@idmwx/idmui-gl4 3.0.6 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3VYIPD3A-92fafc67.js → chunk-3VYIPD3A-2309d6cb.js} +1 -1
- package/dist/{chunk-ANSXOGKI-8ea4f123.js → chunk-ANSXOGKI-b47bfee0.js} +1 -1
- package/dist/{chunk-T4JIPPZO-3d1d10ab.js → chunk-T4JIPPZO-8afc16b4.js} +1 -1
- package/dist/{download-f1b0b34b.js → download-6bd3cac2.js} +3 -3
- package/dist/{index-1599be89.js → index-a6d2c224.js} +19 -19
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/mapbox/src/components/marker/index.vue.d.ts +1 -1
- package/dist/{rasterize-JS5G2XHH-ee90b096.js → rasterize-JS5G2XHH-184e4371.js} +3 -3
- package/dist/{toBlob-c8ab865d.js → toBlob-0139ef9e.js} +3 -3
- package/dist/{toCanvas-d47b66da.js → toCanvas-070d649b.js} +2 -2
- package/dist/{toImg-67e0b4e1.js → toImg-e58e4f8d.js} +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as a } from "./chunk-3VYIPD3A-
|
|
1
|
+
import { W as a } from "./chunk-3VYIPD3A-2309d6cb.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,6 +1,6 @@
|
|
|
1
|
-
import { m as d } from "./chunk-T4JIPPZO-
|
|
2
|
-
import { W as f } from "./chunk-3VYIPD3A-
|
|
3
|
-
import "./index-
|
|
1
|
+
import { m as d } from "./chunk-T4JIPPZO-8afc16b4.js";
|
|
2
|
+
import { W as f } from "./chunk-3VYIPD3A-2309d6cb.js";
|
|
3
|
+
import "./index-a6d2c224.js";
|
|
4
4
|
import "axios";
|
|
5
5
|
import "vuetify";
|
|
6
6
|
import "vue";
|
|
@@ -16482,7 +16482,7 @@ const ku = {
|
|
|
16482
16482
|
return {
|
|
16483
16483
|
right: 10,
|
|
16484
16484
|
toggle: !1,
|
|
16485
|
-
autoActive:
|
|
16485
|
+
autoActive: localStorage.getItem("autoActiveMarkersGL4") === "true" || void 0,
|
|
16486
16486
|
keyword: "",
|
|
16487
16487
|
drawDialog: !1,
|
|
16488
16488
|
importDialog: !1,
|
|
@@ -16520,12 +16520,12 @@ const ku = {
|
|
|
16520
16520
|
},
|
|
16521
16521
|
toggle: {
|
|
16522
16522
|
async handler() {
|
|
16523
|
-
this.toggle;
|
|
16523
|
+
this.toggle && (localStorage.getItem("autoActiveMarkersGL4") || (this.autoActive = !0));
|
|
16524
16524
|
}
|
|
16525
16525
|
},
|
|
16526
16526
|
autoActive: {
|
|
16527
16527
|
async handler() {
|
|
16528
|
-
this.autoActive
|
|
16528
|
+
(this.autoActive === !0 || this.autoActive === !1) && localStorage.setItem("autoActiveMarkersGL4", this.autoActive), this.layerGroup.length === 0 && await this.fetchAllLayers(), this.autoActive ? this.handleDrawAllLayers() : this.handleClearAllLayers();
|
|
16529
16529
|
},
|
|
16530
16530
|
immediate: !0
|
|
16531
16531
|
},
|
|
@@ -20095,52 +20095,52 @@ Se.capture = async (t, e, a) => {
|
|
|
20095
20095
|
if (a !== wr)
|
|
20096
20096
|
throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");
|
|
20097
20097
|
let i = await br(t, e), o = { img: async (u, h) => {
|
|
20098
|
-
let { toImg: f } = await import("./toImg-
|
|
20098
|
+
let { toImg: f } = await import("./toImg-e58e4f8d.js");
|
|
20099
20099
|
return f(i, { ...u, ...h || {} });
|
|
20100
20100
|
}, svg: async (u, h) => {
|
|
20101
|
-
let { toSvg: f } = await import("./toImg-
|
|
20101
|
+
let { toSvg: f } = await import("./toImg-e58e4f8d.js");
|
|
20102
20102
|
return f(i, { ...u, ...h || {} });
|
|
20103
20103
|
}, canvas: async (u, h) => {
|
|
20104
|
-
let { toCanvas: f } = await import("./toCanvas-
|
|
20104
|
+
let { toCanvas: f } = await import("./toCanvas-070d649b.js");
|
|
20105
20105
|
return f(i, { ...u, ...h || {} });
|
|
20106
20106
|
}, blob: async (u, h) => {
|
|
20107
|
-
let { toBlob: f } = await import("./toBlob-
|
|
20107
|
+
let { toBlob: f } = await import("./toBlob-0139ef9e.js");
|
|
20108
20108
|
return f(i, { ...u, ...h || {} });
|
|
20109
20109
|
}, png: async (u, h) => {
|
|
20110
|
-
let { rasterize: f } = await import("./rasterize-JS5G2XHH-
|
|
20110
|
+
let { rasterize: f } = await import("./rasterize-JS5G2XHH-184e4371.js");
|
|
20111
20111
|
return f(i, { ...u, ...h || {}, format: "png" });
|
|
20112
20112
|
}, jpeg: async (u, h) => {
|
|
20113
|
-
let { rasterize: f } = await import("./rasterize-JS5G2XHH-
|
|
20113
|
+
let { rasterize: f } = await import("./rasterize-JS5G2XHH-184e4371.js");
|
|
20114
20114
|
return f(i, { ...u, ...h || {}, format: "jpeg" });
|
|
20115
20115
|
}, webp: async (u, h) => {
|
|
20116
|
-
let { rasterize: f } = await import("./rasterize-JS5G2XHH-
|
|
20116
|
+
let { rasterize: f } = await import("./rasterize-JS5G2XHH-184e4371.js");
|
|
20117
20117
|
return f(i, { ...u, ...h || {}, format: "webp" });
|
|
20118
20118
|
}, download: async (u, h) => {
|
|
20119
|
-
let { download: f } = await import("./download-
|
|
20119
|
+
let { download: f } = await import("./download-6bd3cac2.js");
|
|
20120
20120
|
return f(i, { ...u, ...h || {} });
|
|
20121
20121
|
} }, r = { ...e, export: { url: i }, exports: { svg: async (u) => {
|
|
20122
|
-
let { toSvg: h } = await import("./toImg-
|
|
20122
|
+
let { toSvg: h } = await import("./toImg-e58e4f8d.js");
|
|
20123
20123
|
return h(i, { ...e, ...u || {}, [qe]: !0 });
|
|
20124
20124
|
}, canvas: async (u) => {
|
|
20125
|
-
let { toCanvas: h } = await import("./toCanvas-
|
|
20125
|
+
let { toCanvas: h } = await import("./toCanvas-070d649b.js");
|
|
20126
20126
|
return h(i, { ...e, ...u || {}, [qe]: !0 });
|
|
20127
20127
|
}, png: async (u) => {
|
|
20128
|
-
let { rasterize: h } = await import("./rasterize-JS5G2XHH-
|
|
20128
|
+
let { rasterize: h } = await import("./rasterize-JS5G2XHH-184e4371.js");
|
|
20129
20129
|
return h(i, { ...e, ...u || {}, format: "png", [qe]: !0 });
|
|
20130
20130
|
}, jpeg: async (u) => {
|
|
20131
|
-
let { rasterize: h } = await import("./rasterize-JS5G2XHH-
|
|
20131
|
+
let { rasterize: h } = await import("./rasterize-JS5G2XHH-184e4371.js");
|
|
20132
20132
|
return h(i, { ...e, ...u || {}, format: "jpeg", [qe]: !0 });
|
|
20133
20133
|
}, jpg: async (u) => {
|
|
20134
|
-
let { rasterize: h } = await import("./rasterize-JS5G2XHH-
|
|
20134
|
+
let { rasterize: h } = await import("./rasterize-JS5G2XHH-184e4371.js");
|
|
20135
20135
|
return h(i, { ...e, ...u || {}, format: "jpeg", [qe]: !0 });
|
|
20136
20136
|
}, webp: async (u) => {
|
|
20137
|
-
let { rasterize: h } = await import("./rasterize-JS5G2XHH-
|
|
20137
|
+
let { rasterize: h } = await import("./rasterize-JS5G2XHH-184e4371.js");
|
|
20138
20138
|
return h(i, { ...e, ...u || {}, format: "webp", [qe]: !0 });
|
|
20139
20139
|
}, blob: async (u) => {
|
|
20140
|
-
let { toBlob: h } = await import("./toBlob-
|
|
20140
|
+
let { toBlob: h } = await import("./toBlob-0139ef9e.js");
|
|
20141
20141
|
return h(i, { ...e, ...u || {}, [qe]: !0 });
|
|
20142
20142
|
}, img: async (u) => {
|
|
20143
|
-
let { toImg: h } = await import("./toImg-
|
|
20143
|
+
let { toImg: h } = await import("./toImg-e58e4f8d.js");
|
|
20144
20144
|
return h(i, { ...e, ...u || {}, [qe]: !0 });
|
|
20145
20145
|
} } }, l = await Gg("defineExports", r), c = Object.assign({}, ...l.filter((u) => u && typeof u == "object")), s = { ...o, ...c };
|
|
20146
20146
|
s.jpeg && !s.jpg && (s.jpg = (u, h) => s.jpeg(u, h));
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as n, D as x, L as D, a as T, b as S, M as W, g as f, f as h, P as k, d as y, T as V, V as d, W as u, e as w } from "./index-
|
|
1
|
+
import { c as n, D as x, L as D, a as T, b as S, M as W, g as f, f as h, P as k, d as y, T as V, V as d, W as u, e as w } from "./index-a6d2c224.js";
|
|
2
2
|
import "axios";
|
|
3
3
|
import "vuetify";
|
|
4
4
|
import "vue";
|
package/dist/index.umd.cjs
CHANGED
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
fill="#ffffff" p-id="18386"></path>
|
|
217
217
|
</svg>`,he=document.createElement("div");he.className="idm-tropical-gl4-hourly-marker",he.innerHTML=`<div class="${V.geometry.coordinates[1]>=0?"center north":"center south"}">${re}</div>`;const ge=new ne.Marker(he).setLngLat(V.geometry.coordinates).addTo(this.map);this.interpolateMarkers.push(ge)}this.$emit("tropicalCenterPoints",j)}else(P=this.map)!=null&&P.getSource(this.interpolateSource)&&((G=this.map)==null||G.getSource(this.interpolateSource).setData(this.empty))},handleClick(t){var i,l,n,c,s,d,m,p,u,y,g;const e=t.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:((d=e==null?void 0:e.properties)==null?void 0:d.nameCn)||((m=e==null?void 0:e.properties)==null?void 0:m.name)||"-",Name:((p=e==null?void 0:e.properties)==null?void 0:p.Name)||"-",forecasts:a.map(h=>h.properties),history:(u=r[0])==null?void 0:u.properties,showCircle:(g=(y=a[0])==null?void 0:y.properties)==null?void 0:g.showCircle},this.showTropicalsInfo=!0,this.simple||this.drawTropicalsInfoMaker([t.lngLat.lng,t.lngLat.lat])},drawTropicalsInfoMaker(t){this.$nextTick(()=>{const e=document.getElementById("idm-tropical-gl4-info");this.activeTropicalsMarker?this.activeTropicalsMarker.setLngLat(t).setOffset([220,0]):this.activeTropicalsMarker=new ne.Marker(e).setLngLat(t).setOffset([220,0]).addTo(this.map)})},handleCloseInfoMarker(){this.showTropicalsInfo=!1,this.$nextTick(()=>{var t;(t=this.activeTropicalsMarker)==null||t.remove(),this.activeTropicalsMarker=void 0})},handleForecastToggle(t){var r,i,l,n,c,s;t.disabled=!t.disabled;const e=`${t.name}-${t.model}`,a=(i=(r=this.map)==null?void 0:r.getSource(this.source)._data)==null?void 0:i.features;a.forEach(d=>{d.properties.category===e&&(d.properties.disabled=t.disabled)}),this.interpolateData.forEach(d=>{d.properties.category===e&&(d.properties.disabled=t.disabled)}),(n=(l=this.map)==null?void 0:l.getSource(this.source))==null||n.setData(D.featureCollection(a)),(s=(c=this.map)==null?void 0:c.getSource(this.clusterSource))==null||s.setData(D.featureCollection(a)),this.handleDateChange()},handleStrikeProbability(t){this.$emit("tropicalProbability",t)},handleToggleCircles(t){var e,a;t.showCircle=!t.showCircle,(a=(e=this.tropicals.data)==null?void 0:e.features)==null||a.forEach(r=>{r.properties.name===t.name&&(r.properties.showCircle=t.showCircle)}),this.handleRender()},handleComputePolygons(t){const e=[];for(const a of t){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(t,e,a){var l;const r=[];for(const n in e){const c=e[n]??0;let s;switch(n){case"ne":s=D.lineArc(t,c,0,90,{steps:c>0?32:1,units:"nauticalmiles"});break;case"se":s=D.lineArc(t,c,90,180,{steps:c>0?32:1,units:"nauticalmiles"});break;case"sw":s=D.lineArc(t,c,180,270,{steps:c>0?32:1,units:"nauticalmiles"});break;case"nw":s=D.lineArc(t,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=D.lineString(r);return D.lineToPolygon(i,{properties:a})},handleNotification(t){this.$emit("tropicalNotification",t)},handleHover(t){var i,l,n,c,s;this.map.getCanvas().style.cursor="pointer";const a=this.map.queryRenderedFeatures(t.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(d=>{var m;return d.geometry.type==="LineString"&&d.properties.type==="forecast"&&d.properties.name===((m=a==null?void 0:a.properties)==null?void 0:m.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 d=document.getElementById("tropicalHoverMarkerInfo").cloneNode(!0);this.hoverMarker=new ne.Marker(d).setLngLat(a.geometry.coordinates).setOffset([160,0]).addTo(this.map)}))},handleLeave(){var t;this.map.getCanvas().style.cursor="grab",this.showHoverPoint=!1,(t=this.hoverMarker)==null||t.remove(),this.hoverMarker=void 0}}},Lm={class:"idm-tropical-gl4"},zm={class:"pb-1"},Cm={class:"text-h5 font-weight-600"},vm={key:0,class:"text-h5 font-weight-600"},Sm={class:"text-body-1"},Nm={class:"text-label"},Pm={class:"d-flex justify-space-between align-center"},Vm={class:"w-60"},Mm={class:"text-label pr-1"},Tm={class:"flex-1-1-0"},Dm={class:"text-label pr-1"},Em={class:"py-2 d-flex justify-space-between align-center"},Rm={class:"w-60"},Bm={class:"text-label pr-1"},Im={class:"flex-1-1-0"},Am={class:"text-label pr-1"},Fm={class:"d-flex align-center flex-1-1-100 justify-space-between mt-n1"},Gm={class:"text-label pr-1",style:{width:"70px"}},Wm={class:"model-box d-flex justify-end align-center flex-wrap ga-1 pa-1"},Zm={class:"more"},Om={key:0,class:"w-100 d-flex justify-space-between align-center px-2"},jm={class:"pa-1"},Hm={class:"legend d-flex justify-start align-center py-2"},Xm={class:"label"},Ym={class:"legend d-flex justify-start align-center py-2"},Um={class:"label"},$m={class:"legend d-flex justify-start align-center py-2"},Jm={class:"label"},Km={class:"pa-1"},qm={class:"legend d-flex justify-start align-center py-2"},Qm={class:"label"},ed={class:"legend d-flex justify-start align-center py-2"},td={class:"label"},od={class:"legend d-flex justify-start align-center py-2"},ad={class:"label"},id={class:"pa-1"},rd={class:"w-100 legend d-flex justify-start align-center py-2 ga-2"},ld={class:"label"},nd={class:"label"},sd={class:"w-100 legend d-flex justify-start align-center py-2"},cd={class:"label"},md={class:"w-100 legend d-flex justify-start align-center py-2"},dd={class:"label"},hd={key:1,class:"my-3 w-100",style:{height:"80px"}},pd={class:"legend d-flex justify-start align-center"},gd={class:"label"},ud={class:"legend d-flex justify-start align-center"},fd={class:"label"},yd={class:"legend d-flex justify-start align-center"},bd={class:"label"},wd={class:"legend d-flex justify-start align-center"},xd={class:"label"},kd={class:"legend d-flex justify-start align-center"},_d={class:"label"},Ld={class:"legend d-flex justify-start align-center"},zd={class:"label"},Cd={class:"legend d-flex justify-start align-center"},vd={class:"label"},Sd={class:"legend d-flex justify-start align-center"},Nd={class:"label"},Pd={class:"legend d-flex justify-start align-center"},Vd={class:"label"},Md={class:"legend d-flex justify-start align-center"},Td={class:"label"},Dd={class:"d-flex justify-star align-center"},Ed={class:"font-weight-600 mr-1"},Rd={class:""},Bd={class:"port-box d-flex flex-column justify-center align-start ga-2"},Id={key:0,class:"d-flex justify-start align-center"},Ad={class:"text-label pr-1"},Fd={key:1,class:"d-flex justify-start align-center"},Gd={class:"text-label pr-1"},Wd={key:2,class:"d-flex justify-start align-center"},Zd={class:"text-label pr-1"},Od={key:3,class:"d-flex justify-start align-center"},jd={class:"text-label pr-1"},Hd={key:4,class:"d-flex justify-start align-center"},Xd={class:"text-label pr-1"},Yd={key:5,class:"d-flex justify-start align-center"},Ud={class:"text-label pr-1"},$d={class:"d-flex justify-start align-center"},Jd={class:"text-label pr-1"},Kd={key:6,class:"d-flex justify-start align-center"},qd={class:"text-label pr-1"},Qd={key:7,class:"d-flex justify-start align-center"},eh={class:"text-label pr-1"},th={class:"d-flex justify-start align-center"},oh={class:"text-label pr-1"};function ah(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("VTooltip"),s=o.resolveComponent("VCardText"),d=o.resolveComponent("VDivider"),m=o.resolveComponent("VCardActions"),p=o.resolveComponent("VCard"),u=o.resolveComponent("v-card-title"),y=o.resolveComponent("v-divider");return o.openBlock(),o.createElementBlock("div",Lm,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+86+"px",right:i.right+"px"})},[o.createVNode(c,{text:t.$t("tropical.tropicals"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:g})=>[o.createVNode(n,o.mergeProps(g,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[2]||(e[2]=[o.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&&!t.$attrs.hideTropicalsLegend?(o.openBlock(),o.createElementBlock("div",{key:0,ref:"tropicalsInfo",id:"idm-tropical-gl4-info",class:o.normalizeClass(["idm-tropical-gl4-info",a.simple?"page":"dialog"])},[o.createVNode(p,{class:o.normalizeClass(["w-100",a.simple?"rounded-t-4 bg-none":""]),elevation:a.simple?0:16},{default:o.withCtx(()=>[o.createVNode(s,null,{default:o.withCtx(()=>{var g,h,f,w,z,b,L,x,k,C,S,N;return[o.createElementVNode("div",zm,[o.createElementVNode("span",Cm,o.toDisplayString(a.locale==="en"?(g=i.activeTropicals)==null?void 0:g.Name:((h=i.activeTropicals)==null?void 0:h.nameCn)||((f=i.activeTropicals)==null?void 0:f.Name)||"-"),1),(z=(w=i.activeTropicals)==null?void 0:w.history)!=null&&z.levelI18n?(o.openBlock(),o.createElementBlock("span",vm," , "+o.toDisplayString(t.$t("tropical."+((L=(b=i.activeTropicals)==null?void 0:b.history)==null?void 0:L.levelI18n))),1)):o.createCommentVNode("",!0)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"close",onClick:o.withModifiers(l.handleCloseInfoMarker,["stop"])},{default:o.withCtx(()=>e[3]||(e[3]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[3]},8,["onClick"]),o.createElementVNode("div",Sm,[o.createElementVNode("span",Nm,o.toDisplayString(t.$t("actions.lastUpdate"))+": ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTime(((k=(x=i.activeTropicals)==null?void 0:x.history)==null?void 0:k.updated)||((N=(S=(C=i.activeTropicals)==null?void 0:C.forecasts)==null?void 0:S.filter(T=>!T.disabled)[0])==null?void 0:N.date),a.timeZone)),1)])]}),_:1}),o.createVNode(d),o.createVNode(s,{class:"text-body-1 py-3"},{default:o.withCtx(()=>{var g,h,f,w,z,b,L,x,k;return[o.createElementVNode("div",Pm,[o.createElementVNode("div",Vm,[o.createElementVNode("label",Mm,o.toDisplayString(t.$t("weather.windSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((h=(g=i.activeTropicals)==null?void 0:g.history)==null?void 0:h.kts)||"-")+" kts",1),o.createElementVNode("span",null,", BF "+o.toDisplayString(l.computeBF(((w=(f=i.activeTropicals)==null?void 0:f.history)==null?void 0:w.kts)||"-")),1)]),o.createElementVNode("div",Tm,[o.createElementVNode("label",Dm,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((b=(z=i.activeTropicals)==null?void 0:z.history)==null?void 0:b.pressure)||"-")+" hPa",1)])]),o.createElementVNode("div",Em,[o.createElementVNode("div",Rm,[o.createElementVNode("label",Bm,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((L=l.computeMovement(i.activeTropicals))==null?void 0:L.kts)||"-")+" kts",1)]),o.createElementVNode("div",Im,[o.createElementVNode("label",Am,o.toDisplayString(t.$t("tropical.moveDir"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((x=l.computeMovement(i.activeTropicals))==null?void 0:x.deg)||"-")+"°",1)])]),o.createElementVNode("div",Fm,[o.createElementVNode("label",Gm,o.toDisplayString(t.$t("tropical.models"))+" : ",1),o.createElementVNode("div",Wm,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList((k=i.activeTropicals)==null?void 0:k.forecasts,(C,S)=>(o.openBlock(),o.createBlock(n,{key:S,density:"compact",variant:C.disabled?"text":"flat",color:C.disabled?"":"primary","min-width":30,class:o.normalizeClass(["model text-none text-body-1 px-1",C.disabled?"btn-border-1 btn-bg-1":""]),onClick:o.withModifiers(N=>l.handleForecastToggle(C),["stop"])},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C.model),1)]),_:2},1032,["variant","color","class","onClick"]))),128))])])]}),_:1}),o.createVNode(d),a.simple?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(m,{key:0,class:"d-flex justify-space-between"},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact","prepend-icon":"",variant:"text",color:i.showLegend?"primary":"",class:"text-none text-body-1",onClick:e[0]||(e[0]=o.withModifiers(g=>i.showLegend=!i.showLegend,["stop"]))},{prepend:o.withCtx(()=>e[4]||(e[4]=[o.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(" "+o.toDisplayString(t.$t("weather.legend")),1)]),_:1},8,["color"]),o.createElementVNode("div",Zm,[o.createVNode(n,{variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:e[1]||(e[1]=o.withModifiers(g=>l.handleStrikeProbability(i.activeTropicals),["stop"]))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.viewReport")),1)]),_:1})])]),_:1}))]),_:1},8,["class","elevation"]),a.simple?(o.openBlock(),o.createElementBlock("div",Om,[o.createElementVNode("div",jm,[o.createElementVNode("div",Hm,[e[5]||(e[5]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",Xm,o.toDisplayString(t.$t("tropical.td")),1)]),o.createElementVNode("div",Ym,[e[6]||(e[6]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",Um,o.toDisplayString(t.$t("tropical.sts")),1)]),o.createElementVNode("div",$m,[e[7]||(e[7]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",Jm,o.toDisplayString(t.$t("tropical.sty")),1)])]),o.createElementVNode("div",Km,[o.createElementVNode("div",qm,[e[8]||(e[8]=o.createElementVNode("div",{class:"icon ts"},null,-1)),o.createElementVNode("div",Qm,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",ed,[e[9]||(e[9]=o.createElementVNode("div",{class:"icon ty"},null,-1)),o.createElementVNode("div",td,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",od,[e[10]||(e[10]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",ad,o.toDisplayString(t.$t("tropical.superTy")),1)])]),o.createElementVNode("div",id,[o.createElementVNode("div",rd,[e[11]||(e[11]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",ld,o.toDisplayString(t.$t("tropical.history")),1),e[12]||(e[12]=o.createElementVNode("div",{class:"icon forecast"},null,-1)),o.createElementVNode("div",nd,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",sd,[e[13]||(e[13]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",cd,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",md,[e[14]||(e[14]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",dd,"50kts "+o.toDisplayString(t.$t("tropical.radii")),1)])])])):(o.openBlock(),o.createElementBlock("div",hd,[o.withDirectives(o.createVNode(p,{elevation:"16"},{default:o.withCtx(()=>[o.createVNode(s,null,{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",{class:o.normalizeClass(["pa-1 d-flex justify-space-between align-center flex-wrap",a.locale==="zhHans"?" ga-2":" ga-3"])},[o.createElementVNode("div",pd,[e[15]||(e[15]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",gd,o.toDisplayString(t.$t("tropical.td")),1)]),o.createElementVNode("div",ud,[e[16]||(e[16]=o.createElementVNode("div",{class:"icon ts"},null,-1)),o.createElementVNode("div",fd,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",yd,[e[17]||(e[17]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",bd,o.toDisplayString(t.$t("tropical.sts")),1)]),o.createElementVNode("div",wd,[e[18]||(e[18]=o.createElementVNode("div",{class:"icon ty"},null,-1)),o.createElementVNode("div",xd,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",kd,[e[19]||(e[19]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",_d,o.toDisplayString(t.$t("tropical.sty")),1)]),o.createElementVNode("div",Ld,[e[20]||(e[20]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",zd,o.toDisplayString(t.$t("tropical.superTy")),1)]),o.createElementVNode("div",Cd,[e[21]||(e[21]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",vd,o.toDisplayString(t.$t("tropical.history")),1)]),o.createElementVNode("div",Sd,[e[22]||(e[22]=o.createElementVNode("div",{class:"icon forecast"},null,-1)),o.createElementVNode("div",Nd,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",Pd,[e[23]||(e[23]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",Vd,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",Md,[e[24]||(e[24]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",Td,"50kts "+o.toDisplayString(t.$t("tropical.radii")),1)])],2),[[o.vShow,i.showLegend]])]),_:1})]),_:1},512),[[o.vShow,i.showLegend]])]))],2)):o.createCommentVNode("",!0),o.withDirectives(o.createVNode(p,{id:"tropicalHoverMarkerInfo",elevation:"16","max-width":"280"},{default:o.withCtx(()=>[o.createVNode(u,null,{default:o.withCtx(()=>{var g,h,f,w;return[o.createElementVNode("div",Dd,[o.createElementVNode("span",Ed,o.toDisplayString(a.locale==="en"?(g=i.hoverPoint)==null?void 0:g.Name:((h=i.hoverPoint)==null?void 0:h.nameCn)||((f=i.hoverPoint)==null?void 0:f.Name)),1),o.createElementVNode("span",Rd," ["+o.toDisplayString(t.$t("tropical."+((w=i.hoverPoint)==null?void 0:w.levelI18n)))+"]",1)])]}),_:1}),o.createVNode(y),o.createVNode(s,{class:"text-body-1"},{default:o.withCtx(()=>{var g,h,f,w,z,b,L,x,k,C,S,N,T,B,E,Z,X,$,ae,P;return[o.createElementVNode("div",Bd,[((g=i.hoverPoint)==null?void 0:g.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Id,[o.createElementVNode("label",Ad,o.toDisplayString(t.$t("tropical.updated"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((h=i.hoverPoint)==null?void 0:h.update,a.timeZone)),1)])):o.createCommentVNode("",!0),((f=i.hoverPoint)==null?void 0:f.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Fd,[o.createElementVNode("label",Gd,o.toDisplayString(t.$t("tropical.forecast"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((w=i.hoverPoint)==null?void 0:w.date,a.timeZone)),1)])):o.createCommentVNode("",!0),((z=i.hoverPoint)==null?void 0:z.type)==="history"?(o.openBlock(),o.createElementBlock("div",Wd,[o.createElementVNode("label",Zd,o.toDisplayString(t.$t("tropical.forecast"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((b=i.hoverPoint)==null?void 0:b.date,a.timeZone)),1)])):o.createCommentVNode("",!0),((L=i.hoverPoint)==null?void 0:L.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Od,[o.createElementVNode("label",jd,o.toDisplayString(t.$t("tropical.model"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((x=i.hoverPoint)==null?void 0:x.model)??"-"),1)])):o.createCommentVNode("",!0),((k=i.hoverPoint)==null?void 0:k.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Hd,[o.createElementVNode("label",Xd,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((S=JSON.parse((C=i.hoverPoint)==null?void 0:C.wind))==null?void 0:S.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),((N=i.hoverPoint)==null?void 0:N.type)==="history"?(o.openBlock(),o.createElementBlock("div",Yd,[o.createElementVNode("label",Ud,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((T=i.hoverPoint)==null?void 0:T.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),o.createElementVNode("div",$d,[o.createElementVNode("label",Jd,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((B=i.hoverPoint)==null?void 0:B.pressure)??"-")+" hPa",1)]),((E=i.hoverPoint)==null?void 0:E.type)==="history"?(o.openBlock(),o.createElementBlock("div",Kd,[o.createElementVNode("label",qd,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((X=JSON.parse((Z=i.hoverPoint)==null?void 0:Z.movement))==null?void 0:X.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),(($=i.hoverPoint)==null?void 0:$.type)==="history"?(o.openBlock(),o.createElementBlock("div",Qd,[o.createElementVNode("label",eh,o.toDisplayString(t.$t("tropical.moveDir"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((P=JSON.parse((ae=i.hoverPoint)==null?void 0:ae.movement))==null?void 0:P.deg)??"-")+" °",1)])):o.createCommentVNode("",!0),o.createElementVNode("div",th,[o.createElementVNode("label",oh,o.toDisplayString(t.$t("tropical.position"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computePosition(i.hoverPoint)),1)])])]}),_:1})]),_:1},512),[[o.vShow,i.showHoverPoint]])])}const Ho=Y(_m,[["render",ah]]),Ry="",ih={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 t=this.width||220;if(this.position==="top")return{bottom:"40px",left:`-${(420-t)/2}px`};if(this.position==="bottom")return{top:"40px",left:`-${(420-t)/2}px`};if(this.position==="left")return{bottom:"-140px",left:"-428px"};if(this.position==="right")return{bottom:"-140px",right:"-428px"}},hourOptions(){const t=[];for(let e=0;e<24;e++)t.push(e<10?`0${e}:00`:`${e}:00`);return t.filter((e,a)=>(a-this.timeZone)%this.intervalHour===0)},timeZoneNames(){return v.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:t[0]},utcTimeZoneName(){return"Africa/Abidjan"},localTimeZoneName(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai"}},watch:{timeZone:{handler(t,e){t!==e&&(this.handleResetDateTime(this.dateTime),this.handleResetMinMax())}},dateTime:{handler(t,e){t&&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(t,e){t!==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(t){var i;const e=v(t).utc().date(),a=Math.ceil(v(t).utc().hour()/this.intervalHour)*this.intervalHour;this.currentTimestamp=((i=v(t))==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||!this.dayAbout.f)return;const t=v().utc().date(),e=Math.ceil(v().utc().hour()/this.intervalHour)*this.intervalHour,a=((i=v())==null?void 0:i.utc().set({date:t,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:t+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:t+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(t){const e=t||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 t=v(this.currentDate).format("yyyy-MM-DD"),e=this.currentTime,a=`${t} ${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 t=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=t.clone().format("YYYY-MM-DD"),this.currentTime=t.clone().format("HH:00")},handleClickOutside(t){const e=this.$refs.idmGl4Timepicker;e&&!e.contains(t.target)&&(this.showDatePicker=!1)}}},rh={class:"idm-gl4-time-picker",ref:"idmGl4Timepicker"},lh={class:"pa-0",style:{width:"320px"}},nh={class:"h-100 pa-0 d-flex flex-column justify-start align-center",style:{width:"100px"}},sh={class:"d-flex justify-center align-center text-body-2",style:{height:"44px"}};function ch(t,e,a,r,i,l){const n=o.resolveComponent("VDatePicker"),c=o.resolveComponent("VDivider"),s=o.resolveComponent("VListItemTitle"),d=o.resolveComponent("VListItem"),m=o.resolveComponent("VList"),p=o.resolveComponent("VCardText"),u=o.resolveComponent("VBtn"),y=o.resolveComponent("VCardActions"),g=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",rh,[o.createElementVNode("div",{style:o.normalizeStyle({height:a.height+"px",width:a.width?a.width+"px":"auto"}),class:o.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))},o.toDisplayString(i.currentDateTime)+" | UTC "+o.toDisplayString(a.timeZone<0?a.timeZone:"+"+a.timeZone),7),i.showDatePicker?(o.openBlock(),o.createBlock(g,{key:0,class:"card-box d-flex flex-column border elevation-12",style:o.normalizeStyle(l.getStyle)},{default:o.withCtx(()=>[o.createVNode(p,{class:"w-100 flex-1-1-0 d-flex pa-0 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",lh,[o.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"])]),o.createVNode(c,{class:"h-100",vertical:""}),o.createElementVNode("div",nh,[o.createElementVNode("div",sh,o.toDisplayString(t.$t("time.time")),1),o.createVNode(m,{class:"pa-0 flex-1-1-0 scroll"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.hourOptions,(h,f)=>(o.openBlock(),o.createBlock(d,{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:o.withCtx(()=>[o.createVNode(s,{class:"text-body-2 font-weight-600 text-center",onClick:w=>i.currentTime=h},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(h),1)]),_:2},1032,["onClick"])]),_:2},1032,["value","active","variant"]))),128))]),_:1})])]),_:1}),o.createVNode(c),o.createVNode(y,{class:"w-100 d-flex justify-end align-center px-4 ga-4",style:{height:"50px"}},{default:o.withCtx(()=>[o.createVNode(u,{size:"small",variant:"tonal",class:"text-none text-body-1 px-4",onClick:l.handleCancelDate},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(u,{size:"small",variant:"flat",color:"primary",class:"text-none text-body-1 px-4",onClick:l.handleConfirmDate},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["onClick"])]),_:1})]),_:1},8,["style"])):o.createCommentVNode("",!0)],512)}const qe=Y(ih,[["render",ch]]),By="",mh={name:"IdmPoint",components:{DateTimePicker:qe},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}},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:[t=>t!=null&&t!==""||"required",t=>/^\d{1,3}$/.test(t)||"number",t=>parseInt(t)>=0&&parseInt(t)<=180||"0 ~ 180"],lngMinute:[t=>t===void 0||t===null&&t===""||/^\d{1,2}(\.\d+)?$/.test(t)||"number",t=>t===void 0||t===null&&t===""||parseInt(t)>=0&&parseInt(t)<=59||"0 ~ 59"],latDegree:[t=>t!=null&&t!==""||"required",t=>/^\d{1,2}$/.test(t)||"number",t=>parseInt(t)>=0&&parseInt(t)<=90||"0 ~ 90"],latMinute:[t=>t===void 0||t===null&&t===""||/^\d{1,2}(\.\d+)?$/.test(t)||"number",t=>t===void 0||t===null&&t===""||parseInt(t)>=0&&parseInt(t)<=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 t;return(t=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:t[0]},computedTzTime(){return t=>v.tz(v(t),this.timeZoneName).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(this.timeZone>=0?"+":"")+this.timeZone+")"},computedLocalTime(){return t=>{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(1))==="+")?1:-1),a=(l=this.timeZoneNames.filter(n=>v.tz(v(),n).utcOffset()===e*60))==null?void 0:l[0];return t?v.tz(v(t),a).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(e>=0?"+":"")+e+")":"-"}},computePosition(){return function(t){return!t||t.lng===null||t.lng===void 0||isNaN(t.lng)||t.lat===null||t.lat===void 0||isNaN(t.lat)?"-":M.LngLatHelper.lat2pretty(t==null?void 0:t.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(t==null?void 0:t.lng,2).pretty}},computeRoundPrecision(){return function(t,e=4){return t==null||isNaN(t)||isNaN(e)?"-":M.LngLatHelper.roundPrecision(t,e)}}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.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.toggle=!1,this.map&&this.toggle&&this.handleBind()}},showForm:{handler(){this.showForm?this.$nextTick(()=>{var t;(t=this.$refs.spotForm)==null||t.resetValidation()}):this.handleCloseForm()}},showMeteo:{handler(){var t,e,a,r,i,l;this.showMeteo?((a=(e=(t=this.$parent)==null?void 0:t.$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(t,e){!t&&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 t=>{t!=null&&t.valid&&this.fetchData()})},cancelForm(){var t;(t=this.$refs.spotForm)==null||t.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 t=v();((a=v(this.realTime))==null?void 0:a.diff(t,"d",!0))>=0?await this.fetchForecastData(this.form):await this.fetchHistoryData(this.form)},async fetchForecastData(t){this.loading=!0,this.showMeteo=!0,this.form.lng=t.lng,this.form.lat=t.lat,this.form.followId=t.followId,this.handleDrawInfoMarker([t.lng,t.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Ae.Meteo2Assist.autoPickMeteoModel(t.forecastModel);let r={lat:t.lat,lng:t.lng,datetime:v(t.dateTime).utc().format(),forecastDays:t.day??3,weatherModels:e,marineModels:a};await le.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=t.lng,this.meteoData.lat=t.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1})},async fetchHistoryData(t){this.loading=!0,this.showMeteo=!0,this.form.lng=t.lng,this.form.lat=t.lat,this.form.followId=t.followId,this.handleDrawInfoMarker([t.lng,t.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Ae.Meteo2Assist.autoPickMeteoModel(t.forecastModel),r={lat:t.lat,lng:t.lng,datetime:v(t.dateTime).utc().format(),forecastDays:2,pastDays:1,weatherModels:e,marineModels:a};await le.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=t.lng,this.meteoData.lat=t.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1}),this.loading=!1},initTableData(t){var a,r,i,l,n,c,s,d,m,p,u,y,g,h,f,w,z,b,L,x,k,C,S,N,T,B,E,Z,X,$,ae,P,G,W,U,A,I,j,V,q,re;this.currentHourData={},this.positionGmt=(r=(a=t==null?void 0:t.weather)==null?void 0:a[0])==null?void 0:r.timezone,this.positionOffset=(l=(i=t==null?void 0:t.weather)==null?void 0:i[0])==null?void 0:l.offset;const e=((n=Ae.Meteo2Assist.pickHourly(t,v(this.form.dateTime)))==null?void 0:n[0])||{};this.currentHourData.utc=e.utc,this.currentHourData.lat=t.lat,this.currentHourData.lng=t.lng,this.currentHourData.temp=this.computeRoundPrecision((c=e==null?void 0:e.weather)==null?void 0:c.temp,0)??"-",this.currentHourData.precipProbability=this.computeRoundPrecision((d=(s=e==null?void 0:e.weather)==null?void 0:s.precip)==null?void 0:d.probability,0)??"-",this.currentHourData.precip1h=this.computeRoundPrecision((p=(m=e==null?void 0:e.weather)==null?void 0:m.precip)==null?void 0:p.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((g=(y=e==null?void 0:e.weather)==null?void 0:y.wind)==null?void 0:g.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((z=(w=e==null?void 0:e.weather)==null?void 0:w.wind)==null?void 0:z.scale,0)??"-",this.currentHourData.windGust=this.computeRoundPrecision((L=(b=e==null?void 0:e.weather)==null?void 0:b.wind)==null?void 0:L.gusts,1)??"-",this.currentHourData.sigwaveHeight=this.computeRoundPrecision((k=(x=e==null?void 0:e.wave)==null?void 0:x.sig)==null?void 0:k.height,1)??"-",this.currentHourData.sigwaveDir=(S=(C=e==null?void 0:e.wave)==null?void 0:C.sig)==null?void 0:S.direction,this.currentHourData.sigwavePeriod=this.computeRoundPrecision((T=(N=e==null?void 0:e.wave)==null?void 0:N.sig)==null?void 0:T.period,1)??"-",this.currentHourData.windwaveHeight=this.computeRoundPrecision((E=(B=e==null?void 0:e.wave)==null?void 0:B.wd)==null?void 0:E.height,1)??"-",this.currentHourData.windwaveDir=(X=(Z=e==null?void 0:e.wave)==null?void 0:Z.wd)==null?void 0:X.direction,this.currentHourData.windwavePeriod=this.computeRoundPrecision((ae=($=e==null?void 0:e.wave)==null?void 0:$.wd)==null?void 0:ae.period,1)??"-",this.currentHourData.swellHeight=this.computeRoundPrecision((G=(P=e==null?void 0:e.wave)==null?void 0:P.swell)==null?void 0:G.height,1)??"-",this.currentHourData.swellDir=(U=(W=e==null?void 0:e.wave)==null?void 0:W.swell)==null?void 0:U.direction,this.currentHourData.swellPeriod=this.computeRoundPrecision((I=(A=e==null?void 0:e.wave)==null?void 0:A.swell)==null?void 0:I.period,1)??"-",this.currentHourData.currentSpeed=this.computeRoundPrecision((j=e==null?void 0:e.current)==null?void 0:j.speed,1)??"-",this.currentHourData.currentDir=(V=e==null?void 0:e.current)==null?void 0:V.direction,this.currentHourData.currentSpeed=this.computeRoundPrecision((q=e==null?void 0:e.current)==null?void 0:q.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=(re=e==null?void 0:e.weather)==null?void 0:re.url},handleBind(){var t,e;this.toggle?((t=this.map)==null||t.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(t){if(t.originalEvent.stopPropagation(),t.originalEvent.target.className==="mapboxgl-canvas")this.handleGetPosition(t.lngLat),this.$nextTick(()=>{this.fetchData()});else return!1},handleGetPosition(t){if(isNaN(t.lat)||isNaN(t.lng))return!1;this.form.latDegree=Number(M.LngLatHelper.lat2pretty(t.lat).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(t.lat).minute),this.form.latDirection=M.LngLatHelper.lat2pretty(t.lat).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(t.lng).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(t.lng).minute),this.form.lngDirection=M.LngLatHelper.lng2pretty(t.lng).direction},handleDrawInfoMarker(t){this.drawPositionMarker(t),this.simple||this.drawMeteoInfoMarker(t)},drawPositionMarker(t){t&&(this.map.flyTo({center:t,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 ne.Marker(e).setLngLat(t).setOffset([0,-15]).addTo(this.map)}))},drawMeteoInfoMarker(t){this.$nextTick(()=>{var a;const e=document.getElementById("idm-gl4-spot-meteo");this.meteoInfoMarker?(a=this.meteoInfoMarker)==null||a.setLngLat(t):this.meteoInfoMarker=new ne.Marker(e).setLngLat(t).setOffset([0,-190]).addTo(this.map)})},handleMeteoMore(){this.form.forecastModel=this.forecastModel,this.$emit("meteoMore",this.form)},handleCloseMeteo(){this.showMeteo=!1,this.$nextTick(()=>{var t,e;(t=this.positionMarker)==null||t.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 t=((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",t)}}},dh={class:"idm-gl4-spot"},hh={class:"d-flex justify-start align-center"},ph={class:"text-h6 font-weight-600"},gh={class:"d-flex justify-start align-center ga-1 mb-2"},uh={class:"text-label"},fh={class:"d-flex justify-start align-center ga-1 mb-2"},yh={class:"text-label"},bh={class:"d-flex justify-start align-center ga-1 mb-2"},wh={class:"text-label"},xh={class:"d-flex justify-start align-center ga-1 mb-2"},kh={class:"text-label"},_h={class:"d-flex justify-start align-center"},Lh={class:"mx-2"},zh={class:"mx-0 py-2 d-flex align-center justify-start"},Ch={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},vh={class:"pa-0 px-0"},Sh={class:"mx-0 py-2 d-flex align-center justify-start"},Nh={cols:"9",class:"pa-0 px-0"},Ph={class:"mx-0 py-2 d-flex align-center justify-start"},Vh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Mh={style:{width:"150px"},class:"pa-0 text-left"},Th={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Dh={cols:"3",class:"pa-0 px-0 text-left"},Eh={class:"mx-0 py-2 d-flex align-center justify-start"},Rh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Bh={style:{width:"150px"},class:"pa-0 text-left"},Ih={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Ah={cols:"3",class:"pa-0 text-left"},Fh={class:"mx-0 py-2 d-flex align-center justify-start"},Gh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Wh={style:{width:"150px"},class:"pa-0 text-left"},Zh={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Oh={class:"pa-0 text-left"},jh={class:"d-flex justify-space-between align-center"},Hh={class:"d-flex justify-start align-center"},Xh={class:"mx-1"},Yh={class:"d-flex justify-end align-center"},Uh={class:"mx-0 py-1 d-flex align-center justify-start"},$h={style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},Jh={class:"pa-0 px-0"},Kh={class:"mx-0 py-1 d-flex align-center justify-start"},qh={class:"pa-0 px-0"},Qh={class:"gray-bg-2 mx-4 my-2 py-3 px-2 rounded text-font-13 d-flex align-center justify-space-between"},ep={class:"d-flex flex-column align-start justify-center ga-3"},tp={class:"text-label pr-2"},op={class:"text-label pr-2"},ap={class:"text-label pr-2"},ip={class:"d-flex flex-column align-start justify-center ga-3"},rp={class:"text-label pr-2"},lp={class:"text-label pr-2"},np={class:"text-label pr-2"},sp={id:"idm-position-icon"},cp={class:"multi-color-icon",style:{height:"30px",width:"30px"},"aria-hidden":"true"},mp=["xlink:href"];function dp(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("VTooltip"),s=o.resolveComponent("VCardTitle"),d=o.resolveComponent("VDivider"),m=o.resolveComponent("VTextField"),p=o.resolveComponent("VCol"),u=o.resolveComponent("VRow"),y=o.resolveComponent("DateTimePicker"),g=o.resolveComponent("VBtnToggle"),h=o.resolveComponent("VCardText"),f=o.resolveComponent("VCardActions"),w=o.resolveComponent("VForm"),z=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",dh,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+"px"})},[o.createVNode(c,{text:t.$t("spot.spotsMeteo"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:b})=>[o.createVNode(n,o.mergeProps(b,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[8]||(e[8]=[o.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?(o.openBlock(),o.createBlock(z,{key:0,class:"spot-form-card",style:o.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+50+"px"})},{default:o.withCtx(()=>[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("div",hh,[o.createElementVNode("div",ph,o.toDisplayString(t.$t("spot.spotWeather")),1)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleCloseForm},{default:o.withCtx(()=>e[9]||(e[9]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),o.createVNode(d),o.createVNode(w,{ref:"spotForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.submitForm,["prevent"])},{default:o.withCtx(()=>[o.createVNode(h,{class:"text-body-1 pa-4"},{default:o.withCtx(()=>[o.createElementVNode("div",gh,[o.createElementVNode("div",uh,[o.createTextVNode(o.toDisplayString(t.$t("spot.lat")),1),e[10]||(e[10]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(u,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(p,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.latDegree,"onUpdate:modelValue":e[0]||(e[0]=b=>i.form.latDegree=b),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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[11]}),o.createVNode(p,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.latMinute,"onUpdate:modelValue":e[1]||(e[1]=b=>i.form.latMinute=b),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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[12]}),o.createVNode(p,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.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]=b=>i.form.latDirection=i.form.latDirection==="N"?"S":"N")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.latDirection),1)]),_:1})]),_:1})]),_:1}),o.createElementVNode("div",fh,[o.createElementVNode("div",yh,[o.createTextVNode(o.toDisplayString(t.$t("spot.lng")),1),e[13]||(e[13]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(u,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(p,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.lngDegree,"onUpdate:modelValue":e[3]||(e[3]=b=>i.form.lngDegree=b),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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[14]}),o.createVNode(p,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.lngMinute,"onUpdate:modelValue":e[4]||(e[4]=b=>i.form.lngMinute=b),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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[15]}),o.createVNode(p,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.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.lngDirection=i.form.lngDirection==="E"?"W":"E")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.lngDirection),1)]),_:1})]),_:1})]),_:1}),o.createElementVNode("div",bh,[o.createElementVNode("div",wh,[o.createTextVNode(o.toDisplayString(t.$t("spot.dateTime")),1),e[16]||(e[16]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(u,{class:"ma-0 mb-4"},{default:o.withCtx(()=>[o.createVNode(p,{cols:"12",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(y,o.mergeProps({"date-time":i.form.dateTime,"time-zone":a.timeZone},t.$attrs,{onDateTime:e[6]||(e[6]=b=>i.form.dateTime=b)}),null,16,["date-time","time-zone"])]),_:1})]),_:1}),o.createElementVNode("div",xh,[o.createElementVNode("div",kh,[o.createTextVNode(o.toDisplayString(t.$t("weather.forecastModel")),1),e[17]||(e[17]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(u,{class:"ma-0 mb-2"},{default:o.withCtx(()=>[o.createVNode(p,{cols:"12",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(g,{modelValue:i.form.forecastModel,"onUpdate:modelValue":e[7]||(e[7]=b=>i.form.forecastModel=b),class:"w-100",rounded:"",height:"30",density:"compact",group:""},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact",height:"30",value:"GFS",class:o.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:o.withCtx(()=>e[18]||(e[18]=[o.createTextVNode("NOAA",-1)])),_:1,__:[18]},8,["class","color"]),o.createVNode(n,{density:"compact",height:"30",class:o.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:o.withCtx(()=>e[19]||(e[19]=[o.createTextVNode("ECMWF",-1)])),_:1,__:[19]},8,["class","color"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),o.createVNode(d),o.createVNode(f,{class:"d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(n,{size:"small",variant:"tonal",class:"text-none text-body-1 btn-bg-1",onClick:l.cancelForm},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(n,{ref:"submitSpot",loading:i.loading,size:"small",variant:"flat",color:"primary",type:"submit",class:"text-none text-body-1"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1},8,["style"])):o.createCommentVNode("",!0),i.showMeteo&&!a.simple?(o.openBlock(),o.createBlock(z,{key:1,id:"idm-gl4-spot-meteo",class:"spot-meteo",style:{width:"490px","z-index":"9"}},{default:o.withCtx(()=>[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("div",_h,[e[20]||(e[20]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",Lh,o.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),o.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:o.withModifiers(l.handleCloseMeteo,["stop"])},{default:o.withCtx(()=>e[21]||(e[21]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]),_:1}),o.createVNode(d),o.createVNode(h,{class:"text-body-1 px-0 py-1"},{default:o.withCtx(()=>{var b,L;return[o.createElementVNode("div",zh,[o.createElementVNode("div",Ch,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",vh,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",Sh,[e[22]||(e[22]=o.createElementVNode("div",{style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",Nh,o.toDisplayString(l.computedLocalTime((L=i.currentHourData)==null?void 0:L.utc)),1)]),o.createElementVNode("div",Ph,[o.createElementVNode("div",Vh,o.toDisplayString(t.$t("weather.wind")),1),o.createElementVNode("div",Mh,o.toDisplayString(i.currentHourData.windDir??"-")+"/"+o.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+o.toDisplayString(i.currentHourData.windLevel??"-"),1),o.createElementVNode("div",Th,o.toDisplayString(t.$t("weather.sigWave")),1),o.createElementVNode("div",Dh,o.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),o.createElementVNode("div",Eh,[o.createElementVNode("div",Rh,o.toDisplayString(t.$t("weather.windWave")),1),o.createElementVNode("div",Bh,o.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1),o.createElementVNode("div",Ih,o.toDisplayString(t.$t("weather.swell")),1),o.createElementVNode("div",Ah,o.toDisplayString(i.currentHourData.swellDir??"-")+"/"+o.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),o.createElementVNode("div",Fh,[o.createElementVNode("div",Gh,o.toDisplayString(t.$t("weather.current")),1),o.createElementVNode("div",Wh,o.toDisplayString(i.currentHourData.currentDir??"-")+"/"+o.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1),o.createElementVNode("div",Zh,o.toDisplayString(t.$t("weather.visibility")),1),o.createElementVNode("div",Oh,o.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)])]}),_:1}),o.createVNode(d),o.createVNode(f,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var b;return[(b=a.followList)!=null&&b.some(L=>{var x,k;return(L==null?void 0:L.id)===i.form.followId||((x=L==null?void 0:L.coordinate)==null?void 0:x.lng)===i.form.lng&&((k=L==null?void 0:L.coordinate)==null?void 0:k.lat)===i.form.lat})?(o.openBlock(),o.createBlock(n,{key:0,class:"text-none text-body-1",id:"idm-gl4-spot-meteo-follow",variant:"text",density:"compact",height:"32",onClick:o.withModifiers(l.handleCancelFollow,["stop"])},{prepend:o.withCtx(()=>e[23]||(e[23]=[o.createElementVNode("i",{class:"iconfont icon-yishoucang text-h6 text-warning"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(" "+o.toDisplayString(t.$t("actions.unfollow")),1)]),_:1},8,["onClick"])):(o.openBlock(),o.createBlock(n,{key:1,id:"idm-gl4-spot-meteo-unfollow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:o.withModifiers(l.handleFollow,["stop"])},{prepend:o.withCtx(()=>e[24]||(e[24]=[o.createElementVNode("i",{class:"iconfont icon-weishoucang text-h6"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.follow"))+" ",1)]),_:1},8,["onClick"])),o.createVNode(n,{height:"32",variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:o.withModifiers(l.handleMeteoMore,["stop"])},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("spot.forecast")),1)]),_:1},8,["onClick"])]}),_:1})]),_:1})):o.createCommentVNode("",!0),i.showMeteo&&a.simple?(o.openBlock(),o.createBlock(z,{key:2,ref:"spotMeteo",class:"position-absolute bottom-0 rounded-t-4",style:{width:"100vw","z-index":"1001"}},{default:o.withCtx(()=>[o.createVNode(s,null,{default:o.withCtx(()=>{var b;return[o.createElementVNode("div",jh,[o.createElementVNode("div",Hh,[e[25]||(e[25]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",Xh,o.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),o.createElementVNode("div",Yh,[(b=a.followList)!=null&&b.some(L=>{var x,k;return(L==null?void 0:L.id)===i.form.followId||((x=L==null?void 0:L.coordinate)==null?void 0:x.lng)===i.form.lng&&((k=L==null?void 0:L.coordinate)==null?void 0:k.lat)===i.form.lat})?(o.openBlock(),o.createBlock(n,{key:0,class:"text-none text-body-1 rounded-circle",variant:"text",density:"compact",height:"32",width:"28","min-width":"28",onClick:o.withModifiers(l.handleCancelFollow,["stop"])},{default:o.withCtx(()=>e[26]||(e[26]=[o.createElementVNode("i",{class:"iconfont icon-yishoucang text-h4 text-warning"},null,-1)])),_:1,__:[26]},8,["onClick"])):(o.openBlock(),o.createBlock(n,{key:1,class:"text-none text-body-1 rounded-circle",variant:"plain",density:"compact",height:"32",width:"28","min-width":"28",onClick:o.withModifiers(l.handleFollow,["stop"])},{default:o.withCtx(()=>e[27]||(e[27]=[o.createElementVNode("i",{class:"iconfont icon-weishoucang text-h4"},null,-1)])),_:1,__:[27]},8,["onClick"])),o.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:o.withModifiers(l.handleCloseMeteo,["stop"])},{default:o.withCtx(()=>e[28]||(e[28]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[28]},8,["onClick"])])]),e[29]||(e[29]=o.createElementVNode("div",{class:"px-5 py-0 text-label text-body-1"},"Spot Weather",-1))]}),_:1,__:[29]}),o.createVNode(d),o.createVNode(h,{class:"text-body-1 px-0 py-2"},{default:o.withCtx(()=>{var b,L;return[o.createElementVNode("div",Uh,[o.createElementVNode("div",$h,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",Jh,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",Kh,[e[30]||(e[30]=o.createElementVNode("div",{style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",qh,o.toDisplayString(l.computedLocalTime((L=i.currentHourData)==null?void 0:L.utc)),1)]),o.createElementVNode("div",Qh,[o.createElementVNode("div",ep,[o.createElementVNode("div",null,[o.createElementVNode("span",tp,o.toDisplayString(t.$t("weather.wind")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.windDir??"-")+"/"+o.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+o.toDisplayString(i.currentHourData.windLevel??"-"),1)]),o.createElementVNode("div",null,[o.createElementVNode("span",op,o.toDisplayString(t.$t("weather.sigWave")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",ap,o.toDisplayString(t.$t("weather.windWave")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1)])]),o.createElementVNode("div",ip,[o.createElementVNode("div",null,[o.createElementVNode("span",rp,o.toDisplayString(t.$t("weather.swell")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.swellDir??"-")+"/"+o.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",lp,o.toDisplayString(t.$t("weather.current")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.currentDir??"-")+"/"+o.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",np,o.toDisplayString(t.$t("weather.visibility")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)])])])]}),_:1})]),_:1},512)):o.createCommentVNode("",!0),o.withDirectives(o.createElementVNode("div",sp,[(o.openBlock(),o.createElementBlock("svg",cp,[o.createElementVNode("use",{"xlink:href":`#icon-spot-${a.theme}`},null,8,mp)]))],512),[[o.vShow,i.showMeteo]])])}const hp=Y(mh,[["render",dp]]),Iy="",pp={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:fe.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 t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){var t,e,a;if(this.toggle)this.handleBind();else{(t=this.map)==null||t.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=D.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 t,e,a,r,i;(t=this.map)==null||t.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 t,e,a,r,i;(t=this.map)==null||t.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(t){if(t.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(t){var a,r,i,l,n,c,s,d,m,p;const e=(r=(a=t.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=t.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=t.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);let g;u.features.forEach((f,w)=>{if(f.geometry.type==="Point"&&f.properties.id===e.split("-")[1]){g=w;return}});const h=u.features.filter(f=>f.geometry.type==="Point");this.handleTmpPointUpdate(u,h[g-1],{lng:(d=(s=t.target)==null?void 0:s._lngLat)==null?void 0:d.lng,lat:(p=(m=t.target)==null?void 0:m._lngLat)==null?void 0:p.lat,properties:h[g].properties},g===h.length-1?void 0:h[g+1])}},handleDragEnd(t){var a,r,i,l,n,c,s,d,m,p;const e=(r=(a=t.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=t.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=t.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);const g=u.features.filter(h=>h.geometry.type==="Point"&&h.properties.id===e.split("-")[1])[0];g.geometry.coordinates=[(d=(s=t.target)==null?void 0:s._lngLat)==null?void 0:d.lng,(p=(m=t.target)==null?void 0:m._lngLat)==null?void 0:p.lat],u.features=u.features.filter(h=>h.geometry.type==="Point"),this.handlePointUpdate(u)}},handleContextmenu(t){var a,r,i,l;t.preventDefault(),(a=this.contextmenu)==null||a.remove();const e=(l=(i=(r=t.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(d=>d.properties.id===(e==null?void 0:e.split("-")[1]))[0]){const d=document.createElement("div");d.className="idm-gl4-measure-contextmenu-marker",d.innerHTML=`<span id="del-${e}" class="del-point">${$t("actions.detele")}</span>`,this.contextmenu=new ne.Marker(d).setOffset([24,0]).setLngLat([t.lngLat.lng,t.lngLat.lat]).addTo(this.map)}}},handleClick(t){var a,r,i,l,n,c;(a=this.contextmenu)==null||a.remove();const e=t.originalEvent.target.className;if(e==="marker-close"){const s=(i=(r=t.originalEvent)==null?void 0:r.srcElement)==null?void 0:i.id,d=this.geojson.filter(m=>m.id===s)[0];d&&this.handleClear(d,!0),this.geojson=this.geojson.filter(m=>m.id!==s),!this.toggle&&!((l=this.geojson)!=null&&l.some(m=>m.closed))&&this.handleUnbind()}else if(e==="del-point"){const s=(c=(n=t.originalEvent.target.id)==null?void 0:n.replace("del-",""))==null?void 0:c.split("-"),d=this.geojson.filter(m=>m.id===s[0])[0];d.features=d.features.filter(m=>m.geometry.type==="Point"&&m.properties.id!==s[1]),this.handlePointUpdate(d)}else if(e!=="marker-label"&&this.toggle){let s=this.geojson.at(-1);s||(s=D.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(s)),s.features=s.features.filter(m=>m.geometry.type==="Point");const d=D.feature({type:"Point",coordinates:[t.lngLat.lng,t.lngLat.lat]},{id:new Date().getTime().toString(),mode:this.navigation,sumLabel:"Start"});s.features.push(d),this.handlePointUpdate(s)}},handlePointUpdate(t){const e=t.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]},d={lng:n.geometry.coordinates[0],lat:n.geometry.coordinates[1]},m=M.LaneHelper.calculateDistance(s,d,c.mode==="RL",4),p=M.LaneHelper.calculateBearing(s,d,c.mode==="RL",2);a=M.LngLatHelper.roundPrecision(a+m,4);let u;c.mode==="RL"?u=M.LngLatHelper.convertToMonotonicLng([s,d]):u=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(s,d,200));const y=D.lineString(u.map(h=>[h.lng,h.lat]));y.properties.dist=m,y.properties.bearing=p,y.properties.total=a,y.properties.name="Line "+this.currentLineIndex,r.push(y);const g=e[i];g.properties.totalDist=M.LngLatHelper.roundPrecision((c.totalDist?c.totalDist:0)+m,4),g.properties.sumLabel=g.properties.totalDist+" nm"}e.push(...r),t.total=a}return this.handleRender(t),t},handleTmpPointUpdate(t,e,a,r){const i=D.featureCollection([]);let l,n;if(e){const s=e.properties,d={lng:e.geometry.coordinates[0],lat:e.geometry.coordinates[1]},m={lng:a.lng,lat:a.lat};l=M.LaneHelper.calculateDistance(d,m,s.mode==="RL",4),n=M.LaneHelper.calculateBearing(d,m,s.mode==="RL",2);let p;s.mode==="RL"?p=M.LngLatHelper.convertToMonotonicLng([d,m]):p=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(d,m,200));const u=D.lineString(p.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}if(r){const s=a.properties,d=a,m={lng:r.geometry.coordinates[0],lat:r.geometry.coordinates[1]};l=M.LaneHelper.calculateDistance(d,m,s.mode==="RL",4),n=M.LaneHelper.calculateBearing(d,m,s.mode==="RL",2);let p;s.mode==="RL"?p=M.LngLatHelper.convertToMonotonicLng([d,m]):p=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(d,m,200));const u=D.lineString(p.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","text-rotation-alignment":"map","text-size":10,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});let c;if(r)c=`<div class="marker-label">${this.$t("measure.dragTips")}</div>`;else{const s=M.LngLatHelper.roundPrecision((t.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 ne.Marker(s).setOffset([140,0]).setLngLat([a.lng,a.lat]).addTo(this.map)}},handleMove(t){this.map.getCanvas().style.cursor="crosshair";let e=this.geojson.at(-1);e||(e=D.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:t.lngLat.lng,lat:t.lngLat.lat})},handleDblClick(t){t.preventDefault();let e=this.geojson.at(-1);e.closed=!0,this.handleRender(e),e=D.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e),this.currentLineIndex++},handleRender(t){var e;if((e=t==null?void 0:t.features)!=null&&e.length){const a=`${t.id}-${this.source}`,r=`${t.id}-${this.layer}`,i=`${t.id}-${this.labelLayer}`,l=`${t.id}-${this.sumLayer}`;this.map.getSource(a)?this.map.getSource(a).setData(t):this.map.addSource(a,{type:"geojson",data:t}),this.handleClear(t,!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","text-rotation-alignment":"map","text-size":10,"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=t.features.filter(c=>c.geometry.type==="Point");for(const c of n){const s=document.createElement("div");s.id=`${t.id}-${c.properties.id}`,s.className=`${t.closed?"idm-gl4-measure-marker closed":"idm-gl4-measure-marker"}`,s.innerHTML='<div class="marker-circle"></div>';const d=new ne.Marker({element:s,draggable:!0,contextmenu:!0}).setLngLat(c.geometry.coordinates).addTo(this.map);d.on("drag",this.handleDrag),d.on("dragend",this.handleDragEnd),this.pointMarkers[t.id]?this.pointMarkers[t.id].push(d):this.pointMarkers[t.id]=[d]}if(t.closed){const c=n.at(-1),d=t.features.filter(p=>p.geometry.type==="LineString").at(-1),m=document.createElement("div");m.className="idm-gl4-measure-summary-marker",m.innerHTML=`<div class="marker-label">${d.properties.name}</div><div id="${t.id}" class="marker-close">X</div>`,this.closeMarkers[t.id]=new ne.Marker(m).setOffset([0,-30]).setLngLat(c.geometry.coordinates).addTo(this.map)}}},handleClear(t,e=!0){var n,c,s,d,m,p,u,y,g,h;const a=`${t.id}-${this.source}`,r=`${t.id}-${this.layer}`,i=`${t.id}-${this.labelLayer}`,l=`${t.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),(d=this.map)!=null&&d.getLayer(this.tmpLayer)&&this.map.removeLayer(this.tmpLayer),(m=this.map)!=null&&m.getLayer(this.tmpLabelLayer)&&this.map.removeLayer(this.tmpLabelLayer),(p=this.closeMarkers[t.id])==null||p.remove(),this.closeMarkers[t.id]=void 0,(u=this.pointMarkers[t.id])==null||u.forEach(f=>{f==null||f.remove()}),this.pointMarkers[t.id]=[],(y=this.tipMarker)==null||y.remove(),this.tipMarker=void 0,e&&((g=this.map)!=null&&g.getSource(a))&&this.map.removeSource(a),e&&((h=this.map)!=null&&h.getSource(this.tmpSource))&&this.map.removeSource(this.tmpSource)}}},gp={class:"idm-gl4-measure"};function up(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("VTooltip");return o.openBlock(),o.createElementBlock("div",gp,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+166+"px",right:i.right+"px"})},[o.createVNode(c,{text:t.$t("measure.measure"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:s})=>[o.createVNode(n,o.mergeProps(s,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[0]||(e[0]=[o.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 fp=Y(pp,[["render",up]]),Ay="",yp={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:()=>({})}},setup(){return{Theme:fe.useTheme()}},emits:["close","save","hideLayer"],data(){var t;return{markerType:"Point",form:{latDegree:"",latMinute:"",latDir:"N",lngDegree:"",lngMinute:"",lngDir:"E",areaType:"Polygon",color:(t=this.Theme.current.value.colors)==null?void 0:t["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,editMarkers:[],deleteBtn:null,originalProperties:{}}},watch:{markerType:{handler(){var t;(t=this.editLayer)!=null&&t.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},immediate:!0},"form.areaType"(){var t;(t=this.editLayer)!=null&&t.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},map:{handler(){var t;this.map&&(this.handleBindMap(),(t=this.editLayer)!=null&&t.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 t,e;this.map&&(this.markerType==="Point"?(this.map.on("click",this.handleMapClickPoint),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Line"&&!((t=this.editLayer)!=null&&t.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;if(!((i=this.editLayer)!=null&&i.extend)||!this.map)return;const t=typeof this.editLayer.extend=="string"?JSON.parse(this.editLayer.extend):this.editLayer.extend;if(!t)return;this.form.name=this.editLayer.name||"",this.form.color=this.editLayer.color||((l=this.Theme.current.value.colors)==null?void 0:l["map-green"])||"#4CAF50";const a=(t.features||(t.type==="Feature"?[t]:[]))[0];if(!a)return;const r=(n=a.geometry)==null?void 0:n.type;if(this.originalProperties=a.properties||{},r==="Point"){this.markerType="Point";const[d,m]=a.geometry.coordinates;this.drawCoords=[[d,m]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(m).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(m).minute),this.form.latDir=M.LngLatHelper.lat2pretty(m).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(d).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(d).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(d).direction,this.handleRenderPoint(this.drawCoords,this.form.color),this.setupPointEdit()}else r==="LineString"?(this.markerType="Line",this.$nextTick(()=>{this.handlerRenderEditLine(a),this.setupLineEdit(),this.handleUnbindMap()})):r==="Polygon"&&(this.markerType="Area",this.form.areaType=(s=(c=this.originalProperties)==null?void 0:c.shape)==null?void 0:s.toLowerCase(),this.$nextTick(()=>{this.handlerRenderEditPolygon(t),this.setupPolygonEdit(a),this.handleUnbindMap()}));this.$emit("hideLayer",this.editLayer.id)},setupPointEdit(){this.pointMarker&&(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))},handlePointDrag(){const{lng:t,lat:e}=this.pointMarker.getLngLat();this.drawCoords=[[t,e]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(e).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(e).minute),this.form.latDir=M.LngLatHelper.lat2pretty(e).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(t).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(t).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(t).direction},clearEditMarkers(){this.editMarkers.forEach(t=>t.remove()),this.editMarkers=[],this._edgeContextMenuHandler&&this.map&&(this.map.off("contextmenu",this._edgeContextMenuHandler),this._edgeContextMenuHandler=null)},handlerRenderEditLine(t){this.drawCoords=t.geometry.coordinates.map(r=>[...r]);const e=D.featureCollection([t,...this.drawCoords.map(r=>D.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 ne.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(D.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(D.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(D.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()})}),this.editMarkers.push(i)});const t=e=>{e.preventDefault();const{lng:a,lat:r}=e.lngLat,i=D.point([a,r]),l=D.lineString(this.drawCoords),n=D.nearestPointOnLine(l,i);if(n){const c=n.properties.index;this.showDeleteButton([a,r],()=>{this.drawCoords.splice(c+1,0,[a,r]),this.handlerRenderEditLine(D.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",t),this._edgeContextMenuHandler=t},showDeleteButton(t,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(t);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(t){this.handleSetDrawSource(t);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(t){this.clearEditMarkers();const e=t.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 ne.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=D.point([i,l]),c=D.lineString([...this.drawCoords,this.drawCoords[0]]),s=D.nearestPointOnLine(c,n);if(s){const d=s.properties.index,m=d>=this.drawCoords.length-1?this.drawCoords.length-1:d;this.showDeleteButton([i,l],()=>{this.drawCoords.splice(m+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(t){var r;const{lng:e,lat:a}=t.lngLat;this.drawCoords=[[e,a]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(a).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(a).minute),this.form.latDir=M.LngLatHelper.lat2pretty(a).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(e).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(e).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(e).direction,this.handleRenderPoint(this.drawCoords,this.form.color),(r=this.editLayer)!=null&&r.id&&this.setupPointEdit()},handleChangePoint(){var u;const{latDegree:t,latMinute:e,latDir:a,lngDegree:r,lngMinute:i,lngDir:l}=this.form,n=parseFloat(t),c=parseFloat(e),s=parseFloat(r),d=parseFloat(i);if(isNaN(n)||isNaN(s))return;const m=(n+(isNaN(c)?0:c)/60)*(a==="S"?-1:1),p=(s+(isNaN(d)?0:d)/60)*(l==="W"?-1:1);this.drawCoords=[[p,m]],this.handleRenderPoint(this.drawCoords,this.form.color),(u=this.editLayer)!=null&&u.id&&this.setupPointEdit()},handleRenderPoint(t,e){var i;if((i=this.pointMarker)==null||i.remove(),!t||!t.length)return;const[a,r]=t[0];this.pointMarker=new ne.Marker({color:e}).setLngLat([a,r]).addTo(this.map)},handleMapClickLine(t){var r;const{lng:e,lat:a}=t.lngLat;this.drawCoords.push([e,a]),this.handleRenderLine(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupLineEdit()},handleMapMoveLine(t){if(!this.drawCoords.length)return;const{lng:e,lat:a}=t.lngLat;this.handleRenderTmpLine(this.drawCoords.at(-1),[e,a])},handleMapDblClickLine(t){t.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(t){if(!t||t.length<1)return;const e=[];t==null||t.forEach((i,l)=>{e.push(M.GeoJsonHelper.drawPoint(i==null?void 0:i[1],i==null?void 0:i[0]))}),(t==null?void 0:t.length)>=2&&e.push(M.GeoJsonHelper.drawLine(t));const a=2,r=D.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(t,e){const a=M.GeoJsonHelper.drawLine([t,e]),r=D.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:t[0],lat:t[1]},l={lng:e[0],lat:e[1]},n=M.LaneHelper.calculateDistance(i,l,!0,2),c=M.LaneHelper.calculateBearing(i,l,!0,2);let s=0;for(let m=1;m<this.drawCoords.length;m++){const p={lng:this.drawCoords[m-1][0],lat:this.drawCoords[m-1][1]},u={lng:this.drawCoords[m][0],lat:this.drawCoords[m][1]};s+=M.LaneHelper.calculateDistance(p,u,!0,4)}s=M.LngLatHelper.roundPrecision(s+n,1);const d=`
|
|
218
218
|
<div class="marker-label">${this.$t("measure.totalDistance")}: <b>${s}</b>nm, ${this.$t("measure.bearing")}: <b>${c}</b>°</div>
|
|
219
|
-
<div class="marker-label"> ${this.$t("measure.clickTips")}</div>`;if(this.tipMarker)this.tipMarker._element.innerHTML=d,this.tipMarker.setLngLat([e[0],e[1]]);else{const m=document.createElement("div");m.className="idm-gl4-draw-tip-marker",m.innerHTML=d,this.tipMarker=new ne.Marker(m).setOffset([140,0]).setLngLat([e[0],e[1]]).addTo(this.map)}},handleRefreshLine(){this.drawCoords.length>=1&&this.handleRenderLine(this.drawCoords)},handleMapClickPolygon(t){var r;const{lng:e,lat:a}=t.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(t){if(!this.drawCoords.length)return;const{lng:e,lat:a}=t.lngLat,r=[...this.drawCoords,[e,a]];r.length>=1&&this.handleRenderPolygonFill(r),this.handleRenderAllVertexLabels(r)},handleMapDblClickPolygon(t){t.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(t){var i;let e=[];if(t==null||t.forEach((l,n)=>{e.push(D.point(l))}),(t==null?void 0:t.length)>2){const l=[...t,t[0]];e.push(M.GeoJsonHelper.drawPolygon(l,{...this.originalProperties}))}const a=D.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(t,e=8){this.handleClearVertexLabels();const a=M.LngLatHelper.lat2pretty(t[1],4).pretty,r=M.LngLatHelper.lng2pretty(t[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 ne.Marker(i,{anchor:"bottom",offset:[0,e]}).setLngLat(t).addTo(this.map);this.polygonVertexMarkers.push(l)},handleRenderAllVertexLabels(t){this.handleClearVertexLabels();const e=t.reduce((a,r)=>[a[0]+r[0],a[1]+r[1]],[0,0]);e[0]/=t.length,e[1]/=t.length,t.forEach(a=>{const r=a[0]-e[0],i=a[1]-e[1];let l="center";i>=0&&r>=0?l="bottom-left":i>=0&&r<0?l="bottom-right":i<0&&r>=0?l="top-left":l="top-right";const n=M.LngLatHelper.lat2pretty(a[1],4).pretty,c=M.LngLatHelper.lng2pretty(a[0],4).pretty,s=document.createElement("div");s.className="idm-gl4-draw-corner-label "+l,s.innerHTML=`<span class="corner-text">${n} <br/> ${c}</span>`;const d=new ne.Marker(s,{anchor:l}).setLngLat(a).addTo(this.map);this.polygonVertexMarkers.push(d)})},handleUpdateVertexLabel(t){if(!this.polygonVertexMarkers.length)return;const e=this.polygonVertexMarkers[0];e.setLngLat(t);const a=M.LngLatHelper.lat2pretty(t[1],4).pretty,r=M.LngLatHelper.lng2pretty(t[0],4).pretty,i=e.getElement().querySelector(".corner-text");i&&(i.innerHTML=`${a} <br/> ${r}`)},handleClearVertexLabels(){this.polygonVertexMarkers.forEach(t=>t.remove()),this.polygonVertexMarkers=[]},handleMapClickCircle(t){const{lng:e,lat:a}=t.lngLat;if(this.drawCoords.length===0){this.drawCoords.push([e,a]);const r=D.featureCollection([D.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=D.distance(D.point(r),D.point(i),{units:"nauticalmiles"}),n=M.GeoJsonHelper.drawCircle(r[0],r[1],l),c=D.featureCollection([D.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(t){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[t.lngLat.lng,t.lngLat.lat],r=D.distance(D.point(e),D.point(a),{units:"nauticalmiles"}),i=M.GeoJsonHelper.drawCircle(e[0],e[1],r),l=D.featureCollection([D.point(e),i]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderAreaLayers(),this.handleRenderRadiusLine(e,a,r)},handleRenderCircleCenterLabel(t){const e=M.LngLatHelper.lat2pretty(t[1],4).pretty,a=M.LngLatHelper.lng2pretty(t[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 ne.Marker(r,{anchor:"bottom-right"}).setLngLat(t).addTo(this.map);this.circleMarkers.push(i)},handleRenderRadiusLine(t,e,a){const r=M.LngLatHelper.roundPrecision(a,2),i=D.featureCollection([D.lineString([t,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=[(t[0]+e[0])/2,(t[1]+e[1])/2],n=this.map.project(t),c=this.map.project(e),s=c.x-n.x,d=c.y-n.y;let m=Math.atan2(d,s)*180/Math.PI;m>90&&(m-=180),m<-90&&(m+=180);const p=16,u=(m-90)*Math.PI/180,y=Math.round(Math.cos(u)*p),g=Math.round(Math.sin(u)*p);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(${m}deg)`,f.style.transformOrigin="center",f.style.display="inline-block",f.textContent=`${r} nm`,h.appendChild(f);const w=new ne.Marker(h,{anchor:"center",offset:[y,g]}).setLngLat(l).addTo(this.map);this.circleMarkers.push(w)},handleClearCircleLabels(){var t,e;this.circleMarkers.forEach(a=>a.remove()),this.circleMarkers=[],(t=this.map)!=null&&t.getLayer(this.drawRadiusLayer)&&this.map.removeLayer(this.drawRadiusLayer),(e=this.map)!=null&&e.getSource(this.drawRadiusSource)&&this.map.removeSource(this.drawRadiusSource)},buildRectFeatureCollection(t,e){const a=Math.min(t[0],e[0]),r=Math.max(t[0],e[0]),i=Math.min(t[1],e[1]),l=Math.max(t[1],e[1]);return[[a,l],[r,l],[r,i],[a,i]]},handleMapClickRect(t){const{lng:e,lat:a}=t.lngLat;if(this.drawCoords.length===0)this.drawCoords.push([e,a]);else{const r=this.drawCoords[0],i=[e,a],l=M.GeoJsonHelper.drawRect(r,i);delete l.bbox;const n=this.buildRectFeatureCollection(r,i),c=D.featureCollection([l,...n.map(s=>D.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(t){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[t.lngLat.lng,t.lngLat.lat],r=M.GeoJsonHelper.drawRect(e,a),i=this.buildRectFeatureCollection(e,a),l=D.featureCollection([r,...i.map(n=>D.point(n))]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderRectLayers(),this.handleRenderRectCorners(e,a)},handleRenderRectLayers(){var e;const t=(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",t):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":t}}),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(t,e){const a=Math.min(t[0],e[0]),r=Math.max(t[0],e[0]),i=Math.min(t[1],e[1]),l=Math.max(t[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 d=M.LngLatHelper.lat2pretty(c[1],4).pretty,m=M.LngLatHelper.lng2pretty(c[0],4).pretty,p=document.createElement("div");p.className="idm-gl4-draw-corner-label "+s,p.innerHTML=`<span class="corner-text">${d} <br/> ${m}</span>`;const u=new ne.Marker(p,{anchor:s}).setLngLat(c).addTo(this.map);this.rectCornerMarkers.push(u)})},handleClearRectCorners(){this.rectCornerMarkers.forEach(t=>t.remove()),this.rectCornerMarkers=[]},handleRenderAreaLayers(){var e;const t=(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",t):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":t}})},handleSetDrawSource(t){this.map.getSource(this.drawSource)?this.map.getSource(this.drawSource).setData(t):this.map.addSource(this.drawSource,{type:"geojson",data:t})},handleClearTmp(){var t,e,a;(t=this.map)!=null&&t.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 t=this.form.color;this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",t),this.map.getLayer(this.drawLineLayer)&&this.map.setPaintProperty(this.drawLineLayer,"line-color",t),this.map.getLayer(this.drawFillLayer)&&this.map.setPaintProperty(this.drawFillLayer,"fill-color",t),this.map.getLayer(this.drawRadiusLayer)&&this.map.setPaintProperty(this.drawRadiusLayer,"line-color",t),this.map.getLayer(this.drawTmpLayer)&&this.map.setPaintProperty(this.drawTmpLayer,"line-color",t),this.editMarkers.forEach(e=>{e.getElement()&&(e.getElement().style.backgroundColor=t)})},handleClearDraw(t=!1){var a,r,i,l;this.handleClearTmp(),this.hideDeleteButton();const e=[this.drawPointLayer,this.drawLineLayer,this.drawFillLayer];for(const n of e)(a=this.map)!=null&&a.getLayer(n)&&((r=this.map)==null||r.removeLayer(n));(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,this.clearEditMarkers(),this.handleRebindMap()},async handleSave(){var r,i;let t=null;if(this.markerType==="Point"?await this.$refs.pointForm.validate().then(l=>{if(l!=null&&l.valid){if(!this.drawCoords.length)return;const[n,c]=this.drawCoords[0];t=D.featureCollection([M.GeoJsonHelper.drawPoint(c,n,{...this.originalProperties,color:this.form.color,name:this.form.name})])}}):this.markerType==="Line"?await this.$refs.lineForm.validate().then(l=>{if(l!=null&&l.valid){if(this.drawCoords.length<2)return;const n=[],c=M.LaneHelper.generateRouteAccordingToWaypoints(this.drawCoords.map(s=>({lng:s==null?void 0:s[0],lat:s==null?void 0:s[1]})));for(const s of c)s.length>1&&n.push(M.GeoJsonHelper.drawLine(s,{properties:{...this.originalProperties,color:this.form.color,name:this.form.name}}));t=D.featureCollection(n)}}):this.markerType==="Area"&&await this.$refs.areaForm.validate().then(l=>{var n,c,s;if(l!=null&&l.valid){const d=(n=this.map)==null?void 0:n.getSource(this.drawSource);if(!d)return;const m=d._data;if(!((c=m==null?void 0:m.features)!=null&&c.length))return;let p=((s=m.features)==null?void 0:s.filter(u=>u.geometry.type==="Polygon"))||[];if(p=p==null?void 0:p.map(u=>(u.properties.name=this.form.name,u.properties.color=this.form.color,u)),!p.length)return;t=D.featureCollection(p)}}),!t)return!1;const e={name:this.form.name,format:"geojson",color:this.form.color,extend:t};this.saving=!0,await((r=this.editLayer)!=null&&r.id?le.put(`${this.gateway}/api/arc/layers/${this.editLayer.id}`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}):le.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,d;((n=l.data)==null?void 0:n.code)===0&&this.$emit("save",{...e,id:((c=this.editLayer)==null?void 0:c.id)||((d=(s=l.data)==null?void 0:s.data)==null?void 0:d.id)}),this.saving=!1}).catch(l=>{console.error("save marker error",l),this.saving=!1})}}},bp={class:"text-h6 font-weight-600"},wp={class:"text-label mb-1"},xp={class:"text-label mb-1"},kp={class:"mb-1"},_p={class:"text-label mb-1"},Lp={class:"mb-1"},zp={class:"text-label mb-1"},Cp={class:"mb-1"},vp={class:"text-label mb-1"},Sp={class:"color-picker-row d-flex align-start ga-2"},Np=["value"],Pp={class:"mb-n2"},Vp={class:"text-label mb-1"},Mp={class:"mb-1"},Tp={class:"text-label mb-1"},Dp={class:"color-picker-row d-flex align-start ga-2"},Ep=["value"],Rp={class:"mb-n2"},Bp={class:"text-label mb-1"},Ip={key:0,class:"mb-3"},Ap={class:"text-label mb-1"},Fp={class:"mb-1"},Gp={class:"text-label mb-1"},Wp={class:"color-picker-row d-flex align-start ga-2"},Zp=["value"],Op={class:"mb-n2"},jp={class:"text-label mb-1"};function Hp(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("v-card-title"),s=o.resolveComponent("v-divider"),d=o.resolveComponent("v-text-field"),m=o.resolveComponent("v-card-text"),p=o.resolveComponent("v-btn"),u=o.resolveComponent("v-btn-toggle"),y=o.resolveComponent("VTextField"),g=o.resolveComponent("v-col"),h=o.resolveComponent("v-row"),f=o.resolveComponent("VDivider"),w=o.resolveComponent("VCardActions"),z=o.resolveComponent("VForm"),b=o.resolveComponent("v-card");return o.openBlock(),o.createBlock(b,{class:"idm-gl4-draw-dialog-card",elevation:"4"},{default:o.withCtx(()=>{var L;return[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("span",bp,o.toDisplayString((x=a.editLayer)!=null&&x.id?t.$t("actions.edit"):t.$t("actions.addMarker")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[21]||(e[21]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]}),_:1}),o.createVNode(s),o.createVNode(m,{class:"text-body-1 px-4 pb-0"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("div",wp,o.toDisplayString(t.$t("marker.group")),1),o.createVNode(d,{"model-value":(x=a.group)==null?void 0:x.name,density:"compact",variant:"outlined","hide-details":"",disabled:"",class:"input-btn-bg-1"},null,8,["model-value"])]}),_:1}),(L=a.editLayer)!=null&&L.id?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(m,{key:0,class:"text-body-1 px-4 pb-0"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("div",xp,[o.createTextVNode(o.toDisplayString(t.$t("marker.markerType")),1),e[22]||(e[22]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(u,{modelValue:i.markerType,"onUpdate:modelValue":e[0]||(e[0]=k=>i.markerType=k),mandatory:"",group:"",density:"compact",variant:"flat",class:"w-100",disabled:!!((x=a.editLayer)!=null&&x.id)},{default:o.withCtx(()=>[o.createVNode(p,{value:"Point",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.point")),1)]),_:1},8,["class","color"]),o.createVNode(p,{value:"Line",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.line")),1)]),_:1},8,["class","color"]),o.createVNode(p,{value:"Area",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.area")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])]}),_:1})),i.markerType==="Point"?(o.openBlock(),o.createBlock(z,{key:1,ref:"pointForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(m,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",kp,[o.createElementVNode("div",_p,[o.createTextVNode(o.toDisplayString(t.$t("marker.lat")),1),e[23]||(e[23]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(h,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(g,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(y,{modelValue:i.form.latDegree,"onUpdate:modelValue":[e[1]||(e[1]=x=>i.form.latDegree=x),e[2]||(e[2]=x=>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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[24]}),o.createVNode(g,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(y,{modelValue:i.form.latMinute,"onUpdate:modelValue":[e[3]||(e[3]=x=>i.form.latMinute=x),e[4]||(e[4]=x=>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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[25]}),o.createVNode(g,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(p,{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]=x=>{i.form.latDir=i.form.latDir==="N"?"S":"N",l.handleChangePoint()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.latDir),1)]),_:1})]),_:1})]),_:1})]),o.createElementVNode("div",Lp,[o.createElementVNode("div",zp,[o.createTextVNode(o.toDisplayString(t.$t("marker.lng")),1),e[26]||(e[26]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(h,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(g,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(d,{modelValue:i.form.lngDegree,"onUpdate:modelValue":[e[6]||(e[6]=x=>i.form.lngDegree=x),e[7]||(e[7]=x=>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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[27]}),o.createVNode(g,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(d,{modelValue:i.form.lngMinute,"onUpdate:modelValue":[e[8]||(e[8]=x=>i.form.lngMinute=x),e[9]||(e[9]=x=>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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[28]}),o.createVNode(g,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(p,{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]=x=>{i.form.lngDir=i.form.lngDir==="E"?"W":"E",l.handleChangePoint()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.lngDir),1)]),_:1})]),_:1})]),_:1})]),o.createElementVNode("div",Cp,[o.createElementVNode("div",vp,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[29]||(e[29]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Sp,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[11]||(e[11]=x=>i.form.color=x.target.value)},null,40,Np),o.createVNode(d,{modelValue:i.form.color,"onUpdate:modelValue":e[12]||(e[12]=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"])])]),o.createElementVNode("div",Pp,[o.createElementVNode("div",Vp,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[30]||(e[30]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(d,{modelValue:i.form.name,"onUpdate:modelValue":e[13]||(e[13]=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}),o.createVNode(f),o.createVNode(w,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(p,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(p,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0),i.markerType==="Line"?(o.openBlock(),o.createBlock(z,{key:2,ref:"lineForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(m,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",Mp,[o.createElementVNode("div",Tp,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[31]||(e[31]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Dp,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[14]||(e[14]=x=>i.form.color=x.target.value)},null,40,Ep),o.createVNode(d,{modelValue:i.form.color,"onUpdate:modelValue":e[15]||(e[15]=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"])])]),o.createElementVNode("div",Rp,[o.createElementVNode("div",Bp,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[32]||(e[32]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(d,{modelValue:i.form.name,"onUpdate:modelValue":e[16]||(e[16]=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}),o.createVNode(f),o.createVNode(w,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(p,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(p,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0),i.markerType==="Area"?(o.openBlock(),o.createBlock(z,{key:3,ref:"areaForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(m,{class:"px-4 text-body-1"},{default:o.withCtx(()=>{var x,k;return[(x=a.editLayer)!=null&&x.id?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Ip,[o.createElementVNode("div",Ap,[o.createTextVNode(o.toDisplayString(t.$t("marker.areaType")),1),e[33]||(e[33]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(u,{modelValue:i.form.areaType,"onUpdate:modelValue":e[17]||(e[17]=C=>i.form.areaType=C),mandatory:"",group:"",density:"compact",variant:"flat",color:"primary",class:"w-100",disabled:!!((k=a.editLayer)!=null&&k.id)},{default:o.withCtx(()=>[o.createVNode(p,{value:"Polygon",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.polygon")),1)]),_:1},8,["class","color"]),o.createVNode(p,{value:"Circle",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.circle")),1)]),_:1},8,["class","color"]),o.createVNode(p,{value:"Rect",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.rect")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])])),o.createElementVNode("div",Fp,[o.createElementVNode("div",Gp,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[34]||(e[34]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Wp,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[18]||(e[18]=C=>i.form.color=C.target.value)},null,40,Zp),o.createVNode(d,{modelValue:i.form.color,"onUpdate:modelValue":e[19]||(e[19]=C=>i.form.color=C),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),o.createElementVNode("div",Op,[o.createElementVNode("div",jp,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[35]||(e[35]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(d,{modelValue:i.form.name,"onUpdate:modelValue":e[20]||(e[20]=C=>i.form.name=C),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]}),_:1}),o.createVNode(f),o.createVNode(w,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>{var x;return[(x=a.editLayer)!=null&&x.id?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(p,{key:0,class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"])),o.createVNode(p,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]}),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0)]}),_:1})}const Xp=Y(yp,[["render",Hp]]),Fy="",Yp={name:"IdmImportMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String},group:{type:Object,default:null}},setup(){return{Theme:fe.useTheme()}},emits:["close","import"],data(){return{form:{groupName:"",name:"",file:null,format:"",extend:void 0},formRules:{groupName:[t=>t!=null&&t!==""||"required"]},isDragOver:!1,uploading:!1,fileError:"",previewSourceId:"__import_preview__",previewMarkers:[]}},mounted(){var t;this.form.groupName=((t=this.group)==null?void 0:t.name)||"Import layer 1"},beforeUnmount(){this.handleClearPreview()},methods:{handleClose(){this.$emit("close")},handleReset(){var t;this.form={groupName:((t=this.group)==null?void 0:t.name)||"Import layer 1",file:null,format:"",extend:void 0},this.fileError=""},handleSelectFile(){this.$refs.fileInput.click()},handleFileChange(t){const e=t.target.files[0];e&&this.onUpload(e)},handleDrop(t){this.isDragOver=!1;const e=t.dataTransfer.files[0];e&&this.onUpload(e)},onUpload(t){var i,l;if(t.size>10485760){this.$emit("error",this.$t("marker.fileTooLarge"));return}this.form.file=t,this.fileError="",this.form.name=(i=t.name.split("."))==null?void 0:i[0];const a=(l=t.name.split(".").pop())==null?void 0:l.toLowerCase(),r=new FileReader;r.onload=n=>{const c=new Uint8Array(n.target.result);if(c[0]===80&&c[1]===75){const m=new FileReader;m.onload=async p=>{try{const u=await wr(p.target.result),y=Array.isArray(u)?{type:"FeatureCollection",features:u.flatMap(g=>g.features||[])}:u;this.form.extend=y,this.form.format="geojson",console.log(this.form.extend),this.handleDrawLayers()}catch(u){console.error("Shapefile parse error",u),this.$emit("error","Failed to parse shapefile"),this.fileError="Failed to parse shapefile",this.form.file=null}},m.readAsArrayBuffer(t);return}const d=new FileReader;d.onload=m=>{try{const p=m.target.result;if(a==="json"||a==="geojson")this.form.extend=JSON.parse(p),this.form.format="geojson",console.log(this.form.extend);else if(a==="kml"){const u=M.GeoJsonHelper.convertKML2GeoJSON(p);this.form.extend=u,this.form.format="geojson"}else this.$emit("error","Unsupported format: "+a);this.handleDrawLayers()}catch(p){console.error("File parse error",p),this.$emit("error","Failed to parse file"),this.fileError="Failed to parse file"}},d.readAsText(t)},r.readAsArrayBuffer(t.slice(0,4))},handleRemoveFile(){this.form.file=null,this.$refs.fileInput.value="",this.handleClearPreview()},async handleConfirm(){var a,r;const{valid:t}=await this.$refs.importForm.validate();if(!t)return;if(!this.form.file){this.fileError=this.$t("marker.fileRequired");return}this.uploading=!0;let e=this.group.id;if(e||await le.post(`${this.gateway}/api/arc/lygroups`,{name:this.form.groupName},{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(i=>{var l,n;((l=i.data)==null?void 0:l.code)===0&&(e=(n=i.data.data)==null?void 0:n.id)}),!e){this.uploading=!1;return}(r=(a=this.form.extend)==null?void 0:a.features)==null||r.forEach(i=>{var n,c,s,d,m,p;const l={name:((n=i==null?void 0:i.properties)==null?void 0:n.name)||((c=i==null?void 0:i.properties)==null?void 0:c.shape)||((d=(s=i==null?void 0:i.geometry)==null?void 0:s.type)==null?void 0:d.toLowerCase()),format:this.form.format,color:((m=i==null?void 0:i.properties)==null?void 0:m.color)||((p=this.Theme.current.value.colors)==null?void 0:p["map-green"]),extend:D.featureCollection([i])};le.post(`${this.gateway}/api/arc/lygroups/${e}/layers`,l,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(u=>{var y;((y=u.data)==null?void 0:y.code)===0&&(this.$emit("import"),this.uploading=!1)}).catch(u=>{this.uploading=!1})})},handleDrawLayers(){if(!this.map||!this.form.extend)return;this.handleClearPreview();const t=this.form.extend,e=this.previewSourceId,a=t.features||(t.type==="Feature"?[t]:[]);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[d,m]=i.geometry.coordinates;this.previewMarkers.push(new ne.Marker({color:l}).setLngLat([d,m]).addTo(this.map))}i.properties.color||(i.properties.color=l)}),this.map.getSource(e)?this.map.getSource(e).setData(t):this.map.addSource(e,{type:"geojson",data:t});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 t=this.previewSourceId;[`${t}-vertex`,`${t}-point`,`${t}-line`,`${t}-fill`,`${t}-outline`].forEach(a=>{this.map.getLayer(a)&&this.map.removeLayer(a)}),this.map.getSource(t)&&this.map.removeSource(t)}}},Up={class:"text-h6 font-weight-600"},$p={class:"mb-4"},Jp={class:"text-label mb-1"},Kp={class:"text-body-2 text-center text-label"},qp={class:"text-body-1 text-primary mt-2 cursor-pointer"},Qp={class:"text-body-2 text-left text-label mt-1"},eg={key:0,class:"text-body-2 text-left text-danger mt-1"},tg={key:1,class:"file-item d-flex align-center justify-space-between mt-2 gray-bg-1 pa-1"},og={class:"text-body-2 text-truncate"};function ag(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("v-card-title"),s=o.resolveComponent("v-divider"),d=o.resolveComponent("v-text-field"),m=o.resolveComponent("v-icon"),p=o.resolveComponent("v-card-text"),u=o.resolveComponent("VDivider"),y=o.resolveComponent("v-btn"),g=o.resolveComponent("VCardActions"),h=o.resolveComponent("VForm"),f=o.resolveComponent("v-card");return o.openBlock(),o.createBlock(f,{class:"idm-gl4-import-dialog-card",elevation:"4"},{default:o.withCtx(()=>[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("span",Up,o.toDisplayString(t.$t("marker.importLayer")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[7]||(e[7]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[7]},8,["onClick"])]),_:1}),o.createVNode(s),o.createVNode(h,{ref:"importForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleConfirm,["prevent"])},{default:o.withCtx(()=>[o.createVNode(p,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",$p,[o.createElementVNode("div",Jp,[o.createTextVNode(o.toDisplayString(t.$t("marker.group")),1),e[8]||(e[8]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(d,{modelValue:i.form.groupName,"onUpdate:modelValue":e[0]||(e[0]=w=>i.form.groupName=w),density:"compact",variant:"outlined","hide-details":"",class:"input-btn-bg-1"},null,8,["modelValue"])]),o.createElementVNode("div",{class:o.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[2]||(e[2]=o.withModifiers(w=>i.isDragOver=!0,["prevent"])),onDragleave:e[3]||(e[3]=o.withModifiers(w=>i.isDragOver=!1,["prevent"])),onDragover:e[4]||(e[4]=o.withModifiers(()=>{},["prevent"])),onDrop:e[5]||(e[5]=o.withModifiers((...w)=>l.handleDrop&&l.handleDrop(...w),["prevent"])),onClick:e[6]||(e[6]=(...w)=>l.handleSelectFile&&l.handleSelectFile(...w))},[o.createVNode(m,{size:"36",color:"grey",class:"mb-2"},{default:o.withCtx(()=>e[9]||(e[9]=[o.createTextVNode("mdi-cloud-upload-outline",-1)])),_:1,__:[9]}),o.createElementVNode("div",Kp,o.toDisplayString(t.$t("marker.uploadHint")),1),o.createElementVNode("div",qp,o.toDisplayString(t.$t("marker.selectFile")),1),o.createElementVNode("input",{ref:"fileInput",type:"file",style:{display:"none"},accept:".json,.geojson,.zip,.shp,.kml,.kmz",onChange:e[1]||(e[1]=(...w)=>l.handleFileChange&&l.handleFileChange(...w))},null,544)],34),o.createElementVNode("div",Qp,o.toDisplayString(t.$t("marker.uploadLimit")),1),i.fileError?(o.openBlock(),o.createElementBlock("div",eg,o.toDisplayString(i.fileError),1)):o.createCommentVNode("",!0),i.form.file?(o.openBlock(),o.createElementBlock("div",tg,[o.createElementVNode("span",og,[o.createVNode(m,{size:"16",color:"success",class:"mr-1"},{default:o.withCtx(()=>e[10]||(e[10]=[o.createTextVNode("mdi-check-circle",-1)])),_:1,__:[10]}),o.createTextVNode(" "+o.toDisplayString(i.form.file.name),1)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",size:"small",class:"file-remove-btn",onClick:l.handleRemoveFile},{default:o.withCtx(()=>[o.createVNode(m,{size:"16"},{default:o.withCtx(()=>e[11]||(e[11]=[o.createTextVNode("mdi-close",-1)])),_:1,__:[11]})]),_:1},8,["onClick"])])):o.createCommentVNode("",!0)]),_:1}),o.createVNode(u),o.createVNode(g,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(y,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleReset},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.reset")),1)]),_:1},8,["onClick"]),o.createVNode(y,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.uploading},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1})}const ig=Y(Yp,[["render",ag]]),Gy="",rg={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(t){this.localName=(t==null?void 0:t.name)||""},immediate:!0}},methods:{handleClose(){this.$emit("update:modelValue",!1)},async handleConfirm(){var t;!this.group||!((t=this.localName)!=null&&t.trim())||(this.saving=!0,await le.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")}).catch(()=>{}).finally(()=>{this.saving=!1}))}}},lg={class:"text-h6 font-weight-600"},ng={class:"text-label mb-2"};function sg(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("v-card-title"),s=o.resolveComponent("v-divider"),d=o.resolveComponent("v-text-field"),m=o.resolveComponent("v-card-text"),p=o.resolveComponent("VDivider"),u=o.resolveComponent("v-btn"),y=o.resolveComponent("VCardActions"),g=o.resolveComponent("v-card"),h=o.resolveComponent("v-dialog");return o.openBlock(),o.createBlock(h,{"model-value":a.modelValue,"max-width":"320",persistent:"","onUpdate:modelValue":e[1]||(e[1]=f=>t.$emit("update:modelValue",f))},{default:o.withCtx(()=>[o.createVNode(g,{class:"",elevation:"4"},{default:o.withCtx(()=>[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("span",lg,o.toDisplayString(t.$t("actions.editGroup")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[2]||(e[2]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[2]},8,["onClick"])]),_:1}),o.createVNode(s),o.createVNode(m,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",ng,[o.createTextVNode(o.toDisplayString(t.$t("marker.groupName")),1),e[3]||(e[3]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(d,{modelValue:i.localName,"onUpdate:modelValue":e[0]||(e[0]=f=>i.localName=f),density:"compact",variant:"outlined","hide-details":"",autocomplete:"off",height:"32px","min-height":"32px",class:"input-btn-bg-1"},null,8,["modelValue"])]),_:1}),o.createVNode(p),o.createVNode(y,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(u,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClose},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(u,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",loading:i.saving,onClick:l.handleConfirm},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["model-value"])}const cg=Y(rg,[["render",sg]]),mg={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}}},dg={class:"text-body-1 pb-1"},hg={class:"text-body-1"};function pg(t,e,a,r,i,l){const n=o.resolveComponent("v-icon"),c=o.resolveComponent("VBtn"),s=o.resolveComponent("v-card-title"),d=o.resolveComponent("v-card-text"),m=o.resolveComponent("v-card-actions"),p=o.resolveComponent("v-card"),u=o.resolveComponent("v-dialog");return o.openBlock(),o.createBlock(u,{modelValue:i.showDialog,"onUpdate:modelValue":e[0]||(e[0]=y=>i.showDialog=y),width:"500","min-width":"500","max-width":"500"},{default:o.withCtx(()=>[o.createVNode(p,{class:""},{default:o.withCtx(()=>[o.createVNode(s,{class:"text-h6 font-weight-600 d-flex justify-center align-center py-4"},{default:o.withCtx(()=>[o.createVNode(n,{color:"warning",icon:"mdi-alert-circle",size:"small",class:"mr-2"}),o.createElementVNode("div",null,o.toDisplayString(a.title),1),o.createVNode(c,{icon:"",density:"compact",variant:"plain",class:"position-absolute top-0 right-0 mt-2 mr-2",onClick:l.handleClose},{default:o.withCtx(()=>e[1]||(e[1]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),_:1}),o.createVNode(d,{class:"py-4 text-center"},{default:o.withCtx(()=>[o.createElementVNode("p",dg,o.toDisplayString(a.tips),1),o.createElementVNode("p",hg,o.toDisplayString(t.$t("tips.doYouWantToContinue")),1)]),_:1}),o.createVNode(m,{class:"w-100 d-flex justify-center align-center ga-8 py-6"},{default:o.withCtx(()=>[o.createVNode(c,{variant:"tonal",class:"text-none text-body-1",height:"32",onClick:l.handleClose},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(c,{loading:a.loading,variant:"flat",color:"danger",class:"text-none text-body-1",height:"32",onClick:l.handleDelete},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.delete")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])}const gg=Y(mg,[["render",pg]]),Wy="",Zy="",ug={name:"IdmMarker",components:{IdmDrawMarker:Xp,IdmImportMarker:ig,IdmGroupDialog:cg,DeleteDialog:gg},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},setup(){return{Theme:fe.useTheme()}},emits:["map","menuToggle","theme"],data(){return{right:10,toggle:!1,autoActive:!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 t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.clientWidth)||0)+10)})},immediate:!0},toggle:{async handler(){this.toggle}},autoActive:{async handler(){this.autoActive?this.layerGroup.length===0?await this.fetchAllLayers():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(t){this.drawDialog=!1,this.importDialog=!1,this.currentGroup=t,this.groupDialog=!0},handleSaveGroup(){this.fetchAllLayers(),this.groupDialog=!1,this.currentGroup=void 0},handleOpenDelete(t,e){t==="group"?(this.currentGroup=e,this.currentLayer=void 0):t==="layer"&&(this.currentGroup=void 0,this.currentLayer=e),this.$refs.deleteDialog.open()},confirmDelete(){var t;this.currentGroup?this.handleDeleteGroup((t=this.currentGroup)==null?void 0:t.id):this.currentLayer&&this.handleDeleteLayer(this.currentLayer)},async handleDeleteGroup(t){t&&(this.deleteLoading=!0,await le.delete(`${this.gateway}/api/arc/lygroups/${t}`,{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(t){this.handleCloseDraw(),this.currentGroup=t||this.layerGroup.find(e=>e.name==="Custom Layers"),this.importDialog=!1,this.drawDialog=!0},handleOpenImportDialog(t){this.drawDialog=!1,this.handleCloseDraw(),this.currentGroup=t||void 0,this.importDialog=!0},handleImportLayer(t){this.fetchAllLayers(),this.importDialog=!1},handleSaveMarker(t){this.fetchAllLayers(),this.drawDialog=!1,this.currentLayer=null},handleCloseDraw(){this.drawDialog=!1,this.currentLayer=null,this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=void 0},handleEditLayer(t,e){this.importDialog=!1,this.currentGroup=t,this.currentLayer=e,this.drawDialog=!0},async fetchAllLayers(){this.loading=!0,this.layerGroup=[],await le.get(`${this.gateway}/api/arc/lygroups/my`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(t=>{var e,a,r,i,l,n;if(((e=t.data)==null?void 0:e.code)===0){this.loading=!1,this.layerGroup=((i=(r=(a=t.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 d;s.show=!0,(d=s.layers)==null||d.forEach(m=>{var u;m.layerGroupId=s.id;const p=typeof m.extend=="string"?JSON.parse(m.extend):m.extend;(u=p==null?void 0:p.features)==null||u.forEach(y=>{y.properties.lgId=s.id,y.properties.layerId=m.id,y.properties.name||(y.properties.name=m.name)}),c.push(m)})}),this.layers=c,this.handleDrawAllLayers(),(n=this.$refs.drawDialog)==null||n.handleClearDraw()}}).catch(()=>{this.loading=!1})},async handleDeleteLayer(t){this.deleteLoading=!0,await le.delete(`${this.gateway}/api/arc/layers/${t.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(t){if(!this.map||!(t!=null&&t.extend))return;const e=typeof t.extend=="string"?JSON.parse(t.extend):t.extend;if(!e)return;const a=`marker-layer-${t.id}`;this.handleClearLayerMarkers(t.id);const r=e.features||(e.type==="Feature"?[e]:[]);if(r.some(c=>{var s,d;return(((s=c.geometry)==null?void 0:s.type)==="Point"||((d=c.geometry)==null?void 0:d.type)==="MultiPoint")&&c.properties.type==="point"})){const c=[];r.forEach(s=>{var u,y,g,h;const d=(u=s.geometry)==null?void 0:u.type,m=((y=s.properties)==null?void 0:y.name)||"",p=((g=s.properties)==null?void 0:g.color)||t.color||((h=this.Theme.current.value.colors)==null?void 0:h["map-green"]);if(d==="Point"){const[f,w]=s.geometry.coordinates,z=`<div style="font-size:12px;line-height:1.5;">
|
|
219
|
+
<div class="marker-label"> ${this.$t("measure.clickTips")}</div>`;if(this.tipMarker)this.tipMarker._element.innerHTML=d,this.tipMarker.setLngLat([e[0],e[1]]);else{const m=document.createElement("div");m.className="idm-gl4-draw-tip-marker",m.innerHTML=d,this.tipMarker=new ne.Marker(m).setOffset([140,0]).setLngLat([e[0],e[1]]).addTo(this.map)}},handleRefreshLine(){this.drawCoords.length>=1&&this.handleRenderLine(this.drawCoords)},handleMapClickPolygon(t){var r;const{lng:e,lat:a}=t.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(t){if(!this.drawCoords.length)return;const{lng:e,lat:a}=t.lngLat,r=[...this.drawCoords,[e,a]];r.length>=1&&this.handleRenderPolygonFill(r),this.handleRenderAllVertexLabels(r)},handleMapDblClickPolygon(t){t.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(t){var i;let e=[];if(t==null||t.forEach((l,n)=>{e.push(D.point(l))}),(t==null?void 0:t.length)>2){const l=[...t,t[0]];e.push(M.GeoJsonHelper.drawPolygon(l,{...this.originalProperties}))}const a=D.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(t,e=8){this.handleClearVertexLabels();const a=M.LngLatHelper.lat2pretty(t[1],4).pretty,r=M.LngLatHelper.lng2pretty(t[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 ne.Marker(i,{anchor:"bottom",offset:[0,e]}).setLngLat(t).addTo(this.map);this.polygonVertexMarkers.push(l)},handleRenderAllVertexLabels(t){this.handleClearVertexLabels();const e=t.reduce((a,r)=>[a[0]+r[0],a[1]+r[1]],[0,0]);e[0]/=t.length,e[1]/=t.length,t.forEach(a=>{const r=a[0]-e[0],i=a[1]-e[1];let l="center";i>=0&&r>=0?l="bottom-left":i>=0&&r<0?l="bottom-right":i<0&&r>=0?l="top-left":l="top-right";const n=M.LngLatHelper.lat2pretty(a[1],4).pretty,c=M.LngLatHelper.lng2pretty(a[0],4).pretty,s=document.createElement("div");s.className="idm-gl4-draw-corner-label "+l,s.innerHTML=`<span class="corner-text">${n} <br/> ${c}</span>`;const d=new ne.Marker(s,{anchor:l}).setLngLat(a).addTo(this.map);this.polygonVertexMarkers.push(d)})},handleUpdateVertexLabel(t){if(!this.polygonVertexMarkers.length)return;const e=this.polygonVertexMarkers[0];e.setLngLat(t);const a=M.LngLatHelper.lat2pretty(t[1],4).pretty,r=M.LngLatHelper.lng2pretty(t[0],4).pretty,i=e.getElement().querySelector(".corner-text");i&&(i.innerHTML=`${a} <br/> ${r}`)},handleClearVertexLabels(){this.polygonVertexMarkers.forEach(t=>t.remove()),this.polygonVertexMarkers=[]},handleMapClickCircle(t){const{lng:e,lat:a}=t.lngLat;if(this.drawCoords.length===0){this.drawCoords.push([e,a]);const r=D.featureCollection([D.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=D.distance(D.point(r),D.point(i),{units:"nauticalmiles"}),n=M.GeoJsonHelper.drawCircle(r[0],r[1],l),c=D.featureCollection([D.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(t){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[t.lngLat.lng,t.lngLat.lat],r=D.distance(D.point(e),D.point(a),{units:"nauticalmiles"}),i=M.GeoJsonHelper.drawCircle(e[0],e[1],r),l=D.featureCollection([D.point(e),i]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderAreaLayers(),this.handleRenderRadiusLine(e,a,r)},handleRenderCircleCenterLabel(t){const e=M.LngLatHelper.lat2pretty(t[1],4).pretty,a=M.LngLatHelper.lng2pretty(t[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 ne.Marker(r,{anchor:"bottom-right"}).setLngLat(t).addTo(this.map);this.circleMarkers.push(i)},handleRenderRadiusLine(t,e,a){const r=M.LngLatHelper.roundPrecision(a,2),i=D.featureCollection([D.lineString([t,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=[(t[0]+e[0])/2,(t[1]+e[1])/2],n=this.map.project(t),c=this.map.project(e),s=c.x-n.x,d=c.y-n.y;let m=Math.atan2(d,s)*180/Math.PI;m>90&&(m-=180),m<-90&&(m+=180);const p=16,u=(m-90)*Math.PI/180,y=Math.round(Math.cos(u)*p),g=Math.round(Math.sin(u)*p);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(${m}deg)`,f.style.transformOrigin="center",f.style.display="inline-block",f.textContent=`${r} nm`,h.appendChild(f);const w=new ne.Marker(h,{anchor:"center",offset:[y,g]}).setLngLat(l).addTo(this.map);this.circleMarkers.push(w)},handleClearCircleLabels(){var t,e;this.circleMarkers.forEach(a=>a.remove()),this.circleMarkers=[],(t=this.map)!=null&&t.getLayer(this.drawRadiusLayer)&&this.map.removeLayer(this.drawRadiusLayer),(e=this.map)!=null&&e.getSource(this.drawRadiusSource)&&this.map.removeSource(this.drawRadiusSource)},buildRectFeatureCollection(t,e){const a=Math.min(t[0],e[0]),r=Math.max(t[0],e[0]),i=Math.min(t[1],e[1]),l=Math.max(t[1],e[1]);return[[a,l],[r,l],[r,i],[a,i]]},handleMapClickRect(t){const{lng:e,lat:a}=t.lngLat;if(this.drawCoords.length===0)this.drawCoords.push([e,a]);else{const r=this.drawCoords[0],i=[e,a],l=M.GeoJsonHelper.drawRect(r,i);delete l.bbox;const n=this.buildRectFeatureCollection(r,i),c=D.featureCollection([l,...n.map(s=>D.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(t){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[t.lngLat.lng,t.lngLat.lat],r=M.GeoJsonHelper.drawRect(e,a),i=this.buildRectFeatureCollection(e,a),l=D.featureCollection([r,...i.map(n=>D.point(n))]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderRectLayers(),this.handleRenderRectCorners(e,a)},handleRenderRectLayers(){var e;const t=(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",t):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":t}}),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(t,e){const a=Math.min(t[0],e[0]),r=Math.max(t[0],e[0]),i=Math.min(t[1],e[1]),l=Math.max(t[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 d=M.LngLatHelper.lat2pretty(c[1],4).pretty,m=M.LngLatHelper.lng2pretty(c[0],4).pretty,p=document.createElement("div");p.className="idm-gl4-draw-corner-label "+s,p.innerHTML=`<span class="corner-text">${d} <br/> ${m}</span>`;const u=new ne.Marker(p,{anchor:s}).setLngLat(c).addTo(this.map);this.rectCornerMarkers.push(u)})},handleClearRectCorners(){this.rectCornerMarkers.forEach(t=>t.remove()),this.rectCornerMarkers=[]},handleRenderAreaLayers(){var e;const t=(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",t):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":t}})},handleSetDrawSource(t){this.map.getSource(this.drawSource)?this.map.getSource(this.drawSource).setData(t):this.map.addSource(this.drawSource,{type:"geojson",data:t})},handleClearTmp(){var t,e,a;(t=this.map)!=null&&t.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 t=this.form.color;this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",t),this.map.getLayer(this.drawLineLayer)&&this.map.setPaintProperty(this.drawLineLayer,"line-color",t),this.map.getLayer(this.drawFillLayer)&&this.map.setPaintProperty(this.drawFillLayer,"fill-color",t),this.map.getLayer(this.drawRadiusLayer)&&this.map.setPaintProperty(this.drawRadiusLayer,"line-color",t),this.map.getLayer(this.drawTmpLayer)&&this.map.setPaintProperty(this.drawTmpLayer,"line-color",t),this.editMarkers.forEach(e=>{e.getElement()&&(e.getElement().style.backgroundColor=t)})},handleClearDraw(t=!1){var a,r,i,l;this.handleClearTmp(),this.hideDeleteButton();const e=[this.drawPointLayer,this.drawLineLayer,this.drawFillLayer];for(const n of e)(a=this.map)!=null&&a.getLayer(n)&&((r=this.map)==null||r.removeLayer(n));(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,this.clearEditMarkers(),this.handleRebindMap()},async handleSave(){var r,i;let t=null;if(this.markerType==="Point"?await this.$refs.pointForm.validate().then(l=>{if(l!=null&&l.valid){if(!this.drawCoords.length)return;const[n,c]=this.drawCoords[0];t=D.featureCollection([M.GeoJsonHelper.drawPoint(c,n,{...this.originalProperties,color:this.form.color,name:this.form.name})])}}):this.markerType==="Line"?await this.$refs.lineForm.validate().then(l=>{if(l!=null&&l.valid){if(this.drawCoords.length<2)return;const n=[],c=M.LaneHelper.generateRouteAccordingToWaypoints(this.drawCoords.map(s=>({lng:s==null?void 0:s[0],lat:s==null?void 0:s[1]})));for(const s of c)s.length>1&&n.push(M.GeoJsonHelper.drawLine(s,{properties:{...this.originalProperties,color:this.form.color,name:this.form.name}}));t=D.featureCollection(n)}}):this.markerType==="Area"&&await this.$refs.areaForm.validate().then(l=>{var n,c,s;if(l!=null&&l.valid){const d=(n=this.map)==null?void 0:n.getSource(this.drawSource);if(!d)return;const m=d._data;if(!((c=m==null?void 0:m.features)!=null&&c.length))return;let p=((s=m.features)==null?void 0:s.filter(u=>u.geometry.type==="Polygon"))||[];if(p=p==null?void 0:p.map(u=>(u.properties.name=this.form.name,u.properties.color=this.form.color,u)),!p.length)return;t=D.featureCollection(p)}}),!t)return!1;const e={name:this.form.name,format:"geojson",color:this.form.color,extend:t};this.saving=!0,await((r=this.editLayer)!=null&&r.id?le.put(`${this.gateway}/api/arc/layers/${this.editLayer.id}`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}):le.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,d;((n=l.data)==null?void 0:n.code)===0&&this.$emit("save",{...e,id:((c=this.editLayer)==null?void 0:c.id)||((d=(s=l.data)==null?void 0:s.data)==null?void 0:d.id)}),this.saving=!1}).catch(l=>{console.error("save marker error",l),this.saving=!1})}}},bp={class:"text-h6 font-weight-600"},wp={class:"text-label mb-1"},xp={class:"text-label mb-1"},kp={class:"mb-1"},_p={class:"text-label mb-1"},Lp={class:"mb-1"},zp={class:"text-label mb-1"},Cp={class:"mb-1"},vp={class:"text-label mb-1"},Sp={class:"color-picker-row d-flex align-start ga-2"},Np=["value"],Pp={class:"mb-n2"},Vp={class:"text-label mb-1"},Mp={class:"mb-1"},Tp={class:"text-label mb-1"},Dp={class:"color-picker-row d-flex align-start ga-2"},Ep=["value"],Rp={class:"mb-n2"},Bp={class:"text-label mb-1"},Ip={key:0,class:"mb-3"},Ap={class:"text-label mb-1"},Fp={class:"mb-1"},Gp={class:"text-label mb-1"},Wp={class:"color-picker-row d-flex align-start ga-2"},Zp=["value"],Op={class:"mb-n2"},jp={class:"text-label mb-1"};function Hp(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("v-card-title"),s=o.resolveComponent("v-divider"),d=o.resolveComponent("v-text-field"),m=o.resolveComponent("v-card-text"),p=o.resolveComponent("v-btn"),u=o.resolveComponent("v-btn-toggle"),y=o.resolveComponent("VTextField"),g=o.resolveComponent("v-col"),h=o.resolveComponent("v-row"),f=o.resolveComponent("VDivider"),w=o.resolveComponent("VCardActions"),z=o.resolveComponent("VForm"),b=o.resolveComponent("v-card");return o.openBlock(),o.createBlock(b,{class:"idm-gl4-draw-dialog-card",elevation:"4"},{default:o.withCtx(()=>{var L;return[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("span",bp,o.toDisplayString((x=a.editLayer)!=null&&x.id?t.$t("actions.edit"):t.$t("actions.addMarker")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[21]||(e[21]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]}),_:1}),o.createVNode(s),o.createVNode(m,{class:"text-body-1 px-4 pb-0"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("div",wp,o.toDisplayString(t.$t("marker.group")),1),o.createVNode(d,{"model-value":(x=a.group)==null?void 0:x.name,density:"compact",variant:"outlined","hide-details":"",disabled:"",class:"input-btn-bg-1"},null,8,["model-value"])]}),_:1}),(L=a.editLayer)!=null&&L.id?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(m,{key:0,class:"text-body-1 px-4 pb-0"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("div",xp,[o.createTextVNode(o.toDisplayString(t.$t("marker.markerType")),1),e[22]||(e[22]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(u,{modelValue:i.markerType,"onUpdate:modelValue":e[0]||(e[0]=k=>i.markerType=k),mandatory:"",group:"",density:"compact",variant:"flat",class:"w-100",disabled:!!((x=a.editLayer)!=null&&x.id)},{default:o.withCtx(()=>[o.createVNode(p,{value:"Point",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.point")),1)]),_:1},8,["class","color"]),o.createVNode(p,{value:"Line",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.line")),1)]),_:1},8,["class","color"]),o.createVNode(p,{value:"Area",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.area")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])]}),_:1})),i.markerType==="Point"?(o.openBlock(),o.createBlock(z,{key:1,ref:"pointForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(m,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",kp,[o.createElementVNode("div",_p,[o.createTextVNode(o.toDisplayString(t.$t("marker.lat")),1),e[23]||(e[23]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(h,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(g,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(y,{modelValue:i.form.latDegree,"onUpdate:modelValue":[e[1]||(e[1]=x=>i.form.latDegree=x),e[2]||(e[2]=x=>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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[24]}),o.createVNode(g,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(y,{modelValue:i.form.latMinute,"onUpdate:modelValue":[e[3]||(e[3]=x=>i.form.latMinute=x),e[4]||(e[4]=x=>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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[25]}),o.createVNode(g,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(p,{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]=x=>{i.form.latDir=i.form.latDir==="N"?"S":"N",l.handleChangePoint()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.latDir),1)]),_:1})]),_:1})]),_:1})]),o.createElementVNode("div",Lp,[o.createElementVNode("div",zp,[o.createTextVNode(o.toDisplayString(t.$t("marker.lng")),1),e[26]||(e[26]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(h,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(g,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(d,{modelValue:i.form.lngDegree,"onUpdate:modelValue":[e[6]||(e[6]=x=>i.form.lngDegree=x),e[7]||(e[7]=x=>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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[27]}),o.createVNode(g,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(d,{modelValue:i.form.lngMinute,"onUpdate:modelValue":[e[8]||(e[8]=x=>i.form.lngMinute=x),e[9]||(e[9]=x=>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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[28]}),o.createVNode(g,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(p,{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]=x=>{i.form.lngDir=i.form.lngDir==="E"?"W":"E",l.handleChangePoint()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.lngDir),1)]),_:1})]),_:1})]),_:1})]),o.createElementVNode("div",Cp,[o.createElementVNode("div",vp,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[29]||(e[29]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Sp,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[11]||(e[11]=x=>i.form.color=x.target.value)},null,40,Np),o.createVNode(d,{modelValue:i.form.color,"onUpdate:modelValue":e[12]||(e[12]=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"])])]),o.createElementVNode("div",Pp,[o.createElementVNode("div",Vp,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[30]||(e[30]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(d,{modelValue:i.form.name,"onUpdate:modelValue":e[13]||(e[13]=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}),o.createVNode(f),o.createVNode(w,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(p,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(p,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0),i.markerType==="Line"?(o.openBlock(),o.createBlock(z,{key:2,ref:"lineForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(m,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",Mp,[o.createElementVNode("div",Tp,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[31]||(e[31]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Dp,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[14]||(e[14]=x=>i.form.color=x.target.value)},null,40,Ep),o.createVNode(d,{modelValue:i.form.color,"onUpdate:modelValue":e[15]||(e[15]=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"])])]),o.createElementVNode("div",Rp,[o.createElementVNode("div",Bp,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[32]||(e[32]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(d,{modelValue:i.form.name,"onUpdate:modelValue":e[16]||(e[16]=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}),o.createVNode(f),o.createVNode(w,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(p,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(p,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0),i.markerType==="Area"?(o.openBlock(),o.createBlock(z,{key:3,ref:"areaForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(m,{class:"px-4 text-body-1"},{default:o.withCtx(()=>{var x,k;return[(x=a.editLayer)!=null&&x.id?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Ip,[o.createElementVNode("div",Ap,[o.createTextVNode(o.toDisplayString(t.$t("marker.areaType")),1),e[33]||(e[33]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(u,{modelValue:i.form.areaType,"onUpdate:modelValue":e[17]||(e[17]=C=>i.form.areaType=C),mandatory:"",group:"",density:"compact",variant:"flat",color:"primary",class:"w-100",disabled:!!((k=a.editLayer)!=null&&k.id)},{default:o.withCtx(()=>[o.createVNode(p,{value:"Polygon",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.polygon")),1)]),_:1},8,["class","color"]),o.createVNode(p,{value:"Circle",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.circle")),1)]),_:1},8,["class","color"]),o.createVNode(p,{value:"Rect",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.rect")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])])),o.createElementVNode("div",Fp,[o.createElementVNode("div",Gp,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[34]||(e[34]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Wp,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[18]||(e[18]=C=>i.form.color=C.target.value)},null,40,Zp),o.createVNode(d,{modelValue:i.form.color,"onUpdate:modelValue":e[19]||(e[19]=C=>i.form.color=C),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),o.createElementVNode("div",Op,[o.createElementVNode("div",jp,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[35]||(e[35]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(d,{modelValue:i.form.name,"onUpdate:modelValue":e[20]||(e[20]=C=>i.form.name=C),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]}),_:1}),o.createVNode(f),o.createVNode(w,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>{var x;return[(x=a.editLayer)!=null&&x.id?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(p,{key:0,class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"])),o.createVNode(p,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]}),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0)]}),_:1})}const Xp=Y(yp,[["render",Hp]]),Fy="",Yp={name:"IdmImportMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String},group:{type:Object,default:null}},setup(){return{Theme:fe.useTheme()}},emits:["close","import"],data(){return{form:{groupName:"",name:"",file:null,format:"",extend:void 0},formRules:{groupName:[t=>t!=null&&t!==""||"required"]},isDragOver:!1,uploading:!1,fileError:"",previewSourceId:"__import_preview__",previewMarkers:[]}},mounted(){var t;this.form.groupName=((t=this.group)==null?void 0:t.name)||"Import layer 1"},beforeUnmount(){this.handleClearPreview()},methods:{handleClose(){this.$emit("close")},handleReset(){var t;this.form={groupName:((t=this.group)==null?void 0:t.name)||"Import layer 1",file:null,format:"",extend:void 0},this.fileError=""},handleSelectFile(){this.$refs.fileInput.click()},handleFileChange(t){const e=t.target.files[0];e&&this.onUpload(e)},handleDrop(t){this.isDragOver=!1;const e=t.dataTransfer.files[0];e&&this.onUpload(e)},onUpload(t){var i,l;if(t.size>10485760){this.$emit("error",this.$t("marker.fileTooLarge"));return}this.form.file=t,this.fileError="",this.form.name=(i=t.name.split("."))==null?void 0:i[0];const a=(l=t.name.split(".").pop())==null?void 0:l.toLowerCase(),r=new FileReader;r.onload=n=>{const c=new Uint8Array(n.target.result);if(c[0]===80&&c[1]===75){const m=new FileReader;m.onload=async p=>{try{const u=await wr(p.target.result),y=Array.isArray(u)?{type:"FeatureCollection",features:u.flatMap(g=>g.features||[])}:u;this.form.extend=y,this.form.format="geojson",console.log(this.form.extend),this.handleDrawLayers()}catch(u){console.error("Shapefile parse error",u),this.$emit("error","Failed to parse shapefile"),this.fileError="Failed to parse shapefile",this.form.file=null}},m.readAsArrayBuffer(t);return}const d=new FileReader;d.onload=m=>{try{const p=m.target.result;if(a==="json"||a==="geojson")this.form.extend=JSON.parse(p),this.form.format="geojson",console.log(this.form.extend);else if(a==="kml"){const u=M.GeoJsonHelper.convertKML2GeoJSON(p);this.form.extend=u,this.form.format="geojson"}else this.$emit("error","Unsupported format: "+a);this.handleDrawLayers()}catch(p){console.error("File parse error",p),this.$emit("error","Failed to parse file"),this.fileError="Failed to parse file"}},d.readAsText(t)},r.readAsArrayBuffer(t.slice(0,4))},handleRemoveFile(){this.form.file=null,this.$refs.fileInput.value="",this.handleClearPreview()},async handleConfirm(){var a,r;const{valid:t}=await this.$refs.importForm.validate();if(!t)return;if(!this.form.file){this.fileError=this.$t("marker.fileRequired");return}this.uploading=!0;let e=this.group.id;if(e||await le.post(`${this.gateway}/api/arc/lygroups`,{name:this.form.groupName},{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(i=>{var l,n;((l=i.data)==null?void 0:l.code)===0&&(e=(n=i.data.data)==null?void 0:n.id)}),!e){this.uploading=!1;return}(r=(a=this.form.extend)==null?void 0:a.features)==null||r.forEach(i=>{var n,c,s,d,m,p;const l={name:((n=i==null?void 0:i.properties)==null?void 0:n.name)||((c=i==null?void 0:i.properties)==null?void 0:c.shape)||((d=(s=i==null?void 0:i.geometry)==null?void 0:s.type)==null?void 0:d.toLowerCase()),format:this.form.format,color:((m=i==null?void 0:i.properties)==null?void 0:m.color)||((p=this.Theme.current.value.colors)==null?void 0:p["map-green"]),extend:D.featureCollection([i])};le.post(`${this.gateway}/api/arc/lygroups/${e}/layers`,l,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(u=>{var y;((y=u.data)==null?void 0:y.code)===0&&(this.$emit("import"),this.uploading=!1)}).catch(u=>{this.uploading=!1})})},handleDrawLayers(){if(!this.map||!this.form.extend)return;this.handleClearPreview();const t=this.form.extend,e=this.previewSourceId,a=t.features||(t.type==="Feature"?[t]:[]);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[d,m]=i.geometry.coordinates;this.previewMarkers.push(new ne.Marker({color:l}).setLngLat([d,m]).addTo(this.map))}i.properties.color||(i.properties.color=l)}),this.map.getSource(e)?this.map.getSource(e).setData(t):this.map.addSource(e,{type:"geojson",data:t});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 t=this.previewSourceId;[`${t}-vertex`,`${t}-point`,`${t}-line`,`${t}-fill`,`${t}-outline`].forEach(a=>{this.map.getLayer(a)&&this.map.removeLayer(a)}),this.map.getSource(t)&&this.map.removeSource(t)}}},Up={class:"text-h6 font-weight-600"},$p={class:"mb-4"},Jp={class:"text-label mb-1"},Kp={class:"text-body-2 text-center text-label"},qp={class:"text-body-1 text-primary mt-2 cursor-pointer"},Qp={class:"text-body-2 text-left text-label mt-1"},eg={key:0,class:"text-body-2 text-left text-danger mt-1"},tg={key:1,class:"file-item d-flex align-center justify-space-between mt-2 gray-bg-1 pa-1"},og={class:"text-body-2 text-truncate"};function ag(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("v-card-title"),s=o.resolveComponent("v-divider"),d=o.resolveComponent("v-text-field"),m=o.resolveComponent("v-icon"),p=o.resolveComponent("v-card-text"),u=o.resolveComponent("VDivider"),y=o.resolveComponent("v-btn"),g=o.resolveComponent("VCardActions"),h=o.resolveComponent("VForm"),f=o.resolveComponent("v-card");return o.openBlock(),o.createBlock(f,{class:"idm-gl4-import-dialog-card",elevation:"4"},{default:o.withCtx(()=>[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("span",Up,o.toDisplayString(t.$t("marker.importLayer")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[7]||(e[7]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[7]},8,["onClick"])]),_:1}),o.createVNode(s),o.createVNode(h,{ref:"importForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleConfirm,["prevent"])},{default:o.withCtx(()=>[o.createVNode(p,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",$p,[o.createElementVNode("div",Jp,[o.createTextVNode(o.toDisplayString(t.$t("marker.group")),1),e[8]||(e[8]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(d,{modelValue:i.form.groupName,"onUpdate:modelValue":e[0]||(e[0]=w=>i.form.groupName=w),density:"compact",variant:"outlined","hide-details":"",class:"input-btn-bg-1"},null,8,["modelValue"])]),o.createElementVNode("div",{class:o.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[2]||(e[2]=o.withModifiers(w=>i.isDragOver=!0,["prevent"])),onDragleave:e[3]||(e[3]=o.withModifiers(w=>i.isDragOver=!1,["prevent"])),onDragover:e[4]||(e[4]=o.withModifiers(()=>{},["prevent"])),onDrop:e[5]||(e[5]=o.withModifiers((...w)=>l.handleDrop&&l.handleDrop(...w),["prevent"])),onClick:e[6]||(e[6]=(...w)=>l.handleSelectFile&&l.handleSelectFile(...w))},[o.createVNode(m,{size:"36",color:"grey",class:"mb-2"},{default:o.withCtx(()=>e[9]||(e[9]=[o.createTextVNode("mdi-cloud-upload-outline",-1)])),_:1,__:[9]}),o.createElementVNode("div",Kp,o.toDisplayString(t.$t("marker.uploadHint")),1),o.createElementVNode("div",qp,o.toDisplayString(t.$t("marker.selectFile")),1),o.createElementVNode("input",{ref:"fileInput",type:"file",style:{display:"none"},accept:".json,.geojson,.zip,.shp,.kml,.kmz",onChange:e[1]||(e[1]=(...w)=>l.handleFileChange&&l.handleFileChange(...w))},null,544)],34),o.createElementVNode("div",Qp,o.toDisplayString(t.$t("marker.uploadLimit")),1),i.fileError?(o.openBlock(),o.createElementBlock("div",eg,o.toDisplayString(i.fileError),1)):o.createCommentVNode("",!0),i.form.file?(o.openBlock(),o.createElementBlock("div",tg,[o.createElementVNode("span",og,[o.createVNode(m,{size:"16",color:"success",class:"mr-1"},{default:o.withCtx(()=>e[10]||(e[10]=[o.createTextVNode("mdi-check-circle",-1)])),_:1,__:[10]}),o.createTextVNode(" "+o.toDisplayString(i.form.file.name),1)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",size:"small",class:"file-remove-btn",onClick:l.handleRemoveFile},{default:o.withCtx(()=>[o.createVNode(m,{size:"16"},{default:o.withCtx(()=>e[11]||(e[11]=[o.createTextVNode("mdi-close",-1)])),_:1,__:[11]})]),_:1},8,["onClick"])])):o.createCommentVNode("",!0)]),_:1}),o.createVNode(u),o.createVNode(g,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(y,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleReset},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.reset")),1)]),_:1},8,["onClick"]),o.createVNode(y,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.uploading},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1})}const ig=Y(Yp,[["render",ag]]),Gy="",rg={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(t){this.localName=(t==null?void 0:t.name)||""},immediate:!0}},methods:{handleClose(){this.$emit("update:modelValue",!1)},async handleConfirm(){var t;!this.group||!((t=this.localName)!=null&&t.trim())||(this.saving=!0,await le.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")}).catch(()=>{}).finally(()=>{this.saving=!1}))}}},lg={class:"text-h6 font-weight-600"},ng={class:"text-label mb-2"};function sg(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("v-card-title"),s=o.resolveComponent("v-divider"),d=o.resolveComponent("v-text-field"),m=o.resolveComponent("v-card-text"),p=o.resolveComponent("VDivider"),u=o.resolveComponent("v-btn"),y=o.resolveComponent("VCardActions"),g=o.resolveComponent("v-card"),h=o.resolveComponent("v-dialog");return o.openBlock(),o.createBlock(h,{"model-value":a.modelValue,"max-width":"320",persistent:"","onUpdate:modelValue":e[1]||(e[1]=f=>t.$emit("update:modelValue",f))},{default:o.withCtx(()=>[o.createVNode(g,{class:"",elevation:"4"},{default:o.withCtx(()=>[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("span",lg,o.toDisplayString(t.$t("actions.editGroup")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[2]||(e[2]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[2]},8,["onClick"])]),_:1}),o.createVNode(s),o.createVNode(m,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",ng,[o.createTextVNode(o.toDisplayString(t.$t("marker.groupName")),1),e[3]||(e[3]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(d,{modelValue:i.localName,"onUpdate:modelValue":e[0]||(e[0]=f=>i.localName=f),density:"compact",variant:"outlined","hide-details":"",autocomplete:"off",height:"32px","min-height":"32px",class:"input-btn-bg-1"},null,8,["modelValue"])]),_:1}),o.createVNode(p),o.createVNode(y,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(u,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClose},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(u,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",loading:i.saving,onClick:l.handleConfirm},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["model-value"])}const cg=Y(rg,[["render",sg]]),mg={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}}},dg={class:"text-body-1 pb-1"},hg={class:"text-body-1"};function pg(t,e,a,r,i,l){const n=o.resolveComponent("v-icon"),c=o.resolveComponent("VBtn"),s=o.resolveComponent("v-card-title"),d=o.resolveComponent("v-card-text"),m=o.resolveComponent("v-card-actions"),p=o.resolveComponent("v-card"),u=o.resolveComponent("v-dialog");return o.openBlock(),o.createBlock(u,{modelValue:i.showDialog,"onUpdate:modelValue":e[0]||(e[0]=y=>i.showDialog=y),width:"500","min-width":"500","max-width":"500"},{default:o.withCtx(()=>[o.createVNode(p,{class:""},{default:o.withCtx(()=>[o.createVNode(s,{class:"text-h6 font-weight-600 d-flex justify-center align-center py-4"},{default:o.withCtx(()=>[o.createVNode(n,{color:"warning",icon:"mdi-alert-circle",size:"small",class:"mr-2"}),o.createElementVNode("div",null,o.toDisplayString(a.title),1),o.createVNode(c,{icon:"",density:"compact",variant:"plain",class:"position-absolute top-0 right-0 mt-2 mr-2",onClick:l.handleClose},{default:o.withCtx(()=>e[1]||(e[1]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),_:1}),o.createVNode(d,{class:"py-4 text-center"},{default:o.withCtx(()=>[o.createElementVNode("p",dg,o.toDisplayString(a.tips),1),o.createElementVNode("p",hg,o.toDisplayString(t.$t("tips.doYouWantToContinue")),1)]),_:1}),o.createVNode(m,{class:"w-100 d-flex justify-center align-center ga-8 py-6"},{default:o.withCtx(()=>[o.createVNode(c,{variant:"tonal",class:"text-none text-body-1",height:"32",onClick:l.handleClose},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(c,{loading:a.loading,variant:"flat",color:"danger",class:"text-none text-body-1",height:"32",onClick:l.handleDelete},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.delete")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])}const gg=Y(mg,[["render",pg]]),Wy="",Zy="",ug={name:"IdmMarker",components:{IdmDrawMarker:Xp,IdmImportMarker:ig,IdmGroupDialog:cg,DeleteDialog:gg},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},setup(){return{Theme:fe.useTheme()}},emits:["map","menuToggle","theme"],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 t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.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(t){this.drawDialog=!1,this.importDialog=!1,this.currentGroup=t,this.groupDialog=!0},handleSaveGroup(){this.fetchAllLayers(),this.groupDialog=!1,this.currentGroup=void 0},handleOpenDelete(t,e){t==="group"?(this.currentGroup=e,this.currentLayer=void 0):t==="layer"&&(this.currentGroup=void 0,this.currentLayer=e),this.$refs.deleteDialog.open()},confirmDelete(){var t;this.currentGroup?this.handleDeleteGroup((t=this.currentGroup)==null?void 0:t.id):this.currentLayer&&this.handleDeleteLayer(this.currentLayer)},async handleDeleteGroup(t){t&&(this.deleteLoading=!0,await le.delete(`${this.gateway}/api/arc/lygroups/${t}`,{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(t){this.handleCloseDraw(),this.currentGroup=t||this.layerGroup.find(e=>e.name==="Custom Layers"),this.importDialog=!1,this.drawDialog=!0},handleOpenImportDialog(t){this.drawDialog=!1,this.handleCloseDraw(),this.currentGroup=t||void 0,this.importDialog=!0},handleImportLayer(t){this.fetchAllLayers(),this.importDialog=!1},handleSaveMarker(t){this.fetchAllLayers(),this.drawDialog=!1,this.currentLayer=null},handleCloseDraw(){this.drawDialog=!1,this.currentLayer=null,this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=void 0},handleEditLayer(t,e){this.importDialog=!1,this.currentGroup=t,this.currentLayer=e,this.drawDialog=!0},async fetchAllLayers(){this.loading=!0,this.layerGroup=[],await le.get(`${this.gateway}/api/arc/lygroups/my`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(t=>{var e,a,r,i,l,n;if(((e=t.data)==null?void 0:e.code)===0){this.loading=!1,this.layerGroup=((i=(r=(a=t.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 d;s.show=!0,(d=s.layers)==null||d.forEach(m=>{var u;m.layerGroupId=s.id;const p=typeof m.extend=="string"?JSON.parse(m.extend):m.extend;(u=p==null?void 0:p.features)==null||u.forEach(y=>{y.properties.lgId=s.id,y.properties.layerId=m.id,y.properties.name||(y.properties.name=m.name)}),c.push(m)})}),this.layers=c,this.handleDrawAllLayers(),(n=this.$refs.drawDialog)==null||n.handleClearDraw()}}).catch(()=>{this.loading=!1})},async handleDeleteLayer(t){this.deleteLoading=!0,await le.delete(`${this.gateway}/api/arc/layers/${t.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(t){if(!this.map||!(t!=null&&t.extend))return;const e=typeof t.extend=="string"?JSON.parse(t.extend):t.extend;if(!e)return;const a=`marker-layer-${t.id}`;this.handleClearLayerMarkers(t.id);const r=e.features||(e.type==="Feature"?[e]:[]);if(r.some(c=>{var s,d;return(((s=c.geometry)==null?void 0:s.type)==="Point"||((d=c.geometry)==null?void 0:d.type)==="MultiPoint")&&c.properties.type==="point"})){const c=[];r.forEach(s=>{var u,y,g,h;const d=(u=s.geometry)==null?void 0:u.type,m=((y=s.properties)==null?void 0:y.name)||"",p=((g=s.properties)==null?void 0:g.color)||t.color||((h=this.Theme.current.value.colors)==null?void 0:h["map-green"]);if(d==="Point"){const[f,w]=s.geometry.coordinates,z=`<div style="font-size:12px;line-height:1.5;">
|
|
220
220
|
<div style="font-weight:600;">${m}</div>
|
|
221
221
|
<div>${M.LngLatHelper.lat2pretty(w,4).pretty}, ${M.LngLatHelper.lng2pretty(f,4).pretty}</div>
|
|
222
222
|
</div>`,b=new ne.Popup({offset:40,closeButton:!1,closeOnClick:!1,anchor:"bottom",className:"marker-popup-dark"}).setHTML(z),L=new ne.Marker({color:p}).setLngLat([f,w]).addTo(this.map),x=L.getElement();x.addEventListener("mouseenter",()=>b.setLngLat([f,w]).addTo(this.map)),x.addEventListener("mouseleave",()=>b.remove()),c.push(L)}else d==="MultiPoint"&&s.geometry.coordinates.forEach(([f,w])=>{const z=`<div style="font-size:12px;line-height:1.5;">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as l } from "./chunk-ANSXOGKI-
|
|
2
|
-
import "./chunk-3VYIPD3A-
|
|
3
|
-
import "./index-
|
|
1
|
+
import { d as l } from "./chunk-ANSXOGKI-b47bfee0.js";
|
|
2
|
+
import "./chunk-3VYIPD3A-2309d6cb.js";
|
|
3
|
+
import "./index-a6d2c224.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-
|
|
2
|
-
import "./chunk-3VYIPD3A-
|
|
3
|
-
import "./index-
|
|
1
|
+
import { m as k } from "./chunk-T4JIPPZO-8afc16b4.js";
|
|
2
|
+
import "./chunk-3VYIPD3A-2309d6cb.js";
|
|
3
|
+
import "./index-a6d2c224.js";
|
|
4
4
|
import "axios";
|
|
5
5
|
import "vuetify";
|
|
6
6
|
import "vue";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as u } from "./chunk-ANSXOGKI-
|
|
2
|
-
import { l as g } from "./index-
|
|
3
|
-
import "./chunk-3VYIPD3A-
|
|
1
|
+
import { d as u } from "./chunk-ANSXOGKI-b47bfee0.js";
|
|
2
|
+
import { l as g } from "./index-a6d2c224.js";
|
|
3
|
+
import "./chunk-3VYIPD3A-2309d6cb.js";
|
|
4
4
|
import "axios";
|
|
5
5
|
import "vuetify";
|
|
6
6
|
import "vue";
|