@mappedin/dynamic-focus 6.9.1-beta.0 → 6.10.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.
@@ -0,0 +1 @@
1
+ var Ht=Object.defineProperty,po=Object.defineProperties;var go=Object.getOwnPropertyDescriptors;var qt=Object.getOwnPropertySymbols;var Fo=Object.prototype.hasOwnProperty,yo=Object.prototype.propertyIsEnumerable;var zt=r=>{throw TypeError(r)};var Vt=(r,t,e)=>t in r?Ht(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_=(r,t)=>{for(var e in t||(t={}))Fo.call(t,e)&&Vt(r,e,t[e]);if(qt)for(var e of qt(t))yo.call(t,e)&&Vt(r,e,t[e]);return r},at=(r,t)=>po(r,go(t)),s=(r,t)=>Ht(r,"name",{value:t,configurable:!0});var p=(r,t,e)=>Vt(r,typeof t!="symbol"?t+"":t,e),Mt=(r,t,e)=>t.has(r)||zt("Cannot "+e);var o=(r,t,e)=>(Mt(r,t,"read from private field"),e?e.call(r):t.get(r)),d=(r,t,e)=>t.has(r)?zt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),c=(r,t,e,i)=>(Mt(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e),E=(r,t,e)=>(Mt(r,t,"access private method"),e);var b={env:{NODE_ENV:"production",npm_package_version:"6.10.0-beta.0"}};import{Floor as Lo,getMultiFloorState as Co}from"@mappedin/mappedin-js";function Wt(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}s(Wt,"arraysEqual");var xt=class xt{constructor(){p(this,"_subscribers",{});p(this,"_abortController",new AbortController);p(this,"_cleanupFunctions",[])}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 n=i==null?void 0:i.signal;if(n!=null&&n.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(e);let a=s(()=>this.off(t,e),"cleanup");return n&&n.addEventListener("abort",a,{once:!0}),this._cleanupFunctions.push(a),a}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(){if(!this.signal.aborted){for(let t of this._cleanupFunctions)t();this._cleanupFunctions=[],this._subscribers={},this._abortController.abort()}}};s(xt,"PubSub");var St=xt;import{Facade as So,Floor as Eo,FloorStack as vo}from"@mappedin/mappedin-js";var w,st,N,v,S,I,W,K,Ot=class Ot{constructor(t,e){p(this,"__type","building");d(this,w);d(this,st,new Map);d(this,N,new Map);d(this,v,[]);d(this,S);d(this,I);p(this,"defaultFloor");p(this,"activeFloor");p(this,"excluded",!1);p(this,"floorsAltitudesMap",new Map);p(this,"aboveGroundFloors",[]);d(this,W);d(this,K);var n;c(this,w,t),c(this,st,new Map(t.floors.map(a=>[a.id,a]))),c(this,N,new Map(t.floors.map(a=>[a.elevation,a]))),c(this,v,Array.from(o(this,N).values()).sort((a,h)=>a.elevation-h.elevation)),this.defaultFloor=t.defaultFloor,this.activeFloor=this.defaultFloor,c(this,S,e),this.aboveGroundFloors=o(this,v).filter(a=>a.elevation>=0);let i=(n=t.facade)==null?void 0:n.spaces.map(a=>o(this,S).getState(a)).sort((a,h)=>a.altitude-h.altitude);if(i&&i.length===this.aboveGroundFloors.length)for(let a in this.aboveGroundFloors){let h=this.aboveGroundFloors[a],u=i[a];this.floorsAltitudesMap.set(h.elevation,{altitude:u.altitude,effectiveHeight:u.height})}}get id(){return o(this,w).id}get name(){return o(this,w).name}get floors(){return o(this,w).floors}get floorStack(){return o(this,w)}get facade(){return o(this,w).facade}get isCurrentFloorStack(){return this.id===o(this,S).currentFloorStack.id}get isIndoor(){let t=o(this,S).getState(this.facade);return this.isCurrentFloorStack||(t==null?void 0:t.visible)===!1&&(t==null?void 0: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,K)==null&&c(this,K,Math.min(...o(this,N).keys())),o(this,K)}has(t){return Eo.is(t)?o(this,st).has(t.id):vo.is(t)?t.id===o(this,w).id:So.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 n=o(this,v)[i];if(n.elevation<=t)return n}}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,I)&&(o(this,I).animation.cancel(),c(this,I,void 0))}async animateFacade(t,e={duration:150}){var h;let i=((h=o(this,I))==null?void 0:h.state)||o(this,S).getState(this.facade);if(!i||!t||(i==null?void 0:i.opacity)===t.opacity&&(i==null?void 0:i.visible)===t.visible)return{result:"completed"};this.cancelAnimation();let{opacity:n,visible:a}=t;if(o(this,S).updateState(this.facade,{visible:!0}),n!==void 0){c(this,I,{animation:o(this,S).animateState(this.facade,{opacity:n},{duration:e.duration}),state:t});let u=await o(this,I).animation;if(c(this,I,void 0),u.result==="cancelled")return u}return a===!1&&o(this,S).updateState(this.facade,{visible:a}),{result:"completed"}}destroy(){this.cancelAnimation(),o(this,w).floors.forEach(t=>{o(this,S).updateState(t,{visible:t.id===o(this,S).currentFloor.id})}),this.has(o(this,S).currentFloor)||o(this,S).updateState(this.facade,{visible:!0,opacity:1})}};w=new WeakMap,st=new WeakMap,N=new WeakMap,v=new WeakMap,S=new WeakMap,I=new WeakMap,W=new WeakMap,K=new WeakMap,s(Ot,"Building");var Et=Ot;function Kt(r,t,e){return r>=t?"in-range":r<=e?"out-of-range":"transition"}s(Kt,"getZoomState");function vt(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);default:break}return i.isIndoor?i.activeFloor:i.defaultFloor}s(vt,"getFloorToShow");function wo(r,t,e){return 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}}}s(wo,"getFacadeState");function ko(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}}}})}}s(ko,"getSingleBuildingState");function Qt(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"}s(Qt,"getOutdoorOpacity");function Jt(r,t,e){var i;switch(e){case"in-range":return(i=r[0])!=null&&i.canSetFloor?r[0]:void 0;case"out-of-range":return t;case"transition":default:return}}s(Jt,"getSetFloorTargetFromZoomState");function Xt(r){let{buildings:t,inViewSet:e,currentFloor:i,zoomState:n,mode:a,elevation:h,floorIdsInNavigation:u,floorStackIdsInNavigation:f,multiFloorView:P,getMultiFloorState:R,dynamicBuildingInteriors:bt,isolateBelowGroundView:it,currentElevation:rt}=r,A=new Map,D=it&&rt<0;for(let F of t){let H=e.has(F.id),nt=D&&F.minElevation>=0,It=nt?!1:H,z=nt?!1:At({building:F,currentFloor:i,inRange:n==="in-range",inFocus:H,mode:a,elevation:h,inNavigation:f.includes(F.id),dynamicBuildingInteriors:bt}),Tt=i.floorStack.id===F.id?F.activeFloor:vt(F,a,h),mo=P.enabled?R(F.floors,Tt||F.activeFloor,P==null?void 0:P.floorGap,u,F.floorsAltitudesMap):ko(F.floorStack,Tt||F.activeFloor,z),fo=wo(F.facade,z,it&&rt<0);A.set(F.id,{building:F,showIndoor:z,floorStackState:mo,facadeState:fo,inFocus:It,floorToShow:Tt})}return A}s(Xt,"getBuildingStates");function to(r,t){return r.excluded?"none":t?"indoor":"outdoor"}s(to,"getBuildingAnimationType");function At(r){let{building:t,currentFloor:e,inRange:i,inFocus:n,mode:a,elevation:h,inNavigation:u,dynamicBuildingInteriors:f}=r;if(t.id===e.floorStack.id)return!0;if(t.excluded)return!1;if(u===!0)return!0;if(!f)return e.floorStack.type!=="Outdoor";if(!i||!n)return!1;switch(a){case"lock-elevation":return t.getFloorByElevation(h)!=null;default:break}return!0}s(At,"shouldShowIndoor");function oo(r,t,e){return r!==t&&!e}s(oo,"shouldDeferSetFloor");var eo=["default-floor","lock-elevation","nearest-elevation"];import{Floor as Io,FloorStack as To}from"@mappedin/mappedin-js";var Dt="[MappedinJS]";function _t(r="",{prefix:t=Dt}={}){let e="".concat(t).concat(r?"-".concat(r):""),i=s((n,a)=>{if(typeof window<"u"&&window.rnDebug){let h=a.map(u=>u instanceof Error&&u.stack?"".concat(u.message,"\n").concat(u.stack):u);window.rnDebug("".concat(r," ").concat(n,": ").concat(h.join(" ")))}},"rnDebug");return{logState:b.env.NODE_ENV==="test"?3:0,log(...n){this.logState<=0&&(console.log(e,...n),i("log",n))},warn(...n){this.logState<=1&&(console.warn(e,...n),i("warn",n))},error(...n){this.logState<=2&&(console.error(e,...n),i("error",n))},assert(...n){console.assert(...n)},time(n){console.time(n)},timeEnd(n){console.timeEnd(n)},setLevel(n){0<=n&&n<=3&&(this.logState=n)}}}s(_t,"createLogger");var Bo=_t();var Q=Bo;function io(r,t,e,i){return(r<t||r>e)&&Q.warn(i),Math.min(e,Math.max(t,r))}s(io,"clampWithWarning");function Nt(r,t){return!Io.is(r)||(r==null?void 0:r.floorStack)==null||!To.is(t)?!1:r.floorStack.id!==t.id?(Q.warn("Floor (".concat(r.id,") does not belong to floor stack (").concat(t.id,").")),!1):!0}s(Nt,"validateFloorForStack");function Lt(r,t,e,i){return io(r,t,e,"".concat(i," must be between ").concat(t," and ").concat(e,"."))}s(Lt,"validateZoomThreshold");var J=_t("",{prefix:"[DynamicFocus]"});var T,X,lt,Ct,Zt=class Zt{constructor(t,e){d(this,lt);p(this,"__type","outdoors");d(this,T);d(this,X);c(this,T,t),c(this,X,e)}get id(){return o(this,T).id}get floorStack(){return o(this,T)}get floor(){return o(this,T).defaultFloor}matchesFloorStack(t){return t===o(this,T)||t===o(this,T).id}show(){E(this,lt,Ct).call(this,!0)}hide(){E(this,lt,Ct).call(this,!1)}destroy(){this.matchesFloorStack(o(this,X).currentFloorStack)||this.hide()}};T=new WeakMap,X=new WeakMap,lt=new WeakSet,Ct=s(function(t){for(let e of o(this,T).floors)o(this,X).updateState(e,{visible:t})},"#setVisible"),s(Zt,"Outdoors");var wt=Zt;function ro(r,t){var h;let e=r.getByType("floor-stack"),i=e.find(u=>{var f;return((f=u.type)==null?void 0:f.toLowerCase())==="outdoor"}),n=(h=r.getByType("enterprise-venue"))==null?void 0:h.defaultFloor;if(n){let u=r.getById("floor",n);if(u)return u.floorStack}if(i)return i;let a=e.find(u=>u.facade==null&&!t.has(u.id));return a||(J.warn("No good candidate for the outdoor floor stack was found. Using the first floor stack."),e[0])}s(ro,"getOutdoorFloorStack");import{getMultiFloorState as Vo}from"@mappedin/mappedin-js";var no={indoorZoomThreshold:18,outdoorZoomThreshold:17,setFloorOnFocus:!0,autoFocus:!1,indoorAnimationOptions:{duration:150},outdoorAnimationOptions:{duration:150},autoAdjustFacadeHeights:!1,mode:"default-floor",preloadFloors:!0,customMultiFloorVisibilityState:Vo,dynamicBuildingInteriors:!0,dynamicLayers:[],isolateBelowGroundView:!1},ve=.2,we=.4;function Mo(r,t){return"".concat(t," ").concat(r)}s(Mo,"formatMessage");var Gt=class Gt extends Error{constructor(t,e=Dt){super(Mo(t,e)),this.name="MappedinError"}};s(Gt,"MappedinError");var kt=Gt;var xo=s(r=>r,"linearEase"),Oo=s(r=>r*r,"quadEaseIn"),Ao=s(r=>1-Math.cos(r*Math.PI/2),"easeIn"),Do=s(r=>1-(1-r)*(1-r),"quadEaseOut"),_o={linear:xo,"ease-in":Oo,"ease-out":Do,"ease-in-out":Ao};function No(r,t){let e=0;if(t.length<2)return e;let n=t[0]<t[1]?(a,h)=>a>h:(a,h)=>a<h;for(;e<t.length-1&&n(r,t[e+1]);)e++;return e>t.length-2?Math.max(0,t.length-2):e}s(No,"getInterpolationBreakpoint");function ao(r,t,e,i="ease-in"){if(t.length!==e.length)throw new kt("Input and output ranges must have the same number of values.");r=Math.max(t[0],Math.min(r,t[t.length-1]));let n=No(r,t),a=(r-t[n])/(t[n+1]-t[n]),h=typeof i=="function"?i(a):_o[i](a);return e[n]+h*(e[n+1]-e[n])}s(ao,"interpolateMulti");var V,ut,dt,x,ct,Rt=class Rt{constructor(t,e,i){p(this,"layers");p(this,"visible");d(this,V);d(this,ut,[]);d(this,dt,!1);d(this,x,new Map);p(this,"interpolationFn");d(this,ct,1);this.layers=t,this.visible=e,c(this,V,i)}processLayerGroup(t,e,i){if(!o(this,dt)&&(this.layers.forEach(n=>{let a=t[n];a&&o(this,ut).push(...a)}),c(this,dt,!0),this.visible)){let n=[e,i],a=[1,0];this.interpolationFn=h=>ao(h,n,a)}}setOpacity(t){var e,i,n;c(this,ct,t);for(let a of o(this,ut))if(a.startsWith("img_")){let h=o(this,V).Image3D.getById(a);if(h){let u=o(this,V).getState(h.image);o(this,x).has(a)||o(this,x).set(a,(e=u==null?void 0:u.opacity)!=null?e:1);let f=Math.min(o(this,x).get(a),t);o(this,V).updateState(h.image,{opacity:f})}}else{let h=(i=o(this,V).getMapData())==null?void 0:i.getById("space",a);if(!h)continue;let u=o(this,V).getState(h);o(this,x).has(a)||o(this,x).set(a,(n=u==null?void 0:u.opacity)!=null?n:1);let f=Math.min(o(this,x).get(a),t);o(this,V).updateState(h,{opacity:f,visible:f>0})}}get opacity(){return o(this,ct)}};V=new WeakMap,ut=new WeakMap,dt=new WeakMap,x=new WeakMap,ct=new WeakMap,s(Rt,"LayerGroup");var Bt=Rt;function Pt(r,t){r.forEach(e=>{if(e.interpolationFn!=null){let i=e.interpolationFn(t);i!=null&&(e.setOpacity(i),e.visible=i===1)}})}s(Pt,"runLayerGroupInterpolations");var k,l,L,m,j,U,y,O,$,Y,B,tt,ht,mt,ft,M,C,ot,Z,G,g,jt,lo,uo,Ut,pt,gt,Ft,yt,et,$t,co,ho,q,Yt=class Yt{constructor(t){d(this,g);d(this,k);d(this,l);d(this,L);d(this,m,no);d(this,j,[]);d(this,U,new Set);d(this,y,new Map);d(this,O);d(this,$,!1);d(this,Y,!1);d(this,B,0);d(this,tt,0);d(this,ht,[]);d(this,mt,{});d(this,ft,{});d(this,M,"transition");d(this,C,"outdoor");d(this,ot,[]);d(this,Z,!1);d(this,G,[]);p(this,"sceneUpdateQueue",Promise.resolve());p(this,"on",s((t,e)=>{o(this,k).on(t,e)},"on"));p(this,"off",s((t,e)=>{o(this,k).off(t,e)},"off"));d(this,pt,s(t=>{if(!this.isEnabled)return;let{facades:e}=t;if(Wt(e,this.focusedFacades)&&o(this,C)==="transition"&&!o(this,Y))return;c(this,Y,!1),c(this,j,[]),o(this,U).clear();let i=o(this,m).isolateBelowGroundView&&o(this,B)<0;if(e.length>0)for(let n of e){let a=o(this,y).get(n.floorStack.id);if(a){if(i&&a.minElevation>=0)continue;o(this,U).add(a.id),o(this,j).push(a)}}o(this,m).autoFocus&&this.focus()},"#handleFacadesInViewChange"));d(this,gt,s(async t=>{var n,a,h,u;if(!this.isEnabled)return;let{floor:e}=t,i=o(this,y).get(e.floorStack.id);if(i&&(i.activeFloor=e),(i==null?void 0:i.excluded)===!1&&!o(this,O).matchesFloorStack(e.floorStack)&&c(this,B,e.elevation),o(this,l).manualFloorVisibility===!0){t.reason!=="dynamic-focus"&&(await o(this,q).call(this,e),o(this,k).publish("focus",{facades:this.focusedFacades}));let f=(a=(n=i==null?void 0:i.floorsAltitudesMap.get(e.elevation))==null?void 0:n.altitude)!=null?a:0;o(this,l).options.multiFloorView!=null&&((h=o(this,l).options.multiFloorView)!=null&&h.enabled)&&((u=o(this,l).options.multiFloorView)!=null&&u.updateCameraElevationOnFloorChange)&&o(this,l).Camera.elevation!==f&&o(this,l).Camera.animateElevation(f,{duration:750,easing:"ease-in-out"})}},"#handleFloorChangeStart"));d(this,Ft,s(()=>{c(this,$,!0)},"#handleUserInteractionStart"));d(this,yt,s(()=>{c(this,$,!1)},"#handleUserInteractionEnd"));d(this,et,s(t=>{if(!this.isEnabled)return;let{zoomLevel:e}=t,i=Kt(e,o(this,m).indoorZoomThreshold,o(this,m).outdoorZoomThreshold);o(this,M)!==i&&(c(this,M,i),i==="in-range"?this.setIndoor():i==="out-of-range"&&this.setOutdoor()),Pt(o(this,G),e)},"#handleCameraChange"));d(this,q,s(async t=>{var u,f,P;if(o(this,l).manualFloorVisibility!==!0||!this.isEnabled)return;let e=t||o(this,l).currentFloor,i=o(this,l).options.multiFloorView,n=((f=(u=o(this,l).Navigation)==null?void 0:u.floors)==null?void 0:f.map(R=>R.id))||[],a=((P=o(this,l).Navigation)==null?void 0:P.floorStacks.map(R=>R.id))||[],h=new Promise(async R=>{var rt;await this.sceneUpdateQueue;let bt=Xt({buildings:Array.from(o(this,y).values()),inViewSet:o(this,U),currentFloor:e,zoomState:o(this,M),mode:o(this,m).mode,elevation:o(this,B),floorIdsInNavigation:n,floorStackIdsInNavigation:a,multiFloorView:i,getMultiFloorState:(rt=o(this,m).customMultiFloorVisibilityState)!=null?rt:Co,dynamicBuildingInteriors:o(this,m).dynamicBuildingInteriors,isolateBelowGroundView:o(this,m).isolateBelowGroundView,currentElevation:o(this,B)}),it=[];await Promise.all(Array.from(bt.values()).map(async A=>{let{building:D,showIndoor:F,floorStackState:H,facadeState:nt,inFocus:It}=A;it.push(H);let z=to(D,F);if(z==="indoor")return E(this,g,co).call(this,D,H,nt,It);if(z==="outdoor")return E(this,g,ho).call(this,D,H,nt,a)})),o(this,l).Outdoor.setOpacity(Qt(it,o(this,m).mode)),c(this,ot,o(this,j).filter(A=>{var D;return((D=bt.get(A.id))==null?void 0:D.showIndoor)===!0}).map(A=>A.facade)),o(this,k).publish("focus",{facades:o(this,ot)}),R()});return this.sceneUpdateQueue=h,h},"#applyBuildingStates"));c(this,k,new St),c(this,l,t),J.setLevel(Q.logState),c(this,L,o(this,l).getMapData()),c(this,B,o(this,l).currentFloor.elevation),c(this,tt,o(this,l).Camera.elevation);for(let e of o(this,L).getByType("facade"))o(this,y).set(e.floorStack.id,new Et(e.floorStack,o(this,l)));E(this,g,uo).call(this),c(this,O,new wt(ro(o(this,L),o(this,y)),o(this,l))),o(this,l).on("floor-change-start",o(this,gt)),o(this,l).on("camera-change",o(this,et)),o(this,l).on("facades-in-view-change",o(this,pt)),o(this,l).on("user-interaction-start",o(this,Ft)),o(this,l).on("user-interaction-end",o(this,yt))}enable(t){if(o(this,Z)){J.warn("enable() called on an already enabled Dynamic Focus instance.");return}c(this,Z,!0),o(this,l).manualFloorVisibility=!0,o(this,O).show(),this.updateState(_(_({},o(this,m)),t)),E(this,g,lo).call(this),o(this,et).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,Z)){J.warn("disable() called on an already disabled Dynamic Focus instance.");return}c(this,Z,!1),o(this,l).manualFloorVisibility=!1}get isEnabled(){return o(this,Z)}get isIndoor(){return o(this,C)==="indoor"}get isOutdoor(){return o(this,C)==="outdoor"}get outdoorsFloorStack(){return o(this,O).floorStack}get layers(){return o(this,ht)}get layersBySpaceId(){return o(this,mt)}setIndoor(){c(this,C,"indoor"),c(this,M,"in-range"),E(this,g,jt).call(this)}setOutdoor(){c(this,C,"outdoor"),c(this,M,"out-of-range"),E(this,g,jt).call(this)}get focusedFacades(){return[...o(this,ot)]}getState(){return _({},o(this,m))}updateState(t){var i,n;let e=!1;t.indoorZoomThreshold!=null&&(t.indoorZoomThreshold=Lt(t.indoorZoomThreshold,(i=t==null?void 0:t.outdoorZoomThreshold)!=null?i:o(this,m).outdoorZoomThreshold,o(this,l).Camera.maxZoomLevel,"indoorZoomThreshold"),e=!0),t.outdoorZoomThreshold!=null&&(t.outdoorZoomThreshold=Lt(t.outdoorZoomThreshold,o(this,l).Camera.minZoomLevel,(n=t==null?void 0:t.indoorZoomThreshold)!=null?n:o(this,m).indoorZoomThreshold,"outdoorZoomThreshold"),e=!0),t.mode!=null&&(t.mode=eo.includes(t.mode)?t.mode:"default-floor"),t.autoAdjustFacadeHeights!=null&&(o(this,m).autoAdjustFacadeHeights=t.autoAdjustFacadeHeights),t.dynamicBuildingInteriors!=null&&t.dynamicBuildingInteriors!==o(this,m).dynamicBuildingInteriors&&(e=!0),t.isolateBelowGroundView!=null&&t.isolateBelowGroundView!==o(this,m).isolateBelowGroundView&&(e=!0),c(this,m,Object.assign({},o(this,m),Object.fromEntries(Object.entries(t).filter(([,a])=>a!=null)))),t.mode!=null&&t.preloadFloors&&E(this,g,Ut).call(this,t.mode),e&&o(this,q).call(this)}destroy(){this.disable(),o(this,l).off("facades-in-view-change",o(this,pt)),o(this,l).off("floor-change-start",o(this,gt)),o(this,l).off("camera-change",o(this,et)),o(this,l).off("user-interaction-start",o(this,Ft)),o(this,l).off("user-interaction-end",o(this,yt)),o(this,y).forEach(t=>t.destroy()),o(this,O).destroy(),o(this,k).destroy(),c(this,G,[])}async focus(t=o(this,m).setFloorOnFocus){if(t)if(oo(o(this,tt),o(this,l).Camera.elevation,o(this,$)))c(this,tt,o(this,l).Camera.elevation),c(this,Y,!0);else{let e=Jt(o(this,j),o(this,O),o(this,M)),i=e?vt(e,o(this,m).mode,o(this,B)):void 0;i&&i.id!==o(this,l).currentFloor.id&&o(this,l).setFloor(i,{context:"dynamic-focus"})}await o(this,q).call(this),o(this,k).publish("focus",{facades:this.focusedFacades})}preloadFloors(){E(this,g,Ut).call(this,o(this,m).mode)}setDefaultFloorForStack(t,e){if(!Nt(e,t))return;let i=o(this,y).get(t.id);i&&(i.defaultFloor=e)}resetDefaultFloorForStack(t){let e=o(this,y).get(t.id);e&&(e.defaultFloor=t.defaultFloor)}getDefaultFloorForStack(t){var e;return((e=o(this,y).get(t.id))==null?void 0:e.defaultFloor)||t.defaultFloor||t.floors[0]}setCurrentFloorForStack(t,e){if(!Nt(e,t))return;let i=o(this,y).get(t.id);i&&(i.activeFloor=e,o(this,q).call(this))}exclude(t){let e=Array.isArray(t)?t:[t];for(let i of e){let n=o(this,y).get(i.id);n&&(n.excluded=!0)}}include(t){let e=Array.isArray(t)?t:[t];for(let i of e){let n=o(this,y).get(i.id);n&&(n.excluded=!1)}}getCurrentFloorForStack(t){var e;return((e=o(this,y).get(t.id))==null?void 0:e.activeFloor)||this.getDefaultFloorForStack(t)}};k=new WeakMap,l=new WeakMap,L=new WeakMap,m=new WeakMap,j=new WeakMap,U=new WeakMap,y=new WeakMap,O=new WeakMap,$=new WeakMap,Y=new WeakMap,B=new WeakMap,tt=new WeakMap,ht=new WeakMap,mt=new WeakMap,ft=new WeakMap,M=new WeakMap,C=new WeakMap,ot=new WeakMap,Z=new WeakMap,G=new WeakMap,g=new WeakSet,jt=s(function(){o(this,m).autoFocus&&(o(this,$)?this.focus():c(this,Y,!0)),o(this,k).publish("state-change")},"#handleViewStateChange"),lo=s(function(){c(this,G,[]);for(let t of o(this,m).dynamicLayers){let e=new Bt([t],!0,o(this,l));e.processLayerGroup(o(this,ft),o(this,m).outdoorZoomThreshold,o(this,m).indoorZoomThreshold),o(this,G).push(e)}Pt(o(this,G),o(this,l).Camera.zoomLevel)},"#initializeLayerGroups"),uo=s(function(){var n,a,h;let t=(h=(a=(n=o(this,L).internal.mvf)==null?void 0:n.enterprise)==null?void 0:a.layers)!=null?h:[],e={},i={};t.forEach(u=>{e[u.name]||(e[u.name]=[]),e[u.name].push(...u.spaces.map(({spaceId:f})=>f));for(let{spaceId:f}of u.spaces)i[f]==null&&(i[f]=[]),i[f].push(u.name)}),c(this,ht,t.map(({name:u})=>u)),c(this,mt,i),c(this,ft,e)},"#setupLayers"),Ut=s(function(t){o(this,l).preloadFloors(o(this,L).getByType("facade").map(e=>vt(o(this,y).get(e.floorStack.id),t,o(this,B))).filter(e=>e!=null&&Lo.is(e)))},"#preloadFloors"),pt=new WeakMap,gt=new WeakMap,Ft=new WeakMap,yt=new WeakMap,et=new WeakMap,$t=s(function(t,e,i){t.forEach(n=>{if(n.floor)if(e){let a=i!==void 0?at(_({},n.state),{labels:at(_({},n.state.labels),{enabled:n.state.labels.enabled&&i}),markers:at(_({},n.state.markers),{enabled:n.state.markers.enabled&&i}),occlusion:at(_({},n.state.occlusion),{enabled:n.state.occlusion.enabled&&i})}):n.state;o(this,l).updateState(n.floor,a)}else o(this,l).updateState(n.floor,{visible:!1})})},"#updateFloorVisibility"),co=s(async function(t,e,i,n){return E(this,g,$t).call(this,e.floorStates,!0,n),t.animateFacade(i.state,o(this,m).indoorAnimationOptions)},"#animateIndoorSequence"),ho=s(async function(t,e,i,n){let a=await t.animateFacade(i.state,o(this,m).outdoorAnimationOptions);return a.result==="completed"&&E(this,g,$t).call(this,e.floorStates,At({building:t,currentFloor:o(this,l).currentFloor,inRange:o(this,M)==="in-range",inFocus:o(this,U).has(t.id),mode:o(this,m).mode,elevation:o(this,B),inNavigation:n.includes(t.floorStack.id),dynamicBuildingInteriors:o(this,m).dynamicBuildingInteriors})),a},"#animateOutdoorSequence"),q=new WeakMap,s(Yt,"DynamicFocus");var so=Yt;export{s as a,ve as b,we as c,so as d};
@@ -111,7 +111,7 @@ type DynamicFocusEventPayload<EventName extends keyof DynamicFocusEvents> = Dyna
111
111
  data: null;
112
112
  } ? DynamicFocusEvents[EventName]['data'] : DynamicFocusEvents[EventName];
