@tracktor/map 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +1 -1
- package/dist/main.umd.cjs +5 -5
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -836,7 +836,7 @@ const qr = ({ palette: t, type: r }) => {
|
|
|
836
836
|
(d = t.current) == null || d.setCenter(c);
|
|
837
837
|
}
|
|
838
838
|
}, f = () => {
|
|
839
|
-
|
|
839
|
+
v(), Hr({ map: t, markers: r, palette: s });
|
|
840
840
|
};
|
|
841
841
|
t.current.loaded() ? f() : t.current.once("load", f);
|
|
842
842
|
}, [y, a, i, t, r, s]);
|
package/dist/main.umd.cjs
CHANGED
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var ye;function Qe(){return ye||(ye=1,process.env.NODE_ENV!=="production"&&function(){var r=h,t=Symbol.for("react.element"),s=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),v=Symbol.for("react.provider"),f=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),k=Symbol.iterator,ee="@@iterator";function
|
|
19
|
-
`+se+e}}var ce=!1,ne;{var St=typeof WeakMap=="function"?WeakMap:Map;ne=new St}function
|
|
18
|
+
*/var ye;function Qe(){return ye||(ye=1,process.env.NODE_ENV!=="production"&&function(){var r=h,t=Symbol.for("react.element"),s=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),v=Symbol.for("react.provider"),f=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),k=Symbol.iterator,ee="@@iterator";function F(e){if(e===null||typeof e!="object")return null;var n=k&&e[k]||e[ee];return typeof n=="function"?n:null}var A=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function T(e){{for(var n=arguments.length,o=new Array(n>1?n-1:0),l=1;l<n;l++)o[l-1]=arguments[l];X("error",e,o)}}function X(e,n,o){{var l=A.ReactDebugCurrentFrame,b=l.getStackAddendum();b!==""&&(n+="%s",o=o.concat([b]));var R=o.map(function(g){return String(g)});R.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,R)}}var H=!1,P=!1,Y=!1,te=!1,B=!1,Z;Z=Symbol.for("react.module.reference");function L(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===y||B||e===a||e===p||e===d||te||e===S||H||P||Y||typeof e=="object"&&e!==null&&(e.$$typeof===_||e.$$typeof===u||e.$$typeof===v||e.$$typeof===f||e.$$typeof===c||e.$$typeof===Z||e.getModuleId!==void 0))}function Ct(e,n,o){var l=e.displayName;if(l)return l;var b=n.displayName||n.name||"";return b!==""?o+"("+b+")":o}function Ce(e){return e.displayName||"Context"}function D(e){if(e==null)return null;if(typeof e.tag=="number"&&T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case i:return"Fragment";case s:return"Portal";case y:return"Profiler";case a:return"StrictMode";case p:return"Suspense";case d:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case f:var n=e;return Ce(n)+".Consumer";case v:var o=e;return Ce(o._context)+".Provider";case c:return Ct(e,e.render,"ForwardRef");case u:var l=e.displayName||null;return l!==null?l:D(e.type)||"Memo";case _:{var b=e,R=b._payload,g=b._init;try{return D(g(R))}catch{return null}}}return null}var I=Object.assign,Q=0,Te,xe,Se,Pe,Oe,we,je;function Le(){}Le.__reactDisabledLog=!0;function Tt(){{if(Q===0){Te=console.log,xe=console.info,Se=console.warn,Pe=console.error,Oe=console.group,we=console.groupCollapsed,je=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Le,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Q++}}function xt(){{if(Q--,Q===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:Te}),info:I({},e,{value:xe}),warn:I({},e,{value:Se}),error:I({},e,{value:Pe}),group:I({},e,{value:Oe}),groupCollapsed:I({},e,{value:we}),groupEnd:I({},e,{value:je})})}Q<0&&T("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=A.ReactCurrentDispatcher,se;function re(e,n,o){{if(se===void 0)try{throw Error()}catch(b){var l=b.stack.trim().match(/\n( *(at )?)/);se=l&&l[1]||""}return`
|
|
19
|
+
`+se+e}}var ce=!1,ne;{var St=typeof WeakMap=="function"?WeakMap:Map;ne=new St}function Fe(e,n){if(!e||ce)return"";{var o=ne.get(e);if(o!==void 0)return o}var l;ce=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var R;R=ae.current,ae.current=null,Tt();try{if(n){var g=function(){throw Error()};if(Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(w){l=w}Reflect.construct(e,[],g)}else{try{g.call()}catch(w){l=w}e.call(g.prototype)}}else{try{throw Error()}catch(w){l=w}e()}}catch(w){if(w&&l&&typeof w.stack=="string"){for(var E=w.stack.split(`
|
|
20
20
|
`),O=l.stack.split(`
|
|
21
21
|
`),m=E.length-1,C=O.length-1;m>=1&&C>=0&&E[m]!==O[C];)C--;for(;m>=1&&C>=0;m--,C--)if(E[m]!==O[C]){if(m!==1||C!==1)do if(m--,C--,C<0||E[m]!==O[C]){var j=`
|
|
22
|
-
`+E[m].replace(" at new "," at ");return e.displayName&&j.includes("<anonymous>")&&(j=j.replace("<anonymous>",e.displayName)),typeof e=="function"&&ne.set(e,j),j}while(m>=1&&C>=0);break}}}finally{ce=!1,ae.current=R,xt(),Error.prepareStackTrace=b}var G=e?e.displayName||e.name:"",M=G?re(G):"";return typeof e=="function"&&ne.set(e,M),M}function Pt(e,n,o){return
|
|
22
|
+
`+E[m].replace(" at new "," at ");return e.displayName&&j.includes("<anonymous>")&&(j=j.replace("<anonymous>",e.displayName)),typeof e=="function"&&ne.set(e,j),j}while(m>=1&&C>=0);break}}}finally{ce=!1,ae.current=R,xt(),Error.prepareStackTrace=b}var G=e?e.displayName||e.name:"",M=G?re(G):"";return typeof e=="function"&&ne.set(e,M),M}function Pt(e,n,o){return Fe(e,!1)}function Ot(e){var n=e.prototype;return!!(n&&n.isReactComponent)}function oe(e,n,o){if(e==null)return"";if(typeof e=="function")return Fe(e,Ot(e));if(typeof e=="string")return re(e);switch(e){case p:return re("Suspense");case d:return re("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return Pt(e.render);case u:return oe(e.type,n,o);case _:{var l=e,b=l._payload,R=l._init;try{return oe(R(b),n,o)}catch{}}}return""}var q=Object.prototype.hasOwnProperty,Ae={},De=A.ReactDebugCurrentFrame;function ie(e){if(e){var n=e._owner,o=oe(e.type,e._source,n?n.type:null);De.setExtraStackFrame(o)}else De.setExtraStackFrame(null)}function wt(e,n,o,l,b){{var R=Function.call.bind(q);for(var g in e)if(R(e,g)){var E=void 0;try{if(typeof e[g]!="function"){var O=Error((l||"React class")+": "+o+" type `"+g+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[g]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw O.name="Invariant Violation",O}E=e[g](n,g,l,o,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(m){E=m}E&&!(E instanceof Error)&&(ie(b),T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",l||"React class",o,g,typeof E),ie(null)),E instanceof Error&&!(E.message in Ae)&&(Ae[E.message]=!0,ie(b),T("Failed %s type: %s",o,E.message),ie(null))}}}var jt=Array.isArray;function ue(e){return jt(e)}function Lt(e){{var n=typeof Symbol=="function"&&Symbol.toStringTag,o=n&&e[Symbol.toStringTag]||e.constructor.name||"Object";return o}}function Ft(e){try{return Ne(e),!1}catch{return!0}}function Ne(e){return""+e}function ke(e){if(Ft(e))return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Lt(e)),Ne(e)}var Ie=A.ReactCurrentOwner,At={key:!0,ref:!0,__self:!0,__source:!0},Me,Ue;function Dt(e){if(q.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return e.ref!==void 0}function Nt(e){if(q.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function kt(e,n){typeof e.ref=="string"&&Ie.current}function It(e,n){{var o=function(){Me||(Me=!0,T("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};o.isReactWarning=!0,Object.defineProperty(e,"key",{get:o,configurable:!0})}}function Mt(e,n){{var o=function(){Ue||(Ue=!0,T("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};o.isReactWarning=!0,Object.defineProperty(e,"ref",{get:o,configurable:!0})}}var Ut=function(e,n,o,l,b,R,g){var E={$$typeof:t,type:e,key:n,ref:o,props:g,_owner:R};return E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(E,"_self",{configurable:!1,enumerable:!1,writable:!1,value:l}),Object.defineProperty(E,"_source",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E};function zt(e,n,o,l,b){{var R,g={},E=null,O=null;o!==void 0&&(ke(o),E=""+o),Nt(n)&&(ke(n.key),E=""+n.key),Dt(n)&&(O=n.ref,kt(n,b));for(R in n)q.call(n,R)&&!At.hasOwnProperty(R)&&(g[R]=n[R]);if(e&&e.defaultProps){var m=e.defaultProps;for(R in m)g[R]===void 0&&(g[R]=m[R])}if(E||O){var C=typeof e=="function"?e.displayName||e.name||"Unknown":e;E&&It(g,C),O&&Mt(g,C)}return Ut(e,E,O,b,l,Ie.current,g)}}var le=A.ReactCurrentOwner,ze=A.ReactDebugCurrentFrame;function V(e){if(e){var n=e._owner,o=oe(e.type,e._source,n?n.type:null);ze.setExtraStackFrame(o)}else ze.setExtraStackFrame(null)}var fe;fe=!1;function de(e){return typeof e=="object"&&e!==null&&e.$$typeof===t}function We(){{if(le.current){var e=D(le.current.type);if(e)return`
|
|
23
23
|
|
|
24
24
|
Check the render method of \``+e+"`."}return""}}function Wt(e){return""}var Ye={};function Yt(e){{var n=We();if(!n){var o=typeof e=="string"?e:e.displayName||e.name;o&&(n=`
|
|
25
25
|
|
|
26
|
-
Check the top-level render call using <`+o+">.")}return n}}function Be(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var o=Yt(n);if(Ye[o])return;Ye[o]=!0;var l="";e&&e._owner&&e._owner!==le.current&&(l=" It was passed a child from "+D(e._owner.type)+"."),V(e),T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',o,l),V(null)}}function Ve(e,n){{if(typeof e!="object")return;if(ue(e))for(var o=0;o<e.length;o++){var l=e[o];de(l)&&Be(l,n)}else if(de(e))e._store&&(e._store.validated=!0);else if(e){var b=
|
|
26
|
+
Check the top-level render call using <`+o+">.")}return n}}function Be(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var o=Yt(n);if(Ye[o])return;Ye[o]=!0;var l="";e&&e._owner&&e._owner!==le.current&&(l=" It was passed a child from "+D(e._owner.type)+"."),V(e),T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',o,l),V(null)}}function Ve(e,n){{if(typeof e!="object")return;if(ue(e))for(var o=0;o<e.length;o++){var l=e[o];de(l)&&Be(l,n)}else if(de(e))e._store&&(e._store.validated=!0);else if(e){var b=F(e);if(typeof b=="function"&&b!==e.entries)for(var R=b.call(e),g;!(g=R.next()).done;)de(g.value)&&Be(g.value,n)}}}function Bt(e){{var n=e.type;if(n==null||typeof n=="string")return;var o;if(typeof n=="function")o=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===c||n.$$typeof===u))o=n.propTypes;else return;if(o){var l=D(n);wt(o,e.props,"prop",l,e)}else if(n.PropTypes!==void 0&&!fe){fe=!0;var b=D(n);T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Vt(e){{for(var n=Object.keys(e.props),o=0;o<n.length;o++){var l=n[o];if(l!=="children"&&l!=="key"){V(e),T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",l),V(null);break}}e.ref!==null&&(V(e),T("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}var Ge={};function Je(e,n,o,l,b,R){{var g=L(e);if(!g){var E="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(E+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var O=Wt();O?E+=O:E+=We();var m;e===null?m="null":ue(e)?m="array":e!==void 0&&e.$$typeof===t?(m="<"+(D(e.type)||"Unknown")+" />",E=" Did you accidentally export a JSX literal instead of a component?"):m=typeof e,T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",m,E)}var C=zt(e,n,o,b,R);if(C==null)return C;if(g){var j=n.children;if(j!==void 0)if(l)if(ue(j)){for(var G=0;G<j.length;G++)Ve(j[G],e);Object.freeze&&Object.freeze(j)}else T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ve(j,e)}if(q.call(n,"key")){var M=D(e),w=Object.keys(n).filter(function(Zt){return Zt!=="key"}),pe=w.length>0?"{key: someKey, "+w.join(": ..., ")+": ...}":"{key: someKey}";if(!Ge[M+pe]){var Ht=w.length>0?"{"+w.join(": ..., ")+": ...}":"{}";T(`A props object containing a "key" prop is being spread into JSX:
|
|
27
27
|
let props = %s;
|
|
28
28
|
<%s {...props} />
|
|
29
29
|
React keys must be passed directly to JSX without using spread:
|
|
30
30
|
let props = %s;
|
|
31
|
-
<%s key={someKey} {...props} />`,pe,M,Ht,M),Ge[M+pe]=!0}}return e===i?Vt(C):Bt(C),C}}function Gt(e,n,o){return Je(e,n,o,!0)}function Jt(e,n,o){return Je(e,n,o,!1)}var Kt=Jt,Xt=Gt;K.Fragment=i,K.jsx=Kt,K.jsxs=Xt}()),K}var Ee;function qe(){return Ee||(Ee=1,process.env.NODE_ENV==="production"?$.exports=Ze():$.exports=Qe()),$.exports}var z=qe();const ge=h.createContext({licenceMapbox:"",licenseMuiX:""}),$e=({children:r,licenseMuiX:t,licenceMapbox:s})=>{h.useEffect(()=>{t&&Ke.LicenseInfo.setLicenseKey(t)},[t]);const i=h.useMemo(()=>({licenceMapbox:s,licenseMuiX:t}),[t,s]);return s&&(N.accessToken=s),z.jsx(ge.Provider,{value:i,children:r})},et=r=>typeof r=="string"||typeof r=="number"?String(r):JSON.stringify(r),tt=(r,t)=>t&&(t==null?void 0:t.length)<=1?100:r,rt=({map:r,disableAnimation:t,fitBounds:s,markers:i,fitBoundDuration:a,fitBoundsPadding:y,isMapInitialized:v,fitBoundsAnimationKey:f})=>{const c=h.useRef(void 0);h.useEffect(()=>{var d;if(!r.current||!v||t||s===!1||!(i!=null&&i.length)||(i==null?void 0:i.length)<=1)return;if(f!==void 0){const u=et(f);if(c.current===u)return;c.current=u}const p=new N.LngLatBounds;i.forEach(u=>{p.extend([Number(u.lng),Number(u.lat)])}),(d=r.current)==null||d.fitBounds(p,{duration:tt(a,i),padding:y})},[i,t,a,s,f,y,v,r])},nt=r=>Array.isArray(r)?r.length>=2?[r[0],r[1]]:void 0:r;var W={},be;function ot(){if(be)return W;be=1;var r=He;if(process.env.NODE_ENV==="production")W.createRoot=r.createRoot,W.hydrateRoot=r.hydrateRoot;else{var t=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;W.createRoot=function(s,i){t.usingClientEntryPoint=!0;try{return r.createRoot(s,i)}finally{t.usingClientEntryPoint=!1}},W.hydrateRoot=function(s,i,a){t.usingClientEntryPoint=!0;try{return r.hydrateRoot(s,i,a)}finally{t.usingClientEntryPoint=!1}}}return W}var he=ot();const it=({palette:r,type:t})=>{const s=r.mode==="dark"?"black":"white",i=r.secondary.main,a=r.info.main;switch(t){case"dropOff":return{"circle-color":s,"circle-radius":5,"circle-stroke-color":a,"circle-stroke-width":6};default:return{"circle-color":s,"circle-radius":7,"circle-stroke-color":i,"circle-stroke-width":8}}},at=(r,t,s,i)=>{const a={features:s.map(c=>({geometry:{coordinates:c.geometry.coordinates,type:"Point"},properties:{id:c.properties.id,...c.properties},type:"Feature"})),type:"FeatureCollection"},y=r.getSource(t);y?y.setData(a):r.addSource(t,{data:a,type:"geojson"});const v=[...a.features].sort((c,p)=>{var _,S;const d=((_=c.properties)==null?void 0:_.zIndex)||0,u=((S=p.properties)==null?void 0:S.zIndex)||0;return d-u}),f=r.getStyle().layers;f==null||f.forEach(c=>{c.id.startsWith("marker-")&&r.getLayer(c.id)&&r.removeLayer(c.id)}),v.forEach(c=>{const{description:p,id:d}=c.properties||{},u=it({palette:i,type:p}),_=`marker-${d}`;r.addLayer({filter:["==","id",d],id:_,layout:{visibility:"visible"},paint:u,source:t,type:"circle"})})},st=(r,t)=>{document.querySelectorAll(".react-custom-marker").forEach(a=>a.remove()),[...t].sort((a,y)=>{var c,p;const v=((c=a.properties)==null?void 0:c.zIndex)||0,f=((p=y.properties)==null?void 0:p.zIndex)||0;return v-f}).forEach(a=>{const{IconComponent:y,iconProps:v,onClick:f,zIndex:c,pointerEvents:p}=a.properties||{},{coordinates:d}=a.geometry;if(y&&d.length>=2){const u=document.createElement("div");u.className="react-custom-marker",u.style.position="absolute",c!==void 0&&(u.style.zIndex=c.toString()),p!==void 0&&(u.style.pointerEvents=p.toString());const _=document.createElement("div"),S=he.createRoot(_);y&&S.render(h.createElement(y,v||{})),u.appendChild(_);const k=()=>{f==null||f(a)};u.addEventListener("click",k),new N.Marker(u).setLngLat([d[0],d[1]]).addTo(r)}})},ct=r=>({features:(r==null?void 0:r.map((t,s)=>({geometry:{coordinates:[Number.isFinite(Number(t.lng))?Number(t.lng):Number(bt),Number.isFinite(Number(t.lat))?Number(t.lat):Number(ht)],type:"Point"},properties:{description:t.type,IconComponent:t.IconComponent,iconProps:t.iconProps,id:t.id||`{marker-${s}}`,name:t.name,onClick:t.onClick,pointerEvents:t.pointerEvents||"auto",size:t.size||1,zIndex:t.zIndex||0},type:"Feature"})))||[],type:"FeatureCollection"}),ut=({map:r,palette:t,markers:s})=>{if(!r.current)return;const i=ct(s),a=i.features.filter(v=>{var f;return((f=v.properties)==null?void 0:f.IconComponent)===void 0});a.length&&at(r.current,"markerProps",a,t);const y=i.features.filter(v=>{var f;return(f=v.properties)==null?void 0:f.IconComponent});y.length&&st(r.current,y)},lt=({map:r,markers:t,palette:s,isMapInitialized:i,fitBounds:a,center:y})=>{h.useEffect(()=>{if(!r.current||!t||!i)return;const v=()=>{var c,p,d;if(!a||((t==null?void 0:t.length)||0)<=1){const u=y?nt(y)||{lat:46.8677,lng:2.333}:{lat:((c=t==null?void 0:t[0])==null?void 0:c.lat)!==void 0?Number(t[0].lat):46.8677,lng:((p=t==null?void 0:t[0])==null?void 0:p.lng)!==void 0?Number(t[0].lng):2.333};(d=r.current)==null||d.setCenter(u)}},f=()=>{console.log("A"),v(),ut({map:r,markers:t,palette:s})};r.current.loaded()?f():r.current.once("load",f)},[y,a,i,r,t,s])},ft=({map:r,onMapClick:t,isMapInitialized:s})=>{h.useEffect(()=>{if(!r.current||!t||!s)return;const i=r.current.getCanvas(),a=y=>{const v=[y.clientX-i.getBoundingClientRect().left,y.clientY-i.getBoundingClientRect().top],f=r.current.unproject(v);t(f.lng,f.lat)};i.addEventListener("click",a)},[s,r,t])},dt=r=>{const t=document.createElement("button");return t.innerText="×",t.style.position="absolute",t.style.top="5px",t.style.right="5px",t.style.background="transparent",t.style.border="none",t.style.fontSize="16px",t.style.padding="0",t.style.margin="10px",t.style.cursor="pointer",t.type="button",t.setAttribute("aria-label","Close popup"),t.removeAttribute("aria-hidden"),t.onclick=()=>r.remove(),t},Re=({map:r,tooltip:t,coordinates:s})=>{if(!s||!t||!r.current||!Array.isArray(s)||s.length!==2)return null;const i=document.createElement("div"),a=document.createElement("div"),y=he.createRoot(a);i.style.position="relative",i.style.overflow="hidden",i.style.zIndex="1000",y.render(t);const v=new N.Popup({closeButton:!1}).setLngLat(s).setDOMContent(i).addTo(r.current);v.on("close",()=>{queueMicrotask(()=>{y.unmount()})});const f=dt(v);return i.appendChild(f),i.appendChild(a),v},_e=r=>typeof r=="object"&&r!==null&&"type"in r&&"coordinates"in r,pt=r=>{if(typeof r!="object"||r===null||!("geometry"in r&&"properties"in r))return!1;const{geometry:s}=r;if(typeof s!="object"||s===null||!("coordinates"in s))return!1;const{coordinates:i}=s;if(!Array.isArray(i)||i.length!==2||!_e(s))return!1;const{properties:a}=r;return typeof a!="object"||a===null?!1:"id"in a&&a.id!==void 0},vt=({map:r,point:t})=>{var a,y,v,f,c;if(!((a=r.current)!=null&&a.isStyleLoaded()))return null;const s=((f=(v=(y=r.current)==null?void 0:y.getStyle())==null?void 0:v.layers)==null?void 0:f.filter(p=>p.id.startsWith("marker-")).map(p=>p.id))||[],i=(c=r.current)==null?void 0:c.queryRenderedFeatures(t,{layers:s});if(i&&i.length>0){const p=i[0];if(!pt(p)||!_e(p.geometry))return null;const{geometry:d}=p,u=d.coordinates.slice();return u.length!==2||typeof u[0]!="number"||typeof u[1]!="number"?null:p}},yt=({openPopup:r,map:t,markers:s,isMapInitialized:i})=>{const a=h.useRef(null);h.useEffect(()=>{if(!t.current||!s||!i)return;const v=t.current.getCanvas();if(a.current&&(a.current.remove(),a.current=null),r){const c=s.find(p=>p.id===r);if(c){const p=[Number(c.lng)||0,Number(c.lat)||0],d=Re({coordinates:p,map:t,tooltip:c.Tooltip});d&&(a.current=d)}}const f=c=>{const p=[c.clientX-v.getBoundingClientRect().left,c.clientY-v.getBoundingClientRect().top],d=vt({map:t,point:p});if(d&&d.properties&&d.properties.id){a.current&&(a.current.remove(),a.current=null);const u=s.find(_=>_.id===d.properties.id);if(u){const _=[Number(u.lng)||0,Number(u.lat)||0];if(typeof u.onClick=="function"){const S={geometry:{coordinates:_,type:"Point"},properties:{description:u.name,id:u.id,name:u.name,onClick:u.onClick,size:u.size||1,zIndex:u.zIndex||1},type:"Feature"};u.onClick(S)}requestAnimationFrame(()=>{const S=Re({coordinates:_,map:t,tooltip:u.Tooltip});S&&(a.current=S)})}}};return v.addEventListener("click",f),()=>{v.removeEventListener("click",f),a.current&&(a.current.remove(),a.current=null)}},[i,t,s,r])},Et=(r,t)=>{const s=t==="dark";switch(r){case"satellite":return"mapbox://styles/mapbox/satellite-v9";case"3d":return s?"mapbox://styles/mapbox/dark-v10":"mapbox://styles/mapbox/streets-v12?optimize=true";case"streets":return s?"mapbox://styles/mapbox/dark-v10":"mapbox://styles/mapbox/streets-v11";case"default":default:return s?"mapbox://styles/mapbox/dark-v10":"mapbox://styles/mapbox/streets-v11"}},gt=({mapStyle:r,theme:t,baseMapView:s,doubleClickZoom:i,cooperativeGestures:a})=>({cooperativeGestures:a,doubleClickZoom:i,failIfMajorPerformanceCaveat:!1,style:r||Et(s,t)}),me=(r,t)=>Number.isFinite(r)&&Number.isFinite(t)&&r>=-90&&r<=90&&t>=-180&&t<=180,bt=2.333,ht=46.8677,Rt=({markers:r,center:t,disableAnimation:s,openPopup:i,onMapClick:a,projection:y,theme:v,mapStyle:f,fitBoundsAnimationKey:c,baseMapView:p="default",zoom:d=6,fitBoundsPadding:u=50,fitBoundDuration:_=1e3,fitBounds:S=!0,cooperativeGestures:k=!0,doubleClickZoom:ee=!0})=>{const[A,F]=h.useState(!1),{palette:T}=U.useTheme(),X=Xe.useDebounce(r),H=h.useRef(""),P=h.useRef(null),Y=h.useMemo(()=>X?X.filter(L=>L.lat!==void 0&&L.lng!==void 0&&me(Number(L.lat),Number(L.lng))):[],[X]),te=h.useMemo(()=>gt({baseMapView:p,cooperativeGestures:k,doubleClickZoom:ee,mapStyle:f,theme:v||T.mode}),[p,k,ee,f,T.mode,y,v]),B=h.useCallback(()=>{if(P.current){const L=H.current;L&&typeof L!="string"&&(L.innerHTML=""),P.current.remove(),P.current=null,F(!1)}},[]),Z=h.useCallback(()=>{N.supported()&&(B(),P.current=new N.Map({...te,container:H.current}),P.current.resize(),F(!0))},[B,te]);return h.useEffect(()=>{Z()},[Z]),h.useEffect(()=>{!P.current||!A||d===void 0||Math.abs(P.current.getZoom()-d)>.1&&P.current.setZoom(d)},[d,A]),lt({center:t,fitBounds:S,isMapInitialized:A,map:P,markers:Y,palette:T}),yt({isMapInitialized:A,map:P,markers:Y,openPopup:i}),ft({isMapInitialized:A,map:P,onMapClick:a}),rt({disableAnimation:s,fitBoundDuration:_,fitBounds:S,fitBoundsAnimationKey:c,fitBoundsPadding:u,isMapInitialized:A,map:P,markers:Y}),h.useEffect(()=>B,[B]),{containerRef:H,isMapInitialized:A,map:P,markers:Y}},_t=({containerStyle:r,square:t,loading:s,height:i=300,width:a="100%",...y})=>{const{containerRef:v}=Rt(y);return z.jsxs(U.Box,{sx:{height:i,position:"relative",width:a,...r},children:[z.jsx(U.GlobalStyles,{styles:{".mapboxgl-popup-content":{backgroundColor:"transparent!important",borderRadius:"0px !important",boxShadow:"none!important",padding:"0px 0px!important",width:"fit-content!important"}}}),N.supported()?z.jsx(U.Box,{ref:v,sx:{alignItems:"center",borderRadius:t?0:1,height:i,justifyContent:"center",left:0,overflow:"hidden",position:"absolute",top:0,visibility:s?"hidden !important":"visible",width:a,zIndex:1}}):z.jsx(U.Box,{sx:{left:"50%",position:"absolute",textAlign:"center",top:"50%",transform:"translate(-50%, -50%)"},children:"WebGL is not enabled in your browser. This technology is required to display the interactive map."}),s&&z.jsx(U.Skeleton,{width:a,height:i,variant:t?"rectangular":"rounded",sx:{inset:0,position:"absolute",zIndex:2}})]})},mt=h.memo(_t);x.DEFAULT_CENTER_LAT=46.8677,x.DEFAULT_CENTER_LNG=2.333,x.MapProvider=$e,x.MapProviderContext=ge,x.MarkerMap=mt,x.isValidLatLng=me,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
|
31
|
+
<%s key={someKey} {...props} />`,pe,M,Ht,M),Ge[M+pe]=!0}}return e===i?Vt(C):Bt(C),C}}function Gt(e,n,o){return Je(e,n,o,!0)}function Jt(e,n,o){return Je(e,n,o,!1)}var Kt=Jt,Xt=Gt;K.Fragment=i,K.jsx=Kt,K.jsxs=Xt}()),K}var Ee;function qe(){return Ee||(Ee=1,process.env.NODE_ENV==="production"?$.exports=Ze():$.exports=Qe()),$.exports}var z=qe();const ge=h.createContext({licenceMapbox:"",licenseMuiX:""}),$e=({children:r,licenseMuiX:t,licenceMapbox:s})=>{h.useEffect(()=>{t&&Ke.LicenseInfo.setLicenseKey(t)},[t]);const i=h.useMemo(()=>({licenceMapbox:s,licenseMuiX:t}),[t,s]);return s&&(N.accessToken=s),z.jsx(ge.Provider,{value:i,children:r})},et=r=>typeof r=="string"||typeof r=="number"?String(r):JSON.stringify(r),tt=(r,t)=>t&&(t==null?void 0:t.length)<=1?100:r,rt=({map:r,disableAnimation:t,fitBounds:s,markers:i,fitBoundDuration:a,fitBoundsPadding:y,isMapInitialized:v,fitBoundsAnimationKey:f})=>{const c=h.useRef(void 0);h.useEffect(()=>{var d;if(!r.current||!v||t||s===!1||!(i!=null&&i.length)||(i==null?void 0:i.length)<=1)return;if(f!==void 0){const u=et(f);if(c.current===u)return;c.current=u}const p=new N.LngLatBounds;i.forEach(u=>{p.extend([Number(u.lng),Number(u.lat)])}),(d=r.current)==null||d.fitBounds(p,{duration:tt(a,i),padding:y})},[i,t,a,s,f,y,v,r])},nt=r=>Array.isArray(r)?r.length>=2?[r[0],r[1]]:void 0:r;var W={},be;function ot(){if(be)return W;be=1;var r=He;if(process.env.NODE_ENV==="production")W.createRoot=r.createRoot,W.hydrateRoot=r.hydrateRoot;else{var t=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;W.createRoot=function(s,i){t.usingClientEntryPoint=!0;try{return r.createRoot(s,i)}finally{t.usingClientEntryPoint=!1}},W.hydrateRoot=function(s,i,a){t.usingClientEntryPoint=!0;try{return r.hydrateRoot(s,i,a)}finally{t.usingClientEntryPoint=!1}}}return W}var he=ot();const it=({palette:r,type:t})=>{const s=r.mode==="dark"?"black":"white",i=r.secondary.main,a=r.info.main;switch(t){case"dropOff":return{"circle-color":s,"circle-radius":5,"circle-stroke-color":a,"circle-stroke-width":6};default:return{"circle-color":s,"circle-radius":7,"circle-stroke-color":i,"circle-stroke-width":8}}},at=(r,t,s,i)=>{const a={features:s.map(c=>({geometry:{coordinates:c.geometry.coordinates,type:"Point"},properties:{id:c.properties.id,...c.properties},type:"Feature"})),type:"FeatureCollection"},y=r.getSource(t);y?y.setData(a):r.addSource(t,{data:a,type:"geojson"});const v=[...a.features].sort((c,p)=>{var _,S;const d=((_=c.properties)==null?void 0:_.zIndex)||0,u=((S=p.properties)==null?void 0:S.zIndex)||0;return d-u}),f=r.getStyle().layers;f==null||f.forEach(c=>{c.id.startsWith("marker-")&&r.getLayer(c.id)&&r.removeLayer(c.id)}),v.forEach(c=>{const{description:p,id:d}=c.properties||{},u=it({palette:i,type:p}),_=`marker-${d}`;r.addLayer({filter:["==","id",d],id:_,layout:{visibility:"visible"},paint:u,source:t,type:"circle"})})},st=(r,t)=>{document.querySelectorAll(".react-custom-marker").forEach(a=>a.remove()),[...t].sort((a,y)=>{var c,p;const v=((c=a.properties)==null?void 0:c.zIndex)||0,f=((p=y.properties)==null?void 0:p.zIndex)||0;return v-f}).forEach(a=>{const{IconComponent:y,iconProps:v,onClick:f,zIndex:c,pointerEvents:p}=a.properties||{},{coordinates:d}=a.geometry;if(y&&d.length>=2){const u=document.createElement("div");u.className="react-custom-marker",u.style.position="absolute",c!==void 0&&(u.style.zIndex=c.toString()),p!==void 0&&(u.style.pointerEvents=p.toString());const _=document.createElement("div"),S=he.createRoot(_);y&&S.render(h.createElement(y,v||{})),u.appendChild(_);const k=()=>{f==null||f(a)};u.addEventListener("click",k),new N.Marker(u).setLngLat([d[0],d[1]]).addTo(r)}})},ct=r=>({features:(r==null?void 0:r.map((t,s)=>({geometry:{coordinates:[Number.isFinite(Number(t.lng))?Number(t.lng):Number(bt),Number.isFinite(Number(t.lat))?Number(t.lat):Number(ht)],type:"Point"},properties:{description:t.type,IconComponent:t.IconComponent,iconProps:t.iconProps,id:t.id||`{marker-${s}}`,name:t.name,onClick:t.onClick,pointerEvents:t.pointerEvents||"auto",size:t.size||1,zIndex:t.zIndex||0},type:"Feature"})))||[],type:"FeatureCollection"}),ut=({map:r,palette:t,markers:s})=>{if(!r.current)return;const i=ct(s),a=i.features.filter(v=>{var f;return((f=v.properties)==null?void 0:f.IconComponent)===void 0});a.length&&at(r.current,"markerProps",a,t);const y=i.features.filter(v=>{var f;return(f=v.properties)==null?void 0:f.IconComponent});y.length&&st(r.current,y)},lt=({map:r,markers:t,palette:s,isMapInitialized:i,fitBounds:a,center:y})=>{h.useEffect(()=>{if(!r.current||!t||!i)return;const v=()=>{var c,p,d;if(!a||((t==null?void 0:t.length)||0)<=1){const u=y?nt(y)||{lat:46.8677,lng:2.333}:{lat:((c=t==null?void 0:t[0])==null?void 0:c.lat)!==void 0?Number(t[0].lat):46.8677,lng:((p=t==null?void 0:t[0])==null?void 0:p.lng)!==void 0?Number(t[0].lng):2.333};(d=r.current)==null||d.setCenter(u)}},f=()=>{v(),ut({map:r,markers:t,palette:s})};r.current.loaded()?f():r.current.once("load",f)},[y,a,i,r,t,s])},ft=({map:r,onMapClick:t,isMapInitialized:s})=>{h.useEffect(()=>{if(!r.current||!t||!s)return;const i=r.current.getCanvas(),a=y=>{const v=[y.clientX-i.getBoundingClientRect().left,y.clientY-i.getBoundingClientRect().top],f=r.current.unproject(v);t(f.lng,f.lat)};i.addEventListener("click",a)},[s,r,t])},dt=r=>{const t=document.createElement("button");return t.innerText="×",t.style.position="absolute",t.style.top="5px",t.style.right="5px",t.style.background="transparent",t.style.border="none",t.style.fontSize="16px",t.style.padding="0",t.style.margin="10px",t.style.cursor="pointer",t.type="button",t.setAttribute("aria-label","Close popup"),t.removeAttribute("aria-hidden"),t.onclick=()=>r.remove(),t},Re=({map:r,tooltip:t,coordinates:s})=>{if(!s||!t||!r.current||!Array.isArray(s)||s.length!==2)return null;const i=document.createElement("div"),a=document.createElement("div"),y=he.createRoot(a);i.style.position="relative",i.style.overflow="hidden",i.style.zIndex="1000",y.render(t);const v=new N.Popup({closeButton:!1}).setLngLat(s).setDOMContent(i).addTo(r.current);v.on("close",()=>{queueMicrotask(()=>{y.unmount()})});const f=dt(v);return i.appendChild(f),i.appendChild(a),v},_e=r=>typeof r=="object"&&r!==null&&"type"in r&&"coordinates"in r,pt=r=>{if(typeof r!="object"||r===null||!("geometry"in r&&"properties"in r))return!1;const{geometry:s}=r;if(typeof s!="object"||s===null||!("coordinates"in s))return!1;const{coordinates:i}=s;if(!Array.isArray(i)||i.length!==2||!_e(s))return!1;const{properties:a}=r;return typeof a!="object"||a===null?!1:"id"in a&&a.id!==void 0},vt=({map:r,point:t})=>{var a,y,v,f,c;if(!((a=r.current)!=null&&a.isStyleLoaded()))return null;const s=((f=(v=(y=r.current)==null?void 0:y.getStyle())==null?void 0:v.layers)==null?void 0:f.filter(p=>p.id.startsWith("marker-")).map(p=>p.id))||[],i=(c=r.current)==null?void 0:c.queryRenderedFeatures(t,{layers:s});if(i&&i.length>0){const p=i[0];if(!pt(p)||!_e(p.geometry))return null;const{geometry:d}=p,u=d.coordinates.slice();return u.length!==2||typeof u[0]!="number"||typeof u[1]!="number"?null:p}},yt=({openPopup:r,map:t,markers:s,isMapInitialized:i})=>{const a=h.useRef(null);h.useEffect(()=>{if(!t.current||!s||!i)return;const v=t.current.getCanvas();if(a.current&&(a.current.remove(),a.current=null),r){const c=s.find(p=>p.id===r);if(c){const p=[Number(c.lng)||0,Number(c.lat)||0],d=Re({coordinates:p,map:t,tooltip:c.Tooltip});d&&(a.current=d)}}const f=c=>{const p=[c.clientX-v.getBoundingClientRect().left,c.clientY-v.getBoundingClientRect().top],d=vt({map:t,point:p});if(d&&d.properties&&d.properties.id){a.current&&(a.current.remove(),a.current=null);const u=s.find(_=>_.id===d.properties.id);if(u){const _=[Number(u.lng)||0,Number(u.lat)||0];if(typeof u.onClick=="function"){const S={geometry:{coordinates:_,type:"Point"},properties:{description:u.name,id:u.id,name:u.name,onClick:u.onClick,size:u.size||1,zIndex:u.zIndex||1},type:"Feature"};u.onClick(S)}requestAnimationFrame(()=>{const S=Re({coordinates:_,map:t,tooltip:u.Tooltip});S&&(a.current=S)})}}};return v.addEventListener("click",f),()=>{v.removeEventListener("click",f),a.current&&(a.current.remove(),a.current=null)}},[i,t,s,r])},Et=(r,t)=>{const s=t==="dark";switch(r){case"satellite":return"mapbox://styles/mapbox/satellite-v9";case"3d":return s?"mapbox://styles/mapbox/dark-v10":"mapbox://styles/mapbox/streets-v12?optimize=true";case"streets":return s?"mapbox://styles/mapbox/dark-v10":"mapbox://styles/mapbox/streets-v11";case"default":default:return s?"mapbox://styles/mapbox/dark-v10":"mapbox://styles/mapbox/streets-v11"}},gt=({mapStyle:r,theme:t,baseMapView:s,doubleClickZoom:i,cooperativeGestures:a})=>({cooperativeGestures:a,doubleClickZoom:i,failIfMajorPerformanceCaveat:!1,style:r||Et(s,t)}),me=(r,t)=>Number.isFinite(r)&&Number.isFinite(t)&&r>=-90&&r<=90&&t>=-180&&t<=180,bt=2.333,ht=46.8677,Rt=({markers:r,center:t,disableAnimation:s,openPopup:i,onMapClick:a,projection:y,theme:v,mapStyle:f,fitBoundsAnimationKey:c,baseMapView:p="default",zoom:d=6,fitBoundsPadding:u=50,fitBoundDuration:_=1e3,fitBounds:S=!0,cooperativeGestures:k=!0,doubleClickZoom:ee=!0})=>{const[F,A]=h.useState(!1),{palette:T}=U.useTheme(),X=Xe.useDebounce(r),H=h.useRef(""),P=h.useRef(null),Y=h.useMemo(()=>X?X.filter(L=>L.lat!==void 0&&L.lng!==void 0&&me(Number(L.lat),Number(L.lng))):[],[X]),te=h.useMemo(()=>gt({baseMapView:p,cooperativeGestures:k,doubleClickZoom:ee,mapStyle:f,theme:v||T.mode}),[p,k,ee,f,T.mode,y,v]),B=h.useCallback(()=>{if(P.current){const L=H.current;L&&typeof L!="string"&&(L.innerHTML=""),P.current.remove(),P.current=null,A(!1)}},[]),Z=h.useCallback(()=>{N.supported()&&(B(),P.current=new N.Map({...te,container:H.current}),P.current.resize(),A(!0))},[B,te]);return h.useEffect(()=>{Z()},[Z]),h.useEffect(()=>{!P.current||!F||d===void 0||Math.abs(P.current.getZoom()-d)>.1&&P.current.setZoom(d)},[d,F]),lt({center:t,fitBounds:S,isMapInitialized:F,map:P,markers:Y,palette:T}),yt({isMapInitialized:F,map:P,markers:Y,openPopup:i}),ft({isMapInitialized:F,map:P,onMapClick:a}),rt({disableAnimation:s,fitBoundDuration:_,fitBounds:S,fitBoundsAnimationKey:c,fitBoundsPadding:u,isMapInitialized:F,map:P,markers:Y}),h.useEffect(()=>B,[B]),{containerRef:H,isMapInitialized:F,map:P,markers:Y}},_t=({containerStyle:r,square:t,loading:s,height:i=300,width:a="100%",...y})=>{const{containerRef:v}=Rt(y);return z.jsxs(U.Box,{sx:{height:i,position:"relative",width:a,...r},children:[z.jsx(U.GlobalStyles,{styles:{".mapboxgl-popup-content":{backgroundColor:"transparent!important",borderRadius:"0px !important",boxShadow:"none!important",padding:"0px 0px!important",width:"fit-content!important"}}}),N.supported()?z.jsx(U.Box,{ref:v,sx:{alignItems:"center",borderRadius:t?0:1,height:i,justifyContent:"center",left:0,overflow:"hidden",position:"absolute",top:0,visibility:s?"hidden !important":"visible",width:a,zIndex:1}}):z.jsx(U.Box,{sx:{left:"50%",position:"absolute",textAlign:"center",top:"50%",transform:"translate(-50%, -50%)"},children:"WebGL is not enabled in your browser. This technology is required to display the interactive map."}),s&&z.jsx(U.Skeleton,{width:a,height:i,variant:t?"rectangular":"rounded",sx:{inset:0,position:"absolute",zIndex:2}})]})},mt=h.memo(_t);x.DEFAULT_CENTER_LAT=46.8677,x.DEFAULT_CENTER_LNG=2.333,x.MapProvider=$e,x.MapProviderContext=ge,x.MarkerMap=mt,x.isValidLatLng=me,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED