@mappedin/react-sdk 6.0.0-rc.2 → 6.0.0-rc.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.
@@ -6226,11 +6226,12 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6226
6226
 
6227
6227
  -----------
6228
6228
 
6229
- The following npm package may be included in this product:
6229
+ The following npm packages may be included in this product:
6230
6230
 
6231
6231
  - tslib@1.14.1
6232
+ - tslib@2.8.1
6232
6233
 
6233
- This package contains the following license:
6234
+ These packages each contain the following license:
6234
6235
 
6235
6236
  Copyright (c) Microsoft Corporation.
6236
6237
 
@@ -8900,6 +8901,40 @@ SOFTWARE.
8900
8901
 
8901
8902
  -----------
8902
8903
 
8904
+ The following npm package may be included in this product:
8905
+
8906
+ - es-toolkit@1.39.10
8907
+
8908
+ This package contains the following license:
8909
+
8910
+ MIT License
8911
+
8912
+ Copyright (c) 2024 Viva Republica, Inc
8913
+
8914
+ Copyright OpenJS Foundation and other contributors
8915
+
8916
+ Parts of the test suite and compatibility layer in `es-toolkit/compat` are derived from Lodash (https://github.com/lodash/lodash) by the OpenJS Foundation (https://openjsf.org/) and Underscore.js by Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors (http://underscorejs.org/)
8917
+
8918
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8919
+ of this software and associated documentation files (the "Software"), to deal
8920
+ in the Software without restriction, including without limitation the rights
8921
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8922
+ copies of the Software, and to permit persons to whom the Software is
8923
+ furnished to do so, subject to the following conditions:
8924
+
8925
+ The above copyright notice and this permission notice shall be included in all
8926
+ copies or substantial portions of the Software.
8927
+
8928
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8929
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8930
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8931
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8932
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
8933
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
8934
+ SOFTWARE.
8935
+
8936
+ -----------
8937
+
8903
8938
  The following npm package may be included in this product:
8904
8939
 
8905
8940
  - rbush@4.0.1
@@ -11759,7 +11794,9 @@ The following npm packages may be included in this product:
11759
11794
  - @turf/destination@6.5.0
11760
11795
  - @turf/distance@6.5.0
11761
11796
  - @turf/helpers@6.5.0
11797
+ - @turf/helpers@7.2.0
11762
11798
  - @turf/invariant@6.5.0
11799
+ - @turf/invariant@7.2.0
11763
11800
  - @turf/length@6.5.0
11764
11801
  - @turf/line-intersect@6.5.0
11765
11802
  - @turf/line-segment@6.5.0
@@ -11767,6 +11804,7 @@ The following npm packages may be included in this product:
11767
11804
  - @turf/meta@6.5.0
11768
11805
  - @turf/nearest-point-on-line@6.5.0
11769
11806
  - @turf/polygon-to-line@6.5.0
11807
+ - @turf/polygon-to-line@7.2.0
11770
11808
 
11771
11809
  These packages each contain the following license:
11772
11810
 
@@ -13025,6 +13063,7 @@ The following npm packages may be included in this product:
13025
13063
  - @mappedin/mvf-cms@1.0.0-beta.5
13026
13064
  - @mappedin/mvf-connections@1.0.0-beta.5
13027
13065
  - @mappedin/mvf-core@3.0.0-beta.5
13066
+ - @mappedin/mvf-core@3.0.0-kr-report-deepest-error.4487eaa.0
13028
13067
  - @mappedin/mvf-default-style@1.0.0-beta.5
13029
13068
  - @mappedin/mvf-facade@1.0.0-beta.5
13030
13069
  - @mappedin/mvf-floor-images@1.0.0-beta.5
@@ -13038,6 +13077,7 @@ The following npm packages may be included in this product:
13038
13077
  - @mappedin/mvf-traversability@1.0.0-beta.5
13039
13078
  - @mappedin/mvf-v2@2.100.0-final.4
13040
13079
  - @mappedin/typebox-fast-transform@1.0.0-beta.3
13080
+ - @mappedin/typebox-fast-transform@1.0.0-kr-report-deepest-error.4487eaa.0
13041
13081
 
13042
13082
  These packages each contain the following license:
13043
13083
 
@@ -2,6 +2,7 @@
2
2
  // Dependencies for this module:
3
3
  // ../react/react
4
4
  // ../react/@mappedin/mappedin-js
5
+ // ../react/@packages/internal/common/extensions
5
6
  // ../react/type-fest
6
7
 
7
8
  declare module '@mappedin/react-sdk' {
@@ -12,6 +13,7 @@ declare module '@mappedin/react-sdk' {
12
13
  export { MapView } from '@mappedin/react-sdk/react-sdk/src/MapView';
13
14
  export type { MapViewProps } from '@mappedin/react-sdk/react-sdk/src/MapView';
14
15
  export { useMapViewEvent } from '@mappedin/react-sdk/react-sdk/src/hooks/useMapViewEvent';
16
+ export { useMapViewExtension } from '@mappedin/react-sdk/react-sdk/src/hooks/useMapViewExtension';
15
17
  export { Path } from '@mappedin/react-sdk/react-sdk/src/Path';
16
18
  export type { PathProps } from '@mappedin/react-sdk/react-sdk/src/Path';
17
19
  export { Navigation } from '@mappedin/react-sdk/react-sdk/src/Navigation';
@@ -101,8 +103,10 @@ declare module '@mappedin/react-sdk/react-sdk/src/MapView' {
101
103
  import type { TupleToObjectWithPropNames } from '@mappedin/react-sdk/react-sdk/src/type-utils';
102
104
  import { show3dMap } from '@mappedin/mappedin-js';
103
105
  import type { MapView as MapViewJS } from '@mappedin/mappedin-js';
106
+ import type { ExtensionRegistry } from '@packages/internal/common/extensions';
104
107
  type MapViewContextType = {
105
108
  mapView?: MapViewJS;
109
+ extensions: ExtensionRegistry;
106
110
  };
107
111
  export const MapViewContext: React.Context<MapViewContextType>;
108
112
  type ParamsArray = Parameters<typeof show3dMap>;
@@ -165,6 +169,40 @@ declare module '@mappedin/react-sdk/react-sdk/src/hooks/useMapViewEvent' {
165
169
  } ? TEvents[T]['data'] : TEvents[T]) => void): void;
166
170
  }
167
171
 
172
+ declare module '@mappedin/react-sdk/react-sdk/src/hooks/useMapViewExtension' {
173
+ import type { MapViewExtension, MapViewExtensionName } from '@packages/internal/common/extensions';
174
+ type MapViewExtensionOptions<T extends MapViewExtension<unknown>> = {
175
+ /**
176
+ * Callback to be fired when the extension is registered.
177
+ * This will not be called on subsequent calls to register until the extension is deregistered again.
178
+ **/
179
+ onRegister: () => T;
180
+ /**
181
+ * Callback to be fired when the extension is deregistered.
182
+ * This will not be called if the extension is not registered.
183
+ **/
184
+ onDeregister: (extension: T) => void;
185
+ };
186
+ type MapViewExtensionResult<T extends MapViewExtension<unknown>> = {
187
+ /**
188
+ * Register the extension or return the existing instance if it is already registered.
189
+ */
190
+ register: () => T;
191
+ /**
192
+ * Deregister the extension.
193
+ */
194
+ deregister: () => void;
195
+ };
196
+ /**
197
+ * @internal
198
+ * Register an extension to the mapView context.
199
+ * @param name - The name of the extension.
200
+ * @returns An object with a register and deregister function.
201
+ */
202
+ export function useMapViewExtension<T extends MapViewExtension<unknown> = MapViewExtension<unknown>>(name: MapViewExtensionName, options: MapViewExtensionOptions<T>): MapViewExtensionResult<T>;
203
+ export {};
204
+ }
205
+
168
206
  declare module '@mappedin/react-sdk/react-sdk/src/Path' {
169
207
  import type { TupleToObjectWithPropNames } from '@mappedin/react-sdk/react-sdk/src/type-utils';
170
208
  import type { MapView, Path as PathJS } from '@mappedin/mappedin-js';
package/lib/esm/index.js CHANGED
@@ -1 +1,727 @@
1
- var fe=Object.create;var L=Object.defineProperty,ce=Object.defineProperties,le=Object.getOwnPropertyDescriptor,de=Object.getOwnPropertyDescriptors,Me=Object.getOwnPropertyNames,R=Object.getOwnPropertySymbols,ye=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var H=(e,r,t)=>r in e?L(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,y=(e,r)=>{for(var t in r||(r={}))b.call(r,t)&&H(e,t,r[t]);if(R)for(var t of R(r))z.call(r,t)&&H(e,t,r[t]);return e},v=(e,r)=>ce(e,de(r)),s=(e,r)=>L(e,"name",{value:r,configurable:!0});var $=(e,r)=>{var t={};for(var a in e)b.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(e!=null&&R)for(var a of R(e))r.indexOf(a)<0&&z.call(e,a)&&(t[a]=e[a]);return t};var he=(e,r)=>()=>(e&&(r=e(e=0)),r);var Pe=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var we=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Me(r))!b.call(e,o)&&o!==t&&L(e,o,{get:()=>r[o],enumerable:!(a=le(r,o))||a.enumerable});return e};var U=(e,r,t)=>(t=e!=null?fe(ye(e)):{},we(r||!e||!e.__esModule?L(t,"default",{value:e,enumerable:!0}):t,e));var m,n=he(()=>{m={env:{NODE_ENV:"production",npm_package_version:"6.0.0-rc.2"}}});var A=Pe((_t,F)=>{"use strict";n();F.exports=s(function e(r,t){if(r===t)return!0;if(r&&t&&typeof r=="object"&&typeof t=="object"){if(r.constructor!==t.constructor)return!1;var a,o,p;if(Array.isArray(r)){if(a=r.length,a!=t.length)return!1;for(o=a;o--!==0;)if(!e(r[o],t[o]))return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if(p=Object.keys(r),a=p.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,p[o]))return!1;for(o=a;o--!==0;){var i=p[o];if(!e(r[i],t[i]))return!1}return!0}return r!==r&&t!==t},"equal")});n();n();import De,{createContext as Se,useCallback as q,useMemo as Ee,useRef as ge}from"react";var E=Se({getCache:s(()=>{},"getCache"),setCache:s(()=>{},"setCache")});function k({mapData:e,children:r}){let t=ge(e?{mapData:e,options:{}}:void 0),a=q(()=>t.current,[]),o=q(i=>{t.current=i},[]),p=Ee(()=>({getCache:a,setCache:o}),[a,o]);return De.createElement(E.Provider,{value:p},r)}s(k,"MapDataProvider");n();var Q=U(A());import{useCallback as Ce,useContext as Oe,useEffect as Y,useRef as Re,useState as j}from"react";import{getMapData as Le}from"@mappedin/mappedin-js";n();var Te="[MappedinJS]";function ve(e="",{prefix:r=Te}={}){let t="".concat(r).concat(e?"-".concat(e):""),a=s((o,p)=>{if(typeof window<"u"&&window.rnDebug){let i=p.map(M=>M instanceof Error&&M.stack?"".concat(M.message,"\n").concat(M.stack):M);window.rnDebug("".concat(e," ").concat(o,": ").concat(i.join(" ")))}},"rnDebug");return{logState:m.env.NODE_ENV==="test"?3:0,log(...o){this.logState<=0&&(console.log(t,...o),a("log",o))},warn(...o){this.logState<=1&&(console.warn(t,...o),a("warn",o))},error(...o){this.logState<=2&&(console.error(t,...o),a("error",o))},assert(...o){console.assert(...o)},time(o){console.time(o)},timeEnd(o){console.timeEnd(o)},setLevel(o){0<=o&&o<=3&&(this.logState=o)}}}s(ve,"createLogger");var Ve=ve();var V=Ve;n();var B=U(A());import{useRef as K}from"react";function d(e,r){let t=K(),a=K();return(0,B.default)(r,a.current)||(t.current=e(),a.current=r),t.current}s(d,"useMemoDeep");function Ne(e){let{getCache:r,setCache:t}=Oe(E),[a,o]=j(void 0),[p,i]=j(!0),[M,u]=j(void 0),D=Re(0),l=d(()=>e&&v(y({},e),{analytics:y({context:"reactsdk"},e==null?void 0:e.analytics)}),[e]),g=Ce(h=>{let S=++D.current;i(!0),u(void 0),Le(h).then(P=>{D.current===S&&o(P)}).catch(P=>{D.current===S&&(V.error("Failed to fetch MapData",P),u(P))}).finally(()=>{D.current===S&&i(!1)})},[]);return Y(()=>{let h=r==null?void 0:r();if(h!=null&&(l==null||h.mapData.mapId===l.mapId&&(0,Q.default)(h.options,l))){o(h.mapData),i(!1),u(void 0);return}if(!l){u(new Error("useMapData requires options if not use within a MapDataProvider or MapView component."));return}g(l)},[g,r,l]),Y(()=>{let h=r==null?void 0:r();a!=null&&(h==null||h.mapData.mapId===a.mapId)&&(t==null||t({mapData:a,options:l||{}}))},[a,l,r,t]),{mapData:a,isLoading:p,error:M}}s(Ne,"useMapData");n();import{useCallback as be,useContext as ke,useEffect as Ae}from"react";function je(e,r){let{getCache:t}=ke(E),a=be(o=>r(o),[r]);Ae(()=>{var p;let o=(p=t==null?void 0:t())==null?void 0:p.mapData;if(o==null)throw new Error("useMapDataEvent must be used within a MapDataProvider or MapView component.");return o.on(e,a),()=>{o!=null&&o.off(e,a)}},[t,e,a])}s(je,"useMapDataEvent");n();import C,{useCallback as Ie,useEffect as Je,useMemo as X,useRef as Z,useState as ee,forwardRef as We,useImperativeHandle as _e,createContext as Ge}from"react";import{show3dMap as He}from"@mappedin/mappedin-js";var f=Ge({mapView:void 0}),ze={width:"100%",height:"100%",position:"relative"},$e=We((e,r)=>{let _=e,{mapData:t,options:a,style:o,fallback:p,children:i}=_,M=$(_,["mapData","options","style","fallback","children"]),u=Z({}).current,[D,l]=ee(!0),[g,h]=ee(!1),S=Z(null),P=X(()=>t,[t]),W=d(()=>a,[a]);_e(r,()=>u.mapView);let me=X(()=>({mapData:P,mapView:u.mapView}),[P,u.mapView]),O=Ie(T=>{var G;let w=T||u.mapView;try{(G=w==null?void 0:w.destroy)==null||G.call(w)}catch(ue){V.error("Failed to destroy MapView",ue)}T||(u.mapView=void 0,h(!1))},[u]);return Je(()=>{if(!P||!S.current)return;O();let T=!1;return l(!0),He(S.current,P,W).then(w=>{T?O(w):(u.mapView=w,h(!0))}).catch(w=>{V.error("Failed to render MapView",w)}).finally(()=>{T||l(!1)}),()=>{T=!0,u.mapView&&O()}},[P,W,u,O]),C.createElement(k,{mapData:P},C.createElement(f.Provider,{value:me},C.createElement("div",y({"data-testid":"mappedin-map",ref:S,style:y(y({},ze),o)},M)),D?C.createElement(C.Fragment,null,p):g?i:null))});n();import{useCallback as Ue,useContext as qe,useEffect as Fe}from"react";n();var I=class I extends Error{constructor(r){super("".concat(r," must be used within a MapView component."))}};s(I,"MapViewNullError");var c=I;function Ke(e,r){let{mapView:t}=qe(f),a=Ue(o=>r(o),[r]);Fe(()=>{if(t==null)throw new c("useMapViewEvent");return t.on(e,a),()=>{t!=null&&t.off(e,a)}},[t,e,r])}s(Ke,"useMapViewEvent");n();import{useContext as Qe,useEffect as Xe,useRef as Ze,forwardRef as et,useImperativeHandle as tt,useState as rt}from"react";n();import{useEffect as Be,useRef as Ye}from"react";function x(e,r){let t=Ye(!0);Be(()=>{if(t.current){t.current=!1;return}return e()},r)}s(x,"useUpdateEffect");var at=et((e,r)=>{let{mapView:t}=Qe(f),a=Ze(),o=d(()=>e.options,[e.options]),[p,i]=rt(!1);return tt(r,()=>a.current,[p]),Xe(()=>{if(t==null)throw new c("Path");let M=t.Paths.add(e.coordinate,o);return M.animation.then(()=>{var u;(u=e.onDrawComplete)==null||u.call(e)}),a.current=M,i(!0),()=>{a.current&&t.Paths.remove(a.current),i(!1)}},[t,e.coordinate]),x(()=>{a.current&&o&&(t==null||t.updateState(a.current,o))},[o]),null});n();import{useContext as ot,useEffect as nt}from"react";function it(e){let{mapView:r}=ot(f),t=d(()=>e.options,[e.options]);return nt(()=>{if(r==null)throw new c("Navigation");return r.Navigation.draw(e.directions,t).then(()=>{var a;(a=e.onDrawComplete)==null||a.call(e)}),()=>{r.Navigation.clear()}},[r,e.directions,t]),null}s(it,"Navigation");n();import{useContext as pt,useEffect as st,useRef as mt,forwardRef as ut,useImperativeHandle as ft,useState as ct}from"react";var lt=ut((e,r)=>{let{mapView:t}=pt(f),a=mt(),o=d(()=>e.style,[e.style]),[p,i]=ct(!1);return ft(r,()=>a.current,[p]),st(()=>{if(t==null)throw new Error("MapView not initialized");return a.current=t.Shapes.add(e.geometry,e.style,e.floor),i(!0),()=>{t==null||a.current==null||(t.Shapes.remove(a.current),i(!1))}},[t,e.geometry,e.style,e.floor]),x(()=>{a.current&&o&&(t==null||t.updateState(a.current,o))},[o]),null});n();import{useContext as dt,useEffect as Mt,useRef as yt,forwardRef as ht,useImperativeHandle as Pt,useState as wt}from"react";var xt=ht((e,r)=>{let{mapView:t}=dt(f),a=yt(),o=d(()=>e.options,[e.options]),[p,i]=wt(!1);return Pt(r,()=>a.current,[p]),Mt(()=>{if(t==null)throw new c("Model");return a.current=t.Models.add(e.coordinate,e.url,o),i(!0),()=>{t==null||a.current==null||(t.Models.remove(a.current),i(!1))}},[t,e.url]),x(()=>{a.current&&(t==null||t.updateState(a.current,y({position:e.coordinate},o)))},[e.coordinate,o]),null});n();import{useContext as te}from"react";function Dt(){var t;let{mapView:e}=te(f),{getCache:r}=te(E);if(!e)throw new c("useMap");return{mapData:((t=r==null?void 0:r())==null?void 0:t.mapData)||e.getMapData(),mapView:e}}s(Dt,"useMap");n();import St,{useCallback as Et,useContext as ae,useEffect as oe,useMemo as gt,useRef as N,forwardRef as ne,useImperativeHandle as ie,useState as pe}from"react";import{createPortal as Tt}from"react-dom";n();var J=[0,4,6,8,10],re=s(()=>{let e=new Array(16).fill(0),r=Math.random()*4294967296;for(let a=0;a<e.length;a++)a>0&&(a&3)===0&&(r=Math.random()*4294967296),e[a]=r>>>((a&3)<<3)&255;let t=e.map(a=>a.toString(16).padStart(2,"0"));return t[6]="4"+t[6][1],t[8]=["8","9","a","b"].includes(t[7][0])?t[7]:"a"+t[7][1],J.map((a,o)=>t.slice(a,o===J.length-1?void 0:J[o+1]).join("")).join("-")},"randomId");var se=ne((e,r)=>{let{mapView:t}=ae(f),a=N(),[o,p]=pe(!1),i=d(()=>e.options,[e.options]);return ie(r,()=>a.current,[o]),oe(()=>{if(t==null)throw new c("Marker");return a.current=t.Markers.add(e.target,"",i),p(!0),()=>{t==null||a.current==null||(t.Markers.remove(a.current),p(!1))}},[t,e.target]),x(()=>{a.current&&i&&(t==null||t.updateState(a.current,i))},[i]),t==null||a.current==null?null:Tt(e.children,a.current.contentEl,a.current.id)}),vt=ne((e,r)=>{let{mapView:t}=ae(f),a=N(re()),o=N(),[p,i]=pe(!1),M=N(e.target);ie(r,()=>o.current,[p]);let u=Et(l=>{o.current=l||void 0,i(!!l)},[]);oe(()=>{if(t==null)throw new c("Marker");if(o.current&&o.current.target!==e.target){let{duration:l=300,easing:g="linear"}=e;t.Markers.animateTo(o.current,e.target,{duration:l,easing:g})}return()=>{i(!1)}},[t,e.target]);let D=gt(()=>v(y({},e),{duration:void 0,easing:void 0}),[e.duration,e.easing]);return St.createElement(se,v(y({},D),{key:a.current,target:M.current,ref:u}))});n();import{forwardRef as Vt,useContext as Ct,useEffect as Ot,useImperativeHandle as Rt,useRef as Lt,useState as Nt}from"react";var bt=Vt((e,r)=>{let{mapView:t}=Ct(f),a=Lt(),[o,p]=Nt(!1),i=d(()=>e.options,[e.options]);return Rt(r,()=>a.current,[o]),Ot(()=>{if(t==null)throw new c("Label");return a.current=t.Labels.add(e.target,e.text,i),p(!0),()=>{t==null||a.current==null||(t.Labels.remove(a.current),p(!1))}},[t,e.target]),x(()=>{a.current&&(t==null||t.updateState(a.current,y({text:e.text},i)))},[e.text,i]),null});export{vt as AnimatedMarker,bt as Label,k as MapDataProvider,$e as MapView,se as Marker,xt as Model,it as Navigation,at as Path,lt as Shape,Dt as useMap,Ne as useMapData,je as useMapDataEvent,Ke as useMapViewEvent};
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
11
+ var __commonJS = (cb, mod) => function __require() {
12
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+
31
+ // <define:process>
32
+ var define_process_default;
33
+ var init_define_process = __esm({
34
+ "<define:process>"() {
35
+ define_process_default = { env: { npm_package_version: "6.0.0-rc.3" } };
36
+ }
37
+ });
38
+
39
+ // ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
40
+ var require_fast_deep_equal = __commonJS({
41
+ "../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js"(exports, module) {
42
+ "use strict";
43
+ init_define_process();
44
+ module.exports = /* @__PURE__ */ __name(function equal3(a, b) {
45
+ if (a === b) return true;
46
+ if (a && b && typeof a == "object" && typeof b == "object") {
47
+ if (a.constructor !== b.constructor) return false;
48
+ var length, i, keys;
49
+ if (Array.isArray(a)) {
50
+ length = a.length;
51
+ if (length != b.length) return false;
52
+ for (i = length; i-- !== 0; )
53
+ if (!equal3(a[i], b[i])) return false;
54
+ return true;
55
+ }
56
+ if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
57
+ if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
58
+ if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
59
+ keys = Object.keys(a);
60
+ length = keys.length;
61
+ if (length !== Object.keys(b).length) return false;
62
+ for (i = length; i-- !== 0; )
63
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
64
+ for (i = length; i-- !== 0; ) {
65
+ var key = keys[i];
66
+ if (!equal3(a[key], b[key])) return false;
67
+ }
68
+ return true;
69
+ }
70
+ return a !== a && b !== b;
71
+ }, "equal");
72
+ }
73
+ });
74
+
75
+ // src/index.tsx
76
+ init_define_process();
77
+
78
+ // src/MapDataProvider.tsx
79
+ init_define_process();
80
+ import React, { createContext, useCallback, useMemo, useRef } from "react";
81
+ var MapDataContext = createContext({
82
+ getCache: /* @__PURE__ */ __name(() => void 0, "getCache"),
83
+ setCache: /* @__PURE__ */ __name(() => {
84
+ }, "setCache")
85
+ });
86
+ function MapDataProvider({ mapData, children }) {
87
+ const cachedEntryRef = useRef(
88
+ mapData ? { mapData, options: {} } : void 0
89
+ );
90
+ const getCache = useCallback(() => cachedEntryRef.current, []);
91
+ const setCache = useCallback((entry) => {
92
+ cachedEntryRef.current = entry;
93
+ }, []);
94
+ const contextValue = useMemo(
95
+ () => ({
96
+ getCache,
97
+ setCache
98
+ }),
99
+ [getCache, setCache]
100
+ );
101
+ return /* @__PURE__ */ React.createElement(MapDataContext.Provider, { value: contextValue }, children);
102
+ }
103
+ __name(MapDataProvider, "MapDataProvider");
104
+
105
+ // src/hooks/useMapData.tsx
106
+ init_define_process();
107
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
108
+ import { useCallback as useCallback2, useContext, useEffect, useRef as useRef3, useState } from "react";
109
+ import { getMapData } from "@mappedin/mappedin-js";
110
+
111
+ // ../packages/common/Mappedin.Logger.ts
112
+ init_define_process();
113
+ var MI_ERROR_LABEL = "[MappedinJS]";
114
+ function createLogger(name = "", { prefix = MI_ERROR_LABEL } = {}) {
115
+ const label = `${prefix}${name ? `-${name}` : ""}`;
116
+ const rnDebug = /* @__PURE__ */ __name((type, args) => {
117
+ if (typeof window !== "undefined" && window.rnDebug) {
118
+ const processed = args.map((arg) => {
119
+ if (arg instanceof Error && arg.stack) {
120
+ return `${arg.message}
121
+ ${arg.stack}`;
122
+ }
123
+ return arg;
124
+ });
125
+ window.rnDebug(`${name} ${type}: ${processed.join(" ")}`);
126
+ }
127
+ }, "rnDebug");
128
+ return {
129
+ logState: define_process_default.env.NODE_ENV === "test" ? 3 /* SILENT */ : 0 /* LOG */,
130
+ log(...args) {
131
+ if (this.logState <= 0 /* LOG */) {
132
+ console.log(label, ...args);
133
+ rnDebug("log", args);
134
+ }
135
+ },
136
+ warn(...args) {
137
+ if (this.logState <= 1 /* WARN */) {
138
+ console.warn(label, ...args);
139
+ rnDebug("warn", args);
140
+ }
141
+ },
142
+ error(...args) {
143
+ if (this.logState <= 2 /* ERROR */) {
144
+ console.error(label, ...args);
145
+ rnDebug("error", args);
146
+ }
147
+ },
148
+ // It's a bit tricky to prepend [MappedinJs] to assert and time because of how the output is structured in the console, so it is left out for simplicity
149
+ assert(...args) {
150
+ console.assert(...args);
151
+ },
152
+ time(label2) {
153
+ console.time(label2);
154
+ },
155
+ timeEnd(label2) {
156
+ console.timeEnd(label2);
157
+ },
158
+ setLevel(level) {
159
+ if (0 /* LOG */ <= level && level <= 3 /* SILENT */) {
160
+ this.logState = level;
161
+ }
162
+ }
163
+ };
164
+ }
165
+ __name(createLogger, "createLogger");
166
+ var Logger = createLogger();
167
+ var Mappedin_Logger_default = Logger;
168
+
169
+ // src/hooks/useMemoDeep.tsx
170
+ init_define_process();
171
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
172
+ import { useRef as useRef2 } from "react";
173
+ function useMemoDeep(factory, deps) {
174
+ const valueRef = useRef2();
175
+ const depsRef = useRef2();
176
+ if (!(0, import_fast_deep_equal.default)(deps, depsRef.current)) {
177
+ valueRef.current = factory();
178
+ depsRef.current = deps;
179
+ }
180
+ return valueRef.current;
181
+ }
182
+ __name(useMemoDeep, "useMemoDeep");
183
+
184
+ // src/hooks/useMapData.tsx
185
+ function useMapData(options) {
186
+ const { getCache, setCache } = useContext(MapDataContext);
187
+ const [mapData, setMapData] = useState(void 0);
188
+ const [isLoading, setIsLoading] = useState(true);
189
+ const [error, setError] = useState(void 0);
190
+ const fetchIdRef = useRef3(0);
191
+ const memoizedOptions = useMemoDeep(
192
+ () => options && { ...options, analytics: { context: "reactsdk", ...options?.analytics } },
193
+ [options]
194
+ );
195
+ const fetchMapData = useCallback2((options2) => {
196
+ const fetchId = ++fetchIdRef.current;
197
+ setIsLoading(true);
198
+ setError(void 0);
199
+ getMapData(options2).then((fetchedMapData) => {
200
+ if (fetchIdRef.current === fetchId) {
201
+ setMapData(fetchedMapData);
202
+ }
203
+ }).catch((err) => {
204
+ if (fetchIdRef.current === fetchId) {
205
+ Mappedin_Logger_default.error("Failed to fetch MapData", err);
206
+ setError(err);
207
+ }
208
+ }).finally(() => {
209
+ if (fetchIdRef.current === fetchId) setIsLoading(false);
210
+ });
211
+ }, []);
212
+ useEffect(() => {
213
+ const cachedEntry = getCache?.();
214
+ if (cachedEntry != null) {
215
+ if (
216
+ // No options provided, use cached data
217
+ memoizedOptions == null || // Options provided and matches cached data
218
+ cachedEntry.mapData.mapId === memoizedOptions.mapId && (0, import_fast_deep_equal2.default)(cachedEntry.options, memoizedOptions)
219
+ ) {
220
+ setMapData(cachedEntry.mapData);
221
+ setIsLoading(false);
222
+ setError(void 0);
223
+ return;
224
+ }
225
+ }
226
+ if (!memoizedOptions) {
227
+ setError(new Error("useMapData requires options if not use within a MapDataProvider or MapView component."));
228
+ return;
229
+ }
230
+ fetchMapData(memoizedOptions);
231
+ }, [fetchMapData, getCache, memoizedOptions]);
232
+ useEffect(() => {
233
+ const cachedEntry = getCache?.();
234
+ if (mapData != null && (cachedEntry == null || cachedEntry.mapData.mapId === mapData.mapId)) {
235
+ setCache?.({ mapData, options: memoizedOptions || {} });
236
+ }
237
+ }, [mapData, memoizedOptions, getCache, setCache]);
238
+ return { mapData, isLoading, error };
239
+ }
240
+ __name(useMapData, "useMapData");
241
+
242
+ // src/hooks/useMapDataEvent.tsx
243
+ init_define_process();
244
+ import { useCallback as useCallback3, useContext as useContext2, useEffect as useEffect2 } from "react";
245
+ function useMapDataEvent(event, callback) {
246
+ const { getCache: getCachedMapData } = useContext2(MapDataContext);
247
+ const handleCallback = useCallback3((payload) => callback(payload), [callback]);
248
+ useEffect2(() => {
249
+ const mapData = getCachedMapData?.()?.mapData;
250
+ if (mapData == null) {
251
+ throw new Error("useMapDataEvent must be used within a MapDataProvider or MapView component.");
252
+ }
253
+ mapData.on(event, handleCallback);
254
+ return () => {
255
+ if (mapData == null) {
256
+ return;
257
+ }
258
+ mapData.off(event, handleCallback);
259
+ };
260
+ }, [getCachedMapData, event, handleCallback]);
261
+ }
262
+ __name(useMapDataEvent, "useMapDataEvent");
263
+
264
+ // src/MapView.tsx
265
+ init_define_process();
266
+ import React2, {
267
+ useCallback as useCallback4,
268
+ useEffect as useEffect3,
269
+ useMemo as useMemo2,
270
+ useRef as useRef4,
271
+ useState as useState2,
272
+ forwardRef,
273
+ useImperativeHandle,
274
+ createContext as createContext2
275
+ } from "react";
276
+ import { show3dMap } from "@mappedin/mappedin-js";
277
+ var MapViewContext = createContext2({
278
+ mapView: void 0,
279
+ extensions: {}
280
+ });
281
+ var DEFAULT_STYLE = {
282
+ width: "100%",
283
+ height: "100%",
284
+ position: "relative"
285
+ };
286
+ var MapView = forwardRef((props, ref) => {
287
+ const { mapData, options, style, fallback, children, ...rest } = props;
288
+ const thisRef = useRef4({
289
+ extensions: {}
290
+ // store the extensions in the ref so we don't re-render children when they change
291
+ }).current;
292
+ const [isLoading, setIsLoading] = useState2(true);
293
+ const [isMounted, setIsMounted] = useState2(false);
294
+ const mapEl = useRef4(null);
295
+ const memoizedMapData = useMemo2(() => mapData, [mapData]);
296
+ const memoizedOptions = useMemoDeep(() => options, [options]);
297
+ useImperativeHandle(ref, () => thisRef.mapView);
298
+ const contextValue = useMemo2(() => {
299
+ return {
300
+ mapView: thisRef.mapView,
301
+ extensions: thisRef.extensions
302
+ };
303
+ }, [memoizedMapData, thisRef.mapView, thisRef.extensions]);
304
+ const cleanUpExtensions = useCallback4((extensions) => {
305
+ try {
306
+ const extensionNames = Object.keys(extensions);
307
+ for (const extensionName of extensionNames) {
308
+ const extensionEntry = extensions[extensionName];
309
+ if (extensionEntry) {
310
+ extensionEntry.onDeregister(extensionEntry.instance);
311
+ delete extensions[extensionName];
312
+ }
313
+ }
314
+ } catch (error) {
315
+ Mappedin_Logger_default.error("Failed to clean up extensions", error);
316
+ }
317
+ return {};
318
+ }, []);
319
+ const destroyMapView = useCallback4((mapView) => {
320
+ const mapViewToDestroy = mapView || thisRef.mapView;
321
+ try {
322
+ mapViewToDestroy?.destroy?.();
323
+ } catch (error) {
324
+ Mappedin_Logger_default.error("Failed to destroy MapView", error);
325
+ }
326
+ if (!mapView) {
327
+ thisRef.extensions = cleanUpExtensions(thisRef.extensions);
328
+ thisRef.mapView = void 0;
329
+ setIsMounted(false);
330
+ }
331
+ }, []);
332
+ useEffect3(() => {
333
+ if (!memoizedMapData || !mapEl.current) {
334
+ return;
335
+ }
336
+ destroyMapView();
337
+ let cancelled = false;
338
+ setIsLoading(true);
339
+ show3dMap(mapEl.current, memoizedMapData, memoizedOptions).then((mapView) => {
340
+ if (!cancelled) {
341
+ thisRef.mapView = mapView;
342
+ setIsMounted(true);
343
+ } else {
344
+ destroyMapView(mapView);
345
+ }
346
+ }).catch((err) => {
347
+ Mappedin_Logger_default.error("Failed to render MapView", err);
348
+ }).finally(() => {
349
+ if (!cancelled) {
350
+ setIsLoading(false);
351
+ }
352
+ });
353
+ return () => {
354
+ cancelled = true;
355
+ if (thisRef.mapView) {
356
+ destroyMapView();
357
+ }
358
+ };
359
+ }, [memoizedMapData, memoizedOptions, destroyMapView]);
360
+ return /* @__PURE__ */ React2.createElement(MapDataProvider, { mapData: memoizedMapData }, /* @__PURE__ */ React2.createElement(MapViewContext.Provider, { value: contextValue }, /* @__PURE__ */ React2.createElement("div", { "data-testid": "mappedin-map", ref: mapEl, style: { ...DEFAULT_STYLE, ...style }, ...rest }), isLoading ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, fallback) : isMounted ? children : null));
361
+ });
362
+
363
+ // src/hooks/useMapViewEvent.tsx
364
+ init_define_process();
365
+ import { useCallback as useCallback5, useContext as useContext3, useEffect as useEffect4 } from "react";
366
+
367
+ // src/errors.ts
368
+ init_define_process();
369
+ var MapViewNullError = class extends Error {
370
+ static {
371
+ __name(this, "MapViewNullError");
372
+ }
373
+ constructor(name) {
374
+ super(`${name} must be used within a MapView component.`);
375
+ }
376
+ };
377
+
378
+ // src/hooks/useMapViewEvent.tsx
379
+ function useMapViewEvent(event, callback) {
380
+ const { mapView } = useContext3(MapViewContext);
381
+ const handleCallback = useCallback5((payload) => callback(payload), [callback]);
382
+ useEffect4(() => {
383
+ if (mapView == null) {
384
+ throw new MapViewNullError("useMapViewEvent");
385
+ }
386
+ mapView.on(event, handleCallback);
387
+ return () => {
388
+ if (mapView == null) {
389
+ return;
390
+ }
391
+ mapView.off(event, handleCallback);
392
+ };
393
+ }, [mapView, event, callback]);
394
+ }
395
+ __name(useMapViewEvent, "useMapViewEvent");
396
+
397
+ // src/hooks/useMapViewExtension.tsx
398
+ init_define_process();
399
+ import { useCallback as useCallback6, useContext as useContext4 } from "react";
400
+ function useMapViewExtension(name, options) {
401
+ const { extensions } = useContext4(MapViewContext);
402
+ if (!options?.onRegister || !options?.onDeregister) {
403
+ throw new Error("onRegister and onDeregister are required");
404
+ }
405
+ const register = useCallback6(() => {
406
+ const existingEntry = extensions[name];
407
+ let instance = existingEntry?.instance;
408
+ if (!instance) {
409
+ instance = options.onRegister();
410
+ extensions[name] = {
411
+ instance,
412
+ onDeregister: options.onDeregister
413
+ };
414
+ }
415
+ return instance;
416
+ }, [extensions, name, options.onRegister]);
417
+ const deregister = useCallback6(() => {
418
+ const extensionEntry = extensions[name];
419
+ if (extensionEntry) {
420
+ extensionEntry.onDeregister(extensionEntry.instance);
421
+ delete extensions[name];
422
+ }
423
+ }, [extensions, name, options.onDeregister]);
424
+ return {
425
+ register,
426
+ deregister
427
+ };
428
+ }
429
+ __name(useMapViewExtension, "useMapViewExtension");
430
+
431
+ // src/Path.tsx
432
+ init_define_process();
433
+ import { useContext as useContext5, useEffect as useEffect6, useRef as useRef6, forwardRef as forwardRef2, useImperativeHandle as useImperativeHandle2, useState as useState3 } from "react";
434
+
435
+ // src/hooks/useUpdateEffect.ts
436
+ init_define_process();
437
+ import { useEffect as useEffect5, useRef as useRef5 } from "react";
438
+ function useUpdateEffect(effect, deps) {
439
+ const isInitialRender = useRef5(true);
440
+ useEffect5(() => {
441
+ if (isInitialRender.current) {
442
+ isInitialRender.current = false;
443
+ return;
444
+ }
445
+ return effect();
446
+ }, deps);
447
+ }
448
+ __name(useUpdateEffect, "useUpdateEffect");
449
+
450
+ // src/Path.tsx
451
+ var Path = forwardRef2((props, ref) => {
452
+ const { mapView } = useContext5(MapViewContext);
453
+ const pathRef = useRef6();
454
+ const memoizedOptions = useMemoDeep(() => props.options, [props.options]);
455
+ const [pathReady, setPathReady] = useState3(false);
456
+ useImperativeHandle2(ref, () => pathRef.current, [pathReady]);
457
+ useEffect6(() => {
458
+ if (mapView == null) {
459
+ throw new MapViewNullError("Path");
460
+ }
461
+ const path = mapView.Paths.add(props.coordinate, memoizedOptions);
462
+ path.animation.then(() => {
463
+ props.onDrawComplete?.();
464
+ });
465
+ pathRef.current = path;
466
+ setPathReady(true);
467
+ return () => {
468
+ if (pathRef.current) {
469
+ mapView.Paths.remove(pathRef.current);
470
+ }
471
+ setPathReady(false);
472
+ };
473
+ }, [mapView, props.coordinate]);
474
+ useUpdateEffect(() => {
475
+ if (pathRef.current && memoizedOptions) {
476
+ mapView?.updateState(pathRef.current, memoizedOptions);
477
+ }
478
+ }, [memoizedOptions]);
479
+ return null;
480
+ });
481
+
482
+ // src/Navigation.tsx
483
+ init_define_process();
484
+ import { useContext as useContext6, useEffect as useEffect7 } from "react";
485
+ function Navigation(props) {
486
+ const { mapView } = useContext6(MapViewContext);
487
+ const memoizedOptions = useMemoDeep(() => props.options, [props.options]);
488
+ useEffect7(() => {
489
+ if (mapView == null) {
490
+ throw new MapViewNullError("Navigation");
491
+ }
492
+ mapView.Navigation.draw(props.directions, memoizedOptions).then(() => {
493
+ props.onDrawComplete?.();
494
+ });
495
+ return () => {
496
+ mapView.Navigation.clear();
497
+ };
498
+ }, [mapView, props.directions, memoizedOptions]);
499
+ return null;
500
+ }
501
+ __name(Navigation, "Navigation");
502
+
503
+ // src/Shape.tsx
504
+ init_define_process();
505
+ import { useContext as useContext7, useEffect as useEffect8, useRef as useRef7, forwardRef as forwardRef3, useImperativeHandle as useImperativeHandle3, useState as useState4 } from "react";
506
+ var Shape = forwardRef3((props, ref) => {
507
+ const { mapView } = useContext7(MapViewContext);
508
+ const shapeRef = useRef7();
509
+ const memoizedStyle = useMemoDeep(() => props.style, [props.style]);
510
+ const [shapeReady, setShapeReady] = useState4(false);
511
+ useImperativeHandle3(ref, () => shapeRef.current, [shapeReady]);
512
+ useEffect8(() => {
513
+ if (mapView == null) {
514
+ throw new Error("MapView not initialized");
515
+ }
516
+ shapeRef.current = mapView.Shapes.add(props.geometry, props.style, props.floor);
517
+ setShapeReady(true);
518
+ return () => {
519
+ if (mapView == null || shapeRef.current == null) {
520
+ return;
521
+ }
522
+ mapView.Shapes.remove(shapeRef.current);
523
+ setShapeReady(false);
524
+ };
525
+ }, [mapView, props.geometry, props.style, props.floor]);
526
+ useUpdateEffect(() => {
527
+ if (shapeRef.current && memoizedStyle) {
528
+ mapView?.updateState(shapeRef.current, memoizedStyle);
529
+ }
530
+ }, [memoizedStyle]);
531
+ return null;
532
+ });
533
+
534
+ // src/Model.tsx
535
+ init_define_process();
536
+ import { useContext as useContext8, useEffect as useEffect9, useRef as useRef8, forwardRef as forwardRef4, useImperativeHandle as useImperativeHandle4, useState as useState5 } from "react";
537
+ var Model = forwardRef4((props, ref) => {
538
+ const { mapView } = useContext8(MapViewContext);
539
+ const modelRef = useRef8();
540
+ const memoizedOptions = useMemoDeep(() => props.options, [props.options]);
541
+ const [modelReady, setModelReady] = useState5(false);
542
+ useImperativeHandle4(ref, () => modelRef.current, [modelReady]);
543
+ useEffect9(() => {
544
+ if (mapView == null) {
545
+ throw new MapViewNullError("Model");
546
+ }
547
+ modelRef.current = mapView.Models.add(props.coordinate, props.url, memoizedOptions);
548
+ setModelReady(true);
549
+ return () => {
550
+ if (mapView == null || modelRef.current == null) {
551
+ return;
552
+ }
553
+ mapView.Models.remove(modelRef.current);
554
+ setModelReady(false);
555
+ };
556
+ }, [mapView, props.url]);
557
+ useUpdateEffect(() => {
558
+ if (modelRef.current) {
559
+ mapView?.updateState(modelRef.current, {
560
+ position: props.coordinate,
561
+ ...memoizedOptions
562
+ });
563
+ }
564
+ }, [props.coordinate, memoizedOptions]);
565
+ return null;
566
+ });
567
+
568
+ // src/hooks/useMap.tsx
569
+ init_define_process();
570
+ import { useContext as useContext9 } from "react";
571
+ function useMap() {
572
+ const { mapView } = useContext9(MapViewContext);
573
+ const { getCache: getCachedMapData } = useContext9(MapDataContext);
574
+ if (!mapView) {
575
+ throw new MapViewNullError("useMap");
576
+ }
577
+ return { mapData: getCachedMapData?.()?.mapData || mapView.getMapData(), mapView };
578
+ }
579
+ __name(useMap, "useMap");
580
+
581
+ // src/Marker.tsx
582
+ init_define_process();
583
+ import React3, {
584
+ useCallback as useCallback7,
585
+ useContext as useContext10,
586
+ useEffect as useEffect10,
587
+ useMemo as useMemo3,
588
+ useRef as useRef9,
589
+ forwardRef as forwardRef5,
590
+ useImperativeHandle as useImperativeHandle5,
591
+ useState as useState6
592
+ } from "react";
593
+ import { createPortal } from "react-dom";
594
+
595
+ // ../packages/common/random-id.ts
596
+ init_define_process();
597
+ var SLICE_POSITIONS = [0, 4, 6, 8, 10];
598
+ var randomId = /* @__PURE__ */ __name(() => {
599
+ const array = new Array(16).fill(0);
600
+ let seed = Math.random() * 4294967296;
601
+ for (let i = 0; i < array.length; i++) {
602
+ if (i > 0 && (i & 3) === 0) {
603
+ seed = Math.random() * 4294967296;
604
+ }
605
+ array[i] = seed >>> ((i & 3) << 3) & 255;
606
+ }
607
+ const hexArray = array.map((n) => n.toString(16).padStart(2, "0"));
608
+ hexArray[6] = "4" + hexArray[6][1];
609
+ hexArray[8] = ["8", "9", "a", "b"].includes(hexArray[7][0]) ? hexArray[7] : "a" + hexArray[7][1];
610
+ return SLICE_POSITIONS.map(
611
+ (v, i) => hexArray.slice(v, i === SLICE_POSITIONS.length - 1 ? void 0 : SLICE_POSITIONS[i + 1]).join("")
612
+ ).join("-");
613
+ }, "randomId");
614
+
615
+ // src/Marker.tsx
616
+ var Marker = forwardRef5((props, ref) => {
617
+ const { mapView } = useContext10(MapViewContext);
618
+ const markerRef = useRef9();
619
+ const [markerReady, setMarkerReady] = useState6(false);
620
+ const memoizedOptions = useMemoDeep(() => props.options, [props.options]);
621
+ useImperativeHandle5(ref, () => markerRef.current, [markerReady]);
622
+ useEffect10(() => {
623
+ if (mapView == null) {
624
+ throw new MapViewNullError("Marker");
625
+ }
626
+ markerRef.current = mapView.Markers.add(props.target, "", memoizedOptions);
627
+ setMarkerReady(true);
628
+ return () => {
629
+ if (mapView == null || markerRef.current == null) {
630
+ return;
631
+ }
632
+ mapView.Markers.remove(markerRef.current);
633
+ setMarkerReady(false);
634
+ };
635
+ }, [mapView, props.target]);
636
+ useUpdateEffect(() => {
637
+ if (markerRef.current && memoizedOptions) {
638
+ mapView?.updateState(markerRef.current, memoizedOptions);
639
+ }
640
+ }, [memoizedOptions]);
641
+ if (mapView == null || markerRef.current == null) {
642
+ return null;
643
+ }
644
+ return createPortal(props.children, markerRef.current.contentEl, markerRef.current.id);
645
+ });
646
+ var AnimatedMarker = forwardRef5(
647
+ (props, ref) => {
648
+ const { mapView } = useContext10(MapViewContext);
649
+ const keyRef = useRef9(randomId());
650
+ const markerRef = useRef9();
651
+ const [markerReady, setMarkerReady] = useState6(false);
652
+ const initialTarget = useRef9(props.target);
653
+ useImperativeHandle5(ref, () => markerRef.current, [markerReady]);
654
+ const handleMarkerRef = useCallback7((marker) => {
655
+ markerRef.current = marker || void 0;
656
+ setMarkerReady(!!marker);
657
+ }, []);
658
+ useEffect10(() => {
659
+ if (mapView == null) {
660
+ throw new MapViewNullError("Marker");
661
+ }
662
+ if (markerRef.current && markerRef.current.target !== props.target) {
663
+ const { duration = 300, easing = "linear" } = props;
664
+ mapView.Markers.animateTo(markerRef.current, props.target, { duration, easing });
665
+ }
666
+ return () => {
667
+ setMarkerReady(false);
668
+ };
669
+ }, [mapView, props.target]);
670
+ const propsWithoutAnimation = useMemo3(
671
+ () => ({ ...props, duration: void 0, easing: void 0 }),
672
+ [props.duration, props.easing]
673
+ );
674
+ return /* @__PURE__ */ React3.createElement(Marker, { ...propsWithoutAnimation, key: keyRef.current, target: initialTarget.current, ref: handleMarkerRef });
675
+ }
676
+ );
677
+
678
+ // src/Label.tsx
679
+ init_define_process();
680
+ import { forwardRef as forwardRef6, useContext as useContext11, useEffect as useEffect11, useImperativeHandle as useImperativeHandle6, useRef as useRef10, useState as useState7 } from "react";
681
+ var Label = forwardRef6((props, ref) => {
682
+ const { mapView } = useContext11(MapViewContext);
683
+ const labelRef = useRef10();
684
+ const [isLabelReady, setIsLabelReady] = useState7(false);
685
+ const memoizedOptions = useMemoDeep(() => props.options, [props.options]);
686
+ useImperativeHandle6(ref, () => labelRef.current, [isLabelReady]);
687
+ useEffect11(() => {
688
+ if (mapView == null) {
689
+ throw new MapViewNullError("Label");
690
+ }
691
+ labelRef.current = mapView.Labels.add(props.target, props.text, memoizedOptions);
692
+ setIsLabelReady(true);
693
+ return () => {
694
+ if (mapView == null || labelRef.current == null) {
695
+ return;
696
+ }
697
+ mapView.Labels.remove(labelRef.current);
698
+ setIsLabelReady(false);
699
+ };
700
+ }, [mapView, props.target]);
701
+ useUpdateEffect(() => {
702
+ if (labelRef.current) {
703
+ mapView?.updateState(labelRef.current, {
704
+ text: props.text,
705
+ ...memoizedOptions
706
+ });
707
+ }
708
+ }, [props.text, memoizedOptions]);
709
+ return null;
710
+ });
711
+ export {
712
+ AnimatedMarker,
713
+ Label,
714
+ MapDataProvider,
715
+ MapView,
716
+ Marker,
717
+ Model,
718
+ Navigation,
719
+ Path,
720
+ Shape,
721
+ useMap,
722
+ useMapData,
723
+ useMapDataEvent,
724
+ useMapViewEvent,
725
+ useMapViewExtension
726
+ };
727
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["<define:process>", "../../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js", "../../src/index.tsx", "../../src/MapDataProvider.tsx", "../../src/hooks/useMapData.tsx", "../../../packages/common/Mappedin.Logger.ts", "../../src/hooks/useMemoDeep.tsx", "../../src/hooks/useMapDataEvent.tsx", "../../src/MapView.tsx", "../../src/hooks/useMapViewEvent.tsx", "../../src/errors.ts", "../../src/hooks/useMapViewExtension.tsx", "../../src/Path.tsx", "../../src/hooks/useUpdateEffect.ts", "../../src/Navigation.tsx", "../../src/Shape.tsx", "../../src/Model.tsx", "../../src/hooks/useMap.tsx", "../../src/Marker.tsx", "../../../packages/common/random-id.ts", "../../src/Label.tsx"],
4
+ "sourcesContent": ["{\"env\":{\"npm_package_version\":\"6.0.0-rc.3\"}}", "'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n", "// MapData\nexport { MapDataProvider } from './MapDataProvider';\nexport type { MapDataProviderProps } from './MapDataProvider';\nexport { useMapData } from './hooks/useMapData';\nexport { useMapDataEvent } from './hooks/useMapDataEvent';\n\n// MapView\nexport { MapView } from './MapView';\nexport type { MapViewProps } from './MapView';\nexport { useMapViewEvent } from './hooks/useMapViewEvent';\nexport { useMapViewExtension } from './hooks/useMapViewExtension';\nexport { Path } from './Path';\nexport type { PathProps } from './Path';\nexport { Navigation } from './Navigation';\nexport type { NavigationProps } from './Navigation';\nexport { Shape } from './Shape';\nexport type { ShapeProps } from './Shape';\nexport { Model } from './Model';\nexport type { ModelProps } from './Model';\nexport { useMap } from './hooks/useMap';\nexport { Marker, AnimatedMarker } from './Marker';\nexport type { MarkerProps } from './Marker';\nexport { Label } from './Label';\nexport type { LabelProps } from './Label';\n\n// Re-export React types for docs\nimport type * as React from 'react';\nexport type { React };\n", "import type { MapData, TGetMapDataOptions } from '@mappedin/mappedin-js';\nimport type { PropsWithChildren } from 'react';\nimport React, { createContext, useCallback, useMemo, useRef } from 'react';\n\nexport type CachedMapDataEntry = {\n\tmapData: MapData;\n\toptions: TGetMapDataOptions;\n};\n\nexport type MapDataContextType = {\n\tgetCache: () => CachedMapDataEntry | undefined;\n\tsetCache: (entry: CachedMapDataEntry) => void;\n};\n\nexport const MapDataContext = createContext<MapDataContextType>({\n\tgetCache: () => undefined,\n\tsetCache: () => {},\n});\n\nexport type MapDataProviderProps = {\n\tmapData: MapData;\n};\n\nexport function MapDataProvider({ mapData, children }: PropsWithChildren<MapDataProviderProps>) {\n\tconst cachedEntryRef = useRef<CachedMapDataEntry | undefined>(\n\t\tmapData ? { mapData, options: {} as TGetMapDataOptions } : undefined,\n\t);\n\n\tconst getCache = useCallback(() => cachedEntryRef.current, []);\n\tconst setCache = useCallback((entry: CachedMapDataEntry) => {\n\t\tcachedEntryRef.current = entry;\n\t}, []);\n\n\tconst contextValue = useMemo(\n\t\t() => ({\n\t\t\tgetCache,\n\t\t\tsetCache,\n\t\t}),\n\t\t[getCache, setCache],\n\t);\n\n\treturn <MapDataContext.Provider value={contextValue}>{children}</MapDataContext.Provider>;\n}\n", "import { useCallback, useContext, useEffect, useRef, useState } from 'react';\nimport type { MapData, TGetMapDataOptions } from '@mappedin/mappedin-js';\nimport { getMapData } from '@mappedin/mappedin-js';\nimport equal from 'fast-deep-equal';\nimport Logger from '@packages/internal/common/Mappedin.Logger';\nimport { MapDataContext } from '../MapDataProvider';\nimport { useMemoDeep } from './useMemoDeep';\n\n/**\n * Hook to get the MapData and handle loading and error states.\n *\n * If used outside of a {@link MapDataProvider} or {@link MapView} component, options are required to fetch the MapData.\n * If used within a {@link MapDataProvider} or {@link MapView} component, options are optional and will use the MapData from the context if available.\n *\n * @category Hooks\n *\n * @example\n * ```tsx\n * const { mapData, isLoading, error } = useMapData(options);\n * ```\n */\nexport function useMapData(options?: TGetMapDataOptions): {\n\tmapData?: MapData;\n\tisLoading: boolean;\n\terror?: Error;\n} {\n\tconst { getCache, setCache } = useContext(MapDataContext);\n\tconst [mapData, setMapData] = useState<MapData | undefined>(undefined);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<Error | undefined>(undefined);\n\tconst fetchIdRef = useRef(0);\n\n\tconst memoizedOptions: TGetMapDataOptions | undefined = useMemoDeep(\n\t\t() => options && { ...options, analytics: { context: 'reactsdk', ...options?.analytics } },\n\t\t[options],\n\t);\n\n\tconst fetchMapData = useCallback((options: TGetMapDataOptions) => {\n\t\tconst fetchId = ++fetchIdRef.current;\n\t\tsetIsLoading(true);\n\t\tsetError(undefined);\n\n\t\t// TODO: use abortcontroller signal to cancel the fetch outright\n\t\tgetMapData(options)\n\t\t\t.then(fetchedMapData => {\n\t\t\t\tif (fetchIdRef.current === fetchId) {\n\t\t\t\t\tsetMapData(fetchedMapData);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tif (fetchIdRef.current === fetchId) {\n\t\t\t\t\tLogger.error('Failed to fetch MapData', err);\n\t\t\t\t\tsetError(err);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tif (fetchIdRef.current === fetchId) setIsLoading(false);\n\t\t\t});\n\t}, []);\n\n\tuseEffect(() => {\n\t\t// If this is used within a context, we can try to get the mapData from context first\n\t\tconst cachedEntry = getCache?.();\n\t\tif (cachedEntry != null) {\n\t\t\tif (\n\t\t\t\t// No options provided, use cached data\n\t\t\t\tmemoizedOptions == null ||\n\t\t\t\t// Options provided and matches cached data\n\t\t\t\t(cachedEntry.mapData.mapId === memoizedOptions.mapId && equal(cachedEntry.options, memoizedOptions))\n\t\t\t) {\n\t\t\t\tsetMapData(cachedEntry.mapData);\n\t\t\t\tsetIsLoading(false);\n\t\t\t\tsetError(undefined);\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (!memoizedOptions) {\n\t\t\tsetError(new Error('useMapData requires options if not use within a MapDataProvider or MapView component.'));\n\t\t\treturn;\n\t\t}\n\t\t// If all else fails, fetch new data\n\t\tfetchMapData(memoizedOptions);\n\t}, [fetchMapData, getCache, memoizedOptions]);\n\n\tuseEffect(() => {\n\t\tconst cachedEntry = getCache?.();\n\t\tif (mapData != null && (cachedEntry == null || cachedEntry.mapData.mapId === mapData.mapId)) {\n\t\t\t// Only overwrite the context cache with new data if the mapData has the same mapId\n\t\t\t// In this case, we likely refetched due to an option change\n\t\t\tsetCache?.({ mapData, options: memoizedOptions || ({} as TGetMapDataOptions) });\n\t\t}\n\t}, [mapData, memoizedOptions, getCache, setCache]);\n\n\treturn { mapData, isLoading, error };\n}\n", "/* eslint-disable no-console*/\nexport const MI_DEBUG_KEY = 'mi-debug';\nexport const MI_ERROR_LABEL = '[MappedinJS]';\n\nexport enum E_SDK_LOG_LEVEL {\n\tLOG,\n\tWARN,\n\tERROR,\n\tSILENT,\n}\n\nexport function createLogger(name = '', { prefix = MI_ERROR_LABEL } = {}) {\n\tconst label = `${prefix}${name ? `-${name}` : ''}`;\n\n\tconst rnDebug = (type: 'log' | 'warn' | 'error', args: any[]) => {\n\t\tif (typeof window !== 'undefined' && (window as any).rnDebug) {\n\t\t\tconst processed = args.map(arg => {\n\t\t\t\tif (arg instanceof Error && arg.stack) {\n\t\t\t\t\treturn `${arg.message}\\n${arg.stack}`;\n\t\t\t\t}\n\n\t\t\t\treturn arg;\n\t\t\t});\n\t\t\t(window as any).rnDebug(`${name} ${type}: ${processed.join(' ')}`);\n\t\t}\n\t};\n\n\treturn {\n\t\tlogState: process.env.NODE_ENV === 'test' ? E_SDK_LOG_LEVEL.SILENT : E_SDK_LOG_LEVEL.LOG,\n\n\t\tlog(...args: any[]) {\n\t\t\tif (this.logState <= E_SDK_LOG_LEVEL.LOG) {\n\t\t\t\tconsole.log(label, ...args);\n\t\t\t\trnDebug('log', args);\n\t\t\t}\n\t\t},\n\n\t\twarn(...args: any[]) {\n\t\t\tif (this.logState <= E_SDK_LOG_LEVEL.WARN) {\n\t\t\t\tconsole.warn(label, ...args);\n\t\t\t\trnDebug('warn', args);\n\t\t\t}\n\t\t},\n\n\t\terror(...args: any[]) {\n\t\t\tif (this.logState <= E_SDK_LOG_LEVEL.ERROR) {\n\t\t\t\tconsole.error(label, ...args);\n\n\t\t\t\trnDebug('error', args);\n\t\t\t}\n\t\t},\n\n\t\t// It's a bit tricky to prepend [MappedinJs] to assert and time because of how the output is structured in the console, so it is left out for simplicity\n\t\tassert(...args: any[]) {\n\t\t\tconsole.assert(...args);\n\t\t},\n\n\t\ttime(label: string) {\n\t\t\tconsole.time(label);\n\t\t},\n\n\t\ttimeEnd(label: string) {\n\t\t\tconsole.timeEnd(label);\n\t\t},\n\t\tsetLevel(level: E_SDK_LOG_LEVEL) {\n\t\t\tif (E_SDK_LOG_LEVEL.LOG <= level && level <= E_SDK_LOG_LEVEL.SILENT) {\n\t\t\t\tthis.logState = level;\n\t\t\t}\n\t\t},\n\t};\n}\n\nconst Logger = createLogger();\nexport function setLoggerLevel(level: E_SDK_LOG_LEVEL) {\n\tif (E_SDK_LOG_LEVEL.LOG <= level && level <= E_SDK_LOG_LEVEL.SILENT) {\n\t\tLogger.logState = level;\n\t}\n}\n\nexport default Logger;\n", "import { useRef, type DependencyList } from 'react';\nimport equal from 'fast-deep-equal';\n\n/**\n * Deep comparison memoization hook similar to useMemo but with deep equality check\n * @param factory Function that returns the value to memoize\n * @param deps Dependency list to deeply compare for changes\n * @returns Memoized value that only changes when dependencies deeply change\n * @internal\n */\nexport function useMemoDeep<T>(factory: () => T, deps: DependencyList): T {\n\tconst valueRef = useRef<T>();\n\tconst depsRef = useRef<DependencyList>();\n\n\tif (!equal(deps, depsRef.current)) {\n\t\tvalueRef.current = factory();\n\t\tdepsRef.current = deps;\n\t}\n\n\treturn valueRef.current!;\n}\n", "import { useCallback, useContext, useEffect } from 'react';\nimport type { TMapDataEvents } from '@mappedin/mappedin-js';\nimport { MapDataContext } from '../MapDataProvider';\n\n/**\n * Hook to subscribe to an event on the MapData.\n *\n * Must be used within a {@link MapDataProvider} or {@link MapView} component.\n * @throws If used outside of a {@link MapDataProvider} or {@link MapView} component.\n *\n * @param event - The event to listen for.\n * @param callback - The callback to call when the event is triggered.\n *\n * @category Hooks\n *\n * @example\n * ```tsx\n * useMapDataEvent('language-change', event => {\n * console.log(`Map language changed to ${event.name} (${event.code})`);\n * });\n * ```\n */\nexport function useMapDataEvent<T extends keyof TMapDataEvents>(\n\tevent: T,\n\tcallback: (\n\t\tpayload: TMapDataEvents[T] extends {\n\t\t\tdata: null;\n\t\t}\n\t\t\t? TMapDataEvents[T]['data']\n\t\t\t: TMapDataEvents[T],\n\t) => void,\n) {\n\tconst { getCache: getCachedMapData } = useContext(MapDataContext);\n\tconst handleCallback = useCallback(payload => callback(payload), [callback]);\n\n\tuseEffect(() => {\n\t\tconst mapData = getCachedMapData?.()?.mapData;\n\t\tif (mapData == null) {\n\t\t\tthrow new Error('useMapDataEvent must be used within a MapDataProvider or MapView component.');\n\t\t}\n\n\t\tmapData.on(event, handleCallback);\n\n\t\treturn () => {\n\t\t\tif (mapData == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmapData.off(event, handleCallback);\n\t\t};\n\t}, [getCachedMapData, event, handleCallback]);\n}\n", "import type { ReactNode } from 'react';\nimport React, {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n\tforwardRef,\n\tuseImperativeHandle,\n\tcreateContext,\n} from 'react';\nimport type { TupleToObjectWithPropNames } from './type-utils';\nimport { useMemoDeep } from './hooks/useMemoDeep';\nimport { show3dMap } from '@mappedin/mappedin-js';\nimport type { MapView as MapViewJS } from '@mappedin/mappedin-js';\nimport Logger from '@packages/internal/common/Mappedin.Logger';\nimport { MapDataProvider } from './MapDataProvider';\nimport type { ExtensionRegistry, MapViewExtensionName } from '@packages/internal/common/extensions';\n\ntype MapViewContextType = {\n\tmapView?: MapViewJS;\n\textensions: ExtensionRegistry;\n};\n\nexport const MapViewContext = createContext<MapViewContextType>({\n\tmapView: undefined,\n\textensions: {},\n});\n\nconst DEFAULT_STYLE: React.CSSProperties = {\n\twidth: '100%',\n\theight: '100%',\n\tposition: 'relative',\n};\n\ntype ParamsArray = Parameters<typeof show3dMap>;\n\ntype StreamAgentParameterNames = ['el', 'mapData', 'options'];\n\n/**\n * @interface\n */\nexport type MapViewProps = Omit<\n\tTupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames> & {\n\t\tchildren?: ReactNode;\n\t\t/**\n\t\t * The fallback content to render while the map is loading.\n\t\t */\n\t\tfallback?: ReactNode;\n\t},\n\t'el'\n>;\n\n/**\n * MapView component.\n *\n * The root component which renders the map and provides context to the hooks and child components.\n *\n * @category Components\n *\n * @example\n * ```tsx\n * const { mapData } = useMapData({ key: '...', secret: '...', mapId: '...' });\n * return (\n * <MapView mapData={mapData}>\n * <Marker target={...} />\n * </MapView>\n * )\n * ```\n */\nexport const MapView = forwardRef<\n\tMapViewJS | undefined,\n\tMapViewProps & Omit<React.HTMLProps<HTMLDivElement>, keyof MapViewProps>\n>((props, ref) => {\n\tconst { mapData, options, style, fallback, children, ...rest } = props;\n\n\t// Persistent reference across renders\n\tconst thisRef = useRef<{\n\t\tmapView?: MapViewJS;\n\t\textensions: ExtensionRegistry;\n\t}>({\n\t\textensions: {}, // store the extensions in the ref so we don't re-render children when they change\n\t}).current;\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [isMounted, setIsMounted] = useState(false);\n\tconst mapEl = useRef<HTMLDivElement>(null);\n\n\tconst memoizedMapData = useMemo(() => mapData, [mapData]);\n\tconst memoizedOptions = useMemoDeep(() => options, [options]);\n\n\t// Expose the mapView instance via ref\n\tuseImperativeHandle(ref, () => thisRef.mapView);\n\n\tconst contextValue: MapViewContextType = useMemo(() => {\n\t\treturn {\n\t\t\tmapView: thisRef.mapView,\n\t\t\textensions: thisRef.extensions,\n\t\t} satisfies MapViewContextType;\n\t}, [memoizedMapData, thisRef.mapView, thisRef.extensions]);\n\n\tconst cleanUpExtensions = useCallback((extensions: ExtensionRegistry) => {\n\t\ttry {\n\t\t\tconst extensionNames = Object.keys(extensions) as MapViewExtensionName[];\n\t\t\tfor (const extensionName of extensionNames) {\n\t\t\t\tconst extensionEntry = extensions[extensionName];\n\t\t\t\tif (extensionEntry) {\n\t\t\t\t\textensionEntry.onDeregister(extensionEntry.instance);\n\n\t\t\t\t\tdelete extensions[extensionName];\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tLogger.error('Failed to clean up extensions', error);\n\t\t}\n\n\t\treturn {};\n\t}, []);\n\n\tconst destroyMapView = useCallback((mapView?: MapViewJS) => {\n\t\tconst mapViewToDestroy = mapView || thisRef.mapView;\n\n\t\ttry {\n\t\t\tmapViewToDestroy?.destroy?.();\n\t\t} catch (error) {\n\t\t\tLogger.error('Failed to destroy MapView', error);\n\t\t}\n\n\t\t// Only clear ref and state if destroying the current instance\n\t\tif (!mapView) {\n\t\t\tthisRef.extensions = cleanUpExtensions(thisRef.extensions);\n\t\t\tthisRef.mapView = undefined;\n\t\t\tsetIsMounted(false);\n\t\t}\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!memoizedMapData || !mapEl.current) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Clean up any existing MapView first\n\t\tdestroyMapView();\n\n\t\tlet cancelled = false;\n\t\tsetIsLoading(true);\n\t\tshow3dMap(mapEl.current, memoizedMapData, memoizedOptions)\n\t\t\t.then(mapView => {\n\t\t\t\tif (!cancelled) {\n\t\t\t\t\t// Just in case extensions were left over from a previous render\n\t\t\t\t\tthisRef.mapView = mapView;\n\t\t\t\t\tsetIsMounted(true);\n\t\t\t\t} else {\n\t\t\t\t\t// Component was unmounted during creation, destroy immediately\n\t\t\t\t\tdestroyMapView(mapView);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tLogger.error('Failed to render MapView', err);\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tif (!cancelled) {\n\t\t\t\t\tsetIsLoading(false);\n\t\t\t\t}\n\t\t\t});\n\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t\t// Destroy the mapView if has already been mounted\n\t\t\tif (thisRef.mapView) {\n\t\t\t\tdestroyMapView();\n\t\t\t}\n\t\t};\n\t}, [memoizedMapData, memoizedOptions, destroyMapView]);\n\n\treturn (\n\t\t<MapDataProvider mapData={memoizedMapData}>\n\t\t\t<MapViewContext.Provider value={contextValue}>\n\t\t\t\t<div data-testid=\"mappedin-map\" ref={mapEl} style={{ ...DEFAULT_STYLE, ...style }} {...rest} />\n\t\t\t\t{isLoading ? <>{fallback}</> : isMounted ? children : null}\n\t\t\t</MapViewContext.Provider>\n\t\t</MapDataProvider>\n\t);\n});\n", "import { useCallback, useContext, useEffect } from 'react';\nimport { MapViewNullError } from '../errors';\nimport type { TEvents } from '@mappedin/mappedin-js';\nimport { MapViewContext } from '../MapView';\n\n/**\n * Hook to subscribe to an event on the {@link MapView}.\n *\n * Must be used within a {@link MapView} component.\n * @throws If used outside of a {@link MapView} component.\n *\n * @param event - The event to listen for.\n * @param callback - The callback to call when the event is triggered.\n *\n * @category Hooks\n *\n * @example\n * ```tsx\n * useMapViewEvent('click', event => {\n * const { coordinate } = event;\n * const { latitude, longitude } = coordinate;\n * console.log(`Map was clicked at ${latitude}, ${longitude}`);\n * });\n * ```\n */\nexport function useMapViewEvent<T extends keyof TEvents>(\n\tevent: T,\n\tcallback: (\n\t\tpayload: TEvents[T] extends {\n\t\t\tdata: null;\n\t\t}\n\t\t\t? TEvents[T]['data']\n\t\t\t: TEvents[T],\n\t) => void,\n) {\n\tconst { mapView } = useContext(MapViewContext);\n\n\tconst handleCallback = useCallback(payload => callback(payload), [callback]);\n\n\tuseEffect(() => {\n\t\tif (mapView == null) {\n\t\t\tthrow new MapViewNullError('useMapViewEvent');\n\t\t}\n\n\t\tmapView.on(event, handleCallback);\n\n\t\treturn () => {\n\t\t\tif (mapView == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmapView.off(event, handleCallback);\n\t\t};\n\t}, [mapView, event, callback]);\n}\n", "export class MapViewNullError extends Error {\n\tconstructor(name: string) {\n\t\tsuper(`${name} must be used within a MapView component.`);\n\t}\n}\n", "import type { MapViewExtension, MapViewExtensionName } from '@packages/internal/common/extensions';\nimport { MapViewContext } from '../MapView';\nimport { useCallback, useContext } from 'react';\n\ntype MapViewExtensionOptions<T extends MapViewExtension<unknown>> = {\n\t/**\n\t * Callback to be fired when the extension is registered.\n\t * This will not be called on subsequent calls to register until the extension is deregistered again.\n\t **/\n\tonRegister: () => T;\n\t/**\n\t * Callback to be fired when the extension is deregistered.\n\t * This will not be called if the extension is not registered.\n\t **/\n\tonDeregister: (extension: T) => void;\n};\n\ntype MapViewExtensionResult<T extends MapViewExtension<unknown>> = {\n\t/**\n\t * Register the extension or return the existing instance if it is already registered.\n\t */\n\tregister: () => T;\n\t/**\n\t * Deregister the extension.\n\t */\n\tderegister: () => void;\n};\n\n/**\n * @internal\n * Register an extension to the mapView context.\n * @param name - The name of the extension.\n * @returns An object with a register and deregister function.\n */\nexport function useMapViewExtension<T extends MapViewExtension<unknown> = MapViewExtension<unknown>>(\n\tname: MapViewExtensionName,\n\toptions: MapViewExtensionOptions<T>,\n): MapViewExtensionResult<T> {\n\tconst { extensions } = useContext(MapViewContext);\n\n\tif (!options?.onRegister || !options?.onDeregister) {\n\t\tthrow new Error('onRegister and onDeregister are required');\n\t}\n\n\tconst register = useCallback((): T => {\n\t\tconst existingEntry = extensions[name];\n\t\tlet instance = existingEntry?.instance;\n\n\t\tif (!instance) {\n\t\t\tinstance = options.onRegister();\n\t\t\textensions[name] = {\n\t\t\t\tinstance,\n\t\t\t\tonDeregister: options.onDeregister as (extension: MapViewExtension<unknown>) => void,\n\t\t\t};\n\t\t}\n\n\t\treturn instance as T;\n\t}, [extensions, name, options.onRegister]);\n\n\tconst deregister = useCallback(() => {\n\t\tconst extensionEntry = extensions[name];\n\t\tif (extensionEntry) {\n\t\t\textensionEntry.onDeregister(extensionEntry.instance as T);\n\t\t\tdelete extensions[name];\n\t\t}\n\t}, [extensions, name, options.onDeregister]);\n\n\treturn {\n\t\tregister,\n\t\tderegister,\n\t};\n}\n", "import { useContext, useEffect, useRef, forwardRef, useImperativeHandle, useState } from 'react';\nimport type { TupleToObjectWithPropNames } from './type-utils';\nimport { MapViewNullError } from './errors';\nimport { useMemoDeep } from './hooks/useMemoDeep';\nimport { useUpdateEffect } from './hooks/useUpdateEffect';\nimport type { MapView, Path as PathJS } from '@mappedin/mappedin-js';\nimport { MapViewContext } from './MapView';\n\ntype ParamsArray = Parameters<MapView['Paths']['add']>;\n\ntype StreamAgentParameterNames = ['coordinate', 'options'];\n\n/**\n * @interface\n */\nexport type PathProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames> & {\n\tonDrawComplete?: () => void;\n};\n\n/**\n * Path component.\n *\n * A Path indicates a route on the map.\n *\n * @category Components\n *\n * @example\n * ```tsx\n * const space1 = mapData.getByType('space')[0];\n * const space2 = mapData.getByType('space')[1];\n * const directions = mapView.getDirections(space1, space2);\n *\n * return directions ? <Path coordinate={directions.coordinates} options={{ color: 'blue' }} /> : null;\n * ```\n */\nexport const Path = forwardRef<PathJS | undefined, PathProps>((props, ref) => {\n\tconst { mapView } = useContext(MapViewContext);\n\tconst pathRef = useRef<PathJS>();\n\tconst memoizedOptions = useMemoDeep(() => props.options, [props.options]);\n\tconst [pathReady, setPathReady] = useState(false);\n\n\t// Expose the path instance via ref\n\tuseImperativeHandle(ref, () => pathRef.current, [pathReady]);\n\n\tuseEffect(() => {\n\t\tif (mapView == null) {\n\t\t\tthrow new MapViewNullError('Path');\n\t\t}\n\n\t\tconst path = mapView.Paths.add(props.coordinate, memoizedOptions);\n\t\tpath.animation.then(() => {\n\t\t\t// TODO: this fires when the path is destroyed before the animation is complete\n\t\t\t// our animation should have a reject/resolve to handle this, or implement the CancelablePromise from animateState\n\t\t\tprops.onDrawComplete?.();\n\t\t});\n\n\t\tpathRef.current = path;\n\t\tsetPathReady(true);\n\t\treturn () => {\n\t\t\tif (pathRef.current) {\n\t\t\t\tmapView.Paths.remove(pathRef.current);\n\t\t\t}\n\t\t\tsetPathReady(false);\n\t\t};\n\t}, [mapView, props.coordinate]);\n\n\t// Update options when they change (skip initial render)\n\tuseUpdateEffect(() => {\n\t\tif (pathRef.current && memoizedOptions) {\n\t\t\tmapView?.updateState(pathRef.current, memoizedOptions);\n\t\t}\n\t}, [memoizedOptions]);\n\n\treturn null;\n});\n", "import { useEffect, useRef } from 'react';\n\n/**\n * A custom hook that behaves like useEffect but skips the initial render.\n * This is useful for update effects that should only run when dependencies change,\n * not on the initial mount.\n *\n * @param effect - The effect function to run\n * @param deps - The dependency array\n * @internal\n */\nexport function useUpdateEffect(effect: React.EffectCallback, deps: React.DependencyList): void {\n\tconst isInitialRender = useRef(true);\n\n\tuseEffect(() => {\n\t\tif (isInitialRender.current) {\n\t\t\tisInitialRender.current = false;\n\t\t\treturn;\n\t\t}\n\n\t\treturn effect();\n\t}, deps);\n}\n", "import { useContext, useEffect } from 'react';\nimport type { TupleToObjectWithPropNames } from './type-utils';\nimport { MapViewNullError } from './errors';\nimport type { MapView } from '@mappedin/mappedin-js';\nimport { useMemoDeep } from './hooks/useMemoDeep';\nimport { MapViewContext } from './MapView';\n\ntype ParamsArray = Parameters<MapView['Navigation']['draw']>;\n\ntype StreamAgentParameterNames = ['directions', 'options'];\n\n/**\n * @interface\n */\nexport type NavigationProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames> & {\n\tonDrawComplete?: () => void;\n};\n\n/**\n * Navigation component.\n *\n * Navigation draws a route on the map with pre-defined Markers for connections and the start and end points.\n *\n * @category Components\n *\n * @example\n * ```tsx\n * const space1 = mapData.getByType('space')[0];\n * const space2 = mapData.getByType('space')[1];\n * const directions = mapView.getDirections(space1, space2);\n *\n * return directions ? <Navigation directions={directions} /> : null;\n * ```\n */\nexport function Navigation(props: NavigationProps) {\n\tconst { mapView } = useContext(MapViewContext);\n\tconst memoizedOptions = useMemoDeep(() => props.options, [props.options]);\n\n\tuseEffect(() => {\n\t\tif (mapView == null) {\n\t\t\tthrow new MapViewNullError('Navigation');\n\t\t}\n\n\t\tmapView.Navigation.draw(props.directions, memoizedOptions).then(() => {\n\t\t\tprops.onDrawComplete?.();\n\t\t});\n\n\t\treturn () => {\n\t\t\tmapView.Navigation.clear();\n\t\t};\n\t}, [mapView, props.directions, memoizedOptions]);\n\n\treturn null;\n}\n", "import { useContext, useEffect, useRef, forwardRef, useImperativeHandle, useState } from 'react';\nimport type { TupleToObjectWithPropNames } from './type-utils';\nimport { useMemoDeep } from './hooks/useMemoDeep';\nimport { useUpdateEffect } from './hooks/useUpdateEffect';\nimport type { MapView, Shape as ShapeJS } from '@mappedin/mappedin-js';\nimport { MapViewContext } from './MapView';\n\ntype ParamsArray = Parameters<MapView['Shapes']['add']>;\n\ntype StreamAgentParameterNames = ['geometry', 'style', 'floor'];\n\n/**\n * @interface\n */\nexport type ShapeProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames>;\n\n/**\n * Shape component.\n *\n * A Shape is a custom geometry on the map created from a GeoJSON feature collection.\n *\n * @category Components\n *\n * @example\n * ```tsx\n * <Shape geometry={geojson} style={{ color: 'blue', height: 2 }} />\n * ```\n */\nexport const Shape = forwardRef<ShapeJS | undefined, ShapeProps>((props, ref) => {\n\tconst { mapView } = useContext(MapViewContext);\n\tconst shapeRef = useRef<ShapeJS>();\n\tconst memoizedStyle = useMemoDeep(() => props.style, [props.style]);\n\tconst [shapeReady, setShapeReady] = useState(false);\n\n\t// Expose the shape instance via ref\n\tuseImperativeHandle(ref, () => shapeRef.current, [shapeReady]);\n\n\tuseEffect(() => {\n\t\tif (mapView == null) {\n\t\t\tthrow new Error('MapView not initialized');\n\t\t}\n\t\tshapeRef.current = mapView.Shapes.add(props.geometry, props.style, props.floor);\n\t\tsetShapeReady(true);\n\n\t\treturn () => {\n\t\t\tif (mapView == null || shapeRef.current == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmapView.Shapes.remove(shapeRef.current);\n\t\t\tsetShapeReady(false);\n\t\t};\n\t}, [mapView, props.geometry, props.style, props.floor]);\n\n\t// Update style when it changes (skip initial render)\n\tuseUpdateEffect(() => {\n\t\tif (shapeRef.current && memoizedStyle) {\n\t\t\tmapView?.updateState(shapeRef.current, memoizedStyle);\n\t\t}\n\t}, [memoizedStyle]);\n\n\treturn null;\n});\n", "import { useContext, useEffect, useRef, forwardRef, useImperativeHandle, useState } from 'react';\nimport type { TupleToObjectWithPropNames } from './type-utils';\nimport { MapViewNullError } from './errors';\nimport { useMemoDeep } from './hooks/useMemoDeep';\nimport { useUpdateEffect } from './hooks/useUpdateEffect';\nimport type { MapView, Model as ModelJS } from '@mappedin/mappedin-js';\nimport { MapViewContext } from './MapView';\n\ntype ParamsArray = Parameters<MapView['Models']['add']>;\n\ntype StreamAgentParameterNames = ['coordinate', 'url', 'options'];\n\n/**\n * @interface\n */\nexport type ModelProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames>;\n\n/**\n * Model component.\n *\n * A Model is a 3D model in GLTF or GLB format anchored to a Coordinate on the map.\n *\n * @category Components\n *\n * @example\n * ```tsx\n * <Model\n * coordinate={coordinate}\n * url={'/path/to/model.glb'}\n * options={{\n * scale: [0.01, 0.01, 0.01],\n * rotation: [90, 0, 0],\n * opacity: 0.5,\n * }}\n * />\n * ```\n */\nexport const Model = forwardRef<ModelJS | undefined, ModelProps>((props, ref) => {\n\tconst { mapView } = useContext(MapViewContext);\n\tconst modelRef = useRef<ModelJS>();\n\tconst memoizedOptions = useMemoDeep(() => props.options, [props.options]);\n\tconst [modelReady, setModelReady] = useState(false);\n\n\t// Expose the model instance via ref\n\tuseImperativeHandle(ref, () => modelRef.current, [modelReady]);\n\n\tuseEffect(() => {\n\t\tif (mapView == null) {\n\t\t\tthrow new MapViewNullError('Model');\n\t\t}\n\t\tmodelRef.current = mapView.Models.add(props.coordinate, props.url, memoizedOptions);\n\t\tsetModelReady(true);\n\t\treturn () => {\n\t\t\tif (mapView == null || modelRef.current == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmapView.Models.remove(modelRef.current);\n\t\t\tsetModelReady(false);\n\t\t};\n\t}, [mapView, props.url]);\n\n\t// Update coordinate and options when they change (skip initial render)\n\tuseUpdateEffect(() => {\n\t\tif (modelRef.current) {\n\t\t\tmapView?.updateState(modelRef.current, {\n\t\t\t\tposition: props.coordinate,\n\t\t\t\t...memoizedOptions,\n\t\t\t});\n\t\t}\n\t}, [props.coordinate, memoizedOptions]);\n\n\treturn null;\n});\n", "import { useContext } from 'react';\nimport { MapViewNullError } from '../errors';\nimport type { MapData, MapView } from '@mappedin/mappedin-js';\nimport { MapViewContext } from '../MapView';\nimport { MapDataContext } from '../MapDataProvider';\n/**\n * Hook to get the MapData and MapView from the current MapView context.\n *\n * Must be used within a {@link MapView} component.\n * @throws If used outside of a {@link MapView} component.\n *\n * @category Hooks\n *\n * @example\n * ```tsx\n * const { mapData, mapView } = useMap();\n * ```\n */\nexport function useMap(): {\n\tmapData: MapData;\n\tmapView: MapView;\n} {\n\tconst { mapView } = useContext(MapViewContext);\n\tconst { getCache: getCachedMapData } = useContext(MapDataContext);\n\n\tif (!mapView) {\n\t\tthrow new MapViewNullError('useMap');\n\t}\n\n\treturn { mapData: getCachedMapData?.()?.mapData || mapView.getMapData(), mapView };\n}\n", "import type { PropsWithChildren } from 'react';\nimport React, {\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tforwardRef,\n\tuseImperativeHandle,\n\tuseState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { MapViewNullError } from './errors';\nimport type { TupleToObjectWithPropNames } from './type-utils';\nimport { randomId } from '@packages/internal/common/random-id';\nimport { useMemoDeep } from './hooks/useMemoDeep';\nimport { useUpdateEffect } from './hooks/useUpdateEffect';\nimport type { MapView, TAnimationOptions, Marker as MarkerJS } from '@mappedin/mappedin-js';\nimport { MapViewContext } from './MapView';\n\ntype ParamsArray = Parameters<MapView['Markers']['add']>;\n\ntype StreamAgentParameterNames = ['target', 'contentHtml', 'options'];\n\n/**\n * @interface\n */\nexport type MarkerProps = Omit<TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames>, 'contentHtml'>;\n\n/**\n * Marker component.\n *\n * A Marker is a 2D component anchored to a position on the map.\n * To animate the Marker when its target changes, see {@link AnimatedMarker}.\n *\n * @example\n * ```tsx\n * <Marker target={mapData.getByType('space')[0]}>\n * <div>Hello, world!</div>\n * </Marker>\n * ```\n *\n * @category Components\n */\nexport const Marker = forwardRef<MarkerJS | undefined, PropsWithChildren<MarkerProps>>((props, ref) => {\n\tconst { mapView } = useContext(MapViewContext);\n\tconst markerRef = useRef<MarkerJS>();\n\tconst [markerReady, setMarkerReady] = useState(false);\n\tconst memoizedOptions = useMemoDeep(() => props.options, [props.options]);\n\n\t// Expose the marker instance via ref\n\tuseImperativeHandle(ref, () => markerRef.current, [markerReady]);\n\n\tuseEffect(() => {\n\t\tif (mapView == null) {\n\t\t\tthrow new MapViewNullError('Marker');\n\t\t}\n\t\tmarkerRef.current = mapView.Markers.add(props.target, '', memoizedOptions);\n\t\tsetMarkerReady(true);\n\n\t\treturn () => {\n\t\t\tif (mapView == null || markerRef.current == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmapView.Markers.remove(markerRef.current);\n\t\t\tsetMarkerReady(false);\n\t\t};\n\t}, [mapView, props.target]);\n\n\t// Update options when they change (skip initial render)\n\tuseUpdateEffect(() => {\n\t\tif (markerRef.current && memoizedOptions) {\n\t\t\tmapView?.updateState(markerRef.current, memoizedOptions);\n\t\t}\n\t}, [memoizedOptions]);\n\n\tif (mapView == null || markerRef.current == null) {\n\t\treturn null;\n\t}\n\n\treturn createPortal(props.children, markerRef.current.contentEl, markerRef.current.id);\n});\n\n/**\n * AnimatedMarker component.\n * @experimental\n *\n * A {@link Marker} component that animates between positions when its target changes.\n *\n * @example\n * ```tsx\n * <AnimatedMarker target={mapData.getByType('space')[0]} duration={1000}>\n * <div>Hello, world!</div>\n * </AnimatedMarker>\n * ```\n *\n * @category Components\n */\nexport const AnimatedMarker = forwardRef<MarkerJS | undefined, PropsWithChildren<MarkerProps & TAnimationOptions>>(\n\t(props, ref) => {\n\t\tconst { mapView } = useContext(MapViewContext);\n\t\tconst keyRef = useRef<string>(randomId());\n\t\tconst markerRef = useRef<MarkerJS>();\n\t\tconst [markerReady, setMarkerReady] = useState(false);\n\n\t\t// Store the initial target to avoid re-creating the marker\n\t\tconst initialTarget = useRef(props.target);\n\n\t\t// Forward the ref and also keep a local reference for animations\n\t\tuseImperativeHandle(ref, () => markerRef.current, [markerReady]);\n\n\t\t// Callback ref to track when the marker becomes available\n\t\tconst handleMarkerRef = useCallback((marker: MarkerJS | null) => {\n\t\t\tmarkerRef.current = marker || undefined;\n\t\t\tsetMarkerReady(!!marker);\n\t\t}, []);\n\n\t\tuseEffect(() => {\n\t\t\tif (mapView == null) {\n\t\t\t\tthrow new MapViewNullError('Marker');\n\t\t\t}\n\t\t\tif (markerRef.current && markerRef.current.target !== props.target) {\n\t\t\t\tconst { duration = 300, easing = 'linear' } = props;\n\t\t\t\tmapView.Markers.animateTo(markerRef.current, props.target, { duration, easing });\n\t\t\t}\n\n\t\t\treturn () => {\n\t\t\t\tsetMarkerReady(false);\n\t\t\t};\n\t\t}, [mapView, props.target]);\n\n\t\tconst propsWithoutAnimation = useMemo(\n\t\t\t() => ({ ...props, duration: undefined, easing: undefined }),\n\t\t\t[props.duration, props.easing],\n\t\t);\n\n\t\treturn (\n\t\t\t<Marker {...propsWithoutAnimation} key={keyRef.current} target={initialTarget.current} ref={handleMarkerRef} />\n\t\t);\n\t},\n);\n", "const SLICE_POSITIONS = [0, 4, 6, 8, 10] as const;\n\n/**\n * Returns a UUIDv4-like ID without relying on a CSPRNG as we don't need it for these purposes.\n * @hidden\n */\nexport const randomId = () => {\n\tconst array: number[] = new Array(16).fill(0);\n\tlet seed = Math.random() * 0x100000000;\n\n\tfor (let i = 0; i < array.length; i++) {\n\t\tif (i > 0 && (i & 0x03) === 0) {\n\t\t\tseed = Math.random() * 0x100000000;\n\t\t}\n\t\tarray[i] = (seed >>> ((i & 0x03) << 3)) & 0xff;\n\t}\n\tconst hexArray = array.map(n => n.toString(16).padStart(2, '0'));\n\t// UUID's 3rd segment must start with a 4\n\n\thexArray[6] = '4' + hexArray[6][1];\n\t// UUID's 4th segment (for variant 1) must be an 8, 9, a or b\n\t// (due to needing the leading 2 bits in binary to be 10).\n\thexArray[8] = ['8', '9', 'a', 'b'].includes(hexArray[7][0]) ? hexArray[7] : 'a' + hexArray[7][1];\n\n\treturn SLICE_POSITIONS.map((v, i) =>\n\t\thexArray.slice(v, i === SLICE_POSITIONS.length - 1 ? undefined : SLICE_POSITIONS[i + 1]).join(''),\n\t).join('-');\n};\n\nexport function cyrb53(str: string, seed = 0): number {\n\tlet h1 = 0xdeadbeef ^ seed;\n\tlet h2 = 0x41c6ce57 ^ seed;\n\tfor (let i = 0, ch; i < str.length; i++) {\n\t\tch = str.charCodeAt(i);\n\t\th1 = Math.imul(h1 ^ ch, 2654435761);\n\t\th2 = Math.imul(h2 ^ ch, 1597334677);\n\t}\n\n\th1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n\th2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n\treturn 4294967296 * (2097151 & h2) + (h1 >>> 0);\n}\n\nlet counter = 0;\nexport function shortId() {\n\t// Hybrid ID generation: timestamp base36 + counter\n\tconst base = Date.now().toString(36);\n\treturn `${base}${(++counter).toString(36)}`;\n}\n", "import { forwardRef, useContext, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { MapViewNullError } from './errors';\nimport type { TupleToObjectWithPropNames } from './type-utils';\nimport { useMemoDeep } from './hooks/useMemoDeep';\nimport { useUpdateEffect } from './hooks/useUpdateEffect';\nimport type { MapView, Label as LabelJS } from '@mappedin/mappedin-js';\nimport { MapViewContext } from './MapView';\n\ntype ParamsArray = Parameters<MapView['Labels']['add']>;\n\ntype StreamAgentParameterNames = ['target', 'text', 'options'];\n\n/**\n * @interface\n */\nexport type LabelProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames>;\n\n/**\n * Label component.\n *\n * A Label is a 2D text label anchored to a position on the map.\n *\n * @category Components\n *\n * @example\n * ```tsx\n * <Label target={mapData.getByType('space')[0]} text={\"Hello, world!\"} />\n * ```\n */\nexport const Label = forwardRef<LabelJS | undefined, LabelProps>((props, ref) => {\n\tconst { mapView } = useContext(MapViewContext);\n\tconst labelRef = useRef<LabelJS>();\n\tconst [isLabelReady, setIsLabelReady] = useState(false);\n\tconst memoizedOptions = useMemoDeep(() => props.options, [props.options]);\n\n\t// Expose the label instance via ref\n\tuseImperativeHandle(ref, () => labelRef.current, [isLabelReady]);\n\n\t// Only create/destroy label when target changes\n\tuseEffect(() => {\n\t\tif (mapView == null) {\n\t\t\tthrow new MapViewNullError('Label');\n\t\t}\n\t\tlabelRef.current = mapView.Labels.add(props.target, props.text, memoizedOptions);\n\t\tsetIsLabelReady(true);\n\n\t\treturn () => {\n\t\t\tif (mapView == null || labelRef.current == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmapView.Labels.remove(labelRef.current);\n\t\t\tsetIsLabelReady(false);\n\t\t};\n\t}, [mapView, props.target]); // Only depend on mapView and target\n\n\t// Update text and options when they change (skip initial render)\n\tuseUpdateEffect(() => {\n\t\tif (labelRef.current) {\n\t\t\tmapView?.updateState(labelRef.current, {\n\t\t\t\ttext: props.text,\n\t\t\t\t...memoizedOptions,\n\t\t\t});\n\t\t}\n\t}, [props.text, memoizedOptions]);\n\n\treturn null;\n});\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAC,KAAM,EAAC,qBAAsB,aAAY,EAAC;AAAA;AAAA;;;ACA3C;AAAA;AAAA;AAAA;AAMA,WAAO,UAAU,gCAASA,OAAM,GAAG,GAAG;AACpC,UAAI,MAAM,EAAG,QAAO;AAEpB,UAAI,KAAK,KAAK,OAAO,KAAK,YAAY,OAAO,KAAK,UAAU;AAC1D,YAAI,EAAE,gBAAgB,EAAE,YAAa,QAAO;AAE5C,YAAI,QAAQ,GAAG;AACf,YAAI,MAAM,QAAQ,CAAC,GAAG;AACpB,mBAAS,EAAE;AACX,cAAI,UAAU,EAAE,OAAQ,QAAO;AAC/B,eAAK,IAAI,QAAQ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AM;AACZ,UAAI,WAAW,QAAQ,SAAS,WAAW,MAAM;AAChD;AAAA,MACD;AACA,cAAQ,OAAO,OAAO,SAAS,OAAO;AACtC,sBAAgB,KAAK;AAAA,IACtB;AAAA,EACD,GAAG,CAAC,SAAS,MAAM,MAAM,CAAC;AAG1B,kBAAgB,MAAM;AACrB,QAAI,SAAS,SAAS;AACrB,eAAS,YAAY,SAAS,SAAS;AAAA,QACtC,MAAM,MAAM;AAAA,QACZ,GAAG;AAAA,MACJ,CAAC;AAAA,IACF;AAAA,EACD,GAAG,CAAC,MAAM,MAAM,eAAe,CAAC;AAEhC,SAAO;AACR,CAAC;",
6
+ "names": ["equal", "import_fast_deep_equal", "useCallback", "useRef", "label", "useRef", "useRef", "equal", "useRef", "useCallback", "options", "equal", "useCallback", "useContext", "useEffect", "useContext", "useCallback", "useEffect", "React", "useCallback", "useEffect", "useMemo", "useRef", "useState", "createContext", "createContext", "useRef", "useState", "useMemo", "useCallback", "useEffect", "React", "useCallback", "useContext", "useEffect", "useContext", "useCallback", "useEffect", "useCallback", "useContext", "useContext", "useCallback", "useContext", "useEffect", "useRef", "forwardRef", "useImperativeHandle", "useState", "useEffect", "useRef", "useRef", "useEffect", "forwardRef", "useContext", "useRef", "useState", "useImperativeHandle", "useEffect", "useContext", "useEffect", "useContext", "useEffect", "useContext", "useEffect", "useRef", "forwardRef", "useImperativeHandle", "useState", "forwardRef", "useContext", "useRef", "useState", "useImperativeHandle", "useEffect", "useContext", "useEffect", "useRef", "forwardRef", "useImperativeHandle", "useState", "forwardRef", "useContext", "useRef", "useState", "useImperativeHandle", "useEffect", "useContext", "useContext", "React", "useCallback", "useContext", "useEffect", "useMemo", "useRef", "forwardRef", "useImperativeHandle", "useState", "forwardRef", "useContext", "useRef", "useState", "useImperativeHandle", "useEffect", "useCallback", "useMemo", "React", "forwardRef", "useContext", "useEffect", "useImperativeHandle", "useRef", "useState", "forwardRef", "useContext", "useRef", "useState", "useImperativeHandle", "useEffect"]
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappedin/react-sdk",
3
- "version": "6.0.0-rc.2",
3
+ "version": "6.0.0-rc.3",
4
4
  "homepage": "https://developer.mappedin.com/",
5
5
  "private": false,
6
6
  "main": "lib/esm/index.js",
@@ -32,5 +32,5 @@
32
32
  "volta": {
33
33
  "extends": "../../package.json"
34
34
  },
35
- "gitHead": "3c5c34f3c679167ed717dea0991fe3d1112e24b6"
35
+ "gitHead": "deada2546fa6868b53fe81ce8c007edda58f76fa"
36
36
  }