zhihao-ui 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/es/{BaseInfo-DZ0pUsfS.js → BaseInfo-BqJWKOdd.js} +1 -1
  2. package/dist/es/{BaseItem-C_JbnRPH.js → BaseItem-BQbkTxt9.js} +3 -3
  3. package/dist/es/{Button-CydCp4hf.js → Button-1UUC8v6b.js} +2 -2
  4. package/dist/es/{DatePicker-C__sA0-h.js → DatePicker-ByP3ZkhE.js} +3 -3
  5. package/dist/es/{DetailHeader-bEliAoL-.js → DetailHeader-CnZCthjX.js} +3 -3
  6. package/dist/es/{DetailSubTitle-COsgdEV-.js → DetailSubTitle-COQCdb8X.js} +2 -2
  7. package/dist/es/{Dialog-D-vnJqtW.js → Dialog-DFQIVnQP.js} +3 -3
  8. package/dist/es/{DiyDataTable-DTMKwxu9.js → DiyDataTable-D0gTwPB4.js} +4 -4
  9. package/dist/es/{EditInfoPair-C4vN_b9E.js → EditInfoPair-CZpQKhX6.js} +3 -3
  10. package/dist/es/{FileWrapper-D7KcyVg2.js → FileWrapper-C9Cqt-L8.js} +4 -4
  11. package/dist/es/{Grid-BE-CLeGr.js → Grid-CfwiS54k.js} +2 -2
  12. package/dist/es/{InfoPair-T3_TncEu.js → InfoPair-ZKRxEmIC.js} +3 -3
  13. package/dist/es/{Input-C0UdD80I.js → Input-CloA0e6h.js} +3 -3
  14. package/dist/es/{Loading-QlWiWU_L.js → Loading-BXtzvylk.js} +2 -2
  15. package/dist/es/{Map-DMb_YG1p.js → Map-Ce0s7g5Z.js} +551 -475
  16. package/dist/es/{MessageBox-B42XuRHh.js → MessageBox-BNOuww77.js} +2 -2
  17. package/dist/es/{MoneyInput-BsulLCsJ.js → MoneyInput-CuHL7bEc.js} +8 -8
  18. package/dist/es/{PageHeadPanel-BlFg_TvH.js → PageHeadPanel-BroYHTD8.js} +2 -2
  19. package/dist/es/{Table-Oo-hQWGa.js → Table-DFGzUqS3.js} +5 -5
  20. package/dist/es/{ToolTips-YgMKfoQ0.js → ToolTips-BBi5iPOb.js} +3 -3
  21. package/dist/es/index.js +22 -22
  22. package/dist/es/{utils-CU-8DWnA.js → utils-BbOeFn3W.js} +3 -3
  23. package/dist/es/{vendor-1zIwhmRg.js → vendor-D-B7bNnH.js} +32 -31
  24. package/dist/index.css +1 -1
  25. package/dist/types/components/Map/config/global.d.ts +1 -0
  26. package/dist/types/components/Map/config/index.d.ts +0 -41
  27. package/dist/types/components/Map/config/map.d.ts +0 -3
  28. package/dist/types/components/Map/function/drawPolygon.d.ts +1 -1
  29. package/dist/types/components/Map/function/port.d.ts +1 -2
  30. package/dist/types/components/Map/function/ship/index.d.ts +22 -0
  31. package/dist/types/components/Map/function/ship/style.d.ts +6 -0
  32. package/dist/types/components/Map/function/shipTrack.d.ts +7 -0
  33. package/dist/types/components/Map/meta/index.d.ts +0 -5
  34. package/dist/types/components/Map/utils/overlay.d.ts +2 -1
  35. package/dist/types/components/Map/utils/util.d.ts +42 -0
  36. package/dist/umd/index.css +1 -1
  37. package/dist/umd/index.umd.cjs +17 -15
  38. package/package.json +1 -1
  39. package/dist/types/components/Map/Map.vue.d.ts +0 -130
  40. package/dist/types/components/Map/function/label.d.ts +0 -9
  41. package/dist/types/components/Map/function/ship.d.ts +0 -34
  42. package/dist/types/components/Map/function/shipLabel.d.ts +0 -25
  43. package/dist/types/components/Map/index.d.ts +0 -418
@@ -130,8 +130,8 @@ hooks.version="2.30.1",setHookCallback(createLocal),hooks.fn=proto,hooks.min=min
130
130
  }
131
131
  gl_FragColor = texture2D(u_texture, v_texcoord);
132
132
  }