113
113
  //#endregion
114
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/primitive.d.ts
114
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/primitive.d.ts
115
115
  /**
116
116
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
117
117
 
@@ -119,27 +119,81 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
119
119
  */
120
120
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
121
121
  //#endregion
122
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/observable-like.d.ts
123
- declare global {
124
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
125
- interface SymbolConstructor {
126
- readonly observable: symbol;
127
- }
122
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-any.d.ts
123
+ /**
124
+ Returns a boolean for whether the given type is `any`.
125
+
126
+ @link https://stackoverflow.com/a/49928360/1490091
127
+
128
+ Useful in type utilities, such as disallowing `any`s to be passed to a function.
129
+
130
+ @example
131
+ ```
132
+ import type {IsAny} from 'type-fest';
133
+
134
+ const typedObject = {a: 1, b: 2} as const;
135
+ const anyObject: any = {a: 1, b: 2};
136
+
137
+ function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
138
+ return obj[key];
128
139
  }
129
140
 
130
- /**
131
- @remarks
132
- The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
133
- As well, some guidance on making an `Observable` to not include `closed` property.
134
- @see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
135
- @see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
136
- @see https://github.com/benlesh/symbol-observable#making-an-object-observable
137
-
138
- @category Observable
141
+ const typedA = get(typedObject, 'a');
142
+ //=> 1
143
+
144
+ const anyA = get(anyObject, 'a');
145
+ //=> any
146
+ ```
147
+
148
+ @category Type Guard
149
+ @category Utilities
139
150
  */
151
+ type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
152
+ //#endregion
153
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-optional-key-of.d.ts
154
+ /**
155
+ Returns a boolean for whether the given key is an optional key of type.
156
+
157
+ This is useful when writing utility types or schema validators that need to differentiate `optional` keys.
140
158
 
159
+ @example
160
+ ```
161
+ import type {IsOptionalKeyOf} from 'type-fest';
162
+
163
+ interface User {
164
+ name: string;
165
+ surname: string;
166
+
167
+ luckyNumber?: number;
168
+ }
169
+
170
+ interface Admin {
171
+ name: string;
172
+ surname?: string;
173
+ }
174
+
175
+ type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
176
+ //=> true
177
+
178
+ type T2 = IsOptionalKeyOf<User, 'name'>;
179
+ //=> false
180
+
181
+ type T3 = IsOptionalKeyOf<User, 'name' | 'luckyNumber'>;
182
+ //=> boolean
183
+
184
+ type T4 = IsOptionalKeyOf<User | Admin, 'name'>;
185
+ //=> false
186
+
187
+ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
188
+ //=> boolean
189
+ ```
190
+
191
+ @category Type Guard
192
+ @category Utilities
193
+ */
194
+ type IsOptionalKeyOf<Type extends object, Key$1 extends keyof Type> = IsAny<Type | Key$1> extends true ? never : Key$1 extends keyof Type ? Type extends Record<Key$1, Type[Key$1]> ? false : true : false;
141
195
  //#endregion
142
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/optional-keys-of.d.ts
196
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/optional-keys-of.d.ts
143
197
  /**
144
198
  Extract all optional keys from the given type.
145
199
 
@@ -173,11 +227,11 @@ const update2: UpdateOperation<User> = {
173
227
 
174
228
  @category Utilities
175
229
  */
176
- type OptionalKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
177
- ? (keyof { [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
230
+ type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
231
+ ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
178
232
  : never;
179
233
  //#endregion
180
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/required-keys-of.d.ts
234
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/required-keys-of.d.ts
181
235
  /**
182
236
  Extract all required keys from the given type.
183
237
 
@@ -202,10 +256,10 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
202
256
 
203
257
  @category Utilities
204
258
  */
205
- type RequiredKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
206
- ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>> : never;
259
+ type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
260
+ ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
207
261
  //#endregion
208
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-never.d.ts
262
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-never.d.ts
209
263
  /**
210
264
  Returns a boolean for whether the given type is `never`.
211
265
 
@@ -249,64 +303,120 @@ endIfEqual('abc', '123');
249
303
  */
250
304
  type IsNever<T> = [T] extends [never] ? true : false;
251
305
  //#endregion
252
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-never.d.ts
306
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/if.d.ts
253
307
  /**
254
- An if-else-like type that resolves depending on whether the given type is `never`.
308
+ An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
255
309
 
256
- @see {@link IsNever}
310
+ Use-cases:
311
+ - You can use this in combination with `Is*` types to create an if-else-like experience. For example, `If<IsAny<any>, 'is any', 'not any'>`.
312
+
313
+ Note:
314
+ - Returns a union of if branch and else branch if the given type is `boolean` or `any`. For example, `If<boolean, 'Y', 'N'>` will return `'Y' | 'N'`.
315
+ - Returns the else branch if the given type is `never`. For example, `If<never, 'Y', 'N'>` will return `'N'`.
257
316
 
258
317
  @example
259
318
  ```
260
- import type {IfNever} from 'type-fest';
319
+ import {If} from 'type-fest';
261
320
 
262
- type ShouldBeTrue = IfNever<never>;
263
- //=> true
321
+ type A = If<true, 'yes', 'no'>;
322
+ //=> 'yes'
264
323
 
265
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
266
- //=> 'bar'
267
- ```
324
+ type B = If<false, 'yes', 'no'>;
325
+ //=> 'no'
268
326
 
269
- @category Type Guard
270
- @category Utilities
271
- */
272
- type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever<T> extends true ? TypeIfNever : TypeIfNotNever);
273
- //#endregion
274
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-any.d.ts
275
- // Can eventually be replaced with the built-in once this library supports
276
- // TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
277
- type NoInfer<T> = T extends infer U ? U : never;
327
+ type C = If<boolean, 'yes', 'no'>;
328
+ //=> 'yes' | 'no'
278
329
 
279
- /**
280
- Returns a boolean for whether the given type is `any`.
330
+ type D = If<any, 'yes', 'no'>;
331
+ //=> 'yes' | 'no'
281
332
 
282
- @link https://stackoverflow.com/a/49928360/1490091
333
+ type E = If<never, 'yes', 'no'>;
334
+ //=> 'no'
335
+ ```
283
336
 
284
- Useful in type utilities, such as disallowing `any`s to be passed to a function.
337
+ @example
338
+ ```
339
+ import {If, IsAny, IsNever} from 'type-fest';
340
+
341
+ type A = If<IsAny<unknown>, 'is any', 'not any'>;
342
+ //=> 'not any'
343
+
344
+ type B = If<IsNever<never>, 'is never', 'not never'>;
345
+ //=> 'is never'
346
+ ```
285
347
 
286
348
  @example
287
349
  ```
288
- import type {IsAny} from 'type-fest';
350
+ import {If, IsEqual} from 'type-fest';
289
351
 
290
- const typedObject = {a: 1, b: 2} as const;
291
- const anyObject: any = {a: 1, b: 2};
352
+ type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
292
353
 
293
- function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
294
- return obj[key];
295
- }
354
+ type A = IfEqual<string, string, 'equal', 'not equal'>;
355
+ //=> 'equal'
296
356
 
297
- const typedA = get(typedObject, 'a');
298
- //=> 1
357
+ type B = IfEqual<string, number, 'equal', 'not equal'>;
358
+ //=> 'not equal'
359
+ ```
299
360
 
300
- const anyA = get(anyObject, 'a');
301
- //=> any
361
+ Note: Sometimes using the `If` type can make an implementation non–tail-recursive, which can impact performance. In such cases, it’s better to use a conditional directly. Refer to the following example:
362
+
363
+ @example
364
+ ```
365
+ import type {If, IsEqual, StringRepeat} from 'type-fest';
366
+
367
+ type HundredZeroes = StringRepeat<'0', 100>;
368
+
369
+ // The following implementation is not tail recursive
370
+ type Includes<S extends string, Char extends string> =
371
+ S extends `${infer First}${infer Rest}`
372
+ ? If<IsEqual<First, Char>,
373
+ 'found',
374
+ Includes<Rest, Char>>
375
+ : 'not found';
376
+
377
+ // Hence, instantiations with long strings will fail
378
+ // @ts-expect-error
379
+ type Fails = Includes<HundredZeroes, '1'>;
380
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
381
+ // Error: Type instantiation is excessively deep and possibly infinite.
382
+
383
+ // However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
384
+ type IncludesWithoutIf<S extends string, Char extends string> =
385
+ S extends `${infer First}${infer Rest}`
386
+ ? IsEqual<First, Char> extends true
387
+ ? 'found'
388
+ : IncludesWithoutIf<Rest, Char>
389
+ : 'not found';
390
+
391
+ // Now, instantiations with long strings will work
392
+ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
393
+ //=> 'not found'
302
394
  ```
303
395
 
304
396
  @category Type Guard
305
397
  @category Utilities
306
398
  */
307
- type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
399
+ type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
308
400
  //#endregion
309
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/simplify.d.ts
401
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/type.d.ts
402
+ /**
403
+ Matches any primitive, `void`, `Date`, or `RegExp` value.
404
+ */
405
+ type BuiltIns = Primitive | void | Date | RegExp;
406
+ /**
407
+ Test if the given function has multiple call signatures.
408
+
409
+ Needed to handle the case of a single call signature with properties.
410
+
411
+ Multiple call signatures cannot currently be supported due to a TypeScript limitation.
412
+ @see https://github.com/microsoft/TypeScript/issues/29732
413
+ */
414
+ type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
415
+ (...arguments_: infer A): unknown;
416
+ (...arguments_: infer B): unknown;
417
+ } ? B extends A ? A extends B ? false : true : true : false;
418
+ //#endregion
419
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/simplify.d.ts
310
420
  /**
311
421
  Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
312
422
 
@@ -361,12 +471,12 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
361
471
  ```
362
472
 
363
473
  @link https://github.com/microsoft/TypeScript/issues/15300
364
- @see SimplifyDeep
474
+ @see {@link SimplifyDeep}
365
475
  @category Object
366
476
  */
367
477
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
368
478
  //#endregion
369
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/omit-index-signature.d.ts
479
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/omit-index-signature.d.ts
370
480
  /**
371
481
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
372
482
 
@@ -454,12 +564,12 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
454
564
  // => { foo: 'bar'; qux?: 'baz' | undefined; }
455
565
  ```
456
566
 
457
- @see PickIndexSignature
567
+ @see {@link PickIndexSignature}
458
568
  @category Object
459
569
  */
460
570
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
461
571
  //#endregion
462
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/pick-index-signature.d.ts
572
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/pick-index-signature.d.ts
463
573
  /**
464
574
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
465
575
 
@@ -502,12 +612,12 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
502
612
  // }
503
613
  ```
504
614
 
505
- @see OmitIndexSignature
615
+ @see {@link OmitIndexSignature}
506
616
  @category Object
507
617
  */
508
618
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
509
619
  //#endregion
510
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/merge.d.ts
620
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/merge.d.ts
511
621
  // Merges two objects without worrying about index signatures.
512
622
  type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
513
623
 
@@ -547,35 +657,7 @@ export type FooBar = Merge<Foo, Bar>;
547
657
  */
548
658
  type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
549
659
  //#endregion
550
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-any.d.ts
551
- /**
552
- An if-else-like type that resolves depending on whether the given type is `any`.
553
-
554
- @see {@link IsAny}
555
-
556
- @example
557
- ```
558
- import type {IfAny} from 'type-fest';
559
-
560
- type ShouldBeTrue = IfAny<any>;
561
- //=> true
562
-
563
- type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
564
- //=> 'bar'
565
- ```
566
-
567
- @category Type Guard
568
- @category Utilities
569
- */
570
- type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny<T> extends true ? TypeIfAny : TypeIfNotAny);
571
- //#endregion
572
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/type.d.ts
573
- /**
574
- Matches any primitive, `void`, `Date`, or `RegExp` value.
575
- */
576
- type BuiltIns = Primitive | void | Date | RegExp;
577
- //#endregion
578
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/object.d.ts
660
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/object.d.ts
579
661
 
580
662
  /**
581
663
  Merges user specified options with default options.
@@ -629,10 +711,9 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
629
711
  // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
630
712
  ```
631
713
  */
632
- type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = IfAny<SpecifiedOptions, Defaults, IfNever<SpecifiedOptions, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? Extract<SpecifiedOptions[Key], undefined> extends never ? Key : never : Key]: SpecifiedOptions[Key] }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
633
- >>;
714
+ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
634
715
  //#endregion
