@neshan-maps-platform/react-openlayers 2.0.1 → 2.0.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.
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
(function(D,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(D=typeof globalThis<"u"?globalThis:D||self,m(D.ReactOpenlayers={},D.React))})(this,function(D,m){"use strict";var Q={},We={get exports(){return Q},set exports(s){Q=s}},Y={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var pe;function Ve(){if(pe)return Y;pe=1;var s=m,g=Symbol.for("react.element"),w=Symbol.for("react.fragment"),b=Object.prototype.hasOwnProperty,d=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,M={key:!0,ref:!0,__self:!0,__source:!0};function F(x,v,j){var h,C={},k=null,P=null;j!==void 0&&(k=""+j),v.key!==void 0&&(k=""+v.key),v.ref!==void 0&&(P=v.ref);for(h in v)b.call(v,h)&&!M.hasOwnProperty(h)&&(C[h]=v[h]);if(x&&x.defaultProps)for(h in v=x.defaultProps,v)C[h]===void 0&&(C[h]=v[h]);return{$$typeof:g,type:x,key:k,ref:P,props:C,_owner:d.current}}return Y.Fragment=w,Y.jsx=F,Y.jsxs=F,Y}var L={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var ve;function Be(){return ve||(ve=1,process.env.NODE_ENV!=="production"&&function(){var s=m,g=Symbol.for("react.element"),w=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),x=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),S=Symbol.iterator,U="@@iterator";function ee(e){if(e===null||typeof e!="object")return null;var r=S&&e[S]||e[U];return typeof r=="function"?r:null}var O=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];W("error",e,t)}}function W(e,r,t){{var n=O.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var u=t.map(function(o){return String(o)});u.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,u)}}var re=!1,z=!1,te=!1,ne=!1,ae=!1,J;J=Symbol.for("react.module.reference");function G(e){return!!(typeof e=="string"||typeof e=="function"||e===b||e===M||ae||e===d||e===j||e===h||ne||e===P||re||z||te||typeof e=="object"&&e!==null&&(e.$$typeof===k||e.$$typeof===C||e.$$typeof===F||e.$$typeof===x||e.$$typeof===v||e.$$typeof===J||e.getModuleId!==void 0))}function c(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function E(e){return e.displayName||"Context"}function p(e){if(e==null)return null;if(typeof e.tag=="number"&&y("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 b:return"Fragment";case w:return"Portal";case M:return"Profiler";case d:return"StrictMode";case j:return"Suspense";case h:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case x:var r=e;return E(r)+".Consumer";case F:var t=e;return E(t._context)+".Provider";case v:return c(e,e.render,"ForwardRef");case C:var n=e.displayName||null;return n!==null?n:p(e.type)||"Memo";case k:{var i=e,u=i._payload,o=i._init;try{return p(o(u))}catch{return null}}}return null}var R=Object.assign,V=0,he,_e,Ee,be,Re,Te,Ce;function Pe(){}Pe.__reactDisabledLog=!0;function Ze(){{if(V===0){he=console.log,_e=console.info,Ee=console.warn,be=console.error,Re=console.group,Te=console.groupCollapsed,Ce=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Pe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}V++}}function $e(){{if(V--,V===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},e,{value:he}),info:R({},e,{value:_e}),warn:R({},e,{value:Ee}),error:R({},e,{value:be}),group:R({},e,{value:Re}),groupCollapsed:R({},e,{value:Te}),groupEnd:R({},e,{value:Ce})})}V<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var oe=O.ReactCurrentDispatcher,ie;function K(e,r,t){{if(ie===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);ie=n&&n[1]||""}return`
|
|
18
|
+
`+ie+e}}var se=!1,H;{var Qe=typeof WeakMap=="function"?WeakMap:Map;H=new Qe}function Se(e,r){if(!e||se)return"";{var t=H.get(e);if(t!==void 0)return t}var n;se=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=oe.current,oe.current=null,Ze();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(A){n=A}Reflect.construct(e,[],o)}else{try{o.call()}catch(A){n=A}e.call(o.prototype)}}else{try{throw Error()}catch(A){n=A}e()}}catch(A){if(A&&n&&typeof A.stack=="string"){for(var a=A.stack.split(`
|
|
19
|
+
`),_=n.stack.split(`
|
|
20
|
+
`),l=a.length-1,f=_.length-1;l>=1&&f>=0&&a[l]!==_[f];)f--;for(;l>=1&&f>=0;l--,f--)if(a[l]!==_[f]){if(l!==1||f!==1)do if(l--,f--,f<0||a[l]!==_[f]){var T=`
|
|
21
|
+
`+a[l].replace(" at new "," at ");return e.displayName&&T.includes("<anonymous>")&&(T=T.replace("<anonymous>",e.displayName)),typeof e=="function"&&H.set(e,T),T}while(l>=1&&f>=0);break}}}finally{se=!1,oe.current=u,$e(),Error.prepareStackTrace=i}var N=e?e.displayName||e.name:"",Le=N?K(N):"";return typeof e=="function"&&H.set(e,Le),Le}function qe(e,r,t){return Se(e,!1)}function er(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function X(e,r,t){if(e==null)return"";if(typeof e=="function")return Se(e,er(e));if(typeof e=="string")return K(e);switch(e){case j:return K("Suspense");case h:return K("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return qe(e.render);case C:return X(e.type,r,t);case k:{var n=e,i=n._payload,u=n._init;try{return X(u(i),r,t)}catch{}}}return""}var Z=Object.prototype.hasOwnProperty,we={},Oe=O.ReactDebugCurrentFrame;function $(e){if(e){var r=e._owner,t=X(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}function rr(e,r,t,n,i){{var u=Function.call.bind(Z);for(var o in e)if(u(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var _=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _.name="Invariant Violation",_}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(l){a=l}a&&!(a instanceof Error)&&($(i),y("%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).",n||"React class",t,o,typeof a),$(null)),a instanceof Error&&!(a.message in we)&&(we[a.message]=!0,$(i),y("Failed %s type: %s",t,a.message),$(null))}}}var tr=Array.isArray;function ue(e){return tr(e)}function nr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function ar(e){try{return xe(e),!1}catch{return!0}}function xe(e){return""+e}function je(e){if(ar(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",nr(e)),xe(e)}var B=O.ReactCurrentOwner,or={key:!0,ref:!0,__self:!0,__source:!0},ke,Ae,ce;ce={};function ir(e){if(Z.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function sr(e){if(Z.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function ur(e,r){if(typeof e.ref=="string"&&B.current&&r&&B.current.stateNode!==r){var t=p(B.current.type);ce[t]||(y('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',p(B.current.type),e.ref),ce[t]=!0)}}function cr(e,r){{var t=function(){ke||(ke=!0,y("%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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function lr(e,r){{var t=function(){Ae||(Ae=!0,y("%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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var fr=function(e,r,t,n,i,u,o){var a={$$typeof:g,type:e,key:r,ref:t,props:o,_owner:u};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function dr(e,r,t,n,i){{var u,o={},a=null,_=null;t!==void 0&&(je(t),a=""+t),sr(r)&&(je(r.key),a=""+r.key),ir(r)&&(_=r.ref,ur(r,i));for(u in r)Z.call(r,u)&&!or.hasOwnProperty(u)&&(o[u]=r[u]);if(e&&e.defaultProps){var l=e.defaultProps;for(u in l)o[u]===void 0&&(o[u]=l[u])}if(a||_){var f=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&cr(o,f),_&&lr(o,f)}return fr(e,a,_,i,n,B.current,o)}}var le=O.ReactCurrentOwner,De=O.ReactDebugCurrentFrame;function I(e){if(e){var r=e._owner,t=X(e.type,e._source,r?r.type:null);De.setExtraStackFrame(t)}else De.setExtraStackFrame(null)}var fe;fe=!1;function de(e){return typeof e=="object"&&e!==null&&e.$$typeof===g}function Fe(){{if(le.current){var e=p(le.current.type);if(e)return`
|
|
22
|
+
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function pr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
|
|
24
|
+
|
|
25
|
+
Check your code at `+r+":"+t+"."}return""}}var Me={};function vr(e){{var r=Fe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
26
|
+
|
|
27
|
+
Check the top-level render call using <`+t+">.")}return r}}function Ie(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=vr(r);if(Me[t])return;Me[t]=!0;var n="";e&&e._owner&&e._owner!==le.current&&(n=" It was passed a child from "+p(e._owner.type)+"."),I(e),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),I(null)}}function Ne(e,r){{if(typeof e!="object")return;if(ue(e))for(var t=0;t<e.length;t++){var n=e[t];de(n)&&Ie(n,r)}else if(de(e))e._store&&(e._store.validated=!0);else if(e){var i=ee(e);if(typeof i=="function"&&i!==e.entries)for(var u=i.call(e),o;!(o=u.next()).done;)de(o.value)&&Ie(o.value,r)}}}function yr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===v||r.$$typeof===C))t=r.propTypes;else return;if(t){var n=p(r);rr(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!fe){fe=!0;var i=p(r);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function mr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){I(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),I(null);break}}e.ref!==null&&(I(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}function Ye(e,r,t,n,i,u){{var o=G(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" 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 _=pr(i);_?a+=_:a+=Fe();var l;e===null?l="null":ue(e)?l="array":e!==void 0&&e.$$typeof===g?(l="<"+(p(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,a)}var f=dr(e,r,t,i,u);if(f==null)return f;if(o){var T=r.children;if(T!==void 0)if(n)if(ue(T)){for(var N=0;N<T.length;N++)Ne(T[N],e);Object.freeze&&Object.freeze(T)}else y("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 Ne(T,e)}return e===b?mr(f):yr(f),f}}function gr(e,r,t){return Ye(e,r,t,!0)}function hr(e,r,t){return Ye(e,r,t,!1)}var _r=hr,Er=gr;L.Fragment=b,L.jsx=_r,L.jsxs=Er}()),L}(function(s){process.env.NODE_ENV==="production"?s.exports=Ve():s.exports=Be()})(We);const q=Q.jsx,br="",Ue={map:"_map_an20y_2","map-popup-container":"_map-popup-container_an20y_7",touch:"_touch_an20y_26","mobile-layers-button":"_mobile-layers-button_an20y_30",floaten:"_floaten_an20y_45",float:"_float_an20y_45"},ye=s=>s?s instanceof Object?[s.longitude,s.latitude]:s:void 0,ze=async()=>{try{const g=await new Promise((w,b)=>{navigator.geolocation.getCurrentPosition(d=>{w(d)},d=>b(d))});return g&&ye(g.coords)||Object.values(Je())}catch(s){return console.error(s),{}}},Je=()=>({longitude:59.5870851,latitude:36.311559}),Ge={reverse:"https://api.neshan.org/v4/reverse",search:"https://api.neshan.org/v1/search",map:"https://static.neshan.org/sdk/openlayers/7.1.0/ol.js"},me=m.createContext({map:null,mapType:"neshan",mapContainer:null,setMap:s=>{},setMapType:s=>{},setMapContainer:s=>{}}),ge={map:null,mapType:"neshan",mapContainer:null},Ke=(s,g)=>{switch(g.type){case"SET_MAP":return{...s,map:g.payload};case"SET_MAP_TYPE":return{...s,title:g.payload};default:return ge}},He=s=>{const[g,w]=m.useReducer(Ke,ge),b={...g,setMap:d=>{w({type:"SET_MAP",payload:d})},setMapType:d=>{w({type:"SET_MAP_TYPE",payload:d})},setMapContainer:d=>{w({type:"SET_MAP_CONTAINER",payload:d})}};return q(me.Provider,{value:b,children:s.children})},Xe=m.forwardRef(({options:s,mapKey:g,serviceKey:w="",zoom:b=12,defaultType:d="neshan",scale:M,center:F,poi:x=!0,traffic:v=!0,onInit:j,className:h,style:C},k)=>{const P=m.useContext(me),S=m.useRef(null),[U,ee]=m.useState(!1),[O,y]=m.useState(null),[W,re]=m.useState();m.useImperativeHandle(k,()=>({get mapContainer(){return S},get ol(){return typeof ol<"u"?ol:void 0},get map(){return P.map},get isInitiated(){return U}}),[S,P.map,U]);const z=()=>{var E,p;if(O)return O;const c=(p=(E=S.current)==null?void 0:E.querySelector(".ol-viewport"))==null?void 0:p.querySelectorAll("div:last-child");if(c)return y(Array.from(c)[c.length-1]),O},te=()=>{const c=z();c==null||c.style.setProperty("scale",""+M)},ne=()=>{const c=z();c==null||c.style.setProperty("bottom","0.2em"),c==null||c.style.setProperty("left","0.4em")},ae=(c,E="my-openlayer")=>{const p=document.getElementById(E);if(p)return p;const R=document.createElement("script");return R.src=c,R.id=E,document.getElementsByTagName("head")[0].appendChild(R),R},J=async()=>{var p;if(console.log(1),!S.current)return;console.log(2);const c=W||await ze();console.log(3);const E=new ol.Map({target:S.current,key:g||"",mapType:d,poi:x,traffic:v,view:new ol.View({center:ol.proj.fromLonLat(c),zoom:b,smoothExtentConstraint:!0}),controls:[],...s});console.log(4),E.setMapType(d),P.setMap(E),(p=P.map)==null||p.setMapType(d),P.setMapType(d),ee(!0),console.log(5),j&&j(ol,E),console.log(6)},G=async()=>{await J()};return m.useEffect(()=>{if(S.current&&P.setMapContainer(S.current),W)typeof ol<"u"?G():ae(Ge.map).addEventListener("load",()=>{G()}),te(),ne();else{const c=ye(F);re(E=>c)}},[W]),q(He,{children:q("div",{ref:S,className:h||Ue.map,style:C})})});D.NeshanMap=Xe,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "../assets/main.scss";
|
|
3
3
|
import { MapProps, NeshanMapRef } from "./Map.model";
|
|
4
|
+
export type { NeshanMapRef };
|
|
4
5
|
export declare const NeshanMap: import("react").ForwardRefExoticComponent<MapProps & import("react").RefAttributes<NeshanMapRef>>;
|
package/package.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
(function(D,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(D=typeof globalThis<"u"?globalThis:D||self,m(D.ReactNeshanMapOpenlayers={},D.React))})(this,function(D,m){"use strict";var q={},Ne={get exports(){return q},set exports(c){q=c}},L={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var de;function Le(){if(de)return L;de=1;var c=m,w=Symbol.for("react.element"),A=Symbol.for("react.fragment"),S=Object.prototype.hasOwnProperty,g=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,I={key:!0,ref:!0,__self:!0,__source:!0};function F(P,p,x){var y,R={},j=null,T=null;x!==void 0&&(j=""+x),p.key!==void 0&&(j=""+p.key),p.ref!==void 0&&(T=p.ref);for(y in p)S.call(p,y)&&!I.hasOwnProperty(y)&&(R[y]=p[y]);if(P&&P.defaultProps)for(y in p=P.defaultProps,p)R[y]===void 0&&(R[y]=p[y]);return{$$typeof:w,type:P,key:j,ref:T,props:R,_owner:g.current}}return L.Fragment=A,L.jsx=F,L.jsxs=F,L}var W={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var pe;function We(){return pe||(pe=1,process.env.NODE_ENV!=="production"&&function(){var c=m,w=Symbol.for("react.element"),A=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),P=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),C=Symbol.iterator,U="@@iterator";function Q(e){if(e===null||typeof e!="object")return null;var r=C&&e[C]||e[U];return typeof r=="function"?r:null}var O=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];Y("error",e,t)}}function Y(e,r,t){{var n=O.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var s=t.map(function(o){return String(o)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var ee=!1,z=!1,re=!1,te=!1,ne=!1,J;J=Symbol.for("react.module.reference");function G(e){return!!(typeof e=="string"||typeof e=="function"||e===S||e===I||ne||e===g||e===x||e===y||te||e===T||ee||z||re||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===R||e.$$typeof===F||e.$$typeof===P||e.$$typeof===p||e.$$typeof===J||e.getModuleId!==void 0))}function u(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function _(e){return e.displayName||"Context"}function d(e){if(e==null)return null;if(typeof e.tag=="number"&&v("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 S:return"Fragment";case A:return"Portal";case I:return"Profiler";case g:return"StrictMode";case x:return"Suspense";case y:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case P:var r=e;return _(r)+".Consumer";case F:var t=e;return _(t._context)+".Provider";case p:return u(e,e.render,"ForwardRef");case R:var n=e.displayName||null;return n!==null?n:d(e.type)||"Memo";case j:{var i=e,s=i._payload,o=i._init;try{return d(o(s))}catch{return null}}}return null}var b=Object.assign,V=0,me,ye,he,ge,_e,be,Ee;function Re(){}Re.__reactDisabledLog=!0;function Ke(){{if(V===0){me=console.log,ye=console.info,he=console.warn,ge=console.error,_e=console.group,be=console.groupCollapsed,Ee=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Re,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}V++}}function He(){{if(V--,V===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:b({},e,{value:me}),info:b({},e,{value:ye}),warn:b({},e,{value:he}),error:b({},e,{value:ge}),group:b({},e,{value:_e}),groupCollapsed:b({},e,{value:be}),groupEnd:b({},e,{value:Ee})})}V<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=O.ReactCurrentDispatcher,oe;function K(e,r,t){{if(oe===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);oe=n&&n[1]||""}return`
|
|
18
|
-
`+oe+e}}var ie=!1,H;{var Xe=typeof WeakMap=="function"?WeakMap:Map;H=new Xe}function Te(e,r){if(!e||ie)return"";{var t=H.get(e);if(t!==void 0)return t}var n;ie=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=ae.current,ae.current=null,Ke();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(k){n=k}Reflect.construct(e,[],o)}else{try{o.call()}catch(k){n=k}e.call(o.prototype)}}else{try{throw Error()}catch(k){n=k}e()}}catch(k){if(k&&n&&typeof k.stack=="string"){for(var a=k.stack.split(`
|
|
19
|
-
`),h=n.stack.split(`
|
|
20
|
-
`),l=a.length-1,f=h.length-1;l>=1&&f>=0&&a[l]!==h[f];)f--;for(;l>=1&&f>=0;l--,f--)if(a[l]!==h[f]){if(l!==1||f!==1)do if(l--,f--,f<0||a[l]!==h[f]){var E=`
|
|
21
|
-
`+a[l].replace(" at new "," at ");return e.displayName&&E.includes("<anonymous>")&&(E=E.replace("<anonymous>",e.displayName)),typeof e=="function"&&H.set(e,E),E}while(l>=1&&f>=0);break}}}finally{ie=!1,ae.current=s,He(),Error.prepareStackTrace=i}var N=e?e.displayName||e.name:"",Me=N?K(N):"";return typeof e=="function"&&H.set(e,Me),Me}function $e(e,r,t){return Te(e,!1)}function Ze(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function X(e,r,t){if(e==null)return"";if(typeof e=="function")return Te(e,Ze(e));if(typeof e=="string")return K(e);switch(e){case x:return K("Suspense");case y:return K("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case p:return $e(e.render);case R:return X(e.type,r,t);case j:{var n=e,i=n._payload,s=n._init;try{return X(s(i),r,t)}catch{}}}return""}var $=Object.prototype.hasOwnProperty,Ce={},we=O.ReactDebugCurrentFrame;function Z(e){if(e){var r=e._owner,t=X(e.type,e._source,r?r.type:null);we.setExtraStackFrame(t)}else we.setExtraStackFrame(null)}function qe(e,r,t,n,i){{var s=Function.call.bind($);for(var o in e)if(s(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var h=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(l){a=l}a&&!(a instanceof Error)&&(Z(i),v("%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).",n||"React class",t,o,typeof a),Z(null)),a instanceof Error&&!(a.message in Ce)&&(Ce[a.message]=!0,Z(i),v("Failed %s type: %s",t,a.message),Z(null))}}}var Qe=Array.isArray;function se(e){return Qe(e)}function er(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function rr(e){try{return Se(e),!1}catch{return!0}}function Se(e){return""+e}function Oe(e){if(rr(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",er(e)),Se(e)}var B=O.ReactCurrentOwner,tr={key:!0,ref:!0,__self:!0,__source:!0},Pe,xe,ue;ue={};function nr(e){if($.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function ar(e){if($.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function or(e,r){if(typeof e.ref=="string"&&B.current&&r&&B.current.stateNode!==r){var t=d(B.current.type);ue[t]||(v('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',d(B.current.type),e.ref),ue[t]=!0)}}function ir(e,r){{var t=function(){Pe||(Pe=!0,v("%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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function sr(e,r){{var t=function(){xe||(xe=!0,v("%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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var ur=function(e,r,t,n,i,s,o){var a={$$typeof:w,type:e,key:r,ref:t,props:o,_owner:s};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function cr(e,r,t,n,i){{var s,o={},a=null,h=null;t!==void 0&&(Oe(t),a=""+t),ar(r)&&(Oe(r.key),a=""+r.key),nr(r)&&(h=r.ref,or(r,i));for(s in r)$.call(r,s)&&!tr.hasOwnProperty(s)&&(o[s]=r[s]);if(e&&e.defaultProps){var l=e.defaultProps;for(s in l)o[s]===void 0&&(o[s]=l[s])}if(a||h){var f=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&ir(o,f),h&&sr(o,f)}return ur(e,a,h,i,n,B.current,o)}}var ce=O.ReactCurrentOwner,je=O.ReactDebugCurrentFrame;function M(e){if(e){var r=e._owner,t=X(e.type,e._source,r?r.type:null);je.setExtraStackFrame(t)}else je.setExtraStackFrame(null)}var le;le=!1;function fe(e){return typeof e=="object"&&e!==null&&e.$$typeof===w}function ke(){{if(ce.current){var e=d(ce.current.type);if(e)return`
|
|
22
|
-
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function lr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
|
|
24
|
-
|
|
25
|
-
Check your code at `+r+":"+t+"."}return""}}var De={};function fr(e){{var r=ke();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
26
|
-
|
|
27
|
-
Check the top-level render call using <`+t+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=fr(r);if(De[t])return;De[t]=!0;var n="";e&&e._owner&&e._owner!==ce.current&&(n=" It was passed a child from "+d(e._owner.type)+"."),M(e),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),M(null)}}function Ae(e,r){{if(typeof e!="object")return;if(se(e))for(var t=0;t<e.length;t++){var n=e[t];fe(n)&&Fe(n,r)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var i=Q(e);if(typeof i=="function"&&i!==e.entries)for(var s=i.call(e),o;!(o=s.next()).done;)fe(o.value)&&Fe(o.value,r)}}}function dr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===p||r.$$typeof===R))t=r.propTypes;else return;if(t){var n=d(r);qe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!le){le=!0;var i=d(r);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){M(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),M(null);break}}e.ref!==null&&(M(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),M(null))}}function Ie(e,r,t,n,i,s){{var o=G(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" 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 h=lr(i);h?a+=h:a+=ke();var l;e===null?l="null":se(e)?l="array":e!==void 0&&e.$$typeof===w?(l="<"+(d(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,a)}var f=cr(e,r,t,i,s);if(f==null)return f;if(o){var E=r.children;if(E!==void 0)if(n)if(se(E)){for(var N=0;N<E.length;N++)Ae(E[N],e);Object.freeze&&Object.freeze(E)}else v("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 Ae(E,e)}return e===S?pr(f):dr(f),f}}function vr(e,r,t){return Ie(e,r,t,!0)}function mr(e,r,t){return Ie(e,r,t,!1)}var yr=mr,hr=vr;W.Fragment=S,W.jsx=yr,W.jsxs=hr}()),W}(function(c){process.env.NODE_ENV==="production"?c.exports=Le():c.exports=We()})(Ne);const Ye=q.jsx,gr="",Ve={map:"_map_an20y_2","map-popup-container":"_map-popup-container_an20y_7",touch:"_touch_an20y_26","mobile-layers-button":"_mobile-layers-button_an20y_30",floaten:"_floaten_an20y_45",float:"_float_an20y_45"},ve=c=>c?c instanceof Object?[c.longitude,c.latitude]:c:void 0,Be=async()=>{try{const w=await new Promise((A,S)=>{navigator.geolocation.getCurrentPosition(g=>{A(g)},g=>S(g))});return w&&ve(w.coords)||Object.values(Ue())}catch(c){return console.error(c),{}}},Ue=()=>({longitude:59.5870851,latitude:36.311559}),ze={reverse:"https://api.neshan.org/v4/reverse",search:"https://api.neshan.org/v1/search",map:"https://static.neshan.org/sdk/openlayers/7.1.0/ol.js"},Je=m.createContext({map:null,mapType:"neshan",mapContainer:null,setMap:c=>{},setMapType:c=>{},setMapContainer:c=>{}}),Ge=m.forwardRef(({options:c,mapKey:w,serviceKey:A="",zoom:S=12,defaultType:g="neshan",scale:I,center:F,poi:P=!0,traffic:p=!0,onInit:x,className:y,style:R},j)=>{const T=m.useContext(Je),C=m.useRef(null),[U,Q]=m.useState(!1),[O,v]=m.useState(null),[Y,ee]=m.useState();m.useImperativeHandle(j,()=>({get mapContainer(){return C},get ol(){return typeof ol<"u"?ol:void 0},get map(){return T.map},get isInitiated(){return U}}),[C,T.map,U]);const z=()=>{var _,d;if(O)return O;const u=(d=(_=C.current)==null?void 0:_.querySelector(".ol-viewport"))==null?void 0:d.querySelectorAll("div:last-child");if(u)return v(Array.from(u)[u.length-1]),O},re=()=>{const u=z();u==null||u.style.setProperty("scale",""+I)},te=()=>{const u=z();u==null||u.style.setProperty("bottom","0.2em"),u==null||u.style.setProperty("left","0.4em")},ne=(u,_="my-openlayer")=>{const d=document.getElementById(_);if(d)return d;const b=document.createElement("script");return b.src=u,b.id=_,document.getElementsByTagName("head")[0].appendChild(b),b},J=async()=>{var d;if(!C.current)return;const u=Y||await Be(),_=new ol.Map({target:C.current,key:w||"",mapType:g,poi:P,traffic:p,view:new ol.View({center:ol.proj.fromLonLat(u),zoom:S,smoothExtentConstraint:!0}),controls:[],...c});_.setMapType(g),T.setMap(_),(d=T.map)==null||d.setMapType(g),T.setMapType(g),Q(!0),x&&x(ol,_)},G=async()=>{await J()};return m.useEffect(()=>{if(C.current&&T.setMapContainer(C.current),Y)typeof ol<"u"?G():ne(ze.map).addEventListener("load",()=>{G()}),re(),te();else{const u=ve(F);ee(_=>u)}},[Y]),Ye("div",{ref:C,className:y||Ve.map,style:R})});D.NeshanMap=Ge,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
|