@mappedin/dynamic-focus 6.22.0-beta.0 → 6.24.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/chunk-ZXTOZAT4.js +2 -0
- package/lib/esm/index.d.ts +8 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/react/index.d.ts +8 -2
- package/lib/esm/react/index.js +1 -1
- package/lib/rn/building.d.ts +1 -2
- package/lib/rn/index-rn.js +2 -25
- package/lib/rn/logger.d.ts +3 -1
- package/lib/rn/types.d.ts +8 -1
- package/package.json +4 -4
- package/lib/esm/chunk-5RIJZDXN.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var tt=Object.defineProperty;var et=r=>{throw TypeError(r)};var Ot=(r,t,e)=>t in r?tt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var a=(r,t)=>tt(r,"name",{value:t,configurable:!0});var E=(r,t,e)=>Ot(r,typeof t!="symbol"?t+"":t,e),Zo=(r,t,e)=>t.has(r)||et("Cannot "+e);var o=(r,t,e)=>(Zo(r,t,"read from private field"),e?e.call(r):t.get(r)),d=(r,t,e)=>t.has(r)?et("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),c=(r,t,e,i)=>(Zo(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e),F=(r,t,e)=>(Zo(r,t,"access private method"),e);var y={env:{NODE_ENV:"production",npm_package_version:"6.24.0-beta.0"}};var eo={indoorZoomThreshold:18,outdoorZoomThreshold:17,setFloorOnFocus:!0,autoFocus:!1,indoorAnimationOptions:{duration:150},outdoorAnimationOptions:{duration:150},cameraLiftAnimationOptions:{duration:500,easing:"ease-in-out",interruptible:!0},autoAdjustFacadeHeights:!1,mode:"default-floor",preloadFloors:!0,dynamicBuildingInteriors:!0,dynamicLayers:[],isolateBelowGroundView:!1,forceInteriorsVisible:!1,showLabelsAndMarkersOnAllVisibleFloors:!1,autoZoomThresholds:!1},io=.2,_o=.4;var No="[MappedinJS]";var At={log:0,debug:0,info:1,warn:2,error:3,silent:4};function It(r){return At[r.toLowerCase()]}a(It,"parseLogLevel");function xo(r="",{prefix:t=No}={}){let e=`${t}${r?`-${r}`:""}`,i=a((s,n)=>{if(typeof window<"u"&&window.rnDebug){let f=n.map(p=>p instanceof Error&&p.stack?`${p.message}
|
|
2
|
+
${p.stack}`:p);window.rnDebug(`${r} ${s}: ${f.join(" ")}`)}},"rnDebug");return{logState:y.env.NODE_ENV==="test"?4:1,debug(...s){this.logState<=0&&(console.debug(e,...s),i("debug",s))},log(...s){this.debug(...s)},info(...s){this.logState<=1&&(console.info(e,...s),i("info",s))},warn(...s){this.logState<=2&&(console.warn(e,...s),i("warn",s))},error(...s){this.logState<=3&&(console.error(e,...s),i("error",s))},assert(...s){console.assert(...s)},time(s){console.time(s)},timeEnd(s){console.timeEnd(s)},setLevel(s){let n=typeof s=="string"?It(s):s;if(n===void 0||!(n>=0&&n<=4)){console.warn(e,`setLevel: unknown log level "${s}"`);return}this.logState=n}}}a(xo,"createLogger");var kt=xo();var q=kt;var V=xo("",{prefix:"[DynamicFocus]"});var it=a((r,t={})=>{let e={initialVisibility:t.initialVisibility??"indoor-first",debug:t.debug??!1},i=Bt(r,e);if(i===void 0)return V.error("No indoor floor stacks found. Cannot compute zoom thresholds. Set indoorZoomThreshold and outdoorZoomThreshold manually."),{indoorZoomThreshold:eo.indoorZoomThreshold,outdoorZoomThreshold:eo.outdoorZoomThreshold};let s=i+_o,n=i+io;return e.initialVisibility==="indoor-first"&&(s=i-io,n=i-_o),{indoorZoomThreshold:s,outdoorZoomThreshold:n}},"calculateZoomThresholds");function Bt(r,t){let i=r.getMapData().getByType("floor-stack").filter(f=>f.type!=="Outdoor"),s=1/0,n;for(let f of i){let p=r.Camera.getFocusOnTransform(f).zoomLevel??1/0;p<s&&(s=p,n=f)}if(s!==1/0)return t.debug&&n&&r.Camera.getFocusOnTransform(n,{debugColor:"blue"}),s}a(Bt,"getDefaultZoomLevel");import{Floor as Yt,getMultiFloorState as Wt}from"@mappedin/mappedin-js";function st(r,t){if(r==null||t==null)return r===t;if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==t[e])return!1;return!0}a(st,"arraysEqual");var Co=class Co{_subscribers={};_abortController=new AbortController;get signal(){return this._abortController.signal}publish(t,e){!this._subscribers||!this._subscribers[t]||this.signal.aborted||this._subscribers[t].forEach(function(i){typeof i=="function"&&i(e)})}onAbort(t){this.signal.addEventListener("abort",()=>t(),{once:!0})}on(t,e,i){let s=i?.signal;if(s?.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(e);let n=a(()=>{this.off(t,e)},"cleanup");return s&&s.addEventListener("abort",n,{once:!0}),n}off(t,e){if(!this._subscribers||this._subscribers[t]==null||this.signal.aborted)return;let i=this._subscribers[t].indexOf(e);i!==-1&&this._subscribers[t].splice(i,1)}destroy(){this.signal.aborted||(this._subscribers={},this._abortController.abort())}};a(Co,"PubSub");var Eo=Co;import{Facade as Dt,Floor as Lt,FloorStack as Mt}from"@mappedin/mappedin-js";var I,so,C,w,v,B,H,K,Go=class Go{constructor(t,e){E(this,"__type","building");d(this,I);d(this,so,new Map);d(this,C,new Map);d(this,w,[]);d(this,v);d(this,B);E(this,"defaultFloor");E(this,"activeFloor");E(this,"excluded",!1);E(this,"aboveGroundFloors",[]);d(this,H);d(this,K);c(this,I,t),c(this,so,new Map(t.floors.map(s=>[s.id,s]))),c(this,C,new Map(t.floors.map(s=>[s.elevation,s]))),c(this,w,Array.from(o(this,C).values()).sort((s,n)=>s.elevation-n.elevation));let i=t.defaultFloor;if(!i)throw new Error(`Building created for floor stack "${t.id}" with no resolvable default floor`);this.defaultFloor=i,this.activeFloor=this.defaultFloor,c(this,v,e),this.aboveGroundFloors=o(this,w).filter(s=>s.elevation>=0)}get id(){return o(this,I).id}get name(){return o(this,I).name}get floors(){return o(this,I).floors}get floorStack(){return o(this,I)}get facade(){return o(this,I).facade}get isCurrentFloorStack(){return this.id===o(this,v).currentFloorStack.id}get isIndoor(){let t=o(this,v).getState(this.facade);return this.isCurrentFloorStack||t?.visible===!1&&t?.opacity===0}get canSetFloor(){return this.isIndoor||!this.excluded}get maxElevation(){return o(this,H)==null&&c(this,H,Math.max(...o(this,C).keys())),o(this,H)}get minElevation(){return o(this,K)==null&&c(this,K,Math.min(...o(this,C).keys())),o(this,K)}has(t){return Lt.is(t)?o(this,so).has(t.id):Mt.is(t)?t.id===o(this,I).id:Dt.is(t)?t.id===this.facade.id:!1}getFloorByElevation(t){return o(this,C).get(t)}getNearestFloorByElevation(t){let e=this.getFloorByElevation(t);if(e)return e;if(t>=0){if(t>this.maxElevation)return o(this,w)[o(this,w).length-1];for(let i=o(this,w).length-1;i>=0;i--){let s=o(this,w)[i];if(s.elevation<=t)return s}}else{if(t<this.minElevation)return o(this,w)[0];for(let i of o(this,w))if(i.elevation>=t)return i}}getHighestFloor(){return o(this,w)[o(this,w).length-1]}cancelAnimation(){o(this,B)&&(o(this,B).animation.cancel(),c(this,B,void 0))}async animateFacade(t,e={duration:150}){let i=o(this,B)?.state||o(this,v).getState(this.facade);if(!i||!t||i?.opacity===t.opacity&&i?.visible===t.visible)return{result:"completed"};this.cancelAnimation();let{opacity:s,visible:n}=t;if(o(this,v).updateState(this.facade,{visible:!0}),s!==void 0){c(this,B,{animation:o(this,v).animateState(this.facade,{opacity:s},{duration:e.duration}),state:t});let f=await o(this,B).animation;if(c(this,B,void 0),f.result==="cancelled")return f}return n===!1&&o(this,v).updateState(this.facade,{visible:n}),{result:"completed"}}destroy(){this.cancelAnimation(),o(this,I).floors.forEach(t=>{o(this,v).updateState(t,{visible:t.id===o(this,v).currentFloor.id})}),this.has(o(this,v).currentFloor)||o(this,v).updateState(this.facade,{visible:!0,opacity:1})}};I=new WeakMap,so=new WeakMap,C=new WeakMap,w=new WeakMap,v=new WeakMap,B=new WeakMap,H=new WeakMap,K=new WeakMap,a(Go,"Building");var To=Go;function rt(r,t,e){return r>=t?"in-range":r<=e?"out-of-range":"transition"}a(rt,"getZoomState");function vo(r,t,e){if(r.__type==="outdoors"&&"floor"in r)return r.floor;let i=r;if(i.excluded)return i.activeFloor;switch(t){case"lock-elevation":return i.getFloorByElevation(e);case"nearest-elevation":return i.getNearestFloorByElevation(e);case"active-floor":return i.activeFloor;default:break}return i.isIndoor?i.activeFloor:i.defaultFloor}a(vo,"getFloorToShow");function Zt(r,t,e,i){return i?{facade:r,state:{type:"facade",visible:!1,opacity:0}}:t?{facade:r,state:{type:"facade",visible:!1,opacity:0}}:e?{facade:r,state:{type:"facade",visible:!0,opacity:.2}}:{facade:r,state:{type:"facade",visible:!0,opacity:1}}}a(Zt,"getFacadeState");function _t(r,t,e){return{outdoorOpacity:"initial",floorStates:r.floors.map(i=>{let n=i.id===t.id&&e;return{floor:i,state:{type:"floor",visible:n,geometry:{visible:n},labels:{enabled:n},markers:{enabled:n},footprint:{visible:!1},occlusion:{enabled:!1}}}})}}a(_t,"getSingleBuildingState");function nt(r,t){if(!t.includes("lock-elevation"))return"initial";for(let e of r)if(typeof e.outdoorOpacity=="number"&&e.outdoorOpacity>=0&&e.outdoorOpacity<=1)return e.outdoorOpacity;return"initial"}a(nt,"getOutdoorOpacity");function at(r,t,e){switch(e){case"in-range":return r[0]?.canSetFloor?r[0]:void 0;case"out-of-range":return t;case"transition":default:return}}a(at,"getSetFloorTargetFromZoomState");function lt(r){let{buildings:t,inViewSet:e,currentFloor:i,zoomState:s,mode:n,elevation:f,floorIdsInNavigation:p,floorStackIdsInNavigation:h,multiFloorView:g,getMultiFloorState:$,dynamicBuildingInteriors:A,isolateBelowGroundView:W,currentElevation:Fo,forceInteriorsVisible:to,getFloorStackAltitudeData:bo}=r,yo=new Map,Do=W&&Fo<0&&s==="in-range";for(let b of t){let ot=e.has(b.id),So=Do&&b.minElevation>=0,Et=So?!1:ot,Lo=So?!1:Ro({building:b,currentFloor:i,inRange:s==="in-range",inFocus:ot,mode:n,elevation:f,inNavigation:h.includes(b.id),dynamicBuildingInteriors:A,forceInteriorsVisible:to}),Mo=i.floorStack.id===b.id?b.activeFloor:vo(b,n,f),Tt=g?.enabled?$(b.floors,Mo||b.activeFloor,p,bo(b.id),{color:g?.footprintColor,spacesOpenToBelowEnabled:g?.spacesOpenToBelowEnabled,spacesOpenToBelowVisualEffectEnabled:g?.spacesOpenToBelowVisualEffectEnabled,spacesOpenToBelowVisualEffectDarkenAmount:g?.spacesOpenToBelowVisualEffectDarkenAmount,spacesOpenToBelowVisualEffectDarkenUseDepth:g?.spacesOpenToBelowVisualEffectDarkenUseDepth,spacesOpenToBelowVisualEffectDesaturateAmount:g?.spacesOpenToBelowVisualEffectDesaturateAmount,spacesOpenToBelowVisualEffectDesaturateUseDepth:g?.spacesOpenToBelowVisualEffectDesaturateUseDepth,spacesOpenToBelowVisualEffectWashOutAmount:g?.spacesOpenToBelowVisualEffectWashOutAmount,spacesOpenToBelowVisualEffectWashOutUseDepth:g?.spacesOpenToBelowVisualEffectWashOutUseDepth,opacity:g?.footprintOpacity,outline:g?.footprintOutline}):_t(b.floorStack,Mo||b.activeFloor,Lo),vt=W&&Fo<0&&s==="in-range",wt=Zt(b.facade,Lo,vt,So);yo.set(b.id,{building:b,showIndoor:Lo,floorStackState:Tt,facadeState:wt,inFocus:Et,floorToShow:Mo,isAboveGroundInIsolation:So})}return yo}a(lt,"getBuildingStates");function ut(r,t){return r.excluded?"none":t?"indoor":"outdoor"}a(ut,"getBuildingAnimationType");function Ro(r){let{building:t,currentFloor:e,inRange:i,inFocus:s,mode:n,elevation:f,inNavigation:p,dynamicBuildingInteriors:h,forceInteriorsVisible:g}=r;if(t.id===e.floorStack.id)return!0;if(t.excluded)return!1;if(g===!0||p===!0)return!0;if(!h)return e.floorStack.type!=="Outdoor";if(!i||!s)return!1;switch(n){case"lock-elevation":return t.getFloorByElevation(f)!=null;default:break}return!0}a(Ro,"shouldShowIndoor");function dt(r,t,e){return r!==t&&!e}a(dt,"shouldDeferSetFloor");var ct=["default-floor","active-floor","lock-elevation","nearest-elevation"];import{Floor as Nt,FloorStack as xt}from"@mappedin/mappedin-js";function ht(r,t,e,i){return(r<t||r>e)&&q.warn(i),Math.min(e,Math.max(t,r))}a(ht,"clampWithWarning");function Po(r,t){return!Nt.is(r)||r?.floorStack==null||!xt.is(t)?!1:r.floorStack.id!==t.id?(q.warn(`Floor (${r.id}) does not belong to floor stack (${t.id}).`),!1):!0}a(Po,"validateFloorForStack");function Uo(r,t,e,i){return ht(r,t,e,`${i} must be between ${t} and ${e}.`)}a(Uo,"validateZoomThreshold");var D,Q,ro,$o,jo=class jo{constructor(t,e){d(this,ro);E(this,"__type","outdoors");d(this,D);d(this,Q);c(this,D,t),c(this,Q,e)}get id(){return o(this,D).id}get floorStack(){return o(this,D)}get floor(){return o(this,D).defaultFloor}matchesFloorStack(t){return t===o(this,D)||t===o(this,D).id}show(){F(this,ro,$o).call(this,!0)}hide(){F(this,ro,$o).call(this,!1)}destroy(){this.matchesFloorStack(o(this,Q).currentFloorStack)||this.hide()}};D=new WeakMap,Q=new WeakMap,ro=new WeakSet,$o=a(function(t){for(let e of o(this,D).floors)o(this,Q).updateState(e,{visible:t})},"#setVisible"),a(jo,"Outdoors");var wo=jo;function ft(r,t){let e=r.getByType("floor-stack"),i=e.find(n=>n.type?.toLowerCase()==="outdoor");if(i)return i;let s=e.find(n=>n.facade==null&&!t.has(n.id));return s||(V.warn("No good candidate for the outdoor floor stack was found. Using the first floor stack."),e[0])}a(ft,"getOutdoorFloorStack");function Ct(r,t){return`${t} ${r}`}a(Ct,"formatMessage");var zo=class zo extends Error{constructor(t,e=No){super(Ct(t,e)),this.name="MappedinError"}};a(zo,"MappedinError");var Oo=zo;var Gt=a(r=>r,"linearEase"),Rt=a(r=>r*r,"quadEaseIn"),Pt=a(r=>1-Math.cos(r*Math.PI/2),"easeIn"),Ut=a(r=>1-(1-r)*(1-r),"quadEaseOut"),$t=a(r=>1-Math.pow(1-r,3),"cubicEaseOut"),jt={linear:Gt,"ease-in":Rt,"ease-out":Ut,"ease-in-out":Pt,"ease-out-cubic":$t};function zt(r,t){let e=0;if(t.length<2)return e;let s=t[0]<t[1]?(n,f)=>n>f:(n,f)=>n<f;for(;e<t.length-1&&s(r,t[e+1]);)e++;return e>t.length-2?Math.max(0,t.length-2):e}a(zt,"getInterpolationBreakpoint");function mt(r,t,e,i="ease-in"){if(t.length!==e.length)throw new Oo("Input and output ranges must have the same number of values.");r=Math.max(t[0],Math.min(r,t[t.length-1]));let s=zt(r,t),n=(r-t[s])/(t[s+1]-t[s]),f=typeof i=="function"?i(n):jt[i](n);return e[s]+f*(e[s+1]-e[s])}a(mt,"interpolateMulti");var L,no,ao,Z,lo,Wo=class Wo{constructor(t,e,i){E(this,"layers");E(this,"visible");d(this,L);d(this,no,[]);d(this,ao,!1);d(this,Z,new Map);E(this,"interpolationFn");d(this,lo,1);this.layers=t,this.visible=e,c(this,L,i)}processLayerGroup(t,e){o(this,ao)||(this.layers.forEach(i=>{let s=t[i];s&&o(this,no).push(...s)}),c(this,ao,!0),this.visible&&(this.interpolationFn=i=>{let{outdoorZoomThreshold:s,indoorZoomThreshold:n}=e();return mt(i,[s,n],[1,0])}))}setOpacity(t){c(this,lo,t);for(let e of o(this,no))if(e.startsWith("img_")){let i=o(this,L).Image3D.getById(e);if(i){let s=o(this,L).getState(i.image);o(this,Z).has(e)||o(this,Z).set(e,s?.opacity??1);let n=Math.min(o(this,Z).get(e),t);o(this,L).updateState(i.image,{opacity:n})}}else{let i=o(this,L).getMapData()?.getById("space",e);if(!i)continue;let s=o(this,L).getState(i);o(this,Z).has(e)||o(this,Z).set(e,s?.opacity??1);let n=Math.min(o(this,Z).get(e),t);o(this,L).updateState(i,{opacity:n,visible:n>0})}}get opacity(){return o(this,lo)}};L=new WeakMap,no=new WeakMap,ao=new WeakMap,Z=new WeakMap,lo=new WeakMap,a(Wo,"LayerGroup");var Vo=Wo;function Yo(r,t,e){r.forEach(i=>{if(e?.forceOpacity!==void 0){i.setOpacity(e.forceOpacity),i.visible=e.forceOpacity===1;return}if(i.interpolationFn!=null){let s=i.interpolationFn(t);s!=null&&(i.setOpacity(s),i.visible=s===1)}})}a(Yo,"runLayerGroupInterpolations");var O,l,G,u,j,z,S,_,Y,N,T,J,uo,co,ho,M,R,X,x,P,U,m,qo,gt,Ho,Ko,Qo,Ft,Jo,fo,bt,Io,ko,Bo,mo,po,go,oo,Ao,yt,St,k,Xo=class Xo{constructor(t){d(this,m);d(this,O);d(this,l);d(this,G);d(this,u,eo);d(this,j,[]);d(this,z,new Set);d(this,S,new Map);d(this,_);d(this,Y,!1);d(this,N,!1);d(this,T,0);d(this,J,0);d(this,uo,[]);d(this,co,{});d(this,ho,{});d(this,M,"transition");d(this,R,"outdoor");d(this,X,[]);d(this,x,!1);d(this,P,[]);d(this,U,null);E(this,"sceneUpdateQueue",Promise.resolve());E(this,"on",a((t,e)=>{o(this,O).on(t,e)},"on"));E(this,"off",a((t,e)=>{o(this,O).off(t,e)},"off"));d(this,fo,a(t=>{if(!this.isEnabled)return;let{facades:e}=t;if(st(e,this.focusedFacades)&&o(this,R)==="transition"&&!o(this,N))return;c(this,N,!1),c(this,j,[]),o(this,z).clear();let i=o(this,u).isolateBelowGroundView&&o(this,T)<0;if(e.length>0)for(let s of e){let n=o(this,S).get(s.floorStack.id);if(n){if(i&&n.minElevation>=0)continue;o(this,z).add(n.id),o(this,j).push(n)}}o(this,u).autoFocus&&this.focus()},"#handleFacadesInViewChange"));d(this,Io,a((t,e)=>{if(!this.isEnabled)return;let i=o(this,S).get(t.floorStack.id);i&&(e.reason==="dynamic-focus"&&o(this,u).mode==="active-floor"||(i.activeFloor=t));let s=o(this,u).isolateBelowGroundView&&o(this,T)<0;i?.excluded===!1&&!o(this,_).matchesFloorStack(t.floorStack)&&c(this,T,t.elevation);let n=o(this,u).isolateBelowGroundView&&o(this,T)<0,f=s&&!n;if(e.reason==="dynamic-focus")return;let p=F(this,m,bt).call(this),h=o(this,ko).call(this,t,e,f,p);if(p)return h;h.catch(g=>{V.error("setFloor override work failed after sync floor-change commit",g)})},"#setFloorHandler"));d(this,ko,a(async(t,e,i,s)=>{if(i){if(c(this,N,!0),o(this,l).Camera.updateFacadesInView(),!o(this,u).autoFocus){if(await o(this,k).call(this,t),!this.isEnabled||e.signal.aborted)return;o(this,O).publish("focus",{facades:this.focusedFacades})}}else{if(await o(this,k).call(this,t),!this.isEnabled||e.signal.aborted)return;o(this,O).publish("focus",{facades:this.focusedFacades})}s&&this.isEnabled&&!e.signal.aborted&&await o(this,Bo).call(this,t)},"#runFloorChangeWork"));d(this,Bo,a(t=>{let e=o(this,l).getFloorStackAltitudeData(t.floorStack).get(t.elevation)?.altitude;if(typeof e=="number"&&o(this,l).Camera.elevation!==e)return o(this,l).Camera.animateElevation(e,o(this,u).cameraLiftAnimationOptions)},"#liftCameraToFloorAltitude"));d(this,mo,a(()=>{c(this,Y,!0)},"#handleUserInteractionStart"));d(this,po,a(()=>{c(this,Y,!1)},"#handleUserInteractionEnd"));d(this,go,a(()=>{o(this,k).call(this)},"#handleGlobalStateChange"));d(this,oo,a(t=>{if(!this.isEnabled)return;let{zoomLevel:e}=t,i=rt(e,o(this,u).indoorZoomThreshold,o(this,u).outdoorZoomThreshold);o(this,M)!==i&&(c(this,M,i),i==="in-range"?this.setIndoor():i==="out-of-range"&&this.setOutdoor());let s=(o(this,l).Navigation?.floors?.length??0)>0;Yo(o(this,P),e,s?{forceOpacity:0}:void 0)},"#handleCameraChange"));d(this,k,a(async t=>{if(!this.isEnabled)return;let e=t||o(this,l).currentFloor,i=o(this,l).getGlobalState().multiFloorView,s=o(this,l).options.multiFloorView?{...o(this,l).options.multiFloorView,...i}:o(this,l).options.multiFloorView,n=o(this,l).Navigation?.floors?.map(h=>h.id)||[],f=o(this,l).Navigation?.floorStacks.map(h=>h.id)||[],p=new Promise(async h=>{await this.sceneUpdateQueue;let g=lt({buildings:Array.from(o(this,S).values()),inViewSet:o(this,z),currentFloor:e,zoomState:o(this,M),mode:o(this,u).mode,elevation:o(this,T),floorIdsInNavigation:n,floorStackIdsInNavigation:f,multiFloorView:s,getMultiFloorState:o(this,u).customMultiFloorVisibilityState??Wt,dynamicBuildingInteriors:o(this,u).dynamicBuildingInteriors,isolateBelowGroundView:o(this,u).isolateBelowGroundView,currentElevation:o(this,T),forceInteriorsVisible:o(this,u).forceInteriorsVisible,getFloorStackAltitudeData:a(A=>o(this,l).getFloorStackAltitudeData(A),"getFloorStackAltitudeData")}),$=[];await Promise.all(Array.from(g.values()).map(async A=>{let{building:W,showIndoor:Fo,floorStackState:to,facadeState:bo,inFocus:yo,isAboveGroundInIsolation:Do}=A;$.push(to);let b=ut(W,Fo);if(b==="indoor")return F(this,m,yt).call(this,W,to,bo,yo);if(b==="outdoor")return F(this,m,St).call(this,W,to,bo,f,Do)})),o(this,l).Outdoor.setOpacity(nt($,o(this,u).mode)),c(this,X,o(this,j).filter(A=>g.get(A.id)?.showIndoor===!0).map(A=>A.facade)),o(this,O).publish("focus",{facades:o(this,X)}),h()});return this.sceneUpdateQueue=p,p},"#applyBuildingStates"));c(this,O,new Eo),c(this,l,t),V.setLevel(q.logState),c(this,G,o(this,l).getMapData()),c(this,T,o(this,l).currentFloor.elevation),c(this,J,o(this,l).Camera.elevation);for(let e of o(this,G).getByType("facade")){let{floorStack:i}=e;if(i.floors.length===0||i.defaultFloor==null){V.warn(`Skipping building for floor stack "${i.id}" because it has no floors. It will not participate in Dynamic Focus.`);continue}o(this,S).set(i.id,new To(i,o(this,l)))}F(this,m,Ft).call(this),c(this,_,new wo(ft(o(this,G),o(this,S)),o(this,l))),o(this,l).on("camera-change",o(this,oo)),o(this,l).on("facades-in-view-change",o(this,fo)),o(this,l).on("user-interaction-start",o(this,mo)),o(this,l).on("user-interaction-end",o(this,po)),o(this,l).on("global-state-change",o(this,go))}enable(t){if(o(this,x)){V.warn("enable() called on an already enabled Dynamic Focus instance.");return}c(this,x,!0),o(this,l).__EXPERIMENTAL__overrideSetFloorHandler(o(this,Io)),o(this,_).show();let e={...o(this,u),...t};e.autoZoomThresholds&&(t?.autoZoomThresholds&&(t.indoorZoomThreshold!=null||t.outdoorZoomThreshold!=null)&&V.warn("Manual indoorZoomThreshold/outdoorZoomThreshold values are ignored while autoZoomThresholds is enabled."),delete e.indoorZoomThreshold,delete e.outdoorZoomThreshold),this.updateState(e),F(this,m,gt).call(this),o(this,oo).call(this,{zoomLevel:o(this,l).Camera.zoomLevel,center:o(this,l).Camera.center,bearing:o(this,l).Camera.bearing,pitch:o(this,l).Camera.pitch}),o(this,l).Camera.updateFacadesInView()}disable(){if(!o(this,x)){V.warn("disable() called on an already disabled Dynamic Focus instance.");return}c(this,x,!1),o(this,l).__EXPERIMENTAL__overrideSetFloorHandler(void 0)}get isEnabled(){return o(this,x)}get isIndoor(){return o(this,R)==="indoor"}get isOutdoor(){return o(this,R)==="outdoor"}get outdoorsFloorStack(){return o(this,_).floorStack}get layers(){return o(this,uo)}get layersBySpaceId(){return o(this,co)}setIndoor(){c(this,R,"indoor"),c(this,M,"in-range"),F(this,m,qo).call(this)}setOutdoor(){c(this,R,"outdoor"),c(this,M,"out-of-range"),F(this,m,qo).call(this)}get focusedFacades(){return[...o(this,X)]}getState(){return{...o(this,u)}}updateState(t){let e=!1,i=o(this,u).indoorZoomThreshold,s=o(this,u).outdoorZoomThreshold,n=o(this,u).isolateBelowGroundView&&o(this,T)<0,f=!!o(this,u).autoZoomThresholds,p=t.autoZoomThresholds!=null?!!t.autoZoomThresholds:f,h=t;if(p&&(h.indoorZoomThreshold!=null||h.outdoorZoomThreshold!=null)){V.warn("Manual indoorZoomThreshold/outdoorZoomThreshold values are ignored while autoZoomThresholds is enabled.");let{indoorZoomThreshold:g,outdoorZoomThreshold:$,...A}=h;h=A}if(!f&&p?(c(this,U,()=>{if(!o(this,x))return;let g=o(this,u).indoorZoomThreshold,$=o(this,u).outdoorZoomThreshold;F(this,m,Ko).call(this),F(this,m,Qo).call(this,g,$),o(this,k).call(this)}),o(this,l).on("camera-screen-offsets-change",o(this,U))):f&&!p&&F(this,m,Ho).call(this),h.indoorZoomThreshold!=null&&(h.indoorZoomThreshold=Uo(h.indoorZoomThreshold,h?.outdoorZoomThreshold??o(this,u).outdoorZoomThreshold,o(this,l).Camera.maxZoomLevel,"indoorZoomThreshold"),e=!0),h.outdoorZoomThreshold!=null&&(h.outdoorZoomThreshold=Uo(h.outdoorZoomThreshold,o(this,l).Camera.minZoomLevel,h?.indoorZoomThreshold??o(this,u).indoorZoomThreshold,"outdoorZoomThreshold"),e=!0),h.mode!=null&&(h.mode=ct.includes(h.mode)?h.mode:"default-floor"),h.autoAdjustFacadeHeights!=null&&(o(this,u).autoAdjustFacadeHeights=h.autoAdjustFacadeHeights),h.dynamicBuildingInteriors!=null&&h.dynamicBuildingInteriors!==o(this,u).dynamicBuildingInteriors&&(e=!0),h.isolateBelowGroundView!=null&&h.isolateBelowGroundView!==o(this,u).isolateBelowGroundView&&(e=!0),h.forceInteriorsVisible!=null&&h.forceInteriorsVisible!==o(this,u).forceInteriorsVisible&&(e=!0),h.showLabelsAndMarkersOnAllVisibleFloors!=null&&h.showLabelsAndMarkersOnAllVisibleFloors!==o(this,u).showLabelsAndMarkersOnAllVisibleFloors&&(e=!0),h.cameraLiftAnimationOptions!=null&&(h={...h,cameraLiftAnimationOptions:{...o(this,u).cameraLiftAnimationOptions,...h.cameraLiftAnimationOptions}}),c(this,u,Object.assign({},o(this,u),Object.fromEntries(Object.entries(h).filter(([,g])=>g!=null)))),p&&h.autoZoomThresholds!==void 0&&(F(this,m,Ko).call(this),e=!0),h.mode!=null&&h.preloadFloors&&F(this,m,Jo).call(this,h.mode),e){let g=o(this,u).isolateBelowGroundView&&o(this,T)<0;n&&!g?(c(this,N,!0),o(this,l).Camera.updateFacadesInView(),o(this,u).autoFocus||o(this,k).call(this)):o(this,k).call(this)}F(this,m,Qo).call(this,i,s)}destroy(){this.disable(),F(this,m,Ho).call(this),o(this,l).off("facades-in-view-change",o(this,fo)),o(this,l).off("camera-change",o(this,oo)),o(this,l).off("user-interaction-start",o(this,mo)),o(this,l).off("user-interaction-end",o(this,po)),o(this,l).off("global-state-change",o(this,go)),o(this,S).forEach(t=>t.destroy()),o(this,_).destroy(),o(this,O).destroy(),c(this,P,[])}async focus(t=o(this,u).setFloorOnFocus){let e;if(t)if(dt(o(this,J),o(this,l).Camera.elevation,o(this,Y)))c(this,J,o(this,l).Camera.elevation),c(this,N,!0);else{let i=at(o(this,j),o(this,_),o(this,M)),s=i?vo(i,o(this,u).mode,o(this,T)):void 0;s&&s.id!==o(this,l).currentFloor.id&&(e=s,o(this,l).setFloor(s,{context:"dynamic-focus"}))}await o(this,k).call(this,e),o(this,O).publish("focus",{facades:this.focusedFacades})}preloadFloors(){F(this,m,Jo).call(this,o(this,u).mode)}setDefaultFloorForStack(t,e){if(!Po(e,t))return;let i=o(this,S).get(t.id);i&&(i.defaultFloor=e)}resetDefaultFloorForStack(t){let e=o(this,S).get(t.id),i=t.defaultFloor;e&&i&&(e.defaultFloor=i)}getDefaultFloorForStack(t){return o(this,S).get(t.id)?.defaultFloor||t.defaultFloor||t.floors[0]}setCurrentFloorForStack(t,e){if(!Po(e,t))return;let i=o(this,S).get(t.id);i&&(i.activeFloor=e,o(this,k).call(this))}exclude(t){let e=Array.isArray(t)?t:[t];for(let i of e){let s=o(this,S).get(i.id);s&&(s.excluded=!0)}}include(t){let e=Array.isArray(t)?t:[t];for(let i of e){let s=o(this,S).get(i.id);s&&(s.excluded=!1)}}getCurrentFloorForStack(t){return o(this,S).get(t.id)?.activeFloor||this.getDefaultFloorForStack(t)}};O=new WeakMap,l=new WeakMap,G=new WeakMap,u=new WeakMap,j=new WeakMap,z=new WeakMap,S=new WeakMap,_=new WeakMap,Y=new WeakMap,N=new WeakMap,T=new WeakMap,J=new WeakMap,uo=new WeakMap,co=new WeakMap,ho=new WeakMap,M=new WeakMap,R=new WeakMap,X=new WeakMap,x=new WeakMap,P=new WeakMap,U=new WeakMap,m=new WeakSet,qo=a(function(){o(this,u).autoFocus&&(o(this,Y)?this.focus():c(this,N,!0)),o(this,O).publish("state-change")},"#handleViewStateChange"),gt=a(function(){c(this,P,[]);for(let e of o(this,u).dynamicLayers){let i=new Vo([e],!0,o(this,l));i.processLayerGroup(o(this,ho),()=>o(this,u)),o(this,P).push(i)}let t=(o(this,l).Navigation?.floors?.length??0)>0;Yo(o(this,P),o(this,l).Camera.zoomLevel,t?{forceOpacity:0}:void 0)},"#initializeLayerGroups"),Ho=a(function(){o(this,U)&&(o(this,l).off("camera-screen-offsets-change",o(this,U)),c(this,U,null))},"#unsubscribeScreenOffsets"),Ko=a(function(){let t=o(this,u).autoZoomThresholds,e=typeof t=="object"&&t!==null?{...t}:{},{indoorZoomThreshold:i,outdoorZoomThreshold:s}=it(o(this,l),e);o(this,u).indoorZoomThreshold=i,o(this,u).outdoorZoomThreshold=s,(e.expandMinZoom??!0)&&s<o(this,l).Camera.minZoomLevel&&o(this,l).Camera.setMinZoomLevel(s-io)},"#recalcThresholds"),Qo=a(function(t,e){(o(this,u).indoorZoomThreshold!==t||o(this,u).outdoorZoomThreshold!==e)&&o(this,O).publish("zoom-threshold-change",{indoorZoomThreshold:o(this,u).indoorZoomThreshold,outdoorZoomThreshold:o(this,u).outdoorZoomThreshold})},"#publishThresholdChangeIfNeeded"),Ft=a(function(){let t=o(this,G).internal.mvf?.enterprise?.layers??[],e={},i={};t.forEach(s=>{e[s.name]||(e[s.name]=[]),e[s.name].push(...s.spaces.map(({spaceId:n})=>n));for(let{spaceId:n}of s.spaces)i[n]==null&&(i[n]=[]),i[n].push(s.name)}),c(this,uo,t.map(({name:s})=>s)),c(this,co,i),c(this,ho,e)},"#setupLayers"),Jo=a(function(t){let e=[];for(let i of o(this,G).getByType("facade")){let s=o(this,S).get(i.floorStack.id);if(!s)continue;let n=vo(s,t,o(this,T));n!=null&&Yt.is(n)&&e.push(n)}o(this,l).preloadFloors(e)},"#preloadFloors"),fo=new WeakMap,bt=a(function(){let{multiFloorView:t}=o(this,l).options;return!!t?.enabled&&!!t?.updateCameraElevationOnFloorChange},"#shouldAwaitFloorChangeCommit"),Io=new WeakMap,ko=new WeakMap,Bo=new WeakMap,mo=new WeakMap,po=new WeakMap,go=new WeakMap,oo=new WeakMap,Ao=a(function(t,e,i,s=!1){t.forEach(n=>{if(n.floor)if(e){let p=i!==void 0&&!s?{...n.state,labels:{...n.state.labels,enabled:n.state.labels.enabled&&i},markers:{...n.state.markers,enabled:n.state.markers.enabled&&i},occlusion:{...n.state.occlusion,enabled:n.state.occlusion.enabled&&i}}:n.state;o(this,l).updateState(n.floor,p)}else o(this,l).updateState(n.floor,{visible:!1})})},"#updateFloorVisibility"),yt=a(async function(t,e,i,s){return F(this,m,Ao).call(this,e.floorStates,!0,s,o(this,u).showLabelsAndMarkersOnAllVisibleFloors),t.animateFacade(i.state,o(this,u).indoorAnimationOptions)},"#animateIndoorSequence"),St=a(async function(t,e,i,s,n){let f=n;f&&F(this,m,Ao).call(this,e.floorStates,!1,void 0,o(this,u).showLabelsAndMarkersOnAllVisibleFloors);let p=await t.animateFacade(i.state,o(this,u).outdoorAnimationOptions);return p.result==="completed"&&!f&&F(this,m,Ao).call(this,e.floorStates,Ro({building:t,currentFloor:o(this,l).currentFloor,inRange:o(this,M)==="in-range",inFocus:o(this,z).has(t.id),mode:o(this,u).mode,elevation:o(this,T),inNavigation:s.includes(t.floorStack.id),dynamicBuildingInteriors:o(this,u).dynamicBuildingInteriors,forceInteriorsVisible:o(this,u).forceInteriorsVisible}),void 0,o(this,u).showLabelsAndMarkersOnAllVisibleFloors),p},"#animateOutdoorSequence"),k=new WeakMap,a(Xo,"DynamicFocus");var pt=Xo;export{a,it as b,pt as c};
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Facade, Floor, FloorStack, FootprintConfig, MapView, TFloorAltitudeData, VisibilityState as BuildingFloorStackState } from "@mappedin/mappedin-js";
|
|
1
|
+
import { Facade, Floor, FloorStack, FootprintConfig, MapView, TCameraAnimationOptions, TFloorAltitudeData, VisibilityState as BuildingFloorStackState } from "@mappedin/mappedin-js";
|
|
2
2
|
|
|
3
3
|
//#region src/zoom-thresholds.d.ts
|
|
4
4
|
|
|
@@ -121,6 +121,13 @@ type DynamicFocusState = {
|
|
|
121
121
|
* Options for the animation when fading in the facade to hide the interior.
|
|
122
122
|
*/
|
|
123
123
|
outdoorAnimationOptions: DynamicFocusAnimationOptions;
|
|
124
|
+
/**
|
|
125
|
+
* Camera animation options for the elevation lift triggered on floor change
|
|
126
|
+
* when `multiFloorView.updateCameraElevationOnFloorChange` is enabled.
|
|
127
|
+
* Forwarded to `mapView.Camera.animateElevation`.
|
|
128
|
+
* @default { duration: 500, easing: 'ease-in-out', interruptible: true }
|
|
129
|
+
*/
|
|
130
|
+
cameraLiftAnimationOptions: TCameraAnimationOptions;
|
|
124
131
|
/**
|
|
125
132
|
* The mode of the Dynamic Focus controller.
|
|
126
133
|
* @default 'default-floor'
|
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,c as t}from"./chunk-
|
|
1
|
+
import{b as o,c as t}from"./chunk-ZXTOZAT4.js";export{t as DynamicFocus,o as calculateZoomThresholds};
|
package/lib/esm/react/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Facade, Floor, FloorStack, FootprintConfig, MapView, TFloorAltitudeData, VisibilityState as BuildingFloorStackState } from "@mappedin/mappedin-js";
|
|
1
|
+
import { Facade, Floor, FloorStack, FootprintConfig, MapView, TCameraAnimationOptions, TFloorAltitudeData, VisibilityState as BuildingFloorStackState } from "@mappedin/mappedin-js";
|
|
2
2
|
|
|
3
3
|
//#region src/zoom-thresholds.d.ts
|
|
4
4
|
|
|
@@ -89,6 +89,13 @@ type DynamicFocusState = {
|
|
|
89
89
|
* Options for the animation when fading in the facade to hide the interior.
|
|
90
90
|
*/
|
|
91
91
|
outdoorAnimationOptions: DynamicFocusAnimationOptions;
|
|
92
|
+
/**
|
|
93
|
+
* Camera animation options for the elevation lift triggered on floor change
|
|
94
|
+
* when `multiFloorView.updateCameraElevationOnFloorChange` is enabled.
|
|
95
|
+
* Forwarded to `mapView.Camera.animateElevation`.
|
|
96
|
+
* @default { duration: 500, easing: 'ease-in-out', interruptible: true }
|
|
97
|
+
*/
|
|
98
|
+
cameraLiftAnimationOptions: TCameraAnimationOptions;
|
|
92
99
|
/**
|
|
93
100
|
* The mode of the Dynamic Focus controller.
|
|
94
101
|
* @default 'default-floor'
|
|
@@ -754,7 +761,6 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
|
|
|
754
761
|
: never;
|
|
755
762
|
//#endregion
|
|
756
763
|
//#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/internal/object.d.ts
|
|
757
|
-
|
|
758
764
|
/**
|
|
759
765
|
Merges user specified options with default options.
|
|
760
766
|
|
package/lib/esm/react/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t,c as a}from"../chunk-
|
|
1
|
+
import{a as t,c as a}from"../chunk-ZXTOZAT4.js";import{useCallback as y,useState as p,useMemo as F}from"react";import{useMap as l,useMapViewExtension as D}from"@mappedin/react-sdk";function d(){let[,n]=p({});return y(()=>n({}),[])}t(d,"useForceUpdate");function i(){let{mapView:n}=l(),r=d(),{register:o}=D("dynamic-focus",{onRegister:t(()=>{let e=new a(n);return e.on("state-change",r),e},"onRegister"),onDeregister:t(e=>{e.off("state-change",r),e.destroy()},"onDeregister")}),s=o();if(!s)throw new Error("DynamicFocus is not initialized");return F(()=>{let e=new WeakMap;return new Proxy(s,{get(u,m){let c=u[m];return typeof c=="function"?(e.has(c)||e.set(c,c.bind(u)),e.get(c)):c}})},[s])}t(i,"useDynamicFocus");import{useCallback as w,useEffect as E,useRef as k}from"react";function x(n,r){let o=i(),s=k(r);s.current=r;let e=w(u=>{s.current(u)},[]);E(()=>{if(o!=null)return o.on(n,e),()=>{o?.off(n,e)}},[o,n,e])}t(x,"useDynamicFocusEvent");export{i as useDynamicFocus,x as useDynamicFocusEvent};
|
package/lib/rn/building.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MapView, TAnimateStateResult, TFacadeState
|
|
1
|
+
import type { MapView, TAnimateStateResult, TFacadeState } from '@mappedin/mappedin-js';
|
|
2
2
|
import { Facade, Floor, FloorStack } from '@mappedin/mappedin-js';
|
|
3
3
|
import type { DynamicFocusAnimationOptions } from './types';
|
|
4
4
|
export declare class Building {
|
|
@@ -16,7 +16,6 @@ export declare class Building {
|
|
|
16
16
|
*/
|
|
17
17
|
activeFloor: Floor;
|
|
18
18
|
excluded: boolean;
|
|
19
|
-
floorsAltitudesMap: Map<number, TFloorAltitudeData>;
|
|
20
19
|
aboveGroundFloors: Floor[];
|
|
21
20
|
constructor(floorStack: FloorStack, mapView: MapView);
|
|
22
21
|
get id(): string;
|
package/lib/rn/index-rn.js
CHANGED
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
${a.stack}`:a);window.rnDebug(`${o} ${t}: ${f.join(" ")}`)}},"rnDebug");return{logState:0,log(...t){this.logState<=0&&(console.log(e,...t),s("log",t))},warn(...t){this.logState<=1&&(console.warn(e,...t),s("warn",t))},error(...t){this.logState<=2&&(console.error(e,...t),s("error",t))},assert(...t){console.assert(...t)},time(t){console.time(t)},timeEnd(t){console.timeEnd(t)},setLevel(t){0<=t&&t<=3&&(this.logState=t)}}}l(p,"createLogger");var z=p(),F=p("",{prefix:"[DynamicFocus]"});import{MappedinContext as _,useEventCallback as $,createEventSetupScript as G,createEventCleanupScript as N}from"@mappedin/react-native-sdk";function v(o,i){return i.map(e=>e&&e.id&&o.getById("facade",e.id)||e)}l(v,"hydrateFacades");import{useRegisterExtension as R}from"@mappedin/react-native-sdk";var j=`
|
|
3
|
-
// Define require function that uses bridge.modules for external dependencies
|
|
4
|
-
globalThis.require = globalThis.require || ((id) => {
|
|
5
|
-
if (window.bridge?.modules?.[id]) {
|
|
6
|
-
return window.bridge.modules[id];
|
|
7
|
-
}
|
|
8
|
-
throw new Error('Module not found: ' + id);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
"use strict";var DynamicFocus=(()=>{var eo=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var It=Object.prototype.hasOwnProperty;var rt=s=>{throw TypeError(s)};var At=(s,t,e)=>t in s?eo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var a=(s,t)=>eo(s,"name",{value:t,configurable:!0}),No=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var Dt=(s,t)=>{for(var e in t)eo(s,e,{get:t[e],enumerable:!0})},Bt=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Vt(t))!It.call(s,r)&&r!==e&&eo(s,r,{get:()=>t[r],enumerable:!(i=Ot(t,r))||i.enumerable});return s};var kt=s=>Bt(eo({},"__esModule",{value:!0}),s);var b=(s,t,e)=>At(s,typeof t!="symbol"?t+"":t,e),Co=(s,t,e)=>t.has(s)||rt("Cannot "+e);var o=(s,t,e)=>(Co(s,t,"read from private field"),e?e.call(s):t.get(s)),c=(s,t,e)=>t.has(s)?rt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),d=(s,t,e,i)=>(Co(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e),F=(s,t,e)=>(Co(s,t,"access private method"),e);var $t={};Dt($t,{DynamicFocus:()=>Mo,calculateZoomThresholds:()=>Ao});var Zo=No("@mappedin/mappedin-js");function nt(s,t){if(s==null||t==null)return s===t;if(s.length!==t.length)return!1;for(let e=0;e<s.length;e++)if(s[e]!==t[e])return!1;return!0}a(nt,"arraysEqual");var Go=class Go{constructor(){b(this,"_subscribers",{});b(this,"_abortController",new AbortController)}get signal(){return this._abortController.signal}publish(t,e){!this._subscribers||!this._subscribers[t]||this.signal.aborted||this._subscribers[t].forEach(function(i){typeof i=="function"&&i(e)})}onAbort(t){this.signal.addEventListener("abort",()=>t(),{once:!0})}on(t,e,i){let r=i?.signal;if(r?.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(e);let n=a(()=>{this.off(t,e)},"cleanup");return r&&r.addEventListener("abort",n,{once:!0}),n}off(t,e){if(!this._subscribers||this._subscribers[t]==null||this.signal.aborted)return;let i=this._subscribers[t].indexOf(e);i!==-1&&this._subscribers[t].splice(i,1)}destroy(){this.signal.aborted||(this._subscribers={},this._abortController.abort())}};a(Go,"PubSub");var vo=Go;var H=No("@mappedin/mappedin-js");var V,io,N,v,E,D,q,W,Po=class Po{constructor(t,e){b(this,"__type","building");c(this,V);c(this,io,new Map);c(this,N,new Map);c(this,v,[]);c(this,E);c(this,D);b(this,"defaultFloor");b(this,"activeFloor");b(this,"excluded",!1);b(this,"floorsAltitudesMap",new Map);b(this,"aboveGroundFloors",[]);c(this,q);c(this,W);d(this,V,t),d(this,io,new Map(t.floors.map(n=>[n.id,n]))),d(this,N,new Map(t.floors.map(n=>[n.elevation,n]))),d(this,v,Array.from(o(this,N).values()).sort((n,f)=>n.elevation-f.elevation));let i=t.defaultFloor;if(!i)throw new Error(\`Building created for floor stack "\${t.id}" with no resolvable default floor\`);this.defaultFloor=i,this.activeFloor=this.defaultFloor,d(this,E,e),this.aboveGroundFloors=o(this,v).filter(n=>n.elevation>=0);let r=t.facade?.spaces.map(n=>o(this,E).getState(n)).sort((n,f)=>n.altitude-f.altitude);if(r&&r.length===this.aboveGroundFloors.length)for(let n in this.aboveGroundFloors){let f=this.aboveGroundFloors[n],m=r[n];this.floorsAltitudesMap.set(f.elevation,{altitude:m.altitude,visualHeight:m.height})}}get id(){return o(this,V).id}get name(){return o(this,V).name}get floors(){return o(this,V).floors}get floorStack(){return o(this,V)}get facade(){return o(this,V).facade}get isCurrentFloorStack(){return this.id===o(this,E).currentFloorStack.id}get isIndoor(){let t=o(this,E).getState(this.facade);return this.isCurrentFloorStack||t?.visible===!1&&t?.opacity===0}get canSetFloor(){return this.isIndoor||!this.excluded}get maxElevation(){return o(this,q)==null&&d(this,q,Math.max(...o(this,N).keys())),o(this,q)}get minElevation(){return o(this,W)==null&&d(this,W,Math.min(...o(this,N).keys())),o(this,W)}has(t){return H.Floor.is(t)?o(this,io).has(t.id):H.FloorStack.is(t)?t.id===o(this,V).id:H.Facade.is(t)?t.id===this.facade.id:!1}getFloorByElevation(t){return o(this,N).get(t)}getNearestFloorByElevation(t){let e=this.getFloorByElevation(t);if(e)return e;if(t>=0){if(t>this.maxElevation)return o(this,v)[o(this,v).length-1];for(let i=o(this,v).length-1;i>=0;i--){let r=o(this,v)[i];if(r.elevation<=t)return r}}else{if(t<this.minElevation)return o(this,v)[0];for(let i of o(this,v))if(i.elevation>=t)return i}}getHighestFloor(){return o(this,v)[o(this,v).length-1]}cancelAnimation(){o(this,D)&&(o(this,D).animation.cancel(),d(this,D,void 0))}async animateFacade(t,e={duration:150}){let i=o(this,D)?.state||o(this,E).getState(this.facade);if(!i||!t||i?.opacity===t.opacity&&i?.visible===t.visible)return{result:"completed"};this.cancelAnimation();let{opacity:r,visible:n}=t;if(o(this,E).updateState(this.facade,{visible:!0}),r!==void 0){d(this,D,{animation:o(this,E).animateState(this.facade,{opacity:r},{duration:e.duration}),state:t});let f=await o(this,D).animation;if(d(this,D,void 0),f.result==="cancelled")return f}return n===!1&&o(this,E).updateState(this.facade,{visible:n}),{result:"completed"}}destroy(){this.cancelAnimation(),o(this,V).floors.forEach(t=>{o(this,E).updateState(t,{visible:t.id===o(this,E).currentFloor.id})}),this.has(o(this,E).currentFloor)||o(this,E).updateState(this.facade,{visible:!0,opacity:1})}};V=new WeakMap,io=new WeakMap,N=new WeakMap,v=new WeakMap,E=new WeakMap,D=new WeakMap,q=new WeakMap,W=new WeakMap,a(Po,"Building");var wo=Po;function at(s,t,e){return s>=t?"in-range":s<=e?"out-of-range":"transition"}a(at,"getZoomState");function Oo(s,t,e){if(s.__type==="outdoors"&&"floor"in s)return s.floor;let i=s;if(i.excluded)return i.activeFloor;switch(t){case"lock-elevation":return i.getFloorByElevation(e);case"nearest-elevation":return i.getNearestFloorByElevation(e);case"active-floor":return i.activeFloor;default:break}return i.isIndoor?i.activeFloor:i.defaultFloor}a(Oo,"getFloorToShow");function Mt(s,t,e,i){return i?{facade:s,state:{type:"facade",visible:!1,opacity:0}}:t?{facade:s,state:{type:"facade",visible:!1,opacity:0}}:e?{facade:s,state:{type:"facade",visible:!0,opacity:.2}}:{facade:s,state:{type:"facade",visible:!0,opacity:1}}}a(Mt,"getFacadeState");function Zt(s,t,e){return{outdoorOpacity:"initial",floorStates:s.floors.map(i=>{let n=i.id===t.id&&e;return{floor:i,state:{type:"floor",visible:n,geometry:{visible:n},labels:{enabled:n},markers:{enabled:n},footprint:{visible:!1},occlusion:{enabled:!1}}}})}}a(Zt,"getSingleBuildingState");function lt(s,t){if(!t.includes("lock-elevation"))return"initial";for(let e of s)if(typeof e.outdoorOpacity=="number"&&e.outdoorOpacity>=0&&e.outdoorOpacity<=1)return e.outdoorOpacity;return"initial"}a(lt,"getOutdoorOpacity");function ut(s,t,e){switch(e){case"in-range":return s[0]?.canSetFloor?s[0]:void 0;case"out-of-range":return t;case"transition":default:return}}a(ut,"getSetFloorTargetFromZoomState");function dt(s){let{buildings:t,inViewSet:e,currentFloor:i,zoomState:r,mode:n,elevation:f,floorIdsInNavigation:m,floorStackIdsInNavigation:h,multiFloorView:g,getMultiFloorState:U,dynamicBuildingInteriors:O,isolateBelowGroundView:Y,currentElevation:yo,forceInteriorsVisible:to,getFloorStackAltitudeData:So}=s,Eo=new Map,xo=Y&&yo<0&&r==="in-range";for(let y of t){let st=e.has(y.id),To=xo&&y.minElevation>=0,Et=To?!1:st,Lo=To?!1:Ro({building:y,currentFloor:i,inRange:r==="in-range",inFocus:st,mode:n,elevation:f,inNavigation:h.includes(y.id),dynamicBuildingInteriors:O,forceInteriorsVisible:to}),_o=i.floorStack.id===y.id?y.activeFloor:Oo(y,n,f),Tt=g?.enabled?U(y.floors,_o||y.activeFloor,m,So?.(y.id)??y.floorsAltitudesMap,{color:g?.footprintColor,spacesOpenToBelowEnabled:g?.spacesOpenToBelowEnabled,spacesOpenToBelowVisualEffectEnabled:g?.spacesOpenToBelowVisualEffectEnabled,spacesOpenToBelowVisualEffectDarkenAmount:g?.spacesOpenToBelowVisualEffectDarkenAmount,spacesOpenToBelowVisualEffectDarkenUseDepth:g?.spacesOpenToBelowVisualEffectDarkenUseDepth,spacesOpenToBelowVisualEffectDesaturateAmount:g?.spacesOpenToBelowVisualEffectDesaturateAmount,spacesOpenToBelowVisualEffectDesaturateUseDepth:g?.spacesOpenToBelowVisualEffectDesaturateUseDepth,spacesOpenToBelowVisualEffectWashOutAmount:g?.spacesOpenToBelowVisualEffectWashOutAmount,spacesOpenToBelowVisualEffectWashOutUseDepth:g?.spacesOpenToBelowVisualEffectWashOutUseDepth,opacity:g?.footprintOpacity,outline:g?.footprintOutline}):Zt(y.floorStack,_o||y.activeFloor,Lo),vt=Y&&yo<0&&r==="in-range",wt=Mt(y.facade,Lo,vt,To);Eo.set(y.id,{building:y,showIndoor:Lo,floorStackState:Tt,facadeState:wt,inFocus:Et,floorToShow:_o,isAboveGroundInIsolation:To})}return Eo}a(dt,"getBuildingStates");function ct(s,t){return s.excluded?"none":t?"indoor":"outdoor"}a(ct,"getBuildingAnimationType");function Ro(s){let{building:t,currentFloor:e,inRange:i,inFocus:r,mode:n,elevation:f,inNavigation:m,dynamicBuildingInteriors:h,forceInteriorsVisible:g}=s;if(t.id===e.floorStack.id)return!0;if(t.excluded)return!1;if(g===!0||m===!0)return!0;if(!h)return e.floorStack.type!=="Outdoor";if(!i||!r)return!1;switch(n){case"lock-elevation":return t.getFloorByElevation(f)!=null;default:break}return!0}a(Ro,"shouldShowIndoor");function ht(s,t,e){return s!==t&&!e}a(ht,"shouldDeferSetFloor");var ft=["default-floor","active-floor","lock-elevation","nearest-elevation"];var Vo=No("@mappedin/mappedin-js");var Uo="[MappedinJS]";function jo(s="",{prefix:t=Uo}={}){let e=\`\${t}\${s?\`-\${s}\`:""}\`,i=a((r,n)=>{if(typeof window<"u"&&window.rnDebug){let f=n.map(m=>m instanceof Error&&m.stack?\`\${m.message}
|
|
12
|
-
\${m.stack}\`:m);window.rnDebug(\`\${s} \${r}: \${f.join(" ")}\`)}},"rnDebug");return{logState:0,log(...r){this.logState<=0&&(console.log(e,...r),i("log",r))},warn(...r){this.logState<=1&&(console.warn(e,...r),i("warn",r))},error(...r){this.logState<=2&&(console.error(e,...r),i("error",r))},assert(...r){console.assert(...r)},time(r){console.time(r)},timeEnd(r){console.timeEnd(r)},setLevel(r){0<=r&&r<=3&&(this.logState=r)}}}a(jo,"createLogger");var xt=jo();var K=xt;function mt(s,t,e,i){return(s<t||s>e)&&K.warn(i),Math.min(e,Math.max(t,s))}a(mt,"clampWithWarning");function $o(s,t){return!Vo.Floor.is(s)||s?.floorStack==null||!Vo.FloorStack.is(t)?!1:s.floorStack.id!==t.id?(K.warn(\`Floor (\${s.id}) does not belong to floor stack (\${t.id}).\`),!1):!0}a($o,"validateFloorForStack");function zo(s,t,e,i){return mt(s,t,e,\`\${i} must be between \${t} and \${e}.\`)}a(zo,"validateZoomThreshold");var I=jo("",{prefix:"[DynamicFocus]"});var B,Q,so,Yo,qo=class qo{constructor(t,e){c(this,so);b(this,"__type","outdoors");c(this,B);c(this,Q);d(this,B,t),d(this,Q,e)}get id(){return o(this,B).id}get floorStack(){return o(this,B)}get floor(){return o(this,B).defaultFloor}matchesFloorStack(t){return t===o(this,B)||t===o(this,B).id}show(){F(this,so,Yo).call(this,!0)}hide(){F(this,so,Yo).call(this,!1)}destroy(){this.matchesFloorStack(o(this,Q).currentFloorStack)||this.hide()}};B=new WeakMap,Q=new WeakMap,so=new WeakSet,Yo=a(function(t){for(let e of o(this,B).floors)o(this,Q).updateState(e,{visible:t})},"#setVisible"),a(qo,"Outdoors");var Io=qo;function pt(s,t){let e=s.getByType("floor-stack"),i=e.find(n=>n.type?.toLowerCase()==="outdoor");if(i)return i;let r=e.find(n=>n.facade==null&&!t.has(n.id));return r||(I.warn("No good candidate for the outdoor floor stack was found. Using the first floor stack."),e[0])}a(pt,"getOutdoorFloorStack");var ro={indoorZoomThreshold:18,outdoorZoomThreshold:17,setFloorOnFocus:!0,autoFocus:!1,indoorAnimationOptions:{duration:150},outdoorAnimationOptions:{duration:150},autoAdjustFacadeHeights:!1,mode:"default-floor",preloadFloors:!0,dynamicBuildingInteriors:!0,dynamicLayers:[],isolateBelowGroundView:!1,forceInteriorsVisible:!1,showLabelsAndMarkersOnAllVisibleFloors:!1,autoZoomThresholds:!1},no=.2,Wo=.4;var Ao=a((s,t={})=>{let e={initialVisibility:t.initialVisibility??"indoor-first",debug:t.debug??!1},i=Lt(s,e);if(i===void 0)return I.error("No indoor floor stacks found. Cannot compute zoom thresholds. Set indoorZoomThreshold and outdoorZoomThreshold manually."),{indoorZoomThreshold:ro.indoorZoomThreshold,outdoorZoomThreshold:ro.outdoorZoomThreshold};let r=i+Wo,n=i+no;return e.initialVisibility==="indoor-first"&&(r=i-no,n=i-Wo),{indoorZoomThreshold:r,outdoorZoomThreshold:n}},"calculateZoomThresholds");function Lt(s,t){let i=s.getMapData().getByType("floor-stack").filter(f=>f.type!=="Outdoor"),r=1/0,n;for(let f of i){let m=s.Camera.getFocusOnTransform(f).zoomLevel??1/0;m<r&&(r=m,n=f)}if(r!==1/0)return t.debug&&n&&s.Camera.getFocusOnTransform(n,{debugColor:"blue"}),r}a(Lt,"getDefaultZoomLevel");function _t(s,t){return\`\${t} \${s}\`}a(_t,"formatMessage");var Ho=class Ho extends Error{constructor(t,e=Uo){super(_t(t,e)),this.name="MappedinError"}};a(Ho,"MappedinError");var Do=Ho;var Nt=a(s=>s,"linearEase"),Ct=a(s=>s*s,"quadEaseIn"),Gt=a(s=>1-Math.cos(s*Math.PI/2),"easeIn"),Pt=a(s=>1-(1-s)*(1-s),"quadEaseOut"),Rt=a(s=>1-Math.pow(1-s,3),"cubicEaseOut"),Ut={linear:Nt,"ease-in":Ct,"ease-out":Pt,"ease-in-out":Gt,"ease-out-cubic":Rt};function jt(s,t){let e=0;if(t.length<2)return e;let r=t[0]<t[1]?(n,f)=>n>f:(n,f)=>n<f;for(;e<t.length-1&&r(s,t[e+1]);)e++;return e>t.length-2?Math.max(0,t.length-2):e}a(jt,"getInterpolationBreakpoint");function gt(s,t,e,i="ease-in"){if(t.length!==e.length)throw new Do("Input and output ranges must have the same number of values.");s=Math.max(t[0],Math.min(s,t[t.length-1]));let r=jt(s,t),n=(s-t[r])/(t[r+1]-t[r]),f=typeof i=="function"?i(n):Ut[i](n);return e[r]+f*(e[r+1]-e[r])}a(gt,"interpolateMulti");var k,ao,lo,Z,uo,Qo=class Qo{constructor(t,e,i){b(this,"layers");b(this,"visible");c(this,k);c(this,ao,[]);c(this,lo,!1);c(this,Z,new Map);b(this,"interpolationFn");c(this,uo,1);this.layers=t,this.visible=e,d(this,k,i)}processLayerGroup(t,e){o(this,lo)||(this.layers.forEach(i=>{let r=t[i];r&&o(this,ao).push(...r)}),d(this,lo,!0),this.visible&&(this.interpolationFn=i=>{let{outdoorZoomThreshold:r,indoorZoomThreshold:n}=e();return gt(i,[r,n],[1,0])}))}setOpacity(t){d(this,uo,t);for(let e of o(this,ao))if(e.startsWith("img_")){let i=o(this,k).Image3D.getById(e);if(i){let r=o(this,k).getState(i.image);o(this,Z).has(e)||o(this,Z).set(e,r?.opacity??1);let n=Math.min(o(this,Z).get(e),t);o(this,k).updateState(i.image,{opacity:n})}}else{let i=o(this,k).getMapData()?.getById("space",e);if(!i)continue;let r=o(this,k).getState(i);o(this,Z).has(e)||o(this,Z).set(e,r?.opacity??1);let n=Math.min(o(this,Z).get(e),t);o(this,k).updateState(i,{opacity:n,visible:n>0})}}get opacity(){return o(this,uo)}};k=new WeakMap,ao=new WeakMap,lo=new WeakMap,Z=new WeakMap,uo=new WeakMap,a(Qo,"LayerGroup");var Bo=Qo;function Ko(s,t,e){s.forEach(i=>{if(e?.forceOpacity!==void 0){i.setOpacity(e.forceOpacity),i.visible=e.forceOpacity===1;return}if(i.interpolationFn!=null){let r=i.interpolationFn(t);r!=null&&(i.setOpacity(r),i.visible=r===1)}})}a(Ko,"runLayerGroupInterpolations");var w,l,C,u,j,$,S,x,z,L,T,J,co,ho,fo,M,G,X,_,P,R,p,Jo,Ft,Xo,ot,tt,bt,et,mo,po,go,Fo,bo,oo,ko,yt,St,A,it=class it{constructor(t){c(this,p);c(this,w);c(this,l);c(this,C);c(this,u,ro);c(this,j,[]);c(this,$,new Set);c(this,S,new Map);c(this,x);c(this,z,!1);c(this,L,!1);c(this,T,0);c(this,J,0);c(this,co,[]);c(this,ho,{});c(this,fo,{});c(this,M,"transition");c(this,G,"outdoor");c(this,X,[]);c(this,_,!1);c(this,P,[]);c(this,R,null);b(this,"sceneUpdateQueue",Promise.resolve());b(this,"on",a((t,e)=>{o(this,w).on(t,e)},"on"));b(this,"off",a((t,e)=>{o(this,w).off(t,e)},"off"));c(this,mo,a(t=>{if(!this.isEnabled)return;let{facades:e}=t;if(nt(e,this.focusedFacades)&&o(this,G)==="transition"&&!o(this,L))return;d(this,L,!1),d(this,j,[]),o(this,$).clear();let i=o(this,u).isolateBelowGroundView&&o(this,T)<0;if(e.length>0)for(let r of e){let n=o(this,S).get(r.floorStack.id);if(n){if(i&&n.minElevation>=0)continue;o(this,$).add(n.id),o(this,j).push(n)}}o(this,u).autoFocus&&this.focus()},"#handleFacadesInViewChange"));c(this,po,a(async t=>{if(!this.isEnabled)return;let{floor:e}=t,i=o(this,S).get(e.floorStack.id);i&&(t.reason==="dynamic-focus"&&o(this,u).mode==="active-floor"||(i.activeFloor=e));let r=o(this,u).isolateBelowGroundView&&o(this,T)<0;i?.excluded===!1&&!o(this,x).matchesFloorStack(e.floorStack)&&d(this,T,e.elevation);let n=o(this,u).isolateBelowGroundView&&o(this,T)<0,f=r&&!n;if(o(this,l).manualFloorVisibility===!0){t.reason!=="dynamic-focus"&&(f?(d(this,L,!0),o(this,l).Camera.updateFacadesInView(),o(this,u).autoFocus||(await o(this,A).call(this,e),o(this,w).publish("focus",{facades:this.focusedFacades}))):(await o(this,A).call(this,e),o(this,w).publish("focus",{facades:this.focusedFacades})));let m=i?.floorsAltitudesMap.get(e.elevation)?.altitude??0;o(this,l).options.multiFloorView!=null&&o(this,l).options.multiFloorView?.enabled&&o(this,l).options.multiFloorView?.updateCameraElevationOnFloorChange&&o(this,l).Camera.elevation!==m&&o(this,l).Camera.animateElevation(m,{duration:750,easing:"ease-in-out"})}},"#handleFloorChangeStart"));c(this,go,a(()=>{d(this,z,!0)},"#handleUserInteractionStart"));c(this,Fo,a(()=>{d(this,z,!1)},"#handleUserInteractionEnd"));c(this,bo,a(()=>{o(this,A).call(this)},"#handleGlobalStateChange"));c(this,oo,a(t=>{if(!this.isEnabled)return;let{zoomLevel:e}=t,i=at(e,o(this,u).indoorZoomThreshold,o(this,u).outdoorZoomThreshold);o(this,M)!==i&&(d(this,M,i),i==="in-range"?this.setIndoor():i==="out-of-range"&&this.setOutdoor());let r=(o(this,l).Navigation?.floors?.length??0)>0;Ko(o(this,P),e,r?{forceOpacity:0}:void 0)},"#handleCameraChange"));c(this,A,a(async t=>{if(o(this,l).manualFloorVisibility!==!0||!this.isEnabled)return;let e=t||o(this,l).currentFloor,i=o(this,l).getGlobalState().multiFloorView,r=o(this,l).options.multiFloorView?{...o(this,l).options.multiFloorView,...i}:o(this,l).options.multiFloorView,n=o(this,l).Navigation?.floors?.map(h=>h.id)||[],f=o(this,l).Navigation?.floorStacks.map(h=>h.id)||[],m=new Promise(async h=>{await this.sceneUpdateQueue;let g=dt({buildings:Array.from(o(this,S).values()),inViewSet:o(this,$),currentFloor:e,zoomState:o(this,M),mode:o(this,u).mode,elevation:o(this,T),floorIdsInNavigation:n,floorStackIdsInNavigation:f,multiFloorView:r,getMultiFloorState:o(this,u).customMultiFloorVisibilityState??Zo.getMultiFloorState,dynamicBuildingInteriors:o(this,u).dynamicBuildingInteriors,isolateBelowGroundView:o(this,u).isolateBelowGroundView,currentElevation:o(this,T),forceInteriorsVisible:o(this,u).forceInteriorsVisible,getFloorStackAltitudeData:a(O=>o(this,l).getFloorStackAltitudeData(O),"getFloorStackAltitudeData")}),U=[];await Promise.all(Array.from(g.values()).map(async O=>{let{building:Y,showIndoor:yo,floorStackState:to,facadeState:So,inFocus:Eo,isAboveGroundInIsolation:xo}=O;U.push(to);let y=ct(Y,yo);if(y==="indoor")return F(this,p,yt).call(this,Y,to,So,Eo);if(y==="outdoor")return F(this,p,St).call(this,Y,to,So,f,xo)})),o(this,l).Outdoor.setOpacity(lt(U,o(this,u).mode)),d(this,X,o(this,j).filter(O=>g.get(O.id)?.showIndoor===!0).map(O=>O.facade)),o(this,w).publish("focus",{facades:o(this,X)}),h()});return this.sceneUpdateQueue=m,m},"#applyBuildingStates"));d(this,w,new vo),d(this,l,t),I.setLevel(K.logState),d(this,C,o(this,l).getMapData()),d(this,T,o(this,l).currentFloor.elevation),d(this,J,o(this,l).Camera.elevation);for(let e of o(this,C).getByType("facade")){let{floorStack:i}=e;if(i.floors.length===0||i.defaultFloor==null){I.warn(\`Skipping building for floor stack "\${i.id}" because it has no floors. It will not participate in Dynamic Focus.\`);continue}o(this,S).set(i.id,new wo(i,o(this,l)))}F(this,p,bt).call(this),d(this,x,new Io(pt(o(this,C),o(this,S)),o(this,l))),o(this,l).on("floor-change-start",o(this,po)),o(this,l).on("camera-change",o(this,oo)),o(this,l).on("facades-in-view-change",o(this,mo)),o(this,l).on("user-interaction-start",o(this,go)),o(this,l).on("user-interaction-end",o(this,Fo)),o(this,l).on("global-state-change",o(this,bo))}enable(t){if(o(this,_)){I.warn("enable() called on an already enabled Dynamic Focus instance.");return}d(this,_,!0),o(this,l).manualFloorVisibility=!0,o(this,x).show();let e={...o(this,u),...t};e.autoZoomThresholds&&(t?.autoZoomThresholds&&(t.indoorZoomThreshold!=null||t.outdoorZoomThreshold!=null)&&I.warn("Manual indoorZoomThreshold/outdoorZoomThreshold values are ignored while autoZoomThresholds is enabled."),delete e.indoorZoomThreshold,delete e.outdoorZoomThreshold),this.updateState(e),F(this,p,Ft).call(this),o(this,oo).call(this,{zoomLevel:o(this,l).Camera.zoomLevel,center:o(this,l).Camera.center,bearing:o(this,l).Camera.bearing,pitch:o(this,l).Camera.pitch}),o(this,l).Camera.updateFacadesInView()}disable(){if(!o(this,_)){I.warn("disable() called on an already disabled Dynamic Focus instance.");return}d(this,_,!1),o(this,l).manualFloorVisibility=!1}get isEnabled(){return o(this,_)}get isIndoor(){return o(this,G)==="indoor"}get isOutdoor(){return o(this,G)==="outdoor"}get outdoorsFloorStack(){return o(this,x).floorStack}get layers(){return o(this,co)}get layersBySpaceId(){return o(this,ho)}setIndoor(){d(this,G,"indoor"),d(this,M,"in-range"),F(this,p,Jo).call(this)}setOutdoor(){d(this,G,"outdoor"),d(this,M,"out-of-range"),F(this,p,Jo).call(this)}get focusedFacades(){return[...o(this,X)]}getState(){return{...o(this,u)}}updateState(t){let e=!1,i=o(this,u).indoorZoomThreshold,r=o(this,u).outdoorZoomThreshold,n=o(this,u).isolateBelowGroundView&&o(this,T)<0,f=!!o(this,u).autoZoomThresholds,m=t.autoZoomThresholds!=null?!!t.autoZoomThresholds:f,h=t;if(m&&(h.indoorZoomThreshold!=null||h.outdoorZoomThreshold!=null)){I.warn("Manual indoorZoomThreshold/outdoorZoomThreshold values are ignored while autoZoomThresholds is enabled.");let{indoorZoomThreshold:g,outdoorZoomThreshold:U,...O}=h;h=O}if(!f&&m?(d(this,R,()=>{if(!o(this,_))return;let g=o(this,u).indoorZoomThreshold,U=o(this,u).outdoorZoomThreshold;F(this,p,ot).call(this),F(this,p,tt).call(this,g,U),o(this,A).call(this)}),o(this,l).on("camera-screen-offsets-change",o(this,R))):f&&!m&&F(this,p,Xo).call(this),h.indoorZoomThreshold!=null&&(h.indoorZoomThreshold=zo(h.indoorZoomThreshold,h?.outdoorZoomThreshold??o(this,u).outdoorZoomThreshold,o(this,l).Camera.maxZoomLevel,"indoorZoomThreshold"),e=!0),h.outdoorZoomThreshold!=null&&(h.outdoorZoomThreshold=zo(h.outdoorZoomThreshold,o(this,l).Camera.minZoomLevel,h?.indoorZoomThreshold??o(this,u).indoorZoomThreshold,"outdoorZoomThreshold"),e=!0),h.mode!=null&&(h.mode=ft.includes(h.mode)?h.mode:"default-floor"),h.autoAdjustFacadeHeights!=null&&(o(this,u).autoAdjustFacadeHeights=h.autoAdjustFacadeHeights),h.dynamicBuildingInteriors!=null&&h.dynamicBuildingInteriors!==o(this,u).dynamicBuildingInteriors&&(e=!0),h.isolateBelowGroundView!=null&&h.isolateBelowGroundView!==o(this,u).isolateBelowGroundView&&(e=!0),h.forceInteriorsVisible!=null&&h.forceInteriorsVisible!==o(this,u).forceInteriorsVisible&&(e=!0),h.showLabelsAndMarkersOnAllVisibleFloors!=null&&h.showLabelsAndMarkersOnAllVisibleFloors!==o(this,u).showLabelsAndMarkersOnAllVisibleFloors&&(e=!0),d(this,u,Object.assign({},o(this,u),Object.fromEntries(Object.entries(h).filter(([,g])=>g!=null)))),m&&h.autoZoomThresholds!==void 0&&(F(this,p,ot).call(this),e=!0),h.mode!=null&&h.preloadFloors&&F(this,p,et).call(this,h.mode),e){let g=o(this,u).isolateBelowGroundView&&o(this,T)<0;n&&!g?(d(this,L,!0),o(this,l).Camera.updateFacadesInView(),o(this,u).autoFocus||o(this,A).call(this)):o(this,A).call(this)}F(this,p,tt).call(this,i,r)}destroy(){this.disable(),F(this,p,Xo).call(this),o(this,l).off("facades-in-view-change",o(this,mo)),o(this,l).off("floor-change-start",o(this,po)),o(this,l).off("camera-change",o(this,oo)),o(this,l).off("user-interaction-start",o(this,go)),o(this,l).off("user-interaction-end",o(this,Fo)),o(this,l).off("global-state-change",o(this,bo)),o(this,S).forEach(t=>t.destroy()),o(this,x).destroy(),o(this,w).destroy(),d(this,P,[])}async focus(t=o(this,u).setFloorOnFocus){if(t)if(ht(o(this,J),o(this,l).Camera.elevation,o(this,z)))d(this,J,o(this,l).Camera.elevation),d(this,L,!0);else{let e=ut(o(this,j),o(this,x),o(this,M)),i=e?Oo(e,o(this,u).mode,o(this,T)):void 0;i&&i.id!==o(this,l).currentFloor.id&&o(this,l).setFloor(i,{context:"dynamic-focus"})}await o(this,A).call(this),o(this,w).publish("focus",{facades:this.focusedFacades})}preloadFloors(){F(this,p,et).call(this,o(this,u).mode)}setDefaultFloorForStack(t,e){if(!$o(e,t))return;let i=o(this,S).get(t.id);i&&(i.defaultFloor=e)}resetDefaultFloorForStack(t){let e=o(this,S).get(t.id),i=t.defaultFloor;e&&i&&(e.defaultFloor=i)}getDefaultFloorForStack(t){return o(this,S).get(t.id)?.defaultFloor||t.defaultFloor||t.floors[0]}setCurrentFloorForStack(t,e){if(!$o(e,t))return;let i=o(this,S).get(t.id);i&&(i.activeFloor=e,o(this,A).call(this))}exclude(t){let e=Array.isArray(t)?t:[t];for(let i of e){let r=o(this,S).get(i.id);r&&(r.excluded=!0)}}include(t){let e=Array.isArray(t)?t:[t];for(let i of e){let r=o(this,S).get(i.id);r&&(r.excluded=!1)}}getCurrentFloorForStack(t){return o(this,S).get(t.id)?.activeFloor||this.getDefaultFloorForStack(t)}};w=new WeakMap,l=new WeakMap,C=new WeakMap,u=new WeakMap,j=new WeakMap,$=new WeakMap,S=new WeakMap,x=new WeakMap,z=new WeakMap,L=new WeakMap,T=new WeakMap,J=new WeakMap,co=new WeakMap,ho=new WeakMap,fo=new WeakMap,M=new WeakMap,G=new WeakMap,X=new WeakMap,_=new WeakMap,P=new WeakMap,R=new WeakMap,p=new WeakSet,Jo=a(function(){o(this,u).autoFocus&&(o(this,z)?this.focus():d(this,L,!0)),o(this,w).publish("state-change")},"#handleViewStateChange"),Ft=a(function(){d(this,P,[]);for(let e of o(this,u).dynamicLayers){let i=new Bo([e],!0,o(this,l));i.processLayerGroup(o(this,fo),()=>o(this,u)),o(this,P).push(i)}let t=(o(this,l).Navigation?.floors?.length??0)>0;Ko(o(this,P),o(this,l).Camera.zoomLevel,t?{forceOpacity:0}:void 0)},"#initializeLayerGroups"),Xo=a(function(){o(this,R)&&(o(this,l).off("camera-screen-offsets-change",o(this,R)),d(this,R,null))},"#unsubscribeScreenOffsets"),ot=a(function(){let t=o(this,u).autoZoomThresholds,e=typeof t=="object"&&t!==null?{...t}:{},{indoorZoomThreshold:i,outdoorZoomThreshold:r}=Ao(o(this,l),e);o(this,u).indoorZoomThreshold=i,o(this,u).outdoorZoomThreshold=r,(e.expandMinZoom??!0)&&r<o(this,l).Camera.minZoomLevel&&o(this,l).Camera.setMinZoomLevel(r-no)},"#recalcThresholds"),tt=a(function(t,e){(o(this,u).indoorZoomThreshold!==t||o(this,u).outdoorZoomThreshold!==e)&&o(this,w).publish("zoom-threshold-change",{indoorZoomThreshold:o(this,u).indoorZoomThreshold,outdoorZoomThreshold:o(this,u).outdoorZoomThreshold})},"#publishThresholdChangeIfNeeded"),bt=a(function(){let t=o(this,C).internal.mvf?.enterprise?.layers??[],e={},i={};t.forEach(r=>{e[r.name]||(e[r.name]=[]),e[r.name].push(...r.spaces.map(({spaceId:n})=>n));for(let{spaceId:n}of r.spaces)i[n]==null&&(i[n]=[]),i[n].push(r.name)}),d(this,co,t.map(({name:r})=>r)),d(this,ho,i),d(this,fo,e)},"#setupLayers"),et=a(function(t){let e=[];for(let i of o(this,C).getByType("facade")){let r=o(this,S).get(i.floorStack.id);if(!r)continue;let n=Oo(r,t,o(this,T));n!=null&&Zo.Floor.is(n)&&e.push(n)}o(this,l).preloadFloors(e)},"#preloadFloors"),mo=new WeakMap,po=new WeakMap,go=new WeakMap,Fo=new WeakMap,bo=new WeakMap,oo=new WeakMap,ko=a(function(t,e,i,r=!1){t.forEach(n=>{if(n.floor)if(e){let m=i!==void 0&&!r?{...n.state,labels:{...n.state.labels,enabled:n.state.labels.enabled&&i},markers:{...n.state.markers,enabled:n.state.markers.enabled&&i},occlusion:{...n.state.occlusion,enabled:n.state.occlusion.enabled&&i}}:n.state;o(this,l).updateState(n.floor,m)}else o(this,l).updateState(n.floor,{visible:!1})})},"#updateFloorVisibility"),yt=a(async function(t,e,i,r){return F(this,p,ko).call(this,e.floorStates,!0,r,o(this,u).showLabelsAndMarkersOnAllVisibleFloors),t.animateFacade(i.state,o(this,u).indoorAnimationOptions)},"#animateIndoorSequence"),St=a(async function(t,e,i,r,n){let f=n;f&&F(this,p,ko).call(this,e.floorStates,!1,void 0,o(this,u).showLabelsAndMarkersOnAllVisibleFloors);let m=await t.animateFacade(i.state,o(this,u).outdoorAnimationOptions);return m.result==="completed"&&!f&&F(this,p,ko).call(this,e.floorStates,Ro({building:t,currentFloor:o(this,l).currentFloor,inRange:o(this,M)==="in-range",inFocus:o(this,$).has(t.id),mode:o(this,u).mode,elevation:o(this,T),inNavigation:r.includes(t.floorStack.id),dynamicBuildingInteriors:o(this,u).dynamicBuildingInteriors,forceInteriorsVisible:o(this,u).forceInteriorsVisible}),void 0,o(this,u).showLabelsAndMarkersOnAllVisibleFloors),m},"#animateOutdoorSequence"),A=new WeakMap,a(it,"DynamicFocus");var Mo=it;return kt($t);})();
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// Register the extension
|
|
16
|
-
if (window.bridge && window.bridge.extensions) {
|
|
17
|
-
try {
|
|
18
|
-
window.bridge.extensions.register({ name: 'dynamic-focus', package: { Extension: DynamicFocus.DynamicFocus } });
|
|
19
|
-
if (window.rnDebug) window.rnDebug('Extension: dynamic-focus registered');
|
|
20
|
-
} catch(e) {
|
|
21
|
-
if (window.rnDebug) window.rnDebug('Failed to register dynamic-focus extension: ' + e.message);
|
|
22
|
-
}
|
|
23
|
-
} else {
|
|
24
|
-
if (window.rnDebug) window.rnDebug('Bridge or extensions not available for registration');
|
|
25
|
-
}`;function S(){return j}l(S,"getRegistrationScript");function g(){R({extensionName:"dynamic-focus",getRegistrationScript:S,logger:F})}l(g,"useDynamicFocusRegistration");function b(o,i){if(typeof o!="string"||o.length===0)throw new Error("Event parameter must be a non-empty string");if(typeof i!="function")throw new Error("Callback parameter must be a function");const e=W(_),{extensions:s,mapData:t}=e;if(!t)throw new Error("Map data is not available");g();const f=(s?.["dynamic-focus"]?.registrationState||"unregistered")==="registered",a=A(c=>{try{let h=c;o==="focus"&&c.facades&&(h={...c,facades:v(t,c.facades)}),i(h)}catch(h){F.error(`Error in dynamic focus event callback for ${String(o)}:`,h)}},[o,t,i]);$({eventKey:`dynamic-focus:${String(o)}`,callback:a,setupScript:l(()=>G({extensionName:"dynamic-focus",eventName:String(o)}),"setupScript"),cleanupScript:l(()=>N({extensionName:"dynamic-focus",eventName:String(o)}),"cleanupScript"),shouldInject:f})}l(b,"useDynamicFocusEvent");function k(){const o=x(D),{bridge:i,extensions:e,updateExtensionState:s}=o;g();const t=e["dynamic-focus"],d=t?.registrationState||"unregistered",f=d==="registered",a=t?.isEnabled||!1,[c,h]=B(t?.focusedFacades||[]),w=C(e);w.current=e,b("focus",u(n=>{const m=n.facades;h(m),s("dynamic-focus",y=>({...y,registrationState:d,focusedFacades:m}))},[d,s]));const r=u(async(n,m=[])=>{if(!i?.isReady)throw new Error("Bridge is not ready. Ensure the WebView is loaded.");return await i.instruct({type:"extension",payload:{name:"dynamic-focus",method:n,args:m}})},[i]),E=u(async n=>{w.current?.["dynamic-focus"]?.isEnabled||(await r("enable",[n]),s("dynamic-focus",V=>({...V,isEnabled:!0})))},[r,s]),T=u(async n=>await r("updateState",[n]),[r]),M=u(async()=>await r("getState"),[r]),O=u(async n=>await r("focus",[n]),[r]),Z=u(async()=>{await r("disable"),h([]),s("dynamic-focus",{registrationState:"unregistered",isEnabled:!1,focusedFacades:[]})},[r,h,s]);return{isReady:f,isEnabled:a,focusedFacades:c,updateState:T,getState:M,focus:O,disable:Z,enable:E}}l(k,"useDynamicFocus");export{k as useDynamicFocus,b as useDynamicFocusEvent};
|
|
1
|
+
var C=Object.defineProperty,n=(e,s)=>C(e,"name",{value:s,configurable:!0});import{useState as B,useCallback as c,useContext as A,useRef as L}from"react";import{MappedinContext as x}from"@mappedin/react-native-sdk";import{useCallback as D,useContext as W}from"react";var _="[MappedinJS]",$={log:0,debug:0,info:1,warn:2,error:3,silent:4};function v(e){return $[e.toLowerCase()]}n(v,"parseLogLevel");function m(e="",{prefix:s=_}={}){const o=`${s}${e?`-${e}`:""}`,i=n((t,r)=>{if(typeof window<"u"&&window.rnDebug){const f=r.map(l=>l instanceof Error&&l.stack?`${l.message}
|
|
2
|
+
${l.stack}`:l);window.rnDebug(`${e} ${t}: ${f.join(" ")}`)}},"rnDebug");return{logState:1,debug(...t){this.logState<=0&&(console.debug(o,...t),i("debug",t))},log(...t){this.debug(...t)},info(...t){this.logState<=1&&(console.info(o,...t),i("info",t))},warn(...t){this.logState<=2&&(console.warn(o,...t),i("warn",t))},error(...t){this.logState<=3&&(console.error(o,...t),i("error",t))},assert(...t){console.assert(...t)},time(t){console.time(t)},timeEnd(t){console.timeEnd(t)},setLevel(t){const r=typeof t=="string"?v(t):t;if(r===void 0||!(r>=0&&r<=4)){console.warn(o,`setLevel: unknown log level "${t}"`);return}this.logState=r}}}n(m,"createLogger");var Y=m(),F=m("",{prefix:"[DynamicFocus]"});import{MappedinContext as N,useEventCallback as G,createEventSetupScript as R,createEventCleanupScript as j}from"@mappedin/react-native-sdk";function S(e,s){return s.map(o=>o&&o.id&&e.getById("facade",o.id)||o)}n(S,"hydrateFacades");import{useRegisterExtension as P}from"@mappedin/react-native-sdk";var q='\n // Define require function that uses bridge.modules for external dependencies\n globalThis.require = globalThis.require || ((id) => {\n if (window.bridge?.modules?.[id]) {\n return window.bridge.modules[id];\n }\n throw new Error(\'Module not found: \' + id);\n });\n \n"use strict";var DynamicFocus=(()=>{var eo=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var kt=Object.prototype.hasOwnProperty;var at=r=>{throw TypeError(r)};var Bt=(r,t,e)=>t in r?eo(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var a=(r,t)=>eo(r,"name",{value:t,configurable:!0}),Go=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error(\'Dynamic require of "\'+r+\'" is not supported\')});var Lt=(r,t)=>{for(var e in t)eo(r,e,{get:t[e],enumerable:!0})},Mt=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Dt(t))!kt.call(r,s)&&s!==e&&eo(r,s,{get:()=>t[s],enumerable:!(i=It(t,s))||i.enumerable});return r};var Zt=r=>Mt(eo({},"__esModule",{value:!0}),r);var b=(r,t,e)=>Bt(r,typeof t!="symbol"?t+"":t,e),Ro=(r,t,e)=>t.has(r)||at("Cannot "+e);var o=(r,t,e)=>(Ro(r,t,"read from private field"),e?e.call(r):t.get(r)),d=(r,t,e)=>t.has(r)?at("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),c=(r,t,e,i)=>(Ro(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e),F=(r,t,e)=>(Ro(r,t,"access private method"),e);var Ht={};Lt(Ht,{DynamicFocus:()=>Bo,calculateZoomThresholds:()=>Ao});var _o=Go("@mappedin/mappedin-js");function lt(r,t){if(r==null||t==null)return r===t;if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==t[e])return!1;return!0}a(lt,"arraysEqual");var Po=class Po{constructor(){b(this,"_subscribers",{});b(this,"_abortController",new AbortController)}get signal(){return this._abortController.signal}publish(t,e){!this._subscribers||!this._subscribers[t]||this.signal.aborted||this._subscribers[t].forEach(function(i){typeof i=="function"&&i(e)})}onAbort(t){this.signal.addEventListener("abort",()=>t(),{once:!0})}on(t,e,i){let s=i?.signal;if(s?.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(e);let n=a(()=>{this.off(t,e)},"cleanup");return s&&s.addEventListener("abort",n,{once:!0}),n}off(t,e){if(!this._subscribers||this._subscribers[t]==null||this.signal.aborted)return;let i=this._subscribers[t].indexOf(e);i!==-1&&this._subscribers[t].splice(i,1)}destroy(){this.signal.aborted||(this._subscribers={},this._abortController.abort())}};a(Po,"PubSub");var To=Po;var H=Go("@mappedin/mappedin-js");var A,io,N,v,T,D,W,q,Uo=class Uo{constructor(t,e){b(this,"__type","building");d(this,A);d(this,io,new Map);d(this,N,new Map);d(this,v,[]);d(this,T);d(this,D);b(this,"defaultFloor");b(this,"activeFloor");b(this,"excluded",!1);b(this,"aboveGroundFloors",[]);d(this,W);d(this,q);c(this,A,t),c(this,io,new Map(t.floors.map(s=>[s.id,s]))),c(this,N,new Map(t.floors.map(s=>[s.elevation,s]))),c(this,v,Array.from(o(this,N).values()).sort((s,n)=>s.elevation-n.elevation));let i=t.defaultFloor;if(!i)throw new Error(`Building created for floor stack "${t.id}" with no resolvable default floor`);this.defaultFloor=i,this.activeFloor=this.defaultFloor,c(this,T,e),this.aboveGroundFloors=o(this,v).filter(s=>s.elevation>=0)}get id(){return o(this,A).id}get name(){return o(this,A).name}get floors(){return o(this,A).floors}get floorStack(){return o(this,A)}get facade(){return o(this,A).facade}get isCurrentFloorStack(){return this.id===o(this,T).currentFloorStack.id}get isIndoor(){let t=o(this,T).getState(this.facade);return this.isCurrentFloorStack||t?.visible===!1&&t?.opacity===0}get canSetFloor(){return this.isIndoor||!this.excluded}get maxElevation(){return o(this,W)==null&&c(this,W,Math.max(...o(this,N).keys())),o(this,W)}get minElevation(){return o(this,q)==null&&c(this,q,Math.min(...o(this,N).keys())),o(this,q)}has(t){return H.Floor.is(t)?o(this,io).has(t.id):H.FloorStack.is(t)?t.id===o(this,A).id:H.Facade.is(t)?t.id===this.facade.id:!1}getFloorByElevation(t){return o(this,N).get(t)}getNearestFloorByElevation(t){let e=this.getFloorByElevation(t);if(e)return e;if(t>=0){if(t>this.maxElevation)return o(this,v)[o(this,v).length-1];for(let i=o(this,v).length-1;i>=0;i--){let s=o(this,v)[i];if(s.elevation<=t)return s}}else{if(t<this.minElevation)return o(this,v)[0];for(let i of o(this,v))if(i.elevation>=t)return i}}getHighestFloor(){return o(this,v)[o(this,v).length-1]}cancelAnimation(){o(this,D)&&(o(this,D).animation.cancel(),c(this,D,void 0))}async animateFacade(t,e={duration:150}){let i=o(this,D)?.state||o(this,T).getState(this.facade);if(!i||!t||i?.opacity===t.opacity&&i?.visible===t.visible)return{result:"completed"};this.cancelAnimation();let{opacity:s,visible:n}=t;if(o(this,T).updateState(this.facade,{visible:!0}),s!==void 0){c(this,D,{animation:o(this,T).animateState(this.facade,{opacity:s},{duration:e.duration}),state:t});let f=await o(this,D).animation;if(c(this,D,void 0),f.result==="cancelled")return f}return n===!1&&o(this,T).updateState(this.facade,{visible:n}),{result:"completed"}}destroy(){this.cancelAnimation(),o(this,A).floors.forEach(t=>{o(this,T).updateState(t,{visible:t.id===o(this,T).currentFloor.id})}),this.has(o(this,T).currentFloor)||o(this,T).updateState(this.facade,{visible:!0,opacity:1})}};A=new WeakMap,io=new WeakMap,N=new WeakMap,v=new WeakMap,T=new WeakMap,D=new WeakMap,W=new WeakMap,q=new WeakMap,a(Uo,"Building");var vo=Uo;function ut(r,t,e){return r>=t?"in-range":r<=e?"out-of-range":"transition"}a(ut,"getZoomState");function wo(r,t,e){if(r.__type==="outdoors"&&"floor"in r)return r.floor;let i=r;if(i.excluded)return i.activeFloor;switch(t){case"lock-elevation":return i.getFloorByElevation(e);case"nearest-elevation":return i.getNearestFloorByElevation(e);case"active-floor":return i.activeFloor;default:break}return i.isIndoor?i.activeFloor:i.defaultFloor}a(wo,"getFloorToShow");function _t(r,t,e,i){return i?{facade:r,state:{type:"facade",visible:!1,opacity:0}}:t?{facade:r,state:{type:"facade",visible:!1,opacity:0}}:e?{facade:r,state:{type:"facade",visible:!0,opacity:.2}}:{facade:r,state:{type:"facade",visible:!0,opacity:1}}}a(_t,"getFacadeState");function xt(r,t,e){return{outdoorOpacity:"initial",floorStates:r.floors.map(i=>{let n=i.id===t.id&&e;return{floor:i,state:{type:"floor",visible:n,geometry:{visible:n},labels:{enabled:n},markers:{enabled:n},footprint:{visible:!1},occlusion:{enabled:!1}}}})}}a(xt,"getSingleBuildingState");function dt(r,t){if(!t.includes("lock-elevation"))return"initial";for(let e of r)if(typeof e.outdoorOpacity=="number"&&e.outdoorOpacity>=0&&e.outdoorOpacity<=1)return e.outdoorOpacity;return"initial"}a(dt,"getOutdoorOpacity");function ct(r,t,e){switch(e){case"in-range":return r[0]?.canSetFloor?r[0]:void 0;case"out-of-range":return t;case"transition":default:return}}a(ct,"getSetFloorTargetFromZoomState");function ht(r){let{buildings:t,inViewSet:e,currentFloor:i,zoomState:s,mode:n,elevation:f,floorIdsInNavigation:p,floorStackIdsInNavigation:h,multiFloorView:g,getMultiFloorState:U,dynamicBuildingInteriors:V,isolateBelowGroundView:Y,currentElevation:bo,forceInteriorsVisible:to,getFloorStackAltitudeData:yo}=r,So=new Map,xo=Y&&bo<0&&s==="in-range";for(let y of t){let nt=e.has(y.id),Eo=xo&&y.minElevation>=0,wt=Eo?!1:nt,No=Eo?!1:$o({building:y,currentFloor:i,inRange:s==="in-range",inFocus:nt,mode:n,elevation:f,inNavigation:h.includes(y.id),dynamicBuildingInteriors:V,forceInteriorsVisible:to}),Co=i.floorStack.id===y.id?y.activeFloor:wo(y,n,f),Ot=g?.enabled?U(y.floors,Co||y.activeFloor,p,yo(y.id),{color:g?.footprintColor,spacesOpenToBelowEnabled:g?.spacesOpenToBelowEnabled,spacesOpenToBelowVisualEffectEnabled:g?.spacesOpenToBelowVisualEffectEnabled,spacesOpenToBelowVisualEffectDarkenAmount:g?.spacesOpenToBelowVisualEffectDarkenAmount,spacesOpenToBelowVisualEffectDarkenUseDepth:g?.spacesOpenToBelowVisualEffectDarkenUseDepth,spacesOpenToBelowVisualEffectDesaturateAmount:g?.spacesOpenToBelowVisualEffectDesaturateAmount,spacesOpenToBelowVisualEffectDesaturateUseDepth:g?.spacesOpenToBelowVisualEffectDesaturateUseDepth,spacesOpenToBelowVisualEffectWashOutAmount:g?.spacesOpenToBelowVisualEffectWashOutAmount,spacesOpenToBelowVisualEffectWashOutUseDepth:g?.spacesOpenToBelowVisualEffectWashOutUseDepth,opacity:g?.footprintOpacity,outline:g?.footprintOutline}):xt(y.floorStack,Co||y.activeFloor,No),Vt=Y&&bo<0&&s==="in-range",At=_t(y.facade,No,Vt,Eo);So.set(y.id,{building:y,showIndoor:No,floorStackState:Ot,facadeState:At,inFocus:wt,floorToShow:Co,isAboveGroundInIsolation:Eo})}return So}a(ht,"getBuildingStates");function ft(r,t){return r.excluded?"none":t?"indoor":"outdoor"}a(ft,"getBuildingAnimationType");function $o(r){let{building:t,currentFloor:e,inRange:i,inFocus:s,mode:n,elevation:f,inNavigation:p,dynamicBuildingInteriors:h,forceInteriorsVisible:g}=r;if(t.id===e.floorStack.id)return!0;if(t.excluded)return!1;if(g===!0||p===!0)return!0;if(!h)return e.floorStack.type!=="Outdoor";if(!i||!s)return!1;switch(n){case"lock-elevation":return t.getFloorByElevation(f)!=null;default:break}return!0}a($o,"shouldShowIndoor");function mt(r,t,e){return r!==t&&!e}a(mt,"shouldDeferSetFloor");var pt=["default-floor","active-floor","lock-elevation","nearest-elevation"];var Oo=Go("@mappedin/mappedin-js");var jo="[MappedinJS]";var Nt={log:0,debug:0,info:1,warn:2,error:3,silent:4};function Ct(r){return Nt[r.toLowerCase()]}a(Ct,"parseLogLevel");function zo(r="",{prefix:t=jo}={}){let e=`${t}${r?`-${r}`:""}`,i=a((s,n)=>{if(typeof window<"u"&&window.rnDebug){let f=n.map(p=>p instanceof Error&&p.stack?`${p.message}\n${p.stack}`:p);window.rnDebug(`${r} ${s}: ${f.join(" ")}`)}},"rnDebug");return{logState:1,debug(...s){this.logState<=0&&(console.debug(e,...s),i("debug",s))},log(...s){this.debug(...s)},info(...s){this.logState<=1&&(console.info(e,...s),i("info",s))},warn(...s){this.logState<=2&&(console.warn(e,...s),i("warn",s))},error(...s){this.logState<=3&&(console.error(e,...s),i("error",s))},assert(...s){console.assert(...s)},time(s){console.time(s)},timeEnd(s){console.timeEnd(s)},setLevel(s){let n=typeof s=="string"?Ct(s):s;if(n===void 0||!(n>=0&&n<=4)){console.warn(e,`setLevel: unknown log level "${s}"`);return}this.logState=n}}}a(zo,"createLogger");var Gt=zo();var K=Gt;function gt(r,t,e,i){return(r<t||r>e)&&K.warn(i),Math.min(e,Math.max(t,r))}a(gt,"clampWithWarning");function Yo(r,t){return!Oo.Floor.is(r)||r?.floorStack==null||!Oo.FloorStack.is(t)?!1:r.floorStack.id!==t.id?(K.warn(`Floor (${r.id}) does not belong to floor stack (${t.id}).`),!1):!0}a(Yo,"validateFloorForStack");function Wo(r,t,e,i){return gt(r,t,e,`${i} must be between ${t} and ${e}.`)}a(Wo,"validateZoomThreshold");var O=zo("",{prefix:"[DynamicFocus]"});var k,Q,so,qo,Ho=class Ho{constructor(t,e){d(this,so);b(this,"__type","outdoors");d(this,k);d(this,Q);c(this,k,t),c(this,Q,e)}get id(){return o(this,k).id}get floorStack(){return o(this,k)}get floor(){return o(this,k).defaultFloor}matchesFloorStack(t){return t===o(this,k)||t===o(this,k).id}show(){F(this,so,qo).call(this,!0)}hide(){F(this,so,qo).call(this,!1)}destroy(){this.matchesFloorStack(o(this,Q).currentFloorStack)||this.hide()}};k=new WeakMap,Q=new WeakMap,so=new WeakSet,qo=a(function(t){for(let e of o(this,k).floors)o(this,Q).updateState(e,{visible:t})},"#setVisible"),a(Ho,"Outdoors");var Vo=Ho;function Ft(r,t){let e=r.getByType("floor-stack"),i=e.find(n=>n.type?.toLowerCase()==="outdoor");if(i)return i;let s=e.find(n=>n.facade==null&&!t.has(n.id));return s||(O.warn("No good candidate for the outdoor floor stack was found. Using the first floor stack."),e[0])}a(Ft,"getOutdoorFloorStack");var ro={indoorZoomThreshold:18,outdoorZoomThreshold:17,setFloorOnFocus:!0,autoFocus:!1,indoorAnimationOptions:{duration:150},outdoorAnimationOptions:{duration:150},cameraLiftAnimationOptions:{duration:500,easing:"ease-in-out",interruptible:!0},autoAdjustFacadeHeights:!1,mode:"default-floor",preloadFloors:!0,dynamicBuildingInteriors:!0,dynamicLayers:[],isolateBelowGroundView:!1,forceInteriorsVisible:!1,showLabelsAndMarkersOnAllVisibleFloors:!1,autoZoomThresholds:!1},no=.2,Ko=.4;var Ao=a((r,t={})=>{let e={initialVisibility:t.initialVisibility??"indoor-first",debug:t.debug??!1},i=Rt(r,e);if(i===void 0)return O.error("No indoor floor stacks found. Cannot compute zoom thresholds. Set indoorZoomThreshold and outdoorZoomThreshold manually."),{indoorZoomThreshold:ro.indoorZoomThreshold,outdoorZoomThreshold:ro.outdoorZoomThreshold};let s=i+Ko,n=i+no;return e.initialVisibility==="indoor-first"&&(s=i-no,n=i-Ko),{indoorZoomThreshold:s,outdoorZoomThreshold:n}},"calculateZoomThresholds");function Rt(r,t){let i=r.getMapData().getByType("floor-stack").filter(f=>f.type!=="Outdoor"),s=1/0,n;for(let f of i){let p=r.Camera.getFocusOnTransform(f).zoomLevel??1/0;p<s&&(s=p,n=f)}if(s!==1/0)return t.debug&&n&&r.Camera.getFocusOnTransform(n,{debugColor:"blue"}),s}a(Rt,"getDefaultZoomLevel");function Pt(r,t){return`${t} ${r}`}a(Pt,"formatMessage");var Qo=class Qo extends Error{constructor(t,e=jo){super(Pt(t,e)),this.name="MappedinError"}};a(Qo,"MappedinError");var Io=Qo;var Ut=a(r=>r,"linearEase"),$t=a(r=>r*r,"quadEaseIn"),jt=a(r=>1-Math.cos(r*Math.PI/2),"easeIn"),zt=a(r=>1-(1-r)*(1-r),"quadEaseOut"),Yt=a(r=>1-Math.pow(1-r,3),"cubicEaseOut"),Wt={linear:Ut,"ease-in":$t,"ease-out":zt,"ease-in-out":jt,"ease-out-cubic":Yt};function qt(r,t){let e=0;if(t.length<2)return e;let s=t[0]<t[1]?(n,f)=>n>f:(n,f)=>n<f;for(;e<t.length-1&&s(r,t[e+1]);)e++;return e>t.length-2?Math.max(0,t.length-2):e}a(qt,"getInterpolationBreakpoint");function bt(r,t,e,i="ease-in"){if(t.length!==e.length)throw new Io("Input and output ranges must have the same number of values.");r=Math.max(t[0],Math.min(r,t[t.length-1]));let s=qt(r,t),n=(r-t[s])/(t[s+1]-t[s]),f=typeof i=="function"?i(n):Wt[i](n);return e[s]+f*(e[s+1]-e[s])}a(bt,"interpolateMulti");var B,ao,lo,M,uo,Xo=class Xo{constructor(t,e,i){b(this,"layers");b(this,"visible");d(this,B);d(this,ao,[]);d(this,lo,!1);d(this,M,new Map);b(this,"interpolationFn");d(this,uo,1);this.layers=t,this.visible=e,c(this,B,i)}processLayerGroup(t,e){o(this,lo)||(this.layers.forEach(i=>{let s=t[i];s&&o(this,ao).push(...s)}),c(this,lo,!0),this.visible&&(this.interpolationFn=i=>{let{outdoorZoomThreshold:s,indoorZoomThreshold:n}=e();return bt(i,[s,n],[1,0])}))}setOpacity(t){c(this,uo,t);for(let e of o(this,ao))if(e.startsWith("img_")){let i=o(this,B).Image3D.getById(e);if(i){let s=o(this,B).getState(i.image);o(this,M).has(e)||o(this,M).set(e,s?.opacity??1);let n=Math.min(o(this,M).get(e),t);o(this,B).updateState(i.image,{opacity:n})}}else{let i=o(this,B).getMapData()?.getById("space",e);if(!i)continue;let s=o(this,B).getState(i);o(this,M).has(e)||o(this,M).set(e,s?.opacity??1);let n=Math.min(o(this,M).get(e),t);o(this,B).updateState(i,{opacity:n,visible:n>0})}}get opacity(){return o(this,uo)}};B=new WeakMap,ao=new WeakMap,lo=new WeakMap,M=new WeakMap,uo=new WeakMap,a(Xo,"LayerGroup");var Do=Xo;function Jo(r,t,e){r.forEach(i=>{if(e?.forceOpacity!==void 0){i.setOpacity(e.forceOpacity),i.visible=e.forceOpacity===1;return}if(i.interpolationFn!=null){let s=i.interpolationFn(t);s!=null&&(i.setOpacity(s),i.visible=s===1)}})}a(Jo,"runLayerGroupInterpolations");var w,l,C,u,$,j,S,Z,z,_,E,J,co,ho,fo,L,G,X,x,R,P,m,ot,yt,tt,et,it,St,st,mo,Et,Lo,Mo,Zo,po,go,Fo,oo,ko,Tt,vt,I,rt=class rt{constructor(t){d(this,m);d(this,w);d(this,l);d(this,C);d(this,u,ro);d(this,$,[]);d(this,j,new Set);d(this,S,new Map);d(this,Z);d(this,z,!1);d(this,_,!1);d(this,E,0);d(this,J,0);d(this,co,[]);d(this,ho,{});d(this,fo,{});d(this,L,"transition");d(this,G,"outdoor");d(this,X,[]);d(this,x,!1);d(this,R,[]);d(this,P,null);b(this,"sceneUpdateQueue",Promise.resolve());b(this,"on",a((t,e)=>{o(this,w).on(t,e)},"on"));b(this,"off",a((t,e)=>{o(this,w).off(t,e)},"off"));d(this,mo,a(t=>{if(!this.isEnabled)return;let{facades:e}=t;if(lt(e,this.focusedFacades)&&o(this,G)==="transition"&&!o(this,_))return;c(this,_,!1),c(this,$,[]),o(this,j).clear();let i=o(this,u).isolateBelowGroundView&&o(this,E)<0;if(e.length>0)for(let s of e){let n=o(this,S).get(s.floorStack.id);if(n){if(i&&n.minElevation>=0)continue;o(this,j).add(n.id),o(this,$).push(n)}}o(this,u).autoFocus&&this.focus()},"#handleFacadesInViewChange"));d(this,Lo,a((t,e)=>{if(!this.isEnabled)return;let i=o(this,S).get(t.floorStack.id);i&&(e.reason==="dynamic-focus"&&o(this,u).mode==="active-floor"||(i.activeFloor=t));let s=o(this,u).isolateBelowGroundView&&o(this,E)<0;i?.excluded===!1&&!o(this,Z).matchesFloorStack(t.floorStack)&&c(this,E,t.elevation);let n=o(this,u).isolateBelowGroundView&&o(this,E)<0,f=s&&!n;if(e.reason==="dynamic-focus")return;let p=F(this,m,Et).call(this),h=o(this,Mo).call(this,t,e,f,p);if(p)return h;h.catch(g=>{O.error("setFloor override work failed after sync floor-change commit",g)})},"#setFloorHandler"));d(this,Mo,a(async(t,e,i,s)=>{if(i){if(c(this,_,!0),o(this,l).Camera.updateFacadesInView(),!o(this,u).autoFocus){if(await o(this,I).call(this,t),!this.isEnabled||e.signal.aborted)return;o(this,w).publish("focus",{facades:this.focusedFacades})}}else{if(await o(this,I).call(this,t),!this.isEnabled||e.signal.aborted)return;o(this,w).publish("focus",{facades:this.focusedFacades})}s&&this.isEnabled&&!e.signal.aborted&&await o(this,Zo).call(this,t)},"#runFloorChangeWork"));d(this,Zo,a(t=>{let e=o(this,l).getFloorStackAltitudeData(t.floorStack).get(t.elevation)?.altitude;if(typeof e=="number"&&o(this,l).Camera.elevation!==e)return o(this,l).Camera.animateElevation(e,o(this,u).cameraLiftAnimationOptions)},"#liftCameraToFloorAltitude"));d(this,po,a(()=>{c(this,z,!0)},"#handleUserInteractionStart"));d(this,go,a(()=>{c(this,z,!1)},"#handleUserInteractionEnd"));d(this,Fo,a(()=>{o(this,I).call(this)},"#handleGlobalStateChange"));d(this,oo,a(t=>{if(!this.isEnabled)return;let{zoomLevel:e}=t,i=ut(e,o(this,u).indoorZoomThreshold,o(this,u).outdoorZoomThreshold);o(this,L)!==i&&(c(this,L,i),i==="in-range"?this.setIndoor():i==="out-of-range"&&this.setOutdoor());let s=(o(this,l).Navigation?.floors?.length??0)>0;Jo(o(this,R),e,s?{forceOpacity:0}:void 0)},"#handleCameraChange"));d(this,I,a(async t=>{if(!this.isEnabled)return;let e=t||o(this,l).currentFloor,i=o(this,l).getGlobalState().multiFloorView,s=o(this,l).options.multiFloorView?{...o(this,l).options.multiFloorView,...i}:o(this,l).options.multiFloorView,n=o(this,l).Navigation?.floors?.map(h=>h.id)||[],f=o(this,l).Navigation?.floorStacks.map(h=>h.id)||[],p=new Promise(async h=>{await this.sceneUpdateQueue;let g=ht({buildings:Array.from(o(this,S).values()),inViewSet:o(this,j),currentFloor:e,zoomState:o(this,L),mode:o(this,u).mode,elevation:o(this,E),floorIdsInNavigation:n,floorStackIdsInNavigation:f,multiFloorView:s,getMultiFloorState:o(this,u).customMultiFloorVisibilityState??_o.getMultiFloorState,dynamicBuildingInteriors:o(this,u).dynamicBuildingInteriors,isolateBelowGroundView:o(this,u).isolateBelowGroundView,currentElevation:o(this,E),forceInteriorsVisible:o(this,u).forceInteriorsVisible,getFloorStackAltitudeData:a(V=>o(this,l).getFloorStackAltitudeData(V),"getFloorStackAltitudeData")}),U=[];await Promise.all(Array.from(g.values()).map(async V=>{let{building:Y,showIndoor:bo,floorStackState:to,facadeState:yo,inFocus:So,isAboveGroundInIsolation:xo}=V;U.push(to);let y=ft(Y,bo);if(y==="indoor")return F(this,m,Tt).call(this,Y,to,yo,So);if(y==="outdoor")return F(this,m,vt).call(this,Y,to,yo,f,xo)})),o(this,l).Outdoor.setOpacity(dt(U,o(this,u).mode)),c(this,X,o(this,$).filter(V=>g.get(V.id)?.showIndoor===!0).map(V=>V.facade)),o(this,w).publish("focus",{facades:o(this,X)}),h()});return this.sceneUpdateQueue=p,p},"#applyBuildingStates"));c(this,w,new To),c(this,l,t),O.setLevel(K.logState),c(this,C,o(this,l).getMapData()),c(this,E,o(this,l).currentFloor.elevation),c(this,J,o(this,l).Camera.elevation);for(let e of o(this,C).getByType("facade")){let{floorStack:i}=e;if(i.floors.length===0||i.defaultFloor==null){O.warn(`Skipping building for floor stack "${i.id}" because it has no floors. It will not participate in Dynamic Focus.`);continue}o(this,S).set(i.id,new vo(i,o(this,l)))}F(this,m,St).call(this),c(this,Z,new Vo(Ft(o(this,C),o(this,S)),o(this,l))),o(this,l).on("camera-change",o(this,oo)),o(this,l).on("facades-in-view-change",o(this,mo)),o(this,l).on("user-interaction-start",o(this,po)),o(this,l).on("user-interaction-end",o(this,go)),o(this,l).on("global-state-change",o(this,Fo))}enable(t){if(o(this,x)){O.warn("enable() called on an already enabled Dynamic Focus instance.");return}c(this,x,!0),o(this,l).__EXPERIMENTAL__overrideSetFloorHandler(o(this,Lo)),o(this,Z).show();let e={...o(this,u),...t};e.autoZoomThresholds&&(t?.autoZoomThresholds&&(t.indoorZoomThreshold!=null||t.outdoorZoomThreshold!=null)&&O.warn("Manual indoorZoomThreshold/outdoorZoomThreshold values are ignored while autoZoomThresholds is enabled."),delete e.indoorZoomThreshold,delete e.outdoorZoomThreshold),this.updateState(e),F(this,m,yt).call(this),o(this,oo).call(this,{zoomLevel:o(this,l).Camera.zoomLevel,center:o(this,l).Camera.center,bearing:o(this,l).Camera.bearing,pitch:o(this,l).Camera.pitch}),o(this,l).Camera.updateFacadesInView()}disable(){if(!o(this,x)){O.warn("disable() called on an already disabled Dynamic Focus instance.");return}c(this,x,!1),o(this,l).__EXPERIMENTAL__overrideSetFloorHandler(void 0)}get isEnabled(){return o(this,x)}get isIndoor(){return o(this,G)==="indoor"}get isOutdoor(){return o(this,G)==="outdoor"}get outdoorsFloorStack(){return o(this,Z).floorStack}get layers(){return o(this,co)}get layersBySpaceId(){return o(this,ho)}setIndoor(){c(this,G,"indoor"),c(this,L,"in-range"),F(this,m,ot).call(this)}setOutdoor(){c(this,G,"outdoor"),c(this,L,"out-of-range"),F(this,m,ot).call(this)}get focusedFacades(){return[...o(this,X)]}getState(){return{...o(this,u)}}updateState(t){let e=!1,i=o(this,u).indoorZoomThreshold,s=o(this,u).outdoorZoomThreshold,n=o(this,u).isolateBelowGroundView&&o(this,E)<0,f=!!o(this,u).autoZoomThresholds,p=t.autoZoomThresholds!=null?!!t.autoZoomThresholds:f,h=t;if(p&&(h.indoorZoomThreshold!=null||h.outdoorZoomThreshold!=null)){O.warn("Manual indoorZoomThreshold/outdoorZoomThreshold values are ignored while autoZoomThresholds is enabled.");let{indoorZoomThreshold:g,outdoorZoomThreshold:U,...V}=h;h=V}if(!f&&p?(c(this,P,()=>{if(!o(this,x))return;let g=o(this,u).indoorZoomThreshold,U=o(this,u).outdoorZoomThreshold;F(this,m,et).call(this),F(this,m,it).call(this,g,U),o(this,I).call(this)}),o(this,l).on("camera-screen-offsets-change",o(this,P))):f&&!p&&F(this,m,tt).call(this),h.indoorZoomThreshold!=null&&(h.indoorZoomThreshold=Wo(h.indoorZoomThreshold,h?.outdoorZoomThreshold??o(this,u).outdoorZoomThreshold,o(this,l).Camera.maxZoomLevel,"indoorZoomThreshold"),e=!0),h.outdoorZoomThreshold!=null&&(h.outdoorZoomThreshold=Wo(h.outdoorZoomThreshold,o(this,l).Camera.minZoomLevel,h?.indoorZoomThreshold??o(this,u).indoorZoomThreshold,"outdoorZoomThreshold"),e=!0),h.mode!=null&&(h.mode=pt.includes(h.mode)?h.mode:"default-floor"),h.autoAdjustFacadeHeights!=null&&(o(this,u).autoAdjustFacadeHeights=h.autoAdjustFacadeHeights),h.dynamicBuildingInteriors!=null&&h.dynamicBuildingInteriors!==o(this,u).dynamicBuildingInteriors&&(e=!0),h.isolateBelowGroundView!=null&&h.isolateBelowGroundView!==o(this,u).isolateBelowGroundView&&(e=!0),h.forceInteriorsVisible!=null&&h.forceInteriorsVisible!==o(this,u).forceInteriorsVisible&&(e=!0),h.showLabelsAndMarkersOnAllVisibleFloors!=null&&h.showLabelsAndMarkersOnAllVisibleFloors!==o(this,u).showLabelsAndMarkersOnAllVisibleFloors&&(e=!0),h.cameraLiftAnimationOptions!=null&&(h={...h,cameraLiftAnimationOptions:{...o(this,u).cameraLiftAnimationOptions,...h.cameraLiftAnimationOptions}}),c(this,u,Object.assign({},o(this,u),Object.fromEntries(Object.entries(h).filter(([,g])=>g!=null)))),p&&h.autoZoomThresholds!==void 0&&(F(this,m,et).call(this),e=!0),h.mode!=null&&h.preloadFloors&&F(this,m,st).call(this,h.mode),e){let g=o(this,u).isolateBelowGroundView&&o(this,E)<0;n&&!g?(c(this,_,!0),o(this,l).Camera.updateFacadesInView(),o(this,u).autoFocus||o(this,I).call(this)):o(this,I).call(this)}F(this,m,it).call(this,i,s)}destroy(){this.disable(),F(this,m,tt).call(this),o(this,l).off("facades-in-view-change",o(this,mo)),o(this,l).off("camera-change",o(this,oo)),o(this,l).off("user-interaction-start",o(this,po)),o(this,l).off("user-interaction-end",o(this,go)),o(this,l).off("global-state-change",o(this,Fo)),o(this,S).forEach(t=>t.destroy()),o(this,Z).destroy(),o(this,w).destroy(),c(this,R,[])}async focus(t=o(this,u).setFloorOnFocus){let e;if(t)if(mt(o(this,J),o(this,l).Camera.elevation,o(this,z)))c(this,J,o(this,l).Camera.elevation),c(this,_,!0);else{let i=ct(o(this,$),o(this,Z),o(this,L)),s=i?wo(i,o(this,u).mode,o(this,E)):void 0;s&&s.id!==o(this,l).currentFloor.id&&(e=s,o(this,l).setFloor(s,{context:"dynamic-focus"}))}await o(this,I).call(this,e),o(this,w).publish("focus",{facades:this.focusedFacades})}preloadFloors(){F(this,m,st).call(this,o(this,u).mode)}setDefaultFloorForStack(t,e){if(!Yo(e,t))return;let i=o(this,S).get(t.id);i&&(i.defaultFloor=e)}resetDefaultFloorForStack(t){let e=o(this,S).get(t.id),i=t.defaultFloor;e&&i&&(e.defaultFloor=i)}getDefaultFloorForStack(t){return o(this,S).get(t.id)?.defaultFloor||t.defaultFloor||t.floors[0]}setCurrentFloorForStack(t,e){if(!Yo(e,t))return;let i=o(this,S).get(t.id);i&&(i.activeFloor=e,o(this,I).call(this))}exclude(t){let e=Array.isArray(t)?t:[t];for(let i of e){let s=o(this,S).get(i.id);s&&(s.excluded=!0)}}include(t){let e=Array.isArray(t)?t:[t];for(let i of e){let s=o(this,S).get(i.id);s&&(s.excluded=!1)}}getCurrentFloorForStack(t){return o(this,S).get(t.id)?.activeFloor||this.getDefaultFloorForStack(t)}};w=new WeakMap,l=new WeakMap,C=new WeakMap,u=new WeakMap,$=new WeakMap,j=new WeakMap,S=new WeakMap,Z=new WeakMap,z=new WeakMap,_=new WeakMap,E=new WeakMap,J=new WeakMap,co=new WeakMap,ho=new WeakMap,fo=new WeakMap,L=new WeakMap,G=new WeakMap,X=new WeakMap,x=new WeakMap,R=new WeakMap,P=new WeakMap,m=new WeakSet,ot=a(function(){o(this,u).autoFocus&&(o(this,z)?this.focus():c(this,_,!0)),o(this,w).publish("state-change")},"#handleViewStateChange"),yt=a(function(){c(this,R,[]);for(let e of o(this,u).dynamicLayers){let i=new Do([e],!0,o(this,l));i.processLayerGroup(o(this,fo),()=>o(this,u)),o(this,R).push(i)}let t=(o(this,l).Navigation?.floors?.length??0)>0;Jo(o(this,R),o(this,l).Camera.zoomLevel,t?{forceOpacity:0}:void 0)},"#initializeLayerGroups"),tt=a(function(){o(this,P)&&(o(this,l).off("camera-screen-offsets-change",o(this,P)),c(this,P,null))},"#unsubscribeScreenOffsets"),et=a(function(){let t=o(this,u).autoZoomThresholds,e=typeof t=="object"&&t!==null?{...t}:{},{indoorZoomThreshold:i,outdoorZoomThreshold:s}=Ao(o(this,l),e);o(this,u).indoorZoomThreshold=i,o(this,u).outdoorZoomThreshold=s,(e.expandMinZoom??!0)&&s<o(this,l).Camera.minZoomLevel&&o(this,l).Camera.setMinZoomLevel(s-no)},"#recalcThresholds"),it=a(function(t,e){(o(this,u).indoorZoomThreshold!==t||o(this,u).outdoorZoomThreshold!==e)&&o(this,w).publish("zoom-threshold-change",{indoorZoomThreshold:o(this,u).indoorZoomThreshold,outdoorZoomThreshold:o(this,u).outdoorZoomThreshold})},"#publishThresholdChangeIfNeeded"),St=a(function(){let t=o(this,C).internal.mvf?.enterprise?.layers??[],e={},i={};t.forEach(s=>{e[s.name]||(e[s.name]=[]),e[s.name].push(...s.spaces.map(({spaceId:n})=>n));for(let{spaceId:n}of s.spaces)i[n]==null&&(i[n]=[]),i[n].push(s.name)}),c(this,co,t.map(({name:s})=>s)),c(this,ho,i),c(this,fo,e)},"#setupLayers"),st=a(function(t){let e=[];for(let i of o(this,C).getByType("facade")){let s=o(this,S).get(i.floorStack.id);if(!s)continue;let n=wo(s,t,o(this,E));n!=null&&_o.Floor.is(n)&&e.push(n)}o(this,l).preloadFloors(e)},"#preloadFloors"),mo=new WeakMap,Et=a(function(){let{multiFloorView:t}=o(this,l).options;return!!t?.enabled&&!!t?.updateCameraElevationOnFloorChange},"#shouldAwaitFloorChangeCommit"),Lo=new WeakMap,Mo=new WeakMap,Zo=new WeakMap,po=new WeakMap,go=new WeakMap,Fo=new WeakMap,oo=new WeakMap,ko=a(function(t,e,i,s=!1){t.forEach(n=>{if(n.floor)if(e){let p=i!==void 0&&!s?{...n.state,labels:{...n.state.labels,enabled:n.state.labels.enabled&&i},markers:{...n.state.markers,enabled:n.state.markers.enabled&&i},occlusion:{...n.state.occlusion,enabled:n.state.occlusion.enabled&&i}}:n.state;o(this,l).updateState(n.floor,p)}else o(this,l).updateState(n.floor,{visible:!1})})},"#updateFloorVisibility"),Tt=a(async function(t,e,i,s){return F(this,m,ko).call(this,e.floorStates,!0,s,o(this,u).showLabelsAndMarkersOnAllVisibleFloors),t.animateFacade(i.state,o(this,u).indoorAnimationOptions)},"#animateIndoorSequence"),vt=a(async function(t,e,i,s,n){let f=n;f&&F(this,m,ko).call(this,e.floorStates,!1,void 0,o(this,u).showLabelsAndMarkersOnAllVisibleFloors);let p=await t.animateFacade(i.state,o(this,u).outdoorAnimationOptions);return p.result==="completed"&&!f&&F(this,m,ko).call(this,e.floorStates,$o({building:t,currentFloor:o(this,l).currentFloor,inRange:o(this,L)==="in-range",inFocus:o(this,j).has(t.id),mode:o(this,u).mode,elevation:o(this,E),inNavigation:s.includes(t.floorStack.id),dynamicBuildingInteriors:o(this,u).dynamicBuildingInteriors,forceInteriorsVisible:o(this,u).forceInteriorsVisible}),void 0,o(this,u).showLabelsAndMarkersOnAllVisibleFloors),p},"#animateOutdoorSequence"),I=new WeakMap,a(rt,"DynamicFocus");var Bo=rt;return Zt(Ht);})();\n\n\n// Register the extension\nif (window.bridge && window.bridge.extensions) {\n try {\n window.bridge.extensions.register({ name: \'dynamic-focus\', package: { Extension: DynamicFocus.DynamicFocus } });\n if (window.rnDebug) window.rnDebug(\'Extension: dynamic-focus registered\');\n } catch(e) {\n if (window.rnDebug) window.rnDebug(\'Failed to register dynamic-focus extension: \' + e.message);\n }\n} else {\n if (window.rnDebug) window.rnDebug(\'Bridge or extensions not available for registration\');\n}';function k(){return q}n(k,"getRegistrationScript");function g(){P({extensionName:"dynamic-focus",getRegistrationScript:k,logger:F})}n(g,"useDynamicFocusRegistration");function b(e,s){if(typeof e!="string"||e.length===0)throw new Error("Event parameter must be a non-empty string");if(typeof s!="function")throw new Error("Callback parameter must be a function");const o=W(N),{extensions:i,mapData:t}=o;if(!t)throw new Error("Map data is not available");g();const f=(i?.["dynamic-focus"]?.registrationState||"unregistered")==="registered",l=D(d=>{try{let u=d;e==="focus"&&d.facades&&(u={...d,facades:S(t,d.facades)}),s(u)}catch(u){F.error(`Error in dynamic focus event callback for ${String(e)}:`,u)}},[e,t,s]);G({eventKey:`dynamic-focus:${String(e)}`,callback:l,setupScript:n(()=>R({extensionName:"dynamic-focus",eventName:String(e)}),"setupScript"),cleanupScript:n(()=>j({extensionName:"dynamic-focus",eventName:String(e)}),"cleanupScript"),shouldInject:f})}n(b,"useDynamicFocusEvent");function E(){const e=A(x),{bridge:s,extensions:o,updateExtensionState:i}=e;g();const t=o["dynamic-focus"],r=t?.registrationState||"unregistered",f=r==="registered",l=t?.isEnabled||!1,[d,u]=B(t?.focusedFacades||[]),w=L(o);w.current=o,b("focus",c(h=>{const p=h.facades;u(p),i("dynamic-focus",y=>({...y,registrationState:r,focusedFacades:p}))},[r,i]));const a=c(async(h,p=[])=>{if(!s?.isReady)throw new Error("Bridge is not ready. Ensure the WebView is loaded.");return await s.instruct({type:"extension",payload:{name:"dynamic-focus",method:h,args:p}})},[s]),T=c(async h=>{w.current?.["dynamic-focus"]?.isEnabled||(await a("enable",[h]),i("dynamic-focus",V=>({...V,isEnabled:!0})))},[a,i]),M=c(async h=>await a("updateState",[h]),[a]),O=c(async()=>await a("getState"),[a]),I=c(async h=>await a("focus",[h]),[a]),Z=c(async()=>{await a("disable"),u([]),i("dynamic-focus",{registrationState:"unregistered",isEnabled:!1,focusedFacades:[]})},[a,u,i]);return{isReady:f,isEnabled:l,focusedFacades:d,updateState:M,getState:O,focus:I,disable:Z,enable:T}}n(E,"useDynamicFocus");export{E as useDynamicFocus,b as useDynamicFocusEvent};
|
package/lib/rn/logger.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export declare const Logger: {
|
|
2
2
|
logState: import("@mappedin/mappedin-js").E_SDK_LOG_LEVEL;
|
|
3
|
+
debug(...args: any[]): void;
|
|
3
4
|
log(...args: any[]): void;
|
|
5
|
+
info(...args: any[]): void;
|
|
4
6
|
warn(...args: any[]): void;
|
|
5
7
|
error(...args: any[]): void;
|
|
6
8
|
assert(...args: any[]): void;
|
|
7
9
|
time(label: string): void;
|
|
8
10
|
timeEnd(label: string): void;
|
|
9
|
-
setLevel(level: import("@mappedin/mappedin-js").E_SDK_LOG_LEVEL): void;
|
|
11
|
+
setLevel(level: import("@mappedin/mappedin-js").E_SDK_LOG_LEVEL | import("@mappedin/mappedin-js").TLogLevelName): void;
|
|
10
12
|
};
|
package/lib/rn/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Facade, Floor, FootprintConfig, TFacadeState, TFloorAltitudeData, VisibilityState as BuildingFloorStackState } from '@mappedin/mappedin-js';
|
|
1
|
+
import type { Facade, Floor, FootprintConfig, TCameraAnimationOptions, TFacadeState, TFloorAltitudeData, VisibilityState as BuildingFloorStackState } from '@mappedin/mappedin-js';
|
|
2
2
|
import { Building } from './building';
|
|
3
3
|
import type { CalculateZoomThresholdsOptions } from './zoom-thresholds';
|
|
4
4
|
export type MultiFloorVisibilityState = (floors: Floor[], currentFloor: Floor, floorIdsInNavigation: Floor['id'][], floorsVisualHeightMap: Map<number, TFloorAltitudeData>, footprintConfig?: Partial<FootprintConfig>) => BuildingFloorStackState;
|
|
@@ -60,6 +60,13 @@ export type DynamicFocusState = {
|
|
|
60
60
|
* Options for the animation when fading in the facade to hide the interior.
|
|
61
61
|
*/
|
|
62
62
|
outdoorAnimationOptions: DynamicFocusAnimationOptions;
|
|
63
|
+
/**
|
|
64
|
+
* Camera animation options for the elevation lift triggered on floor change
|
|
65
|
+
* when `multiFloorView.updateCameraElevationOnFloorChange` is enabled.
|
|
66
|
+
* Forwarded to `mapView.Camera.animateElevation`.
|
|
67
|
+
* @default { duration: 500, easing: 'ease-in-out', interruptible: true }
|
|
68
|
+
*/
|
|
69
|
+
cameraLiftAnimationOptions: TCameraAnimationOptions;
|
|
63
70
|
/**
|
|
64
71
|
* The mode of the Dynamic Focus controller.
|
|
65
72
|
* @default 'default-floor'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mappedin/dynamic-focus",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.24.0-beta.0",
|
|
4
4
|
"homepage": "https://developer.mappedin.com/",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "lib/esm/index.js",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": ">=16.8.0",
|
|
40
|
-
"@mappedin/react-native-sdk": "^6.
|
|
41
|
-
"@mappedin/mappedin-js": "^6.
|
|
42
|
-
"@mappedin/react-sdk": "^6.
|
|
40
|
+
"@mappedin/react-native-sdk": "^6.24.0",
|
|
41
|
+
"@mappedin/mappedin-js": "^6.24.0",
|
|
42
|
+
"@mappedin/react-sdk": "^6.24.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"@mappedin/react-sdk": {
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var Xo=Object.defineProperty;var ot=r=>{throw TypeError(r)};var Tt=(r,t,e)=>t in r?Xo(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var a=(r,t)=>Xo(r,"name",{value:t,configurable:!0});var y=(r,t,e)=>Tt(r,typeof t!="symbol"?t+"":t,e),Mo=(r,t,e)=>t.has(r)||ot("Cannot "+e);var o=(r,t,e)=>(Mo(r,t,"read from private field"),e?e.call(r):t.get(r)),c=(r,t,e)=>t.has(r)?ot("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),d=(r,t,e,i)=>(Mo(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e),F=(r,t,e)=>(Mo(r,t,"access private method"),e);var S={env:{NODE_ENV:"production",npm_package_version:"6.22.0-beta.0"}};var eo={indoorZoomThreshold:18,outdoorZoomThreshold:17,setFloorOnFocus:!0,autoFocus:!1,indoorAnimationOptions:{duration:150},outdoorAnimationOptions:{duration:150},autoAdjustFacadeHeights:!1,mode:"default-floor",preloadFloors:!0,dynamicBuildingInteriors:!0,dynamicLayers:[],isolateBelowGroundView:!1,forceInteriorsVisible:!1,showLabelsAndMarkersOnAllVisibleFloors:!1,autoZoomThresholds:!1},io=.2,Zo=.4;var xo="[MappedinJS]";function Lo(r="",{prefix:t=xo}={}){let e=`${t}${r?`-${r}`:""}`,i=a((s,n)=>{if(typeof window<"u"&&window.rnDebug){let f=n.map(m=>m instanceof Error&&m.stack?`${m.message}
|
|
2
|
-
${m.stack}`:m);window.rnDebug(`${r} ${s}: ${f.join(" ")}`)}},"rnDebug");return{logState:S.env.NODE_ENV==="test"?3:0,log(...s){this.logState<=0&&(console.log(e,...s),i("log",s))},warn(...s){this.logState<=1&&(console.warn(e,...s),i("warn",s))},error(...s){this.logState<=2&&(console.error(e,...s),i("error",s))},assert(...s){console.assert(...s)},time(s){console.time(s)},timeEnd(s){console.timeEnd(s)},setLevel(s){0<=s&&s<=3&&(this.logState=s)}}}a(Lo,"createLogger");var wt=Lo();var W=wt;var I=Lo("",{prefix:"[DynamicFocus]"});var tt=a((r,t={})=>{let e={initialVisibility:t.initialVisibility??"indoor-first",debug:t.debug??!1},i=Ot(r,e);if(i===void 0)return I.error("No indoor floor stacks found. Cannot compute zoom thresholds. Set indoorZoomThreshold and outdoorZoomThreshold manually."),{indoorZoomThreshold:eo.indoorZoomThreshold,outdoorZoomThreshold:eo.outdoorZoomThreshold};let s=i+Zo,n=i+io;return e.initialVisibility==="indoor-first"&&(s=i-io,n=i-Zo),{indoorZoomThreshold:s,outdoorZoomThreshold:n}},"calculateZoomThresholds");function Ot(r,t){let i=r.getMapData().getByType("floor-stack").filter(f=>f.type!=="Outdoor"),s=1/0,n;for(let f of i){let m=r.Camera.getFocusOnTransform(f).zoomLevel??1/0;m<s&&(s=m,n=f)}if(s!==1/0)return t.debug&&n&&r.Camera.getFocusOnTransform(n,{debugColor:"blue"}),s}a(Ot,"getDefaultZoomLevel");import{Floor as Rt,getMultiFloorState as Ut}from"@mappedin/mappedin-js";function et(r,t){if(r==null||t==null)return r===t;if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==t[e])return!1;return!0}a(et,"arraysEqual");var _o=class _o{_subscribers={};_abortController=new AbortController;get signal(){return this._abortController.signal}publish(t,e){!this._subscribers||!this._subscribers[t]||this.signal.aborted||this._subscribers[t].forEach(function(i){typeof i=="function"&&i(e)})}onAbort(t){this.signal.addEventListener("abort",()=>t(),{once:!0})}on(t,e,i){let s=i?.signal;if(s?.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(e);let n=a(()=>{this.off(t,e)},"cleanup");return s&&s.addEventListener("abort",n,{once:!0}),n}off(t,e){if(!this._subscribers||this._subscribers[t]==null||this.signal.aborted)return;let i=this._subscribers[t].indexOf(e);i!==-1&&this._subscribers[t].splice(i,1)}destroy(){this.signal.aborted||(this._subscribers={},this._abortController.abort())}};a(_o,"PubSub");var To=_o;import{Facade as Vt,Floor as It,FloorStack as At}from"@mappedin/mappedin-js";var A,so,C,w,T,k,H,K,No=class No{constructor(t,e){y(this,"__type","building");c(this,A);c(this,so,new Map);c(this,C,new Map);c(this,w,[]);c(this,T);c(this,k);y(this,"defaultFloor");y(this,"activeFloor");y(this,"excluded",!1);y(this,"floorsAltitudesMap",new Map);y(this,"aboveGroundFloors",[]);c(this,H);c(this,K);d(this,A,t),d(this,so,new Map(t.floors.map(n=>[n.id,n]))),d(this,C,new Map(t.floors.map(n=>[n.elevation,n]))),d(this,w,Array.from(o(this,C).values()).sort((n,f)=>n.elevation-f.elevation));let i=t.defaultFloor;if(!i)throw new Error(`Building created for floor stack "${t.id}" with no resolvable default floor`);this.defaultFloor=i,this.activeFloor=this.defaultFloor,d(this,T,e),this.aboveGroundFloors=o(this,w).filter(n=>n.elevation>=0);let s=t.facade?.spaces.map(n=>o(this,T).getState(n)).sort((n,f)=>n.altitude-f.altitude);if(s&&s.length===this.aboveGroundFloors.length)for(let n in this.aboveGroundFloors){let f=this.aboveGroundFloors[n],m=s[n];this.floorsAltitudesMap.set(f.elevation,{altitude:m.altitude,visualHeight:m.height})}}get id(){return o(this,A).id}get name(){return o(this,A).name}get floors(){return o(this,A).floors}get floorStack(){return o(this,A)}get facade(){return o(this,A).facade}get isCurrentFloorStack(){return this.id===o(this,T).currentFloorStack.id}get isIndoor(){let t=o(this,T).getState(this.facade);return this.isCurrentFloorStack||t?.visible===!1&&t?.opacity===0}get canSetFloor(){return this.isIndoor||!this.excluded}get maxElevation(){return o(this,H)==null&&d(this,H,Math.max(...o(this,C).keys())),o(this,H)}get minElevation(){return o(this,K)==null&&d(this,K,Math.min(...o(this,C).keys())),o(this,K)}has(t){return It.is(t)?o(this,so).has(t.id):At.is(t)?t.id===o(this,A).id:Vt.is(t)?t.id===this.facade.id:!1}getFloorByElevation(t){return o(this,C).get(t)}getNearestFloorByElevation(t){let e=this.getFloorByElevation(t);if(e)return e;if(t>=0){if(t>this.maxElevation)return o(this,w)[o(this,w).length-1];for(let i=o(this,w).length-1;i>=0;i--){let s=o(this,w)[i];if(s.elevation<=t)return s}}else{if(t<this.minElevation)return o(this,w)[0];for(let i of o(this,w))if(i.elevation>=t)return i}}getHighestFloor(){return o(this,w)[o(this,w).length-1]}cancelAnimation(){o(this,k)&&(o(this,k).animation.cancel(),d(this,k,void 0))}async animateFacade(t,e={duration:150}){let i=o(this,k)?.state||o(this,T).getState(this.facade);if(!i||!t||i?.opacity===t.opacity&&i?.visible===t.visible)return{result:"completed"};this.cancelAnimation();let{opacity:s,visible:n}=t;if(o(this,T).updateState(this.facade,{visible:!0}),s!==void 0){d(this,k,{animation:o(this,T).animateState(this.facade,{opacity:s},{duration:e.duration}),state:t});let f=await o(this,k).animation;if(d(this,k,void 0),f.result==="cancelled")return f}return n===!1&&o(this,T).updateState(this.facade,{visible:n}),{result:"completed"}}destroy(){this.cancelAnimation(),o(this,A).floors.forEach(t=>{o(this,T).updateState(t,{visible:t.id===o(this,T).currentFloor.id})}),this.has(o(this,T).currentFloor)||o(this,T).updateState(this.facade,{visible:!0,opacity:1})}};A=new WeakMap,so=new WeakMap,C=new WeakMap,w=new WeakMap,T=new WeakMap,k=new WeakMap,H=new WeakMap,K=new WeakMap,a(No,"Building");var vo=No;function it(r,t,e){return r>=t?"in-range":r<=e?"out-of-range":"transition"}a(it,"getZoomState");function wo(r,t,e){if(r.__type==="outdoors"&&"floor"in r)return r.floor;let i=r;if(i.excluded)return i.activeFloor;switch(t){case"lock-elevation":return i.getFloorByElevation(e);case"nearest-elevation":return i.getNearestFloorByElevation(e);case"active-floor":return i.activeFloor;default:break}return i.isIndoor?i.activeFloor:i.defaultFloor}a(wo,"getFloorToShow");function Bt(r,t,e,i){return i?{facade:r,state:{type:"facade",visible:!1,opacity:0}}:t?{facade:r,state:{type:"facade",visible:!1,opacity:0}}:e?{facade:r,state:{type:"facade",visible:!0,opacity:.2}}:{facade:r,state:{type:"facade",visible:!0,opacity:1}}}a(Bt,"getFacadeState");function kt(r,t,e){return{outdoorOpacity:"initial",floorStates:r.floors.map(i=>{let n=i.id===t.id&&e;return{floor:i,state:{type:"floor",visible:n,geometry:{visible:n},labels:{enabled:n},markers:{enabled:n},footprint:{visible:!1},occlusion:{enabled:!1}}}})}}a(kt,"getSingleBuildingState");function st(r,t){if(!t.includes("lock-elevation"))return"initial";for(let e of r)if(typeof e.outdoorOpacity=="number"&&e.outdoorOpacity>=0&&e.outdoorOpacity<=1)return e.outdoorOpacity;return"initial"}a(st,"getOutdoorOpacity");function rt(r,t,e){switch(e){case"in-range":return r[0]?.canSetFloor?r[0]:void 0;case"out-of-range":return t;case"transition":default:return}}a(rt,"getSetFloorTargetFromZoomState");function nt(r){let{buildings:t,inViewSet:e,currentFloor:i,zoomState:s,mode:n,elevation:f,floorIdsInNavigation:m,floorStackIdsInNavigation:h,multiFloorView:g,getMultiFloorState:j,dynamicBuildingInteriors:V,isolateBelowGroundView:q,currentElevation:bo,forceInteriorsVisible:to,getFloorStackAltitudeData:yo}=r,So=new Map,Bo=q&&bo<0&&s==="in-range";for(let b of t){let Jo=e.has(b.id),Eo=Bo&&b.minElevation>=0,bt=Eo?!1:Jo,ko=Eo?!1:Co({building:b,currentFloor:i,inRange:s==="in-range",inFocus:Jo,mode:n,elevation:f,inNavigation:h.includes(b.id),dynamicBuildingInteriors:V,forceInteriorsVisible:to}),Do=i.floorStack.id===b.id?b.activeFloor:wo(b,n,f),yt=g?.enabled?j(b.floors,Do||b.activeFloor,m,yo?.(b.id)??b.floorsAltitudesMap,{color:g?.footprintColor,spacesOpenToBelowEnabled:g?.spacesOpenToBelowEnabled,spacesOpenToBelowVisualEffectEnabled:g?.spacesOpenToBelowVisualEffectEnabled,spacesOpenToBelowVisualEffectDarkenAmount:g?.spacesOpenToBelowVisualEffectDarkenAmount,spacesOpenToBelowVisualEffectDarkenUseDepth:g?.spacesOpenToBelowVisualEffectDarkenUseDepth,spacesOpenToBelowVisualEffectDesaturateAmount:g?.spacesOpenToBelowVisualEffectDesaturateAmount,spacesOpenToBelowVisualEffectDesaturateUseDepth:g?.spacesOpenToBelowVisualEffectDesaturateUseDepth,spacesOpenToBelowVisualEffectWashOutAmount:g?.spacesOpenToBelowVisualEffectWashOutAmount,spacesOpenToBelowVisualEffectWashOutUseDepth:g?.spacesOpenToBelowVisualEffectWashOutUseDepth,opacity:g?.footprintOpacity,outline:g?.footprintOutline}):kt(b.floorStack,Do||b.activeFloor,ko),St=q&&bo<0&&s==="in-range",Et=Bt(b.facade,ko,St,Eo);So.set(b.id,{building:b,showIndoor:ko,floorStackState:yt,facadeState:Et,inFocus:bt,floorToShow:Do,isAboveGroundInIsolation:Eo})}return So}a(nt,"getBuildingStates");function at(r,t){return r.excluded?"none":t?"indoor":"outdoor"}a(at,"getBuildingAnimationType");function Co(r){let{building:t,currentFloor:e,inRange:i,inFocus:s,mode:n,elevation:f,inNavigation:m,dynamicBuildingInteriors:h,forceInteriorsVisible:g}=r;if(t.id===e.floorStack.id)return!0;if(t.excluded)return!1;if(g===!0||m===!0)return!0;if(!h)return e.floorStack.type!=="Outdoor";if(!i||!s)return!1;switch(n){case"lock-elevation":return t.getFloorByElevation(f)!=null;default:break}return!0}a(Co,"shouldShowIndoor");function lt(r,t,e){return r!==t&&!e}a(lt,"shouldDeferSetFloor");var ut=["default-floor","active-floor","lock-elevation","nearest-elevation"];import{Floor as Dt,FloorStack as Mt}from"@mappedin/mappedin-js";function dt(r,t,e,i){return(r<t||r>e)&&W.warn(i),Math.min(e,Math.max(t,r))}a(dt,"clampWithWarning");function Go(r,t){return!Dt.is(r)||r?.floorStack==null||!Mt.is(t)?!1:r.floorStack.id!==t.id?(W.warn(`Floor (${r.id}) does not belong to floor stack (${t.id}).`),!1):!0}a(Go,"validateFloorForStack");function Po(r,t,e,i){return dt(r,t,e,`${i} must be between ${t} and ${e}.`)}a(Po,"validateZoomThreshold");var D,Q,ro,Ro,Uo=class Uo{constructor(t,e){c(this,ro);y(this,"__type","outdoors");c(this,D);c(this,Q);d(this,D,t),d(this,Q,e)}get id(){return o(this,D).id}get floorStack(){return o(this,D)}get floor(){return o(this,D).defaultFloor}matchesFloorStack(t){return t===o(this,D)||t===o(this,D).id}show(){F(this,ro,Ro).call(this,!0)}hide(){F(this,ro,Ro).call(this,!1)}destroy(){this.matchesFloorStack(o(this,Q).currentFloorStack)||this.hide()}};D=new WeakMap,Q=new WeakMap,ro=new WeakSet,Ro=a(function(t){for(let e of o(this,D).floors)o(this,Q).updateState(e,{visible:t})},"#setVisible"),a(Uo,"Outdoors");var Oo=Uo;function ct(r,t){let e=r.getByType("floor-stack"),i=e.find(n=>n.type?.toLowerCase()==="outdoor");if(i)return i;let s=e.find(n=>n.facade==null&&!t.has(n.id));return s||(I.warn("No good candidate for the outdoor floor stack was found. Using the first floor stack."),e[0])}a(ct,"getOutdoorFloorStack");function Zt(r,t){return`${t} ${r}`}a(Zt,"formatMessage");var jo=class jo extends Error{constructor(t,e=xo){super(Zt(t,e)),this.name="MappedinError"}};a(jo,"MappedinError");var Vo=jo;var xt=a(r=>r,"linearEase"),Lt=a(r=>r*r,"quadEaseIn"),_t=a(r=>1-Math.cos(r*Math.PI/2),"easeIn"),Nt=a(r=>1-(1-r)*(1-r),"quadEaseOut"),Ct=a(r=>1-Math.pow(1-r,3),"cubicEaseOut"),Gt={linear:xt,"ease-in":Lt,"ease-out":Nt,"ease-in-out":_t,"ease-out-cubic":Ct};function Pt(r,t){let e=0;if(t.length<2)return e;let s=t[0]<t[1]?(n,f)=>n>f:(n,f)=>n<f;for(;e<t.length-1&&s(r,t[e+1]);)e++;return e>t.length-2?Math.max(0,t.length-2):e}a(Pt,"getInterpolationBreakpoint");function ht(r,t,e,i="ease-in"){if(t.length!==e.length)throw new Vo("Input and output ranges must have the same number of values.");r=Math.max(t[0],Math.min(r,t[t.length-1]));let s=Pt(r,t),n=(r-t[s])/(t[s+1]-t[s]),f=typeof i=="function"?i(n):Gt[i](n);return e[s]+f*(e[s+1]-e[s])}a(ht,"interpolateMulti");var M,no,ao,x,lo,zo=class zo{constructor(t,e,i){y(this,"layers");y(this,"visible");c(this,M);c(this,no,[]);c(this,ao,!1);c(this,x,new Map);y(this,"interpolationFn");c(this,lo,1);this.layers=t,this.visible=e,d(this,M,i)}processLayerGroup(t,e){o(this,ao)||(this.layers.forEach(i=>{let s=t[i];s&&o(this,no).push(...s)}),d(this,ao,!0),this.visible&&(this.interpolationFn=i=>{let{outdoorZoomThreshold:s,indoorZoomThreshold:n}=e();return ht(i,[s,n],[1,0])}))}setOpacity(t){d(this,lo,t);for(let e of o(this,no))if(e.startsWith("img_")){let i=o(this,M).Image3D.getById(e);if(i){let s=o(this,M).getState(i.image);o(this,x).has(e)||o(this,x).set(e,s?.opacity??1);let n=Math.min(o(this,x).get(e),t);o(this,M).updateState(i.image,{opacity:n})}}else{let i=o(this,M).getMapData()?.getById("space",e);if(!i)continue;let s=o(this,M).getState(i);o(this,x).has(e)||o(this,x).set(e,s?.opacity??1);let n=Math.min(o(this,x).get(e),t);o(this,M).updateState(i,{opacity:n,visible:n>0})}}get opacity(){return o(this,lo)}};M=new WeakMap,no=new WeakMap,ao=new WeakMap,x=new WeakMap,lo=new WeakMap,a(zo,"LayerGroup");var Io=zo;function $o(r,t,e){r.forEach(i=>{if(e?.forceOpacity!==void 0){i.setOpacity(e.forceOpacity),i.visible=e.forceOpacity===1;return}if(i.interpolationFn!=null){let s=i.interpolationFn(t);s!=null&&(i.setOpacity(s),i.visible=s===1)}})}a($o,"runLayerGroupInterpolations");var O,l,G,u,$,z,E,L,Y,_,v,J,uo,co,ho,Z,P,X,N,R,U,p,Yo,mt,qo,Wo,Ho,pt,Ko,fo,mo,po,go,Fo,oo,Ao,gt,Ft,B,Qo=class Qo{constructor(t){c(this,p);c(this,O);c(this,l);c(this,G);c(this,u,eo);c(this,$,[]);c(this,z,new Set);c(this,E,new Map);c(this,L);c(this,Y,!1);c(this,_,!1);c(this,v,0);c(this,J,0);c(this,uo,[]);c(this,co,{});c(this,ho,{});c(this,Z,"transition");c(this,P,"outdoor");c(this,X,[]);c(this,N,!1);c(this,R,[]);c(this,U,null);y(this,"sceneUpdateQueue",Promise.resolve());y(this,"on",a((t,e)=>{o(this,O).on(t,e)},"on"));y(this,"off",a((t,e)=>{o(this,O).off(t,e)},"off"));c(this,fo,a(t=>{if(!this.isEnabled)return;let{facades:e}=t;if(et(e,this.focusedFacades)&&o(this,P)==="transition"&&!o(this,_))return;d(this,_,!1),d(this,$,[]),o(this,z).clear();let i=o(this,u).isolateBelowGroundView&&o(this,v)<0;if(e.length>0)for(let s of e){let n=o(this,E).get(s.floorStack.id);if(n){if(i&&n.minElevation>=0)continue;o(this,z).add(n.id),o(this,$).push(n)}}o(this,u).autoFocus&&this.focus()},"#handleFacadesInViewChange"));c(this,mo,a(async t=>{if(!this.isEnabled)return;let{floor:e}=t,i=o(this,E).get(e.floorStack.id);i&&(t.reason==="dynamic-focus"&&o(this,u).mode==="active-floor"||(i.activeFloor=e));let s=o(this,u).isolateBelowGroundView&&o(this,v)<0;i?.excluded===!1&&!o(this,L).matchesFloorStack(e.floorStack)&&d(this,v,e.elevation);let n=o(this,u).isolateBelowGroundView&&o(this,v)<0,f=s&&!n;if(o(this,l).manualFloorVisibility===!0){t.reason!=="dynamic-focus"&&(f?(d(this,_,!0),o(this,l).Camera.updateFacadesInView(),o(this,u).autoFocus||(await o(this,B).call(this,e),o(this,O).publish("focus",{facades:this.focusedFacades}))):(await o(this,B).call(this,e),o(this,O).publish("focus",{facades:this.focusedFacades})));let m=i?.floorsAltitudesMap.get(e.elevation)?.altitude??0;o(this,l).options.multiFloorView!=null&&o(this,l).options.multiFloorView?.enabled&&o(this,l).options.multiFloorView?.updateCameraElevationOnFloorChange&&o(this,l).Camera.elevation!==m&&o(this,l).Camera.animateElevation(m,{duration:750,easing:"ease-in-out"})}},"#handleFloorChangeStart"));c(this,po,a(()=>{d(this,Y,!0)},"#handleUserInteractionStart"));c(this,go,a(()=>{d(this,Y,!1)},"#handleUserInteractionEnd"));c(this,Fo,a(()=>{o(this,B).call(this)},"#handleGlobalStateChange"));c(this,oo,a(t=>{if(!this.isEnabled)return;let{zoomLevel:e}=t,i=it(e,o(this,u).indoorZoomThreshold,o(this,u).outdoorZoomThreshold);o(this,Z)!==i&&(d(this,Z,i),i==="in-range"?this.setIndoor():i==="out-of-range"&&this.setOutdoor());let s=(o(this,l).Navigation?.floors?.length??0)>0;$o(o(this,R),e,s?{forceOpacity:0}:void 0)},"#handleCameraChange"));c(this,B,a(async t=>{if(o(this,l).manualFloorVisibility!==!0||!this.isEnabled)return;let e=t||o(this,l).currentFloor,i=o(this,l).getGlobalState().multiFloorView,s=o(this,l).options.multiFloorView?{...o(this,l).options.multiFloorView,...i}:o(this,l).options.multiFloorView,n=o(this,l).Navigation?.floors?.map(h=>h.id)||[],f=o(this,l).Navigation?.floorStacks.map(h=>h.id)||[],m=new Promise(async h=>{await this.sceneUpdateQueue;let g=nt({buildings:Array.from(o(this,E).values()),inViewSet:o(this,z),currentFloor:e,zoomState:o(this,Z),mode:o(this,u).mode,elevation:o(this,v),floorIdsInNavigation:n,floorStackIdsInNavigation:f,multiFloorView:s,getMultiFloorState:o(this,u).customMultiFloorVisibilityState??Ut,dynamicBuildingInteriors:o(this,u).dynamicBuildingInteriors,isolateBelowGroundView:o(this,u).isolateBelowGroundView,currentElevation:o(this,v),forceInteriorsVisible:o(this,u).forceInteriorsVisible,getFloorStackAltitudeData:a(V=>o(this,l).getFloorStackAltitudeData(V),"getFloorStackAltitudeData")}),j=[];await Promise.all(Array.from(g.values()).map(async V=>{let{building:q,showIndoor:bo,floorStackState:to,facadeState:yo,inFocus:So,isAboveGroundInIsolation:Bo}=V;j.push(to);let b=at(q,bo);if(b==="indoor")return F(this,p,gt).call(this,q,to,yo,So);if(b==="outdoor")return F(this,p,Ft).call(this,q,to,yo,f,Bo)})),o(this,l).Outdoor.setOpacity(st(j,o(this,u).mode)),d(this,X,o(this,$).filter(V=>g.get(V.id)?.showIndoor===!0).map(V=>V.facade)),o(this,O).publish("focus",{facades:o(this,X)}),h()});return this.sceneUpdateQueue=m,m},"#applyBuildingStates"));d(this,O,new To),d(this,l,t),I.setLevel(W.logState),d(this,G,o(this,l).getMapData()),d(this,v,o(this,l).currentFloor.elevation),d(this,J,o(this,l).Camera.elevation);for(let e of o(this,G).getByType("facade")){let{floorStack:i}=e;if(i.floors.length===0||i.defaultFloor==null){I.warn(`Skipping building for floor stack "${i.id}" because it has no floors. It will not participate in Dynamic Focus.`);continue}o(this,E).set(i.id,new vo(i,o(this,l)))}F(this,p,pt).call(this),d(this,L,new Oo(ct(o(this,G),o(this,E)),o(this,l))),o(this,l).on("floor-change-start",o(this,mo)),o(this,l).on("camera-change",o(this,oo)),o(this,l).on("facades-in-view-change",o(this,fo)),o(this,l).on("user-interaction-start",o(this,po)),o(this,l).on("user-interaction-end",o(this,go)),o(this,l).on("global-state-change",o(this,Fo))}enable(t){if(o(this,N)){I.warn("enable() called on an already enabled Dynamic Focus instance.");return}d(this,N,!0),o(this,l).manualFloorVisibility=!0,o(this,L).show();let e={...o(this,u),...t};e.autoZoomThresholds&&(t?.autoZoomThresholds&&(t.indoorZoomThreshold!=null||t.outdoorZoomThreshold!=null)&&I.warn("Manual indoorZoomThreshold/outdoorZoomThreshold values are ignored while autoZoomThresholds is enabled."),delete e.indoorZoomThreshold,delete e.outdoorZoomThreshold),this.updateState(e),F(this,p,mt).call(this),o(this,oo).call(this,{zoomLevel:o(this,l).Camera.zoomLevel,center:o(this,l).Camera.center,bearing:o(this,l).Camera.bearing,pitch:o(this,l).Camera.pitch}),o(this,l).Camera.updateFacadesInView()}disable(){if(!o(this,N)){I.warn("disable() called on an already disabled Dynamic Focus instance.");return}d(this,N,!1),o(this,l).manualFloorVisibility=!1}get isEnabled(){return o(this,N)}get isIndoor(){return o(this,P)==="indoor"}get isOutdoor(){return o(this,P)==="outdoor"}get outdoorsFloorStack(){return o(this,L).floorStack}get layers(){return o(this,uo)}get layersBySpaceId(){return o(this,co)}setIndoor(){d(this,P,"indoor"),d(this,Z,"in-range"),F(this,p,Yo).call(this)}setOutdoor(){d(this,P,"outdoor"),d(this,Z,"out-of-range"),F(this,p,Yo).call(this)}get focusedFacades(){return[...o(this,X)]}getState(){return{...o(this,u)}}updateState(t){let e=!1,i=o(this,u).indoorZoomThreshold,s=o(this,u).outdoorZoomThreshold,n=o(this,u).isolateBelowGroundView&&o(this,v)<0,f=!!o(this,u).autoZoomThresholds,m=t.autoZoomThresholds!=null?!!t.autoZoomThresholds:f,h=t;if(m&&(h.indoorZoomThreshold!=null||h.outdoorZoomThreshold!=null)){I.warn("Manual indoorZoomThreshold/outdoorZoomThreshold values are ignored while autoZoomThresholds is enabled.");let{indoorZoomThreshold:g,outdoorZoomThreshold:j,...V}=h;h=V}if(!f&&m?(d(this,U,()=>{if(!o(this,N))return;let g=o(this,u).indoorZoomThreshold,j=o(this,u).outdoorZoomThreshold;F(this,p,Wo).call(this),F(this,p,Ho).call(this,g,j),o(this,B).call(this)}),o(this,l).on("camera-screen-offsets-change",o(this,U))):f&&!m&&F(this,p,qo).call(this),h.indoorZoomThreshold!=null&&(h.indoorZoomThreshold=Po(h.indoorZoomThreshold,h?.outdoorZoomThreshold??o(this,u).outdoorZoomThreshold,o(this,l).Camera.maxZoomLevel,"indoorZoomThreshold"),e=!0),h.outdoorZoomThreshold!=null&&(h.outdoorZoomThreshold=Po(h.outdoorZoomThreshold,o(this,l).Camera.minZoomLevel,h?.indoorZoomThreshold??o(this,u).indoorZoomThreshold,"outdoorZoomThreshold"),e=!0),h.mode!=null&&(h.mode=ut.includes(h.mode)?h.mode:"default-floor"),h.autoAdjustFacadeHeights!=null&&(o(this,u).autoAdjustFacadeHeights=h.autoAdjustFacadeHeights),h.dynamicBuildingInteriors!=null&&h.dynamicBuildingInteriors!==o(this,u).dynamicBuildingInteriors&&(e=!0),h.isolateBelowGroundView!=null&&h.isolateBelowGroundView!==o(this,u).isolateBelowGroundView&&(e=!0),h.forceInteriorsVisible!=null&&h.forceInteriorsVisible!==o(this,u).forceInteriorsVisible&&(e=!0),h.showLabelsAndMarkersOnAllVisibleFloors!=null&&h.showLabelsAndMarkersOnAllVisibleFloors!==o(this,u).showLabelsAndMarkersOnAllVisibleFloors&&(e=!0),d(this,u,Object.assign({},o(this,u),Object.fromEntries(Object.entries(h).filter(([,g])=>g!=null)))),m&&h.autoZoomThresholds!==void 0&&(F(this,p,Wo).call(this),e=!0),h.mode!=null&&h.preloadFloors&&F(this,p,Ko).call(this,h.mode),e){let g=o(this,u).isolateBelowGroundView&&o(this,v)<0;n&&!g?(d(this,_,!0),o(this,l).Camera.updateFacadesInView(),o(this,u).autoFocus||o(this,B).call(this)):o(this,B).call(this)}F(this,p,Ho).call(this,i,s)}destroy(){this.disable(),F(this,p,qo).call(this),o(this,l).off("facades-in-view-change",o(this,fo)),o(this,l).off("floor-change-start",o(this,mo)),o(this,l).off("camera-change",o(this,oo)),o(this,l).off("user-interaction-start",o(this,po)),o(this,l).off("user-interaction-end",o(this,go)),o(this,l).off("global-state-change",o(this,Fo)),o(this,E).forEach(t=>t.destroy()),o(this,L).destroy(),o(this,O).destroy(),d(this,R,[])}async focus(t=o(this,u).setFloorOnFocus){if(t)if(lt(o(this,J),o(this,l).Camera.elevation,o(this,Y)))d(this,J,o(this,l).Camera.elevation),d(this,_,!0);else{let e=rt(o(this,$),o(this,L),o(this,Z)),i=e?wo(e,o(this,u).mode,o(this,v)):void 0;i&&i.id!==o(this,l).currentFloor.id&&o(this,l).setFloor(i,{context:"dynamic-focus"})}await o(this,B).call(this),o(this,O).publish("focus",{facades:this.focusedFacades})}preloadFloors(){F(this,p,Ko).call(this,o(this,u).mode)}setDefaultFloorForStack(t,e){if(!Go(e,t))return;let i=o(this,E).get(t.id);i&&(i.defaultFloor=e)}resetDefaultFloorForStack(t){let e=o(this,E).get(t.id),i=t.defaultFloor;e&&i&&(e.defaultFloor=i)}getDefaultFloorForStack(t){return o(this,E).get(t.id)?.defaultFloor||t.defaultFloor||t.floors[0]}setCurrentFloorForStack(t,e){if(!Go(e,t))return;let i=o(this,E).get(t.id);i&&(i.activeFloor=e,o(this,B).call(this))}exclude(t){let e=Array.isArray(t)?t:[t];for(let i of e){let s=o(this,E).get(i.id);s&&(s.excluded=!0)}}include(t){let e=Array.isArray(t)?t:[t];for(let i of e){let s=o(this,E).get(i.id);s&&(s.excluded=!1)}}getCurrentFloorForStack(t){return o(this,E).get(t.id)?.activeFloor||this.getDefaultFloorForStack(t)}};O=new WeakMap,l=new WeakMap,G=new WeakMap,u=new WeakMap,$=new WeakMap,z=new WeakMap,E=new WeakMap,L=new WeakMap,Y=new WeakMap,_=new WeakMap,v=new WeakMap,J=new WeakMap,uo=new WeakMap,co=new WeakMap,ho=new WeakMap,Z=new WeakMap,P=new WeakMap,X=new WeakMap,N=new WeakMap,R=new WeakMap,U=new WeakMap,p=new WeakSet,Yo=a(function(){o(this,u).autoFocus&&(o(this,Y)?this.focus():d(this,_,!0)),o(this,O).publish("state-change")},"#handleViewStateChange"),mt=a(function(){d(this,R,[]);for(let e of o(this,u).dynamicLayers){let i=new Io([e],!0,o(this,l));i.processLayerGroup(o(this,ho),()=>o(this,u)),o(this,R).push(i)}let t=(o(this,l).Navigation?.floors?.length??0)>0;$o(o(this,R),o(this,l).Camera.zoomLevel,t?{forceOpacity:0}:void 0)},"#initializeLayerGroups"),qo=a(function(){o(this,U)&&(o(this,l).off("camera-screen-offsets-change",o(this,U)),d(this,U,null))},"#unsubscribeScreenOffsets"),Wo=a(function(){let t=o(this,u).autoZoomThresholds,e=typeof t=="object"&&t!==null?{...t}:{},{indoorZoomThreshold:i,outdoorZoomThreshold:s}=tt(o(this,l),e);o(this,u).indoorZoomThreshold=i,o(this,u).outdoorZoomThreshold=s,(e.expandMinZoom??!0)&&s<o(this,l).Camera.minZoomLevel&&o(this,l).Camera.setMinZoomLevel(s-io)},"#recalcThresholds"),Ho=a(function(t,e){(o(this,u).indoorZoomThreshold!==t||o(this,u).outdoorZoomThreshold!==e)&&o(this,O).publish("zoom-threshold-change",{indoorZoomThreshold:o(this,u).indoorZoomThreshold,outdoorZoomThreshold:o(this,u).outdoorZoomThreshold})},"#publishThresholdChangeIfNeeded"),pt=a(function(){let t=o(this,G).internal.mvf?.enterprise?.layers??[],e={},i={};t.forEach(s=>{e[s.name]||(e[s.name]=[]),e[s.name].push(...s.spaces.map(({spaceId:n})=>n));for(let{spaceId:n}of s.spaces)i[n]==null&&(i[n]=[]),i[n].push(s.name)}),d(this,uo,t.map(({name:s})=>s)),d(this,co,i),d(this,ho,e)},"#setupLayers"),Ko=a(function(t){let e=[];for(let i of o(this,G).getByType("facade")){let s=o(this,E).get(i.floorStack.id);if(!s)continue;let n=wo(s,t,o(this,v));n!=null&&Rt.is(n)&&e.push(n)}o(this,l).preloadFloors(e)},"#preloadFloors"),fo=new WeakMap,mo=new WeakMap,po=new WeakMap,go=new WeakMap,Fo=new WeakMap,oo=new WeakMap,Ao=a(function(t,e,i,s=!1){t.forEach(n=>{if(n.floor)if(e){let m=i!==void 0&&!s?{...n.state,labels:{...n.state.labels,enabled:n.state.labels.enabled&&i},markers:{...n.state.markers,enabled:n.state.markers.enabled&&i},occlusion:{...n.state.occlusion,enabled:n.state.occlusion.enabled&&i}}:n.state;o(this,l).updateState(n.floor,m)}else o(this,l).updateState(n.floor,{visible:!1})})},"#updateFloorVisibility"),gt=a(async function(t,e,i,s){return F(this,p,Ao).call(this,e.floorStates,!0,s,o(this,u).showLabelsAndMarkersOnAllVisibleFloors),t.animateFacade(i.state,o(this,u).indoorAnimationOptions)},"#animateIndoorSequence"),Ft=a(async function(t,e,i,s,n){let f=n;f&&F(this,p,Ao).call(this,e.floorStates,!1,void 0,o(this,u).showLabelsAndMarkersOnAllVisibleFloors);let m=await t.animateFacade(i.state,o(this,u).outdoorAnimationOptions);return m.result==="completed"&&!f&&F(this,p,Ao).call(this,e.floorStates,Co({building:t,currentFloor:o(this,l).currentFloor,inRange:o(this,Z)==="in-range",inFocus:o(this,z).has(t.id),mode:o(this,u).mode,elevation:o(this,v),inNavigation:s.includes(t.floorStack.id),dynamicBuildingInteriors:o(this,u).dynamicBuildingInteriors,forceInteriorsVisible:o(this,u).forceInteriorsVisible}),void 0,o(this,u).showLabelsAndMarkersOnAllVisibleFloors),m},"#animateOutdoorSequence"),B=new WeakMap,a(Qo,"DynamicFocus");var ft=Qo;export{a,tt as b,ft as c};
|