635
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/partial-deep.d.ts
716
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/partial-deep.d.ts
636
717
  /**
637
718
  @see {@link PartialDeep}
638
719
  */
@@ -647,24 +728,23 @@ type PartialDeepOptions = {
647
728
  Allows `undefined` values in non-tuple arrays.
648
729
  - When set to `true`, elements of non-tuple arrays can be `undefined`.
649
730
  - When set to `false`, only explicitly defined elements are allowed in non-tuple arrays, ensuring stricter type checking.
650
- @default true
731
+ @default false
651
732
  @example
652
- You can prevent `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: false}` as the second type argument:
733
+ You can allow `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}` as the second type argument:
653
734
  ```
654
735
  import type {PartialDeep} from 'type-fest';
655
736
  type Settings = {
656
737
  languages: string[];
657
738
  };
658
- declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: false}>;
659
- partialSettings.languages = [undefined]; // Error
660
- partialSettings.languages = []; // Ok
739
+ declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}>;
740
+ partialSettings.languages = [undefined]; // OK
661
741
  ```
662
742
  */
663
743
  readonly allowUndefinedInNonTupleArrays?: boolean;
664
744
  };
665
745
  type DefaultPartialDeepOptions = {
666
746
  recurseIntoArrays: false;
667
- allowUndefinedInNonTupleArrays: true;
747
+ allowUndefinedInNonTupleArrays: false;
668
748
  };
