UNPKG

@pansy/react-mapbox-gl

Version:

🌍 基于 Mapbox GL 封装的 React 组件库

1 lines 40 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM"),require("mapboxgl")):"function"==typeof define&&define.amd?define(["React","ReactDOM","mapboxgl"],t):"object"==typeof exports?exports.ReactMapboxGl=t(require("React"),require("ReactDOM"),require("mapboxgl")):e.ReactMapboxGl=t(e.React,e.ReactDOM,e.mapboxgl)}(self,(function(e,t,r){return function(){var n={159:function(e,t,r){"use strict";var n=r(24),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,u=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,r){var n,i={},c=null,l=null;for(n in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(l=t.ref),t)a.call(t,n)&&!s.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===i[n]&&(i[n]=t[n]);return{$$typeof:o,type:e,key:c,ref:l,props:i,_owner:u.current}}t.Fragment=i,t.jsx=c,t.jsxs=c},955:function(e,t,r){"use strict";e.exports=r(159)},24:function(t){"use strict";t.exports=e},314:function(e){"use strict";e.exports=t},640:function(e){"use strict";e.exports=r},890:function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n},e.exports.__esModule=!0,e.exports.default=e.exports},160:function(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},884:function(e,t,r){var n=r(890);e.exports=function(e){if(Array.isArray(e))return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports},57:function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},905:function(e,t,r){var n=r(726);function o(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}e.exports=function(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},837:function(e,t,r){var n=r(784);e.exports=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=n(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){s=!0,a=e},f:function(){try{u||null==r.return||r.return()}finally{if(s)throw a}}}},e.exports.__esModule=!0,e.exports.default=e.exports},650:function(e,t,r){var n=r(726);e.exports=function(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},333:function(e){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},785:function(e){e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],s=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}},e.exports.__esModule=!0,e.exports.default=e.exports},537:function(e){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},113:function(e){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},643:function(e,t,r){var n=r(650);function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e},e.exports.__esModule=!0,e.exports.default=e.exports},209:function(e,t,r){var n=r(276);e.exports=function(e,t){if(null==e)return{};var r,o,i=n(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i},e.exports.__esModule=!0,e.exports.default=e.exports},276:function(e){e.exports=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o},e.exports.__esModule=!0,e.exports.default=e.exports},892:function(e,t,r){var n=r(160),o=r(785),i=r(784),a=r(537);e.exports=function(e,t){return n(e)||o(e,t)||i(e,t)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},115:function(e,t,r){var n=r(884),o=r(333),i=r(784),a=r(113);e.exports=function(e){return n(e)||o(e)||i(e)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},50:function(e,t,r){var n=r(374).default;e.exports=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},726:function(e,t,r){var n=r(374).default,o=r(50);e.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},374:function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},784:function(e,t,r){var n=r(890);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return function(){"use strict";i.r(a),i.d(a,{Layer:function(){return me},Map:function(){return te},Marker:function(){return ce},MarkerCluster:function(){return Ue},Popup:function(){return $e},Source:function(){return he},StyleLoaded:function(){return fe},Supercluster:function(){return je},WorldView:function(){return Be},useMap:function(){return re}});var e=i(643),t=i.n(e),r=i(892),n=i.n(r),o=i(640),u=i.n(o),s=i(24),c=i.n(s),l=i(115),f=i.n(l),d=i(837),p=i.n(d),v=(i(209),i(726),i(650),i(314)),h=i(374),y=i.n(h),m=(Array.isArray,function(e){return!!(e&&e.constructor&&e.call&&e.apply)}),g="undefined"!=typeof window&&"undefined"!=typeof document,b="undefined"!=typeof navigator;function x(e){return void 0===e}function w(e){var t;return"undefined"!=typeof window&&null!=window.navigator&&e.test((null==(t=window.navigator.userAgentData)?void 0:t.platform)||window.navigator.platform)}function M(){return w(/^Mac/i)}function _(){return w(/^iPhone/i)||w(/^iPad/i)||M()&&navigator.maxTouchPoints>1}function S(e,t){if(g)return e?m(e)?e():"current"in e?e.current:e:t}function E(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=new Set;function o(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=n.has(e);if(a)return!1;if(e===t)return!0;if(r&&i>1)return!1;n.add(e);var u=i+1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(var s=0;s<e.length;s++)if(!o(e[s],t[s],u))return!1;return!0}if(e&&t&&"object"===h(e)&&"object"===h(t)){var c=Object.keys(e);return c.length===Object.keys(t).length&&c.every((function(r){return o(e[r],t[r],u)}))}return!1}return o(e,t)}var P=function(){for(var e="",t=0;t<32;t++)switch(t){case 8:case 20:e+="-".concat(Math.trunc(16*Math.random()).toString(16));break;case 12:e+="-4";break;case 16:e+="-".concat((8|16*Math.random()).toString(16));break;default:e+=Math.trunc(16*Math.random()).toString(16)}return e};"undefined"!=typeof window&&"requestAnimationFrame"in window&&function(e){return window.requestAnimationFrame(e)};function O(){var e=(0,s.useState)((function(){return document.createElement("div")})),t=r(e,1)[0],n=(0,s.useState)({render:function(){return null},remove:function(){return null}}),o=r(n,2),i=o[0],a=o[1],u=(0,s.useCallback)((function(e){return{render:function(t){var r=t.children;return r?(0,v.createPortal)(r,e):null},remove:function(e){e&&(0,v.unmountComponentAtNode)(e)}}}),[]);return(0,s.useEffect)((function(){t&&i.remove();var e=u(t);return a(e),function(){e.remove(t)}}),[t]),{Portal:i.render,container:t}}function k(e){var t=(0,s.useRef)(e);return t.current=e,t}var A=b?navigator:void 0;A&&(A.connection||A.mozConnection||A.webkitConnection);function j(e){var t=(0,s.useState)(e),n=r(t,2),o=n[0],i=n[1],a=(0,s.useRef)(o);return a.current=o,[o,(0,s.useCallback)((function(e){var t,r;a.current=(t=e,r=a.current,"function"==typeof t?t.length?t(r):t():t),i(a.current)}),[]),(0,s.useCallback)((function(){return a.current}),[])]}var C=function(e){var t=k(e);(0,s.useEffect)((function(){return function(){t.current()}}),[])},R=function(e,t){return!Object.is(e,t)};function L(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:R,r=(0,s.useRef)(),n=(0,s.useRef)();return t(n.current,e)&&(r.current=n.current,n.current=e),r.current}var I,T=(I=s.useEffect,function(e,t){var r=(0,s.useRef)(),n=(0,s.useRef)(0);void 0!==t&&E(t,r.current)||(r.current=t,n.current+=1),I(e,[n.current])});var Z=function(e){return function(t,r){var n=(0,s.useRef)(!1);e((function(){return function(){n.current=!1}}),[]),e((function(){if(n.current)return t();n.current=!0}),r)}}(s.useEffect);function D(e){var t=(0,s.useRef)(e);t.current=(0,s.useMemo)((function(){return e}),[e]);var r=(0,s.useRef)();return r.current||(r.current=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.current.apply(this,r)}),r.current}function z(e,t){if(e===t)return!0;for(var r=0;r<e.length;r++)if(!Object.is(e[r],t[r]))return!1;return!0}function F(e){return function(t,r,n){var o=(0,s.useRef)(!1),i=(0,s.useRef)([]),a=(0,s.useRef)([]),u=(0,s.useRef)();e((function(){var e,s=(Array.isArray(n)?n:[n]).map((function(e){return S(e)}));if(!o.current)return o.current=!0,i.current=s,a.current=r,void(u.current=t());s.length===i.current.length&&z(s,i.current)&&z(r,a.current)||(null==(e=u.current)||e.call(u),i.current=s,a.current=r,u.current=t())})),C((function(){var e;null==(e=u.current)||e.call(u),o.current=!1}))}}var N=F(s.useEffect);function U(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.enable,o=void 0===n||n,i=k(t);N((function(){if(o){var t=S(r.target,window);if(null==t?void 0:t.addEventListener){var n=function(e){return i.current(e)};return t.addEventListener(e,n,{capture:r.capture,once:r.once,passive:r.passive}),function(){t.removeEventListener(e,n,{capture:r.capture})}}}}),[e,r.capture,r.once,r.passive,o],r.target)}g&&("ontouchstart"in window||window.DocumentTouch&&(document,DocumentTouch));M()||_();var B="RCUSE_SYNC_STORAGE_EVENT_NAME";function q(e){return function(t){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.listenStorageChange,a=void 0!==i&&i,u=o.onError,c=void 0===u?function(e){console.error(e)}:u;try{n=e()}catch(e){c(e)}var l=function(e){return o.serializer?o.serializer(e):JSON.stringify(e)},f=function(e){return o.deserializer?o.deserializer(e):JSON.parse(e)};function d(){try{var e=null==n?void 0:n.getItem(t);if(e)return f(e)}catch(e){c(e)}return m(o.defaultValue)?o.defaultValue():o.defaultValue}var p=(0,s.useState)(d),v=r(p,2),h=v[0],y=v[1];Z((function(){y(d())}),[t]);var g=function(e){var r=m(e)?e(h):e;a||y(r);try{var o,i=null==n?void 0:n.getItem(t);x(r)?(o=null,null==n||n.removeItem(t)):(o=l(r),null==n||n.setItem(t,o)),dispatchEvent(new CustomEvent(B,{detail:{key:t,newValue:o,oldValue:i,storageArea:n}}))}catch(e){c(e)}},b=function(e){e.key===t&&e.storageArea===n&&y(d())},w=function(e){b(e.detail)};return U("storage",b,{enable:a}),U(B,w,{enable:a}),[h,D(g)]}}q((function(){return g?localStorage:void 0})),q((function(){return g?sessionStorage:void 0}));(null==globalThis?void 0:globalThis.document)&&s.useLayoutEffect;s["useId".toString()];F(s.useLayoutEffect);var W=function(e,t){var r=(0,s.useRef)();(0,s.useEffect)((function(){var n,o,i=(n=r.current,o=t,n?n.map((function(e,t){return Object.is(n[t],null==o?void 0:o[t])?-1:t})).filter((function(e){return e>=0})):o?o.map((function(e,t){return t})):[]),a=r.current;return r.current=t,e(i,a,t)}),t)},G=function(e,t,r){var n=r.eventMap,o=void 0===n?{}:n,i=r.eventList,a=void 0===i?[]:i;W((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(e){var i=t.filter((function(e){return!!e})).map((function(e){return e-1}));t.includes(0)&&(i=a.map((function(e,t){return t}))),i.forEach((function(t){var i=o[a[t]],u=null==r?void 0:r[t+1],s=null==n?void 0:n[t+1];u&&e.off(i,u),s&&e.on(i,s)}))}}),[e].concat(f()(a.map((function(e){return t[e]}))))),C((function(){e&&a.forEach((function(r){var n=o[r],i=t[r];n&&i&&e.off(n,i)}))}))},V=function(e){return e[0].toUpperCase()+e.slice(1,e.length)};function H(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.setterMap,o=void 0===n?{}:n,i=r.converterMap,a=void 0===i?{}:i,u=L(e);T((function(){t&&c(e,!0)}),[e]),C((function(){t&&"remove"in t&&t.remove()}));var s=function(){c(e,!1)},c=function(r){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t)try{Object.keys(r).forEach((function(i){if(!m(e[i])||!/^on[A-Z]/.test(i)){var s=!0;if(n&&(s=!E(r[i],null==u?void 0:u[i])),s){var c=r[i];if(i in a&&(c=a[i](r[i])),i in o)o[i](c,t);else{var l="set".concat(V(i));l in t&&t[l](c)}}}}))}catch(e){console.error(e)}};return{onInstanceCreated:s}}var Y=(0,s.createContext)({}),$=["center","zoom","minZoom","maxZoom","style","maxBounds","dragPan","renderWorldCopies","pitch","maxPitch","minPitch","bearing","projection","touchPitch","boxZoom","scrollZoom","dragRotate","dragPan","keyboard","touchZoomRotate","doubleClickZoom"].concat(["accessToken","antialias","attributionControl","bearingSnap","bounds","hash","interactive","clickTolerance","pitchWithRotate","customAttribution","cooperativeGestures","logoPosition","failIfMajorPerformanceCaveat","preserveDrawingBuffer","refreshExpiredTiles","trackResize","fitBoundsOptions","maxTileCacheSize","transformRequest","collectResourceTiming","fadeDuration","crossSourceCollisions","locale","localFontFamily","localIdeographFontFamily","testMode"]),J={touchPitch:function(e,t){t&&(e?t.touchPitch.enable():t.touchPitch.disable())},scrollZoom:function(e,t){t&&(e?t.scrollZoom.enable():t.scrollZoom.disable())},boxZoom:function(e,t){t&&(e?t.boxZoom.enable():t.boxZoom.disable())},dragRotate:function(e,t){t&&(e?t.dragRotate.enable():t.dragRotate.disable())},dragPan:function(e,t){t&&(e?t.dragPan.enable():t.dragPan.disable())},keyboard:function(e,t){t&&(e?t.keyboard.enable():t.keyboard.disable())},touchZoomRotate:function(e,t){t&&(e?t.touchZoomRotate.enable():t.touchZoomRotate.disable())},doubleClickZoom:function(e,t){t&&(e?t.doubleClickZoom.enable():t.doubleClickZoom.disable())}},K={},Q={onError:"error",onLoad:"load",onIdle:"idle",onRemove:"remove",onRender:"render",onResize:"resize",onWebglContextLost:"webglcontextlost",onWebglContextRestored:"webglcontextrestored",onDataloading:"dataloading",onData:"data",onSourceDataLoading:"sourcedataloading",onStyleDataLoading:"styledataloading",onStyleLoad:"style.load",onStyleImportLoad:"style.import.load",onSourceData:"sourcedata",onStyleData:"styledata",onBoxZoomCancel:"boxzoomcancel",onBoxZoomStart:"boxzoomstart",onBoxZoomEnd:"boxzoomend",onTouchCancel:"touchcancel",onTouchMove:"touchmove",onTouchEnd:"touchend",onTouchStart:"touchstart",onClick:"click",onContextMenu:"contextmenu",onDoubleClick:"dblclick",onMouseMove:"mousemove",onMouseUp:"mouseup",onMouseDown:"mousedown",onMouseOut:"mouseout",onMouseOver:"mouseover",onMoveStart:"movestart",onMove:"move",onMoveEnd:"moveend",onZoomStart:"zoomstart",onZoom:"zoom",onZoomEnd:"zoomend",onRotateStart:"rotatestart",onRotate:"rotate",onRotateEnd:"rotateend",onDragStart:"dragstart",onDrag:"drag",onDragEnd:"dragend",onPitchStart:"pitchstart",onPitch:"pitch",onPitchEnd:"pitchend",onWheel:"wheel",onStyleImageMissing:"styleimagemissing"},X=Object.keys(Q),ee=i(955),te=(0,s.forwardRef)((function(e,r){var o=e.className,i=e.loading,a=e.containerStyle,c=e.children,l=(0,s.useRef)(null),f=(0,s.useState)(),d=n()(f,2),p=d[0],v=d[1],h=(0,s.useMemo)((function(){return t()({position:"relative",width:"100%",height:"100%"},a)}),[a]),y=function(){var t=function(e){var t={container:l.current};return $.forEach((function(r){r in e&&"container"!==r&&(t[r]=e[r])})),t}(e);return Promise.resolve(new(u().Map)(t))},m=(0,s.useRef)({}).current,g=H(e,p,{setterMap:J,converterMap:K}).onInstanceCreated;G(p,e,{eventMap:Q,eventList:X}),(0,s.useImperativeHandle)(r,(function(){return p}),[p]),(0,s.useEffect)((function(){l.current&&y().then((function(e){g(),m.map=e,v(e)}))}),[l]);return(0,ee.jsxs)("div",{ref:l,style:h,className:o,children:[!p&&i,p&&(0,ee.jsx)(Y.Provider,{value:m,children:(0,ee.jsx)("div",{style:{height:"100%"},children:c})})]})}));te.displayName="Map";var re=function(){var e=(0,s.useContext)(Y);if(!e)throw new Error("The useMap must be used in the Map container");return e},ne=function(e){if(!e)return null;if("toBounds"in e)return e;var t=0,r=0;return Array.isArray(e)?(t=e[0],r=e[1]):"lng"in e&&"lat"in e?(t=e.lng,r=e.lat):"lon"in e&&"lat"in e&&(t=e.lon,r=e.lat),0!==t&&0!==r?new(u().LngLat)(t,r):null},oe=["offset","draggable","rotation","rotationAlignment","pitchAlignment","occludedOpacity","lngLat"].concat(["anchor","clickTolerance","color","scale"]),ie={},ae={lngLat:ne},ue={onDragStart:"dragstart",onDrag:"drag",onDragEnd:"dragend"},se=Object.keys(ue),ce=c().forwardRef((function(e,t){var r=re().map,o=O(),i=o.Portal,a=o.container,c=j(),l=n()(c,3),f=l[0],d=l[1],p=l[2],v=H(e,f,{setterMap:ie,converterMap:ae}).onInstanceCreated;G(f,e,{eventMap:ue,eventList:se}),(0,s.useImperativeHandle)(t,(function(){return f}),[f]);var h=function(t){var r;null===(r=e.onClick)||void 0===r||r.call(e,{type:"click",target:p(),originalEvent:t})},y=function(e){e.stopPropagation(),e.preventDefault()};(0,s.useEffect)((function(){return r&&m().then((function(e){d(e),e.addTo(r),a.addEventListener("click",h),a.addEventListener("dblclick",y),v()})),function(){a&&(a.removeEventListener("click",h),a.removeEventListener("dblclick",h))}}),[r]);var m=function(){var t=g(e);if(t.lngLat){var r=new(u().Marker)(a,t);return r.setLngLat(t.lngLat),Promise.resolve(r)}return Promise.reject()},g=function(e){var t={};return oe.forEach((function(r){r in e&&(t[r]=b(r,e))})),t},b=function(e,t){var r=t[e];if(e in ae)try{var n;r=null===(n=ae[e])||void 0===n?void 0:n.call(ae,t[e])}catch(e){}return r};return(0,ee.jsx)(ee.Fragment,{children:f&&(0,ee.jsx)(i,{children:e.children})})})),le=function(e){return e.style&&e.style._loaded},fe=function(e){var t=e.isFinishRender,r=void 0!==t&&t,o=e.children,i=re().map,a=(0,s.useState)(0),u=n()(a,2)[1],c=(0,s.useRef)([0,0,0]),l=(0,s.useRef)(0),f=function(){u((function(e){return e+1}))},d=function(){return["031","131"].includes(c.current.join(""))},p=function(){c.current=[1,0,0],f()},v=function(){c.current[1]=c.current[1]+1,3===c.current[1]&&(l.current=l.current+1),d()&&f()},h=function(){c.current[2]=1};return(0,s.useEffect)((function(){if(i)return le(i)&&(c.current=[0,3,1],l.current=1,f(),c.current=[0,0,0]),i.on("styledataloading",p),i.on("styledata",v),i.on("style.load",h),function(){i.off("styledataloading",p),i.off("styledata",v),i.off("style.load",h)}}),[i]),m(o)?o(d(),1===l.current):r?d()?e.children:null:l.current>0&&e.children};function de(e,t){if(!e)throw new Error(t)}function pe(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!pe(e[r],t[r]))return!1;return!0}if(Array.isArray(t))return!1;if("object"===y()(e)&&"object"===y()(t)){var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(var i=0,a=n;i<a.length;i++){var u=a[i];if(!t.hasOwnProperty(u))return!1;if(!pe(e[u],t[u]))return!1}return!0}return!1}var ve=0;function he(e){var r=re().map,o=(0,s.useRef)(e),i=(0,s.useState)(0),a=n()(i,2)[1],u=(0,s.useMemo)((function(){return e.id||"jsx-source-".concat(ve++)}),[]);(0,s.useEffect)((function(){if(r){var e=function(){return setTimeout((function(){return a((function(e){return e+1}))}),0)};return r.on("styledata",e),e(),function(){if(r.off("styledata",e),r.getStyle()&&le(r)&&r.getSource(u)){var t,n=null===(t=r.getStyle())||void 0===t?void 0:t.layers;if(n){var o,i=p()(n);try{for(i.s();!(o=i.n()).done;){var a=o.value;a.source===u&&r.removeLayer(a.id)}}catch(e){i.e(e)}finally{i.f()}}r.removeSource(u)}}}}),[r]);var l=r&&r.getStyle()&&r.getSource(u);return l?function(e,t,r){de(t.id===r.id,"source id changed"),de(t.type===r.type,"source type changed");var n="",o=0;for(var i in t)"children"===i||"id"===i||pe(r[i],t[i])||(n=i,o++);if(o){var a=t.type;if("geojson"===a)e.setData(t.data);else if("image"===a)e.updateImage({url:t.url,coordinates:t.coordinates});else if("setCoordinates"in e&&1===o&&"coordinates"===n)e.setCoordinates(t.coordinates);else if("setUrl"in e)switch(n){case"url":e.setUrl(t.url);break;case"tiles":e.setTiles(t.tiles)}else console.warn("Unable to update <Source> prop: ".concat(n))}}(l,e,o.current):l=function(e,r,n){if(le(e)){var o=t()({},n);return delete o.id,delete o.children,e.addSource(r,o),e.getSource(r)}}(r,u,e),o.current=e,l&&c().Children.map(e.children,(function(e){return e&&(0,s.cloneElement)(e,{source:u})}))||null}var ye=0,me=function(e){var r=re().map,o=(0,s.useRef)(e),i=(0,s.useState)(0),a=n()(i,2)[1],u=(0,s.useMemo)((function(){return e.id||"jsx-layer-".concat(ye++)}),[]);if((0,s.useEffect)((function(){if(r){var e=function(){return a((function(e){return e+1}))};return r.on("styledata",e),e(),function(){r.off("styledata",e),le(r)&&r.getLayer(u)&&r.removeLayer(u)}}}),[r]),le(r)&&r.getLayer(u))try{!function(e,t,r,n){if(de(r.id===n.id,"layer id changed"),de(r.type===n.type,"layer type changed"),"custom"!==r.type&&"custom"!==n.type){var o=r.layout,i=void 0===o?{}:o,a=r.paint,u=void 0===a?{}:a,s=r.filter,c=r.minzoom,l=r.maxzoom,f=r.beforeId;if(f!==n.beforeId&&e.moveLayer(t,f),i!==n.layout){var d=n.layout||{};for(var p in i)pe(i[p],d[p])||e.setLayoutProperty(t,p,i[p]);for(var v in d)i.hasOwnProperty(v)||e.setLayoutProperty(t,v,void 0)}if(u!==n.paint){var h=n.paint||{};for(var y in u)pe(u[y],h[y])||e.setPaintProperty(t,y,u[y]);for(var m in h)u.hasOwnProperty(m)||e.setPaintProperty(t,m,void 0)}pe(s,n.filter)||e.setFilter(t,s),c===n.minzoom&&l===n.maxzoom||e.setLayerZoomRange(t,c,l)}}(r,u,e,o.current)}catch(e){console.warn(e)}else!function(e,r,n){if(le(e)&&(!("source"in n)||e.getSource(n.source))){var o=t()(t()({},n),{},{id:r});delete o.beforeId,e.addLayer(o,n.beforeId)}}(r,u,e);return o.current=e,null};var ge=i(57),be=i(905),xe=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],we=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float64Array,o=arguments.length>3?arguments[3]:void 0;if(ge(this,e),isNaN(t)||t<0)throw new Error("Unpexpected numItems value: ".concat(t,"."));this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;var i=xe.indexOf(this.ArrayType),a=2*t*this.ArrayType.BYTES_PER_ELEMENT,u=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-u%8)%8;if(i<0)throw new Error("Unexpected typed array class: ".concat(n,"."));o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+u+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+a+u+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+u+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}return be(e,[{key:"add",value:function(e,t){var r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=t,r}},{key:"finish",value:function(){var e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return Me(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}},{key:"range",value:function(e,t,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var o=this.ids,i=this.coords,a=this.nodeSize,u=[0,o.length-1,0],s=[];u.length;){var c=u.pop()||0,l=u.pop()||0,f=u.pop()||0;if(l-f<=a)for(var d=f;d<=l;d++){var p=i[2*d],v=i[2*d+1];p>=e&&p<=r&&v>=t&&v<=n&&s.push(o[d])}else{var h=f+l>>1,y=i[2*h],m=i[2*h+1];y>=e&&y<=r&&m>=t&&m<=n&&s.push(o[h]),(0===c?e<=y:t<=m)&&(u.push(f),u.push(h-1),u.push(1-c)),(0===c?r>=y:n>=m)&&(u.push(h+1),u.push(l),u.push(1-c))}}return s}},{key:"within",value:function(e,t,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var n=this.ids,o=this.coords,i=this.nodeSize,a=[0,n.length-1,0],u=[],s=r*r;a.length;){var c=a.pop()||0,l=a.pop()||0,f=a.pop()||0;if(l-f<=i)for(var d=f;d<=l;d++)Pe(o[2*d],o[2*d+1],e,t)<=s&&u.push(n[d]);else{var p=f+l>>1,v=o[2*p],h=o[2*p+1];Pe(v,h,e,t)<=s&&u.push(n[p]),(0===c?e-r<=v:t-r<=h)&&(a.push(f),a.push(p-1),a.push(1-c)),(0===c?e+r>=v:t+r>=h)&&(a.push(p+1),a.push(l),a.push(1-c))}}return u}}],[{key:"from",value:function(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");var n=new Uint8Array(t,0,2),o=r(n,2),i=o[0],a=o[1];if(219!==i)throw new Error("Data does not appear to be in a KDBush format.");var u=a>>4;if(1!==u)throw new Error("Got v".concat(u," data when expected v").concat(1,"."));var s=xe[15&a];if(!s)throw new Error("Unrecognized array type.");var c=new Uint16Array(t,2,1),l=r(c,1)[0],f=new Uint32Array(t,4,1);return new e(r(f,1)[0],l,s,t)}}]),e}();function Me(e,t,r,n,o,i){if(!(o-n<=r)){var a=n+o>>1;_e(e,t,a,n,o,i),Me(e,t,r,n,a-1,1-i),Me(e,t,r,a+1,o,1-i)}}function _e(e,t,r,n,o,i){for(;o>n;){if(o-n>600){var a=o-n+1,u=r-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(u-a/2<0?-1:1);_e(e,t,r,Math.max(n,Math.floor(r-u*c/a+l)),Math.min(o,Math.floor(r+(a-u)*c/a+l)),i)}var f=t[2*r+i],d=n,p=o;for(Se(e,t,n,r),t[2*o+i]>f&&Se(e,t,n,o);d<p;){for(Se(e,t,d,p),d++,p--;t[2*d+i]<f;)d++;for(;t[2*p+i]>f;)p--}t[2*n+i]===f?Se(e,t,n,p):Se(e,t,++p,o),p<=r&&(n=p+1),r<=p&&(o=p-1)}}function Se(e,t,r,n){Ee(e,r,n),Ee(t,2*r,2*n),Ee(t,2*r+1,2*n+1)}function Ee(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Pe(e,t,r,n){var o=e-r,i=t-n;return o*o+i*i}var Oe,ke={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(e){return e}},Ae=Math.fround||(Oe=new Float32Array(1),function(e){return Oe[0]=+e,Oe[0]}),je=function(){function e(t){ge(this,e),this.options=Object.assign(Object.create(ke),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}return be(e,[{key:"load",value:function(e){var t=this.options,n=t.log,o=t.minZoom,i=t.maxZoom;n&&console.time("total time");var a="prepare ".concat(e.length," points");n&&console.time(a),this.points=e;for(var u=[],s=0;s<e.length;s++){var c=e[s];if(c.geometry){var l=r(c.geometry.coordinates,2),f=l[0],d=l[1],p=Ae(Le(f)),v=Ae(Ie(d));u.push(p,v,1/0,s,-1,1),this.options.reduce&&u.push(0)}}var h=this.trees[i+1]=this._createTree(u);n&&console.timeEnd(a);for(var y=i;y>=o;y--){var m=+Date.now();h=this.trees[y]=this._createTree(this._cluster(h,y)),n&&console.log("z%d: %d clusters in %dms",y,h.numItems,+Date.now()-m)}return n&&console.timeEnd("total time"),this}},{key:"getClusters",value:function(e,t){var r=((e[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,e[1])),o=180===e[2]?180:((e[2]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,o=180;else if(r>o){var a=this.getClusters([r,n,180,i],t),u=this.getClusters([-180,n,o,i],t);return a.concat(u)}var s,c=this.trees[this._limitZoom(t)],l=c.range(Le(r),Ie(i),Le(o),Ie(n)),f=c.data,p=[],v=d(l);try{for(v.s();!(s=v.n()).done;){var h=s.value,y=this.stride*h;p.push(f[y+5]>1?Ce(f,y,this.clusterProps):this.points[f[y+3]])}}catch(e){v.e(e)}finally{v.f()}return p}},{key:"getChildren",value:function(e){var t=this._getOriginId(e),r=this._getOriginZoom(e),n="No cluster with the specified id.",o=this.trees[r];if(!o)throw new Error(n);var i=o.data;if(t*this.stride>=i.length)throw new Error(n);var a,u=this.options.radius/(this.options.extent*Math.pow(2,r-1)),s=i[t*this.stride],c=i[t*this.stride+1],l=o.within(s,c,u),f=[],p=d(l);try{for(p.s();!(a=p.n()).done;){var v=a.value*this.stride;i[v+4]===e&&f.push(i[v+5]>1?Ce(i,v,this.clusterProps):this.points[i[v+3]])}}catch(e){p.e(e)}finally{p.f()}if(0===f.length)throw new Error(n);return f}},{key:"getLeaves",value:function(e,t,r){t=t||10,r=r||0;var n=[];return this._appendLeaves(n,e,t,r,0),n}},{key:"getTile",value:function(e,t,r){var n=this.trees[this._limitZoom(e)],o=Math.pow(2,e),i=this.options,a=i.extent,u=i.radius/a,s=(r-u)/o,c=(r+1+u)/o,l={features:[]};return this._addTileFeatures(n.range((t-u)/o,s,(t+1+u)/o,c),n.data,t,r,o,l),0===t&&this._addTileFeatures(n.range(1-u/o,s,1,c),n.data,o,r,o,l),t===o-1&&this._addTileFeatures(n.range(0,s,u/o,c),n.data,-1,r,o,l),l.features.length?l:null}},{key:"getClusterExpansionZoom",value:function(e){for(var t=this._getOriginZoom(e)-1;t<=this.options.maxZoom;){var r=this.getChildren(e);if(t++,1!==r.length)break;e=r[0].properties.cluster_id}return t}},{key:"_appendLeaves",value:function(e,t,r,n,o){var i,a=this.getChildren(t),u=d(a);try{for(u.s();!(i=u.n()).done;){var s=i.value,c=s.properties;if(c&&c.cluster?o+c.point_count<=n?o+=c.point_count:o=this._appendLeaves(e,c.cluster_id,r,n,o):o<n?o++:e.push(s),e.length===r)break}}catch(e){u.e(e)}finally{u.f()}return o}},{key:"_createTree",value:function(e){for(var t=new we(e.length/this.stride|0,this.options.nodeSize,Float32Array),r=0;r<e.length;r+=this.stride)t.add(e[r],e[r+1]);return t.finish(),t.data=e,t}},{key:"_addTileFeatures",value:function(e,t,n,o,i,a){var u,s=d(e);try{for(s.s();!(u=s.n()).done;){var c=u.value*this.stride,l=t[c+5]>1,f=void 0,p=void 0,v=void 0;if(l)f=Re(t,c,this.clusterProps),p=t[c],v=t[c+1];else{var h=this.points[t[c+3]];f=h.properties;var y=r(h.geometry.coordinates,2),m=y[0],g=y[1];p=Le(m),v=Ie(g)}var b={type:1,geometry:[[Math.round(this.options.extent*(p*i-n)),Math.round(this.options.extent*(v*i-o))]],tags:f},x=void 0;void 0!==(x=l||this.options.generateId?t[c+3]:this.points[t[c+3]].id)&&(b.id=x),a.features.push(b)}}catch(e){s.e(e)}finally{s.f()}}},{key:"_limitZoom",value:function(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}},{key:"_cluster",value:function(e,t){for(var r=this.options,n=r.radius,o=r.extent,i=r.reduce,a=r.minPoints,u=n/(o*Math.pow(2,t)),s=e.data,c=[],l=this.stride,f=0;f<s.length;f+=l)if(!(s[f+2]<=t)){s[f+2]=t;var p,v=s[f],h=s[f+1],y=e.within(s[f],s[f+1],u),m=s[f+5],g=m,b=d(y);try{for(b.s();!(p=b.n()).done;){var x=p.value*l;s[x+2]>t&&(g+=s[x+5])}}catch(e){b.e(e)}finally{b.f()}if(g>m&&g>=a){var w,M=v*m,_=h*m,S=void 0,E=-1,P=((f/l|0)<<5)+(t+1)+this.points.length,O=d(y);try{for(O.s();!(w=O.n()).done;){var k=w.value*l;if(!(s[k+2]<=t)){s[k+2]=t;var A=s[k+5];M+=s[k]*A,_+=s[k+1]*A,s[k+4]=P,i&&(S||(S=this._map(s,f,!0),E=this.clusterProps.length,this.clusterProps.push(S)),i(S,this._map(s,k)))}}}catch(e){O.e(e)}finally{O.f()}s[f+4]=P,c.push(M/g,_/g,1/0,P,-1,g),i&&c.push(E)}else{for(var j=0;j<l;j++)c.push(s[f+j]);if(g>1){var C,R=d(y);try{for(R.s();!(C=R.n()).done;){var L=C.value*l;if(!(s[L+2]<=t)){s[L+2]=t;for(var I=0;I<l;I++)c.push(s[L+I])}}}catch(e){R.e(e)}finally{R.f()}}}}return c}},{key:"_getOriginId",value:function(e){return e-this.points.length>>5}},{key:"_getOriginZoom",value:function(e){return(e-this.points.length)%32}},{key:"_map",value:function(e,t,r){if(e[t+5]>1){var n=this.clusterProps[e[t+6]];return r?Object.assign({},n):n}var o=this.points[e[t+3]].properties,i=this.options.map(o);return r&&i===o?Object.assign({},i):i}}]),e}();function Ce(e,t,r){return{type:"Feature",id:e[t+3],properties:Re(e,t,r),geometry:{type:"Point",coordinates:[(i=e[t],360*(i-.5)),(n=e[t+1],o=(180-360*n)*Math.PI/180,360*Math.atan(Math.exp(o))/Math.PI-90)]}};var n,o,i}function Re(e,t,r){var n=e[t+5],o=n>=1e4?"".concat(Math.round(n/1e3),"k"):n>=1e3?"".concat(Math.round(n/100)/10,"k"):n,i=e[t+6],a=-1===i?{}:Object.assign({},r[i]);return Object.assign(a,{cluster:!0,cluster_id:e[t+3],point_count:n,point_count_abbreviated:o})}function Le(e){return e/360+.5}function Ie(e){var t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function Te(e,t){void 0===t&&(t={});var r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}function Ze(e,t,r){if(null!==e)for(var n,o,i,a,u,s,c,l,f=0,d=0,p=e.type,v="FeatureCollection"===p,h="Feature"===p,y=v?e.features.length:1,m=0;m<y;m++){u=(l=!!(c=v?e.features[m].geometry:h?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var g=0;g<u;g++){var b=0,x=0;if(null!==(a=l?c.geometries[g]:c)){s=a.coordinates;var w=a.type;switch(f=!r||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===t(s,d,m,b,x))return!1;d++,b++;break;case"LineString":case"MultiPoint":for(n=0;n<s.length;n++){if(!1===t(s[n],d,m,b,x))return!1;d++,"MultiPoint"===w&&b++}"LineString"===w&&b++;break;case"Polygon":case"MultiLineString":for(n=0;n<s.length;n++){for(o=0;o<s[n].length-f;o++){if(!1===t(s[n][o],d,m,b,x))return!1;d++}"MultiLineString"===w&&b++,"Polygon"===w&&x++}"Polygon"===w&&b++;break;case"MultiPolygon":for(n=0;n<s.length;n++){for(x=0,o=0;o<s[n].length;o++){for(i=0;i<s[n][o].length-f;i++){if(!1===t(s[n][o][i],d,m,b,x))return!1;d++}x++}b++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(!1===Ze(a.geometries[n],t,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function De(e){var t=[1/0,1/0,-1/0,-1/0];return Ze(e,(function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])})),t}De.default=De;var ze=De,Fe={radius:60,minZoom:0,maxZoom:16,extent:512,nodeSize:64,log:!1};function Ne(e,r){var i,a,u,c,l,d=e.cluster,p=e.render,v=e.renderCluster,h=e.data,y=void 0===h?[]:h,g=e.zoomOnClick,b=e.zoomOnClickPadding,x=void 0===b?20:b,w=e.onClick,M=e.onClusterClick,_=re().map,S=(0,s.useState)([]),E=n()(S,2),O=E[0],k=E[1],A=(0,s.useMemo)((function(){return new je(t()(t()({},Fe),d))}),[]),j=(0,s.useCallback)((i=function(){var e,r,n=(e=_.getBounds(),r=_.getZoom(),[[e.getWest(),e.getSouth(),e.getEast(),e.getNorth()],Math.round(r)]),o=A.getClusters.apply(A,f()(n));k(o.map((function(e){return t()(t()({},e),{},{id:e.id||P()})})))},a={delay:500}.delay,u=void 0,c=!0,l=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];c?(clearTimeout(u),u=setTimeout((function(){c&&i.apply(void 0,t),u=void 0}),a)):i.apply(void 0,t)},l.isPending=function(){return void 0!==u},l.cancel=function(){c=!1},l.flush=function(){return i.apply(void 0,arguments)},l),[]);(0,s.useEffect)((function(){if(_)return _.on("zoom",j),_.on("move",j),_.on("resize",j),function(){_.off("zoom",j),_.off("move",j),_.off("resize",j)}}),[_]),(0,s.useEffect)((function(){y&&(A.load(y),j())}),[y]),(0,s.useImperativeHandle)(r,(function(){return A}),[]);return(0,ee.jsx)(ee.Fragment,{children:O.map((function(e){var t=e.geometry,r=e.properties,n=r.point_count,i=r.cluster,a=r.cluster_id;return i?(0,ee.jsx)(ce,{lngLat:t.coordinates,onClick:function(){null==M||M(n,a),g&&function(e){var t=e.properties;if(null!=t&&t.cluster){var r=A.getLeaves(t.cluster_id,Number.POSITIVE_INFINITY),n=ze(Te(r));_.fitBounds(o.LngLatBounds.convert(n),{padding:x})}}(e)},children:m(v)?v(n,a):v},e.id):(0,ee.jsx)(ce,{lngLat:t.coordinates,onClick:function(){null==w||w(e)},children:m(p)?p(e):p},e.id)}))})}var Ue=(0,s.forwardRef)(Ne),Be=function(e){var t=e.code,r=void 0===t?"CN":t,n=re().map;(0,s.useEffect)((function(){r&&o(r)}),[r]);var o=function(e){n.setFilter("admin-0-boundary-disputed",["all",["==",["get","disputed"],"true"],["==",["get","admin_level"],0],["==",["get","maritime"],"false"],["match",["get","worldview"],["all",e],!0,!1]]),n.setFilter("admin-0-boundary",["all",["==",["get","admin_level"],0],["==",["get","disputed"],"false"],["==",["get","maritime"],"false"],["match",["get","worldview"],["all",e],!0,!1]]),n.setFilter("admin-0-boundary-bg",["all",["==",["get","admin_level"],0],["==",["get","maritime"],"false"],["match",["get","worldview"],["all",e],!0,!1]])};return null},qe=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;var We=["offset","maxWidth","altitude","lngLat"].concat(["closeButton","closeOnClick","closeOnMove","focusAfterOpen","anchor","className"]),Ge={},Ve={lngLat:ne},He={onOpen:"open",onClose:"close"},Ye=Object.keys(He),$e=(0,s.forwardRef)((function(e,t){var r=re().map,o=O(),i=o.Portal,a=o.container,c=j(),l=n()(c,3),f=l[0],d=l[1],p=(l[2],H(e,f,{setterMap:Ge,converterMap:Ve}).onInstanceCreated);G(f,e,{eventMap:He,eventList:Ye}),(0,s.useImperativeHandle)(t,(function(){return f}),[f]),(0,s.useEffect)((function(){r&&v().then((function(e){d(e),e.addTo(r),p()}))}),[r]),(0,s.useEffect)((function(){var t=null==f?void 0:f.getElement();t&&function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&t){var r=e.style;for(var n in t){var o=t[n];Number.isFinite(o)&&!qe.test(n)?r[n]="".concat(o,"px"):r[n]=o}}}(t,e.style)}),[e.style,f]);var v=function(){var t=h(e),r=new(u().Popup)(t);return r.setDOMContent(a),t.lngLat&&r.setLngLat(t.lngLat),Promise.resolve(r)},h=function(e){var t={};return We.forEach((function(r){r in e&&(t[r]=y(r,e))})),t},y=function(e,t){var r=t[e];if(e in Ve)try{var n;r=null===(n=Ve[e])||void 0===n?void 0:n.call(Ve,t[e])}catch(e){}return r};return(0,ee.jsx)(ee.Fragment,{children:f&&(0,ee.jsx)(i,{children:e.children})})}))}(),a}()}));