133
- `;function createCanvasContextWebGL(t,e,n,r){let i;return n&&n.length?i=n.shift():WORKER_OFFSCREEN_CANVAS?i=new OffscreenCanvas(t||300,e||300):i=document.createElement("canvas"),t&&(i.width=t),e&&(i.height=e),i.getContext("webgl",r)}function releaseGLCanvas(t){const e=t.canvas;e.width=1,e.height=1,t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)}const canvasGLPool=[];function render(t,e,n,r,i,g,y,k,L,$,V,z,re,oe){const j=Math.round(r*e),ie=Math.round(r*n);t.canvas.width=j,t.canvas.height=ie;let ae,ue;if(ue=t.createTexture(),t.bindTexture(t.TEXTURE_2D,ue),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),re?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,j,ie,0,t.RGBA,V,null),ae=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,ae),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,ue,0),ae===null)throw new Error("Could not create framebuffer");if(ue===null)throw new Error("Could not create texture");if(L.length===0)return{width:j,height:ie,framebuffer:ae,texture:ue};const de=createEmpty();L.forEach(function(Ne,Ue,kt){extend$3(de,Ne.extent)});let pe,le,he;const _e=1/i;{if(pe=t.createTexture(),ue===null)throw new Error("Could not create texture");le=Math.round(getWidth(de)*_e),he=Math.round(getHeight(de)*_e);const Ne=t.getParameter(t.MAX_TEXTURE_SIZE),Ue=Math.max(le,he),kt=Ue>Ne?Ne/Ue:1,Dt=Math.round(le*kt),jt=Math.round(he*kt);t.bindTexture(t.TEXTURE_2D,pe),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),re?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,Dt,jt,0,t.RGBA,V,null);const Fe=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,Fe),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,pe,0);const $e=new Canvas(t);L.forEach(function(Ve,ze,Oe){const qe=(Ve.extent[0]-de[0])*_e*kt,Et=-(Ve.extent[3]-de[3])*_e*kt,hn=getWidth(Ve.extent)*_e*kt,At=getHeight(Ve.extent)*_e*kt;if(t.bindFramebuffer(t.FRAMEBUFFER,Fe),t.viewport(0,0,Dt,jt),Ve.clipExtent){const Lt=(Ve.clipExtent[0]-de[0])*_e*kt,wn=-(Ve.clipExtent[3]-de[3])*_e*kt,kn=getWidth(Ve.clipExtent)*_e*kt,En=getHeight(Ve.clipExtent)*_e*kt;t.enable(t.SCISSOR_TEST),t.scissor(re?Lt:Math.round(Lt),re?wn:Math.round(wn),re?kn:Math.round(Lt+kn)-Math.round(Lt),re?En:Math.round(wn+En)-Math.round(wn))}$e.drawImage(Ve.texture,Ve.width,Ve.height,$,$,Ve.width-2*$,Ve.height-2*$,re?qe:Math.round(qe),re?Et:Math.round(Et),re?hn:Math.round(qe+hn)-Math.round(qe),re?At:Math.round(Et+At)-Math.round(Et),Dt,jt),t.disable(t.SCISSOR_TEST)}),t.deleteFramebuffer(Fe)}const Ce=getTopLeft(y),xe=getTopLeft(de),Ie=Ne=>{const Ue=(Ne[0][0]-Ce[0])/g*r,kt=-(Ne[0][1]-Ce[1])/g*r,Dt=(Ne[1][0]-Ce[0])/g*r,jt=-(Ne[1][1]-Ce[1])/g*r,Fe=(Ne[2][0]-Ce[0])/g*r,$e=-(Ne[2][1]-Ce[1])/g*r;return{u1:Dt,v1:jt,u0:Ue,v0:kt,u2:Fe,v2:$e}};t.bindFramebuffer(t.FRAMEBUFFER,ae),t.viewport(0,0,j,ie);{const Ne=[],Ue=[],kt=createProgram(t,TRIANGLE_FRAGMENT_SHADER,TRIANGLE_VERTEX_SHADER);t.useProgram(kt);const Dt=t.getUniformLocation(kt,"u_texture");t.bindTexture(t.TEXTURE_2D,pe),t.uniform1i(Dt,0),k.getTriangles().forEach(function(qe,Et,hn){const At=qe.source,Lt=qe.target,{u1:wn,v1:kn,u0:En,v0:Cn,u2:Pn,v2:Dn}=Ie(Lt),Ln=(At[0][0]-xe[0])/i/le,Vn=-(At[0][1]-xe[1])/i/he,Bn=(At[1][0]-xe[0])/i/le,jn=-(At[1][1]-xe[1])/i/he,Xn=(At[2][0]-xe[0])/i/le,Zn=-(At[2][1]-xe[1])/i/he;Ne.push(wn,kn,En,Cn,Pn,Dn),Ue.push(Bn,jn,Ln,Vn,Xn,Zn)});const jt=orthographic(0,j,ie,0,-1,1),Fe=t.getUniformLocation(kt,"u_matrix");t.uniformMatrix4fv(Fe,!1,jt);const $e=t.getAttribLocation(kt,"a_position"),Ve=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,Ve),t.bufferData(t.ARRAY_BUFFER,new Float32Array(Ne),t.STATIC_DRAW),t.vertexAttribPointer($e,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray($e);const ze=t.getAttribLocation(kt,"a_texcoord"),Oe=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,Oe),t.bufferData(t.ARRAY_BUFFER,new Float32Array(Ue),t.STATIC_DRAW),t.vertexAttribPointer(ze,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(ze),t.drawArrays(t.TRIANGLES,0,Ne.length/2)}if(z){const Ne=createProgram(t,EDGE_FRAGMENT_SHADER,EDGE_VERTEX_SHADER);t.useProgram(Ne);const Ue=orthographic(0,j,ie,0,-1,1),kt=t.getUniformLocation(Ne,"u_matrix");t.uniformMatrix4fv(kt,!1,Ue);const Dt=Array.isArray(z)?z:[0,0,0,255],jt=t.getUniformLocation(Ne,"u_val");t.uniform4fv(jt,Dt);const Fe=t.getAttribLocation(Ne,"a_position"),$e=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,$e),t.vertexAttribPointer(Fe,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(Fe);const Ve=k.getTriangles().reduce(function(ze,Oe){const qe=Oe.target,{u1:Et,v1:hn,u0:At,v0:Lt,u2:wn,v2:kn}=Ie(qe);return ze.concat([Et,hn,At,Lt,At,Lt,wn,kn,wn,kn,Et,hn])},[]);t.bufferData(t.ARRAY_BUFFER,new Float32Array(Ve),t.STATIC_DRAW),t.drawArrays(t.LINES,0,Ve.length/2)}return{width:j,height:ie,framebuffer:ae,texture:ue}}class ReprojDataTile extends DataTile{constructor(e){super({tileCoord:e.tileCoord,loader:()=>Promise.resolve(new Uint8ClampedArray(4)),interpolate:e.interpolate,transition:e.transition}),this.renderEdges_=e.renderEdges!==void 0?e.renderEdges:!1,this.pixelRatio_=e.pixelRatio,this.gutter_=e.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=e.sourceTileGrid,this.targetTileGrid_=e.targetTileGrid,this.wrappedTileCoord_=e.wrappedTileCoord||e.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const n=e.sourceProj,r=n.getExtent(),i=e.sourceTileGrid.getExtent();this.clipExtent_=n.canWrapX()?i?getIntersection(r,i):r:i;const g=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),y=this.targetTileGrid_.getExtent();let k=this.sourceTileGrid_.getExtent();const L=y?getIntersection(g,y):g;if(getArea$1(L)===0){this.state=TileState.EMPTY;return}r&&(k?k=getIntersection(k,r):k=r);const $=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),V=e.targetProj,z=calculateSourceExtentResolution(n,V,L,$);if(!isFinite(z)||z<=0){this.state=TileState.EMPTY;return}const re=e.errorThreshold!==void 0?e.errorThreshold:ERROR_THRESHOLD;if(this.triangulation_=new Triangulation(n,V,L,k,z*re,$,e.transformMatrix),this.triangulation_.getTriangles().length===0){this.state=TileState.EMPTY;return}this.sourceZ_=this.sourceTileGrid_.getZForResolution(z);let oe=this.triangulation_.calculateSourceExtent();if(k&&(n.canWrapX()?(oe[1]=clamp(oe[1],k[1],k[3]),oe[3]=clamp(oe[3],k[1],k[3])):oe=getIntersection(oe,k)),!getArea$1(oe))this.state=TileState.EMPTY;else{let j=0,ie=0;n.canWrapX()&&(j=getWidth(r),ie=Math.floor((oe[0]-r[0])/j)),wrapAndSliceX(oe.slice(),n,!0).forEach(ue=>{const de=this.sourceTileGrid_.getTileRangeForExtentAndZ(ue,this.sourceZ_),pe=e.getTileFunction;for(let le=de.minX;le<=de.maxX;le++)for(let he=de.minY;he<=de.maxY;he++){const _e=pe(this.sourceZ_,le,he,this.pixelRatio_);if(_e){const Ce=ie*j;this.sourceTiles_.push({tile:_e,offset:Ce})}}++ie}),this.sourceTiles_.length===0&&(this.state=TileState.EMPTY)}}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const e=[];let n=!1;if(this.sourceTiles_.forEach(le=>{var Et;const he=le.tile;if(!he||he.getState()!==TileState.LOADED)return;const _e=he.getSize(),Ce=this.gutter_;let xe;const Ie=asArrayLike(he.getData());Ie?xe=Ie:(n=!0,xe=toArray(asImageLike(he.getData())));const Ne=[_e[0]+2*Ce,_e[1]+2*Ce],Ue=xe instanceof Float32Array,kt=Ne[0]*Ne[1],Dt=Ue?Float32Array:Uint8ClampedArray,jt=new Dt(xe.buffer),Fe=Dt.BYTES_PER_ELEMENT,$e=Fe*jt.length/kt,Ve=jt.byteLength/Ne[1],ze=Math.floor(Ve/Fe/Ne[0]),Oe=this.sourceTileGrid_.getTileCoordExtent(he.tileCoord);Oe[0]+=le.offset,Oe[2]+=le.offset;const qe=(Et=this.clipExtent_)==null?void 0:Et.slice();qe&&(qe[0]+=le.offset,qe[2]+=le.offset),e.push({extent:Oe,clipExtent:qe,data:jt,dataType:Dt,bytesPerPixel:$e,pixelSize:Ne,bandCount:ze})}),this.sourceTiles_.length=0,e.length===0){this.state=TileState.ERROR,this.changed();return}const r=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(r),g=typeof i=="number"?i:i[0],y=typeof i=="number"?i:i[1],k=g*this.pixelRatio_,L=y*this.pixelRatio_,$=this.targetTileGrid_.getResolution(r),V=this.sourceTileGrid_.getResolution(this.sourceZ_),z=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),re=e[0].bandCount,oe=new e[0].dataType(re*k*L),j=createCanvasContextWebGL(k,L,canvasGLPool,{premultipliedAlpha:!1,antialias:!1});let ie;const ae=j.RGBA;let ue;e[0].dataType==Float32Array?(ue=j.FLOAT,j.getExtension("WEBGL_color_buffer_float"),j.getExtension("OES_texture_float"),j.getExtension("EXT_float_blend"),ie=j.getExtension("OES_texture_float_linear")!==null&&this.interpolate):(ue=j.UNSIGNED_BYTE,ie=this.interpolate);const de=4,pe=Math.ceil(re/de);for(let le=pe-1;le>=0;--le){const he=[];for(let Dt=0,jt=e.length;Dt<jt;++Dt){const Fe=e[Dt],$e=Fe.pixelSize,Ve=$e[0],ze=$e[1],Oe=new Fe.dataType(de*Ve*ze),qe=Fe.data;let Et=le*de;for(let At=0,Lt=Oe.length;At<Lt;At+=de)Oe[At]=qe[Et],Oe[At+1]=qe[Et+1],Oe[At+2]=qe[Et+2],Oe[At+3]=qe[Et+3],Et+=re;const hn=j.createTexture();j.bindTexture(j.TEXTURE_2D,hn),ie?(j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.LINEAR),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.LINEAR)):(j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST)),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texImage2D(j.TEXTURE_2D,0,ae,Ve,ze,0,ae,ue,Oe),he.push({extent:Fe.extent,clipExtent:Fe.clipExtent,texture:hn,width:Ve,height:ze})}const{framebuffer:_e,width:Ce,height:xe}=render(j,g,y,this.pixelRatio_,V,$,z,this.triangulation_,he,this.gutter_,ue,this.renderEdges_,ie),Ie=Ce,Ne=xe*de,Ue=new e[0].dataType(Ie*Ne);j.bindFramebuffer(j.FRAMEBUFFER,_e),j.readPixels(0,0,Ce,xe,j.RGBA,ue,Ue);let kt=le*de;for(let Dt=0,jt=Ue.length;Dt<jt;Dt+=de){const Fe=(Ie-1-(Dt/Ne|0))*Ne+Dt%Ne;oe[kt]=Ue[Fe],oe[kt+1]=Ue[Fe+1],oe[kt+2]=Ue[Fe+2],oe[kt+3]=Ue[Fe+3],kt+=re}}if(releaseGLCanvas(j),canvasGLPool.push(j.canvas),n){const le=createCanvasContext2D(g,y),he=new ImageData(oe,g);le.putImageData(he,0,0),this.reprojData_=le.canvas}else this.reprojData_=oe;this.reprojSize_=[Math.round(k),Math.round(L)],this.state=TileState.LOADED,this.changed()}load(){if(this.state!==TileState.IDLE&&this.state!==TileState.ERROR)return;this.state=TileState.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:n})=>{const r=n.getState();if(r!==TileState.IDLE&&r!==TileState.LOADING)return;e++;const i=listen(n,EventType.CHANGE,()=>{const g=n.getState();(g==TileState.LOADED||g==TileState.ERROR||g==TileState.EMPTY)&&(unlistenByKey(i),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(i)}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:n}){n.getState()==TileState.IDLE&&n.load()})}unlistenSources_(){this.sourcesListenerKeys_.forEach(unlistenByKey),this.sourcesListenerKeys_=null}}class ReprojTile extends Tile{constructor(e,n,r,i,g,y,k,L,$,V,z,re){super(g,TileState.IDLE,re),this.renderEdges_=z!==void 0?z:!1,this.pixelRatio_=k,this.gutter_=L,this.canvas_=null,this.sourceTileGrid_=n,this.targetTileGrid_=i,this.wrappedTileCoord_=y||g,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;const oe=i.getTileCoordExtent(this.wrappedTileCoord_),j=this.targetTileGrid_.getExtent();let ie=this.sourceTileGrid_.getExtent();const ae=j?getIntersection(oe,j):oe;if(getArea$1(ae)===0){this.state=TileState.EMPTY;return}const ue=e.getExtent();ue&&(ie?ie=getIntersection(ie,ue):ie=ue);const de=i.getResolution(this.wrappedTileCoord_[0]),pe=calculateSourceExtentResolution(e,r,ae,de);if(!isFinite(pe)||pe<=0){this.state=TileState.EMPTY;return}const le=V!==void 0?V:ERROR_THRESHOLD;if(this.triangulation_=new Triangulation(e,r,ae,ie,pe*le,de),this.triangulation_.getTriangles().length===0){this.state=TileState.EMPTY;return}this.sourceZ_=n.getZForResolution(pe);let he=this.triangulation_.calculateSourceExtent();if(ie&&(e.canWrapX()?(he[1]=clamp(he[1],ie[1],ie[3]),he[3]=clamp(he[3],ie[1],ie[3])):he=getIntersection(he,ie)),!getArea$1(he))this.state=TileState.EMPTY;else{let _e=0,Ce=0;e.canWrapX()&&(_e=getWidth(ue),Ce=Math.floor((he[0]-ue[0])/_e)),wrapAndSliceX(he.slice(),e,!0).forEach(Ie=>{const Ne=n.getTileRangeForExtentAndZ(Ie,this.sourceZ_);for(let Ue=Ne.minX;Ue<=Ne.maxX;Ue++)for(let kt=Ne.minY;kt<=Ne.maxY;kt++){const Dt=$(this.sourceZ_,Ue,kt,k);if(Dt){const jt=Ce*_e;this.sourceTiles_.push({tile:Dt,offset:jt})}}++Ce}),this.sourceTiles_.length===0&&(this.state=TileState.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(n=>{var i;const r=n.tile;if(r&&r.getState()==TileState.LOADED){const g=this.sourceTileGrid_.getTileCoordExtent(r.tileCoord);g[0]+=n.offset,g[2]+=n.offset;const y=(i=this.clipExtent_)==null?void 0:i.slice();y&&(y[0]+=n.offset,y[2]+=n.offset),e.push({extent:g,clipExtent:y,image:r.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=TileState.ERROR;else{const n=this.wrappedTileCoord_[0],r=this.targetTileGrid_.getTileSize(n),i=typeof r=="number"?r:r[0],g=typeof r=="number"?r:r[1],y=this.targetTileGrid_.getResolution(n),k=this.sourceTileGrid_.getResolution(this.sourceZ_),L=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=render$1(i,g,this.pixelRatio_,k,this.sourceTileGrid_.getExtent(),y,L,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=TileState.LOADED}this.changed()}load(){if(this.state==TileState.IDLE){this.state=TileState.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:n})=>{const r=n.getState();if(r==TileState.IDLE||r==TileState.LOADING){e++;const i=listen(n,EventType.CHANGE,g=>{const y=n.getState();(y==TileState.LOADED||y==TileState.ERROR||y==TileState.EMPTY)&&(unlistenByKey(i),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(i)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:n},r,i){n.getState()==TileState.IDLE&&n.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(unlistenByKey),this.sourcesListenerKeys_=null}release(){this.canvas_&&(releaseCanvas(this.canvas_.getContext("2d")),canvasPool.push(this.canvas_),this.canvas_=null),super.release()}}function getCacheKey(t,e,n,r){return`${t},${getKeyZXY(e,n,r)}`}function addTileToLookup(t,e,n){if(!(n in t))return t[n]=new Set([e]),!0;const r=t[n],i=r.has(e);return i||r.add(e),!i}function removeTileFromLookup(t,e,n){const r=t[n];return r?r.delete(e):!1}function getRenderExtent(t,e){const n=t.layerStatesArray[t.layerIndex];n.extent&&(e=getIntersection(e,fromUserExtent(n.extent,t.viewState.projection)));const r=n.layer.getRenderSource();if(!r.getWrapX()){const i=r.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=getIntersection(e,i))}return e}class CanvasTileLayerRenderer extends CanvasLayerRenderer{constructor(e,n){super(e),n=n||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=createEmpty(),this.tempTileRange_=new TileRange(0,0,0,0),this.tempTileCoord_=createOrUpdate$1(0,0,0);const r=n.cacheSize!==void 0?n.cacheSize:512;this.tileCache_=new LRUCache(r),this.maxStaleKeys=r*.5}getTileCache(){return this.tileCache_}getOrCreateTile(e,n,r,i){const g=this.tileCache_,k=this.getLayer().getSource(),L=getCacheKey(k.getKey(),e,n,r);let $;if(g.containsKey(L))$=g.get(L);else{if($=k.getTile(e,n,r,i.pixelRatio,i.viewState.projection),!$)return null;g.set(L,$)}return $}getTile(e,n,r,i){const g=this.getOrCreateTile(e,n,r,i);return g||null}getData(e){const n=this.frameState;if(!n)return null;const r=this.getLayer(),i=apply(n.pixelToCoordinateTransform,e.slice()),g=r.getExtent();if(g&&!containsCoordinate(g,i))return null;const y=n.viewState,k=r.getRenderSource(),L=k.getTileGridForProjection(y.projection),$=k.getTilePixelRatio(n.pixelRatio);for(let V=L.getZForResolution(y.resolution);V>=L.getMinZoom();--V){const z=L.getTileCoordForCoordAndZ(i,V),re=this.getTile(V,z[1],z[2],n);if(!re||re.getState()!==TileState.LOADED)continue;const oe=L.getOrigin(V),j=toSize(L.getTileSize(V)),ie=L.getResolution(V);let ae;if(re instanceof ImageTile||re instanceof ReprojTile)ae=re.getImage();else if(re instanceof DataTile){if(ae=asImageLike(re.getData()),!ae)continue}else continue;const ue=Math.floor($*((i[0]-oe[0])/ie-z[1]*j[0])),de=Math.floor($*((oe[1]-i[1])/ie-z[2]*j[1])),pe=Math.round($*k.getGutterForProjection(y.projection));return this.getImageData(ae,ue+pe,de+pe)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;const n=this.getLayer().getSource();if(!n)return!1;const r=n.getRevision();return this.renderedRevision_?this.renderedRevision_!==r&&(this.renderedRevision_=r,this.renderedSourceKey_===n.getKey()&&this.tileCache_.clear()):this.renderedRevision_=r,!0}enqueueTiles(e,n,r,i,g){const y=e.viewState,k=this.getLayer(),L=k.getRenderSource(),$=L.getTileGridForProjection(y.projection),V=getUid(L);V in e.wantedTiles||(e.wantedTiles[V]={});const z=e.wantedTiles[V],re=k.getMapInternal(),oe=Math.max(r-g,$.getMinZoom(),$.getZForResolution(Math.min(k.getMaxResolution(),re?re.getView().getResolutionForZoom(Math.max(k.getMinZoom(),0)):$.getResolution(0)),L.zDirection));for(let j=r;j>=oe;--j){const ie=$.getTileRangeForExtentAndZ(n,j,this.tempTileRange_),ae=$.getResolution(j);for(let ue=ie.minX;ue<=ie.maxX;++ue)for(let de=ie.minY;de<=ie.maxY;++de){const pe=this.getTile(j,ue,de,e);if(!pe||!addTileToLookup(i,pe,j))continue;const he=pe.getKey();if(z[he]=!0,pe.getState()===TileState.IDLE&&!e.tileQueue.isKeyQueued(he)){const _e=createOrUpdate$1(j,ue,de,this.tempTileCoord_);e.tileQueue.enqueue([pe,V,$.getTileCoordCenter(_e),ae])}}}}findStaleTile_(e,n){const r=this.tileCache_,i=e[0],g=e[1],y=e[2],k=this.getStaleKeys();for(let L=0;L<k.length;++L){const $=getCacheKey(k[L],i,g,y);if(r.containsKey($)){const V=r.get($);if(V.getState()===TileState.LOADED)return V.endTransition(getUid(this)),addTileToLookup(n,V,i),!0}}return!1}findAltTiles_(e,n,r,i){const g=e.getTileRangeForTileCoordAndZ(n,r,this.tempTileRange_);if(!g)return!1;let y=!0;const k=this.tileCache_,$=this.getLayer().getRenderSource().getKey();for(let V=g.minX;V<=g.maxX;++V)for(let z=g.minY;z<=g.maxY;++z){const re=getCacheKey($,r,V,z);let oe=!1;if(k.containsKey(re)){const j=k.get(re);j.getState()===TileState.LOADED&&(addTileToLookup(i,j,r),oe=!0)}oe||(y=!1)}return y}renderFrame(e,n){let r=!0;this.renderComplete=!0;const i=e.layerStatesArray[e.layerIndex],g=e.viewState,y=g.projection,k=g.resolution,L=g.center,$=e.pixelRatio,V=this.getLayer(),z=V.getSource(),re=z.getRevision(),oe=z.getTileGridForProjection(y),j=oe.getZForResolution(k,z.zDirection),ie=oe.getResolution(j),ae=z.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==ae&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=ae):this.renderedSourceKey_=ae;let ue=e.extent;const de=z.getTilePixelRatio($);this.prepareContainer(e,n);const pe=this.context.canvas.width,le=this.context.canvas.height,he=i.extent&&fromUserExtent(i.extent);he&&(ue=getIntersection(ue,fromUserExtent(i.extent)));const _e=ie*pe/2/de,Ce=ie*le/2/de,xe=[L[0]-_e,L[1]-Ce,L[0]+_e,L[1]+Ce],Ie={};this.renderedTiles.length=0;const Ne=V.getPreload();if(e.nextExtent){const qe=oe.getZForResolution(g.nextResolution,z.zDirection),Et=getRenderExtent(e,e.nextExtent);this.enqueueTiles(e,Et,qe,Ie,Ne)}const Ue=getRenderExtent(e,ue);if(this.enqueueTiles(e,Ue,j,Ie,0),Ne>0&&setTimeout(()=>{this.enqueueTiles(e,Ue,j-1,Ie,Ne-1)},0),!(j in Ie))return this.container;const kt=getUid(this),Dt=e.time;for(const qe of Ie[j]){const Et=qe.getState();if((qe instanceof ReprojTile||qe instanceof ReprojDataTile)&&Et===TileState.EMPTY)continue;const hn=qe.tileCoord;if(Et===TileState.LOADED&&qe.getAlpha(kt,Dt)===1){qe.endTransition(kt);continue}if(Et!==TileState.IDLE&&(r=!1),Et!==TileState.ERROR&&(this.renderComplete=!1),this.findStaleTile_(hn,Ie)){removeTileFromLookup(Ie,qe,j),e.animate=!0;continue}if(this.findAltTiles_(oe,hn,j+1,Ie))continue;const wn=oe.getMinZoom();for(let kn=j-1;kn>=wn&&!this.findAltTiles_(oe,hn,kn,Ie);--kn);}const jt=ie/k*$/de,Fe=this.getRenderContext(e);compose(this.tempTransform,pe/2,le/2,jt,jt,0,-pe/2,-le/2),i.extent&&this.clipUnrotated(Fe,e,he),z.getInterpolate()||(Fe.imageSmoothingEnabled=!1),this.preRender(Fe,e);const $e=Object.keys(Ie).map(Number);$e.sort(ascending);let Ve;const ze=[],Oe=[];for(let qe=$e.length-1;qe>=0;--qe){const Et=$e[qe],hn=z.getTilePixelSize(Et,$,y),Lt=oe.getResolution(Et)/ie,wn=hn[0]*Lt*jt,kn=hn[1]*Lt*jt,En=oe.getTileCoordForCoordAndZ(getTopLeft(xe),Et),Cn=oe.getTileCoordExtent(En),Pn=apply(this.tempTransform,[de*(Cn[0]-xe[0])/ie,de*(xe[3]-Cn[3])/ie]),Dn=de*z.getGutterForProjection(y);for(const Ln of Ie[Et]){if(Ln.getState()!==TileState.LOADED)continue;const Vn=Ln.tileCoord,Bn=En[1]-Vn[1],jn=Math.round(Pn[0]-(Bn-1)*wn),Xn=En[2]-Vn[2],Zn=Math.round(Pn[1]-(Xn-1)*kn),zn=Math.round(Pn[0]-Bn*wn),Gn=Math.round(Pn[1]-Xn*kn),Fn=jn-zn,Un=Zn-Gn,xn=$e.length===1;let Rn=!1;Ve=[zn,Gn,zn+Fn,Gn,zn+Fn,Gn+Un,zn,Gn+Un];for(let Nn=0,_n=ze.length;Nn<_n;++Nn)if(!xn&&Et<Oe[Nn]){const Mn=ze[Nn];intersects$1([zn,Gn,zn+Fn,Gn+Un],[Mn[0],Mn[3],Mn[4],Mn[7]])&&(Rn||(Fe.save(),Rn=!0),Fe.beginPath(),Fe.moveTo(Ve[0],Ve[1]),Fe.lineTo(Ve[2],Ve[3]),Fe.lineTo(Ve[4],Ve[5]),Fe.lineTo(Ve[6],Ve[7]),Fe.moveTo(Mn[6],Mn[7]),Fe.lineTo(Mn[4],Mn[5]),Fe.lineTo(Mn[2],Mn[3]),Fe.lineTo(Mn[0],Mn[1]),Fe.clip())}ze.push(Ve),Oe.push(Et),this.drawTile(Ln,e,zn,Gn,Fn,Un,Dn,xn),Rn&&Fe.restore(),this.renderedTiles.unshift(Ln),this.updateUsedTiles(e.usedTiles,z,Ln)}}if(this.renderedRevision=re,this.renderedResolution=ie,this.extentChanged=!this.renderedExtent_||!equals$2(this.renderedExtent_,xe),this.renderedExtent_=xe,this.renderedPixelRatio=$,this.postRender(this.context,e),i.extent&&Fe.restore(),Fe.imageSmoothingEnabled=!0,this.renderComplete){const qe=(Et,hn)=>{const At=getUid(z),Lt=hn.wantedTiles[At],wn=Lt?Object.keys(Lt).length:0;this.updateCacheSize(wn),this.tileCache_.expireCache()};e.postRenderFunctions.push(qe)}return!this.renderComplete&&!r&&(e.animate=!0),this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,n,r,i,g,y,k,L){let $;if(e instanceof DataTile){if($=asImageLike(e.getData()),!$)throw new Error("Rendering array data is not yet supported")}else $=this.getTileImage(e);if(!$)return;const V=this.getRenderContext(n),z=getUid(this),re=n.layerStatesArray[n.layerIndex],oe=re.opacity*(L?e.getAlpha(z,n.time):1),j=oe!==V.globalAlpha;j&&(V.save(),V.globalAlpha=oe),V.drawImage($,k,k,$.width-2*k,$.height-2*k,r,i,g,y),j&&V.restore(),oe!==re.opacity?n.animate=!0:L&&e.endTransition(z)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,n,r){const i=getUid(n);i in e||(e[i]={}),e[i][r.getKey()]=!0}}class TileLayer extends BaseTileLayer{constructor(e){super(e)}createRenderer(){return new CanvasTileLayerRenderer(this,{cacheSize:this.getCacheSize()})}}const TIAN_DI_TU_KEY="a6e8f78974f2581f2ca00485b40c948f",MAP_ZOOM={default:13,min:3,max:18,shipTriggleMin:16,shipModelMax:18,scaleNum:.555},projection={data:"EPSG:4326",mercator:"EPSG:3857"},MAP_DEFAULT_CENTER=[114.84,30.52],CDN_URL="https://static.zhihaoscm.cn/",calculateCirclePoints=(t,e)=>{const n=fromLonLat(t),r=e*1e3,i=[n[0]-r,n[1]-r,n[0]+r,n[1]+r],g=transformExtent(i,projection.mercator,projection.data);return{leftTopPoint:{lng:g[0],lat:g[3]},rightTopPoint:{lng:g[2],lat:g[3]},rightBottomPoint:{lng:g[2],lat:g[1]},leftBottomPoint:{lng:g[0],lat:g[1]}}},formatLength=function(t,e){const r=getLength(t);let i="";switch(e){case LENGTH_UNIT.M:i=Math.round(r*100)/100+" m";break;case LENGTH_UNIT.KM:i=Math.round(r/1e3*100)/100+" km";break;case LENGTH_UNIT.NM:i=(Math.round(r/1e3*100)/100/1.852).toFixed(2)+" nm";break}return i},equatorialCircumference=2003750834e-2;function lonLatToMercator(t){const e=t[0]*equatorialCircumference/180;let n=Math.log(Math.tan((90+t[1])*Math.PI/360))/(Math.PI/180);return n=n*equatorialCircumference/180,[e,n]}function getIconFont(unicode=""){return unicode.indexOf("&amp;")!==-1&&(unicode=unicode.replace("&amp;","&")),unicode.indexOf("&amp")!==-1&&(unicode=unicode.replace("&amp","&")),eval('("'+unicode.replace("&#x","\\u").replace(";","")+'")')}const getIconStyle=t=>{const e=new Text({font:"Normal 14px map-iconfont",text:getIconFont(t),fill:new Fill({color:"#fff"}),offsetY:-14});return new Style({text:e,zIndex:100})},adjustBounds=(t,e)=>e.length===2?[t[0]-e[0],t[1]-e[1],t[2]+e[0],t[3]+e[1]]:[t[0]+e[0],t[1]+e[1],t[2]+e[2],t[3]+e[3]],isOverlapping$1=(t,e)=>t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1],mercatorToLonLat=(t,e="lonlat")=>{const n={lon:0,lat:0},r=t[0]/equatorialCircumference*180;let i=t[1]/equatorialCircumference*180;return i=180/Math.PI*(2*Math.atan(Math.exp(i*Math.PI/180))-Math.PI/2),n.lon=r,n.lat=i,e==="lonlat"?n:[r,i]};var BASE_MAP_LINK=(t=>(t.vectorTile=`https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`,t.vectorTileMark=`https://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`,t.satelliteImgTile=`https://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`,t.satelliteImgTileMark=`https://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`,t.greenTile=`${CDN_URL}/map/tile/{z}/{x}/{y}.png`,t))(BASE_MAP_LINK||{}),LENGTH_UNIT=(t=>(t[t.M=1]="M",t[t.KM=2]="KM",t[t.NM=3]="NM",t))(LENGTH_UNIT||{});const TileEventType={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"},tmpTileCoord=[0,0,0],DECIMALS=5;class TileGrid{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,assert(isSorted(this.resolutions_,(i,g)=>g-i),"`resolutions` must be sorted in descending order");let n;if(!e.origins){for(let i=0,g=this.resolutions_.length-1;i<g;++i)if(!n)n=this.resolutions_[i]/this.resolutions_[i+1];else if(this.resolutions_[i]/this.resolutions_[i+1]!==n){n=void 0;break}}this.zoomFactor_=n,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,assert(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const r=e.extent;r!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=getTopLeft(r)),assert(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,assert(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:DEFAULT_TILE_SIZE,assert(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=r!==void 0?r:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((i,g)=>{const y=new TileRange(Math.min(0,i[0]),Math.max(i[0]-1,-1),Math.min(0,i[1]),Math.max(i[1]-1,-1));if(r){const k=this.getTileRangeForExtentAndZ(r,g);y.minX=Math.max(k.minX,y.minX),y.maxX=Math.min(k.maxX,y.maxX),y.minY=Math.max(k.minY,y.minY),y.maxY=Math.min(k.maxY,y.maxY)}return y}):r&&this.calculateTileRanges_(r)}forEachTileCoord(e,n,r){const i=this.getTileRangeForExtentAndZ(e,n);for(let g=i.minX,y=i.maxX;g<=y;++g)for(let k=i.minY,L=i.maxY;k<=L;++k)r([n,g,k])}forEachTileCoordParentTileRange(e,n,r,i){let g,y,k,L=null,$=e[0]-1;for(this.zoomFactor_===2?(y=e[1],k=e[2]):L=this.getTileCoordExtent(e,i);$>=this.minZoom;){if(y!==void 0&&k!==void 0?(y=Math.floor(y/2),k=Math.floor(k/2),g=createOrUpdate(y,y,k,k,r)):g=this.getTileRangeForExtentAndZ(L,$,r),n($,g))return!0;--$}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,n,r){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const g=e[1]*2,y=e[2]*2;return createOrUpdate(g,g+1,y,y+1,n)}const i=this.getTileCoordExtent(e,r||this.tmpExtent_);return this.getTileRangeForExtentAndZ(i,e[0]+1,n)}return null}getTileRangeForTileCoordAndZ(e,n,r){if(n>this.maxZoom||n<this.minZoom)return null;const i=e[0],g=e[1],y=e[2];if(n===i)return createOrUpdate(g,y,g,y,r);if(this.zoomFactor_){const L=Math.pow(this.zoomFactor_,n-i),$=Math.floor(g*L),V=Math.floor(y*L);if(n<i)return createOrUpdate($,$,V,V,r);const z=Math.floor(L*(g+1))-1,re=Math.floor(L*(y+1))-1;return createOrUpdate($,z,V,re,r)}const k=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(k,n,r)}getTileRangeForExtentAndZ(e,n,r){this.getTileCoordForXYAndZ_(e[0],e[3],n,!1,tmpTileCoord);const i=tmpTileCoord[1],g=tmpTileCoord[2];this.getTileCoordForXYAndZ_(e[2],e[1],n,!0,tmpTileCoord);const y=tmpTileCoord[1],k=tmpTileCoord[2];return createOrUpdate(i,y,g,k,r)}getTileCoordCenter(e){const n=this.getOrigin(e[0]),r=this.getResolution(e[0]),i=toSize(this.getTileSize(e[0]),this.tmpSize_);return[n[0]+(e[1]+.5)*i[0]*r,n[1]-(e[2]+.5)*i[1]*r]}getTileCoordExtent(e,n){const r=this.getOrigin(e[0]),i=this.getResolution(e[0]),g=toSize(this.getTileSize(e[0]),this.tmpSize_),y=r[0]+e[1]*g[0]*i,k=r[1]-(e[2]+1)*g[1]*i,L=y+g[0]*i,$=k+g[1]*i;return createOrUpdate$2(y,k,L,$,n)}getTileCoordForCoordAndResolution(e,n,r){return this.getTileCoordForXYAndResolution_(e[0],e[1],n,!1,r)}getTileCoordForXYAndResolution_(e,n,r,i,g){const y=this.getZForResolution(r),k=r/this.getResolution(y),L=this.getOrigin(y),$=toSize(this.getTileSize(y),this.tmpSize_);let V=k*(e-L[0])/r/$[0],z=k*(L[1]-n)/r/$[1];return i?(V=ceil(V,DECIMALS)-1,z=ceil(z,DECIMALS)-1):(V=floor(V,DECIMALS),z=floor(z,DECIMALS)),createOrUpdate$1(y,V,z,g)}getTileCoordForXYAndZ_(e,n,r,i,g){const y=this.getOrigin(r),k=this.getResolution(r),L=toSize(this.getTileSize(r),this.tmpSize_);let $=(e-y[0])/k/L[0],V=(y[1]-n)/k/L[1];return i?($=ceil($,DECIMALS)-1,V=ceil(V,DECIMALS)-1):($=floor($,DECIMALS),V=floor(V,DECIMALS)),createOrUpdate$1(r,$,V,g)}getTileCoordForCoordAndZ(e,n,r){return this.getTileCoordForXYAndZ_(e[0],e[1],n,!1,r)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,n){const r=linearFindNearest(this.resolutions_,e,n||0);return clamp(r,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,n){return intersectsLinearRing(n,0,n.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const n=this.resolutions_.length,r=new Array(n);for(let i=this.minZoom;i<n;++i)r[i]=this.getTileRangeForExtentAndZ(e,i);this.fullTileRanges_=r}}function getForProjection(t){let e=t.getDefaultTileGrid();return e||(e=createForProjection(t),t.setDefaultTileGrid(e)),e}function wrapX(t,e,n){const r=e[0],i=t.getTileCoordCenter(e),g=extentFromProjection(n);if(!containsCoordinate(g,i)){const y=getWidth(g),k=Math.ceil((g[0]-i[0])/y);return i[0]+=y*k,t.getTileCoordForCoordAndZ(i,r)}return e}function createForExtent(t,e,n,r){r=r!==void 0?r:"top-left";const i=resolutionsFromExtent(t,e,n);return new TileGrid({extent:t,origin:getCorner(t,r),resolutions:i,tileSize:n})}function createXYZ(t){const e=t||{},n=e.extent||get$1("EPSG:3857").getExtent(),r={extent:n,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:resolutionsFromExtent(n,e.maxZoom,e.tileSize,e.maxResolution)};return new TileGrid(r)}function resolutionsFromExtent(t,e,n,r){e=e!==void 0?e:DEFAULT_MAX_ZOOM,n=toSize(n!==void 0?n:DEFAULT_TILE_SIZE);const i=getHeight(t),g=getWidth(t);r=r>0?r:Math.max(g/n[0],i/n[1]);const y=e+1,k=new Array(y);for(let L=0;L<y;++L)k[L]=r/Math.pow(2,L);return k}function createForProjection(t,e,n,r){const i=extentFromProjection(t);return createForExtent(i,e,n,r)}function extentFromProjection(t){t=get$1(t);let e=t.getExtent();if(!e){const n=180*METERS_PER_UNIT$1.degrees/t.getMetersPerUnit();e=createOrUpdate$2(-n,-n,n,n)}return e}class TileSource extends Source{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;const n=[256,256];this.tileGrid&&toSize(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),n),this.tmpSize=[0,0],this.key_=e.key||getUid(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){const n=e?this.getTileGridForProjection(e):this.tileGrid;return n?n.getResolutions():null}getTile(e,n,r,i,g){return abstract()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:getForProjection(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,n,r){const i=this.getTileGridForProjection(r),g=this.getTilePixelRatio(n),y=toSize(i.getTileSize(e),this.tmpSize);return g==1?y:scale$1(y,g,this.tmpSize)}getTileCoordForTileUrlFunction(e,n){const r=n!==void 0?n:this.getProjection(),i=n!==void 0?this.getTileGridForProjection(r):this.tileGrid||this.getTileGridForProjection(r);return this.getWrapX()&&r.isGlobal()&&(e=wrapX(i,e,r)),withinExtentAndZ(e,i)?e:null}clear(){}refresh(){this.clear(),super.refresh()}}class TileSourceEvent extends BaseEvent{constructor(e,n){super(e),this.tile=n}}const zRegEx=/\{z\}/g,xRegEx=/\{x\}/g,yRegEx=/\{y\}/g,dashYRegEx=/\{-y\}/g;function renderXYZTemplate(t,e,n,r,i){return t.replace(zRegEx,e.toString()).replace(xRegEx,n.toString()).replace(yRegEx,r.toString()).replace(dashYRegEx,function(){if(i===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(i-r).toString()})}function expandUrl(t){const e=[];let n=/\{([a-z])-([a-z])\}/.exec(t);if(n){const r=n[1].charCodeAt(0),i=n[2].charCodeAt(0);let g;for(g=r;g<=i;++g)e.push(t.replace(n[0],String.fromCharCode(g)));return e}if(n=/\{(\d+)-(\d+)\}/.exec(t),n){const r=parseInt(n[2],10);for(let i=parseInt(n[1],10);i<=r;i++)e.push(t.replace(n[0],i.toString()));return e}return e.push(t),e}function createFromTemplate(t,e){return function(n,r,i){if(!n)return;let g;const y=n[0];if(e){const k=e.getFullTileRange(y);k&&(g=k.getHeight()-1)}return renderXYZTemplate(t,y,n[1],n[2],g)}}function createFromTemplates(t,e){const n=t.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=createFromTemplate(t[i],e);return createFromTileUrlFunctions(r)}function createFromTileUrlFunctions(t){return t.length===1?t[0]:function(e,n,r){if(!e)return;const i=hash(e),g=modulo(i,t.length);return t[g](e,n,r)}}class UrlTile extends TileSource{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===UrlTile.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){const n=e.target,r=getUid(n),i=n.getState();let g;i==TileState.LOADING?(this.tileLoadingKeys_[r]=!0,g=TileEventType.TILELOADSTART):r in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[r],g=i==TileState.ERROR?TileEventType.TILELOADERROR:i==TileState.LOADED?TileEventType.TILELOADEND:void 0),g!=null&&this.dispatchEvent(new TileSourceEvent(g,n))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,n){this.tileUrlFunction=e,typeof n<"u"?this.setKey(n):this.changed()}setUrl(e){const n=expandUrl(e);this.urls=n,this.setUrls(n)}setUrls(e){this.urls=e;const n=e.join(`
134
- `);this.generateTileUrlFunction_?this.setTileUrlFunction(createFromTemplates(e,this.tileGrid),n):this.setKey(n)}tileUrlFunction(e,n,r){}}class TileImage extends UrlTile{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:defaultTileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.tileClass=e.tileClass!==void 0?e.tileClass:ImageTile,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!equivalent(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){const n=this.getProjection();if(this.tileGrid&&(!n||equivalent(n,e)))return this.tileGrid;const r=getUid(e);return r in this.tileGridForProjection||(this.tileGridForProjection[r]=getForProjection(e)),this.tileGridForProjection[r]}createTile_(e,n,r,i,g,y){const k=[e,n,r],L=this.getTileCoordForTileUrlFunction(k,g),$=L?this.tileUrlFunction(L,i,g):void 0,V=new this.tileClass(k,$!==void 0?TileState.IDLE:TileState.EMPTY,$!==void 0?$:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return V.key=y,V.addEventListener(EventType.CHANGE,this.handleTileChange.bind(this)),V}getTile(e,n,r,i,g){const y=this.getProjection();if(!y||!g||equivalent(y,g))return this.getTileInternal(e,n,r,i,y||g);const k=[e,n,r],L=this.getKey(),$=this.getTileGridForProjection(y),V=this.getTileGridForProjection(g),z=this.getTileCoordForTileUrlFunction(k,g),re=new ReprojTile(y,$,g,V,k,z,this.getTilePixelRatio(i),this.getGutter(),(oe,j,ie,ae)=>this.getTileInternal(oe,j,ie,ae,y),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return re.key=L,re}getTileInternal(e,n,r,i,g){const y=this.getKey();return this.createTile_(e,n,r,i,g,y)}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,n){const r=get$1(e);if(r){const i=getUid(r);i in this.tileGridForProjection||(this.tileGridForProjection[i]=n)}}}function defaultTileLoadFunction(t,e){t.getImage().src=e}class XYZ extends TileImage{constructor(e){e=e||{};const n=e.projection!==void 0?e.projection:"EPSG:3857",r=e.tileGrid!==void 0?e.tileGrid:createXYZ({extent:extentFromProjection(n),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:n,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:r,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}const getRightIcons=t=>{const e=[];return t.existDevice&&e.push("&#xe687;"),t.existMobile&&e.push("&#xe688;"),t.existWaterGauge&&e.push("&#xe686;"),e};new RBush$1;var SHIP_SAIL_STATUS=(t=>(t[t.发动机使用中=0]="发动机使用中",t[t.锚泊=1]="锚泊",t[t.未操作=2]="未操作",t[t.操纵能力受限=3]="操纵能力受限",t[t.吃水受限=4]="吃水受限",t[t.系泊=5]="系泊",t[t.搁浅=6]="搁浅",t[t.从事捕捞=7]="从事捕捞",t[t.航行中=8]="航行中",t[t.留作将来修正导航状态=9]="留作将来修正导航状态",t[t.高速船留用=10]="高速船留用",t[t.机动船尾推作业=11]="机动船尾推作业",t[t.机动船顶推或侧推作业=12]="机动船顶推或侧推作业",t[t.飞翼船留用=13]="飞翼船留用",t[t.现行的=14]="现行的",t[t.未定义=15]="未定义",t))(SHIP_SAIL_STATUS||{}),SHIP_DIRECT=(t=>(t.left="left",t.right="right",t.front="front",t.up="up",t.down="down",t.back="back",t))(SHIP_DIRECT||{});function useShipOverlay(t){const e=vue.ref(null),n=vue.ref(null),r=vue.computed(()=>({"--overlay-color":t.color,"--bg-color":t.selected?t.color:"#ffffff",position:"relative","pointer-events":"none"})),i=vue.computed(()=>({position:"relative","border-radius":"1px","background-color":"var(--bg-color)",color:"#000","padding-right":"5px","box-shadow":"0 2px 10px rgba(0, 0, 0, 0.2)","font-size":"10px","white-space":"nowrap",border:"1px solid #FFF","pointer-events":"auto",transition:"background-color 0.5s ease, border 0.5s ease","z-index":"1",display:"flex","align-items":"center"})),g=vue.computed(()=>({width:"14px",height:"14px",margin:"1px 5px 1px 1px","background-color":"var(--bg-color)"})),y=vue.computed(()=>({position:"absolute",top:"0px",color:"var(--overlay-color)","pointer-events":"none",transform:"translateY(-1px)","z-index":"0",width:"20px",height:"20px",overflow:"visible"}));let k=null;const L=()=>{$(),k=window.setInterval(()=>{if(e.value){const z=e.value.querySelector(".ship-overlay-content");z&&z.style&&(z.style.backgroundColor=t.color,z.style.color="#FFF",setTimeout(()=>{z&&z.style&&(z.style.backgroundColor="#ffffff",z.style.color="#000")},500))}},1e3)},$=()=>{k&&(clearInterval(k),k=null)},V=()=>{n.value&&n.value.setPosition(fromLonLat(t.position))};return vue.watch(()=>t.selected,z=>{z?L():$()},{immediate:!0}),vue.watch(()=>t.position,()=>{V()},{deep:!0}),vue.onMounted(()=>{}),vue.onBeforeUnmount(()=>{$()}),()=>vue.h("div",{ref:e,class:"ship-overlay-container",style:r.value},[vue.h("div",{class:"ship-overlay-content",style:i.value},[vue.h("div",{style:t.selected?g.value:{}},""),vue.h("div",{class:"text"},t.name||"未命名船舶"),vue.h("div",{class:"icons",style:{color:"#3370ff"}},[t.existDevice?vue.h("i",{class:"iconfont icon-Frame-19",style:{fontSize:"12px"}}):"",t.existMobile?vue.h("i",{class:"iconfont icon-Frame13",style:{fontSize:"12px"}}):"",t.existWaterGauge?vue.h("i",{class:"iconfont icon-a-Frame7",style:{fontSize:"12px"}}):""])]),vue.h("svg",{class:"ship-overlay-line",style:y.value,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[vue.h("line",{x1:"0",y1:"0",x2:"0",y2:"0",stroke:"white","stroke-width":"1"})])])}const POSITION_PRIORITY=[{positioning:"top-left",offset:[20,-20],line:{x1:"0",y1:"20",x2:"20",y2:"4"}},{positioning:"top-right",offset:[-20,-20],line:{x1:"0",y1:"4",x2:"20",y2:"20"}},{positioning:"top-left",offset:[20,0],line:{x1:"0",y1:"0",x2:"20",y2:"4"}},{positioning:"top-right",offset:[-20,0],line:{x1:"0",y1:"4",x2:"20",y2:"0"}},{positioning:"top-left",offset:[20,20],line:{x1:"20",y1:"4",x2:"0",y2:"-20"}},{positioning:"top-right",offset:[-20,20],line:{x1:"0",y1:"4",x2:"20",y2:"-20"}}],existingOverlays=vue.ref([]);function isOverlapping(t,e){return!(t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom)}function calculateBestPosition(t,e){const n=existingOverlays.value.filter(r=>r!==t).map(r=>{var i;return(i=r.getElement())==null?void 0:i.getBoundingClientRect()}).filter(r=>r!==void 0);for(const r of POSITION_PRIORITY){t.setPositioning(r.positioning),t.setOffset(r.offset),t.setPosition(e);const i=t.getElement();if(!i)continue;i.offsetHeight;const g=i.getBoundingClientRect();if(!n.some(k=>isOverlapping(g,k)))break}}function addOverlay(t,e,n,r){const i=new Overlay({element:n,positioning:"top-left",id:"label-"+r,offset:[0,0],autoPan:!1,className:"ship-label-overlay"});i.set("class","zh-map-ship-overlay"),t.addOverlay(i),existingOverlays.value.push(i),vue.nextTick(async()=>{await calculateBestPosition(i,e),setLinePath(i)})}function setLinePath(t){const e=t.getElement(),n=e==null?void 0:e.querySelector(".ship-overlay-line"),r=t.getPositioning(),i=t.getOffset();n&&r==="top-right"&&(n.style.right="-20px"),n&&r==="top-left"&&(n.style.left="-20px");const g=POSITION_PRIORITY.filter(k=>k.positioning===r&&k.offset===i),y=e==null?void 0:e.querySelector(".ship-overlay-line line");if(g.length>0){const{x1:k,y1:L,x2:$,y2:V}=g[0].line;y&&(y.setAttribute("x1",k),y.setAttribute("y1",L),y.setAttribute("x2",$),y.setAttribute("y2",V))}}function removeLabelOverlay(t){existingOverlays.value=[],t.getOverlays().getArray().filter(r=>r.get("class")==="zh-map-ship-overlay").forEach(r=>{r.setPosition(void 0),r.setElement(void 0),t.removeOverlay(r),r.dispose()})}const getShipDirectPath=t=>{const{spd:e,hdg:n,cog:r}=t;return e?n!==null&&+n!=511&&r!==null?r-+n>=3?SHIP_DIRECT.right:r-+n<=-3?SHIP_DIRECT.left:SHIP_DIRECT.front:SHIP_DIRECT.front:""},createShipStyle=t=>{const{shipData:e}=t.getProperties(),n=getShipType(),r=getShipScale(e,n);return initShipStyle(t,r,n)},getShipType=()=>{const t=getZoom();return t<=MAP_ZOOM.shipModelMax&&t>=MAP_ZOOM.shipTriggleMin?"ship":"triangle"},getShipScale=(t,e)=>{if(e==="ship"){const{len:n,wid:r}=t,i=97,g=20,k=1/getView().getResolution(),L=n*k/i,$=r*k/g;return Math.max(L,$)}return MAP_ZOOM.scaleNum},initShipStyle=(t,e,n)=>{const{color:r,direct:i,isHighlight:g,shipData:y}=t.getProperties(),k=(y.cog-90+360)%360;return new Style({image:new Icon({src:L(),scale:e||MAP_ZOOM.scaleNum,anchor:[.5,.5],rotation:k*Math.PI/180,rotateWithView:!1})});function L(){return`data:image/svg+xml;utf8,${encodeURIComponent($())}`}function $(){switch(n){case"triangle":return`<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
133
+ `;function createCanvasContextWebGL(t,e,n,r){let i;return n&&n.length?i=n.shift():WORKER_OFFSCREEN_CANVAS?i=new OffscreenCanvas(t||300,e||300):i=document.createElement("canvas"),t&&(i.width=t),e&&(i.height=e),i.getContext("webgl",r)}function releaseGLCanvas(t){const e=t.canvas;e.width=1,e.height=1,t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)}const canvasGLPool=[];function render(t,e,n,r,i,g,y,k,L,$,V,z,re,oe){const j=Math.round(r*e),ie=Math.round(r*n);t.canvas.width=j,t.canvas.height=ie;let ae,ue;if(ue=t.createTexture(),t.bindTexture(t.TEXTURE_2D,ue),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),re?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,j,ie,0,t.RGBA,V,null),ae=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,ae),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,ue,0),ae===null)throw new Error("Could not create framebuffer");if(ue===null)throw new Error("Could not create texture");if(L.length===0)return{width:j,height:ie,framebuffer:ae,texture:ue};const de=createEmpty();L.forEach(function(Ne,Ue,kt){extend$3(de,Ne.extent)});let pe,le,he;const _e=1/i;{if(pe=t.createTexture(),ue===null)throw new Error("Could not create texture");le=Math.round(getWidth(de)*_e),he=Math.round(getHeight(de)*_e);const Ne=t.getParameter(t.MAX_TEXTURE_SIZE),Ue=Math.max(le,he),kt=Ue>Ne?Ne/Ue:1,Dt=Math.round(le*kt),jt=Math.round(he*kt);t.bindTexture(t.TEXTURE_2D,pe),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),re?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,Dt,jt,0,t.RGBA,V,null);const Fe=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,Fe),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,pe,0);const $e=new Canvas(t);L.forEach(function(Ve,ze,Oe){const qe=(Ve.extent[0]-de[0])*_e*kt,Et=-(Ve.extent[3]-de[3])*_e*kt,hn=getWidth(Ve.extent)*_e*kt,At=getHeight(Ve.extent)*_e*kt;if(t.bindFramebuffer(t.FRAMEBUFFER,Fe),t.viewport(0,0,Dt,jt),Ve.clipExtent){const Lt=(Ve.clipExtent[0]-de[0])*_e*kt,wn=-(Ve.clipExtent[3]-de[3])*_e*kt,kn=getWidth(Ve.clipExtent)*_e*kt,En=getHeight(Ve.clipExtent)*_e*kt;t.enable(t.SCISSOR_TEST),t.scissor(re?Lt:Math.round(Lt),re?wn:Math.round(wn),re?kn:Math.round(Lt+kn)-Math.round(Lt),re?En:Math.round(wn+En)-Math.round(wn))}$e.drawImage(Ve.texture,Ve.width,Ve.height,$,$,Ve.width-2*$,Ve.height-2*$,re?qe:Math.round(qe),re?Et:Math.round(Et),re?hn:Math.round(qe+hn)-Math.round(qe),re?At:Math.round(Et+At)-Math.round(Et),Dt,jt),t.disable(t.SCISSOR_TEST)}),t.deleteFramebuffer(Fe)}const Ce=getTopLeft(y),xe=getTopLeft(de),Ie=Ne=>{const Ue=(Ne[0][0]-Ce[0])/g*r,kt=-(Ne[0][1]-Ce[1])/g*r,Dt=(Ne[1][0]-Ce[0])/g*r,jt=-(Ne[1][1]-Ce[1])/g*r,Fe=(Ne[2][0]-Ce[0])/g*r,$e=-(Ne[2][1]-Ce[1])/g*r;return{u1:Dt,v1:jt,u0:Ue,v0:kt,u2:Fe,v2:$e}};t.bindFramebuffer(t.FRAMEBUFFER,ae),t.viewport(0,0,j,ie);{const Ne=[],Ue=[],kt=createProgram(t,TRIANGLE_FRAGMENT_SHADER,TRIANGLE_VERTEX_SHADER);t.useProgram(kt);const Dt=t.getUniformLocation(kt,"u_texture");t.bindTexture(t.TEXTURE_2D,pe),t.uniform1i(Dt,0),k.getTriangles().forEach(function(qe,Et,hn){const At=qe.source,Lt=qe.target,{u1:wn,v1:kn,u0:En,v0:Cn,u2:Pn,v2:Dn}=Ie(Lt),Ln=(At[0][0]-xe[0])/i/le,Vn=-(At[0][1]-xe[1])/i/he,Bn=(At[1][0]-xe[0])/i/le,jn=-(At[1][1]-xe[1])/i/he,Xn=(At[2][0]-xe[0])/i/le,Zn=-(At[2][1]-xe[1])/i/he;Ne.push(wn,kn,En,Cn,Pn,Dn),Ue.push(Bn,jn,Ln,Vn,Xn,Zn)});const jt=orthographic(0,j,ie,0,-1,1),Fe=t.getUniformLocation(kt,"u_matrix");t.uniformMatrix4fv(Fe,!1,jt);const $e=t.getAttribLocation(kt,"a_position"),Ve=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,Ve),t.bufferData(t.ARRAY_BUFFER,new Float32Array(Ne),t.STATIC_DRAW),t.vertexAttribPointer($e,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray($e);const ze=t.getAttribLocation(kt,"a_texcoord"),Oe=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,Oe),t.bufferData(t.ARRAY_BUFFER,new Float32Array(Ue),t.STATIC_DRAW),t.vertexAttribPointer(ze,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(ze),t.drawArrays(t.TRIANGLES,0,Ne.length/2)}if(z){const Ne=createProgram(t,EDGE_FRAGMENT_SHADER,EDGE_VERTEX_SHADER);t.useProgram(Ne);const Ue=orthographic(0,j,ie,0,-1,1),kt=t.getUniformLocation(Ne,"u_matrix");t.uniformMatrix4fv(kt,!1,Ue);const Dt=Array.isArray(z)?z:[0,0,0,255],jt=t.getUniformLocation(Ne,"u_val");t.uniform4fv(jt,Dt);const Fe=t.getAttribLocation(Ne,"a_position"),$e=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,$e),t.vertexAttribPointer(Fe,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(Fe);const Ve=k.getTriangles().reduce(function(ze,Oe){const qe=Oe.target,{u1:Et,v1:hn,u0:At,v0:Lt,u2:wn,v2:kn}=Ie(qe);return ze.concat([Et,hn,At,Lt,At,Lt,wn,kn,wn,kn,Et,hn])},[]);t.bufferData(t.ARRAY_BUFFER,new Float32Array(Ve),t.STATIC_DRAW),t.drawArrays(t.LINES,0,Ve.length/2)}return{width:j,height:ie,framebuffer:ae,texture:ue}}class ReprojDataTile extends DataTile{constructor(e){super({tileCoord:e.tileCoord,loader:()=>Promise.resolve(new Uint8ClampedArray(4)),interpolate:e.interpolate,transition:e.transition}),this.renderEdges_=e.renderEdges!==void 0?e.renderEdges:!1,this.pixelRatio_=e.pixelRatio,this.gutter_=e.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=e.sourceTileGrid,this.targetTileGrid_=e.targetTileGrid,this.wrappedTileCoord_=e.wrappedTileCoord||e.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const n=e.sourceProj,r=n.getExtent(),i=e.sourceTileGrid.getExtent();this.clipExtent_=n.canWrapX()?i?getIntersection(r,i):r:i;const g=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),y=this.targetTileGrid_.getExtent();let k=this.sourceTileGrid_.getExtent();const L=y?getIntersection(g,y):g;if(getArea$1(L)===0){this.state=TileState.EMPTY;return}r&&(k?k=getIntersection(k,r):k=r);const $=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),V=e.targetProj,z=calculateSourceExtentResolution(n,V,L,$);if(!isFinite(z)||z<=0){this.state=TileState.EMPTY;return}const re=e.errorThreshold!==void 0?e.errorThreshold:ERROR_THRESHOLD;if(this.triangulation_=new Triangulation(n,V,L,k,z*re,$,e.transformMatrix),this.triangulation_.getTriangles().length===0){this.state=TileState.EMPTY;return}this.sourceZ_=this.sourceTileGrid_.getZForResolution(z);let oe=this.triangulation_.calculateSourceExtent();if(k&&(n.canWrapX()?(oe[1]=clamp(oe[1],k[1],k[3]),oe[3]=clamp(oe[3],k[1],k[3])):oe=getIntersection(oe,k)),!getArea$1(oe))this.state=TileState.EMPTY;else{let j=0,ie=0;n.canWrapX()&&(j=getWidth(r),ie=Math.floor((oe[0]-r[0])/j)),wrapAndSliceX(oe.slice(),n,!0).forEach(ue=>{const de=this.sourceTileGrid_.getTileRangeForExtentAndZ(ue,this.sourceZ_),pe=e.getTileFunction;for(let le=de.minX;le<=de.maxX;le++)for(let he=de.minY;he<=de.maxY;he++){const _e=pe(this.sourceZ_,le,he,this.pixelRatio_);if(_e){const Ce=ie*j;this.sourceTiles_.push({tile:_e,offset:Ce})}}++ie}),this.sourceTiles_.length===0&&(this.state=TileState.EMPTY)}}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const e=[];let n=!1;if(this.sourceTiles_.forEach(le=>{var Et;const he=le.tile;if(!he||he.getState()!==TileState.LOADED)return;const _e=he.getSize(),Ce=this.gutter_;let xe;const Ie=asArrayLike(he.getData());Ie?xe=Ie:(n=!0,xe=toArray(asImageLike(he.getData())));const Ne=[_e[0]+2*Ce,_e[1]+2*Ce],Ue=xe instanceof Float32Array,kt=Ne[0]*Ne[1],Dt=Ue?Float32Array:Uint8ClampedArray,jt=new Dt(xe.buffer),Fe=Dt.BYTES_PER_ELEMENT,$e=Fe*jt.length/kt,Ve=jt.byteLength/Ne[1],ze=Math.floor(Ve/Fe/Ne[0]),Oe=this.sourceTileGrid_.getTileCoordExtent(he.tileCoord);Oe[0]+=le.offset,Oe[2]+=le.offset;const qe=(Et=this.clipExtent_)==null?void 0:Et.slice();qe&&(qe[0]+=le.offset,qe[2]+=le.offset),e.push({extent:Oe,clipExtent:qe,data:jt,dataType:Dt,bytesPerPixel:$e,pixelSize:Ne,bandCount:ze})}),this.sourceTiles_.length=0,e.length===0){this.state=TileState.ERROR,this.changed();return}const r=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(r),g=typeof i=="number"?i:i[0],y=typeof i=="number"?i:i[1],k=g*this.pixelRatio_,L=y*this.pixelRatio_,$=this.targetTileGrid_.getResolution(r),V=this.sourceTileGrid_.getResolution(this.sourceZ_),z=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),re=e[0].bandCount,oe=new e[0].dataType(re*k*L),j=createCanvasContextWebGL(k,L,canvasGLPool,{premultipliedAlpha:!1,antialias:!1});let ie;const ae=j.RGBA;let ue;e[0].dataType==Float32Array?(ue=j.FLOAT,j.getExtension("WEBGL_color_buffer_float"),j.getExtension("OES_texture_float"),j.getExtension("EXT_float_blend"),ie=j.getExtension("OES_texture_float_linear")!==null&&this.interpolate):(ue=j.UNSIGNED_BYTE,ie=this.interpolate);const de=4,pe=Math.ceil(re/de);for(let le=pe-1;le>=0;--le){const he=[];for(let Dt=0,jt=e.length;Dt<jt;++Dt){const Fe=e[Dt],$e=Fe.pixelSize,Ve=$e[0],ze=$e[1],Oe=new Fe.dataType(de*Ve*ze),qe=Fe.data;let Et=le*de;for(let At=0,Lt=Oe.length;At<Lt;At+=de)Oe[At]=qe[Et],Oe[At+1]=qe[Et+1],Oe[At+2]=qe[Et+2],Oe[At+3]=qe[Et+3],Et+=re;const hn=j.createTexture();j.bindTexture(j.TEXTURE_2D,hn),ie?(j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.LINEAR),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.LINEAR)):(j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST)),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texImage2D(j.TEXTURE_2D,0,ae,Ve,ze,0,ae,ue,Oe),he.push({extent:Fe.extent,clipExtent:Fe.clipExtent,texture:hn,width:Ve,height:ze})}const{framebuffer:_e,width:Ce,height:xe}=render(j,g,y,this.pixelRatio_,V,$,z,this.triangulation_,he,this.gutter_,ue,this.renderEdges_,ie),Ie=Ce,Ne=xe*de,Ue=new e[0].dataType(Ie*Ne);j.bindFramebuffer(j.FRAMEBUFFER,_e),j.readPixels(0,0,Ce,xe,j.RGBA,ue,Ue);let kt=le*de;for(let Dt=0,jt=Ue.length;Dt<jt;Dt+=de){const Fe=(Ie-1-(Dt/Ne|0))*Ne+Dt%Ne;oe[kt]=Ue[Fe],oe[kt+1]=Ue[Fe+1],oe[kt+2]=Ue[Fe+2],oe[kt+3]=Ue[Fe+3],kt+=re}}if(releaseGLCanvas(j),canvasGLPool.push(j.canvas),n){const le=createCanvasContext2D(g,y),he=new ImageData(oe,g);le.putImageData(he,0,0),this.reprojData_=le.canvas}else this.reprojData_=oe;this.reprojSize_=[Math.round(k),Math.round(L)],this.state=TileState.LOADED,this.changed()}load(){if(this.state!==TileState.IDLE&&this.state!==TileState.ERROR)return;this.state=TileState.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:n})=>{const r=n.getState();if(r!==TileState.IDLE&&r!==TileState.LOADING)return;e++;const i=listen(n,EventType.CHANGE,()=>{const g=n.getState();(g==TileState.LOADED||g==TileState.ERROR||g==TileState.EMPTY)&&(unlistenByKey(i),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(i)}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:n}){n.getState()==TileState.IDLE&&n.load()})}unlistenSources_(){this.sourcesListenerKeys_.forEach(unlistenByKey),this.sourcesListenerKeys_=null}}class ReprojTile extends Tile{constructor(e,n,r,i,g,y,k,L,$,V,z,re){super(g,TileState.IDLE,re),this.renderEdges_=z!==void 0?z:!1,this.pixelRatio_=k,this.gutter_=L,this.canvas_=null,this.sourceTileGrid_=n,this.targetTileGrid_=i,this.wrappedTileCoord_=y||g,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;const oe=i.getTileCoordExtent(this.wrappedTileCoord_),j=this.targetTileGrid_.getExtent();let ie=this.sourceTileGrid_.getExtent();const ae=j?getIntersection(oe,j):oe;if(getArea$1(ae)===0){this.state=TileState.EMPTY;return}const ue=e.getExtent();ue&&(ie?ie=getIntersection(ie,ue):ie=ue);const de=i.getResolution(this.wrappedTileCoord_[0]),pe=calculateSourceExtentResolution(e,r,ae,de);if(!isFinite(pe)||pe<=0){this.state=TileState.EMPTY;return}const le=V!==void 0?V:ERROR_THRESHOLD;if(this.triangulation_=new Triangulation(e,r,ae,ie,pe*le,de),this.triangulation_.getTriangles().length===0){this.state=TileState.EMPTY;return}this.sourceZ_=n.getZForResolution(pe);let he=this.triangulation_.calculateSourceExtent();if(ie&&(e.canWrapX()?(he[1]=clamp(he[1],ie[1],ie[3]),he[3]=clamp(he[3],ie[1],ie[3])):he=getIntersection(he,ie)),!getArea$1(he))this.state=TileState.EMPTY;else{let _e=0,Ce=0;e.canWrapX()&&(_e=getWidth(ue),Ce=Math.floor((he[0]-ue[0])/_e)),wrapAndSliceX(he.slice(),e,!0).forEach(Ie=>{const Ne=n.getTileRangeForExtentAndZ(Ie,this.sourceZ_);for(let Ue=Ne.minX;Ue<=Ne.maxX;Ue++)for(let kt=Ne.minY;kt<=Ne.maxY;kt++){const Dt=$(this.sourceZ_,Ue,kt,k);if(Dt){const jt=Ce*_e;this.sourceTiles_.push({tile:Dt,offset:jt})}}++Ce}),this.sourceTiles_.length===0&&(this.state=TileState.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(n=>{var i;const r=n.tile;if(r&&r.getState()==TileState.LOADED){const g=this.sourceTileGrid_.getTileCoordExtent(r.tileCoord);g[0]+=n.offset,g[2]+=n.offset;const y=(i=this.clipExtent_)==null?void 0:i.slice();y&&(y[0]+=n.offset,y[2]+=n.offset),e.push({extent:g,clipExtent:y,image:r.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=TileState.ERROR;else{const n=this.wrappedTileCoord_[0],r=this.targetTileGrid_.getTileSize(n),i=typeof r=="number"?r:r[0],g=typeof r=="number"?r:r[1],y=this.targetTileGrid_.getResolution(n),k=this.sourceTileGrid_.getResolution(this.sourceZ_),L=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=render$1(i,g,this.pixelRatio_,k,this.sourceTileGrid_.getExtent(),y,L,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=TileState.LOADED}this.changed()}load(){if(this.state==TileState.IDLE){this.state=TileState.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:n})=>{const r=n.getState();if(r==TileState.IDLE||r==TileState.LOADING){e++;const i=listen(n,EventType.CHANGE,g=>{const y=n.getState();(y==TileState.LOADED||y==TileState.ERROR||y==TileState.EMPTY)&&(unlistenByKey(i),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(i)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:n},r,i){n.getState()==TileState.IDLE&&n.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(unlistenByKey),this.sourcesListenerKeys_=null}release(){this.canvas_&&(releaseCanvas(this.canvas_.getContext("2d")),canvasPool.push(this.canvas_),this.canvas_=null),super.release()}}function getCacheKey(t,e,n,r){return`${t},${getKeyZXY(e,n,r)}`}function addTileToLookup(t,e,n){if(!(n in t))return t[n]=new Set([e]),!0;const r=t[n],i=r.has(e);return i||r.add(e),!i}function removeTileFromLookup(t,e,n){const r=t[n];return r?r.delete(e):!1}function getRenderExtent(t,e){const n=t.layerStatesArray[t.layerIndex];n.extent&&(e=getIntersection(e,fromUserExtent(n.extent,t.viewState.projection)));const r=n.layer.getRenderSource();if(!r.getWrapX()){const i=r.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=getIntersection(e,i))}return e}class CanvasTileLayerRenderer extends CanvasLayerRenderer{constructor(e,n){super(e),n=n||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=createEmpty(),this.tempTileRange_=new TileRange(0,0,0,0),this.tempTileCoord_=createOrUpdate$1(0,0,0);const r=n.cacheSize!==void 0?n.cacheSize:512;this.tileCache_=new LRUCache(r),this.maxStaleKeys=r*.5}getTileCache(){return this.tileCache_}getOrCreateTile(e,n,r,i){const g=this.tileCache_,k=this.getLayer().getSource(),L=getCacheKey(k.getKey(),e,n,r);let $;if(g.containsKey(L))$=g.get(L);else{if($=k.getTile(e,n,r,i.pixelRatio,i.viewState.projection),!$)return null;g.set(L,$)}return $}getTile(e,n,r,i){const g=this.getOrCreateTile(e,n,r,i);return g||null}getData(e){const n=this.frameState;if(!n)return null;const r=this.getLayer(),i=apply(n.pixelToCoordinateTransform,e.slice()),g=r.getExtent();if(g&&!containsCoordinate(g,i))return null;const y=n.viewState,k=r.getRenderSource(),L=k.getTileGridForProjection(y.projection),$=k.getTilePixelRatio(n.pixelRatio);for(let V=L.getZForResolution(y.resolution);V>=L.getMinZoom();--V){const z=L.getTileCoordForCoordAndZ(i,V),re=this.getTile(V,z[1],z[2],n);if(!re||re.getState()!==TileState.LOADED)continue;const oe=L.getOrigin(V),j=toSize(L.getTileSize(V)),ie=L.getResolution(V);let ae;if(re instanceof ImageTile||re instanceof ReprojTile)ae=re.getImage();else if(re instanceof DataTile){if(ae=asImageLike(re.getData()),!ae)continue}else continue;const ue=Math.floor($*((i[0]-oe[0])/ie-z[1]*j[0])),de=Math.floor($*((oe[1]-i[1])/ie-z[2]*j[1])),pe=Math.round($*k.getGutterForProjection(y.projection));return this.getImageData(ae,ue+pe,de+pe)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;const n=this.getLayer().getSource();if(!n)return!1;const r=n.getRevision();return this.renderedRevision_?this.renderedRevision_!==r&&(this.renderedRevision_=r,this.renderedSourceKey_===n.getKey()&&this.tileCache_.clear()):this.renderedRevision_=r,!0}enqueueTiles(e,n,r,i,g){const y=e.viewState,k=this.getLayer(),L=k.getRenderSource(),$=L.getTileGridForProjection(y.projection),V=getUid(L);V in e.wantedTiles||(e.wantedTiles[V]={});const z=e.wantedTiles[V],re=k.getMapInternal(),oe=Math.max(r-g,$.getMinZoom(),$.getZForResolution(Math.min(k.getMaxResolution(),re?re.getView().getResolutionForZoom(Math.max(k.getMinZoom(),0)):$.getResolution(0)),L.zDirection));for(let j=r;j>=oe;--j){const ie=$.getTileRangeForExtentAndZ(n,j,this.tempTileRange_),ae=$.getResolution(j);for(let ue=ie.minX;ue<=ie.maxX;++ue)for(let de=ie.minY;de<=ie.maxY;++de){const pe=this.getTile(j,ue,de,e);if(!pe||!addTileToLookup(i,pe,j))continue;const he=pe.getKey();if(z[he]=!0,pe.getState()===TileState.IDLE&&!e.tileQueue.isKeyQueued(he)){const _e=createOrUpdate$1(j,ue,de,this.tempTileCoord_);e.tileQueue.enqueue([pe,V,$.getTileCoordCenter(_e),ae])}}}}findStaleTile_(e,n){const r=this.tileCache_,i=e[0],g=e[1],y=e[2],k=this.getStaleKeys();for(let L=0;L<k.length;++L){const $=getCacheKey(k[L],i,g,y);if(r.containsKey($)){const V=r.get($);if(V.getState()===TileState.LOADED)return V.endTransition(getUid(this)),addTileToLookup(n,V,i),!0}}return!1}findAltTiles_(e,n,r,i){const g=e.getTileRangeForTileCoordAndZ(n,r,this.tempTileRange_);if(!g)return!1;let y=!0;const k=this.tileCache_,$=this.getLayer().getRenderSource().getKey();for(let V=g.minX;V<=g.maxX;++V)for(let z=g.minY;z<=g.maxY;++z){const re=getCacheKey($,r,V,z);let oe=!1;if(k.containsKey(re)){const j=k.get(re);j.getState()===TileState.LOADED&&(addTileToLookup(i,j,r),oe=!0)}oe||(y=!1)}return y}renderFrame(e,n){let r=!0;this.renderComplete=!0;const i=e.layerStatesArray[e.layerIndex],g=e.viewState,y=g.projection,k=g.resolution,L=g.center,$=e.pixelRatio,V=this.getLayer(),z=V.getSource(),re=z.getRevision(),oe=z.getTileGridForProjection(y),j=oe.getZForResolution(k,z.zDirection),ie=oe.getResolution(j),ae=z.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==ae&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=ae):this.renderedSourceKey_=ae;let ue=e.extent;const de=z.getTilePixelRatio($);this.prepareContainer(e,n);const pe=this.context.canvas.width,le=this.context.canvas.height,he=i.extent&&fromUserExtent(i.extent);he&&(ue=getIntersection(ue,fromUserExtent(i.extent)));const _e=ie*pe/2/de,Ce=ie*le/2/de,xe=[L[0]-_e,L[1]-Ce,L[0]+_e,L[1]+Ce],Ie={};this.renderedTiles.length=0;const Ne=V.getPreload();if(e.nextExtent){const qe=oe.getZForResolution(g.nextResolution,z.zDirection),Et=getRenderExtent(e,e.nextExtent);this.enqueueTiles(e,Et,qe,Ie,Ne)}const Ue=getRenderExtent(e,ue);if(this.enqueueTiles(e,Ue,j,Ie,0),Ne>0&&setTimeout(()=>{this.enqueueTiles(e,Ue,j-1,Ie,Ne-1)},0),!(j in Ie))return this.container;const kt=getUid(this),Dt=e.time;for(const qe of Ie[j]){const Et=qe.getState();if((qe instanceof ReprojTile||qe instanceof ReprojDataTile)&&Et===TileState.EMPTY)continue;const hn=qe.tileCoord;if(Et===TileState.LOADED&&qe.getAlpha(kt,Dt)===1){qe.endTransition(kt);continue}if(Et!==TileState.IDLE&&(r=!1),Et!==TileState.ERROR&&(this.renderComplete=!1),this.findStaleTile_(hn,Ie)){removeTileFromLookup(Ie,qe,j),e.animate=!0;continue}if(this.findAltTiles_(oe,hn,j+1,Ie))continue;const wn=oe.getMinZoom();for(let kn=j-1;kn>=wn&&!this.findAltTiles_(oe,hn,kn,Ie);--kn);}const jt=ie/k*$/de,Fe=this.getRenderContext(e);compose(this.tempTransform,pe/2,le/2,jt,jt,0,-pe/2,-le/2),i.extent&&this.clipUnrotated(Fe,e,he),z.getInterpolate()||(Fe.imageSmoothingEnabled=!1),this.preRender(Fe,e);const $e=Object.keys(Ie).map(Number);$e.sort(ascending);let Ve;const ze=[],Oe=[];for(let qe=$e.length-1;qe>=0;--qe){const Et=$e[qe],hn=z.getTilePixelSize(Et,$,y),Lt=oe.getResolution(Et)/ie,wn=hn[0]*Lt*jt,kn=hn[1]*Lt*jt,En=oe.getTileCoordForCoordAndZ(getTopLeft(xe),Et),Cn=oe.getTileCoordExtent(En),Pn=apply(this.tempTransform,[de*(Cn[0]-xe[0])/ie,de*(xe[3]-Cn[3])/ie]),Dn=de*z.getGutterForProjection(y);for(const Ln of Ie[Et]){if(Ln.getState()!==TileState.LOADED)continue;const Vn=Ln.tileCoord,Bn=En[1]-Vn[1],jn=Math.round(Pn[0]-(Bn-1)*wn),Xn=En[2]-Vn[2],Zn=Math.round(Pn[1]-(Xn-1)*kn),zn=Math.round(Pn[0]-Bn*wn),Gn=Math.round(Pn[1]-Xn*kn),Fn=jn-zn,Un=Zn-Gn,xn=$e.length===1;let Rn=!1;Ve=[zn,Gn,zn+Fn,Gn,zn+Fn,Gn+Un,zn,Gn+Un];for(let Nn=0,_n=ze.length;Nn<_n;++Nn)if(!xn&&Et<Oe[Nn]){const Mn=ze[Nn];intersects$1([zn,Gn,zn+Fn,Gn+Un],[Mn[0],Mn[3],Mn[4],Mn[7]])&&(Rn||(Fe.save(),Rn=!0),Fe.beginPath(),Fe.moveTo(Ve[0],Ve[1]),Fe.lineTo(Ve[2],Ve[3]),Fe.lineTo(Ve[4],Ve[5]),Fe.lineTo(Ve[6],Ve[7]),Fe.moveTo(Mn[6],Mn[7]),Fe.lineTo(Mn[4],Mn[5]),Fe.lineTo(Mn[2],Mn[3]),Fe.lineTo(Mn[0],Mn[1]),Fe.clip())}ze.push(Ve),Oe.push(Et),this.drawTile(Ln,e,zn,Gn,Fn,Un,Dn,xn),Rn&&Fe.restore(),this.renderedTiles.unshift(Ln),this.updateUsedTiles(e.usedTiles,z,Ln)}}if(this.renderedRevision=re,this.renderedResolution=ie,this.extentChanged=!this.renderedExtent_||!equals$2(this.renderedExtent_,xe),this.renderedExtent_=xe,this.renderedPixelRatio=$,this.postRender(this.context,e),i.extent&&Fe.restore(),Fe.imageSmoothingEnabled=!0,this.renderComplete){const qe=(Et,hn)=>{const At=getUid(z),Lt=hn.wantedTiles[At],wn=Lt?Object.keys(Lt).length:0;this.updateCacheSize(wn),this.tileCache_.expireCache()};e.postRenderFunctions.push(qe)}return!this.renderComplete&&!r&&(e.animate=!0),this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,n,r,i,g,y,k,L){let $;if(e instanceof DataTile){if($=asImageLike(e.getData()),!$)throw new Error("Rendering array data is not yet supported")}else $=this.getTileImage(e);if(!$)return;const V=this.getRenderContext(n),z=getUid(this),re=n.layerStatesArray[n.layerIndex],oe=re.opacity*(L?e.getAlpha(z,n.time):1),j=oe!==V.globalAlpha;j&&(V.save(),V.globalAlpha=oe),V.drawImage($,k,k,$.width-2*k,$.height-2*k,r,i,g,y),j&&V.restore(),oe!==re.opacity?n.animate=!0:L&&e.endTransition(z)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,n,r){const i=getUid(n);i in e||(e[i]={}),e[i][r.getKey()]=!0}}class TileLayer extends BaseTileLayer{constructor(e){super(e)}createRenderer(){return new CanvasTileLayerRenderer(this,{cacheSize:this.getCacheSize()})}}const TIAN_DI_TU_KEY="a6e8f78974f2581f2ca00485b40c948f",MAP_ZOOM={default:13,min:3,max:18,shipTriggleMin:16,shipModelMax:18,scaleNum:.555},projection={data:"EPSG:4326",mercator:"EPSG:3857"},MAP_DEFAULT_CENTER=[114.84,30.52],CDN_URL="https://static.zhihaoscm.cn/",equatorialCircumference=2003750834e-2;var BASE_MAP_LINK=(t=>(t.vectorTile=`https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`,t.vectorTileMark=`https://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`,t.satelliteImgTile=`https://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`,t.satelliteImgTileMark=`https://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`,t.greenTile=`${CDN_URL}/map/tile/{z}/{x}/{y}.png`,t))(BASE_MAP_LINK||{}),LENGTH_UNIT=(t=>(t[t.M=1]="M",t[t.KM=2]="KM",t[t.NM=3]="NM",t))(LENGTH_UNIT||{});const TileEventType={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"},tmpTileCoord=[0,0,0],DECIMALS=5;class TileGrid{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,assert(isSorted(this.resolutions_,(i,g)=>g-i),"`resolutions` must be sorted in descending order");let n;if(!e.origins){for(let i=0,g=this.resolutions_.length-1;i<g;++i)if(!n)n=this.resolutions_[i]/this.resolutions_[i+1];else if(this.resolutions_[i]/this.resolutions_[i+1]!==n){n=void 0;break}}this.zoomFactor_=n,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,assert(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const r=e.extent;r!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=getTopLeft(r)),assert(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,assert(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:DEFAULT_TILE_SIZE,assert(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=r!==void 0?r:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((i,g)=>{const y=new TileRange(Math.min(0,i[0]),Math.max(i[0]-1,-1),Math.min(0,i[1]),Math.max(i[1]-1,-1));if(r){const k=this.getTileRangeForExtentAndZ(r,g);y.minX=Math.max(k.minX,y.minX),y.maxX=Math.min(k.maxX,y.maxX),y.minY=Math.max(k.minY,y.minY),y.maxY=Math.min(k.maxY,y.maxY)}return y}):r&&this.calculateTileRanges_(r)}forEachTileCoord(e,n,r){const i=this.getTileRangeForExtentAndZ(e,n);for(let g=i.minX,y=i.maxX;g<=y;++g)for(let k=i.minY,L=i.maxY;k<=L;++k)r([n,g,k])}forEachTileCoordParentTileRange(e,n,r,i){let g,y,k,L=null,$=e[0]-1;for(this.zoomFactor_===2?(y=e[1],k=e[2]):L=this.getTileCoordExtent(e,i);$>=this.minZoom;){if(y!==void 0&&k!==void 0?(y=Math.floor(y/2),k=Math.floor(k/2),g=createOrUpdate(y,y,k,k,r)):g=this.getTileRangeForExtentAndZ(L,$,r),n($,g))return!0;--$}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,n,r){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const g=e[1]*2,y=e[2]*2;return createOrUpdate(g,g+1,y,y+1,n)}const i=this.getTileCoordExtent(e,r||this.tmpExtent_);return this.getTileRangeForExtentAndZ(i,e[0]+1,n)}return null}getTileRangeForTileCoordAndZ(e,n,r){if(n>this.maxZoom||n<this.minZoom)return null;const i=e[0],g=e[1],y=e[2];if(n===i)return createOrUpdate(g,y,g,y,r);if(this.zoomFactor_){const L=Math.pow(this.zoomFactor_,n-i),$=Math.floor(g*L),V=Math.floor(y*L);if(n<i)return createOrUpdate($,$,V,V,r);const z=Math.floor(L*(g+1))-1,re=Math.floor(L*(y+1))-1;return createOrUpdate($,z,V,re,r)}const k=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(k,n,r)}getTileRangeForExtentAndZ(e,n,r){this.getTileCoordForXYAndZ_(e[0],e[3],n,!1,tmpTileCoord);const i=tmpTileCoord[1],g=tmpTileCoord[2];this.getTileCoordForXYAndZ_(e[2],e[1],n,!0,tmpTileCoord);const y=tmpTileCoord[1],k=tmpTileCoord[2];return createOrUpdate(i,y,g,k,r)}getTileCoordCenter(e){const n=this.getOrigin(e[0]),r=this.getResolution(e[0]),i=toSize(this.getTileSize(e[0]),this.tmpSize_);return[n[0]+(e[1]+.5)*i[0]*r,n[1]-(e[2]+.5)*i[1]*r]}getTileCoordExtent(e,n){const r=this.getOrigin(e[0]),i=this.getResolution(e[0]),g=toSize(this.getTileSize(e[0]),this.tmpSize_),y=r[0]+e[1]*g[0]*i,k=r[1]-(e[2]+1)*g[1]*i,L=y+g[0]*i,$=k+g[1]*i;return createOrUpdate$2(y,k,L,$,n)}getTileCoordForCoordAndResolution(e,n,r){return this.getTileCoordForXYAndResolution_(e[0],e[1],n,!1,r)}getTileCoordForXYAndResolution_(e,n,r,i,g){const y=this.getZForResolution(r),k=r/this.getResolution(y),L=this.getOrigin(y),$=toSize(this.getTileSize(y),this.tmpSize_);let V=k*(e-L[0])/r/$[0],z=k*(L[1]-n)/r/$[1];return i?(V=ceil(V,DECIMALS)-1,z=ceil(z,DECIMALS)-1):(V=floor(V,DECIMALS),z=floor(z,DECIMALS)),createOrUpdate$1(y,V,z,g)}getTileCoordForXYAndZ_(e,n,r,i,g){const y=this.getOrigin(r),k=this.getResolution(r),L=toSize(this.getTileSize(r),this.tmpSize_);let $=(e-y[0])/k/L[0],V=(y[1]-n)/k/L[1];return i?($=ceil($,DECIMALS)-1,V=ceil(V,DECIMALS)-1):($=floor($,DECIMALS),V=floor(V,DECIMALS)),createOrUpdate$1(r,$,V,g)}getTileCoordForCoordAndZ(e,n,r){return this.getTileCoordForXYAndZ_(e[0],e[1],n,!1,r)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,n){const r=linearFindNearest(this.resolutions_,e,n||0);return clamp(r,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,n){return intersectsLinearRing(n,0,n.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const n=this.resolutions_.length,r=new Array(n);for(let i=this.minZoom;i<n;++i)r[i]=this.getTileRangeForExtentAndZ(e,i);this.fullTileRanges_=r}}function getForProjection(t){let e=t.getDefaultTileGrid();return e||(e=createForProjection(t),t.setDefaultTileGrid(e)),e}function wrapX(t,e,n){const r=e[0],i=t.getTileCoordCenter(e),g=extentFromProjection(n);if(!containsCoordinate(g,i)){const y=getWidth(g),k=Math.ceil((g[0]-i[0])/y);return i[0]+=y*k,t.getTileCoordForCoordAndZ(i,r)}return e}function createForExtent(t,e,n,r){r=r!==void 0?r:"top-left";const i=resolutionsFromExtent(t,e,n);return new TileGrid({extent:t,origin:getCorner(t,r),resolutions:i,tileSize:n})}function createXYZ(t){const e=t||{},n=e.extent||get$1("EPSG:3857").getExtent(),r={extent:n,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:resolutionsFromExtent(n,e.maxZoom,e.tileSize,e.maxResolution)};return new TileGrid(r)}function resolutionsFromExtent(t,e,n,r){e=e!==void 0?e:DEFAULT_MAX_ZOOM,n=toSize(n!==void 0?n:DEFAULT_TILE_SIZE);const i=getHeight(t),g=getWidth(t);r=r>0?r:Math.max(g/n[0],i/n[1]);const y=e+1,k=new Array(y);for(let L=0;L<y;++L)k[L]=r/Math.pow(2,L);return k}function createForProjection(t,e,n,r){const i=extentFromProjection(t);return createForExtent(i,e,n,r)}function extentFromProjection(t){t=get$1(t);let e=t.getExtent();if(!e){const n=180*METERS_PER_UNIT$1.degrees/t.getMetersPerUnit();e=createOrUpdate$2(-n,-n,n,n)}return e}class TileSource extends Source{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;const n=[256,256];this.tileGrid&&toSize(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),n),this.tmpSize=[0,0],this.key_=e.key||getUid(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){const n=e?this.getTileGridForProjection(e):this.tileGrid;return n?n.getResolutions():null}getTile(e,n,r,i,g){return abstract()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:getForProjection(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,n,r){const i=this.getTileGridForProjection(r),g=this.getTilePixelRatio(n),y=toSize(i.getTileSize(e),this.tmpSize);return g==1?y:scale$1(y,g,this.tmpSize)}getTileCoordForTileUrlFunction(e,n){const r=n!==void 0?n:this.getProjection(),i=n!==void 0?this.getTileGridForProjection(r):this.tileGrid||this.getTileGridForProjection(r);return this.getWrapX()&&r.isGlobal()&&(e=wrapX(i,e,r)),withinExtentAndZ(e,i)?e:null}clear(){}refresh(){this.clear(),super.refresh()}}class TileSourceEvent extends BaseEvent{constructor(e,n){super(e),this.tile=n}}const zRegEx=/\{z\}/g,xRegEx=/\{x\}/g,yRegEx=/\{y\}/g,dashYRegEx=/\{-y\}/g;function renderXYZTemplate(t,e,n,r,i){return t.replace(zRegEx,e.toString()).replace(xRegEx,n.toString()).replace(yRegEx,r.toString()).replace(dashYRegEx,function(){if(i===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(i-r).toString()})}function expandUrl(t){const e=[];let n=/\{([a-z])-([a-z])\}/.exec(t);if(n){const r=n[1].charCodeAt(0),i=n[2].charCodeAt(0);let g;for(g=r;g<=i;++g)e.push(t.replace(n[0],String.fromCharCode(g)));return e}if(n=/\{(\d+)-(\d+)\}/.exec(t),n){const r=parseInt(n[2],10);for(let i=parseInt(n[1],10);i<=r;i++)e.push(t.replace(n[0],i.toString()));return e}return e.push(t),e}function createFromTemplate(t,e){return function(n,r,i){if(!n)return;let g;const y=n[0];if(e){const k=e.getFullTileRange(y);k&&(g=k.getHeight()-1)}return renderXYZTemplate(t,y,n[1],n[2],g)}}function createFromTemplates(t,e){const n=t.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=createFromTemplate(t[i],e);return createFromTileUrlFunctions(r)}function createFromTileUrlFunctions(t){return t.length===1?t[0]:function(e,n,r){if(!e)return;const i=hash(e),g=modulo(i,t.length);return t[g](e,n,r)}}class UrlTile extends TileSource{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===UrlTile.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){const n=e.target,r=getUid(n),i=n.getState();let g;i==TileState.LOADING?(this.tileLoadingKeys_[r]=!0,g=TileEventType.TILELOADSTART):r in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[r],g=i==TileState.ERROR?TileEventType.TILELOADERROR:i==TileState.LOADED?TileEventType.TILELOADEND:void 0),g!=null&&this.dispatchEvent(new TileSourceEvent(g,n))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,n){this.tileUrlFunction=e,typeof n<"u"?this.setKey(n):this.changed()}setUrl(e){const n=expandUrl(e);this.urls=n,this.setUrls(n)}setUrls(e){this.urls=e;const n=e.join(`
134
+ `);this.generateTileUrlFunction_?this.setTileUrlFunction(createFromTemplates(e,this.tileGrid),n):this.setKey(n)}tileUrlFunction(e,n,r){}}class TileImage extends UrlTile{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:defaultTileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.tileClass=e.tileClass!==void 0?e.tileClass:ImageTile,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!equivalent(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){const n=this.getProjection();if(this.tileGrid&&(!n||equivalent(n,e)))return this.tileGrid;const r=getUid(e);return r in this.tileGridForProjection||(this.tileGridForProjection[r]=getForProjection(e)),this.tileGridForProjection[r]}createTile_(e,n,r,i,g,y){const k=[e,n,r],L=this.getTileCoordForTileUrlFunction(k,g),$=L?this.tileUrlFunction(L,i,g):void 0,V=new this.tileClass(k,$!==void 0?TileState.IDLE:TileState.EMPTY,$!==void 0?$:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return V.key=y,V.addEventListener(EventType.CHANGE,this.handleTileChange.bind(this)),V}getTile(e,n,r,i,g){const y=this.getProjection();if(!y||!g||equivalent(y,g))return this.getTileInternal(e,n,r,i,y||g);const k=[e,n,r],L=this.getKey(),$=this.getTileGridForProjection(y),V=this.getTileGridForProjection(g),z=this.getTileCoordForTileUrlFunction(k,g),re=new ReprojTile(y,$,g,V,k,z,this.getTilePixelRatio(i),this.getGutter(),(oe,j,ie,ae)=>this.getTileInternal(oe,j,ie,ae,y),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return re.key=L,re}getTileInternal(e,n,r,i,g){const y=this.getKey();return this.createTile_(e,n,r,i,g,y)}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,n){const r=get$1(e);if(r){const i=getUid(r);i in this.tileGridForProjection||(this.tileGridForProjection[i]=n)}}}function defaultTileLoadFunction(t,e){t.getImage().src=e}class XYZ extends TileImage{constructor(e){e=e||{};const n=e.projection!==void 0?e.projection:"EPSG:3857",r=e.tileGrid!==void 0?e.tileGrid:createXYZ({extent:extentFromProjection(n),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:n,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:r,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}const calculateCirclePoints=(t,e)=>{const n=fromLonLat(t),r=e*1e3,i=[n[0]-r,n[1]-r,n[0]+r,n[1]+r],g=transformExtent(i,projection.mercator,projection.data);return{leftTopPoint:{lng:g[0],lat:g[3]},rightTopPoint:{lng:g[2],lat:g[3]},rightBottomPoint:{lng:g[2],lat:g[1]},leftBottomPoint:{lng:g[0],lat:g[1]}}},formatLength=function(t,e){const r=getLength(t);let i="";switch(console.log(e,LENGTH_UNIT),e){case LENGTH_UNIT.M:i=Math.round(r*100)/100+" m";break;case LENGTH_UNIT.KM:i=Math.round(r/1e3*100)/100+" km";break;case LENGTH_UNIT.NM:i=(Math.round(r/1e3*100)/100/1.852).toFixed(2)+" nm";break}return i};function lonLatToMercator(t){const e=t[0]*equatorialCircumference/180;let n=Math.log(Math.tan((90+t[1])*Math.PI/360))/(Math.PI/180);return n=n*equatorialCircumference/180,[e,n]}function getIconFont(unicode=""){return unicode.indexOf("&amp;")!==-1&&(unicode=unicode.replace("&amp;","&")),unicode.indexOf("&amp")!==-1&&(unicode=unicode.replace("&amp","&")),eval('("'+unicode.replace("&#x","\\u").replace(";","")+'")')}const getIconStyle=t=>{const e=new Text({font:"Normal 14px map-iconfont",text:getIconFont(t),fill:new Fill({color:"#fff"}),offsetY:-14});return new Style({text:e,zIndex:100})},mercatorToLonLat=(t,e="lonlat")=>{const n={lon:0,lat:0},r=t[0]/equatorialCircumference*180;let i=t[1]/equatorialCircumference*180;return i=180/Math.PI*(2*Math.atan(Math.exp(i*Math.PI/180))-Math.PI/2),n.lon=r,n.lat=i,e==="lonlat"?n:[r,i]},adjustBounds=(t,e)=>e.length===2?[t[0]-e[0],t[1]-e[1],t[2]+e[0],t[3]+e[1]]:[t[0]+e[0],t[1]+e[1],t[2]+e[2],t[3]+e[3]],isOverlapping$1=(t,e)=>t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1];class FeatureFormat{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Feature,this.supportedMediaTypes=null}getReadOptions(e,n){if(n){let r=n.dataProjection?get$1(n.dataProjection):this.readProjection(e);n.extent&&r&&r.getUnits()==="tile-pixels"&&(r=get$1(r),r.setWorldExtent(n.extent)),n={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(n)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return abstract()}readFeature(e,n){return abstract()}readFeatures(e,n){return abstract()}readGeometry(e,n){return abstract()}readProjection(e){return abstract()}writeFeature(e,n){return abstract()}writeFeatures(e,n){return abstract()}writeGeometry(e,n){return abstract()}}function transformGeometryWithOptions(t,e,n){const r=n?get$1(n.featureProjection):null,i=n?get$1(n.dataProjection):null;let g=t;if(r&&i&&!equivalent(r,i)){e&&(g=t.clone());const y=e?r:i,k=e?i:r;y.getUnits()==="tile-pixels"?g.transform(y,k):g.applyTransform(getTransform(y,k))}if(e&&n&&n.decimals!==void 0){const y=Math.pow(10,n.decimals),k=function(L){for(let $=0,V=L.length;$<V;++$)L[$]=Math.round(L[$]*y)/y;return L};g===t&&(g=t.clone()),g.applyTransform(k)}return g}class TextFeature extends FeatureFormat{constructor(){super()}getType(){return"text"}readFeature(e,n){return this.readFeatureFromText(getText(e),this.adaptOptions(n))}readFeatureFromText(e,n){return abstract()}readFeatures(e,n){return this.readFeaturesFromText(getText(e),this.adaptOptions(n))}readFeaturesFromText(e,n){return abstract()}readGeometry(e,n){return this.readGeometryFromText(getText(e),this.adaptOptions(n))}readGeometryFromText(e,n){return abstract()}readProjection(e){return this.readProjectionFromText(getText(e))}readProjectionFromText(e){return this.dataProjection}writeFeature(e,n){return this.writeFeatureText(e,this.adaptOptions(n))}writeFeatureText(e,n){return abstract()}writeFeatures(e,n){return this.writeFeaturesText(e,this.adaptOptions(n))}writeFeaturesText(e,n){return abstract()}writeGeometry(e,n){return this.writeGeometryText(e,this.adaptOptions(n))}writeGeometryText(e,n){return abstract()}}function getText(t){return typeof t=="string"?t:""}function flipXY(t,e,n,r,i,g){i!==void 0?(i=i,g=g!==void 0?g:0):(i=[],g=0);let y=e;for(;y<n;){const k=t[y++];i[g++]=t[y++],i[g++]=k;for(let L=2;L<r;++L)i[g++]=t[y++]}return i.length=g,i}class Polyline extends TextFeature{constructor(e){super(),e=e||{},this.dataProjection=get$1("EPSG:4326"),this.factor_=e.factor?e.factor:1e5,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY"}readFeatureFromText(e,n){const r=this.readGeometryFromText(e,n);return new Feature(r)}readFeaturesFromText(e,n){return[this.readFeatureFromText(e,n)]}readGeometryFromText(e,n){const r=getStrideForLayout(this.geometryLayout_),i=decodeDeltas(e,r,this.factor_);flipXY(i,0,i.length,r,i);const g=inflateCoordinates(i,0,i.length,r),y=new LineString(g,this.geometryLayout_);return transformGeometryWithOptions(y,!1,this.adaptOptions(n))}writeFeatureText(e,n){const r=e.getGeometry();if(r)return this.writeGeometryText(r,n);throw new Error("Expected `feature` to have a geometry")}writeFeaturesText(e,n){return this.writeFeatureText(e[0],n)}writeGeometryText(e,n){e=transformGeometryWithOptions(e,!0,this.adaptOptions(n));const r=e.getFlatCoordinates(),i=e.getStride();return flipXY(r,0,r.length,i,r),encodeDeltas(r,i,this.factor_)}}function encodeDeltas(t,e,n){n=n||1e5;let r;const i=new Array(e);for(r=0;r<e;++r)i[r]=0;for(let g=0,y=t.length;g<y;)for(r=0;r<e;++r,++g){const k=t[g],L=k-i[r];i[r]=k,t[g]=L}return encodeFloats(t,n)}function decodeDeltas(t,e,n){n=n||1e5;let r;const i=new Array(e);for(r=0;r<e;++r)i[r]=0;const g=decodeFloats(t,n);for(let y=0,k=g.length;y<k;)for(r=0;r<e;++r,++y)i[r]+=g[y],g[y]=i[r];return g}function encodeFloats(t,e){e=e||1e5;for(let n=0,r=t.length;n<r;++n)t[n]=Math.round(t[n]*e);return encodeSignedIntegers(t)}function decodeFloats(t,e){e=e||1e5;const n=decodeSignedIntegers(t);for(let r=0,i=n.length;r<i;++r)n[r]/=e;return n}function encodeSignedIntegers(t){for(let e=0,n=t.length;e<n;++e){const r=t[e];t[e]=r<0?~(r<<1):r<<1}return encodeUnsignedIntegers(t)}function decodeSignedIntegers(t){const e=decodeUnsignedIntegers(t);for(let n=0,r=e.length;n<r;++n){const i=e[n];e[n]=i&1?~(i>>1):i>>1}return e}function encodeUnsignedIntegers(t){let e="";for(let n=0,r=t.length;n<r;++n)e+=encodeUnsignedInteger(t[n]);return e}function decodeUnsignedIntegers(t){const e=[];let n=0,r=0;for(let i=0,g=t.length;i<g;++i){const y=t.charCodeAt(i)-63;n|=(y&31)<<r,y<32?(e.push(n),n=0,r=0):r+=5}return e}function encodeUnsignedInteger(t){let e,n="";for(;t>=32;)e=(32|t&31)+63,n+=String.fromCharCode(e),t>>=5;return e=t+63,n+=String.fromCharCode(e),n}var SHIP_SAIL_STATUS=(t=>(t[t.发动机使用中=0]="发动机使用中",t[t.锚泊=1]="锚泊",t[t.未操作=2]="未操作",t[t.操纵能力受限=3]="操纵能力受限",t[t.吃水受限=4]="吃水受限",t[t.系泊=5]="系泊",t[t.搁浅=6]="搁浅",t[t.从事捕捞=7]="从事捕捞",t[t.航行中=8]="航行中",t[t.留作将来修正导航状态=9]="留作将来修正导航状态",t[t.高速船留用=10]="高速船留用",t[t.机动船尾推作业=11]="机动船尾推作业",t[t.机动船顶推或侧推作业=12]="机动船顶推或侧推作业",t[t.飞翼船留用=13]="飞翼船留用",t[t.现行的=14]="现行的",t[t.未定义=15]="未定义",t))(SHIP_SAIL_STATUS||{}),SHIP_DIRECT=(t=>(t.left="left",t.right="right",t.front="front",t.up="up",t.down="down",t.back="back",t))(SHIP_DIRECT||{});const convertSixHundredThousandToLatLng=function(t,e){const n=Number(e)/6e5;return[Number(t)/6e5,n]},getRightIcons=t=>{const e=[];return t.existDevice&&e.push("&#xe687;"),t.existMobile&&e.push("&#xe688;"),t.existWaterGauge&&e.push("&#xe686;"),e};new RBush$1;function useShipOverlay(t){const e=vue.ref(null),n=vue.ref(null),r=vue.computed(()=>({"--overlay-color":t.color||"#FFF","--bg-color":t.selected?t.color:"#ffffff",position:"relative","pointer-events":"none"})),i=vue.computed(()=>({position:"relative","border-radius":"1px","background-color":"var(--bg-color)",color:"#000","padding-right":"5px","box-shadow":"0 2px 10px rgba(0, 0, 0, 0.2)","font-size":"10px","white-space":"nowrap",border:"1px solid #FFF","pointer-events":"auto",transition:"background-color 0.5s ease, border 0.5s ease","z-index":"1",display:"flex","align-items":"center"})),g=vue.computed(()=>({width:"14px",height:"14px",margin:"1px 5px 1px 1px","background-color":"var(--bg-color)"})),y=vue.computed(()=>({position:"absolute",top:"0px",color:"var(--overlay-color)","pointer-events":"none",transform:"translateY(-1px)","z-index":"0",width:"20px",height:"20px",overflow:"visible"}));let k=null;const L=()=>{$(),k=window.setInterval(()=>{if(e.value){const z=e.value.querySelector(".ship-overlay-content");z&&z.style&&(z.style.backgroundColor=t.color,z.style.color="#FFF",setTimeout(()=>{z&&z.style&&(z.style.backgroundColor="#ffffff",z.style.color="#000")},500))}},1e3)},$=()=>{k&&(clearInterval(k),k=null)},V=()=>{n.value&&n.value.setPosition(fromLonLat(t.position))};return vue.watch(()=>t.selected,z=>{z?L():$()},{immediate:!0}),vue.watch(()=>t.position,()=>{V()},{deep:!0}),vue.onMounted(()=>{}),vue.onBeforeUnmount(()=>{$()}),()=>vue.h("div",{ref:e,class:"ship-overlay-container",style:r.value},[vue.h("div",{class:"ship-overlay-content",style:i.value},[vue.h("div",{style:t.selected?g.value:{}},""),vue.h("div",{class:"text"},t.name||"未命名船舶"),vue.h("div",{class:"icons",style:{color:"#3370ff"}},[t.existDevice?vue.h("i",{class:"iconfont icon-Frame-19",style:{fontSize:"12px"}}):"",t.existMobile?vue.h("i",{class:"iconfont icon-Frame13",style:{fontSize:"12px"}}):"",t.existWaterGauge?vue.h("i",{class:"iconfont icon-a-Frame7",style:{fontSize:"12px"}}):""])]),vue.h("svg",{class:"ship-overlay-line",style:y.value,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[vue.h("line",{x1:"0",y1:"0",x2:"0",y2:"0",stroke:"white","stroke-width":"1"})])])}const POSITION_PRIORITY=[{positioning:"top-left",offset:[20,-20],line:{x1:"0",y1:"20",x2:"20",y2:"4"}},{positioning:"top-right",offset:[-20,-20],line:{x1:"0",y1:"4",x2:"20",y2:"20"}},{positioning:"top-left",offset:[20,0],line:{x1:"0",y1:"0",x2:"20",y2:"4"}},{positioning:"top-right",offset:[-20,0],line:{x1:"0",y1:"4",x2:"20",y2:"0"}},{positioning:"top-left",offset:[20,20],line:{x1:"20",y1:"4",x2:"0",y2:"-20"}},{positioning:"top-right",offset:[-20,20],line:{x1:"0",y1:"4",x2:"20",y2:"-20"}}],existingOverlays=vue.ref([]);function isOverlapping(t,e){return!(t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom)}function calculateBestPosition(t,e){const n=existingOverlays.value.filter(r=>r!==t).map(r=>{var i;return(i=r.getElement())==null?void 0:i.getBoundingClientRect()}).filter(r=>r!==void 0);for(const r of POSITION_PRIORITY){t.setPositioning(r.positioning),t.setOffset(r.offset),t.setPosition(e);const i=t.getElement();if(!i)continue;i.offsetHeight;const g=i.getBoundingClientRect();if(!n.some(k=>isOverlapping(g,k)))break}}function addOverlay(t,e,n,r){const i=new Overlay({element:n,positioning:"top-left",id:"label-"+(r==null?void 0:r.id),offset:[0,0],autoPan:!1,className:r.blinking?"ship-label-overlay-blinking":"ship-label-overlay"});i.set("class","zh-map-ship-overlay"),t.addOverlay(i),existingOverlays.value.push(i),vue.nextTick(async()=>{await calculateBestPosition(i,e),setLinePath(i)})}function setLinePath(t){const e=t.getElement(),n=e==null?void 0:e.querySelector(".ship-overlay-line"),r=t.getPositioning(),i=t.getOffset();n&&r==="top-right"&&(n.style.right="-20px"),n&&r==="top-left"&&(n.style.left="-20px");const g=POSITION_PRIORITY.filter(k=>k.positioning===r&&k.offset===i),y=e==null?void 0:e.querySelector(".ship-overlay-line line");if(g.length>0){const{x1:k,y1:L,x2:$,y2:V}=g[0].line;y&&(y.setAttribute("x1",k),y.setAttribute("y1",L),y.setAttribute("x2",$),y.setAttribute("y2",V))}}function removeLabelOverlay(t){existingOverlays.value=[],t.getOverlays().getArray().filter(r=>r.get("class")==="zh-map-ship-overlay").forEach(r=>{r.setPosition(void 0),r.setElement(void 0),t.removeOverlay(r),r.dispose()})}const getShipDirectPath=t=>{const{spd:e,hdg:n,cog:r}=t;return e?n!==null&&+n!=511&&r!==null?r-+n>=3?SHIP_DIRECT.right:r-+n<=-3?SHIP_DIRECT.left:SHIP_DIRECT.front:SHIP_DIRECT.front:""},createShipStyle=t=>{const{shipData:e}=t.getProperties(),n=getShipType(),r=getShipScale(e,n);return initShipStyle(t,r,n)},getShipType=()=>{const t=getZoom();return t<=MAP_ZOOM.shipModelMax&&t>=MAP_ZOOM.shipTriggleMin?"ship":"triangle"},getShipScale=(t,e)=>{if(e==="ship"){const{len:n,wid:r}=t,i=97,g=20,k=1/getView().getResolution(),L=n*k/i,$=r*k/g;return Math.max(L,$)}return MAP_ZOOM.scaleNum},initShipStyle=(t,e,n)=>{const{color:r,direct:i,isHighlight:g,shipData:y}=t.getProperties(),k=(y.cog-90+360)%360;return new Style({image:new Icon({src:L(),scale:e||MAP_ZOOM.scaleNum,anchor:[.5,.5],rotation:k*Math.PI/180,rotateWithView:!1})});function L(){return`data:image/svg+xml;utf8,${encodeURIComponent($())}`}function $(){switch(n){case"triangle":return`<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
135
135
  <path d="M30.8843 12.6777L2.21343 21.7067C1.75559 21.8509 1.28947 21.509 1.28947 21.029L1.28947 2.97103C1.28947 2.49102 1.75558 2.14913 2.21342 2.29331L30.8843 11.3223C31.5471 11.531 31.5471 12.469 30.8843 12.6777Z"