669
749
 
670
750
  /**
@@ -678,19 +758,19 @@ Use-cases:
678
758
  ```
679
759
  import type {PartialDeep} from 'type-fest';
680
760
 
681
- const settings: Settings = {
761
+ let settings = {
682
762
  textEditor: {
683
763
  fontSize: 14,
684
764
  fontColor: '#000000',
685
- fontWeight: 400
765
+ fontWeight: 400,
686
766
  },
687
767
  autocomplete: false,
688
- autosave: true
768
+ autosave: true,
689
769
  };
690
770
 
691
- const applySavedSettings = (savedSettings: PartialDeep<Settings>) => {
692
- return {...settings, ...savedSettings};
693
- }
771
+ const applySavedSettings = (savedSettings: PartialDeep<typeof settings>) => (
772
+ {...settings, ...savedSettings, textEditor: {...settings.textEditor, ...savedSettings.textEditor}}
773
+ );
694
774
 
695
775
  settings = applySavedSettings({textEditor: {fontWeight: 500}});
696
776
  ```
@@ -700,13 +780,15 @@ By default, this does not affect elements in array and tuple types. You can chan
700
780
  ```
701
781
  import type {PartialDeep} from 'type-fest';
702
782
 
703
- type Settings = {
704
- languages: string[];
705
- }
783
+ type Shape = {
784
+ dimensions: [number, number];
785
+ };
706
786
 
707
- const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true}> = {
708
- languages: [undefined]
787
+ const partialShape: PartialDeep<Shape, {recurseIntoArrays: true}> = {
788
+ dimensions: [], // OK
709
789
  };
790
+
791
+ partialShape.dimensions = [15]; // OK
710
792
  ```
711
793
 
712
794
  @see {@link PartialDeepOptions}
@@ -717,8 +799,8 @@ const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true}> = {
717
799
  @category Map
718
800
  */
719
801
  type PartialDeep<T, Options extends PartialDeepOptions = {}> = _PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
720
- type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown)) ? T : IsNever<keyof T> extends true // For functions with no properties
721
- ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
802
+ type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown)) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T extends ((...arguments_: any[]) => unknown) ? IsNever<keyof T> extends true ? T // For functions with no properties
803
+ : HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & PartialObjectDeep<T, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
722
804
  ? Options['recurseIntoArrays'] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
723
805
  ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
724
806
  ? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : PartialObjectDeep<T, Options> // Tuples behave properly
