@eyeon/threejs-map 1.1.6 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +420 -420
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -68,7 +68,7 @@ is considered to be not a multigraph by default (each edge is unique).`),e.multi
|
|
|
68
68
|
</svg>`,WheelChair:`<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 432 492.2">
|
|
69
69
|
<path fill="#444444" d="M134.7,80.1l9.5,103h104.6v33.3H146.6l3.2,30.9h147.4l66.6,157l56.3-23.8l11.9,27l-84,36.4l-69.7-163.3H118.9l-19-221.9 c-3.2-5.5-4.7-11.9-4.7-18.2C95.1,18.2,112.5,0,134.7,0c22.2,0,40.4,18.2,40.4,40.4C175.2,61.8,156.9,80.1,134.7,80.1L134.7,80.1z" />
|
|
70
70
|
<path fill="#444444" d="M306.7,397.1c-25.3,56.3-81.6,95.1-146.6,95.1C72.1,492.2,0,420.9,0,332.1C0,268.7,37.2,214,91.1,187.9l3.2,36.5 c-36.5,22.2-61,61.8-61,107.8c0,69.8,57.1,126.8,126.8,126.8c65,0,118.1-48.3,126-110.2L306.7,397.1"/>
|
|
71
|
-
</svg>`},X2=[{name:"ATM",type:"atm",svgCode:X1.ATM},{name:"Management",type:"management",svgCode:X1.Management},{name:"Kids Area",type:"playarea",svgCode:X1.PlayArea},{name:"Restroom",type:"restroom",svgCode:X1.RestRoom},{name:"Family Restroom",type:"family-restroom",svgCode:X1.FamilyRestRoom},{name:"Elevator",type:"elevator",svgCode:X1.Elevator},{name:"Security",type:"security",svgCode:X1.Security},{name:"Escalator",type:"escalator",svgCode:X1.Escalator},{name:"Child Stroller",type:"child-stroller",svgCode:X1.ChildStroller},{name:"Vending Machine",type:"vending-machine",svgCode:X1.VendingMachine},{name:"Stairs",type:"stairs",svgCode:X1.Stairs},{name:"Charging Station",type:"charging-station",svgCode:X1.ChargingStation},{name:"Wheelchair",type:"wheelchair",svgCode:X1.WheelChair}],U6={"route-path":0,escalator:0,underlay:0,overlay:1,"building-base":1,base:2,store:3,"big-store":4,kiosk:5,wall:6,"outer-wall":7,boundary:8,amenity:9,"layer-image":10,"layer-text":11,"route-tube":12,"special-shape":13},H2=()=>{const{mapConfig:e,allMapObjects:l,allIndexedMapObjects:t,allIndexedRetailers:o,floorsData:n}=$1(),r=C.useCallback(i=>i!=null&&U6[i]!==void 0?U6[i]:0,[]),a=C.useCallback((i,s,m,v)=>{const I={color:m instanceof Q.Color?m:L1(m),side:Q.DoubleSide,transparent:!1,depthWrite:!0,depthTest:!0,opacity:1};(e.STYLE==="2D"||i==="base"||i==null)&&i!=="boundary"&&(I.depthWrite=!1,I.depthTest=!1),i==="overlay"&&(I.color=e.OVERLAY_COLOR,I.opacity=e.OVERLAY_OPACITY),i&&["store","big-store","kiosk"].includes(i)&&e.ROLE!=="PORTAL"&&t[s]&&t[s].transparent&&(I.opacity=0);var x=new Q.MeshLambertMaterial(I);return i&&["store","big-store","kiosk","amenity"].includes(i)&&(x.colorDefault=x.color,t[s]&&t[s].bg_color!==""&&(x.color=L1(t[s].bg_color),x.colorDefault=x.color),x.active=!1),e.ROLE!=="PORTAL"&&v&&(x.opacity=0,x.transparent=!0),x.transparent=x.opacity!==1,x},[t,e.OVERLAY_COLOR,e.OVERLAY_OPACITY,e.ROLE,e.STYLE]),c=C.useCallback((i,s,m,v,I)=>{const x="MaterialAndGeometry";let p=I.toShapes(!0),f;e.STYLE==="2D"?f=["building-base"]:f=["store","big-store","base","building-base"];let _=["wall","outer-wall","boundary"];var R;if(i&&f.includes(i))R=new Q.ExtrudeGeometry(p,{depth:-m,bevelEnabled:!1});else if(i&&_.includes(i)){let g=[];I.subPaths.forEach(u=>{u.curves.forEach(d=>{if(d.type==="LineCurve"){let S=0;i==="boundary"&&(S=1);let A=A0(d,v,S),N=new Q.ExtrudeGeometry(A,{depth:-m,bevelEnabled:!1});g.push(N)}else console.warn(x+'"%s" found in walls. Check layer "%s"',d.type,s)})}),g.length===1?R=g[0]:g.length>1?R=S0(g):console.warn(x+'Unneccessary wall exists "%s"',s)}else{R=new Q.ShapeGeometry(p);try{R.attributes.position.count===0&&console.warn(x+'Unneccessary map shape "%s"',s,I.userData.node)}catch(g){console.error(g.message)}}return R},[e.STYLE]),q=C.useCallback((i,s,m,v,I,x,p,f,_,R)=>{var A,N;const g=a(i,s,m,v),u=c(i,s,p,f,R),d=new Q.Mesh(u,g);d.object_id=s,d.mesh_type=i,d.floor_index=_,d.visible=I,d.position.z=x;let S="";if(["retail_logo","retail_name","retail_text","custom_text","amenity"].includes((A=t[s])==null?void 0:A.layer_type)){if(t[s].layer_type&&["retail_name","retail_logo"].includes(t[s].layer_type)&&t[s].retailer_id&&o[((N=t[s])==null?void 0:N.retailer_id)||0])S=o[t[s].retailer_id].retail_name;else if(["retail_text","custom_text"].includes(t[s].layer_type))S=t[s].custom_text,S===""&&t[s].retailer_id&&o[t[s].retailer_id]&&(S=o[t[s].retailer_id].retail_name);else if(["amenity"].includes(t[s].layer_type)&&(S=t[s].value,S)){const B=X2.find(V=>V.type===S);B&&(S=B.name)}}return d.userData.storeName=S,e.STYLE==="2D"&&(d.renderOrder=r(i),s&&s.includes("underlay")&&(d.renderOrder=r("underlay"))),n[_].objsGroup.add(d),i==="escalator"&&(n[_].escalatorsNodes[s]=null,n[_].escalatorsObjs.push(d),d.escalator_id=_+"-"+s),i&&["store","big-store","kiosk","amenity"].includes(i)&&(d.route_node_id=null,t[s]&&t[s].layer_type,l.push(s),(e.ROLE!=="PORTAL"&&i==="kiosk"||e.ROLE!=="PORTAL"&&e.ROLE!=="PORTAL_KIOSK"&&t[s]&&t[s].obj_type==="retailer"&&t[s].retailer_id!=null||e.ROLE!=="PORTAL"&&e.ROLE!=="PORTAL_KIOSK"&&t[s]&&t[s].obj_type==="custom"&&t[s].custom_text!==""||e.ROLE!=="PORTAL"&&e.ROLE!=="PORTAL_KIOSK"&&t[s]&&t[s].layer_type==="amenity"&&t[s].value!==null||e.ROLE==="PORTAL"&&t[s]&&(t[s].obj_type==="special"||t[s].obj_type==="custom")||e.ROLE==="PORTAL"&&["store","kiosk","amenity"].includes(d.mesh_type??"")||e.ROLE==="PORTAL")&&n[_].interactiveObjs.push(d)),{mesh:d,geometry:u,material:g,object_id:s,mesh_type:i,floor_index:_,visible:I,renderOrder:d.renderOrder}},[t,o,l,n,c,a,r,e.ROLE,e.STYLE]);return{getRenderOrder:r,getMaterial:a,getGeometry:c,getMaterialAndGeometry:q}},i3="ROUTE: ",R0=1e4,O9=()=>{const{floorsData:e,allNodesFloor:l,ngraphPath:t,pathFinderGraph:o,allIndexedMapObjects:n}=$1(),{getRenderOrder:r}=H2(),a=C.useCallback((_,R,g)=>{if(!g.data)return!1;let u=g.data.weight;const d=l[_.id],S=l[R.id];return d!==S?u+R0+Math.abs(d-S):u},[l]),c=C.useCallback(_=>{var R;for(let g=0;g<_.length;g++){const u=_[g];u.route_active=!1,u.route_tube!=null&&(u.route_tube.geometry.dispose(),u.route_tube.material.dispose(),(R=u.objsGroup)==null||R.remove(u.route_tube)),u.route_tube=void 0,u.route_texture=null,u.escalatorMeshes=[]}},[]),q=C.useCallback((_,R,g)=>{let u=g.find(_,R);return u.length===0?!1:u},[]),i=C.useCallback((_,R,g)=>{let d=document.createElement("canvas").getContext("2d");if(d){d.canvas.width=_,d.canvas.height=80,d.fillStyle="#4ea5ff",d.fillRect(0,0,_,80);let S=.1*_;const A=60,N=120;S<A&&(S=A),S>N&&(S=N);let B=d.createLinearGradient(0,0,S,0);B.addColorStop(0,"#4ea5ff"),B.addColorStop(.4,"white"),B.addColorStop(.6,"white"),B.addColorStop(1,"#4ea5ff"),d.fillStyle=B,d.fillRect(10,0,S,80);let V=new Q.CanvasTexture(d.canvas);return V.offset.x=1,V.colorSpace="srgb",g[R].route_texture=V,V}else return},[]),s=C.useCallback((_,R,g,u="2D")=>{var V;let d=0,S=new Q.CurvePath;for(let l1=1;l1<_.length;l1++){let W=new Q.Vector3(_[l1-1].data.x,_[l1-1].data.y,0),n1=new Q.Vector3(_[l1].data.x,_[l1].data.y,0);S.add(new Q.LineCurve3(W,n1)),d+=W.distanceTo(n1)}var A=new Q.TubeGeometry(S,400,6,8);A=new Q.BufferGeometry().copy(A);var N=new Q.MeshBasicMaterial({map:i(d,R,g),transparent:!0,side:Q.DoubleSide,depthTest:!1,depthWrite:!1});let B=new Q.Mesh(A,N);return u==="2D"&&(B.position.z=-10,B.scale.z=.1),B.position.z=0,B.renderOrder=r("route-tube"),B.mesh_type="route-tube",B.geometry.index!==null?B.geometry.setDrawRange(0,B.geometry.index.count):console.warn("route_tube.geometry.index is null"),g[R].route_tube=B,(V=g[R].objsGroup)==null||V.add(B),B},[r,i]),m=C.useCallback((_,R,g,u,d,S,A,N,B=null)=>{var L,k,Z,O,E,b;const V=[];c(S);let l1=g.getObjectByProperty("object_id",_),W=g.getObjectByProperty("object_id",R),n1=l1.route_node_id,K=W.route_node_id;if(n1||console.error(i3+'Route Anchor point missing for "%s"',_),K||console.error(i3+'Route Anchor point missing for "%s"',R),!n1||!K)return V;const e1=l1.floor_index,Y=W.floor_index,J=t.nba(A,{distance:a,oriented:!0,blocked(h,z,X){return X.data.blocked},debug:!0}),F=q(n1,K,J),q1=[];if(!F)return[];F.reverse();const j=[];for(let h=0;h<F.length;h++){const z=F[h];j[u[z.id]]?j[u[z.id]].push(z):j[u[z.id]]=[z],d.includes(z.id)&&d.includes(F[h-1].id)&&d.includes(F[h+1].id),q1.push(z)}for(let h=0;h<q1.length;h++){const z=q1[h];if(u[q1[0].id]!==u[q1[q1.length-1].id]&&d.includes(z.id)){const X=Object.keys(S[u[z.id]].escalatorsNodes).find(M=>{var o1,$;return(($=(o1=S[u[z.id]])==null?void 0:o1.escalatorsNodes)==null?void 0:$[M])===z.id}),G=g.getObjectByProperty("escalator_id",u[z.id]+"-"+X);let t1=null;if(u[z.id]!==u[q1[h+1].id]&&d.includes(q1[h+1].id)&&(t1={index:u[q1[h+1].id],direction:"To"}),u[z.id]!==u[q1[h-1].id]&&d.includes(q1[h-1].id)&&(t1={index:u[q1[h-1].id],direction:"From"}),t1&&G){G.goToFloor=t1;const M=G.clone();M.goToFloor=t1,M.object_id=X,(k=(L=S[u[z.id]])==null?void 0:L.escalatorMeshes)==null||k.push(M)}}}for(let h=0;h<j.length;h++){const z=j[h];if(z&&z.length>1){const X=s(z,h,S,N);V[h]=X,S[h].route_active=!0,S[h].routeMeshes=[X],h===e1&&((O=(Z=S[h])==null?void 0:Z.routeMeshes)==null||O.push(l1)),h===Y&&((b=(E=S[h])==null?void 0:E.routeMeshes)==null||b.push(W))}}return V},[s,q,t,c,a]),v=C.useCallback((_,R,g,u,d,S,A,N)=>{if(R===g)return{routePaths:[],fromFloor:void 0};const B=m(R,g,u,_,S,d,A,N);B.length||console.warn(i3+'No route found in between "%s" and "%s"',R,g);let V=u.getObjectByProperty("object_id",R);return{routePaths:B,fromFloor:V.floor_index}},[m]),I=C.useCallback((_,R,g,u)=>{let d=0,S=g.find(R,_);if(S.length===0)return!1;for(let A=1;A<S.length;A++){let N=u.getLink(S[A-1].id,S[A].id);d+=(N==null?void 0:N.data.weight)||0}return d},[]),x=C.useCallback(()=>{if(e.length>1){const _=[],R=[];for(let g=0;g<e.length;g++)R[g]=[],e[g].escalatorsNodes&&(_[g]=Object.fromEntries(Object.entries(e[g].escalatorsNodes).map(([u,d])=>{const S=u.split("-"),A=S.slice(0,2).join("-"),N=S.includes("end"),B=S.includes("start"),V=S.includes("up"),l1=S.includes("down"),W=V?"up":l1?"down":"both";return R[g].push(A),[A,{node:d,escalatorId:A,isExitOnly:N,isEntranceOnly:B,upOnly:V,downOnly:l1,direction:W,floorsTo:[]}]})));for(let g=0;g<e.length;g++)for(let u=0;u<R[g].length;u++){const d=R[g][u],S=_[g][d];for(let A=g+1;A<e.length;A++)for(let N=0;N<R[A].length;N++){const B=R[A][N];d===B&&S.floorsTo.push(A)}}for(let g=0;g<e.length-1;g++){const u=_[g];for(const d in u){const S=u[d],A=S.node;S.floorsTo.forEach(N=>{const V=_[N][d].node;V&&(S.isExitOnly?(o.addLink(A,V,{blocked:!0}),o.addLink(V,A,{weight:1})):S.isEntranceOnly?(o.addLink(V,A,{blocked:!0}),o.addLink(A,V,{weight:1})):(o.addLink(A,V,{weight:1}),o.addLink(V,A,{weight:1})))})}}}},[e,o]),p=C.useCallback((_,R,g,u,d)=>{let S=g.getObjectByProperty("object_id",_),A=S?S.route_node_id:"";var N=null,B=9999;const V=[];for(let l1 in n){const W=n[l1];W.layer_type==="amenity"&&W.obj_type==="special"&&W.value===R&&V.push(l1)}return V.forEach(l1=>{let W=g.getObjectByProperty("object_id",l1);const n1=t.aStar(o,{distance:a,debug:!0});if(W&&A){var K=W.route_node_id;try{var e1=I(A||"",K||"",n1,o);e1&&e1<B&&(B=e1,N=l1)}catch(Y){console.warn(`Amenity Path: ${Y.message}`)}}!A&&W&&(N=K)}),v(l,_,N??"",g,e,u,o,d)},[n,l,v,e,I,t,o,a]),f=C.useCallback((_,R,g)=>{const u=new Map,d=e[_];return d&&d.route_points&&d.route_points.forEach(S=>{let A=new Q.Vector3(S.node.x,S.node.y,-10),N=new Q.Vector3(0,0,1);g.set(A,N);var B=g.intersectObjects(e[_].interactiveObjs);B.length&&(B[0].object.route_node_id=S.name,u.set(B[0].object.object_id,S.name));var V=g.intersectObjects(e[_].escalatorsObjs);if(V.length){let W=V[0].object.object_id;const n1=e[_].escalatorsNodes;n1&&(n1[W]=S.name,l[S.name]=_,R.push(S.name))}}),u},[l,e]);return{delete_route_path:c,create_route:v,create_route_paths:m,create_route_path:s,get_route_nodes:q,get_nodes_distance:I,get_route_texture:i,linkFloorEscalators:x,make_amenity_route:p,assign_route_nodes_to_stores:f}};function z0(e){return"node-"+e}function $6(e,l,t,o){let n=!1,r="-name-not-found-";const a=t[l];if(a.route_points!==void 0){for(let c=0;c<a.route_points.length;c++)if(e.x===a.route_points[c].node.x&&e.y===a.route_points[c].node.y){n=!0,r=a.route_points[c].name;break}n||(r=z0(o))}return[r,n]}const O0=()=>{const{mapConfig:e,floorsData:l,allNodesFloor:t,pathFinderGraph:o}=$1();return{getMeshParams:C.useCallback((r,a,c,q)=>{var d;const i="MeshParams";let s=null;var m=r.color.clone(),v=0,I=0,x=!0,p=!0,f=!1,_=e.WALL_THICKNESS,R=!0,g=(d=r.userData)==null?void 0:d.node.id;return g!==void 0?g.startsWith("boundary")?(s="boundary",m=e.BOUNDARY_COLOR,_=e.BOUNDARY_THICKNESS,e.STYLE==="3D"&&(v=9)):g.startsWith("wall")?(s="wall",m=e.WALL_COLOR,e.STYLE==="3D"&&(v=8.5)):g.startsWith("outer-wall")?(s="outer-wall",m=e.WALL_COLOR,e.STYLE==="3D"&&(p=!1)):g.startsWith("base")?(s="base",m=e.BASE_COLOR):g.startsWith("store")?(s="store",m=e.STORE_DEFAULT_COLOR,e.STYLE==="3D"&&(v=e.STORE_HEIGHT),g.startsWith("store-underlay")&&(R=!1)):g.startsWith("route-path")?(s="route-path",p=!1,r.subPaths.forEach(S=>{S.curves.length===0&&console.warn(i+'Route-path standalone anchor point exists, layer_name: "%s"',g),S.curves.forEach(A=>{var K,e1;const N=A.v1,B=A.v2,[V,l1]=$6(N,c,l,q);l1||((K=l[c].route_points)==null||K.push({name:V,node:new Q.Vector3(N.x,N.y,1)}),t[V]=c);const[W,n1]=$6(B,c,l,q);n1||((e1=l[c].route_points)==null||e1.push({name:W,node:new Q.Vector3(B.x,B.y,1)}),t[W]=c),o.addNode(V,{...N}),o.addNode(W,{...B}),o.addLink(V,W,{weight:N.distanceTo(B)}),o.addLink(W,V,{weight:N.distanceTo(B)})})})):g.startsWith("escalator-")?(s="escalator",x=!1,f=!0):g.startsWith("kiosk-")?(s="kiosk",f=!0):g.startsWith("amenity-")?(s="amenity",f=!0,I=1):g.startsWith("overlay")?s="overlay":g.startsWith("special-shape")?s="special-shape":v=1:console.warn(i+"Layer name is undefined, path",r),{mesh_type:s,layer_color:m,extrude:v,z_index:I,mesh_visible:x,mesh_draw:p,mesh_transparent:f,line_thickness:_,interactiveMesh:R,path:r,layer_name:g}},[t,l,e.BASE_COLOR,e.BOUNDARY_COLOR,e.BOUNDARY_THICKNESS,e.STORE_DEFAULT_COLOR,e.STORE_HEIGHT,e.STYLE,e.WALL_COLOR,e.WALL_THICKNESS,o])}};let T0=0;const w0=e=>{const{mapConfig:l,pathFinderGraph:t}=$1(),{getMaterialAndGeometry:o}=H2(),{getMeshParams:n}=O0(),{assign_route_nodes_to_stores:r,linkFloorEscalators:a}=O9(),[c,q,i]=C.useMemo(()=>{const s=new Set,m=[],v=[];e.forEach((I,x)=>{var p,f;if(I&&I.paths&&I.paths.length){const _=[];for(let d=0;d<I.paths.length;d++)_.push((f=(p=I.paths[d])==null?void 0:p.userData)==null?void 0:f.node.id);const R=I.paths;for(let d=0;d<R.length;d++){const{mesh_type:S,layer_color:A,extrude:N,z_index:B,mesh_visible:V,mesh_draw:l1,mesh_transparent:W,line_thickness:n1,path:K,layer_name:e1}=n(R[d],R,x,++T0);if(l1){const Y=o(S,e1,A,W,V,B,N,n1,x,K);e1.startsWith("kiosk-")&&l.ROLE,m[x]||(m[x]=[]),m[x].push(Y)}}const g=new Q.Raycaster,u=r(x,v,g);if(u.size&&m[x].length)for(let d=0;d<m[x].length;d++)u.has(m[x][d].mesh.object_id)&&(m[x][d].mesh.route_node_id=u.get(m[x][d].mesh.object_id));a()}});for(let I=0;I<m.length;I++){const x=m[I];for(let p=0;p<x.length;p++)s.add(x[p].object_id)}return[m,v,s]},[r,o,n,a,l.ROLE,e]);return{GeometriesAndMaterials:c,graph:t,escalator_nodes:q,allSvgObjectIds:i}},T9=()=>{const{allIndexedRetailers:e,allIndexedMapObjects:l,floorsData:t,mapConfig:o}=$1(),{getRenderOrder:n}=H2(),r=(x,p,f,_,R,g,u,d)=>{for(let S=0;S<x.length;S++)a(x[S],p,f,_,R,g,u,d)},a=(x,p,f,_,R,g,u,d)=>{let S=p.getObjectByProperty("object_id",x.map_obj_name);S&&add_store_name_logo(S,f,_,R,g,u,d,p)},c=x=>(Array.isArray(x)||(x=[x]),x.reduce((f,_)=>(_.geometry.boundingBox||_.geometry.computeBoundingBox(),f.union(_.geometry.boundingBox),f),new Q.Box3)),q=(x,p,f,_,R)=>{let g=R[x];p.z=-f.z,_.rotateZ(((g==null?void 0:g.rotate)||0)*Math.PI/180),_.scale.y*=-1,p.x+=(g==null?void 0:g.offset_x)||0,p.y+=(g==null?void 0:g.offset_y)||0,_.position.set(p.x,p.y,p.z+1)},i=async x=>{try{const p=l9(x,o),f=await fetch(p);if(!f.ok)throw new Error(`Failed to fetch image: ${f.statusText}`);const _=await f.blob();return URL.createObjectURL(_)}catch(p){return console.error("Error fetching or converting the image:",p),""}},s=(x,p)=>new Promise((f,_)=>{var R;if(x.obj_type==="retailer")p?i(p.logo).then(g=>{f(g)}):(console.error("retailer not found"),f(""));else if(x.obj_type==="special"){let g=x.value;if(x.layer_type==="kiosk"&&(g="kiosk"),x.layer_type==="escalator"&&(g="escalator"),g){let u="222222";x.text_color!=null&&(u=x.text_color.replace("#",""));const d=document.getElementById("map-special-svg-"+g);if(d){const S=d.querySelector("svg");if(S){const A=S.cloneNode(!0);A.querySelectorAll("[fill]").forEach(W=>{W.setAttribute("fill","#"+u)});const B=new XMLSerializer().serializeToString(A),V=new Blob([B],{type:"image/svg+xml"}),l1=URL.createObjectURL(V);f(l1)}else console.error("svg_element not found",g),f("")}else console.error("svg_block not found",g),f("")}}else x.custom_image!==""&&((R=x==null?void 0:x.custom_image)!=null&&R.startsWith("http"))?f(x.custom_image):(console.error("custom_image URL not found"),f(""))}),m=(x,p,f)=>{const _=document.createElement("img");_.crossOrigin="anonymous",_.src=x,_.onload=function(){const R=document.getElementById("temp-image-rendering");R&&(_.style.height="100px",R.appendChild(_),setTimeout(()=>{const g=document.createElement("canvas"),u=g.getContext("2d");if(u){g.width=_.width*O6,g.height=_.height*O6,u==null||u.drawImage(_,0,0,g.width,g.height);let d=new Q.CanvasTexture(g);d.colorSpace="srgb";const S=new Q.PlaneGeometry(p.size,p.size*_.height/_.width),A=new Q.MeshBasicMaterial({map:d,transparent:!0,side:Q.DoubleSide,depthTest:!1,depthWrite:!1});p.layer_type==="kiosk"&&(A.visible=!1),f(S,A)}},100))},_.onerror=function(){console.error("processImage():: Error loading image:",x)}},v=C.useCallback((x,p,f,_,R,g,u,d,S,A)=>{s(f,p[f.retailer_id]).then(N=>{N&&m(N,f,(B,V)=>{var n1;const l1=new Q.Mesh(B,V),W=_.floor_index;q(R,u,d,l1,x),l1.object_id=g,l1.floor_index=W,l1.renderOrder=n("layer-image"),(n1=S[W])==null||n1.objsGroup.add(l1),A({storeLogo:l1})})})},[n]),I=C.useCallback((x,p,f,_,R,g)=>{const u=_+p;let d=null;if(x.boundingBox||x.computeBoundingBox(),!x.boundingBox)return null;const S=x.boundingBox,A=new Q.Vector3;S.getCenter(A);const N=new Q.Vector3;S.getSize(N);let B=l[p]?l[p]:{layer_type:p.startsWith("escalator")?"escalator":"custom_text",custom_text:"",size:8};if(["retail_name","retail_text","custom_text"].includes(B.layer_type)){let V="";B.layer_type==="retail_name"&&B.retailer_id&&e[B.retailer_id]?V=e[B.retailer_id].retail_name:["retail_text","custom_text"].includes(B.layer_type)?V=B.custom_text:V="";let l1=o.STORE_TEXT_COLOR;B.text_color&&(l1=L1(B.text_color));const W={color:l1,transparent:!1,side:Q.DoubleSide,depthWrite:!1,depthTest:!1};let n1=new Q.MeshBasicMaterial(W),K=new z9(V,{font:R,size:parseInt(B.size),height:.01,curveSegments:4});K.center();const e1=new Q.Mesh(K,n1);e1.userData.debug_name=V,e1.userData.font=R,q(p,A,N,e1,l),e1.object_id=u,e1.floor_index=f,e1.renderOrder=n("layer-text"),B.layer_type==="retail_name"&&(e1.userData.retail_name=V),t[f].objsGroup.add(e1),d={textMesh:e1}}else(B.layer_type==="retail_logo"||B.layer_type==="custom_image"||B.obj_type==="special"&&B.layer_type==="kiosk"&&B.kiosk_id!=null||B.obj_type==="special"&&B.layer_type==="amenity"&&B.value!==""||B.layer_type==="escalator")&&v(l,e,B,x,p,u,A,N,t,g);return d},[l,e,t,v,n,o.STORE_TEXT_COLOR]);return{drawTextLogoStoreOnMap:r,addTextOrLogoOnStore:a,getMeshGroupBoundingBox:c,layer_text_logo_position_by_id:q,getImage:s,processImage:m,getImageLogo:v,get_store_name_logo_geometry:I}};let s3=[];const M0=()=>{const{mapConfig:e,initialFloorsDataIsLoaded:l,allIndexedMapObjects:t,allIndexedRetailers:o,allMapObjects:n,allNodesFloor:r,pathFinderGraph:a,setPathFinderGraph:c,mapApiResponse:q}=$1(),[i,s]=C.useState([]),[m,v]=C.useState([]),[I,x]=C.useState([]),[p,f]=C.useState([]);let _=y4.useLoader(Y3,q.floors.map(V=>l9(V.svgUrl,e)));const{GeometriesAndMaterials:R,graph:g,escalator_nodes:u,allSvgObjectIds:d}=w0(_),{get_store_name_logo_geometry:S}=T9(),A=S4.useFont(K8),N=C.useCallback(V=>l1=>{x(W=>(W[V]?W[V].push({...l1}):W[V]=[{...l1}],[...W]))},[]),B=C.useCallback(()=>{s(V=>(V&&V.forEach(l1=>{l1&&l1.forEach(W=>{W.mesh.removeFromParent()})}),[])),v(V=>(V&&V.forEach(l1=>{l1&&l1.forEach(W=>{W.textMesh.removeFromParent()})}),[])),x(V=>(V&&V.forEach(l1=>{l1&&l1.forEach(W=>{W.storeLogo.removeFromParent()})}),[]))},[]);return C.useEffect(()=>{if(l&&e.ROLE==="PORTAL")return()=>{B()}},[B,l]),C.useEffect(()=>()=>{B()},[]),C.useEffect(()=>{if(!A||!_)return;x([]);const V=[];if(s3.forEach(n1=>{let K;for(let Y=0;Y<R.length&&(K=R[Y].find(J=>J.object_id===n1.map_obj_name),K===void 0);Y++);if(!K)return null;const e1=S(K.geometry,n1.map_obj_name,K.floor_index,A2,A,N(K.floor_index));e1&&(V[K.floor_index]||(V[K.floor_index]=[]),V[K.floor_index].push(e1))}),R.reduce((n1,K)=>n1+K.length,0)-s3.length!==0){const n1=new Set;s3.forEach(K=>{n1.add(K.map_obj_name)}),R.forEach(K=>{K.forEach(e1=>{if(!n1.has(e1.object_id)){const Y=S(e1.geometry,e1.object_id,e1.floor_index,A2,A,N(e1.floor_index));Y&&(V[e1.floor_index]||(V[e1.floor_index]=[]),V[e1.floor_index].push(Y))}})})}s([...R]),v(V),c(g),f([...u])},[_,A,t,o,n,r,a,e,c,N,R,S,g,u]),C.useMemo(()=>({meshParams:i,textParams:m,storeLogos:I,pathFinderGraph:a,escalator_nodes:p,allSvgObjectIds:d}),[i,m,I,a,p,d])},N0=e=>{const{scene:l}=y4.useThree();return e.background&&(l.background=new Q.Color(e.background)),null},L0=e=>{const{camera:l}=y4.useThree(),t=e.far||e.near||e.fov;return e.far&&(l.far=e.far),e.near&&(l.near=e.near),l instanceof Q.PerspectiveCamera&&e.fov&&(l.fov=e.fov),t&&l.updateProjectionMatrix(),null};function Q6(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function P0({mesh:e}){const l=C.useRef(null);return C.useEffect(()=>{var r;if(!e)return;if(!((r=e.geometry.index)!=null&&r.count)){console.log("NO ROUTE TUBE GEOMETRY INDEX COUNT");return}if(!(e.material instanceof Q.MeshBasicMaterial))return;if(!e.material.map){console.log("NO ROUTE TEXTURE");return}e.geometry.setDrawRange(0,0);const t=e.geometry.index.count,o=(()=>{const c=performance.now();return()=>{const q=(performance.now()-c)/1e3,i=Math.floor(Q6(q)*t);q>=1&&(l.current=n),e.geometry.setDrawRange(0,i)}})(),n=(()=>{if(!(e.material instanceof Q.MeshBasicMaterial)||!e.material.map)return null;const a=e.material.map.offset,c=2e3,q=.1,i=1+q,s=performance.now();return()=>{const m=(performance.now()-s)/c%1;a.x=q-i*Q6(m)}})();return l.current=o,()=>{l.current=null,e.removeFromParent(),e.material instanceof Q.MeshBasicMaterial&&e.material.dispose(),e.geometry&&e.geometry.dispose()}},[e]),y4.useFrame(()=>{if(l.current)try{l.current()}catch(t){console.error(`ERROR ANIMATE ROUTE: ${t.message}`),l.current=null}}),e?w.jsx("primitive",{object:e}):null}const F0="_escalator_elems_1kqb9_1",B0="_element_1kqb9_4",G0="_svgIcon_1kqb9_21",k0="_label_1kqb9_34",i2={escalator_elems:F0,element:B0,svgIcon:G0,label:k0},j0="_mapCenterMarker_1eu0j_18",V0={mapCenterMarker:j0},K6=({size:e,lockSize:l,blink:t,cameraLength:o,text_color:n="black"})=>{const{mapConfig:r}=$1(),[,a]=C.useState(1),[c,q]=C.useState(null),i=l?5*e/256:8*e;C.useEffect(()=>{!l&&o!==void 0&&a(1-(o-r.CAMERA.minDistance)/(r.CAMERA.maxDistance-r.CAMERA.minDistance))},[l,r,o]);const s=C.useMemo(()=>c?new Q.SpriteMaterial({map:c,sizeAttenuation:!l,depthTest:!1,depthWrite:!1,color:n}):null,[l,c,n]);return C.useEffect(()=>{var v;const m=(v=document.getElementById("map-special-svg-kiosk"))==null?void 0:v.querySelector("svg");if(m){const I=m.cloneNode(!0),x=new XMLSerializer().serializeToString(I),p=new Blob([x],{type:"image/svg+xml"}),f=URL.createObjectURL(p),_=document.createElement("canvas");_.width=256,_.height=256;const R=_.getContext("2d"),g=document.createElement("img");g.src=f,g.onload=()=>{R==null||R.drawImage(g,96,0,64,128);const u=new Q.Texture(_);u.needsUpdate=!0,q(u)}}},[]),s?w.jsxs("group",{children:[w.jsx("sprite",{scale:i,material:s}),t&&w.jsx(S4.Html,{children:w.jsx("div",{className:`mapCenterMarker ${V0.mapCenterMarker}`})})]}):null},D0=e=>{if(e){var l={...e};return l.r=e.r*.92,l.g=e.g*.92,l.b=e.b*.92,l}return null},e8=e=>{const{type:l,mesh:t,currentFloorIndex:o}=e;C.useEffect(()=>(t.userData.triggerUpdate=()=>{},()=>t.userData.triggerUpdate=void 0),[t.userData]);const{cameraLength:n}=$1();switch(l){case"storeLogo":return t.userData.kioskConfig&&t.userData.kioskConfig.floorIndex===o?w.jsx("primitive",{object:t,children:w.jsx(K6,{size:t.userData.kioskConfig.size,blink:t.userData.kioskConfig.blink,cameraLength:n,lockSize:t.userData.kioskConfig.lockSize,text_color:t.userData.kioskConfig.text_color})},t.uuid):w.jsx("primitive",{object:t,children:t.userData.htmlContent?w.jsx(S4.Html,{style:{pointerEvents:"none"},distanceFactor:t.userData.distanceFactor,children:t.userData.htmlContent}):null},t.uuid);case"kiosk":return t.userData.kioskConfig&&t.userData.kioskConfig.floorIndex===o?w.jsx(K6,{size:t.userData.kioskConfig.size,blink:t.userData.kioskConfig.blink,cameraLength:n,lockSize:t.userData.kioskConfig.lockSize,text_color:t.userData.kioskConfig.text_color}):null;default:return null}},W0=e=>{const{meshFloors:l,routeTube:t,floorIndex:o,currentFloorIndex:n,activeObjectId:r,hoverObjectId:a,visible:c,handleChangeFloor:q}=e,{mapConfig:i,floorsData:s}=$1(),{meshParams:m,textParams:v,storeLogos:I}=l,x=s[o],p=e.onPointerMove,f=e.onPointerEnter,_=e.onPointerLeave,R=e.onClick,g=m[o],u=v[o],d=I[o],S=s[o].escalatorMeshes;return w.jsxs("group",{visible:c,children:[g==null?void 0:g.map(A=>{if(!A.mesh)return null;const N=c&&A.mesh.visible&&x.interactiveObjs&&x.interactiveObjs.includes(A.mesh),B=a&&A.mesh.object_id===a,V=r&&A.mesh.object_id===r;if(N)if((V||B)&&(A.mesh.material instanceof Q.MeshLambertMaterial||A.mesh.material instanceof Q.MeshStandardMaterial)){const l1=V?i.ACCENT_COLOR:A.mesh.material.colorDefault;A.mesh.material.color=B?D0(l1):l1}else A.mesh.material.color=A.mesh.material.colorDefault;return w.jsx("group",{...N?{onPointerOver:f,onPointerMove:p,onPointerOut:_,onClick:R}:{},children:w.jsx("primitive",{object:A.mesh})},A.mesh.uuid)}),u==null?void 0:u.map(A=>A.textMesh?w.jsx(C.Fragment,{children:w.jsx("primitive",{object:A.textMesh,children:A.textMesh.userData.kioskConfig?w.jsx(e8,{mesh:A.textMesh,currentFloorIndex:n,type:"kiosk",visible:c},void 0):null})},A.textMesh.uuid):null),d==null?void 0:d.map(A=>A.storeLogo?w.jsx(e8,{mesh:A.storeLogo,currentFloorIndex:n,type:"storeLogo",visible:c},A.storeLogo.uuid):null),S==null?void 0:S.map(A=>{var N,B;return w.jsx("primitive",{object:A,children:w.jsx(S4.Html,{visible:!0,position:(N=A.geometry.boundingSphere)==null?void 0:N.center,children:w.jsx("div",{className:`escalator_elems ${i2.escalator_elems}`,style:{display:c?"block":"none"},onClick:V=>{var l1;return V.stopPropagation(),q(((l1=A.goToFloor)==null?void 0:l1.index)||0),!1},onPointerMove:V=>V.stopPropagation(),children:w.jsxs("div",{className:`element ${i2.element}`,id:A.object_id,children:[w.jsx("div",{className:`svgIcon ${i2.svgIcon}`,dangerouslySetInnerHTML:{__html:e9("escalator")}}),w.jsxs("div",{className:`label ${i2.label}`,children:[(B=A.goToFloor)==null?void 0:B.direction,": ",A.goToFloor?s[A.goToFloor.index].name:""]})]})})})},`escalator-${A.object_id}`)}),w.jsx(P0,{mesh:t})]})};function l8(e,l,t,o){if(Array.isArray(e)||(e=[e]),!e.length)return console.warn("get_camera_focus_object: no objects passed"),{position:new Q.Vector3,target:new Q.Vector3};const n=e.reduce((p,f)=>(f.geometry.boundingBox||f.geometry.computeBoundingBox(),f.geometry.boundingBox&&p.union(f.geometry.boundingBox),p),new Q.Box3),r=new Q.Vector3;n.getSize(r);const a=new Q.Vector3;n.getCenter(a),e[0].localToWorld(a);let c=Math.tan(Math.PI*l/360),q=1.1,i=r.x*q/2/(c*t),s=r.y*q/2/c,m=Math.max(i,s),v=X0(m,o);const I=new Q.Vector3(a.x,0,a.z);return{position:new Q.Vector3(a.x,m,a.z+v),target:I}}function X0(e,l){let t=60;return l==="2D"&&(t=89.9),e/Math.tan(t*Math.PI/180)}const H0=C.forwardRef((e,l)=>{const{mapConfig:t,allMapObjects:o,allIndexedMapObjects:n,allNodesFloor:r,mapApiResponse:a,pathFinderGraph:c,setCameraLength:q,floorsData:i}=$1(),{make_amenity_route:s,create_route:m}=O9(),[v,I]=C.useState(!1),{meshFloors:x,currentFloorIndex:p,currKioskObj:f,currKioskFloorIndex:_,routeTargetId:R,routeTargetFromId:g,selectedAmenityType:u,handleChangeFloor:d,escalatorNodes:S,zoom:A,handleCameraLength:N,handleCameraAndControlsChange:B,activeObjectId:V,isSelectedRetailerSlug:l1,setIsCameraInit:W,handleObjectClick:n1,triggerClick:K,cameraControlsPosition:e1,deviceType:Y}=e,[J,F]=C.useState({min:t.CAMERA.minDistance,max:t.CAMERA.maxDistance,initialDistance:0,needsUpdate:!0}),q1=C.useRef(null),[j,L]=C.useState([]),k=C.useRef(null),{camera:Z,scene:O}=y4.useThree(),E=C.useRef(null),b=t.STYLE,h=t.ACCENT_COLOR,z=f?f.object_id:g||void 0,X=t.ROLE==="PORTAL"&&R,G=C.useCallback((D=!1)=>{if(!(Z instanceof Q.PerspectiveCamera)){console.error("Camera is not a PerspectiveCamera");return}const T=x.meshParams[_];if(!(T!=null&&T.length)){console.warn("objects not loaded yet");return}let y;y=T.map(b1=>b1.mesh);const r1=l8(y,Z.fov,Z.aspect,t.ROLE==="PORTAL"?"2D":b);let s1=!0;if(e1){let b1=e1.camera;b1 instanceof Q.Vector3||(b1=new Q.Vector3(b1.x,b1.y,b1.z)),s1=b1.length()===0}!D&&e1&&!s1&&!["PORTAL"].includes(t.ROLE)&&(r1.position.set(e1.camera.x,e1.camera.y,e1.camera.z),r1.target.set(e1.controls.x,e1.controls.y,e1.controls.z));const _1=Math.min(J.max,Math.max(J.min,r1.position.distanceTo(r1.target)));r1.position.sub(r1.target).setLength(_1).add(r1.target),E.current={...r1,fromPosition:k.current.object.position.clone(),fromTarget:k.current.target.clone(),animationStartTime:performance.now(),duration:t.CAMERA.animSpeed},["DISPLAY_APP","WP_SITE"].includes(t.ROLE)&&J.needsUpdate===!1&&J.initialDistance>0&&F(b1=>({...b1,min:t.CAMERA.minDistance<.1?.1:t.CAMERA.minDistance,max:t.CAMERA.maxDistance}))},[Z,J.needsUpdate,t.CAMERA.animSpeed,t.CAMERA.maxDistance,t.CAMERA.minDistance,e1,t.ROLE,_,x.meshParams,b]),t1=E.current?E.current.position.distanceTo(E.current.target):0;C.useEffect(()=>{e1&&G()},[e1,G]),C.useEffect(()=>{t1>0&&J.needsUpdate&&(F({min:t.CAMERA.minDistance<.1?.1:t.CAMERA.minDistance,max:t.CAMERA.maxDistance,initialDistance:t1,needsUpdate:!1}),W(!0))},[t1,J.needsUpdate,t.CAMERA,W]),C.useEffect(()=>{F(D=>({...D,needsUpdate:!0}))},[t.CAMERA]),C.useEffect(()=>{x.meshParams.length>0&&G()},[x.meshParams.length,G]),C.useEffect(()=>{if(!u||t.ROLE==="PORTAL"){L([]);return}const{routePaths:D,fromFloor:T}=s(z??"",u,O,S,b);L(D),T!==void 0&&d(T),f&&t.ROLE==="DISPLAY_APP"&&d(_)},[u,O,c,i,S,b,z,t.ROLE,r,n,s,f,d,_]);const M=C.useCallback(()=>{i.flat().forEach(D=>D.escalatorMeshes=[])},[i]);C.useEffect(()=>{if(!z||!R||t.ROLE==="PORTAL"){if(t.ROLE==="PORTAL")if(R){const y=O.getObjectByProperty("object_id",R);y&&L([y])}else M(),L([]);else u||(M(),L([]));return}u||i.forEach(y=>{y.escalatorMeshes=[]});const{routePaths:D,fromFloor:T}=m(r,z,R,O,i,x.escalator_nodes,c,b);L(D),T!==void 0&&d(T)},[z,R,O,Z,i,h,c,b,x.escalator_nodes,u,t.ROLE,r,K,m,M,d]);const o1=x.meshParams[p];C.useEffect(()=>{var s1;if(t.ROLE==="PORTAL_RESPONSIVE")return;if(!(Z instanceof Q.PerspectiveCamera)){console.error("Camera is not a PerspectiveCamera");return}if(!(o1!=null&&o1.length)){console.warn("objects not loaded yet");return}let D=(s1=i[p])==null?void 0:s1.routeMeshes;if(!V&&!u)return;let T=[];if(j[p]&&(D!=null&&D.length))T=[...D];else if(V&&(t.ROLE==="PORTAL"||l1)){const _1=R&&o1.find(b1=>b1.mesh.object_id===R);_1&&(T=[_1.mesh])}T.length||(T=o1.map(_1=>_1.mesh));const y=l8(T,Z.fov,Z.aspect,t.ROLE==="PORTAL"||t.ROLE==="WP_SITE"?"2D":b),r1=Math.min(X?t.CAMERA.maxDistance:J.max,Math.max(X?t.CAMERA.minDistance:J.min,y.position.distanceTo(y.target)));y.position.sub(y.target).setLength(r1).add(y.target),E.current={...y,fromPosition:k.current.object.position.clone(),fromTarget:k.current.target.clone(),animationStartTime:performance.now(),duration:t.CAMERA.animSpeed}},[j,o1,p,b,Z,R,t.ROLE,t.CAMERA.maxDistance,t.CAMERA.minDistance,t.CAMERA.animSpeed,i,V,u,l1,X,J.max,J.min]),C.useEffect(()=>{if(A!=null&&A.direction&&k.current){if(!(Z instanceof Q.PerspectiveCamera)){console.error("Camera is not a PerspectiveCamera");return}if(!o1.length){console.warn("objects not loaded yet");return}let D;if(j[p]){D=[j[p]];const r1=R&&o1.find(s1=>s1.mesh.object_id===R);r1&&D.push(r1.mesh)}else D=o1.map(r1=>r1.mesh);const T={position:k.current.object.position.clone(),target:k.current.target.clone()};let y=parseInt(T.position.distanceTo(T.target));A.direction==="in"?y-=t.ZOOM_STEP:y+=t.ZOOM_STEP,y=Math.min(J.max,Math.max(J.min,y)),T.position.sub(T.target).setLength(y).add(T.target),E.current={...T,fromPosition:k.current.object.position.clone(),fromTarget:k.current.target.clone(),animationStartTime:performance.now(),duration:t.CAMERA.animSpeed}}},[A]);const $=()=>J.initialDistance,U=C.useCallback(D=>{if(N){const T=new Q.Vector3;T.copy(D.target.object.position),T.sub(k.current.target),N(T.length()),q(T.length()),B&&B({camera:k.current.object.position.clone(),controls:k.current.target.clone()})}},[N,B,q]);y4.useFrame(()=>{var D,T;if((D=E.current)!=null&&D.duration&&((T=E.current)==null?void 0:T.duration)>0){v||(I(!0),E.current.duration=0);const y=E.current,r1=(performance.now()-y.animationStartTime)/1e3,s1=Math.min(1,r1/(y==null?void 0:y.duration));k.current.object.position.lerpVectors(y.fromPosition,y.position,s1),k.current.target.lerpVectors(y==null?void 0:y.fromTarget,y.target,s1),k.current.object.updateProjectionMatrix(),s1>=1&&(E.current=null)}});const P=C.useCallback(D=>{if(D>0){const T=a.retailers.find(y=>y.id===D);if(T){const y=a.map_objs.filter(r1=>r1.retailer_id===T.id);for(let r1=0;r1<y.length;r1++)if(o.includes(y[r1].map_obj_name)){const s1=O.getObjectByProperty("object_id",y[r1].map_obj_name);s1&&n1(s1,y[r1].map_obj_name,!0);break}}}},[n1,a,O]);return C.useImperativeHandle(l,()=>({resetCamera:G,createRouteToStore:P,getInitialDistance:$})),w.jsxs("group",{rotation:[Math.PI/2,0,0],ref:q1,children:[w.jsx(S4.MapControls,{makeDefault:!0,onChange:U,ref:k,maxPolarAngle:Math.PI/2,minDistance:X?f4.CAMERA.minDistance:J.min,maxDistance:X?f4.CAMERA.maxDistance:J.max,enableZoom:t.ROLE==="PORTAL"||t.ROLE==="DISPLAY_APP"||t.ROLE==="WP_SITE"&&["mobile","tablet"].includes(Y),enableRotate:t.ROLE!=="WP_SITE"&&t.ROLE!=="PORTAL_RESPONSIVE"&&t.ROLE!=="DISPLAY_APP",dampingFactor:.3}),i&&i.map((D,T)=>w.jsx(W0,{visible:p===T,floorIndex:T,currentFloorIndex:p,currKioskObj:e.currKioskObj,activeObjectId:e.activeObjectId,hoverObjectId:e.hoverObjectId,meshFloors:x,routeTube:t.ROLE!=="PORTAL"?j&&j[T]:void 0,onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerMove:e.onPointerMove,onClick:e.onClick,handleChangeFloor:d},`Map-${T}`))]})}),Z0="_threejsMapWrapper_6jbfd_1",Y0="_threejsMap_6jbfd_1",J0="_map_controls_6jbfd_18",U0="_amenities_6jbfd_112",$0="_amenity_6jbfd_123",Q0="_content_6jbfd_155",K0="_icon_6jbfd_163",el="_name_6jbfd_176",m4={threejsMapWrapper:Z0,threejsMap:Y0,map_controls:J0,amenities:U0,amenity:$0,content:Q0,icon:K0,name:el},ll=e=>{const{selectedFloorIndex:l,handleFloorChange:t,amenitiesList:o,zoomIn:n,zoomOut:r,reset:a,handleAmenityClick:c,onExtractedAmenities:q}=e,{mapConfig:i,mapApiResponse:s,floorsData:m,allMapObjects:v}=$1(),I=p=>{p.preventDefault(),a instanceof Function&&(i.ROLE==="PORTAL_RESPONSIVE"||i.ROLE==="PORTAL"?a(!0):a())},x=C.useMemo(()=>s!=null&&s.map_objs?s==null?void 0:s.map_objs.filter(p=>p.layer_type==="amenity"&&v.includes(p.map_obj_name)).map(p=>p.value):[],[s,v]);return C.useEffect(()=>{q&&q(x)},[q,x]),w.jsx("div",{className:m4.threejsMapWrapper,children:w.jsxs("div",{className:m4.threejsMap,children:[m.length>0&&w.jsx("div",{className:`map_controls ${m4.map_controls}`,children:w.jsxs("div",{className:"map_controls_wrapper",children:[w.jsx("div",{className:"floors btn_group",children:m.length>1&&m.map((p,f)=>w.jsx("div",{className:`floor control_btn ${f===l?"active":""}`,onClick:()=>{t(f)},children:p.name},f))}),w.jsxs("div",{className:"reset-zoom",children:[w.jsx("div",{onClick:I,className:"reset_btn control_btn",children:"RESET"}),w.jsxs("div",{className:"zoom_btns",children:[w.jsx("div",{onClick:r,className:"zoom-out control_btn",children:"–"}),w.jsx("div",{onClick:n,className:"zoom-in control_btn",children:"+"})]})]})]})}),w.jsx("div",{className:"loading_map hide",children:"Loading map, please wait..."}),!["PORTAL","DISPLAY_APP"].includes(i.ROLE)&&w.jsx("div",{className:`amenities ${m4.amenities}`,style:{display:"block"},children:o.map((p,f)=>x.includes(p.type)?w.jsx("div",{className:`amenity ${m4.amenity}`,onClick:()=>c(p.type),children:w.jsxs("div",{className:`content ${m4.content}`,children:[w.jsx("div",{className:`icon ${m4.icon}`,dangerouslySetInnerHTML:{__html:e9(p.type)}}),w.jsx("div",{className:`name ${m4.name}`,children:p.name})]})},`amenity-${p.name}-${f}`):null)})]})})},tl="_mapBoxSidebar_kftp4_1",nl="_active_kftp4_6",ol="_sidebarWrapper_kftp4_10",rl="_sidebarBox_kftp4_15",al="_mapBox_kftp4_1",ql="_storeNamePlaceholder_kftp4_29",il="_stats_kftp4_41",x4={mapBoxSidebar:tl,active:nl,sidebarWrapper:ol,sidebarBox:rl,mapBox:al,storeNamePlaceholder:ql,stats:il};function o6(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var w9={exports:{}};/*!
|
|
71
|
+
</svg>`},X2=[{name:"ATM",type:"atm",svgCode:X1.ATM},{name:"Management",type:"management",svgCode:X1.Management},{name:"Kids Area",type:"playarea",svgCode:X1.PlayArea},{name:"Restroom",type:"restroom",svgCode:X1.RestRoom},{name:"Family Restroom",type:"family-restroom",svgCode:X1.FamilyRestRoom},{name:"Elevator",type:"elevator",svgCode:X1.Elevator},{name:"Security",type:"security",svgCode:X1.Security},{name:"Escalator",type:"escalator",svgCode:X1.Escalator},{name:"Child Stroller",type:"child-stroller",svgCode:X1.ChildStroller},{name:"Vending Machine",type:"vending-machine",svgCode:X1.VendingMachine},{name:"Stairs",type:"stairs",svgCode:X1.Stairs},{name:"Charging Station",type:"charging-station",svgCode:X1.ChargingStation},{name:"Wheelchair",type:"wheelchair",svgCode:X1.WheelChair}],U6={"route-path":0,escalator:0,underlay:0,overlay:1,"building-base":1,base:2,store:3,"big-store":4,kiosk:5,wall:6,"outer-wall":7,boundary:8,amenity:9,"layer-image":10,"layer-text":11,"route-tube":12,"special-shape":13},H2=()=>{const{mapConfig:e,allMapObjects:l,allIndexedMapObjects:t,allIndexedRetailers:o,floorsData:n}=$1(),r=C.useCallback(i=>i!=null&&U6[i]!==void 0?U6[i]:0,[]),a=C.useCallback((i,s,m,v)=>{const I={color:m instanceof Q.Color?m:L1(m),side:Q.DoubleSide,transparent:!1,depthWrite:!0,depthTest:!0,opacity:1};(e.STYLE==="2D"||i==="base"||i==null)&&i!=="boundary"&&(I.depthWrite=!1,I.depthTest=!1),i==="overlay"&&(I.color=e.OVERLAY_COLOR,I.opacity=e.OVERLAY_OPACITY),i&&["store","big-store","kiosk"].includes(i)&&e.ROLE!=="PORTAL"&&t[s]&&t[s].transparent&&(I.opacity=0);var x=new Q.MeshLambertMaterial(I);return i&&["store","big-store","kiosk","amenity"].includes(i)&&(x.colorDefault=x.color,t[s]&&t[s].bg_color!==""&&(x.color=L1(t[s].bg_color),x.colorDefault=x.color),x.active=!1),e.ROLE!=="PORTAL"&&v&&(x.opacity=0,x.transparent=!0),x.transparent=x.opacity!==1,x},[t,e.OVERLAY_COLOR,e.OVERLAY_OPACITY,e.ROLE,e.STYLE]),c=C.useCallback((i,s,m,v,I)=>{const x="MaterialAndGeometry";let p=I.toShapes(!0),f;e.STYLE==="2D"?f=["building-base"]:f=["store","big-store","base","building-base"];let _=["wall","outer-wall","boundary"];var R;if(i&&f.includes(i))R=new Q.ExtrudeGeometry(p,{depth:-m,bevelEnabled:!1});else if(i&&_.includes(i)){let g=[];I.subPaths.forEach(u=>{u.curves.forEach(d=>{if(d.type==="LineCurve"){let S=0;i==="boundary"&&(S=1);let A=A0(d,v,S),N=new Q.ExtrudeGeometry(A,{depth:-m,bevelEnabled:!1});g.push(N)}else console.warn(x+'"%s" found in walls. Check layer "%s"',d.type,s)})}),g.length===1?R=g[0]:g.length>1?R=S0(g):console.warn(x+'Unneccessary wall exists "%s"',s)}else{R=new Q.ShapeGeometry(p);try{R.attributes.position.count===0&&console.warn(x+'Unneccessary map shape "%s"',s,I.userData.node)}catch(g){console.error(g.message)}}return R},[e.STYLE]),q=C.useCallback((i,s,m,v,I,x,p,f,_,R)=>{var A,N;const g=a(i,s,m,v),u=c(i,s,p,f,R),d=new Q.Mesh(u,g);d.object_id=s,d.mesh_type=i,d.floor_index=_,d.visible=I,d.position.z=x;let S="";if(["retail_logo","retail_name","retail_text","custom_text","amenity"].includes((A=t[s])==null?void 0:A.layer_type)){if(t[s].layer_type&&["retail_name","retail_logo"].includes(t[s].layer_type)&&t[s].retailer_id&&o[((N=t[s])==null?void 0:N.retailer_id)||0])S=o[t[s].retailer_id].retail_name;else if(["retail_text","custom_text"].includes(t[s].layer_type))S=t[s].custom_text,S===""&&t[s].retailer_id&&o[t[s].retailer_id]&&(S=o[t[s].retailer_id].retail_name);else if(["amenity"].includes(t[s].layer_type)&&(S=t[s].value,S)){const B=X2.find(V=>V.type===S);B&&(S=B.name)}}return d.userData.storeName=S,e.STYLE==="2D"&&(d.renderOrder=r(i),s&&s.includes("underlay")&&(d.renderOrder=r("underlay"))),n[_].objsGroup.add(d),i==="escalator"&&(n[_].escalatorsNodes[s]=null,n[_].escalatorsObjs.push(d),d.escalator_id=_+"-"+s),i&&["store","big-store","kiosk","amenity"].includes(i)&&(d.route_node_id=null,t[s]&&t[s].layer_type,l.push(s),(e.ROLE!=="PORTAL"&&i==="kiosk"||e.ROLE!=="PORTAL"&&e.ROLE!=="PORTAL_KIOSK"&&t[s]&&t[s].obj_type==="retailer"&&t[s].retailer_id!=null||e.ROLE!=="PORTAL"&&e.ROLE!=="PORTAL_KIOSK"&&t[s]&&t[s].obj_type==="custom"&&t[s].custom_text!==""||e.ROLE!=="PORTAL"&&e.ROLE!=="PORTAL_KIOSK"&&t[s]&&t[s].layer_type==="amenity"&&t[s].value!==null||e.ROLE==="PORTAL"&&t[s]&&(t[s].obj_type==="special"||t[s].obj_type==="custom")||e.ROLE==="PORTAL"&&["store","kiosk","amenity"].includes(d.mesh_type??"")||e.ROLE==="PORTAL")&&n[_].interactiveObjs.push(d)),{mesh:d,geometry:u,material:g,object_id:s,mesh_type:i,floor_index:_,visible:I,renderOrder:d.renderOrder}},[t,o,l,n,c,a,r,e.ROLE,e.STYLE]);return{getRenderOrder:r,getMaterial:a,getGeometry:c,getMaterialAndGeometry:q}},i3="ROUTE: ",R0=1e4,O9=()=>{const{floorsData:e,allNodesFloor:l,ngraphPath:t,pathFinderGraph:o,allIndexedMapObjects:n}=$1(),{getRenderOrder:r}=H2(),a=C.useCallback((_,R,g)=>{if(!g.data)return!1;let u=g.data.weight;const d=l[_.id],S=l[R.id];return d!==S?u+R0+Math.abs(d-S):u},[l]),c=C.useCallback(_=>{var R;for(let g=0;g<_.length;g++){const u=_[g];u.route_active=!1,u.route_tube!=null&&(u.route_tube.geometry.dispose(),u.route_tube.material.dispose(),(R=u.objsGroup)==null||R.remove(u.route_tube)),u.route_tube=void 0,u.route_texture=null,u.escalatorMeshes=[]}},[]),q=C.useCallback((_,R,g)=>{let u=g.find(_,R);return u.length===0?!1:u},[]),i=C.useCallback((_,R,g)=>{let d=document.createElement("canvas").getContext("2d");if(d){d.canvas.width=_,d.canvas.height=80,d.fillStyle="#4ea5ff",d.fillRect(0,0,_,80);let S=.1*_;const A=60,N=120;S<A&&(S=A),S>N&&(S=N);let B=d.createLinearGradient(0,0,S,0);B.addColorStop(0,"#4ea5ff"),B.addColorStop(.4,"white"),B.addColorStop(.6,"white"),B.addColorStop(1,"#4ea5ff"),d.fillStyle=B,d.fillRect(10,0,S,80);let V=new Q.CanvasTexture(d.canvas);return V.offset.x=1,V.colorSpace="srgb",g[R].route_texture=V,V}else return},[]),s=C.useCallback((_,R,g,u="2D")=>{var V;let d=0,S=new Q.CurvePath;for(let l1=1;l1<_.length;l1++){let W=new Q.Vector3(_[l1-1].data.x,_[l1-1].data.y,0),n1=new Q.Vector3(_[l1].data.x,_[l1].data.y,0);S.add(new Q.LineCurve3(W,n1)),d+=W.distanceTo(n1)}var A=new Q.TubeGeometry(S,400,6,8);A=new Q.BufferGeometry().copy(A);var N=new Q.MeshBasicMaterial({map:i(d,R,g),transparent:!0,side:Q.DoubleSide,depthTest:!1,depthWrite:!1});let B=new Q.Mesh(A,N);return u==="2D"&&(B.position.z=-10,B.scale.z=.1),B.position.z=0,B.renderOrder=r("route-tube"),B.mesh_type="route-tube",B.geometry.index!==null?B.geometry.setDrawRange(0,B.geometry.index.count):console.warn("route_tube.geometry.index is null"),g[R].route_tube=B,(V=g[R].objsGroup)==null||V.add(B),B},[r,i]),m=C.useCallback((_,R,g,u,d,S,A,N,B=null)=>{var L,k,Z,O,E,b;const V=[];c(S);let l1=g.getObjectByProperty("object_id",_),W=g.getObjectByProperty("object_id",R),n1=l1.route_node_id,K=W.route_node_id;if(n1||console.error(i3+'Route Anchor point missing for "%s"',_),K||console.error(i3+'Route Anchor point missing for "%s"',R),!n1||!K)return V;const e1=l1.floor_index,Y=W.floor_index,J=t.nba(A,{distance:a,oriented:!0,blocked(h,z,X){return X.data.blocked},debug:!0}),F=q(n1,K,J),q1=[];if(!F)return[];F.reverse();const j=[];for(let h=0;h<F.length;h++){const z=F[h];j[u[z.id]]?j[u[z.id]].push(z):j[u[z.id]]=[z],d.includes(z.id)&&d.includes(F[h-1].id)&&d.includes(F[h+1].id),q1.push(z)}for(let h=0;h<q1.length;h++){const z=q1[h];if(u[q1[0].id]!==u[q1[q1.length-1].id]&&d.includes(z.id)){const X=Object.keys(S[u[z.id]].escalatorsNodes).find(M=>{var o1,$;return(($=(o1=S[u[z.id]])==null?void 0:o1.escalatorsNodes)==null?void 0:$[M])===z.id}),G=g.getObjectByProperty("escalator_id",u[z.id]+"-"+X);let t1=null;if(u[z.id]!==u[q1[h+1].id]&&d.includes(q1[h+1].id)&&(t1={index:u[q1[h+1].id],direction:"To"}),u[z.id]!==u[q1[h-1].id]&&d.includes(q1[h-1].id)&&(t1={index:u[q1[h-1].id],direction:"From"}),t1&&G){G.goToFloor=t1;const M=G.clone();M.goToFloor=t1,M.object_id=X,(k=(L=S[u[z.id]])==null?void 0:L.escalatorMeshes)==null||k.push(M)}}}for(let h=0;h<j.length;h++){const z=j[h];if(z&&z.length>1){const X=s(z,h,S,N);V[h]=X,S[h].route_active=!0,S[h].routeMeshes=[X],h===e1&&((O=(Z=S[h])==null?void 0:Z.routeMeshes)==null||O.push(l1)),h===Y&&((b=(E=S[h])==null?void 0:E.routeMeshes)==null||b.push(W))}}return V},[s,q,t,c,a]),v=C.useCallback((_,R,g,u,d,S,A,N)=>{if(R===g)return{routePaths:[],fromFloor:void 0};const B=m(R,g,u,_,S,d,A,N);B.length||console.warn(i3+'No route found in between "%s" and "%s"',R,g);let V=u.getObjectByProperty("object_id",R);return{routePaths:B,fromFloor:V.floor_index}},[m]),I=C.useCallback((_,R,g,u)=>{let d=0,S=g.find(R,_);if(S.length===0)return!1;for(let A=1;A<S.length;A++){let N=u.getLink(S[A-1].id,S[A].id);d+=(N==null?void 0:N.data.weight)||0}return d},[]),x=C.useCallback(()=>{if(e.length>1){const _=[],R=[];for(let g=0;g<e.length;g++)R[g]=[],e[g].escalatorsNodes&&(_[g]=Object.fromEntries(Object.entries(e[g].escalatorsNodes).map(([u,d])=>{const S=u.split("-"),A=S.slice(0,2).join("-"),N=S.includes("end"),B=S.includes("start"),V=S.includes("up"),l1=S.includes("down"),W=V?"up":l1?"down":"both";return R[g].push(A),[A,{node:d,escalatorId:A,isExitOnly:N,isEntranceOnly:B,upOnly:V,downOnly:l1,direction:W,floorsTo:[]}]})));for(let g=0;g<e.length;g++)for(let u=0;u<R[g].length;u++){const d=R[g][u],S=_[g][d];for(let A=g+1;A<e.length;A++)for(let N=0;N<R[A].length;N++){const B=R[A][N];d===B&&S.floorsTo.push(A)}}for(let g=0;g<e.length-1;g++){const u=_[g];for(const d in u){const S=u[d],A=S.node;S.floorsTo.forEach(N=>{const V=_[N][d].node;V&&(S.isExitOnly?(o.addLink(A,V,{blocked:!0}),o.addLink(V,A,{weight:1})):S.isEntranceOnly?(o.addLink(V,A,{blocked:!0}),o.addLink(A,V,{weight:1})):(o.addLink(A,V,{weight:1}),o.addLink(V,A,{weight:1})))})}}}},[e,o]),p=C.useCallback((_,R,g,u,d)=>{let S=g.getObjectByProperty("object_id",_),A=S?S.route_node_id:"";var N=null,B=9999;const V=[];for(let l1 in n){const W=n[l1];W.layer_type==="amenity"&&W.obj_type==="special"&&W.value===R&&V.push(l1)}return V.forEach(l1=>{let W=g.getObjectByProperty("object_id",l1);const n1=t.aStar(o,{distance:a,debug:!0});if(W&&A){var K=W.route_node_id;try{var e1=I(A||"",K||"",n1,o);e1&&e1<B&&(B=e1,N=l1)}catch(Y){console.warn(`Amenity Path: ${Y.message}`)}}!A&&W&&(N=K)}),v(l,_,N??"",g,e,u,o,d)},[n,l,v,e,I,t,o,a]),f=C.useCallback((_,R,g)=>{const u=new Map,d=e[_];return d&&d.route_points&&d.route_points.forEach(S=>{let A=new Q.Vector3(S.node.x,S.node.y,-10),N=new Q.Vector3(0,0,1);g.set(A,N);var B=g.intersectObjects(e[_].interactiveObjs);B.length&&(B[0].object.route_node_id=S.name,u.set(B[0].object.object_id,S.name));var V=g.intersectObjects(e[_].escalatorsObjs);if(V.length){let W=V[0].object.object_id;const n1=e[_].escalatorsNodes;n1&&(n1[W]=S.name,l[S.name]=_,R.push(S.name))}}),u},[l,e]);return{delete_route_path:c,create_route:v,create_route_paths:m,create_route_path:s,get_route_nodes:q,get_nodes_distance:I,get_route_texture:i,linkFloorEscalators:x,make_amenity_route:p,assign_route_nodes_to_stores:f}};function z0(e){return"node-"+e}function $6(e,l,t,o){let n=!1,r="-name-not-found-";const a=t[l];if(a.route_points!==void 0){for(let c=0;c<a.route_points.length;c++)if(e.x===a.route_points[c].node.x&&e.y===a.route_points[c].node.y){n=!0,r=a.route_points[c].name;break}n||(r=z0(o))}return[r,n]}const O0=()=>{const{mapConfig:e,floorsData:l,allNodesFloor:t,pathFinderGraph:o}=$1();return{getMeshParams:C.useCallback((r,a,c,q)=>{var d;const i="MeshParams";let s=null;var m=r.color.clone(),v=0,I=0,x=!0,p=!0,f=!1,_=e.WALL_THICKNESS,R=!0,g=(d=r.userData)==null?void 0:d.node.id;return g!==void 0?g.startsWith("boundary")?(s="boundary",m=e.BOUNDARY_COLOR,_=e.BOUNDARY_THICKNESS,e.STYLE==="3D"&&(v=9)):g.startsWith("wall")?(s="wall",m=e.WALL_COLOR,e.STYLE==="3D"&&(v=8.5)):g.startsWith("outer-wall")?(s="outer-wall",m=e.WALL_COLOR,e.STYLE==="3D"&&(p=!1)):g.startsWith("base")?(s="base",m=e.BASE_COLOR):g.startsWith("store")?(s="store",m=e.STORE_DEFAULT_COLOR,e.STYLE==="3D"&&(v=e.STORE_HEIGHT),g.startsWith("store-underlay")&&(R=!1)):g.startsWith("route-path")?(s="route-path",p=!1,r.subPaths.forEach(S=>{S.curves.length===0&&console.warn(i+'Route-path standalone anchor point exists, layer_name: "%s"',g),S.curves.forEach(A=>{var K,e1;const N=A.v1,B=A.v2,[V,l1]=$6(N,c,l,q);l1||((K=l[c].route_points)==null||K.push({name:V,node:new Q.Vector3(N.x,N.y,1)}),t[V]=c);const[W,n1]=$6(B,c,l,q);n1||((e1=l[c].route_points)==null||e1.push({name:W,node:new Q.Vector3(B.x,B.y,1)}),t[W]=c),o.addNode(V,{...N}),o.addNode(W,{...B}),o.addLink(V,W,{weight:N.distanceTo(B)}),o.addLink(W,V,{weight:N.distanceTo(B)})})})):g.startsWith("escalator-")?(s="escalator",x=!1,f=!0):g.startsWith("kiosk-")?(s="kiosk",f=!0):g.startsWith("amenity-")?(s="amenity",f=!0,I=1):g.startsWith("overlay")?s="overlay":g.startsWith("special-shape")?s="special-shape":v=1:console.warn(i+"Layer name is undefined, path",r),{mesh_type:s,layer_color:m,extrude:v,z_index:I,mesh_visible:x,mesh_draw:p,mesh_transparent:f,line_thickness:_,interactiveMesh:R,path:r,layer_name:g}},[t,l,e.BASE_COLOR,e.BOUNDARY_COLOR,e.BOUNDARY_THICKNESS,e.STORE_DEFAULT_COLOR,e.STORE_HEIGHT,e.STYLE,e.WALL_COLOR,e.WALL_THICKNESS,o])}};let T0=0;const w0=e=>{const{mapConfig:l,pathFinderGraph:t}=$1(),{getMaterialAndGeometry:o}=H2(),{getMeshParams:n}=O0(),{assign_route_nodes_to_stores:r,linkFloorEscalators:a}=O9(),[c,q,i]=C.useMemo(()=>{const s=new Set,m=[],v=[];e.forEach((I,x)=>{var p,f;if(I&&I.paths&&I.paths.length){const _=[];for(let d=0;d<I.paths.length;d++)_.push((f=(p=I.paths[d])==null?void 0:p.userData)==null?void 0:f.node.id);const R=I.paths;for(let d=0;d<R.length;d++){const{mesh_type:S,layer_color:A,extrude:N,z_index:B,mesh_visible:V,mesh_draw:l1,mesh_transparent:W,line_thickness:n1,path:K,layer_name:e1}=n(R[d],R,x,++T0);if(l1){const Y=o(S,e1,A,W,V,B,N,n1,x,K);e1.startsWith("kiosk-")&&l.ROLE,m[x]||(m[x]=[]),m[x].push(Y)}}const g=new Q.Raycaster,u=r(x,v,g);if(u.size&&m[x].length)for(let d=0;d<m[x].length;d++)u.has(m[x][d].mesh.object_id)&&(m[x][d].mesh.route_node_id=u.get(m[x][d].mesh.object_id));a()}});for(let I=0;I<m.length;I++){const x=m[I];for(let p=0;p<x.length;p++)s.add(x[p].object_id)}return[m,v,s]},[r,o,n,a,l.ROLE,e]);return{GeometriesAndMaterials:c,graph:t,escalator_nodes:q,allSvgObjectIds:i}},T9=()=>{const{allIndexedRetailers:e,allIndexedMapObjects:l,floorsData:t,mapConfig:o}=$1(),{getRenderOrder:n}=H2(),r=(x,p,f,_,R,g,u,d)=>{for(let S=0;S<x.length;S++)a(x[S],p,f,_,R,g,u,d)},a=(x,p,f,_,R,g,u,d)=>{let S=p.getObjectByProperty("object_id",x.map_obj_name);S&&add_store_name_logo(S,f,_,R,g,u,d,p)},c=x=>(Array.isArray(x)||(x=[x]),x.reduce((f,_)=>(_.geometry.boundingBox||_.geometry.computeBoundingBox(),f.union(_.geometry.boundingBox),f),new Q.Box3)),q=(x,p,f,_,R)=>{let g=R[x];p.z=-f.z,_.rotateZ(((g==null?void 0:g.rotate)||0)*Math.PI/180),_.scale.y*=-1,p.x+=(g==null?void 0:g.offset_x)||0,p.y+=(g==null?void 0:g.offset_y)||0,_.position.set(p.x,p.y,p.z+1)},i=async x=>{try{const p=l9(x,o),f=await fetch(p);if(!f.ok)throw new Error(`Failed to fetch image: ${f.statusText}`);const _=await f.blob();return URL.createObjectURL(_)}catch(p){return console.error("Error fetching or converting the image:",p),""}},s=(x,p)=>new Promise((f,_)=>{var R;if(x.obj_type==="retailer")p?i(p.logo).then(g=>{f(g)}):(console.error("retailer not found"),f(""));else if(x.obj_type==="special"){let g=x.value;if(x.layer_type==="kiosk"&&(g="kiosk"),x.layer_type==="escalator"&&(g="escalator"),g){let u="222222";x.text_color!=null&&(u=x.text_color.replace("#",""));const d=document.getElementById("map-special-svg-"+g);if(d){const S=d.querySelector("svg");if(S){const A=S.cloneNode(!0);A.querySelectorAll("[fill]").forEach(W=>{W.setAttribute("fill","#"+u)});const B=new XMLSerializer().serializeToString(A),V=new Blob([B],{type:"image/svg+xml"}),l1=URL.createObjectURL(V);f(l1)}else console.error("svg_element not found",g),f("")}else console.error("svg_block not found",g),f("")}}else x.custom_image!==""&&((R=x==null?void 0:x.custom_image)!=null&&R.startsWith("http"))?f(x.custom_image):(console.error("custom_image URL not found"),f(""))}),m=(x,p,f)=>{const _=document.createElement("img");_.crossOrigin="anonymous",_.src=x,_.onload=function(){const R=document.getElementById("temp-image-rendering");R&&(_.style.height="100px",R.appendChild(_),setTimeout(()=>{const g=document.createElement("canvas"),u=g.getContext("2d");if(u){g.width=_.width*O6,g.height=_.height*O6,u==null||u.drawImage(_,0,0,g.width,g.height);let d=new Q.CanvasTexture(g);d.colorSpace="srgb";const S=new Q.PlaneGeometry(p.size,p.size*_.height/_.width),A=new Q.MeshBasicMaterial({map:d,transparent:!0,side:Q.DoubleSide,depthTest:!1,depthWrite:!1});p.layer_type==="kiosk"&&(A.visible=!1),f(S,A)}},100))},_.onerror=function(){console.error("processImage():: Error loading image:",x)}},v=C.useCallback((x,p,f,_,R,g,u,d,S,A)=>{s(f,p[f.retailer_id]).then(N=>{N&&m(N,f,(B,V)=>{var n1;const l1=new Q.Mesh(B,V),W=_.floor_index;q(R,u,d,l1,x),l1.object_id=g,l1.floor_index=W,l1.renderOrder=n("layer-image"),(n1=S[W])==null||n1.objsGroup.add(l1),A({storeLogo:l1})})})},[n]),I=C.useCallback((x,p,f,_,R,g)=>{const u=_+p;let d=null;if(x.boundingBox||x.computeBoundingBox(),!x.boundingBox)return null;const S=x.boundingBox,A=new Q.Vector3;S.getCenter(A);const N=new Q.Vector3;S.getSize(N);let B=l[p]?l[p]:{layer_type:p.startsWith("escalator")?"escalator":"custom_text",custom_text:"",size:8};if(["retail_name","retail_text","custom_text"].includes(B.layer_type)){let V="";B.layer_type==="retail_name"&&B.retailer_id&&e[B.retailer_id]?V=e[B.retailer_id].retail_name:["retail_text","custom_text"].includes(B.layer_type)?V=B.custom_text:V="";let l1=o.STORE_TEXT_COLOR;B.text_color&&(l1=L1(B.text_color));const W={color:l1,transparent:!1,side:Q.DoubleSide,depthWrite:!1,depthTest:!1};let n1=new Q.MeshBasicMaterial(W),K=new z9(V,{font:R,size:parseInt(B.size),height:.01,curveSegments:4});K.center();const e1=new Q.Mesh(K,n1);e1.userData.debug_name=V,e1.userData.font=R,q(p,A,N,e1,l),e1.object_id=u,e1.floor_index=f,e1.renderOrder=n("layer-text"),B.layer_type==="retail_name"&&(e1.userData.retail_name=V),t[f].objsGroup.add(e1),d={textMesh:e1}}else(B.layer_type==="retail_logo"||B.layer_type==="custom_image"||B.obj_type==="special"&&B.layer_type==="kiosk"&&B.kiosk_id!=null||B.obj_type==="special"&&B.layer_type==="amenity"&&B.value!==""||B.layer_type==="escalator")&&v(l,e,B,x,p,u,A,N,t,g);return d},[l,e,t,v,n,o.STORE_TEXT_COLOR]);return{drawTextLogoStoreOnMap:r,addTextOrLogoOnStore:a,getMeshGroupBoundingBox:c,layer_text_logo_position_by_id:q,getImage:s,processImage:m,getImageLogo:v,get_store_name_logo_geometry:I}};let s3=[];const M0=()=>{const{mapConfig:e,initialFloorsDataIsLoaded:l,allIndexedMapObjects:t,allIndexedRetailers:o,allMapObjects:n,allNodesFloor:r,pathFinderGraph:a,setPathFinderGraph:c,mapApiResponse:q}=$1(),[i,s]=C.useState([]),[m,v]=C.useState([]),[I,x]=C.useState([]),[p,f]=C.useState([]);let _=y4.useLoader(Y3,q.floors.map(V=>l9(V.svgUrl,e)));const{GeometriesAndMaterials:R,graph:g,escalator_nodes:u,allSvgObjectIds:d}=w0(_),{get_store_name_logo_geometry:S}=T9(),A=S4.useFont(K8),N=C.useCallback(V=>l1=>{x(W=>(W[V]?W[V].push({...l1}):W[V]=[{...l1}],[...W]))},[]),B=C.useCallback(()=>{s(V=>(V&&V.forEach(l1=>{l1&&l1.forEach(W=>{W.mesh.removeFromParent()})}),[])),v(V=>(V&&V.forEach(l1=>{l1&&l1.forEach(W=>{W.textMesh.removeFromParent()})}),[])),x(V=>(V&&V.forEach(l1=>{l1&&l1.forEach(W=>{W.storeLogo.removeFromParent()})}),[]))},[]);return C.useEffect(()=>{if(l&&e.ROLE==="PORTAL")return()=>{B()}},[B,l]),C.useEffect(()=>()=>{B()},[]),C.useEffect(()=>{if(!A||!_)return;x([]);const V=[];if(s3.forEach(n1=>{let K;for(let Y=0;Y<R.length&&(K=R[Y].find(J=>J.object_id===n1.map_obj_name),K===void 0);Y++);if(!K)return null;const e1=S(K.geometry,n1.map_obj_name,K.floor_index,A2,A,N(K.floor_index));e1&&(V[K.floor_index]||(V[K.floor_index]=[]),V[K.floor_index].push(e1))}),R.reduce((n1,K)=>n1+K.length,0)-s3.length!==0){const n1=new Set;s3.forEach(K=>{n1.add(K.map_obj_name)}),R.forEach(K=>{K.forEach(e1=>{if(!n1.has(e1.object_id)){const Y=S(e1.geometry,e1.object_id,e1.floor_index,A2,A,N(e1.floor_index));Y&&(V[e1.floor_index]||(V[e1.floor_index]=[]),V[e1.floor_index].push(Y))}})})}s([...R]),v(V),c(g),f([...u])},[_,A,t,o,n,r,a,e,c,N,R,S,g,u]),C.useMemo(()=>({meshParams:i,textParams:m,storeLogos:I,pathFinderGraph:a,escalator_nodes:p,allSvgObjectIds:d}),[i,m,I,a,p,d])},N0=e=>{const{scene:l}=y4.useThree();return e.background&&(l.background=new Q.Color(e.background)),null},L0=e=>{const{camera:l}=y4.useThree(),t=e.far||e.near||e.fov;return e.far&&(l.far=e.far),e.near&&(l.near=e.near),l instanceof Q.PerspectiveCamera&&e.fov&&(l.fov=e.fov),t&&l.updateProjectionMatrix(),null};function Q6(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function P0({mesh:e}){const l=C.useRef(null);return C.useEffect(()=>{var r;if(!e)return;if(!((r=e.geometry.index)!=null&&r.count)){console.log("NO ROUTE TUBE GEOMETRY INDEX COUNT");return}if(!(e.material instanceof Q.MeshBasicMaterial))return;if(!e.material.map){console.log("NO ROUTE TEXTURE");return}e.geometry.setDrawRange(0,0);const t=e.geometry.index.count,o=(()=>{const c=performance.now();return()=>{const q=(performance.now()-c)/1e3,i=Math.floor(Q6(q)*t);q>=1&&(l.current=n),e.geometry.setDrawRange(0,i)}})(),n=(()=>{if(!(e.material instanceof Q.MeshBasicMaterial)||!e.material.map)return null;const a=e.material.map.offset,c=2e3,q=.1,i=1+q,s=performance.now();return()=>{const m=(performance.now()-s)/c%1;a.x=q-i*Q6(m)}})();return l.current=o,()=>{l.current=null,e.removeFromParent(),e.material instanceof Q.MeshBasicMaterial&&e.material.dispose(),e.geometry&&e.geometry.dispose()}},[e]),y4.useFrame(()=>{if(l.current)try{l.current()}catch(t){console.error(`ERROR ANIMATE ROUTE: ${t.message}`),l.current=null}}),e?w.jsx("primitive",{object:e}):null}const F0="_escalator_elems_1kqb9_1",B0="_element_1kqb9_4",G0="_svgIcon_1kqb9_21",k0="_label_1kqb9_34",i2={escalator_elems:F0,element:B0,svgIcon:G0,label:k0},j0="_mapCenterMarker_1eu0j_18",V0={mapCenterMarker:j0},K6=({size:e,lockSize:l,blink:t,cameraLength:o,text_color:n="black"})=>{const{mapConfig:r}=$1(),[,a]=C.useState(1),[c,q]=C.useState(null),i=l?5*e/256:8*e;C.useEffect(()=>{!l&&o!==void 0&&a(1-(o-r.CAMERA.minDistance)/(r.CAMERA.maxDistance-r.CAMERA.minDistance))},[l,r,o]);const s=C.useMemo(()=>c?new Q.SpriteMaterial({map:c,sizeAttenuation:!l,depthTest:!1,depthWrite:!1,color:n}):null,[l,c,n]);return C.useEffect(()=>{var v;const m=(v=document.getElementById("map-special-svg-kiosk"))==null?void 0:v.querySelector("svg");if(m){const I=m.cloneNode(!0),x=new XMLSerializer().serializeToString(I),p=new Blob([x],{type:"image/svg+xml"}),f=URL.createObjectURL(p),_=document.createElement("canvas");_.width=256,_.height=256;const R=_.getContext("2d"),g=document.createElement("img");g.src=f,g.onload=()=>{R==null||R.drawImage(g,96,0,64,128);const u=new Q.Texture(_);u.needsUpdate=!0,q(u)}}},[]),s?w.jsxs("group",{children:[w.jsx("sprite",{scale:i,material:s}),t&&w.jsx(S4.Html,{children:w.jsx("div",{className:`mapCenterMarker ${V0.mapCenterMarker}`})})]}):null},D0=e=>{if(e){var l={...e};return l.r=e.r*.92,l.g=e.g*.92,l.b=e.b*.92,l}return null},e8=e=>{const{type:l,mesh:t,currentFloorIndex:o}=e;C.useEffect(()=>(t.userData.triggerUpdate=()=>{},()=>t.userData.triggerUpdate=void 0),[t.userData]);const{cameraLength:n}=$1();switch(l){case"storeLogo":return t.userData.kioskConfig&&t.userData.kioskConfig.floorIndex===o?w.jsx("primitive",{object:t,children:w.jsx(K6,{size:t.userData.kioskConfig.size,blink:t.userData.kioskConfig.blink,cameraLength:n,lockSize:t.userData.kioskConfig.lockSize,text_color:t.userData.kioskConfig.text_color})},t.uuid):w.jsx("primitive",{object:t,children:t.userData.htmlContent?w.jsx(S4.Html,{style:{pointerEvents:"none"},distanceFactor:t.userData.distanceFactor,children:t.userData.htmlContent}):null},t.uuid);case"kiosk":return t.userData.kioskConfig&&t.userData.kioskConfig.floorIndex===o?w.jsx(K6,{size:t.userData.kioskConfig.size,blink:t.userData.kioskConfig.blink,cameraLength:n,lockSize:t.userData.kioskConfig.lockSize,text_color:t.userData.kioskConfig.text_color}):null;default:return null}},W0=e=>{const{meshFloors:l,routeTube:t,floorIndex:o,currentFloorIndex:n,activeObjectId:r,hoverObjectId:a,visible:c,handleChangeFloor:q}=e,{mapConfig:i,floorsData:s}=$1(),{meshParams:m,textParams:v,storeLogos:I}=l,x=s[o],p=e.onPointerMove,f=e.onPointerEnter,_=e.onPointerLeave,R=e.onClick,g=m[o],u=v[o],d=I[o],S=s[o].escalatorMeshes;return w.jsxs("group",{visible:c,children:[g==null?void 0:g.map(A=>{if(!A.mesh)return null;const N=c&&A.mesh.visible&&x.interactiveObjs&&x.interactiveObjs.includes(A.mesh),B=a&&A.mesh.object_id===a,V=r&&A.mesh.object_id===r;if(N)if((V||B)&&(A.mesh.material instanceof Q.MeshLambertMaterial||A.mesh.material instanceof Q.MeshStandardMaterial)){const l1=V?i.ACCENT_COLOR:A.mesh.material.colorDefault;A.mesh.material.color=B?D0(l1):l1}else A.mesh.material.color=A.mesh.material.colorDefault;return w.jsx("group",{...N?{onPointerOver:f,onPointerMove:p,onPointerOut:_,onClick:R}:{},children:w.jsx("primitive",{object:A.mesh})},A.mesh.uuid)}),u==null?void 0:u.map(A=>A.textMesh?w.jsx(C.Fragment,{children:w.jsx("primitive",{object:A.textMesh,children:A.textMesh.userData.kioskConfig?w.jsx(e8,{mesh:A.textMesh,currentFloorIndex:n,type:"kiosk",visible:c},void 0):null})},A.textMesh.uuid):null),d==null?void 0:d.map(A=>A.storeLogo?w.jsx(e8,{mesh:A.storeLogo,currentFloorIndex:n,type:"storeLogo",visible:c},A.storeLogo.uuid):null),S==null?void 0:S.map(A=>{var N,B;return w.jsx("primitive",{object:A,children:w.jsx(S4.Html,{visible:!0,position:(N=A.geometry.boundingSphere)==null?void 0:N.center,children:w.jsx("div",{className:`escalator_elems ${i2.escalator_elems}`,style:{display:c?"block":"none"},onClick:V=>{var l1;return V.stopPropagation(),q(((l1=A.goToFloor)==null?void 0:l1.index)||0),!1},onPointerMove:V=>V.stopPropagation(),children:w.jsxs("div",{className:`element ${i2.element}`,id:A.object_id,children:[w.jsx("div",{className:`svgIcon ${i2.svgIcon}`,dangerouslySetInnerHTML:{__html:e9("escalator")}}),w.jsxs("div",{className:`label ${i2.label}`,children:[(B=A.goToFloor)==null?void 0:B.direction,": ",A.goToFloor?s[A.goToFloor.index].name:""]})]})})})},`escalator-${A.object_id}`)}),w.jsx(P0,{mesh:t})]})};function l8(e,l,t,o){if(Array.isArray(e)||(e=[e]),!e.length)return console.warn("get_camera_focus_object: no objects passed"),{position:new Q.Vector3,target:new Q.Vector3};const n=e.reduce((p,f)=>(f.geometry.boundingBox||f.geometry.computeBoundingBox(),f.geometry.boundingBox&&p.union(f.geometry.boundingBox),p),new Q.Box3),r=new Q.Vector3;n.getSize(r);const a=new Q.Vector3;n.getCenter(a),e[0].localToWorld(a);let c=Math.tan(Math.PI*l/360),q=1.1,i=r.x*q/2/(c*t),s=r.y*q/2/c,m=Math.max(i,s),v=X0(m,o);const I=new Q.Vector3(a.x,0,a.z);return{position:new Q.Vector3(a.x,m,a.z+v),target:I}}function X0(e,l){let t=60;return l==="2D"&&(t=89.9),e/Math.tan(t*Math.PI/180)}const H0=C.forwardRef((e,l)=>{const{mapConfig:t,allMapObjects:o,allIndexedMapObjects:n,allNodesFloor:r,mapApiResponse:a,pathFinderGraph:c,setCameraLength:q,floorsData:i}=$1(),{make_amenity_route:s,create_route:m}=O9(),[v,I]=C.useState(!1),{meshFloors:x,currentFloorIndex:p,currKioskObj:f,currKioskFloorIndex:_,routeTargetId:R,routeTargetFromId:g,selectedAmenityType:u,handleChangeFloor:d,escalatorNodes:S,zoom:A,handleCameraLength:N,handleCameraAndControlsChange:B,activeObjectId:V,isSelectedRetailerSlug:l1,setIsCameraInit:W,handleObjectClick:n1,triggerClick:K,cameraControlsPosition:e1,deviceType:Y}=e,[J,F]=C.useState({min:t.CAMERA.minDistance,max:t.CAMERA.maxDistance,initialDistance:0,needsUpdate:!0}),q1=C.useRef(null),[j,L]=C.useState([]),k=C.useRef(null),{camera:Z,scene:O}=y4.useThree(),E=C.useRef(null),b=t.STYLE,h=t.ACCENT_COLOR,z=f?f.object_id:g||void 0,X=t.ROLE==="PORTAL"&&R,G=C.useCallback((D=!1)=>{if(!(Z instanceof Q.PerspectiveCamera)){console.error("Camera is not a PerspectiveCamera");return}const T=x.meshParams[_];if(!(T!=null&&T.length)){console.warn("objects not loaded yet");return}let y;y=T.map(b1=>b1.mesh);const r1=l8(y,Z.fov,Z.aspect,t.ROLE==="PORTAL"?"2D":b);let s1=!0;if(e1){let b1=e1.camera;b1 instanceof Q.Vector3||(b1=new Q.Vector3(b1.x,b1.y,b1.z)),s1=b1.length()===0}!D&&e1&&!s1&&!["PORTAL"].includes(t.ROLE)&&(r1.position.set(e1.camera.x,e1.camera.y,e1.camera.z),r1.target.set(e1.controls.x,e1.controls.y,e1.controls.z));const _1=Math.min(J.max,Math.max(J.min,r1.position.distanceTo(r1.target)));r1.position.sub(r1.target).setLength(_1).add(r1.target),E.current={...r1,fromPosition:k.current.object.position.clone(),fromTarget:k.current.target.clone(),animationStartTime:performance.now(),duration:t.CAMERA.animSpeed},["DISPLAY_APP","WP_SITE"].includes(t.ROLE)&&J.needsUpdate===!1&&J.initialDistance>0&&F(b1=>({...b1,min:t.CAMERA.minDistance<.1?.1:t.CAMERA.minDistance,max:t.CAMERA.maxDistance}))},[Z,J.needsUpdate,t.CAMERA.animSpeed,t.CAMERA.maxDistance,t.CAMERA.minDistance,e1,t.ROLE,_,x.meshParams,b]),t1=E.current?E.current.position.distanceTo(E.current.target):0;C.useEffect(()=>{e1&&G()},[e1,G]),C.useEffect(()=>{t1>0&&J.needsUpdate&&(F({min:t.CAMERA.minDistance<.1?.1:t.CAMERA.minDistance,max:t.CAMERA.maxDistance,initialDistance:t1,needsUpdate:!1}),W(!0))},[t1,J.needsUpdate,t.CAMERA,W]),C.useEffect(()=>{F(D=>({...D,needsUpdate:!0}))},[t.CAMERA]),C.useEffect(()=>{x.meshParams.length>0&&G()},[x.meshParams.length,G]),C.useEffect(()=>{if(!u||t.ROLE==="PORTAL"){L([]);return}const{routePaths:D,fromFloor:T}=s(z??"",u,O,S,b);L(D),T!==void 0&&d(T),f&&t.ROLE==="DISPLAY_APP"&&d(_)},[u,O,c,i,S,b,z,t.ROLE,r,n,s,f,d,_]);const M=C.useCallback(()=>{i.flat().forEach(D=>D.escalatorMeshes=[])},[i]);C.useEffect(()=>{if(!z||!R||t.ROLE==="PORTAL"){if(t.ROLE==="PORTAL")if(R){const y=O.getObjectByProperty("object_id",R);y&&L([y])}else M(),L([]);else u||(M(),L([]));return}u||i.forEach(y=>{y.escalatorMeshes=[]});const{routePaths:D,fromFloor:T}=m(r,z,R,O,i,x.escalator_nodes,c,b);L(D),T!==void 0&&d(T)},[z,R,O,Z,i,h,c,b,x.escalator_nodes,u,t.ROLE,r,K,m,M,d]);const o1=x.meshParams[p];C.useEffect(()=>{var s1;if(t.ROLE==="PORTAL_RESPONSIVE")return;if(!(Z instanceof Q.PerspectiveCamera)){console.error("Camera is not a PerspectiveCamera");return}if(!(o1!=null&&o1.length)){console.warn("objects not loaded yet");return}let D=(s1=i[p])==null?void 0:s1.routeMeshes;if(!V&&!u)return;let T=[];if(j[p]&&(D!=null&&D.length))T=[...D];else if(V&&(t.ROLE==="PORTAL"||l1)){const _1=R&&o1.find(b1=>b1.mesh.object_id===R);_1&&(T=[_1.mesh])}T.length||(T=o1.map(_1=>_1.mesh));const y=l8(T,Z.fov,Z.aspect,t.ROLE==="PORTAL"||t.ROLE==="WP_SITE"?"2D":b),r1=Math.min(X?t.CAMERA.maxDistance:J.max,Math.max(X?t.CAMERA.minDistance:J.min,y.position.distanceTo(y.target)));y.position.sub(y.target).setLength(r1).add(y.target),E.current={...y,fromPosition:k.current.object.position.clone(),fromTarget:k.current.target.clone(),animationStartTime:performance.now(),duration:t.CAMERA.animSpeed}},[j,o1,p,b,Z,R,t.ROLE,t.CAMERA.maxDistance,t.CAMERA.minDistance,t.CAMERA.animSpeed,i,V,u,l1,X,J.max,J.min]),C.useEffect(()=>{if(A!=null&&A.direction&&k.current){if(!(Z instanceof Q.PerspectiveCamera)){console.error("Camera is not a PerspectiveCamera");return}if(!o1.length){console.warn("objects not loaded yet");return}let D;if(j[p]){D=[j[p]];const r1=R&&o1.find(s1=>s1.mesh.object_id===R);r1&&D.push(r1.mesh)}else D=o1.map(r1=>r1.mesh);const T={position:k.current.object.position.clone(),target:k.current.target.clone()};let y=parseInt(T.position.distanceTo(T.target));A.direction==="in"?y-=t.ZOOM_STEP:y+=t.ZOOM_STEP,y=Math.min(J.max,Math.max(J.min,y)),T.position.sub(T.target).setLength(y).add(T.target),E.current={...T,fromPosition:k.current.object.position.clone(),fromTarget:k.current.target.clone(),animationStartTime:performance.now(),duration:t.CAMERA.animSpeed}}},[A]);const $=()=>J.initialDistance,U=C.useCallback(D=>{if(N){const T=new Q.Vector3;T.copy(D.target.object.position),T.sub(k.current.target),N(T.length()),q(T.length()),B&&B({camera:k.current.object.position.clone(),controls:k.current.target.clone()})}},[N,B,q]);y4.useFrame(()=>{var D,T;if((D=E.current)!=null&&D.duration&&((T=E.current)==null?void 0:T.duration)>0){v||(I(!0),E.current.duration=0);const y=E.current,r1=(performance.now()-y.animationStartTime)/1e3,s1=Math.min(1,r1/(y==null?void 0:y.duration));k.current.object.position.lerpVectors(y.fromPosition,y.position,s1),k.current.target.lerpVectors(y==null?void 0:y.fromTarget,y.target,s1),k.current.object.updateProjectionMatrix(),s1>=1&&(E.current=null)}});const P=C.useCallback(D=>{if(D>0){const T=a.retailers.find(y=>y.id===D);if(T){const y=a.map_objs.filter(r1=>r1.retailer_id===T.id);for(let r1=0;r1<y.length;r1++)if(o.includes(y[r1].map_obj_name)){const s1=O.getObjectByProperty("object_id",y[r1].map_obj_name);s1&&n1(s1,y[r1].map_obj_name,!0);break}}}},[n1,a,O]);return C.useImperativeHandle(l,()=>({resetCamera:G,createRouteToStore:P,getInitialDistance:$})),w.jsxs("group",{rotation:[Math.PI/2,0,0],ref:q1,children:[w.jsx(S4.MapControls,{makeDefault:!0,onChange:U,ref:k,maxPolarAngle:Math.PI/2,minDistance:X?f4.CAMERA.minDistance:J.min,maxDistance:X?f4.CAMERA.maxDistance:J.max,enableZoom:t.ROLE==="PORTAL"||t.ROLE==="DISPLAY_APP"||t.ROLE==="WP_SITE"&&["mobile","tablet"].includes(Y),enableRotate:t.ROLE!=="WP_SITE"&&t.ROLE!=="PORTAL_RESPONSIVE"&&t.ROLE!=="DISPLAY_APP",dampingFactor:.3}),i&&i.map((D,T)=>w.jsx(W0,{visible:p===T,floorIndex:T,currentFloorIndex:p,currKioskObj:e.currKioskObj,activeObjectId:e.activeObjectId,hoverObjectId:e.hoverObjectId,meshFloors:x,routeTube:t.ROLE!=="PORTAL"?j&&j[T]:void 0,onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerMove:e.onPointerMove,onClick:e.onClick,handleChangeFloor:d},`Map-${T}`))]})}),Z0="_threejsMapWrapper_6jbfd_1",Y0="_threejsMap_6jbfd_1",J0="_map_controls_6jbfd_18",U0="_amenities_6jbfd_112",$0="_amenity_6jbfd_123",Q0="_content_6jbfd_155",K0="_icon_6jbfd_163",el="_name_6jbfd_176",m4={threejsMapWrapper:Z0,threejsMap:Y0,map_controls:J0,amenities:U0,amenity:$0,content:Q0,icon:K0,name:el},ll=e=>{const{selectedFloorIndex:l,handleFloorChange:t,amenitiesList:o,zoomIn:n,zoomOut:r,reset:a,handleAmenityClick:c,onExtractedAmenities:q}=e,{mapConfig:i,mapApiResponse:s,floorsData:m,allMapObjects:v}=$1(),I=p=>{p.preventDefault(),a instanceof Function&&(i.ROLE==="PORTAL_RESPONSIVE"||i.ROLE==="PORTAL"?a(!0):a())},x=C.useMemo(()=>s!=null&&s.map_objs?s==null?void 0:s.map_objs.filter(p=>p.layer_type==="amenity"&&v.includes(p.map_obj_name)).map(p=>p.value):[],[s,v]);return C.useEffect(()=>{q&&q(x)},[q,x]),w.jsx("div",{className:m4.threejsMapWrapper,children:w.jsxs("div",{className:m4.threejsMap,children:[m.length>0&&w.jsx("div",{className:`map_controls ${m4.map_controls}`,children:w.jsxs("div",{className:"map_controls_wrapper",children:[w.jsx("div",{className:"floors btn_group",children:m.length>1&&m.map((p,f)=>w.jsx("div",{className:`floor control_btn ${f===l?"active":""}`,onClick:()=>{t(f)},children:p.name},f))}),w.jsxs("div",{className:"reset-zoom",children:[w.jsx("div",{onClick:I,className:"reset_btn control_btn",children:"RESET"}),w.jsxs("div",{className:"zoom_btns",children:[w.jsx("div",{onClick:r,className:"zoom-out control_btn",children:"–"}),w.jsx("div",{onClick:n,className:"zoom-in control_btn",children:"+"})]})]})]})}),w.jsx("div",{className:"loading_map",children:"Map loading, please wait..."}),!["PORTAL","DISPLAY_APP"].includes(i.ROLE)&&w.jsx("div",{className:`amenities ${m4.amenities}`,style:{display:"block"},children:o.map((p,f)=>x.includes(p.type)?w.jsx("div",{className:`amenity ${m4.amenity}`,onClick:()=>c(p.type),children:w.jsxs("div",{className:`content ${m4.content}`,children:[w.jsx("div",{className:`icon ${m4.icon}`,dangerouslySetInnerHTML:{__html:e9(p.type)}}),w.jsx("div",{className:`name ${m4.name}`,children:p.name})]})},`amenity-${p.name}-${f}`):null)})]})})},tl="_mapBoxSidebar_kftp4_1",nl="_active_kftp4_6",ol="_sidebarWrapper_kftp4_10",rl="_sidebarBox_kftp4_15",al="_mapBox_kftp4_1",ql="_storeNamePlaceholder_kftp4_29",il="_stats_kftp4_41",x4={mapBoxSidebar:tl,active:nl,sidebarWrapper:ol,sidebarBox:rl,mapBox:al,storeNamePlaceholder:ql,stats:il};function o6(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var w9={exports:{}};/*!
|
|
72
72
|
Copyright (c) 2018 Jed Watson.
|
|
73
73
|
Licensed under the MIT License (MIT), see
|
|
74
74
|
http://jedwatson.github.io/classnames
|