136
136
  fill="${r}" stroke="${g?"#FF2424":"black"}" stroke-width="${g?"2":"0.578947"}" />
137
137
  <!--path船航向左边或者向前-->
@@ -148,12 +148,12 @@ hooks.version="2.30.1",setHookCallback(createLocal),hooks.fn=proto,hooks.min=min
148
148
  ${i===SHIP_DIRECT.right&&`<path d="M86 10L96 10L96 14" stroke="${g?"#FF2424":"black"}" stroke-width="1.5"/>`}
149
149
  ${i===SHIP_DIRECT.front&&`<path d="M86 10L96 10" stroke="${g?"#FF2424":"black"}" stroke-width="1.5"/>`}
150
150
  </svg>
151
- `;default:return""}}},selectedShipStyle=t=>{const e=getShipType(),n=getShipScale(t,e),r=t.id,i=e==="ship"?109:49,g=`
152
- <svg style="transform:scale(${n});" xmlns="http://www.w3.org/2000/svg" width="${i}" height="${i}" viewBox="0 0 49 49" fill="none">
151
+ `;default:return""}}},selectedShipStyle=t=>{const e=selectedShipElement(t),n=t.id,{lon:r,lat:i}=t,g=new Overlay({element:e,position:fromLonLat([r,i]),id:"selected-"+n,positioning:"center-center",offset:[0,5],className:"ship-selected-overlay"});return g.set("class","ship-overlay-selected"),g},selectedShipElement=t=>{const e=getShipType(),n=getShipScale(t,e),r=e==="ship"?109:49,i=`
152
+ <svg style="transform:scale(${n});" xmlns="http://www.w3.org/2000/svg" width="${r}" height="${r}" viewBox="0 0 49 49" fill="none">
153
153
  <path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