@@ -748,7 +830,7 @@ type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {
748
830
  /**
749
831
  Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
750
832
  */
751
- type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = (ObjectType extends ((...arguments_: any) => unknown) ? (...arguments_: Parameters<ObjectType>) => ReturnType<ObjectType> : {}) & ({ [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options> });
833
+ type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = { [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options> };
752
834
  //#endregion
753
835
  //#region ../packages/common/extensions.d.ts
754
836
  interface MapViewExtension<T> {
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{a as d,b as u,c as y,d as F}from"./chunk-Z5WTQ5AT.js";var p=d((t,o)=>{var l,i,s,a;let n={initialVisibility:(l=o.initialVisibility)!=null?l:"outdoor-first",layersBySpaceId:(i=o.layersBySpaceId)!=null?i:{},focusLayers:(s=o.focusLayers)!=null?s:[],defaultFloor:(a=o.defaultFloor)!=null?a:t.currentFloor},e=O(t,n),c=e+y,r=e+u;return n.initialVisibility==="indoor-first"&&(c=e-u,r=e-y),{indoorZoomThreshold:c,outdoorZoomThreshold:r}},"calculateZoomThresholds");function O(t,o){var l;let n=t.getMapData().getByType("space"),e=o.focusLayers.length?n.filter(i=>{var a,f,m;let s=(a=o.layersBySpaceId[i.id])==null?void 0:a[0];return typeof s=="string"&&i.floor.id===((f=o.defaultFloor)==null?void 0:f.id)&&((m=o.focusLayers)==null?void 0:m.indexOf(s))!==-1}):void 0,c=(l=t.Camera.getFocusOnTransform(o.defaultFloor,{}).zoomLevel)!=null?l:0,r=e!=null&&e.length?t.Camera.getFocusOnTransform(e,{}).zoomLevel:void 0;return r!=null?r:c}d(O,"getDefaultZoomLevel");export{F as DynamicFocus,p as calculateZoomThresholds};
1
+ import{a as d,b as u,c as y,d as F}from"./chunk-I4YW7HLG.js";var p=d((t,o)=>{var l,i,s,a;let n={initialVisibility:(l=o.initialVisibility)!=null?l:"outdoor-first",layersBySpaceId:(i=o.layersBySpaceId)!=null?i:{},focusLayers:(s=o.focusLayers)!=null?s:[],defaultFloor:(a=o.defaultFloor)!=null?a:t.currentFloor},e=O(t,n),c=e+y,r=e+u;return n.initialVisibility==="indoor-first"&&(c=e-u,r=e-y),{indoorZoomThreshold:c,outdoorZoomThreshold:r}},"calculateZoomThresholds");function O(t,o){var l;let n=t.getMapData().getByType("space"),e=o.focusLayers.length?n.filter(i=>{var a,f,m;let s=(a=o.layersBySpaceId[i.id])==null?void 0:a[0];return typeof s=="string"&&i.floor.id===((f=o.defaultFloor)==null?void 0:f.id)&&((m=o.focusLayers)==null?void 0:m.indexOf(s))!==-1}):void 0,c=(l=t.Camera.getFocusOnTransform(o.defaultFloor,{}).zoomLevel)!=null?l:0,r=e!=null&&e.length?t.Camera.getFocusOnTransform(e,{}).zoomLevel:void 0;return r!=null?r:c}d(O,"getDefaultZoomLevel");export{F as DynamicFocus,p as calculateZoomThresholds};
@@ -111,7 +111,7 @@ type DynamicFocusEventPayload<EventName extends keyof DynamicFocusEvents> = Dyna
111
111
  data: null;
112
112
  } ? DynamicFocusEvents[EventName]['data'] : DynamicFocusEvents[EventName];
113
113
  //#endregion
114
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/primitive.d.ts
114
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/primitive.d.ts
115
115
  /**
116
116
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
117
117
 
@@ -119,27 +119,81 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
119
119
  */
120
120
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
121
121
  //#endregion
122
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/observable-like.d.ts
123
- declare global {
124
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
125
- interface SymbolConstructor {
126
- readonly observable: symbol;
127
- }
122
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-any.d.ts
123
+ /**
124
+ Returns a boolean for whether the given type is `any`.
125
+
126
+ @link https://stackoverflow.com/a/49928360/1490091
127
+
128
+ Useful in type utilities, such as disallowing `any`s to be passed to a function.
129
+
130
+ @example
131
+ ```
132
+ import type {IsAny} from 'type-fest';
133
+
134
+ const typedObject = {a: 1, b: 2} as const;
135
+ const anyObject: any = {a: 1, b: 2};
136
+
137
+ function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
138
+ return obj[key];
128
139
  }
129
140
 
130
- /**
131
- @remarks
132
- The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
133
- As well, some guidance on making an `Observable` to not include `closed` property.
134
- @see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
135
- @see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
136
- @see https://github.com/benlesh/symbol-observable#making-an-object-observable
137
-
138
- @category Observable
141
+ const typedA = get(typedObject, 'a');
142
+ //=> 1
143
+
144
+ const anyA = get(anyObject, 'a');
145
+ //=> any
146
+ ```
147
+
148
+ @category Type Guard
149
+ @category Utilities
139
150
  */
151
+ type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
152
+ //#endregion
153
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-optional-key-of.d.ts
154
+ /**
155
+ Returns a boolean for whether the given key is an optional key of type.
156
+
157
+ This is useful when writing utility types or schema validators that need to differentiate `optional` keys.
140
158
 
159
+ @example
160
+ ```
161
+ import type {IsOptionalKeyOf} from 'type-fest';
162
+
163
+ interface User {
164
+ name: string;
165
+ surname: string;
166
+
167
+ luckyNumber?: number;
168
+ }
169
+
170
+ interface Admin {
171
+ name: string;
172
+ surname?: string;
173
+ }
174
+
175
+ type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
176
+ //=> true
177
+
178
+ type T2 = IsOptionalKeyOf<User, 'name'>;
179
+ //=> false
180
+
181
+ type T3 = IsOptionalKeyOf<User, 'name' | 'luckyNumber'>;
182
+ //=> boolean
183
+
184
+ type T4 = IsOptionalKeyOf<User | Admin, 'name'>;
185
+ //=> false
186
+
187
+ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
188
+ //=> boolean
189
+ ```
190
+
191
+ @category Type Guard
192
+ @category Utilities
193
+ */
194
+ type IsOptionalKeyOf<Type extends object, Key$1 extends keyof Type> = IsAny<Type | Key$1> extends true ? never : Key$1 extends keyof Type ? Type extends Record<Key$1, Type[Key$1]> ? false : true : false;
141
195
  //#endregion
142
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/optional-keys-of.d.ts
196
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/optional-keys-of.d.ts
143
197
  /**
144
198
  Extract all optional keys from the given type.
145
199
 
@@ -173,11 +227,11 @@ const update2: UpdateOperation<User> = {
173
227
 
174
228
  @category Utilities
175
229
  */
176
- type OptionalKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
177
- ? (keyof { [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
230
+ type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
231
+ ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
178
232
  : never;
179
233
  //#endregion
180
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/required-keys-of.d.ts
234
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/required-keys-of.d.ts
181
235
  /**
182
236
  Extract all required keys from the given type.
183
237
 
@@ -202,10 +256,10 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
202
256
 
203
257
  @category Utilities
204
258
  */
205
- type RequiredKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
206
- ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>> : never;
259
+ type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
260
+ ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
207
261
  //#endregion
208
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-never.d.ts
262
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-never.d.ts
209
263
  /**
210
264
  Returns a boolean for whether the given type is `never`.
211
265
 
@@ -249,64 +303,120 @@ endIfEqual('abc', '123');
249
303
  */
250
304
  type IsNever<T> = [T] extends [never] ? true : false;
251
305
  //#endregion
252
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-never.d.ts
306
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/if.d.ts
253
307
  /**
254
- An if-else-like type that resolves depending on whether the given type is `never`.
308
+ An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
255
309
 
256
- @see {@link IsNever}
310
+ Use-cases:
311
+ - You can use this in combination with `Is*` types to create an if-else-like experience. For example, `If<IsAny<any>, 'is any', 'not any'>`.
312
+
313
+ Note:
314
+ - Returns a union of if branch and else branch if the given type is `boolean` or `any`. For example, `If<boolean, 'Y', 'N'>` will return `'Y' | 'N'`.
315
+ - Returns the else branch if the given type is `never`. For example, `If<never, 'Y', 'N'>` will return `'N'`.
257
316
 
258
317
  @example
259
318
  ```
260
- import type {IfNever} from 'type-fest';
319
+ import {If} from 'type-fest';
261
320
 
262
- type ShouldBeTrue = IfNever<never>;
263
- //=> true
321
+ type A = If<true, 'yes', 'no'>;
322
+ //=> 'yes'
323
+
324
+ type B = If<false, 'yes', 'no'>;
325
+ //=> 'no'
326
+
327
+ type C = If<boolean, 'yes', 'no'>;
328
+ //=> 'yes' | 'no'
264
329
 
265
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
266
- //=> 'bar'
330
+ type D = If<any, 'yes', 'no'>;
331
+ //=> 'yes' | 'no'
332
+
333
+ type E = If<never, 'yes', 'no'>;
334
+ //=> 'no'
267
335
  ```
268
336
 
269
- @category Type Guard
270
- @category Utilities
271
- */
272
- type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever<T> extends true ? TypeIfNever : TypeIfNotNever);
273
- //#endregion
274
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-any.d.ts
275
- // Can eventually be replaced with the built-in once this library supports
276
- // TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
277
- type NoInfer<T> = T extends infer U ? U : never;
337
+ @example
338
+ ```
339
+ import {If, IsAny, IsNever} from 'type-fest';
278
340
 
279
- /**
280
- Returns a boolean for whether the given type is `any`.
341
+ type A = If<IsAny<unknown>, 'is any', 'not any'>;
342
+ //=> 'not any'
281
343
 
282
- @link https://stackoverflow.com/a/49928360/1490091
344
+ type B = If<IsNever<never>, 'is never', 'not never'>;
345
+ //=> 'is never'
346
+ ```
283
347
 
284
- Useful in type utilities, such as disallowing `any`s to be passed to a function.
348
+ @example
349
+ ```
350
+ import {If, IsEqual} from 'type-fest';
351
+
352
+ type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
353
+
354
+ type A = IfEqual<string, string, 'equal', 'not equal'>;
355
+ //=> 'equal'
356
+
357
+ type B = IfEqual<string, number, 'equal', 'not equal'>;
358
+ //=> 'not equal'
359
+ ```
360
+
361
+ Note: Sometimes using the `If` type can make an implementation non–tail-recursive, which can impact performance. In such cases, it’s better to use a conditional directly. Refer to the following example:
285
362
 
286
363
  @example
287
364
  ```
288
- import type {IsAny} from 'type-fest';
365
+ import type {If, IsEqual, StringRepeat} from 'type-fest';
289
366
 
290
- const typedObject = {a: 1, b: 2} as const;
291
- const anyObject: any = {a: 1, b: 2};
367
+ type HundredZeroes = StringRepeat<'0', 100>;
292
368
 
293
- function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
294
- return obj[key];
295
- }
369
+ // The following implementation is not tail recursive
370
+ type Includes<S extends string, Char extends string> =
371
+ S extends `${infer First}${infer Rest}`
372
+ ? If<IsEqual<First, Char>,
373
+ 'found',
374
+ Includes<Rest, Char>>
375
+ : 'not found';
296
376
 
297
- const typedA = get(typedObject, 'a');
298
- //=> 1
377
+ // Hence, instantiations with long strings will fail
378
+ // @ts-expect-error
379
+ type Fails = Includes<HundredZeroes, '1'>;
380
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
381
+ // Error: Type instantiation is excessively deep and possibly infinite.
299
382
 
300
- const anyA = get(anyObject, 'a');
301
- //=> any
383
+ // However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
384
+ type IncludesWithoutIf<S extends string, Char extends string> =
385
+ S extends `${infer First}${infer Rest}`
386
+ ? IsEqual<First, Char> extends true
387
+ ? 'found'
388
+ : IncludesWithoutIf<Rest, Char>
389
+ : 'not found';
390
+
391
+ // Now, instantiations with long strings will work
392
+ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
393
+ //=> 'not found'
302
394
  ```
303
395
 
304
396
  @category Type Guard
305
397
  @category Utilities
306
398
  */
307
- type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
399
+ type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
308
400
  //#endregion
309
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/simplify.d.ts
401
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/type.d.ts
402
+ /**
403
+ Matches any primitive, `void`, `Date`, or `RegExp` value.
404
+ */
405
+ type BuiltIns = Primitive | void | Date | RegExp;
406
+ /**
407
+ Test if the given function has multiple call signatures.
408
+
409
+ Needed to handle the case of a single call signature with properties.
410
+
411
+ Multiple call signatures cannot currently be supported due to a TypeScript limitation.
412
+ @see https://github.com/microsoft/TypeScript/issues/29732
413
+ */
414
+ type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
415
+ (...arguments_: infer A): unknown;
416
+ (...arguments_: infer B): unknown;
417
+ } ? B extends A ? A extends B ? false : true : true : false;
418
+ //#endregion
419
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/simplify.d.ts
310
420
  /**
311
421
  Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
312
422
 
@@ -361,12 +471,12 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
361
471
  ```
362
472
 
363
473
  @link https://github.com/microsoft/TypeScript/issues/15300
364
- @see SimplifyDeep
474
+ @see {@link SimplifyDeep}
365
475
  @category Object
366
476
  */
367
477
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
368
478
  //#endregion
369
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/omit-index-signature.d.ts
479
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/omit-index-signature.d.ts
370
480
  /**
371
481
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
372
482
 
@@ -454,12 +564,12 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
454
564
  // => { foo: 'bar'; qux?: 'baz' | undefined; }
455
565
  ```
456
566
 
457
- @see PickIndexSignature
567
+ @see {@link PickIndexSignature}
458
568
  @category Object
459
569
  */
460
570
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
461
571
  //#endregion
462
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/pick-index-signature.d.ts
572
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/pick-index-signature.d.ts
463
573
  /**
464
574
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
465
575
 
@@ -502,12 +612,12 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
502
612
  // }
503
613
  ```
504
614
 
505
- @see OmitIndexSignature
615
+ @see {@link OmitIndexSignature}
506
616
  @category Object
507
617
  */
508
618
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
509
619
  //#endregion
510
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/merge.d.ts
620
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/merge.d.ts
511
621
  // Merges two objects without worrying about index signatures.
512
622
  type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
513
623
 
@@ -547,35 +657,7 @@ export type FooBar = Merge<Foo, Bar>;
547
657
  */
548
658
  type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
549
659
  //#endregion
550
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-any.d.ts
551
- /**
552
- An if-else-like type that resolves depending on whether the given type is `any`.
553
-
554
- @see {@link IsAny}
555
-
556
- @example
557
- ```
558
- import type {IfAny} from 'type-fest';
559
-
560
- type ShouldBeTrue = IfAny<any>;
561
- //=> true
562
-
563
- type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
564
- //=> 'bar'
565
- ```
566
-
567
- @category Type Guard
568
- @category Utilities
569
- */
570
- type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny<T> extends true ? TypeIfAny : TypeIfNotAny);
571
- //#endregion
572
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/type.d.ts
573
- /**
574
- Matches any primitive, `void`, `Date`, or `RegExp` value.
575
- */
576
- type BuiltIns = Primitive | void | Date | RegExp;
577
- //#endregion
578
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/object.d.ts
660
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/object.d.ts
579
661
 
580
662
  /**
581
663
  Merges user specified options with default options.
@@ -629,10 +711,9 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
629
711
  // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
630
712
  ```
631
713
  */
632
- type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = IfAny<SpecifiedOptions, Defaults, IfNever<SpecifiedOptions, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? Extract<SpecifiedOptions[Key], undefined> extends never ? Key : never : Key]: SpecifiedOptions[Key] }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
633
- >>;
714
+ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
634
715
  //#endregion
635
- //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/partial-deep.d.ts
716
+ //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/partial-deep.d.ts
636
717
  /**
637
718
  @see {@link PartialDeep}
638
719
  */
@@ -647,24 +728,23 @@ type PartialDeepOptions = {
647
728
  Allows `undefined` values in non-tuple arrays.
648
729
  - When set to `true`, elements of non-tuple arrays can be `undefined`.
649
730
  - When set to `false`, only explicitly defined elements are allowed in non-tuple arrays, ensuring stricter type checking.
650
- @default true
731
+ @default false
651
732
  @example
652
- You can prevent `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: false}` as the second type argument:
733
+ You can allow `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}` as the second type argument:
653
734
  ```
654
735
  import type {PartialDeep} from 'type-fest';
655
736
  type Settings = {
656
737
  languages: string[];
657
738
  };
658
- declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: false}>;
659
- partialSettings.languages = [undefined]; // Error
660
- partialSettings.languages = []; // Ok
739
+ declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}>;
740
+ partialSettings.languages = [undefined]; // OK
661
741
  ```
662
742
  */
663
743
  readonly allowUndefinedInNonTupleArrays?: boolean;
664
744
  };
665
745
  type DefaultPartialDeepOptions = {
666
746
  recurseIntoArrays: false;
667
- allowUndefinedInNonTupleArrays: true;
747
+ allowUndefinedInNonTupleArrays: false;
668
748
  };
669
749
 
670
750
  /**
@@ -678,19 +758,19 @@ Use-cases:
678
758
  ```
679
759
  import type {PartialDeep} from 'type-fest';
680
760
 
681
- const settings: Settings = {
761
+ let settings = {
682
762
  textEditor: {
683
763
  fontSize: 14,
684
764
  fontColor: '#000000',
685
- fontWeight: 400
765
+ fontWeight: 400,
686
766
  },
687
767
  autocomplete: false,
688
- autosave: true
768
+ autosave: true,
689
769
  };
690
770
 
691
- const applySavedSettings = (savedSettings: PartialDeep<Settings>) => {
692
- return {...settings, ...savedSettings};
693
- }
771
+ const applySavedSettings = (savedSettings: PartialDeep<typeof settings>) => (
772
+ {...settings, ...savedSettings, textEditor: {...settings.textEditor, ...savedSettings.textEditor}}
773
+ );
694
774
 
695
775
  settings = applySavedSettings({textEditor: {fontWeight: 500}});
696
776
  ```
@@ -700,13 +780,15 @@ By default, this does not affect elements in array and tuple types. You can chan
700
780
  ```
701
781
  import type {PartialDeep} from 'type-fest';
702
782
 
703
- type Settings = {
704
- languages: string[];
705
- }
783
+ type Shape = {
784
+ dimensions: [number, number];
785
+ };
706
786
 
707
- const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true}> = {
708
- languages: [undefined]
787
+ const partialShape: PartialDeep<Shape, {recurseIntoArrays: true}> = {
788
+ dimensions: [], // OK
709
789
  };
790
+
791
+ partialShape.dimensions = [15]; // OK
710
792
  ```
711
793
 
712
794
  @see {@link PartialDeepOptions}
@@ -717,8 +799,8 @@ const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true}> = {
717
799
  @category Map
718
800
  */
719
801
  type PartialDeep<T, Options extends PartialDeepOptions = {}> = _PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
720
- type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown)) ? T : IsNever<keyof T> extends true // For functions with no properties
721
- ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
802
+ type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown)) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T extends ((...arguments_: any[]) => unknown) ? IsNever<keyof T> extends true ? T // For functions with no properties
803
+ : HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & PartialObjectDeep<T, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
722
804
  ? Options['recurseIntoArrays'] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
