@eyeon/threejs-map 1.1.7 → 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.umd.js
CHANGED
|
@@ -69,7 +69,7 @@ is considered to be not a multigraph by default (each edge is unique).`),e.multi
|
|
|
69
69
|
</svg>`,WheelChair:`<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 432 492.2">
|
|
70
70
|
<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" />
|
|
71
71
|
<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"/>
|
|
72
|
-
</svg>`},_2=[{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}],E8={"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},b2=()=>{const{mapConfig:e,allMapObjects:l,allIndexedMapObjects:t,allIndexedRetailers:o,floorsData:n}=Y1(),r=C.useCallback(q=>q!=null&&E8[q]!==void 0?E8[q]:0,[]),a=C.useCallback((q,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"||q==="base"||q==null)&&q!=="boundary"&&(I.depthWrite=!1,I.depthTest=!1),q==="overlay"&&(I.color=e.OVERLAY_COLOR,I.opacity=e.OVERLAY_OPACITY),q&&["store","big-store","kiosk"].includes(q)&&e.ROLE!=="PORTAL"&&t[s]&&t[s].transparent&&(I.opacity=0);var x=new Q.MeshLambertMaterial(I);return q&&["store","big-store","kiosk","amenity"].includes(q)&&(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((q,s,m,v,I)=>{const x="MaterialAndGeometry";let h=I.toShapes(!0),f;e.STYLE==="2D"?f=["building-base"]:f=["store","big-store","base","building-base"];let g=["wall","outer-wall","boundary"];var z;if(q&&f.includes(q))z=new Q.ExtrudeGeometry(h,{depth:-m,bevelEnabled:!1});else if(q&&g.includes(q)){let _=[];I.subPaths.forEach(u=>{u.curves.forEach(d=>{if(d.type==="LineCurve"){let S=0;q==="boundary"&&(S=1);let E=n0(d,v,S),F=new Q.ExtrudeGeometry(E,{depth:-m,bevelEnabled:!1});_.push(F)}else console.warn(x+'"%s" found in walls. Check layer "%s"',d.type,s)})}),_.length===1?z=_[0]:_.length>1?z=o0(_):console.warn(x+'Unneccessary wall exists "%s"',s)}else{z=new Q.ShapeGeometry(h);try{z.attributes.position.count===0&&console.warn(x+'Unneccessary map shape "%s"',s,I.userData.node)}catch(_){console.error(_.message)}}return z},[e.STYLE]),i=C.useCallback((q,s,m,v,I,x,h,f,g,z)=>{var E,F;const _=a(q,s,m,v),u=c(q,s,h,f,z),d=new Q.Mesh(u,_);d.object_id=s,d.mesh_type=q,d.floor_index=g,d.visible=I,d.position.z=x;let S="";if(["retail_logo","retail_name","retail_text","custom_text","amenity"].includes((E=t[s])==null?void 0:E.layer_type)){if(t[s].layer_type&&["retail_name","retail_logo"].includes(t[s].layer_type)&&t[s].retailer_id&&o[((F=t[s])==null?void 0:F.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=_2.find(D=>D.type===S);B&&(S=B.name)}}return d.userData.storeName=S,e.STYLE==="2D"&&(d.renderOrder=r(q),s&&s.includes("underlay")&&(d.renderOrder=r("underlay"))),n[g].objsGroup.add(d),q==="escalator"&&(n[g].escalatorsNodes[s]=null,n[g].escalatorsObjs.push(d),d.escalator_id=g+"-"+s),q&&["store","big-store","kiosk","amenity"].includes(q)&&(d.route_node_id=null,t[s]&&t[s].layer_type,l.push(s),(e.ROLE!=="PORTAL"&&q==="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[g].interactiveObjs.push(d)),{mesh:d,geometry:u,material:_,object_id:s,mesh_type:q,floor_index:g,visible:I,renderOrder:d.renderOrder}},[t,o,l,n,c,a,r,e.ROLE,e.STYLE]);return{getRenderOrder:r,getMaterial:a,getGeometry:c,getMaterialAndGeometry:i}},g3="ROUTE: ",r0=1e4,S8=()=>{const{floorsData:e,allNodesFloor:l,ngraphPath:t,pathFinderGraph:o,allIndexedMapObjects:n}=Y1(),{getRenderOrder:r}=b2(),a=C.useCallback((g,z,_)=>{if(!_.data)return!1;let u=_.data.weight;const d=l[g.id],S=l[z.id];return d!==S?u+r0+Math.abs(d-S):u},[l]),c=C.useCallback(g=>{var z;for(let _=0;_<g.length;_++){const u=g[_];u.route_active=!1,u.route_tube!=null&&(u.route_tube.geometry.dispose(),u.route_tube.material.dispose(),(z=u.objsGroup)==null||z.remove(u.route_tube)),u.route_tube=void 0,u.route_texture=null,u.escalatorMeshes=[]}},[]),i=C.useCallback((g,z,_)=>{let u=_.find(g,z);return u.length===0?!1:u},[]),q=C.useCallback((g,z,_)=>{let d=document.createElement("canvas").getContext("2d");if(d){d.canvas.width=g,d.canvas.height=80,d.fillStyle="#4ea5ff",d.fillRect(0,0,g,80);let S=.1*g;const E=60,F=120;S<E&&(S=E),S>F&&(S=F);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 D=new Q.CanvasTexture(d.canvas);return D.offset.x=1,D.colorSpace="srgb",_[z].route_texture=D,D}else return},[]),s=C.useCallback((g,z,_,u="2D")=>{var D;let d=0,S=new Q.CurvePath;for(let l1=1;l1<g.length;l1++){let W=new Q.Vector3(g[l1-1].data.x,g[l1-1].data.y,0),n1=new Q.Vector3(g[l1].data.x,g[l1].data.y,0);S.add(new Q.LineCurve3(W,n1)),d+=W.distanceTo(n1)}var E=new Q.TubeGeometry(S,400,6,8);E=new Q.BufferGeometry().copy(E);var F=new Q.MeshBasicMaterial({map:q(d,z,_),transparent:!0,side:Q.DoubleSide,depthTest:!1,depthWrite:!1});let B=new Q.Mesh(E,F);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"),_[z].route_tube=B,(D=_[z].objsGroup)==null||D.add(B),B},[r,q]),m=C.useCallback((g,z,_,u,d,S,E,F,B=null)=>{var L,R,H,w,A,b;const D=[];c(S);let l1=_.getObjectByProperty("object_id",g),W=_.getObjectByProperty("object_id",z),n1=l1.route_node_id,K=W.route_node_id;if(n1||console.error(g3+'Route Anchor point missing for "%s"',g),K||console.error(g3+'Route Anchor point missing for "%s"',z),!n1||!K)return D;const e1=l1.floor_index,Y=W.floor_index,J=t.nba(E,{distance:a,oriented:!0,blocked(p,O,X){return X.data.blocked},debug:!0}),k=i(n1,K,J),q1=[];if(!k)return[];k.reverse();const V=[];for(let p=0;p<k.length;p++){const O=k[p];V[u[O.id]]?V[u[O.id]].push(O):V[u[O.id]]=[O],d.includes(O.id)&&d.includes(k[p-1].id)&&d.includes(k[p+1].id),q1.push(O)}for(let p=0;p<q1.length;p++){const O=q1[p];if(u[q1[0].id]!==u[q1[q1.length-1].id]&&d.includes(O.id)){const X=Object.keys(S[u[O.id]].escalatorsNodes).find(N=>{var o1,$;return(($=(o1=S[u[O.id]])==null?void 0:o1.escalatorsNodes)==null?void 0:$[N])===O.id}),G=_.getObjectByProperty("escalator_id",u[O.id]+"-"+X);let t1=null;if(u[O.id]!==u[q1[p+1].id]&&d.includes(q1[p+1].id)&&(t1={index:u[q1[p+1].id],direction:"To"}),u[O.id]!==u[q1[p-1].id]&&d.includes(q1[p-1].id)&&(t1={index:u[q1[p-1].id],direction:"From"}),t1&&G){G.goToFloor=t1;const N=G.clone();N.goToFloor=t1,N.object_id=X,(R=(L=S[u[O.id]])==null?void 0:L.escalatorMeshes)==null||R.push(N)}}}for(let p=0;p<V.length;p++){const O=V[p];if(O&&O.length>1){const X=s(O,p,S,F);D[p]=X,S[p].route_active=!0,S[p].routeMeshes=[X],p===e1&&((w=(H=S[p])==null?void 0:H.routeMeshes)==null||w.push(l1)),p===Y&&((b=(A=S[p])==null?void 0:A.routeMeshes)==null||b.push(W))}}return D},[s,i,t,c,a]),v=C.useCallback((g,z,_,u,d,S,E,F)=>{if(z===_)return{routePaths:[],fromFloor:void 0};const B=m(z,_,u,g,S,d,E,F);B.length||console.warn(g3+'No route found in between "%s" and "%s"',z,_);let D=u.getObjectByProperty("object_id",z);return{routePaths:B,fromFloor:D.floor_index}},[m]),I=C.useCallback((g,z,_,u)=>{let d=0,S=_.find(z,g);if(S.length===0)return!1;for(let E=1;E<S.length;E++){let F=u.getLink(S[E-1].id,S[E].id);d+=(F==null?void 0:F.data.weight)||0}return d},[]),x=C.useCallback(()=>{if(e.length>1){const g=[],z=[];for(let _=0;_<e.length;_++)z[_]=[],e[_].escalatorsNodes&&(g[_]=Object.fromEntries(Object.entries(e[_].escalatorsNodes).map(([u,d])=>{const S=u.split("-"),E=S.slice(0,2).join("-"),F=S.includes("end"),B=S.includes("start"),D=S.includes("up"),l1=S.includes("down"),W=D?"up":l1?"down":"both";return z[_].push(E),[E,{node:d,escalatorId:E,isExitOnly:F,isEntranceOnly:B,upOnly:D,downOnly:l1,direction:W,floorsTo:[]}]})));for(let _=0;_<e.length;_++)for(let u=0;u<z[_].length;u++){const d=z[_][u],S=g[_][d];for(let E=_+1;E<e.length;E++)for(let F=0;F<z[E].length;F++){const B=z[E][F];d===B&&S.floorsTo.push(E)}}for(let _=0;_<e.length-1;_++){const u=g[_];for(const d in u){const S=u[d],E=S.node;S.floorsTo.forEach(F=>{const D=g[F][d].node;D&&(S.isExitOnly?(o.addLink(E,D,{blocked:!0}),o.addLink(D,E,{weight:1})):S.isEntranceOnly?(o.addLink(D,E,{blocked:!0}),o.addLink(E,D,{weight:1})):(o.addLink(E,D,{weight:1}),o.addLink(D,E,{weight:1})))})}}}},[e,o]),h=C.useCallback((g,z,_,u,d)=>{let S=_.getObjectByProperty("object_id",g),E=S?S.route_node_id:"";var F=null,B=9999;const D=[];for(let l1 in n){const W=n[l1];W.layer_type==="amenity"&&W.obj_type==="special"&&W.value===z&&D.push(l1)}return D.forEach(l1=>{let W=_.getObjectByProperty("object_id",l1);const n1=t.aStar(o,{distance:a,debug:!0});if(W&&E){var K=W.route_node_id;try{var e1=I(E||"",K||"",n1,o);e1&&e1<B&&(B=e1,F=l1)}catch(Y){console.warn(`Amenity Path: ${Y.message}`)}}!E&&W&&(F=K)}),v(l,g,F??"",_,e,u,o,d)},[n,l,v,e,I,t,o,a]),f=C.useCallback((g,z,_)=>{const u=new Map,d=e[g];return d&&d.route_points&&d.route_points.forEach(S=>{let E=new Q.Vector3(S.node.x,S.node.y,-10),F=new Q.Vector3(0,0,1);_.set(E,F);var B=_.intersectObjects(e[g].interactiveObjs);B.length&&(B[0].object.route_node_id=S.name,u.set(B[0].object.object_id,S.name));var D=_.intersectObjects(e[g].escalatorsObjs);if(D.length){let W=D[0].object.object_id;const n1=e[g].escalatorsNodes;n1&&(n1[W]=S.name,l[S.name]=g,z.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:i,get_nodes_distance:I,get_route_texture:q,linkFloorEscalators:x,make_amenity_route:h,assign_route_nodes_to_stores:f}};function a0(e){return"node-"+e}function z8(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=a0(o))}return[r,n]}const i0=()=>{const{mapConfig:e,floorsData:l,allNodesFloor:t,pathFinderGraph:o}=Y1();return{getMeshParams:C.useCallback((r,a,c,i)=>{var d;const q="MeshParams";let s=null;var m=r.color.clone(),v=0,I=0,x=!0,h=!0,f=!1,g=e.WALL_THICKNESS,z=!0,_=(d=r.userData)==null?void 0:d.node.id;return _!==void 0?_.startsWith("boundary")?(s="boundary",m=e.BOUNDARY_COLOR,g=e.BOUNDARY_THICKNESS,e.STYLE==="3D"&&(v=9)):_.startsWith("wall")?(s="wall",m=e.WALL_COLOR,e.STYLE==="3D"&&(v=8.5)):_.startsWith("outer-wall")?(s="outer-wall",m=e.WALL_COLOR,e.STYLE==="3D"&&(h=!1)):_.startsWith("base")?(s="base",m=e.BASE_COLOR):_.startsWith("store")?(s="store",m=e.STORE_DEFAULT_COLOR,e.STYLE==="3D"&&(v=e.STORE_HEIGHT),_.startsWith("store-underlay")&&(z=!1)):_.startsWith("route-path")?(s="route-path",h=!1,r.subPaths.forEach(S=>{S.curves.length===0&&console.warn(q+'Route-path standalone anchor point exists, layer_name: "%s"',_),S.curves.forEach(E=>{var K,e1;const F=E.v1,B=E.v2,[D,l1]=z8(F,c,l,i);l1||((K=l[c].route_points)==null||K.push({name:D,node:new Q.Vector3(F.x,F.y,1)}),t[D]=c);const[W,n1]=z8(B,c,l,i);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(D,{...F}),o.addNode(W,{...B}),o.addLink(D,W,{weight:F.distanceTo(B)}),o.addLink(W,D,{weight:F.distanceTo(B)})})})):_.startsWith("escalator-")?(s="escalator",x=!1,f=!0):_.startsWith("kiosk-")?(s="kiosk",f=!0):_.startsWith("amenity-")?(s="amenity",f=!0,I=1):_.startsWith("overlay")?s="overlay":_.startsWith("special-shape")?s="special-shape":v=1:console.warn(q+"Layer name is undefined, path",r),{mesh_type:s,layer_color:m,extrude:v,z_index:I,mesh_visible:x,mesh_draw:h,mesh_transparent:f,line_thickness:g,interactiveMesh:z,path:r,layer_name:_}},[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 q0=0;const s0=e=>{const{mapConfig:l,pathFinderGraph:t}=Y1(),{getMaterialAndGeometry:o}=b2(),{getMeshParams:n}=i0(),{assign_route_nodes_to_stores:r,linkFloorEscalators:a}=S8(),[c,i,q]=C.useMemo(()=>{const s=new Set,m=[],v=[];e.forEach((I,x)=>{var h,f;if(I&&I.paths&&I.paths.length){const g=[];for(let d=0;d<I.paths.length;d++)g.push((f=(h=I.paths[d])==null?void 0:h.userData)==null?void 0:f.node.id);const z=I.paths;for(let d=0;d<z.length;d++){const{mesh_type:S,layer_color:E,extrude:F,z_index:B,mesh_visible:D,mesh_draw:l1,mesh_transparent:W,line_thickness:n1,path:K,layer_name:e1}=n(z[d],z,x,++q0);if(l1){const Y=o(S,e1,E,W,D,B,F,n1,x,K);e1.startsWith("kiosk-")&&l.ROLE,m[x]||(m[x]=[]),m[x].push(Y)}}const _=new Q.Raycaster,u=r(x,v,_);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 h=0;h<x.length;h++)s.add(x[h].object_id)}return[m,v,s]},[r,o,n,a,l.ROLE,e]);return{GeometriesAndMaterials:c,graph:t,escalator_nodes:i,allSvgObjectIds:q}},O8=()=>{const{allIndexedRetailers:e,allIndexedMapObjects:l,floorsData:t,mapConfig:o}=Y1(),{getRenderOrder:n}=b2(),r=(x,h,f,g,z,_,u,d)=>{for(let S=0;S<x.length;S++)a(x[S],h,f,g,z,_,u,d)},a=(x,h,f,g,z,_,u,d)=>{let S=h.getObjectByProperty("object_id",x.map_obj_name);S&&add_store_name_logo(S,f,g,z,_,u,d,h)},c=x=>(Array.isArray(x)||(x=[x]),x.reduce((f,g)=>(g.geometry.boundingBox||g.geometry.computeBoundingBox(),f.union(g.geometry.boundingBox),f),new Q.Box3)),i=(x,h,f,g,z)=>{let _=z[x];h.z=-f.z,g.rotateZ(((_==null?void 0:_.rotate)||0)*Math.PI/180),g.scale.y*=-1,h.x+=(_==null?void 0:_.offset_x)||0,h.y+=(_==null?void 0:_.offset_y)||0,g.position.set(h.x,h.y,h.z+1)},q=async x=>{try{const h=T6(x,o),f=await fetch(h);if(!f.ok)throw new Error(`Failed to fetch image: ${f.statusText}`);const g=await f.blob();return URL.createObjectURL(g)}catch(h){return console.error("Error fetching or converting the image:",h),""}},s=(x,h)=>new Promise((f,g)=>{var z;if(x.obj_type==="retailer")h?q(h.logo).then(_=>{f(_)}):(console.error("retailer not found"),f(""));else if(x.obj_type==="special"){let _=x.value;if(x.layer_type==="kiosk"&&(_="kiosk"),x.layer_type==="escalator"&&(_="escalator"),_){let u="222222";x.text_color!=null&&(u=x.text_color.replace("#",""));const d=document.getElementById("map-special-svg-"+_);if(d){const S=d.querySelector("svg");if(S){const E=S.cloneNode(!0);E.querySelectorAll("[fill]").forEach(W=>{W.setAttribute("fill","#"+u)});const B=new XMLSerializer().serializeToString(E),D=new Blob([B],{type:"image/svg+xml"}),l1=URL.createObjectURL(D);f(l1)}else console.error("svg_element not found",_),f("")}else console.error("svg_block not found",_),f("")}}else x.custom_image!==""&&((z=x==null?void 0:x.custom_image)!=null&&z.startsWith("http"))?f(x.custom_image):(console.error("custom_image URL not found"),f(""))}),m=(x,h,f)=>{const g=document.createElement("img");g.crossOrigin="anonymous",g.src=x,g.onload=function(){const z=document.getElementById("temp-image-rendering");z&&(g.style.height="100px",z.appendChild(g),setTimeout(()=>{const _=document.createElement("canvas"),u=_.getContext("2d");if(u){_.width=g.width*N6,_.height=g.height*N6,u==null||u.drawImage(g,0,0,_.width,_.height);let d=new Q.CanvasTexture(_);d.colorSpace="srgb";const S=new Q.PlaneGeometry(h.size,h.size*g.height/g.width),E=new Q.MeshBasicMaterial({map:d,transparent:!0,side:Q.DoubleSide,depthTest:!1,depthWrite:!1});h.layer_type==="kiosk"&&(E.visible=!1),f(S,E)}},100))},g.onerror=function(){console.error("processImage():: Error loading image:",x)}},v=C.useCallback((x,h,f,g,z,_,u,d,S,E)=>{s(f,h[f.retailer_id]).then(F=>{F&&m(F,f,(B,D)=>{var n1;const l1=new Q.Mesh(B,D),W=g.floor_index;i(z,u,d,l1,x),l1.object_id=_,l1.floor_index=W,l1.renderOrder=n("layer-image"),(n1=S[W])==null||n1.objsGroup.add(l1),E({storeLogo:l1})})})},[n]),I=C.useCallback((x,h,f,g,z,_)=>{const u=g+h;let d=null;if(x.boundingBox||x.computeBoundingBox(),!x.boundingBox)return null;const S=x.boundingBox,E=new Q.Vector3;S.getCenter(E);const F=new Q.Vector3;S.getSize(F);let B=l[h]?l[h]:{layer_type:h.startsWith("escalator")?"escalator":"custom_text",custom_text:"",size:8};if(["retail_name","retail_text","custom_text"].includes(B.layer_type)){let D="";B.layer_type==="retail_name"&&B.retailer_id&&e[B.retailer_id]?D=e[B.retailer_id].retail_name:["retail_text","custom_text"].includes(B.layer_type)?D=B.custom_text:D="";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 A8(D,{font:z,size:parseInt(B.size),height:.01,curveSegments:4});K.center();const e1=new Q.Mesh(K,n1);e1.userData.debug_name=D,e1.userData.font=z,i(h,E,F,e1,l),e1.object_id=u,e1.floor_index=f,e1.renderOrder=n("layer-text"),B.layer_type==="retail_name"&&(e1.userData.retail_name=D),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,h,u,E,F,t,_);return d},[l,e,t,v,n,o.STORE_TEXT_COLOR]);return{drawTextLogoStoreOnMap:r,addTextOrLogoOnStore:a,getMeshGroupBoundingBox:c,layer_text_logo_position_by_id:i,getImage:s,processImage:m,getImageLogo:v,get_store_name_logo_geometry:I}};let v3=[];const c0=()=>{const{mapConfig:e,initialFloorsDataIsLoaded:l,allIndexedMapObjects:t,allIndexedRetailers:o,allMapObjects:n,allNodesFloor:r,pathFinderGraph:a,setPathFinderGraph:c,mapApiResponse:i}=Y1(),[q,s]=C.useState([]),[m,v]=C.useState([]),[I,x]=C.useState([]),[h,f]=C.useState([]);let g=p4.useLoader(t3,i.floors.map(D=>T6(D.svgUrl,e)));const{GeometriesAndMaterials:z,graph:_,escalator_nodes:u,allSvgObjectIds:d}=s0(g),{get_store_name_logo_geometry:S}=O8(),E=h4.useFont(O6),F=C.useCallback(D=>l1=>{x(W=>(W[D]?W[D].push({...l1}):W[D]=[{...l1}],[...W]))},[]),B=C.useCallback(()=>{s(D=>(D&&D.forEach(l1=>{l1&&l1.forEach(W=>{W.mesh.removeFromParent()})}),[])),v(D=>(D&&D.forEach(l1=>{l1&&l1.forEach(W=>{W.textMesh.removeFromParent()})}),[])),x(D=>(D&&D.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(!E||!g)return;x([]);const D=[];if(v3.forEach(n1=>{let K;for(let Y=0;Y<z.length&&(K=z[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,E,F(K.floor_index));e1&&(D[K.floor_index]||(D[K.floor_index]=[]),D[K.floor_index].push(e1))}),z.reduce((n1,K)=>n1+K.length,0)-v3.length!==0){const n1=new Set;v3.forEach(K=>{n1.add(K.map_obj_name)}),z.forEach(K=>{K.forEach(e1=>{if(!n1.has(e1.object_id)){const Y=S(e1.geometry,e1.object_id,e1.floor_index,a2,E,F(e1.floor_index));Y&&(D[e1.floor_index]||(D[e1.floor_index]=[]),D[e1.floor_index].push(Y))}})})}s([...z]),v(D),c(_),f([...u])},[g,E,t,o,n,r,a,e,c,F,z,S,_,u]),C.useMemo(()=>({meshParams:q,textParams:m,storeLogos:I,pathFinderGraph:a,escalator_nodes:h,allSvgObjectIds:d}),[q,m,I,a,h,d])},u0=e=>{const{scene:l}=p4.useThree();return e.background&&(l.background=new Q.Color(e.background)),null},m0=e=>{const{camera:l}=p4.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 w8(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function d0({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 i=(performance.now()-c)/1e3,q=Math.floor(w8(i)*t);i>=1&&(l.current=n),e.geometry.setDrawRange(0,q)}})(),n=(()=>{if(!(e.material instanceof Q.MeshBasicMaterial)||!e.material.map)return null;const a=e.material.map.offset,c=2e3,i=.1,q=1+i,s=performance.now();return()=>{const m=(performance.now()-s)/c%1;a.x=i-q*w8(m)}})();return l.current=o,()=>{l.current=null,e.removeFromParent(),e.material instanceof Q.MeshBasicMaterial&&e.material.dispose(),e.geometry&&e.geometry.dispose()}},[e]),p4.useFrame(()=>{if(l.current)try{l.current()}catch(t){console.error(`ERROR ANIMATE ROUTE: ${t.message}`),l.current=null}}),e?M.jsx("primitive",{object:e}):null}const g2={escalator_elems:"_escalator_elems_1kqb9_1",element:"_element_1kqb9_4",svgIcon:"_svgIcon_1kqb9_21",label:"_label_1kqb9_34"},f0={mapCenterMarker:"_mapCenterMarker_1eu0j_18"},T8=({size:e,lockSize:l,blink:t,cameraLength:o,text_color:n="black"})=>{const{mapConfig:r}=Y1(),[,a]=C.useState(1),[c,i]=C.useState(null),q=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),h=new Blob([x],{type:"image/svg+xml"}),f=URL.createObjectURL(h),g=document.createElement("canvas");g.width=256,g.height=256;const z=g.getContext("2d"),_=document.createElement("img");_.src=f,_.onload=()=>{z==null||z.drawImage(_,96,0,64,128);const u=new Q.Texture(g);u.needsUpdate=!0,i(u)}}},[]),s?M.jsxs("group",{children:[M.jsx("sprite",{scale:q,material:s}),t&&M.jsx(h4.Html,{children:M.jsx("div",{className:`mapCenterMarker ${f0.mapCenterMarker}`})})]}):null},x0=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},M8=e=>{const{type:l,mesh:t,currentFloorIndex:o}=e;C.useEffect(()=>(t.userData.triggerUpdate=()=>{},()=>t.userData.triggerUpdate=void 0),[t.userData]);const{cameraLength:n}=Y1();switch(l){case"storeLogo":return t.userData.kioskConfig&&t.userData.kioskConfig.floorIndex===o?M.jsx("primitive",{object:t,children:M.jsx(T8,{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):M.jsx("primitive",{object:t,children:t.userData.htmlContent?M.jsx(h4.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?M.jsx(T8,{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}},p0=e=>{const{meshFloors:l,routeTube:t,floorIndex:o,currentFloorIndex:n,activeObjectId:r,hoverObjectId:a,visible:c,handleChangeFloor:i}=e,{mapConfig:q,floorsData:s}=Y1(),{meshParams:m,textParams:v,storeLogos:I}=l,x=s[o],h=e.onPointerMove,f=e.onPointerEnter,g=e.onPointerLeave,z=e.onClick,_=m[o],u=v[o],d=I[o],S=s[o].escalatorMeshes;return M.jsxs("group",{visible:c,children:[_==null?void 0:_.map(E=>{if(!E.mesh)return null;const F=c&&E.mesh.visible&&x.interactiveObjs&&x.interactiveObjs.includes(E.mesh),B=a&&E.mesh.object_id===a,D=r&&E.mesh.object_id===r;if(F)if((D||B)&&(E.mesh.material instanceof Q.MeshLambertMaterial||E.mesh.material instanceof Q.MeshStandardMaterial)){const l1=D?q.ACCENT_COLOR:E.mesh.material.colorDefault;E.mesh.material.color=B?x0(l1):l1}else E.mesh.material.color=E.mesh.material.colorDefault;return M.jsx("group",{...F?{onPointerOver:f,onPointerMove:h,onPointerOut:g,onClick:z}:{},children:M.jsx("primitive",{object:E.mesh})},E.mesh.uuid)}),u==null?void 0:u.map(E=>E.textMesh?M.jsx(C.Fragment,{children:M.jsx("primitive",{object:E.textMesh,children:E.textMesh.userData.kioskConfig?M.jsx(M8,{mesh:E.textMesh,currentFloorIndex:n,type:"kiosk",visible:c},void 0):null})},E.textMesh.uuid):null),d==null?void 0:d.map(E=>E.storeLogo?M.jsx(M8,{mesh:E.storeLogo,currentFloorIndex:n,type:"storeLogo",visible:c},E.storeLogo.uuid):null),S==null?void 0:S.map(E=>{var F,B;return M.jsx("primitive",{object:E,children:M.jsx(h4.Html,{visible:!0,position:(F=E.geometry.boundingSphere)==null?void 0:F.center,children:M.jsx("div",{className:`escalator_elems ${g2.escalator_elems}`,style:{display:c?"block":"none"},onClick:D=>{var l1;return D.stopPropagation(),i(((l1=E.goToFloor)==null?void 0:l1.index)||0),!1},onPointerMove:D=>D.stopPropagation(),children:M.jsxs("div",{className:`element ${g2.element}`,id:E.object_id,children:[M.jsx("div",{className:`svgIcon ${g2.svgIcon}`,dangerouslySetInnerHTML:{__html:w6("escalator")}}),M.jsxs("div",{className:`label ${g2.label}`,children:[(B=E.goToFloor)==null?void 0:B.direction,": ",E.goToFloor?s[E.goToFloor.index].name:""]})]})})})},`escalator-${E.object_id}`)}),M.jsx(d0,{mesh:t})]})};function N8(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((h,f)=>(f.geometry.boundingBox||f.geometry.computeBoundingBox(),f.geometry.boundingBox&&h.union(f.geometry.boundingBox),h),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),i=1.1,q=r.x*i/2/(c*t),s=r.y*i/2/c,m=Math.max(q,s),v=h0(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 h0(e,l){let t=60;return l==="2D"&&(t=89.9),e/Math.tan(t*Math.PI/180)}const _0=C.forwardRef((e,l)=>{const{mapConfig:t,allMapObjects:o,allIndexedMapObjects:n,allNodesFloor:r,mapApiResponse:a,pathFinderGraph:c,setCameraLength:i,floorsData:q}=Y1(),{make_amenity_route:s,create_route:m}=S8(),[v,I]=C.useState(!1),{meshFloors:x,currentFloorIndex:h,currKioskObj:f,currKioskFloorIndex:g,routeTargetId:z,routeTargetFromId:_,selectedAmenityType:u,handleChangeFloor:d,escalatorNodes:S,zoom:E,handleCameraLength:F,handleCameraAndControlsChange:B,activeObjectId:D,isSelectedRetailerSlug:l1,setIsCameraInit:W,handleObjectClick:n1,triggerClick:K,cameraControlsPosition:e1,deviceType:Y}=e,[J,k]=C.useState({min:t.CAMERA.minDistance,max:t.CAMERA.maxDistance,initialDistance:0,needsUpdate:!0}),q1=C.useRef(null),[V,L]=C.useState([]),R=C.useRef(null),{camera:H,scene:w}=p4.useThree(),A=C.useRef(null),b=t.STYLE,p=t.ACCENT_COLOR,O=f?f.object_id:_||void 0,X=t.ROLE==="PORTAL"&&z,G=C.useCallback((j=!1)=>{if(!(H instanceof Q.PerspectiveCamera)){console.error("Camera is not a PerspectiveCamera");return}const T=x.meshParams[g];if(!(T!=null&&T.length)){console.warn("objects not loaded yet");return}let y;y=T.map(b1=>b1.mesh);const r1=N8(y,H.fov,H.aspect,t.ROLE==="PORTAL"?"2D":b);let c1=!0;if(e1){let b1=e1.camera;b1 instanceof Q.Vector3||(b1=new Q.Vector3(b1.x,b1.y,b1.z)),c1=b1.length()===0}!j&&e1&&!c1&&!["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 g1=Math.min(J.max,Math.max(J.min,r1.position.distanceTo(r1.target)));r1.position.sub(r1.target).setLength(g1).add(r1.target),A.current={...r1,fromPosition:R.current.object.position.clone(),fromTarget:R.current.target.clone(),animationStartTime:performance.now(),duration:t.CAMERA.animSpeed},["DISPLAY_APP","WP_SITE"].includes(t.ROLE)&&J.needsUpdate===!1&&J.initialDistance>0&&k(b1=>({...b1,min:t.CAMERA.minDistance<.1?.1:t.CAMERA.minDistance,max:t.CAMERA.maxDistance}))},[H,J.needsUpdate,t.CAMERA.animSpeed,t.CAMERA.maxDistance,t.CAMERA.minDistance,e1,t.ROLE,g,x.meshParams,b]),t1=A.current?A.current.position.distanceTo(A.current.target):0;C.useEffect(()=>{e1&&G()},[e1,G]),C.useEffect(()=>{t1>0&&J.needsUpdate&&(k({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(()=>{k(j=>({...j,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:j,fromFloor:T}=s(O??"",u,w,S,b);L(j),T!==void 0&&d(T),f&&t.ROLE==="DISPLAY_APP"&&d(g)},[u,w,c,q,S,b,O,t.ROLE,r,n,s,f,d,g]);const N=C.useCallback(()=>{q.flat().forEach(j=>j.escalatorMeshes=[])},[q]);C.useEffect(()=>{if(!O||!z||t.ROLE==="PORTAL"){if(t.ROLE==="PORTAL")if(z){const y=w.getObjectByProperty("object_id",z);y&&L([y])}else N(),L([]);else u||(N(),L([]));return}u||q.forEach(y=>{y.escalatorMeshes=[]});const{routePaths:j,fromFloor:T}=m(r,O,z,w,q,x.escalator_nodes,c,b);L(j),T!==void 0&&d(T)},[O,z,w,H,q,p,c,b,x.escalator_nodes,u,t.ROLE,r,K,m,N,d]);const o1=x.meshParams[h];C.useEffect(()=>{var c1;if(t.ROLE==="PORTAL_RESPONSIVE")return;if(!(H instanceof Q.PerspectiveCamera)){console.error("Camera is not a PerspectiveCamera");return}if(!(o1!=null&&o1.length)){console.warn("objects not loaded yet");return}let j=(c1=q[h])==null?void 0:c1.routeMeshes;if(!D&&!u)return;let T=[];if(V[h]&&(j!=null&&j.length))T=[...j];else if(D&&(t.ROLE==="PORTAL"||l1)){const g1=z&&o1.find(b1=>b1.mesh.object_id===z);g1&&(T=[g1.mesh])}T.length||(T=o1.map(g1=>g1.mesh));const y=N8(T,H.fov,H.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),A.current={...y,fromPosition:R.current.object.position.clone(),fromTarget:R.current.target.clone(),animationStartTime:performance.now(),duration:t.CAMERA.animSpeed}},[V,o1,h,b,H,z,t.ROLE,t.CAMERA.maxDistance,t.CAMERA.minDistance,t.CAMERA.animSpeed,q,D,u,l1,X,J.max,J.min]),C.useEffect(()=>{if(E!=null&&E.direction&&R.current){if(!(H instanceof Q.PerspectiveCamera)){console.error("Camera is not a PerspectiveCamera");return}if(!o1.length){console.warn("objects not loaded yet");return}let j;if(V[h]){j=[V[h]];const r1=z&&o1.find(c1=>c1.mesh.object_id===z);r1&&j.push(r1.mesh)}else j=o1.map(r1=>r1.mesh);const T={position:R.current.object.position.clone(),target:R.current.target.clone()};let y=parseInt(T.position.distanceTo(T.target));E.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),A.current={...T,fromPosition:R.current.object.position.clone(),fromTarget:R.current.target.clone(),animationStartTime:performance.now(),duration:t.CAMERA.animSpeed}}},[E]);const $=()=>J.initialDistance,U=C.useCallback(j=>{if(F){const T=new Q.Vector3;T.copy(j.target.object.position),T.sub(R.current.target),F(T.length()),i(T.length()),B&&B({camera:R.current.object.position.clone(),controls:R.current.target.clone()})}},[F,B,i]);p4.useFrame(()=>{var j,T;if((j=A.current)!=null&&j.duration&&((T=A.current)==null?void 0:T.duration)>0){v||(I(!0),A.current.duration=0);const y=A.current,r1=(performance.now()-y.animationStartTime)/1e3,c1=Math.min(1,r1/(y==null?void 0:y.duration));R.current.object.position.lerpVectors(y.fromPosition,y.position,c1),R.current.target.lerpVectors(y==null?void 0:y.fromTarget,y.target,c1),R.current.object.updateProjectionMatrix(),c1>=1&&(A.current=null)}});const P=C.useCallback(j=>{if(j>0){const T=a.retailers.find(y=>y.id===j);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 c1=w.getObjectByProperty("object_id",y[r1].map_obj_name);c1&&n1(c1,y[r1].map_obj_name,!0);break}}}},[n1,a,w]);return C.useImperativeHandle(l,()=>({resetCamera:G,createRouteToStore:P,getInitialDistance:$})),M.jsxs("group",{rotation:[Math.PI/2,0,0],ref:q1,children:[M.jsx(h4.MapControls,{makeDefault:!0,onChange:U,ref:R,maxPolarAngle:Math.PI/2,minDistance:X?d4.CAMERA.minDistance:J.min,maxDistance:X?d4.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}),q&&q.map((j,T)=>M.jsx(p0,{visible:h===T,floorIndex:T,currentFloorIndex:h,currKioskObj:e.currKioskObj,activeObjectId:e.activeObjectId,hoverObjectId:e.hoverObjectId,meshFloors:x,routeTube:t.ROLE!=="PORTAL"?V&&V[T]:void 0,onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerMove:e.onPointerMove,onClick:e.onClick,handleChangeFloor:d},`Map-${T}`))]})}),f4={threejsMapWrapper:"_threejsMapWrapper_6jbfd_1",threejsMap:"_threejsMap_6jbfd_1",map_controls:"_map_controls_6jbfd_18",amenities:"_amenities_6jbfd_112",amenity:"_amenity_6jbfd_123",content:"_content_6jbfd_155",icon:"_icon_6jbfd_163",name:"_name_6jbfd_176"},b0=e=>{const{selectedFloorIndex:l,handleFloorChange:t,amenitiesList:o,zoomIn:n,zoomOut:r,reset:a,handleAmenityClick:c,onExtractedAmenities:i}=e,{mapConfig:q,mapApiResponse:s,floorsData:m,allMapObjects:v}=Y1(),I=h=>{h.preventDefault(),a instanceof Function&&(q.ROLE==="PORTAL_RESPONSIVE"||q.ROLE==="PORTAL"?a(!0):a())},x=C.useMemo(()=>s!=null&&s.map_objs?s==null?void 0:s.map_objs.filter(h=>h.layer_type==="amenity"&&v.includes(h.map_obj_name)).map(h=>h.value):[],[s,v]);return C.useEffect(()=>{i&&i(x)},[i,x]),M.jsx("div",{className:f4.threejsMapWrapper,children:M.jsxs("div",{className:f4.threejsMap,children:[m.length>0&&M.jsx("div",{className:`map_controls ${f4.map_controls}`,children:M.jsxs("div",{className:"map_controls_wrapper",children:[M.jsx("div",{className:"floors btn_group",children:m.length>1&&m.map((h,f)=>M.jsx("div",{className:`floor control_btn ${f===l?"active":""}`,onClick:()=>{t(f)},children:h.name},f))}),M.jsxs("div",{className:"reset-zoom",children:[M.jsx("div",{onClick:I,className:"reset_btn control_btn",children:"RESET"}),M.jsxs("div",{className:"zoom_btns",children:[M.jsx("div",{onClick:r,className:"zoom-out control_btn",children:"–"}),M.jsx("div",{onClick:n,className:"zoom-in control_btn",children:"+"})]})]})]})}),M.jsx("div",{className:"loading_map hide",children:"Loading map, please wait..."}),!["PORTAL","DISPLAY_APP"].includes(q.ROLE)&&M.jsx("div",{className:`amenities ${f4.amenities}`,style:{display:"block"},children:o.map((h,f)=>x.includes(h.type)?M.jsx("div",{className:`amenity ${f4.amenity}`,onClick:()=>c(h.type),children:M.jsxs("div",{className:`content ${f4.content}`,children:[M.jsx("div",{className:`icon ${f4.icon}`,dangerouslySetInnerHTML:{__html:w6(h.type)}}),M.jsx("div",{className:`name ${f4.name}`,children:h.name})]})},`amenity-${h.name}-${f}`):null)})]})})},y4={mapBoxSidebar:"_mapBoxSidebar_kftp4_1",active:"_active_kftp4_6",sidebarWrapper:"_sidebarWrapper_kftp4_10",sidebarBox:"_sidebarBox_kftp4_15",mapBox:"_mapBox_kftp4_1",storeNamePlaceholder:"_storeNamePlaceholder_kftp4_29",stats:"_stats_kftp4_41"};function C3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var F8={exports:{}};/*!
|
|
72
|
+
</svg>`},_2=[{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}],E8={"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},b2=()=>{const{mapConfig:e,allMapObjects:l,allIndexedMapObjects:t,allIndexedRetailers:o,floorsData:n}=Y1(),r=C.useCallback(q=>q!=null&&E8[q]!==void 0?E8[q]:0,[]),a=C.useCallback((q,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"||q==="base"||q==null)&&q!=="boundary"&&(I.depthWrite=!1,I.depthTest=!1),q==="overlay"&&(I.color=e.OVERLAY_COLOR,I.opacity=e.OVERLAY_OPACITY),q&&["store","big-store","kiosk"].includes(q)&&e.ROLE!=="PORTAL"&&t[s]&&t[s].transparent&&(I.opacity=0);var x=new Q.MeshLambertMaterial(I);return q&&["store","big-store","kiosk","amenity"].includes(q)&&(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((q,s,m,v,I)=>{const x="MaterialAndGeometry";let h=I.toShapes(!0),f;e.STYLE==="2D"?f=["building-base"]:f=["store","big-store","base","building-base"];let g=["wall","outer-wall","boundary"];var z;if(q&&f.includes(q))z=new Q.ExtrudeGeometry(h,{depth:-m,bevelEnabled:!1});else if(q&&g.includes(q)){let _=[];I.subPaths.forEach(u=>{u.curves.forEach(d=>{if(d.type==="LineCurve"){let S=0;q==="boundary"&&(S=1);let E=n0(d,v,S),F=new Q.ExtrudeGeometry(E,{depth:-m,bevelEnabled:!1});_.push(F)}else console.warn(x+'"%s" found in walls. Check layer "%s"',d.type,s)})}),_.length===1?z=_[0]:_.length>1?z=o0(_):console.warn(x+'Unneccessary wall exists "%s"',s)}else{z=new Q.ShapeGeometry(h);try{z.attributes.position.count===0&&console.warn(x+'Unneccessary map shape "%s"',s,I.userData.node)}catch(_){console.error(_.message)}}return z},[e.STYLE]),i=C.useCallback((q,s,m,v,I,x,h,f,g,z)=>{var E,F;const _=a(q,s,m,v),u=c(q,s,h,f,z),d=new Q.Mesh(u,_);d.object_id=s,d.mesh_type=q,d.floor_index=g,d.visible=I,d.position.z=x;let S="";if(["retail_logo","retail_name","retail_text","custom_text","amenity"].includes((E=t[s])==null?void 0:E.layer_type)){if(t[s].layer_type&&["retail_name","retail_logo"].includes(t[s].layer_type)&&t[s].retailer_id&&o[((F=t[s])==null?void 0:F.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=_2.find(D=>D.type===S);B&&(S=B.name)}}return d.userData.storeName=S,e.STYLE==="2D"&&(d.renderOrder=r(q),s&&s.includes("underlay")&&(d.renderOrder=r("underlay"))),n[g].objsGroup.add(d),q==="escalator"&&(n[g].escalatorsNodes[s]=null,n[g].escalatorsObjs.push(d),d.escalator_id=g+"-"+s),q&&["store","big-store","kiosk","amenity"].includes(q)&&(d.route_node_id=null,t[s]&&t[s].layer_type,l.push(s),(e.ROLE!=="PORTAL"&&q==="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[g].interactiveObjs.push(d)),{mesh:d,geometry:u,material:_,object_id:s,mesh_type:q,floor_index:g,visible:I,renderOrder:d.renderOrder}},[t,o,l,n,c,a,r,e.ROLE,e.STYLE]);return{getRenderOrder:r,getMaterial:a,getGeometry:c,getMaterialAndGeometry:i}},g3="ROUTE: ",r0=1e4,S8=()=>{const{floorsData:e,allNodesFloor:l,ngraphPath:t,pathFinderGraph:o,allIndexedMapObjects:n}=Y1(),{getRenderOrder:r}=b2(),a=C.useCallback((g,z,_)=>{if(!_.data)return!1;let u=_.data.weight;const d=l[g.id],S=l[z.id];return d!==S?u+r0+Math.abs(d-S):u},[l]),c=C.useCallback(g=>{var z;for(let _=0;_<g.length;_++){const u=g[_];u.route_active=!1,u.route_tube!=null&&(u.route_tube.geometry.dispose(),u.route_tube.material.dispose(),(z=u.objsGroup)==null||z.remove(u.route_tube)),u.route_tube=void 0,u.route_texture=null,u.escalatorMeshes=[]}},[]),i=C.useCallback((g,z,_)=>{let u=_.find(g,z);return u.length===0?!1:u},[]),q=C.useCallback((g,z,_)=>{let d=document.createElement("canvas").getContext("2d");if(d){d.canvas.width=g,d.canvas.height=80,d.fillStyle="#4ea5ff",d.fillRect(0,0,g,80);let S=.1*g;const E=60,F=120;S<E&&(S=E),S>F&&(S=F);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 D=new Q.CanvasTexture(d.canvas);return D.offset.x=1,D.colorSpace="srgb",_[z].route_texture=D,D}else return},[]),s=C.useCallback((g,z,_,u="2D")=>{var D;let d=0,S=new Q.CurvePath;for(let l1=1;l1<g.length;l1++){let W=new Q.Vector3(g[l1-1].data.x,g[l1-1].data.y,0),n1=new Q.Vector3(g[l1].data.x,g[l1].data.y,0);S.add(new Q.LineCurve3(W,n1)),d+=W.distanceTo(n1)}var E=new Q.TubeGeometry(S,400,6,8);E=new Q.BufferGeometry().copy(E);var F=new Q.MeshBasicMaterial({map:q(d,z,_),transparent:!0,side:Q.DoubleSide,depthTest:!1,depthWrite:!1});let B=new Q.Mesh(E,F);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"),_[z].route_tube=B,(D=_[z].objsGroup)==null||D.add(B),B},[r,q]),m=C.useCallback((g,z,_,u,d,S,E,F,B=null)=>{var L,R,H,w,A,b;const D=[];c(S);let l1=_.getObjectByProperty("object_id",g),W=_.getObjectByProperty("object_id",z),n1=l1.route_node_id,K=W.route_node_id;if(n1||console.error(g3+'Route Anchor point missing for "%s"',g),K||console.error(g3+'Route Anchor point missing for "%s"',z),!n1||!K)return D;const e1=l1.floor_index,Y=W.floor_index,J=t.nba(E,{distance:a,oriented:!0,blocked(p,O,X){return X.data.blocked},debug:!0}),k=i(n1,K,J),q1=[];if(!k)return[];k.reverse();const V=[];for(let p=0;p<k.length;p++){const O=k[p];V[u[O.id]]?V[u[O.id]].push(O):V[u[O.id]]=[O],d.includes(O.id)&&d.includes(k[p-1].id)&&d.includes(k[p+1].id),q1.push(O)}for(let p=0;p<q1.length;p++){const O=q1[p];if(u[q1[0].id]!==u[q1[q1.length-1].id]&&d.includes(O.id)){const X=Object.keys(S[u[O.id]].escalatorsNodes).find(N=>{var o1,$;return(($=(o1=S[u[O.id]])==null?void 0:o1.escalatorsNodes)==null?void 0:$[N])===O.id}),G=_.getObjectByProperty("escalator_id",u[O.id]+"-"+X);let t1=null;if(u[O.id]!==u[q1[p+1].id]&&d.includes(q1[p+1].id)&&(t1={index:u[q1[p+1].id],direction:"To"}),u[O.id]!==u[q1[p-1].id]&&d.includes(q1[p-1].id)&&(t1={index:u[q1[p-1].id],direction:"From"}),t1&&G){G.goToFloor=t1;const N=G.clone();N.goToFloor=t1,N.object_id=X,(R=(L=S[u[O.id]])==null?void 0:L.escalatorMeshes)==null||R.push(N)}}}for(let p=0;p<V.length;p++){const O=V[p];if(O&&O.length>1){const X=s(O,p,S,F);D[p]=X,S[p].route_active=!0,S[p].routeMeshes=[X],p===e1&&((w=(H=S[p])==null?void 0:H.routeMeshes)==null||w.push(l1)),p===Y&&((b=(A=S[p])==null?void 0:A.routeMeshes)==null||b.push(W))}}return D},[s,i,t,c,a]),v=C.useCallback((g,z,_,u,d,S,E,F)=>{if(z===_)return{routePaths:[],fromFloor:void 0};const B=m(z,_,u,g,S,d,E,F);B.length||console.warn(g3+'No route found in between "%s" and "%s"',z,_);let D=u.getObjectByProperty("object_id",z);return{routePaths:B,fromFloor:D.floor_index}},[m]),I=C.useCallback((g,z,_,u)=>{let d=0,S=_.find(z,g);if(S.length===0)return!1;for(let E=1;E<S.length;E++){let F=u.getLink(S[E-1].id,S[E].id);d+=(F==null?void 0:F.data.weight)||0}return d},[]),x=C.useCallback(()=>{if(e.length>1){const g=[],z=[];for(let _=0;_<e.length;_++)z[_]=[],e[_].escalatorsNodes&&(g[_]=Object.fromEntries(Object.entries(e[_].escalatorsNodes).map(([u,d])=>{const S=u.split("-"),E=S.slice(0,2).join("-"),F=S.includes("end"),B=S.includes("start"),D=S.includes("up"),l1=S.includes("down"),W=D?"up":l1?"down":"both";return z[_].push(E),[E,{node:d,escalatorId:E,isExitOnly:F,isEntranceOnly:B,upOnly:D,downOnly:l1,direction:W,floorsTo:[]}]})));for(let _=0;_<e.length;_++)for(let u=0;u<z[_].length;u++){const d=z[_][u],S=g[_][d];for(let E=_+1;E<e.length;E++)for(let F=0;F<z[E].length;F++){const B=z[E][F];d===B&&S.floorsTo.push(E)}}for(let _=0;_<e.length-1;_++){const u=g[_];for(const d in u){const S=u[d],E=S.node;S.floorsTo.forEach(F=>{const D=g[F][d].node;D&&(S.isExitOnly?(o.addLink(E,D,{blocked:!0}),o.addLink(D,E,{weight:1})):S.isEntranceOnly?(o.addLink(D,E,{blocked:!0}),o.addLink(E,D,{weight:1})):(o.addLink(E,D,{weight:1}),o.addLink(D,E,{weight:1})))})}}}},[e,o]),h=C.useCallback((g,z,_,u,d)=>{let S=_.getObjectByProperty("object_id",g),E=S?S.route_node_id:"";var F=null,B=9999;const D=[];for(let l1 in n){const W=n[l1];W.layer_type==="amenity"&&W.obj_type==="special"&&W.value===z&&D.push(l1)}return D.forEach(l1=>{let W=_.getObjectByProperty("object_id",l1);const n1=t.aStar(o,{distance:a,debug:!0});if(W&&E){var K=W.route_node_id;try{var e1=I(E||"",K||"",n1,o);e1&&e1<B&&(B=e1,F=l1)}catch(Y){console.warn(`Amenity Path: ${Y.message}`)}}!E&&W&&(F=K)}),v(l,g,F??"",_,e,u,o,d)},[n,l,v,e,I,t,o,a]),f=C.useCallback((g,z,_)=>{const u=new Map,d=e[g];return d&&d.route_points&&d.route_points.forEach(S=>{let E=new Q.Vector3(S.node.x,S.node.y,-10),F=new Q.Vector3(0,0,1);_.set(E,F);var B=_.intersectObjects(e[g].interactiveObjs);B.length&&(B[0].object.route_node_id=S.name,u.set(B[0].object.object_id,S.name));var D=_.intersectObjects(e[g].escalatorsObjs);if(D.length){let W=D[0].object.object_id;const n1=e[g].escalatorsNodes;n1&&(n1[W]=S.name,l[S.name]=g,z.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:i,get_nodes_distance:I,get_route_texture:q,linkFloorEscalators:x,make_amenity_route:h,assign_route_nodes_to_stores:f}};function a0(e){return"node-"+e}function z8(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=a0(o))}return[r,n]}const i0=()=>{const{mapConfig:e,floorsData:l,allNodesFloor:t,pathFinderGraph:o}=Y1();return{getMeshParams:C.useCallback((r,a,c,i)=>{var d;const q="MeshParams";let s=null;var m=r.color.clone(),v=0,I=0,x=!0,h=!0,f=!1,g=e.WALL_THICKNESS,z=!0,_=(d=r.userData)==null?void 0:d.node.id;return _!==void 0?_.startsWith("boundary")?(s="boundary",m=e.BOUNDARY_COLOR,g=e.BOUNDARY_THICKNESS,e.STYLE==="3D"&&(v=9)):_.startsWith("wall")?(s="wall",m=e.WALL_COLOR,e.STYLE==="3D"&&(v=8.5)):_.startsWith("outer-wall")?(s="outer-wall",m=e.WALL_COLOR,e.STYLE==="3D"&&(h=!1)):_.startsWith("base")?(s="base",m=e.BASE_COLOR):_.startsWith("store")?(s="store",m=e.STORE_DEFAULT_COLOR,e.STYLE==="3D"&&(v=e.STORE_HEIGHT),_.startsWith("store-underlay")&&(z=!1)):_.startsWith("route-path")?(s="route-path",h=!1,r.subPaths.forEach(S=>{S.curves.length===0&&console.warn(q+'Route-path standalone anchor point exists, layer_name: "%s"',_),S.curves.forEach(E=>{var K,e1;const F=E.v1,B=E.v2,[D,l1]=z8(F,c,l,i);l1||((K=l[c].route_points)==null||K.push({name:D,node:new Q.Vector3(F.x,F.y,1)}),t[D]=c);const[W,n1]=z8(B,c,l,i);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(D,{...F}),o.addNode(W,{...B}),o.addLink(D,W,{weight:F.distanceTo(B)}),o.addLink(W,D,{weight:F.distanceTo(B)})})})):_.startsWith("escalator-")?(s="escalator",x=!1,f=!0):_.startsWith("kiosk-")?(s="kiosk",f=!0):_.startsWith("amenity-")?(s="amenity",f=!0,I=1):_.startsWith("overlay")?s="overlay":_.startsWith("special-shape")?s="special-shape":v=1:console.warn(q+"Layer name is undefined, path",r),{mesh_type:s,layer_color:m,extrude:v,z_index:I,mesh_visible:x,mesh_draw:h,mesh_transparent:f,line_thickness:g,interactiveMesh:z,path:r,layer_name:_}},[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 q0=0;const s0=e=>{const{mapConfig:l,pathFinderGraph:t}=Y1(),{getMaterialAndGeometry:o}=b2(),{getMeshParams:n}=i0(),{assign_route_nodes_to_stores:r,linkFloorEscalators:a}=S8(),[c,i,q]=C.useMemo(()=>{const s=new Set,m=[],v=[];e.forEach((I,x)=>{var h,f;if(I&&I.paths&&I.paths.length){const g=[];for(let d=0;d<I.paths.length;d++)g.push((f=(h=I.paths[d])==null?void 0:h.userData)==null?void 0:f.node.id);const z=I.paths;for(let d=0;d<z.length;d++){const{mesh_type:S,layer_color:E,extrude:F,z_index:B,mesh_visible:D,mesh_draw:l1,mesh_transparent:W,line_thickness:n1,path:K,layer_name:e1}=n(z[d],z,x,++q0);if(l1){const Y=o(S,e1,E,W,D,B,F,n1,x,K);e1.startsWith("kiosk-")&&l.ROLE,m[x]||(m[x]=[]),m[x].push(Y)}}const _=new Q.Raycaster,u=r(x,v,_);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 h=0;h<x.length;h++)s.add(x[h].object_id)}return[m,v,s]},[r,o,n,a,l.ROLE,e]);return{GeometriesAndMaterials:c,graph:t,escalator_nodes:i,allSvgObjectIds:q}},O8=()=>{const{allIndexedRetailers:e,allIndexedMapObjects:l,floorsData:t,mapConfig:o}=Y1(),{getRenderOrder:n}=b2(),r=(x,h,f,g,z,_,u,d)=>{for(let S=0;S<x.length;S++)a(x[S],h,f,g,z,_,u,d)},a=(x,h,f,g,z,_,u,d)=>{let S=h.getObjectByProperty("object_id",x.map_obj_name);S&&add_store_name_logo(S,f,g,z,_,u,d,h)},c=x=>(Array.isArray(x)||(x=[x]),x.reduce((f,g)=>(g.geometry.boundingBox||g.geometry.computeBoundingBox(),f.union(g.geometry.boundingBox),f),new Q.Box3)),i=(x,h,f,g,z)=>{let _=z[x];h.z=-f.z,g.rotateZ(((_==null?void 0:_.rotate)||0)*Math.PI/180),g.scale.y*=-1,h.x+=(_==null?void 0:_.offset_x)||0,h.y+=(_==null?void 0:_.offset_y)||0,g.position.set(h.x,h.y,h.z+1)},q=async x=>{try{const h=T6(x,o),f=await fetch(h);if(!f.ok)throw new Error(`Failed to fetch image: ${f.statusText}`);const g=await f.blob();return URL.createObjectURL(g)}catch(h){return console.error("Error fetching or converting the image:",h),""}},s=(x,h)=>new Promise((f,g)=>{var z;if(x.obj_type==="retailer")h?q(h.logo).then(_=>{f(_)}):(console.error("retailer not found"),f(""));else if(x.obj_type==="special"){let _=x.value;if(x.layer_type==="kiosk"&&(_="kiosk"),x.layer_type==="escalator"&&(_="escalator"),_){let u="222222";x.text_color!=null&&(u=x.text_color.replace("#",""));const d=document.getElementById("map-special-svg-"+_);if(d){const S=d.querySelector("svg");if(S){const E=S.cloneNode(!0);E.querySelectorAll("[fill]").forEach(W=>{W.setAttribute("fill","#"+u)});const B=new XMLSerializer().serializeToString(E),D=new Blob([B],{type:"image/svg+xml"}),l1=URL.createObjectURL(D);f(l1)}else console.error("svg_element not found",_),f("")}else console.error("svg_block not found",_),f("")}}else x.custom_image!==""&&((z=x==null?void 0:x.custom_image)!=null&&z.startsWith("http"))?f(x.custom_image):(console.error("custom_image URL not found"),f(""))}),m=(x,h,f)=>{const g=document.createElement("img");g.crossOrigin="anonymous",g.src=x,g.onload=function(){const z=document.getElementById("temp-image-rendering");z&&(g.style.height="100px",z.appendChild(g),setTimeout(()=>{const _=document.createElement("canvas"),u=_.getContext("2d");if(u){_.width=g.width*N6,_.height=g.height*N6,u==null||u.drawImage(g,0,0,_.width,_.height);let d=new Q.CanvasTexture(_);d.colorSpace="srgb";const S=new Q.PlaneGeometry(h.size,h.size*g.height/g.width),E=new Q.MeshBasicMaterial({map:d,transparent:!0,side:Q.DoubleSide,depthTest:!1,depthWrite:!1});h.layer_type==="kiosk"&&(E.visible=!1),f(S,E)}},100))},g.onerror=function(){console.error("processImage():: Error loading image:",x)}},v=C.useCallback((x,h,f,g,z,_,u,d,S,E)=>{s(f,h[f.retailer_id]).then(F=>{F&&m(F,f,(B,D)=>{var n1;const l1=new Q.Mesh(B,D),W=g.floor_index;i(z,u,d,l1,x),l1.object_id=_,l1.floor_index=W,l1.renderOrder=n("layer-image"),(n1=S[W])==null||n1.objsGroup.add(l1),E({storeLogo:l1})})})},[n]),I=C.useCallback((x,h,f,g,z,_)=>{const u=g+h;let d=null;if(x.boundingBox||x.computeBoundingBox(),!x.boundingBox)return null;const S=x.boundingBox,E=new Q.Vector3;S.getCenter(E);const F=new Q.Vector3;S.getSize(F);let B=l[h]?l[h]:{layer_type:h.startsWith("escalator")?"escalator":"custom_text",custom_text:"",size:8};if(["retail_name","retail_text","custom_text"].includes(B.layer_type)){let D="";B.layer_type==="retail_name"&&B.retailer_id&&e[B.retailer_id]?D=e[B.retailer_id].retail_name:["retail_text","custom_text"].includes(B.layer_type)?D=B.custom_text:D="";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 A8(D,{font:z,size:parseInt(B.size),height:.01,curveSegments:4});K.center();const e1=new Q.Mesh(K,n1);e1.userData.debug_name=D,e1.userData.font=z,i(h,E,F,e1,l),e1.object_id=u,e1.floor_index=f,e1.renderOrder=n("layer-text"),B.layer_type==="retail_name"&&(e1.userData.retail_name=D),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,h,u,E,F,t,_);return d},[l,e,t,v,n,o.STORE_TEXT_COLOR]);return{drawTextLogoStoreOnMap:r,addTextOrLogoOnStore:a,getMeshGroupBoundingBox:c,layer_text_logo_position_by_id:i,getImage:s,processImage:m,getImageLogo:v,get_store_name_logo_geometry:I}};let v3=[];const c0=()=>{const{mapConfig:e,initialFloorsDataIsLoaded:l,allIndexedMapObjects:t,allIndexedRetailers:o,allMapObjects:n,allNodesFloor:r,pathFinderGraph:a,setPathFinderGraph:c,mapApiResponse:i}=Y1(),[q,s]=C.useState([]),[m,v]=C.useState([]),[I,x]=C.useState([]),[h,f]=C.useState([]);let g=p4.useLoader(t3,i.floors.map(D=>T6(D.svgUrl,e)));const{GeometriesAndMaterials:z,graph:_,escalator_nodes:u,allSvgObjectIds:d}=s0(g),{get_store_name_logo_geometry:S}=O8(),E=h4.useFont(O6),F=C.useCallback(D=>l1=>{x(W=>(W[D]?W[D].push({...l1}):W[D]=[{...l1}],[...W]))},[]),B=C.useCallback(()=>{s(D=>(D&&D.forEach(l1=>{l1&&l1.forEach(W=>{W.mesh.removeFromParent()})}),[])),v(D=>(D&&D.forEach(l1=>{l1&&l1.forEach(W=>{W.textMesh.removeFromParent()})}),[])),x(D=>(D&&D.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(!E||!g)return;x([]);const D=[];if(v3.forEach(n1=>{let K;for(let Y=0;Y<z.length&&(K=z[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,E,F(K.floor_index));e1&&(D[K.floor_index]||(D[K.floor_index]=[]),D[K.floor_index].push(e1))}),z.reduce((n1,K)=>n1+K.length,0)-v3.length!==0){const n1=new Set;v3.forEach(K=>{n1.add(K.map_obj_name)}),z.forEach(K=>{K.forEach(e1=>{if(!n1.has(e1.object_id)){const Y=S(e1.geometry,e1.object_id,e1.floor_index,a2,E,F(e1.floor_index));Y&&(D[e1.floor_index]||(D[e1.floor_index]=[]),D[e1.floor_index].push(Y))}})})}s([...z]),v(D),c(_),f([...u])},[g,E,t,o,n,r,a,e,c,F,z,S,_,u]),C.useMemo(()=>({meshParams:q,textParams:m,storeLogos:I,pathFinderGraph:a,escalator_nodes:h,allSvgObjectIds:d}),[q,m,I,a,h,d])},u0=e=>{const{scene:l}=p4.useThree();return e.background&&(l.background=new Q.Color(e.background)),null},m0=e=>{const{camera:l}=p4.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 w8(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function d0({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 i=(performance.now()-c)/1e3,q=Math.floor(w8(i)*t);i>=1&&(l.current=n),e.geometry.setDrawRange(0,q)}})(),n=(()=>{if(!(e.material instanceof Q.MeshBasicMaterial)||!e.material.map)return null;const a=e.material.map.offset,c=2e3,i=.1,q=1+i,s=performance.now();return()=>{const m=(performance.now()-s)/c%1;a.x=i-q*w8(m)}})();return l.current=o,()=>{l.current=null,e.removeFromParent(),e.material instanceof Q.MeshBasicMaterial&&e.material.dispose(),e.geometry&&e.geometry.dispose()}},[e]),p4.useFrame(()=>{if(l.current)try{l.current()}catch(t){console.error(`ERROR ANIMATE ROUTE: ${t.message}`),l.current=null}}),e?M.jsx("primitive",{object:e}):null}const g2={escalator_elems:"_escalator_elems_1kqb9_1",element:"_element_1kqb9_4",svgIcon:"_svgIcon_1kqb9_21",label:"_label_1kqb9_34"},f0={mapCenterMarker:"_mapCenterMarker_1eu0j_18"},T8=({size:e,lockSize:l,blink:t,cameraLength:o,text_color:n="black"})=>{const{mapConfig:r}=Y1(),[,a]=C.useState(1),[c,i]=C.useState(null),q=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),h=new Blob([x],{type:"image/svg+xml"}),f=URL.createObjectURL(h),g=document.createElement("canvas");g.width=256,g.height=256;const z=g.getContext("2d"),_=document.createElement("img");_.src=f,_.onload=()=>{z==null||z.drawImage(_,96,0,64,128);const u=new Q.Texture(g);u.needsUpdate=!0,i(u)}}},[]),s?M.jsxs("group",{children:[M.jsx("sprite",{scale:q,material:s}),t&&M.jsx(h4.Html,{children:M.jsx("div",{className:`mapCenterMarker ${f0.mapCenterMarker}`})})]}):null},x0=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},M8=e=>{const{type:l,mesh:t,currentFloorIndex:o}=e;C.useEffect(()=>(t.userData.triggerUpdate=()=>{},()=>t.userData.triggerUpdate=void 0),[t.userData]);const{cameraLength:n}=Y1();switch(l){case"storeLogo":return t.userData.kioskConfig&&t.userData.kioskConfig.floorIndex===o?M.jsx("primitive",{object:t,children:M.jsx(T8,{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):M.jsx("primitive",{object:t,children:t.userData.htmlContent?M.jsx(h4.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?M.jsx(T8,{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}},p0=e=>{const{meshFloors:l,routeTube:t,floorIndex:o,currentFloorIndex:n,activeObjectId:r,hoverObjectId:a,visible:c,handleChangeFloor:i}=e,{mapConfig:q,floorsData:s}=Y1(),{meshParams:m,textParams:v,storeLogos:I}=l,x=s[o],h=e.onPointerMove,f=e.onPointerEnter,g=e.onPointerLeave,z=e.onClick,_=m[o],u=v[o],d=I[o],S=s[o].escalatorMeshes;return M.jsxs("group",{visible:c,children:[_==null?void 0:_.map(E=>{if(!E.mesh)return null;const F=c&&E.mesh.visible&&x.interactiveObjs&&x.interactiveObjs.includes(E.mesh),B=a&&E.mesh.object_id===a,D=r&&E.mesh.object_id===r;if(F)if((D||B)&&(E.mesh.material instanceof Q.MeshLambertMaterial||E.mesh.material instanceof Q.MeshStandardMaterial)){const l1=D?q.ACCENT_COLOR:E.mesh.material.colorDefault;E.mesh.material.color=B?x0(l1):l1}else E.mesh.material.color=E.mesh.material.colorDefault;return M.jsx("group",{...F?{onPointerOver:f,onPointerMove:h,onPointerOut:g,onClick:z}:{},children:M.jsx("primitive",{object:E.mesh})},E.mesh.uuid)}),u==null?void 0:u.map(E=>E.textMesh?M.jsx(C.Fragment,{children:M.jsx("primitive",{object:E.textMesh,children:E.textMesh.userData.kioskConfig?M.jsx(M8,{mesh:E.textMesh,currentFloorIndex:n,type:"kiosk",visible:c},void 0):null})},E.textMesh.uuid):null),d==null?void 0:d.map(E=>E.storeLogo?M.jsx(M8,{mesh:E.storeLogo,currentFloorIndex:n,type:"storeLogo",visible:c},E.storeLogo.uuid):null),S==null?void 0:S.map(E=>{var F,B;return M.jsx("primitive",{object:E,children:M.jsx(h4.Html,{visible:!0,position:(F=E.geometry.boundingSphere)==null?void 0:F.center,children:M.jsx("div",{className:`escalator_elems ${g2.escalator_elems}`,style:{display:c?"block":"none"},onClick:D=>{var l1;return D.stopPropagation(),i(((l1=E.goToFloor)==null?void 0:l1.index)||0),!1},onPointerMove:D=>D.stopPropagation(),children:M.jsxs("div",{className:`element ${g2.element}`,id:E.object_id,children:[M.jsx("div",{className:`svgIcon ${g2.svgIcon}`,dangerouslySetInnerHTML:{__html:w6("escalator")}}),M.jsxs("div",{className:`label ${g2.label}`,children:[(B=E.goToFloor)==null?void 0:B.direction,": ",E.goToFloor?s[E.goToFloor.index].name:""]})]})})})},`escalator-${E.object_id}`)}),M.jsx(d0,{mesh:t})]})};function N8(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((h,f)=>(f.geometry.boundingBox||f.geometry.computeBoundingBox(),f.geometry.boundingBox&&h.union(f.geometry.boundingBox),h),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),i=1.1,q=r.x*i/2/(c*t),s=r.y*i/2/c,m=Math.max(q,s),v=h0(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 h0(e,l){let t=60;return l==="2D"&&(t=89.9),e/Math.tan(t*Math.PI/180)}const _0=C.forwardRef((e,l)=>{const{mapConfig:t,allMapObjects:o,allIndexedMapObjects:n,allNodesFloor:r,mapApiResponse:a,pathFinderGraph:c,setCameraLength:i,floorsData:q}=Y1(),{make_amenity_route:s,create_route:m}=S8(),[v,I]=C.useState(!1),{meshFloors:x,currentFloorIndex:h,currKioskObj:f,currKioskFloorIndex:g,routeTargetId:z,routeTargetFromId:_,selectedAmenityType:u,handleChangeFloor:d,escalatorNodes:S,zoom:E,handleCameraLength:F,handleCameraAndControlsChange:B,activeObjectId:D,isSelectedRetailerSlug:l1,setIsCameraInit:W,handleObjectClick:n1,triggerClick:K,cameraControlsPosition:e1,deviceType:Y}=e,[J,k]=C.useState({min:t.CAMERA.minDistance,max:t.CAMERA.maxDistance,initialDistance:0,needsUpdate:!0}),q1=C.useRef(null),[V,L]=C.useState([]),R=C.useRef(null),{camera:H,scene:w}=p4.useThree(),A=C.useRef(null),b=t.STYLE,p=t.ACCENT_COLOR,O=f?f.object_id:_||void 0,X=t.ROLE==="PORTAL"&&z,G=C.useCallback((j=!1)=>{if(!(H instanceof Q.PerspectiveCamera)){console.error("Camera is not a PerspectiveCamera");return}const T=x.meshParams[g];if(!(T!=null&&T.length)){console.warn("objects not loaded yet");return}let y;y=T.map(b1=>b1.mesh);const r1=N8(y,H.fov,H.aspect,t.ROLE==="PORTAL"?"2D":b);let c1=!0;if(e1){let b1=e1.camera;b1 instanceof Q.Vector3||(b1=new Q.Vector3(b1.x,b1.y,b1.z)),c1=b1.length()===0}!j&&e1&&!c1&&!["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 g1=Math.min(J.max,Math.max(J.min,r1.position.distanceTo(r1.target)));r1.position.sub(r1.target).setLength(g1).add(r1.target),A.current={...r1,fromPosition:R.current.object.position.clone(),fromTarget:R.current.target.clone(),animationStartTime:performance.now(),duration:t.CAMERA.animSpeed},["DISPLAY_APP","WP_SITE"].includes(t.ROLE)&&J.needsUpdate===!1&&J.initialDistance>0&&k(b1=>({...b1,min:t.CAMERA.minDistance<.1?.1:t.CAMERA.minDistance,max:t.CAMERA.maxDistance}))},[H,J.needsUpdate,t.CAMERA.animSpeed,t.CAMERA.maxDistance,t.CAMERA.minDistance,e1,t.ROLE,g,x.meshParams,b]),t1=A.current?A.current.position.distanceTo(A.current.target):0;C.useEffect(()=>{e1&&G()},[e1,G]),C.useEffect(()=>{t1>0&&J.needsUpdate&&(k({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(()=>{k(j=>({...j,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:j,fromFloor:T}=s(O??"",u,w,S,b);L(j),T!==void 0&&d(T),f&&t.ROLE==="DISPLAY_APP"&&d(g)},[u,w,c,q,S,b,O,t.ROLE,r,n,s,f,d,g]);const N=C.useCallback(()=>{q.flat().forEach(j=>j.escalatorMeshes=[])},[q]);C.useEffect(()=>{if(!O||!z||t.ROLE==="PORTAL"){if(t.ROLE==="PORTAL")if(z){const y=w.getObjectByProperty("object_id",z);y&&L([y])}else N(),L([]);else u||(N(),L([]));return}u||q.forEach(y=>{y.escalatorMeshes=[]});const{routePaths:j,fromFloor:T}=m(r,O,z,w,q,x.escalator_nodes,c,b);L(j),T!==void 0&&d(T)},[O,z,w,H,q,p,c,b,x.escalator_nodes,u,t.ROLE,r,K,m,N,d]);const o1=x.meshParams[h];C.useEffect(()=>{var c1;if(t.ROLE==="PORTAL_RESPONSIVE")return;if(!(H instanceof Q.PerspectiveCamera)){console.error("Camera is not a PerspectiveCamera");return}if(!(o1!=null&&o1.length)){console.warn("objects not loaded yet");return}let j=(c1=q[h])==null?void 0:c1.routeMeshes;if(!D&&!u)return;let T=[];if(V[h]&&(j!=null&&j.length))T=[...j];else if(D&&(t.ROLE==="PORTAL"||l1)){const g1=z&&o1.find(b1=>b1.mesh.object_id===z);g1&&(T=[g1.mesh])}T.length||(T=o1.map(g1=>g1.mesh));const y=N8(T,H.fov,H.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),A.current={...y,fromPosition:R.current.object.position.clone(),fromTarget:R.current.target.clone(),animationStartTime:performance.now(),duration:t.CAMERA.animSpeed}},[V,o1,h,b,H,z,t.ROLE,t.CAMERA.maxDistance,t.CAMERA.minDistance,t.CAMERA.animSpeed,q,D,u,l1,X,J.max,J.min]),C.useEffect(()=>{if(E!=null&&E.direction&&R.current){if(!(H instanceof Q.PerspectiveCamera)){console.error("Camera is not a PerspectiveCamera");return}if(!o1.length){console.warn("objects not loaded yet");return}let j;if(V[h]){j=[V[h]];const r1=z&&o1.find(c1=>c1.mesh.object_id===z);r1&&j.push(r1.mesh)}else j=o1.map(r1=>r1.mesh);const T={position:R.current.object.position.clone(),target:R.current.target.clone()};let y=parseInt(T.position.distanceTo(T.target));E.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),A.current={...T,fromPosition:R.current.object.position.clone(),fromTarget:R.current.target.clone(),animationStartTime:performance.now(),duration:t.CAMERA.animSpeed}}},[E]);const $=()=>J.initialDistance,U=C.useCallback(j=>{if(F){const T=new Q.Vector3;T.copy(j.target.object.position),T.sub(R.current.target),F(T.length()),i(T.length()),B&&B({camera:R.current.object.position.clone(),controls:R.current.target.clone()})}},[F,B,i]);p4.useFrame(()=>{var j,T;if((j=A.current)!=null&&j.duration&&((T=A.current)==null?void 0:T.duration)>0){v||(I(!0),A.current.duration=0);const y=A.current,r1=(performance.now()-y.animationStartTime)/1e3,c1=Math.min(1,r1/(y==null?void 0:y.duration));R.current.object.position.lerpVectors(y.fromPosition,y.position,c1),R.current.target.lerpVectors(y==null?void 0:y.fromTarget,y.target,c1),R.current.object.updateProjectionMatrix(),c1>=1&&(A.current=null)}});const P=C.useCallback(j=>{if(j>0){const T=a.retailers.find(y=>y.id===j);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 c1=w.getObjectByProperty("object_id",y[r1].map_obj_name);c1&&n1(c1,y[r1].map_obj_name,!0);break}}}},[n1,a,w]);return C.useImperativeHandle(l,()=>({resetCamera:G,createRouteToStore:P,getInitialDistance:$})),M.jsxs("group",{rotation:[Math.PI/2,0,0],ref:q1,children:[M.jsx(h4.MapControls,{makeDefault:!0,onChange:U,ref:R,maxPolarAngle:Math.PI/2,minDistance:X?d4.CAMERA.minDistance:J.min,maxDistance:X?d4.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}),q&&q.map((j,T)=>M.jsx(p0,{visible:h===T,floorIndex:T,currentFloorIndex:h,currKioskObj:e.currKioskObj,activeObjectId:e.activeObjectId,hoverObjectId:e.hoverObjectId,meshFloors:x,routeTube:t.ROLE!=="PORTAL"?V&&V[T]:void 0,onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerMove:e.onPointerMove,onClick:e.onClick,handleChangeFloor:d},`Map-${T}`))]})}),f4={threejsMapWrapper:"_threejsMapWrapper_6jbfd_1",threejsMap:"_threejsMap_6jbfd_1",map_controls:"_map_controls_6jbfd_18",amenities:"_amenities_6jbfd_112",amenity:"_amenity_6jbfd_123",content:"_content_6jbfd_155",icon:"_icon_6jbfd_163",name:"_name_6jbfd_176"},b0=e=>{const{selectedFloorIndex:l,handleFloorChange:t,amenitiesList:o,zoomIn:n,zoomOut:r,reset:a,handleAmenityClick:c,onExtractedAmenities:i}=e,{mapConfig:q,mapApiResponse:s,floorsData:m,allMapObjects:v}=Y1(),I=h=>{h.preventDefault(),a instanceof Function&&(q.ROLE==="PORTAL_RESPONSIVE"||q.ROLE==="PORTAL"?a(!0):a())},x=C.useMemo(()=>s!=null&&s.map_objs?s==null?void 0:s.map_objs.filter(h=>h.layer_type==="amenity"&&v.includes(h.map_obj_name)).map(h=>h.value):[],[s,v]);return C.useEffect(()=>{i&&i(x)},[i,x]),M.jsx("div",{className:f4.threejsMapWrapper,children:M.jsxs("div",{className:f4.threejsMap,children:[m.length>0&&M.jsx("div",{className:`map_controls ${f4.map_controls}`,children:M.jsxs("div",{className:"map_controls_wrapper",children:[M.jsx("div",{className:"floors btn_group",children:m.length>1&&m.map((h,f)=>M.jsx("div",{className:`floor control_btn ${f===l?"active":""}`,onClick:()=>{t(f)},children:h.name},f))}),M.jsxs("div",{className:"reset-zoom",children:[M.jsx("div",{onClick:I,className:"reset_btn control_btn",children:"RESET"}),M.jsxs("div",{className:"zoom_btns",children:[M.jsx("div",{onClick:r,className:"zoom-out control_btn",children:"–"}),M.jsx("div",{onClick:n,className:"zoom-in control_btn",children:"+"})]})]})]})}),M.jsx("div",{className:"loading_map",children:"Map loading, please wait..."}),!["PORTAL","DISPLAY_APP"].includes(q.ROLE)&&M.jsx("div",{className:`amenities ${f4.amenities}`,style:{display:"block"},children:o.map((h,f)=>x.includes(h.type)?M.jsx("div",{className:`amenity ${f4.amenity}`,onClick:()=>c(h.type),children:M.jsxs("div",{className:`content ${f4.content}`,children:[M.jsx("div",{className:`icon ${f4.icon}`,dangerouslySetInnerHTML:{__html:w6(h.type)}}),M.jsx("div",{className:`name ${f4.name}`,children:h.name})]})},`amenity-${h.name}-${f}`):null)})]})})},y4={mapBoxSidebar:"_mapBoxSidebar_kftp4_1",active:"_active_kftp4_6",sidebarWrapper:"_sidebarWrapper_kftp4_10",sidebarBox:"_sidebarBox_kftp4_15",mapBox:"_mapBox_kftp4_1",storeNamePlaceholder:"_storeNamePlaceholder_kftp4_29",stats:"_stats_kftp4_41"};function C3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var F8={exports:{}};/*!
|
|
73
73
|
Copyright (c) 2018 Jed Watson.
|
|
74
74
|
Licensed under the MIT License (MIT), see
|
|
75
75
|
http://jedwatson.github.io/classnames
|