154
154
  <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"/>
155
155
  </svg>
156
- `,y=document.createElement("div");y.className="ship-overlay-selected",y.innerHTML=g;const{lon:k,lat:L}=t,$=new Overlay({element:y,position:fromLonLat([k,L]),id:"selected-"+r,positioning:"center-center",offset:[0,5],className:"ship-selected-overlay"});return $.set("class","ship-overlay-selected"),$},createLabelStyle=t=>{const e=getInstall(),n=document.createElement("div");n.className="ship-overlay-box",n.style.zIndex="9",n.style.position="relative";const r=t.getProperties(),{shipData:i,blinking:g,blinkingColor:y,name:k}=r,{lon:L,lat:$}=i,V=vue.createVNode({setup(){return useShipOverlay({position:[L+.002,$+.002],selected:g,name:k,color:y,existDevice:i==null?void 0:i.existDevice,existMobile:i==null?void 0:i.existMobile,existWaterGauge:i==null?void 0:i.existWaterGauge})}});vue.render(V,n),addOverlay(e,fromLonLat([L,$]),n,i.id)};let selectedShipFeature=null,selectedShip=null;const shipsSource=new VectorSource,shipsLayer=new VectorLayer({source:shipsSource,className:"zh-map--ship-layer",updateWhileInteracting:!1,updateWhileAnimating:!1,renderBuffer:300,zIndex:101});let hoveredShipId="",attentionShips={},attentionShipsColor={};const renderShipList=t=>{console.log("renderShipList",t);const e=getInstall();if(!e)return;e.getLayers().getArray().includes(shipsLayer)||e.addLayer(shipsLayer);const n=(selectedShip==null?void 0:selectedShip.id)||(selectedShipFeature==null?void 0:selectedShipFeature.get("id"));removeLabelOverlay(e),removeSelectedOverlay(),shipsSource&&shipsSource.clear();const r=[];if(selectedShip){const i=t.filter(g=>g.id===n);i.length===0?t.push(selectedShip):selectedShip=i[0]}t.forEach(i=>{const g=fromLonLat([i.lon,i.lat]),y=new Feature({geometry:new Point(g),shipData:i,id:i.id,name:i.cnname||"未命名船舶",selected:i.id===n,rightIcons:getRightIcons(i),blinking:attentionShips[i.id]||!1,blinkingColor:attentionShipsColor[i.id]||"",color:i.fill||"#04C900",direct:getShipDirectPath(i),isHighlight:!1});y.setStyle(createShipStyle(y)),r.push(y),createLabelStyle(y)}),shipsSource.addFeatures(r),setTimeout(()=>{if(selectedShip){const i=selectedShipStyle(selectedShip);e.addOverlay(i)}},500)},clearShipList=()=>{const t=getInstall();if(!t||!shipsSource)return;const e=(selectedShip==null?void 0:selectedShip.id)||"";shipsSource.getFeatures().forEach(r=>{r.get("shipData").shipId!==e&&shipsSource.removeFeature(r)});const n=t.getOverlays().getArray();cloneDeep(n).map(r=>{(r.getId()!=="label-"+e||r.getId()!=="selected-"+e)&&(r.setPosition(void 0),r.setElement(void 0),t.removeOverlay(r),r.dispose())})},renderShipBlink=(t,e)=>{attentionShips=t,attentionShipsColor=e},filterShipShow=t=>{if(!getInstall())return;const n=shipsSource.getFeatures(),r=selectedShipFeature?selectedShipFeature.get("id"):"",i=n.filter(y=>y.getId()!==r),g=new Map;t.forEach(y=>{g.set(y.id,!0)}),i.forEach(y=>{const k=y.get("id");if(!g.has(k))y.setStyle([]);else{const L=y.getStyle();(L==null?void 0:L.length)==0&&y.setStyle(createShipStyle(y))}})},renderShipSelected=t=>{if(t){console.log("选中",t);const e=shipsSource.getFeatures().find(n=>n.get("id")===t.id);e&&(selectedShipFeature=e),selectedShip=t}else console.log("取消选中"),removeSelectedOverlay()},handleShipMapEvent=debounce((t,e,n)=>{const r=getInstall();if(t){const i=t.get("shipData"),g=t.get("id");if(r.getTargetElement().style.cursor=g?"pointer":"",e==="click"&&(renderShipSelected(i),n&&n(g)),e==="hover"){hoveredShipId&&hoveredShipId!==g&&clearHoverHight(),hoveredShipId=g;const y=shipsSource.getFeatures().find(k=>k.get("id")===hoveredShipId);y==null||y.set("isHighlight",!0),y==null||y.setStyle(createShipStyle(y))}}else r.getTargetElement().style.cursor="",clearHoverHight()},10),clearHoverHight=()=>{const t=hoveredShipId?shipsSource.getFeatures().find(e=>e.get("id")===hoveredShipId):null;hoveredShipId=null,t==null||t.set("isHighlight",!1),t==null||t.setStyle(createShipStyle(t))},removeSelectedOverlay=()=>{const t=getInstall();t.getOverlays().getArray().filter(r=>r.get("class")=="ship-overlay-selected").forEach(r=>{r.setPosition(void 0),r.setElement(void 0),t.removeOverlay(r),r.dispose()})};class FeatureFormat{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Feature,this.supportedMediaTypes=null}getReadOptions(e,n){if(n){let r=n.dataProjection?get$1(n.dataProjection):this.readProjection(e);n.extent&&r&&r.getUnits()==="tile-pixels"&&(r=get$1(r),r.setWorldExtent(n.extent)),n={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(n)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return abstract()}readFeature(e,n){return abstract()}readFeatures(e,n){return abstract()}readGeometry(e,n){return abstract()}readProjection(e){return abstract()}writeFeature(e,n){return abstract()}writeFeatures(e,n){return abstract()}writeGeometry(e,n){return abstract()}}function transformGeometryWithOptions(t,e,n){const r=n?get$1(n.featureProjection):null,i=n?get$1(n.dataProjection):null;let g=t;if(r&&i&&!equivalent(r,i)){e&&(g=t.clone());const y=e?r:i,k=e?i:r;y.getUnits()==="tile-pixels"?g.transform(y,k):g.applyTransform(getTransform(y,k))}if(e&&n&&n.decimals!==void 0){const y=Math.pow(10,n.decimals),k=function(L){for(let $=0,V=L.length;$<V;++$)L[$]=Math.round(L[$]*y)/y;return L};g===t&&(g=t.clone()),g.applyTransform(k)}return g}class TextFeature extends FeatureFormat{constructor(){super()}getType(){return"text"}readFeature(e,n){return this.readFeatureFromText(getText(e),this.adaptOptions(n))}readFeatureFromText(e,n){return abstract()}readFeatures(e,n){return this.readFeaturesFromText(getText(e),this.adaptOptions(n))}readFeaturesFromText(e,n){return abstract()}readGeometry(e,n){return this.readGeometryFromText(getText(e),this.adaptOptions(n))}readGeometryFromText(e,n){return abstract()}readProjection(e){return this.readProjectionFromText(getText(e))}readProjectionFromText(e){return this.dataProjection}writeFeature(e,n){return this.writeFeatureText(e,this.adaptOptions(n))}writeFeatureText(e,n){return abstract()}writeFeatures(e,n){return this.writeFeaturesText(e,this.adaptOptions(n))}writeFeaturesText(e,n){return abstract()}writeGeometry(e,n){return this.writeGeometryText(e,this.adaptOptions(n))}writeGeometryText(e,n){return abstract()}}function getText(t){return typeof t=="string"?t:""}function flipXY(t,e,n,r,i,g){i!==void 0?(i=i,g=g!==void 0?g:0):(i=[],g=0);let y=e;for(;y<n;){const k=t[y++];i[g++]=t[y++],i[g++]=k;for(let L=2;L<r;++L)i[g++]=t[y++]}return i.length=g,i}class Polyline extends TextFeature{constructor(e){super(),e=e||{},this.dataProjection=get$1("EPSG:4326"),this.factor_=e.factor?e.factor:1e5,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY"}readFeatureFromText(e,n){const r=this.readGeometryFromText(e,n);return new Feature(r)}readFeaturesFromText(e,n){return[this.readFeatureFromText(e,n)]}readGeometryFromText(e,n){const r=getStrideForLayout(this.geometryLayout_),i=decodeDeltas(e,r,this.factor_);flipXY(i,0,i.length,r,i);const g=inflateCoordinates(i,0,i.length,r),y=new LineString(g,this.geometryLayout_);return transformGeometryWithOptions(y,!1,this.adaptOptions(n))}writeFeatureText(e,n){const r=e.getGeometry();if(r)return this.writeGeometryText(r,n);throw new Error("Expected `feature` to have a geometry")}writeFeaturesText(e,n){return this.writeFeatureText(e[0],n)}writeGeometryText(e,n){e=transformGeometryWithOptions(e,!0,this.adaptOptions(n));const r=e.getFlatCoordinates(),i=e.getStride();return flipXY(r,0,r.length,i,r),encodeDeltas(r,i,this.factor_)}}function encodeDeltas(t,e,n){n=n||1e5;let r;const i=new Array(e);for(r=0;r<e;++r)i[r]=0;for(let g=0,y=t.length;g<y;)for(r=0;r<e;++r,++g){const k=t[g],L=k-i[r];i[r]=k,t[g]=L}return encodeFloats(t,n)}function decodeDeltas(t,e,n){n=n||1e5;let r;const i=new Array(e);for(r=0;r<e;++r)i[r]=0;const g=decodeFloats(t,n);for(let y=0,k=g.length;y<k;)for(r=0;r<e;++r,++y)i[r]+=g[y],g[y]=i[r];return g}function encodeFloats(t,e){e=e||1e5;for(let n=0,r=t.length;n<r;++n)t[n]=Math.round(t[n]*e);return encodeSignedIntegers(t)}function decodeFloats(t,e){e=e||1e5;const n=decodeSignedIntegers(t);for(let r=0,i=n.length;r<i;++r)n[r]/=e;return n}function encodeSignedIntegers(t){for(let e=0,n=t.length;e<n;++e){const r=t[e];t[e]=r<0?~(r<<1):r<<1}return encodeUnsignedIntegers(t)}function decodeSignedIntegers(t){const e=decodeUnsignedIntegers(t);for(let n=0,r=e.length;n<r;++n){const i=e[n];e[n]=i&1?~(i>>1):i>>1}return e}function encodeUnsignedIntegers(t){let e="";for(let n=0,r=t.length;n<r;++n)e+=encodeUnsignedInteger(t[n]);return e}function decodeUnsignedIntegers(t){const e=[];let n=0,r=0;for(let i=0,g=t.length;i<g;++i){const y=t.charCodeAt(i)-63;n|=(y&31)<<r,y<32?(e.push(n),n=0,r=0):r+=5}return e}function encodeUnsignedInteger(t){let e,n="";for(;t>=32;)e=(32|t&31)+63,n+=String.fromCharCode(e),t>>=5;return e=t+63,n+=String.fromCharCode(e),n}const convertSixHundredThousandToLatLng=function(t,e){const n=Number(e)/6e5;return[Number(t)/6e5,n]},stopIcon="&#xe6e2;",stopColor="#E31818",slowIcon="&#xe703;",slowColor="#1890FF",dropletsIcon="&#xe6d2",DEFAULT_VALUE="--";let moveFeatureHandler=null;const stopIconStyle=getIconStyle(stopIcon),slowIconStyle=getIconStyle(slowIcon),popupEle=document.createElement("div"),popupOverlay=new Overlay({element:popupEle,positioning:"top-left",stopEvent:!1,className:"track-label-overlay"});let polyline,linePath,startMarker,position,geoMarker,trackAnimating=!1,lastTime=Date.now(),vectorLayer$3,distance=0,thresholdNum=20;const routesSource=new VectorSource,routeLayer=new VectorLayer({source:routesSource,className:"zh-map--track-layer",zIndex:102});let routeFeatures=[],showTracks=[],allTracks={},trackId="",trackColor="",trackList=[],mapInstance$1=null;const reRenderTrackLine=()=>{mapInstance$1=getInstall(),handlerRenderLine()},renderTrackLine=async(t,e,n,r=LENGTH_UNIT.NM,i="ship",g=200)=>{if(mapInstance$1=getInstall(),!mapInstance$1)return;if(routeLayer==null||routeLayer.setVisible(!0),e=e==null?void 0:e.reverse(),popupOverlay&&i==="ship"&&(mapInstance$1!=null&&mapInstance$1.getOverlays().getArray().includes(popupOverlay)||mapInstance$1.addOverlay(popupOverlay)),clearShipList(),(e==null?void 0:e.length)<2){(showTracks==null?void 0:showTracks.findIndex(z=>z.id===t))<0&&showTracks.push({id:t,length:""});return}const y={};e.forEach(z=>{z.state?z.state=Number(z.state):delete z.state}),trackId=t,y[t]=e,trackList=e;const k=y[t].map(z=>transform([z.lon,z.lat],projection.data,projection.mercator)),L=new LineString(k),$=formatLength(L,r)||"--",V=showTracks==null?void 0:showTracks.findIndex(z=>z.id===t);V<0?showTracks.push({id:t,length:$}):showTracks[V].length=$,allTracks[t]=e,trackList=[],trackColor=n,thresholdNum=g,await handlerRenderLine(),await setTrackViewCenter(trackId)},handlerRenderLine=async()=>{const t=trackColor||"",e=trackId,n=allTracks[trackId]||[],r=thresholdNum||200,i=Math.max(1,Math.floor(n.length/r));trackList=n.filter((k,L)=>L%i===0).map((k,L)=>{if(Number(k.lon)>180||Number(k.lat)>180){const[$,V]=convertSixHundredThousandToLatLng(k.lon,k.lat);k.lon=$,k.lat=V}return k.center=[k.lon,k.lat],k.centerPoint=lonLatToMercator(k.center),k.id=e,k.index=L,k.time=hooks(k.createdAt).format("YYYY-MM-DD HH:mm:ss"),k});const y=trackList.map(k=>k.centerPoint);y.length>=2&&(mapInstance$1==null||mapInstance$1.addLayer(routeLayer),await createTrackLineFeature(e,y,t))},createTrackLineFeature=(t,e,n)=>{var y;const r=new LineString(e),i=new Feature({geometry:r});i.setStyle(createTrackLineStyle(n)),i.setId(t),i.set("type","line"),(y=routeLayer==null?void 0:routeLayer.getSource())==null||y.clear(),removeAllLabel(),routeFeatures=[];const g=routeFeatures.findIndex(k=>k.getId()===t);g>=0?routeFeatures[g]=i:routeFeatures.push(i),routesSource.addFeatures([...routeFeatures]),createPointFeature(n)},createTrackLineStyle=t=>new Style({stroke:new Stroke({color:t,width:2})}),handleTrackMapEvent=(t,e,n)=>{const r=t==null?void 0:t.get("trackId");if(t&&r&&e==="hover"){mapInstance$1.getTargetElement().style.cursor=r?"pointer":"";const i=t.get("data"),g=renderTrackPointHtml(i),y=n==null?void 0:n.coordinate;y&&(popupEle.querySelector(".popup-content"),popupEle.innerHTML=g,popupOverlay==null||popupOverlay.setPosition(y))}else popupOverlay&&popupOverlay.setPosition(void 0)},formatMinutesToDDHHMM=t=>{const e=hooks.duration(t,"minutes"),n=Math.floor(e.asDays()),r=e.hours(),i=e.minutes();let g=`${String(i).padStart(2,"0")}分`;return r!==0&&(g=`${String(r).padStart(2,"0")}时${g}`),n!==0&&(g=`${String(n).padStart(2,"0")}天${g}`),g},renderTrackPointHtml=t=>{if(!(t!=null&&t.time))return;let e="";return t!=null&&t.stayTime&&(e=`
156
+ `,g=document.createElement("div");return g.className="ship-overlay-selected",g.innerHTML=i,g},createLabelStyle=t=>{const e=getInstall(),{shipData:n,blinking:r}=t.getProperties(),{lon:i,lat:g}=n,y=createLabelElement(t);addOverlay(e,fromLonLat([i,g]),y,{...n,blinking:r})},createLabelElement=t=>{const e=document.createElement("div");e.className="ship-overlay-box",e.style.position="relative";const n=t.getProperties(),{shipData:r,blinking:i,blinkingColor:g,name:y}=n,{lon:k,lat:L}=r,$=vue.createVNode({setup(){return useShipOverlay({position:[k+.002,L+.002],selected:i,name:y,color:g,existDevice:r==null?void 0:r.existDevice,existMobile:r==null?void 0:r.existMobile,existWaterGauge:r==null?void 0:r.existWaterGauge})}});return vue.render($,e),e};let selectedShipFeature=null,selectedShip=null;const shipsSource=new VectorSource,shipsLayer=new VectorLayer({source:shipsSource,className:"zh-map--ship-layer",updateWhileInteracting:!1,updateWhileAnimating:!1,renderBuffer:300,zIndex:101});let hoveredShipId="",attentionShips={},attentionShipsColor={};const renderShipList=t=>{console.log("renderShipList",t);const e=getInstall();if(!e)return;e.getLayers().getArray().includes(shipsLayer)||e.addLayer(shipsLayer);const n=(selectedShip==null?void 0:selectedShip.id)||(selectedShipFeature==null?void 0:selectedShipFeature.get("id"));removeLabelOverlay(e),removeSelectedOverlay(),shipsSource&&shipsSource.clear();const r=[];if(selectedShip){const i=t.filter(g=>g.id===n);i.length===0?t.push(selectedShip):selectedShip=i[0]}t.forEach(i=>{const g=createShipFetature(i);r.push(g),createLabelStyle(g)}),shipsSource.addFeatures(r),handleChangeSelected()},createShipFetature=t=>{const e=(selectedShip==null?void 0:selectedShip.id)||(selectedShipFeature==null?void 0:selectedShipFeature.get("id")),n=fromLonLat([t.lon,t.lat]),r=new Feature({geometry:new Point(n),shipData:t,id:t.id,name:t.cnname||"未命名船舶",selected:t.id===e,rightIcons:getRightIcons(t),blinking:attentionShips[t.id]||!1,blinkingColor:attentionShipsColor[t.id]||"",color:t.fill||"#04C900",direct:getShipDirectPath(t),isHighlight:!1});return r.setStyle(createShipStyle(r)),r},handleChangeSelected=()=>{var r;if(!selectedShip)return;const t=getInstall();if(!t)return;const n=cloneDeep(t.getOverlays().getArray()).find(i=>i.get("class")=="ship-overlay-selected");if(console.log("selectedOverlay-----------",n),n){const i=selectedShipElement(selectedShip);n.setElement(i),n.setPosition(fromLonLat([selectedShip.lon,selectedShip.lat])),n.get("element").style.visibility="visible"}else{const i=selectedShipStyle(selectedShip);t.addOverlay(i)}(r=n.get("element"))!=null&&r.parentElement&&(n.get("element").parentElement.style.display="block")},clearShipList=()=>{const t=getInstall();if(!t||!shipsSource)return;const e=(selectedShip==null?void 0:selectedShip.id)||"";shipsSource.getFeatures().forEach(r=>{r.get("shipData").shipId!==e&&shipsSource.removeFeature(r)});const n=t.getOverlays().getArray();cloneDeep(n).map(r=>{(r.getId()!=="label-"+e||r.getId()!=="selected-"+e)&&(r.setPosition(void 0),t.removeOverlay(r),r.dispose())})},renderShipBlink=(t,e)=>{const n=getInstall();attentionShips=t,attentionShipsColor=e;const r=cloneDeep(n.getOverlays().getArray()),i=cloneDeep(shipsSource.getFeatures());for(const g in attentionShips){const y=attentionShips[g],k=r.find($=>$.getId()==="label-"+g),L=i.find($=>g===$.get("id"));if(k&&L){L.set("blinking",y),L.set("blinkingColor",attentionShipsColor[g]||"");const $=k.getElement(),V=createLabelElement(L),z=V.querySelector(".ship-overlay-line"),re=$==null?void 0:$.querySelector(".ship-overlay-line");$&&$!==V&&(re&&z&&z.replaceWith(re),k.setElement(V))}}},filterShipShow=t=>{const e=getInstall();if(!e)return;const n=shipsSource.getFeatures(),r=selectedShipFeature?selectedShipFeature.get("id"):"",i=n.filter(k=>k.get("id")!==r),g=new Map;t.forEach(k=>{g.set(k.id,!0)});const y=cloneDeep(e.getOverlays().getArray());i.forEach(k=>{const L=k.get("id"),$=y.find(V=>V.getId()==="label-"+L);if(!g.has(L))k.setStyle([]),$&&($.get("element").style.visibility="hidden");else{$&&($.get("element").style.visibility="visible");const V=k.getStyle();(V==null?void 0:V.length)==0&&k.setStyle(createShipStyle(k))}})},renderShipSelected=t=>{if(t){console.log("选中",t);const e=shipsSource.getFeatures().find(n=>n.get("id")===t.id);e&&(selectedShipFeature=e),selectedShip=t}else console.log("取消选中"),selectedShip=null,removeSelectedOverlay()},renderShipSelectedChange=()=>{console.log("selectedShip------------------",selectedShip);const t=shipsSource.getFeatures().find(e=>e.get("id")===(selectedShip==null?void 0:selectedShip.id));if(console.log("hasShipFetature------------------",t),t)hasShip==null||hasShip.setStyle(createShipStyle(hasShip)),createLabelStyle(hasShip);else{const e=createShipFetature(selectedShip);shipsSource.addFeature(e),createLabelStyle(e)}handleChangeSelected()},handleShipMapEvent=debounce((t,e,n)=>{const r=getInstall();if(t){const i=t.get("shipData"),g=t.get("id");if(r.getTargetElement().style.cursor=g?"pointer":"",e==="click"&&(renderShipSelected(i),n&&n(g)),e==="hover"){hoveredShipId&&hoveredShipId!==g&&clearHoverHight(),hoveredShipId=g;const y=shipsSource.getFeatures().find(k=>k.get("id")===hoveredShipId);y==null||y.set("isHighlight",!0),y==null||y.setStyle(createShipStyle(y))}}else r.getTargetElement().style.cursor="",clearHoverHight()},10),clearHoverHight=()=>{const t=hoveredShipId?shipsSource.getFeatures().find(e=>e.get("id")===hoveredShipId):null;hoveredShipId=null,t==null||t.set("isHighlight",!1),t==null||t.setStyle(createShipStyle(t))},removeSelectedOverlay=()=>{try{const t=getInstall(),n=cloneDeep(t.getOverlays().getArray()).find(r=>r.get("class")=="ship-overlay-selected");n&&n.get("element")&&(n.get("element").style.visibility="hidden")}catch(t){console.log(t)}},stopIcon="&#xe6e2;",stopColor="#E31818",slowIcon="&#xe703;",slowColor="#1890FF",dropletsIcon="&#xe6d2",DEFAULT_VALUE="--";let moveFeatureHandler=null;const stopIconStyle=getIconStyle(stopIcon),slowIconStyle=getIconStyle(slowIcon),popupEle=document.createElement("div"),popupOverlay=new Overlay({element:popupEle,positioning:"top-left",stopEvent:!1,className:"track-label-popup"});let polyline,linePath,startMarker,position,geoMarker,trackAnimating=!1,lastTime=Date.now(),vectorLayer$3,distance=0,thresholdNum=20;const routesSource=new VectorSource,routeLayer=new VectorLayer({source:routesSource,className:"zh-map--track-layer",zIndex:102});let routeFeatures=[],showTracks=[],allTracks={},trackId="",trackColor="",trackList=[],mapInstance$1=null,isClosing=!1;const reRenderTrackLine=()=>{mapInstance$1=getInstall(),isClosing||handlerRenderLine()},renderTrackLine=async(t,e,n,r=LENGTH_UNIT.NM,i="ship",g=200)=>{if(mapInstance$1=getInstall(),!mapInstance$1)return;if(routeLayer==null||routeLayer.setVisible(!0),e=e==null?void 0:e.reverse(),popupOverlay&&i==="ship"&&(mapInstance$1!=null&&mapInstance$1.getOverlays().getArray().includes(popupOverlay)||mapInstance$1.addOverlay(popupOverlay)),renderShipSelectedChange(),isClosing=!1,(e==null?void 0:e.length)<2){(showTracks==null?void 0:showTracks.findIndex(z=>z.id===t))<0&&showTracks.push({id:t,length:""});return}const y={};e.forEach(z=>{z.state?z.state=Number(z.state):delete z.state}),trackId=t,y[t]=e,trackList=e;const k=y[t].map(z=>transform([z.lon,z.lat],projection.data,projection.mercator)),L=new LineString(k),$=formatLength(L,r)||"--";console.log("length",formatLength(L,r));const V=showTracks==null?void 0:showTracks.findIndex(z=>z.id===t);V<0?showTracks.push({id:t,length:$}):showTracks[V].length=$,console.log("showTracks",showTracks),allTracks[t]=e,trackList=[],trackColor=n,thresholdNum=g,await handlerRenderLine(),await setTrackViewCenter(trackId)},handlerRenderLine=async()=>{const t=trackColor||"",e=trackId,n=allTracks[trackId]||[],r=thresholdNum||200,i=Math.max(1,Math.floor(n.length/r));trackList=n.filter((k,L)=>L%i===0).map((k,L)=>{if(Number(k.lon)>180||Number(k.lat)>180){const[$,V]=convertSixHundredThousandToLatLng(k.lon,k.lat);k.lon=$,k.lat=V}return k.center=[k.lon,k.lat],k.centerPoint=lonLatToMercator(k.center),k.id=e,k.index=L,k.time=hooks(k.createdAt).format("YYYY-MM-DD HH:mm:ss"),k});const y=trackList.map(k=>k.centerPoint);y.length>=2&&(mapInstance$1==null||mapInstance$1.addLayer(routeLayer),await createTrackLineFeature(e,y,t))},createTrackLineFeature=(t,e,n)=>{var y;const r=new LineString(e),i=new Feature({geometry:r});i.setStyle(createTrackLineStyle(n)),i.setId(t),i.set("type","line"),(y=routeLayer==null?void 0:routeLayer.getSource())==null||y.clear(),removeAllLabel(),routeFeatures=[];const g=routeFeatures.findIndex(k=>k.getId()===t);g>=0?routeFeatures[g]=i:routeFeatures.push(i),routesSource.addFeatures([...routeFeatures]),createPointFeature(n)},createTrackLineStyle=t=>new Style({stroke:new Stroke({color:t,width:2})}),handleTrackMapEvent=(t,e,n)=>{const r=t==null?void 0:t.get("trackId");if(t&&r&&e==="hover"){mapInstance$1.getTargetElement().style.cursor=r?"pointer":"";const i=t.get("data"),g=renderTrackPointHtml(i),y=n==null?void 0:n.coordinate;y&&(popupEle.querySelector(".popup-content"),popupEle.innerHTML=g,popupOverlay==null||popupOverlay.setPosition(y))}else popupOverlay&&popupOverlay.setPosition(void 0)},formatMinutesToDDHHMM=t=>{const e=hooks.duration(t,"minutes"),n=Math.floor(e.asDays()),r=e.hours(),i=e.minutes();let g=`${String(i).padStart(2,"0")}分`;return r!==0&&(g=`${String(r).padStart(2,"0")}时${g}`),n!==0&&(g=`${String(n).padStart(2,"0")}天${g}`),g},renderTrackPointHtml=t=>{if(!(t!=null&&t.time))return;let e="";return t!=null&&t.stayTime&&(e=`
157
157
  <div class="item w-100">
