cmap-core 0.0.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +568 -0
- package/dist/cmap-core.css +1 -1
- package/dist/index.es.d.ts +837 -34
- package/dist/index.es.js +4819 -1873
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -61
- package/dist/index.umd.js.map +1 -1
- package/package.json +22 -16
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(M,A){typeof exports=="object"&&typeof module<"u"?A(exports,require("mapbox-gl")):typeof define=="function"&&define.amd?define(["exports","mapbox-gl"],A):(M=typeof globalThis<"u"?globalThis:M||self,A(M["cmap-core"]={},M.mapboxgl))})(this,(function(M,A){"use strict";function Fi(e){return["boolean","number"].includes(typeof e)?!1:e instanceof Array?e.length===0:e instanceof Object?JSON.stringify(e)==="{}":["null",null,void 0,"undefined",""].includes(e)}class be{_options;cacheKey;cacheType;constructor(t){this._options=t,this.cacheKey=t.uniqueKey+"-",this.cacheType=t.type}set({name:t,content:i}){const n=`${this.cacheKey}${t}`;typeof i=="function"&&(i=i.toString());const r={dataType:typeof i,content:i,type:this.cacheType,datetime:new Date().getTime()};this.cacheType==="sessionstorage"?window.sessionStorage.setItem(n,JSON.stringify(r)):window.localStorage.setItem(n,JSON.stringify(r))}get(t){const i=`${this.cacheKey}${t}`;let n="";if(this.cacheType==="sessionstorage"?n=window.sessionStorage.getItem(i):n=window.localStorage.getItem(i),Fi(n)){console.warn(`未找到缓存,${t}不存在!`);return}try{const r=JSON.parse(n);return["string","number","boolean","object"].includes(r.dataType)?r.content:r.dataType==="function"?this.stringParseToFunction(r.content):r.content}catch{return n}}remove(t){const i=`${this.cacheKey}${t}`;this.cacheType==="sessionstorage"?window.sessionStorage.removeItem(i):window.localStorage.removeItem(i)}removeAll(){const t=[];if(this.cacheType==="sessionstorage")for(let i=0;i<=window.sessionStorage.length;i++)t.push({name:window.sessionStorage.key(i),content:this.get(window.sessionStorage.key(i))});else for(let i=0;i<=window.localStorage.length;i++)t.push({name:window.localStorage.key(i),content:this.get(window.localStorage.key(i))});return t}stringParseToFunction(t){return new Function('"use strict"; return ('+t+")")()}}function Se(e,t,i=0,n=e.length-1,r=Bi){for(;n>i;){if(n-i>600){const h=n-i+1,c=t-i+1,l=Math.log(h),u=.5*Math.exp(2*l/3),m=.5*Math.sqrt(l*u*(h-u)/h)*(c-h/2<0?-1:1),y=Math.max(i,Math.floor(t-c*u/h+m)),w=Math.min(n,Math.floor(t+(h-c)*u/h+m));Se(e,t,y,w,r)}const s=e[t];let o=i,a=n;for(xt(e,i,t),r(e[n],s)>0&&xt(e,i,n);o<a;){for(xt(e,o,a),o++,a--;r(e[o],s)<0;)o++;for(;r(e[a],s)>0;)a--}r(e[i],s)===0?xt(e,i,a):(a++,xt(e,a,n)),a<=t&&(i=a+1),t<=a&&(n=a-1)}}function xt(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function Bi(e,t){return e<t?-1:e>t?1:0}class zi{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let i=this.data;const n=[];if(!$t(t,i))return n;const r=this.toBBox,s=[];for(;i;){for(let o=0;o<i.children.length;o++){const a=i.children[o],h=i.leaf?r(a):a;$t(t,h)&&(i.leaf?n.push(a):Wt(t,h)?this._all(a,n):s.push(a))}i=s.pop()}return n}collides(t){let i=this.data;if(!$t(t,i))return!1;const n=[];for(;i;){for(let r=0;r<i.children.length;r++){const s=i.children[r],o=i.leaf?this.toBBox(s):s;if($t(t,o)){if(i.leaf||Wt(t,o))return!0;n.push(s)}}i=n.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let i=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=i;else if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){const n=this.data;this.data=i,i=n}this._insert(i,this.data.height-i.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=lt([]),this}remove(t,i){if(!t)return this;let n=this.data;const r=this.toBBox(t),s=[],o=[];let a,h,c;for(;n||s.length;){if(n||(n=s.pop(),h=s[s.length-1],a=o.pop(),c=!0),n.leaf){const l=Yi(t,n.children,i);if(l!==-1)return n.children.splice(l,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&Wt(n,r)?(s.push(n),o.push(a),a=0,h=n,n=n.children[0]):h?(a++,n=h.children[a],c=!1):n=null}return this}toBBox(t){return t}compareMinX(t,i){return t.minX-i.minX}compareMinY(t,i){return t.minY-i.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,i){const n=[];for(;t;)t.leaf?i.push(...t.children):n.push(...t.children),t=n.pop();return i}_build(t,i,n,r){const s=n-i+1;let o=this._maxEntries,a;if(s<=o)return a=lt(t.slice(i,n+1)),ht(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=lt([]),a.leaf=!1,a.height=r;const h=Math.ceil(s/o),c=h*Math.ceil(Math.sqrt(o));Me(t,i,n,c,this.compareMinX);for(let l=i;l<=n;l+=c){const u=Math.min(l+c-1,n);Me(t,l,u,h,this.compareMinY);for(let m=l;m<=u;m+=h){const y=Math.min(m+h-1,u);a.children.push(this._build(t,m,y,r-1))}}return ht(a,this.toBBox),a}_chooseSubtree(t,i,n,r){for(;r.push(i),!(i.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let h=0;h<i.children.length;h++){const c=i.children[h],l=Kt(c),u=Ui(t,c)-l;u<o?(o=u,s=l<s?l:s,a=c):u===o&&l<s&&(s=l,a=c)}i=a||i.children[0]}return i}_insert(t,i,n){const r=n?t:this.toBBox(t),s=[],o=this._chooseSubtree(r,this.data,i,s);for(o.children.push(t),_t(o,r);i>=0&&s[i].children.length>this._maxEntries;)this._split(s,i),i--;this._adjustParentBBoxes(r,s,i)}_split(t,i){const n=t[i],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);const o=this._chooseSplitIndex(n,s,r),a=lt(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,ht(n,this.toBBox),ht(a,this.toBBox),i?t[i-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,i){this.data=lt([t,i]),this.data.height=t.height+1,this.data.leaf=!1,ht(this.data,this.toBBox)}_chooseSplitIndex(t,i,n){let r,s=1/0,o=1/0;for(let a=i;a<=n-i;a++){const h=wt(t,0,a,this.toBBox),c=wt(t,a,n,this.toBBox),l=Hi(h,c),u=Kt(h)+Kt(c);l<s?(s=l,r=a,o=u<o?u:o):l===s&&u<o&&(o=u,r=a)}return r||n-i}_chooseSplitAxis(t,i,n){const r=t.leaf?this.compareMinX:ji,s=t.leaf?this.compareMinY:Xi,o=this._allDistMargin(t,i,n,r),a=this._allDistMargin(t,i,n,s);o<a&&t.children.sort(r)}_allDistMargin(t,i,n,r){t.children.sort(r);const s=this.toBBox,o=wt(t,0,i,s),a=wt(t,n-i,n,s);let h=Nt(o)+Nt(a);for(let c=i;c<n-i;c++){const l=t.children[c];_t(o,t.leaf?s(l):l),h+=Nt(o)}for(let c=n-i-1;c>=i;c--){const l=t.children[c];_t(a,t.leaf?s(l):l),h+=Nt(a)}return h}_adjustParentBBoxes(t,i,n){for(let r=n;r>=0;r--)_t(i[r],t)}_condense(t){for(let i=t.length-1,n;i>=0;i--)t[i].children.length===0?i>0?(n=t[i-1].children,n.splice(n.indexOf(t[i]),1)):this.clear():ht(t[i],this.toBBox)}}function Yi(e,t,i){if(!i)return t.indexOf(e);for(let n=0;n<t.length;n++)if(i(e,t[n]))return n;return-1}function ht(e,t){wt(e,0,e.children.length,t,e)}function wt(e,t,i,n,r){r||(r=lt(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=t;s<i;s++){const o=e.children[s];_t(r,e.leaf?n(o):o)}return r}function _t(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function ji(e,t){return e.minX-t.minX}function Xi(e,t){return e.minY-t.minY}function Kt(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Nt(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Ui(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function Hi(e,t){const i=Math.max(e.minX,t.minX),n=Math.max(e.minY,t.minY),r=Math.min(e.maxX,t.maxX),s=Math.min(e.maxY,t.maxY);return Math.max(0,r-i)*Math.max(0,s-n)}function Wt(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function $t(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function lt(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Me(e,t,i,n,r){const s=[t,i];for(;s.length;){if(i=s.pop(),t=s.pop(),i-t<=n)continue;const o=t+Math.ceil((i-t)/n/2)*n;Se(e,o,t,i,r),s.push(t,o,o,i)}}var bt=(e=>(e[e.MIN_X=0]="MIN_X",e[e.MIN_Y=1]="MIN_Y",e[e.MAX_X=2]="MAX_X",e[e.MAX_Y=3]="MAX_Y",e))(bt||{});class Ee{static MIN_X=bt.MIN_X;static MIN_Y=bt.MIN_Y;static MAX_X=bt.MAX_X;static MAX_Y=bt.MAX_Y;id;visible=!0;dir="top-left";dirs=["top-left","top-right","bottom-left","bottom-right"];_options;constructor(t){this.id=t.id,this._options=t}get minX(){return this._options[this.dir].minX}get minY(){return this._options[this.dir].minY}get maxX(){return this._options[this.dir].maxX}get maxY(){return this._options[this.dir].maxY}getBBox(){return this._options[this.dir]}setVisible(t){this.visible=t}setDir(t){this.dir=t}isIntersect(t){const{minX:i,minY:n,maxX:r,maxY:s}=t;return i<=this.minX&&n<=this.minY&&this.maxX<=r&&this.maxY<=s}}class Vt{_tree=new zi;_map;_collisionList=[];constructor(t,i){this._map=t,Array.isArray(i?.collisions)&&i.collisions.length>0&&this.load(i.collisions)}load(t){return this._tree.clear(),this._collisionList=t.map(i=>new Ee(i)),this.collides()}getItem(t){return this._collisionList.find(i=>i.id===t)}clear(){this._tree.clear()}getCollisions(){return this._collisionList}collides(){for(const t of this._collisionList)for(const i of t.dirs){t.setDir(i);const n=this._tree.collides(t);if(t.setVisible(!n),t.visible){this._tree.insert(t);break}}return this.getCollisions()}}const qi="mapbox-gl-cache";var Qt=(e=>(e[e.SUCCESS=0]="SUCCESS",e[e.FAIL=-1]="FAIL",e))(Qt||{}),R=63710088e-1,Le={centimeters:R*100,centimetres:R*100,degrees:360/(2*Math.PI),feet:R*3.28084,inches:R*39.37,kilometers:R/1e3,kilometres:R/1e3,meters:R,metres:R,miles:R/1609.344,millimeters:R*1e3,millimetres:R*1e3,nauticalmiles:R/1852,radians:1,yards:R*1.0936};function St(e,t,i={}){const n={type:"Feature"};return(i.id===0||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}function Dt(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ie(e[0])||!Ie(e[1]))throw new Error("coordinates must contain numbers");return St({type:"Point",coordinates:e},t,i)}function te(e,t,i={}){for(const r of e){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let s=0;s<r[r.length-1].length;s++)if(r[r.length-1][s]!==r[0][s])throw new Error("First and last Position are not equivalent.")}return St({type:"Polygon",coordinates:e},t,i)}function Pt(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return St({type:"LineString",coordinates:e},t,i)}function Zi(e,t,i={}){return St({type:"MultiLineString",coordinates:e},t,i)}function Gi(e,t,i={}){return St({type:"MultiPolygon",coordinates:e},t,i)}function Ji(e,t="kilometers"){const i=Le[t];if(!i)throw new Error(t+" units is invalid");return e*i}function Ki(e,t="kilometers"){const i=Le[t];if(!i)throw new Error(t+" units is invalid");return e/i}function Ce(e){return e%(2*Math.PI)*180/Math.PI}function X(e){return e%360*Math.PI/180}function Ae(e,t="kilometers",i="kilometers"){if(!(e>=0))throw new Error("length must be a positive number");return Ji(Ki(e,t),i)}function Ie(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Wi(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function U(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return[...e.geometry.coordinates];if(e.type==="Point")return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Te(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Vi(e){return e.type==="Feature"?e.geometry:e}function Mt(e,t,i={}){if(i.final===!0)return Qi(e,t);const n=U(e),r=U(t),s=X(n[0]),o=X(r[0]),a=X(n[1]),h=X(r[1]),c=Math.sin(o-s)*Math.cos(h),l=Math.cos(a)*Math.sin(h)-Math.sin(a)*Math.cos(h)*Math.cos(o-s);return Ce(Math.atan2(c,l))}function Qi(e,t){let i=Mt(t,e);return i=(i+180)%360,i}function tn(e,t,i={}){let n;return i.final?n=Oe(U(t),U(e)):n=Oe(U(e),U(t)),n>180?-(360-n):n}function Oe(e,t){const i=X(e[1]),n=X(t[1]);let r=X(t[0]-e[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);const s=Math.log(Math.tan(n/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),o=Math.atan2(r,s);return(Ce(o)+360)%360}function Rt(e,t,i){if(e!==null)for(var n,r,s,o,a,h,c,l=0,u=0,m,y=e.type,w=y==="FeatureCollection",T=y==="Feature",v=w?e.features.length:1,O=0;O<v;O++){c=w?e.features[O].geometry:T?e.geometry:e,m=c?c.type==="GeometryCollection":!1,a=m?c.geometries.length:1;for(var B=0;B<a;B++){var S=0,Y=0;if(o=m?c.geometries[B]:c,o!==null){h=o.coordinates;var k=o.type;switch(l=i&&(k==="Polygon"||k==="MultiPolygon")?1:0,k){case null:break;case"Point":if(t(h,u,O,S,Y)===!1)return!1;u++,S++;break;case"LineString":case"MultiPoint":for(n=0;n<h.length;n++){if(t(h[n],u,O,S,Y)===!1)return!1;u++,k==="MultiPoint"&&S++}k==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(n=0;n<h.length;n++){for(r=0;r<h[n].length-l;r++){if(t(h[n][r],u,O,S,Y)===!1)return!1;u++}k==="MultiLineString"&&S++,k==="Polygon"&&Y++}k==="Polygon"&&S++;break;case"MultiPolygon":for(n=0;n<h.length;n++){for(Y=0,r=0;r<h[n].length;r++){for(s=0;s<h[n][r].length-l;s++){if(t(h[n][r][s],u,O,S,Y)===!1)return!1;u++}Y++}S++}break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(Rt(o.geometries[n],t,i)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ke(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;const i=[1/0,1/0,-1/0,-1/0];return Rt(e,n=>{i[0]>n[0]&&(i[0]=n[0]),i[1]>n[1]&&(i[1]=n[1]),i[2]<n[0]&&(i[2]=n[0]),i[3]<n[1]&&(i[3]=n[1])}),i}function en(e,t={}){const i=Number(e[0]),n=Number(e[1]),r=Number(e[2]),s=Number(e[3]);if(e.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");const o=[i,n];return te([[o,[r,n],[r,s],[i,s],o]],t.properties,{bbox:e,id:t.id})}function Ne(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function nn(e,t={}){let i=0,n=0,r=0;return Rt(e,function(s){i+=s[0],n+=s[1],r++},!0),Dt([i/r,n/r],t.properties)}function $e(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return De(e);case"FeatureCollection":return rn(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return ee(e);default:throw new Error("unknown GeoJSON type")}}function De(e){const t={type:"Feature"};return Object.keys(e).forEach(i=>{switch(i){case"type":case"properties":case"geometry":return;default:t[i]=e[i]}}),t.properties=Pe(e.properties),e.geometry==null?t.geometry=null:t.geometry=ee(e.geometry),t}function Pe(e){const t={};return e&&Object.keys(e).forEach(i=>{const n=e[i];typeof n=="object"?n===null?t[i]=null:Array.isArray(n)?t[i]=n.map(r=>r):t[i]=Pe(n):t[i]=n}),t}function rn(e){const t={type:"FeatureCollection"};return Object.keys(e).forEach(i=>{switch(i){case"type":case"features":return;default:t[i]=e[i]}}),t.features=e.features.map(i=>De(i)),t}function ee(e){const t={type:e.type};return e.bbox&&(t.bbox=e.bbox),e.type==="GeometryCollection"?(t.geometries=e.geometries.map(i=>ee(i)),t):(t.coordinates=Re(e.coordinates),t)}function Re(e){const t=e;return typeof t[0]!="object"?t.slice():t.map(i=>Re(i))}function sn(e,t,i={}){const n=U(e),r=U(t);r[0]+=r[0]-n[0]>180?-360:n[0]-r[0]>180?360:0;const s=on(n,r);return Ae(s,"meters",i.units)}function on(e,t,i){i=i===void 0?R:Number(i);const n=i,r=e[1]*Math.PI/180,s=t[1]*Math.PI/180,o=s-r;let a=Math.abs(t[0]-e[0])*Math.PI/180;a>Math.PI&&(a-=2*Math.PI);const h=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),c=Math.abs(h)>1e-11?o/h:Math.cos(r);return Math.sqrt(o*o+c*c*a*a)*n}function an(e,t,i,n={}){const r=t<0;let s=Ae(Math.abs(t),n.units,"meters");r&&(s=-Math.abs(s));const o=U(e),a=cn(o,s,i);return a[0]+=a[0]-o[0]>180?-360:o[0]-a[0]>180?360:0,Dt(a,n.properties)}function cn(e,t,i,n){n=n===void 0?R:Number(n);const r=t/n,s=e[0]*Math.PI/180,o=X(e[1]),a=X(i),h=r*Math.cos(a);let c=o+h;Math.abs(c)>Math.PI/2&&(c=c>0?Math.PI-c:-Math.PI-c);const l=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),u=Math.abs(l)>1e-11?h/l:Math.cos(o),m=r*Math.sin(a)/u;return[((s+m)*180/Math.PI+540)%360-180,c*180/Math.PI]}function hn(e,t,i){if(i=i||{},!Wi(i))throw new Error("options is invalid");const n=i.pivot,r=i.mutate;if(!e)throw new Error("geojson is required");if(t==null||isNaN(t))throw new Error("angle is required");if(t===0)return e;const s=n??nn(e);return(r===!1||r===void 0)&&(e=$e(e)),Rt(e,function(o){const h=tn(s,o)+t,c=sn(s,o),l=Te(an(s,c,h));o[0]=l[0],o[1]=l[1]}),e}function ln(e,t={}){var i,n,r,s=t.properties,o=(i=t.autoComplete)!=null?i:!0,a=(n=t.orderCoords)!=null?n:!0,h=(r=t.mutate)!=null?r:!1;if(h||(e=$e(e)),e.type==="FeatureCollection"){var c=[];return e.features.forEach(function(l){c.push(Te(Fe(l,{},o,a)))}),Gi(c,s)}else return Fe(e,s,o,a)}function Fe(e,t,i,n){t=t||(e.type==="Feature"?e.properties:{});var r=Vi(e),s=r.coordinates,o=r.type;if(!s.length)throw new Error("line must contain coordinates");switch(o){case"LineString":return i&&(s=Be(s)),te([s],t);case"MultiLineString":var a=[],h=0;return s.forEach(function(c){if(i&&(c=Be(c)),n){var l=un(ke(Pt(c)));l>h?(a.unshift(c),h=l):a.push(c)}else a.push(c)}),te(a,t);default:throw new Error("geometry type "+o+" is not supported")}}function Be(e){var t=e[0],i=t[0],n=t[1],r=e[e.length-1],s=r[0],o=r[1];return(i!==s||n!==o)&&e.push(t),e}function un(e){var t=e[0],i=e[1],n=e[2],r=e[3];return Math.abs(t-n)*Math.abs(i-r)}function Et(e,t,i){const r=e.getCenter().lat,s=e.getZoom(),o=r*(Math.PI/180),a=40075017*Math.cos(o)/Math.pow(2,s+9);return t/a}async function fn(e,t,i){const r=await(u=>new Promise((m,y)=>{const w=new Blob([u],{type:"image/svg+xml;charset=utf-8"}),T=URL.createObjectURL(w),v=new Image;v.crossOrigin="anonymous",v.onload=()=>{URL.revokeObjectURL(T),m(v)},v.onerror=O=>{URL.revokeObjectURL(T),y(new Error(`SVG图片加载失败:${JSON.stringify(O)}`))},v.src=T}))(e),s=r.naturalWidth||r.width||300,o=r.naturalHeight||r.height||150,a=document.createElement("canvas");a.width=s,a.height=o;const h=a.getContext("2d");if(!h)throw new Error("无法获取Canvas 2D上下文");h.clearRect(0,0,s,o),h.drawImage(r,0,0,s,o);const[c,l]=await Promise.all([createImageBitmap(a),Promise.resolve(h.getImageData(0,0,s,o))]);return{image:r,bitmap:c,imageData:l}}class ut{static SUCCESS=Qt.SUCCESS;static FAIL=Qt.FAIL;_map;_cache=new be({uniqueKey:`${qi}-icon`,type:"localstorage"});constructor(t){this._map=t}async load(t){const i=await Promise.allSettled(t.map(s=>this.add(s))),n=[],r=[];return i.forEach(s=>{s.status==="fulfilled"?n.push(s.value):r.push(s.reason)}),{success:n,error:r}}async loadSvg(t){const i=await Promise.allSettled(t.map(s=>this.addSvg(s))),n=[],r=[];return i.forEach(s=>{s.status==="fulfilled"?n.push(s.value):r.push(s.reason)}),{success:n,error:r}}async addSvg(t){if(this.has(t.name))return this.error(t,"The image has been loaded!");{const i=await fn(t.svg);return this._cache.set({name:t.name,content:{width:i.image.width,height:i.image.height,image:i.image}}),this._map.addImage(t.name,i.image),this.success(t)}}add(t){return new Promise((i,n)=>{this.has(t.name)?n(this.error(t,"The image has been loaded!")):this._map.loadImage(t.url,(r,s)=>{if(r){n(this.error(t,r));return}if(s)this._cache.set({name:t.name,content:{width:s.width,height:s.height,image:s}}),this._map.addImage(t.name,s,t.options),i(this.success(t));else{n(this.error(t,"The image has not found!"));return}})})}has(t){return this._map.hasImage(t)}getImage(t){return this._cache.get(t)}update(t){return new Promise((i,n)=>{if(!this._map.hasImage(t.name)){n(this.error(t,"The image has not been loaded!"));return}this._map.loadImage(t.url,(r,s)=>{if(r){n(this.error(t,r));return}if(s)this._cache.set({name:t.name,content:{width:s.width,height:s.height}}),this._map.updateImage(t.name,s),i(this.success(t));else{n(this.error(t,"The image has not found!"));return}})})}delete(t){this._map.hasImage(t)&&(this._map.removeImage(t),this._cache.remove(t))}success(t){return{code:ut.SUCCESS,data:t,msg:`The ${t.name} was successfully added`}}error(t,i){return{code:ut.FAIL,data:t,msg:i}}}var ie={exports:{}},ze;function dn(){return ze||(ze=1,(function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(i=!1));function r(h,c,l){this.fn=h,this.context=c,this.once=l||!1}function s(h,c,l,u,m){if(typeof l!="function")throw new TypeError("The listener must be a function");var y=new r(l,u||h,m),w=i?i+c:c;return h._events[w]?h._events[w].fn?h._events[w]=[h._events[w],y]:h._events[w].push(y):(h._events[w]=y,h._eventsCount++),h}function o(h,c){--h._eventsCount===0?h._events=new n:delete h._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],l,u;if(this._eventsCount===0)return c;for(u in l=this._events)t.call(l,u)&&c.push(i?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(l)):c},a.prototype.listeners=function(c){var l=i?i+c:c,u=this._events[l];if(!u)return[];if(u.fn)return[u.fn];for(var m=0,y=u.length,w=new Array(y);m<y;m++)w[m]=u[m].fn;return w},a.prototype.listenerCount=function(c){var l=i?i+c:c,u=this._events[l];return u?u.fn?1:u.length:0},a.prototype.emit=function(c,l,u,m,y,w){var T=i?i+c:c;if(!this._events[T])return!1;var v=this._events[T],O=arguments.length,B,S;if(v.fn){switch(v.once&&this.removeListener(c,v.fn,void 0,!0),O){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,l),!0;case 3:return v.fn.call(v.context,l,u),!0;case 4:return v.fn.call(v.context,l,u,m),!0;case 5:return v.fn.call(v.context,l,u,m,y),!0;case 6:return v.fn.call(v.context,l,u,m,y,w),!0}for(S=1,B=new Array(O-1);S<O;S++)B[S-1]=arguments[S];v.fn.apply(v.context,B)}else{var Y=v.length,k;for(S=0;S<Y;S++)switch(v[S].once&&this.removeListener(c,v[S].fn,void 0,!0),O){case 1:v[S].fn.call(v[S].context);break;case 2:v[S].fn.call(v[S].context,l);break;case 3:v[S].fn.call(v[S].context,l,u);break;case 4:v[S].fn.call(v[S].context,l,u,m);break;default:if(!B)for(k=1,B=new Array(O-1);k<O;k++)B[k-1]=arguments[k];v[S].fn.apply(v[S].context,B)}}return!0},a.prototype.on=function(c,l,u){return s(this,c,l,u,!1)},a.prototype.once=function(c,l,u){return s(this,c,l,u,!0)},a.prototype.removeListener=function(c,l,u,m){var y=i?i+c:c;if(!this._events[y])return this;if(!l)return o(this,y),this;var w=this._events[y];if(w.fn)w.fn===l&&(!m||w.once)&&(!u||w.context===u)&&o(this,y);else{for(var T=0,v=[],O=w.length;T<O;T++)(w[T].fn!==l||m&&!w[T].once||u&&w[T].context!==u)&&v.push(w[T]);v.length?this._events[y]=v.length===1?v[0]:v:o(this,y)}return this},a.prototype.removeAllListeners=function(c){var l;return c?(l=i?i+c:c,this._events[l]&&o(this,l)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a})(ie)),ie.exports}var pn=dn();const ne=Ne(pn);var Ye=typeof global=="object"&&global&&global.Object===Object&&global,mn=typeof self=="object"&&self&&self.Object===Object&&self,q=Ye||mn||Function("return this")(),ft=q.Symbol,je=Object.prototype,gn=je.hasOwnProperty,yn=je.toString,Lt=ft?ft.toStringTag:void 0;function vn(e){var t=gn.call(e,Lt),i=e[Lt];try{e[Lt]=void 0;var n=!0}catch{}var r=yn.call(e);return n&&(t?e[Lt]=i:delete e[Lt]),r}var xn=Object.prototype,wn=xn.toString;function _n(e){return wn.call(e)}var bn="[object Null]",Sn="[object Undefined]",Xe=ft?ft.toStringTag:void 0;function dt(e){return e==null?e===void 0?Sn:bn:Xe&&Xe in Object(e)?vn(e):_n(e)}function Ft(e){return e!=null&&typeof e=="object"}var Mn="[object Symbol]";function re(e){return typeof e=="symbol"||Ft(e)&&dt(e)==Mn}function En(e,t){for(var i=-1,n=e==null?0:e.length,r=Array(n);++i<n;)r[i]=t(e[i],i,e);return r}var Bt=Array.isArray,Ue=ft?ft.prototype:void 0,He=Ue?Ue.toString:void 0;function qe(e){if(typeof e=="string")return e;if(Bt(e))return En(e,qe)+"";if(re(e))return He?He.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function zt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ln="[object AsyncFunction]",Cn="[object Function]",An="[object GeneratorFunction]",In="[object Proxy]";function Ze(e){if(!zt(e))return!1;var t=dt(e);return t==Cn||t==An||t==Ln||t==In}var se=q["__core-js_shared__"],Ge=(function(){var e=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function Tn(e){return!!Ge&&Ge in e}var On=Function.prototype,kn=On.toString;function W(e){if(e!=null){try{return kn.call(e)}catch{}try{return e+""}catch{}}return""}var Nn=/[\\^$.*+?()[\]{}|]/g,$n=/^\[object .+?Constructor\]$/,Dn=Function.prototype,Pn=Object.prototype,Rn=Dn.toString,Fn=Pn.hasOwnProperty,Bn=RegExp("^"+Rn.call(Fn).replace(Nn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function zn(e){if(!zt(e)||Tn(e))return!1;var t=Ze(e)?Bn:$n;return t.test(W(e))}function Yn(e,t){return e?.[t]}function V(e,t){var i=Yn(e,t);return zn(i)?i:void 0}var oe=V(q,"WeakMap"),Je=(function(){try{var e=V(Object,"defineProperty");return e({},"",{}),e}catch{}})(),jn=9007199254740991,Xn=/^(?:0|[1-9]\d*)$/;function Un(e,t){var i=typeof e;return t=t??jn,!!t&&(i=="number"||i!="symbol"&&Xn.test(e))&&e>-1&&e%1==0&&e<t}function Hn(e,t,i){t=="__proto__"&&Je?Je(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}function Ke(e,t){return e===t||e!==e&&t!==t}var qn=Object.prototype,Zn=qn.hasOwnProperty;function Gn(e,t,i){var n=e[t];(!(Zn.call(e,t)&&Ke(n,i))||i===void 0&&!(t in e))&&Hn(e,t,i)}var Jn=9007199254740991;function We(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Jn}function Kn(e){return e!=null&&We(e.length)&&!Ze(e)}var Wn=Object.prototype;function Ve(e){var t=e&&e.constructor,i=typeof t=="function"&&t.prototype||Wn;return e===i}var Vn="[object Arguments]";function Qe(e){return Ft(e)&&dt(e)==Vn}var ti=Object.prototype,Qn=ti.hasOwnProperty,tr=ti.propertyIsEnumerable,er=Qe((function(){return arguments})())?Qe:function(e){return Ft(e)&&Qn.call(e,"callee")&&!tr.call(e,"callee")};function ir(){return!1}var ei=typeof M=="object"&&M&&!M.nodeType&&M,ii=ei&&typeof module=="object"&&module&&!module.nodeType&&module,nr=ii&&ii.exports===ei,ni=nr?q.Buffer:void 0,rr=ni?ni.isBuffer:void 0,sr=rr||ir,or="[object Arguments]",ar="[object Array]",cr="[object Boolean]",hr="[object Date]",lr="[object Error]",ur="[object Function]",fr="[object Map]",dr="[object Number]",pr="[object Object]",mr="[object RegExp]",gr="[object Set]",yr="[object String]",vr="[object WeakMap]",xr="[object ArrayBuffer]",wr="[object DataView]",_r="[object Float32Array]",br="[object Float64Array]",Sr="[object Int8Array]",Mr="[object Int16Array]",Er="[object Int32Array]",Lr="[object Uint8Array]",Cr="[object Uint8ClampedArray]",Ar="[object Uint16Array]",Ir="[object Uint32Array]",C={};C[_r]=C[br]=C[Sr]=C[Mr]=C[Er]=C[Lr]=C[Cr]=C[Ar]=C[Ir]=!0,C[or]=C[ar]=C[xr]=C[cr]=C[wr]=C[hr]=C[lr]=C[ur]=C[fr]=C[dr]=C[pr]=C[mr]=C[gr]=C[yr]=C[vr]=!1;function Tr(e){return Ft(e)&&We(e.length)&&!!C[dt(e)]}function Or(e){return function(t){return e(t)}}var ri=typeof M=="object"&&M&&!M.nodeType&&M,Ct=ri&&typeof module=="object"&&module&&!module.nodeType&&module,kr=Ct&&Ct.exports===ri,ae=kr&&Ye.process,si=(function(){try{var e=Ct&&Ct.require&&Ct.require("util").types;return e||ae&&ae.binding&&ae.binding("util")}catch{}})(),oi=si&&si.isTypedArray,Nr=oi?Or(oi):Tr;function $r(e,t){return function(i){return e(t(i))}}var Dr=$r(Object.keys,Object),Pr=Object.prototype,Rr=Pr.hasOwnProperty;function Fr(e){if(!Ve(e))return Dr(e);var t=[];for(var i in Object(e))Rr.call(e,i)&&i!="constructor"&&t.push(i);return t}var Br=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zr=/^\w*$/;function Yr(e,t){if(Bt(e))return!1;var i=typeof e;return i=="number"||i=="symbol"||i=="boolean"||e==null||re(e)?!0:zr.test(e)||!Br.test(e)||t!=null&&e in Object(t)}var At=V(Object,"create");function jr(){this.__data__=At?At(null):{},this.size=0}function Xr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ur="__lodash_hash_undefined__",Hr=Object.prototype,qr=Hr.hasOwnProperty;function Zr(e){var t=this.__data__;if(At){var i=t[e];return i===Ur?void 0:i}return qr.call(t,e)?t[e]:void 0}var Gr=Object.prototype,Jr=Gr.hasOwnProperty;function Kr(e){var t=this.__data__;return At?t[e]!==void 0:Jr.call(t,e)}var Wr="__lodash_hash_undefined__";function Vr(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=At&&t===void 0?Wr:t,this}function Q(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}Q.prototype.clear=jr,Q.prototype.delete=Xr,Q.prototype.get=Zr,Q.prototype.has=Kr,Q.prototype.set=Vr;function Qr(){this.__data__=[],this.size=0}function Yt(e,t){for(var i=e.length;i--;)if(Ke(e[i][0],t))return i;return-1}var ts=Array.prototype,es=ts.splice;function is(e){var t=this.__data__,i=Yt(t,e);if(i<0)return!1;var n=t.length-1;return i==n?t.pop():es.call(t,i,1),--this.size,!0}function ns(e){var t=this.__data__,i=Yt(t,e);return i<0?void 0:t[i][1]}function rs(e){return Yt(this.__data__,e)>-1}function ss(e,t){var i=this.__data__,n=Yt(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this}function pt(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}pt.prototype.clear=Qr,pt.prototype.delete=is,pt.prototype.get=ns,pt.prototype.has=rs,pt.prototype.set=ss;var jt=V(q,"Map");function os(){this.size=0,this.__data__={hash:new Q,map:new(jt||pt),string:new Q}}function as(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Xt(e,t){var i=e.__data__;return as(t)?i[typeof t=="string"?"string":"hash"]:i.map}function cs(e){var t=Xt(this,e).delete(e);return this.size-=t?1:0,t}function hs(e){return Xt(this,e).get(e)}function ls(e){return Xt(this,e).has(e)}function us(e,t){var i=Xt(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this}function tt(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}tt.prototype.clear=os,tt.prototype.delete=cs,tt.prototype.get=hs,tt.prototype.has=ls,tt.prototype.set=us;var fs="Expected a function";function ce(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(fs);var i=function(){var n=arguments,r=t?t.apply(this,n):n[0],s=i.cache;if(s.has(r))return s.get(r);var o=e.apply(this,n);return i.cache=s.set(r,o)||s,o};return i.cache=new(ce.Cache||tt),i}ce.Cache=tt;var ds=500;function ps(e){var t=ce(e,function(n){return i.size===ds&&i.clear(),n}),i=t.cache;return t}var ms=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gs=/\\(\\)?/g,ys=ps(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(ms,function(i,n,r,s){t.push(r?s.replace(gs,"$1"):n||i)}),t});function vs(e){return e==null?"":qe(e)}function xs(e,t){return Bt(e)?e:Yr(e,t)?[e]:ys(vs(e))}function ws(e){if(typeof e=="string"||re(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var he=V(q,"DataView"),le=V(q,"Promise"),ue=V(q,"Set"),ai="[object Map]",_s="[object Object]",ci="[object Promise]",hi="[object Set]",li="[object WeakMap]",ui="[object DataView]",bs=W(he),Ss=W(jt),Ms=W(le),Es=W(ue),Ls=W(oe),et=dt;(he&&et(new he(new ArrayBuffer(1)))!=ui||jt&&et(new jt)!=ai||le&&et(le.resolve())!=ci||ue&&et(new ue)!=hi||oe&&et(new oe)!=li)&&(et=function(e){var t=dt(e),i=t==_s?e.constructor:void 0,n=i?W(i):"";if(n)switch(n){case bs:return ui;case Ss:return ai;case Ms:return ci;case Es:return hi;case Ls:return li}return t});var Cs="[object Map]",As="[object Set]",Is=Object.prototype,Ts=Is.hasOwnProperty;function Os(e){if(e==null)return!0;if(Kn(e)&&(Bt(e)||typeof e=="string"||typeof e.splice=="function"||sr(e)||Nr(e)||er(e)))return!e.length;var t=et(e);if(t==Cs||t==As)return!e.size;if(Ve(e))return!Fr(e).length;for(var i in e)if(Ts.call(e,i))return!1;return!0}function ks(e,t,i,n){if(!zt(e))return e;t=xs(t,e);for(var r=-1,s=t.length,o=s-1,a=e;a!=null&&++r<s;){var h=ws(t[r]),c=i;if(h==="__proto__"||h==="constructor"||h==="prototype")return e;if(r!=o){var l=a[h];c=void 0,c===void 0&&(c=zt(l)?l:Un(t[r+1])?[]:{})}Gn(a,h,c),a=a[h]}return e}function Ns(e,t,i){return e==null?e:ks(e,t,i)}const D=[];for(let e=0;e<256;++e)D.push((e+256).toString(16).slice(1));function $s(e,t=0){return(D[e[t+0]]+D[e[t+1]]+D[e[t+2]]+D[e[t+3]]+"-"+D[e[t+4]]+D[e[t+5]]+"-"+D[e[t+6]]+D[e[t+7]]+"-"+D[e[t+8]]+D[e[t+9]]+"-"+D[e[t+10]]+D[e[t+11]]+D[e[t+12]]+D[e[t+13]]+D[e[t+14]]+D[e[t+15]]).toLowerCase()}let fe;const Ds=new Uint8Array(16);function Ps(){if(!fe){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");fe=crypto.getRandomValues.bind(crypto)}return fe(Ds)}const fi={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function di(e,t,i){if(fi.randomUUID&&!e)return fi.randomUUID();e=e||{};const n=e.random??e.rng?.()??Ps();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,$s(n)}class pi{map;sourceData=new Map;dirtySourceIds=new Set;renderFrameId=null;constructor(t){this.map=t}addSource(t,i){this.map.getSource(t)||(i.type==="geojson"&&i.promoteId,this.map.addSource(t,i))}addLayer(t,i){this.map.getLayer(t.id)||this.map.addLayer(t,i)}findFeature(t,i){return this.sourceData.get(t)?.features.find(r=>r.id===i)}getSource(t){return this.map.getSource(t)}setGeoJSONData(t,i){const n=Array.isArray(i)?i:[i];let r=this.sourceData.get(t);r||(r={type:"FeatureCollection",features:[]},this.sourceData.set(t,r)),n.forEach(s=>{if(Os(s.id))return;const o=r.features.findIndex(a=>a.id===s.id);s.geometry===null?o>-1&&r.features.splice(o,1):o>-1?r.features[o]=s:r.features.push(s)}),this.dirtySourceIds.add(t),this.scheduleRender()}scheduleRender(){this.renderFrameId===null&&(this.renderFrameId=requestAnimationFrame(()=>{this.flushUpdates(),this.renderFrameId=null}))}flushUpdates(){this.dirtySourceIds.forEach(t=>{const i=this.getSource(t),n=this.sourceData.get(t);i?.type==="geojson"&&n&&i.setData({...n,features:[...n.features]})}),this.dirtySourceIds.clear()}setState(t,i,n){this.map.setFeatureState({source:t,id:i},n)}getState(t,i){return this.map.getFeatureState({source:t,id:i})}destroy(){this.renderFrameId!==null&&(cancelAnimationFrame(this.renderFrameId),this.renderFrameId=null),this.sourceData.clear(),this.dirtySourceIds.clear()}}const de="mapbox-gl-focus-source",Rs={id:"mapbox-gl-focus-layer",type:"line",source:de,paint:{"line-color":"#f00","line-width":3},layout:{}};class Fs extends ne{map;focusItems=[];register;zoomendFunc=this._zoomend.bind(this);constructor(t){super(),this.map=t,this.register=new pi(t),this.onAdd()}get features(){return this.focusItems.map(t=>t.border)}onAdd(){this.register.addSource(de,{type:"geojson",dynamic:!0,data:{type:"FeatureCollection",features:[]}}),this.register.addLayer(Rs)}onRemove(){this.removeAll()}set(t,i){const n=t.id??di();return this._onHandle(n,t,i),n}get(t){return this.focusItems.find(i=>i.id===t)}remove(t){const i=this.focusItems.findIndex(n=>n.id===t);i!==-1&&this.focusItems.splice(i,1),this.render()}removeAll(){this.focusItems=[],this.render()}render(){const t=this.map.getSource(de);t&&(this.features.length>0?t.updateData({type:"FeatureCollection",features:this.features}):t.setData({type:"FeatureCollection",features:this.features}))}_zoomend(){this.render()}_onHandle(t,i,n){const r=this.getFocusBorder(i,n),s={id:t,border:r,feature:i,options:n},o=this.focusItems.findIndex(a=>a.id===t);o!==-1?Ns(this.focusItems,o,s):this.focusItems.push(s),this.render(),this.features.length>0?this.map.on("zoomend",this.zoomendFunc):this.map.off("zoomend",this.zoomendFunc)}getFocusBorder(t,i={}){const n=String(t.id??di()),{padding:r=10,armLength:s=20,size:o=40}=i,a=ke(t),h=1/Et(this.map,1);let c=a,l=0;if(t.geometry.type==="Point"){const m=(o+r)/2*h;l=o*.3*h,c=this._expandBBox(a,m,a[1])}else{const u=r*h;l=s*h,c=this._expandBBox(a,u,a[1])}return this._createBracketGeometry(n,c,l)}_expandBBox(t,i,n){const[r,s,o,a]=t,c=i/111319,l=c/Math.cos(n*Math.PI/180);return[r-l,s-c,o+l,a+c]}_createBracketGeometry(t,i,n){const[r,s,o,a]=i,c=n/111319,l=s*Math.PI/180,u=c/Math.cos(l),m=Math.min(c,(a-s)/2),y=Math.min(u,(o-r)/2),w=[[[r+y,s],[r,s],[r,s+m]],[[r,a-m],[r,a],[r+y,a]],[[o-y,a],[o,a],[o,a-m]],[[o,s+m],[o,s],[o-y,s]]];return Zi(w,{id:t},{id:t})}}class mi{map;events;register;iconManage;focus;constructor(t){this.map=t.map,this.events=new ne,this.register=new pi(this.map),this.iconManage=new ut(this.map),this.focus=new Fs(this.map)}destroy(){this.events.removeAllListeners()}}const pe=new WeakMap;function Bs(e){const t=pe.get(e);if(t)return t;const i=new mi({map:e});return pe.set(e,i),e.once("remove",()=>{i.destroy(),pe.delete(e)}),i}class mt{context;constructor(t){this.context=Bs(t),this.onAdd(),this.context.map.once("beforeRemove",()=>{this.onRemove()})}emit(){this.context.events.emit("")}mount(){this.onAdd()}destroy(){this.onRemove()}}const zs="mapbox-gl-tooltip-connect-line",Ys="mapbox-gl-tooltip-connect-debug-line",js="mapbox-gl-tooltip-connect-debug-fill",it="mapbox-gl-tooltip-source",Xs=[{id:zs,source:it,type:"line",paint:{"line-color":"#000","line-width":1}},{id:js,source:it,type:"fill",filter:["all",["==","meta","debug"]],paint:{"fill-color":"#f00","fill-opacity":0}},{id:Ys,source:it,type:"line",filter:["all",["==","meta","debug"]],paint:{"line-color":"#f00","line-width":1}}];class It extends mt{static DEBUG=!1;options;mark=null;zoom=()=>{this.render()};constructor(t,i){super(t),this.options=i,this.visible&&(this.context.map.on("zoom",this.zoom),this.context.map.on("zoomend",this.zoom))}get id(){return this.options.id}get visible(){const t=this.context.map.getBounds();return!!this.options.visible&&!!t?.contains(this.options.position)}get bbox(){const t=this.getAllBbox(),i=this.options.anchor??"bottom-right";return t[i]}onAdd(){this.context.register.addSource(it,{type:"geojson",dynamic:!0,data:{type:"FeatureCollection",features:[]}}),Xs.forEach(t=>{this.context.register.addLayer(t)})}onRemove(){this.remove()}debug(){const{minX:t,minY:i,maxX:n,maxY:r}=this.bbox,{lng:s,lat:o}=this.context.map.unproject(new A.Point(t,i)),{lng:a,lat:h}=this.context.map.unproject(new A.Point(n,r)),c=en([s,o,a,h],{properties:{meta:"debug"},id:String(this.id)+"debug"});this.context.register.setGeoJSONData(it,c)}hide(){this.options.visible=!1,this.render(),this.context.map.off("zoom",this.zoom),this.context.map.off("zoomend",this.zoom)}show(){this.options.visible=!0,this.render(),this.context.map.on("zoom",this.zoom),this.context.map.on("zoomend",this.zoom)}setAnchor(t){this.mark&&(this.mark.remove(),this.mark=null),this.options.anchor=t,this.show()}getSimpleBbox(){return{"top-left":this.getBbox("top-left"),"top-right":this.getBbox("top-right"),"bottom-left":this.getBbox("bottom-left"),"bottom-right":this.getBbox("bottom-right")}}getAllBbox(){return{"top-left":this.getBbox("top-left"),"top-right":this.getBbox("top-right"),"bottom-left":this.getBbox("bottom-left"),"bottom-right":this.getBbox("bottom-right")}}getBbox(t){const i=t??this.options.anchor,n=this.context.map.project(this.options.position),r=new A.Point(this.options.offsetX??0,this.options.offsetY??0),{width:s,height:o}=this.getOffDOMSize(this.options.element),a={minX:n.x,minY:n.y,maxX:n.x,maxY:n.y};return i==="top-left"?(a.maxY=n.y+o+Math.abs(r.y),a.maxX=n.x+s+Math.abs(r.x)):i==="top-right"?(a.maxY=n.y+o+Math.abs(r.y),a.minX=n.x-(s+r.x)):i==="bottom-left"?(a.minY=n.y-(o+r.y),a.maxX=n.x+s+Math.abs(r.x)):i==="bottom-right"&&(a.minY=n.y-(o+r.y),a.minX=n.x-(s+r.x)),a}getOffDOMSize(t){const i=t.cloneNode(!0),n={position:i.style.position,visibility:i.style.visibility,top:i.style.top,left:i.style.left,display:i.style.display};i.style.position="absolute",i.style.visibility="hidden",i.style.top="-9999px",i.style.left="-9999px",i.style.display="block",this.context.map.getCanvasContainer().appendChild(i);const r=i.offsetWidth,s=i.offsetHeight;return this.context.map.getCanvasContainer().removeChild(i),i.style.position=n.position,i.style.visibility=n.visibility,i.style.top=n.top,i.style.left=n.left,i.style.display=n.display,{width:r,height:s}}remove(){this.options.visible=!1,this.context.map.off("zoom",this.zoom),this.context.map.off("zoomend",this.zoom),console.log("remove"),this.mark&&(this.mark.remove(),this.mark=null),this.connectLine()}_create(){this.mark=new A.Marker({className:this.options.className??"mapbox-gl-tooltip",element:this.options.element,offset:this._getOffsetByAnchor(),anchor:this.options.anchor}).setLngLat(this.options.position)}_getOffsetByAnchor(){const t=new A.Point(0,0);return this.options.anchor==="top-left"?(t.x=this.options.offsetX??0,t.y=this.options.offsetY??0):this.options.anchor==="top-right"?(t.x=-(this.options.offsetX??0),t.y=this.options.offsetY??0):this.options.anchor==="bottom-left"?(t.x=this.options.offsetX??0,t.y=-(this.options.offsetY??0)):this.options.anchor==="bottom-right"&&(t.x=-(this.options.offsetX??0),t.y=-(this.options.offsetY??0)),t}setLngLat(t){return this.options.position=t,this.mark&&this.mark.setLngLat(t),this}connectLine(){const t=`${String(this.options.id)}-tooltip-connect-line`,i=this.connectPoint();if(!i||!this.visible){const s={type:"Feature",geometry:{type:"Point",coordinates:[0,0]},id:t,properties:{}};this.context.register.setGeoJSONData(it,s);return}const n=[this.options.position.toArray(),i.toArray()],r=Pt(n,{},{id:t});this.context.register.setGeoJSONData(it,r)}connectPoint(){if(!this.mark||!this.visible)return null;const t=this.context.map.project(this.mark.getLngLat()),i=this.mark.getOffset();t.x+=i.x,t.y+=i.y;const{width:n}=this.getOffDOMSize(this.options.element);return this.options.anchor==="top-left"?t.x+=n/2:this.options.anchor==="top-right"?t.x-=n/2:this.options.anchor==="bottom-left"?t.x+=n/2:this.options.anchor==="bottom-right"&&(t.x-=n/2),this.context.map.unproject(t)}render(){return this.visible?(this.mark||this._create(),this.mark?.addTo(this.context.map),It.DEBUG&&this.debug()):(this.mark?.remove(),this.mark=null),this.connectLine(),this}}const j="Ais",gt="mapbox-gl-ship-source",Z="mapbox-gl-ship-icon-layer",G="mapbox-gl-ship-real-layer",gi="mapbox-gl-ship-real-outline-layer",Us=.2,Hs=.5;var H=(e=>(e.ONLINE="Online",e.DELAY="Delay",e.OFFLINE="Offline",e))(H||{}),Tt=(e=>(e.ONLINE="#03CC02",e.DELAY="#FFFD6C",e.OFFLINE="#999999",e))(Tt||{});const yi={id:Z,source:gt,filter:["==","$type","Point"],type:"symbol",layout:{"icon-allow-overlap":!0,"icon-image":["get","icon"],"icon-rotate":["get","direction"],"icon-size":["interpolate",["linear"],["zoom"],0,["coalesce",["get","minIconSize"],.2],19,["coalesce",["get","maxIconSize"],.5]]}},vi={id:G,source:gt,type:"fill",layout:{},paint:{"fill-color":["case",["==",["get","updateStatus"],"Online"],"#03CC02",["==",["get","updateStatus"],"Delay"],"#FFFD6C",["==",["get","updateStatus"],"Offline"],"#999999","#999999"]}},xi={id:gi,source:gt,type:"line",layout:{},paint:{"line-color":["case",["boolean",["feature-state","hover"],!1],"#f00",["boolean",["feature-state","focus"],!1],"#f00","#000"],"line-width":2}},wi=[yi,vi,xi],_i=[{name:`${j}-$color-static`,svg:`<?xml version="1.0" encoding="UTF-8"?>
|
|
1
|
+
(function(k,q){typeof exports=="object"&&typeof module<"u"?q(exports,require("mapbox-gl")):typeof define=="function"&&define.amd?define(["exports","mapbox-gl"],q):(k=typeof globalThis<"u"?globalThis:k||self,q(k["cmap-core"]={},k.mapboxgl))})(this,(function(k,q){"use strict";function wo(i){return["boolean","number"].includes(typeof i)?!1:i instanceof Array?i.length===0:i instanceof Object?JSON.stringify(i)==="{}":["null",null,void 0,"undefined",""].includes(i)}class ji{_options;cacheKey;cacheType;constructor(t){this._options=t,this.cacheKey=t.uniqueKey+"-",this.cacheType=t.type}set({name:t,content:e}){const n=`${this.cacheKey}${t}`;typeof e=="function"&&(e=e.toString());const s={dataType:typeof e,content:e,type:this.cacheType,datetime:new Date().getTime()};this.cacheType==="sessionstorage"?window.sessionStorage.setItem(n,JSON.stringify(s)):window.localStorage.setItem(n,JSON.stringify(s))}get(t){const e=`${this.cacheKey}${t}`;let n="";if(this.cacheType==="sessionstorage"?n=window.sessionStorage.getItem(e):n=window.localStorage.getItem(e),wo(n)){console.warn(`未找到缓存,${t}不存在!`);return}try{const s=JSON.parse(n);return["string","number","boolean","object"].includes(s.dataType)?s.content:s.dataType==="function"?this.stringParseToFunction(s.content):s.content}catch{return n}}remove(t){const e=`${this.cacheKey}${t}`;this.cacheType==="sessionstorage"?window.sessionStorage.removeItem(e):window.localStorage.removeItem(e)}removeAll(){const t=[];if(this.cacheType==="sessionstorage")for(let e=0;e<=window.sessionStorage.length;e++)t.push({name:window.sessionStorage.key(e),content:this.get(window.sessionStorage.key(e))});else for(let e=0;e<=window.localStorage.length;e++)t.push({name:window.localStorage.key(e),content:this.get(window.localStorage.key(e))});return t}stringParseToFunction(t){return new Function('"use strict"; return ('+t+")")()}}function Hi(i,t,e=0,n=i.length-1,s=Ao){for(;n>e;){if(n-e>600){const h=n-e+1,c=t-e+1,u=Math.log(h),f=.5*Math.exp(2*u/3),v=.5*Math.sqrt(u*f*(h-f)/h)*(c-h/2<0?-1:1),x=Math.max(e,Math.floor(t-c*f/h+v)),_=Math.min(n,Math.floor(t+(h-c)*f/h+v));Hi(i,t,x,_,s)}const o=i[t];let r=e,a=n;for(Qt(i,e,t),s(i[n],o)>0&&Qt(i,e,n);r<a;){for(Qt(i,r,a),r++,a--;s(i[r],o)<0;)r++;for(;s(i[a],o)>0;)a--}s(i[e],o)===0?Qt(i,e,a):(a++,Qt(i,a,n)),a<=t&&(e=a+1),t<=a&&(n=a-1)}}function Qt(i,t,e){const n=i[t];i[t]=i[e],i[e]=n}function Ao(i,t){return i<t?-1:i>t?1:0}class So{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!xe(t,e))return n;const s=this.toBBox,o=[];for(;e;){for(let r=0;r<e.children.length;r++){const a=e.children[r],h=e.leaf?s(a):a;xe(t,h)&&(e.leaf?n.push(a):Ye(t,h)?this._all(a,n):o.push(a))}e=o.pop()}return n}collides(t){let e=this.data;if(!xe(t,e))return!1;const n=[];for(;e;){for(let s=0;s<e.children.length;s++){const o=e.children[s],r=e.leaf?this.toBBox(o):o;if(xe(t,r)){if(e.leaf||Ye(t,r))return!0;n.push(o)}}e=n.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const n=this.data;this.data=e,e=n}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Xt([]),this}remove(t,e){if(!t)return this;let n=this.data;const s=this.toBBox(t),o=[],r=[];let a,h,c;for(;n||o.length;){if(n||(n=o.pop(),h=o[o.length-1],a=r.pop(),c=!0),n.leaf){const u=Io(t,n.children,e);if(u!==-1)return n.children.splice(u,1),o.push(n),this._condense(o),this}!c&&!n.leaf&&Ye(n,s)?(o.push(n),r.push(a),a=0,h=n,n=n.children[0]):h?(a++,n=h.children[a],c=!1):n=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,s){const o=n-e+1;let r=this._maxEntries,a;if(o<=r)return a=Xt(t.slice(e,n+1)),kt(a,this.toBBox),a;s||(s=Math.ceil(Math.log(o)/Math.log(r)),r=Math.ceil(o/Math.pow(r,s-1))),a=Xt([]),a.leaf=!1,a.height=s;const h=Math.ceil(o/r),c=h*Math.ceil(Math.sqrt(r));qi(t,e,n,c,this.compareMinX);for(let u=e;u<=n;u+=c){const f=Math.min(u+c-1,n);qi(t,u,f,h,this.compareMinY);for(let v=u;v<=f;v+=h){const x=Math.min(v+h-1,f);a.children.push(this._build(t,v,x,s-1))}}return kt(a,this.toBBox),a}_chooseSubtree(t,e,n,s){for(;s.push(e),!(e.leaf||s.length-1===n);){let o=1/0,r=1/0,a;for(let h=0;h<e.children.length;h++){const c=e.children[h],u=Fe(c),f=Po(t,c)-u;f<r?(r=f,o=u<o?u:o,a=c):f===r&&u<o&&(o=u,a=c)}e=a||e.children[0]}return e}_insert(t,e,n){const s=n?t:this.toBBox(t),o=[],r=this._chooseSubtree(s,this.data,e,o);for(r.children.push(t),ee(r,s);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(s,o,e)}_split(t,e){const n=t[e],s=n.children.length,o=this._minEntries;this._chooseSplitAxis(n,o,s);const r=this._chooseSplitIndex(n,o,s),a=Xt(n.children.splice(r,n.children.length-r));a.height=n.height,a.leaf=n.leaf,kt(n,this.toBBox),kt(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,e){this.data=Xt([t,e]),this.data.height=t.height+1,this.data.leaf=!1,kt(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let s,o=1/0,r=1/0;for(let a=e;a<=n-e;a++){const h=te(t,0,a,this.toBBox),c=te(t,a,n,this.toBBox),u=Oo(h,c),f=Fe(h)+Fe(c);u<o?(o=u,s=a,r=f<r?f:r):u===o&&f<r&&(r=f,s=a)}return s||n-e}_chooseSplitAxis(t,e,n){const s=t.leaf?this.compareMinX:Co,o=t.leaf?this.compareMinY:To,r=this._allDistMargin(t,e,n,s),a=this._allDistMargin(t,e,n,o);r<a&&t.children.sort(s)}_allDistMargin(t,e,n,s){t.children.sort(s);const o=this.toBBox,r=te(t,0,e,o),a=te(t,n-e,n,o);let h=ye(r)+ye(a);for(let c=e;c<n-e;c++){const u=t.children[c];ee(r,t.leaf?o(u):u),h+=ye(r)}for(let c=n-e-1;c>=e;c--){const u=t.children[c];ee(a,t.leaf?o(u):u),h+=ye(a)}return h}_adjustParentBBoxes(t,e,n){for(let s=n;s>=0;s--)ee(e[s],t)}_condense(t){for(let e=t.length-1,n;e>=0;e--)t[e].children.length===0?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():kt(t[e],this.toBBox)}}function Io(i,t,e){if(!e)return t.indexOf(i);for(let n=0;n<t.length;n++)if(e(i,t[n]))return n;return-1}function kt(i,t){te(i,0,i.children.length,t,i)}function te(i,t,e,n,s){s||(s=Xt(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let o=t;o<e;o++){const r=i.children[o];ee(s,i.leaf?n(r):r)}return s}function ee(i,t){return i.minX=Math.min(i.minX,t.minX),i.minY=Math.min(i.minY,t.minY),i.maxX=Math.max(i.maxX,t.maxX),i.maxY=Math.max(i.maxY,t.maxY),i}function Co(i,t){return i.minX-t.minX}function To(i,t){return i.minY-t.minY}function Fe(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function ye(i){return i.maxX-i.minX+(i.maxY-i.minY)}function Po(i,t){return(Math.max(t.maxX,i.maxX)-Math.min(t.minX,i.minX))*(Math.max(t.maxY,i.maxY)-Math.min(t.minY,i.minY))}function Oo(i,t){const e=Math.max(i.minX,t.minX),n=Math.max(i.minY,t.minY),s=Math.min(i.maxX,t.maxX),o=Math.min(i.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,o-n)}function Ye(i,t){return i.minX<=t.minX&&i.minY<=t.minY&&t.maxX<=i.maxX&&t.maxY<=i.maxY}function xe(i,t){return t.minX<=i.maxX&&t.minY<=i.maxY&&t.maxX>=i.minX&&t.maxY>=i.minY}function Xt(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function qi(i,t,e,n,s){const o=[t,e];for(;o.length;){if(e=o.pop(),t=o.pop(),e-t<=n)continue;const r=t+Math.ceil((e-t)/n/2)*n;Hi(i,r,t,e,s),o.push(t,r,r,e)}}var ie=(i=>(i[i.MIN_X=0]="MIN_X",i[i.MIN_Y=1]="MIN_Y",i[i.MAX_X=2]="MAX_X",i[i.MAX_Y=3]="MAX_Y",i))(ie||{});class Zi{static MIN_X=ie.MIN_X;static MIN_Y=ie.MIN_Y;static MAX_X=ie.MAX_X;static MAX_Y=ie.MAX_Y;id;visible=!0;dir="top-left";dirs=["top-left","top-right","bottom-left","bottom-right"];_options;constructor(t){this.id=t.id,this._options=t}get minX(){return this._options[this.dir].minX}get minY(){return this._options[this.dir].minY}get maxX(){return this._options[this.dir].maxX}get maxY(){return this._options[this.dir].maxY}getBBox(){return this._options[this.dir]}setVisible(t){this.visible=t}setDir(t){this.dir=t}isIntersect(t){const{minX:e,minY:n,maxX:s,maxY:o}=t;return e<=this.minX&&n<=this.minY&&this.maxX<=s&&this.maxY<=o}}class Be{_tree=new So;_map;_collisionList=[];constructor(t,e){this._map=t,Array.isArray(e?.collisions)&&e.collisions.length>0&&this.load(e.collisions)}load(t){return this._tree.clear(),this._collisionList=t.map(e=>new Zi(e)),this.collides()}getItem(t){return this._collisionList.find(e=>e.id===t)}clear(){this._tree.clear()}getCollisions(){return this._collisionList}collides(){for(const t of this._collisionList)for(const e of t.dirs){t.setDir(e);const n=this._tree.collides(t);if(t.setVisible(!n),t.visible){this._tree.insert(t);break}}return this.getCollisions()}}const Do="mapbox-gl-cache";var ke=(i=>(i[i.SUCCESS=0]="SUCCESS",i[i.FAIL=-1]="FAIL",i))(ke||{}),ot=63710088e-1,Vi={centimeters:ot*100,centimetres:ot*100,degrees:360/(2*Math.PI),feet:ot*3.28084,inches:ot*39.37,kilometers:ot/1e3,kilometres:ot/1e3,meters:ot,metres:ot,miles:ot/1609.344,millimeters:ot*1e3,millimetres:ot*1e3,nauticalmiles:ot/1852,radians:1,yards:ot*1.0936};function It(i,t,e={}){const n={type:"Feature"};return(e.id===0||e.id)&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.properties=t||{},n.geometry=i,n}function lt(i,t,e={}){if(!i)throw new Error("coordinates is required");if(!Array.isArray(i))throw new Error("coordinates must be an Array");if(i.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Wi(i[0])||!Wi(i[1]))throw new Error("coordinates must contain numbers");return It({type:"Point",coordinates:i},t,e)}function Ee(i,t,e={}){for(const s of i){if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(s[s.length-1].length!==s[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<s[s.length-1].length;o++)if(s[s.length-1][o]!==s[0][o])throw new Error("First and last Position are not equivalent.")}return It({type:"Polygon",coordinates:i},t,e)}function Et(i,t,e={}){if(i.length<2)throw new Error("coordinates must be an array of two or more positions");return It({type:"LineString",coordinates:i},t,e)}function No(i,t,e={}){return It({type:"MultiLineString",coordinates:i},t,e)}function Ro(i,t,e={}){return It({type:"MultiPolygon",coordinates:i},t,e)}function Gi(i,t="kilometers"){const e=Vi[t];if(!e)throw new Error(t+" units is invalid");return i*e}function Ki(i,t="kilometers"){const e=Vi[t];if(!e)throw new Error(t+" units is invalid");return i/e}function _e(i){return i%(2*Math.PI)*180/Math.PI}function it(i){return i%360*Math.PI/180}function Ji(i,t="kilometers",e="kilometers"){if(!(i>=0))throw new Error("length must be a positive number");return Gi(Ki(i,t),e)}function Wi(i){return!isNaN(i)&&i!==null&&!Array.isArray(i)}function $o(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}function at(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return[...i.geometry.coordinates];if(i.type==="Point")return[...i.coordinates]}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return[...i];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Qi(i){if(Array.isArray(i))return i;if(i.type==="Feature"){if(i.geometry!==null)return i.geometry.coordinates}else if(i.coordinates)return i.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Xe(i){return i.type==="Feature"?i.geometry:i}function Fo(i,t){return i.type==="FeatureCollection"?"FeatureCollection":i.type==="GeometryCollection"?"GeometryCollection":i.type==="Feature"&&i.geometry!==null?i.geometry.type:i.type}function _t(i,t,e={}){if(e.final===!0)return Yo(i,t);const n=at(i),s=at(t),o=it(n[0]),r=it(s[0]),a=it(n[1]),h=it(s[1]),c=Math.sin(r-o)*Math.cos(h),u=Math.cos(a)*Math.sin(h)-Math.sin(a)*Math.cos(h)*Math.cos(r-o);return _e(Math.atan2(c,u))}function Yo(i,t){let e=_t(t,i);return e=(e+180)%360,e}function Bo(i,t,e,n={}){const s=at(i),o=it(s[0]),r=it(s[1]),a=it(e),h=Ki(t,n.units),c=Math.asin(Math.sin(r)*Math.cos(h)+Math.cos(r)*Math.sin(h)*Math.cos(a)),u=o+Math.atan2(Math.sin(a)*Math.sin(h)*Math.cos(r),Math.cos(h)-Math.sin(r)*Math.sin(c)),f=_e(u),v=_e(c);return s[2]!==void 0?lt([f,v,s[2]],n.properties):lt([f,v],n.properties)}function tn(i,t,e={}){var n=at(i),s=at(t),o=it(s[1]-n[1]),r=it(s[0]-n[0]),a=it(n[1]),h=it(s[1]),c=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(r/2),2)*Math.cos(a)*Math.cos(h);return Gi(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),e.units)}function ko(i,t,e={}){const s=Xe(i).coordinates;let o=0;for(let r=0;r<s.length&&!(t>=o&&r===s.length-1);r++)if(o>=t){const a=t-o;if(a){const h=_t(s[r],s[r-1])-180;return Bo(s[r],a,h,e)}else return lt(s[r])}else o+=tn(s[r],s[r+1],e);return lt(s[s.length-1])}function Xo(i,t,e={}){let n;return e.final?n=en(at(t),at(i)):n=en(at(i),at(t)),n>180?-(360-n):n}function en(i,t){const e=it(i[1]),n=it(t[1]);let s=it(t[0]-i[0]);s>Math.PI&&(s-=2*Math.PI),s<-Math.PI&&(s+=2*Math.PI);const o=Math.log(Math.tan(n/2+Math.PI/4)/Math.tan(e/2+Math.PI/4)),r=Math.atan2(s,o);return(_e(r)+360)%360}function Ct(i,t,e){if(i!==null)for(var n,s,o,r,a,h,c,u=0,f=0,v,x=i.type,_=x==="FeatureCollection",M=x==="Feature",I=_?i.features.length:1,C=0;C<I;C++){c=_?i.features[C].geometry:M?i.geometry:i,v=c?c.type==="GeometryCollection":!1,a=v?c.geometries.length:1;for(var d=0;d<a;d++){var p=0,l=0;if(r=v?c.geometries[d]:c,r!==null){h=r.coordinates;var m=r.type;switch(u=e&&(m==="Polygon"||m==="MultiPolygon")?1:0,m){case null:break;case"Point":if(t(h,f,C,p,l)===!1)return!1;f++,p++;break;case"LineString":case"MultiPoint":for(n=0;n<h.length;n++){if(t(h[n],f,C,p,l)===!1)return!1;f++,m==="MultiPoint"&&p++}m==="LineString"&&p++;break;case"Polygon":case"MultiLineString":for(n=0;n<h.length;n++){for(s=0;s<h[n].length-u;s++){if(t(h[n][s],f,C,p,l)===!1)return!1;f++}m==="MultiLineString"&&p++,m==="Polygon"&&l++}m==="Polygon"&&p++;break;case"MultiPolygon":for(n=0;n<h.length;n++){for(l=0,s=0;s<h[n].length;s++){for(o=0;o<h[n][s].length-u;o++){if(t(h[n][s][o],f,C,p,l)===!1)return!1;f++}l++}p++}break;case"GeometryCollection":for(n=0;n<r.geometries.length;n++)if(Ct(r.geometries[n],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Uo(i,t){var e,n,s,o,r,a,h,c,u,f,v=0,x=i.type==="FeatureCollection",_=i.type==="Feature",M=x?i.features.length:1;for(e=0;e<M;e++){for(a=x?i.features[e].geometry:_?i.geometry:i,c=x?i.features[e].properties:_?i.properties:{},u=x?i.features[e].bbox:_?i.bbox:void 0,f=x?i.features[e].id:_?i.id:void 0,h=a?a.type==="GeometryCollection":!1,r=h?a.geometries.length:1,s=0;s<r;s++){if(o=h?a.geometries[s]:a,o===null){if(t(null,v,c,u,f)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,v,c,u,f)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(t(o.geometries[n],v,c,u,f)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function zo(i,t){Uo(i,function(e,n,s,o,r){var a=e===null?null:e.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return t(It(e,s,{bbox:o,id:r}),n,0)===!1?!1:void 0}var h;switch(a){case"MultiPoint":h="Point";break;case"MultiLineString":h="LineString";break;case"MultiPolygon":h="Polygon";break}for(var c=0;c<e.coordinates.length;c++){var u=e.coordinates[c],f={type:h,coordinates:u};if(t(It(f,s),n,c)===!1)return!1}})}function jo(i,t){zo(i,function(e,n,s){var o=0;if(e.geometry){var r=e.geometry.type;if(!(r==="Point"||r==="MultiPoint")){var a,h=0,c=0,u=0;if(Ct(e,function(f,v,x,_,M){if(a===void 0||n>h||_>c||M>u){a=f,h=n,c=_,u=M,o=0;return}var I=Et([a,f],e.properties);if(t(I,n,s,M,o)===!1)return!1;o++,a=f})===!1)return!1}}})}function Ho(i,t,e){var n=e,s=!1;return jo(i,function(o,r,a,h,c){s===!1&&e===void 0?n=o:n=t(n,o,r,a,h,c),s=!0}),n}function be(i,t={}){if(i.bbox!=null&&t.recompute!==!0)return i.bbox;const e=[1/0,1/0,-1/0,-1/0];return Ct(i,n=>{e[0]>n[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]<n[0]&&(e[2]=n[0]),e[3]<n[1]&&(e[3]=n[1])}),e}function qo(i,t={}){const e=Number(i[0]),n=Number(i[1]),s=Number(i[2]),o=Number(i[3]);if(i.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");const r=[e,n];return Ee([[r,[s,n],[s,o],[e,o],r]],t.properties,{bbox:i,id:t.id})}const gt=11102230246251565e-32,nt=134217729,Zo=(3+8*gt)*gt;function Ue(i,t,e,n,s){let o,r,a,h,c=t[0],u=n[0],f=0,v=0;u>c==u>-c?(o=c,c=t[++f]):(o=u,u=n[++v]);let x=0;if(f<i&&v<e)for(u>c==u>-c?(r=c+o,a=o-(r-c),c=t[++f]):(r=u+o,a=o-(r-u),u=n[++v]),o=r,a!==0&&(s[x++]=a);f<i&&v<e;)u>c==u>-c?(r=o+c,h=r-o,a=o-(r-h)+(c-h),c=t[++f]):(r=o+u,h=r-o,a=o-(r-h)+(u-h),u=n[++v]),o=r,a!==0&&(s[x++]=a);for(;f<i;)r=o+c,h=r-o,a=o-(r-h)+(c-h),c=t[++f],o=r,a!==0&&(s[x++]=a);for(;v<e;)r=o+u,h=r-o,a=o-(r-h)+(u-h),u=n[++v],o=r,a!==0&&(s[x++]=a);return(o!==0||x===0)&&(s[x++]=o),x}function Vo(i,t){let e=t[0];for(let n=1;n<i;n++)e+=t[n];return e}function ne(i){return new Float64Array(i)}const Go=(3+16*gt)*gt,Ko=(2+12*gt)*gt,Jo=(9+64*gt)*gt*gt,Ut=ne(4),nn=ne(8),sn=ne(12),on=ne(16),rt=ne(4);function Wo(i,t,e,n,s,o,r){let a,h,c,u,f,v,x,_,M,I,C,d,p,l,m,g,y,E;const L=i-s,w=e-s,A=t-o,N=n-o;l=L*N,v=nt*L,x=v-(v-L),_=L-x,v=nt*N,M=v-(v-N),I=N-M,m=_*I-(l-x*M-_*M-x*I),g=A*w,v=nt*A,x=v-(v-A),_=A-x,v=nt*w,M=v-(v-w),I=w-M,y=_*I-(g-x*M-_*M-x*I),C=m-y,f=m-C,Ut[0]=m-(C+f)+(f-y),d=l+C,f=d-l,p=l-(d-f)+(C-f),C=p-g,f=p-C,Ut[1]=p-(C+f)+(f-g),E=d+C,f=E-d,Ut[2]=d-(E-f)+(C-f),Ut[3]=E;let Y=Vo(4,Ut),O=Ko*r;if(Y>=O||-Y>=O||(f=i-L,a=i-(L+f)+(f-s),f=e-w,c=e-(w+f)+(f-s),f=t-A,h=t-(A+f)+(f-o),f=n-N,u=n-(N+f)+(f-o),a===0&&h===0&&c===0&&u===0)||(O=Jo*r+Zo*Math.abs(Y),Y+=L*u+N*a-(A*c+w*h),Y>=O||-Y>=O))return Y;l=a*N,v=nt*a,x=v-(v-a),_=a-x,v=nt*N,M=v-(v-N),I=N-M,m=_*I-(l-x*M-_*M-x*I),g=h*w,v=nt*h,x=v-(v-h),_=h-x,v=nt*w,M=v-(v-w),I=w-M,y=_*I-(g-x*M-_*M-x*I),C=m-y,f=m-C,rt[0]=m-(C+f)+(f-y),d=l+C,f=d-l,p=l-(d-f)+(C-f),C=p-g,f=p-C,rt[1]=p-(C+f)+(f-g),E=d+C,f=E-d,rt[2]=d-(E-f)+(C-f),rt[3]=E;const D=Ue(4,Ut,4,rt,nn);l=L*u,v=nt*L,x=v-(v-L),_=L-x,v=nt*u,M=v-(v-u),I=u-M,m=_*I-(l-x*M-_*M-x*I),g=A*c,v=nt*A,x=v-(v-A),_=A-x,v=nt*c,M=v-(v-c),I=c-M,y=_*I-(g-x*M-_*M-x*I),C=m-y,f=m-C,rt[0]=m-(C+f)+(f-y),d=l+C,f=d-l,p=l-(d-f)+(C-f),C=p-g,f=p-C,rt[1]=p-(C+f)+(f-g),E=d+C,f=E-d,rt[2]=d-(E-f)+(C-f),rt[3]=E;const b=Ue(D,nn,4,rt,sn);l=a*u,v=nt*a,x=v-(v-a),_=a-x,v=nt*u,M=v-(v-u),I=u-M,m=_*I-(l-x*M-_*M-x*I),g=h*c,v=nt*h,x=v-(v-h),_=h-x,v=nt*c,M=v-(v-c),I=c-M,y=_*I-(g-x*M-_*M-x*I),C=m-y,f=m-C,rt[0]=m-(C+f)+(f-y),d=l+C,f=d-l,p=l-(d-f)+(C-f),C=p-g,f=p-C,rt[1]=p-(C+f)+(f-g),E=d+C,f=E-d,rt[2]=d-(E-f)+(C-f),rt[3]=E;const P=Ue(b,sn,4,rt,on);return on[P-1]}function Qo(i,t,e,n,s,o){const r=(t-o)*(e-s),a=(i-s)*(n-o),h=r-a,c=Math.abs(r+a);return Math.abs(h)>=Go*c?h:-Wo(i,t,e,n,s,o,c)}function tr(i,t){var e,n,s=0,o,r,a,h,c,u,f,v=i[0],x=i[1],_=t.length;for(e=0;e<_;e++){n=0;var M=t[e],I=M.length-1;if(u=M[0],u[0]!==M[I][0]&&u[1]!==M[I][1])throw new Error("First and last coordinates in a ring must be the same");for(r=u[0]-v,a=u[1]-x,n;n<I;n++){if(f=M[n+1],h=f[0]-v,c=f[1]-x,a===0&&c===0){if(h<=0&&r>=0||r<=0&&h>=0)return 0}else if(c>=0&&a<=0||c<=0&&a>=0){if(o=Qo(r,h,a,c,0,0),o===0)return 0;(o>0&&c>0&&a<=0||o<0&&c<=0&&a>0)&&s++}u=f,a=c,r=h}}return s%2!==0}function er(i,t,e={}){if(!i)throw new Error("point is required");if(!t)throw new Error("polygon is required");const n=at(i),s=Xe(t),o=s.type,r=t.bbox;let a=s.coordinates;if(r&&ir(n,r)===!1)return!1;o==="Polygon"&&(a=[a]);let h=!1;for(var c=0;c<a.length;++c){const u=tr(n,a[c]);if(u===0)return!e.ignoreBoundary;u&&(h=!0)}return h}function ir(i,t){return t[0]<=i[0]&&t[1]<=i[1]&&t[2]>=i[0]&&t[3]>=i[1]}function ze(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function nr(i){if(Object.prototype.hasOwnProperty.call(i,"__esModule"))return i;var t=i.default;if(typeof t=="function"){var e=function n(){var s=!1;try{s=this instanceof n}catch{}return s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(i).forEach(function(n){var s=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:function(){return i[n]}})}),e}function je(i,t={}){let e=0,n=0,s=0;return Ct(i,function(o){e+=o[0],n+=o[1],s++},!0),lt([e/s,n/s],t.properties)}var Le={exports:{}},Me={exports:{}},sr=Me.exports,rn;function or(){return rn||(rn=1,(function(i,t){(function(e,n){i.exports=n()})(sr,function(){function e(d,p,l,m,g){(function y(E,L,w,A,N){for(;A>w;){if(A-w>600){var Y=A-w+1,O=L-w+1,D=Math.log(Y),b=.5*Math.exp(2*D/3),P=.5*Math.sqrt(D*b*(Y-b)/Y)*(O-Y/2<0?-1:1),T=Math.max(w,Math.floor(L-O*b/Y+P)),F=Math.min(A,Math.floor(L+(Y-O)*b/Y+P));y(E,L,T,F,N)}var S=E[L],R=w,$=A;for(n(E,w,L),N(E[A],S)>0&&n(E,w,A);R<$;){for(n(E,R,$),R++,$--;N(E[R],S)<0;)R++;for(;N(E[$],S)>0;)$--}N(E[w],S)===0?n(E,w,$):n(E,++$,A),$<=L&&(w=$+1),L<=$&&(A=$-1)}})(d,p,l||0,m||d.length-1,g||s)}function n(d,p,l){var m=d[p];d[p]=d[l],d[l]=m}function s(d,p){return d<p?-1:d>p?1:0}var o=function(d){d===void 0&&(d=9),this._maxEntries=Math.max(4,d),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function r(d,p,l){if(!l)return p.indexOf(d);for(var m=0;m<p.length;m++)if(l(d,p[m]))return m;return-1}function a(d,p){h(d,0,d.children.length,p,d)}function h(d,p,l,m,g){g||(g=I(null)),g.minX=1/0,g.minY=1/0,g.maxX=-1/0,g.maxY=-1/0;for(var y=p;y<l;y++){var E=d.children[y];c(g,d.leaf?m(E):E)}return g}function c(d,p){return d.minX=Math.min(d.minX,p.minX),d.minY=Math.min(d.minY,p.minY),d.maxX=Math.max(d.maxX,p.maxX),d.maxY=Math.max(d.maxY,p.maxY),d}function u(d,p){return d.minX-p.minX}function f(d,p){return d.minY-p.minY}function v(d){return(d.maxX-d.minX)*(d.maxY-d.minY)}function x(d){return d.maxX-d.minX+(d.maxY-d.minY)}function _(d,p){return d.minX<=p.minX&&d.minY<=p.minY&&p.maxX<=d.maxX&&p.maxY<=d.maxY}function M(d,p){return p.minX<=d.maxX&&p.minY<=d.maxY&&p.maxX>=d.minX&&p.maxY>=d.minY}function I(d){return{children:d,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function C(d,p,l,m,g){for(var y=[p,l];y.length;)if(!((l=y.pop())-(p=y.pop())<=m)){var E=p+Math.ceil((l-p)/m/2)*m;e(d,E,p,l,g),y.push(p,E,E,l)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(d){var p=this.data,l=[];if(!M(d,p))return l;for(var m=this.toBBox,g=[];p;){for(var y=0;y<p.children.length;y++){var E=p.children[y],L=p.leaf?m(E):E;M(d,L)&&(p.leaf?l.push(E):_(d,L)?this._all(E,l):g.push(E))}p=g.pop()}return l},o.prototype.collides=function(d){var p=this.data;if(!M(d,p))return!1;for(var l=[];p;){for(var m=0;m<p.children.length;m++){var g=p.children[m],y=p.leaf?this.toBBox(g):g;if(M(d,y)){if(p.leaf||_(d,y))return!0;l.push(g)}}p=l.pop()}return!1},o.prototype.load=function(d){if(!d||!d.length)return this;if(d.length<this._minEntries){for(var p=0;p<d.length;p++)this.insert(d[p]);return this}var l=this._build(d.slice(),0,d.length-1,0);if(this.data.children.length)if(this.data.height===l.height)this._splitRoot(this.data,l);else{if(this.data.height<l.height){var m=this.data;this.data=l,l=m}this._insert(l,this.data.height-l.height-1,!0)}else this.data=l;return this},o.prototype.insert=function(d){return d&&this._insert(d,this.data.height-1),this},o.prototype.clear=function(){return this.data=I([]),this},o.prototype.remove=function(d,p){if(!d)return this;for(var l,m,g,y=this.data,E=this.toBBox(d),L=[],w=[];y||L.length;){if(y||(y=L.pop(),m=L[L.length-1],l=w.pop(),g=!0),y.leaf){var A=r(d,y.children,p);if(A!==-1)return y.children.splice(A,1),L.push(y),this._condense(L),this}g||y.leaf||!_(y,E)?m?(l++,y=m.children[l],g=!1):y=null:(L.push(y),w.push(l),l=0,m=y,y=y.children[0])}return this},o.prototype.toBBox=function(d){return d},o.prototype.compareMinX=function(d,p){return d.minX-p.minX},o.prototype.compareMinY=function(d,p){return d.minY-p.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(d){return this.data=d,this},o.prototype._all=function(d,p){for(var l=[];d;)d.leaf?p.push.apply(p,d.children):l.push.apply(l,d.children),d=l.pop();return p},o.prototype._build=function(d,p,l,m){var g,y=l-p+1,E=this._maxEntries;if(y<=E)return a(g=I(d.slice(p,l+1)),this.toBBox),g;m||(m=Math.ceil(Math.log(y)/Math.log(E)),E=Math.ceil(y/Math.pow(E,m-1))),(g=I([])).leaf=!1,g.height=m;var L=Math.ceil(y/E),w=L*Math.ceil(Math.sqrt(E));C(d,p,l,w,this.compareMinX);for(var A=p;A<=l;A+=w){var N=Math.min(A+w-1,l);C(d,A,N,L,this.compareMinY);for(var Y=A;Y<=N;Y+=L){var O=Math.min(Y+L-1,N);g.children.push(this._build(d,Y,O,m-1))}}return a(g,this.toBBox),g},o.prototype._chooseSubtree=function(d,p,l,m){for(;m.push(p),!p.leaf&&m.length-1!==l;){for(var g=1/0,y=1/0,E=void 0,L=0;L<p.children.length;L++){var w=p.children[L],A=v(w),N=(Y=d,O=w,(Math.max(O.maxX,Y.maxX)-Math.min(O.minX,Y.minX))*(Math.max(O.maxY,Y.maxY)-Math.min(O.minY,Y.minY))-A);N<y?(y=N,g=A<g?A:g,E=w):N===y&&A<g&&(g=A,E=w)}p=E||p.children[0]}var Y,O;return p},o.prototype._insert=function(d,p,l){var m=l?d:this.toBBox(d),g=[],y=this._chooseSubtree(m,this.data,p,g);for(y.children.push(d),c(y,m);p>=0&&g[p].children.length>this._maxEntries;)this._split(g,p),p--;this._adjustParentBBoxes(m,g,p)},o.prototype._split=function(d,p){var l=d[p],m=l.children.length,g=this._minEntries;this._chooseSplitAxis(l,g,m);var y=this._chooseSplitIndex(l,g,m),E=I(l.children.splice(y,l.children.length-y));E.height=l.height,E.leaf=l.leaf,a(l,this.toBBox),a(E,this.toBBox),p?d[p-1].children.push(E):this._splitRoot(l,E)},o.prototype._splitRoot=function(d,p){this.data=I([d,p]),this.data.height=d.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(d,p,l){for(var m,g,y,E,L,w,A,N=1/0,Y=1/0,O=p;O<=l-p;O++){var D=h(d,0,O,this.toBBox),b=h(d,O,l,this.toBBox),P=(g=D,y=b,E=void 0,L=void 0,w=void 0,A=void 0,E=Math.max(g.minX,y.minX),L=Math.max(g.minY,y.minY),w=Math.min(g.maxX,y.maxX),A=Math.min(g.maxY,y.maxY),Math.max(0,w-E)*Math.max(0,A-L)),T=v(D)+v(b);P<N?(N=P,m=O,Y=T<Y?T:Y):P===N&&T<Y&&(Y=T,m=O)}return m||l-p},o.prototype._chooseSplitAxis=function(d,p,l){var m=d.leaf?this.compareMinX:u,g=d.leaf?this.compareMinY:f;this._allDistMargin(d,p,l,m)<this._allDistMargin(d,p,l,g)&&d.children.sort(m)},o.prototype._allDistMargin=function(d,p,l,m){d.children.sort(m);for(var g=this.toBBox,y=h(d,0,p,g),E=h(d,l-p,l,g),L=x(y)+x(E),w=p;w<l-p;w++){var A=d.children[w];c(y,d.leaf?g(A):A),L+=x(y)}for(var N=l-p-1;N>=p;N--){var Y=d.children[N];c(E,d.leaf?g(Y):Y),L+=x(E)}return L},o.prototype._adjustParentBBoxes=function(d,p,l){for(var m=l;m>=0;m--)c(p[m],d)},o.prototype._condense=function(d){for(var p=d.length-1,l=void 0;p>=0;p--)d[p].children.length===0?p>0?(l=d[p-1].children).splice(l.indexOf(d[p]),1):this.clear():a(d[p],this.toBBox)},o})})(Me)),Me.exports}let rr=class{constructor(t=[],e=ar){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,s=e[t];for(;t>0;){const o=t-1>>1,r=e[o];if(n(s,r)>=0)break;e[t]=r,t=o}e[t]=s}_down(t){const{data:e,compare:n}=this,s=this.length>>1,o=e[t];for(;t<s;){let r=(t<<1)+1,a=e[r];const h=r+1;if(h<this.length&&n(e[h],a)<0&&(r=h,a=e[h]),n(a,o)>=0)break;e[t]=a,t=r}e[t]=o}};function ar(i,t){return i<t?-1:i>t?1:0}const cr=nr(Object.freeze(Object.defineProperty({__proto__:null,default:rr},Symbol.toStringTag,{value:"Module"})));var se={exports:{}},He,an;function hr(){return an||(an=1,He=function(t,e,n,s){var o=t[0],r=t[1],a=!1;n===void 0&&(n=0),s===void 0&&(s=e.length);for(var h=(s-n)/2,c=0,u=h-1;c<h;u=c++){var f=e[n+c*2+0],v=e[n+c*2+1],x=e[n+u*2+0],_=e[n+u*2+1],M=v>r!=_>r&&o<(x-f)*(r-v)/(_-v)+f;M&&(a=!a)}return a}),He}var qe,cn;function lr(){return cn||(cn=1,qe=function(t,e,n,s){var o=t[0],r=t[1],a=!1;n===void 0&&(n=0),s===void 0&&(s=e.length);for(var h=s-n,c=0,u=h-1;c<h;u=c++){var f=e[c+n][0],v=e[c+n][1],x=e[u+n][0],_=e[u+n][1],M=v>r!=_>r&&o<(x-f)*(r-v)/(_-v)+f;M&&(a=!a)}return a}),qe}var hn;function ur(){if(hn)return se.exports;hn=1;var i=hr(),t=lr();return se.exports=function(n,s,o,r){return s.length>0&&Array.isArray(s[0])?t(n,s,o,r):i(n,s,o,r)},se.exports.nested=t,se.exports.flat=i,se.exports}var oe={exports:{}},fr=oe.exports,ln;function dr(){return ln||(ln=1,(function(i,t){(function(e,n){n(t)})(fr,function(e){const s=33306690738754706e-32;function o(M,I,C,d,p){let l,m,g,y,E=I[0],L=d[0],w=0,A=0;L>E==L>-E?(l=E,E=I[++w]):(l=L,L=d[++A]);let N=0;if(w<M&&A<C)for(L>E==L>-E?(g=l-((m=E+l)-E),E=I[++w]):(g=l-((m=L+l)-L),L=d[++A]),l=m,g!==0&&(p[N++]=g);w<M&&A<C;)L>E==L>-E?(g=l-((m=l+E)-(y=m-l))+(E-y),E=I[++w]):(g=l-((m=l+L)-(y=m-l))+(L-y),L=d[++A]),l=m,g!==0&&(p[N++]=g);for(;w<M;)g=l-((m=l+E)-(y=m-l))+(E-y),E=I[++w],l=m,g!==0&&(p[N++]=g);for(;A<C;)g=l-((m=l+L)-(y=m-l))+(L-y),L=d[++A],l=m,g!==0&&(p[N++]=g);return l===0&&N!==0||(p[N++]=l),N}function r(M){return new Float64Array(M)}const a=33306690738754716e-32,h=22204460492503146e-32,c=11093356479670487e-47,u=r(4),f=r(8),v=r(12),x=r(16),_=r(4);e.orient2d=function(M,I,C,d,p,l){const m=(I-l)*(C-p),g=(M-p)*(d-l),y=m-g;if(m===0||g===0||m>0!=g>0)return y;const E=Math.abs(m+g);return Math.abs(y)>=a*E?y:-(function(L,w,A,N,Y,O,D){let b,P,T,F,S,R,$,j,B,z,U,H,G,Z,V,W,st,Q;const ct=L-Y,ht=A-Y,ft=w-O,dt=N-O;S=(V=(j=ct-($=(R=134217729*ct)-(R-ct)))*(z=dt-(B=(R=134217729*dt)-(R-dt)))-((Z=ct*dt)-$*B-j*B-$*z))-(U=V-(st=(j=ft-($=(R=134217729*ft)-(R-ft)))*(z=ht-(B=(R=134217729*ht)-(R-ht)))-((W=ft*ht)-$*B-j*B-$*z))),u[0]=V-(U+S)+(S-st),S=(G=Z-((H=Z+U)-(S=H-Z))+(U-S))-(U=G-W),u[1]=G-(U+S)+(S-W),S=(Q=H+U)-H,u[2]=H-(Q-S)+(U-S),u[3]=Q;let St=(function(mu,Lo){let Mo=Lo[0];for(let zi=1;zi<mu;zi++)Mo+=Lo[zi];return Mo})(4,u),ve=h*D;if(St>=ve||-St>=ve||(b=L-(ct+(S=L-ct))+(S-Y),T=A-(ht+(S=A-ht))+(S-Y),P=w-(ft+(S=w-ft))+(S-O),F=N-(dt+(S=N-dt))+(S-O),b===0&&P===0&&T===0&&F===0)||(ve=c*D+s*Math.abs(St),(St+=ct*F+dt*b-(ft*T+ht*P))>=ve||-St>=ve))return St;S=(V=(j=b-($=(R=134217729*b)-(R-b)))*(z=dt-(B=(R=134217729*dt)-(R-dt)))-((Z=b*dt)-$*B-j*B-$*z))-(U=V-(st=(j=P-($=(R=134217729*P)-(R-P)))*(z=ht-(B=(R=134217729*ht)-(R-ht)))-((W=P*ht)-$*B-j*B-$*z))),_[0]=V-(U+S)+(S-st),S=(G=Z-((H=Z+U)-(S=H-Z))+(U-S))-(U=G-W),_[1]=G-(U+S)+(S-W),S=(Q=H+U)-H,_[2]=H-(Q-S)+(U-S),_[3]=Q;const fu=o(4,u,4,_,f);S=(V=(j=ct-($=(R=134217729*ct)-(R-ct)))*(z=F-(B=(R=134217729*F)-(R-F)))-((Z=ct*F)-$*B-j*B-$*z))-(U=V-(st=(j=ft-($=(R=134217729*ft)-(R-ft)))*(z=T-(B=(R=134217729*T)-(R-T)))-((W=ft*T)-$*B-j*B-$*z))),_[0]=V-(U+S)+(S-st),S=(G=Z-((H=Z+U)-(S=H-Z))+(U-S))-(U=G-W),_[1]=G-(U+S)+(S-W),S=(Q=H+U)-H,_[2]=H-(Q-S)+(U-S),_[3]=Q;const du=o(fu,f,4,_,v);S=(V=(j=b-($=(R=134217729*b)-(R-b)))*(z=F-(B=(R=134217729*F)-(R-F)))-((Z=b*F)-$*B-j*B-$*z))-(U=V-(st=(j=P-($=(R=134217729*P)-(R-P)))*(z=T-(B=(R=134217729*T)-(R-T)))-((W=P*T)-$*B-j*B-$*z))),_[0]=V-(U+S)+(S-st),S=(G=Z-((H=Z+U)-(S=H-Z))+(U-S))-(U=G-W),_[1]=G-(U+S)+(S-W),S=(Q=H+U)-H,_[2]=H-(Q-S)+(U-S),_[3]=Q;const pu=o(du,v,4,_,x);return x[pu-1]})(M,I,C,d,p,l,E)},e.orient2dfast=function(M,I,C,d,p,l){return(I-l)*(C-p)-(M-p)*(d-l)},Object.defineProperty(e,"__esModule",{value:!0})})})(oe,oe.exports)),oe.exports}var un;function pr(){if(un)return Le.exports;un=1;var i=or(),t=cr,e=ur(),n=dr().orient2d;t.default&&(t=t.default),Le.exports=s,Le.exports.default=s;function s(l,m,g){m=Math.max(0,m===void 0?2:m),g=g||0;var y=x(l),E=new i(16);E.toBBox=function($){return{minX:$[0],minY:$[1],maxX:$[0],maxY:$[1]}},E.compareMinX=function($,j){return $[0]-j[0]},E.compareMinY=function($,j){return $[1]-j[1]},E.load(l);for(var L=[],w=0,A;w<y.length;w++){var N=y[w];E.remove(N),A=_(N,A),L.push(A)}var Y=new i(16);for(w=0;w<L.length;w++)Y.insert(v(L[w]));for(var O=m*m,D=g*g;L.length;){var b=L.shift(),P=b.p,T=b.next.p,F=M(P,T);if(!(F<D)){var S=F/O;N=o(E,b.prev.p,P,T,b.next.next.p,S,Y),N&&Math.min(M(N,P),M(N,T))<=S&&(L.push(b),L.push(_(N,b)),E.remove(N),Y.remove(b),Y.insert(v(b)),Y.insert(v(b.next)))}}b=A;var R=[];do R.push(b.p),b=b.next;while(b!==A);return R.push(b.p),R}function o(l,m,g,y,E,L,w){for(var A=new t([],r),N=l.data;N;){for(var Y=0;Y<N.children.length;Y++){var O=N.children[Y],D=N.leaf?I(O,g,y):a(g,y,O);D>L||A.push({node:O,dist:D})}for(;A.length&&!A.peek().node.children;){var b=A.pop(),P=b.node,T=I(P,m,g),F=I(P,y,E);if(b.dist<T&&b.dist<F&&c(g,P,w)&&c(y,P,w))return P}N=A.pop(),N&&(N=N.node)}return null}function r(l,m){return l.dist-m.dist}function a(l,m,g){if(h(l,g)||h(m,g))return 0;var y=C(l[0],l[1],m[0],m[1],g.minX,g.minY,g.maxX,g.minY);if(y===0)return 0;var E=C(l[0],l[1],m[0],m[1],g.minX,g.minY,g.minX,g.maxY);if(E===0)return 0;var L=C(l[0],l[1],m[0],m[1],g.maxX,g.minY,g.maxX,g.maxY);if(L===0)return 0;var w=C(l[0],l[1],m[0],m[1],g.minX,g.maxY,g.maxX,g.maxY);return w===0?0:Math.min(y,E,L,w)}function h(l,m){return l[0]>=m.minX&&l[0]<=m.maxX&&l[1]>=m.minY&&l[1]<=m.maxY}function c(l,m,g){for(var y=Math.min(l[0],m[0]),E=Math.min(l[1],m[1]),L=Math.max(l[0],m[0]),w=Math.max(l[1],m[1]),A=g.search({minX:y,minY:E,maxX:L,maxY:w}),N=0;N<A.length;N++)if(f(A[N].p,A[N].next.p,l,m))return!1;return!0}function u(l,m,g){return n(l[0],l[1],m[0],m[1],g[0],g[1])}function f(l,m,g,y){return l!==y&&m!==g&&u(l,m,g)>0!=u(l,m,y)>0&&u(g,y,l)>0!=u(g,y,m)>0}function v(l){var m=l.p,g=l.next.p;return l.minX=Math.min(m[0],g[0]),l.minY=Math.min(m[1],g[1]),l.maxX=Math.max(m[0],g[0]),l.maxY=Math.max(m[1],g[1]),l}function x(l){for(var m=l[0],g=l[0],y=l[0],E=l[0],L=0;L<l.length;L++){var w=l[L];w[0]<m[0]&&(m=w),w[0]>y[0]&&(y=w),w[1]<g[1]&&(g=w),w[1]>E[1]&&(E=w)}var A=[m,g,y,E],N=A.slice();for(L=0;L<l.length;L++)e(l[L],A)||N.push(l[L]);return p(N)}function _(l,m){var g={p:l,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return m?(g.next=m.next,g.prev=m,m.next.prev=g,m.next=g):(g.prev=g,g.next=g),g}function M(l,m){var g=l[0]-m[0],y=l[1]-m[1];return g*g+y*y}function I(l,m,g){var y=m[0],E=m[1],L=g[0]-y,w=g[1]-E;if(L!==0||w!==0){var A=((l[0]-y)*L+(l[1]-E)*w)/(L*L+w*w);A>1?(y=g[0],E=g[1]):A>0&&(y+=L*A,E+=w*A)}return L=l[0]-y,w=l[1]-E,L*L+w*w}function C(l,m,g,y,E,L,w,A){var N=g-l,Y=y-m,O=w-E,D=A-L,b=l-E,P=m-L,T=N*N+Y*Y,F=N*O+Y*D,S=O*O+D*D,R=N*b+Y*P,$=O*b+D*P,j=T*S-F*F,B,z,U,H,G=j,Z=j;j===0?(z=0,G=1,H=$,Z=S):(z=F*$-S*R,H=T*$-F*R,z<0?(z=0,H=$,Z=S):z>G&&(z=G,H=$+F,Z=S)),H<0?(H=0,-R<0?z=0:-R>T?z=G:(z=-R,G=T)):H>Z&&(H=Z,-R+F<0?z=0:-R+F>T?z=G:(z=-R+F,G=T)),B=z===0?0:z/G,U=H===0?0:H/Z;var V=(1-B)*l+B*g,W=(1-B)*m+B*y,st=(1-U)*E+U*w,Q=(1-U)*L+U*A,ct=st-V,ht=Q-W;return ct*ct+ht*ht}function d(l,m){return l[0]===m[0]?l[1]-m[1]:l[0]-m[0]}function p(l){l.sort(d);for(var m=[],g=0;g<l.length;g++){for(;m.length>=2&&u(m[m.length-2],m[m.length-1],l[g])<=0;)m.pop();m.push(l[g])}for(var y=[],E=l.length-1;E>=0;E--){for(;y.length>=2&&u(y[y.length-2],y[y.length-1],l[E])<=0;)y.pop();y.push(l[E])}return y.pop(),m.pop(),m.concat(y)}return Le.exports}var mr=pr();const gr=ze(mr);function vr(i,t={}){t.concavity=t.concavity||1/0;const e=[];if(Ct(i,s=>{e.push([s[0],s[1]])}),!e.length)return null;const n=gr(e,t.concavity);return n.length>3?Ee([n]):null}function fn(i,t={}){switch(Fo(i)){case"Point":return lt(at(i),t.properties);case"Polygon":var e=[];Ct(i,function(l){e.push(l)});var n=je(i,{properties:t.properties}),s=n.geometry.coordinates,o=0,r=0,a=0,h,c,u,f,v,x,_,M,I=e.map(function(l){return[l[0]-s[0],l[1]-s[1]]});for(h=0;h<e.length-1;h++)c=I[h],f=c[0],x=c[1],u=I[h+1],v=u[0],_=u[1],M=f*_-v*x,a+=M,o+=(f+v)*M,r+=(x+_)*M;if(a===0)return n;var C=a*.5,d=1/(6*C);return lt([s[0]+d*o,s[1]+d*r],t.properties);default:var p=vr(i);return p?fn(p,{properties:t.properties}):je(i,{properties:t.properties})}}function dn(i){if(!i)throw new Error("geojson is required");switch(i.type){case"Feature":return pn(i);case"FeatureCollection":return yr(i);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ze(i);default:throw new Error("unknown GeoJSON type")}}function pn(i){const t={type:"Feature"};return Object.keys(i).forEach(e=>{switch(e){case"type":case"properties":case"geometry":return;default:t[e]=i[e]}}),t.properties=mn(i.properties),i.geometry==null?t.geometry=null:t.geometry=Ze(i.geometry),t}function mn(i){const t={};return i&&Object.keys(i).forEach(e=>{const n=i[e];typeof n=="object"?n===null?t[e]=null:Array.isArray(n)?t[e]=n.map(s=>s):t[e]=mn(n):t[e]=n}),t}function yr(i){const t={type:"FeatureCollection"};return Object.keys(i).forEach(e=>{switch(e){case"type":case"features":return;default:t[e]=i[e]}}),t.features=i.features.map(e=>pn(e)),t}function Ze(i){const t={type:i.type};return i.bbox&&(t.bbox=i.bbox),i.type==="GeometryCollection"?(t.geometries=i.geometries.map(e=>Ze(e)),t):(t.coordinates=gn(i.coordinates),t)}function gn(i){const t=i;return typeof t[0]!="object"?t.slice():t.map(e=>gn(e))}function xr(i,t,e={}){const n=at(i),s=at(t);s[0]+=s[0]-n[0]>180?-360:n[0]-s[0]>180?360:0;const o=Er(n,s);return Ji(o,"meters",e.units)}function Er(i,t,e){e=e===void 0?ot:Number(e);const n=e,s=i[1]*Math.PI/180,o=t[1]*Math.PI/180,r=o-s;let a=Math.abs(t[0]-i[0])*Math.PI/180;a>Math.PI&&(a-=2*Math.PI);const h=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(s/2+Math.PI/4)),c=Math.abs(h)>1e-11?r/h:Math.cos(s);return Math.sqrt(r*r+c*c*a*a)*n}function we(i,t,e,n={}){const s=t<0;let o=Ji(Math.abs(t),n.units,"meters");s&&(o=-Math.abs(o));const r=at(i),a=_r(r,o,e);return a[0]+=a[0]-r[0]>180?-360:r[0]-a[0]>180?360:0,lt(a,n.properties)}function _r(i,t,e,n){n=n===void 0?ot:Number(n);const s=t/n,o=i[0]*Math.PI/180,r=it(i[1]),a=it(e),h=s*Math.cos(a);let c=r+h;Math.abs(c)>Math.PI/2&&(c=c>0?Math.PI-c:-Math.PI-c);const u=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),f=Math.abs(u)>1e-11?h/u:Math.cos(r),v=s*Math.sin(a)/f;return[((o+v)*180/Math.PI+540)%360-180,c*180/Math.PI]}function br(i,t,e){if(e=e||{},!$o(e))throw new Error("options is invalid");const n=e.pivot,s=e.mutate;if(!i)throw new Error("geojson is required");if(t==null||isNaN(t))throw new Error("angle is required");if(t===0)return i;const o=n??je(i);return(s===!1||s===void 0)&&(i=dn(i)),Ct(i,function(r){const h=Xo(o,r)+t,c=xr(o,r),u=Qi(we(o,c,h));r[0]=u[0],r[1]=u[1]}),i}function Lr(i,t={}){return Ho(i,(e,n)=>{const s=n.geometry.coordinates;return e+tn(s[0],s[1],t)},0)}function vn(i,t={}){var e,n,s,o=t.properties,r=(e=t.autoComplete)!=null?e:!0,a=(n=t.orderCoords)!=null?n:!0,h=(s=t.mutate)!=null?s:!1;if(h||(i=dn(i)),i.type==="FeatureCollection"){var c=[];return i.features.forEach(function(u){c.push(Qi(yn(u,{},r,a)))}),Ro(c,o)}else return yn(i,o,r,a)}function yn(i,t,e,n){t=t||(i.type==="Feature"?i.properties:{});var s=Xe(i),o=s.coordinates,r=s.type;if(!o.length)throw new Error("line must contain coordinates");switch(r){case"LineString":return e&&(o=xn(o)),Ee([o],t);case"MultiLineString":var a=[],h=0;return o.forEach(function(c){if(e&&(c=xn(c)),n){var u=Mr(be(Et(c)));u>h?(a.unshift(c),h=u):a.push(c)}else a.push(c)}),Ee(a,t);default:throw new Error("geometry type "+r+" is not supported")}}function xn(i){var t=i[0],e=t[0],n=t[1],s=i[i.length-1],o=s[0],r=s[1];return(e!==o||n!==r)&&i.push(t),i}function Mr(i){var t=i[0],e=i[1],n=i[2],s=i[3];return Math.abs(t-n)*Math.abs(e-s)}function re(i,t,e){const s=i.getCenter().lat,o=i.getZoom(),r=s*(Math.PI/180),a=40075017*Math.cos(r)/Math.pow(2,o+9);return t/a}async function wr(i,t,e){const s=await(f=>new Promise((v,x)=>{const _=new Blob([f],{type:"image/svg+xml;charset=utf-8"}),M=URL.createObjectURL(_),I=new Image;I.crossOrigin="anonymous",I.onload=()=>{URL.revokeObjectURL(M),v(I)},I.onerror=C=>{URL.revokeObjectURL(M),x(new Error(`SVG图片加载失败:${JSON.stringify(C)}`))},I.src=M}))(i),o=s.naturalWidth||s.width||300,r=s.naturalHeight||s.height||150,a=document.createElement("canvas");a.width=o,a.height=r;const h=a.getContext("2d");if(!h)throw new Error("无法获取Canvas 2D上下文");h.clearRect(0,0,o,r),h.drawImage(s,0,0,o,r);const[c,u]=await Promise.all([createImageBitmap(a),Promise.resolve(h.getImageData(0,0,o,r))]);return{image:s,bitmap:c,imageData:u}}function En(i,t,e){const s=i.getZoom(),o=t*Math.PI/180,r=40075017*Math.cos(o)/Math.pow(2,s+9);return e*r}class zt{static SUCCESS=ke.SUCCESS;static FAIL=ke.FAIL;_map;_cache=new ji({uniqueKey:`${Do}-icon`,type:"localstorage"});loadingPromises=new Map;constructor(t){this._map=t}async load(t){const e=await Promise.allSettled(t.map(o=>this.add(o))),n=[],s=[];return e.forEach(o=>{o.status==="fulfilled"?n.push(o.value):s.push(o.reason)}),{success:n,error:s}}async loadSvg(t){const e=await Promise.allSettled(t.map(o=>this.addSvg(o))),n=[],s=[];return e.forEach(o=>{o.status==="fulfilled"?n.push(o.value):s.push(o.reason)}),{success:n,error:s}}async addSvg(t){if(this.has(t.name))return this.error(t,"The image has been loaded!");if(this.loadingPromises.has(t.name))return this.loadingPromises.get(t.name);const e=(async()=>{try{const n=await wr(t.svg);return this.has(t.name)||(this._cache.set({name:t.name,content:{width:n.image.width,height:n.image.height,image:n.image}}),this._map.addImage(t.name,n.image)),this.success(t)}catch(n){return this.error(t,n)}finally{this.loadingPromises.delete(t.name)}})();return this.loadingPromises.set(t.name,e),e}add(t){if(this.has(t.name))return Promise.resolve(this.error(t,"The image has been loaded!"));if(this.loadingPromises.has(t.name))return this.loadingPromises.get(t.name);const e=new Promise((n,s)=>{this._map.loadImage(t.url,(o,r)=>{if(this.loadingPromises.delete(t.name),o){s(this.error(t,o));return}r?(this.has(t.name)||(this._cache.set({name:t.name,content:{width:r.width,height:r.height,image:r}}),this._map.addImage(t.name,r,t.options)),n(this.success(t))):s(this.error(t,"The image has not found!"))})});return this.loadingPromises.set(t.name,e),e}has(t){return this._map.hasImage(t)}getImage(t){return this._cache.get(t)}update(t){return new Promise((e,n)=>{if(!this._map.hasImage(t.name)){n(this.error(t,"The image has not been loaded!"));return}this._map.loadImage(t.url,(s,o)=>{if(s){n(this.error(t,s));return}o?(this._cache.set({name:t.name,content:{width:o.width,height:o.height}}),this._map.updateImage(t.name,o),e(this.success(t))):n(this.error(t,"The image has not found!"))})})}delete(t){this._map.hasImage(t)&&(this._map.removeImage(t),this._cache.remove(t))}success(t){return{code:zt.SUCCESS,data:t,msg:`The ${t.name} was successfully added`}}error(t,e){return{code:zt.FAIL,data:t,msg:e}}}var Ve={exports:{}},_n;function Ar(){return _n||(_n=1,(function(i){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function s(h,c,u){this.fn=h,this.context=c,this.once=u||!1}function o(h,c,u,f,v){if(typeof u!="function")throw new TypeError("The listener must be a function");var x=new s(u,f||h,v),_=e?e+c:c;return h._events[_]?h._events[_].fn?h._events[_]=[h._events[_],x]:h._events[_].push(x):(h._events[_]=x,h._eventsCount++),h}function r(h,c){--h._eventsCount===0?h._events=new n:delete h._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,f;if(this._eventsCount===0)return c;for(f in u=this._events)t.call(u,f)&&c.push(e?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=e?e+c:c,f=this._events[u];if(!f)return[];if(f.fn)return[f.fn];for(var v=0,x=f.length,_=new Array(x);v<x;v++)_[v]=f[v].fn;return _},a.prototype.listenerCount=function(c){var u=e?e+c:c,f=this._events[u];return f?f.fn?1:f.length:0},a.prototype.emit=function(c,u,f,v,x,_){var M=e?e+c:c;if(!this._events[M])return!1;var I=this._events[M],C=arguments.length,d,p;if(I.fn){switch(I.once&&this.removeListener(c,I.fn,void 0,!0),C){case 1:return I.fn.call(I.context),!0;case 2:return I.fn.call(I.context,u),!0;case 3:return I.fn.call(I.context,u,f),!0;case 4:return I.fn.call(I.context,u,f,v),!0;case 5:return I.fn.call(I.context,u,f,v,x),!0;case 6:return I.fn.call(I.context,u,f,v,x,_),!0}for(p=1,d=new Array(C-1);p<C;p++)d[p-1]=arguments[p];I.fn.apply(I.context,d)}else{var l=I.length,m;for(p=0;p<l;p++)switch(I[p].once&&this.removeListener(c,I[p].fn,void 0,!0),C){case 1:I[p].fn.call(I[p].context);break;case 2:I[p].fn.call(I[p].context,u);break;case 3:I[p].fn.call(I[p].context,u,f);break;case 4:I[p].fn.call(I[p].context,u,f,v);break;default:if(!d)for(m=1,d=new Array(C-1);m<C;m++)d[m-1]=arguments[m];I[p].fn.apply(I[p].context,d)}}return!0},a.prototype.on=function(c,u,f){return o(this,c,u,f,!1)},a.prototype.once=function(c,u,f){return o(this,c,u,f,!0)},a.prototype.removeListener=function(c,u,f,v){var x=e?e+c:c;if(!this._events[x])return this;if(!u)return r(this,x),this;var _=this._events[x];if(_.fn)_.fn===u&&(!v||_.once)&&(!f||_.context===f)&&r(this,x);else{for(var M=0,I=[],C=_.length;M<C;M++)(_[M].fn!==u||v&&!_[M].once||f&&_[M].context!==f)&&I.push(_[M]);I.length?this._events[x]=I.length===1?I[0]:I:r(this,x)}return this},a.prototype.removeAllListeners=function(c){var u;return c?(u=e?e+c:c,this._events[u]&&r(this,u)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,i.exports=a})(Ve)),Ve.exports}var Sr=Ar();const Ae=ze(Sr);class bn{map;listeners=new Map;activeLayerListeners=new Map;currentHoverIdByLayer=new Map;constructor(t){this.map=t}on(t,e,n,s){const o=String(t);this.listeners.has(o)||this.listeners.set(o,new Map);const r=this.listeners.get(o);if(!r){console.error("未找到listener");return}r.has(n)||r.set(n,[]);const a=r.get(n);a&&(a.push(s),this.ensureMapListener(e,n))}off(t,e,n){const s=String(t),o=this.listeners.get(s);if(!o)return;if(!e){this.listeners.delete(s);return}const r=o.get(e);if(!r)return;if(!n){o.delete(e);return}const a=r.indexOf(n);a!==-1&&r.splice(a,1),r.length===0&&o.delete(e),o.size===0&&this.listeners.delete(s)}ensureMapListener(t,e){const n=`${t}:${e}`;if(this.activeLayerListeners.has(n))return;const s=o=>{this.dispatch(o,t,e)};this.map.on(e,t,s),this.activeLayerListeners.set(n,s),e==="mouseleave"&&this.ensureMapListener(t,"mouseenter")}dispatch(t,e,n){let s;if(n==="mouseleave"){const r=this.currentHoverIdByLayer.get(e);r!==void 0&&(s=r,this.currentHoverIdByLayer.delete(e))}else if(t.features&&t.features.length>0){const r=t.features[0],a=r.properties?.id??r.id;a!=null&&(s=String(a))}if(s===void 0)return;n==="mouseenter"&&this.currentHoverIdByLayer.set(e,s);const o=this.listeners.get(s);if(o){const r=o.get(n);r&&[...r].forEach(a=>{a(t)})}}destroy(){this.activeLayerListeners.forEach((t,e)=>{const n=e.lastIndexOf(":"),s=e.substring(0,n),o=e.substring(n+1);try{this.map.off(o,s,t)}catch{}}),this.activeLayerListeners.clear(),this.listeners.clear(),this.currentHoverIdByLayer.clear()}}var Ln=typeof global=="object"&&global&&global.Object===Object&&global,Ir=typeof self=="object"&&self&&self.Object===Object&&self,pt=Ln||Ir||Function("return this")(),bt=pt.Symbol,Mn=Object.prototype,Cr=Mn.hasOwnProperty,Tr=Mn.toString,ae=bt?bt.toStringTag:void 0;function Pr(i){var t=Cr.call(i,ae),e=i[ae];try{i[ae]=void 0;var n=!0}catch{}var s=Tr.call(i);return n&&(t?i[ae]=e:delete i[ae]),s}var Or=Object.prototype,Dr=Or.toString;function Nr(i){return Dr.call(i)}var Rr="[object Null]",$r="[object Undefined]",wn=bt?bt.toStringTag:void 0;function jt(i){return i==null?i===void 0?$r:Rr:wn&&wn in Object(i)?Pr(i):Nr(i)}function Ht(i){return i!=null&&typeof i=="object"}var Fr="[object Symbol]";function Ge(i){return typeof i=="symbol"||Ht(i)&&jt(i)==Fr}function Yr(i,t){for(var e=-1,n=i==null?0:i.length,s=Array(n);++e<n;)s[e]=t(i[e],e,i);return s}var Tt=Array.isArray,An=bt?bt.prototype:void 0,Sn=An?An.toString:void 0;function In(i){if(typeof i=="string")return i;if(Tt(i))return Yr(i,In)+"";if(Ge(i))return Sn?Sn.call(i):"";var t=i+"";return t=="0"&&1/i==-1/0?"-0":t}function qt(i){var t=typeof i;return i!=null&&(t=="object"||t=="function")}var Br="[object AsyncFunction]",kr="[object Function]",Xr="[object GeneratorFunction]",Ur="[object Proxy]";function Cn(i){if(!qt(i))return!1;var t=jt(i);return t==kr||t==Xr||t==Br||t==Ur}var Ke=pt["__core-js_shared__"],Tn=(function(){var i=/[^.]+$/.exec(Ke&&Ke.keys&&Ke.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function zr(i){return!!Tn&&Tn in i}var jr=Function.prototype,Hr=jr.toString;function Pt(i){if(i!=null){try{return Hr.call(i)}catch{}try{return i+""}catch{}}return""}var qr=/[\\^$.*+?()[\]{}|]/g,Zr=/^\[object .+?Constructor\]$/,Vr=Function.prototype,Gr=Object.prototype,Kr=Vr.toString,Jr=Gr.hasOwnProperty,Wr=RegExp("^"+Kr.call(Jr).replace(qr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Qr(i){if(!qt(i)||zr(i))return!1;var t=Cn(i)?Wr:Zr;return t.test(Pt(i))}function ta(i,t){return i?.[t]}function Ot(i,t){var e=ta(i,t);return Qr(e)?e:void 0}var Je=Ot(pt,"WeakMap"),Pn=Object.create,ea=(function(){function i(){}return function(t){if(!qt(t))return{};if(Pn)return Pn(t);i.prototype=t;var e=new i;return i.prototype=void 0,e}})(),On=(function(){try{var i=Ot(Object,"defineProperty");return i({},"",{}),i}catch{}})();function ia(i,t){for(var e=-1,n=i==null?0:i.length;++e<n&&t(i[e],e,i)!==!1;);return i}var na=9007199254740991,sa=/^(?:0|[1-9]\d*)$/;function Dn(i,t){var e=typeof i;return t=t??na,!!t&&(e=="number"||e!="symbol"&&sa.test(i))&&i>-1&&i%1==0&&i<t}function oa(i,t,e){t=="__proto__"&&On?On(i,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):i[t]=e}function Nn(i,t){return i===t||i!==i&&t!==t}var ra=Object.prototype,aa=ra.hasOwnProperty;function Rn(i,t,e){var n=i[t];(!(aa.call(i,t)&&Nn(n,e))||e===void 0&&!(t in i))&&oa(i,t,e)}var ca=9007199254740991;function $n(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=ca}function Fn(i){return i!=null&&$n(i.length)&&!Cn(i)}var ha=Object.prototype;function We(i){var t=i&&i.constructor,e=typeof t=="function"&&t.prototype||ha;return i===e}function la(i,t){for(var e=-1,n=Array(i);++e<i;)n[e]=t(e);return n}var ua="[object Arguments]";function Yn(i){return Ht(i)&&jt(i)==ua}var Bn=Object.prototype,fa=Bn.hasOwnProperty,da=Bn.propertyIsEnumerable,kn=Yn((function(){return arguments})())?Yn:function(i){return Ht(i)&&fa.call(i,"callee")&&!da.call(i,"callee")};function pa(){return!1}var Xn=typeof k=="object"&&k&&!k.nodeType&&k,Un=Xn&&typeof module=="object"&&module&&!module.nodeType&&module,ma=Un&&Un.exports===Xn,zn=ma?pt.Buffer:void 0,ga=zn?zn.isBuffer:void 0,Qe=ga||pa,va="[object Arguments]",ya="[object Array]",xa="[object Boolean]",Ea="[object Date]",_a="[object Error]",ba="[object Function]",La="[object Map]",Ma="[object Number]",wa="[object Object]",Aa="[object RegExp]",Sa="[object Set]",Ia="[object String]",Ca="[object WeakMap]",Ta="[object ArrayBuffer]",Pa="[object DataView]",Oa="[object Float32Array]",Da="[object Float64Array]",Na="[object Int8Array]",Ra="[object Int16Array]",$a="[object Int32Array]",Fa="[object Uint8Array]",Ya="[object Uint8ClampedArray]",Ba="[object Uint16Array]",ka="[object Uint32Array]",J={};J[Oa]=J[Da]=J[Na]=J[Ra]=J[$a]=J[Fa]=J[Ya]=J[Ba]=J[ka]=!0,J[va]=J[ya]=J[Ta]=J[xa]=J[Pa]=J[Ea]=J[_a]=J[ba]=J[La]=J[Ma]=J[wa]=J[Aa]=J[Sa]=J[Ia]=J[Ca]=!1;function Xa(i){return Ht(i)&&$n(i.length)&&!!J[jt(i)]}function ti(i){return function(t){return i(t)}}var jn=typeof k=="object"&&k&&!k.nodeType&&k,ce=jn&&typeof module=="object"&&module&&!module.nodeType&&module,Ua=ce&&ce.exports===jn,ei=Ua&&Ln.process,Zt=(function(){try{var i=ce&&ce.require&&ce.require("util").types;return i||ei&&ei.binding&&ei.binding("util")}catch{}})(),Hn=Zt&&Zt.isTypedArray,qn=Hn?ti(Hn):Xa,za=Object.prototype,ja=za.hasOwnProperty;function Ha(i,t){var e=Tt(i),n=!e&&kn(i),s=!e&&!n&&Qe(i),o=!e&&!n&&!s&&qn(i),r=e||n||s||o,a=r?la(i.length,String):[],h=a.length;for(var c in i)ja.call(i,c)&&!(r&&(c=="length"||s&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Dn(c,h)))&&a.push(c);return a}function Zn(i,t){return function(e){return i(t(e))}}var qa=Zn(Object.keys,Object),Za=Object.prototype,Va=Za.hasOwnProperty;function Vn(i){if(!We(i))return qa(i);var t=[];for(var e in Object(i))Va.call(i,e)&&e!="constructor"&&t.push(e);return t}function Ga(i){return Fn(i)?Ha(i):Vn(i)}var Ka=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ja=/^\w*$/;function Wa(i,t){if(Tt(i))return!1;var e=typeof i;return e=="number"||e=="symbol"||e=="boolean"||i==null||Ge(i)?!0:Ja.test(i)||!Ka.test(i)||t!=null&&i in Object(t)}var he=Ot(Object,"create");function Qa(){this.__data__=he?he(null):{},this.size=0}function tc(i){var t=this.has(i)&&delete this.__data__[i];return this.size-=t?1:0,t}var ec="__lodash_hash_undefined__",ic=Object.prototype,nc=ic.hasOwnProperty;function sc(i){var t=this.__data__;if(he){var e=t[i];return e===ec?void 0:e}return nc.call(t,i)?t[i]:void 0}var oc=Object.prototype,rc=oc.hasOwnProperty;function ac(i){var t=this.__data__;return he?t[i]!==void 0:rc.call(t,i)}var cc="__lodash_hash_undefined__";function hc(i,t){var e=this.__data__;return this.size+=this.has(i)?0:1,e[i]=he&&t===void 0?cc:t,this}function Dt(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var n=i[t];this.set(n[0],n[1])}}Dt.prototype.clear=Qa,Dt.prototype.delete=tc,Dt.prototype.get=sc,Dt.prototype.has=ac,Dt.prototype.set=hc;function lc(){this.__data__=[],this.size=0}function Se(i,t){for(var e=i.length;e--;)if(Nn(i[e][0],t))return e;return-1}var uc=Array.prototype,fc=uc.splice;function dc(i){var t=this.__data__,e=Se(t,i);if(e<0)return!1;var n=t.length-1;return e==n?t.pop():fc.call(t,e,1),--this.size,!0}function pc(i){var t=this.__data__,e=Se(t,i);return e<0?void 0:t[e][1]}function mc(i){return Se(this.__data__,i)>-1}function gc(i,t){var e=this.__data__,n=Se(e,i);return n<0?(++this.size,e.push([i,t])):e[n][1]=t,this}function vt(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var n=i[t];this.set(n[0],n[1])}}vt.prototype.clear=lc,vt.prototype.delete=dc,vt.prototype.get=pc,vt.prototype.has=mc,vt.prototype.set=gc;var le=Ot(pt,"Map");function vc(){this.size=0,this.__data__={hash:new Dt,map:new(le||vt),string:new Dt}}function yc(i){var t=typeof i;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?i!=="__proto__":i===null}function Ie(i,t){var e=i.__data__;return yc(t)?e[typeof t=="string"?"string":"hash"]:e.map}function xc(i){var t=Ie(this,i).delete(i);return this.size-=t?1:0,t}function Ec(i){return Ie(this,i).get(i)}function _c(i){return Ie(this,i).has(i)}function bc(i,t){var e=Ie(this,i),n=e.size;return e.set(i,t),this.size+=e.size==n?0:1,this}function Lt(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var n=i[t];this.set(n[0],n[1])}}Lt.prototype.clear=vc,Lt.prototype.delete=xc,Lt.prototype.get=Ec,Lt.prototype.has=_c,Lt.prototype.set=bc;var Lc="Expected a function";function ii(i,t){if(typeof i!="function"||t!=null&&typeof t!="function")throw new TypeError(Lc);var e=function(){var n=arguments,s=t?t.apply(this,n):n[0],o=e.cache;if(o.has(s))return o.get(s);var r=i.apply(this,n);return e.cache=o.set(s,r)||o,r};return e.cache=new(ii.Cache||Lt),e}ii.Cache=Lt;var Mc=500;function wc(i){var t=ii(i,function(n){return e.size===Mc&&e.clear(),n}),e=t.cache;return t}var Ac=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Sc=/\\(\\)?/g,Ic=wc(function(i){var t=[];return i.charCodeAt(0)===46&&t.push(""),i.replace(Ac,function(e,n,s,o){t.push(s?o.replace(Sc,"$1"):n||e)}),t});function Cc(i){return i==null?"":In(i)}function Tc(i,t){return Tt(i)?i:Wa(i,t)?[i]:Ic(Cc(i))}function Pc(i){if(typeof i=="string"||Ge(i))return i;var t=i+"";return t=="0"&&1/i==-1/0?"-0":t}function Oc(i,t){for(var e=-1,n=t.length,s=i.length;++e<n;)i[s+e]=t[e];return i}var Dc=Zn(Object.getPrototypeOf,Object);function Nc(){this.__data__=new vt,this.size=0}function Rc(i){var t=this.__data__,e=t.delete(i);return this.size=t.size,e}function $c(i){return this.__data__.get(i)}function Fc(i){return this.__data__.has(i)}var Yc=200;function Bc(i,t){var e=this.__data__;if(e instanceof vt){var n=e.__data__;if(!le||n.length<Yc-1)return n.push([i,t]),this.size=++e.size,this;e=this.__data__=new Lt(n)}return e.set(i,t),this.size=e.size,this}function Vt(i){var t=this.__data__=new vt(i);this.size=t.size}Vt.prototype.clear=Nc,Vt.prototype.delete=Rc,Vt.prototype.get=$c,Vt.prototype.has=Fc,Vt.prototype.set=Bc;var Gn=typeof k=="object"&&k&&!k.nodeType&&k,Kn=Gn&&typeof module=="object"&&module&&!module.nodeType&&module,kc=Kn&&Kn.exports===Gn,Jn=kc?pt.Buffer:void 0;Jn&&Jn.allocUnsafe;function Xc(i,t){return i.slice()}function Uc(i,t){for(var e=-1,n=i==null?0:i.length,s=0,o=[];++e<n;){var r=i[e];t(r,e,i)&&(o[s++]=r)}return o}function zc(){return[]}var jc=Object.prototype,Hc=jc.propertyIsEnumerable,Wn=Object.getOwnPropertySymbols,qc=Wn?function(i){return i==null?[]:(i=Object(i),Uc(Wn(i),function(t){return Hc.call(i,t)}))}:zc;function Zc(i,t,e){var n=t(i);return Tt(i)?n:Oc(n,e(i))}function Vc(i){return Zc(i,Ga,qc)}var ni=Ot(pt,"DataView"),si=Ot(pt,"Promise"),oi=Ot(pt,"Set"),Qn="[object Map]",Gc="[object Object]",ts="[object Promise]",es="[object Set]",is="[object WeakMap]",ns="[object DataView]",Kc=Pt(ni),Jc=Pt(le),Wc=Pt(si),Qc=Pt(oi),th=Pt(Je),mt=jt;(ni&&mt(new ni(new ArrayBuffer(1)))!=ns||le&&mt(new le)!=Qn||si&&mt(si.resolve())!=ts||oi&&mt(new oi)!=es||Je&&mt(new Je)!=is)&&(mt=function(i){var t=jt(i),e=t==Gc?i.constructor:void 0,n=e?Pt(e):"";if(n)switch(n){case Kc:return ns;case Jc:return Qn;case Wc:return ts;case Qc:return es;case th:return is}return t});var eh=Object.prototype,ih=eh.hasOwnProperty;function nh(i){var t=i.length,e=new i.constructor(t);return t&&typeof i[0]=="string"&&ih.call(i,"index")&&(e.index=i.index,e.input=i.input),e}var ss=pt.Uint8Array;function ri(i){var t=new i.constructor(i.byteLength);return new ss(t).set(new ss(i)),t}function sh(i,t){var e=ri(i.buffer);return new i.constructor(e,i.byteOffset,i.byteLength)}var oh=/\w*$/;function rh(i){var t=new i.constructor(i.source,oh.exec(i));return t.lastIndex=i.lastIndex,t}var os=bt?bt.prototype:void 0,rs=os?os.valueOf:void 0;function ah(i){return rs?Object(rs.call(i)):{}}function ch(i,t){var e=ri(i.buffer);return new i.constructor(e,i.byteOffset,i.length)}var hh="[object Boolean]",lh="[object Date]",uh="[object Map]",fh="[object Number]",dh="[object RegExp]",ph="[object Set]",mh="[object String]",gh="[object Symbol]",vh="[object ArrayBuffer]",yh="[object DataView]",xh="[object Float32Array]",Eh="[object Float64Array]",_h="[object Int8Array]",bh="[object Int16Array]",Lh="[object Int32Array]",Mh="[object Uint8Array]",wh="[object Uint8ClampedArray]",Ah="[object Uint16Array]",Sh="[object Uint32Array]";function Ih(i,t,e){var n=i.constructor;switch(t){case vh:return ri(i);case hh:case lh:return new n(+i);case yh:return sh(i);case xh:case Eh:case _h:case bh:case Lh:case Mh:case wh:case Ah:case Sh:return ch(i);case uh:return new n;case fh:case mh:return new n(i);case dh:return rh(i);case ph:return new n;case gh:return ah(i)}}function Ch(i){return typeof i.constructor=="function"&&!We(i)?ea(Dc(i)):{}}var Th="[object Map]";function Ph(i){return Ht(i)&&mt(i)==Th}var as=Zt&&Zt.isMap,Oh=as?ti(as):Ph,Dh="[object Set]";function Nh(i){return Ht(i)&&mt(i)==Dh}var cs=Zt&&Zt.isSet,Rh=cs?ti(cs):Nh,hs="[object Arguments]",$h="[object Array]",Fh="[object Boolean]",Yh="[object Date]",Bh="[object Error]",ls="[object Function]",kh="[object GeneratorFunction]",Xh="[object Map]",Uh="[object Number]",us="[object Object]",zh="[object RegExp]",jh="[object Set]",Hh="[object String]",qh="[object Symbol]",Zh="[object WeakMap]",Vh="[object ArrayBuffer]",Gh="[object DataView]",Kh="[object Float32Array]",Jh="[object Float64Array]",Wh="[object Int8Array]",Qh="[object Int16Array]",tl="[object Int32Array]",el="[object Uint8Array]",il="[object Uint8ClampedArray]",nl="[object Uint16Array]",sl="[object Uint32Array]",K={};K[hs]=K[$h]=K[Vh]=K[Gh]=K[Fh]=K[Yh]=K[Kh]=K[Jh]=K[Wh]=K[Qh]=K[tl]=K[Xh]=K[Uh]=K[us]=K[zh]=K[jh]=K[Hh]=K[qh]=K[el]=K[il]=K[nl]=K[sl]=!0,K[Bh]=K[ls]=K[Zh]=!1;function Ce(i,t,e,n,s,o){var r;if(r!==void 0)return r;if(!qt(i))return i;var a=Tt(i);if(a)r=nh(i);else{var h=mt(i),c=h==ls||h==kh;if(Qe(i))return Xc(i);if(h==us||h==hs||c&&!s)r=c?{}:Ch(i);else{if(!K[h])return s?i:{};r=Ih(i,h)}}o||(o=new Vt);var u=o.get(i);if(u)return u;o.set(i,r),Rh(i)?i.forEach(function(x){r.add(Ce(x,t,e,x,i,o))}):Oh(i)&&i.forEach(function(x,_){r.set(_,Ce(x,t,e,_,i,o))});var f=Vc,v=a?void 0:f(i);return ia(v||i,function(x,_){v&&(_=x,x=i[_]),Rn(r,_,Ce(x,t,e,_,i,o))}),r}var ol=1,rl=4;function al(i){return Ce(i,ol|rl)}var cl="[object Map]",hl="[object Set]",ll=Object.prototype,ul=ll.hasOwnProperty;function fl(i){if(i==null)return!0;if(Fn(i)&&(Tt(i)||typeof i=="string"||typeof i.splice=="function"||Qe(i)||qn(i)||kn(i)))return!i.length;var t=mt(i);if(t==cl||t==hl)return!i.size;if(We(i))return!Vn(i).length;for(var e in i)if(ul.call(i,e))return!1;return!0}function dl(i,t,e,n){if(!qt(i))return i;t=Tc(t,i);for(var s=-1,o=t.length,r=o-1,a=i;a!=null&&++s<o;){var h=Pc(t[s]),c=e;if(h==="__proto__"||h==="constructor"||h==="prototype")return i;if(s!=r){var u=a[h];c=void 0,c===void 0&&(c=qt(u)?u:Dn(t[s+1])?[]:{})}Rn(a,h,c),a=a[h]}return i}function pl(i,t,e){return i==null?i:dl(i,t,e)}const tt=[];for(let i=0;i<256;++i)tt.push((i+256).toString(16).slice(1));function ml(i,t=0){return(tt[i[t+0]]+tt[i[t+1]]+tt[i[t+2]]+tt[i[t+3]]+"-"+tt[i[t+4]]+tt[i[t+5]]+"-"+tt[i[t+6]]+tt[i[t+7]]+"-"+tt[i[t+8]]+tt[i[t+9]]+"-"+tt[i[t+10]]+tt[i[t+11]]+tt[i[t+12]]+tt[i[t+13]]+tt[i[t+14]]+tt[i[t+15]]).toLowerCase()}let ai;const gl=new Uint8Array(16);function vl(){if(!ai){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ai=crypto.getRandomValues.bind(crypto)}return ai(gl)}const fs={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ds(i,t,e){if(fs.randomUUID&&!i)return fs.randomUUID();i=i||{};const n=i.random??i.rng?.()??vl();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,ml(n)}function yl(i){return i!=null}class ps{map;sourceData=new Map;featureIndex=new Map;dirtySourceIds=new Set;renderFrameId=null;layerList=[];destroyed=!1;managedSourceIds=new Set;managedLayerIds=new Set;constructor(t){this.map=t}checkDestroyed(){this.destroyed&&console.warn("[ResourceRegister] Instance has been destroyed")}addSource(t,e){if(this.checkDestroyed(),!this.map.getSource(t)){const n=e.type==="geojson"&&!e.promoteId?{...e,promoteId:"id"}:{...e};this.map.addSource(t,n),this.managedSourceIds.add(t)}}addLayer(t){this.checkDestroyed();const{layer:e,zIndex:n}=t;if(!this.map.getLayer(e.id)){const s=this.layerList.findIndex(o=>o.zIndex>n);if(s===-1)this.map.addLayer(e),this.layerList.push({zIndex:n,layer:e});else{const o=this.layerList[s].layer;this.map.addLayer(e,o.id),this.layerList.splice(s,0,{layer:e,zIndex:n})}this.managedLayerIds.add(e.id)}}removeLayer(t){this.checkDestroyed(),this.map.getLayer(t)&&this.map.removeLayer(t);const e=this.layerList.findIndex(n=>n.layer.id===t);e>-1&&this.layerList.splice(e,1),this.managedLayerIds.delete(t)}removeSource(t){this.checkDestroyed(),this.layerList.filter(n=>"source"in n.layer&&n.layer.source===t).forEach(n=>{this.removeLayer(n.layer.id)}),this.map.getSource(t)&&this.map.removeSource(t),this.sourceData.delete(t),this.managedSourceIds.delete(t);for(const n of this.featureIndex.keys())n.startsWith(`${t}:`)&&this.featureIndex.delete(n)}findFeature(t,e){return this.sourceData.get(t)?.features.find(s=>s.id===e)}getSource(t){return this.map.getSource(t)}setGeoJSONData(t,e){this.checkDestroyed();const n=Array.isArray(e)?e:[e];let s=this.sourceData.get(t);s||(s={type:"FeatureCollection",features:[]},this.sourceData.set(t,s)),n.forEach(o=>{if(!yl(o.id))return;const r=`${t}:${String(o.id)}`,a=this.featureIndex.get(r);if(o.geometry===null){if(a!==void 0){s.features.splice(a,1),this.featureIndex.delete(r);for(const[h,c]of this.featureIndex.entries())h.startsWith(`${t}:`)&&c>a&&this.featureIndex.set(h,c-1)}}else{const h=o;if(a!==void 0)s.features[a]=h;else{const c=s.features.length;s.features.push(h),this.featureIndex.set(r,c)}}}),this.dirtySourceIds.add(t),this.scheduleRender()}scheduleRender(){this.renderFrameId===null&&(this.renderFrameId=requestAnimationFrame(()=>{this.flushUpdates(),this.renderFrameId=null}))}flushUpdates(){this.destroyed||(this.dirtySourceIds.forEach(t=>{try{const e=this.getSource(t),n=this.sourceData.get(t);e?.type==="geojson"&&n&&e.setData({...n,features:[...n.features]})}catch(e){console.warn(`[ResourceRegister] Failed to update source "${t}":`,e)}}),this.dirtySourceIds.clear())}setState(t,e,n){if(this.checkDestroyed(),!this.map.getSource(t)){console.warn(`[ResourceRegister] Source "${t}" not found`);return}this.map.setFeatureState({source:t,id:e},n)}getState(t,e){return this.checkDestroyed(),this.map.getSource(t)?this.map.getFeatureState({source:t,id:e}):null}destroy(t=!1){if(!this.destroyed){if(this.destroyed=!0,this.renderFrameId!==null&&(cancelAnimationFrame(this.renderFrameId),this.renderFrameId=null),t){for(const e of this.managedLayerIds)this.map.getLayer(e)&&this.map.removeLayer(e);for(const e of this.managedSourceIds)this.map.getSource(e)&&this.map.removeSource(e)}this.layerList=[],this.sourceData.clear(),this.dirtySourceIds.clear(),this.featureIndex.clear(),this.managedSourceIds.clear(),this.managedLayerIds.clear()}}}const ci="mapbox-gl-focus-source",xl="mapbox-gl-focus-layer",El=99999,_l={id:xl,type:"line",source:ci,paint:{"line-color":"#f00","line-width":3},layout:{}};class bl extends Ae{map;focusItems=[];register;zoomendFunc=this._zoomend.bind(this);constructor(t){super(),this.map=t,this.register=new ps(t),this.onAdd()}get features(){return this.focusItems.map(t=>t.border)}onAdd(){this.register.addSource(ci,{type:"geojson",dynamic:!0,data:{type:"FeatureCollection",features:[]}}),this.register.addLayer({layer:_l,zIndex:El})}onRemove(){this.removeAll()}set(t,e){const n=t.id??ds();return this._onHandle(n,t,e),n}get(t){return this.focusItems.find(e=>e.id===t)}remove(t){const e=this.focusItems.findIndex(n=>n.id===t);e!==-1&&this.focusItems.splice(e,1),this.render()}removeAll(){this.focusItems=[],this.render()}render(){const t=this.map.getSource(ci);t&&(this.features.length>0?t.updateData({type:"FeatureCollection",features:this.features}):t.setData({type:"FeatureCollection",features:this.features}))}_zoomend(){this.render()}_onHandle(t,e,n){const s=this.getFocusBorder(e,n),o={id:t,border:s,feature:e,options:n},r=this.focusItems.findIndex(a=>a.id===t);r!==-1?pl(this.focusItems,r,o):this.focusItems.push(o),this.render(),this.features.length>0?this.map.on("zoomend",this.zoomendFunc):this.map.off("zoomend",this.zoomendFunc)}getFocusBorder(t,e={}){const n=String(t.id??ds()),{padding:s=10,armLength:o=20,size:r=40}=e,a=be(t),h=1/re(this.map,1);let c=a,u=0;if(t.geometry.type==="Point"){const v=(r+s)/2*h;u=r*.3*h,c=this._expandBBox(a,v,a[1])}else{const f=s*h;u=o*h,c=this._expandBBox(a,f,a[1])}return this._createBracketGeometry(n,c,u)}_expandBBox(t,e,n){const[s,o,r,a]=t,c=e/111319,u=c/Math.cos(n*Math.PI/180);return[s-u,o-c,r+u,a+c]}_createBracketGeometry(t,e,n){const[s,o,r,a]=e,c=n/111319,u=o*Math.PI/180,f=c/Math.cos(u),v=Math.min(c,(a-o)/2),x=Math.min(f,(r-s)/2),_=[[[s+x,o],[s,o],[s,o+v]],[[s,a-v],[s,a],[s+x,a]],[[r-x,a],[r,a],[r,a-v]],[[r,o+v],[r,o],[r-x,o]]];return No(_,{id:t},{id:t})}}class ms{map;events;register;iconManage;focus;eventManager;constructor(t){this.map=t.map,this.events=new Ae,this.register=new ps(this.map),this.iconManage=new zt(this.map),this.focus=new bl(this.map),this.eventManager=new bn(this.map)}destroy(){this.events.removeAllListeners()}}const hi=new WeakMap;function Ll(i){const t=hi.get(i);if(t)return t;const e=new ms({map:i});return hi.set(i,e),i.once("remove",()=>{e.destroy(),hi.delete(i)}),e}class Nt extends Ae{context;constructor(t){super(),this.context=Ll(t),this.onAdd(),this.context.map.once("beforeRemove",()=>{this.onRemove()})}mount(){this.onAdd()}destroy(){this.onRemove()}}const Ml="mapbox-gl-tooltip-connect-line",wl="mapbox-gl-tooltip-connect-debug-line",Al="mapbox-gl-tooltip-connect-debug-fill",Rt="mapbox-gl-tooltip-source",Sl=[{layer:{id:Ml,source:Rt,type:"line",paint:{"line-color":"#000","line-width":1}},zIndex:9999},{layer:{id:Al,source:Rt,type:"fill",filter:["all",["==","meta","debug"]],paint:{"fill-color":"#f00","fill-opacity":0}},zIndex:9999},{layer:{id:wl,source:Rt,type:"line",filter:["all",["==","meta","debug"]],paint:{"line-color":"#f00","line-width":1}},zIndex:9999}];class ue extends Nt{static DEBUG=!1;options;mark=null;zoom=()=>{this.render()};constructor(t,e){super(t),this.options=e,this.visible&&(this.context.map.on("zoom",this.zoom),this.context.map.on("zoomend",this.zoom))}get id(){return this.options.id}get visible(){const t=this.context.map.getBounds();return!!this.options.visible&&!!t?.contains(this.options.position)}get bbox(){const t=this.getAllBbox(),e=this.options.anchor??"bottom-right";return t[e]}onAdd(){this.context.register.addSource(Rt,{type:"geojson",dynamic:!0,data:{type:"FeatureCollection",features:[]}}),Sl.forEach(t=>{this.context.register.addLayer(t)})}onRemove(){this.remove()}debug(){const{minX:t,minY:e,maxX:n,maxY:s}=this.bbox,{lng:o,lat:r}=this.context.map.unproject(new q.Point(t,e)),{lng:a,lat:h}=this.context.map.unproject(new q.Point(n,s)),c=qo([o,r,a,h],{properties:{meta:"debug"},id:String(this.id)+"debug"});this.context.register.setGeoJSONData(Rt,c)}hide(){this.options.visible=!1,this.render(),this.context.map.off("zoom",this.zoom),this.context.map.off("zoomend",this.zoom)}show(){this.options.visible=!0,this.render(),this.context.map.on("zoom",this.zoom),this.context.map.on("zoomend",this.zoom)}update(t){this.options=t,this.render()}setAnchor(t){this.mark&&(this.mark.remove(),this.mark=null),this.options.anchor=t,this.show()}getSimpleBbox(){return{"top-left":this.getBbox("top-left"),"top-right":this.getBbox("top-right"),"bottom-left":this.getBbox("bottom-left"),"bottom-right":this.getBbox("bottom-right")}}getAllBbox(){return{center:this.getBbox("center"),top:this.getBbox("top"),bottom:this.getBbox("bottom"),left:this.getBbox("left"),right:this.getBbox("right"),"top-left":this.getBbox("top-left"),"top-right":this.getBbox("top-right"),"bottom-left":this.getBbox("bottom-left"),"bottom-right":this.getBbox("bottom-right")}}getBbox(t){const e=t??this.options.anchor,n=this.context.map.project(this.options.position),s=new q.Point(this.options.offsetX??0,this.options.offsetY??0),{width:o,height:r}=this.getOffDOMSize(this.options.element),a={minX:n.x,minY:n.y,maxX:n.x,maxY:n.y};return e==="top-left"?(a.maxY=n.y+r+Math.abs(s.y),a.maxX=n.x+o+Math.abs(s.x)):e==="top-right"?(a.maxY=n.y+r+Math.abs(s.y),a.minX=n.x-(o+s.x)):e==="bottom-left"?(a.minY=n.y-(r+s.y),a.maxX=n.x+o+Math.abs(s.x)):e==="bottom-right"&&(a.minY=n.y-(r+s.y),a.minX=n.x-(o+s.x)),a}getOffDOMSize(t){const e=t.cloneNode(!0),n={position:e.style.position,visibility:e.style.visibility,top:e.style.top,left:e.style.left,display:e.style.display};e.style.position="absolute",e.style.visibility="hidden",e.style.top="-9999px",e.style.left="-9999px",e.style.display="block",this.context.map.getCanvasContainer().appendChild(e);const s=e.offsetWidth,o=e.offsetHeight;return this.context.map.getCanvasContainer().removeChild(e),e.style.position=n.position,e.style.visibility=n.visibility,e.style.top=n.top,e.style.left=n.left,e.style.display=n.display,{width:s,height:o}}remove(){this.options.visible=!1,this.context.map.off("zoom",this.zoom),this.context.map.off("zoomend",this.zoom),this.mark&&(this.mark.remove(),this.mark=null),this.connectLine()}_create(){this.mark=new q.Marker({className:this.options.className??"mapbox-gl-tooltip",element:this.options.element,offset:this._getOffsetByAnchor(),anchor:this.options.anchor}).setLngLat(this.options.position)}_getOffsetByAnchor(){const t=new q.Point(0,0);return this.options.anchor==="center"?(t.x=0,t.y=0):this.options.anchor==="top"?(t.x=0,t.y=this.options.offsetY??0):this.options.anchor==="bottom"?(t.x=0,t.y=-(this.options.offsetY??0)):this.options.anchor==="left"?(t.x=this.options.offsetX??0,t.y=0):this.options.anchor==="right"?(t.x=-(this.options.offsetX??0),t.y=0):this.options.anchor==="top-left"?(t.x=this.options.offsetX??0,t.y=this.options.offsetY??0):this.options.anchor==="top-right"?(t.x=-(this.options.offsetX??0),t.y=this.options.offsetY??0):this.options.anchor==="bottom-left"?(t.x=this.options.offsetX??0,t.y=-(this.options.offsetY??0)):this.options.anchor==="bottom-right"&&(t.x=-(this.options.offsetX??0),t.y=-(this.options.offsetY??0)),t}setLngLat(t){return this.options.position=t,this.mark&&this.mark.setLngLat(t),this}connectLine(){if(!this.options.line)return;const t=`${String(this.options.id)}-tooltip-connect-line`,e=this.connectPoint();if(!e||!this.visible){const o={type:"Feature",geometry:{type:"Point",coordinates:[0,0]},id:t,properties:{}};this.context.register.setGeoJSONData(Rt,o);return}const n=[this.options.position.toArray(),e.toArray()],s=Et(n,{},{id:t});this.context.register.setGeoJSONData(Rt,s)}connectPoint(){if(!this.mark||!this.visible)return null;const t=this.context.map.project(this.mark.getLngLat()),e=this.mark.getOffset();t.x+=e.x,t.y+=e.y;const{width:n}=this.getOffDOMSize(this.options.element);return this.options.anchor==="top-left"?t.x+=n/2:this.options.anchor==="top-right"?t.x-=n/2:this.options.anchor==="bottom-left"?t.x+=n/2:this.options.anchor==="bottom-right"&&(t.x-=n/2),this.context.map.unproject(t)}render(){return this.visible?(this.mark||this._create(),this.mark?.addTo(this.context.map),ue.DEBUG&&this.debug()):(this.mark?.remove(),this.mark=null),this.connectLine(),this}}const Te="Ais",fe=300,$t="mapbox-gl-ship-source",Mt="mapbox-gl-ship-icon-layer",gs="mapbox-gl-ship-icon-direction-layer",wt="mapbox-gl-ship-real-layer",vs="mapbox-gl-ship-real-outline-layer",Il=.2,Cl=.5;var yt=(i=>(i.ONLINE="Online",i.DELAY="Delay",i.OFFLINE="Offline",i))(yt||{}),de=(i=>(i.ONLINE="#03CC02",i.DELAY="#FFFD6C",i.OFFLINE="#999999",i))(de||{});const ys={id:gs,source:$t,filter:["==",["get","meta"],"directionLine"],type:"line",layout:{},paint:{"line-color":["coalesce",["get","line-color"],"#000"],"line-width":1}},xs={id:Mt,source:$t,filter:["==","$type","Point"],type:"symbol",layout:{"icon-allow-overlap":!0,"icon-image":["get","icon"],"icon-rotate":["get","direction"],"icon-size":["interpolate",["linear"],["zoom"],0,["coalesce",["get","minIconSize"],.2],19,["coalesce",["get","maxIconSize"],.5]]}},Es={id:wt,source:$t,type:"fill",filter:["!=",["get","meta"],"directionLine"],layout:{},paint:{"fill-color":["case",["==",["get","updateStatus"],"Online"],"#03CC02",["==",["get","updateStatus"],"Delay"],"#FFFD6C",["==",["get","updateStatus"],"Offline"],"#999999","#999999"]}},_s={id:vs,source:$t,type:"line",filter:["!=",["get","meta"],"directionLine"],layout:{},paint:{"line-color":["case",["boolean",["feature-state","hover"],!1],"#f00",["boolean",["feature-state","focus"],!1],"#f00","#000"],"line-width":2}},bs=[{layer:ys,zIndex:fe},{layer:xs,zIndex:fe},{layer:Es,zIndex:fe},{layer:_s,zIndex:fe}],Ls=[{name:`${Te}-$color`,svg:`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<svg width="33px" height="49px" viewBox="0 0 33 49" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
3
|
<title>delay_nospeed</title>
|
|
4
4
|
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<path d="M16.5,3.13354433 L31.6080922,48 L1.39190779,48 L16.5,3.13354433 Z" id="三角形"></path>
|
|
7
7
|
</g>
|
|
8
8
|
</g>
|
|
9
|
-
</svg>`},{name:`${
|
|
9
|
+
</svg>`},{name:`${Te}-$color-active`,svg:`<?xml version="1.0" encoding="UTF-8"?>
|
|
10
10
|
<svg width="33px" height="49px" viewBox="0 0 33 49" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
11
11
|
<title>delay_nospeed_select</title>
|
|
12
12
|
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
@@ -14,63 +14,6 @@
|
|
|
14
14
|
<path d="M16.5,3.13354433 L31.6080922,48 L1.39190779,48 L16.5,3.13354433 Z" id="三角形"></path>
|
|
15
15
|
</g>
|
|
16
16
|
</g>
|
|
17
|
-
</svg>`},{name:`${j}-$color-straight`,svg:`<?xml version="1.0" encoding="UTF-8"?>
|
|
18
|
-
<svg width="33px" height="87px" viewBox="0 0 33 87" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
19
|
-
<title>delay_straight</title>
|
|
20
|
-
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
21
|
-
<g id="delay_straight" transform="translate(0, 1)" stroke="#000000" stroke-width="2">
|
|
22
|
-
<path d="M16.5,40.1335443 L31.6080922,85 L1.39190779,85 L16.5,40.1335443 Z" id="三角形" fill="$color"></path>
|
|
23
|
-
<line x1="16.5" y1="0.5" x2="16.5" y2="41.5" id="直线" stroke-linecap="square"></line>
|
|
24
|
-
</g>
|
|
25
|
-
</g>
|
|
26
|
-
</svg>`},{name:`${j}-$color-straight-active`,svg:`<?xml version="1.0" encoding="UTF-8"?>
|
|
27
|
-
<svg width="33px" height="87px" viewBox="0 0 33 87" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
28
|
-
<title>delay_straight_select</title>
|
|
29
|
-
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
30
|
-
<g id="delay_straight_select" transform="translate(0, 1)" stroke="#FF0000" stroke-width="2">
|
|
31
|
-
<path d="M16.5,40.1335443 L31.6080922,85 L1.39190779,85 L16.5,40.1335443 Z" id="三角形" fill="$color"></path>
|
|
32
|
-
<line x1="16.5" y1="0.5" x2="16.5" y2="41.5" id="直线" stroke-linecap="square"></line>
|
|
33
|
-
</g>
|
|
34
|
-
</g>
|
|
35
|
-
</svg>`},{name:`${j}-$color-left`,svg:`<?xml version="1.0" encoding="UTF-8"?>
|
|
36
|
-
<svg width="40px" height="87px" viewBox="0 0 40 87" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
37
|
-
<title>delay_left</title>
|
|
38
|
-
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
39
|
-
<g id="delay_left" transform="translate(20.5, 44) scale(-1, 1) translate(-20.5, -44)translate(1, 1)" stroke="#000000" stroke-width="2">
|
|
40
|
-
<path d="M16.5,40.1335443 L31.6080922,85 L1.39190779,85 L16.5,40.1335443 Z" id="三角形" fill="$color"></path>
|
|
41
|
-
<line x1="16.5" y1="0.5" x2="16.5" y2="41.5" id="直线" stroke-linecap="square"></line>
|
|
42
|
-
<line x1="16.5" y1="0.5" x2="38.5" y2="0.5" id="直线-2" stroke-linecap="square"></line>
|
|
43
|
-
</g>
|
|
44
|
-
</g>
|
|
45
|
-
</svg>`},{name:`${j}-$color-left-active`,svg:`<?xml version="1.0" encoding="UTF-8"?>
|
|
46
|
-
<svg width="41px" height="87px" viewBox="0 0 41 87" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
47
|
-
<title>delay_left_select</title>
|
|
48
|
-
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
49
|
-
<g id="delay_left_select" transform="translate(20.75, 43.75) scale(-1, 1) translate(-20.75, -43.75)translate(1, 0.5)" stroke="#FF0000" stroke-width="2">
|
|
50
|
-
<path d="M16.5,40.6335443 L31.6080922,85.5 L1.39190779,85.5 L16.5,40.6335443 Z" id="三角形" fill="$color"></path>
|
|
51
|
-
<line x1="16.5" y1="1" x2="16.5" y2="42" id="直线" stroke-linecap="square"></line>
|
|
52
|
-
<line x1="17" y1="0.5" x2="39" y2="0.5" id="直线-2" stroke-linecap="square"></line>
|
|
53
|
-
</g>
|
|
54
|
-
</g>
|
|
55
|
-
</svg>`},{name:`${j}-$color-right`,svg:`<?xml version="1.0" encoding="UTF-8"?>
|
|
56
|
-
<svg width="40px" height="87px" viewBox="0 0 40 87" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
57
|
-
<title>delay_right</title>
|
|
58
|
-
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
59
|
-
<g id="delay_right" transform="translate(0, 1)" stroke="#000000" stroke-width="2">
|
|
60
|
-
<path d="M16.5,40.1335443 L31.6080922,85 L1.39190779,85 L16.5,40.1335443 Z" id="三角形" fill="$color"></path>
|
|
61
|
-
<line x1="16.5" y1="0.5" x2="16.5" y2="41.5" id="直线" stroke-linecap="square"></line>
|
|
62
|
-
<line x1="16.5" y1="0.5" x2="38.5" y2="0.5" id="直线-2" stroke-linecap="square"></line>
|
|
63
|
-
</g>
|
|
64
|
-
</g>
|
|
65
|
-
</svg>`},{name:`${j}-$color-right-active`,svg:`<?xml version="1.0" encoding="UTF-8"?>
|
|
66
|
-
<svg width="40px" height="87px" viewBox="0 0 40 87" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
67
|
-
<title>delay_right_select</title>
|
|
68
|
-
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
69
|
-
<g id="delay_right_select" transform="translate(0, 0.5)" stroke="#FF0000" stroke-width="2">
|
|
70
|
-
<path d="M16.5,40.6335443 L31.6080922,85.5 L1.39190779,85.5 L16.5,40.6335443 Z" id="三角形" fill="$color"></path>
|
|
71
|
-
<line x1="16.5" y1="1" x2="16.5" y2="42" id="直线" stroke-linecap="square"></line>
|
|
72
|
-
<line x1="17" y1="0.5" x2="39" y2="0.5" id="直线-2" stroke-linecap="square"></line>
|
|
73
|
-
</g>
|
|
74
|
-
</g>
|
|
75
|
-
</svg>`}],qs=Object.freeze(Object.defineProperty({__proto__:null,LAYER_LIST:wi,MAX_ICON_SIZE:Hs,MIN_ICON_SIZE:Us,NAME:j,SHIP_COLOR:Tt,SHIP_ICON:_i,SHIP_ICON_LAYER:yi,SHIP_ICON_LAYER_NAME:Z,SHIP_REAL_LAYER:vi,SHIP_REAL_LAYER_NAME:G,SHIP_REAL_OUTLINE_LAYER:xi,SHIP_REAL_OUTLINE_LAYER_NAME:gi,SHIP_SOURCE_NAME:gt,UPDATE_STATUS:H},Symbol.toStringTag,{value:"Module"}));var me=(e=>(e.LAND="land",e.SATELLITE="satellite",e.CUSTOM="custom",e))(me||{});const bi={version:8,name:"Basic",glyphs:"https://sdkinteligenceberth.zhonganhse.com:21333/app/font/{fontstack}/{range}.pbf",sources:{base:{tiles:["http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t1.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t2.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t3.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t4.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t5.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t6.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t7.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990"],type:"raster",tileSize:256,minzoom:0,maxzoom:21},label:{tiles:["http://t0.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t1.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t2.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t3.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t4.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t5.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t6.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t7.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990"],type:"raster",tileSize:256,minzoom:0,maxzoom:21}},layers:[{id:"background",type:"background",paint:{"background-color":"rgba(212,234,238,1)"}},{id:"base_layer",source:"base",type:"raster"},{id:"label_layer",source:"label",type:"raster"},{id:"base-end",type:"background",paint:{"background-color":"transparent"}},{id:"point-end",type:"background",paint:{"background-color":"transparent"}}]},Si={version:8,name:"Basic",glyphs:"https://sdkinteligenceberth.zhonganhse.com:21333/app/font/{fontstack}/{range}.pbf",sources:{base:{tiles:["http://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t1.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t2.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t3.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t4.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t5.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t6.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t7.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990"],type:"raster",tileSize:256,minzoom:0,maxzoom:21},label:{tiles:["http://t0.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t1.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t2.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t3.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t4.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t5.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t6.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990","http://t7.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=15999a02266fd7d952a7a771eca68990"],type:"raster",tileSize:256,minzoom:0,maxzoom:21}},layers:[{id:"background",type:"background",paint:{"background-color":"rgba(212,234,238,1)"}},{id:"base_layer",source:"base",type:"raster"},{id:"label_layer",source:"label",type:"raster"},{id:"base-end",type:"background",paint:{"background-color":"transparent"}},{id:"point-end",type:"background",paint:{"background-color":"transparent"}}]};class yt extends ne{map;options;cache=new Set;timer=null;originalRemove;icon;static LAND=me.LAND;static SATELLITE=me.SATELLITE;constructor(t){super(),this.options=t,t.type===yt.LAND?this.options.style=bi:t.type===yt.SATELLITE&&(this.options.style=Si),A.Map.prototype._authenticate=()=>{},this.map=new A.Map(this.options),this.icon=new ut(this.map),this.originalRemove=this.map.remove.bind(this.map),this.map.remove=()=>{let i=!1;this.map.fire("beforeRemove",{cancel:()=>{i=!0},next:()=>{i=!1}}),i||this.originalRemove()},this.map.once("load",()=>{_i.forEach(async i=>{await Promise.all([this.icon.addSvg({name:i.name.replace("$color",H.ONLINE),svg:i.svg.replace("$color",Tt.ONLINE)}),this.icon.addSvg({name:i.name.replace("$color",H.DELAY),svg:i.svg.replace("$color",Tt.DELAY)}),this.icon.addSvg({name:i.name.replace("$color",H.OFFLINE),svg:i.svg.replace("$color",Tt.OFFLINE)})])}),this.emit("loaded",this.map)})}change(t){t===yt.LAND?this.getMap().setStyle(bi):t===yt.SATELLITE&&this.getMap().setStyle(Si)}getMap(){return this.map}zoomIn(){this.getMap().isZooming()||this.getMap().zoomIn()}zoomOut(){this.getMap().isZooming()||this.getMap().zoomOut()}mapLoaded(){const t=i=>{this.getMap()._loaded?(this.timer&&(clearInterval(this.timer),this.timer=null),this.cache.size>0&&(this.cache.forEach(n=>{n(this.getMap())}),this.cache.clear()),i(this.getMap())):this.timer?this.cache.add(i):this.timer=setInterval(()=>{t(i)},16)};return new Promise((i,n)=>{try{t(i)}catch(r){this.timer&&(clearInterval(this.timer),this.timer=null),n(new Error(`mapLoaded错误:${r}`))}})}}var Ut=(e=>(e.ON="On",e.OFF="Off",e))(Ut||{});class nt extends mt{status=Ut.OFF;static ON=Ut.ON;static OFF=Ut.OFF;constructor(t){super(t)}switch(){return this.status===nt.ON?(this.status=nt.OFF,this.off()):this.status===nt.OFF&&(this.status=nt.ON,this.on()),this.status}}class Zs extends nt{ships=[];hoverId=null;_click=()=>{};_move=()=>{};_leave=()=>{};_zoomEnd=()=>{};constructor(t,i){super(t),i&&(this.ships=i)}on(){this.context.map.on("click",Z,this._click),this.context.map.on("mousemove",Z,this._move),this.context.map.on("mouseleave",Z,this._leave),this.context.map.on("click",G,this._click),this.context.map.on("mousemove",G,this._move),this.context.map.on("mouseleave",G,this._leave),this.context.map.on("zoomend",this._zoomEnd)}off(){this.context.map.off("click",Z,this._click),this.context.map.off("mousemove",Z,this._move),this.context.map.off("mouseleave",Z,this._leave),this.context.map.off("click",G,this._click),this.context.map.off("mousemove",G,this._move),this.context.map.off("mouseleave",G,this._leave),this.context.map.off("zoomend",this._zoomEnd)}onAdd(){this._click=this.onClick.bind(this),this._move=this.onMove.bind(this),this._leave=this.onLeave.bind(this),this._zoomEnd=this.onZoomEnd.bind(this),this.on()}onRemove(){this.off()}add(t){const i=this.findShip(t.id);i?t.update(i.options):this.ships.push(t)}remove(t){const i=this.ships.findIndex(n=>n.id===t);i!==-1&&this.ships.splice(i,1)}removeAll(){this.ships=[]}onZoomEnd(){this.ships.forEach(t=>{t.render()})}onMove(t){if(t.features?.length){if(this.context.map.getCanvasContainer().style.cursor="pointer",this.hoverId===t.features[0].id)return;this.hoverId&&this.unhover(),this.hoverId=t.features[0].id,this.hover()}}onLeave(){this.unhover(),this.hoverId=null,this.context.map.getCanvasContainer().style.cursor=""}onClick(t){if(t.features?.length){const i=t.features[0].id;if(i){const n=this.findShip(i);this.context.events.emit("click",n),this.context.map.fire("ship-click",n)}}}hover(){if(!this.hoverId)return;const t=this.findShip(this.hoverId);t?.setState({hover:!0}),t?.render(),this.context.events.emit("hover",t),this.context.map.fire("ship-hover",t)}unhover(){if(!this.hoverId)return;const t=this.findShip(this.hoverId);t?.setState({hover:!1}),t?.render(),this.context.events.emit("unhover",t),this.context.map.fire("ship-unhover",t)}findShip(t){return this.ships.find(i=>String(i.id)===String(t))}}class Gs extends mt{options;ships=[];event;pluginRegistry=new Map;collision;focusId=null;constructor(t,i){super(t),this.options=i,this.collision=new Vt(this.context.map),this.event=new Zs(t),this.registerPlugins(i.plugins)}onAdd(){}onRemove(){}get tooltips(){return this.ships.flatMap(t=>t.tooltip??[])}registerPlugins(t=[]){t.forEach(i=>{i.NAME?this.pluginRegistry.set(i.NAME,i):console.warn("Ship Plugin missing static NAME property:",i)})}createCollisions(){return this.tooltips.map(t=>({...t.getSimpleBbox(),id:t.id}))}collisionTooltip(){this.collision.load(this.createCollisions()).forEach(t=>{const i=this.tooltips.find(n=>n.id===t.id);i&&t.visible&&i.setAnchor(t.dir)})}add(t){const i=this.pluginRegistry.get(t.type);if(!i){console.warn(`No plugin registered for ship type: "${t.type}"`);return}const n=new i(this.context.map,t);return this.ships.push(n),this.event.add(n),n}load(t){this.removeAll();const i=[];if(t.forEach(n=>{const r=this.add(n);r&&i.push(r)}),this.render(),this.collisionTooltip(),this.focusId){const n=this.get(this.focusId);n&&n.focus()}return i}remove(t){this.event.remove(t);const i=this.ships.findIndex(n=>n.id===t);i!==-1&&(this.ships[i].remove(),this.ships.splice(i,1))}removeAll(){this.collision.clear(),this.ships.forEach(t=>{t.remove()}),this.ships=[],this.event.removeAll()}render(){this.ships.forEach(t=>{t.render()})}get(t){return this.ships.find(i=>i.id===t)}select(t){const i=this.get(t);i?(i.select(),this.focusId=i.id):console.warn(`The ship-${String(t)} was not found.`)}unselect(t){const i=this.get(t);i?(i.unselect(),this.focusId=null):console.warn(`The ship-${String(t)} was not found.`)}}class Ht extends mt{options;SOURCE="mapbox-gl-ship-source";static NAME="Base";tooltip=null;visible=!0;constructor(t,i){super(t),this.options=i}destroy(){throw new Error("Method not implemented.")}get isFocus(){const t=this.getState();return t?!!t.focus:!1}setState(t){this.context.map.setFeatureState({source:this.SOURCE,id:this.id},t)}getState(){return this.context.map.getFeatureState({source:this.SOURCE,id:this.id})}isSelf(t){if(t.features&&t.features.length>0){const i=t.features[0];return String(i.id)===this.id}else return!1}getName(){return Ht.NAME}}var qt={exports:{}},Js=qt.exports,Mi;function Ks(){return Mi||(Mi=1,(function(e,t){(function(i,n){e.exports=n()})(Js,(function(){var i=1e3,n=6e4,r=36e5,s="millisecond",o="second",a="minute",h="hour",c="day",l="week",u="month",m="quarter",y="year",w="date",T="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,O=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,B={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(x){var p=["th","st","nd","rd"],f=x%100;return"["+x+(p[(f-20)%10]||p[f]||p[0])+"]"}},S=function(x,p,f){var g=String(x);return!g||g.length>=p?x:""+Array(p+1-g.length).join(f)+x},Y={s:S,z:function(x){var p=-x.utcOffset(),f=Math.abs(p),g=Math.floor(f/60),d=f%60;return(p<=0?"+":"-")+S(g,2,"0")+":"+S(d,2,"0")},m:function x(p,f){if(p.date()<f.date())return-x(f,p);var g=12*(f.year()-p.year())+(f.month()-p.month()),d=p.clone().add(g,u),_=f-d<0,b=p.clone().add(g+(_?-1:1),u);return+(-(g+(f-d)/(_?d-b:b-d))||0)},a:function(x){return x<0?Math.ceil(x)||0:Math.floor(x)},p:function(x){return{M:u,y,w:l,d:c,D:w,h,m:a,s:o,ms:s,Q:m}[x]||String(x||"").toLowerCase().replace(/s$/,"")},u:function(x){return x===void 0}},k="en",ot={};ot[k]=B;var Pi="$isDayjsObject",_e=function(x){return x instanceof Gt||!(!x||!x[Pi])},Zt=function x(p,f,g){var d;if(!p)return k;if(typeof p=="string"){var _=p.toLowerCase();ot[_]&&(d=_),f&&(ot[_]=f,d=_);var b=p.split("-");if(!d&&b.length>1)return x(b[0])}else{var L=p.name;ot[L]=p,d=L}return!g&&d&&(k=d),d||!g&&k},N=function(x,p){if(_e(x))return x.clone();var f=typeof p=="object"?p:{};return f.date=x,f.args=arguments,new Gt(f)},E=Y;E.l=Zt,E.i=_e,E.w=function(x,p){return N(x,{locale:p.$L,utc:p.$u,x:p.$x,$offset:p.$offset})};var Gt=(function(){function x(f){this.$L=Zt(f.locale,null,!0),this.parse(f),this.$x=this.$x||f.x||{},this[Pi]=!0}var p=x.prototype;return p.parse=function(f){this.$d=(function(g){var d=g.date,_=g.utc;if(d===null)return new Date(NaN);if(E.u(d))return new Date;if(d instanceof Date)return new Date(d);if(typeof d=="string"&&!/Z$/i.test(d)){var b=d.match(v);if(b){var L=b[2]-1||0,I=(b[7]||"0").substring(0,3);return _?new Date(Date.UTC(b[1],L,b[3]||1,b[4]||0,b[5]||0,b[6]||0,I)):new Date(b[1],L,b[3]||1,b[4]||0,b[5]||0,b[6]||0,I)}}return new Date(d)})(f),this.init()},p.init=function(){var f=this.$d;this.$y=f.getFullYear(),this.$M=f.getMonth(),this.$D=f.getDate(),this.$W=f.getDay(),this.$H=f.getHours(),this.$m=f.getMinutes(),this.$s=f.getSeconds(),this.$ms=f.getMilliseconds()},p.$utils=function(){return E},p.isValid=function(){return this.$d.toString()!==T},p.isSame=function(f,g){var d=N(f);return this.startOf(g)<=d&&d<=this.endOf(g)},p.isAfter=function(f,g){return N(f)<this.startOf(g)},p.isBefore=function(f,g){return this.endOf(g)<N(f)},p.$g=function(f,g,d){return E.u(f)?this[g]:this.set(d,f)},p.unix=function(){return Math.floor(this.valueOf()/1e3)},p.valueOf=function(){return this.$d.getTime()},p.startOf=function(f,g){var d=this,_=!!E.u(g)||g,b=E.p(f),L=function(ct,F){var K=E.w(d.$u?Date.UTC(d.$y,F,ct):new Date(d.$y,F,ct),d);return _?K:K.endOf(c)},I=function(ct,F){return E.w(d.toDate()[ct].apply(d.toDate("s"),(_?[0,0,0,0]:[23,59,59,999]).slice(F)),d)},$=this.$W,P=this.$M,z=this.$D,vt="set"+(this.$u?"UTC":"");switch(b){case y:return _?L(1,0):L(31,11);case u:return _?L(1,P):L(0,P+1);case l:var at=this.$locale().weekStart||0,Ot=($<at?$+7:$)-at;return L(_?z-Ot:z+(6-Ot),P);case c:case w:return I(vt+"Hours",0);case h:return I(vt+"Minutes",1);case a:return I(vt+"Seconds",2);case o:return I(vt+"Milliseconds",3);default:return this.clone()}},p.endOf=function(f){return this.startOf(f,!1)},p.$set=function(f,g){var d,_=E.p(f),b="set"+(this.$u?"UTC":""),L=(d={},d[c]=b+"Date",d[w]=b+"Date",d[u]=b+"Month",d[y]=b+"FullYear",d[h]=b+"Hours",d[a]=b+"Minutes",d[o]=b+"Seconds",d[s]=b+"Milliseconds",d)[_],I=_===c?this.$D+(g-this.$W):g;if(_===u||_===y){var $=this.clone().set(w,1);$.$d[L](I),$.init(),this.$d=$.set(w,Math.min(this.$D,$.daysInMonth())).$d}else L&&this.$d[L](I);return this.init(),this},p.set=function(f,g){return this.clone().$set(f,g)},p.get=function(f){return this[E.p(f)]()},p.add=function(f,g){var d,_=this;f=Number(f);var b=E.p(g),L=function(P){var z=N(_);return E.w(z.date(z.date()+Math.round(P*f)),_)};if(b===u)return this.set(u,this.$M+f);if(b===y)return this.set(y,this.$y+f);if(b===c)return L(1);if(b===l)return L(7);var I=(d={},d[a]=n,d[h]=r,d[o]=i,d)[b]||1,$=this.$d.getTime()+f*I;return E.w($,this)},p.subtract=function(f,g){return this.add(-1*f,g)},p.format=function(f){var g=this,d=this.$locale();if(!this.isValid())return d.invalidDate||T;var _=f||"YYYY-MM-DDTHH:mm:ssZ",b=E.z(this),L=this.$H,I=this.$m,$=this.$M,P=d.weekdays,z=d.months,vt=d.meridiem,at=function(F,K,kt,Jt){return F&&(F[K]||F(g,_))||kt[K].slice(0,Jt)},Ot=function(F){return E.s(L%12||12,F,"0")},ct=vt||function(F,K,kt){var Jt=F<12?"AM":"PM";return kt?Jt.toLowerCase():Jt};return _.replace(O,(function(F,K){return K||(function(kt){switch(kt){case"YY":return String(g.$y).slice(-2);case"YYYY":return E.s(g.$y,4,"0");case"M":return $+1;case"MM":return E.s($+1,2,"0");case"MMM":return at(d.monthsShort,$,z,3);case"MMMM":return at(z,$);case"D":return g.$D;case"DD":return E.s(g.$D,2,"0");case"d":return String(g.$W);case"dd":return at(d.weekdaysMin,g.$W,P,2);case"ddd":return at(d.weekdaysShort,g.$W,P,3);case"dddd":return P[g.$W];case"H":return String(L);case"HH":return E.s(L,2,"0");case"h":return Ot(1);case"hh":return Ot(2);case"a":return ct(L,I,!0);case"A":return ct(L,I,!1);case"m":return String(I);case"mm":return E.s(I,2,"0");case"s":return String(g.$s);case"ss":return E.s(g.$s,2,"0");case"SSS":return E.s(g.$ms,3,"0");case"Z":return b}return null})(F)||b.replace(":","")}))},p.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},p.diff=function(f,g,d){var _,b=this,L=E.p(g),I=N(f),$=(I.utcOffset()-this.utcOffset())*n,P=this-I,z=function(){return E.m(b,I)};switch(L){case y:_=z()/12;break;case u:_=z();break;case m:_=z()/3;break;case l:_=(P-$)/6048e5;break;case c:_=(P-$)/864e5;break;case h:_=P/r;break;case a:_=P/n;break;case o:_=P/i;break;default:_=P}return d?_:E.a(_)},p.daysInMonth=function(){return this.endOf(u).$D},p.$locale=function(){return ot[this.$L]},p.locale=function(f,g){if(!f)return this.$L;var d=this.clone(),_=Zt(f,g,!0);return _&&(d.$L=_),d},p.clone=function(){return E.w(this.$d,this)},p.toDate=function(){return new Date(this.valueOf())},p.toJSON=function(){return this.isValid()?this.toISOString():null},p.toISOString=function(){return this.$d.toISOString()},p.toString=function(){return this.$d.toUTCString()},x})(),Ri=Gt.prototype;return N.prototype=Ri,[["$ms",s],["$s",o],["$m",a],["$H",h],["$W",c],["$M",u],["$y",y],["$D",w]].forEach((function(x){Ri[x[1]]=function(p){return this.$g(p,x[0],x[1])}})),N.extend=function(x,p){return x.$i||(x(p,Gt,N),x.$i=!0),N},N.locale=Zt,N.isDayjs=_e,N.unix=function(x){return N(1e3*x)},N.en=ot[k],N.Ls=ot,N.p={},N}))})(qt)),qt.exports}var Ws=Ks();const Ei=Ne(Ws);class ge extends Ht{SOURCE=gt;static NAME=j;constructor(t,i){super(t,i),this.options.tooltip&&this.setTooltip(new It(this.context.map,{id:this.id,position:this.position(),className:"mapbox-gl-ship-name-tooltip",offsetX:5,offsetY:25,element:this.label(),anchor:"bottom-right",visible:!1}))}onAdd(){this.context.register.addSource(gt,{type:"geojson",dynamic:!0,data:{type:"FeatureCollection",features:[]}}),wi.forEach(t=>{this.context.register.addLayer(t)})}onRemove(){throw new Error("Method not implemented.")}get id(){return this.options.id}get updateStatus(){const t=Date.now()-Ei(Number(this.options.time)).valueOf();return t<=18e5?H.ONLINE:t>18e5&&t<=72e5?H.DELAY:(t>72e5,H.OFFLINE)}getIconName(){const t=this.getState();let i=null;return this.options.icon?i=this.options.icon:(i=`${ge.NAME}-${this.updateStatus}-${this.orientation}`,(t?.hover||t?.focus)&&(i=`${i}-active`)),i}position(){const t=this.context.map.project(this.options.position),i=t.x+this.offset().x,n=t.y+this.offset().y;return this.context.map.unproject(new A.Point(i,n))}get direction(){return this.options.hdg&&this.options.hdg>=0&&this.options.hdg<360?this.options.statusId===0||this.options.statusId===7||this.options.statusId===8?this.options.speed<=.5?this.options.hdg||this.options.cog||0:Math.abs(this.options.hdg-this.options.cog)>30?this.options.cog:this.options.cog||this.options.hdg||0:this.options.hdg||this.options.cog||0:this.options.cog||0}get orientation(){let t=0;return this.options.rot>180&&(t=this.options.rot-180),this.options.rot<-180&&(t=this.options.rot+180),this.options.speed===0||!this.options.speed||t===-128?"static":t<0&&t>-180?"left":t>0&&t<=180?"right":t===0?"straight":"static"}getShape(){if(this.options.width&&this.options.height){const{x:t,y:i}=this.context.map.project(this.position()),n=Et(this.context.map,this.options.width)/2,r=Et(this.context.map,this.options.height)/2;return{leftDirection:new A.Point(t-n,i-r*2),rightDirection:new A.Point(t+n,i-r*2),turn:new A.Point(t,i-r*2),head:new A.Point(t,i-r),rightBow:new A.Point(t+n,i-r*.5),rightQuarter:new A.Point(t+n,i+r*.85),rightStern:new A.Point(t+n*.7,i+r),leftStern:new A.Point(t-n*.7,i+r),leftQuarter:new A.Point(t-n,i+r*.85),leftBow:new A.Point(t-n,i-r*.5)}}else return null}getFeature(){const t=this.options.realZoom??16;return this.context.map.getZoom()>=t?this.real():this.icon()}remove(){this.removeTooltip(),this.isFocus&&(this.unfocus(),this.context.focus.remove(String(this.id)));const t={type:"Feature",geometry:null,id:this.id,properties:{}};this.context.register.setGeoJSONData(this.SOURCE,t),this.context.map.triggerRepaint()}setTooltip(t){this.tooltip=t}removeTooltip(){this.tooltip?.remove(),this.tooltip=null}update(t){this.options=t,this.render()}select(){this.context.map.flyTo({center:this.position(),zoom:16}),this.context.map.once("moveend",()=>{this.focus()})}unselect(){this.unfocus()}focus(){this.setState({focus:!0}),this.render()}unfocus(){this.setState({focus:!1}),this.render()}icon(){return Dt(this.position().toArray(),{...this.options,icon:this.getIconName(),direction:this.direction,updateStatus:this.updateStatus},{id:this.id})}real(){const t=this.getShape();if(t){const{head:i,rightBow:n,rightQuarter:r,rightStern:s,leftStern:o,leftQuarter:a,leftBow:h,leftDirection:c,rightDirection:l,turn:u}=t;let m=[i,n,r,s,o,a,h,i];this.orientation==="left"?m=[c,u,...m,u,c]:this.orientation==="right"?m=[l,u,...m,u,l]:this.orientation==="straight"&&(m=[u,...m,u]);const y=Pt(m.map(T=>this.context.map.unproject(T).toArray()));let w=ln(y,{properties:{...this.options,updateStatus:this.updateStatus,outLine:!0}});return w=hn(w,this.direction,{pivot:this.position().toArray()}),w.id=this.id,w}else return this.icon()}render(){if(!this.context.map.getBounds()?.contains(this.position())){this.tooltip?.hide();return}if(this.tooltip?.render(),this.context.register.setGeoJSONData(this.SOURCE,this.getFeature()),this.isFocus){const i=this.context.iconManage.getImage(this.getIconName());this.context.focus.set(this.getFeature(),{size:i?.width,armLength:10,padding:10})}else this.context.focus.remove(String(this.id))}label(){const t=`${String(this.id)}-ship-name-box`;let i=document.getElementById(t);if(i)return i;i=document.createElement("div"),i.id=t,i.classList.add("ship-name-box");const n=document.createElement("div");return n.innerText=this.options.name,n.classList.add("ship-name"),i.appendChild(n),i}offset(){const t=new A.Point(0,0);if(this.options.top&&this.options.bottom&&this.options.left&&this.options.right){const i=Et(this.context.map,Math.abs(this.options.top-this.options.bottom)/2),n=Et(this.context.map,Math.abs(this.options.left-this.options.right)/2);t.x=this.options.right>this.options.left?n:-n,t.y=this.options.top>this.options.bottom?i:-i}return t}}var J=(e=>(e[e.START_END=0]="START_END",e[e.SHARP_TURN=1]="SHARP_TURN",e[e.STOP_GO=2]="STOP_GO",e[e.TIME_ANCHOR=3]="TIME_ANCHOR",e[e.NORMAL=9]="NORMAL",e))(J||{});const Vs="Track",rt="mapbox-gl-track-source",Li="mapbox-gl-track-arrow-layer",st="mapbox-gl-track-icon-layer",Ci="mapbox-gl-track-line-layer",ye="track-start",Ai='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="74" height="74" viewBox="0 0 74 74" fill="none"><circle cx="37" cy="37" r="32" stroke="rgba(172, 51, 193, 1)" stroke-width="10" fill="#AC33C1" ></circle><path d="M36.4 50.84C40.84 51.08 45.24 51.08 45.24 51.08C50.52 51.08 55.12 50.8 55.12 50.8L54.48 54.36C50.16 54.64 45.24 54.64 45.24 54.64C40.32 54.64 35.96 54.36 35.96 54.36C31.16 54.08 28.16 52.72 28.16 52.72C25.16 51.36 23.4 48.36 23.4 48.36C22.64 51.96 20.84 55.72 20.84 55.72L18 53.52C19.16 51.04 19.76 48.94 19.76 48.94C20.36 46.84 20.62 44.26 20.62 44.26C20.88 41.68 20.88 37.64 20.88 37.64L24.2 37.64C24.2 40.92 24.04 43.12 24.04 43.12C25.16 46.52 27.28 48.24 27.28 48.24L27.28 35.44L18.68 35.44L18.68 32.08L26.32 32.08L26.32 27.12L20.08 27.12L20.08 23.72L26.32 23.72L26.32 19L29.84 19L29.84 23.72L35.64 23.72L35.64 27.12L29.84 27.12L29.84 32.08L36.76 32.08L36.76 35.44L30.72 35.44L30.72 40.96L36.36 40.96L36.36 44.32L30.72 44.32L30.72 49.96C33 50.64 36.4 50.84 36.4 50.84ZM48.96 30.88L48.96 24.64L37.8 24.64L37.8 21.12L52.44 21.12L52.44 34.4L41.84 34.4L41.84 41.52C41.84 42.72 42.02 43.24 42.02 43.24C42.2 43.76 42.68 43.98 42.68 43.98C43.16 44.2 44.28 44.32 44.28 44.32C44.88 44.36 46 44.36 46 44.36C47.12 44.36 47.72 44.32 47.72 44.32C48.88 44.2 49.44 43.98 49.44 43.98C50 43.76 50.22 43.28 50.22 43.28C50.44 42.8 50.52 41.8 50.52 41.8C50.68 39.72 50.68 38.44 50.68 38.44L54.08 39.24C53.96 41.12 53.8 43 53.8 43C53.6 45.04 53.16 45.98 53.16 45.98C52.72 46.92 51.72 47.3 51.72 47.3C50.72 47.68 48.64 47.8 48.64 47.8C46.8 47.88 45.88 47.88 45.88 47.88C44.96 47.88 43.12 47.8 43.12 47.8C41.2 47.68 40.22 47.2 40.22 47.2C39.24 46.72 38.8 45.64 38.8 45.64C38.36 44.56 38.36 42.44 38.36 42.44L38.36 30.88L48.96 30.88Z" fill="#FFFFFF" ></path></svg>',ve="track-end",Ii='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="74" height="74" viewBox="0 0 74 74" fill="none"><circle cx="37" cy="37" r="32" stroke="rgba(172, 51, 193, 1)" stroke-width="10" fill="#AC33C1" ></circle><path d="M45.6 33.64C49.28 36.12 55.28 38.24 55.28 38.24L54 41.8C50.48 40.32 47.78 38.88 47.78 38.88C45.08 37.44 42.92 35.8 42.92 35.8C38.76 38.84 32.04 41.6 32.04 41.6L30.4 38.4C36.28 36.2 40.24 33.56 40.24 33.56C38.2 31.6 36.12 28.8 36.12 28.8C34.56 30.92 32.68 32.88 32.68 32.88L30.72 30.36C32.88 28.08 35.08 24.52 35.08 24.52C37.28 20.96 38.4 18 38.4 18L41.64 18.92C41.2 19.96 40.24 22.04 40.24 22.04L52.04 22.04L52.04 25.48C50.56 27.96 49.02 29.96 49.02 29.96C47.48 31.96 45.6 33.64 45.6 33.64ZM20.76 33.44C19.96 33.48 19 33.76 19 33.76L18.2 30.24C18.72 30.04 18.98 29.82 18.98 29.82C19.24 29.6 19.56 29.2 19.56 29.2C20.44 28 22.06 24.68 22.06 24.68C23.68 21.36 24.92 18.2 24.92 18.2L28.04 19.4C26.8 22.28 25.24 25.4 25.24 25.4C23.68 28.52 22.6 30.04 22.6 30.04C25.92 29.56 26.76 29.44 26.76 29.44C28.16 26.68 29.28 24.16 29.28 24.16L32.16 25.52C30.52 28.92 28.16 33.22 28.16 33.22C25.8 37.52 24.4 39.48 24.4 39.48L27.36 38.76L29.76 38.16L29.84 41.68C29.28 41.72 26.86 42.2 26.86 42.2C24.44 42.68 22.52 43.08 22.52 43.08C21.96 43.2 20.84 43.52 20.84 43.52L19.92 43.76L19.08 40.12C19.96 39.76 20.34 39.48 20.34 39.48C20.72 39.2 21.2 38.64 21.2 38.64C22.84 36.6 24.92 32.84 24.92 32.84C22.24 33.28 20.76 33.44 20.76 33.44ZM38.08 25.92C40.2 29.2 42.88 31.52 42.88 31.52C45.56 29.16 48.12 25.4 48.12 25.4L38.4 25.4L38.08 25.92ZM37.6 39.4L40.8 40.4L49.4 43.08L48.12 46.52C45.76 45.68 42.22 44.5 42.22 44.5C38.68 43.32 36.64 42.76 36.64 42.76L37.6 39.4ZM18 49.08C18.68 48.96 21.08 48.4 21.08 48.4C23.48 47.84 25.2 47.44 25.2 47.44C30.76 46.2 31.08 46.12 31.08 46.12L31.28 49.6C30.12 49.8 22.24 51.6 22.24 51.6C18.8 52.44 18.48 52.48 18.48 52.48L18 49.08ZM34.4 46.48C37.24 47.24 42.46 48.82 42.46 48.82C47.68 50.4 51.12 51.52 51.12 51.52L49.92 55.04C46.44 53.8 41.38 52.2 41.38 52.2C36.32 50.6 33.44 49.84 33.44 49.84L34.4 46.48Z" fill="#FFFFFF" ></path></svg>',xe="track-arrow",Ti='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="74" height="74" viewBox="0 0 74 74" fill="none"><circle cx="37" cy="37" r="32" stroke="rgba(172, 51, 193, 1)" stroke-width="10" fill="#FFFFFF" ></circle></svg>',we="track-normal",Oi='<svg t="1769503360247" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="24046" width="64" height="64"><path d="M509.093 894.223l-447.093-761.539 452.861 219.23099999 447.139-222.13799999z" p-id="24047" fill="#d81e06"></path></svg>',ki={id:Li,source:rt,type:"symbol",layout:{"symbol-placement":"line","symbol-spacing":250,"icon-image":xe,"icon-size":.3,"icon-rotate":-90,"icon-allow-overlap":!0},paint:{}},Ni={id:st,source:rt,type:"symbol",filter:["==","$type","Point"],layout:{"icon-image":["get","icon"],"icon-size":["get","iconSize"],"icon-allow-overlap":!1,"symbol-sort-key":["get","type"]}},$i={id:Ci,source:rt,type:"line",filter:["all",["==","$type","LineString"]],paint:{"line-color":"#f00","line-width":3},layout:{}},Di=[$i,ki,Ni],Qs=Object.freeze(Object.defineProperty({__proto__:null,ARROW_ICON:Oi,ARROW_ICON_NAME:xe,END_ICON:Ii,END_ICON_NAME:ve,LAYER_LIST:Di,NAME:Vs,NORMAL_ICON:Ti,NORMAL_ICON_NAME:we,START_ICON:Ai,START_ICON_NAME:ye,TRACK_ARROW_LAYER:ki,TRACK_ARROW_LAYER_NAME:Li,TRACK_ICON_LAYER:Ni,TRACK_ICON_LAYER_NAME:st,TRACK_LINE_LAYER:$i,TRACK_LINE_LAYER_NAME:Ci,TRACK_SOURCE_NAME:rt},Symbol.toStringTag,{value:"Module"}));class to extends nt{hoverId=null;hoverPointId=null;track;_move=()=>{};_leave=()=>{};_moveEnd=()=>{};constructor(t,i){super(t),this.track=i}off(){this.context.map.off("mousemove",st,this._move),this.context.map.off("mouseleave",st,this._leave),this.context.map.off("moveend",this._moveEnd)}on(){this.context.map.on("mousemove",st,this._move),this.context.map.on("mouseleave",st,this._leave),this.context.map.on("moveend",this._moveEnd)}onAdd(){this._move=this.onMove.bind(this),this._leave=this.onLeave.bind(this),this._moveEnd=this.onMoveEnd.bind(this),this.on()}onRemove(){this.off()}onMoveEnd(){this.track.render()}onMove(t){if(t.features?.length){if(this.context.map.getCanvasContainer().style.cursor="pointer",this.hoverId===(t.features[0].id??t.features[0].properties.id))return;this.hoverId&&this.unhover(),this.hoverId=t.features[0].id??t.features[0].properties.id,this.hoverPointId=t.features[0].properties.pId,this.hover()}}onLeave(){this.unhover(),this.hoverId=null,this.hoverPointId=null,this.context.map.getCanvasContainer().style.cursor=""}hover(){if(!this.hoverId)return;const i=this.track.trackData.get(this.hoverId)?.find(r=>r.pId===this.hoverPointId),n="track-hover";this.context.events.emit(n,i),this.context.map.fire(n,i)}unhover(){if(!this.hoverId)return;const i=this.track.trackData.get(this.hoverId)?.find(r=>r.pId===this.hoverPointId),n="track-unhover";this.context.events.emit(n,i),this.context.map.fire(n,i)}}class eo extends mt{options;trackData=new Map;tooltips=[];collision;event;constructor(t,i){super(t),this.options=i,this.collision=new Vt(t),this.event=new to(t,this)}onAdd(){this.context.register.addSource(rt,{type:"geojson",dynamic:!0,data:{type:"FeatureCollection",features:[]}}),Di.forEach(t=>{this.context.register.addLayer(t)}),this.context.iconManage.loadSvg([{name:ye,svg:Ai},{name:ve,svg:Ii},{name:xe,svg:Oi},{name:we,svg:Ti}])}onRemove(){this.event.off()}load(t){const i=t[0].id,n=t.filter(r=>r.id===i).sort((r,s)=>r.time.getTime()-s.time.getTime());this.trackData.set(i,this.markItem(n))}remove(){this.removeAllTooltip(),this.event.off(),this.context.register.setGeoJSONData(rt,this.getFeature())}markItem(t){if(t.length===0)return[];const i=t.map(r=>({...r,visible:!0,type:J.NORMAL}));i[0].type=J.START_END,i[i.length-1].type=J.START_END;let n=i[0].time.getTime();for(let r=1;r<i.length-1;r++){const s=i[r-1],o=i[r],a=i[r+1];let h=s.cog;h??=Mt(s.position.toArray(),o.position.toArray());let c=o.cog;c??=Mt(o.position.toArray(),a.position.toArray());const l=Math.abs(c-h);(l>180?360-l:l)>25&&(o.type=Math.min(o.type,J.SHARP_TURN));const m=h<.5,y=c<.5;m!==y&&(o.type=Math.min(o.type,J.STOP_GO)),o.type===J.NORMAL?o.time.getTime()-n>18e5&&(o.type=J.TIME_ANCHOR,n=o.time.getTime()):n=o.time.getTime()}return i}simplifyTrackBySlope(t,i=2){if(t.length<=2)return t;const n=[t[0]];let r=t[0];for(let s=1;s<t.length-1;s++){const o=t[s],a=t[s+1],h=Mt(r.position.toArray(),o.position.toArray()),c=Mt(o.position.toArray(),a.position.toArray());let l=Math.abs(h-c);l>180&&(l=360-l),l>i&&(n.push(o),r=o)}return n.push(t[t.length-1]),n}simplifyTrackByZoom(t,i){let n=0;return i<8?n=10:i<10?n=5:i<13?n=2:i<16?n=1:n=0,n===0||t.length<10?t:this.simplifyTrackBySlope(t,n)}getFeature(){const t=[];for(const i of this.trackData.keys()){const n=this.trackData.get(i);if(n){const s=[...this.simplifyTrackByZoom(n,this.context.map.getZoom())].sort((l,u)=>l.time.getTime()-u.time.getTime()),o=s.length,a=s.map(l=>l.position.toArray()),h=s[o-1],c={id:i,startTime:s[0].time.getTime(),endTime:h.time.getTime(),count:n.length};s.forEach((l,u)=>{let m=we,y=.2;u===0?(m=ye,y=.4):u===o-1&&(m=ve,y=.4),t.push(Dt(l.position.toArray(),{...l,icon:m,iconSize:y,isStartEnd:u===0||u===o-1,time:new Date(l.time).getTime()},{id:l.pId}))}),t.push(Pt(a,c,{id:i}))}}return t}collisionTooltip(){this.collision.load(this.createCollisions()).forEach(t=>{const i=this.tooltips.find(n=>n.id===t.id);i&&(t.visible?i.setAnchor(t.dir):i.hide())})}createCollisions(){return this.tooltips.map(t=>({...t.getSimpleBbox(),id:t.id}))}createTooltip(){const{width:t,height:i}=this.context.map.getCanvas(),n=[[0,0],[t,i]],r=this.context.map.queryRenderedFeatures(n,{layers:[st]});if(r.length===0)return;const s=(o,a)=>{let h=document.getElementById(o);if(h)return h;h=document.createElement("div"),h.id=`${o}-track-name-box`,h.classList.add("track-name-box");const c=document.createElement("div");return c.innerText=a,c.classList.add("track-name"),h.appendChild(c),h};this.tooltips=r.map(o=>new It(this.context.map,{id:o.properties.pId,position:new A.LngLat(o.geometry.coordinates[0],o.geometry.coordinates[1]),className:"mapbox-gl-track-name-tooltip",offsetX:5,offsetY:25,element:s(o.properties.pId,Ei(Number(o.properties.time)).format("YYYY-MM-DD HH:mm:ss")),anchor:"bottom-right",visible:!1})),this.collisionTooltip()}removeAllTooltip(){this.tooltips.forEach(t=>{t.remove()}),this.tooltips=[],this.collision.clear()}render(){this.removeAllTooltip(),this.createTooltip(),this.context.register.setGeoJSONData(rt,this.getFeature())}}M.AisShip=ge,M.BaseShip=Ht,M.CMap=yt,M.Cache=be,M.Collision=Vt,M.CollisionItem=Ee,M.Context=mi,M.IconManager=ut,M.Module=mt,M.Ship=Gs,M.ShipVars=qs,M.Tooltip=It,M.Track=eo,M.TrackVars=Qs,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}));
|
|
17
|
+
</svg>`}],Tl=Object.freeze(Object.defineProperty({__proto__:null,LAYER_LIST:bs,MAX_ICON_SIZE:Cl,MIN_ICON_SIZE:Il,NAME:Te,SHIP_COLOR:de,SHIP_ICON:Ls,SHIP_ICON_DIRECTION_LAYER:ys,SHIP_ICON_DIRECTION_LAYER_NAME:gs,SHIP_ICON_LAYER:xs,SHIP_ICON_LAYER_NAME:Mt,SHIP_REAL_LAYER:Es,SHIP_REAL_LAYER_NAME:wt,SHIP_REAL_OUTLINE_LAYER:_s,SHIP_REAL_OUTLINE_LAYER_NAME:vs,SHIP_SOURCE_NAME:$t,UPDATE_STATUS:yt,Z_INDEX:fe},Symbol.toStringTag,{value:"Module"}));var Gt=(i=>(i.LAND="land",i.SATELLITE="satellite",i))(Gt||{});const Pl="dedbd86f02e50097b36eb7cfc2e0bf5f",Ol={[Gt.LAND]:"vec_w",[Gt.SATELLITE]:"img_w"};function Ms(i=Gt.LAND,t=!0,e,n){const s=t?"https":"http",o=e??Pl,r=Ol[i],a=Array.from({length:8},(c,u)=>`${s}://t${String(u)}.tianditu.gov.cn/DataServer?T=${r}&x={x}&y={y}&l={z}&tk=${o}`),h=Array.from({length:8},(c,u)=>`${s}://t${String(u)}.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${o}`);return{version:8,name:"Basic",glyphs:n??"https://sdkinteligenceberth.zhonganhse.com:21333/app/font/{fontstack}/{range}.pbf",sources:{base:{tiles:a,type:"raster",tileSize:256,minzoom:0,maxzoom:21},label:{tiles:h,type:"raster",tileSize:256,minzoom:0,maxzoom:21}},layers:[{id:"background",type:"background",paint:{"background-color":"rgba(212,234,238,1)"}},{id:"base_layer",source:"base",type:"raster"},{id:"label_layer",source:"label",type:"raster"},{id:"base-end",type:"background",paint:{"background-color":"transparent"}},{id:"point-end",type:"background",paint:{"background-color":"transparent"}}]}}const Dl=new Set(["base","label"]),Nl=new Set(["background","base_layer","label_layer","base-end","point-end"]);class Rl extends Ae{map;options;cache=new Set;timer=null;originalRemove;icon;static LAND=Gt.LAND;static SATELLITE=Gt.SATELLITE;constructor(t){super(),this.options=t,fl(this.options.style)&&(this.options.style=Ms(t.type,t.http2,t.TDTToken)),q.Map.prototype._authenticate=()=>{},this.map=new q.Map(this.options),this.icon=new zt(this.map),this.originalRemove=this.map.remove.bind(this.map),this.map.remove=()=>{let e=!1;this.map.fire("beforeRemove",{cancel:()=>{e=!0},next:()=>{e=!1}}),e||this.originalRemove()},this.map.once("load",()=>{Ls.forEach(e=>{this.icon.loadSvg([{name:e.name.replace("$color",yt.ONLINE),svg:e.svg.replace("$color",de.ONLINE)},{name:e.name.replace("$color",yt.DELAY),svg:e.svg.replace("$color",de.DELAY)},{name:e.name.replace("$color",yt.OFFLINE),svg:e.svg.replace("$color",de.OFFLINE)}])}),this.emit("loaded",this.map)})}change(t){const e=this.getMap(),n=e.getStyle(),s=Object.entries(n.sources).filter(([h])=>!Dl.has(h)).map(([h,c])=>{if(c.type==="geojson"){const u=e.getSource(h);return{id:h,spec:{...c,data:u._data}}}return{id:h,spec:c}}),o=n.layers.filter(h=>!Nl.has(h.id)),r=()=>{for(const{id:h,spec:c}of s)e.addSource(h,c);for(const h of o)e.addLayer(h)},a=()=>{e.isStyleLoaded()?r():e.once("styledata",a)};e.setStyle(Ms(t,this.options.http2,this.options.TDTToken)),e.once("styledata",a)}getMap(){return this.map}zoomIn(){this.getMap().isZooming()||this.getMap().zoomIn()}zoomOut(){this.getMap().isZooming()||this.getMap().zoomOut()}mapLoaded(){const t=e=>{this.getMap()._loaded?(this.timer&&(clearInterval(this.timer),this.timer=null),this.cache.size>0&&(this.cache.forEach(n=>{n(this.getMap())}),this.cache.clear()),e(this.getMap())):this.timer?this.cache.add(e):this.timer=setInterval(()=>{t(e)},16)};return new Promise((e,n)=>{try{t(e)}catch(s){this.timer&&(clearInterval(this.timer),this.timer=null),n(new Error(`mapLoaded错误:${s}`))}})}}var xt=(i=>(i.ON="On",i.OFF="Off",i))(xt||{});class ut extends Nt{status=xt.OFF;static ON=xt.ON;static OFF=xt.OFF;constructor(t){super(t)}switch(){return this.status===ut.ON?(this.status=ut.OFF,this.disabled()):this.status===ut.OFF&&(this.status=ut.ON,this.enabled()),this.status}changeStatus(){this.status===ut.ON?this.status=xt.OFF:this.status===xt.OFF&&(this.status=xt.ON)}message(t,e){return{originEvent:t,instance:e}}}const et="mapbox-gl-plot-source",li={type:"geojson",data:{type:"FeatureCollection",features:[]},buffer:256,tolerance:.2,lineMetrics:!0};var Ft=(i=>(i.CREATE="crosshair",i.CLICK="pointer",i.MOVE="move",i.EMPTY="",i))(Ft||{}),X=(i=>(i.CREATE="create",i.BEFORE_UPDATE="update.before",i.UPDATE="update.execute",i.DONE_UPDATE="update.done",i.MID_BEFORE_UPDATE="mid.update.before",i.MID_UPDATE="mid.update.execute",i.MID_DONE_UPDATE="mid.update.done",i.HOVER="hover",i.UN_HOVER="unhover",i.CLICK="click",i.DBL_CLICK="dblclick",i))(X||{}),ui=(i=>(i.Line="Line",i.LINE_TITLE="lineTitle",i))(ui||{});class fi extends ut{point;constructor(t,e){super(t),this.point=e}}class ws extends fi{onClick=t=>{this.point.update({...this.point.options,position:t.lngLat}),this.point.emit(X.CREATE,this.message(t,this.point)),this.point.stop(),this.disabled(),this.point.edit()};onMousemove=()=>{this.context.map.getCanvasContainer().style.cursor="crosshair"};constructor(t,e){super(t,e)}onAdd(){}onRemove(){this.disabled()}enabled(){this.context.map.on("click",this.onClick),this.context.map.on("mousemove",this.onMousemove),this.changeStatus()}disabled(){this.context.map.getCanvasContainer().style.cursor="",this.context.map.off("click",this.onClick),this.context.map.off("mousemove",this.onMousemove),this.changeStatus()}}class As extends fi{onMousedown=t=>{t.preventDefault(),this.context.map.getCanvasContainer().style.cursor="move",this.context.map.on("mousemove",this.onMousemove),this.context.map.once("mouseup",this.onMouseup),this.point.emit(X.BEFORE_UPDATE,this.message(t,this.point))};onMousemove=t=>{this.context.map.getCanvasContainer().style.cursor="move",this.point.move(t.lngLat),this.point.emit(X.UPDATE,this.message(t,this.point))};onMouseup=t=>{this.context.map.getCanvasContainer().style.cursor="",this.context.map.off("mousemove",this.onMousemove),this.point.render(),this.point.emit(X.DONE_UPDATE,this.message(t,this.point))};constructor(t,e){super(t,e)}onAdd(){}onRemove(){this.disabled()}enabled(){this.context.eventManager.on(this.point.id,this.point.LAYER,"mousedown",this.onMousedown),this.changeStatus()}disabled(){this.context.eventManager.off(this.point.id,"mousedown",this.onMousedown),this.changeStatus()}}class Ss extends fi{onMouseEnter=t=>{this.context.map.getCanvasContainer().style.cursor="pointer";const e=this.message(t,this.point);this.point.setState({hover:!0}),this.point.emit(X.HOVER,e)};onMouseLeave=t=>{this.context.map.getCanvasContainer().style.cursor="";const e=this.message(t,this.point);this.point.setState({hover:!1}),this.point.emit(X.UN_HOVER,e)};onClick=t=>{const e=this.message(t,this.point);this.point.emit(X.CLICK,e)};onDblclick=t=>{t.preventDefault();const e=this.message(t,this.point);this.point.emit(X.DBL_CLICK,e)};constructor(t,e){super(t,e)}onAdd(){}onRemove(){this.disabled()}enabled(){this.context.eventManager.on(this.point.id,this.point.LAYER,"dblclick",this.onDblclick),this.context.eventManager.on(this.point.id,this.point.LAYER,"mouseenter",this.onMouseEnter),this.context.eventManager.on(this.point.id,this.point.LAYER,"mouseleave",this.onMouseLeave),this.context.eventManager.on(this.point.id,this.point.LAYER,"click",this.onClick),this.changeStatus()}disabled(){this.context.eventManager.off(this.point.id,"dblclick",this.onDblclick),this.context.eventManager.off(this.point.id,"mouseenter",this.onMouseEnter),this.context.eventManager.off(this.point.id,"mouseleave",this.onMouseLeave),this.context.eventManager.off(this.point.id,"click",this.onClick),this.changeStatus()}}class di extends Nt{options;SOURCE=et;LAYER="";constructor(t,e){super(t),this.options=e}get isEdit(){return!!this.getState()?.edit}get isFocus(){const t=this.getState();return t?!!t.focus:!1}get isCreate(){return!!this.getState()?.create}get visibility(){return this.options.visibility}show(){this.options.visibility="visible",this.render()}hide(){this.options.visibility="none",this.render()}setState(t){this.context.map.setFeatureState({source:this.SOURCE,id:this.id},t)}getState(){return this.context.map.getFeatureState({source:this.SOURCE,id:this.id})}}var Kt=(i=>(i.POINT="Point",i.INDEX_POINT="IndexPoint",i.ICON_POINT="IconPoint",i.LINE="LineString",i.Fill="Polygon",i.CIRCLE="Circle",i))(Kt||{});const Is=Kt.INDEX_POINT,pi="mapbox-gl-plot-point-index-layer",mi="#333",gi=["coalesce",["get","text-size"],12],Cs={id:pi,type:"symbol",filter:["all",["==","$type","Point"],["==","meta","circle"],["==","subMeta","indexPoint"],["==","visibility","visible"]],source:et,paint:{"text-color":["coalesce",["get","text-color"],mi]},layout:{"text-field":["get","index"],"text-font":["Open Sans Regular","Arial Unicode MS Regular"],"text-anchor":"center","text-allow-overlap":!0,"text-size":["interpolate",["linear"],["zoom"],5,["*",gi,.5],14,["*",gi,1],22,["*",gi,2.5]]}},Ts=[{layer:Cs,zIndex:11}],$l=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_TEXT_COLOR:mi,LAYER_LIST:Ts,NAME:Is,POINT_INDEX_LAYER:Cs,POINT_INDEX_LAYER_NAME:pi},Symbol.toStringTag,{value:"Module"})),Ps=Kt.POINT,Pe=10,Os=Pe+1,vi="mapbox-gl-plot-point-circle-layer",Ds="mapbox-gl-plot-point-text-layer",yi=12,xi=5,Ei=10,Ns="#fff",_i=2,Rs="#f00",bi=["coalesce",["get","circle-radius"],Ei],Li=["coalesce",["get","circle-stroke-width"],_i],Mi=["coalesce",["get","text-size"],yi],Jt=["case",["boolean",["feature-state","hover"],!1],1.2,1],$s={id:vi,type:"circle",filter:["all",["==","$type","Point"],["==","meta","circle"],["==","visibility","visible"]],source:et,paint:{"circle-radius":["interpolate",["linear"],["zoom"],5,["*",bi,Jt,.5],14,["*",bi,Jt,1],22,["*",bi,Jt,2.5]],"circle-stroke-width":["interpolate",["linear"],["zoom"],5,["*",Li,Jt,.5],14,["*",Li,Jt,1],22,["*",Li,Jt,2.5]],"circle-color":["coalesce",["get","circle-color"],Ns],"circle-stroke-color":["coalesce",["get","circle-stroke-color"],Rs]}},Fs={id:Ds,type:"symbol",filter:["all",["==","$type","Point"],["==","isName",!0],["==","visibility","visible"]],source:et,layout:{"text-field":["get","text"],"text-font":["Open Sans Regular","Arial Unicode MS Regular"],"text-offset":["coalesce",["get","_calcTextOffset"],["get","text-offset"],[0,0]],"text-anchor":"top","text-rotate":["coalesce",["get","icon-rotate"],0],"text-allow-overlap":!0,"text-size":["interpolate",["linear"],["zoom"],5,["*",Mi,.5],14,["*",Mi,1],22,["*",Mi,2.5]]},paint:{"text-color":["coalesce",["get","text-color"],mi],"text-halo-color":"#ffffff","text-halo-width":1}},Ys=[{layer:$s,zIndex:Pe},{layer:Fs,zIndex:Os}],Fl=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_CIRCLE_COLOR:Ns,DEFAULT_CIRCLE_RADIUS:Ei,DEFAULT_CIRCLE_STROKE_COLOR:Rs,DEFAULT_CIRCLE_STROKE_WIDTH:_i,DEFAULT_TEXT_SIZE:yi,GAP_PX:xi,LAYER_LIST:Ys,NAME:Ps,POINT_CIRCLE_LAYER:$s,POINT_CIRCLE_LAYER_NAME:vi,POINT_TEXT_LAYER:Fs,POINT_TEXT_LAYER_NAME:Ds,TEXT_Z_INDEX:Os,Z_INDEX:Pe},Symbol.toStringTag,{value:"Module"}));class pe extends di{static NAME=Ps;LAYER=vi;residentEvent;updateEvent;createEvent;constructor(t,e){super(t,e),this.residentEvent=new Ss(t,this),this.updateEvent=new As(t,this),this.createEvent=new ws(t,this),this.residentEvent.enabled()}onAdd(){this.context.register.addSource(et,li),Ys.forEach(t=>{this.context.register.addLayer(t)})}onRemove(){this.remove()}get id(){return this.options.id}edit(){this.setState({edit:!0}),this.residentEvent.disabled(),this.updateEvent.enabled()}unedit(){this.setState({edit:!1}),this.residentEvent.enabled(),this.updateEvent.disabled()}focus(){throw new Error("Method not implemented.")}unfocus(){throw new Error("Method not implemented.")}select(){throw new Error("Method not implemented.")}unselect(){throw new Error("Method not implemented.")}get center(){return this.options.position?this.options.position:null}get geometry(){throw new Error("Method not implemented.")}getFeature(){if(!this.options.position)return{type:"Feature",geometry:null,id:this.id,properties:{}};const t=(Ei+_i)*2,s=this.calculateTextOffset({iconHeight:t,iconScale:1,iconAnchor:"center",textSize:yi,gap:xi});return lt(this.options.position.toArray(),{...this.options.style,...this.options.properties,id:this.options.id,visibility:this.options.visibility,isName:this.options.isName,text:this.options.name,_calcTextOffset:s,meta:"circle"},{id:this.options.id})}start(){this.center===null&&this.createEvent.enabled()}stop(){this.createEvent.disabled()}move(t){this.options.position=t,this.render()}update(t){this.options=t,this.render()}remove(){this.residentEvent.disabled(),this.updateEvent.disabled(),this.createEvent.disabled(),this.removeAllListeners();const t={type:"Feature",geometry:null,id:this.id,properties:{}};this.context.register.setGeoJSONData(et,t)}render(){this.context.register.setGeoJSONData(et,this.getFeature())}calculateTextOffset(t){const{iconHeight:e,iconScale:n=1,iconAnchor:s="bottom",textSize:o=12,gap:r=xi}=t,a=e*n;let h=0;return s.includes("bottom")?h=r:s.includes("top")?h=a+r:h=a/2+r,[0,h/o]}}const Bs=Kt.ICON_POINT,wi="mapbox-gl-plot-point-icon-layer",ks=12,Ai="bottom",Xs=5,Si=1,Ii=["coalesce",["get","icon-size"],Si],Us=["coalesce",["get","icon-rotate"],0],zs={id:wi,type:"symbol",filter:["all",["==","$type","Point"],["==","meta","icon"],["==","visibility","visible"]],source:et,layout:{"icon-allow-overlap":!0,"icon-anchor":["coalesce",["get","icon-anchor"],Ai],"icon-image":["get","icon"],"icon-rotate":Us,"icon-size":["interpolate",["linear"],["zoom"],5,["*",Ii,0],14,["*",Ii,1],22,["*",Ii,2.5]]},paint:{}},js=[{layer:zs,zIndex:Pe}],Yl=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_ICON_ANCHOR:Ai,DEFAULT_ICON_SIZE:Si,DEFAULT_TEXT_SIZE:ks,GAP_PX:Xs,ICON_ROTATE:Us,LAYER_LIST:js,NAME:Bs,POINT_ICON_LAYER:zs,POINT_ICON_LAYER_NAME:wi},Symbol.toStringTag,{value:"Module"}));class Ci extends pe{static NAME=Bs;LAYER=wi;constructor(t,e){super(t,e),this.residentEvent=new Ss(t,this),this.updateEvent=new As(t,this),this.createEvent=new ws(t,this),this.residentEvent.enabled()}onAdd(){super.onAdd(),js.forEach(t=>{this.context.register.addLayer(t)})}getFeature(){if(!this.options.position)return{type:"Feature",geometry:null,id:this.id,properties:{}};const t=this.context.iconManage.getImage(this.options.icon)?.height??0,e=this.options.style?.["icon-size"]??Si,n=this.options.style?.["icon-anchor"]??Ai,s=this.options.style?.["text-size"]??ks,o=this.calculateTextOffset({iconHeight:t,iconScale:e,iconAnchor:n,textSize:s,gap:Xs});return lt(this.options.position.toArray(),{...this.options.style,...this.options.properties,id:this.options.id,icon:this.options.icon,text:this.options.name,visibility:this.options.visibility,isName:this.options.isName,_calcTextOffset:o,meta:"icon"},{id:this.options.id})}}class Ti extends ut{line;constructor(t,e){super(t),this.line=e}}class Bl extends Ti{count=0;drawPoint=null;onClick=t=>{if(this.count>=1){const e=new Set([...this.line.points,...this.line.midPoints].map(s=>s.LAYER));if(this.context.map.queryRenderedFeatures(t.point,{layers:[...e]}).length>0){this.stop(t);return}}this.line.insertPoint(this.count,t.lngLat),this.count++};onMousemove=t=>{this.context.map.getCanvasContainer().style.cursor="crosshair",this.line.options.position&&(this.setDrawLngLat(t.lngLat),this.line.render())};stop=t=>{t.preventDefault(),this.line.stop(),this.context.map.getCanvasContainer().style.cursor="",this.setDrawLngLat(null),this.count=0,this.disabled(),this.line.createPoint(),this.line.edit(),this.line.emit(X.CREATE,this.message(t,this.line))};constructor(t,e){super(t,e)}onAdd(){}onRemove(){}setDrawLngLat(t){this.drawPoint=t}getDrawLngLat(){return this.drawPoint}enabled(){this.context.map.doubleClickZoom.disable(),this.context.map.on("click",this.onClick),this.context.map.on("mousemove",this.onMousemove),this.context.map.on("dblclick",this.stop),this.changeStatus()}disabled(){this.context.map.off("click",this.onClick),this.context.map.off("mousemove",this.onMousemove),this.context.map.off("dblclick",this.stop),setTimeout(()=>{this.context.map.doubleClickZoom.enable()},0),this.changeStatus()}}class kl extends Ti{dragStartLngLat=null;modifyMid=null;onVertexUpdate=t=>{const e=t.instance,{index:n}=e.options.properties??{};typeof n!="number"||!e.center||(this.line.updatePoint(n,e.center),this.line.emit(X.UPDATE,this.message(t.originEvent,this.line),e))};onMidBeforeUpdate=t=>{this.setModifyLngLat(t.instance),this.line.emit(X.MID_BEFORE_UPDATE,this.message(t.originEvent,this.line),t.instance)};onMidUpdate=t=>{const{index:e}=t.instance.options.properties??{},{position:n}=al(this.line.options);n&&typeof e=="number"&&t.instance.center&&(this.line.render(),this.line.emit(X.MID_UPDATE,this.message(t.originEvent,this.line),t.instance))};onMidDone=t=>{if(this.line.geometry?.coordinates){const e=this.line.geometry.coordinates;this.line.options.position=e.map(n=>new q.LngLat(n[0],n[1])),this.setModifyLngLat(null),this.line.update({...this.line.options}),this.line.edit(),this.line.emit(X.MID_DONE_UPDATE,this.message(t,this.line))}};onLineMousedown=t=>{const e=new Set([...this.line.points,...this.line.midPoints].map(s=>s.LAYER));this.context.map.queryRenderedFeatures(t.point,{layers:[...e]}).length>0||(t.preventDefault(),this.context.map.getCanvasContainer().style.cursor=Ft.MOVE,this.dragStartLngLat=t.lngLat,this.context.map.on("mousemove",this.onMousemove),this.context.map.once("mouseup",this.onMouseup),this.line.emit(X.BEFORE_UPDATE,this.message(t,this.line)))};onLineMouseenter=()=>{this.context.map.getCanvasContainer().style.cursor=Ft.CLICK,this.context.map.on("mousedown",this.line.LAYER,this.onLineMousedown)};onLineMouseLeave=()=>{this.context.map.getCanvasContainer().style.cursor=Ft.EMPTY,this.context.map.off("mousedown",this.line.LAYER,this.onLineMousedown)};onMousemove=t=>{this.context.map.getCanvasContainer().style.cursor=Ft.MOVE;const e=t.lngLat;this.line.move(e),this.dragStartLngLat=e,this.line.emit(X.UPDATE,this.message(t,this.line))};onMouseup=t=>{this.context.map.getCanvasContainer().style.cursor="",this.context.map.off("mousemove",this.onMousemove),this.context.map.off("mousedown",this.line.LAYER,this.onLineMousedown),this.dragStartLngLat=null,this.line.render(),this.line.emit(X.DONE_UPDATE,this.message(t,this.line))};constructor(t,e){super(t,e)}onAdd(){}onRemove(){this.disabled()}setModifyLngLat(t){this.modifyMid=t}getModifyLngLat(){return this.modifyMid}setDragLngLat(t){this.dragStartLngLat??=t}getDragLngLat(){return this.dragStartLngLat}enabled(){this.line.points.forEach(t=>{t.on(X.UPDATE,this.onVertexUpdate)}),this.line.midPoints.forEach(t=>{t.on(X.BEFORE_UPDATE,this.onMidBeforeUpdate),t.on(X.UPDATE,this.onMidUpdate),t.on(X.DONE_UPDATE,this.onMidDone)}),this.context.eventManager.on(this.line.id,this.line.LAYER,"mouseenter",this.onLineMouseenter),this.context.eventManager.on(this.line.id,this.line.LAYER,"mouseleave",this.onLineMouseLeave),this.changeStatus()}disabled(){this.line.points.forEach(t=>{t.off(X.UPDATE,this.onVertexUpdate)}),this.line.midPoints.forEach(t=>{t.off(X.BEFORE_UPDATE,this.onMidBeforeUpdate),t.off(X.UPDATE,this.onMidUpdate),t.off(X.DONE_UPDATE,this.onMidDone)}),this.context.eventManager.off(this.line.id,"mouseenter",this.onLineMouseenter),this.context.eventManager.off(this.line.id,"mouseleave",this.onLineMouseLeave),this.changeStatus()}}class Xl extends Ti{onLineMouseenter=t=>{this.context.map.getCanvasContainer().style.cursor="pointer",this.line.setState({hover:!0}),this.line.points.forEach(e=>{e.setState({hover:!0})}),this.line.emit(X.HOVER,this.message(t,this.line))};onLineMouseLeave=t=>{this.context.map.getCanvasContainer().style.cursor="",this.line.setState({hover:!1}),this.line.points.forEach(e=>{e.setState({hover:!1})}),this.line.emit(X.UN_HOVER,this.message(t,this.line))};onClick=t=>{this.line.emit(X.CLICK,this.message(t.originEvent,this.line))};onLineClick=t=>{const e=new Set([...this.line.points,...this.line.midPoints].map(s=>s.LAYER));this.context.map.queryRenderedFeatures(t.point,{layers:[...e]}).length>0||this.line.emit(X.CLICK,this.message(t,this.line))};constructor(t,e){super(t,e)}onAdd(){}onRemove(){this.disabled()}enabled(){this.line.points.forEach(t=>{t.on(X.CLICK,this.onClick)}),this.context.eventManager.on(this.line.id,this.line.LAYER,"mouseenter",this.onLineMouseenter),this.context.eventManager.on(this.line.id,this.line.LAYER,"mouseleave",this.onLineMouseLeave),this.context.eventManager.on(this.line.id,this.line.LAYER,"click",this.onLineClick),this.changeStatus()}disabled(){this.line.points.forEach(t=>{t.off(X.CLICK,this.onClick)}),this.context.eventManager.off(this.line.id,"mouseenter",this.onLineMouseenter),this.context.eventManager.off(this.line.id,"mouseleave",this.onLineMouseLeave),this.context.eventManager.off(this.line.id,"click",this.onLineClick),this.changeStatus()}}var me=(i=>(i.VERTEX="Vertex",i.MIDPOINT="MidPoint",i))(me||{});const Hs=Kt.LINE,Pi=5,qs=Pi+1,Oi="mapbox-gl-plot-line-layer",Zs="mapbox-gl-plot-dotted-line-layer",Vs="mapbox-gl-plot-line-text-layer",ge="#f00",Gs=3,Ks="#333",Js=16,Ws=["coalesce",["get","line-color"],ge],Wt=["coalesce",["get","line-width"],Gs],Ul=["coalesce",["get","line-dasharray"],[99999,99999]],Di=["coalesce",["get","text-size"],Js],zl={id:Zs,type:"line",filter:["all",["==","$type","LineString"],["==","visibility","visible"]],source:et,paint:{"line-dasharray":Ul,"line-color":Ws,"line-width":["case",["boolean",["feature-state","hover"],!1],["+",Wt,["%",Wt,1.2]],Wt]},layout:{"line-join":"round","line-cap":"round"}},Qs={id:Oi,type:"line",filter:["all",["==","$type","LineString"],["==","visibility","visible"],["!=","meta",ui.LINE_TITLE]],source:et,paint:{"line-color":Ws,"line-width":["case",["boolean",["feature-state","hover"],!1],["+",Wt,["%",Wt,1.2]],Wt]},layout:{"line-join":"round","line-cap":"round"}},to={id:Vs,type:"symbol",filter:["all",["==","$type","LineString"],["==","isName",!0],["==","visibility","visible"]],source:et,layout:{"icon-ignore-placement":!0,"text-ignore-placement":!1,"text-letter-spacing":.01,"symbol-placement":"line-center","text-field":["get","text"],"text-font":["Open Sans Regular","Arial Unicode MS Regular"],"text-allow-overlap":!0,"text-size":["interpolate",["linear"],["zoom"],5,["*",Di,.5],14,["*",Di,1],22,["*",Di,2.5]]},paint:{"text-color":["coalesce",["get","text-color"],Ks],"text-halo-color":"#ffffff","text-halo-width":1}},eo=[{layer:Qs,zIndex:Pi},{layer:to,zIndex:qs}],jl=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_LINE_COLOR:ge,DEFAULT_LINE_WIDTH:Gs,DEFAULT_TEXT_COLOR:Ks,DEFAULT_TEXT_SIZE:Js,DOTTED_LINE_LAYER:zl,DOTTED_LINE_LAYER_NAME:Zs,LAYER_LIST:eo,LINE_LAYER:Qs,LINE_LAYER_NAME:Oi,LINE_TEXT_LAYER:to,LINE_TEXT_LAYER_NAME:Vs,NAME:Hs,TEXT_Z_INDEX:qs,Z_INDEX:Pi},Symbol.toStringTag,{value:"Module"}));class Oe extends di{static NAME=Hs;LAYER=Oi;points=[];midPoints=[];titles=[];residentEvent;updateEvent;createEvent;constructor(t,e){super(t,e),this.residentEvent=new Xl(t,this),this.updateEvent=new kl(t,this),this.createEvent=new Bl(t,this),this.createPoint(),this.residentEvent.enabled()}get id(){return this.options.id}get center(){if(!Array.isArray(this.options.position)||this.options.position.length===0)return null;const t=this.getFeature(),e=Lr(t),n=ko(t,e/2).geometry.coordinates;return new q.LngLat(n[0],n[1])}get geometry(){return this.getFeature().geometry}onAdd(){this.context.register.addSource(et,li),eo.forEach(t=>{this.context.register.addLayer(t)})}onRemove(){this.remove()}getFeature(){if((!this.options.position||this.options.position.length<2)&&!this.createEvent.getDrawLngLat())return{type:"Feature",geometry:null,id:this.id,properties:{}};const t=this.points.map(n=>n.center?n.center.toArray():[]),e=this.updateEvent.getModifyLngLat();if(e){const{index:n}=e.options.properties??{};typeof n=="number"&&e.center&&t.splice(n+1,0,e.center.toArray())}return this.createEvent.getDrawLngLat()&&t.push(this.createEvent.getDrawLngLat().toArray()),Et(t,{...this.options.properties,...this.options.style,visibility:this.options.visibility,isName:this.options.isName,text:this.options.name,id:this.options.id},{id:this.id})}start(){this.center===null&&(this.createEvent.enabled(),this.updateEvent.disabled(),this.residentEvent.disabled(),this.setState({create:!0}))}stop(){this.createEvent.disabled(),this.residentEvent.enabled(),this.setState({create:!1})}show(){this.points.forEach(t=>{t.show()}),this.midPoints.forEach(t=>{t.show()}),super.show()}hide(){this.points.forEach(t=>{t.hide()}),this.midPoints.forEach(t=>{t.hide()}),super.hide()}edit(){this.setState({edit:!0}),this.points.forEach(t=>{t.edit()}),this.midPoints.forEach(t=>{t.edit(),t.show()}),this.residentEvent.disabled(),this.updateEvent.enabled(),this.render()}unedit(){this.setState({edit:!1}),this.points.forEach(t=>{t.unedit()}),this.midPoints.forEach(t=>{t.unedit(),t.hide()}),this.residentEvent.enabled(),this.updateEvent.disabled(),this.render()}focus(){this.setState({focus:!0}),this.render()}unfocus(){this.setState({focus:!1}),this.render()}select(){const t=be(this.getFeature());this.context.map.fitBounds(t,{padding:{left:60,right:60,top:60,bottom:60}}),this.context.map.once("moveend",()=>{this.focus()})}unselect(){this.unfocus()}move(t){const e=this.center??this.updateEvent.getDragLngLat();if(!e)return;const n=t.lng-e.lng,s=t.lat-e.lat;this.points.forEach((o,r)=>{if(o.center){const a=new q.LngLat(o.center.lng+n,o.center.lat+s);this.updatePoint(r,a,!1)}}),this.render()}update(t){this.options=t,this.removePoint(),this.createPoint(),this.render()}remove(){this.removePoint(),this.residentEvent.disabled(),this.createEvent.disabled(),this.updateEvent.disabled(),this.removeAllListeners(),this.options.position=[],this.render()}render(){this.points.map(t=>{t.render()}),this.isEdit&&this.midPoints.map(t=>{t.render()}),this.isFocus?this.context.focus.set(this.getFeature(),{armLength:40,padding:30}):this.context.focus.remove(this.id),this.context.register.setGeoJSONData(et,[this.getFeature()])}getMidPoint(t){const e=this.midPoints.at(t);return e&&Number(e.options.properties?.index)===t?e:null}getPoint(t){const e=this.points.at(t);return e&&Number(e.options.properties?.index)===t?e:null}createVertex(t,e,n){const s={"circle-radius":5,"circle-stroke-color":this.options.style?.["line-color"]??ge,...this.options.vertexStyle};return new pe(this.context.map,{id:t,isName:!1,visibility:"visible",position:n,style:s,properties:{id:`${this.id}-node-${String(e)}`,index:e,type:me.VERTEX}})}createMid(t,e,n){const s={"circle-radius":2,"circle-color":this.options.style?.["line-color"]??ge,"circle-stroke-color":this.options.style?.["line-color"]??ge,...this.options.midStyle};return new pe(this.context.map,{id:t,isName:!1,visibility:"visible",position:n,style:s,properties:{id:`${this.id}-mid-${String(e)}`,index:e,type:me.MIDPOINT}})}createTitles(){if(!Array.isArray(this.points)||this.points.length===0)return[];const t=this.points.length;return this.titles=this.points.flatMap((e,n)=>{if(n===t-1)return[];if(!e.center)return[];const s=this.points[n+1];if(!s.center)return[];const o=`line-title-${this.id}-${String(n)}`;return Et([e.center.toArray(),s.center.toArray()],{meta:ui.LINE_TITLE,visibility:this.options.visibility,isName:!0,text:this.options.name,"text-size":this.options.style?.["text-size"],originId:this.id,id:o},{id:o})}),this.titles}removeTitles(){return this.titles=this.titles.map(t=>({...t,geometry:null})),this.titles}createPoint(){this.removePoint(),(this.options.position??[]).forEach((e,n)=>{this.points.push(this.createVertex(`${this.id}-node-${String(n)}`,n,e))}),this.syncMidPoints()}insertPoint(t,e){this.options.position??=[],this.options.position.splice(t,0,e);const n=this.createVertex(`${this.id}-node-${String(t)}`,t,e);return this.points.splice(t,0,n),this.isEdit&&n.edit(),this.reindexPoints(),this.syncMidPoints(),this.render(),n}updatePoint(t,e,n=!0){const s=this.getPoint(t);s&&(this.options.position?.[t]&&(this.options.position[t]=e),s.move(e),this.updateAdjacentMidPoints(t),n&&this.render())}updateMidPoint(t,e){const n=this.getMidPoint(t);n&&n.move(e)}removePointAt(t){const e=this.points.at(t);e&&(e.remove(),this.points.splice(t,1),this._reindexPoints(),this._syncMidPoints())}clearAll(){this.points.forEach(t=>{t.remove()}),this.midPoints.forEach(t=>{t.remove()}),this.points=[],this.midPoints=[]}removePoint(){this.points.forEach(t=>{t.remove()}),this.points=[],this.midPoints.forEach(t=>{t.remove()}),this.midPoints=[]}syncMidPoints(){this.midPoints.forEach(t=>{t.remove()}),this.midPoints=[];for(let t=0;t<this.points.length-1;t++){const e=this.points[t].center,n=this.points[t+1].center;if(e&&n){const s=this.calcMidPosition(e,n),o=this.createMid(`${this.id}-mid-${String(t)}`,t,s);this.isEdit&&o.edit(),this.midPoints.push(o)}}}reindexPoints(){this.points.forEach((t,e)=>{const n=`${this.id}-node-${String(e)}`;t.options.properties&&(t.options.properties.index=e,t.options.properties.id=n),t.options.id=n})}updateAdjacentMidPoints(t){if(t>0&&this.points[t-1]){const e=this.points[t-1].center,n=this.points[t].center;e&&n&&this.updateMidPoint(t-1,this.calcMidPosition(e,n))}if(t<this.points.length-1&&this.points[t+1]){const e=this.points[t].center,n=this.points[t+1].center;e&&n&&this.updateMidPoint(t,this.calcMidPosition(e,n))}}calcMidPosition(t,e){const n=(t.lng+e.lng)/2,s=(t.lat+e.lat)/2;return new q.LngLat(n,s)}_reindexPoints(){this.points.forEach((t,e)=>{const n=`${this.id}-node-${String(e)}`;t.options.properties&&(t.options.properties.index=e,t.options.properties.id=n),t.options.id=n})}_syncMidPoints(){this.midPoints.forEach(t=>{t.remove()}),this.midPoints=[];for(let t=0;t<this.points.length-1;t++){const e=this.points[t].options.position,n=this.points[t+1].options.position,s=this.calcMidPosition(e,n);this.midPoints.push(this.createMid(`${this.id}-mid-${String(t)}`,t,s))}}}class Hl extends Oe{constructor(t,e){super(t,e)}onAdd(){super.onAdd(),this.context.iconManage.loadSvg([{name:"plot-arrow-start",svg:'<svg t="1772517328676" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="41296" width="32" height="32"><path d="M512 512m-512 0a512 512 0 1 0 1024 0 512 512 0 1 0-1024 0Z" fill="#39BF8F" p-id="41297"></path><path d="M803.84 558.08c-5.12 53.76-12.8 89.6-23.04 104.96-10.24 15.36-30.72 25.6-61.44 25.6h-117.76c-38.4 0-56.32-20.48-56.32-56.32v-217.6h181.76v-128h-192V240.64h238.08V460.8h-179.2v153.6c0 17.92 10.24 28.16 28.16 28.16h89.6c17.92 0 30.72-7.68 38.4-20.48 5.12-12.8 7.68-38.4 10.24-76.8l43.52 12.8z m-545.28-43.52l43.52 5.12c-2.56 38.4-5.12 74.24-10.24 107.52 20.48 38.4 43.52 64 69.12 84.48v-240.64H225.28v-43.52h122.88v-97.28H238.08v-43.52h110.08V197.12h48.64v89.6h107.52v43.52h-107.52v97.28H512v43.52h-102.4v94.72h94.72v43.52H409.6v125.44c40.96 10.24 122.88 17.92 245.76 17.92 74.24 0 128-2.56 163.84-2.56l-7.68 46.08H665.6c-156.16 0-253.44-10.24-291.84-28.16-33.28-15.36-64-43.52-89.6-84.48-10.24 43.52-23.04 87.04-40.96 125.44L204.8 775.68c33.28-76.8 51.2-163.84 53.76-261.12z" fill="#FFFFFF" p-id="41298"></path></svg>'},{name:"plot-arrow",svg:'<svg t="1772517045368" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="35873" width="32" height="32"><path d="M859.615 662.634c0 15.79300001-6.25500001 30.502-17.606 41.418-22.813 21.967-59.274 21.291-81.271-1.512l-250.406-259.796L263.652 703.5c-21.796 23.016-58.255 24.034-81.29 2.268-11.425-10.837-17.975-26.076-17.975-41.799 0-14.747 5.576-28.771 15.709-39.492L467.923 320.166c16.939-17.94 43.603-22.701 66.333-11.842 1.705 0.781 3.015 1.69300001 3.761 2.231a65.89 65.89 0 0 0 1.399 0.748c2.742 1.45 6.385 3.373 9.855 6.687l0.225 0.218c0.209 0.203 0.397 0.404 0.573 0.59a19.821 19.821 0 0 1 2.609 2.17500001L843.521 622.732c10.382 10.795 16.096 24.962 16.09600001 39.901z" p-id="35874" fill="#ff0000"></path></svg>'},{name:"plot-arrow-end",svg:'<svg t="1772517393676" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="42489" width="32" height="32"><path d="M512 512m-512 0a512 512 0 1 0 1024 0 512 512 0 1 0-1024 0Z" fill="#FF343E" p-id="42490"></path><path d="M393.216 277.9136a901.12 901.12 0 0 1-75.9808 155.8528c18.0224-2.2528 36.2496-4.9152 54.272-8.192l31.5392-67.7888 45.056 16.7936a1425.8176 1425.8176 0 0 1-108.544 196.608 634.88 634.88 0 0 0 80.2816-26.624v46.2848a689.3568 689.3568 0 0 1-139.4688 37.888L266.24 582.0416a89.4976 89.4976 0 0 0 22.9376-14.5408A568.7296 568.7296 0 0 0 348.16 472.2688l-78.848 12.0832-12.4928-46.6944a44.8512 44.8512 0 0 0 20.48-19.0464 1016.832 1016.832 0 0 0 66.7648-159.3344z m49.5616 421.0688a1099.776 1099.776 0 0 1-171.8272 46.08l-7.5776-54.272a956.8256 956.8256 0 0 0 179.4048-44.6464z m143.36-432.5376a437.4528 437.4528 0 0 1-14.1312 43.4176h149.504v40.96a466.1248 466.1248 0 0 1-78.2336 111.4112 681.5744 681.5744 0 0 0 122.88 64.1024L739.328 573.44a680.5504 680.5504 0 0 1-132.5056-77.0048 490.2912 490.2912 0 0 1-153.1904 84.1728l-25.6-45.2608a426.5984 426.5984 0 0 0 139.0592-71.0656 696.32 696.32 0 0 1-53.6576-53.248 518.7584 518.7584 0 0 1-40.96 40.96L440.5248 409.6a305.3568 305.3568 0 0 0 93.3888-150.528z m-97.6896 372.736a1465.7536 1465.7536 0 0 1 237.9776 81.92l-27.2384 43.008a1431.3472 1431.3472 0 0 0-240.2304-81.92zM554.1888 552.96a921.6 921.6 0 0 1 151.9616 57.1392l-25.3952 39.1168a904.8064 904.8064 0 0 0-153.8048-56.5248z m108.1344-192.7168h-113.664c-2.048 3.2768-5.12 7.9872-8.6016 14.5408a474.112 474.112 0 0 0 62.464 59.1872 447.0784 447.0784 0 0 0 59.8016-74.5472z" fill="#FFFFFF" p-id="42491"></path></svg>'}])}createVertex(t,e,n){return new Ci(this.context.map,{icon:e===0?"plot-arrow-start":this.getIconName(e),id:t,isName:!1,position:n,properties:{id:t,index:e,type:me.VERTEX},style:{...this.options.vertexStyle,"icon-anchor":"center","icon-rotate":this.getRotate(e)},visibility:this.options.visibility})}getIconName(t){if(!Array.isArray(this.options.position))return"";if(this.createEvent.status===xt.ON)return"plot-arrow";const e=this.options.position.length-1===t;return t===0?"plot-arrow-start":e?"plot-arrow-end":"plot-arrow"}getRotate(t){if(!Array.isArray(this.options.position))return 0;if(this.createEvent.status===xt.ON){if(t===0)return 0;const r=this.options.position[t-1],a=this.options.position[t];return _t(r.toArray(),a.toArray())}const e=this.options.position.length-1===t;if(t===0||e)return 0;const s=this.options.position[t-1],o=this.options.position[t];return _t(s.toArray(),o.toArray())}}class ql{constructor(t=[],e=(n,s)=>n<s?-1:n>s?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,s=e[t];for(;t>0;){const o=t-1>>1,r=e[o];if(n(s,r)>=0)break;e[t]=r,t=o}e[t]=s}_down(t){const{data:e,compare:n}=this,s=this.length>>1,o=e[t];for(;t<s;){let r=(t<<1)+1;const a=r+1;if(a<this.length&&n(e[a],e[r])<0&&(r=a),n(e[r],o)>=0)break;e[t]=e[r],t=r}e[t]=o}}function Zl(i,t=1,e=!1){let n=1/0,s=1/0,o=-1/0,r=-1/0;for(const[C,d]of i[0])C<n&&(n=C),d<s&&(s=d),C>o&&(o=C),d>r&&(r=d);const a=o-n,h=r-s,c=Math.max(t,Math.min(a,h));if(c===t){const C=[n,s];return C.distance=0,C}const u=new ql([],(C,d)=>d.max-C.max);let f=Gl(i);const v=new De(n+a/2,s+h/2,0,i);v.d>f.d&&(f=v);let x=2;function _(C,d,p){const l=new De(C,d,p,i);x++,l.max>f.d+t&&u.push(l),l.d>f.d&&(f=l,e&&console.log(`found best ${Math.round(1e4*l.d)/1e4} after ${x} probes`))}let M=c/2;for(let C=n;C<o;C+=c)for(let d=s;d<r;d+=c)_(C+M,d+M,M);for(;u.length;){const{max:C,x:d,y:p,h:l}=u.pop();if(C-f.d<=t)break;M=l/2,_(d-M,p-M,M),_(d+M,p-M,M),_(d-M,p+M,M),_(d+M,p+M,M)}e&&console.log(`num probes: ${x}
|
|
18
|
+
best distance: ${f.d}`);const I=[f.x,f.y];return I.distance=f.d,I}function De(i,t,e,n){this.x=i,this.y=t,this.h=e,this.d=Vl(i,t,n),this.max=this.d+this.h*Math.SQRT2}function Vl(i,t,e){let n=!1,s=1/0;for(const o of e)for(let r=0,a=o.length,h=a-1;r<a;h=r++){const c=o[r],u=o[h];c[1]>t!=u[1]>t&&i<(u[0]-c[0])*(t-c[1])/(u[1]-c[1])+c[0]&&(n=!n),s=Math.min(s,Kl(i,t,c,u))}return s===0?0:(n?1:-1)*Math.sqrt(s)}function Gl(i){let t=0,e=0,n=0;const s=i[0];for(let r=0,a=s.length,h=a-1;r<a;h=r++){const c=s[r],u=s[h],f=c[0]*u[1]-u[0]*c[1];e+=(c[0]+u[0])*f,n+=(c[1]+u[1])*f,t+=f*3}const o=new De(e/t,n/t,0,i);return t===0||o.d<0?new De(s[0][0],s[0][1],0,i):o}function Kl(i,t,e,n){let s=e[0],o=e[1],r=n[0]-s,a=n[1]-o;if(r!==0||a!==0){const h=((i-s)*r+(t-o)*a)/(r*r+a*a);h>1?(s=n[0],o=n[1]):h>0&&(s+=r*h,o+=a*h)}return r=i-s,a=t-o,r*r+a*a}class Ni extends ut{fill;constructor(t,e){super(t),this.fill=e}}class Jl extends Ni{count=0;drawPoint=null;onClick=t=>{if(this.count>1){const e=new Set([...this.fill.line?.points??[],...this.fill.line?.midPoints??[]].map(s=>s.LAYER));if(this.context.map.queryRenderedFeatures(t.point,{layers:[...e]}).length>0){this.stop(t);return}}Array.isArray(this.fill.options.position)||(this.fill.options.position=[],this.fill.createLine()),this.fill.line.insertPoint(this.count,t.lngLat),this.fill.options.position=this.fill.line?.options.position,this.count++};onMousemove=t=>{this.context.map.getCanvasContainer().style.cursor=Ft.CREATE,this.setDrawLngLat(t.lngLat),this.fill.render(),this.fill.emit(X.UPDATE,this.message(t,this.fill))};onContextmenu=t=>{this.fill.line.insertPoint(this.count,t.lngLat),this.stop(t)};stop=t=>{t.preventDefault();const e=this.fill.line?.points.at(0);this.fill.line&&e?.center&&this.fill.line.insertPoint(this.count+1,e.center).hide(),this.context.map.getCanvasContainer().style.cursor=Ft.EMPTY,this.setDrawLngLat(null),this.count=0,this.fill.setState({create:!1}),this.disabled(),this.fill.edit(),this.fill.emit(X.CREATE,this.message(t,this.fill))};constructor(t,e){super(t,e)}setDrawLngLat(t){this.drawPoint=t,this.fill.line?.createEvent.setDrawLngLat(t)}getDrawLngLat(){return this.drawPoint}onAdd(){}onRemove(){}enabled(){this.context.map.doubleClickZoom.disable(),this.context.map.on("click",this.onClick),this.context.map.on("mousemove",this.onMousemove),this.context.map.on("dblclick",this.stop),this.context.map.on("contextmenu",this.onContextmenu),this.changeStatus()}disabled(){this.context.map.off("click",this.onClick),this.context.map.off("mousemove",this.onMousemove),this.context.map.off("dblclick",this.stop),this.context.map.off("contextmenu",this.onContextmenu),setTimeout(()=>{this.context.map.doubleClickZoom.enable()},0),this.changeStatus()}}class Wl extends Ni{dragStartLngLat=null;onLineUpdate=(t,e)=>{if(console.log("onLineUpdate"),!e.center||!this.fill.line)return;const n=e.options.properties?.index;if(n===0){const s=this.fill.line.points.length-1;this.fill.line.updatePoint(s,e.center)}this.fill.line.updatePoint(n,e.center),this.fill.render(),this.fill.emit(X.UPDATE,this.message(t.originEvent,this.fill),e)};onLineMidUpdate=t=>{this.fill.render(),this.fill.emit(X.MID_UPDATE,this.message(t.originEvent,this.fill))};onLineMidDoneUpdate=t=>{this.fill.line?.points.at(-1)?.hide(),this.fill.emit(X.MID_DONE_UPDATE,this.message(t.originEvent,this.fill))};onFillMousedown=t=>{const e=new Set([...this.fill.line?.points??[],...this.fill.line?.midPoints??[]].map(s=>s.LAYER));this.context.map.queryRenderedFeatures(t.point,{layers:[...e,this.fill.line?.LAYER??""]}).length>0||(t.preventDefault(),this.context.map.getCanvasContainer().style.cursor="move",this.setDragLngLat(t.lngLat),this.context.map.on("mousemove",this.onMousemove),this.context.map.once("mouseup",this.onMouseup),this.fill.emit(X.BEFORE_UPDATE,this.message(t,this.fill)))};onMousemove=t=>{this.context.map.getCanvasContainer().style.cursor="move";const e=t.lngLat;this.fill.move(e),this.setDragLngLat(e),this.fill.emit(X.UPDATE,this.message(t,this.fill))};onMouseup=t=>{this.context.map.getCanvasContainer().style.cursor="pointer",this.context.map.off("mousemove",this.onMousemove),this.setDragLngLat(null),this.fill.render(),this.fill.emit(X.DONE_UPDATE,this.message(t,this.fill))};onFillMouseenter=()=>{this.context.map.getCanvasContainer().style.cursor="pointer"};onFillMouseLeave=()=>{this.context.map.getCanvasContainer().style.cursor=""};constructor(t,e){super(t,e)}setDragLngLat(t){this.dragStartLngLat=t}getDragLngLat(){return this.dragStartLngLat}onAdd(){}onRemove(){this.disabled()}enabled(){this.fill.line?.on(X.UPDATE,this.onLineUpdate),this.fill.line?.on(X.MID_UPDATE,this.onLineMidUpdate),this.fill.line?.on(X.MID_DONE_UPDATE,this.onLineMidDoneUpdate),this.context.map.on("mousedown",this.fill.LAYER,this.onFillMousedown),this.context.eventManager.on(this.fill.id,this.fill.LAYER,"mouseenter",this.onFillMouseenter),this.context.eventManager.on(this.fill.id,this.fill.LAYER,"mouseleave",this.onFillMouseLeave),this.changeStatus()}disabled(){this.fill.line?.off(X.UPDATE,this.onLineUpdate),this.fill.line?.off(X.MID_UPDATE,this.onLineMidUpdate),this.fill.line?.off(X.MID_DONE_UPDATE,this.onLineMidDoneUpdate),this.context.map.off("mousedown",this.fill.LAYER,this.onFillMousedown),this.context.eventManager.off(this.fill.id,"mouseenter",this.onFillMouseenter),this.context.eventManager.off(this.fill.id,"mouseleave",this.onFillMouseLeave),this.changeStatus()}}class Ql extends Ni{constructor(t,e){super(t,e)}onAdd(){}onRemove(){this.disabled()}enabled(){this.changeStatus()}disabled(){this.changeStatus()}}const io=Kt.Fill,Ri=3,$i="mapbox-gl-plot-fill-layer",no="mapbox-gl-plot-closed-line-layer",Fi="#009dff",so=.3,oo=["coalesce",["get","fill-color"],Fi],ro={id:$i,type:"fill",filter:["all",["==","$type","Polygon"],["==","visibility","visible"]],source:et,paint:{"fill-color":oo,"fill-opacity":["coalesce",["get","fill-opacity"],so]},layout:{}},ao={id:no,type:"line",filter:["all",["==","visibility","visible"]],source:et,paint:{"line-color":oo,"line-width":["case",["boolean",["feature-state","create"],!1],3,0]},layout:{}},co=[{layer:ro,zIndex:Ri},{layer:ao,zIndex:Ri}],tu=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_FILL_COLOR:Fi,DEFAULT_FILL_OPACITY:so,FILL_CLOSED_LINE_LAYER:ao,FILL_CLOSED_LINE_LAYER_NAME:no,FILL_LAYER:ro,FILL_LAYER_NAME:$i,LAYER_LIST:co,NAME:io,Z_INDEX:Ri},Symbol.toStringTag,{value:"Module"}));class eu extends di{static NAME=io;LAYER=$i;title=null;line=null;residentEvent;updateEvent;createEvent;constructor(t,e){super(t,e),this.options.position&&(this.options.position=[...this.options.position,this.options.position[0]]),this.residentEvent=new Ql(t,this),this.updateEvent=new Wl(t,this),this.createEvent=new Jl(t,this),this.createLine(),this.center&&(this.title=new Ci(this.context.map,{icon:this.options.icon??"normal-fill",visibility:this.options.visibility,id:this.id+"-fill-title-icon",position:this.center,name:this.options.name,isName:this.options.isName})),this.residentEvent.enabled()}get center(){if(!Array.isArray(this.options.position)||this.options.position.length===0||this.geometry===null)return null;const t=fn(this.getFeature());if(er(t,this.getFeature())){const e=t.geometry.coordinates;return new q.LngLat(e[0],e[1])}else{const e=this.options.position.map(o=>o.toArray()),[n,s]=Zl([e],1e-6);return new q.LngLat(n,s)}}get geometry(){return this.getFeature().geometry}getFeature(){if(this.line?.geometry&&Array.isArray(this.line.geometry.coordinates)&&this.line.geometry.coordinates.length>2){const t=vn(this.line.getFeature(),{properties:{...this.options.style,...this.options.properties,visibility:this.options.visibility,id:this.options.id}});return t.id=this.id,t}else return{type:"Feature",geometry:null,id:this.id,properties:{}}}get id(){return this.options.id}move(t){const e=this.center===null?this.center:this.updateEvent.getDragLngLat();if(!this.line||!e)return;const n=t.lng-e.lng,s=t.lat-e.lat;this.line.points.forEach((o,r)=>{if(o.center){const a=new q.LngLat(o.center.lng+n,o.center.lat+s);this.line.updatePoint(r,a,!1)}}),this.options.position=this.line.options.position,this.render()}createLine(){if(!Array.isArray(this.options.position))return;const t=this.options.style?.["fill-color"]??Fi,e={"line-color":t,...this.options.outLineStyle},n={"circle-radius":5,"circle-stroke-color":t,...this.options.vertexStyle};this.line=new Oe(this.context.map,{isName:!1,position:this.options.position,properties:{},style:e,vertexStyle:n,visibility:this.options.visibility,id:`${this.id}-line`});const s=this.line.points.length-1;s>0&&this.line.points[s].hide()}removeLine(){this.line?.remove(),this.line=null}onAdd(){this.context.register.addSource(et,li),co.forEach(t=>{this.context.register.addLayer(t)}),this.context.iconManage.addSvg({name:"normal-fill",svg:'<svg t="1773066297467" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="15103" width="32" height="32"><path d="M1024 512c0 282.8-229.2 512-512 512S0 794.8 0 512 229.2 0 512 0s512 229.2 512 512" fill="#5A89FF" p-id="15104"></path><path d="M709.76 818.4H314.24a24 24 0 0 1-22.8-16.56L169.2 425.6c-3.2-9.92 0.32-20.72 8.72-26.8l320-232.48c8.4-6.08 19.84-6.08 28.24 0l320 232.48a24 24 0 0 1 8.72 26.8l-122.24 376.16a24.136 24.136 0 0 1-22.88 16.64z m-378.08-48h360.64l111.44-343.04L512 215.36l-291.76 212L331.68 770.4z" fill="#FFFFFF" p-id="15105"></path></svg>'})}onRemove(){this.remove()}remove(){this.options.position=[],this.removeLine(),this.title?.remove(),this.title=null,this.render()}show(){this.line?.show(),super.show()}hide(){this.line?.hide(),super.hide()}render(){this.line&&(this.line.render(),this.options.position=this.line.options.position),this.options.visibility==="visible"?this.title?.show():this.title?.hide(),this.isFocus?this.context.focus.set(this.getFeature(),{armLength:40,padding:30}):this.context.focus.remove(this.id),this.context.register.setGeoJSONData(et,this.getFeature())}start(){this.center===null&&(this.createEvent.enabled(),this.updateEvent.disabled(),this.residentEvent.disabled(),this.setState({create:!0}))}stop(){this.createEvent.disabled(),this.residentEvent.enabled(),this.setState({create:!1})}unedit(){this.setState({edit:!1}),this.line?.unedit(),this.residentEvent.enabled(),this.updateEvent.disabled(),this.render()}edit(){this.setState({edit:!0}),this.line?.edit(),this.residentEvent.disabled(),this.updateEvent.enabled(),this.render()}focus(){this.setState({focus:!0}),this.render()}unfocus(){this.setState({focus:!1}),this.render()}select(){const t=be(this.getFeature());this.context.map.fitBounds(t,{padding:{left:60,right:60,top:60,bottom:60}}),this.context.map.once("moveend",()=>{this.focus()})}unselect(){this.unfocus()}update(t){this.options=t,this.options.position&&(this.options.position=[...this.options.position,this.options.position[0]]),this.removeLine(),this.createLine()}}class ho extends pe{static NAME=Is;LAYER=pi;constructor(t,e){super(t,e)}onAdd(){super.onAdd(),Ts.forEach(t=>{this.context.register.addLayer(t)})}getFeature(){return this.options.position?lt(this.options.position.toArray(),{...this.options.style,...this.options.properties,id:this.options.id,visibility:this.options.visibility,isName:!1,index:this.options.index,meta:"circle",subMeta:"indexPoint"},{id:this.options.id}):{type:"Feature",geometry:null,id:this.id,properties:{}}}}class iu extends Oe{constructor(t,e){super(t,e)}createVertex(t,e,n){return new ho(this.context.map,{id:t,isName:!1,visibility:"visible",position:n,index:e+1,style:this.options.vertexStyle,properties:{id:`${this.id}-node-${String(e)}`,index:e,type:me.VERTEX}})}}class nu extends ut{ships=[];hoverId=null;_click=()=>{};_move=()=>{};_leave=()=>{};_zoomEnd=()=>{};constructor(t,e){super(t),e&&(this.ships=e)}enabled(){this.context.map.on("click",Mt,this._click),this.context.map.on("mousemove",Mt,this._move),this.context.map.on("mouseleave",Mt,this._leave),this.context.map.on("click",wt,this._click),this.context.map.on("mousemove",wt,this._move),this.context.map.on("mouseleave",wt,this._leave),this.context.map.on("zoomend",this._zoomEnd)}disabled(){this.context.map.off("click",Mt,this._click),this.context.map.off("mousemove",Mt,this._move),this.context.map.off("mouseleave",Mt,this._leave),this.context.map.off("click",wt,this._click),this.context.map.off("mousemove",wt,this._move),this.context.map.off("mouseleave",wt,this._leave),this.context.map.off("zoomend",this._zoomEnd)}onAdd(){this._click=this.onClick.bind(this),this._move=this.onMove.bind(this),this._leave=this.onLeave.bind(this),this._zoomEnd=this.onZoomEnd.bind(this),this.enabled()}onRemove(){this.disabled()}add(t){const e=this.findShip(t.id);e?t.update(e.options):this.ships.push(t)}remove(t){const e=this.ships.findIndex(n=>n.id===t);e!==-1&&this.ships.splice(e,1)}removeAll(){this.ships=[]}onZoomEnd(){this.ships.forEach(t=>{t.render()})}onMove(t){if(t.features?.length){if(this.context.map.getCanvasContainer().style.cursor="pointer",this.hoverId===t.features[0].id)return;this.hoverId&&this.unhover(),this.hoverId=t.features[0].id,this.hover()}}onLeave(){this.unhover(),this.hoverId=null,this.context.map.getCanvasContainer().style.cursor=""}onClick(t){if(t.features?.length){const e=t.features[0].id;if(e){const n=this.findShip(e);this.context.events.emit("click",n),this.context.map.fire("ship-click",n)}}}hover(){if(!this.hoverId)return;const t=this.findShip(this.hoverId);t?.setState({hover:!0}),t?.render(),this.context.events.emit("hover",t),this.context.map.fire("ship-hover",t)}unhover(){if(!this.hoverId)return;const t=this.findShip(this.hoverId);t?.setState({hover:!1}),t?.render(),this.context.events.emit("unhover",t),this.context.map.fire("ship-unhover",t)}findShip(t){return this.ships.find(e=>String(e.id)===String(t))}}class su extends Nt{options;ships=[];event;pluginRegistry=new Map;collision;focusId=null;constructor(t,e){super(t),this.options=e,this.collision=new Be(this.context.map),this.event=new nu(t),this.registerPlugins(e.plugins)}onAdd(){}onRemove(){}get tooltips(){return this.ships.flatMap(t=>t.tooltip??[])}registerPlugins(t=[]){t.forEach(e=>{e.NAME?this.pluginRegistry.set(e.NAME,e):console.warn("Ship Plugin missing static NAME property:",e)})}createCollisions(){return this.tooltips.map(t=>({...t.getAllBbox(),id:t.id}))}collisionTooltip(){this.collision.load(this.createCollisions()).forEach(t=>{const e=this.tooltips.find(n=>n.id===t.id);e&&t.visible&&e.setAnchor(t.dir)})}add(t){const e=this.pluginRegistry.get(t.type);if(!e){console.warn(`No plugin registered for ship type: "${t.type}"`);return}const n=new e(this.context.map,t);return this.ships.push(n),this.event.add(n),n}load(t){this.removeAll();const e=[];if(t.forEach(n=>{const s=this.add(n);s&&e.push(s)}),this.render(),this.collisionTooltip(),this.focusId){const n=this.get(this.focusId);n&&n.focus()}return e}remove(t){this.event.remove(t);const e=this.ships.findIndex(n=>n.id===t);e!==-1&&(this.ships[e].remove(),this.ships.splice(e,1))}removeAll(){this.collision.clear(),this.ships.forEach(t=>{t.remove()}),this.ships=[],this.event.removeAll()}render(){this.ships.forEach(t=>{t.render()})}get(t){return this.ships.find(e=>e.id===t)}focus(t){const e=this.get(t);e?(e.focus(),this.focusId=e.id):console.warn(`The ship-${String(t)} was not found.`)}unfocus(t){const e=this.get(t);e?(e.unfocus(),this.focusId=null):console.warn(`The ship-${String(t)} was not found.`)}select(t){const e=this.get(t);e?(e.select(),this.focusId=e.id):console.warn(`The ship-${String(t)} was not found.`)}unselect(t){const e=this.get(t);e?(e.unselect(),this.focusId=null):console.warn(`The ship-${String(t)} was not found.`)}}class Ne extends Nt{options;SOURCE="mapbox-gl-ship-source";static NAME="Base";tooltip=null;visible=!0;constructor(t,e){super(t),this.options=e}destroy(){throw new Error("Method not implemented.")}get isFocus(){const t=this.getState();return t?!!t.focus:!1}get isHover(){const t=this.getState();return t?!!t.hover:!1}setState(t){this.context.map.setFeatureState({source:this.SOURCE,id:this.id},t)}getState(){return this.context.map.getFeatureState({source:this.SOURCE,id:this.id})}isSelf(t){if(t.features&&t.features.length>0){const e=t.features[0];return String(e.id)===this.id}else return!1}getName(){return Ne.NAME}}var Re={exports:{}},ou=Re.exports,lo;function ru(){return lo||(lo=1,(function(i,t){(function(e,n){i.exports=n()})(ou,(function(){var e=1e3,n=6e4,s=36e5,o="millisecond",r="second",a="minute",h="hour",c="day",u="week",f="month",v="quarter",x="year",_="date",M="Invalid Date",I=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(O){var D=["th","st","nd","rd"],b=O%100;return"["+O+(D[(b-20)%10]||D[b]||D[0])+"]"}},p=function(O,D,b){var P=String(O);return!P||P.length>=D?O:""+Array(D+1-P.length).join(b)+O},l={s:p,z:function(O){var D=-O.utcOffset(),b=Math.abs(D),P=Math.floor(b/60),T=b%60;return(D<=0?"+":"-")+p(P,2,"0")+":"+p(T,2,"0")},m:function O(D,b){if(D.date()<b.date())return-O(b,D);var P=12*(b.year()-D.year())+(b.month()-D.month()),T=D.clone().add(P,f),F=b-T<0,S=D.clone().add(P+(F?-1:1),f);return+(-(P+(b-T)/(F?T-S:S-T))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:f,y:x,w:u,d:c,D:_,h,m:a,s:r,ms:o,Q:v}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},m="en",g={};g[m]=d;var y="$isDayjsObject",E=function(O){return O instanceof N||!(!O||!O[y])},L=function O(D,b,P){var T;if(!D)return m;if(typeof D=="string"){var F=D.toLowerCase();g[F]&&(T=F),b&&(g[F]=b,T=F);var S=D.split("-");if(!T&&S.length>1)return O(S[0])}else{var R=D.name;g[R]=D,T=R}return!P&&T&&(m=T),T||!P&&m},w=function(O,D){if(E(O))return O.clone();var b=typeof D=="object"?D:{};return b.date=O,b.args=arguments,new N(b)},A=l;A.l=L,A.i=E,A.w=function(O,D){return w(O,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var N=(function(){function O(b){this.$L=L(b.locale,null,!0),this.parse(b),this.$x=this.$x||b.x||{},this[y]=!0}var D=O.prototype;return D.parse=function(b){this.$d=(function(P){var T=P.date,F=P.utc;if(T===null)return new Date(NaN);if(A.u(T))return new Date;if(T instanceof Date)return new Date(T);if(typeof T=="string"&&!/Z$/i.test(T)){var S=T.match(I);if(S){var R=S[2]-1||0,$=(S[7]||"0").substring(0,3);return F?new Date(Date.UTC(S[1],R,S[3]||1,S[4]||0,S[5]||0,S[6]||0,$)):new Date(S[1],R,S[3]||1,S[4]||0,S[5]||0,S[6]||0,$)}}return new Date(T)})(b),this.init()},D.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},D.$utils=function(){return A},D.isValid=function(){return this.$d.toString()!==M},D.isSame=function(b,P){var T=w(b);return this.startOf(P)<=T&&T<=this.endOf(P)},D.isAfter=function(b,P){return w(b)<this.startOf(P)},D.isBefore=function(b,P){return this.endOf(P)<w(b)},D.$g=function(b,P,T){return A.u(b)?this[P]:this.set(T,b)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(b,P){var T=this,F=!!A.u(P)||P,S=A.p(b),R=function(Z,V){var W=A.w(T.$u?Date.UTC(T.$y,V,Z):new Date(T.$y,V,Z),T);return F?W:W.endOf(c)},$=function(Z,V){return A.w(T.toDate()[Z].apply(T.toDate("s"),(F?[0,0,0,0]:[23,59,59,999]).slice(V)),T)},j=this.$W,B=this.$M,z=this.$D,U="set"+(this.$u?"UTC":"");switch(S){case x:return F?R(1,0):R(31,11);case f:return F?R(1,B):R(0,B+1);case u:var H=this.$locale().weekStart||0,G=(j<H?j+7:j)-H;return R(F?z-G:z+(6-G),B);case c:case _:return $(U+"Hours",0);case h:return $(U+"Minutes",1);case a:return $(U+"Seconds",2);case r:return $(U+"Milliseconds",3);default:return this.clone()}},D.endOf=function(b){return this.startOf(b,!1)},D.$set=function(b,P){var T,F=A.p(b),S="set"+(this.$u?"UTC":""),R=(T={},T[c]=S+"Date",T[_]=S+"Date",T[f]=S+"Month",T[x]=S+"FullYear",T[h]=S+"Hours",T[a]=S+"Minutes",T[r]=S+"Seconds",T[o]=S+"Milliseconds",T)[F],$=F===c?this.$D+(P-this.$W):P;if(F===f||F===x){var j=this.clone().set(_,1);j.$d[R]($),j.init(),this.$d=j.set(_,Math.min(this.$D,j.daysInMonth())).$d}else R&&this.$d[R]($);return this.init(),this},D.set=function(b,P){return this.clone().$set(b,P)},D.get=function(b){return this[A.p(b)]()},D.add=function(b,P){var T,F=this;b=Number(b);var S=A.p(P),R=function(B){var z=w(F);return A.w(z.date(z.date()+Math.round(B*b)),F)};if(S===f)return this.set(f,this.$M+b);if(S===x)return this.set(x,this.$y+b);if(S===c)return R(1);if(S===u)return R(7);var $=(T={},T[a]=n,T[h]=s,T[r]=e,T)[S]||1,j=this.$d.getTime()+b*$;return A.w(j,this)},D.subtract=function(b,P){return this.add(-1*b,P)},D.format=function(b){var P=this,T=this.$locale();if(!this.isValid())return T.invalidDate||M;var F=b||"YYYY-MM-DDTHH:mm:ssZ",S=A.z(this),R=this.$H,$=this.$m,j=this.$M,B=T.weekdays,z=T.months,U=T.meridiem,H=function(V,W,st,Q){return V&&(V[W]||V(P,F))||st[W].slice(0,Q)},G=function(V){return A.s(R%12||12,V,"0")},Z=U||function(V,W,st){var Q=V<12?"AM":"PM";return st?Q.toLowerCase():Q};return F.replace(C,(function(V,W){return W||(function(st){switch(st){case"YY":return String(P.$y).slice(-2);case"YYYY":return A.s(P.$y,4,"0");case"M":return j+1;case"MM":return A.s(j+1,2,"0");case"MMM":return H(T.monthsShort,j,z,3);case"MMMM":return H(z,j);case"D":return P.$D;case"DD":return A.s(P.$D,2,"0");case"d":return String(P.$W);case"dd":return H(T.weekdaysMin,P.$W,B,2);case"ddd":return H(T.weekdaysShort,P.$W,B,3);case"dddd":return B[P.$W];case"H":return String(R);case"HH":return A.s(R,2,"0");case"h":return G(1);case"hh":return G(2);case"a":return Z(R,$,!0);case"A":return Z(R,$,!1);case"m":return String($);case"mm":return A.s($,2,"0");case"s":return String(P.$s);case"ss":return A.s(P.$s,2,"0");case"SSS":return A.s(P.$ms,3,"0");case"Z":return S}return null})(V)||S.replace(":","")}))},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(b,P,T){var F,S=this,R=A.p(P),$=w(b),j=($.utcOffset()-this.utcOffset())*n,B=this-$,z=function(){return A.m(S,$)};switch(R){case x:F=z()/12;break;case f:F=z();break;case v:F=z()/3;break;case u:F=(B-j)/6048e5;break;case c:F=(B-j)/864e5;break;case h:F=B/s;break;case a:F=B/n;break;case r:F=B/e;break;default:F=B}return T?F:A.a(F)},D.daysInMonth=function(){return this.endOf(f).$D},D.$locale=function(){return g[this.$L]},D.locale=function(b,P){if(!b)return this.$L;var T=this.clone(),F=L(b,P,!0);return F&&(T.$L=F),T},D.clone=function(){return A.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},O})(),Y=N.prototype;return w.prototype=Y,[["$ms",o],["$s",r],["$m",a],["$H",h],["$W",c],["$M",f],["$y",x],["$D",_]].forEach((function(O){Y[O[1]]=function(D){return this.$g(D,O[0],O[1])}})),w.extend=function(O,D){return O.$i||(O(D,N,w),O.$i=!0),w},w.locale=L,w.isDayjs=E,w.unix=function(O){return w(1e3*O)},w.en=g[m],w.Ls=g,w.p={},w}))})(Re)),Re.exports}var au=ru();const uo=ze(au);class Yi extends Ne{SOURCE=$t;static NAME=Te;constructor(t,e){super(t,e),this.options.tooltip&&this.setTooltip(new ue(this.context.map,{id:this.id,position:this.position(),className:"mapbox-gl-ship-name-tooltip",offsetX:5,offsetY:25,element:this.label(),anchor:"bottom-right",line:!0,visible:!1}))}onAdd(){this.context.register.addSource($t,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),bs.forEach(t=>{this.context.register.addLayer(t)})}onRemove(){throw new Error("Method not implemented.")}get id(){return this.options.id}get updateStatus(){const t=Date.now()-uo(Number(this.options.time)).valueOf();return t<=18e5?yt.ONLINE:t>18e5&&t<=72e5?yt.DELAY:(t>72e5,yt.OFFLINE)}getIconName(){const t=this.getState();let e;return this.options.icon?e=this.options.icon:(e=`${Yi.NAME}-${this.updateStatus}`,(t?.hover||t?.focus)&&(e=`${e}-active`)),e}position(){const t=this.context.map.project(this.options.position),e=t.x+this.offset().x,n=t.y+this.offset().y;return this.context.map.unproject(new q.Point(e,n))}get direction(){return this.options.hdg!==511&&this.options.hdg>0&&this.options.hdg<360?this.options.hdg:this.options.cog>0&&this.options.cog<360?this.options.cog:0}get orientation(){return this.options.speed<.5?"static":this.options.rot===-128||this.options.rot===0?"straight":this.options.rot>0?"right":this.options.rot<0?"left":"straight"}getShape(){if(this.options.width&&this.options.height){const{x:t,y:e}=this.context.map.project(this.position()),n=re(this.context.map,this.options.width)/2,s=re(this.context.map,this.options.height)/2;return{leftDirection:new q.Point(t-n,e-s*2),rightDirection:new q.Point(t+n,e-s*2),turn:new q.Point(t,e-s-this.options.speed*3),head:new q.Point(t,e-s),rightBow:new q.Point(t+n,e-s*.5),rightQuarter:new q.Point(t+n,e+s*.85),rightStern:new q.Point(t+n*.7,e+s),leftStern:new q.Point(t-n*.7,e+s),leftQuarter:new q.Point(t-n,e+s*.85),leftBow:new q.Point(t-n,e-s*.5)}}else return null}getFeature(){const t=this.options.realZoom??16;return this.context.map.getZoom()>=t?this.real():this.icon()}remove(){this.removeTooltip(),this.isFocus&&(this.unfocus(),this.context.focus.remove(String(this.id)));const t={type:"Feature",geometry:null,id:this.id,properties:{}},e={type:"Feature",geometry:null,id:String(this.id)+"-direction-line",properties:{}};this.context.register.setGeoJSONData(this.SOURCE,[t,e]),this.context.map.triggerRepaint()}setTooltip(t){this.tooltip=t}removeTooltip(){this.tooltip?.remove(),this.tooltip=null}update(t){this.options=t,this.render()}select(){this.context.map.flyTo({center:this.position(),zoom:16}),this.context.map.once("moveend",()=>{this.focus()})}unselect(){this.unfocus()}focus(){this.setState({focus:!0}),this.render()}unfocus(){this.setState({focus:!1}),this.render()}icon(){return lt(this.position().toArray(),{...this.options,id:this.options.id,icon:this.getIconName(),direction:this.direction,updateStatus:this.updateStatus},{id:this.id})}real(){const t=this.getShape();if(t){const{head:e,rightBow:n,rightQuarter:s,rightStern:o,leftStern:r,leftQuarter:a,leftBow:h,leftDirection:c,rightDirection:u,turn:f}=t;let v=[e,n,s,o,r,a,h,e];this.orientation==="left"?v=[c,f,...v,f,c]:this.orientation==="right"?v=[u,f,...v,f,u]:this.orientation==="straight"&&(v=[f,...v,f]);const x=Et(v.map(M=>this.context.map.unproject(M).toArray()));let _=vn(x,{properties:{...this.options,id:this.options.id,updateStatus:this.updateStatus,outLine:!0}});return _=br(_,this.direction,{pivot:this.position().toArray()}),_.id=this.id,_}else return this.icon()}headingLine(){const t=we(this.position().toArray(),this.options.speed*92.52,this.direction,{units:"meters"}),e=[];if(this.orientation==="left"){const n=we(t,En(this.context.map,this.position().toArray()[1],10),this.direction-90,{units:"meters"});e.push(this.position().toArray(),t.geometry.coordinates,n.geometry.coordinates)}else if(this.orientation==="right"){const n=we(t,En(this.context.map,this.position().toArray()[1],10),this.direction+90,{units:"meters"});e.push(this.position().toArray(),t.geometry.coordinates,n.geometry.coordinates)}else this.orientation==="straight"&&e.push(this.position().toArray(),t.geometry.coordinates);return e.length===0?{type:"Feature",geometry:null,id:String(this.id)+"-direction-line",properties:{meta:"directionLine","line-color":"#f00"}}:Et(e,{meta:"directionLine","line-color":this.isFocus||this.isHover?"#f00":"#000"},{id:String(this.id)+"-direction-line"})}render(){if(!this.context.map.getBounds()?.contains(this.position())){this.tooltip?.hide();return}if(this.tooltip?.render(),this.context.register.setGeoJSONData(this.SOURCE,[this.headingLine(),this.getFeature()]),this.isFocus){const e=this.context.iconManage.getImage(this.getIconName());this.context.focus.set(this.getFeature(),{size:e?.width,armLength:10,padding:10})}else this.context.focus.remove(String(this.id))}label(){const t=`${String(this.id)}-ship-name-box`;let e=document.getElementById(t);if(e)return e;e=document.createElement("div"),e.id=t,e.classList.add("ship-name-box");const n=document.createElement("div");return n.innerText=this.options.name,n.classList.add("ship-name"),e.appendChild(n),e}offset(){const t=new q.Point(0,0);if(this.options.top&&this.options.bottom&&this.options.left&&this.options.right){const e=re(this.context.map,Math.abs(this.options.top-this.options.bottom)/2),n=re(this.context.map,Math.abs(this.options.left-this.options.right)/2);t.x=this.options.right>this.options.left?n:-n,t.y=this.options.top>this.options.bottom?e:-e}return t}}var At=(i=>(i[i.START_END=0]="START_END",i[i.SHARP_TURN=1]="SHARP_TURN",i[i.STOP_GO=2]="STOP_GO",i[i.TIME_ANCHOR=3]="TIME_ANCHOR",i[i.NORMAL=9]="NORMAL",i))(At||{});const cu="Track",$e=290,Yt="mapbox-gl-track-source",fo="mapbox-gl-track-arrow-layer",Bt="mapbox-gl-track-icon-layer",po="mapbox-gl-track-line-layer",Bi="track-start",mo='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="74" height="74" viewBox="0 0 74 74" fill="none"><circle cx="37" cy="37" r="32" stroke="rgba(172, 51, 193, 1)" stroke-width="10" fill="#AC33C1" ></circle><path d="M36.4 50.84C40.84 51.08 45.24 51.08 45.24 51.08C50.52 51.08 55.12 50.8 55.12 50.8L54.48 54.36C50.16 54.64 45.24 54.64 45.24 54.64C40.32 54.64 35.96 54.36 35.96 54.36C31.16 54.08 28.16 52.72 28.16 52.72C25.16 51.36 23.4 48.36 23.4 48.36C22.64 51.96 20.84 55.72 20.84 55.72L18 53.52C19.16 51.04 19.76 48.94 19.76 48.94C20.36 46.84 20.62 44.26 20.62 44.26C20.88 41.68 20.88 37.64 20.88 37.64L24.2 37.64C24.2 40.92 24.04 43.12 24.04 43.12C25.16 46.52 27.28 48.24 27.28 48.24L27.28 35.44L18.68 35.44L18.68 32.08L26.32 32.08L26.32 27.12L20.08 27.12L20.08 23.72L26.32 23.72L26.32 19L29.84 19L29.84 23.72L35.64 23.72L35.64 27.12L29.84 27.12L29.84 32.08L36.76 32.08L36.76 35.44L30.72 35.44L30.72 40.96L36.36 40.96L36.36 44.32L30.72 44.32L30.72 49.96C33 50.64 36.4 50.84 36.4 50.84ZM48.96 30.88L48.96 24.64L37.8 24.64L37.8 21.12L52.44 21.12L52.44 34.4L41.84 34.4L41.84 41.52C41.84 42.72 42.02 43.24 42.02 43.24C42.2 43.76 42.68 43.98 42.68 43.98C43.16 44.2 44.28 44.32 44.28 44.32C44.88 44.36 46 44.36 46 44.36C47.12 44.36 47.72 44.32 47.72 44.32C48.88 44.2 49.44 43.98 49.44 43.98C50 43.76 50.22 43.28 50.22 43.28C50.44 42.8 50.52 41.8 50.52 41.8C50.68 39.72 50.68 38.44 50.68 38.44L54.08 39.24C53.96 41.12 53.8 43 53.8 43C53.6 45.04 53.16 45.98 53.16 45.98C52.72 46.92 51.72 47.3 51.72 47.3C50.72 47.68 48.64 47.8 48.64 47.8C46.8 47.88 45.88 47.88 45.88 47.88C44.96 47.88 43.12 47.8 43.12 47.8C41.2 47.68 40.22 47.2 40.22 47.2C39.24 46.72 38.8 45.64 38.8 45.64C38.36 44.56 38.36 42.44 38.36 42.44L38.36 30.88L48.96 30.88Z" fill="#FFFFFF" ></path></svg>',ki="track-end",go='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="74" height="74" viewBox="0 0 74 74" fill="none"><circle cx="37" cy="37" r="32" stroke="rgba(172, 51, 193, 1)" stroke-width="10" fill="#AC33C1" ></circle><path d="M45.6 33.64C49.28 36.12 55.28 38.24 55.28 38.24L54 41.8C50.48 40.32 47.78 38.88 47.78 38.88C45.08 37.44 42.92 35.8 42.92 35.8C38.76 38.84 32.04 41.6 32.04 41.6L30.4 38.4C36.28 36.2 40.24 33.56 40.24 33.56C38.2 31.6 36.12 28.8 36.12 28.8C34.56 30.92 32.68 32.88 32.68 32.88L30.72 30.36C32.88 28.08 35.08 24.52 35.08 24.52C37.28 20.96 38.4 18 38.4 18L41.64 18.92C41.2 19.96 40.24 22.04 40.24 22.04L52.04 22.04L52.04 25.48C50.56 27.96 49.02 29.96 49.02 29.96C47.48 31.96 45.6 33.64 45.6 33.64ZM20.76 33.44C19.96 33.48 19 33.76 19 33.76L18.2 30.24C18.72 30.04 18.98 29.82 18.98 29.82C19.24 29.6 19.56 29.2 19.56 29.2C20.44 28 22.06 24.68 22.06 24.68C23.68 21.36 24.92 18.2 24.92 18.2L28.04 19.4C26.8 22.28 25.24 25.4 25.24 25.4C23.68 28.52 22.6 30.04 22.6 30.04C25.92 29.56 26.76 29.44 26.76 29.44C28.16 26.68 29.28 24.16 29.28 24.16L32.16 25.52C30.52 28.92 28.16 33.22 28.16 33.22C25.8 37.52 24.4 39.48 24.4 39.48L27.36 38.76L29.76 38.16L29.84 41.68C29.28 41.72 26.86 42.2 26.86 42.2C24.44 42.68 22.52 43.08 22.52 43.08C21.96 43.2 20.84 43.52 20.84 43.52L19.92 43.76L19.08 40.12C19.96 39.76 20.34 39.48 20.34 39.48C20.72 39.2 21.2 38.64 21.2 38.64C22.84 36.6 24.92 32.84 24.92 32.84C22.24 33.28 20.76 33.44 20.76 33.44ZM38.08 25.92C40.2 29.2 42.88 31.52 42.88 31.52C45.56 29.16 48.12 25.4 48.12 25.4L38.4 25.4L38.08 25.92ZM37.6 39.4L40.8 40.4L49.4 43.08L48.12 46.52C45.76 45.68 42.22 44.5 42.22 44.5C38.68 43.32 36.64 42.76 36.64 42.76L37.6 39.4ZM18 49.08C18.68 48.96 21.08 48.4 21.08 48.4C23.48 47.84 25.2 47.44 25.2 47.44C30.76 46.2 31.08 46.12 31.08 46.12L31.28 49.6C30.12 49.8 22.24 51.6 22.24 51.6C18.8 52.44 18.48 52.48 18.48 52.48L18 49.08ZM34.4 46.48C37.24 47.24 42.46 48.82 42.46 48.82C47.68 50.4 51.12 51.52 51.12 51.52L49.92 55.04C46.44 53.8 41.38 52.2 41.38 52.2C36.32 50.6 33.44 49.84 33.44 49.84L34.4 46.48Z" fill="#FFFFFF" ></path></svg>',Xi="track-arrow",vo='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="74" height="74" viewBox="0 0 74 74" fill="none"><circle cx="37" cy="37" r="32" stroke="rgba(172, 51, 193, 1)" stroke-width="10" fill="#FFFFFF" ></circle></svg>',Ui="track-normal",yo='<svg t="1769503360247" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="24046" width="64" height="64"><path d="M509.093 894.223l-447.093-761.539 452.861 219.23099999 447.139-222.13799999z" p-id="24047" fill="#d81e06"></path></svg>',xo={id:fo,source:Yt,type:"symbol",layout:{"symbol-placement":"line","symbol-spacing":250,"icon-image":Xi,"icon-size":.3,"icon-rotate":-90,"icon-allow-overlap":!0},paint:{}},Eo={id:Bt,source:Yt,type:"symbol",filter:["==","$type","Point"],layout:{"icon-image":["get","icon"],"icon-size":["get","iconSize"],"icon-allow-overlap":!1,"symbol-sort-key":["get","type"]}},_o={id:po,source:Yt,type:"line",filter:["all",["==","$type","LineString"]],paint:{"line-color":"#f00","line-width":3},layout:{}},bo=[{layer:_o,zIndex:$e},{layer:xo,zIndex:$e},{layer:Eo,zIndex:$e}],hu=Object.freeze(Object.defineProperty({__proto__:null,ARROW_ICON:yo,ARROW_ICON_NAME:Xi,END_ICON:go,END_ICON_NAME:ki,LAYER_LIST:bo,NAME:cu,NORMAL_ICON:vo,NORMAL_ICON_NAME:Ui,START_ICON:mo,START_ICON_NAME:Bi,TRACK_ARROW_LAYER:xo,TRACK_ARROW_LAYER_NAME:fo,TRACK_ICON_LAYER:Eo,TRACK_ICON_LAYER_NAME:Bt,TRACK_LINE_LAYER:_o,TRACK_LINE_LAYER_NAME:po,TRACK_SOURCE_NAME:Yt,Z_INDEX:$e},Symbol.toStringTag,{value:"Module"}));class lu extends ut{hoverId=null;hoverPointId=null;track;_move=()=>{};_leave=()=>{};_moveEnd=()=>{};constructor(t,e){super(t),this.track=e}disabled(){this.context.map.off("mousemove",Bt,this._move),this.context.map.off("mouseleave",Bt,this._leave),this.context.map.off("moveend",this._moveEnd)}enabled(){this.context.map.on("mousemove",Bt,this._move),this.context.map.on("mouseleave",Bt,this._leave),this.context.map.on("moveend",this._moveEnd)}onAdd(){this._move=this.onMove.bind(this),this._leave=this.onLeave.bind(this),this._moveEnd=this.onMoveEnd.bind(this),this.enabled()}onRemove(){this.disabled()}onMoveEnd(){this.track.render()}onMove(t){if(t.features?.length){if(this.context.map.getCanvasContainer().style.cursor="pointer",this.hoverId===(t.features[0].id??t.features[0].properties.id))return;this.hoverId&&this.unhover(),this.hoverId=t.features[0].id??t.features[0].properties.id,this.hoverPointId=t.features[0].properties.pId,this.hover()}}onLeave(){this.unhover(),this.hoverId=null,this.hoverPointId=null,this.context.map.getCanvasContainer().style.cursor=""}hover(){if(!this.hoverId)return;const e=this.track.trackData.get(this.hoverId)?.find(s=>s.pId===this.hoverPointId),n="track-hover";this.context.events.emit(n,e),this.context.map.fire(n,e)}unhover(){if(!this.hoverId)return;const e=this.track.trackData.get(this.hoverId)?.find(s=>s.pId===this.hoverPointId),n="track-unhover";this.context.events.emit(n,e),this.context.map.fire(n,e)}}class uu extends Nt{options;trackData=new Map;tooltips=[];collision;event;constructor(t,e){super(t),this.options=e,this.collision=new Be(t),this.event=new lu(t,this)}onAdd(){this.context.register.addSource(Yt,{type:"geojson",dynamic:!0,data:{type:"FeatureCollection",features:[]}}),bo.forEach(t=>{this.context.register.addLayer(t)}),this.context.iconManage.loadSvg([{name:Bi,svg:mo},{name:ki,svg:go},{name:Xi,svg:yo},{name:Ui,svg:vo}])}onRemove(){this.event.disabled()}load(t){const e=t[0].id,n=t.filter(s=>s.id===e).sort((s,o)=>s.time.getTime()-o.time.getTime());this.trackData.set(e,this.markItem(n))}remove(){this.removeAllTooltip(),this.event.disabled(),this.context.register.setGeoJSONData(Yt,this.getFeature())}markItem(t){if(t.length===0)return[];const e=t.map(s=>({...s,visible:!0,type:At.NORMAL}));e[0].type=At.START_END,e[e.length-1].type=At.START_END;let n=e[0].time.getTime();for(let s=1;s<e.length-1;s++){const o=e[s-1],r=e[s],a=e[s+1];let h=o.cog;h??=_t(o.position.toArray(),r.position.toArray());let c=r.cog;c??=_t(r.position.toArray(),a.position.toArray());const u=Math.abs(c-h);(u>180?360-u:u)>25&&(r.type=Math.min(r.type,At.SHARP_TURN));const v=h<.5,x=c<.5;v!==x&&(r.type=Math.min(r.type,At.STOP_GO)),r.type===At.NORMAL?r.time.getTime()-n>18e5&&(r.type=At.TIME_ANCHOR,n=r.time.getTime()):n=r.time.getTime()}return e}simplifyTrackBySlope(t,e=2){if(t.length<=2)return t;const n=[t[0]];let s=t[0];for(let o=1;o<t.length-1;o++){const r=t[o],a=t[o+1],h=_t(s.position.toArray(),r.position.toArray()),c=_t(r.position.toArray(),a.position.toArray());let u=Math.abs(h-c);u>180&&(u=360-u),u>e&&(n.push(r),s=r)}return n.push(t[t.length-1]),n}simplifyTrackByZoom(t,e){let n=0;return e<8?n=10:e<10?n=5:e<13?n=2:e<16?n=1:n=0,n===0||t.length<10?t:this.simplifyTrackBySlope(t,n)}getFeature(){const t=[];for(const e of this.trackData.keys()){const n=this.trackData.get(e);if(n){const o=[...this.simplifyTrackByZoom(n,this.context.map.getZoom())].sort((u,f)=>u.time.getTime()-f.time.getTime()),r=o.length,a=o.map(u=>u.position.toArray()),h=o[r-1],c={id:e,startTime:o[0].time.getTime(),endTime:h.time.getTime(),count:n.length};o.forEach((u,f)=>{let v=Ui,x=.2;f===0?(v=Bi,x=.4):f===r-1&&(v=ki,x=.4),t.push(lt(u.position.toArray(),{...u,id:u.pId,icon:v,iconSize:x,isStartEnd:f===0||f===r-1,time:new Date(u.time).getTime()},{id:u.pId}))}),t.push(Et(a,c,{id:e}))}}return t}collisionTooltip(){this.collision.load(this.createCollisions()).forEach(t=>{const e=this.tooltips.find(n=>n.id===t.id);e&&(t.visible?e.setAnchor(t.dir):e.hide())})}createCollisions(){return this.tooltips.map(t=>({...t.getAllBbox(),id:t.id}))}createTooltip(){const{width:t,height:e}=this.context.map.getCanvas(),n=[[0,0],[t,e]],s=this.context.map.queryRenderedFeatures(n,{layers:[Bt]});if(s.length===0)return;const o=(r,a)=>{let h=document.getElementById(r);if(h)return h;h=document.createElement("div"),h.id=`${r}-track-name-box`,h.classList.add("track-name-box");const c=document.createElement("div");return c.innerText=a,c.classList.add("track-name"),h.appendChild(c),h};this.tooltips=s.map(r=>new ue(this.context.map,{id:r.properties.pId,position:new q.LngLat(r.geometry.coordinates[0],r.geometry.coordinates[1]),className:"mapbox-gl-track-name-tooltip",offsetX:5,offsetY:25,element:o(r.properties.pId,uo(Number(r.properties.time)).format("YYYY-MM-DD HH:mm:ss")),anchor:"bottom-right",visible:!1})),this.collisionTooltip()}removeAllTooltip(){this.tooltips.forEach(t=>{t.remove()}),this.tooltips=[],this.collision.clear()}render(){this.removeAllTooltip(),this.createTooltip(),this.context.register.setGeoJSONData(Yt,this.getFeature())}}k.AisShip=Yi,k.ArrowLine=Hl,k.BaseShip=Ne,k.CMap=Rl,k.Cache=ji,k.Collision=Be,k.CollisionItem=Zi,k.Context=ms,k.EventManager=bn,k.Fill=eu,k.FillVars=tu,k.IconManager=zt,k.IconPoint=Ci,k.IconPointVars=Yl,k.IndexLine=iu,k.IndexPoint=ho,k.IndexPointVars=$l,k.Line=Oe,k.LineVars=jl,k.Module=Nt,k.Point=pe,k.PointVars=Fl,k.Ship=su,k.ShipVars=Tl,k.Tooltip=ue,k.Track=uu,k.TrackVars=hu,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
|
|
76
19
|
//# sourceMappingURL=index.umd.js.map
|