zhihao-ui 1.3.50 → 1.3.52

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/es/index.js CHANGED
@@ -17,7 +17,7 @@ import { Z as B } from "./BaseInfo-Cu3ME-K_.js";
17
17
  import { Z as g } from "./DetailHeader-DTHE-pQa.js";
18
18
  import { Z as x } from "./DiyDataTable-BQaaClFf.js";
19
19
  import { D as V } from "./DiyDataTable-BQaaClFf.js";
20
- import { Z as G } from "./Map-BnrPdkzo.js";
20
+ import { Z as G } from "./Map-BTSSoA-T.js";
21
21
  import { Z as M } from "./Table-CzNjEPnP.js";
22
22
  import { Z as $ } from "./BaseItem-Co7KlYD6.js";
23
23
  const A = [
@@ -7,6 +7,6 @@ export declare const useDrawLineManager: (mapInstance: Map, propsManager: PropsM
7
7
  close: () => void;
8
8
  deleteLine: (id: string) => void;
9
9
  setUnit: (unitValue: string) => void;
10
- getState: () => boolean;
10
+ getState: () => "close" | "open";
11
11
  };
12
12
  export declare const computedDistance: (line: LineString, unit: string) => string;
@@ -189,7 +189,7 @@ ye.version="2.30.1",JB(Dt),ye.fn=le,ye.min=$V,ye.max=zV,ye.now=WV,ye.utc=_i,ye.u
189
189
  <path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
190
190
  <path fill-rule="evenodd" clip-rule="evenodd" d="M19.9998 0.5V3.5L3.49976 3.5V20H0.499756V0.500002L19.9998 0.5ZM45.4998 3.5H28.9998V0.5H48.4998V20H45.4998V3.5ZM48.4998 29L48.4998 48.5H28.9998V45.5H45.4998L45.4998 29H48.4998ZM3.49976 45.5L3.49976 29H0.499756L0.499758 48.5L19.9998 48.5V45.5L3.49976 45.5Z" fill="#FF2424"/>
191
191
  </svg>
192
- `;return new _t({image:new ni({src:`data:image/svg+xml;utf8,${encodeURIComponent(s)}`,scale:r,anchorXUnits:"fraction",anchorYUnits:"fraction"})})};function M7(t,e,n,r){if(e){const o=new Os({element:n,positioning:"top-left",id:"label-"+(r==null?void 0:r.id),offset:[20,-20],autoPan:!1,position:e,className:r!=null&&r.blinking?"ship-label-overlay-blinking":"ship-label-overlay"});o.set("class","zh-map-ship-overlay"),t.addOverlay(o)}}const D7=(t,e)=>{const{lon:n,lat:r,blinking:o}=e,s=z2(e);n&&r&&M7(t,Jr([n,r]),s,{...e,blinking:o})},z2=t=>{const e=document.createElement("div");e.className="ship-overlay-box",e.style.position="relative";const{lon:n,lat:r,blinking:o,blinkingColors:s,name:a}=t,l=i.createVNode({setup(){return x7({position:[n+.002,r+.002],selected:o,name:a,colors:s||[],existDevice:t==null?void 0:t.existDevice,existMobile:t==null?void 0:t.existMobile,existWaterGauge:t==null?void 0:t.existWaterGauge})}});return i.render(l,e),e},W2=t=>{const e=[];return t.existDevice&&e.push("&#xe687;"),t.existMobile&&e.push("&#xe688;"),t.existWaterGauge&&e.push("&#xe686;"),e};function I7(){const t=["left-top","left-middle","left-bottom","right-top","right-middle","right-bottom"];return t[Math.floor(Math.random()*t.length)]}const P7=window.devicePixelRatio||1,C0=new Map;let zc=null,E0=null;function O7(t,e,n="left-bottom",r=10){const o=`${t}-${e.join(",")}-${n}-${r}`;if(C0.has(o))return C0.get(o);if(!zc){zc=document.createElement("canvas");try{E0=zc.getContext("2d",{willReadFrequently:!0})}catch(D){console.log("e",D),E0=zc.getContext("2d")}}const s=zc,a=E0;if(!a)return"";s.width=0,s.height=0;const l=2,c=4,d=16,u=window.devicePixelRatio||1,f="500 12px Arial",p="12px map-iconfont";a.font=f;const h=a.measureText(t).width;a.font=p;const y=e.map(D=>({width:a.measureText(Ls(D)).width,height:14})),g=y.reduce((D,P)=>D+P.width,0),b=e.length*r,w=c+h+g+b+c,C=l+14+l*2;let _,E,S=0,v=0,x=0,k=0,M=0,T=0;switch(_=d+w,n){case"right-top":E=d+C,S=0,v=d+C,x=d,k=0,M=d,T=0;break;case"right-middle":E=C,S=0,v=C/2,x=d,k=C/2,M=d,T=0;break;case"right-bottom":E=d+C,S=0,v=0,x=d,k=d,M=d,T=d;break;case"left-top":E=d+C,S=w,v=d,x=w+d,k=C+d,M=0,T=0;break;case"left-middle":E=C,S=w,v=C/2,x=w+d,k=C/2,M=0,T=0;break;case"left-bottom":E=d+C,S=w,v=C,x=w+d,k=0,M=0,T=d;break}E=E+l,s.width=Math.round(_*u),s.height=Math.round(E*u),a.scale(u,u),a.clearRect(0,0,_,E),a.beginPath(),a.moveTo(S,v),a.lineTo(x,k),a.strokeStyle="#FFF",a.lineWidth=1,a.stroke(),a.fillStyle="#FFF",a.fillRect(M,T,w,C),a.font=f,a.textBaseline="middle";const L=T+l/2+C/2;a.strokeStyle="#ffffff",a.lineWidth=1,a.strokeText(t,M+c,L),a.fillStyle="#000000",a.fillText(t,M+c,L),a.font=p,a.fillStyle="#3370ff";let O=M+c+h+r;const F=T+C/2;e.length>0&&e.forEach((D,P)=>{a.fillText(Ls(D),O,F),O+=y[P].width+r});const I=s.toDataURL("image/png");return C0.set(o,I),I}const Y2=(t,e)=>{const{name:n,rightIcons:r,selected:o}=t.getProperties(),s=e!==1?I7():"right-top",a=O7(n,r,s);let l=[0,0];switch(s){case"right-top":l=[0,1];break;case"right-middle":l=[0,.5];break;case"right-bottom":l=[0,0];break;case"left-top":l=[1,1];break;case"left-middle":l=[1,.5];break;case"left-bottom":l=[1,0];break}return new _t({image:new ni({src:a,anchor:l,displacement:[0,0],scale:1/P7,anchorXUnits:"fraction",anchorYUnits:"fraction"}),zIndex:o?100:10})},N7=t=>{let e=null,n=null;const r=new Di,o=new v7({source:r,className:"zh-map--ship-layer",renderBuffer:300,zIndex:101,properties:{layerType:Un.SHIP}}),s=new Di,a=new go({source:s,className:"zh-map--ship-label-layer",zIndex:102,updateWhileInteracting:!1,updateWhileAnimating:!1,properties:{layerType:Un.SHIP},declutter:!0}),l=new Di,c=new go({source:l,className:"zh-map--ship-selected-layer",zIndex:999});t==null||t.addLayer(o),t==null||t.addLayer(a),t==null||t.addLayer(c);let d=null,u="",f={},p={};const m=T=>{if(!T||!t)return;const L=(n==null?void 0:n.id)||(e==null?void 0:e.get("id"));if(n){const O=T.filter(F=>F.id===L);O.length===0?T.push(n):n=O[0]}b(),M(T),y()},h=T=>{var R;const L=(n==null?void 0:n.id)||(e==null?void 0:e.get("id")),O=Jr([T==null?void 0:T.lon,T==null?void 0:T.lat]),F=((R=p[T.id])==null?void 0:R.blinkColors)||[],D=F[F.length-1]||T.fill||"#04C900",P=k7(T),N=new Kt({geometry:new Xt(O),shipData:T,id:T.id,name:T.cnname||T.enname||T.name||T.id||"未命名船舶",selected:T.id===L,rightIcons:W2(T),color:D,direct:P,isHighlight:!1});return N.set("clickGeometry",new Lc(O)),N},y=()=>{if(n&&t&&n){l.getFeatures().length>0&&l.clear();const T=Jr([n==null?void 0:n.lon,n==null?void 0:n.lat]),L=new Kt({geometry:new Xt(T),id:n.id});L.setStyle(R7(t,n)),l.addFeature(L)}},g=T=>{if(T==="start"){const L=()=>{const O=l.getFeatures();r.getFeatures().forEach(F=>{var D,P;const I=il(t,F);if(F.setStyle(I),F.get("id")===(n==null?void 0:n.id)&&O&&O[0]){const N=O[0],R=N==null?void 0:N.getStyle();if(R&&(R!=null&&R.getImage())){const A=(D=I.getImage())==null?void 0:D.getScale();A&&((P=R.getImage())==null||P.setScale(A))}}}),d=requestAnimationFrame(L)};L()}T==="end"&&d&&(cancelAnimationFrame(d),d=null)},b=()=>{t&&r&&(w(),r.clear(),s.clear(),l.clear(),g("end"))},w=T=>{const L=t.getOverlays().getArray().filter(O=>O.get("class")=="zh-map-ship-overlay");if(L&&L.length>0){for(let O=0;O<L.length;O++)if(L[O].get("class")!=="ship-overlay-selected"){const F=L[O];console.log("overlay---",F),F.setPosition(void 0),t.removeOverlay(F),F.dispose()}}},C=(T,L)=>{f=T,p=L;const O=t.getOverlays().getArray(),F=r.getFeatures();for(const I in f){const D=f[I],P=O.find(R=>(R==null?void 0:R.getId())==="label-"+I),N=F.find(R=>I===R.get("id"));if(P&&N){const R=L[I].blinkColors||[],{shipData:A,name:B,color:Y}=N.getProperties();N.set("blinking",D),R[(R==null?void 0:R.length)-1]&&Y!==R[(R==null?void 0:R.length)-1]&&(N.set("color",R[(R==null?void 0:R.length)-1]||""),N.setStyle(il(t,N)));const z={...A,blinking:D,blinkingColors:R||[],name:B+"("+L[I].shipState+")"},W=P.getElement(),Z=z2(z);W&&W!==Z&&P.setElement(Z)}}},_=T=>{if(!t)return;const L=r.getFeatures(),O=s.getFeatures(),F=e?e.get("id"):"",I=L.filter(R=>R.get("id")!==F),D=O==null?void 0:O.filter(R=>R.get("id")!==F),P=new Map;T.forEach(R=>{P.set(R.id,!0)});const N=t.getOverlays().getArray();I.forEach(R=>{const A=R.get("id");if(!P.has(A))R.setStyle([]);else{const Y=R.getStyle();(Y==null?void 0:Y.length)==0&&R.setStyle(il(t,R))}const B=N.find(Y=>Y.getId()==="label-"+A);B&&B.setPosition(void 0)}),D.forEach(R=>{const A=R.get("id");if(!P.has(A))R.setStyle([]);else{const B=R.getStyle();(B==null?void 0:B.length)==0&&R.setStyle(Y2(R,T.length))}})},E=T=>{if(T){console.log("选中",T);const L=r.getFeatures().find(F=>F.get("id")===T.id),O=s.getFeatures().find(F=>F.get("id")===T.id);L&&(e=L),O&&O.set("selected",!0),n=T,y()}else console.log("取消选中"),n=null,e=null,x()},S=Li((T,L,O)=>{try{if(T){const F=T.get("shipData"),I=T.get("id");if(L==="click"&&(E(F),O&&O(I)),L==="hover"){u&&u!==I&&v(),u=I;const D=r.getFeatures().find(P=>P.get("id")===u);D==null||D.set("isHighlight",!0),D==null||D.setStyle(il(t,D))}}else v()}catch(F){console.log("handleShipMapEvent",F)}},10),v=()=>{const T=u?r.getFeatures().find(L=>L.get("id")===u):null;u=null,T==null||T.set("isHighlight",!1),T==null||T.setStyle(il(t,T))},x=()=>{try{l.clear()}catch(T){console.log(T)}},k=(T,L)=>{const O=Jr([T==null?void 0:T.lon,T==null?void 0:T.lat]),F=new Kt({geometry:new Xt(O),name:T.cnname||T.enname||T.name||T.id||"未命名船舶",rightIcons:W2(T),selected:(T==null?void 0:T.id)===(n==null?void 0:n.id),shipData:T});F.set("id",T.id);const I=Y2(F,L);return F.setStyle(I),F},M=T=>{const L=t.getView().getZoom();T.forEach(O=>{const F=h(O);if(F.setStyle(il(t,F)),r.addFeature(F),(n==null?void 0:n.id)==O.id||L&&L>=In.shipModelMin)if(f[O.id]){if(O.id&&p[O==null?void 0:O.id]){const I=p[O==null?void 0:O.id]||{},D=(I==null?void 0:I.blinkColors)||[],P=(I==null?void 0:I.shipState)||"",N=(O.cnname||O.enname||O.name||O.id||"未命名船舶")+"("+P+")",R={...O,name:N,blinking:f[O.id],blinkingColors:D||[]};D7(t,R)}}else{const I=k(O,T.length);s.addFeature(I)}})};return{render:m,selected:E,filter:_,blinking:C,clear:b,handleShipMapEvent:S,changeShipScale:g}},L7=t=>{const e=()=>t==null?void 0:t.getLayers(),n=i.ref("vector"),r=()=>n.value,o=c=>{n.value=c;const d=e();d&&(d==null||d.getArray().forEach(u=>{(u.className_==="vector"||u.className_==="satellite")&&u.setVisible(u.className_===c)}))},s=i.ref(!1);return{getLayers:e,getGreenTileVisible:()=>s.value,setGreenTileVisible:c=>{if(c!==s.value){if(c){const d=e();if(!d.getArray().find(f=>f.className_==="greenTile")){const f=new el({source:new rl({url:Ns.greenTile}),visible:c,zIndex:2,className:"greenTile"});d.push(f)}}else{const d=e(),u=d.getArray().find(f=>f.className_==="greenTile");u&&d.remove(u)}s.value=c}},getShowLayerType:r,setShowLayerType:o}},A7=()=>{const t=i.ref();return{setProps:r=>{t.value=r},getProps:()=>t.value}},F7=t=>{const e="zh-map-location-layer";let n,r,o=null,s=null;const a=h=>{if(!(!h||h.length===0)){if(r||(r=new Di),r.clear(),s){const y=h.find(g=>g.id===s.id);y?s=y:h.push(s)}h.forEach(y=>{l(y)}),n||(n=new go({className:e,source:r,zIndex:100}),t==null||t.addLayer(n))}},l=h=>{const y=t==null?void 0:t.getView().getZoom(),[g,b]=h.latLon.split(","),w=new Kt({geometry:new Xt(Jr([Number(g),Number(b)]))});w.setStyle(c(h,y,h.id===(s==null?void 0:s.id))),w.set("loactionData",h),r.addFeature(w)},c=(h,y,g)=>{const b={image:new ni({src:g&&h.selectedPath||h.defaultPath,scale:.5*y/10})};return h.name&&(b.text=new uo({text:h.name,font:"12px sans-serif",fill:new rn({color:"#000000"}),backgroundFill:new rn({color:"#FFFFFF"}),offsetY:30})),new _t(b)},d=()=>{if(o){const h=o.get("loactionData").id;r.getFeatures().forEach(y=>{y.get("loactionData").id!==h&&r.removeFeature(y)})}else r.clear()},u=()=>{var b;const h=o.get("loactionData"),y=(b=t==null?void 0:t.getView())==null?void 0:b.getZoom();r.getFeatures().forEach(w=>{w.get("loactionData").id===h.id&&(w==null||w.setStyle(c(h,y,!1)))}),s=null,o=null},f=h=>{h?(p(),m(h)):clearSelectedPort()},p=()=>{var h;if(o){const y=o.get("loactionData"),g=(h=t==null?void 0:t.getView())==null?void 0:h.getZoom();o.setStyle(c(y,g,!1))}},m=h=>{const y=r.getFeatures();s=h,o=y.find(g=>g.get("loactionData").id===h.id)};return{render:a,selected:f,clearSelected:u,clear:d}},Ef={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Sf extends Ei{constructor(e,n){super(e),this.feature=n}}function B7(t,e){const n=[];for(let r=0;r<e.length;++r){const s=e[r].getGeometry();G2(t,s,n)}return n}function vf(t,e){return no(t[0],t[1],e[0],e[1])}function ol(t,e){const n=t.length;return e<0?t[e+n]:e>=n?t[e-n]:t[e]}function xf(t,e,n){let r,o;e<n?(r=e,o=n):(r=n,o=e);const s=Math.ceil(r),a=Math.floor(o);if(s>a){const c=sl(t,r),d=sl(t,o);return vf(c,d)}let l=0;if(r<s){const c=sl(t,r),d=ol(t,s);l+=vf(c,d)}if(a<o){const c=ol(t,a),d=sl(t,o);l+=vf(c,d)}for(let c=s;c<a-1;++c){const d=ol(t,c),u=ol(t,c+1);l+=vf(d,u)}return l}function G2(t,e,n){if(e instanceof $n){kf(t,e.getCoordinates(),!1,n);return}if(e instanceof Ac){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o)kf(t,r[o],!1,n);return}if(e instanceof oo){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o)kf(t,r[o],!0,n);return}if(e instanceof Bc){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o){const a=r[o];for(let l=0,c=a.length;l<c;++l)kf(t,a[l],!0,n)}return}if(e instanceof hf){const r=e.getGeometries();for(let o=0;o<r.length;++o)G2(t,r[o],n);return}}const S0={index:-1,endIndex:NaN};function V7(t,e,n,r){const o=t[0],s=t[1];let a=1/0,l=-1,c=NaN;for(let f=0;f<e.targets.length;++f){const p=e.targets[f],m=p.coordinates;let h=1/0,y;for(let g=0;g<m.length-1;++g){const b=m[g],w=m[g+1],C=j2(o,s,b,w);C.squaredDistance<h&&(h=C.squaredDistance,y=g+C.along)}h<a&&(a=h,p.ring&&e.targetIndex===f&&(p.endIndex>p.startIndex?y<p.startIndex&&(y+=m.length):p.endIndex<p.startIndex&&y>p.startIndex&&(y-=m.length)),c=y,l=f)}const d=e.targets[l];let u=d.ring;if(e.targetIndex===l&&u){const f=sl(d.coordinates,c),p=n.getPixelFromCoordinate(f);EE(p,e.startPx)>r&&(u=!1)}if(u){const f=d.coordinates,p=f.length,m=d.startIndex,h=c;if(m<h){const y=xf(f,m,h);xf(f,m,h-p)<y&&(c-=p)}else{const y=xf(f,m,h);xf(f,m,h+p)<y&&(c+=p)}}return S0.index=l,S0.endIndex=c,S0}function kf(t,e,n,r){const o=t[0],s=t[1];for(let a=0,l=e.length-1;a<l;++a){const c=e[a],d=e[a+1],u=j2(o,s,c,d);if(u.squaredDistance===0){const f=a+u.along;r.push({coordinates:e,ring:n,startIndex:f,endIndex:f});return}}}const v0={along:0,squaredDistance:0};function j2(t,e,n,r){const o=n[0],s=n[1],a=r[0],l=r[1],c=a-o,d=l-s;let u=0,f=o,p=s;return(c!==0||d!==0)&&(u=Lt(((t-o)*c+(e-s)*d)/(c*c+d*d),0,1),f+=c*u,p+=d*u),v0.along=u,v0.squaredDistance=Pu(no(t,e,f,p),10),v0}function sl(t,e){const n=t.length;let r=Math.floor(e);const o=e-r;r>=n?r-=n:r<0&&(r+=n);let s=r+1;s>=n&&(s-=n);const a=t[r],l=a[0],c=a[1],d=t[s],u=d[0]-l,f=d[1]-c;return[l+u*o,c+f*o]}class Tf extends Xa{constructor(e){const n=e;n.stopDown||(n.stopDown=xa),super(n),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=e.source?e.source:null,this.features_=e.features?e.features:null,this.snapTolerance_=e.snapTolerance?e.snapTolerance:12,this.type_=e.type,this.mode_=z7(this.type_),this.stopClick_=!!e.stopClick,this.minPoints_=e.minPoints?e.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:e.maxPoints?e.maxPoints:1/0,this.finishCondition_=e.finishCondition?e.finishCondition:va,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let r=e.geometryFunction;if(!r){const o=this.mode_;if(o==="Circle")r=(s,a,l)=>{const c=a||new Lc([NaN,NaN]),d=Qr(s[0]),u=CE(d,Qr(s[s.length-1]));return c.setCenterAndRadius(d,Math.sqrt(u),this.geometryLayout_),c};else{let s;o==="Point"?s=Xt:o==="LineString"?s=$n:o==="Polygon"&&(s=oo),r=(a,l,c)=>(l?o==="Polygon"?a[0].length?l.setCoordinates([a[0].concat([a[0][0]])],this.geometryLayout_):l.setCoordinates([],this.geometryLayout_):l.setCoordinates(a,this.geometryLayout_):l=new s(a,this.geometryLayout_),l)}}this.geometryFunction_=r,this.dragVertexDelay_=e.dragVertexDelay!==void 0?e.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.overlay_=new go({source:new Di({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:$7(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:s0,this.freehandCondition_,e.freehand?this.freehandCondition_=o0:this.freehandCondition_=e.freehandCondition?e.freehandCondition:p2,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(e0.ACTIVE,this.updateState_)}setTrace(e){let n;e?e===!0?n=o0:n=e:n=HY,this.traceCondition_=n}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===Ve.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let n=e.type===bt.POINTERMOVE,r=!0;return!this.freehand_&&this.lastDragTime_&&e.type===bt.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,n=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===bt.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),r=!1):this.freehand_&&e.type===bt.POINTERDOWN?r=!1:n&&this.getPointerCount()<2?(r=e.type===bt.POINTERMOVE,r&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===bt.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===bt.DBLCLICK&&(r=!1),super.handleEvent(e)&&r}handleDownEvent(e){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=e.pixel,this.finishCoordinate_||this.startDrawing_(e.coordinate),!0):this.condition_(e)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new yo(bt.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))},this.dragVertexDelay_),this.downPx_=e.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_();return}const n=this.getMap(),r=n.getCoordinateFromPixel([e.pixel[0]-this.snapTolerance_,e.pixel[1]+this.snapTolerance_]),o=n.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),s=Am([r,o]),a=this.traceSource_.getFeaturesInExtent(s);if(a.length===0)return;const l=B7(e.coordinate,a);l.length&&(this.traceState_={active:!0,startPx:e.pixel.slice(),targets:l,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,n){const r=e.startIndex<=e.endIndex,o=e.startIndex<=n;r===o?r&&n>e.endIndex||!r&&n<e.endIndex?this.addTracedCoordinates_(e,e.endIndex,n):(r&&n<e.endIndex||!r&&n>e.endIndex)&&this.removeTracedCoordinates_(n,e.endIndex):(this.removeTracedCoordinates_(e.startIndex,e.endIndex),this.addTracedCoordinates_(e,e.startIndex,n))}removeTracedCoordinates_(e,n){if(e===n)return;let r=0;if(e<n){const o=Math.ceil(e);let s=Math.floor(n);s===n&&(s-=1),r=s-o+1}else{const o=Math.floor(e);let s=Math.ceil(n);s===n&&(s+=1),r=o-s+1}r>0&&this.removeLastPoints_(r)}addTracedCoordinates_(e,n,r){if(n===r)return;const o=[];if(n<r){const s=Math.ceil(n);let a=Math.floor(r);a===r&&(a-=1);for(let l=s;l<=a;++l)o.push(ol(e.coordinates,l))}else{const s=Math.floor(n);let a=Math.ceil(r);a===r&&(a+=1);for(let l=s;l>=a;--l)o.push(ol(e.coordinates,l))}o.length&&this.appendCoordinates(o)}updateTrace_(e){const n=this.traceState_;if(!n.active||n.targetIndex===-1&&EE(n.startPx,e.pixel)<this.snapTolerance_)return;const r=V7(e.coordinate,n,this.getMap(),this.snapTolerance_);if(n.targetIndex!==r.index){if(n.targetIndex!==-1){const c=n.targets[n.targetIndex];this.removeTracedCoordinates_(c.startIndex,c.endIndex)}const l=n.targets[r.index];this.addTracedCoordinates_(l,l.startIndex,r.endIndex)}else{const l=n.targets[n.targetIndex];this.addOrRemoveTracedCoordinates_(l,r.endIndex)}n.targetIndex=r.index;const o=n.targets[n.targetIndex];o.endIndex=r.endIndex;const s=sl(o.coordinates,o.endIndex),a=this.getMap().getPixelFromCoordinate(s);e.coordinate=s,e.pixel=[Math.round(a[0]),Math.round(a[1])]}handleUpEvent(e){let n=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(e);const r=this.traceState_.active;if(this.toggleTraceState_(e),this.shouldHandle_){const o=!this.finishCoordinate_;o&&this.startDrawing_(e.coordinate),!o&&this.freehand_?this.finishDrawing():!this.freehand_&&(!o||this.mode_==="Point")&&(this.atFinish_(e.pixel,r)?this.finishCondition_(e)&&this.finishDrawing():this.addToDrawing_(e.coordinate)),n=!1}else this.freehand_&&this.abortDrawing()}return!n&&this.stopClick_&&e.preventDefault(),n}handlePointerMove_(e){if(this.pointerType_=e.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const n=this.downPx_,r=e.pixel,o=n[0]-r[0],s=n[1]-r[1],a=o*o+s*s;if(this.shouldHandle_=this.freehand_?a>this.squaredClickTolerance_:a<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(e.coordinate.slice());return}this.updateTrace_(e),this.modifyDrawing_(e.coordinate)}atFinish_(e,n){let r=!1;if(this.sketchFeature_){let o=!1,s=[this.finishCoordinate_];const a=this.mode_;if(a==="Point")r=!0;else if(a==="Circle")r=this.sketchCoords_.length===2;else if(a==="LineString")o=!n&&this.sketchCoords_.length>this.minPoints_;else if(a==="Polygon"){const l=this.sketchCoords_;o=l[0].length>this.minPoints_,s=[l[0][0],l[0][l[0].length-2]],n?s=[l[0][0]]:s=[l[0][0],l[0][l[0].length-2]]}if(o){const l=this.getMap();for(let c=0,d=s.length;c<d;c++){const u=s[c],f=l.getPixelFromCoordinate(u),p=e[0]-f[0],m=e[1]-f[1],h=this.freehand_?1:this.snapTolerance_;if(r=Math.sqrt(p*p+m*m)<=h,r){this.finishCoordinate_=u;break}}}}return r}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new Kt(new Xt(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new Kt);const n=e.getLinearRing(0);let r=this.sketchLine_.getGeometry();r?(r.setFlatCoordinates(n.getLayout(),n.getFlatCoordinates()),r.changed()):(r=new $n(n.getFlatCoordinates(),n.getLayout()),this.sketchLine_.setGeometry(r))}startDrawing_(e){const n=this.getMap().getView().getProjection(),r=pc(this.geometryLayout_);for(;e.length<r;)e.push(0);this.finishCoordinate_=e,this.mode_==="Point"?this.sketchCoords_=e.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[e.slice(),e.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[e.slice(),e.slice()],this.sketchLineCoords_&&(this.sketchLine_=new Kt(new $n(this.sketchLineCoords_)));const o=this.geometryFunction_(this.sketchCoords_,void 0,n);this.sketchFeature_=new Kt,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(o),this.updateSketchFeatures_(),this.dispatchEvent(new Sf(Ef.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const n=this.getMap(),r=this.sketchFeature_.getGeometry(),o=n.getView().getProjection(),s=pc(this.geometryLayout_);let a,l;for(;e.length<s;)e.push(0);this.mode_==="Point"?l=this.sketchCoords_:this.mode_==="Polygon"?(a=this.sketchCoords_[0],l=a[a.length-1],this.atFinish_(n.getPixelFromCoordinate(e))&&(e=this.finishCoordinate_.slice())):(a=this.sketchCoords_,l=a[a.length-1]),l[0]=e[0],l[1]=e[1],this.geometryFunction_(this.sketchCoords_,r,o),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(e),r.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(r):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(e){const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection();let o,s;const a=this.mode_;return a==="LineString"||a==="Circle"?(this.finishCoordinate_=e.slice(),s=this.sketchCoords_,s.length>=this.maxPoints_&&(this.freehand_?s.pop():o=!0),s.push(e.slice()),this.geometryFunction_(s,n,r)):a==="Polygon"&&(s=this.sketchCoords_[0],s.length>=this.maxPoints_&&(this.freehand_?s.pop():o=!0),s.push(e.slice()),o&&(this.finishCoordinate_=s[0]),this.geometryFunction_(this.sketchCoords_,n,r)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),o?this.finishDrawing():this.sketchFeature_}removeLastPoints_(e){if(!this.sketchFeature_)return;const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection(),o=this.mode_;for(let s=0;s<e;++s){let a;if(o==="LineString"||o==="Circle"){if(a=this.sketchCoords_,a.splice(-2,1),a.length>=2){this.finishCoordinate_=a[a.length-2].slice();const l=this.finishCoordinate_.slice();a[a.length-1]=l,this.createOrUpdateSketchPoint_(l)}this.geometryFunction_(a,n,r),n.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(n)}else if(o==="Polygon"){a=this.sketchCoords_[0],a.splice(-2,1);const l=this.sketchLine_.getGeometry();if(a.length>=2){const c=a[a.length-2].slice();a[a.length-1]=c,this.createOrUpdateSketchPoint_(c)}l.setCoordinates(a),this.geometryFunction_(this.sketchCoords_,n,r)}if(a.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const e=this.abortDrawing_();if(!e)return null;let n=this.sketchCoords_;const r=e.getGeometry(),o=this.getMap().getView().getProjection();return this.mode_==="LineString"?(n.pop(),this.geometryFunction_(n,r,o)):this.mode_==="Polygon"&&(n[0].pop(),this.geometryFunction_(n,r,o),n=r.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new Fc([n])):this.type_==="MultiLineString"?e.setGeometry(new Ac([n])):this.type_==="MultiPolygon"&&e.setGeometry(new Bc([n])),this.dispatchEvent(new Sf(Ef.DRAWEND,e)),this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e),e}abortDrawing_(){this.finishCoordinate_=null;const e=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),e}abortDrawing(){const e=this.abortDrawing_();e&&this.dispatchEvent(new Sf(Ef.DRAWABORT,e))}appendCoordinates(e){const n=this.mode_,r=!this.sketchFeature_;r&&this.startDrawing_(e[0]);let o;if(n==="LineString"||n==="Circle")o=this.sketchCoords_;else if(n==="Polygon")o=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;r&&o.shift(),o.pop();for(let a=0;a<e.length;a++)this.addToDrawing_(e[a]);const s=e[e.length-1];this.sketchFeature_=this.addToDrawing_(s),this.modifyDrawing_(s)}extend(e){const r=e.getGeometry();this.sketchFeature_=e,this.sketchCoords_=r.getCoordinates();const o=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=o.slice(),this.sketchCoords_.push(o.slice()),this.sketchPoint_=new Kt(new Xt(o)),this.updateSketchFeatures_(),this.dispatchEvent(new Sf(Ef.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const e=[];this.sketchFeature_&&e.push(this.sketchFeature_),this.sketchLine_&&e.push(this.sketchLine_),this.sketchPoint_&&e.push(this.sketchPoint_);const n=this.overlay_.getSource();n.clear(!0),n.addFeatures(e)}updateState_(){const e=this.getMap(),n=this.getActive();(!e||!n)&&this.abortDrawing(),this.overlay_.setMap(n?e:null)}}function $7(){const t=H9();return function(e,n){return t[e.getGeometry().getType()]}}function z7(t){switch(t){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+t)}}const W7=t=>{t.getInteractions().forEach(e=>{e instanceof n0&&e.setActive(!1)})},Y7=t=>{t.getInteractions().forEach(e=>{e instanceof n0&&e.setActive(!0)})},Xo=(t,e)=>{const n=t.getViewport();n&&(n.style.cursor=e)},G7=(t,e)=>{const n=i.ref([]),r=i.ref("km"),o=k=>{r.value=k};let s;const a=i.ref(!1),l=()=>{Xo(t,"crosshair"),u(),W7(t),t.on("pointermove",m),t.getViewport().addEventListener("mouseout",()=>{s&&s.classList.add("hidden")}),y(),a.value=!0};let c,d;const u=()=>{c=new Di,d=new go({source:c,zIndex:1e3,style:{"fill-color":"rgba(255, 255, 255, 0.2)","stroke-color":"#ffcc33","stroke-width":2,"circle-radius":7,"circle-fill-color":"#ffcc33"}}),t==null||t.addLayer(d)};let f,p;const m=k=>{if(k.dragging)return;let M="点击选择起点";f&&(M="单击继续,双击结束"),s&&(s.innerHTML=M,p.setPosition(k.coordinate),s.classList.remove("hidden"))};let h;const y=()=>{h=new Tf({source:c,type:"LineString",style:new _t({fill:new rn({color:"rgba(255, 255, 255, 0.2)"}),stroke:new zn({color:"rgba(255,204,51)",lineDash:[10,10],width:2}),image:new co({radius:5,stroke:new zn({color:"rgba(0, 0, 0, 0.7)"}),fill:new rn({color:"rgba(255, 255, 255, 0.2)"})})}),condition:M=>M.originalEvent.target.tagName!=="DIV"}),t==null||t.addInteraction(h),C(),_();let k;h.on("drawstart",function(M){var L;f=M.feature,f.set("randomId",g());let T;k=(L=f.getGeometry())==null?void 0:L.on("change",function(O){const F=O.target,I=H2(F,r.value);T=F.getLastCoordinate(),b&&I&&(b.innerHTML=I),w.setPosition(T)})}),h.on("drawend",function(){var M,T,L;if(b&&(b.className="ol-tooltip ol-tooltip-static ol-tooltip-measure"),b!=null&&b.innerHTML){const O=(f==null?void 0:f.get("randomId"))||g();n.value.push({id:O,value:b==null?void 0:b.innerHTML}),b.innerHTML=`${b.innerHTML}<div class="ol-tooltip-delete-button" data-id="${O}"><i class="map-iconfont icon-delete"></i></div>`}(M=document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button"))==null||M.addEventListener("click",O=>{var I;O.preventDefault(),O.stopPropagation();const F=(I=O.target)==null?void 0:I.getAttribute("data-id");F&&S(F)}),w.setOffset([0,-7]),f=null,b=null,C(),k&&vu(k),(L=(T=e.getProps())==null?void 0:T.lineDrawEnd)==null||L.call(T,n.value)})},g=()=>Math.random().toString(36).substring(2,9);let b,w;const C=()=>{b!=null&&b.parentNode&&b.parentNode.removeChild(b),b=document.createElement("div"),b.className="ol-tooltip ol-tooltip-measure",w=new Os({element:b,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),t==null||t.addOverlay(w)},_=()=>{s!=null&&s.parentNode&&s.parentNode.removeChild(s),s=document.createElement("div"),s.className="ol-tooltip hidden",p=new Os({element:s,offset:[15,0],positioning:"center-left"}),t==null||t.addOverlay(p)},E=()=>{n.value.forEach((k,M)=>{var O,F;const T=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");T[M]&&((F=(O=T[M])==null?void 0:O.parentNode)==null||F.removeChild(T[M]));const L=c.getFeatures();L[M]&&c.removeFeature(L[M])}),v(),Y7(t),a.value=!1,Xo(t,"grab")},S=k=>{var T,L,O,F;const M=n.value.findIndex(I=>I.id===k);if(M!==-1){n.value.splice(M,1);const I=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");I[M]&&((L=(T=I[M])==null?void 0:T.parentNode)==null||L.removeChild(I[M]));const D=c.getFeatures();D[M]&&c.removeFeature(D[M])}(F=(O=e.getProps())==null?void 0:O.lineDrawEnd)==null||F.call(O,n.value)},v=()=>{if(n.value=[],document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach(k=>{var M;(M=k==null?void 0:k.parentNode)==null||M.removeChild(k)}),c==null||c.clear(),h){const k=t.getInteractions().getArray().find(M=>ut(M)===ut(h));k&&t.removeInteraction(k)}t.removeLayer(d),s!=null&&s.parentNode&&s.parentNode.removeChild(s),b!=null&&b.parentNode&&b.parentNode.removeChild(b)};return{open:l,close:E,deleteLine:S,setUnit:o,getState:()=>a.value}},H2=(t,e)=>{const r=Au(t);let o="";switch(e){case"m":o=`${Math.round(r*100)/100} m`;break;case"km":o=`${Math.round(r/1e3*100)/100} km`;break;case"nm":o=(Math.round(r/1e3*100)/100/1.852).toFixed(2)+" nm";break}return o},j7=(t,e)=>{let n,r,o="close";const s=()=>{v(),o="open",a(),Xo(t,"crosshair")},a=()=>{d(),w(),E(),h()};let l=null,c=null;const d=()=>{if(l&&c)return;const k=new Di,M=new go({source:k,style:new _t({stroke:new zn({color:"#fbcc33",width:2})}),zIndex:1e3});l=M,c=k,t.on("pointermove",f),t.addLayer(M),t.on(["dblclick"],function(T){p&&(T.stopPropagation(),T.preventDefault())})};let u;const f=k=>{if(k.dragging)return;const M=u?"单击继续,双击结束":"点击选择起点";C&&(C.innerHTML=M,_.setPosition(k.coordinate))};let p,m=!1;const h=()=>{if(n){C!=null&&C.parentNode&&C.parentNode.removeChild(C);const k=n.getGeometry();if(!k)return;const M=y(k,"nm");g&&(g.innerHTML=`
192
+ `;return new _t({image:new ni({src:`data:image/svg+xml;utf8,${encodeURIComponent(s)}`,scale:r,anchorXUnits:"fraction",anchorYUnits:"fraction"})})};function M7(t,e,n,r){if(e){const o=new Os({element:n,positioning:"top-left",id:"label-"+(r==null?void 0:r.id),offset:[20,-20],autoPan:!1,position:e,className:r!=null&&r.blinking?"ship-label-overlay-blinking":"ship-label-overlay"});o.set("class","zh-map-ship-overlay"),t.addOverlay(o)}}const D7=(t,e)=>{const{lon:n,lat:r,blinking:o}=e,s=z2(e);n&&r&&M7(t,Jr([n,r]),s,{...e,blinking:o})},z2=t=>{const e=document.createElement("div");e.className="ship-overlay-box",e.style.position="relative";const{lon:n,lat:r,blinking:o,blinkingColors:s,name:a}=t,l=i.createVNode({setup(){return x7({position:[n+.002,r+.002],selected:o,name:a,colors:s||[],existDevice:t==null?void 0:t.existDevice,existMobile:t==null?void 0:t.existMobile,existWaterGauge:t==null?void 0:t.existWaterGauge})}});return i.render(l,e),e},W2=t=>{const e=[];return t.existDevice&&e.push("&#xe687;"),t.existMobile&&e.push("&#xe688;"),t.existWaterGauge&&e.push("&#xe686;"),e};function I7(){const t=["left-top","left-middle","left-bottom","right-top","right-middle","right-bottom"];return t[Math.floor(Math.random()*t.length)]}const P7=window.devicePixelRatio||1,C0=new Map;let zc=null,E0=null;function O7(t,e,n="left-bottom",r=10){const o=`${t}-${e.join(",")}-${n}-${r}`;if(C0.has(o))return C0.get(o);if(!zc){zc=document.createElement("canvas");try{E0=zc.getContext("2d",{willReadFrequently:!0})}catch(D){console.log("e",D),E0=zc.getContext("2d")}}const s=zc,a=E0;if(!a)return"";s.width=0,s.height=0;const l=2,c=4,d=16,u=window.devicePixelRatio||1,f="500 12px Arial",p="12px map-iconfont";a.font=f;const h=a.measureText(t).width;a.font=p;const y=e.map(D=>({width:a.measureText(Ls(D)).width,height:14})),g=y.reduce((D,P)=>D+P.width,0),b=e.length*r,w=c+h+g+b+c,C=l+14+l*2;let _,E,S=0,v=0,x=0,k=0,M=0,T=0;switch(_=d+w,n){case"right-top":E=d+C,S=0,v=d+C,x=d,k=0,M=d,T=0;break;case"right-middle":E=C,S=0,v=C/2,x=d,k=C/2,M=d,T=0;break;case"right-bottom":E=d+C,S=0,v=0,x=d,k=d,M=d,T=d;break;case"left-top":E=d+C,S=w,v=d,x=w+d,k=C+d,M=0,T=0;break;case"left-middle":E=C,S=w,v=C/2,x=w+d,k=C/2,M=0,T=0;break;case"left-bottom":E=d+C,S=w,v=C,x=w+d,k=0,M=0,T=d;break}E=E+l,s.width=Math.round(_*u),s.height=Math.round(E*u),a.scale(u,u),a.clearRect(0,0,_,E),a.beginPath(),a.moveTo(S,v),a.lineTo(x,k),a.strokeStyle="#FFF",a.lineWidth=1,a.stroke(),a.fillStyle="#FFF",a.fillRect(M,T,w,C),a.font=f,a.textBaseline="middle";const L=T+l/2+C/2;a.strokeStyle="#ffffff",a.lineWidth=1,a.strokeText(t,M+c,L),a.fillStyle="#000000",a.fillText(t,M+c,L),a.font=p,a.fillStyle="#3370ff";let O=M+c+h+r;const F=T+C/2;e.length>0&&e.forEach((D,P)=>{a.fillText(Ls(D),O,F),O+=y[P].width+r});const I=s.toDataURL("image/png");return C0.set(o,I),I}const Y2=(t,e)=>{const{name:n,rightIcons:r,selected:o}=t.getProperties(),s=e!==1?I7():"right-top",a=O7(n,r,s);let l=[0,0];switch(s){case"right-top":l=[0,1];break;case"right-middle":l=[0,.5];break;case"right-bottom":l=[0,0];break;case"left-top":l=[1,1];break;case"left-middle":l=[1,.5];break;case"left-bottom":l=[1,0];break}return new _t({image:new ni({src:a,anchor:l,displacement:[0,0],scale:1/P7,anchorXUnits:"fraction",anchorYUnits:"fraction"}),zIndex:o?100:10})},N7=t=>{let e=null,n=null;const r=new Di,o=new v7({source:r,className:"zh-map--ship-layer",renderBuffer:300,zIndex:101,properties:{layerType:Un.SHIP}}),s=new Di,a=new go({source:s,className:"zh-map--ship-label-layer",zIndex:102,updateWhileInteracting:!1,updateWhileAnimating:!1,properties:{layerType:Un.SHIP},declutter:!0}),l=new Di,c=new go({source:l,className:"zh-map--ship-selected-layer",zIndex:999});t==null||t.addLayer(o),t==null||t.addLayer(a),t==null||t.addLayer(c);let d=null,u="",f={},p={};const m=T=>{if(!T||!t)return;const L=(n==null?void 0:n.id)||(e==null?void 0:e.get("id"));if(n){const O=T.filter(F=>F.id===L);O.length===0?T.push(n):n=O[0]}b(),M(T),y()},h=T=>{var R;const L=(n==null?void 0:n.id)||(e==null?void 0:e.get("id")),O=Jr([T==null?void 0:T.lon,T==null?void 0:T.lat]),F=((R=p[T.id])==null?void 0:R.blinkColors)||[],D=F[F.length-1]||T.fill||"#04C900",P=k7(T),N=new Kt({geometry:new Xt(O),shipData:T,id:T.id,name:T.cnname||T.enname||T.name||T.id||"未命名船舶",selected:T.id===L,rightIcons:W2(T),color:D,direct:P,isHighlight:!1});return N.set("clickGeometry",new Lc(O)),N},y=()=>{if(n&&t&&n){l.getFeatures().length>0&&l.clear();const T=Jr([n==null?void 0:n.lon,n==null?void 0:n.lat]),L=new Kt({geometry:new Xt(T),id:n.id});L.setStyle(R7(t,n)),l.addFeature(L)}},g=T=>{if(T==="start"){const L=()=>{const O=l.getFeatures();r.getFeatures().forEach(F=>{var D,P;const I=il(t,F);if(F.setStyle(I),F.get("id")===(n==null?void 0:n.id)&&O&&O[0]){const N=O[0],R=N==null?void 0:N.getStyle();if(R&&(R!=null&&R.getImage())){const A=(D=I.getImage())==null?void 0:D.getScale();A&&((P=R.getImage())==null||P.setScale(A))}}}),d=requestAnimationFrame(L)};L()}T==="end"&&d&&(cancelAnimationFrame(d),d=null)},b=()=>{t&&r&&(w(),r.clear(),s.clear(),l.clear(),g("end"))},w=T=>{const L=t.getOverlays().getArray().filter(O=>O.get("class")=="zh-map-ship-overlay");if(L&&L.length>0){for(let O=0;O<L.length;O++)if(L[O].get("class")!=="ship-overlay-selected"){const F=L[O];console.log("overlay---",F),F.setPosition(void 0),t.removeOverlay(F),F.dispose()}}},C=(T,L)=>{f=T,p=L;const O=t.getOverlays().getArray(),F=r.getFeatures();for(const I in f){const D=f[I],P=O.find(R=>(R==null?void 0:R.getId())==="label-"+I),N=F.find(R=>I===R.get("id"));if(P&&N){const R=L[I].blinkColors||[],{shipData:A,name:B,color:Y}=N.getProperties();N.set("blinking",D),R[(R==null?void 0:R.length)-1]&&Y!==R[(R==null?void 0:R.length)-1]&&(N.set("color",R[(R==null?void 0:R.length)-1]||""),N.setStyle(il(t,N)));const z={...A,blinking:D,blinkingColors:R||[],name:B+"("+L[I].shipState+")"},W=P.getElement(),Z=z2(z);W&&W!==Z&&P.setElement(Z)}}},_=T=>{if(!t)return;const L=r.getFeatures(),O=s.getFeatures(),F=e?e.get("id"):"",I=L.filter(R=>R.get("id")!==F),D=O==null?void 0:O.filter(R=>R.get("id")!==F),P=new Map;T.forEach(R=>{P.set(R.id,!0)});const N=t.getOverlays().getArray();I.forEach(R=>{const A=R.get("id");if(!P.has(A))R.setStyle([]);else{const Y=R.getStyle();(Y==null?void 0:Y.length)==0&&R.setStyle(il(t,R))}const B=N.find(Y=>Y.getId()==="label-"+A);B&&B.setPosition(void 0)}),D.forEach(R=>{const A=R.get("id");if(!P.has(A))R.setStyle([]);else{const B=R.getStyle();(B==null?void 0:B.length)==0&&R.setStyle(Y2(R,T.length))}})},E=T=>{if(T){console.log("选中",T);const L=r.getFeatures().find(F=>F.get("id")===T.id),O=s.getFeatures().find(F=>F.get("id")===T.id);L&&(e=L),O&&O.set("selected",!0),n=T,y()}else console.log("取消选中"),n=null,e=null,x()},S=Li((T,L,O)=>{try{if(T){const F=T.get("shipData"),I=T.get("id");if(L==="click"&&(E(F),O&&O(I)),L==="hover"){u&&u!==I&&v(),u=I;const D=r.getFeatures().find(P=>P.get("id")===u);D==null||D.set("isHighlight",!0),D==null||D.setStyle(il(t,D))}}else v()}catch(F){console.log("handleShipMapEvent",F)}},10),v=()=>{const T=u?r.getFeatures().find(L=>L.get("id")===u):null;u=null,T==null||T.set("isHighlight",!1),T==null||T.setStyle(il(t,T))},x=()=>{try{l.clear()}catch(T){console.log(T)}},k=(T,L)=>{const O=Jr([T==null?void 0:T.lon,T==null?void 0:T.lat]),F=new Kt({geometry:new Xt(O),name:T.cnname||T.enname||T.name||T.id||"未命名船舶",rightIcons:W2(T),selected:(T==null?void 0:T.id)===(n==null?void 0:n.id),shipData:T});F.set("id",T.id);const I=Y2(F,L);return F.setStyle(I),F},M=T=>{const L=t.getView().getZoom();T.forEach(O=>{const F=h(O);if(F.setStyle(il(t,F)),r.addFeature(F),(n==null?void 0:n.id)==O.id||L&&L>=In.shipModelMin)if(f[O.id]){if(O.id&&p[O==null?void 0:O.id]){const I=p[O==null?void 0:O.id]||{},D=(I==null?void 0:I.blinkColors)||[],P=(I==null?void 0:I.shipState)||"",N=(O.cnname||O.enname||O.name||O.id||"未命名船舶")+"("+P+")",R={...O,name:N,blinking:f[O.id],blinkingColors:D||[]};D7(t,R)}}else{const I=k(O,T.length);s.addFeature(I)}})};return{render:m,selected:E,filter:_,blinking:C,clear:b,handleShipMapEvent:S,changeShipScale:g}},L7=t=>{const e=()=>t==null?void 0:t.getLayers(),n=i.ref("vector"),r=()=>n.value,o=c=>{n.value=c;const d=e();d&&(d==null||d.getArray().forEach(u=>{(u.className_==="vector"||u.className_==="satellite")&&u.setVisible(u.className_===c)}))},s=i.ref(!1);return{getLayers:e,getGreenTileVisible:()=>s.value,setGreenTileVisible:c=>{if(c!==s.value){if(c){const d=e();if(!d.getArray().find(f=>f.className_==="greenTile")){const f=new el({source:new rl({url:Ns.greenTile}),visible:c,zIndex:2,className:"greenTile"});d.push(f)}}else{const d=e(),u=d.getArray().find(f=>f.className_==="greenTile");u&&d.remove(u)}s.value=c}},getShowLayerType:r,setShowLayerType:o}},A7=()=>{const t=i.ref();return{setProps:r=>{t.value=r},getProps:()=>t.value}},F7=t=>{const e="zh-map-location-layer";let n,r,o=null,s=null;const a=h=>{if(!(!h||h.length===0)){if(r||(r=new Di),r.clear(),s){const y=h.find(g=>g.id===s.id);y?s=y:h.push(s)}h.forEach(y=>{l(y)}),n||(n=new go({className:e,source:r,zIndex:100}),t==null||t.addLayer(n))}},l=h=>{const y=t==null?void 0:t.getView().getZoom(),[g,b]=h.latLon.split(","),w=new Kt({geometry:new Xt(Jr([Number(g),Number(b)]))});w.setStyle(c(h,y,h.id===(s==null?void 0:s.id))),w.set("loactionData",h),r.addFeature(w)},c=(h,y,g)=>{const b={image:new ni({src:g&&h.selectedPath||h.defaultPath,scale:.5*y/10})};return h.name&&(b.text=new uo({text:h.name,font:"12px sans-serif",fill:new rn({color:"#000000"}),backgroundFill:new rn({color:"#FFFFFF"}),offsetY:30})),new _t(b)},d=()=>{if(o){const h=o.get("loactionData").id;r.getFeatures().forEach(y=>{y.get("loactionData").id!==h&&r.removeFeature(y)})}else r.clear()},u=()=>{var b;const h=o.get("loactionData"),y=(b=t==null?void 0:t.getView())==null?void 0:b.getZoom();r.getFeatures().forEach(w=>{w.get("loactionData").id===h.id&&(w==null||w.setStyle(c(h,y,!1)))}),s=null,o=null},f=h=>{h?(p(),m(h)):clearSelectedPort()},p=()=>{var h;if(o){const y=o.get("loactionData"),g=(h=t==null?void 0:t.getView())==null?void 0:h.getZoom();o.setStyle(c(y,g,!1))}},m=h=>{const y=r.getFeatures();s=h,o=y.find(g=>g.get("loactionData").id===h.id)};return{render:a,selected:f,clearSelected:u,clear:d}},Ef={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Sf extends Ei{constructor(e,n){super(e),this.feature=n}}function B7(t,e){const n=[];for(let r=0;r<e.length;++r){const s=e[r].getGeometry();G2(t,s,n)}return n}function vf(t,e){return no(t[0],t[1],e[0],e[1])}function ol(t,e){const n=t.length;return e<0?t[e+n]:e>=n?t[e-n]:t[e]}function xf(t,e,n){let r,o;e<n?(r=e,o=n):(r=n,o=e);const s=Math.ceil(r),a=Math.floor(o);if(s>a){const c=sl(t,r),d=sl(t,o);return vf(c,d)}let l=0;if(r<s){const c=sl(t,r),d=ol(t,s);l+=vf(c,d)}if(a<o){const c=ol(t,a),d=sl(t,o);l+=vf(c,d)}for(let c=s;c<a-1;++c){const d=ol(t,c),u=ol(t,c+1);l+=vf(d,u)}return l}function G2(t,e,n){if(e instanceof $n){kf(t,e.getCoordinates(),!1,n);return}if(e instanceof Ac){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o)kf(t,r[o],!1,n);return}if(e instanceof oo){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o)kf(t,r[o],!0,n);return}if(e instanceof Bc){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o){const a=r[o];for(let l=0,c=a.length;l<c;++l)kf(t,a[l],!0,n)}return}if(e instanceof hf){const r=e.getGeometries();for(let o=0;o<r.length;++o)G2(t,r[o],n);return}}const S0={index:-1,endIndex:NaN};function V7(t,e,n,r){const o=t[0],s=t[1];let a=1/0,l=-1,c=NaN;for(let f=0;f<e.targets.length;++f){const p=e.targets[f],m=p.coordinates;let h=1/0,y;for(let g=0;g<m.length-1;++g){const b=m[g],w=m[g+1],C=j2(o,s,b,w);C.squaredDistance<h&&(h=C.squaredDistance,y=g+C.along)}h<a&&(a=h,p.ring&&e.targetIndex===f&&(p.endIndex>p.startIndex?y<p.startIndex&&(y+=m.length):p.endIndex<p.startIndex&&y>p.startIndex&&(y-=m.length)),c=y,l=f)}const d=e.targets[l];let u=d.ring;if(e.targetIndex===l&&u){const f=sl(d.coordinates,c),p=n.getPixelFromCoordinate(f);EE(p,e.startPx)>r&&(u=!1)}if(u){const f=d.coordinates,p=f.length,m=d.startIndex,h=c;if(m<h){const y=xf(f,m,h);xf(f,m,h-p)<y&&(c-=p)}else{const y=xf(f,m,h);xf(f,m,h+p)<y&&(c+=p)}}return S0.index=l,S0.endIndex=c,S0}function kf(t,e,n,r){const o=t[0],s=t[1];for(let a=0,l=e.length-1;a<l;++a){const c=e[a],d=e[a+1],u=j2(o,s,c,d);if(u.squaredDistance===0){const f=a+u.along;r.push({coordinates:e,ring:n,startIndex:f,endIndex:f});return}}}const v0={along:0,squaredDistance:0};function j2(t,e,n,r){const o=n[0],s=n[1],a=r[0],l=r[1],c=a-o,d=l-s;let u=0,f=o,p=s;return(c!==0||d!==0)&&(u=Lt(((t-o)*c+(e-s)*d)/(c*c+d*d),0,1),f+=c*u,p+=d*u),v0.along=u,v0.squaredDistance=Pu(no(t,e,f,p),10),v0}function sl(t,e){const n=t.length;let r=Math.floor(e);const o=e-r;r>=n?r-=n:r<0&&(r+=n);let s=r+1;s>=n&&(s-=n);const a=t[r],l=a[0],c=a[1],d=t[s],u=d[0]-l,f=d[1]-c;return[l+u*o,c+f*o]}class Tf extends Xa{constructor(e){const n=e;n.stopDown||(n.stopDown=xa),super(n),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=e.source?e.source:null,this.features_=e.features?e.features:null,this.snapTolerance_=e.snapTolerance?e.snapTolerance:12,this.type_=e.type,this.mode_=z7(this.type_),this.stopClick_=!!e.stopClick,this.minPoints_=e.minPoints?e.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:e.maxPoints?e.maxPoints:1/0,this.finishCondition_=e.finishCondition?e.finishCondition:va,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let r=e.geometryFunction;if(!r){const o=this.mode_;if(o==="Circle")r=(s,a,l)=>{const c=a||new Lc([NaN,NaN]),d=Qr(s[0]),u=CE(d,Qr(s[s.length-1]));return c.setCenterAndRadius(d,Math.sqrt(u),this.geometryLayout_),c};else{let s;o==="Point"?s=Xt:o==="LineString"?s=$n:o==="Polygon"&&(s=oo),r=(a,l,c)=>(l?o==="Polygon"?a[0].length?l.setCoordinates([a[0].concat([a[0][0]])],this.geometryLayout_):l.setCoordinates([],this.geometryLayout_):l.setCoordinates(a,this.geometryLayout_):l=new s(a,this.geometryLayout_),l)}}this.geometryFunction_=r,this.dragVertexDelay_=e.dragVertexDelay!==void 0?e.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.overlay_=new go({source:new Di({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:$7(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:s0,this.freehandCondition_,e.freehand?this.freehandCondition_=o0:this.freehandCondition_=e.freehandCondition?e.freehandCondition:p2,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(e0.ACTIVE,this.updateState_)}setTrace(e){let n;e?e===!0?n=o0:n=e:n=HY,this.traceCondition_=n}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===Ve.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let n=e.type===bt.POINTERMOVE,r=!0;return!this.freehand_&&this.lastDragTime_&&e.type===bt.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,n=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===bt.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),r=!1):this.freehand_&&e.type===bt.POINTERDOWN?r=!1:n&&this.getPointerCount()<2?(r=e.type===bt.POINTERMOVE,r&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===bt.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===bt.DBLCLICK&&(r=!1),super.handleEvent(e)&&r}handleDownEvent(e){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=e.pixel,this.finishCoordinate_||this.startDrawing_(e.coordinate),!0):this.condition_(e)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new yo(bt.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))},this.dragVertexDelay_),this.downPx_=e.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_();return}const n=this.getMap(),r=n.getCoordinateFromPixel([e.pixel[0]-this.snapTolerance_,e.pixel[1]+this.snapTolerance_]),o=n.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),s=Am([r,o]),a=this.traceSource_.getFeaturesInExtent(s);if(a.length===0)return;const l=B7(e.coordinate,a);l.length&&(this.traceState_={active:!0,startPx:e.pixel.slice(),targets:l,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,n){const r=e.startIndex<=e.endIndex,o=e.startIndex<=n;r===o?r&&n>e.endIndex||!r&&n<e.endIndex?this.addTracedCoordinates_(e,e.endIndex,n):(r&&n<e.endIndex||!r&&n>e.endIndex)&&this.removeTracedCoordinates_(n,e.endIndex):(this.removeTracedCoordinates_(e.startIndex,e.endIndex),this.addTracedCoordinates_(e,e.startIndex,n))}removeTracedCoordinates_(e,n){if(e===n)return;let r=0;if(e<n){const o=Math.ceil(e);let s=Math.floor(n);s===n&&(s-=1),r=s-o+1}else{const o=Math.floor(e);let s=Math.ceil(n);s===n&&(s+=1),r=o-s+1}r>0&&this.removeLastPoints_(r)}addTracedCoordinates_(e,n,r){if(n===r)return;const o=[];if(n<r){const s=Math.ceil(n);let a=Math.floor(r);a===r&&(a-=1);for(let l=s;l<=a;++l)o.push(ol(e.coordinates,l))}else{const s=Math.floor(n);let a=Math.ceil(r);a===r&&(a+=1);for(let l=s;l>=a;--l)o.push(ol(e.coordinates,l))}o.length&&this.appendCoordinates(o)}updateTrace_(e){const n=this.traceState_;if(!n.active||n.targetIndex===-1&&EE(n.startPx,e.pixel)<this.snapTolerance_)return;const r=V7(e.coordinate,n,this.getMap(),this.snapTolerance_);if(n.targetIndex!==r.index){if(n.targetIndex!==-1){const c=n.targets[n.targetIndex];this.removeTracedCoordinates_(c.startIndex,c.endIndex)}const l=n.targets[r.index];this.addTracedCoordinates_(l,l.startIndex,r.endIndex)}else{const l=n.targets[n.targetIndex];this.addOrRemoveTracedCoordinates_(l,r.endIndex)}n.targetIndex=r.index;const o=n.targets[n.targetIndex];o.endIndex=r.endIndex;const s=sl(o.coordinates,o.endIndex),a=this.getMap().getPixelFromCoordinate(s);e.coordinate=s,e.pixel=[Math.round(a[0]),Math.round(a[1])]}handleUpEvent(e){let n=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(e);const r=this.traceState_.active;if(this.toggleTraceState_(e),this.shouldHandle_){const o=!this.finishCoordinate_;o&&this.startDrawing_(e.coordinate),!o&&this.freehand_?this.finishDrawing():!this.freehand_&&(!o||this.mode_==="Point")&&(this.atFinish_(e.pixel,r)?this.finishCondition_(e)&&this.finishDrawing():this.addToDrawing_(e.coordinate)),n=!1}else this.freehand_&&this.abortDrawing()}return!n&&this.stopClick_&&e.preventDefault(),n}handlePointerMove_(e){if(this.pointerType_=e.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const n=this.downPx_,r=e.pixel,o=n[0]-r[0],s=n[1]-r[1],a=o*o+s*s;if(this.shouldHandle_=this.freehand_?a>this.squaredClickTolerance_:a<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(e.coordinate.slice());return}this.updateTrace_(e),this.modifyDrawing_(e.coordinate)}atFinish_(e,n){let r=!1;if(this.sketchFeature_){let o=!1,s=[this.finishCoordinate_];const a=this.mode_;if(a==="Point")r=!0;else if(a==="Circle")r=this.sketchCoords_.length===2;else if(a==="LineString")o=!n&&this.sketchCoords_.length>this.minPoints_;else if(a==="Polygon"){const l=this.sketchCoords_;o=l[0].length>this.minPoints_,s=[l[0][0],l[0][l[0].length-2]],n?s=[l[0][0]]:s=[l[0][0],l[0][l[0].length-2]]}if(o){const l=this.getMap();for(let c=0,d=s.length;c<d;c++){const u=s[c],f=l.getPixelFromCoordinate(u),p=e[0]-f[0],m=e[1]-f[1],h=this.freehand_?1:this.snapTolerance_;if(r=Math.sqrt(p*p+m*m)<=h,r){this.finishCoordinate_=u;break}}}}return r}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new Kt(new Xt(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new Kt);const n=e.getLinearRing(0);let r=this.sketchLine_.getGeometry();r?(r.setFlatCoordinates(n.getLayout(),n.getFlatCoordinates()),r.changed()):(r=new $n(n.getFlatCoordinates(),n.getLayout()),this.sketchLine_.setGeometry(r))}startDrawing_(e){const n=this.getMap().getView().getProjection(),r=pc(this.geometryLayout_);for(;e.length<r;)e.push(0);this.finishCoordinate_=e,this.mode_==="Point"?this.sketchCoords_=e.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[e.slice(),e.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[e.slice(),e.slice()],this.sketchLineCoords_&&(this.sketchLine_=new Kt(new $n(this.sketchLineCoords_)));const o=this.geometryFunction_(this.sketchCoords_,void 0,n);this.sketchFeature_=new Kt,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(o),this.updateSketchFeatures_(),this.dispatchEvent(new Sf(Ef.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const n=this.getMap(),r=this.sketchFeature_.getGeometry(),o=n.getView().getProjection(),s=pc(this.geometryLayout_);let a,l;for(;e.length<s;)e.push(0);this.mode_==="Point"?l=this.sketchCoords_:this.mode_==="Polygon"?(a=this.sketchCoords_[0],l=a[a.length-1],this.atFinish_(n.getPixelFromCoordinate(e))&&(e=this.finishCoordinate_.slice())):(a=this.sketchCoords_,l=a[a.length-1]),l[0]=e[0],l[1]=e[1],this.geometryFunction_(this.sketchCoords_,r,o),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(e),r.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(r):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(e){const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection();let o,s;const a=this.mode_;return a==="LineString"||a==="Circle"?(this.finishCoordinate_=e.slice(),s=this.sketchCoords_,s.length>=this.maxPoints_&&(this.freehand_?s.pop():o=!0),s.push(e.slice()),this.geometryFunction_(s,n,r)):a==="Polygon"&&(s=this.sketchCoords_[0],s.length>=this.maxPoints_&&(this.freehand_?s.pop():o=!0),s.push(e.slice()),o&&(this.finishCoordinate_=s[0]),this.geometryFunction_(this.sketchCoords_,n,r)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),o?this.finishDrawing():this.sketchFeature_}removeLastPoints_(e){if(!this.sketchFeature_)return;const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection(),o=this.mode_;for(let s=0;s<e;++s){let a;if(o==="LineString"||o==="Circle"){if(a=this.sketchCoords_,a.splice(-2,1),a.length>=2){this.finishCoordinate_=a[a.length-2].slice();const l=this.finishCoordinate_.slice();a[a.length-1]=l,this.createOrUpdateSketchPoint_(l)}this.geometryFunction_(a,n,r),n.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(n)}else if(o==="Polygon"){a=this.sketchCoords_[0],a.splice(-2,1);const l=this.sketchLine_.getGeometry();if(a.length>=2){const c=a[a.length-2].slice();a[a.length-1]=c,this.createOrUpdateSketchPoint_(c)}l.setCoordinates(a),this.geometryFunction_(this.sketchCoords_,n,r)}if(a.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const e=this.abortDrawing_();if(!e)return null;let n=this.sketchCoords_;const r=e.getGeometry(),o=this.getMap().getView().getProjection();return this.mode_==="LineString"?(n.pop(),this.geometryFunction_(n,r,o)):this.mode_==="Polygon"&&(n[0].pop(),this.geometryFunction_(n,r,o),n=r.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new Fc([n])):this.type_==="MultiLineString"?e.setGeometry(new Ac([n])):this.type_==="MultiPolygon"&&e.setGeometry(new Bc([n])),this.dispatchEvent(new Sf(Ef.DRAWEND,e)),this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e),e}abortDrawing_(){this.finishCoordinate_=null;const e=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),e}abortDrawing(){const e=this.abortDrawing_();e&&this.dispatchEvent(new Sf(Ef.DRAWABORT,e))}appendCoordinates(e){const n=this.mode_,r=!this.sketchFeature_;r&&this.startDrawing_(e[0]);let o;if(n==="LineString"||n==="Circle")o=this.sketchCoords_;else if(n==="Polygon")o=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;r&&o.shift(),o.pop();for(let a=0;a<e.length;a++)this.addToDrawing_(e[a]);const s=e[e.length-1];this.sketchFeature_=this.addToDrawing_(s),this.modifyDrawing_(s)}extend(e){const r=e.getGeometry();this.sketchFeature_=e,this.sketchCoords_=r.getCoordinates();const o=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=o.slice(),this.sketchCoords_.push(o.slice()),this.sketchPoint_=new Kt(new Xt(o)),this.updateSketchFeatures_(),this.dispatchEvent(new Sf(Ef.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const e=[];this.sketchFeature_&&e.push(this.sketchFeature_),this.sketchLine_&&e.push(this.sketchLine_),this.sketchPoint_&&e.push(this.sketchPoint_);const n=this.overlay_.getSource();n.clear(!0),n.addFeatures(e)}updateState_(){const e=this.getMap(),n=this.getActive();(!e||!n)&&this.abortDrawing(),this.overlay_.setMap(n?e:null)}}function $7(){const t=H9();return function(e,n){return t[e.getGeometry().getType()]}}function z7(t){switch(t){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+t)}}const W7=t=>{t.getInteractions().forEach(e=>{e instanceof n0&&e.setActive(!1)})},Y7=t=>{t.getInteractions().forEach(e=>{e instanceof n0&&e.setActive(!0)})},Xo=(t,e)=>{const n=t.getViewport();n&&(n.style.cursor=e)},G7=(t,e)=>{const n=i.ref([]),r=i.ref("km"),o=k=>{r.value=k};let s,a="close";const l=()=>{Xo(t,"crosshair"),u(),W7(t),t.on("pointermove",m),t.getViewport().addEventListener("mouseout",()=>{s&&s.classList.add("hidden")}),y(),a="open"};let c,d;const u=()=>{c=new Di,d=new go({source:c,zIndex:1e3,style:{"fill-color":"rgba(255, 255, 255, 0.2)","stroke-color":"#ffcc33","stroke-width":2,"circle-radius":7,"circle-fill-color":"#ffcc33"}}),t==null||t.addLayer(d)};let f,p;const m=k=>{if(k.dragging)return;let M="点击选择起点";f&&(M="单击继续,双击结束"),s&&(s.innerHTML=M,p.setPosition(k.coordinate),s.classList.remove("hidden"))};let h;const y=()=>{h=new Tf({source:c,type:"LineString",style:new _t({fill:new rn({color:"rgba(255, 255, 255, 0.2)"}),stroke:new zn({color:"rgba(255,204,51)",lineDash:[10,10],width:2}),image:new co({radius:5,stroke:new zn({color:"rgba(0, 0, 0, 0.7)"}),fill:new rn({color:"rgba(255, 255, 255, 0.2)"})})}),condition:M=>M.originalEvent.target.tagName!=="DIV"}),t==null||t.addInteraction(h),C(),_();let k;h.on("drawstart",function(M){var L;f=M.feature,f.set("randomId",g());let T;k=(L=f.getGeometry())==null?void 0:L.on("change",function(O){const F=O.target,I=H2(F,r.value);T=F.getLastCoordinate(),b&&I&&(b.innerHTML=I),w.setPosition(T)})}),h.on("drawend",function(){var M,T,L;if(b&&(b.className="ol-tooltip ol-tooltip-static ol-tooltip-measure"),b!=null&&b.innerHTML){const O=(f==null?void 0:f.get("randomId"))||g();n.value.push({id:O,value:b==null?void 0:b.innerHTML}),b.innerHTML=`${b.innerHTML}<div class="ol-tooltip-delete-button" data-id="${O}"><i class="map-iconfont icon-delete"></i></div>`}(M=document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button"))==null||M.addEventListener("click",O=>{var I;O.preventDefault(),O.stopPropagation();const F=(I=O.target)==null?void 0:I.getAttribute("data-id");F&&S(F)}),w.setOffset([0,-7]),f=null,b=null,C(),k&&vu(k),(L=(T=e.getProps())==null?void 0:T.lineDrawEnd)==null||L.call(T,n.value)})},g=()=>Math.random().toString(36).substring(2,9);let b,w;const C=()=>{b!=null&&b.parentNode&&b.parentNode.removeChild(b),b=document.createElement("div"),b.className="ol-tooltip ol-tooltip-measure",w=new Os({element:b,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),t==null||t.addOverlay(w)},_=()=>{s!=null&&s.parentNode&&s.parentNode.removeChild(s),s=document.createElement("div"),s.className="ol-tooltip hidden",p=new Os({element:s,offset:[15,0],positioning:"center-left"}),t==null||t.addOverlay(p)},E=()=>{n.value.forEach((k,M)=>{var O,F;const T=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");T[M]&&((F=(O=T[M])==null?void 0:O.parentNode)==null||F.removeChild(T[M]));const L=c.getFeatures();L[M]&&c.removeFeature(L[M])}),v(),Y7(t),a="close",Xo(t,"grab")},S=k=>{var T,L,O,F;const M=n.value.findIndex(I=>I.id===k);if(M!==-1){n.value.splice(M,1);const I=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");I[M]&&((L=(T=I[M])==null?void 0:T.parentNode)==null||L.removeChild(I[M]));const D=c.getFeatures();D[M]&&c.removeFeature(D[M])}(F=(O=e.getProps())==null?void 0:O.lineDrawEnd)==null||F.call(O,n.value)},v=()=>{if(n.value=[],document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach(k=>{var M;(M=k==null?void 0:k.parentNode)==null||M.removeChild(k)}),c==null||c.clear(),h){const k=t.getInteractions().getArray().find(M=>ut(M)===ut(h));k&&t.removeInteraction(k)}t.removeLayer(d),s!=null&&s.parentNode&&s.parentNode.removeChild(s),b!=null&&b.parentNode&&b.parentNode.removeChild(b)};return{open:l,close:E,deleteLine:S,setUnit:o,getState:()=>a}},H2=(t,e)=>{const r=Au(t);let o="";switch(e){case"m":o=`${Math.round(r*100)/100} m`;break;case"km":o=`${Math.round(r/1e3*100)/100} km`;break;case"nm":o=(Math.round(r/1e3*100)/100/1.852).toFixed(2)+" nm";break}return o},j7=(t,e)=>{let n,r,o="close";const s=()=>{v(),o="open",a(),Xo(t,"crosshair")},a=()=>{d(),w(),E(),h()};let l=null,c=null;const d=()=>{if(l&&c)return;const k=new Di,M=new go({source:k,style:new _t({stroke:new zn({color:"#fbcc33",width:2})}),zIndex:1e3});l=M,c=k,t.on("pointermove",f),t.addLayer(M),t.on(["dblclick"],function(T){p&&(T.stopPropagation(),T.preventDefault())})};let u;const f=k=>{if(k.dragging)return;const M=u?"单击继续,双击结束":"点击选择起点";C&&(C.innerHTML=M,_.setPosition(k.coordinate))};let p,m=!1;const h=()=>{if(n){C!=null&&C.parentNode&&C.parentNode.removeChild(C);const k=n.getGeometry();if(!k)return;const M=y(k,"nm");g&&(g.innerHTML=`
193
193
  <span class="text">面积:${M}${m?'<span class="error pl-12">超出可以绘画的距离</span>':""}</span>
194
194
  `),g&&(g.innerHTML+='<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');const T=k.getCoordinates(),L=T[0][T[0].length-2];if(b.setPosition(L),l){const F=l.getSource();F&&n&&(F.clear(),F.addFeature(n))}setTimeout(()=>{var F;(F=document.querySelector(".delete-icon"))==null||F.addEventListener("click",()=>{var I,D;console.log("delete"),S(),(D=(I=e.getProps())==null?void 0:I.areaDrawEnd)==null||D.call(I,[])})},0);const O=eo(n.getGeometry().getExtent());t==null||t.getView().setCenter(O);return}p=new Tf({type:"Polygon",source:c,trace:!0,style:[new _t({stroke:new zn({color:"rgba(255, 255, 255, 1)",width:1.5,lineDash:[10,10]}),fill:new rn({color:"rgba(255, 255, 255, 0.25)"})}),new _t({image:new co({radius:5,fill:new rn({color:"rgb(51,112,255, 1)"})}),geometry:function(k){const M=k.getGeometry().getCoordinates();return new Fc(M)}})]}),t==null||t.addInteraction(p),p.on("drawstart",k=>{var M;u=k.feature,r=(M=u.getGeometry())==null?void 0:M.on("change",T=>{const L=T.target,O=y(L,"nm"),I=L.getCoordinates()[0],D=new $n([I[I.length-2],I[I.length-1]]),P=H2(D,"nm");if(m=Number(Au(D)/1e3)>150,!O)return;const N='<span class="error pl-4">超出可以绘画的距离</span>';g&&(g.innerHTML=`
195
195
  <div class="text">
@@ -219,7 +219,7 @@ ye.version="2.30.1",JB(Dt),ye.fn=le,ye.min=$V,ye.max=zV,ye.now=WV,ye.utc=_i,ye.u
219
219
  </clipPath>
220
220
  </defs>
221
221
  </svg>
222
- `,_=()=>`data:image/svg+xml;utf8,${encodeURIComponent(C(b?"#F32D2D":"#3370FF"))}`,E=t.getView().getZoom(),S=g.get("portData"),v=window.devicePixelRatio||1,x=new _t({image:new ni({src:_(),scale:.5*E/10}),zIndex:b?110:100}),k=new _t({image:new ni({src:d(S.shortName,b),anchor:[.5,.5],displacement:[0,-30],scale:1/v,anchorXUnits:"fraction",anchorYUnits:"fraction"}),zIndex:b?110:100});return!w&&!b?x:[x,k]},f=()=>{if(e)if(r){console.log("清除非选中的港口");const g=r.get("portData").id;e.getFeatures().forEach(b=>{b.get("portData").id!==g&&e.removeFeature(b)})}else console.log("清除所有港口",e),e==null||e.clear()},p=g=>{if(e){if(!g)return m();(r==null?void 0:r.get("portData").id)!==g.id&&(m(),h(g))}},m=()=>{var g;if(r){const b=r==null?void 0:r.get("portData"),w=(g=e.getFeatures())==null?void 0:g.find(C=>C.get("portData").id===b.id);w&&(w.set("select",!1),w.setStyle(u(w)),r=null,o=null)}},h=g=>{if(!e)return;const b=e.getFeatures();o=g,r=b.find(w=>w.get("portData").id===g.id),r&&(r.set("select",!0),r.setStyle(u(r)))};return{render:s,clear:f,selected:p,handlePortHover:g=>{g&&g.get("portData")?Xo(t,"pointer"):Xo(t,"grab")}}},K7=(t,e,n,r,o,s,a)=>{const l=t.getInstall();l.on("moveend",()=>{var f,p;try{const m=t.getZoom();(p=(f=e.getProps()).mapMoveEnd)==null||p.call(f,m),m>=In.min&&m<=In.max&&n.reRenderTrackLine(),m>=In.shipTriggleMin&&m<=In.max&&r.changeShipScale("end")}catch(m){console.log("moveend---catch",m)}});const c={[Un.PORT]:null,[Un.SHIP]:null,[Un.TRACK]:null},d=(f,p,m)=>{switch(Xo(l,"pointer"),f){case Un.SHIP:r==null||r.handleShipMapEvent(p,"hover");break;case Un.PORT:break;case Un.TRACK:n==null||n.handleTrackMapEvent(p,"hover",m);break}},u=f=>{switch(Xo(l,"grab"),f){case Un.PORT:break;case Un.SHIP:r==null||r.handleShipMapEvent(null,"hover");break;case Un.TRACK:n==null||n.handleTrackMapEvent(null,"hover");break}};l.on("pointermove",f=>{if(!l.getView().getAnimating())try{let p=!1;const m=l.getLayers().getArray().filter(h=>h.get("layerType"));m&&m.length>0&&m.forEach(h=>{if(p)return;const y=l==null?void 0:l.getEventPixel(f.originalEvent),g=h==null?void 0:h.get("layerType"),b=l==null?void 0:l.forEachFeatureAtPixel(y,w=>w,{layerFilter:w=>w===h,hitTolerance:5});b!==c[g]&&(c[g]&&u(g,c[g]),c[g]=b,b&&(d(g,b,f),p=!0))})}catch(p){console.log("pointermove----",p)}}),l.on("movestart",()=>{try{const f=l==null?void 0:l.getView().getZoom();f&&f<=In.shipModelMax&&f>=In.shipTriggleMin&&r.changeShipScale("start")}catch(f){console.log("movestart---catch",f)}}),l.on("click",o_(f=>{if(a.getState()!=="open"&&!l.getView().getAnimating())try{let p=!1;const m=l.getLayers().getArray().filter(h=>h.get("layerType"));m&&m.length>0&&m.forEach(h=>{var b,w,C;if(p)return;const y=l==null?void 0:l.getEventPixel(f.originalEvent),g=l==null?void 0:l.forEachFeatureAtPixel(y,_=>{if(_.get("shipData")||_.get("portData"))return _},{layerFilter:_=>_===h,hitTolerance:10});if(g){if(g!=null&&g.get("shipData"))console.log("trackManager.getTrackStatus()---",n.getTrackStatus()),n.getTrackStatus()||r.handleShipMapEvent(g,"click",(b=e.getProps())==null?void 0:b.selectShip);else if(g!=null&&g.get("portData")){const _=g==null?void 0:g.get("portData");o.selected(_),(C=(w=e.getProps())==null?void 0:w.selectPort)==null||C.call(w,_)}p=!0,f.preventDefault(),f.stopPropagation()}})}catch(p){console.log("pointermove----",p)}},150))},X7=()=>{const t=i.reactive([]);return{createInstance:(r,o)=>{const s=o7();s.initMap(r,o);const a=s.getInstall(),l=L7(a),c=A7();c.setProps(o),l.setShowLayerType(o.layerType),l.setGreenTileVisible(o.showGreenLayer);const d=E7(a),u=d7(a,d),f=N7(a),p=F7(a),m=G7(a,c),h=j7(a,c),y=U7(a);K7(s,c,d,f,y,m,h);const g=()=>{const w=a.getView().calculateExtent(s.getSize()),C=ro([w[0],w[1]],Hn.mercator,Hn.data),_=ro([w[2],w[3]],Hn.mercator,Hn.data);return[C[0],C[1],_[0],_[1]]},b={id:Symbol("map-instance"),innerMap:null,map:s.getInstall(),destroy:()=>{t.splice(t.indexOf(b),1)},methods:{...s,layer:l,ship:f,track:d,carTrack:u,port:{render:y.render,clear:y.clear,selected:y.selected},position:p,drawLine:m,drawPolygon:h,utils:{getCalculateExtent:g,convertSixHundredThousandToLatLng:w0,calculateCirclePoints:s7}}};return t.push(b),b},destroyInstance:r=>{const o=t.findIndex(s=>s.id===r);o>-1&&(t[o].destroy(),t.splice(o,1))},destroyAll:()=>{t.forEach(r=>r.destroy()),t.splice(0,t.length)},getAllInstances:()=>[...t]}},Z7={class:"zh-map-box"},q7=i.defineComponent({__name:"Map",props:{zoom:{default:In.default},center:{default:VG},layerType:{default:"vector"},showGreenLayer:{type:Boolean,default:!1},showScale:{type:Boolean,default:!0},scaleLineUnit:{default:"metric"},mapMoveEnd:{type:Function,default:()=>{}},lineDrawEnd:{},areaDrawEnd:{type:Function,default:()=>{}},selectShip:{type:Function,default:()=>{}},selectPort:{type:Function,default:()=>{}}},setup(t,{expose:e}){function n(){return new Promise(d=>{document.fonts?document.fonts.load("12px map-iconfont").then(d):setTimeout(d,300)})}n();const r=i.ref(),o=i.ref(),s=X7(),a=i.ref(),l=t,c=i.ref({getInstall(){}});return i.onMounted(()=>{var d;a.value=s.createInstance(r.value,l),c.value=a.value.methods,(d=o.value)==null||d.setScaleLine(a.value.map,l.scaleLineUnit)}),i.onUnmounted(()=>{var d,u;s.destroyInstance((d=a==null?void 0:a.value)==null?void 0:d.id),(u=a.value)==null||u.destroy()}),e({getZoom:()=>{var d;return(d=a.value)==null?void 0:d.methods.getZoom()},setZoom:d=>{var u;return(u=a.value)==null?void 0:u.methods.setZoom(d)},getInstall:()=>{var d;return(d=a.value)==null?void 0:d.methods.getInstall()},getView:()=>{var d;return(d=a.value)==null?void 0:d.methods.getView()},setCenter:(d,u)=>{var f;return(f=a.value)==null?void 0:f.methods.setCenter(d,u)},getSize:()=>{var d;return(d=a.value)==null?void 0:d.methods.getSize()},getCenter:(d,u)=>{var f;return(f=a.value)==null?void 0:f.methods.getCenter()},layer:{setGreenTileVisible:d=>{var u;return(u=a.value)==null?void 0:u.methods.layer.setGreenTileVisible(d)},getGreenTileVisible:()=>{var d;return(d=a.value)==null?void 0:d.methods.layer.getGreenTileVisible()},getShowLayerType:()=>{var d;return(d=a.value)==null?void 0:d.methods.layer.getShowLayerType()},setShowLayerType:d=>{var u;return(u=a.value)==null?void 0:u.methods.layer.setShowLayerType(d)}},ship:{render:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.ship.render(...d)},selected:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.ship.selected(...d)},filter:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.ship.filter(...d)},blinking:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.ship.blinking(...d)},clear:()=>{var d;return(d=a.value)==null?void 0:d.methods.ship.clear()}},track:{render:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.track.render(...d)},remove:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.track.remove(...d)},play:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.track.play(...d)},setCenter:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.track.setCenter(...d)},close:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.track.close(...d)},getLength:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.track.getLength(...d)}},carTrack:{location:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.carTrack.location(...d)},remove:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.carTrack.remove(...d)},renderTrack:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.carTrack.renderTrack(...d)},setCenter:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.carTrack.setCenter(...d)},closeTrack:()=>{var d;return(d=a.value)==null?void 0:d.methods.carTrack.closeTrack()},playTrack:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.carTrack.playTrack(...d)}},port:{render:(d,u)=>{var f;return(f=a.value)==null?void 0:f.methods.port.render(d,u)},clear:()=>{var d;return(d=a.value)==null?void 0:d.methods.port.clear()},selected:d=>{var u;return(u=a.value)==null?void 0:u.methods.port.selected(d)}},position:{render:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.position.render(...d)},selected:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.position.selected(...d)},clearSelected:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.position.clearSelected(...d)},clear:()=>{var d;return(d=a.value)==null?void 0:d.methods.position.clear()}},drawLine:{open:()=>{var d;return(d=a.value)==null?void 0:d.methods.drawLine.open()},close:()=>{var d;return(d=a.value)==null?void 0:d.methods.drawLine.close()},deleteLine:d=>{var u;return(u=a.value)==null?void 0:u.methods.drawLine.deleteLine(d)},setUnit:d=>{var u;return(u=a.value)==null?void 0:u.methods.drawLine.setUnit(d)},getState:()=>{var d;return(d=a.value)==null?void 0:d.methods.drawLine.getState()}},drawPolygon:{open:()=>{var d;return(d=a.value)==null?void 0:d.methods.drawPolygon.open()},close:()=>{var d;return(d=a.value)==null?void 0:d.methods.drawPolygon.close()},reset:()=>{var d;return(d=a.value)==null?void 0:d.methods.drawPolygon.reset()}},utils:{getCalculateExtent:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.utils.getCalculateExtent(...d)},convertSixHundredThousandToLatLng:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.utils.convertSixHundredThousandToLatLng(...d)},calculateCirclePoints:(d,u)=>{var f;return(f=a.value)==null?void 0:f.methods.utils.calculateCirclePoints(d,u)}}}),(d,u)=>(i.openBlock(),i.createElementBlock("div",Z7,[i.createElementVNode("div",{id:"map",ref_key:"zhMapRef",ref:r,class:"zh-map"},null,512),i.createVNode(hG,{ref_key:"scaleLineRef",ref:o},null,512),i.createVNode(mG,{ref:"zoomControlRef","map-instance":a.value},null,8,["map-instance"])]))}}),U2=Pt(zt(q7,[["__scopeId","data-v-a0c7f7b1"]]));var J7={name:"zh-cn",el:{breadcrumb:{label:"面包屑"},colorpicker:{confirm:"确定",clear:"清空",defaultLabel:"颜色选择器",description:"当前颜色 {color},按 Enter 键选择新颜色",alphaLabel:"选择透明度的值"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",dateTablePrompt:"使用方向键与 Enter 键可选择日期",monthTablePrompt:"使用方向键与 Enter 键可选择月份",yearTablePrompt:"使用方向键与 Enter 键可选择年份",selectedDate:"已选日期",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"年",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"日",mon:"一",tue:"二",wed:"三",thu:"四",fri:"五",sat:"六"},weeksFull:{sun:"星期日",mon:"星期一",tue:"星期二",wed:"星期三",thu:"星期四",fri:"星期五",sat:"星期六"},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},inputNumber:{decrease:"减少数值",increase:"增加数值"},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},dropdown:{toggleDropdown:"切换下拉选项"},mention:{loading:"加载中"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:"页",page:"页",prev:"上一页",next:"下一页",currentPage:"第 {pager} 页",prevPages:"向前 {pager} 页",nextPages:"向后 {pager} 页",deprecationWarning:"你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档"},dialog:{close:"关闭此对话框"},drawer:{close:"关闭此对话框"},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!",close:"关闭此对话框"},upload:{deleteTip:"按 delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},slider:{defaultLabel:"滑块介于 {min} 至 {max}",defaultRangeStartLabel:"选择起始值",defaultRangeEndLabel:"选择结束值"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计"},tour:{next:"下一步",previous:"上一步",finish:"结束导览"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"},carousel:{leftArrow:"上一张幻灯片",rightArrow:"下一张幻灯片",indicator:"幻灯片切换至索引 {index}"}}};/**!
222
+ `,_=()=>`data:image/svg+xml;utf8,${encodeURIComponent(C(b?"#F32D2D":"#3370FF"))}`,E=t.getView().getZoom(),S=g.get("portData"),v=window.devicePixelRatio||1,x=new _t({image:new ni({src:_(),scale:.5*E/10}),zIndex:b?110:100}),k=new _t({image:new ni({src:d(S.shortName,b),anchor:[.5,.5],displacement:[0,-30],scale:1/v,anchorXUnits:"fraction",anchorYUnits:"fraction"}),zIndex:b?110:100});return!w&&!b?x:[x,k]},f=()=>{if(e)if(r){console.log("清除非选中的港口");const g=r.get("portData").id;e.getFeatures().forEach(b=>{b.get("portData").id!==g&&e.removeFeature(b)})}else console.log("清除所有港口",e),e==null||e.clear()},p=g=>{if(e){if(!g)return m();(r==null?void 0:r.get("portData").id)!==g.id&&(m(),h(g))}},m=()=>{var g;if(r){const b=r==null?void 0:r.get("portData"),w=(g=e.getFeatures())==null?void 0:g.find(C=>C.get("portData").id===b.id);w&&(w.set("select",!1),w.setStyle(u(w)),r=null,o=null)}},h=g=>{if(!e)return;const b=e.getFeatures();o=g,r=b.find(w=>w.get("portData").id===g.id),r&&(r.set("select",!0),r.setStyle(u(r)))};return{render:s,clear:f,selected:p,handlePortHover:g=>{g&&g.get("portData")?Xo(t,"pointer"):Xo(t,"grab")}}},K7=(t,e,n,r,o,s,a)=>{const l=t.getInstall();l.on("moveend",()=>{var f,p;try{const m=t.getZoom();(p=(f=e.getProps()).mapMoveEnd)==null||p.call(f,m),m>=In.min&&m<=In.max&&n.reRenderTrackLine(),m>=In.shipTriggleMin&&m<=In.max&&r.changeShipScale("end")}catch(m){console.log("moveend---catch",m)}});const c={[Un.PORT]:null,[Un.SHIP]:null,[Un.TRACK]:null},d=(f,p,m)=>{switch(Xo(l,"pointer"),f){case Un.SHIP:r==null||r.handleShipMapEvent(p,"hover");break;case Un.PORT:break;case Un.TRACK:n==null||n.handleTrackMapEvent(p,"hover",m);break}},u=f=>{switch(Xo(l,"grab"),f){case Un.PORT:break;case Un.SHIP:r==null||r.handleShipMapEvent(null,"hover");break;case Un.TRACK:n==null||n.handleTrackMapEvent(null,"hover");break}};l.on("pointermove",f=>{if(a.getState()!=="open"&&s.getState()!=="open"&&!l.getView().getAnimating())try{let p=!1;const m=l.getLayers().getArray().filter(h=>h.get("layerType"));m&&m.length>0&&m.forEach(h=>{if(p)return;const y=l==null?void 0:l.getEventPixel(f.originalEvent),g=h==null?void 0:h.get("layerType"),b=l==null?void 0:l.forEachFeatureAtPixel(y,w=>w,{layerFilter:w=>w===h,hitTolerance:5});b!==c[g]&&(c[g]&&u(g,c[g]),c[g]=b,b&&(d(g,b,f),p=!0))})}catch(p){console.log("pointermove----",p)}}),l.on("movestart",()=>{try{const f=l==null?void 0:l.getView().getZoom();f&&f<=In.shipModelMax&&f>=In.shipTriggleMin&&r.changeShipScale("start")}catch(f){console.log("movestart---catch",f)}}),l.on("click",o_(f=>{if(a.getState()!=="open"&&s.getState()!=="open"&&!l.getView().getAnimating())try{let p=!1;const m=l.getLayers().getArray().filter(h=>h.get("layerType"));m&&m.length>0&&m.forEach(h=>{var b,w,C;if(p)return;const y=l==null?void 0:l.getEventPixel(f.originalEvent),g=l==null?void 0:l.forEachFeatureAtPixel(y,_=>{if(_.get("shipData")||_.get("portData"))return _},{layerFilter:_=>_===h,hitTolerance:10});if(g){if(g!=null&&g.get("shipData"))console.log("trackManager.getTrackStatus()---",n.getTrackStatus()),n.getTrackStatus()||r.handleShipMapEvent(g,"click",(b=e.getProps())==null?void 0:b.selectShip);else if(g!=null&&g.get("portData")){const _=g==null?void 0:g.get("portData");o.selected(_),(C=(w=e.getProps())==null?void 0:w.selectPort)==null||C.call(w,_)}p=!0,f.preventDefault(),f.stopPropagation()}})}catch(p){console.log("pointermove----",p)}},150))},X7=()=>{const t=i.reactive([]);return{createInstance:(r,o)=>{const s=o7();s.initMap(r,o);const a=s.getInstall(),l=L7(a),c=A7();c.setProps(o),l.setShowLayerType(o.layerType),l.setGreenTileVisible(o.showGreenLayer);const d=E7(a),u=d7(a,d),f=N7(a),p=F7(a),m=G7(a,c),h=j7(a,c),y=U7(a);K7(s,c,d,f,y,m,h);const g=()=>{const w=a.getView().calculateExtent(s.getSize()),C=ro([w[0],w[1]],Hn.mercator,Hn.data),_=ro([w[2],w[3]],Hn.mercator,Hn.data);return[C[0],C[1],_[0],_[1]]},b={id:Symbol("map-instance"),innerMap:null,map:s.getInstall(),destroy:()=>{t.splice(t.indexOf(b),1)},methods:{...s,layer:l,ship:f,track:d,carTrack:u,port:{render:y.render,clear:y.clear,selected:y.selected},position:p,drawLine:m,drawPolygon:h,utils:{getCalculateExtent:g,convertSixHundredThousandToLatLng:w0,calculateCirclePoints:s7}}};return t.push(b),b},destroyInstance:r=>{const o=t.findIndex(s=>s.id===r);o>-1&&(t[o].destroy(),t.splice(o,1))},destroyAll:()=>{t.forEach(r=>r.destroy()),t.splice(0,t.length)},getAllInstances:()=>[...t]}},Z7={class:"zh-map-box"},q7=i.defineComponent({__name:"Map",props:{zoom:{default:In.default},center:{default:VG},layerType:{default:"vector"},showGreenLayer:{type:Boolean,default:!1},showScale:{type:Boolean,default:!0},scaleLineUnit:{default:"metric"},mapMoveEnd:{type:Function,default:()=>{}},lineDrawEnd:{},areaDrawEnd:{type:Function,default:()=>{}},selectShip:{type:Function,default:()=>{}},selectPort:{type:Function,default:()=>{}}},setup(t,{expose:e}){function n(){return new Promise(d=>{document.fonts?document.fonts.load("12px map-iconfont").then(d):setTimeout(d,300)})}n();const r=i.ref(),o=i.ref(),s=X7(),a=i.ref(),l=t,c=i.ref({getInstall(){}});return i.onMounted(()=>{var d;a.value=s.createInstance(r.value,l),c.value=a.value.methods,(d=o.value)==null||d.setScaleLine(a.value.map,l.scaleLineUnit)}),i.onUnmounted(()=>{var d,u;s.destroyInstance((d=a==null?void 0:a.value)==null?void 0:d.id),(u=a.value)==null||u.destroy()}),e({getZoom:()=>{var d;return(d=a.value)==null?void 0:d.methods.getZoom()},setZoom:d=>{var u;return(u=a.value)==null?void 0:u.methods.setZoom(d)},getInstall:()=>{var d;return(d=a.value)==null?void 0:d.methods.getInstall()},getView:()=>{var d;return(d=a.value)==null?void 0:d.methods.getView()},setCenter:(d,u)=>{var f;return(f=a.value)==null?void 0:f.methods.setCenter(d,u)},getSize:()=>{var d;return(d=a.value)==null?void 0:d.methods.getSize()},getCenter:(d,u)=>{var f;return(f=a.value)==null?void 0:f.methods.getCenter()},layer:{setGreenTileVisible:d=>{var u;return(u=a.value)==null?void 0:u.methods.layer.setGreenTileVisible(d)},getGreenTileVisible:()=>{var d;return(d=a.value)==null?void 0:d.methods.layer.getGreenTileVisible()},getShowLayerType:()=>{var d;return(d=a.value)==null?void 0:d.methods.layer.getShowLayerType()},setShowLayerType:d=>{var u;return(u=a.value)==null?void 0:u.methods.layer.setShowLayerType(d)}},ship:{render:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.ship.render(...d)},selected:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.ship.selected(...d)},filter:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.ship.filter(...d)},blinking:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.ship.blinking(...d)},clear:()=>{var d;return(d=a.value)==null?void 0:d.methods.ship.clear()}},track:{render:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.track.render(...d)},remove:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.track.remove(...d)},play:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.track.play(...d)},setCenter:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.track.setCenter(...d)},close:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.track.close(...d)},getLength:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.track.getLength(...d)}},carTrack:{location:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.carTrack.location(...d)},remove:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.carTrack.remove(...d)},renderTrack:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.carTrack.renderTrack(...d)},setCenter:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.carTrack.setCenter(...d)},closeTrack:()=>{var d;return(d=a.value)==null?void 0:d.methods.carTrack.closeTrack()},playTrack:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.carTrack.playTrack(...d)}},port:{render:(d,u)=>{var f;return(f=a.value)==null?void 0:f.methods.port.render(d,u)},clear:()=>{var d;return(d=a.value)==null?void 0:d.methods.port.clear()},selected:d=>{var u;return(u=a.value)==null?void 0:u.methods.port.selected(d)}},position:{render:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.position.render(...d)},selected:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.position.selected(...d)},clearSelected:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.position.clearSelected(...d)},clear:()=>{var d;return(d=a.value)==null?void 0:d.methods.position.clear()}},drawLine:{open:()=>{var d;return(d=a.value)==null?void 0:d.methods.drawLine.open()},close:()=>{var d;return(d=a.value)==null?void 0:d.methods.drawLine.close()},deleteLine:d=>{var u;return(u=a.value)==null?void 0:u.methods.drawLine.deleteLine(d)},setUnit:d=>{var u;return(u=a.value)==null?void 0:u.methods.drawLine.setUnit(d)},getState:()=>{var d;return(d=a.value)==null?void 0:d.methods.drawLine.getState()}},drawPolygon:{open:()=>{var d;return(d=a.value)==null?void 0:d.methods.drawPolygon.open()},close:()=>{var d;return(d=a.value)==null?void 0:d.methods.drawPolygon.close()},reset:()=>{var d;return(d=a.value)==null?void 0:d.methods.drawPolygon.reset()}},utils:{getCalculateExtent:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.utils.getCalculateExtent(...d)},convertSixHundredThousandToLatLng:(...d)=>{var u;return(u=a.value)==null?void 0:u.methods.utils.convertSixHundredThousandToLatLng(...d)},calculateCirclePoints:(d,u)=>{var f;return(f=a.value)==null?void 0:f.methods.utils.calculateCirclePoints(d,u)}}}),(d,u)=>(i.openBlock(),i.createElementBlock("div",Z7,[i.createElementVNode("div",{id:"map",ref_key:"zhMapRef",ref:r,class:"zh-map"},null,512),i.createVNode(hG,{ref_key:"scaleLineRef",ref:o},null,512),i.createVNode(mG,{ref:"zoomControlRef","map-instance":a.value},null,8,["map-instance"])]))}}),U2=Pt(zt(q7,[["__scopeId","data-v-a0c7f7b1"]]));var J7={name:"zh-cn",el:{breadcrumb:{label:"面包屑"},colorpicker:{confirm:"确定",clear:"清空",defaultLabel:"颜色选择器",description:"当前颜色 {color},按 Enter 键选择新颜色",alphaLabel:"选择透明度的值"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",dateTablePrompt:"使用方向键与 Enter 键可选择日期",monthTablePrompt:"使用方向键与 Enter 键可选择月份",yearTablePrompt:"使用方向键与 Enter 键可选择年份",selectedDate:"已选日期",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"年",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"日",mon:"一",tue:"二",wed:"三",thu:"四",fri:"五",sat:"六"},weeksFull:{sun:"星期日",mon:"星期一",tue:"星期二",wed:"星期三",thu:"星期四",fri:"星期五",sat:"星期六"},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},inputNumber:{decrease:"减少数值",increase:"增加数值"},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},dropdown:{toggleDropdown:"切换下拉选项"},mention:{loading:"加载中"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:"页",page:"页",prev:"上一页",next:"下一页",currentPage:"第 {pager} 页",prevPages:"向前 {pager} 页",nextPages:"向后 {pager} 页",deprecationWarning:"你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档"},dialog:{close:"关闭此对话框"},drawer:{close:"关闭此对话框"},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!",close:"关闭此对话框"},upload:{deleteTip:"按 delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},slider:{defaultLabel:"滑块介于 {min} 至 {max}",defaultRangeStartLabel:"选择起始值",defaultRangeEndLabel:"选择结束值"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计"},tour:{next:"下一步",previous:"上一步",finish:"结束导览"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"},carousel:{leftArrow:"上一张幻灯片",rightArrow:"下一张幻灯片",indicator:"幻灯片切换至索引 {index}"}}};/**!
223
223
  * Sortable 1.15.6
224
224
  * @author RubaXa <trash@rubaxa.org>
225
225
  * @author owenm <owen23355@gmail.com>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zhihao-ui",
3
- "version": "1.3.50",
3
+ "version": "1.3.52",
4
4
  "description": "components",
5
5
  "type": "module",
6
6
  "main": "./dist/umd/index.umd.cjs",