158
158
  <div class="item-label">停泊时间约</div>
159
159
  <div class="item-item">${formatMinutesToDDHHMM(Number(t.stayTime))}</div>
@@ -189,7 +189,7 @@ hooks.version="2.30.1",setHookCallback(createLocal),hooks.fn=proto,hooks.min=min
189
189
  <div class="item-item">${t.time}</div>
190
190
  </div>
191
191
  ${e??e}
192
- </div>`},createPointFeature=t=>{const e=trackList||[];if(!(e&&e.length>1))return[];const n={16:24,17:15,default:4},r=[],i=e.length;for(let y=0;y<i;y++){e[y].index=y;const k=mapInstance$1==null?void 0:mapInstance$1.getPixelFromCoordinate(e[y].centerPoint);if(k){let L=k.concat(k);L=adjustBounds(L,[20,20]);const $=mapInstance$1==null?void 0:mapInstance$1.getView().getZoom();if(!$)return;if($>15){const z=n[$]||n.default;L=adjustBounds(L,[z,z])}let V=!0;if(e[y].state!=="0"){for(let z=0;z<r.length;z++)if(isOverlapping$1(L,r[z].bounds)){V=!1;break}}V&&(e[y].bounds=L,r.push(e[y]))}}const g=[];r.forEach(y=>{const k=new Feature({geometry:new Point(y.centerPoint),time:y.time});k.set("type","track_point"),k.set("trackId",y.id),k.set("data",y),k.setStyle(createPointStyle(t)),g.push(k),typeof y=="object"&&Object.prototype.hasOwnProperty.call(y,"state")&&createIconFeature(y)}),routesSource.addFeatures(g),g.forEach(y=>{const k=y.getProperties().data,L=createPointLabelOverlay(t,k);mapInstance$1==null||mapInstance$1.addOverlay(L)}),createArrowFetaure(r,t),createIconPointFeature()},createPointLabelOverlay=(t,e)=>{const n=document.createElement("div");n.className="track-overlay-label",n.style.position="relative",n.style.backgroundColor="rgba(255,255,255,0.8)",n.style.border=`1px solid ${t}`,n.style.fontSize="12px",n.innerHTML=`
192
+ </div>`},createPointFeature=t=>{const e=trackList||[];if(!(e&&e.length>1))return[];const n={16:24,17:15,default:4},r=[],i=e.length;for(let y=0;y<i;y++){e[y].index=y;const k=mapInstance$1==null?void 0:mapInstance$1.getPixelFromCoordinate(e[y].centerPoint);if(k){let L=k.concat(k);L=adjustBounds(L,[20,20]);const $=mapInstance$1==null?void 0:mapInstance$1.getView().getZoom();if(!$)return;if($>15){const z=n[$]||n.default;L=adjustBounds(L,[z,z])}let V=!0;if(e[y].state!=="0"){for(let z=0;z<r.length;z++)if(isOverlapping$1(L,r[z].bounds)){V=!1;break}}V&&(e[y].bounds=L,r.push(e[y]))}}const g=[];r.forEach(y=>{const k=new Feature({geometry:new Point(y.centerPoint),time:y.time});k.set("type","track_point"),k.set("trackId",y.id),k.set("data",y),k.setStyle(createPointStyle(t)),g.push(k),typeof y=="object"&&Object.prototype.hasOwnProperty.call(y,"state")&&createIconFeature(y)}),routesSource.addFeatures(g),console.log("createPointLabelOverlay---------------"),g.forEach(y=>{const k=y.getProperties().data,L=createPointLabelOverlay(t,k);mapInstance$1==null||mapInstance$1.addOverlay(L)}),createArrowFetaure(r,t),createIconPointFeature()},createPointLabelOverlay=(t,e)=>{const n=document.createElement("div");n.className="track-overlay-label",n.style.position="relative",n.style.backgroundColor="rgba(255,255,255,0.8)",n.style.border=`1px solid ${t}`,n.style.fontSize="12px",n.innerHTML=`
193
193
  <span>${e.time}</span>
194
194
  <svg
195
195
  style="position: absolute;left: -20px;top: 0;"
@@ -201,7 +201,7 @@ hooks.version="2.30.1",setHookCallback(createLocal),hooks.fn=proto,hooks.min=min
201
201
  x2="20" y2="0"
202
202
  stroke="${t}"
203
203
  stroke-width="1" />
