tg-map-vue3
Version:
封装 百度地图, Google地图, Here地图(未完成) 的Vue3组件库
2 lines • 157 kB
JavaScript
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.baidu-info-box-container{transform:translateY(-11px);font-size:13px;font-weight:300;width:100vw;cursor:auto;-webkit-user-select:auto!important;user-select:auto!important}.baidu-info-box-container__border{position:absolute;padding:12px;background-color:#fff;box-shadow:0 2px 7px 1px #0000004d;border-radius:8px;transform:translate(-50%,-100%)}.baidu-info-box-container__inner{overflow:auto}.baidu-info-box-container__close{position:absolute;right:-6px;top:-6px;width:14px;height:14px;margin:8px;opacity:.6;cursor:pointer;-webkit-mask-image:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M19%206.41L17.59%205%2012%2010.59%206.41%205%205%206.41%2010.59%2012%205%2017.59%206.41%2019%2012%2013.41%2017.59%2019%2019%2017.59%2013.41%2012z%22/%3E%3Cpath%20d%3D%22M0%200h24v24H0z%22%20fill%3D%22none%22/%3E%3C/svg%3E);mask-image:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M19%206.41L17.59%205%2012%2010.59%206.41%205%205%206.41%2010.59%2012%205%2017.59%206.41%2019%2012%2013.41%2017.59%2019%2019%2017.59%2013.41%2012z%22/%3E%3Cpath%20d%3D%22M0%200h24v24H0z%22%20fill%3D%22none%22/%3E%3C/svg%3E);background-color:#000}.baidu-info-box-container__close:hover{opacity:1}.baidu-info-box-container:after{position:absolute;background-color:#fff;content:"";width:15px;height:15px;left:0;top:0;box-shadow:-2px 2px 2px #b2b2b266;transform:translate(-50%,-50%) rotate(-45deg)}.gm-style-iw-c .gm-style-iw-chr{display:block}.gm-style-iw-c .gm-style-iw-chr .gm-style-iw-ch{padding-top:12px}.gm-style-iw-c .gm-style-iw-chr button.gm-ui-hover-effect{position:absolute!important;right:-6px;top:-6px;width:14px!important;height:14px!important;margin:8px!important}.gm-style-iw-c .gm-style-iw-chr button.gm-ui-hover-effect span{width:14px!important;height:14px!important;margin:0!important}.gm-style-iw-c .gm-style-iw-d::-webkit-scrollbar{width:12px;height:12px}.element-overlay{position:absolute}.baidu-marker-label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.tg-map{height:100%;position:relative}.tg-map__map{width:100%;height:100%}.tg-map__map--hide-logo-google .gm-style a[target=_blank]:has(>div>img){display:none!important}.tg-map__map--hide-logo-google .gm-style>div:last-child>div:last-child>div{display:none}.tg-map__map--hide-logo-baidu div.anchorBL>a[target=_blank]>img{display:none}.tg-map__map--hide-logo-baidu div.BMap_cpyCtrl{display:none}.tg-map-widget{position:absolute}.tg-map>.tg-custom-control{display:none}.tg-map .tg-element-overlay{display:none}.tg-map__map .tg-element-overlay{display:block}.tg-map .tg-info-box{display:none}.tg-map__map .tg-info-box{display:block}.tg-map .tg-label{display:none}.tg-map__map .tg-label{display:block}')),document.head.appendChild(t)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
"use strict";var Fr=Object.defineProperty;var Ur=(i,t,e)=>t in i?Fr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var g=(i,t,e)=>Ur(i,typeof t!="symbol"?t+"":t,e);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("tg-commons"),_=require("vue");function Q(i,t,e){Object.keys(i).forEach(r=>{r.startsWith("update:")||e!=null&&e.includes(r)||t.addEventListener(r,i[r])})}let qr=1;function Yr(){return qr++}function De(i,t){return t.__id__||(t.__id__=Yr()),`${i}::${t.__id__}`}function Fe(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var ke={exports:{}},Kr=ke.exports,Ut;function Xr(){return Ut||(Ut=1,function(i){(function(t,e){i.exports?i.exports=e():t.coordtransform=e()})(Kr,function(){var t=52.35987755982988,e=3.141592653589793,r=6378245,n=.006693421622965943;function s(l,h,f,y){this.west=Math.min(l,f),this.north=Math.max(h,y),this.east=Math.max(l,f),this.south=Math.min(h,y)}s.prototype.contain=function(l,h){return this.west<=l&&this.east>=l&&this.north>=h&&this.south<=h};var a=[new s(79.4462,49.2204,96.33,42.8899),new s(109.6872,54.1415,135.0002,39.3742),new s(73.1246,42.8899,124.143255,29.5297),new s(82.9684,29.5297,97.0352,26.7186),new s(97.0253,29.5297,124.367395,20.414096),new s(107.975793,20.414096,111.744104,17.871542)],d=[new s(119.921265,25.398623,122.497559,21.785006),new s(101.8652,22.284,106.665,20.0988),new s(106.4525,21.5422,108.051,20.4878),new s(109.0323,55.8175,119.127,50.3257),new s(127.4568,55.8175,137.0227,49.5574),new s(131.2662,44.8922,137.0227,42.5692),new s(73.1246,35.398637,77.948114,29.5297)],o=[new s(114.505238,22.138258,113.845,22.428903),new s(113.97,22.507833,114.45,22.428903)];function c(l,h,f=!0){for(var y=0;y<a.length;y++)if(a[y].contain(l,h)){for(var w=0;w<d.length;w++)if(d[w].contain(l,h))return!1;if(f){for(var w=0;w<o.length;w++)if(o[w].contain(l,h))return!1}return!0}return!1}function u(l,h){var f=l-.0065,y=h-.006,w=Math.sqrt(f*f+y*y)-2e-5*Math.sin(y*t),E=Math.atan2(y,f)-3e-6*Math.cos(f*t),L=w*Math.cos(E),A=w*Math.sin(E);return[L,A]}function m(l,h){var f=Math.sqrt(l*l+h*h)+2e-5*Math.sin(h*t),y=Math.atan2(h,l)+3e-6*Math.cos(l*t),w=f*Math.cos(y)+.0065,E=f*Math.sin(y)+.006;return[w,E]}function p(l,h){return T(l,h)}function v(l,h){var f=T(l,h);return[l*2-f[0],h*2-f[1]]}function T(l,h){var f=b(l-105,h-35),y=O(l-105,h-35),w=h/180*e,E=Math.sin(w);E=1-n*E*E;var L=Math.sqrt(E);f=f*180/(r*(1-n)/(E*L)*e),y=y*180/(r/L*Math.cos(w)*e);var A=h+f,z=l+y;return[z,A]}function b(l,h){var f=-100+2*l+3*h+.2*h*h+.1*l*h+.2*Math.sqrt(Math.abs(l));return f+=(20*Math.sin(6*l*e)+20*Math.sin(2*l*e))*2/3,f+=(20*Math.sin(h*e)+40*Math.sin(h/3*e))*2/3,f+=(160*Math.sin(h/12*e)+320*Math.sin(h*e/30))*2/3,f}function O(l,h){var f=300+l+2*h+.1*l*l+.1*l*h+.1*Math.sqrt(Math.abs(l));return f+=(20*Math.sin(6*l*e)+20*Math.sin(2*l*e))*2/3,f+=(20*Math.sin(l*e)+40*Math.sin(l/3*e))*2/3,f+=(150*Math.sin(l/12*e)+300*Math.sin(l/30*e))*2/3,f}return{rawBd09ToGcj02:u,rawGcj02ToBd09:m,rawWgs84ToGcj02:p,rawGcj02ToWgs84:v,bd09ToGcj02:u,gcj02ToBd09:m,wgs84ToGcj02:function(l,h){return c(l,h)?p(l,h):[l,h]},gcj02ToWgs84:function(l,h){return c(l,h)?v(l,h):[l,h]},bd09ToWgs84:function(l,h){if(!c(l,h,!1))return[l,h];var f=u(l,h);return v(f[0],f[1])},wgs84ToBd09:function(l,h){if(!c(l,h,!1))return[l,h];var f=p(l,h);return m(f[0],f[1])}}})}(ke)),ke.exports}var Jr=Xr();const se=Fe(Jr);function Qr(i,t){return i instanceof t}function ei(i,t){if(i instanceof t)return i}function $e(i,t){return(i==null?void 0:i.$options.name)===t.name}function kt(i,t){return $e(i,t)?i:void 0}function Ue(i,t,e){let r=t;for(;r;){if($e(r,i))return r;if(e&&$e(r,e))return;r=r.$parent}}function ti(i){return i}var R=(i=>(i.wgs84="wgs84",i.gcj02="gcj02",i.bd09="bd09",i))(R||{});const wt="wgs84",$=class ${constructor(t,e,r){this.lat=t,this.lng=e,this.coord=r,C.noop()}static _normalize(t,e){const r=e>90?90:e<-90?-90:e;return[t>180?(t+180)%360-180:t<-180?(t-180)%360+180:t,r]}static fromBaidu(t,e){return new $(t.lat,t.lng,e)}static fromGoogle(t,e){return new $(t.lat(),t.lng(),e)}static fromHere(t,e){return new $(t.lat,t.lng,e)}static fromLiteral(t){return new $(t.lat,t.lng,t.coord||wt)}static fromLngLat(t,e,r=wt){return new $(e,t,r)}static create(t,e,r=wt){return new $(t,e,r)}to(t){const e=t;if(this.coord===e)return this;const[r,n]=this._convert(e);return new $(n,r,e)}toBaidu(t,e=!1){let r=this.lat,n=this.lng;return this.coord!==t&&([n,r]=this._convert(t)),e&&([n,r]=$._normalize(n,r)),new BMap.Point(n,r)}toGoogle(t){let e=this.lat,r=this.lng;return this.coord!==t&&([r,e]=this._convert(t)),new google.maps.LatLng(e,r)}toHere(t){let e=this.lat,r=this.lng;return this.coord!==t&&([r,e]=this._convert(t)),new H.geo.Point(e,r)}_convert(t){switch(this.coord){case"bd09":return t==="gcj02"?se.bd09ToGcj02(this.lng,this.lat):se.bd09ToWgs84(this.lng,this.lat);case"gcj02":return t==="wgs84"?se.gcj02ToWgs84(this.lng,this.lat):se.gcj02ToBd09(this.lng,this.lat);case"wgs84":return t==="bd09"?se.wgs84ToBd09(this.lng,this.lat):se.wgs84ToGcj02(this.lng,this.lat)}throw new Error(`不支持的坐标转换: ${this.coord}=>${t}`)}normalize(){const[t,e]=$._normalize(this.lng,this.lat);return e===this.lat&&t===this.lng?this:new $(e,t,this.coord)}equals(t){return this===t?!0:this.lat===t.lat&&this.lng===t.lng&&this.coord===t.coord}toString(){return JSON.stringify(this)}};g($,"ZERO",$.create(0,0));let x=$;const te=class te{constructor(t,e){g(this,"coord");this.sw=t,this.ne=e,C.assert(t.coord===e.coord,"sw和ne的coord应该相同"),C.assert(Number.isFinite(t.lat)&&Number.isFinite(t.lng)&&Number.isFinite(e.lat)&&Number.isFinite(e.lng),`sw(${t})和ne(${e})不能包含NaN或Infinite`),C.assert(t.lat<=e.lat,`sw.lat(${t.lat})应该比ne.lat(${e.lat})小`),this.coord=t.coord}static isBetweenLng(t,e,r){return t<=e?t<=r&&r<=e:t<=r||r<=e}static fromArray(t){if(t.length===0)return;const e=new te.Builder(t[0]);for(let r=1;r<t.length;r++)e.include(t[r]);return e.build()}static from(...t){return this.fromArray(t)??C.throwError("positions中没有点")}static fromGoogle(t,e){return new te(x.fromGoogle(t.getSouthWest(),e),x.fromGoogle(t.getNorthEast(),e))}static fromBaidu(t,e){return new te(x.fromBaidu(t.getSouthWest(),e),x.fromBaidu(t.getNorthEast(),e))}static create(t,e){return this.from(t,e)}isEmpty(){return this.sw.equals(this.ne)}contains(t){const{lat:e,lng:r}=t.to(this.coord);return this.sw.lat<=e&&e<=this.ne.lat&&te.isBetweenLng(this.sw.lng,this.ne.lng,r)}getCenter(){if(this.sw.equals(this.ne))return this.sw;const t=(this.sw.lat+this.ne.lat)/2,e=(this.sw.lng+this.ne.lng+(this.sw.lng<this.ne.lng?0:360))/2;return x.create(t,e,this.coord)}toString(){return JSON.stringify(this)}equals(t){return this.sw.equals(t.sw)&&this.ne.equals(t.ne)}toRectArray(){const t=this.sw.coord;return[this.sw,x.fromLngLat(this.sw.lng,this.ne.lat,t),this.ne,x.fromLngLat(this.ne.lng,this.sw.lat,t)]}toGoogle(t){return new google.maps.LatLngBounds(this.sw.toGoogle(t),this.ne.toGoogle(t))}toBaidu(t){return new BMap.Bounds(this.sw.toBaidu(t),this.ne.toBaidu(t))}toBaiduArray(t){return[this.sw.toBaidu(t),this.ne.toBaidu(t)]}};g(te,"EMPTY",new te(x.ZERO,x.ZERO));let U=te;(i=>{class t{constructor(r){g(this,"coord");g(this,"minLat");g(this,"minLng");g(this,"maxLat");g(this,"maxLng");this.coord=r.coord,this.minLat=this.maxLat=r.lat,this.minLng=this.maxLng=r.lng}build(){return new i(x.create(this.minLat,this.minLng,this.coord),x.create(this.maxLat,this.maxLng,this.coord))}include(r){const{lat:n,lng:s}=r.to(this.coord);return this.minLat=Math.min(this.minLat,n),this.maxLat=Math.max(this.maxLat,n),i.isBetweenLng(this.minLng,this.maxLng,s)||(this.delta(this.minLng,s)<this.delta(s,this.maxLng)?this.minLng=s:this.maxLng=s),this}delta(r,n){return(r-n+360)%360}}i.Builder=t})(U||(U={}));exports.Location=void 0;(i=>{function t(r,n){if(r==null)return;if(typeof r=="string")return r;const s=r.to(n);return`${s.lat},${s.lng}`}i.toString=t;function e(r){return typeof r=="string"||r==null?void 0:r.coord}i.getCoordType=e})(exports.Location||(exports.Location={}));function sr(){BMap.OverlayV3||(BMap.OverlayV3=BMap.Overlay)}function ri(){const i=window.$BAIDU$;"kT"in i||Object.defineProperty(i,"kT",{get:()=>i._instances,enumerable:!0,configurable:!0})}const qt={equals(i,t){return i.lat===t.lat&&i.lng===t.lng}};var Bt;(i=>{function t(e){return e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight}i.isScrollable=t})(Bt||(Bt={}));exports.Arrays=void 0;(i=>{function t(n,s){for(const a of n)if(a instanceof s)return a}i.findByType=t;function e(n,s){return n.includes(s)}i.includesTyped=e;function r(n,s,a){const d=s>=0?s:n.length+s;if(a===void 0)return n[d];n[d]=a}i.at=r})(exports.Arrays||(exports.Arrays={}));exports.MVCArrays=void 0;(i=>{function t(n,s){const a=n.getLength();for(let d=0;d<a;d++)if(n.getAt(d)===s)return d;return-1}i.indexOf=t;function e(n,s){const a=t(n,s);if(a!==-1)return n.removeAt(a)}i.remove=e;function r(n,s){return[n.addListener("insert_at",s),n.addListener("remove_at",s),n.addListener("set_at",s)]}i.listenChanged=r})(exports.MVCArrays||(exports.MVCArrays={}));function or(i,t,e){return i.addListener(t,e).remove}function ii(i,t,e){return i.addEventListener(t,e),()=>i.removeEventListener(t,e)}function ni(i,t,e,r){return i.addEventListener(t,e,r),()=>i.removeEventListener(t,e,r)}function Yt(i,t,e){return i.addEventListener(t,e),()=>i.removeEventListener(t,e)}class ar{constructor(t,e){g(this,"eventMap",new Map);g(this,"target",C.lateinit());this.inner=t,this.coordTypeSupplier=e,this.addEventListener=this.addEventListener.bind(this),this.removeEventListener=this.removeEventListener.bind(this)}setTarget(t){return this.target=t,this}}class qe{constructor(t,e){g(this,"eventHub",new lr);this.delegate=t,this.options=e}notify(t){this.eventHub.notify(t)}hasListener(t){return this.eventHub.hasListener(t)}setTarget(t){return this.delegate.setTarget(t),this}addEventListener(t,e){if(exports.Arrays.includesTyped(this.options.types,t)){this.eventHub.hasListener(t)||this.options.onListen(t),this.eventHub.addEventListener(t,e);return}this.delegate.addEventListener(t,e)}removeEventListener(t,e){if(exports.Arrays.includesTyped(this.options.types,t)){this.eventHub.removeEventListener(t,e),this.eventHub.hasListener(t)||this.options.onCancel(t);return}this.delegate.removeEventListener(t,e)}}const Ve=class Ve extends ar{addEventListener(t,e){const r=De(t,e);if(this.eventMap.get(r)){console.warn("listener已经添加过了",r,e);return}const n=this.inner.addListener(Ve.EVENT_TYPE_MAP[t]||t,s=>{const a={type:t,target:this.target,originalEvent:s};s!=null&&s.latLng&&(a.position=x.fromGoogle(s.latLng,this.coordTypeSupplier.coordType)),e.call(this.target,a)});this.eventMap.set(r,n)}removeEventListener(t,e){const r=De(t,e),n=this.eventMap.get(r);n?(n.remove(),this.eventMap.delete(r)):console.warn("移除失败, 不存在该listener",r,e)}};g(Ve,"EVENT_TYPE_MAP",{"center-changed":"center_changed","zoom-changed":"zoom_changed","radius-changed":"radius_changed","bounds-changed":"bounds_changed","map-type-changed":"maptypeid_changed","map-mousedown":"mousedown","map-mousemove":"mousemove","map-mouseup":"mouseup","map-dblclick":"dblclick"});let le=Ve;const Ce=class Ce extends ar{addEventListener(t,e){const r=De(t,e);if(this.eventMap.get(r)){console.warn("listener已经添加过了",r,e);return}const n=s=>{const a={type:t,target:this.target,originalEvent:s};s.point&&(a.position=x.fromBaidu(s.point,this.coordTypeSupplier.coordType)),e.call(this.target,a)};this.inner.addEventListener(Ce.EVENT_TYPE_MAP[t]||t,n),this.eventMap.set(r,n)}removeEventListener(t,e){const r=De(t,e),n=this.eventMap.get(r);n?(this.inner.removeEventListener(Ce.EVENT_TYPE_MAP[t]||t,n),this.eventMap.delete(r)):console.warn("移除失败, 不存在该listener",r,e)}};g(Ce,"EVENT_TYPE_MAP",{drag:"dragging",closeclick:"clickclose",contextmenu:"rightclick","zoom-changed":"zoomend","map-type-changed":"maptypechange"});let we=Ce;class lr{constructor(){g(this,"typeMap",new Map)}addEventListener(t,e){let r=this.typeMap.get(t);r||(r=[],this.typeMap.set(t,r)),!r.includes(e)&&r.push(e)}removeEventListener(t,e){const r=this.typeMap.get(t);r&&C.Arrays.remove(r,e)}hasListener(t){const e=this.typeMap.get(t);return e!=null&&e.length>0}notify(t){const e=this.typeMap.get(t.type);e&&e.forEach(r=>r.call(t.target,t))}}class St{constructor(t,e){g(this,"keyToValue",new Map);g(this,"valueToKey",new Map);C.assert(t.length===e.length);for(let r=t.length-1;r>=0;r--)this.keyToValue.set(t[r],e[r]),this.valueToKey.set(e[r],t[r])}toKey(t){return this.valueToKey.get(t)??C.throwError()}toValue(t){return this.keyToValue.get(t)??C.throwError()}}class hr{constructor(t,e=10){g(this,"map",new Map);this.values=t,this.maxSize4Debug=e,C.noop()}getValueMap(t){let e=this.map.get(t);if(!e){e=new Map;for(let r=this.values.length-1;r>=0;r--){const n=this.values[r];e.set(t.call(n),n)}this.map.set(t,e),process.env.NODE_ENV!=="production"&&this.map.size>this.maxSize4Debug&&console.warn(`this.map的大小(${this.map.size})超过了设置的最大大小(${this.maxSize4Debug}), 这可能是由于你每次都创建新的keySelector造成的, 请保证相同功能的keySelector只创建一个对象`)}return e}getOrNull(t,e){return this.getValueMap(t).get(e)}get(t,e){return this.getOrNull(t,e)??C.throwError(`key(${e})不存在与valueMap(${this.getValueMap(t)})中`)}}class ae{constructor(t){g(this,"value");this.creator=t,C.noop()}get(){return this.value===void 0&&(this.value=this.creator()),this.value}}var k=(i=>(i.TOP_LEFT="top-left",i.TOP_CENTER="top-center",i.TOP_RIGHT="top-right",i.BOTTOM_LEFT="bottom-left",i.BOTTOM_CENTER="bottom-center",i.BOTTOM_RIGHT="bottom-right",i.LEFT_TOP="left-top",i.LEFT_CENTER="left-center",i.LEFT_BOTTOM="left-bottom",i.RIGHT_TOP="right-top",i.RIGHT_CENTER="right-center",i.RIGHT_BOTTOM="right-bottom",i))(k||{});exports.ControlPositionConverter=void 0;(i=>{let t,e;const r=["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right","left-top","left-center","left-bottom","right-top","right-center","right-bottom"];function n(){return t||(t=new St(r,[BMAP_ANCHOR_TOP_LEFT,BMAP_ANCHOR_TOP_LEFT,BMAP_ANCHOR_TOP_RIGHT,BMAP_ANCHOR_BOTTOM_LEFT,BMAP_ANCHOR_BOTTOM_LEFT,BMAP_ANCHOR_BOTTOM_RIGHT,BMAP_ANCHOR_TOP_LEFT,BMAP_ANCHOR_BOTTOM_LEFT,BMAP_ANCHOR_BOTTOM_LEFT,BMAP_ANCHOR_TOP_RIGHT,BMAP_ANCHOR_BOTTOM_RIGHT,BMAP_ANCHOR_BOTTOM_RIGHT])),t}i.getBaidu=n;function s(){return e||(e=new St(r,[google.maps.ControlPosition.TOP_LEFT,google.maps.ControlPosition.TOP_CENTER,google.maps.ControlPosition.TOP_RIGHT,google.maps.ControlPosition.BOTTOM_LEFT,google.maps.ControlPosition.BOTTOM_CENTER,google.maps.ControlPosition.BOTTOM_RIGHT,google.maps.ControlPosition.LEFT_TOP,google.maps.ControlPosition.LEFT_CENTER,google.maps.ControlPosition.LEFT_BOTTOM,google.maps.ControlPosition.RIGHT_TOP,google.maps.ControlPosition.RIGHT_CENTER,google.maps.ControlPosition.RIGHT_BOTTOM])),e}i.getGoogle=s})(exports.ControlPositionConverter||(exports.ControlPositionConverter={}));class cr{constructor(t){g(this,"inner");this.position=t,C.noop()}}class Ye{}class dr extends Ye{constructor(t,e){super(),this.visible=t,this.position=e}isVisible(){return this.visible}setVisible(t){this.visible=t}getPosition(){return this.position}setPosition(t){this.position=t}addTo(t){}removeFrom(t){}}class Ke extends Ye{constructor(t,e){super(),this.inner=t,this.position=e}isVisible(){return this.inner.isVisible()}setVisible(t){t?this.inner.show():this.inner.hide()}getPosition(){return this.position??exports.ControlPositionConverter.getBaidu().toKey(this.inner.getAnchor())}setPosition(t){this.position=t,this.inner.setAnchor(exports.ControlPositionConverter.getBaidu().toValue(t))}addTo(t){t.innerMap.addControl(this.inner)}removeFrom(t){t.innerMap.removeControl(this.inner)}}class Ee extends Ye{constructor(e,r){super();g(this,"visible",!1);g(this,"map");this._type=e,this.position=r}isVisible(){return this.visible}setVisible(e){this.visible=e,this.tryUpdateOptions()}getPosition(){return this.position}setPosition(e){this.position=e,this.tryUpdateOptions()}addTo(e){this.map||(this.map=e,this.setVisible(!0))}removeFrom(){this.map&&(this.setVisible(!1),this.map=void 0)}onCreateOptions(){return{position:exports.ControlPositionConverter.getGoogle().toValue(this.position)}}tryUpdateOptions(){this.map&&this.map.innerMap.setOptions({[`${this._type}Control`]:this.visible,[`${this._type}ControlOptions`]:this.onCreateOptions()})}}var At=(i=>(i.normal="normal",i.satellite="satellite",i.hybrid="hybrid",i))(At||{});class N{constructor(t,e,r,n){this.id=t,this.baidu=e,this.google=r,this.googleCoordType=n,C.noop()}getId(){return this.id}getBaiduCoordType(){return R.bd09}asBaiduMapType(){return this.baidu()}getGoogleCoordType(){return this.googleCoordType}getGoogleMapTypeId(){return this.google()}asGoogleMapType(){C.throwUnsupported("google的内置地图没有对应的实例")}}class si{constructor(t,e){g(this,"baiduLayerCached",new ae(()=>{const t=new BMap.TileLayer({});return t.getTilesUrl=(e,r)=>{const n=Math.pow(2,r-1),s=e.x+n,a=n-1-e.y;return this.options.getTileUrl({x:s,y:a},r)},t}));g(this,"baiduMapTypeCached",new ae(()=>{const t=new BMap.MapType(this.options.name,this.baiduLayerCached.get(),{maxZoom:this.options.maxZoom,minZoom:this.options.minZoom,tips:this.options.describe});return t.__baidu_map_type__=this,t}));g(this,"googleCached",new ae(()=>{const t=new google.maps.ImageMapType({getTileUrl:(e,r)=>this.options.getTileUrl(e,r),tileSize:new google.maps.Size(256,256),name:this.options.name,alt:this.options.describe,maxZoom:this.options.maxZoom,minZoom:this.options.minZoom});return t.__google_map_type__=this,t}));this.coordType=t,this.options=e,C.noop()}get id(){return this.options.id}getBaiduCoordType(){return this.coordType}asBaiduMapType(){return this.baiduMapTypeCached.get()}asBaiduLayer(){return this.baiduLayerCached.get()}getGoogleCoordType(){return this.coordType}asGoogleMapType(){return this.googleCached.get()}asGoogleLayer(){C.throwUnsupported("这个方法不会被调用")}}class ur{constructor(){g(this,"baiduCache",new ae(()=>new BMap.TrafficLayer));g(this,"googleCache",new ae(()=>new google.maps.TrafficLayer))}asBaiduLayer(){return this.baiduCache.get()}asGoogleLayer(){return this.googleCache.get()}}exports.MapType=void 0;(i=>{i.NORMAL=new N("normal",()=>BMAP_NORMAL_MAP,()=>google.maps.MapTypeId.ROADMAP,R.gcj02),i.SATELLITE=new N("satellite",()=>BMAP_SATELLITE_MAP,()=>google.maps.MapTypeId.SATELLITE,R.wgs84),i.HYBRID=new N("hybrid",()=>BMAP_HYBRID_MAP,()=>google.maps.MapTypeId.HYBRID,R.gcj02),i.TERRAIN=new N("terrain",()=>BMAP_PERSPECTIVE_MAP,()=>google.maps.MapTypeId.TERRAIN,R.wgs84),i.BUILD_IN_MAP_TYPES=new hr([i.NORMAL,i.SATELLITE,i.HYBRID,i.TERRAIN])})(exports.MapType||(exports.MapType={}));var Rt=(i=>(i.DEFAULT="default",i.HORIZONTAL="horizontal",i.DROPDOWN="dropdown",i))(Rt||{});const pr=[exports.MapType.NORMAL,exports.MapType.SATELLITE,exports.MapType.HYBRID];class Xe extends Ke{static create(t){const e=t.mapTypes??pr,r={default:BMAP_MAPTYPE_CONTROL_HORIZONTAL,horizontal:BMAP_MAPTYPE_CONTROL_HORIZONTAL,dropdown:BMAP_MAPTYPE_CONTROL_DROPDOWN},n=new BMap.MapTypeControl({type:t.type&&r[t.type],mapTypes:e.map(s=>s.asBaiduMapType())});return t.position&&n.setAnchor(exports.ControlPositionConverter.getBaidu().toValue(t.position)),new Xe(n,t.position)}}const ne=class ne extends Ee{constructor(t="default",e=k.TOP_LEFT,r=pr){super("mapType",e),this.type=t,this.mapTypes=r,ne.type2google||(ne.type2google={default:google.maps.MapTypeControlStyle.DEFAULT,horizontal:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,dropdown:google.maps.MapTypeControlStyle.DROPDOWN_MENU})}static create(t){return new ne(t.type,t.position,t.mapTypes)}onCreateOptions(){const t=super.onCreateOptions();return t.style=ne.type2google[this.type],t.mapTypeIds=this.mapTypes.map(e=>e instanceof N?e.getGoogleMapTypeId():e.id),t}addTo(t){super.addTo(t),this.mapTypes.forEach(e=>{e instanceof N||t.innerMap.mapTypes.set(e.id,e.asGoogleMapType())})}};g(ne,"type2google");let ze=ne;class Je extends Ke{static create(t){const e=new BMap.ScaleControl({anchor:t.position&&exports.ControlPositionConverter.getBaidu().toValue(t.position)});return new Je(e,t.position)}}class Qe extends Ee{static create(t){return new Qe(t.position)}constructor(t=k.BOTTOM_RIGHT){super("scale",t)}}class et extends dr{static create(t){return new et(!0,t.position??k.RIGHT_BOTTOM)}}class tt extends Ee{static create(t){return new tt(t.position)}constructor(t=k.RIGHT_BOTTOM){super("streetView",t)}}class rt extends Ke{static create(t){const e=new BMap.NavigationControl({type:BMAP_NAVIGATION_CONTROL_ZOOM,anchor:t.position&&exports.ControlPositionConverter.getBaidu().toValue(t.position)});return new rt(e,t.position)}}class it extends Ee{static create(t){return new it(t.position)}constructor(t=k.RIGHT_BOTTOM){super("zoom",t)}}let oi,ai;const re={get LATLNG_ZERO(){return oi??(oi=new google.maps.LatLng({lat:0,lng:0}))},get BOUNDS_ZERO(){return ai??(ai=new google.maps.LatLngBounds(this.LATLNG_ZERO,this.LATLNG_ZERO))}};function gr(i,t={country:"",province:"",city:"",district:"",street:"",streetNumber:""}){for(const e of i)for(const r of e.types)switch(r){case"street_number":t.streetNumber=e.long_name;break;case"route":t.street=e.long_name;break;case"locality":t.city=e.long_name;break;case"sublocality":t.district=e.long_name;break;case"administrative_area_level_1":t.province=e.long_name;break;case"country":t.country=e.long_name;break}return t}function mr(i,t){var r;const e=i.address_components&&gr(i.address_components);return{country:(e==null?void 0:e.country)??"",province:(e==null?void 0:e.province)??"",city:(e==null?void 0:e.city)??"",id:i.place_id??"",address:i.formatted_address??"",position:x.fromGoogle(((r=i.geometry)==null?void 0:r.location)??re.LATLNG_ZERO,t.coordType),title:i.name??""}}class Dt{}class fr extends Dt{constructor(e,r){super();g(this,"inner");this.map=e,this.inner=new google.maps.places.Autocomplete(r.input,{fields:["address_components","name"]}),r.bindToMap&&this.inner.bindTo("bounds",e.innerMap)}setBounds(e){this.inner.setBounds(e.toGoogle(this.map.coordType))}addResultListener(e){return or(this.inner,"place_changed",()=>{const r=this.inner.getPlace(),n={title:r.name??"",province:"",city:"",district:"",street:"",streetNumber:"",country:""};r.address_components&&gr(r.address_components,n),e(n)})}}class yr extends Dt{constructor(e,r){super();g(this,"inner");g(this,"input");g(this,"removeableArray",[]);if(this.map=e,this.input=r.input,this.inner=new BMap.Autocomplete({input:r.input,location:r.bindToMap?e.innerMap:void 0}),r.bindToMap){const n=()=>{this.inner.setLocation(this.map.innerMap)};this.removeableArray.push(Yt(this.map,"center-changed",n)),this.removeableArray.push(Yt(this.map,"zoom-changed",n))}}setBounds(e){this.inner.setLocation(e.getCenter().toBaidu(this.map.coordType))}addResultListener(e){let r=0;const n=ii(this.inner,"confirm",a=>{const d=a.item.value;r=Date.now(),e(Object.assign({title:d.business,country:""},d))}),s=ni(this.input,"keyup",a=>{a.key==="Enter"&&Date.now()-r>100&&e({title:this.input.value,country:"",city:"",district:"",province:"",street:"",streetNumber:""})});return()=>{s(),n()}}}var Ae={exports:{}},li=Ae.exports,Kt;function hi(){return Kt||(Kt=1,function(i,t){(function(e,r){i.exports=r()})(li,function(){const e=function(){var s={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.45:"rgb(0,0,255)",.55:"rgb(0,255,255)",.65:"rgb(0,255,0)",.95:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},a=function(){var v=function(O){this._coordinator={},this._data=[],this._radi=[],this._min=0,this._max=1,this._xField=O.xField||O.defaultXField,this._yField=O.yField||O.defaultYField,this._valueField=O.valueField||O.defaultValueField,O.radius&&(this._cfgRadius=O.radius)},T=s.defaultRadius;return v.prototype={_organiseData:function(b,O){var l=b[this._xField],h=b[this._yField],f=this._radi,y=this._data,w=this._max,E=this._min,L=b[this._valueField]||1,A=b.radius||this._cfgRadius||T;return y[l]||(y[l]=[],f[l]=[]),y[l][h]?y[l][h]+=L:(y[l][h]=L,f[l][h]=A),y[l][h]>w?(O?this.setDataMax(y[l][h]):this._max=y[l][h],!1):{x:l,y:h,value:L,radius:A,min:E,max:w}},_unOrganizeData:function(){var b=[],O=this._data,l=this._radi;for(var h in O)for(var f in O[h])b.push({x:h,y:f,radius:l[h][f],value:O[h][f]});return{min:this._min,max:this._max,data:b}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0)for(var b=arguments[0],O=b.length;O--;)this.addData.call(this,b[O]);else{var l=this._organiseData(arguments[0],!0);l&&this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[l]})}return this},setData:function(b){var O=b.data,l=O.length;this._data=[],this._radi=[];for(var h=0;h<l;h++)this._organiseData(O[h],!1);return this._max=b.max,this._min=b.min||0,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},removeData:function(){},setDataMax:function(b){return this._max=b,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setDataMin:function(b){return this._min=b,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setCoordinator:function(b){this._coordinator=b},_getInternalData:function(){return{max:this._max,min:this._min,data:this._data,radi:this._radi}},getData:function(){return this._unOrganizeData()}},v}(),d=function(){var v=function(l){var h=l.gradient||l.defaultGradient,f=document.createElement("canvas"),y=f.getContext("2d");f.width=256,f.height=1;var w=y.createLinearGradient(0,0,256,1);for(var E in h)w.addColorStop(E,h[E]);return y.fillStyle=w,y.fillRect(0,0,256,1),y.getImageData(0,0,256,1).data},T=function(l,h){var f=document.createElement("canvas"),y=f.getContext("2d"),w=l,E=l;if(f.width=f.height=l*2,h==1)y.beginPath(),y.arc(w,E,l,0,2*Math.PI,!1),y.fillStyle="rgba(0,0,0,1)",y.fill();else{var L=y.createRadialGradient(w,E,l*h,w,E,l);L.addColorStop(0,"rgba(0,0,0,1)"),L.addColorStop(1,"rgba(0,0,0,0)"),y.fillStyle=L,y.fillRect(0,0,2*l,2*l)}return f},b=function(E){for(var h=[],f=E.min,y=E.max,w=E.radi,E=E.data,L=Object.keys(E),A=L.length;A--;)for(var z=L[A],B=Object.keys(E[z]),X=B.length;X--;){var S=B[X],W=E[z][S],J=w[z][S];h.push({x:z,y:S,value:W,radius:J})}return{min:f,max:y,data:h}};function O(l){var h=l.element,f=this.shadowCanvas=document.createElement("canvas"),y=this.canvas=l.canvas||document.createElement("canvas");this._renderBoundaries=[1e4,1e4,0,0];var w=getComputedStyle(l.element)||{};y.className="heatmap-canvas",this._width=y.width=f.width=+w.width.replace(/px/,""),this._height=y.height=f.height=+w.height.replace(/px/,""),this.shadowCtx=f.getContext("2d"),this.ctx=y.getContext("2d"),y.style.cssText=f.style.cssText="position:absolute;left:0;top:0;",h.style.position="relative",h.appendChild(y),this._palette=v(l),this._templates={},this._setStyles(l)}return O.prototype={renderPartial:function(l){this._drawAlpha(l),this._colorize()},renderAll:function(l){this._clear(),this._drawAlpha(b(l)),this._colorize()},_updateGradient:function(l){this._palette=v(l)},updateConfig:function(l,h){l.gradient!==h.gradient&&this._updateGradient(l),this._setStyles(l)},setDimensions:function(l,h){this._width=l,this._height=h,this.canvas.width=this.shadowCanvas.width=l,this.canvas.height=this.shadowCanvas.height=h},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(l){this._blur=l.blur==0?0:l.blur||l.defaultBlur,l.backgroundColor&&(this.canvas.style.backgroundColor=l.backgroundColor),this._opacity=(l.opacity||0)*255,this._maxOpacity=(l.maxOpacity||l.defaultMaxOpacity)*255,this._minOpacity=(l.minOpacity||l.defaultMinOpacity)*255,this._useGradientOpacity=!!l.useGradientOpacity},_drawAlpha:function(y){for(var h=this._min=y.min,f=this._max=y.max,y=y.data||[],w=y.length,E=1-this._blur;w--;){var L=y[w],A=L.x,z=L.y,B=L.radius,X=Math.min(L.value,f),S=A-B,W=z-B,J=this.shadowCtx,j;this._templates[B]?j=this._templates[B]:this._templates[B]=j=T(B,E),J.globalAlpha=(X-h)/(f-h),J.drawImage(j,S,W),S<this._renderBoundaries[0]&&(this._renderBoundaries[0]=S),W<this._renderBoundaries[1]&&(this._renderBoundaries[1]=W),S+2*B>this._renderBoundaries[2]&&(this._renderBoundaries[2]=S+2*B),W+2*B>this._renderBoundaries[3]&&(this._renderBoundaries[3]=W+2*B)}},_colorize:function(){var l=this._renderBoundaries[0],h=this._renderBoundaries[1],f=this._renderBoundaries[2]-l,y=this._renderBoundaries[3]-h,w=this._width,E=this._height,L=this._opacity,A=this._maxOpacity,z=this._minOpacity,B=this._useGradientOpacity;l<0&&(l=0),h<0&&(h=0),l+f>w&&(f=w-l),h+y>E&&(y=E-h);for(var X=this.shadowCtx.getImageData(l,h,f,y),S=X.data,W=S.length,J=this._palette,j=3;j<W;j+=4){var Se=S[j],ge=Se*4;if(ge){var me;L>0?me=L:Se<A?Se<z?me=z:me=Se:me=A,S[j-3]=J[ge],S[j-2]=J[ge+1],S[j-1]=J[ge+2],S[j]=B?J[ge+3]:me}}this.ctx.putImageData(X,l,h),this._renderBoundaries=[1e3,1e3,0,0]},getValueAt:function(l){var h,f=this.shadowCtx,y=f.getImageData(l.x,l.y,1,1),w=y.data[3],E=this._max,L=this._min;return h=Math.abs(E-L)*(w/255)>>0,h},getDataURL:function(){return this.canvas.toDataURL()}},O}(),o=function(){var v=!1;return s.defaultRenderer==="canvas2d"&&(v=d),v}(),c={merge:function(){for(var p={},v=arguments.length,T=0;T<v;T++){var b=arguments[T];for(var O in b)p[O]=b[O]}return p}},u=function(){var v=function(){function l(){this.cStore={}}return l.prototype={on:function(h,f,y){var w=this.cStore;w[h]||(w[h]=[]),w[h].push(function(E){return f.call(y,E)})},emit:function(h,f){var y=this.cStore;if(y[h])for(var w=y[h].length,E=0;E<w;E++){var L=y[h][E];L(f)}}},l}(),T=function(O){var l=O._renderer,h=O._coordinator,f=O._store;h.on("renderpartial",l.renderPartial,l),h.on("renderall",l.renderAll,l),h.on("extremachange",function(y){O._config.onExtremaChange&&O._config.onExtremaChange({min:y.min,max:y.max,gradient:O._config.gradient||O._config.defaultGradient})}),f.setCoordinator(h)};function b(){var O=this._config=c.merge(s,arguments[0]||{});if(this._coordinator=new v,O.plugin){var l=O.plugin;if(s.plugins[l]){var h=s.plugins[l];this._renderer=new h.renderer(O),this._store=new h.store(O)}else throw new Error("Plugin '"+l+"' not found. Maybe it was not registered.")}else this._renderer=new o(O),this._store=new a(O);T(this)}return b.prototype={addData:function(){return this._store.addData.apply(this._store,arguments),this},removeData:function(){return this._store.removeData&&this._store.removeData.apply(this._store,arguments),this},setData:function(){return this._store.setData.apply(this._store,arguments),this},setDataMax:function(){return this._store.setDataMax.apply(this._store,arguments),this},setDataMin:function(){return this._store.setDataMin.apply(this._store,arguments),this},configure:function(O){const l=this._config;return this._config=c.merge(this._config,O),this._renderer.updateConfig(this._config,l),this._coordinator.emit("renderall",this._store._getInternalData()),this},repaint:function(){return this._coordinator.emit("renderall",this._store._getInternalData()),this},getData:function(){return this._store.getData()},getDataURL:function(){return this._renderer.getDataURL()},getValueAt:function(O){return this._store.getValueAt?this._store.getValueAt(O):this._renderer.getValueAt?this._renderer.getValueAt(O):null}},b}(),m={create:function(p){return new u(p)},register:function(p,v){s.plugins[p]=v}};return m}();var r=function(s){Reflect.getPrototypeOf(r.prototype)!==BMap.Overlay.prototype&&Reflect.setPrototypeOf(r.prototype,BMap.Overlay.prototype),this.conf=s,this.conf.visible=s.visible===void 0?!0:s.visible,this.heatmap=null,this.latlngs=[],this.bounds=null};r.prototype=Object.create(typeof BMap>"u"?null:BMap.Overlay.prototype),r.prototype.initialize=function(s){this._map=s;var a=document.createElement("div");if(a.style.position="absolute",a.style.top=0,a.style.left=0,a.style.border=0,a.style.width=this._map.getSize().width+"px",a.style.height=this._map.getSize().height+"px",this.conf.element=a,!n())return a;s.getPanes().mapPane.appendChild(a),this.conf.valueField=this.conf.valueField||"count",this.heatmap=e.create(this.conf);var d=this;return s.addEventListener("resize",function(o){var c=o.size;a.style.width=c.width+"px",a.style.height=c.height+"px",d.heatmap._renderer.setDimensions(c.width,c.height),d.draw()}),this._div=a,a},r.prototype.draw=function(){if(n()){var s=this._map.getBounds();if(!s.equals(this.bounds)){this.bounds=s;var a=this._map.pointToOverlayPixel(s.getNorthEast()),d=this._map.pointToOverlayPixel(s.getSouthWest()),o=a.y,c=d.x,u=d.y-a.y,m=a.x-d.x;if(this.conf.element.style.left=c+"px",this.conf.element.style.top=o+"px",this.conf.element.style.width=m+"px",this.conf.element.style.height=u+"px",this.latlngs.length>0){this.heatmap.removeData();var p=this.latlngs.length;const l={max:this.heatmap._store.getData().max,data:[]};for(;p--;){var v=this.latlngs[p].latlng;if(s.containsPoint(v)){var T=this._map.pointToOverlayPixel(v),c=this._map.pointToOverlayPixel(s.getSouthWest()).x,o=this._map.pointToOverlayPixel(s.getNorthEast()).y,b=new BMap.Pixel(T.x-c,T.y-o),O=this.pixelTransform(b);l.data.push({x:O.x,y:O.y,count:this.latlngs[p].c})}}this.conf.radiusChangeByZoom&&(this.heatmap._store._cfgRadius=this.conf.radiusChangeByZoom(this._map.getZoom())),this.heatmap.setData(l)}}}},r.prototype.pixelTransform=function(s){for(var a=this.heatmap.width,d=this.heatmap.height;s.x<0;)s.x+=a;for(;s.x>a;)s.x-=a;for(;s.y<0;)s.y+=d;for(;s.y>d;)s.y-=d;return s.x=s.x>>0,s.y=s.y>>0,s},r.prototype.setDataSet=function(s){if(this.data=s,!!n()){var a=this._map.getBounds(),d={max:s.max,data:[]},o=s.data,c=o.length;for(this.latlngs=[],this.heatmap.removeData(),this.conf.radiusChangeByZoom&&(this.heatmap._store._cfgRadius=this.conf.radiusChangeByZoom(this._map.getZoom()));c--;){var u=new BMap.Point(o[c].lng,o[c].lat);if(this.latlngs.push({latlng:u,c:o[c].count}),!!a.containsPoint(u)){var m=this._map.pointToOverlayPixel(u),p=this._map.pointToOverlayPixel(a.getSouthWest()).x,v=this._map.pointToOverlayPixel(a.getNorthEast()).y,T=new BMap.Pixel(m.x-p,m.y-v),b=this.pixelTransform(T);d.data.push({x:b.x,y:b.y,count:o[c].count})}}this.heatmap.setData(d)}},r.prototype.addDataPoint=function(s,a,d){if(n()){this.data&&this.data.data&&this.data.data.push({lng:s,lat:a,count:d});var o=new BMap.Point(s,a),c=this.pixelTransform(this._map.pointToOverlayPixel(o));this.heatmap.store.addDataPoint(c.x,c.y,d),this.latlngs.push({latlng:o,c:d})}},r.prototype.toggle=function(){n()&&(this.conf.visible===!0?this.conf.visible=!1:this.conf.visible=!0,this.conf.visible?this.conf.element.style.display="block":this.conf.element.style.display="none")},r.prototype.setOptions=function(s){if(n()){for(var a in s)a=="radius"&&(this.heatmap._store._cfgRadius=s[a]);this.heatmap.configure(s),this.data&&this.setDataSet(this.data)}};function n(){var s=document.createElement("canvas");return!!(s.getContext&&s.getContext("2d"))}return r})}(Ae)),Ae.exports}var ci=hi();const di=Fe(ci),Xt=10,Ge={toGoogle:(i,t)=>({opacity:i.opacity,radius:i.radius??Xt,gradient:i.gradient&&Object.entries(i.gradient).sort(([e],[r])=>+e-+r).map(([e,r])=>r),maxIntensity:i.maxIntensity,data:Ne.toGoogle(i.data,t)}),toBaidu:(i,t,e)=>({opacity:i.opacity,radius:i.radius??Xt,gradient:i.gradient,data:Ne.toBaidu(i.data,t,e)})},Ne={toGoogle:(i,t)=>i.map(e=>"weight"in e?{weight:e.weight,location:e.position.toGoogle(t)}:e.toGoogle(t)),toBaidu:(i,t,e)=>{let r=1;return{data:i.map(s=>{let a,d;return"weight"in s?(a=s.position.to(t),d=s.weight):(a=s.to(t),d=1),r<d&&(r=d),{lng:a.lng,lat:a.lat,count:d}}),max:e??r}}};class $t{}class vr extends $t{constructor(e,r){super();g(this,"inner");this.map=e,this.inner=new google.maps.visualization.HeatmapLayer(Ge.toGoogle(r,this.map.coordType)),this.inner.setMap(e.innerMap)}setData(e){this.inner.setData(Ne.toGoogle(e,this.map.coordType))}setOptions(e){this.inner.setOptions(Ge.toGoogle(e,this.map.coordType))}remove(){this.inner.setMap(null)}}class _r extends $t{constructor(e,r){super();g(this,"inner");this.map=e;const n=Ge.toBaidu(r,this.map.coordType,r.maxIntensity);this.inner=new di(n),e.innerMap.addOverlay(this.inner),this.inner.setDataSet(n.data)}get innerDataMax(){var e;return(e=this.inner.data)==null?void 0:e.max}set innerDataMax(e){var r;((r=this.inner).data??(r.data={})).max=e}setData(e){this.inner.setDataSet(Ne.toBaidu(e,this.map.coordType,this.innerDataMax))}setOptions(e){const r=Ge.toBaidu(e,this.map.coordType,e.maxIntensity??this.innerDataMax);e.data!==this.inner.data?this.inner.setDataSet(r.data):e.maxIntensity&&(this.innerDataMax=e.maxIntensity),this.inner.setOptions(r)}remove(){this.map.innerMap.removeOverlay(this.inner)}}class zt{constructor(t){this.options=t}}function be(i,t,e){const r=new URL(t,i),n=new URLSearchParams(Object.entries(e).filter($r));return r.search="?"+n.toString(),r}function xt(){const i=window.location.hostname.split(".").filter(t=>!exports.Strings.isInt(t));return i.length===3?i.join("."):[...i,"tg","map","urls"].slice(0,3).join(".")}const Te=class Te extends zt{directions(t,e,r){return be(Te.BASE_URL,"dir/",{api:"1",origin:exports.Location.toString(t,R.gcj02),destination:exports.Location.toString(e,R.gcj02),travelmode:r})}search(t){return be(Te.BASE_URL,"search/",{api:"1",query:exports.Location.toString(t,R.gcj02)})}};g(Te,"BASE_URL","https://www.google.com/maps/");let Ze=Te;const oe=class oe extends zt{directions(t,e,r="driving"){const n=exports.Location.getCoordType(e)??exports.Location.getCoordType(t)??R.bd09,s=exports.Location.toString(e,n);return be(oe.BASE_URL,"direction",{origin:exports.Location.toString(t,n)??(typeof e!="string"?`name:请选择起点|latlng:${s}`:s),destination:s,coord_type:n===R.bd09?void 0:n,mode:r,output:"html",region:"中国",src:xt()})}search(t){return typeof t=="string"?this.geocoderApi(t):this.latlngApi(t)}latlngApi(t){const e=t.to(R.bd09);return new URL(`https://map.baidu.com/?latlng=${e.lat},${e.lng}`)}markerApi(t,e,r){return be(oe.BASE_URL,"marker",{location:`${t.lat},${t.lng}`,coord_type:t.coord===R.bd09?void 0:t.coord,title:e,content:r,output:"html",src:xt()})}geocoderApi(t){return be(oe.BASE_URL,"geocoder",{...typeof t=="string"?{address:t}:{location:`${t.lat},${t.lng}`,coord_type:t.coord===R.bd09?void 0:t.coord},output:"html",src:xt()})}};g(oe,"BASE_URL","https://api.map.baidu.com/");let We=oe,ui=class br{constructor(t,e,r){this.extend(br,google.maps.OverlayView),this.map_=t,this.MARKER_CLUSTER_IMAGE_PATH_="../images/m",this.MARKER_CLUSTER_IMAGE_EXTENSION_="png",this.markers_=[],this.clusters_=[],this.sizes=[53,56,66,78,90],this.styles_=[],this.ready_=!1;var n=r||{};this.zIndex_=n.zIndex||google.maps.Marker.MAX_ZINDEX+1,this.gridSize_=n.gridSize||60,this.minClusterSize_=n.minimumClusterSize||2,this.maxZoom_=n.maxZoom||null,this.styles_=n.styles||[],this.imagePath_=n.imagePath||this.MARKER_CLUSTER_IMAGE_PATH_,this.imageExtension_=n.imageExtension||this.MARKER_CLUSTER_IMAGE_EXTENSION_,this.zoomOnClick_=!0,n.zoomOnClick!=null&&(this.zoomOnClick_=n.zoomOnClick),this.averageCenter_=!1,n.averageCenter!=null&&(this.averageCenter_=n.averageCenter),this.setupStyles_(),this.setMap(t),this.prevZoom_=this.map_.getZoom();var s=this;google.maps.event.addListener(this.map_,"zoom_changed",function(){var a=s.map_.getZoom(),d=s.map_.minZoom||0,o=Math.min(s.map_.maxZoom||100,s.map_.mapTypes[s.map_.getMapTypeId()].maxZoom);a=Math.min(Math.max(a,d),o),s.prevZoom_!=a&&(s.prevZoom_=a,s.resetViewport())}),google.maps.event.addListener(this.map_,"idle",function(){s.redraw()}),e&&(e.length||Object.keys(e).length)&&this.addMarkers(e,!1)}extend(t,e){return(function(r){for(var n in r.prototype)this.prototype[n]=r.prototype[n];return this}).apply(t,[e])}onAdd(){this.setReady_(!0)}draw(){}setupStyles_(){if(!this.styles_.length)for(var t=0,e;e=this.sizes[t];t++)this.styles_.push({url:this.imagePath_+(t+1)+"."+this.imageExtension_,height:e,width:e})}fitMapToMarkers(){for(var t=this.getMarkers(),e=new google.maps.LatLngBounds,r=0,n;n=t[r];r++)e.extend(n.getPosition());this.map_.fitBounds(e)}setZIndex(t){this.zIndex_=t}getZIndex(){return this.zIndex_}setStyles(t){this.styles_=t}getStyles(){return this.styles_}isZoomOnClick(){return this.zoomOnClick_}isAverageCenter(){return this.averageCenter_}getMarkers(){return this.markers_}getTotalMarkers(){return this.markers_.length}setMaxZoom(t){this.maxZoom_=t}getMaxZoom(){return this.maxZoom_}calculator_(t,e){for(var r=0,n=t.length,s=n;s!==0;)s=parseInt(s/10,10),r++;return r=Math.min(r,e),{text:n,index:r}}setCalculator(t){this.calculator_=t}getCalculator(){return this.calculator_}addMarkers(t,e){if(t.length)for(let r=0,n;n=t[r];r++)this.pushMarkerTo_(n);else if(Object.keys(t).length)for(let r in t)this.pushMarkerTo_(t[r]);e||this.redraw()}pushMarkerTo_(t){if(t.isAdded=!1,t.draggable){var e=this;google.maps.event.addListener(t,"dragend",function(){t.isAdded=!1,e.repaint()})}this.markers_.push(t)}addMarker(t,e){this.pushMarkerTo_(t),e||this.redraw()}removeMarker_(t){var e=-1;if(this.markers_.indexOf)e=this.markers_.indexOf(t);else for(var r=0,n;n=this.markers_[r];r++)if(n==t){e=r;break}return e==-1?!1:(t.setMap(null),this.markers_.splice(e,1),!0)}removeMarker(t,e){var r=this.removeMarker_(t);return!e&&r?(this.resetViewport(),this.redraw(),!0):!1}removeMarkers(t,e){for(var r=t===this.getMarkers()?t.slice():t,n=!1,s=0,a;a=r[s];s++){var d=this.removeMarker_(a);n=n||d}if(!e&&n)return this.resetViewport(),this.redraw(),!0}setReady_(t){this.ready_||(this.ready_=t,this.createClusters_())}getTotalClusters(){return this.clusters_.length}getMap(){return this.map_}setMap(t){this.map_=t}getGridSize(){return this.gridSize_}setGridSize(t){this.gridSize_=t}getMinClusterSize(){return this.minClusterSize_}setMinClusterSize(t){this.minClusterSize_=t}getExtendedBounds(t){var e=this.getProjection(),r=new google.maps.LatLng(t.getNorthEast().lat(),t.getNorthEast().lng()),n=new google.maps.LatLng(t.getSouthWest().lat(),t.getSouthWest().lng()),s=e.fromLatLngToDivPixel(r);s.x+=this.gridSize_,s.y-=this.gridSize_;var a=e.fromLatLngToDivPixel(n);a.x-=this.gridSize_,a.y+=this.gridSize_;var d=e.fromDivPixelToLatLng(s),o=e.fromDivPixelToLatLng(a);return t.extend(d),t.extend(o),t}isMarkerInBounds_(t,e){return e.contains(t.getPosition())}clearMarkers(){this.resetViewport(!0),this.markers_=[]}resetViewport(t){for(let e=0,r;r=this.clusters_[e];e++)r.remove();for(let e=0,r;r=this.markers_[e];e++)r.isAdded=!1,t&&r.setMap(null);this.clusters_=[]}repaint(){var t=this.clusters_.slice();this.clusters_.length=0,this.resetViewport(),this.redraw(),setTimeout(function(){for(var e=0,r;r=t[e];e++)r.remove()},0)}redraw(){this.createClusters_()}distanceBetweenPoints_(t,e){if(!t||!e)return 0;var r=6371,n=(e.lat()-t.lat())*Math.PI/180,s=(e.lng()-t.lng())*Math.PI/180,a=Math.sin(n/2)*Math.sin(n/2)+Math.cos(t.lat()*Math.PI/180)*Math.cos(e.lat()*Math.PI/180)*Math.sin(s/2)*Math.sin(s/2),d=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)),o=r*d;return o}addToClosestCluster_(t){for(var e=4e4,r=null,n=0,s;s=this.clusters_[n];n++){var a=s.getCenter();if(a){var d=this.distanceBetweenPoints_(a,t.getPosition());d<e&&(e=d,r=s)}}if(r&&r.isMarkerInClusterBounds(t))r.addMarker(t);else{var o=new pi(this);o.addMarker(t),this.clusters_.push(o)}}createClusters_(){if(this.ready_)for(var t=new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),this.map_.getBounds().getNorthEast()),e=this.getExtendedBounds(t),r=0,n;n=this.markers_[r];r++)!n.isAdded&&this.isMarkerInBounds_(n,e)&&this.addToClosestCluster_(n)}},pi=class{constructor(t){this.markerClusterer_=t,this.map_=t.getMap(),this.gridSize_=t.getGridSize(),this.minClusterSize_=t.getMinClusterSize(),this.averageCenter_=t.isAverageCenter(),this.center_=null,this.markers_=[],this.bounds_=null,this.clusterIcon_=new Gt(this,t.getStyles(),t.getGridSize())}isMarkerAlreadyAdded(t){if(this.markers_.indexOf)return this.markers_.indexOf(t)!=-1;for(var e=0,r;r=this.markers_[e];e++)if(r==t)return!0;return!1}addMarker(t){if(this.isMarkerAlreadyAdded(t))return!1;if(!this.center_)this.center_=t.getPosition(),this.calculateBounds_();else if(this.averageCenter_){var e=this.markers_.length+1,r=(this.center_.lat()*(e-1)+t.getPosition().lat())/e,n=(this.center_.lng()*(e-1)+t.getPosition().lng())/e;this.center_=new google.maps.LatLng(r,n),this.calculateBounds_()}t.isAdded=!0,this.markers_.push(t);var s=this.markers_.length;if(s<this.minClusterSize_&&t.getMap()!=this.map_&&t.setMap(this.map_),s==this.minClusterSize_)for(var a=0;a<s;a++)this.markers_[a].setMap(null);return s>=this.minClusterSize_&&t.setMap(null),this.updateIcon(),!0}getMarkerClusterer(){return this.markerClusterer_}getBounds(){for(var t=new google.maps.LatLngBounds(this.center_,this.center_),e=this.getMarkers(),r=0,n;n=e[r];r++)t.extend(n.getPosition());return t}remove(){this.clusterIcon_.remove(),this.markers_.length=0,delete this.markers_}getSize(){return this.markers_.length}getMarkers(){return this.markers_}getCenter(){return this.center_}calculateBounds_(){var t=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.markerClusterer_.getExtendedBounds(t)}isMarkerInClusterBounds(t){return this.bounds_.contains(t.getPosition())}getMap(){return this.map_}updateIcon(){var t=this.map_.getZoom(),e=this.markerClusterer_.getMaxZoom();if(e&&t>e){for(var r=0,n;n=this.markers_[r];r++)n.setMap(this.map_);return}if(this.markers_.length<this.minClusterSize_){this.clusterIcon_.hide();return}var s=this.markerClusterer_.getStyles().length,a=this.markerClusterer_.getCalculator()(this.markers_,s);this.clusterIcon_.setCenter(this.center_),this.clusterIcon_.setSums(a),this.clusterIcon_.show()}};class Gt{constructor(t,e,r){t.getMarkerClusterer().extend(Gt,google.maps.OverlayView),this.styles_=e,this.padding_=r||0,this.cluster_=t,this.center_=null,this.map_=t.getMap(),this.div_=null,this.sums_=null,this.visible_=!1,this.setMap(this.map_)}triggerClusterClick(){var t=this.cluster_.getBounds(),e=this.cluster_.getMarkerClusterer();google.maps.event.trigger(e.map_,"clusterclick",this.cluster_),e.isZoomOnClick()&&(this.map_.fitBounds(t),this.map_.setCenter(t.getCenter()))}onAdd(){if(this.div_=document.createElement("DIV"),this.visible_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(t),this.div_.innerHTML=this.sums_.text}var e=this.getPanes();e.overlayMouseTarget.appendChild(this.div_);var r=this;google.maps.event.addDomListener(this.div_,"click",function(){r.triggerClusterClick()})}getPosFromLatLng_(t){var e=this.getProjection().fromLatLngToDivPixel(t);return e.x-=parseInt(this.width_/2,10),e.y-=parseInt(this.height_/2,10),e}draw(){if(this.visible_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.top=t.y+"px",this.div_.style.left=t.x+"px"}}hide(){this.div_&&(this.div_.style.display="none"),this.visible_=!1}show(){if(this.div_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(t),this.div_.style.display=""}this.visible_=!0}remove(){this.setMap(null)}onRemove(){this.div_&&this.div_.parentNode&&(this.hide(),this.div_.p