smap-leaflet 0.0.0-stage → 2.6.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.
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./smap-leaflet.cjs");exports.BaseMeasureTool=e.BaseMeasureTool;exports.CircleMeasure=e.CircleMeasure;exports.PolygonMeasure=e.PolygonMeasure;exports.PolylineMeasure=e.PolylineMeasure;exports.RectangleMeasure=e.RectangleMeasure;
2
+ //# sourceMappingURL=measure-BV-2_Fc1.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measure-BV-2_Fc1.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { RectangleMeasure as r, CircleMeasure as o, PolygonMeasure as a, PolylineMeasure as l } from "./smap-leaflet.mjs";
2
+ import { BaseMeasureTool as M } from "./smap-leaflet.mjs";
3
+ export {
4
+ M as BaseMeasureTool,
5
+ o as CircleMeasure,
6
+ a as PolygonMeasure,
7
+ l as PolylineMeasure,
8
+ r as RectangleMeasure
9
+ };
10
+ //# sourceMappingURL=measure-DJVSnHDg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measure-DJVSnHDg.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const St=require("leaflet");require("proj4");require("proj4leaflet");function Et(i){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>i[e]})}}return t.default=i,Object.freeze(t)}const o=Et(St),W=o;W.Proj&&(o.CRS.Baidu=new W.Proj.CRS("EPSG:900913","+proj=merc +a=6378206 +b=6356584.314245179 +lat_ts=0.0 +lon_0=0.0 +x_0=0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs",{resolutions:(()=>{const t=[];t[0]=Math.pow(2,18);for(let e=1;e<19;e++)t[e]=Math.pow(2,18-e);return t})(),origin:[0,0],bounds:o.bounds([20037508342789244e-9,0],[0,20037508342789244e-9])}));const O={TianDiTu:{Normal:{Map:"https://t{s}.tianditu.gov.cn/DataServer?T=vec_w&X={x}&Y={y}&L={z}&tk={key}",Annotion:"https://t{s}.tianditu.gov.cn/DataServer?T=cva_w&X={x}&Y={y}&L={z}&tk={key}"},Satellite:{Map:"https://t{s}.tianditu.gov.cn/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk={key}",Annotion:"https://t{s}.tianditu.gov.cn/DataServer?T=cia_w&X={x}&Y={y}&L={z}&tk={key}"},Terrain:{Map:"https://t{s}.tianditu.gov.cn/DataServer?T=ter_w&X={x}&Y={y}&L={z}&tk={key}",Annotion:"https://t{s}.tianditu.gov.cn/DataServer?T=cta_w&X={x}&Y={y}&L={z}&tk={key}"},Subdomains:["0","1","2","3","4","5","6","7"]},GaoDe:{Normal:{Map:"https://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}"},Satellite:{Map:"https://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",Annotion:"https://webst0{s}.is.autonavi.com/appmaptile?style=8&x={x}&y={y}&z={z}"},Brief:{Map:"https://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}"},Subdomains:["1","2","3","4"]},Google:{Normal:{Map:"https://www.google.cn/maps/vt?lyrs=m@189&gl=cn&x={x}&y={y}&z={z}"},Satellite:{Map:"https://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}",Annotion:"https://www.google.cn/maps/vt?lyrs=y@189&gl=cn&x={x}&y={y}&z={z}"},Subdomains:[]},Geoq:{Normal:{Map:"https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}",PurplishBlue:"https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}",Gray:"https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetGray/MapServer/tile/{z}/{y}/{x}",Warm:"https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetWarm/MapServer/tile/{z}/{y}/{x}"},Theme:{Hydro:"https://thematic.geoq.cn/arcgis/rest/services/ThematicMaps/WorldHydroMap/MapServer/tile/{z}/{y}/{x}"},Subdomains:[]},OSM:{Normal:{Map:"https://{s}.tile.osm.org/{z}/{x}/{y}.png"},Subdomains:["a","b","c"]},Baidu:{Normal:{Map:"https://online{s}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&scaler=1&p=1"},Satellite:{Map:"https://shangetu{s}.map.bdimg.com/it/u=x={x};y={y};z={z};v=009;type=sate&fm=46",Annotion:"https://online{s}.map.bdimg.com/tile/?qt=tile&x={x}&y={y}&z={z}&styles=sl&v=020"},Subdomains:"0123456789".split(""),tms:!0},BaiduV3:{Normal:{Map:"https://maponline{s}.bdimg.com/tile/?qt=vtile&x={x}&y={y}&z={z}&styles=pl&scaler=2&udt=&from=jsapi3_0"},Subdomains:"012".split(""),tms:!0},Tencent:{Normal:{Map:"https://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={-y}&type=vector&styleid=3"},Satellite:{Map:"https://p{s}.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{-y}.jpg"},Terrain:{Map:"https://p{s}.map.gtimg.com/demTiles/{z}/{sx}/{sy}/{x}_{-y}.jpg"},Subdomains:"0123".split("")},Mapbox:{Satellite:{Map:"https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.webp?access_token={key}"},Subdomains:["0"]}},N={GaoDe:"gcj02",Geoq:"gcj02",Google:"gcj02",Tencent:"gcj02",Baidu:"bd09",BaiduV3:"bd09"};function st(i){return N[i]||"wgs84"}const Ot=["TianDiTu.Normal.Map","TianDiTu.Normal.Annotion","TianDiTu.Satellite.Map","TianDiTu.Satellite.Annotion","TianDiTu.Terrain.Map","TianDiTu.Terrain.Annotion","GaoDe.Normal.Map","GaoDe.Satellite.Map","GaoDe.Satellite.Annotion","GaoDe.Brief.Map","Google.Normal.Map","Google.Satellite.Map","Google.Satellite.Annotion","Geoq.Normal.Map","Geoq.Normal.PurplishBlue","Geoq.Normal.Gray","Geoq.Normal.Warm","Geoq.Theme.Hydro","OSM.Normal.Map","Baidu.Normal.Map","Baidu.Satellite.Map","Baidu.Satellite.Annotion","BaiduV3.Normal.Map","Tencent.Normal.Map","Tencent.Satellite.Map","Tencent.Terrain.Map","Mapbox.Satellite.Map"],it=["Subdomains","tms","key"];function Pt(i,t){if(!i||i.includes("."))throw new Error(`Invalid tile provider name: "${i}"`);for(const e of Object.keys(t.layers))if(e.includes(".")||it.includes(e))throw new Error(`Invalid tile group name: "${e}"`);O[i]={...t.layers,Subdomains:t.subdomains??[],...t.tms?{tms:!0}:{},...t.key?{key:t.key}:{}},t.coordType&&t.coordType!=="wgs84"?N[i]=t.coordType:delete N[i]}function Dt(){const i=[];for(const[t,e]of Object.entries(O))for(const[s,r]of Object.entries(e))if(!(it.includes(s)||typeof r!="object"||!r))for(const n of Object.keys(r))i.push(`${t}.${s}.${n}`);return i}function B(i,t={}){var d;const e=i.split("."),s=e[0],r=e[1],n=e[2],a=O[s];if(!((d=a==null?void 0:a[r])!=null&&d[n]))throw new Error(`Unknown tile provider: ${i}`);const l=a[r][n],h={subdomains:a.Subdomains||[],...t,key:t.key||a.key||"",corrdType:st(s)};a.tms&&(h.tms=!0);const c=o.TileLayer.extend({getTileUrl(p){const g={s:this._getSubdomain(p),x:p.x,y:p.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){const v=this._globalTileRange.max.y-p.y;this.options.tms&&(g.y=v),g["-y"]=v}return g.sx=g.x>>4,g.sy=(1<<g.z)-g.y>>4,o.Util.template(this._url,o.Util.extend(g,this.options))}});return new c(l,h)}const f=3.141592653589793,H=6378245,Z=.006693421622965943,S=f*3e3/180;function At(i,t){let e=-100+2*i+3*t+.2*t*t+.1*i*t+.2*Math.sqrt(Math.abs(i));return e+=(20*Math.sin(6*i*f)+20*Math.sin(2*i*f))*2/3,e+=(20*Math.sin(t*f)+40*Math.sin(t/3*f))*2/3,e+=(160*Math.sin(t/12*f)+320*Math.sin(t*f/30))*2/3,e}function zt(i,t){let e=300+i+2*t+.1*i*i+.1*i*t+.1*Math.sqrt(Math.abs(i));return e+=(20*Math.sin(6*i*f)+20*Math.sin(2*i*f))*2/3,e+=(20*Math.sin(i*f)+40*Math.sin(i/3*f))*2/3,e+=(150*Math.sin(i/12*f)+300*Math.sin(i/30*f))*2/3,e}function rt(i,t){return t<72.004||t>137.8347||i<.8293||i>55.8271}function nt(i,t){let e=At(i-105,t-35),s=zt(i-105,t-35);const r=t/180*f;let n=Math.sin(r);n=1-Z*n*n;const a=Math.sqrt(n);return e=e*180/(H*(1-Z)/(n*a)*f),s=s*180/(H/a*Math.cos(r)*f),{lat:t+e,lng:i+s}}function T(i,t){return rt(t,i)?{lng:i,lat:t}:nt(i,t)}function _(i,t){if(rt(t,i))return{lng:i,lat:t};const e=nt(i,t);return{lng:i*2-e.lng,lat:t*2-e.lat}}function G(i,t){const e=Math.sqrt(i*i+t*t)+2e-5*Math.sin(t*S),s=Math.atan2(t,i)+3e-6*Math.cos(i*S);return{lng:e*Math.cos(s)+.0065,lat:e*Math.sin(s)+.006}}function $(i,t){const e=i-.0065,s=t-.006,r=Math.sqrt(e*e+s*s)-2e-5*Math.sin(s*S),n=Math.atan2(s,e)-3e-6*Math.cos(e*S);return{lng:r*Math.cos(n),lat:r*Math.sin(n)}}function E(i,t){const e=T(i,t);return G(e.lng,e.lat)}function at(i,t){const e=$(i,t);return _(e.lng,e.lat)}const Nt={"wgs84>gcj02":T,"gcj02>wgs84":_,"gcj02>bd09":G,"bd09>gcj02":$,"wgs84>bd09":E,"bd09>wgs84":at};function ot(i,t,e,s){if(e===s)return{lng:i,lat:t};const r=Nt[`${e}>${s}`];if(!r)throw new Error(`Unsupported coordinate conversion: ${e} → ${s}`);return r(i,t)}function Bt(i,t,e){const s=JSON.parse(JSON.stringify(i));if(t===e)return s;const r=a=>{if(!Array.isArray(a))return a;if(typeof a[0]=="number"){const{lng:l,lat:h}=ot(a[0],a[1],t,e);return[l,h,...a.slice(2)]}return a.map(r)},n=a=>{var l,h;if(!(!a||typeof a!="object")){switch(a.type){case"FeatureCollection":(l=a.features)==null||l.forEach(n);break;case"Feature":n(a.geometry);break;case"GeometryCollection":(h=a.geometries)==null||h.forEach(n);break;default:a.coordinates&&(a.coordinates=r(a.coordinates))}delete a.bbox}};return n(s),s}function It(){const i=o.GridLayer.prototype;i._setZoomTransform=function(t,e,s){let r=e;r&&this.options&&(this.options.corrdType==="gcj02"?r=T(e.lng,e.lat):this.options.corrdType==="bd09"&&(r=E(e.lng,e.lat)));const n=this._map.getZoomScale(s,t.zoom),a=t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(r,s)).round();o.Browser.any3d?o.DomUtil.setTransform(t.el,a,n):o.DomUtil.setPosition(t.el,a)},i._getTiledPixelBounds=function(t){let e=t;e&&this.options&&(this.options.corrdType==="gcj02"?e=T(t.lng,t.lat):this.options.corrdType==="bd09"&&(e=E(t.lng,t.lat)));const s=this._map,r=s._animatingZoom?Math.max(s._animateToZoom,s.getZoom()):s.getZoom(),n=s.getZoomScale(r,this._tileZoom),a=s.project(e,this._tileZoom).floor(),l=s.getSize().divideBy(n*2);return new o.Bounds(a.subtract(l),a.add(l))}}function _t(){const i=o.Canvas.prototype,t=i._redraw;i._redraw=function(){if(!this._ctx){this._redrawRequest=null;return}t.call(this)}}function I(i){i.dataset.nogap||(i.dataset.nogap="1",i.style.border="none")}function Gt(i){i.querySelectorAll(".leaflet-tile").forEach(I)}function $t(){const i=o.GridLayer.prototype._initTile;o.GridLayer.prototype._initTile=function(t){i.call(this,t),t.style.border="none",t.dataset.nogap="1"}}function Rt(i){Gt(i);const t=new MutationObserver(e=>{for(const s of e)for(const r of s.addedNodes)r instanceof HTMLElement&&(r.classList.contains("leaflet-tile")?I(r):r.querySelectorAll(".leaflet-tile").forEach(I))});return t.observe(i,{childList:!0,subtree:!0}),t}function jt(i){return i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${(i/1e3).toFixed(1)}k`:String(i)}function Ut(i){const t=i<10?"s":i<100?"m":"l",e={s:32,m:38,l:46}[t];return o.divIcon({className:`smap-cluster smap-cluster--${t}`,html:`<span>${jt(i)}</span>`,iconSize:[e,e]})}class lt extends o.FeatureGroup{constructor(t,e={},s={}){super(),this.items=[],this.clusterOptions=e,this.canvas=s,this.items=this.index(t)}setPoints(t){return this.items=this.index(t),this.refresh(),this}getBounds(){return o.latLngBounds(this.items.map(t=>t.latlng))}onAdd(t){return super.onAdd(t),t.on("zoomend moveend",this.refresh,this),this.refresh(),this}onRemove(t){return t.off("zoomend moveend",this.refresh,this),super.onRemove(t)}index(t){return t.map(e=>({point:e,latlng:o.latLng(e)}))}refresh(){const t=this._map;if(!t)return;this.clearLayers();const e=t.getZoom(),s=this.clusterOptions,r=s.clusterRadius??60,n=e<(s.disableClusteringAtZoom??1/0),a=t.getBounds().pad(.2),l=new Map;this.items.forEach((h,c)=>{if(!a.contains(h.latlng))return;let d=`#${c}`;if(n){const g=t.project(h.latlng,e);d=`${Math.floor(g.x/r)}:${Math.floor(g.y/r)}`}let p=l.get(d);p||l.set(d,p={items:[],lat:0,lng:0}),p.items.push(h),p.lat+=h.latlng.lat,p.lng+=h.latlng.lng});for(const h of l.values()){const c=h.items.length;this.addLayer(c===1?this.pointMarker(h.items[0]):this.clusterMarker(h,o.latLng(h.lat/c,h.lng/c)))}}pointMarker({point:t,latlng:e}){const{style:s,tooltip:r,onClick:n}=this.clusterOptions,a=o.circleMarker(e,{radius:this.clusterOptions.radius??5,weight:1,color:"#fff",fillColor:"#1f6feb",fillOpacity:.9,interactive:!!(r||n),...typeof s=="function"?s(t,0):s,...this.canvas});return r&&a.bindTooltip(()=>r(t)),n&&a.on("click",l=>n(t,l)),a}clusterMarker(t,e){const s=o.marker(e,{icon:Ut(t.items.length),keyboard:!1});return s.on("click",r=>{const n=t.items.map(l=>l.point);if(this.clusterOptions.onClusterClick){this.clusterOptions.onClusterClick(n,r);return}const a=this._map;a.fitBounds(o.latLngBounds(t.items.map(l=>l.latlng)),{padding:[48,48],maxZoom:a.getMaxZoom()})}),s}}const Ft=[[-90,-360],[90,-360],[90,360],[-90,360]];function qt(i){const t=[],e=r=>t.push(r.map(([n,a])=>[a,n])),s=r=>{switch(r==null?void 0:r.type){case"FeatureCollection":r.features.forEach(s);break;case"Feature":s(r.geometry);break;case"GeometryCollection":r.geometries.forEach(s);break;case"Polygon":e(r.coordinates[0]);break;case"MultiPolygon":r.coordinates.forEach(n=>e(n[0]));break}};return s(i),t}class ht{constructor(t){this.registry=new Map,this.ownCanvas=null,this.listeners=[],this.map=t}onChange(t){this.listeners.push(t)}changed(){this.listeners.forEach(t=>t())}add(t,e,s={}){return this.remove(t),this.registry.set(t,e),s.visible!==!1&&e.addTo(this.map),this.changed(),e}get(t){return this.registry.get(t)}has(t){return this.registry.has(t)}ids(){return[...this.registry.keys()]}isVisible(t){const e=this.registry.get(t);return!!e&&this.map.hasLayer(e)}show(t){const e=this.registry.get(t);return e?(e.addTo(this.map),this.changed(),!0):!1}hide(t){const e=this.registry.get(t);return e?(e.remove(),this.changed(),!0):!1}toggle(t,e){return e??!this.isVisible(t)?this.show(t):(this.hide(t),!1)}remove(t){const e=this.registry.get(t);return e?(e.remove(),this.registry.delete(t),this.changed(),!0):!1}clear(){for(const t of this.registry.values())t.remove();this.registry.clear(),this.changed()}destroy(){var t;this.clear(),this.listeners=[],(t=this.ownCanvas)==null||t.remove(),this.ownCanvas=null}canvas(){return this.map.options.preferCanvas?{}:(this.ownCanvas??(this.ownCanvas=o.canvas({padding:.5})),{renderer:this.ownCanvas})}place(t,e){return e?this.add(e,t):t.addTo(this.map)}async loadWFS(t){const e=new URLSearchParams({service:"WFS",version:"1.1.0",request:"GetFeature",typeName:t.layer,outputFormat:t.outputFormat||"application/json"});for(const[n,a]of Object.entries(t))!["url","layer","style","outputFormat","id"].includes(n)&&a!=null&&e.set(n,String(a));const s=`${t.url}?${e.toString()}`,r=await fetch(s);if(!r.ok)throw new Error(`WFS request failed: ${r.status} ${r.statusText}`);return r.json()}createGeoJsonLayer(t,e){return o.geoJSON(t,{style:e?{...e,...this.canvas()}:void 0})}async addWFS(t){const e=await this.loadWFS(t);return this.place(this.createGeoJsonLayer(e,t.style),t.id)}createWMS(t){const{url:e,layer:s,id:r,...n}=t;return o.tileLayer.wms(e,{layers:s,format:n.format||"image/png",transparent:n.transparent!==!1,crs:n.crs||o.CRS.EPSG4326,...n})}addWMS(t){return this.place(this.createWMS(t),t.id)}createMask(t,e={}){const s=qt(t);if(!s.length)throw new Error("createMask() needs a GeoJSON Polygon or MultiPolygon");const n=[o.polygon([Ft,...s],{stroke:!1,fillColor:e.fillColor??"#000",fillOpacity:e.fillOpacity??.5,interactive:!1})];e.outline!==!1&&n.push(o.polyline(s.map(h=>[...h,h[0]]),{color:e.color??"#3388ff",weight:e.weight??2,interactive:!1}));const a=o.featureGroup(n),l=o.latLngBounds(s.flat());return a.getBounds=()=>l,a}addMask(t,e={}){const s=this.createMask(t,e);if(e.restrict){const r=this.map.options.maxBounds;s.once("remove",()=>this.map.setMaxBounds(r)),this.map.setMaxBounds(s.getBounds())}return this.place(s,e.id),e.fit!==!1&&this.map.fitBounds(s.getBounds()),s}createPointLayer(t,e={}){const s=this.canvas(),{style:r,tooltip:n,onClick:a}=e,l=!!(n||a),h=o.featureGroup();return t.forEach((c,d)=>{const p=o.circleMarker(o.latLng(c),{radius:e.radius??4,weight:1,color:"#fff",fillColor:"#3388ff",fillOpacity:.9,interactive:l,...typeof r=="function"?r(c,d):r,...s});n&&p.bindTooltip(()=>n(c)),a&&p.on("click",g=>a(c,g)),h.addLayer(p)}),h}addPoints(t,e={}){return this.place(this.createPointLayer(t,e),e.id)}createCluster(t,e={}){return new lt(t,e,this.canvas())}addCluster(t,e={}){return this.place(this.createCluster(t,e),e.id)}}const Wt=(i,t)=>i.length===t.length&&i.every((e,s)=>e===t[s]);class ct{constructor(t,e,s){this.controls=new Map,this.refreshLayers=null,this.refreshOverlays=null,this.map=t,this.host=e,this.layers=s,e==null||e.onTileChange(()=>{var r;return(r=this.refreshLayers)==null?void 0:r.call(this)}),s==null||s.onChange(()=>{var r;return(r=this.refreshOverlays)==null?void 0:r.call(this)})}add(t,e){this.remove(t);let s;switch(t){case"attribution":{const r=o.control.attribution({prefix:(e==null?void 0:e.prefix)??""});r.addAttribution((e==null?void 0:e.content)??'smap-leaflet &copy; <a href="https://github.com">SMap</a>'),s=r;break}case"zoom":{s=o.control.zoom({position:(e==null?void 0:e.position)??"topright",...e});break}case"scale":{s=o.control.scale({position:(e==null?void 0:e.position)??"bottomleft",...e});break}case"layers":{s=this.createLayersControl(e);break}case"overlays":{s=this.createOverlaysControl(e??{});break}default:throw new Error(`Unknown control type: ${t}`)}return s.addTo(this.map),this.controls.set(t,s),s}createLayersControl(t){var n;const e=this.host;if(!e)throw new Error('The "layers" control is only available through smap.control');if(!((n=t==null?void 0:t.options)!=null&&n.length))throw new Error('The "layers" control needs a non-empty `options` list');const s=t.options.map(a=>({label:a.label,types:Array.isArray(a.tileType)?a.tileType:[a.tileType]})),r=new o.Control({position:t.position??"topright"});return r.onAdd=()=>{const a=o.DomUtil.create("div","smap-layers leaflet-bar");a.setAttribute("role","group"),o.DomEvent.disableClickPropagation(a),o.DomEvent.disableScrollPropagation(a);const l=s.map(h=>{const c=o.DomUtil.create("button","smap-layers-item",a);return c.type="button",c.textContent=h.label,c.addEventListener("click",()=>e.setTileLayer(h.types)),c});return this.refreshLayers=()=>{const h=e.getTileType();l.forEach((c,d)=>{const p=Wt(s[d].types,h);c.classList.toggle("is-active",p),c.setAttribute("aria-pressed",String(p))})},this.refreshLayers(),a},r.onRemove=()=>{this.refreshLayers=null},r}createOverlaysControl(t){const e=this.layers;if(!e)throw new Error('The "overlays" control is only available through smap.control');const s=new o.Control({position:t.position??"topright"});return s.onAdd=()=>{const r=o.DomUtil.create("div","smap-overlays leaflet-bar");o.DomEvent.disableClickPropagation(r),o.DomEvent.disableScrollPropagation(r),t.title&&(o.DomUtil.create("div","smap-overlays-title",r).textContent=t.title);const n=o.DomUtil.create("div","smap-overlays-list",r);return this.refreshOverlays=()=>{n.textContent="";const a=t.items??e.ids().map(l=>({id:l,label:l}));for(const l of a){const h=o.DomUtil.create("label","smap-overlays-item",n),c=o.DomUtil.create("input","",h);c.type="checkbox",c.checked=e.isVisible(l.id),c.disabled=!e.has(l.id),c.addEventListener("change",()=>e.toggle(l.id,c.checked)),o.DomUtil.create("span","",h).textContent=l.label}r.classList.toggle("is-empty",!a.length)},this.refreshOverlays(),r},s.onRemove=()=>{this.refreshOverlays=null},s}remove(t){const e=this.controls.get(t);e&&(e.remove(),this.controls.delete(t))}removeAll(){for(const[,t]of this.controls)t.remove();this.controls.clear()}}const M="https://api.tianditu.gov.cn";class ut{constructor(t={}){this.context=t}async search(t,e){const s=e??t,r=e?t:this.context.map;let{level:n,mapBound:a}=s;if(r){const h=r.getBounds();n??(n=r.getZoom()),a??(a=[h.getWest(),h.getSouth(),h.getEast(),h.getNorth()].join(","))}if(n==null||!a)throw new Error("search() needs a map, or both `level` and `mapBound`");const l=JSON.stringify({level:n,mapBound:a,queryType:s.queryType??1,start:s.start??0,count:s.count??10,keyWord:s.keyword});return this.request(`${M}/v2/search`,{postStr:l,type:"query",tk:this.resolveKey(s.tk)})}async geocode(t){const{tk:e,...s}=t;return this.request(`${M}/geocoder`,{ds:JSON.stringify(s),tk:this.resolveKey(e)})}async reverseGeocode(t){const{tk:e,...s}=t;return this.request(`${M}/geocoder`,{type:"geocode",postStr:JSON.stringify({...s,ver:s.ver??1}),tk:this.resolveKey(e)})}async getAdministrative(t){const e=t.keyword??t.searchWord;if(!e)throw new Error("getAdministrative() needs a `keyword`");return this.request(`${M}/v2/administrative`,{keyword:e,childLevel:String(t.childLevel??0),extensions:String(t.extensions??!1),tk:this.resolveKey(t.tk)})}async getLocationByIp(){const t=await fetch("https://map.tianditu.gov.cn/data/getCityName");if(!t.ok)throw new Error(`IP location request failed: ${t.status}`);return t.json()}resolveKey(t){const e=this.context.key,s=t||(typeof e=="function"?e():e);if(!s)throw new Error("TianDiTu key is missing: pass `tk`, or set `tdtKey` on the map");return s}async request(t,e){const s=new URLSearchParams(e),r=`${t}?${s.toString()}`,n=await fetch(r);if(!n.ok)throw new Error(`API request failed: ${n.status} ${n.statusText}`);return n.json()}}class dt{constructor(t){this.mapItems=null,this.bound=new Map,this.el=null,this.onPointerDown=e=>{this.el&&!this.el.contains(e.target)&&this.hide()},this.onKeyDown=e=>{e.key==="Escape"&&this.hide()},this.map=t,this.map.on("click movestart zoomstart resize",this.hide,this),document.addEventListener("pointerdown",this.onPointerDown,!0),document.addEventListener("keydown",this.onKeyDown)}setItems(t){this.map.off("contextmenu",this.onMapContextMenu,this),this.mapItems=t,t&&this.map.on("contextmenu",this.onMapContextMenu,this)}bind(t,e){this.unbind(t);const s=r=>{var n;o.DomEvent.stopPropagation(r),(n=r.originalEvent)==null||n.preventDefault(),this.open(e,{latlng:r.latlng,containerPoint:r.containerPoint,layer:t})};return t.on("contextmenu",s),this.bound.set(t,s),()=>this.unbind(t)}unbind(t){const e=this.bound.get(t);e&&(t.off("contextmenu",e),this.bound.delete(t))}hide(){var t;(t=this.el)==null||t.remove(),this.el=null}destroy(){this.hide(),this.setItems(null);for(const t of[...this.bound.keys()])this.unbind(t);this.map.off("click movestart zoomstart resize",this.hide,this),document.removeEventListener("pointerdown",this.onPointerDown,!0),document.removeEventListener("keydown",this.onKeyDown)}onMapContextMenu(t){this.mapItems&&this.open(this.mapItems,{latlng:t.latlng,containerPoint:t.containerPoint})}open(t,e){this.hide();const s={...e,map:this.map},r=typeof t=="function"?t(s):t;if(!r.length)return;const n=o.DomUtil.create("div","smap-contextmenu");n.setAttribute("role","menu"),o.DomEvent.disableClickPropagation(n),o.DomEvent.disableScrollPropagation(n),n.addEventListener("contextmenu",c=>c.preventDefault()),r.forEach(c=>n.appendChild(this.renderItem(c,s)));const a=this.map.getContainer();a.appendChild(n),this.el=n;const l=Math.max(0,Math.min(e.containerPoint.x,a.clientWidth-n.offsetWidth)),h=Math.max(0,Math.min(e.containerPoint.y,a.clientHeight-n.offsetHeight));n.style.left=`${l}px`,n.style.top=`${h}px`}renderItem(t,e){if(t==="-"){const r=o.DomUtil.create("div","smap-contextmenu-separator");return r.setAttribute("role","separator"),r}const s=o.DomUtil.create("button","smap-contextmenu-item");return s.type="button",s.setAttribute("role","menuitem"),s.textContent=t.text,s.disabled=!!t.disabled,t.danger&&s.classList.add("is-danger"),s.addEventListener("click",()=>{var r;this.hide(),(r=t.onClick)==null||r.call(t,e)}),s}}const Ht={timeout:3e3,enableHighAccuracy:!1};function pt(i){const{timeout:t,enableHighAccuracy:e}={...Ht,...i};return new Promise((s,r)=>{if(!navigator.geolocation){r(new Error("浏览器不支持 HTML5 定位"));return}let n=-1;n=navigator.geolocation.watchPosition(a=>{navigator.geolocation.clearWatch(n);const{latitude:l,longitude:h,accuracy:c}=a.coords;s({latitude:l,longitude:h,accuracy:c})},a=>{navigator.geolocation.clearWatch(n);const l={[a.PERMISSION_DENIED]:"定位权限被拒绝",[a.POSITION_UNAVAILABLE]:"位置信息不可用",[a.TIMEOUT]:"定位超时"};r(new Error(l[a.code]||"定位未知错误"))},{enableHighAccuracy:e,timeout:t,maximumAge:0})})}function K(i){const t=e=>new Promise((s,r)=>{const n=new Image;n.crossOrigin="anonymous",n.onload=()=>s(n),n.onerror=()=>r(new Error(i)),n.src=e});return t(i).catch(()=>t(`${i}${i.includes("?")?"&":"?"}_cors=${Date.now()}`))}function Zt(i){try{return new URL(i).host}catch{return i}}const Kt=[".smap-measure-label",".smap-cluster",".smap-draw-marker"],Vt=".smap-measure-remove";function V(i){return!i||i==="transparent"||/,\s*0\)$|\/\s*0\)$/.test(i)}function J(i,t,e,s,r,n){const a=Math.max(0,Math.min(n,s/2,r/2));i.beginPath(),i.moveTo(t+a,e),i.arcTo(t+s,e,t+s,e+r,a),i.arcTo(t+s,e+r,t,e+r,a),i.arcTo(t,e+r,t,e,a),i.arcTo(t,e,t+s,e,a),i.closePath()}function mt(i,t,e){var l;const s=getComputedStyle(t);if(s.display==="none"||s.visibility==="hidden"||Number(s.opacity)===0)return;const r=t.getBoundingClientRect(),n=r.left-e.left,a=r.top-e.top;if(r.width>0&&r.height>0){const h=s.borderTopLeftRadius,c=h.endsWith("%")?Math.min(r.width,r.height)*parseFloat(h)/100:parseFloat(h)||0;V(s.backgroundColor)||(J(i,n,a,r.width,r.height,c),i.fillStyle=s.backgroundColor,i.fill());const d=parseFloat(s.borderTopWidth)||0;d>0&&s.borderTopStyle!=="none"&&!V(s.borderTopColor)&&(J(i,n+d/2,a+d/2,r.width-d,r.height-d,c-d/2),i.lineWidth=d,i.strokeStyle=s.borderTopColor,i.stroke())}for(const h of t.childNodes)if(h.nodeType===Node.TEXT_NODE){const c=(l=h.textContent)==null?void 0:l.trim();if(!c)continue;const d=document.createRange();d.selectNodeContents(h);const p=d.getBoundingClientRect();i.font=`${s.fontStyle} ${s.fontWeight} ${s.fontSize} ${s.fontFamily}`,i.fillStyle=s.color,i.textAlign="center",i.textBaseline="middle",i.fillText(c,p.left-e.left+p.width/2,p.top-e.top+p.height/2)}else h instanceof Element&&!h.matches(Vt)&&mt(i,h,e)}function Jt(i,t){const e=[];return i.eachLayer(s=>{s instanceof o.GridLayer&&s.isLoading()&&e.push(new Promise(r=>s.once("load",()=>r())))}),e.length?Promise.race([Promise.all(e).then(()=>{}),new Promise(s=>setTimeout(s,t))]):Promise.resolve()}function Yt(i,t){for(let e=i;e&&e!==t;e=e.parentElement){const s=Number(e.style.zIndex);if(s)return s}return 0}async function Xt(i,t={}){var v;await Jt(i,t.timeout??8e3);const e=i.getContainer(),s=e.getBoundingClientRect(),r=i.getSize(),n=t.scale??Math.min(window.devicePixelRatio||1,2),a=document.createElement("canvas");a.width=Math.round(r.x*n),a.height=Math.round(r.y*n);const l=a.getContext("2d");if(!l)throw new Error("Canvas is not available in this environment");l.scale(n,n),l.fillStyle=t.background??"#ffffff",l.fillRect(0,0,r.x,r.y);const h=u=>{const m=u.getBoundingClientRect();return{x:m.left-s.left,y:m.top-s.top,w:m.width,h:m.height}},c=u=>u.w>0&&u.h>0&&u.x<r.x&&u.y<r.y&&u.x+u.w>0&&u.y+u.h>0,d=[...e.querySelectorAll("img.leaflet-tile-loaded")].map((u,m)=>({img:u,order:m,box:h(u),z:Yt(u,e)})).filter(u=>c(u.box)).sort((u,m)=>u.z-m.z||u.order-m.order),p=await Promise.all(d.map(u=>K(u.img.src).catch(()=>{throw new Error(`Cannot export the map: tiles from ${Zt(u.img.src)} do not allow cross-origin reading`)})));d.forEach(({img:u,box:m},w)=>{const b=u.closest(".leaflet-layer");l.globalAlpha=Number((b==null?void 0:b.style.opacity)||1),l.drawImage(p[w],m.x,m.y,m.w,m.h)}),l.globalAlpha=1,i.eachLayer(u=>{const m=u;u instanceof o.Canvas&&m._redrawRequest&&m._redraw()});for(const u of e.querySelectorAll(".leaflet-pane > canvas, .leaflet-pane > svg")){const m=h(u);if(c(m))if(u instanceof HTMLCanvasElement)l.drawImage(u,m.x,m.y,m.w,m.h);else{const w=new XMLSerializer().serializeToString(u),b=URL.createObjectURL(new Blob([w],{type:"image/svg+xml"}));try{l.drawImage(await K(b),m.x,m.y,m.w,m.h)}finally{URL.revokeObjectURL(b)}}}const g=[...t.labels===!1?[]:Kt,...t.include??[]];if(g.length)for(const u of e.querySelectorAll(g.join(",")))(v=u.parentElement)!=null&&v.closest(g.join(","))||c(h(u))&&mt(l,u,s);return new Promise((u,m)=>{a.toBlob(w=>w?u(w):m(new Error("Failed to encode the image")),t.type??"image/png",t.quality)})}function Qt(i,t){const e=URL.createObjectURL(i),s=document.createElement("a");s.href=e,s.download=t,s.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)}const Y=6378137,z=Math.PI/180;function gt(i){const t=i.length;if(t<3)return 0;let e=0;for(let s=0;s<t;s++){const r=i[s],n=i[(s+1)%t];e+=(n.lng-r.lng)*z*(2+Math.sin(r.lat*z)+Math.sin(n.lat*z))}return Math.abs(e*Y*Y/2)}function R(i){let t=0;for(let e=1;e<i.length;e++)t+=i[e-1].distanceTo(i[e]);return t}const te=2e3/3;function j(i,t="auto"){return t==="km"||t==="auto"&&i>=1e3?`${(i/1e3).toFixed(2)} km`:`${i.toFixed(1)} m`}function ft(i,t="auto"){switch(t){case"ha":return`${(i/1e4).toFixed(2)} 公顷`;case"mu":return`${(i/te).toFixed(2)} 亩`;case"km2":return`${(i/1e6).toFixed(2)} km²`;case"m2":return`${i.toFixed(1)} m²`;default:return i>=1e6?`${(i/1e6).toFixed(2)} km²`:`${i.toFixed(1)} m²`}}const y={marker:{start:"单击地图放置标记"},polyline:{start:"单击开始绘制线",next:"单击继续绘制",finish:"再次单击最后一个点完成"},polygon:{start:"单击开始绘制多边形",next:"单击继续绘制",finish:"单击第一个点闭合"},rectangle:{start:"按住拖动绘制矩形,或单击确定第一个角",finish:"松开完成,或再次单击确定对角"},circle:{start:"按住拖动绘制圆,或单击确定圆心",finish:"松开完成,或再次单击确定半径",radius:"半径"},tooFewPoints:"至少需要 {n} 个点",cancel:"按 Esc 取消",edit:"拖动圆点调整形状;单击顶点可删除"},ee=8,se=6;function U(i="vertex"){return o.divIcon({className:`smap-vertex smap-vertex--${i}`,iconSize:[14,14],iconAnchor:[7,7]})}class F{constructor(t){this.snapMark=null,this.host=t,this.map=t.map,this.scratch=o.featureGroup()}enable(){this.scratch.addTo(this.map),this.map.getContainer().classList.add("smap-drawing"),this.map.on("mousemove",this.trackHint,this),this.start()}disable(){this.stop(),this.map.off("mousemove",this.trackHint,this),this.map.getContainer().classList.remove("smap-drawing"),this.scratch.remove()}get shape(){return this.host.options.shapeOptions??{}}get ghost(){return{...this.shape,dashArray:"4 6",opacity:.75,interactive:!1}}resolve(t){var s,r;const e=((r=(s=this.host.options).snap)==null?void 0:r.call(s,t.latlng))??t.latlng;return this.markSnap(e!==t.latlng?e:null),e}markSnap(t){var e;t?this.snapMark?this.snapMark.setLatLng(t):this.snapMark=o.marker(t,{icon:U("snap"),interactive:!1,keyboard:!1}).addTo(this.scratch):((e=this.snapMark)==null||e.remove(),this.snapMark=null)}trackHint(t){this.host.hint.move(t.containerPoint),this.host.options.snap&&this.resolve(t)}}class ie extends F{start(){this.host.hint.set(y.marker.start,y.cancel),this.map.on("click",this.onClick,this)}stop(){this.map.off("click",this.onClick,this)}onClick(t){const e=this.host.options.markerIcon;this.host.finish(o.marker(this.resolve(t),e?{icon:e}:{}))}}class X extends F{constructor(t,e){super(t),this.points=[],this.fill=null,this.handles=o.layerGroup(),this.hadDoubleClickZoom=!1,this.onKey=s=>{s.key==="Enter"?this.tryFinish():s.key==="Backspace"&&this.undo()},this.closed=e}get text(){return this.closed?y.polygon:y.polyline}get min(){return this.closed?3:2}start(){this.line=o.polyline([],{...this.shape,fill:!1,interactive:!1}),this.guide=o.polyline([],{...this.ghost,fill:!1}),this.scratch.addLayer(this.line).addLayer(this.guide).addLayer(this.handles),this.closed&&(this.fill=o.polygon([],{...this.shape,stroke:!1,interactive:!1}),this.scratch.addLayer(this.fill)),this.hadDoubleClickZoom=this.map.doubleClickZoom.enabled(),this.map.doubleClickZoom.disable(),this.map.on("click",this.onClick,this),this.map.on("mousemove",this.onMove,this),document.addEventListener("keydown",this.onKey),this.host.hint.set(this.text.start,y.cancel)}stop(){this.map.off("click",this.onClick,this),this.map.off("mousemove",this.onMove,this),document.removeEventListener("keydown",this.onKey),this.hadDoubleClickZoom&&this.map.doubleClickZoom.enable()}near(t,e){return this.map.latLngToContainerPoint(e).distanceTo(t)<=ee}onClick(t){const{points:e}=this,s=this.resolve(t),r=n=>this.near(t.containerPoint,n)||s.equals(n);if(e.length){if(r(e[e.length-1]))return this.tryFinish();if(this.closed&&r(e[0]))return this.tryFinish()}this.add(s)}add(t){this.points.push(t),this.redraw(),this.host.vertex([...this.points])}undo(){this.points.length&&(this.points.pop(),this.guide.setLatLngs([]),this.redraw(),this.host.vertex([...this.points]))}tryFinish(){if(this.points.length<this.min){this.host.hint.set(y.tooFewPoints.replace("{n}",String(this.min)),"",!0);return}const t={...this.shape};this.host.finish(this.closed?o.polygon(this.points,t):o.polyline(this.points,t))}redraw(){const{points:t}=this;this.line.setLatLngs(t),this.handles.clearLayers();const e=this.host.options.vertexIcon??U();t.forEach((s,r)=>{const n=r===0,a=r===t.length-1,l=o.marker(s,{icon:e,interactive:a||this.closed&&n,keyboard:!1});(a||this.closed&&n)&&l.on("click",()=>this.tryFinish()),this.handles.addLayer(l)}),t.length?t.length<this.min?this.host.hint.set(this.text.next,y.cancel):this.host.hint.set(this.text.next,this.text.finish):this.host.hint.set(this.text.start,y.cancel)}onMove(t){var n;const{points:e}=this;if(!e.length)return;const s=e[e.length-1],r=this.resolve(t);this.guide.setLatLngs(this.closed&&e.length>1?[s,r,e[0]]:[s,r]),(n=this.fill)==null||n.setLatLngs([...e,r])}}class yt extends F{constructor(){super(...arguments),this.origin=null,this.originPoint=null,this.pressing=!1,this.dragged=!1,this.armed=!1,this.hadDragging=!1}start(){this.hadDragging=this.map.dragging.enabled(),this.map.dragging.disable(),this.map.on("mousedown",this.onDown,this),this.map.on("mousemove",this.onMove,this),this.map.on("mouseup",this.onUp,this),this.map.on("click",this.onClick,this),this.host.hint.set(this.text.start,y.cancel)}stop(){this.map.off("mousedown",this.onDown,this),this.map.off("mousemove",this.onMove,this),this.map.off("mouseup",this.onUp,this),this.map.off("click",this.onClick,this),this.hadDragging&&this.map.dragging.enable()}setOrigin(t){this.origin=this.resolve(t),this.originPoint=t.containerPoint,this.begin(this.origin),this.host.hint.set(this.text.finish,y.cancel)}onDown(t){this.origin||(this.setOrigin(t),this.pressing=!0,this.dragged=!1)}onMove(t){this.origin&&(this.update(this.origin,this.resolve(t)),this.pressing&&this.originPoint.distanceTo(t.containerPoint)>se&&(this.dragged=!0))}onUp(t){const e=this.pressing&&this.dragged;this.pressing=!1,e&&this.complete(this.resolve(t))}onClick(t){this.origin?this.armed?this.complete(this.resolve(t)):this.armed=!0:(this.setOrigin(t),this.armed=!0)}complete(t){const e=this.build(this.origin,t);e&&this.host.finish(e)}}class re extends yt{constructor(){super(...arguments),this.preview=null}get text(){return y.rectangle}begin(t){this.preview=o.rectangle(o.latLngBounds(t,t),{...this.shape,interactive:!1}),this.scratch.addLayer(this.preview)}update(t,e){var s;(s=this.preview)==null||s.setBounds(o.latLngBounds(t,e))}build(t,e){return t.lat===e.lat||t.lng===e.lng?null:o.rectangle(o.latLngBounds(t,e),{...this.shape})}}class ne extends yt{constructor(){super(...arguments),this.preview=null}get text(){return y.circle}begin(t){this.preview=o.circle(t,{...this.shape,radius:0,interactive:!1}),this.scratch.addLayer(this.preview)}update(t,e){var r;const s=t.distanceTo(e);(r=this.preview)==null||r.setRadius(s),this.host.hint.set(this.text.finish,`${y.circle.radius} ${j(s)}`)}build(t,e){const s=t.distanceTo(e);return s>0?o.circle(t,{...this.shape,radius:s}):null}}function ae(i,t){switch(i){case"marker":return new ie(t);case"polyline":return new X(t,!1);case"polygon":return new X(t,!0);case"rectangle":return new re(t);case"circle":return new ne(t);default:throw new Error(`Unknown draw type: ${i}`)}}class oe{constructor(t){this.el=o.DomUtil.create("div","smap-draw-hint",t.getContainer()),this.main=o.DomUtil.create("div","smap-draw-hint-main",this.el),this.sub=o.DomUtil.create("div","smap-draw-hint-sub",this.el),this.el.style.display="none"}set(t,e="",s=!1){this.main.textContent=t,this.sub.textContent=e,this.sub.style.display=e?"":"none",this.el.classList.toggle("is-error",s)}move(t){this.el.style.display="",this.el.style.transform=`translate(${Math.round(t.x)+16}px, ${Math.round(t.y)+16}px)`}remove(){this.el.remove()}}const P="#1f6feb";function vt(i,t){i.getContainer().style.setProperty("--smap-accent",t||P)}function k(){return Promise.resolve()}const x=new WeakMap;class wt{constructor(t,e){this.drawer=null,this.hint=null,this.type=null,this.onKey=s=>{s.key==="Escape"&&this.cancel()},this.map=t,this.hooks=e}get active(){return this.type}start(t,e,s){var n;(n=x.get(this.map))==null||n.cancel(),vt(this.map,s);const r=new oe(this.map);this.hint=r,this.type=t,this.drawer=ae(t,{map:this.map,options:e,hint:r,finish:a=>this.end(!0,a),vertex:a=>{var l,h;return(h=(l=this.hooks).vertex)==null?void 0:h.call(l,a,t)}}),x.set(this.map,this),document.addEventListener("keydown",this.onKey),this.drawer.enable()}cancel(){this.end(!1)}destroy(){this.cancel()}end(t,e){var n;const{type:s,drawer:r}=this;!s||!r||(this.type=null,this.drawer=null,r.disable(),(n=this.hint)==null||n.remove(),this.hint=null,document.removeEventListener("keydown",this.onKey),x.get(this.map)===this&&x.delete(this.map),t&&e&&this.hooks.created(e,s),this.hooks.stop(s,t))}}function le(i){return{all:i=i||new Map,on:function(t,e){var s=i.get(t);s?s.push(e):i.set(t,[e])},off:function(t,e){var s=i.get(t);s&&(e?s.splice(s.indexOf(e)>>>0,1):i.set(t,[]))},emit:function(t,e){var s=i.get(t);s&&s.slice().map(function(r){r(e)}),(s=i.get("*"))&&s.slice().map(function(r){r(t,e)})}}}function q(){return le()}let Q=!1;function he(){Q||(It(),$t(),_t(),Q=!0)}class ce{constructor(t,e={}){this.tileLayers=[],this.tileTypes=[],this.tileChangeHandlers=[],this.drawTools=new Set,this.locationLayer=null,this.measureTools=new Set,this.sharedMeasures=new Map,this.emitter=q(),this.tileObserver=null,this.destroyed=!1,he(),this.options=e;const s=typeof t=="string"&&t.startsWith("#")?t.slice(1):t,{tileType:r,tdtKey:n,mapboxToken:a,container:l,...h}=e;this.instance=o.map(s,{attributionControl:!1,zoomControl:!1,center:e.center,zoom:e.zoom??12,minZoom:e.minZoom,maxZoom:e.maxZoom,maxNativeZoom:e.maxNativeZoom,preferCanvas:e.preferCanvas??!0,...h}),this.layer=new ht(this.instance),this.control=new ct(this.instance,{setTileLayer:c=>this.setTileLayer(c),getTileType:()=>this.getTileType(),onTileChange:c=>this.tileChangeHandlers.push(c)},this.layer),this.contextMenu=new dt(this.instance),this.service=new ut({map:this.instance,key:()=>this.options.tdtKey}),r&&this.setTileLayer(r),this.tileObserver=Rt(this.instance.getContainer()),queueMicrotask(()=>{this.destroyed||(this.emitter.emit("loaded",this.instance),this.tileLayers.length&&this.emitter.emit("tileLoaded",this.tileLayers))})}setTileLayer(t){const e=Array.isArray(t)?t:[t],s=e.map((r,n)=>B(r,{...this.resolveKey(r),zIndex:n}));return this.tileLayers.forEach(r=>r.remove()),s.forEach(r=>r.addTo(this.instance)),this.tileLayers=s,this.tileTypes=[...e],this.notifyTileChange(),this.emitter.emit("tileLoaded",this.tileLayers),this.tileLayers}addTileLayer(t){const e=Array.isArray(t)?t:[t],s=e.map((r,n)=>B(r,{...this.resolveKey(r),zIndex:this.tileLayers.length+n}));return s.forEach(r=>r.addTo(this.instance)),this.tileLayers.push(...s),this.tileTypes.push(...e),this.notifyTileChange(),s}notifyTileChange(){this.tileChangeHandlers.forEach(t=>t())}resolveKey(t){const e=t.split(".")[0],s=e==="Mapbox"?this.options.mapboxToken:e==="TianDiTu"?this.options.tdtKey:void 0;return s?{key:s}:{}}clearTileLayers(){this.tileLayers.forEach(t=>t.remove()),this.tileLayers=[],this.tileTypes=[],this.notifyTileChange()}getTileType(){return[...this.tileTypes]}getTileLayers(){return[...this.tileLayers]}async createMeasure(t,e){await k();const s=await Promise.resolve().then(()=>require("./measure-BV-2_Fc1.cjs")),r={polyline:s.PolylineMeasure,polygon:s.PolygonMeasure,circle:s.CircleMeasure,rectangle:s.RectangleMeasure}[t];if(!r)throw new Error(`Unknown measure type: ${t}`);const n=new r(this.instance,e);return n.on("start",a=>this.emitter.emit("measure:start",a)),n.on("stop",a=>this.emitter.emit("measure:stop",a)),n.on("created",a=>this.emitter.emit("measure:created",a)),n.on("removed",a=>this.emitter.emit("measure:removed",a)),n.on("updating",a=>this.emitter.emit("measure:updating",a)),n.on("updated",a=>this.emitter.emit("measure:updated",a)),n.on("destroyed",()=>this.measureTools.delete(n)),this.measureTools.add(n),n}getMeasure(t,e){let s=this.sharedMeasures.get(t);return s||(s=this.createMeasure(t,e).then(r=>(r.on("destroyed",()=>this.sharedMeasures.delete(t)),r)),s.catch(()=>this.sharedMeasures.delete(t)),this.sharedMeasures.set(t,s)),s}clearMeasures(){for(const t of[...this.measureTools])t.destroy();this.measureTools.clear(),this.sharedMeasures.clear()}async createDraw(t){await k();const{DrawTool:e}=await Promise.resolve().then(()=>be),s=new e(this.instance,t);return this.drawTools.add(s),s}async locate(t={}){const e=await pt(t),s=o.latLng(e.latitude,e.longitude);return this.destroyed?{...e,latlng:s}:(this.clearLocation(),t.marker!==!1&&(this.locationLayer=o.featureGroup([o.circle(s,{radius:e.accuracy,weight:1,color:"#2a7fff",fillOpacity:.12,interactive:!1}),o.circleMarker(s,{radius:6,weight:2,color:"#fff",fillColor:"#2a7fff",fillOpacity:1,interactive:!1})]).addTo(this.instance)),t.setView!==!1&&this.instance.setView(s,t.zoom??Math.max(this.instance.getZoom(),16)),{...e,latlng:s})}clearLocation(){var t;(t=this.locationLayer)==null||t.remove(),this.locationLayer=null}exportImage(t){return Xt(this.instance,t)}async downloadImage(t="map.png",e){Qt(await this.exportImage(e),t)}fitToLayer(t){"getBounds"in t&&typeof t.getBounds=="function"&&this.instance.fitBounds(t.getBounds())}setView(t,e){this.instance.setView(t,e)}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}destroy(){var t;this.destroyed||(this.destroyed=!0,this.clearMeasures(),this.drawTools.forEach(e=>e.destroy()),this.drawTools.clear(),this.clearLocation(),this.contextMenu.destroy(),this.layer.destroy(),this.tileChangeHandlers=[],this.control.removeAll(),this.clearTileLayers(),this.emitter.all.clear(),(t=this.tileObserver)==null||t.disconnect(),this.tileObserver=null,this.instance.stop(),this.instance.eachLayer(e=>{e instanceof o.Renderer||e.remove()}),this.instance.remove())}}const tt=new Set,et=new Set;function ue(i){return tt.has(i)?Promise.resolve():new Promise((t,e)=>{const s=document.createElement("script");s.type="text/javascript",s.src=i,s.onload=()=>{tt.add(i),t()},s.onerror=()=>e(new Error(`Failed to load script: ${i}`)),document.head.appendChild(s)})}function de(i){if(et.has(i))return;const t=document.createElement("link");t.type="text/css",t.rel="stylesheet",t.href=i,document.head.appendChild(t),et.add(i)}function L(i,t){return o.marker(i,{icon:U(t),draggable:!0,keyboard:!1,zIndexOffset:1e3})}class D{constructor(t){this.changed=!1,this.onChange=null,this.onBegin=null,this.snap=null,this.handles=o.layerGroup(),this.enabled=!1,this.map=t}enable(){this.initial=this.capture(),this.enabled=!0,this.handles.addTo(this.map),this.build()}disable(){this.enabled=!1,this.handles.remove(),this.handles.clearLayers(),this.cleanup()}revert(){this.restore(this.initial)}cleanup(){}refresh(){this.enabled&&(this.handles.clearLayers(),this.build())}begin(){var t;(t=this.onBegin)==null||t.call(this)}touch(){var t;this.changed=!0,(t=this.onChange)==null||t.call(this)}position(t){const e=t.getLatLng(),s=this.snap?this.snap(e):e;return s!==e&&t.setLatLng(s),s}}class pe extends D{constructor(t,e){super(t),this.wasDraggable=!1,this.layer=e}capture(){return this.layer.getLatLng()}restore(t){this.layer.setLatLng(t)}build(){var e;const{dragging:t}=this.layer;this.wasDraggable=!!(t!=null&&t.enabled()),t==null||t.enable(),this.layer.on("dragstart",this.begin,this),this.layer.on("drag dragend",this.touch,this),(e=this.layer.getElement())==null||e.classList.add("smap-marker-editing")}cleanup(){var t,e;this.wasDraggable||(t=this.layer.dragging)==null||t.disable(),this.layer.off("dragstart",this.begin,this),this.layer.off("drag dragend",this.touch,this),(e=this.layer.getElement())==null||e.classList.remove("smap-marker-editing")}}function C(i){return Array.isArray(i)?i.map(C):o.latLng(i.lat,i.lng)}function bt(i){return Array.isArray(i[0])?i.flatMap(bt):[i]}class me extends D{constructor(t,e){super(t),this.layer=e,this.closed=e instanceof o.Polygon,this.current=C(e.getLatLngs()),this.originalDash=e.options.dashArray}get min(){return this.closed?3:2}capture(){return C(this.current)}restore(t){this.current=C(t),this.layer.setLatLngs(this.current),this.refresh()}apply(){this.layer.setLatLngs(this.current),this.touch()}enable(){super.enable(),this.layer.setStyle({dashArray:"6 6"})}cleanup(){this.layer.setStyle({dashArray:this.originalDash})}build(){for(const t of bt(this.current)){t.forEach((s,r)=>this.addVertex(t,r,s));const e=this.closed?t.length:t.length-1;for(let s=0;s<e;s++)this.addMidpoint(t,s)}}addVertex(t,e,s){const r=L(s,"vertex");let n=!1;r.on("dragstart",()=>{n=!0,this.begin()}),r.on("drag",()=>{t[e]=this.position(r),this.apply()}),r.on("dragend",()=>this.refresh()),r.on("click",()=>{if(n)return void(n=!1);t.length<=this.min||(this.begin(),t.splice(e,1),this.apply(),this.refresh())}),this.handles.addLayer(r)}addMidpoint(t,e){const s=t[e],r=t[(e+1)%t.length],n=L([(s.lat+r.lat)/2,(s.lng+r.lng)/2],"mid");n.on("dragstart",()=>{this.begin(),t.splice(e+1,0,n.getLatLng())}),n.on("drag",()=>{t[e+1]=this.position(n),this.apply()}),n.on("dragend",()=>this.refresh()),this.handles.addLayer(n)}}class ge extends D{constructor(t,e){super(t),this.layer=e}capture(){const t=this.layer.getBounds();return o.latLngBounds(t.getSouthWest(),t.getNorthEast())}restore(t){this.layer.setBounds(t),this.refresh()}build(){const t=this.layer.getBounds(),e=[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()];e.forEach((r,n)=>{const a=e[(n+2)%4],l=L(r,"resize");l.on("dragstart",this.begin,this),l.on("drag",()=>{this.layer.setBounds(o.latLngBounds(this.position(l),a)),this.touch()}),l.on("dragend",()=>this.refresh()),this.handles.addLayer(l)});const s=L(t.getCenter(),"move");s.on("dragstart",this.begin,this),s.on("drag",()=>{const r=this.layer.getBounds().getCenter(),n=s.getLatLng(),a=n.lat-r.lat,l=n.lng-r.lng,h=this.layer.getBounds();this.layer.setBounds(o.latLngBounds([h.getSouth()+a,h.getWest()+l],[h.getNorth()+a,h.getEast()+l])),this.touch()}),s.on("dragend",()=>this.refresh()),this.handles.addLayer(s)}}class fe extends D{constructor(t,e){super(t),this.layer=e}capture(){return{center:this.layer.getLatLng(),radius:this.layer.getRadius()}}restore(t){const{center:e,radius:s}=t;this.layer.setLatLng(e),this.layer.setRadius(s),this.refresh()}edge(){const t=this.layer.getLatLng();return o.latLng(t.lat,this.layer.getBounds().getEast())}build(){const t=L(this.layer.getLatLng(),"move"),e=L(this.edge(),"resize");t.on("dragstart",this.begin,this),t.on("drag",()=>{this.layer.setLatLng(this.position(t)),e.setLatLng(this.edge()),this.touch()}),e.on("dragstart",this.begin,this),e.on("drag",()=>{this.layer.setRadius(this.layer.getLatLng().distanceTo(this.position(e))),this.touch()}),e.on("dragend",()=>e.setLatLng(this.edge())),this.handles.addLayer(t).addLayer(e)}}function ye(i,t){return t instanceof o.Rectangle?new ge(i,t):t instanceof o.Polyline?new me(i,t):t instanceof o.Circle?new fe(i,t):t instanceof o.Marker?new pe(i,t):null}class Lt{constructor(t,e,s={}){this.editors=new Map,this.history=[],this.onKey=n=>{var l;if(n.key.toLowerCase()!=="z"||!(n.ctrlKey||n.metaKey)||n.shiftKey)return;const a=n.target;(l=a==null?void 0:a.closest)!=null&&l.call(a,"input, textarea, [contenteditable]")||this.undo()&&n.preventDefault()},this.map=t,this.onChange=s.onChange;const{snap:r}=s;for(const n of e){const a=ye(t,n);a&&(a.onChange=()=>{var l;return(l=this.onChange)==null?void 0:l.call(this,n)},a.onBegin=()=>this.history.push({editor:a,layer:n,state:a.capture()}),r&&(a.snap=l=>r(l,n)),this.editors.set(n,a))}}enable(){this.map.getContainer().classList.add("smap-editing"),this.editors.forEach(t=>t.enable()),document.addEventListener("keydown",this.onKey)}changed(){return[...this.editors].filter(([,t])=>t.changed).map(([t])=>t)}get canUndo(){return this.history.length>0}undo(){var e;const t=this.history.pop();return t?(t.editor.restore(t.state),t.editor.changed=this.history.some(s=>s.editor===t.editor),(e=this.onChange)==null||e.call(this,t.layer),!0):!1}revert(){this.editors.forEach(t=>{t.changed&&t.revert()}),this.history=[]}disable(){document.removeEventListener("keydown",this.onKey),this.editors.forEach(t=>t.disable()),this.map.getContainer().classList.remove("smap-editing")}}function Tt(i,t,e){if(i!==t)if(i instanceof o.Polyline){const s=i instanceof o.Polygon,r=n=>{if(Array.isArray(n[0]))return n.forEach(r);const a=n;e.vertices.push(...a),e.paths.push(s&&a.length?[...a,a[0]]:a)};r(i.getLatLngs())}else i instanceof o.CircleMarker||i instanceof o.Marker?e.vertices.push(i.getLatLng()):i instanceof o.LayerGroup&&i.eachLayer(s=>Tt(s,t,e))}function kt(i,t,e=12){return(s,r)=>{const n={vertices:[],paths:[]};for(const d of t())Tt(d,r,n);const a=i.project(s);let l=null,h=e;for(const d of n.vertices){const p=i.project(d).distanceTo(a);p<=h&&(l=d,h=p)}if(l)return o.latLng(l.lat,l.lng);let c=null;for(const d of n.paths)for(let p=1;p<d.length;p++){const g=o.LineUtil.closestPointOnSegment(a,i.project(d[p-1]),i.project(d[p])),v=g.distanceTo(a);v<=h&&(c=g,h=v)}return c?i.unproject(c):s}}function Mt(i,t,e){if(!t)return null;const{distance:s,layers:r}=t===!0?{}:t,n=()=>typeof r=="function"?r():r??[];return kt(i,()=>[...e(),...n()],s)}const ve={color:P,weight:3,lineCap:"round",lineJoin:"round",fillOpacity:.15};function we(){return o.divIcon({className:"smap-draw-marker",iconSize:[16,16],iconAnchor:[8,8]})}class xt{constructor(t,e={}){this.emitter=q(),this.editor=null,this.map=t,this.options=e,this.group=o.featureGroup().addTo(t),this.snapper=Mt(t,e.snap,()=>this.getLayers()),this.session=new wt(t,{created:(s,r)=>{this.group.addLayer(s),this.emitter.emit("created",{layer:s,type:r}),this.emitChange()},stop:s=>this.emitter.emit("drawstop",{type:s})})}static preload(){return k()}get drawing(){return this.session.active}draw(t){this.finishEdit(!0);const e=this.shapeOptions(),{snapper:s}=this;this.session.start(t,{shapeOptions:e,markerIcon:this.markerIcon(),snap:s?r=>s(r):void 0},e.color),this.emitter.emit("drawstart",{type:t})}cancel(){this.session.cancel()}get editing(){return!!this.editor}startEdit(){this.editor||(this.cancel(),vt(this.map,this.shapeOptions().color),this.editor=new Lt(this.map,this.getLayers(),{snap:this.snapper,onChange:t=>this.emitter.emit("editing",{layer:t})}),this.editor.enable())}get canUndo(){var t;return((t=this.editor)==null?void 0:t.canUndo)??!1}undo(){var t;return((t=this.editor)==null?void 0:t.undo())??!1}finishEdit(t=!0){const e=this.editor;if(!e)return;this.editor=null;const s=t?e.changed():[];t||e.revert(),e.disable(),s.length&&(this.emitter.emit("edited",{layers:s}),this.emitChange())}getLayers(){return this.group.getLayers()}remove(t){this.group.hasLayer(t)&&(this.group.removeLayer(t),this.emitter.emit("removed",{layers:[t]}),this.emitChange())}clear(){const t=this.getLayers();t.length&&(this.finishEdit(!1),this.group.clearLayers(),this.emitter.emit("removed",{layers:t}),this.emitChange())}toGeoJSON(){return{type:"FeatureCollection",features:this.getLayers().map(e=>{const s=e.toGeoJSON();return e instanceof o.Circle&&(s.properties={...s.properties,radius:e.getRadius()}),s})}}load(t,e={}){this.finishEdit(!1),e.replace!==!1&&this.group.clearLayers(),o.geoJSON(t,{style:()=>this.shapeOptions(),pointToLayer:(r,n)=>{var l;const a=Number((l=r.properties)==null?void 0:l.radius);return a>0?o.circle(n,{...this.shapeOptions(),radius:a}):o.marker(n,{icon:this.markerIcon()})}}).eachLayer(r=>this.group.addLayer(r)),this.emitChange()}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}destroy(){this.session.destroy(),this.finishEdit(!1),this.emitter.all.clear(),this.group.remove()}emitChange(){this.emitter.emit("change",this.toGeoJSON())}shapeOptions(){return{...ve,...this.options.shapeOptions}}markerIcon(){return this.options.markerIcon??we()}}const be=Object.freeze(Object.defineProperty({__proto__:null,DrawTool:xt},Symbol.toStringTag,{value:"Module"})),Le={stroke:!0,color:P,weight:3,opacity:1,lineCap:"round",lineJoin:"round",fillOpacity:.12};let Te=0;function ke(){return`measure_${++Te}_${Date.now()}`}class A{constructor(t,e={}){this.entries=new Map,this.draft=null,this.emitter=q(),this.editor=null,this.destroyed=!1,this.map=t,this.options={...e},this.layerGroup=o.featureGroup().addTo(t),this.snapper=Mt(t,e.snap,()=>this.layerGroup.getLayers()),this.session=new wt(t,{created:s=>this.handleCreated(s),vertex:s=>this.handleVertex(s),stop:(s,r)=>{this.setDraft(null),this.emitter.emit("stop",{type:s,completed:r})}}),this.clickHandler=s=>{var n;const r=s.target;if((n=r.classList)!=null&&n.contains("smap-measure-remove")){const a=r.dataset.measureId;a&&this.remove(a)}},t.getContainer().addEventListener("click",this.clickHandler)}static preload(){return k()}draftLabels(t){return[]}resultLabels(t){return[{latlng:this.anchor(t),html:this.resultHtml(t)}]}get type(){return this.drawType}get measuring(){return this.session.active!==null}enable(){this.finishEdit(!0);const t=this.getShapeOptions(),{snapper:e}=this;this.session.start(this.drawType,{shapeOptions:t,vertexIcon:this.options.icon,snap:e?s=>e(s):void 0},t.color),this.emitter.emit("start",{type:this.drawType})}disable(){this.session.cancel()}get editing(){return!!this.editor}startEdit(){if(this.editor)return;this.disable();const t=new Map([...this.entries.values()].map(e=>[e.result.layer,e]));this.editor=new Lt(this.map,[...t.keys()],{snap:this.snapper,onChange:e=>{const s=t.get(e);s&&(this.refresh(s),this.emitter.emit("updating",s.result))}}),this.editor.enable()}undo(){var t;return((t=this.editor)==null?void 0:t.undo())??!1}finishEdit(t=!0){const e=this.editor;if(!e)return;this.editor=null;const s=e.changed();t||e.revert(),e.disable();for(const r of this.entries.values())s.includes(r.result.layer)&&(this.refresh(r),t&&this.emitter.emit("updated",r.result))}refresh(t){Object.assign(t.result,this.measure(t.result.layer)),t.labels.remove(),t.labels=this.renderLabels(this.options.showMarker?this.resultLabels(t.result):[])}setOptions(t){Object.assign(this.options,t);for(const e of this.entries.values())this.refresh(e)}getResults(){return[...this.entries.values()].map(t=>t.result)}remove(t){const e=this.entries.get(t);e&&(this.finishEdit(!0),e.labels.remove(),this.layerGroup.removeLayer(e.result.layer),this.entries.delete(t),this.emitter.emit("removed",{id:t,type:this.drawType}))}clearAll(){for(const t of[...this.entries.keys()])this.remove(t)}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}destroy(){this.destroyed||(this.destroyed=!0,this.session.destroy(),this.finishEdit(!1),this.setDraft(null),this.clearAll(),this.layerGroup.remove(),this.map.getContainer().removeEventListener("click",this.clickHandler),this.emitter.emit("destroyed",{type:this.drawType}),this.emitter.all.clear())}handleVertex(t){if(!this.options.showMarker)return;const e=this.draftLabels(t);e.length&&this.setDraft(this.renderLabels(e))}handleCreated(t){const e=ke();this.layerGroup.addLayer(t);const s={id:e,type:this.drawType,layer:t,...this.measure(t)};this.setDraft(null);const r=this.renderLabels(this.options.showMarker?this.resultLabels(s):[]);this.entries.set(e,{result:s,labels:r}),this.emitter.emit("created",s)}setDraft(t){var e;(e=this.draft)==null||e.remove(),this.draft=t}renderLabels(t){const e=o.featureGroup();for(const{latlng:s,html:r}of t)o.marker(s,{icon:o.divIcon({className:"measure-div-icon"}),interactive:!1}).bindTooltip(r,{permanent:!0,direction:"right",offset:[6,0],className:"measure-tooltip"}).addTo(e);return e.addTo(this.map)}getShapeOptions(){return{...Le,...this.options.shapeOptions}}text(t,e=""){return this.options.formatLabel?this.options.formatLabel(t):this.options.valueFormatter?e+this.options.valueFormatter(this.legacyValue(t)):this.defaultText(t)}labelHtml(t){return`<div class="smap-measure-label" style="${this.accentStyle()}">${t}</div>`}resultHtml(t,e=""){const{id:s,layer:r,...n}=t,a=this.text({...n,partial:!1},e),l=`<button type="button" class="smap-measure-remove" data-measure-id="${t.id}" title="删除" aria-label="删除">×</button>`;return`<div class="smap-measure-label smap-measure-label--result" style="${this.accentStyle()}"><span>${a}</span>${l}</div>`}accentStyle(){return`--smap-accent:${this.getShapeOptions().color||P}`}formatLength(t){return j(t,this.options.lengthUnit)}formatArea(t){return ft(t,this.options.areaUnit)}pathLength(t){return R(t)}}class Me extends A{constructor(){super(...arguments),this.drawType="polyline"}measure(t){const e=t.getLatLngs();return{latlngs:e,distance:this.pathLength(e)}}anchor(t){return t.latlngs[t.latlngs.length-1]}defaultText(t){const e=this.formatLength(t.distance??0);return t.partial?e:`共 ${e}`}legacyValue(t){return t.distance??0}draftLabels(t){return this.nodeLabels(t)}resultLabels(t){return[...this.nodeLabels(t.latlngs.slice(0,-1)),{latlng:this.anchor(t),html:this.resultHtml(t,"共 ")}]}nodeLabels(t){return t.map((e,s)=>{if(s===0)return{latlng:e,html:this.labelHtml("起点")};const r=t.slice(0,s+1),n=this.text({type:"polyline",latlngs:r,distance:this.pathLength(r),partial:!0});return{latlng:e,html:this.labelHtml(n)}})}}class Ct extends A{measure(t){const e=t.getLatLngs()[0];return{latlngs:e,area:gt(e),perimeter:e.length?R([...e,e[0]]):0}}anchor(t){return t.latlngs[0]}defaultText(t){return this.formatArea(t.area??0)}legacyValue(t){return t.latlngs}}class xe extends Ct{constructor(){super(...arguments),this.drawType="polygon"}}class Ce extends A{constructor(){super(...arguments),this.drawType="circle"}measure(t){const e=t.getRadius(),s=t.getLatLng();return{latlngs:[s],center:s,radius:e,area:Math.PI*e*e,perimeter:2*Math.PI*e}}anchor(t){return t.center??t.latlngs[0]}defaultText(t){return this.formatArea(t.area??0)}legacyValue(t){return t.radius??0}}class Se extends Ct{constructor(){super(...arguments),this.drawType="rectangle"}}exports.BUILTIN_TILE_TYPES=Ot;exports.BaseMeasureTool=A;exports.CircleMeasure=Ce;exports.ClusterLayer=lt;exports.ContextMenu=dt;exports.ControlManager=ct;exports.DrawTool=xt;exports.LayerManager=ht;exports.PolygonMeasure=xe;exports.PolylineMeasure=Me;exports.RectangleMeasure=Se;exports.SMap=ce;exports.ServiceClient=ut;exports.bd09ToGcj02=$;exports.bd09ToWgs84=at;exports.createChinaTileLayer=B;exports.createSnapper=kt;exports.formatArea=ft;exports.formatLength=j;exports.gcj02ToBd09=G;exports.gcj02ToWgs84=_;exports.geodesicArea=gt;exports.getCoordType=st;exports.getLocation=pt;exports.getTileTypes=Dt;exports.loadLeafletDraw=k;exports.loadScript=ue;exports.loadStyle=de;exports.pathLength=R;exports.providers=O;exports.registerProvider=Pt;exports.sketchText=y;exports.transformCoord=ot;exports.transformGeoJSON=Bt;exports.wgs84ToBd09=E;exports.wgs84ToGcj02=T;
2
+ //# sourceMappingURL=smap-leaflet.cjs.map