204
- `;const r=new Overlay({element:n,position:fromLonLat(e.center),positioning:"top-left",offset:[20,-20],className:"track-label-time-overlay"});return r.set("class","track-label-overlay"),r},removeAllLabel=()=>{const t=mapInstance$1==null?void 0:mapInstance$1.getOverlays().getArray(),e=t==null?void 0:t.filter(n=>n.get("class")==="track-label-overlay");e&&e.length>0&&e.forEach(n=>{n.setPosition(void 0),n.setElement(void 0),mapInstance$1==null||mapInstance$1.removeOverlay(n),n.dispose()})},createPointStyle=t=>[new Style({image:new CircleStyle({stroke:new Stroke({color:"rgba(0, 0, 0, 0.01)",width:20}),radius:3})}),new Style({image:new CircleStyle({fill:new Fill({color:t}),stroke:new Stroke({color:"#fff",width:2}),radius:3})})],createIconFeature=t=>{const e=new Feature({geometry:new Point([t.lon,t.lat]),time:t.time});e.set("type","track_icon");const n=new Style({text:new Text({font:"Normal 22px map-iconfont",text:getIconFont(dropletsIcon),offsetY:-10,fill:new Fill({color:Number(t.state)===0?stopColor:Number(t.state)===1?slowColor:""})}),zIndex:99}),r=[];Number(t.state)===0?r.push(stopIconStyle):Number(t.state)===1&&r.push(slowIconStyle),r.push(n),e.setStyle(r),routesSource.addFeature(e)},createArrowFetaure=(t,e)=>{const n=t||[],r=t.length;r||(n.push(trackList[0]),n.push(trackList[trackList.length-1]));for(let i=0;i<r-1;i++){let g;const y=t[i],k=(t[i+1].index+y.index)/2;if(k%2===0)g=trackList[k].centerPoint;else{const L=trackList[Math.floor(k)],$=trackList[Math.ceil(k)];if(L&&$){const[V,z]=L.centerPoint,[re,oe]=$.centerPoint;g=[(V+re)/2,(z+oe)/2]}}if(g){const L=new Feature({geometry:new Point(g)});L.set("type","track_arrow"),L.setStyle(new Style({text:new Text({font:"700 14px map-iconfont",text:getIconFont("&#xe6bc;"),fill:new Fill({color:e}),rotation:getRotation(t[i].center,t[i+1].center)*(Math.PI/180)})})),routesSource==null||routesSource.addFeature(L)}}},setTrackViewCenter=t=>{var i;const e=mapInstance$1.getView(),n=t?routeFeatures.find(g=>g.getId()===t):routeFeatures[0];if(!n)return;const r=(i=n==null?void 0:n.getGeometry())==null?void 0:i.getExtent();if(r!=null&&r.length)try{const g=buffer(r,Math.max(r[2]-r[0],r[3]-r[1])*.02);e.fit(g)}catch(g){console.log(g)}},createIconPointFeature=()=>{const t="&#xe69b;",e="#fcdc3f",n="#ff0000";(trackList.length<2?[trackList[0]]:[trackList[0],trackList[trackList.length-1]]).forEach(i=>{const g=new Feature({geometry:new Point(i.centerPoint)});g.set("type","track_begin"),g.set("data",i);const y=i.index===0&&trackList.length>=2?e:n;g.setStyle(new Style({text:new Text({font:"Normal 14px map-iconfont",text:getIconFont(t),fill:new Fill({color:y})}),zIndex:101})),routesSource.addFeature(g)})},geoMarkerStyle=new Style({text:new Text({font:"700 20px map-iconfont",text:getIconFont("&#xe657;"),fill:new Fill({color:"#ff0000"}),rotation:0})}),playShipTrack=(t,e)=>{handlePlay(String(t),e)},removeAllTrackLayer=()=>{showTracks=[],allTracks={},routesSource==null||routesSource.clear()},closeTrack=(t=!1)=>{routeLayer==null||routeLayer.setVisible(!1),t&&removeAllTrackLayer(),stopAnimation()},handlePlay=(t,e)=>{const n=allTracks[String(t)];playAnimation(n==null?void 0:n.map(r=>[r.lon,r.lat]),e)},moveFeature=(t,e)=>{var z,re;const n=Number(50*e),r=((z=t.frameState)==null?void 0:z.time)??Date.now(),i=r-lastTime;if(distance=(distance+n*i/1e6)%2,lastTime=r,distance>=1){stopAnimation();return}const g=linePath.getCoordinateAt(distance>1?2-distance:distance),y=linePath.getCoordinateAt(distance>1?distance-.01:distance),k=linePath.getCoordinateAt(distance>1?2-distance:distance+.01),$=getRotation(mercatorToLonLat(y,"array"),mercatorToLonLat(k,"array"))*Math.PI/180;(re=geoMarkerStyle.getText())==null||re.setRotation($),position.setCoordinates(g);const V=getVectorContext(t);V.setStyle(geoMarkerStyle),V.drawGeometry(position),mapInstance$1==null||mapInstance$1.render()},startAnimation=()=>{var t;trackAnimating=!0,lastTime=Date.now(),distance=0,position=((t=startMarker.getGeometry())==null?void 0:t.clone())||new Point([0,0]),moveFeatureHandler&&(vectorLayer$3==null||vectorLayer$3.on("postrender",moveFeatureHandler)),geoMarker==null||geoMarker.setGeometry(void 0)},stopAnimation=()=>{trackAnimating&&(trackAnimating=!1,geoMarker==null||geoMarker.setGeometry(void 0),moveFeatureHandler&&vectorLayer$3&&vectorLayer$3.un("postrender",moveFeatureHandler),vectorLayer$3&&(mapInstance$1==null||mapInstance$1.removeLayer(vectorLayer$3)),vectorLayer$3=null,geoMarker=null)},playAnimation=(t,e)=>{trackAnimating&&stopAnimation(),polyline=new Polyline({factor:1e6}).writeGeometry(new LineString(t)),linePath=new Polyline({factor:1e6}).readGeometry(polyline,{dataProjection:projection.data,featureProjection:projection.mercator}),startMarker=new Feature({type:"icon",geometry:new Point(linePath.getFirstCoordinate())});const n=startMarker.getGeometry();position=n?n.clone():new Point([0,0]),geoMarker=new Feature({type:"geoMarker",style:geoMarkerStyle,geometry:position}),vectorLayer$3=new VectorLayer({source:new VectorSource({features:[geoMarker]})}),mapInstance$1==null||mapInstance$1.addLayer(vectorLayer$3),moveFeatureHandler=r=>moveFeature(r,e),startAnimation()},getRotation=(t,e,n)=>{function r(z){return 180*(z%(2*Math.PI))/Math.PI}function i(z){return z%360*Math.PI/180}function g(z){var re;if(!z)throw new Error("Coordinate is required");if(!Array.isArray(z)){if((z==null?void 0:z.type)==="Feature"&&(z==null?void 0:z.geometry)!==null&&((re=z==null?void 0:z.geometry)==null?void 0:re.type)==="Point")return z==null?void 0:z.geometry.coordinates;if(z.type==="Point")return(z==null?void 0:z.coordinates)||[]}if(Array.isArray(z)&&z.length>=2&&!Array.isArray(z[0])&&!Array.isArray(z[1]))return z;throw new Error("Coordinate must be GeoJSON Point or an Array of numbers")}function y(z,re,oe={}){if(oe.final)return function(_e,Ce){return(y(Ce,_e)+180)%360}(z,re);const j=g(z),ie=g(re),ae=i(j[0]),ue=i(ie[0]),de=i(j[1]),pe=i(ie[1]),le=Math.sin(ue-ae)*Math.cos(pe),he=Math.cos(de)*Math.sin(pe)-Math.sin(de)*Math.cos(pe)*Math.cos(ue-ae);return r(Math.atan2(le,he))}function k(z){return!isNaN(z)&&z!==null&&!Array.isArray(z)}function L(z,re={},oe={}){return z||console.log("Coordinates are required"),Array.isArray(z)||console.log("Coordinates must be an Array"),z.length<2&&console.log("Coordinates must be at least 2 numbers long"),(!k(z[0])||!k(z[1]))&&console.log("Coordinates must contain numbers"),$({type:"Point",coordinates:z},re,oe)}function $(z,re={},oe={}){const j={type:"Feature",id:"",properties:{},bbox:{},geometry:{}};return oe.id!==void 0&&(j.id=oe.id),oe.bbox&&(j.bbox=oe.bbox),j.properties=re,j.geometry=z,j}const V=y(L(t),L(e),n);return V<0?360+V:V},PORT_LAYER_CLASS_NAME="zh-map-port-layer";let vectorLayer$2,vectorSource$2;const renderPortList=t=>{var n;if(!t||t.length===0)return;const e=getZoom();vectorSource$2||(vectorSource$2=new VectorSource),t.forEach(r=>{if((selectedPortFeature==null?void 0:selectedPortFeature.get("portData").id)===r.id)return;const[i,g]=r.latLon.split(","),y=new Feature({geometry:new Point(fromLonLat([Number(i),Number(g)]))});y.setStyle(setPortStyle(r,e,!1)),y.set("portData",r),vectorSource$2.addFeature(y)}),vectorLayer$2||(vectorLayer$2=new VectorLayer({className:PORT_LAYER_CLASS_NAME,source:vectorSource$2,zIndex:100}),(n=getInstall())==null||n.addLayer(vectorLayer$2))},setPortStyle=(t,e,n)=>{const r=g=>`<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
204
+ `;const r=new Overlay({element:n,position:fromLonLat(e.center),positioning:"top-left",offset:[20,-20],stopEvent:!1,className:"track-label-time-overlay"});return r.set("class","track-label-overlay"),r},removeAllLabel=()=>{const t=cloneDeep(mapInstance$1==null?void 0:mapInstance$1.getOverlays().getArray()),e=t==null?void 0:t.filter(n=>n.get("class")==="track-label-overlay");e&&e.length>0&&e.forEach(n=>{n.setPosition(void 0),n.setElement(void 0),mapInstance$1==null||mapInstance$1.removeOverlay(n),n.dispose()})},createPointStyle=t=>[new Style({image:new CircleStyle({stroke:new Stroke({color:"rgba(0, 0, 0, 0.01)",width:20}),radius:3})}),new Style({image:new CircleStyle({fill:new Fill({color:t}),stroke:new Stroke({color:"#fff",width:2}),radius:3})})],createIconFeature=t=>{const e=new Feature({geometry:new Point([t.lon,t.lat]),time:t.time});e.set("type","track_icon");const n=new Style({text:new Text({font:"Normal 22px map-iconfont",text:getIconFont(dropletsIcon),offsetY:-10,fill:new Fill({color:Number(t.state)===0?stopColor:Number(t.state)===1?slowColor:""})}),zIndex:99}),r=[];Number(t.state)===0?r.push(stopIconStyle):Number(t.state)===1&&r.push(slowIconStyle),r.push(n),e.setStyle(r),routesSource.addFeature(e)},createArrowFetaure=(t,e)=>{const n=t||[],r=t.length;r||(n.push(trackList[0]),n.push(trackList[trackList.length-1]));for(let i=0;i<r-1;i++){let g;const y=t[i],k=(t[i+1].index+y.index)/2;if(k%2===0)g=trackList[k].centerPoint;else{const L=trackList[Math.floor(k)],$=trackList[Math.ceil(k)];if(L&&$){const[V,z]=L.centerPoint,[re,oe]=$.centerPoint;g=[(V+re)/2,(z+oe)/2]}}if(g){const L=new Feature({geometry:new Point(g)});L.set("type","track_arrow"),L.setStyle(new Style({text:new Text({font:"700 14px map-iconfont",text:getIconFont("&#xe6bc;"),fill:new Fill({color:e}),rotation:getRotation(t[i].center,t[i+1].center)*(Math.PI/180)})})),routesSource==null||routesSource.addFeature(L)}}},setTrackViewCenter=t=>{var i;const e=mapInstance$1.getView(),n=t?routeFeatures.find(g=>g.getId()===t):routeFeatures[0];if(!n)return;const r=(i=n==null?void 0:n.getGeometry())==null?void 0:i.getExtent();if(r!=null&&r.length)try{const g=buffer(r,Math.max(r[2]-r[0],r[3]-r[1])*.02);e.fit(g)}catch(g){console.log(g)}},createIconPointFeature=()=>{const t="&#xe69b;",e="#fcdc3f",n="#ff0000";(trackList.length<2?[trackList[0]]:[trackList[0],trackList[trackList.length-1]]).forEach(i=>{const g=new Feature({geometry:new Point(i.centerPoint)});g.set("type","track_begin"),g.set("data",i);const y=i.index===0&&trackList.length>=2?e:n;g.setStyle(new Style({text:new Text({font:"Normal 14px map-iconfont",text:getIconFont(t),fill:new Fill({color:y})}),zIndex:101})),routesSource.addFeature(g)})},geoMarkerStyle=new Style({text:new Text({font:"700 20px map-iconfont",text:getIconFont("&#xe657;"),fill:new Fill({color:"#ff0000"}),rotation:0})}),playShipTrack=(t,e)=>{handlePlay(String(t),e)},removeAllTrackLayer=()=>{showTracks=[],allTracks={},routesSource==null||routesSource.clear()},closeTrack=(t=!1)=>{routeLayer==null||routeLayer.setVisible(!1);const e=getInstall();cloneDeep(e.getOverlays().getArray()).forEach(r=>{r.get("class")==="track-label-overlay"&&(r.setPosition(void 0),e.removeOverlay(r),r.dispose())}),t&&removeAllTrackLayer(),stopAnimation(),isClosing=!0},getShowTracks=()=>showTracks,handlePlay=(t,e)=>{const n=allTracks[String(t)];playAnimation(n==null?void 0:n.map(r=>[r.lon,r.lat]),e)},moveFeature=(t,e)=>{var z,re;const n=Number(50*e),r=((z=t.frameState)==null?void 0:z.time)??Date.now(),i=r-lastTime;if(distance=(distance+n*i/1e6)%2,lastTime=r,distance>=1){stopAnimation();return}const g=linePath.getCoordinateAt(distance>1?2-distance:distance),y=linePath.getCoordinateAt(distance>1?distance-.01:distance),k=linePath.getCoordinateAt(distance>1?2-distance:distance+.01),$=getRotation(mercatorToLonLat(y,"array"),mercatorToLonLat(k,"array"))*Math.PI/180;(re=geoMarkerStyle.getText())==null||re.setRotation($),position.setCoordinates(g);const V=getVectorContext(t);V.setStyle(geoMarkerStyle),V.drawGeometry(position),mapInstance$1==null||mapInstance$1.render()},startAnimation=()=>{var t;trackAnimating=!0,lastTime=Date.now(),distance=0,position=((t=startMarker.getGeometry())==null?void 0:t.clone())||new Point([0,0]),moveFeatureHandler&&(vectorLayer$3==null||vectorLayer$3.on("postrender",moveFeatureHandler)),geoMarker==null||geoMarker.setGeometry(void 0)},stopAnimation=()=>{trackAnimating&&(trackAnimating=!1,geoMarker==null||geoMarker.setGeometry(void 0),moveFeatureHandler&&vectorLayer$3&&vectorLayer$3.un("postrender",moveFeatureHandler),vectorLayer$3&&(mapInstance$1==null||mapInstance$1.removeLayer(vectorLayer$3)),vectorLayer$3=null,geoMarker=null)},playAnimation=(t,e)=>{trackAnimating&&stopAnimation(),polyline=new Polyline({factor:1e6}).writeGeometry(new LineString(t)),linePath=new Polyline({factor:1e6}).readGeometry(polyline,{dataProjection:projection.data,featureProjection:projection.mercator}),startMarker=new Feature({type:"icon",geometry:new Point(linePath.getFirstCoordinate())});const n=startMarker.getGeometry();position=n?n.clone():new Point([0,0]),geoMarker=new Feature({type:"geoMarker",style:geoMarkerStyle,geometry:position}),vectorLayer$3=new VectorLayer({source:new VectorSource({features:[geoMarker]})}),mapInstance$1==null||mapInstance$1.addLayer(vectorLayer$3),moveFeatureHandler=r=>moveFeature(r,e),startAnimation()},getRotation=(t,e,n)=>{function r(z){return 180*(z%(2*Math.PI))/Math.PI}function i(z){return z%360*Math.PI/180}function g(z){var re;if(!z)throw new Error("Coordinate is required");if(!Array.isArray(z)){if((z==null?void 0:z.type)==="Feature"&&(z==null?void 0:z.geometry)!==null&&((re=z==null?void 0:z.geometry)==null?void 0:re.type)==="Point")return z==null?void 0:z.geometry.coordinates;if(z.type==="Point")return(z==null?void 0:z.coordinates)||[]}if(Array.isArray(z)&&z.length>=2&&!Array.isArray(z[0])&&!Array.isArray(z[1]))return z;throw new Error("Coordinate must be GeoJSON Point or an Array of numbers")}function y(z,re,oe={}){if(oe.final)return function(_e,Ce){return(y(Ce,_e)+180)%360}(z,re);const j=g(z),ie=g(re),ae=i(j[0]),ue=i(ie[0]),de=i(j[1]),pe=i(ie[1]),le=Math.sin(ue-ae)*Math.cos(pe),he=Math.cos(de)*Math.sin(pe)-Math.sin(de)*Math.cos(pe)*Math.cos(ue-ae);return r(Math.atan2(le,he))}function k(z){return!isNaN(z)&&z!==null&&!Array.isArray(z)}function L(z,re={},oe={}){return z||console.log("Coordinates are required"),Array.isArray(z)||console.log("Coordinates must be an Array"),z.length<2&&console.log("Coordinates must be at least 2 numbers long"),(!k(z[0])||!k(z[1]))&&console.log("Coordinates must contain numbers"),$({type:"Point",coordinates:z},re,oe)}function $(z,re={},oe={}){const j={type:"Feature",id:"",properties:{},bbox:{},geometry:{}};return oe.id!==void 0&&(j.id=oe.id),oe.bbox&&(j.bbox=oe.bbox),j.properties=re,j.geometry=z,j}const V=y(L(t),L(e),n);return V<0?360+V:V},PORT_LAYER_CLASS_NAME="zh-map-port-layer";let vectorLayer$2,vectorSource$2;const renderPortList=t=>{var e;if(!(!t||t.length===0)){if(vectorSource$2||(vectorSource$2=new VectorSource),vectorSource$2.clear(),selectedPortData){const n=t.find(r=>r.id===selectedPortData.id);n?selectedPortData=n:t.push(selectedPortData)}t.forEach(n=>{renderPortPoint(n)}),vectorLayer$2||(vectorLayer$2=new VectorLayer({className:PORT_LAYER_CLASS_NAME,source:vectorSource$2,zIndex:100}),(e=getInstall())==null||e.addLayer(vectorLayer$2))}},renderPortPoint=t=>{const e=getZoom(),[n,r]=t.latLon.split(","),i=new Feature({geometry:new Point(fromLonLat([Number(n),Number(r)]))});i.setStyle(setPortStyle(t,e,t.id===(selectedPortData==null?void 0:selectedPortData.id))),i.set("portData",t),vectorSource$2.addFeature(i)},setPortStyle=(t,e,n)=>{const r=g=>`<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
205
205
  <path fill-rule="evenodd" clip-rule="evenodd" d="M22.6563 44.9304C22.5453 44.8844 22.4445 44.817 22.3595 44.7321C22.3595 44.7321 9.36986 31.7424 9.32952 31.6913C7.09059 29.0791 5.64794 25.8802 5.17255 22.4736C4.69716 19.0671 5.20896 15.5957 6.64728 12.471C8.08561 9.34625 10.3902 6.69909 13.2878 4.84325C16.1855 2.98741 19.5548 2.00068 22.9965 2C26.4381 1.99932 29.8078 2.98473 32.7062 4.83943C35.6046 6.69414 37.9102 9.34039 39.3498 12.4646C40.7893 15.5888 41.3025 19.0599 40.8284 22.4666C40.3544 25.8734 38.913 29.0729 36.6751 31.686C36.6401 31.737 23.6531 44.7321 23.6531 44.7321C23.5682 44.817 23.4674 44.8844 23.3564 44.9304C23.2454 44.9763 23.1265 45 23.0063 45C22.8862 45 22.7673 44.9763 22.6563 44.9304Z" fill="${g}"/>
206
206
  <g clip-path="url(#clip0_10059_122082)">
207
207
  <path d="M34.8624 22.8687L32.5874 25.6313L33.4812 25.7125C33.4812 25.7125 30.5562 28.0687 27.9562 28.2312C25.3562 28.3937 24.1374 24.9 24.1374 24.9V19.1312H27.6312V17.425H24.2999V15.15C25.7624 14.6625 26.7374 13.2812 26.7374 11.6562C26.7374 9.625 25.1124 8 23.0812 8H22.9999C20.9687 8 19.3437 9.625 19.3437 11.6562C19.3437 13.2812 20.3999 14.6625 21.7812 15.15V17.425H18.4499V19.1312H21.9437V24.9C21.9437 24.9 20.6437 28.3125 18.0437 28.2312C15.4437 28.0687 12.5187 25.7125 12.5187 25.7125L13.4124 25.6313L11.0562 22.8687L10.2437 26.2812L11.2187 26.0375C11.2187 26.0375 13.1687 29.5313 16.1749 30.8313C19.1812 32.2125 22.1874 33.9187 22.8374 34C23.4874 33.9187 26.4937 32.2125 29.4187 30.8313C32.3437 29.45 34.3749 26.0375 34.3749 26.0375L35.3499 26.2812L34.8624 22.8687ZM23.0812 13.6875C21.9437 13.6875 21.0499 12.7937 21.0499 11.6562C21.0499 10.6 21.9437 9.70625 22.9999 9.70625H23.0812C24.1374 9.70625 25.0312 10.6 25.0312 11.6562C25.1124 12.7937 24.1374 13.6875 23.0812 13.6875Z" fill="white"/>
@@ -212,24 +212,26 @@ hooks.version="2.30.1",setHookCallback(createLocal),hooks.fn=proto,hooks.min=min
212
212
  </clipPath>
213
213
  </defs>
214
214
  </svg>