723
805
  ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
724
806
  ? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : PartialObjectDeep<T, Options> // Tuples behave properly
@@ -748,7 +830,7 @@ type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {
748
830
  /**
749
831
  Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
750
832
  */
751
- type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = (ObjectType extends ((...arguments_: any) => unknown) ? (...arguments_: Parameters<ObjectType>) => ReturnType<ObjectType> : {}) & ({ [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options> });
833
+ type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = { [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options> };
752
834
  //#endregion
753
835
  //#region ../packages/common/extensions.d.ts
754
836
  interface MapViewExtension<T> {
@@ -1 +1 @@
1
- import{a as t,d as a}from"../chunk-Z5WTQ5AT.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!=null&&o.off(n,e)}},[o,n,e])}t(x,"useDynamicFocusEvent");export{i as useDynamicFocus,x as useDynamicFocusEvent};
1
+ import{a as t,d as a}from"../chunk-I4YW7HLG.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!=null&&o.off(n,e)}},[o,n,e])}t(x,"useDynamicFocusEvent");export{i as useDynamicFocus,x as useDynamicFocusEvent};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappedin/dynamic-focus",
3
- "version": "6.9.1-beta.0",
3
+ "version": "6.10.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/mappedin-js": "^6.9.1",
41
- "@mappedin/react-sdk": "^6.9.1",
42
- "@mappedin/react-native-sdk": "^6.9.1"
40
+ "@mappedin/react-native-sdk": "^6.10.0",
41
+ "@mappedin/react-sdk": "^6.10.0",
42
+ "@mappedin/mappedin-js": "^6.10.0"
43
43
  },
44
44
  "peerDependenciesMeta": {
45
45
  "@mappedin/react-sdk": {
@@ -1 +0,0 @@
1
- var Ht=Object.defineProperty,po=Object.defineProperties;var go=Object.getOwnPropertyDescriptors;var qt=Object.getOwnPropertySymbols;var Fo=Object.prototype.hasOwnProperty,yo=Object.prototype.propertyIsEnumerable;var zt=r=>{throw TypeError(r)};var Vt=(r,t,e)=>t in r?Ht(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_=(r,t)=>{for(var e in t||(t={}))Fo.call(t,e)&&Vt(r,e,t[e]);if(qt)for(var e of qt(t))yo.call(t,e)&&Vt(r,e,t[e]);return r},at=(r,t)=>po(r,go(t)),s=(r,t)=>Ht(r,"name",{value:t,configurable:!0});var p=(r,t,e)=>Vt(r,typeof t!="symbol"?t+"":t,e),Mt=(r,t,e)=>t.has(r)||zt("Cannot "+e);var o=(r,t,e)=>(Mt(r,t,"read from private field"),e?e.call(r):t.get(r)),d=(r,t,e)=>t.has(r)?zt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),c=(r,t,e,i)=>(Mt(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e),E=(r,t,e)=>(Mt(r,t,"access private method"),e);var b={env:{NODE_ENV:"production",npm_package_version:"6.9.1-beta.0"}};import{Floor as Lo,getMultiFloorState as Co}from"@mappedin/mappedin-js";function Wt(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}s(Wt,"arraysEqual");var xt=class xt{constructor(){p(this,"_subscribers",{});p(this,"_abortController",new AbortController);p(this,"_cleanupFunctions",[])}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 n=i==null?void 0:i.signal;if(n!=null&&n.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(e);let a=s(()=>this.off(t,e),"cleanup");return n&&n.addEventListener("abort",a,{once:!0}),this._cleanupFunctions.push(a),a}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(){if(!this.signal.aborted){for(let t of this._cleanupFunctions)t();this._cleanupFunctions=[],this._subscribers={},this._abortController.abort()}}};s(xt,"PubSub");var St=xt;import{Facade as So,Floor as Eo,FloorStack as vo}from"@mappedin/mappedin-js";var w,st,N,v,S,I,W,K,Ot=class Ot{constructor(t,e){p(this,"__type","building");d(this,w);d(this,st,new Map);d(this,N,new Map);d(this,v,[]);d(this,S);d(this,I);p(this,"defaultFloor");p(this,"activeFloor");p(this,"excluded",!1);p(this,"floorsAltitudesMap",new Map);p(this,"aboveGroundFloors",[]);d(this,W);d(this,K);var n;c(this,w,t),c(this,st,new Map(t.floors.map(a=>[a.id,a]))),c(this,N,new Map(t.floors.map(a=>[a.elevation,a]))),c(this,v,Array.from(o(this,N).values()).sort((a,h)=>a.elevation-h.elevation)),this.defaultFloor=t.defaultFloor,this.activeFloor=this.defaultFloor,c(this,S,e),this.aboveGroundFloors=o(this,v).filter(a=>a.elevation>=0);let i=(n=t.facade)==null?void 0:n.spaces.map(a=>o(this,S).getState(a)).sort((a,h)=>a.altitude-h.altitude);if(i&&i.length===this.aboveGroundFloors.length)for(let a in this.aboveGroundFloors){let h=this.aboveGroundFloors[a],u=i[a];this.floorsAltitudesMap.set(h.elevation,{altitude:u.altitude,effectiveHeight:u.height})}}get id(){return o(this,w).id}get name(){return o(this,w).name}get floors(){return o(this,w).floors}get floorStack(){return o(this,w)}get facade(){return o(this,w).facade}get isCurrentFloorStack(){return this.id===o(this,S).currentFloorStack.id}get isIndoor(){let t=o(this,S).getState(this.facade);return this.isCurrentFloorStack||(t==null?void 0:t.visible)===!1&&(t==null?void 0: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,K)==null&&c(this,K,Math.min(...o(this,N).keys())),o(this,K)}has(t){return Eo.is(t)?o(this,st).has(t.id):vo.is(t)?t.id===o(this,w).id:So.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 n=o(this,v)[i];if(n.elevation<=t)return n}}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,I)&&(o(this,I).animation.cancel(),c(this,I,void 0))}async animateFacade(t,e={duration:150}){var h;let i=((h=o(this,I))==null?void 0:h.state)||o(this,S).getState(this.facade);if(!i||!t||(i==null?void 0:i.opacity)===t.opacity&&(i==null?void 0:i.visible)===t.visible)return{result:"completed"};this.cancelAnimation();let{opacity:n,visible:a}=t;if(o(this,S).updateState(this.facade,{visible:!0}),n!==void 0){c(this,I,{animation:o(this,S).animateState(this.facade,{opacity:n},{duration:e.duration}),state:t});let u=await o(this,I).animation;if(c(this,I,void 0),u.result==="cancelled")return u}return a===!1&&o(this,S).updateState(this.facade,{visible:a}),{result:"completed"}}destroy(){this.cancelAnimation(),o(this,w).floors.forEach(t=>{o(this,S).updateState(t,{visible:t.id===o(this,S).currentFloor.id})}),this.has(o(this,S).currentFloor)||o(this,S).updateState(this.facade,{visible:!0,opacity:1})}};w=new WeakMap,st=new WeakMap,N=new WeakMap,v=new WeakMap,S=new WeakMap,I=new WeakMap,W=new WeakMap,K=new WeakMap,s(Ot,"Building");var Et=Ot;function Kt(r,t,e){return r>=t?"in-range":r<=e?"out-of-range":"transition"}s(Kt,"getZoomState");function vt(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);default:break}return i.isIndoor?i.activeFloor:i.defaultFloor}s(vt,"getFloorToShow");function wo(r,t,e){return 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}}}s(wo,"getFacadeState");function ko(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}}}})}}s(ko,"getSingleBuildingState");function Qt(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"}s(Qt,"getOutdoorOpacity");function Jt(r,t,e){var i;switch(e){case"in-range":return(i=r[0])!=null&&i.canSetFloor?r[0]:void 0;case"out-of-range":return t;case"transition":default:return}}s(Jt,"getSetFloorTargetFromZoomState");function Xt(r){let{buildings:t,inViewSet:e,currentFloor:i,zoomState:n,mode:a,elevation:h,floorIdsInNavigation:u,floorStackIdsInNavigation:f,multiFloorView:P,getMultiFloorState:R,dynamicBuildingInteriors:bt,isolateBelowGroundView:it,currentElevation:rt}=r,A=new Map,D=it&&rt<0;for(let F of t){let H=e.has(F.id),nt=D&&F.minElevation>=0,It=nt?!1:H,z=nt?!1:At({building:F,currentFloor:i,inRange:n==="in-range",inFocus:H,mode:a,elevation:h,inNavigation:f.includes(F.id),dynamicBuildingInteriors:bt}),Tt=i.floorStack.id===F.id?F.activeFloor:vt(F,a,h),mo=P.enabled?R(F.floors,Tt||F.activeFloor,P==null?void 0:P.floorGap,u,F.floorsAltitudesMap):ko(F.floorStack,Tt||F.activeFloor,z),fo=wo(F.facade,z,it&&rt<0);A.set(F.id,{building:F,showIndoor:z,floorStackState:mo,facadeState:fo,inFocus:It,floorToShow:Tt})}return A}s(Xt,"getBuildingStates");function to(r,t){return r.excluded?"none":t?"indoor":"outdoor"}s(to,"getBuildingAnimationType");function At(r){let{building:t,currentFloor:e,inRange:i,inFocus:n,mode:a,elevation:h,inNavigation:u,dynamicBuildingInteriors:f}=r;if(t.id===e.floorStack.id)return!0;if(t.excluded)return!1;if(u===!0)return!0;if(!f)return e.floorStack.type!=="Outdoor";if(!i||!n)return!1;switch(a){case"lock-elevation":return t.getFloorByElevation(h)!=null;default:break}return!0}s(At,"shouldShowIndoor");function oo(r,t,e){return r!==t&&!e}s(oo,"shouldDeferSetFloor");var eo=["default-floor","lock-elevation","nearest-elevation"];import{Floor as Io,FloorStack as To}from"@mappedin/mappedin-js";var Dt="[MappedinJS]";function _t(r="",{prefix:t=Dt}={}){let e="".concat(t).concat(r?"-".concat(r):""),i=s((n,a)=>{if(typeof window<"u"&&window.rnDebug){let h=a.map(u=>u instanceof Error&&u.stack?"".concat(u.message,"\n").concat(u.stack):u);window.rnDebug("".concat(r," ").concat(n,": ").concat(h.join(" ")))}},"rnDebug");return{logState:b.env.NODE_ENV==="test"?3:0,log(...n){this.logState<=0&&(console.log(e,...n),i("log",n))},warn(...n){this.logState<=1&&(console.warn(e,...n),i("warn",n))},error(...n){this.logState<=2&&(console.error(e,...n),i("error",n))},assert(...n){console.assert(...n)},time(n){console.time(n)},timeEnd(n){console.timeEnd(n)},setLevel(n){0<=n&&n<=3&&(this.logState=n)}}}s(_t,"createLogger");var Bo=_t();var Q=Bo;function io(r,t,e,i){return(r<t||r>e)&&Q.warn(i),Math.min(e,Math.max(t,r))}s(io,"clampWithWarning");function Nt(r,t){return!Io.is(r)||(r==null?void 0:r.floorStack)==null||!To.is(t)?!1:r.floorStack.id!==t.id?(Q.warn("Floor (".concat(r.id,") does not belong to floor stack (").concat(t.id,").")),!1):!0}s(Nt,"validateFloorForStack");function Lt(r,t,e,i){return io(r,t,e,"".concat(i," must be between ").concat(t," and ").concat(e,"."))}s(Lt,"validateZoomThreshold");var J=_t("",{prefix:"[DynamicFocus]"});var T,X,lt,Ct,Zt=class Zt{constructor(t,e){d(this,lt);p(this,"__type","outdoors");d(this,T);d(this,X);c(this,T,t),c(this,X,e)}get id(){return o(this,T).id}get floorStack(){return o(this,T)}get floor(){return o(this,T).defaultFloor}matchesFloorStack(t){return t===o(this,T)||t===o(this,T).id}show(){E(this,lt,Ct).call(this,!0)}hide(){E(this,lt,Ct).call(this,!1)}destroy(){this.matchesFloorStack(o(this,X).currentFloorStack)||this.hide()}};T=new WeakMap,X=new WeakMap,lt=new WeakSet,Ct=s(function(t){for(let e of o(this,T).floors)o(this,X).updateState(e,{visible:t})},"#setVisible"),s(Zt,"Outdoors");var wt=Zt;function ro(r,t){var h;let e=r.getByType("floor-stack"),i=e.find(u=>{var f;return((f=u.type)==null?void 0:f.toLowerCase())==="outdoor"}),n=(h=r.getByType("enterprise-venue"))==null?void 0:h.defaultFloor;if(n){let u=r.getById("floor",n);if(u)return u.floorStack}if(i)return i;let a=e.find(u=>u.facade==null&&!t.has(u.id));return a||(J.warn("No good candidate for the outdoor floor stack was found. Using the first floor stack."),e[0])}s(ro,"getOutdoorFloorStack");import{getMultiFloorState as Vo}from"@mappedin/mappedin-js";var no={indoorZoomThreshold:18,outdoorZoomThreshold:17,setFloorOnFocus:!0,autoFocus:!1,indoorAnimationOptions:{duration:150},outdoorAnimationOptions:{duration:150},autoAdjustFacadeHeights:!1,mode:"default-floor",preloadFloors:!0,customMultiFloorVisibilityState:Vo,dynamicBuildingInteriors:!0,dynamicLayers:[],isolateBelowGroundView:!1},ve=.2,we=.4;function Mo(r,t){return"".concat(t," ").concat(r)}s(Mo,"formatMessage");var Gt=class Gt extends Error{constructor(t,e=Dt){super(Mo(t,e)),this.name="MappedinError"}};s(Gt,"MappedinError");var kt=Gt;var xo=s(r=>r,"linearEase"),Oo=s(r=>r*r,"quadEaseIn"),Ao=s(r=>1-Math.cos(r*Math.PI/2),"easeIn"),Do=s(r=>1-(1-r)*(1-r),"quadEaseOut"),_o={linear:xo,"ease-in":Oo,"ease-out":Do,"ease-in-out":Ao};function No(r,t){let e=0;if(t.length<2)return e;let n=t[0]<t[1]?(a,h)=>a>h:(a,h)=>a<h;for(;e<t.length-1&&n(r,t[e+1]);)e++;return e>t.length-2?Math.max(0,t.length-2):e}s(No,"getInterpolationBreakpoint");function ao(r,t,e,i="ease-in"){if(t.length!==e.length)throw new kt("Input and output ranges must have the same number of values.");r=Math.max(t[0],Math.min(r,t[t.length-1]));let n=No(r,t),a=(r-t[n])/(t[n+1]-t[n]),h=typeof i=="function"?i(a):_o[i](a);return e[n]+h*(e[n+1]-e[n])}s(ao,"interpolateMulti");var V,ut,dt,x,ct,Rt=class Rt{constructor(t,e,i){p(this,"layers");p(this,"visible");d(this,V);d(this,ut,[]);d(this,dt,!1);d(this,x,new Map);p(this,"interpolationFn");d(this,ct,1);this.layers=t,this.visible=e,c(this,V,i)}processLayerGroup(t,e,i){if(!o(this,dt)&&(this.layers.forEach(n=>{let a=t[n];a&&o(this,ut).push(...a)}),c(this,dt,!0),this.visible)){let n=[e,i],a=[1,0];this.interpolationFn=h=>ao(h,n,a)}}setOpacity(t){var e,i,n;c(this,ct,t);for(let a of o(this,ut))if(a.startsWith("img_")){let h=o(this,V).Image3D.getById(a);if(h){let u=o(this,V).getState(h.image);o(this,x).has(a)||o(this,x).set(a,(e=u==null?void 0:u.opacity)!=null?e:1);let f=Math.min(o(this,x).get(a),t);o(this,V).updateState(h.image,{opacity:f})}}else{let h=(i=o(this,V).getMapData())==null?void 0:i.getById("space",a);if(!h)continue;let u=o(this,V).getState(h);o(this,x).has(a)||o(this,x).set(a,(n=u==null?void 0:u.opacity)!=null?n:1);let f=Math.min(o(this,x).get(a),t);o(this,V).updateState(h,{opacity:f,visible:f>0})}}get opacity(){return o(this,ct)}};V=new WeakMap,ut=new WeakMap,dt=new WeakMap,x=new WeakMap,ct=new WeakMap,s(Rt,"LayerGroup");var Bt=Rt;function Pt(r,t){r.forEach(e=>{if(e.interpolationFn!=null){let i=e.interpolationFn(t);i!=null&&(e.setOpacity(i),e.visible=i===1)}})}s(Pt,"runLayerGroupInterpolations");var k,l,L,m,j,U,y,O,$,Y,B,tt,ht,mt,ft,M,C,ot,Z,G,g,jt,lo,uo,Ut,pt,gt,Ft,yt,et,$t,co,ho,q,Yt=class Yt{constructor(t){d(this,g);d(this,k);d(this,l);d(this,L);d(this,m,no);d(this,j,[]);d(this,U,new Set);d(this,y,new Map);d(this,O);d(this,$,!1);d(this,Y,!1);d(this,B,0);d(this,tt,0);d(this,ht,[]);d(this,mt,{});d(this,ft,{});d(this,M,"transition");d(this,C,"outdoor");d(this,ot,[]);d(this,Z,!1);d(this,G,[]);p(this,"sceneUpdateQueue",Promise.resolve());p(this,"on",s((t,e)=>{o(this,k).on(t,e)},"on"));p(this,"off",s((t,e)=>{o(this,k).off(t,e)},"off"));d(this,pt,s(t=>{if(!this.isEnabled)return;let{facades:e}=t;if(Wt(e,this.focusedFacades)&&o(this,C)==="transition"&&!o(this,Y))return;c(this,Y,!1),c(this,j,[]),o(this,U).clear();let i=o(this,m).isolateBelowGroundView&&o(this,B)<0;if(e.length>0)for(let n of e){let a=o(this,y).get(n.floorStack.id);if(a){if(i&&a.minElevation>=0)continue;o(this,U).add(a.id),o(this,j).push(a)}}o(this,m).autoFocus&&this.focus()},"#handleFacadesInViewChange"));d(this,gt,s(async t=>{var n,a,h,u;if(!this.isEnabled)return;let{floor:e}=t,i=o(this,y).get(e.floorStack.id);if(i&&(i.activeFloor=e),(i==null?void 0:i.excluded)===!1&&!o(this,O).matchesFloorStack(e.floorStack)&&c(this,B,e.elevation),o(this,l).manualFloorVisibility===!0){t.reason!=="dynamic-focus"&&(await o(this,q).call(this,e),o(this,k).publish("focus",{facades:this.focusedFacades}));let f=(a=(n=i==null?void 0:i.floorsAltitudesMap.get(e.elevation))==null?void 0:n.altitude)!=null?a:0;o(this,l).options.multiFloorView!=null&&((h=o(this,l).options.multiFloorView)!=null&&h.enabled)&&((u=o(this,l).options.multiFloorView)!=null&&u.updateCameraElevationOnFloorChange)&&o(this,l).Camera.elevation!==f&&o(this,l).Camera.animateElevation(f,{duration:750,easing:"ease-in-out"})}},"#handleFloorChangeStart"));d(this,Ft,s(()=>{c(this,$,!0)},"#handleUserInteractionStart"));d(this,yt,s(()=>{c(this,$,!1)},"#handleUserInteractionEnd"));d(this,et,s(t=>{if(!this.isEnabled)return;let{zoomLevel:e}=t,i=Kt(e,o(this,m).indoorZoomThreshold,o(this,m).outdoorZoomThreshold);o(this,M)!==i&&(c(this,M,i),i==="in-range"?this.setIndoor():i==="out-of-range"&&this.setOutdoor()),Pt(o(this,G),e)},"#handleCameraChange"));d(this,q,s(async t=>{var u,f,P;if(o(this,l).manualFloorVisibility!==!0||!this.isEnabled)return;let e=t||o(this,l).currentFloor,i=o(this,l).options.multiFloorView,n=((f=(u=o(this,l).Navigation)==null?void 0:u.floors)==null?void 0:f.map(R=>R.id))||[],a=((P=o(this,l).Navigation)==null?void 0:P.floorStacks.map(R=>R.id))||[],h=new Promise(async R=>{var rt;await this.sceneUpdateQueue;let bt=Xt({buildings:Array.from(o(this,y).values()),inViewSet:o(this,U),currentFloor:e,zoomState:o(this,M),mode:o(this,m).mode,elevation:o(this,B),floorIdsInNavigation:n,floorStackIdsInNavigation:a,multiFloorView:i,getMultiFloorState:(rt=o(this,m).customMultiFloorVisibilityState)!=null?rt:Co,dynamicBuildingInteriors:o(this,m).dynamicBuildingInteriors,isolateBelowGroundView:o(this,m).isolateBelowGroundView,currentElevation:o(this,B)}),it=[];await Promise.all(Array.from(bt.values()).map(async A=>{let{building:D,showIndoor:F,floorStackState:H,facadeState:nt,inFocus:It}=A;it.push(H);let z=to(D,F);if(z==="indoor")return E(this,g,co).call(this,D,H,nt,It);if(z==="outdoor")return E(this,g,ho).call(this,D,H,nt,a)})),o(this,l).Outdoor.setOpacity(Qt(it,o(this,m).mode)),c(this,ot,o(this,j).filter(A=>{var D;return((D=bt.get(A.id))==null?void 0:D.showIndoor)===!0}).map(A=>A.facade)),o(this,k).publish("focus",{facades:o(this,ot)}),R()});return this.sceneUpdateQueue=h,h},"#applyBuildingStates"));c(this,k,new St),c(this,l,t),J.setLevel(Q.logState),c(this,L,o(this,l).getMapData()),c(this,B,o(this,l).currentFloor.elevation),c(this,tt,o(this,l).Camera.elevation);for(let e of o(this,L).getByType("facade"))o(this,y).set(e.floorStack.id,new Et(e.floorStack,o(this,l)));E(this,g,uo).call(this),c(this,O,new wt(ro(o(this,L),o(this,y)),o(this,l))),o(this,l).on("floor-change-start",o(this,gt)),o(this,l).on("camera-change",o(this,et)),o(this,l).on("facades-in-view-change",o(this,pt)),o(this,l).on("user-interaction-start",o(this,Ft)),o(this,l).on("user-interaction-end",o(this,yt))}enable(t){if(o(this,Z)){J.warn("enable() called on an already enabled Dynamic Focus instance.");return}c(this,Z,!0),o(this,l).manualFloorVisibility=!0,o(this,O).show(),this.updateState(_(_({},o(this,m)),t)),E(this,g,lo).call(this),o(this,et).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,Z)){J.warn("disable() called on an already disabled Dynamic Focus instance.");return}c(this,Z,!1),o(this,l).manualFloorVisibility=!1}get isEnabled(){return o(this,Z)}get isIndoor(){return o(this,C)==="indoor"}get isOutdoor(){return o(this,C)==="outdoor"}get outdoorsFloorStack(){return o(this,O).floorStack}get layers(){return o(this,ht)}get layersBySpaceId(){return o(this,mt)}setIndoor(){c(this,C,"indoor"),c(this,M,"in-range"),E(this,g,jt).call(this)}setOutdoor(){c(this,C,"outdoor"),c(this,M,"out-of-range"),E(this,g,jt).call(this)}get focusedFacades(){return[...o(this,ot)]}getState(){return _({},o(this,m))}updateState(t){var i,n;let e=!1;t.indoorZoomThreshold!=null&&(t.indoorZoomThreshold=Lt(t.indoorZoomThreshold,(i=t==null?void 0:t.outdoorZoomThreshold)!=null?i:o(this,m).outdoorZoomThreshold,o(this,l).Camera.maxZoomLevel,"indoorZoomThreshold"),e=!0),t.outdoorZoomThreshold!=null&&(t.outdoorZoomThreshold=Lt(t.outdoorZoomThreshold,o(this,l).Camera.minZoomLevel,(n=t==null?void 0:t.indoorZoomThreshold)!=null?n:o(this,m).indoorZoomThreshold,"outdoorZoomThreshold"),e=!0),t.mode!=null&&(t.mode=eo.includes(t.mode)?t.mode:"default-floor"),t.autoAdjustFacadeHeights!=null&&(o(this,m).autoAdjustFacadeHeights=t.autoAdjustFacadeHeights),t.dynamicBuildingInteriors!=null&&t.dynamicBuildingInteriors!==o(this,m).dynamicBuildingInteriors&&(e=!0),t.isolateBelowGroundView!=null&&t.isolateBelowGroundView!==o(this,m).isolateBelowGroundView&&(e=!0),c(this,m,Object.assign({},o(this,m),Object.fromEntries(Object.entries(t).filter(([,a])=>a!=null)))),t.mode!=null&&t.preloadFloors&&E(this,g,Ut).call(this,t.mode),e&&o(this,q).call(this)}destroy(){this.disable(),o(this,l).off("facades-in-view-change",o(this,pt)),o(this,l).off("floor-change-start",o(this,gt)),o(this,l).off("camera-change",o(this,et)),o(this,l).off("user-interaction-start",o(this,Ft)),o(this,l).off("user-interaction-end",o(this,yt)),o(this,y).forEach(t=>t.destroy()),o(this,O).destroy(),o(this,k).destroy(),c(this,G,[])}async focus(t=o(this,m).setFloorOnFocus){if(t)if(oo(o(this,tt),o(this,l).Camera.elevation,o(this,$)))c(this,tt,o(this,l).Camera.elevation),c(this,Y,!0);else{let e=Jt(o(this,j),o(this,O),o(this,M)),i=e?vt(e,o(this,m).mode,o(this,B)):void 0;i&&i.id!==o(this,l).currentFloor.id&&o(this,l).setFloor(i,{context:"dynamic-focus"})}await o(this,q).call(this),o(this,k).publish("focus",{facades:this.focusedFacades})}preloadFloors(){E(this,g,Ut).call(this,o(this,m).mode)}setDefaultFloorForStack(t,e){if(!Nt(e,t))return;let i=o(this,y).get(t.id);i&&(i.defaultFloor=e)}resetDefaultFloorForStack(t){let e=o(this,y).get(t.id);e&&(e.defaultFloor=t.defaultFloor)}getDefaultFloorForStack(t){var e;return((e=o(this,y).get(t.id))==null?void 0:e.defaultFloor)||t.defaultFloor||t.floors[0]}setCurrentFloorForStack(t,e){if(!Nt(e,t))return;let i=o(this,y).get(t.id);i&&(i.activeFloor=e,o(this,q).call(this))}exclude(t){let e=Array.isArray(t)?t:[t];for(let i of e){let n=o(this,y).get(i.id);n&&(n.excluded=!0)}}include(t){let e=Array.isArray(t)?t:[t];for(let i of e){let n=o(this,y).get(i.id);n&&(n.excluded=!1)}}getCurrentFloorForStack(t){var e;return((e=o(this,y).get(t.id))==null?void 0:e.activeFloor)||this.getDefaultFloorForStack(t)}};k=new WeakMap,l=new WeakMap,L=new WeakMap,m=new WeakMap,j=new WeakMap,U=new WeakMap,y=new WeakMap,O=new WeakMap,$=new WeakMap,Y=new WeakMap,B=new WeakMap,tt=new WeakMap,ht=new WeakMap,mt=new WeakMap,ft=new WeakMap,M=new WeakMap,C=new WeakMap,ot=new WeakMap,Z=new WeakMap,G=new WeakMap,g=new WeakSet,jt=s(function(){o(this,m).autoFocus&&(o(this,$)?this.focus():c(this,Y,!0)),o(this,k).publish("state-change")},"#handleViewStateChange"),lo=s(function(){c(this,G,[]);for(let t of o(this,m).dynamicLayers){let e=new Bt([t],!0,o(this,l));e.processLayerGroup(o(this,ft),o(this,m).outdoorZoomThreshold,o(this,m).indoorZoomThreshold),o(this,G).push(e)}Pt(o(this,G),o(this,l).Camera.zoomLevel)},"#initializeLayerGroups"),uo=s(function(){var n,a,h;let t=(h=(a=(n=o(this,L).internal.mvf)==null?void 0:n.enterprise)==null?void 0:a.layers)!=null?h:[],e={},i={};t.forEach(u=>{e[u.name]||(e[u.name]=[]),e[u.name].push(...u.spaces.map(({spaceId:f})=>f));for(let{spaceId:f}of u.spaces)i[f]==null&&(i[f]=[]),i[f].push(u.name)}),c(this,ht,t.map(({name:u})=>u)),c(this,mt,i),c(this,ft,e)},"#setupLayers"),Ut=s(function(t){o(this,l).preloadFloors(o(this,L).getByType("facade").map(e=>vt(o(this,y).get(e.floorStack.id),t,o(this,B))).filter(e=>e!=null&&Lo.is(e)))},"#preloadFloors"),pt=new WeakMap,gt=new WeakMap,Ft=new WeakMap,yt=new WeakMap,et=new WeakMap,$t=s(function(t,e,i){t.forEach(n=>{if(n.floor)if(e){let a=i!==void 0?at(_({},n.state),{labels:at(_({},n.state.labels),{enabled:n.state.labels.enabled&&i}),markers:at(_({},n.state.markers),{enabled:n.state.markers.enabled&&i}),occlusion:at(_({},n.state.occlusion),{enabled:n.state.occlusion.enabled&&i})}):n.state;o(this,l).updateState(n.floor,a)}else o(this,l).updateState(n.floor,{visible:!1})})},"#updateFloorVisibility"),co=s(async function(t,e,i,n){return E(this,g,$t).call(this,e.floorStates,!0,n),t.animateFacade(i.state,o(this,m).indoorAnimationOptions)},"#animateIndoorSequence"),ho=s(async function(t,e,i,n){let a=await t.animateFacade(i.state,o(this,m).outdoorAnimationOptions);return a.result==="completed"&&E(this,g,$t).call(this,e.floorStates,At({building:t,currentFloor:o(this,l).currentFloor,inRange:o(this,M)==="in-range",inFocus:o(this,U).has(t.id),mode:o(this,m).mode,elevation:o(this,B),inNavigation:n.includes(t.floorStack.id),dynamicBuildingInteriors:o(this,m).dynamicBuildingInteriors})),a},"#animateOutdoorSequence"),q=new WeakMap,s(Yt,"DynamicFocus");var so=Yt;export{s as a,ve as b,we as c,so as d};