215
- `,i=()=>`data:image/svg+xml;utf8,${encodeURIComponent(r(n?"#FF5733":"#3370FF"))}`;return new Style({text:new Text({text:t.shortName,font:"12px sans-serif",fill:new Fill({color:n?"#ffffff":"#000000"}),backgroundFill:new Fill({color:n?"#FF5733":"#FFFFFF"}),offsetY:30}),image:new Icon({src:i(),scale:.5*e/10})})},clearPortList=()=>{if(selectedPortFeature){console.log("清除非选中的港口");const t=selectedPortFeature.get("portData").id;vectorSource$2.getFeatures().forEach(e=>{e.get("portData").id!==t&&vectorSource$2.removeFeature(e)})}else console.log("清除所有港口"),vectorSource$2.clear()};let selectedPortFeature=null;const selectedPort=t=>{clearPrevSelectedPort(),addSelectedPortStyle(t)},clearPrevSelectedPort=()=>{if(selectedPortFeature){const t=selectedPortFeature.get("portData"),e=getZoom();selectedPortFeature.setStyle(setPortStyle(t,e,!1))}},addSelectedPortStyle=t=>{const e=t.get("portData"),n=getZoom();selectedPortFeature=t,t.setStyle(setPortStyle(e,n,!0))},handlePortHover=t=>{const e=getInstall(),n=e.forEachFeatureAtPixel(t,r=>r);n&&n.get("portData")&&(e.getTargetElement().style.cursor="pointer")},DrawEventType={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class DrawEvent extends BaseEvent{constructor(e,n){super(e),this.feature=n}}function getTraceTargets(t,e){const n=[];for(let r=0;r<e.length;++r){const g=e[r].getGeometry();appendGeometryTraceTargets(t,g,n)}return n}function getSquaredDistance(t,e){return squaredDistance$1(t[0],t[1],e[0],e[1])}function getCoordinate(t,e){const n=t.length;return e<0?t[e+n]:e>=n?t[e-n]:t[e]}function getCumulativeSquaredDistance(t,e,n){let r,i;e<n?(r=e,i=n):(r=n,i=e);const g=Math.ceil(r),y=Math.floor(i);if(g>y){const L=interpolateCoordinate(t,r),$=interpolateCoordinate(t,i);return getSquaredDistance(L,$)}let k=0;if(r<g){const L=interpolateCoordinate(t,r),$=getCoordinate(t,g);k+=getSquaredDistance(L,$)}if(y<i){const L=getCoordinate(t,y),$=interpolateCoordinate(t,i);k+=getSquaredDistance(L,$)}for(let L=g;L<y-1;++L){const $=getCoordinate(t,L),V=getCoordinate(t,L+1);k+=getSquaredDistance($,V)}return k}function appendGeometryTraceTargets(t,e,n){if(e instanceof LineString){appendTraceTarget(t,e.getCoordinates(),!1,n);return}if(e instanceof MultiLineString){const r=e.getCoordinates();for(let i=0,g=r.length;i<g;++i)appendTraceTarget(t,r[i],!1,n);return}if(e instanceof Polygon){const r=e.getCoordinates();for(let i=0,g=r.length;i<g;++i)appendTraceTarget(t,r[i],!0,n);return}if(e instanceof MultiPolygon){const r=e.getCoordinates();for(let i=0,g=r.length;i<g;++i){const y=r[i];for(let k=0,L=y.length;k<L;++k)appendTraceTarget(t,y[k],!0,n)}return}if(e instanceof GeometryCollection){const r=e.getGeometries();for(let i=0;i<r.length;++i)appendGeometryTraceTargets(t,r[i],n);return}}const sharedUpdateInfo={index:-1,endIndex:NaN};function getTraceTargetUpdate(t,e,n,r){const i=t[0],g=t[1];let y=1/0,k=-1,L=NaN;for(let z=0;z<e.targets.length;++z){const re=e.targets[z],oe=re.coordinates;let j=1/0,ie;for(let ae=0;ae<oe.length-1;++ae){const ue=oe[ae],de=oe[ae+1],pe=getPointSegmentRelationship(i,g,ue,de);pe.squaredDistance<j&&(j=pe.squaredDistance,ie=ae+pe.along)}j<y&&(y=j,re.ring&&e.targetIndex===z&&(re.endIndex>re.startIndex?ie<re.startIndex&&(ie+=oe.length):re.endIndex<re.startIndex&&ie>re.startIndex&&(ie-=oe.length)),L=ie,k=z)}const $=e.targets[k];let V=$.ring;if(e.targetIndex===k&&V){const z=interpolateCoordinate($.coordinates,L),re=n.getPixelFromCoordinate(z);distance$1(re,e.startPx)>r&&(V=!1)}if(V){const z=$.coordinates,re=z.length,oe=$.startIndex,j=L;if(oe<j){const ie=getCumulativeSquaredDistance(z,oe,j);getCumulativeSquaredDistance(z,oe,j-re)<ie&&(L-=re)}else{const ie=getCumulativeSquaredDistance(z,oe,j);getCumulativeSquaredDistance(z,oe,j+re)<ie&&(L+=re)}}return sharedUpdateInfo.index=k,sharedUpdateInfo.endIndex=L,sharedUpdateInfo}function appendTraceTarget(t,e,n,r){const i=t[0],g=t[1];for(let y=0,k=e.length-1;y<k;++y){const L=e[y],$=e[y+1],V=getPointSegmentRelationship(i,g,L,$);if(V.squaredDistance===0){const z=y+V.along;r.push({coordinates:e,ring:n,startIndex:z,endIndex:z});return}}}const sharedRel={along:0,squaredDistance:0};function getPointSegmentRelationship(t,e,n,r){const i=n[0],g=n[1],y=r[0],k=r[1],L=y-i,$=k-g;let V=0,z=i,re=g;return(L!==0||$!==0)&&(V=clamp(((t-i)*L+(e-g)*$)/(L*L+$*$),0,1),z+=L*V,re+=$*V),sharedRel.along=V,sharedRel.squaredDistance=toFixed(squaredDistance$1(t,e,z,re),10),sharedRel}function interpolateCoordinate(t,e){const n=t.length;let r=Math.floor(e);const i=e-r;r>=n?r-=n:r<0&&(r+=n);let g=r+1;g>=n&&(g-=n);const y=t[r],k=y[0],L=y[1],$=t[g],V=$[0]-k,z=$[1]-L;return[k+V*i,L+z*i]}class Draw extends PointerInteraction{constructor(e){const n=e;n.stopDown||(n.stopDown=FALSE),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_=getMode(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:TRUE,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let r=e.geometryFunction;if(!r){const i=this.mode_;if(i==="Circle")r=(g,y,k)=>{const L=y||new Circle([NaN,NaN]),$=fromUserCoordinate(g[0]),V=squaredDistance($,fromUserCoordinate(g[g.length-1]));return L.setCenterAndRadius($,Math.sqrt(V),this.geometryLayout_),L};else{let g;i==="Point"?g=Point:i==="LineString"?g=LineString:i==="Polygon"&&(g=Polygon),r=(y,k,L)=>(k?i==="Polygon"?y[0].length?k.setCoordinates([y[0].concat([y[0][0]])],this.geometryLayout_):k.setCoordinates([],this.geometryLayout_):k.setCoordinates(y,this.geometryLayout_):k=new g(y,this.geometryLayout_),k)}}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 VectorLayer({source:new VectorSource({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:getDefaultStyleFunction(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:noModifierKeys,this.freehandCondition_,e.freehand?this.freehandCondition_=always:this.freehandCondition_=e.freehandCondition?e.freehandCondition:shiftKeyOnly,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(InteractionProperty.ACTIVE,this.updateState_)}setTrace(e){let n;e?e===!0?n=always:n=e:n=never,this.traceCondition_=n}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===EventType.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let n=e.type===MapBrowserEventType.POINTERMOVE,r=!0;return!this.freehand_&&this.lastDragTime_&&e.type===MapBrowserEventType.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===MapBrowserEventType.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),r=!1):this.freehand_&&e.type===MapBrowserEventType.POINTERDOWN?r=!1:n&&this.getPointerCount()<2?(r=e.type===MapBrowserEventType.POINTERMOVE,r&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===MapBrowserEventType.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===MapBrowserEventType.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 MapBrowserEvent(MapBrowserEventType.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_]),i=n.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),g=boundingExtent([r,i]),y=this.traceSource_.getFeaturesInExtent(g);if(y.length===0)return;const k=getTraceTargets(e.coordinate,y);k.length&&(this.traceState_={active:!0,startPx:e.pixel.slice(),targets:k,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,n){const r=e.startIndex<=e.endIndex,i=e.startIndex<=n;r===i?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 i=Math.ceil(e);let g=Math.floor(n);g===n&&(g-=1),r=g-i+1}else{const i=Math.floor(e);let g=Math.ceil(n);g===n&&(g+=1),r=i-g+1}r>0&&this.removeLastPoints_(r)}addTracedCoordinates_(e,n,r){if(n===r)return;const i=[];if(n<r){const g=Math.ceil(n);let y=Math.floor(r);y===r&&(y-=1);for(let k=g;k<=y;++k)i.push(getCoordinate(e.coordinates,k))}else{const g=Math.floor(n);let y=Math.ceil(r);y===r&&(y+=1);for(let k=g;k>=y;--k)i.push(getCoordinate(e.coordinates,k))}i.length&&this.appendCoordinates(i)}updateTrace_(e){const n=this.traceState_;if(!n.active||n.targetIndex===-1&&distance$1(n.startPx,e.pixel)<this.snapTolerance_)return;const r=getTraceTargetUpdate(e.coordinate,n,this.getMap(),this.snapTolerance_);if(n.targetIndex!==r.index){if(n.targetIndex!==-1){const L=n.targets[n.targetIndex];this.removeTracedCoordinates_(L.startIndex,L.endIndex)}const k=n.targets[r.index];this.addTracedCoordinates_(k,k.startIndex,r.endIndex)}else{const k=n.targets[n.targetIndex];this.addOrRemoveTracedCoordinates_(k,r.endIndex)}n.targetIndex=r.index;const i=n.targets[n.targetIndex];i.endIndex=r.endIndex;const g=interpolateCoordinate(i.coordinates,i.endIndex),y=this.getMap().getPixelFromCoordinate(g);e.coordinate=g,e.pixel=[Math.round(y[0]),Math.round(y[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 i=!this.finishCoordinate_;i&&this.startDrawing_(e.coordinate),!i&&this.freehand_?this.finishDrawing():!this.freehand_&&(!i||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,i=n[0]-r[0],g=n[1]-r[1],y=i*i+g*g;if(this.shouldHandle_=this.freehand_?y>this.squaredClickTolerance_:y<=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 i=!1,g=[this.finishCoordinate_];const y=this.mode_;if(y==="Point")r=!0;else if(y==="Circle")r=this.sketchCoords_.length===2;else if(y==="LineString")i=!n&&this.sketchCoords_.length>this.minPoints_;else if(y==="Polygon"){const k=this.sketchCoords_;i=k[0].length>this.minPoints_,g=[k[0][0],k[0][k[0].length-2]],n?g=[k[0][0]]:g=[k[0][0],k[0][k[0].length-2]]}if(i){const k=this.getMap();for(let L=0,$=g.length;L<$;L++){const V=g[L],z=k.getPixelFromCoordinate(V),re=e[0]-z[0],oe=e[1]-z[1],j=this.freehand_?1:this.snapTolerance_;if(r=Math.sqrt(re*re+oe*oe)<=j,r){this.finishCoordinate_=V;break}}}}return r}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new Feature(new Point(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new Feature);const n=e.getLinearRing(0);let r=this.sketchLine_.getGeometry();r?(r.setFlatCoordinates(n.getLayout(),n.getFlatCoordinates()),r.changed()):(r=new LineString(n.getFlatCoordinates(),n.getLayout()),this.sketchLine_.setGeometry(r))}startDrawing_(e){const n=this.getMap().getView().getProjection(),r=getStrideForLayout(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 Feature(new LineString(this.sketchLineCoords_)));const i=this.geometryFunction_(this.sketchCoords_,void 0,n);this.sketchFeature_=new Feature,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(i),this.updateSketchFeatures_(),this.dispatchEvent(new DrawEvent(DrawEventType.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const n=this.getMap(),r=this.sketchFeature_.getGeometry(),i=n.getView().getProjection(),g=getStrideForLayout(this.geometryLayout_);let y,k;for(;e.length<g;)e.push(0);this.mode_==="Point"?k=this.sketchCoords_:this.mode_==="Polygon"?(y=this.sketchCoords_[0],k=y[y.length-1],this.atFinish_(n.getPixelFromCoordinate(e))&&(e=this.finishCoordinate_.slice())):(y=this.sketchCoords_,k=y[y.length-1]),k[0]=e[0],k[1]=e[1],this.geometryFunction_(this.sketchCoords_,r,i),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 i,g;const y=this.mode_;return y==="LineString"||y==="Circle"?(this.finishCoordinate_=e.slice(),g=this.sketchCoords_,g.length>=this.maxPoints_&&(this.freehand_?g.pop():i=!0),g.push(e.slice()),this.geometryFunction_(g,n,r)):y==="Polygon"&&(g=this.sketchCoords_[0],g.length>=this.maxPoints_&&(this.freehand_?g.pop():i=!0),g.push(e.slice()),i&&(this.finishCoordinate_=g[0]),this.geometryFunction_(this.sketchCoords_,n,r)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),i?this.finishDrawing():this.sketchFeature_}removeLastPoints_(e){if(!this.sketchFeature_)return;const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection(),i=this.mode_;for(let g=0;g<e;++g){let y;if(i==="LineString"||i==="Circle"){if(y=this.sketchCoords_,y.splice(-2,1),y.length>=2){this.finishCoordinate_=y[y.length-2].slice();const k=this.finishCoordinate_.slice();y[y.length-1]=k,this.createOrUpdateSketchPoint_(k)}this.geometryFunction_(y,n,r),n.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(n)}else if(i==="Polygon"){y=this.sketchCoords_[0],y.splice(-2,1);const k=this.sketchLine_.getGeometry();if(y.length>=2){const L=y[y.length-2].slice();y[y.length-1]=L,this.createOrUpdateSketchPoint_(L)}k.setCoordinates(y),this.geometryFunction_(this.sketchCoords_,n,r)}if(y.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(),i=this.getMap().getView().getProjection();return this.mode_==="LineString"?(n.pop(),this.geometryFunction_(n,r,i)):this.mode_==="Polygon"&&(n[0].pop(),this.geometryFunction_(n,r,i),n=r.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new MultiPoint([n])):this.type_==="MultiLineString"?e.setGeometry(new MultiLineString([n])):this.type_==="MultiPolygon"&&e.setGeometry(new MultiPolygon([n])),this.dispatchEvent(new DrawEvent(DrawEventType.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 DrawEvent(DrawEventType.DRAWABORT,e))}appendCoordinates(e){const n=this.mode_,r=!this.sketchFeature_;r&&this.startDrawing_(e[0]);let i;if(n==="LineString"||n==="Circle")i=this.sketchCoords_;else if(n==="Polygon")i=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;r&&i.shift(),i.pop();for(let y=0;y<e.length;y++)this.addToDrawing_(e[y]);const g=e[e.length-1];this.sketchFeature_=this.addToDrawing_(g),this.modifyDrawing_(g)}extend(e){const r=e.getGeometry();this.sketchFeature_=e,this.sketchCoords_=r.getCoordinates();const i=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=i.slice(),this.sketchCoords_.push(i.slice()),this.sketchPoint_=new Feature(new Point(i)),this.updateSketchFeatures_(),this.dispatchEvent(new DrawEvent(DrawEventType.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 getDefaultStyleFunction(){const t=createEditingStyle();return function(e,n){return t[e.getGeometry().getType()]}}function getMode(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 disableDoubleClickZoom=()=>{getInstall().getInteractions().forEach(e=>{e instanceof DoubleClickZoom&&e.setActive(!1)})},enableDoubleClickZoom=()=>{getInstall().getInteractions().forEach(e=>{e instanceof DoubleClickZoom&&e.setActive(!0)})},props=vue.ref(),setProps=t=>{props.value=t},getProps=()=>props.value,measureHistory=vue.ref([]),unit=vue.ref("km"),setUnit=t=>{unit.value=t};let helpTooltipElement$1;const state=vue.ref(!1),open$1=()=>{initMapLayer(),disableDoubleClickZoom(),changeCursor("pointer");const t=getInstall();t.on("pointermove",pointerMoveHandler$1),t.getViewport().addEventListener("mouseout",()=>{helpTooltipElement$1&&helpTooltipElement$1.classList.add("hidden")}),addInteraction(),state.value=!0};let vectorSource$1,vectorLayer$1;const initMapLayer=()=>{vectorSource$1=new VectorSource,vectorLayer$1=new VectorLayer({source:vectorSource$1,zIndex:1e3,style:{"fill-color":"rgba(255, 255, 255, 0.2)","stroke-color":"#ffcc33","stroke-width":2,"circle-radius":7,"circle-fill-color":"#ffcc33"}}),getInstall().addLayer(vectorLayer$1)};let sketch$1,helpTooltip;const pointerMoveHandler$1=t=>{if(t.dragging)return;let e="点击选择起点";sketch$1&&(e="单击继续,双击结束"),helpTooltipElement$1&&(helpTooltipElement$1.innerHTML=e,helpTooltip.setPosition(t.coordinate),helpTooltipElement$1.classList.remove("hidden"))},changeCursor=t=>{getInstall().getTargetElement().style.cursor=t};let draw$1;const addInteraction=()=>{draw$1=new Draw({source:vectorSource$1,type:"LineString",style:new Style({fill:new Fill({color:"rgba(255, 255, 255, 0.2)"}),stroke:new Stroke({color:"rgba(255,204,51)",lineDash:[10,10],width:2}),image:new CircleStyle({radius:5,stroke:new Stroke({color:"rgba(0, 0, 0, 0.7)"}),fill:new Fill({color:"rgba(255, 255, 255, 0.2)"})})}),condition:e=>e.originalEvent.target.tagName!=="DIV"}),getInstall().addInteraction(draw$1),createMeasureTooltip$1(),createHelpTooltip$1();let t;draw$1.on("drawstart",function(e){var r;sketch$1=e.feature,sketch$1.set("randomId",generateRandomId());let n;t=(r=sketch$1.getGeometry())==null?void 0:r.on("change",function(i){const g=i.target,y=computedDistance(g,unit.value);n=g.getLastCoordinate(),measureTooltipElement$1&&y&&(measureTooltipElement$1.innerHTML=y),measureTooltip$1.setPosition(n)})}),draw$1.on("drawend",function(){var e,n,r;if(measureTooltipElement$1&&(measureTooltipElement$1.className="ol-tooltip ol-tooltip-static ol-tooltip-measure"),measureTooltipElement$1!=null&&measureTooltipElement$1.innerHTML){const i=(sketch$1==null?void 0:sketch$1.get("randomId"))||generateRandomId();measureHistory.value.push({id:i,value:measureTooltipElement$1==null?void 0:measureTooltipElement$1.innerHTML}),measureTooltipElement$1.innerHTML=`${measureTooltipElement$1.innerHTML}<div class="ol-tooltip-delete-button" data-id="${i}"><i class="map-iconfont icon-delete"></i></div>`}(e=document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button"))==null||e.addEventListener("click",i=>{var y;i.preventDefault(),i.stopPropagation();const g=(y=i.target)==null?void 0:y.getAttribute("data-id");g&&deleteLine(g)}),measureTooltip$1.setOffset([0,-7]),sketch$1=null,measureTooltipElement$1=null,createMeasureTooltip$1(),t&&unByKey(t),(n=getProps())!=null&&n.lineDrawEnd&&((r=getProps())==null||r.lineDrawEnd(measureHistory.value))})},generateRandomId=()=>Math.random().toString(36).substring(2,9);let measureTooltipElement$1,measureTooltip$1;const createMeasureTooltip$1=()=>{measureTooltipElement$1!=null&&measureTooltipElement$1.parentNode&&measureTooltipElement$1.parentNode.removeChild(measureTooltipElement$1),measureTooltipElement$1=document.createElement("div"),measureTooltipElement$1.className="ol-tooltip ol-tooltip-measure",measureTooltip$1=new Overlay({element:measureTooltipElement$1,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),getInstall().addOverlay(measureTooltip$1)},createHelpTooltip$1=()=>{helpTooltipElement$1!=null&&helpTooltipElement$1.parentNode&&helpTooltipElement$1.parentNode.removeChild(helpTooltipElement$1),helpTooltipElement$1=document.createElement("div"),helpTooltipElement$1.className="ol-tooltip hidden",helpTooltip=new Overlay({element:helpTooltipElement$1,offset:[15,0],positioning:"center-left"}),getInstall().addOverlay(helpTooltip)},close$1=()=>{measureHistory.value.forEach((t,e)=>{var i,g;const n=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");n[e]&&((g=(i=n[e])==null?void 0:i.parentNode)==null||g.removeChild(n[e]));const r=vectorSource$1.getFeatures();r[e]&&vectorSource$1.removeFeature(r[e])}),removeInteraction(),enableDoubleClickZoom(),state.value=!1},deleteLine=t=>{var n,r,i,g;const e=measureHistory.value.findIndex(y=>y.id===t);if(e!==-1){measureHistory.value.splice(e,1);const y=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");y[e]&&((r=(n=y[e])==null?void 0:n.parentNode)==null||r.removeChild(y[e]));const k=vectorSource$1.getFeatures();k[e]&&vectorSource$1.removeFeature(k[e])}(i=getProps())!=null&&i.lineDrawEnd&&((g=getProps())==null||g.lineDrawEnd(measureHistory.value))},computedDistance=(t,e)=>{const r=getLength(t);let i="";switch(e){case"m":i=`${Math.round(r*100)/100} m`;break;case"km":i=`${Math.round(r/1e3*100)/100} km`;break;case"nm":i=`${Math.round(r/1.852*100)/100} nm`;break}return i},removeInteraction=()=>{measureHistory.value=[],document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach(e=>{var n;(n=e==null?void 0:e.parentNode)==null||n.removeChild(e)}),vectorSource$1.clear();const t=getInstall();if(draw$1){const e=t.getInteractions().getArray().find(n=>getUid(n)===getUid(draw$1));e&&t.removeInteraction(e)}t.removeLayer(vectorLayer$1),helpTooltipElement$1!=null&&helpTooltipElement$1.parentNode&&helpTooltipElement$1.parentNode.removeChild(helpTooltipElement$1),measureTooltipElement$1!=null&&measureTooltipElement$1.parentNode&&measureTooltipElement$1.parentNode.removeChild(measureTooltipElement$1)},getState=()=>state.value,drawLine={open:open$1,close:close$1,deleteLine,setUnit,getState},mapInstance=vue.ref(),getInstall=()=>mapInstance.value,getView=()=>getInstall().getView(),getZoom=()=>{var t;return(t=getView())==null?void 0:t.getZoom()},setZoom=t=>{var e;(e=getView())==null||e.setZoom(t)},setCenter=(t,e)=>{var n;(n=getView())==null||n.setCenter(fromLonLat([t,e]))},getCenter=()=>{var e;const t=(e=getView())==null?void 0:e.getCenter();return toLonLat(t)},getSize=()=>{var t;return(t=getInstall())==null?void 0:t.getSize()},BASE_LAYER_MAP=new Map$2,initMap=t=>{setBaseLayerMap(t);const e={zoom:t.zoom,center:fromLonLat(t.center),minZoom:MAP_ZOOM.min,maxZoom:MAP_ZOOM.max,constrainResolution:!0,enableRotation:!1,multiWorld:!0},n=new Map$2({target:"map",layers:[BASE_LAYER_MAP.get("vectorTile"),BASE_LAYER_MAP.get("vectorTileMark"),BASE_LAYER_MAP.get("satelliteImgTile"),BASE_LAYER_MAP.get("satelliteImgTileMark")],view:new View(e)});mapInstance.value=n,setBaseMapEvent(n,t)},setBaseLayerMap=t=>{BASE_LAYER_MAP.set("vectorTile",new TileLayer({source:new XYZ({url:BASE_MAP_LINK.vectorTile}),visible:t.layerType==="vector",zIndex:0,preload:1,className:"vector"})),BASE_LAYER_MAP.set("vectorTileMark",new TileLayer({source:new XYZ({url:BASE_MAP_LINK.vectorTileMark}),visible:t.layerType==="vector",zIndex:1,preload:1,className:"vector"})),BASE_LAYER_MAP.set("satelliteImgTile",new TileLayer({source:new XYZ({url:BASE_MAP_LINK.satelliteImgTile}),visible:t.layerType==="satellite",zIndex:0,preload:1,className:"satellite"})),BASE_LAYER_MAP.set("satelliteImgTileMark",new TileLayer({source:new XYZ({url:BASE_MAP_LINK.satelliteImgTileMark}),visible:t.layerType==="satellite",zIndex:1,preload:1,className:"satellite"})),BASE_LAYER_MAP.set("greenMark",new TileLayer({source:new XYZ({url:BASE_MAP_LINK.greenTile}),visible:t.showGreenLayer,zIndex:2,className:"greenTile"}))},setBaseMapEvent=(t,e)=>{t.on("moveend",()=>{var r;const n=getZoom();(r=e.mapMoveEnd)==null||r.call(e,n),reRenderTrackLine()}),t.on("pointermove",n=>{const r=t.getEventPixel(n.originalEvent),i=t.forEachFeatureAtPixel(r,g=>g);handleShipMapEvent(i,"hover"),i&&(handleTrackMapEvent(i,"hover",n),handlePortHover(r))}),t.on("click",debounce(n=>{if(console.log("1",drawLine.getState()),drawLine.getState())return;const r=t.getEventPixel(n.originalEvent),i=t.forEachFeatureAtPixel(r,g=>{if(g!=null&&g.get("shipData")||g!=null&&g.get("portData"))return g});if(console.log("2",i),!!i){if(n.preventDefault(),n.stopPropagation(),i.get("shipData"))handleShipMapEvent(i,"click",e==null?void 0:e.selectShip);else if(i.get("portData")){const g=i.get("portData");selectedPort(i),e==null||e.selectPort(String(g==null?void 0:g.id))}}},150))},_hoisted_1$7={id:"scale-line-container"},_sfc_main$9=vue.defineComponent({__name:"scaleLine",setup(t,{expose:e}){return e({setScaleLine:r=>{r||(r="metric");const i=new ScaleLine$1({units:r}),g=document.getElementById("scale-line-container");g&&(i.setTarget(g),getInstall().addControl(i))}}),(r,i)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$7))}}),ScaleLine=_export_sfc(_sfc_main$9,[["__scopeId","data-v-31ff8293"]]),_hoisted_1$6={class:"zoom"},_sfc_main$8=vue.defineComponent({__name:"zoomControl",setup(t){const e=vue.inject("mapInstance"),n=()=>{if(e!=null&&e.value){const i=getZoom();if(!i)return;setZoom(i+1)}},r=()=>{if(e!=null&&e.value){const i=getZoom();if(!i)return;setZoom(i-1)}};return(i,g)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$6,[vue.createElementVNode("div",{class:"button big-button",onClick:n}," + "),vue.createElementVNode("div",{class:"button small-button",onClick:r}," - ")]))}}),ZoomControl=_export_sfc(_sfc_main$8,[["__scopeId","data-v-37968fef"]]),getLayers=()=>{var t;return(t=getInstall())==null?void 0:t.getLayers()},layerType=vue.ref("vector"),getShowLayerType=()=>layerType.value,setShowLayerType=t=>{layerType.value=t;const e=getLayers();e&&e.getArray().forEach(n=>{n.setVisible(n.className_===t)})},showGreenTile=vue.ref(),getGreenTileVisible=()=>showGreenTile.value,setGreenTileVisible=t=>{if(t!==showGreenTile.value){if(t){const e=getLayers();if(!e.getArray().find(r=>r.className_==="greenTile")){const r=new TileLayer({source:new XYZ({url:BASE_MAP_LINK.greenTile}),visible:t,zIndex:2,className:"greenTile"});e.push(r)}}else{const e=getLayers(),n=e.getArray().find(r=>r.className_==="greenTile");n&&e.remove(n)}showGreenTile.value=t}},open=()=>{initLayer(),initDraw(),createMeasureTooltip(),createHelpTooltip()};let vectorLayer=null,vectorSource=null;const initLayer=()=>{if(vectorLayer||vectorSource)return;const t=new VectorSource,e=new VectorLayer({source:t,style:new Style({stroke:new Stroke({color:"#fbcc33",width:2})})});vectorLayer=e,vectorSource=t;const n=getInstall();n.on("pointermove",pointerMoveHandler),n.addLayer(e),n.on(["dblclick"],function(r){draw&&(r.stopPropagation(),r.preventDefault())})};let sketch;const pointerMoveHandler=t=>{if(t.dragging)return;const e=sketch?"单击继续,双击结束":"点击选择起点";helpTooltipElement&&(helpTooltipElement.innerHTML=e,tipOverlay.setPosition(t.coordinate))};let draw;const initDraw=()=>{let t=!1;draw=new Draw({type:"Polygon",source:vectorSource,trace:!0,style:[new Style({stroke:new Stroke({color:"rgba(255, 255, 255, 1)",width:1.5,lineDash:[10,10]}),fill:new Fill({color:"rgba(255, 255, 255, 0.25)"})}),new Style({image:new CircleStyle({radius:5,fill:new Fill({color:"rgb(51,112,255, 1)"})}),geometry:function(n){const r=n.getGeometry().getCoordinates();return new MultiPoint(r)}})]}),getInstall().addInteraction(draw);let e;draw.on("drawstart",n=>{var r;sketch=n.feature,e=(r=sketch.getGeometry())==null?void 0:r.on("change",i=>{const g=i.target,y=computedArea(g,"nm"),L=g.getCoordinates()[0],$=new LineString([L[L.length-2],L[L.length-1]]),V=computedDistance($,"nm");if(t=Number(getLength($)/1e3)>150,!y)return;const z='<span class="error pl-4">超出可以绘画的距离</span>';measureTooltipElement&&(measureTooltipElement.innerHTML=`
215
+ `,i=()=>`data:image/svg+xml;utf8,${encodeURIComponent(r(n?"#FF5733":"#3370FF"))}`;return new Style({text:new Text({text:t.shortName,font:"12px sans-serif",fill:new Fill({color:n?"#ffffff":"#000000"}),backgroundFill:new Fill({color:n?"#FF5733":"#FFFFFF"}),offsetY:30}),image:new Icon({src:i(),scale:.5*e/10})})},clearPortList=()=>{if(selectedPortFeature){console.log("清除非选中的港口");const t=selectedPortFeature.get("portData").id;vectorSource$2.getFeatures().forEach(e=>{e.get("portData").id!==t&&vectorSource$2.removeFeature(e)})}else console.log("清除所有港口"),vectorSource$2.clear()},clearSelectedPort=()=>{const t=selectedPortFeature.get("portData"),e=getZoom();vectorSource$2.getFeatures().forEach(r=>{r.get("portData").id===t.id&&(r==null||r.setStyle(setPortStyle(t,e,!1)))}),selectedPortData=null,selectedPortFeature=null};let selectedPortFeature=null,selectedPortData=null;const selectedPort=t=>{t?(clearPrevSelectedPort(),addSelectedPortStyle(t)):clearSelectedPort()},clearPrevSelectedPort=()=>{if(selectedPortFeature){const t=selectedPortFeature.get("portData"),e=getZoom();selectedPortFeature.setStyle(setPortStyle(t,e,!1))}},addSelectedPortStyle=t=>{const e=vectorSource$2.getFeatures();selectedPortData=t,selectedPortFeature=e.find(n=>n.get("portData").id===t.id)},handlePortHover=t=>{const e=getInstall(),n=e.forEachFeatureAtPixel(t,r=>r);n&&n.get("portData")&&(e.getTargetElement().style.cursor="pointer")},DrawEventType={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class DrawEvent extends BaseEvent{constructor(e,n){super(e),this.feature=n}}function getTraceTargets(t,e){const n=[];for(let r=0;r<e.length;++r){const g=e[r].getGeometry();appendGeometryTraceTargets(t,g,n)}return n}function getSquaredDistance(t,e){return squaredDistance$1(t[0],t[1],e[0],e[1])}function getCoordinate(t,e){const n=t.length;return e<0?t[e+n]:e>=n?t[e-n]:t[e]}function getCumulativeSquaredDistance(t,e,n){let r,i;e<n?(r=e,i=n):(r=n,i=e);const g=Math.ceil(r),y=Math.floor(i);if(g>y){const L=interpolateCoordinate(t,r),$=interpolateCoordinate(t,i);return getSquaredDistance(L,$)}let k=0;if(r<g){const L=interpolateCoordinate(t,r),$=getCoordinate(t,g);k+=getSquaredDistance(L,$)}if(y<i){const L=getCoordinate(t,y),$=interpolateCoordinate(t,i);k+=getSquaredDistance(L,$)}for(let L=g;L<y-1;++L){const $=getCoordinate(t,L),V=getCoordinate(t,L+1);k+=getSquaredDistance($,V)}return k}function appendGeometryTraceTargets(t,e,n){if(e instanceof LineString){appendTraceTarget(t,e.getCoordinates(),!1,n);return}if(e instanceof MultiLineString){const r=e.getCoordinates();for(let i=0,g=r.length;i<g;++i)appendTraceTarget(t,r[i],!1,n);return}if(e instanceof Polygon){const r=e.getCoordinates();for(let i=0,g=r.length;i<g;++i)appendTraceTarget(t,r[i],!0,n);return}if(e instanceof MultiPolygon){const r=e.getCoordinates();for(let i=0,g=r.length;i<g;++i){const y=r[i];for(let k=0,L=y.length;k<L;++k)appendTraceTarget(t,y[k],!0,n)}return}if(e instanceof GeometryCollection){const r=e.getGeometries();for(let i=0;i<r.length;++i)appendGeometryTraceTargets(t,r[i],n);return}}const sharedUpdateInfo={index:-1,endIndex:NaN};function getTraceTargetUpdate(t,e,n,r){const i=t[0],g=t[1];let y=1/0,k=-1,L=NaN;for(let z=0;z<e.targets.length;++z){const re=e.targets[z],oe=re.coordinates;let j=1/0,ie;for(let ae=0;ae<oe.length-1;++ae){const ue=oe[ae],de=oe[ae+1],pe=getPointSegmentRelationship(i,g,ue,de);pe.squaredDistance<j&&(j=pe.squaredDistance,ie=ae+pe.along)}j<y&&(y=j,re.ring&&e.targetIndex===z&&(re.endIndex>re.startIndex?ie<re.startIndex&&(ie+=oe.length):re.endIndex<re.startIndex&&ie>re.startIndex&&(ie-=oe.length)),L=ie,k=z)}const $=e.targets[k];let V=$.ring;if(e.targetIndex===k&&V){const z=interpolateCoordinate($.coordinates,L),re=n.getPixelFromCoordinate(z);distance$1(re,e.startPx)>r&&(V=!1)}if(V){const z=$.coordinates,re=z.length,oe=$.startIndex,j=L;if(oe<j){const ie=getCumulativeSquaredDistance(z,oe,j);getCumulativeSquaredDistance(z,oe,j-re)<ie&&(L-=re)}else{const ie=getCumulativeSquaredDistance(z,oe,j);getCumulativeSquaredDistance(z,oe,j+re)<ie&&(L+=re)}}return sharedUpdateInfo.index=k,sharedUpdateInfo.endIndex=L,sharedUpdateInfo}function appendTraceTarget(t,e,n,r){const i=t[0],g=t[1];for(let y=0,k=e.length-1;y<k;++y){const L=e[y],$=e[y+1],V=getPointSegmentRelationship(i,g,L,$);if(V.squaredDistance===0){const z=y+V.along;r.push({coordinates:e,ring:n,startIndex:z,endIndex:z});return}}}const sharedRel={along:0,squaredDistance:0};function getPointSegmentRelationship(t,e,n,r){const i=n[0],g=n[1],y=r[0],k=r[1],L=y-i,$=k-g;let V=0,z=i,re=g;return(L!==0||$!==0)&&(V=clamp(((t-i)*L+(e-g)*$)/(L*L+$*$),0,1),z+=L*V,re+=$*V),sharedRel.along=V,sharedRel.squaredDistance=toFixed(squaredDistance$1(t,e,z,re),10),sharedRel}function interpolateCoordinate(t,e){const n=t.length;let r=Math.floor(e);const i=e-r;r>=n?r-=n:r<0&&(r+=n);let g=r+1;g>=n&&(g-=n);const y=t[r],k=y[0],L=y[1],$=t[g],V=$[0]-k,z=$[1]-L;return[k+V*i,L+z*i]}class Draw extends PointerInteraction{constructor(e){const n=e;n.stopDown||(n.stopDown=FALSE),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_=getMode(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:TRUE,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let r=e.geometryFunction;if(!r){const i=this.mode_;if(i==="Circle")r=(g,y,k)=>{const L=y||new Circle([NaN,NaN]),$=fromUserCoordinate(g[0]),V=squaredDistance($,fromUserCoordinate(g[g.length-1]));return L.setCenterAndRadius($,Math.sqrt(V),this.geometryLayout_),L};else{let g;i==="Point"?g=Point:i==="LineString"?g=LineString:i==="Polygon"&&(g=Polygon),r=(y,k,L)=>(k?i==="Polygon"?y[0].length?k.setCoordinates([y[0].concat([y[0][0]])],this.geometryLayout_):k.setCoordinates([],this.geometryLayout_):k.setCoordinates(y,this.geometryLayout_):k=new g(y,this.geometryLayout_),k)}}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 VectorLayer({source:new VectorSource({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:getDefaultStyleFunction(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:noModifierKeys,this.freehandCondition_,e.freehand?this.freehandCondition_=always:this.freehandCondition_=e.freehandCondition?e.freehandCondition:shiftKeyOnly,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(InteractionProperty.ACTIVE,this.updateState_)}setTrace(e){let n;e?e===!0?n=always:n=e:n=never,this.traceCondition_=n}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===EventType.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let n=e.type===MapBrowserEventType.POINTERMOVE,r=!0;return!this.freehand_&&this.lastDragTime_&&e.type===MapBrowserEventType.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===MapBrowserEventType.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),r=!1):this.freehand_&&e.type===MapBrowserEventType.POINTERDOWN?r=!1:n&&this.getPointerCount()<2?(r=e.type===MapBrowserEventType.POINTERMOVE,r&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===MapBrowserEventType.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===MapBrowserEventType.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 MapBrowserEvent(MapBrowserEventType.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_]),i=n.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),g=boundingExtent([r,i]),y=this.traceSource_.getFeaturesInExtent(g);if(y.length===0)return;const k=getTraceTargets(e.coordinate,y);k.length&&(this.traceState_={active:!0,startPx:e.pixel.slice(),targets:k,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,n){const r=e.startIndex<=e.endIndex,i=e.startIndex<=n;r===i?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 i=Math.ceil(e);let g=Math.floor(n);g===n&&(g-=1),r=g-i+1}else{const i=Math.floor(e);let g=Math.ceil(n);g===n&&(g+=1),r=i-g+1}r>0&&this.removeLastPoints_(r)}addTracedCoordinates_(e,n,r){if(n===r)return;const i=[];if(n<r){const g=Math.ceil(n);let y=Math.floor(r);y===r&&(y-=1);for(let k=g;k<=y;++k)i.push(getCoordinate(e.coordinates,k))}else{const g=Math.floor(n);let y=Math.ceil(r);y===r&&(y+=1);for(let k=g;k>=y;--k)i.push(getCoordinate(e.coordinates,k))}i.length&&this.appendCoordinates(i)}updateTrace_(e){const n=this.traceState_;if(!n.active||n.targetIndex===-1&&distance$1(n.startPx,e.pixel)<this.snapTolerance_)return;const r=getTraceTargetUpdate(e.coordinate,n,this.getMap(),this.snapTolerance_);if(n.targetIndex!==r.index){if(n.targetIndex!==-1){const L=n.targets[n.targetIndex];this.removeTracedCoordinates_(L.startIndex,L.endIndex)}const k=n.targets[r.index];this.addTracedCoordinates_(k,k.startIndex,r.endIndex)}else{const k=n.targets[n.targetIndex];this.addOrRemoveTracedCoordinates_(k,r.endIndex)}n.targetIndex=r.index;const i=n.targets[n.targetIndex];i.endIndex=r.endIndex;const g=interpolateCoordinate(i.coordinates,i.endIndex),y=this.getMap().getPixelFromCoordinate(g);e.coordinate=g,e.pixel=[Math.round(y[0]),Math.round(y[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 i=!this.finishCoordinate_;i&&this.startDrawing_(e.coordinate),!i&&this.freehand_?this.finishDrawing():!this.freehand_&&(!i||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,i=n[0]-r[0],g=n[1]-r[1],y=i*i+g*g;if(this.shouldHandle_=this.freehand_?y>this.squaredClickTolerance_:y<=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 i=!1,g=[this.finishCoordinate_];const y=this.mode_;if(y==="Point")r=!0;else if(y==="Circle")r=this.sketchCoords_.length===2;else if(y==="LineString")i=!n&&this.sketchCoords_.length>this.minPoints_;else if(y==="Polygon"){const k=this.sketchCoords_;i=k[0].length>this.minPoints_,g=[k[0][0],k[0][k[0].length-2]],n?g=[k[0][0]]:g=[k[0][0],k[0][k[0].length-2]]}if(i){const k=this.getMap();for(let L=0,$=g.length;L<$;L++){const V=g[L],z=k.getPixelFromCoordinate(V),re=e[0]-z[0],oe=e[1]-z[1],j=this.freehand_?1:this.snapTolerance_;if(r=Math.sqrt(re*re+oe*oe)<=j,r){this.finishCoordinate_=V;break}}}}return r}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new Feature(new Point(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new Feature);const n=e.getLinearRing(0);let r=this.sketchLine_.getGeometry();r?(r.setFlatCoordinates(n.getLayout(),n.getFlatCoordinates()),r.changed()):(r=new LineString(n.getFlatCoordinates(),n.getLayout()),this.sketchLine_.setGeometry(r))}startDrawing_(e){const n=this.getMap().getView().getProjection(),r=getStrideForLayout(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 Feature(new LineString(this.sketchLineCoords_)));const i=this.geometryFunction_(this.sketchCoords_,void 0,n);this.sketchFeature_=new Feature,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(i),this.updateSketchFeatures_(),this.dispatchEvent(new DrawEvent(DrawEventType.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const n=this.getMap(),r=this.sketchFeature_.getGeometry(),i=n.getView().getProjection(),g=getStrideForLayout(this.geometryLayout_);let y,k;for(;e.length<g;)e.push(0);this.mode_==="Point"?k=this.sketchCoords_:this.mode_==="Polygon"?(y=this.sketchCoords_[0],k=y[y.length-1],this.atFinish_(n.getPixelFromCoordinate(e))&&(e=this.finishCoordinate_.slice())):(y=this.sketchCoords_,k=y[y.length-1]),k[0]=e[0],k[1]=e[1],this.geometryFunction_(this.sketchCoords_,r,i),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 i,g;const y=this.mode_;return y==="LineString"||y==="Circle"?(this.finishCoordinate_=e.slice(),g=this.sketchCoords_,g.length>=this.maxPoints_&&(this.freehand_?g.pop():i=!0),g.push(e.slice()),this.geometryFunction_(g,n,r)):y==="Polygon"&&(g=this.sketchCoords_[0],g.length>=this.maxPoints_&&(this.freehand_?g.pop():i=!0),g.push(e.slice()),i&&(this.finishCoordinate_=g[0]),this.geometryFunction_(this.sketchCoords_,n,r)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),i?this.finishDrawing():this.sketchFeature_}removeLastPoints_(e){if(!this.sketchFeature_)return;const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection(),i=this.mode_;for(let g=0;g<e;++g){let y;if(i==="LineString"||i==="Circle"){if(y=this.sketchCoords_,y.splice(-2,1),y.length>=2){this.finishCoordinate_=y[y.length-2].slice();const k=this.finishCoordinate_.slice();y[y.length-1]=k,this.createOrUpdateSketchPoint_(k)}this.geometryFunction_(y,n,r),n.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(n)}else if(i==="Polygon"){y=this.sketchCoords_[0],y.splice(-2,1);const k=this.sketchLine_.getGeometry();if(y.length>=2){const L=y[y.length-2].slice();y[y.length-1]=L,this.createOrUpdateSketchPoint_(L)}k.setCoordinates(y),this.geometryFunction_(this.sketchCoords_,n,r)}if(y.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(),i=this.getMap().getView().getProjection();return this.mode_==="LineString"?(n.pop(),this.geometryFunction_(n,r,i)):this.mode_==="Polygon"&&(n[0].pop(),this.geometryFunction_(n,r,i),n=r.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new MultiPoint([n])):this.type_==="MultiLineString"?e.setGeometry(new MultiLineString([n])):this.type_==="MultiPolygon"&&e.setGeometry(new MultiPolygon([n])),this.dispatchEvent(new DrawEvent(DrawEventType.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 DrawEvent(DrawEventType.DRAWABORT,e))}appendCoordinates(e){const n=this.mode_,r=!this.sketchFeature_;r&&this.startDrawing_(e[0]);let i;if(n==="LineString"||n==="Circle")i=this.sketchCoords_;else if(n==="Polygon")i=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;r&&i.shift(),i.pop();for(let y=0;y<e.length;y++)this.addToDrawing_(e[y]);const g=e[e.length-1];this.sketchFeature_=this.addToDrawing_(g),this.modifyDrawing_(g)}extend(e){const r=e.getGeometry();this.sketchFeature_=e,this.sketchCoords_=r.getCoordinates();const i=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=i.slice(),this.sketchCoords_.push(i.slice()),this.sketchPoint_=new Feature(new Point(i)),this.updateSketchFeatures_(),this.dispatchEvent(new DrawEvent(DrawEventType.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 getDefaultStyleFunction(){const t=createEditingStyle();return function(e,n){return t[e.getGeometry().getType()]}}function getMode(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 disableDoubleClickZoom=()=>{getInstall().getInteractions().forEach(e=>{e instanceof DoubleClickZoom&&e.setActive(!1)})},enableDoubleClickZoom=()=>{getInstall().getInteractions().forEach(e=>{e instanceof DoubleClickZoom&&e.setActive(!0)})},props=vue.ref(),setProps=t=>{props.value=t},getProps=()=>props.value,measureHistory=vue.ref([]),unit=vue.ref("km"),setUnit=t=>{unit.value=t};let helpTooltipElement$1;const state=vue.ref(!1),open$1=()=>{initMapLayer(),disableDoubleClickZoom(),changeCursor("pointer");const t=getInstall();t.on("pointermove",pointerMoveHandler$1),t.getViewport().addEventListener("mouseout",()=>{helpTooltipElement$1&&helpTooltipElement$1.classList.add("hidden")}),addInteraction(),state.value=!0};let vectorSource$1,vectorLayer$1;const initMapLayer=()=>{vectorSource$1=new VectorSource,vectorLayer$1=new VectorLayer({source:vectorSource$1,zIndex:1e3,style:{"fill-color":"rgba(255, 255, 255, 0.2)","stroke-color":"#ffcc33","stroke-width":2,"circle-radius":7,"circle-fill-color":"#ffcc33"}}),getInstall().addLayer(vectorLayer$1)};let sketch$1,helpTooltip;const pointerMoveHandler$1=t=>{if(t.dragging)return;let e="点击选择起点";sketch$1&&(e="单击继续,双击结束"),helpTooltipElement$1&&(helpTooltipElement$1.innerHTML=e,helpTooltip.setPosition(t.coordinate),helpTooltipElement$1.classList.remove("hidden"))},changeCursor=t=>{getInstall().getTargetElement().style.cursor=t};let draw$1;const addInteraction=()=>{draw$1=new Draw({source:vectorSource$1,type:"LineString",style:new Style({fill:new Fill({color:"rgba(255, 255, 255, 0.2)"}),stroke:new Stroke({color:"rgba(255,204,51)",lineDash:[10,10],width:2}),image:new CircleStyle({radius:5,stroke:new Stroke({color:"rgba(0, 0, 0, 0.7)"}),fill:new Fill({color:"rgba(255, 255, 255, 0.2)"})})}),condition:e=>e.originalEvent.target.tagName!=="DIV"}),getInstall().addInteraction(draw$1),createMeasureTooltip$1(),createHelpTooltip$1();let t;draw$1.on("drawstart",function(e){var r;sketch$1=e.feature,sketch$1.set("randomId",generateRandomId());let n;t=(r=sketch$1.getGeometry())==null?void 0:r.on("change",function(i){const g=i.target,y=computedDistance(g,unit.value);n=g.getLastCoordinate(),measureTooltipElement$1&&y&&(measureTooltipElement$1.innerHTML=y),measureTooltip$1.setPosition(n)})}),draw$1.on("drawend",function(){var e,n,r;if(measureTooltipElement$1&&(measureTooltipElement$1.className="ol-tooltip ol-tooltip-static ol-tooltip-measure"),measureTooltipElement$1!=null&&measureTooltipElement$1.innerHTML){const i=(sketch$1==null?void 0:sketch$1.get("randomId"))||generateRandomId();measureHistory.value.push({id:i,value:measureTooltipElement$1==null?void 0:measureTooltipElement$1.innerHTML}),measureTooltipElement$1.innerHTML=`${measureTooltipElement$1.innerHTML}<div class="ol-tooltip-delete-button" data-id="${i}"><i class="map-iconfont icon-delete"></i></div>`}(e=document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button"))==null||e.addEventListener("click",i=>{var y;i.preventDefault(),i.stopPropagation();const g=(y=i.target)==null?void 0:y.getAttribute("data-id");g&&deleteLine(g)}),measureTooltip$1.setOffset([0,-7]),sketch$1=null,measureTooltipElement$1=null,createMeasureTooltip$1(),t&&unByKey(t),(n=getProps())!=null&&n.lineDrawEnd&&((r=getProps())==null||r.lineDrawEnd(measureHistory.value))})},generateRandomId=()=>Math.random().toString(36).substring(2,9);let measureTooltipElement$1,measureTooltip$1;const createMeasureTooltip$1=()=>{measureTooltipElement$1!=null&&measureTooltipElement$1.parentNode&&measureTooltipElement$1.parentNode.removeChild(measureTooltipElement$1),measureTooltipElement$1=document.createElement("div"),measureTooltipElement$1.className="ol-tooltip ol-tooltip-measure",measureTooltip$1=new Overlay({element:measureTooltipElement$1,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),getInstall().addOverlay(measureTooltip$1)},createHelpTooltip$1=()=>{helpTooltipElement$1!=null&&helpTooltipElement$1.parentNode&&helpTooltipElement$1.parentNode.removeChild(helpTooltipElement$1),helpTooltipElement$1=document.createElement("div"),helpTooltipElement$1.className="ol-tooltip hidden",helpTooltip=new Overlay({element:helpTooltipElement$1,offset:[15,0],positioning:"center-left"}),getInstall().addOverlay(helpTooltip)},close$1=()=>{measureHistory.value.forEach((t,e)=>{var i,g;const n=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");n[e]&&((g=(i=n[e])==null?void 0:i.parentNode)==null||g.removeChild(n[e]));const r=vectorSource$1.getFeatures();r[e]&&vectorSource$1.removeFeature(r[e])}),removeInteraction(),enableDoubleClickZoom(),state.value=!1},deleteLine=t=>{var n,r,i,g;const e=measureHistory.value.findIndex(y=>y.id===t);if(e!==-1){measureHistory.value.splice(e,1);const y=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");y[e]&&((r=(n=y[e])==null?void 0:n.parentNode)==null||r.removeChild(y[e]));const k=vectorSource$1.getFeatures();k[e]&&vectorSource$1.removeFeature(k[e])}(i=getProps())!=null&&i.lineDrawEnd&&((g=getProps())==null||g.lineDrawEnd(measureHistory.value))},computedDistance=(t,e)=>{const r=getLength(t);let i="";switch(e){case"m":i=`${Math.round(r*100)/100} m`;break;case"km":i=`${Math.round(r/1e3*100)/100} km`;break;case"nm":i=`${Math.round(r/1.852*100)/100} nm`;break}return i},removeInteraction=()=>{measureHistory.value=[],document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach(e=>{var n;(n=e==null?void 0:e.parentNode)==null||n.removeChild(e)}),vectorSource$1.clear();const t=getInstall();if(draw$1){const e=t.getInteractions().getArray().find(n=>getUid(n)===getUid(draw$1));e&&t.removeInteraction(e)}t.removeLayer(vectorLayer$1),helpTooltipElement$1!=null&&helpTooltipElement$1.parentNode&&helpTooltipElement$1.parentNode.removeChild(helpTooltipElement$1),measureTooltipElement$1!=null&&measureTooltipElement$1.parentNode&&measureTooltipElement$1.parentNode.removeChild(measureTooltipElement$1)},getState=()=>state.value,drawLine={open:open$1,close:close$1,deleteLine,setUnit,getState},mapInstance=vue.ref(),getInstall=()=>mapInstance.value,getView=()=>getInstall().getView(),getZoom=()=>{var t;return(t=getView())==null?void 0:t.getZoom()},setZoom=t=>{var e;(e=getView())==null||e.setZoom(t)},setCenter=(t,e)=>{var n;(n=getView())==null||n.setCenter(fromLonLat([t,e]))},getCenter=()=>{var e;const t=(e=getView())==null?void 0:e.getCenter();return toLonLat(t)},getSize=()=>{var t;return(t=getInstall())==null?void 0:t.getSize()},BASE_LAYER_MAP=new Map$2,initMap=t=>{setBaseLayerMap(t);const e={zoom:t.zoom,center:fromLonLat(t.center),minZoom:MAP_ZOOM.min,maxZoom:MAP_ZOOM.max,constrainResolution:!0,enableRotation:!1,multiWorld:!0},n=new Map$2({target:"map",controls:defaults$2({zoom:!1}),layers:[BASE_LAYER_MAP.get("vectorTile"),BASE_LAYER_MAP.get("vectorTileMark"),BASE_LAYER_MAP.get("satelliteImgTile"),BASE_LAYER_MAP.get("satelliteImgTileMark")],view:new View(e)});mapInstance.value=n,setBaseMapEvent(n,t)},setBaseLayerMap=t=>{BASE_LAYER_MAP.set("vectorTile",new TileLayer({source:new XYZ({url:BASE_MAP_LINK.vectorTile}),visible:t.layerType==="vector",zIndex:0,preload:1,className:"vector"})),BASE_LAYER_MAP.set("vectorTileMark",new TileLayer({source:new XYZ({url:BASE_MAP_LINK.vectorTileMark}),visible:t.layerType==="vector",zIndex:1,preload:1,className:"vector"})),BASE_LAYER_MAP.set("satelliteImgTile",new TileLayer({source:new XYZ({url:BASE_MAP_LINK.satelliteImgTile}),visible:t.layerType==="satellite",zIndex:0,preload:1,className:"satellite"})),BASE_LAYER_MAP.set("satelliteImgTileMark",new TileLayer({source:new XYZ({url:BASE_MAP_LINK.satelliteImgTileMark}),visible:t.layerType==="satellite",zIndex:1,preload:1,className:"satellite"})),BASE_LAYER_MAP.set("greenMark",new TileLayer({source:new XYZ({url:BASE_MAP_LINK.greenTile}),visible:t.showGreenLayer,zIndex:2,className:"greenTile"}))},setBaseMapEvent=(t,e)=>{t.on("moveend",()=>{var r;const n=getZoom();(r=e.mapMoveEnd)==null||r.call(e,n),reRenderTrackLine()}),t.on("pointermove",n=>{const r=t.getEventPixel(n.originalEvent),i=t.forEachFeatureAtPixel(r,g=>g);handleShipMapEvent(i,"hover"),handleTrackMapEvent(i,"hover",n),i&&handlePortHover(r)}),t.on("movestart",()=>{removeSelectedOverlay()}),t.on("click",debounce(n=>{if(console.log("1",drawLine.getState()),drawLine.getState())return;const r=t.getEventPixel(n.originalEvent),i=t.forEachFeatureAtPixel(r,g=>{if(g!=null&&g.get("shipData")||g!=null&&g.get("portData"))return g});if(console.log("2",i),!!i){if(n.preventDefault(),n.stopPropagation(),i.get("shipData"))handleShipMapEvent(i,"click",e==null?void 0:e.selectShip);else if(i.get("portData")){const g=i.get("portData");selectedPort(g),e==null||e.selectPort(g)}}},150))},_hoisted_1$7={id:"scale-line-container"},_sfc_main$9=vue.defineComponent({__name:"scaleLine",setup(t,{expose:e}){return e({setScaleLine:r=>{r||(r="metric");const i=new ScaleLine$1({units:r}),g=document.getElementById("scale-line-container");g&&(i.setTarget(g),getInstall().addControl(i))}}),(r,i)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$7))}}),ScaleLine=_export_sfc(_sfc_main$9,[["__scopeId","data-v-31ff8293"]]),_hoisted_1$6={class:"zoom"},_sfc_main$8=vue.defineComponent({__name:"zoomControl",setup(t){const e=vue.inject("mapInstance"),n=()=>{if(e!=null&&e.value){const i=getZoom();if(!i)return;setZoom(i+1)}},r=()=>{if(e!=null&&e.value){const i=getZoom();if(!i)return;setZoom(i-1)}};return(i,g)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$6,[vue.createElementVNode("div",{class:"button big-button",onClick:n}," + "),vue.createElementVNode("div",{class:"button small-button",onClick:r}," - ")]))}}),ZoomControl=_export_sfc(_sfc_main$8,[["__scopeId","data-v-37968fef"]]),getLayers=()=>{var t;return(t=getInstall())==null?void 0:t.getLayers()},layerType=vue.ref("vector"),getShowLayerType=()=>layerType.value,setShowLayerType=t=>{layerType.value=t;const e=getLayers();e&&e.getArray().forEach(n=>{n.setVisible(n.className_===t)})},showGreenTile=vue.ref(),getGreenTileVisible=()=>showGreenTile.value,setGreenTileVisible=t=>{if(t!==showGreenTile.value){if(t){const e=getLayers();if(!e.getArray().find(r=>r.className_==="greenTile")){const r=new TileLayer({source:new XYZ({url:BASE_MAP_LINK.greenTile}),visible:t,zIndex:2,className:"greenTile"});e.push(r)}}else{const e=getLayers(),n=e.getArray().find(r=>r.className_==="greenTile");n&&e.remove(n)}showGreenTile.value=t}};let storeFeature;const open=()=>{init()},init=()=>{initLayer(),createMeasureTooltip(),createHelpTooltip(),initDraw()};let vectorLayer=null,vectorSource=null;const initLayer=()=>{if(vectorLayer||vectorSource)return;const t=new VectorSource,e=new VectorLayer({source:t,style:new Style({stroke:new Stroke({color:"#fbcc33",width:2})})});vectorLayer=e,vectorSource=t;const n=getInstall();n.on("pointermove",pointerMoveHandler),n.addLayer(e),n.on(["dblclick"],function(r){draw&&(r.stopPropagation(),r.preventDefault())})};let sketch;const pointerMoveHandler=t=>{if(t.dragging)return;const e=sketch?"单击继续,双击结束":"点击选择起点";helpTooltipElement&&(helpTooltipElement.innerHTML=e,tipOverlay.setPosition(t.coordinate))};let draw,lineLimitError=!1;const initDraw=()=>{var e,n;if(storeFeature){helpTooltipElement!=null&&helpTooltipElement.parentNode&&helpTooltipElement.parentNode.removeChild(helpTooltipElement);const r=storeFeature.getGeometry();if(!r)return;const i=computedArea(r,"nm");measureTooltipElement&&(measureTooltipElement.innerHTML=`
216
+ <span class="text">面积:${i}${lineLimitError?'<span class="error pl-12">超出可以绘画的距离</span>':""}</span>
217
+ `),measureTooltipElement&&(measureTooltipElement.innerHTML+='<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');const g=r.getCoordinates(),y=g[0][g[0].length-2];measureTooltip.setPosition(y),vectorLayer&&((e=vectorLayer.getSource())==null||e.addFeature(storeFeature)),console.log("helpTooltipElement",(n=document.querySelector(".delete-icon"))==null?void 0:n.parentNode),setTimeout(()=>{var k;(k=document.querySelector(".delete-icon"))==null||k.addEventListener("click",()=>{var L;console.log("delete"),reset(),(L=getProps())==null||L.areaDrawEnd([])})},0);return}draw=new Draw({type:"Polygon",source:vectorSource,trace:!0,style:[new Style({stroke:new Stroke({color:"rgba(255, 255, 255, 1)",width:1.5,lineDash:[10,10]}),fill:new Fill({color:"rgba(255, 255, 255, 0.25)"})}),new Style({image:new CircleStyle({radius:5,fill:new Fill({color:"rgb(51,112,255, 1)"})}),geometry:function(r){const i=r.getGeometry().getCoordinates();return new MultiPoint(i)}})]}),getInstall().addInteraction(draw);let t;draw.on("drawstart",r=>{var i;sketch=r.feature,t=(i=sketch.getGeometry())==null?void 0:i.on("change",g=>{const y=g.target,k=computedArea(y,"nm"),$=y.getCoordinates()[0],V=new LineString([$[$.length-2],$[$.length-1]]),z=computedDistance(V,"nm");if(lineLimitError=Number(getLength(V)/1e3)>150,!k)return;const re='<span class="error pl-4">超出可以绘画的距离</span>';measureTooltipElement&&(measureTooltipElement.innerHTML=`
216
218
  <div class="text">
217
- 面积:${y}
218
- ${t?z:""}
219
+ 面积:${k}
220
+ ${lineLimitError?re:""}
219
221
  </div>
220
222
  `),helpTooltipElement&&(helpTooltipElement.innerHTML=`
221
223
  <div class="text">
222
- 面积:${y}
224
+ 面积:${k}
223
225
  </div>
224
- <div class="text ${t?"error":""}">
225
- 线段 ${L.length-2}: ${V}
226
- ${t?z:""}
226
+ <div class="text ${lineLimitError?"error":""}">
227
+ 线段 ${$.length-2}: ${z}
228
+ ${lineLimitError?re:""}
227
229
 
228
230
  </div>
229
231
  <div>
230
232
  <span class="text">单击继续,双击结束</span>
231
233
  </div>
232
- `)})}),draw.on("drawend",n=>{var y,k,L;if(!n.feature.getGeometry())return;measureTooltipElement&&(measureTooltipElement.innerHTML+='<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'),measureTooltip.setOffset([10,0]);const i=n.feature.getGeometry().getCoordinates(),g=i[0][i[0].length-2];measureTooltip.setPosition(g),helpTooltipElement!=null&&helpTooltipElement.parentNode&&helpTooltipElement.parentNode.removeChild(helpTooltipElement),(y=getProps())!=null&&y.areaDrawEnd&&((k=getProps())==null||k.areaDrawEnd(i)),draw&&(draw.setActive(!1),getInstall().removeInteraction(draw),getInstall().getInteractions().forEach(V=>{V instanceof Draw&&(V.setActive(!1),getInstall().removeInteraction(V))})),e&&unByKey(e),(L=document.querySelector(".delete-icon"))==null||L.addEventListener("click",()=>{reset()})})},computedArea=(t,e)=>{const n=getArea(t);switch(e){case"km":return n>1e4?Math.round(n/1e6*100)/100+" km<sup>2</sup>":Math.round(n*100)/100+" m<sup>2</sup>";case"nm":return n>1e4?Math.round(n/1e6/Math.pow(1.852,2)*100)/100+" nm<sup>2</sup>":Math.round(n*100)/100+" m<sup>2</sup>"}};let measureTooltipElement,measureTooltip;const createMeasureTooltip=()=>{measureTooltipElement!=null&&measureTooltipElement.parentNode&&measureTooltipElement.parentNode.removeChild(measureTooltipElement),measureTooltipElement=document.createElement("div"),measureTooltipElement.style.display="flex",measureTooltipElement.className="ol-tooltip ol-tooltip-draw-polygon",measureTooltip=new Overlay({element:measureTooltipElement,offset:[0,-15],positioning:"bottom-center"}),getInstall().addOverlay(measureTooltip)};let helpTooltipElement,tipOverlay;const createHelpTooltip=()=>{helpTooltipElement!=null&&helpTooltipElement.parentNode&&helpTooltipElement.parentNode.removeChild(helpTooltipElement),helpTooltipElement=document.createElement("div"),helpTooltipElement.className="ol-tooltip ol-help-tooltip hidden",tipOverlay=new Overlay({element:helpTooltipElement,offset:[15,0],positioning:"center-left"}),getInstall().addOverlay(tipOverlay)},reset=()=>{var t;vectorSource==null||vectorSource.clear(),draw==null||draw.setActive(!0),(t=measureTooltipElement==null?void 0:measureTooltipElement.parentNode)==null||t.removeChild(measureTooltipElement),measureTooltip.setPosition(void 0),createMeasureTooltip(),createHelpTooltip(),getInstall().removeOverlay(tipOverlay),getInstall().removeOverlay(measureTooltip),initDraw()},close=()=>{vectorSource==null||vectorSource.clear(),vectorSource=null;const t=getInstall();vectorLayer&&(t.removeLayer(vectorLayer),vectorLayer=null),sketch=null,draw&&(t.removeInteraction(draw),draw=null)},drawPolygon={open,reset,close};let currentTruckOverlay=null;const locationTruck=async t=>{const e=getInstall();if(!e||(console.log("vehicleInfo",t),!(t!=null&&t.lon&&(t!=null&&t.lat))))return;const n=Math.abs(Number(t.lon))>180?convertSixHundredThousandToLatLng(t.lon,t.lat):[t.lon,t.lat];drawTruckIcon(t,fromLonLat(n));const r=e.getView(),i=new Point(n);r.setCenter(transform(i.getCoordinates(),projection.data,projection.mercator))},drawTruckIcon=(t,e)=>{const n=getInstall(),r=`${CDN_URL}map/car-icon.gif`;currentTruckOverlay||(currentTruckOverlay=new Overlay({element:document.createElement("div"),positioning:"center-center",stopEvent:!1}),n.addOverlay(currentTruckOverlay));const i=currentTruckOverlay.getElement();i.style.backgroundImage=`url(${r})`,i.style.width="80px",i.style.height="80px";const g=(t==null?void 0:t.drc)||"";i.style.transform=`rotate(${g}deg)`,i.style.backgroundSize="cover",currentTruckOverlay==null||currentTruckOverlay.setPosition(e)},renderTruckTrack=(t,e,n,r=1e3)=>{renderTrackLine(t,e,n,LENGTH_UNIT.KM,"truck",r)},closeTruckTrack=()=>{closeTrack()},removeTruckIcon=()=>{const t=currentTruckOverlay==null?void 0:currentTruckOverlay.getElement();t&&(t.innerHTML="")},resetTrackView=t=>{setTrackViewCenter(t)},playTrack=(t,e)=>{playShipTrack(t,e)},carTrack={locationTruck,renderTruckTrack,removeTruckIcon,closeTruckTrack,resetTrackView,playTrack},_sfc_main$7=vue.defineComponent({__name:"Map",props:{zoom:{default:MAP_ZOOM.default},center:{default:MAP_DEFAULT_CENTER},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}){const n=vue.ref(),r=vue.ref(),i=t;return console.log(i),vue.onMounted(()=>{var y;initMap(i),setProps(i),setShowLayerType(i.layerType),setGreenTileVisible(i.showGreenLayer),(y=r.value)==null||y.setScaleLine(i.scaleLineUnit)}),e({getInstall,getZoom,setZoom,getView,setCenter,getCenter,layer:{getGreenTileVisible,setGreenTileVisible,getShowLayerType,setShowLayerType},ship:{render:renderShipList,selected:renderShipSelected,filter:filterShipShow,blinking:renderShipBlink,clear:clearShipList},track:{renderTrackLine,handleTrackMapEvent,removeAllTrackLayer,playShipTrack,setTrackViewCenter,closeTrack},port:{render:renderPortList,clear:clearPortList,selected:selectedPort},drawLine,drawPolygon,carTrack,utils:{getCalculateExtent:()=>{const y=getView().calculateExtent(getSize()),k=transform([y[0],y[1]],projection.mercator,projection.data),L=transform([y[2],y[3]],projection.mercator,projection.data);return[k[0],k[1],L[0],L[1]]},convertSixHundredThousandToLatLng,calculateCirclePoints}}),(y,k)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{id:"map",ref_key:"zhMapRef",ref:n,class:"zh-map"},null,512),vue.createVNode(ScaleLine,{ref_key:"scaleLineRef",ref:r},null,512),vue.createVNode(ZoomControl,{ref:"zoomControlRef"},null,512)],64))}}),Map$1=_export_sfc(_sfc_main$7,[["__scopeId","data-v-6a8d9fff"]]),ZhMap=withInstall$1(Map$1);var zhCn={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}"}}};/**!
234
+ `)})}),draw.on("drawend",r=>{var k,L,$;if(!r.feature.getGeometry())return;storeFeature=r.feature,measureTooltipElement&&(measureTooltipElement.innerHTML+='<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'),measureTooltip.setOffset([10,0]);const i=r.feature.getGeometry(),g=i.getCoordinates(),y=g[0][g[0].length-2];if(measureTooltip.setPosition(y),helpTooltipElement!=null&&helpTooltipElement.parentNode&&helpTooltipElement.parentNode.removeChild(helpTooltipElement),(k=getProps())!=null&&k.areaDrawEnd){i.getInteriorPoint().getCoordinates();const V=g[0].map(z=>transform(z,projection.mercator,projection.data));(L=getProps())==null||L.areaDrawEnd(V)}draw&&(draw.setActive(!1),getInstall().removeInteraction(draw),getInstall().getInteractions().forEach(z=>{z instanceof Draw&&(z.setActive(!1),getInstall().removeInteraction(z))})),t&&unByKey(t),($=document.querySelector(".delete-icon"))==null||$.addEventListener("click",()=>{var V;reset(),(V=getProps())==null||V.areaDrawEnd([])})})},computedArea=(t,e)=>{const n=getArea(t);switch(e){case"km":return n>1e4?Math.round(n/1e6*100)/100+" km<sup>2</sup>":Math.round(n*100)/100+" m<sup>2</sup>";case"nm":return n>1e4?Math.round(n/1e6/Math.pow(1.852,2)*100)/100+" nm<sup>2</sup>":Math.round(n*100)/100+" m<sup>2</sup>"}};let measureTooltipElement,measureTooltip;const createMeasureTooltip=()=>{measureTooltipElement!=null&&measureTooltipElement.parentNode&&measureTooltipElement.parentNode.removeChild(measureTooltipElement),measureTooltipElement=document.createElement("div"),measureTooltipElement.style.display="flex",measureTooltipElement.className="ol-tooltip ol-tooltip-draw-polygon",measureTooltip=new Overlay({element:measureTooltipElement,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),getInstall().addOverlay(measureTooltip)};let helpTooltipElement,tipOverlay;const createHelpTooltip=()=>{helpTooltipElement!=null&&helpTooltipElement.parentNode&&helpTooltipElement.parentNode.removeChild(helpTooltipElement),helpTooltipElement=document.createElement("div"),helpTooltipElement.className="ol-tooltip ol-help-tooltip",tipOverlay=new Overlay({element:helpTooltipElement,offset:[15,0],positioning:"center-left"}),getInstall().addOverlay(tipOverlay)},reset=()=>{vectorSource==null||vectorSource.clear(),storeFeature=null,createMeasureTooltip(),createHelpTooltip(),initDraw()},close=()=>{const t=getInstall();vectorSource==null||vectorSource.clear(),vectorSource=null,vectorLayer&&(t.removeLayer(vectorLayer),vectorLayer=null),sketch=null,draw&&(draw=null,t.getInteractions().forEach(e=>{e instanceof Draw&&t.removeInteraction(e)})),helpTooltipElement!=null&&helpTooltipElement.parentElement&&helpTooltipElement.parentElement.removeChild(helpTooltipElement),measureTooltipElement!=null&&measureTooltipElement.parentElement&&measureTooltipElement.parentElement.removeChild(measureTooltipElement),tipOverlay&&t.removeOverlay(tipOverlay),measureTooltip&&t.removeOverlay(measureTooltip)},drawPolygon={open,close,reset};let currentTruckOverlay=null;const locationTruck=async t=>{const e=getInstall();if(!e||(console.log("vehicleInfo",t),!(t!=null&&t.lon&&(t!=null&&t.lat))))return;const n=Math.abs(Number(t.lon))>180?convertSixHundredThousandToLatLng(t.lon,t.lat):[t.lon,t.lat];drawTruckIcon(t,fromLonLat(n));const r=e.getView(),i=new Point(n);r.setCenter(transform(i.getCoordinates(),projection.data,projection.mercator))},drawTruckIcon=(t,e)=>{const n=getInstall(),r=`${CDN_URL}map/car-icon.gif`;currentTruckOverlay||(currentTruckOverlay=new Overlay({element:document.createElement("div"),positioning:"center-center",stopEvent:!1}),n.addOverlay(currentTruckOverlay));const i=currentTruckOverlay.getElement();i.style.backgroundImage=`url(${r})`,i.style.width="80px",i.style.height="80px";const g=(t==null?void 0:t.drc)||"";i.style.transform=`rotate(${g}deg)`,i.style.backgroundSize="cover",currentTruckOverlay==null||currentTruckOverlay.setPosition(e)},renderTruckTrack=(t,e,n,r=1e3)=>{renderTrackLine(t,e,n,LENGTH_UNIT.KM,"truck",r)},closeTruckTrack=()=>{closeTrack()},removeTruckIcon=()=>{const t=currentTruckOverlay==null?void 0:currentTruckOverlay.getElement();t&&(t.innerHTML="")},resetTrackView=t=>{setTrackViewCenter(t)},playTrack=(t,e)=>{playShipTrack(t,e)},carTrack={locationTruck,renderTruckTrack,removeTruckIcon,closeTruckTrack,resetTrackView,playTrack},_sfc_main$7=vue.defineComponent({__name:"Map",props:{zoom:{default:MAP_ZOOM.default},center:{default:MAP_DEFAULT_CENTER},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}){const n=vue.ref(),r=vue.ref(),i=t;return console.log(i),vue.onMounted(()=>{var y;initMap(i),setProps(i),setShowLayerType(i.layerType),setGreenTileVisible(i.showGreenLayer),(y=r.value)==null||y.setScaleLine(i.scaleLineUnit)}),e({getInstall,getZoom,setZoom,getView,setCenter,getCenter,layer:{getGreenTileVisible,setGreenTileVisible,getShowLayerType,setShowLayerType},ship:{render:renderShipList,selected:renderShipSelected,filter:filterShipShow,blinking:renderShipBlink,clear:clearShipList},track:{renderTrackLine,handleTrackMapEvent,removeAllTrackLayer,playShipTrack,setTrackViewCenter,closeTrack,getTrack:getShowTracks},port:{render:renderPortList,clear:clearPortList,selected:selectedPort},drawLine,drawPolygon,carTrack,utils:{getCalculateExtent:()=>{const y=getView().calculateExtent(getSize()),k=transform([y[0],y[1]],projection.mercator,projection.data),L=transform([y[2],y[3]],projection.mercator,projection.data);return[k[0],k[1],L[0],L[1]]},convertSixHundredThousandToLatLng,calculateCirclePoints}}),(y,k)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{id:"map",ref_key:"zhMapRef",ref:n,class:"zh-map"},null,512),vue.createVNode(ScaleLine,{ref_key:"scaleLineRef",ref:r},null,512),vue.createVNode(ZoomControl,{ref:"zoomControlRef"},null,512)],64))}}),Map$1=_export_sfc(_sfc_main$7,[["__scopeId","data-v-a27bd97d"]]),ZhMap=withInstall$1(Map$1);var zhCn={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}"}}};/**!
233
235
  * Sortable 1.15.6
234
236
  * @author RubaXa <trash@rubaxa.org>
235
237
  * @author owenm <owen23355@gmail.com>