@aibee/crc-bmap 0.13.16 → 0.13.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -498,7 +498,7 @@
498
498
  gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
499
499
  }
500
500
  }
501
- `,i=-1/0,s=this.geometry.getAttribute("position");if(s)for(let n=0;n<s.count;n++){let r=s.getZ(n);r>i&&(i=r)}let o=new vt.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new vt.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new vt.Color(le(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=L.createLineMaterial({color:this.options[0].strokeColor,opacity:this.options[0].strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new vt.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(i=>{let{coords:s}=i.geometry;for(let o=0;o<s.length;o++){let n=s[o];for(let r=0;r<n.length;r++){let h=n[r],c=r+1===n.length?n[0]:n[r+1];t.push(new vt.Vector3(h[0],h[1],e)),t.push(new vt.Vector3(c[0],c[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new vt.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new vt.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t,e;this.geometry?(this.geometry.dispose(),this._listeners={}):this.addEventListener("init-geometry",()=>{var i;(i=this.geometry)==null||i.dispose(),this._listeners={}}),(t=this.material)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e,i){super(),this.context=t,this.mergedElement=i,this.options=[],i?(this.options=[i],this.initMergedElement()):(this.options=e.map(s=>x({},fe,s)),this.init())}};var Ig=require("core-js/modules/web.dom-collections.iterator.js"),Rg=require("core-js/modules/es.string.trim.js");var Nt=require("three"),Wr=require("three/examples/jsm/utils/BufferGeometryUtils.js");var Ur={airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},texts:[],fillColor:"#ffffff",fillOpacity:0,strokeColor:"#ffffff",strokeOpacity:0,secondHeight:0,secondRotate:0,center_x:0,center_y:0},Qi=class extends Nt.Object3D{init(){return f(this,null,function*(){let t=yield Promise.all(this.options.map(n=>mt.getTextureByText(n.texts[0],{fillStyle:bs(n.fillColor,n.fillOpacity),strokeStyle:bs(n.strokeColor,n.strokeOpacity),lineWidth:6,font:"bold 54px sans-serif",maxWidth:2048}))),e=t.map((n,r)=>{let h=this.options[r],{width:c,height:l}=n.texture.image,p=c/l,d=h.secondHeight*p,u=new Nt.PlaneGeometry(d,h.secondHeight),m=new Nt.Matrix4().makeTranslation(h.center_x,h.center_y,h.airHeight+h.deltaHeight+h.height).multiply(new Nt.Matrix4().makeRotationZ(h.secondRotate));return u.applyMatrix4(m),u}),i=(0,Wr.mergeGeometries)(e,!0);e.forEach(n=>n.dispose());let s=t.map(n=>{let{texture:r}=n,h=new Nt.MeshBasicMaterial({map:r,alphaTest:1,side:Nt.DoubleSide});return r.needsUpdate=!0,h}),o=new Nt.Mesh(i,s);this.mesh=o,this.position.z+=.04,this.add(o)})}setOpacity(t){var e,i;(i=this.mesh)==null||(e=i.material)==null||e.forEach(s=>{s.opacity=t,s.needsUpdate=!0})}dispose(){var t,e,i;(t=this.mesh)==null||t.geometry.dispose(),(i=this.mesh)==null||(e=i.material)==null||e.forEach(s=>s.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(i=>x({},Ur,i)).filter(i=>i.texts[0].trim()),this.options.length&&this.init()}};var Hr=require("three"),Nr=require("three/examples/jsm/lines/Line2.js"),Zr=require("three/examples/jsm/lines/LineGeometry.js"),jr=require("three/examples/jsm/lines/LineMaterial.js"),ai=class extends Hr.Object3D{registryEvent(){this.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.context.removeEventListener("resize",this.onResize)}setPosition(t,e){this.lineGeometry.setPositions([t.x,t.y,t.z,e.x,e.y,e.z]),this.line||this.createLine()}createLine(){this.line=new Nr.Line2(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&G(this.line),this.lineGeometry=null,this.lineMaterial=null,this.clear(),(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,i){super(),this.context=t,this.lineGeometry=new Zr.LineGeometry,this.lineMaterial=new jr.LineMaterial({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:s,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(s,o)},this.onResize(),this.registryEvent(),e&&i&&this.setPosition(e,i)}};var Hg=require("core-js/modules/es.array.push.js"),Ng=require("core-js/modules/web.dom-collections.iterator.js"),ze=require("three");var hi=require("three");var ji=class extends ze.Object3D{loadModel(){return f(this,null,function*(){let t=yield Tt.loadModel(this.options[0].url);t.scene.updateMatrixWorld(!0);let e=t.scene.matrixWorld.clone().invert();t.scene.traverse(h=>{if(h.isMesh){let c=e.clone().multiply(h.matrixWorld),l=h.material;this.subMeshes.push({geometry:h.geometry,material:h.material,initialMatrix:c}),Array.isArray(l)?l.forEach(p=>{p.transparent=!0,this.materialOriginParams.set(p,{opacity:p.opacity})}):(l.transparent=!0,this.materialOriginParams.set(l,{opacity:l.opacity}))}});let i=this.subMeshes.map(h=>{let{geometry:c,material:l}=h;return new ze.InstancedMesh(c,l,this.options.length)});t.scene.rotation.set(Math.PI/2,0,0);let o=new ze.Box3().setFromObject(t.scene).getSize(new ze.Vector3),n=Math.max(o.x,o.y);this.options.map(h=>{let c=new hi.Matrix4,l=h.width/n;return c.multiply(new hi.Matrix4().makeTranslation(h.center_x,h.center_y,h.airHeight+h.deltaHeight)).multiply(new hi.Matrix4().makeScale(l,l,l)).multiply(new hi.Matrix4().makeRotationZ(h.rotate)).multiply(new hi.Matrix4().makeRotationX(Math.PI/2)),h.url==="https://robot-vr-public.cdn.bcebos.com/ai-map-resource/757/1865371442288267264/smzsdrc.glb"&&console.log(h,c),c}).forEach((h,c)=>{i.forEach((l,p)=>{let d=h.clone().multiply(this.subMeshes[p].initialMatrix);l.setMatrixAt(c,d)})}),i.forEach(h=>{h.instanceMatrix.needsUpdate=!0,this.meshSetMaterial(h),this.add(h)})})}meshSetMaterial(t){t.isMesh&&(t.frustumCulled=!1,t.castShadow=!0,Array.isArray(t.material)?t.material.map(e=>{e.emissiveIntensity*=.95}):(t.material.emissiveIntensity*=.95,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map))}setOpacity(t,e){e===void 0&&(e=!1),this.subMeshes.forEach(i=>{let{material:s}=i;if(Array.isArray(s))s.forEach(o=>{if(e)o.opacity=t;else{let n=this.materialOriginParams.get(o)||{opacity:1};t>n.opacity?o.opacity=n.opacity:o.opacity=t}o.needsUpdate=!0});else{let o=this.materialOriginParams.get(s)||{opacity:1};t>o.opacity?s.opacity=o.opacity:s.opacity=t,s.needsUpdate=!0}}),this.children.forEach(i=>{i.instanceMatrix.needsUpdate=!0})}dispose(){this.children.forEach(t=>t.dispose()),G(this),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.subMeshes=[],this.materialOriginParams=new Map,this.loadModel()}};var Be=require("three");var ri=class extends Be.Object3D{init(){return f(this,null,function*(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.deltaHeight+this.options.airHeight,this.options.lineGeometry&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())})}initGeometry(){return this.loader.parseGeometries([this.options.mergedGeometry])[this.options.mergedGeometry.uuid]}initMaterial(){this.material=L.GetMergeAttributeGraphicMaterial()}initLineMaterial(){return this.lineMaterial=L.GetMergeAttributeGraphicLineMaterial()}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new Be.Mesh(this.geometry,this.material),this.add(this.mesh)}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.loader.parseGeometries([this.options.lineGeometry]);this.lineGeometry=t[this.options.lineGeometry.uuid]}createBorder(){this.line&&this.remove(this.line);let t=new Be.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;this.geometry&&this.geometry.dispose(),(t=this.line)==null||t.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.loader=new Be.ObjectLoader,this.options=x({},fe,e),this.init()}};var ci=require("three");var ts=class extends ci.Object3D{initGeometry(){return f(this,null,function*(){let t=new ci.ObjectLoader().parseGeometries([this.options.mergedGeometry]);this.geometry=t[this.options.mergedGeometry.uuid]})}init(){return f(this,null,function*(){var t;yield this.initGeometry();let e=new ci.Mesh(this.geometry,At.GetMergeAttributeWallMaterial());this.add(e);let i=(t=this.geometry)==null?void 0:t.getAttribute("opacity");i&&(this.originOpacities=Array.from(i.array))})}setOpacity(t,e){e===void 0&&(e=!1);var i;let s=(i=this.geometry)==null?void 0:i.getAttribute("opacity");if(s){for(let n=0;n<s.count;n++)if(e)s.setX(n,t);else{var o;s.setX(n,Math.min(t,(o=this.originOpacities[n])!=null?o:1))}s.needsUpdate=!0}}dispose(){var t;(t=this.geometry)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.originOpacities=[],this.init()}};var sy=require("core-js/modules/es.typed-array.float32-array.js"),oy=require("core-js/modules/es.typed-array.at.js"),ny=require("core-js/modules/es.typed-array.fill.js"),ry=require("core-js/modules/es.typed-array.find-last.js"),ay=require("core-js/modules/es.typed-array.find-last-index.js"),hy=require("core-js/modules/es.typed-array.set.js"),cy=require("core-js/modules/es.typed-array.sort.js"),ly=require("core-js/modules/es.typed-array.to-reversed.js"),py=require("core-js/modules/es.typed-array.to-sorted.js"),dy=require("core-js/modules/es.typed-array.with.js"),uy=require("core-js/modules/es.array-buffer.constructor.js"),my=require("core-js/modules/es.array-buffer.slice.js"),fy=require("core-js/modules/es.array-buffer.detached.js"),gy=require("core-js/modules/es.array-buffer.transfer.js"),yy=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js");var pt=require("three");var Ie=class extends pt.Object3D{init(){return f(this,null,function*(){let t=this.options.iconUrl,e=yield ft.getTextureByUrl(t),i=new pt.MeshBasicMaterial({map:e,transparent:!0,alphaTest:.2,side:pt.FrontSide}),s=new pt.InstancedMesh(this.geometry,i,this.options.mergedMatrixes.size);s.instanceMatrix=new pt.InstancedBufferAttribute(new Float32Array(this.options.mergedMatrixes.array),16),this.add(s),this.mesh=s,this.position.z+=.004})}setOpacity(t){this.mesh&&(this.mesh.material.opacity=t,this.mesh.material.needsUpdate=!0,this.mesh.instanceMatrix.needsUpdate=!0)}dispose(){var t;this.mesh&&G(this.mesh),(t=this.mesh)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.geometry=new pt.ShapeGeometry(new pt.Shape([new pt.Vector2(-.5,-.5),new pt.Vector2(-.5,.5),new pt.Vector2(.5,.5),new pt.Vector2(.5,-.5)])),this.options=x({},Ns,e);let i=new pt.Float32BufferAttribute([0,0,0,1,1,1,1,0],2);this.geometry.setAttribute("uv",i),this.init()}};var Py=require("core-js/modules/es.array.push.js"),Ee=require("three");var Yo=require("three/examples/jsm/lines/LineSegments2.js"),Xo=require("three/examples/jsm/lines/LineSegmentsGeometry.js");var es=class extends Ee.Object3D{initGeometry(){return f(this,null,function*(){let t=this.loader.parseGeometries([this.options.mergedGeometry]);this.geometry=t[this.options.mergedGeometry.uuid]})}initMaterial(){let t=L.createMeshBasicMaterial({color:"#ffffff",opacity:1,vertexColors:!0});return this.material=t,t}initDoubleLine(){if(this.options.dashedLineGeometry){let t=L.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:!0,resolution:new Ee.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0});t.transparent=!0,t.needsUpdate=!0;let e=new Xo.LineSegmentsGeometry;e.setPositions(this.options.dashedLineGeometry.positions),e.setColors(this.options.dashedLineGeometry.colors);let i=new Yo.LineSegments2(e,t);i.computeLineDistances(),i.position.z+=.01,this.add(i),this.doubleLines.push(i)}if(this.options.lineGeometry){let t=L.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:!1,resolution:new Ee.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0}),e=new Xo.LineSegmentsGeometry;e.setPositions(this.options.lineGeometry.positions),e.setColors(this.options.lineGeometry.colors);let i=new Yo.LineSegments2(e,t);i.position.z+=.01,this.add(i),this.doubleLines.push(i)}}init(){return f(this,null,function*(){yield this.initGeometry(),this.initMaterial();let t=new Ee.Mesh(this.geometry,this.material);this.add(t),this.initDoubleLine(),this.position.z+=.02})}setOpacity(t){this.material.opacity=t,this.material.needsUpdate=!0,this.doubleLines.forEach(e=>{e.material.opacity=t,e.material.needsUpdate=!0})}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.lineGeometry)==null||e.dispose(),this.doubleLines.map(i=>i.geometry.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.doubleLines=[],this.loader=new Ee.ObjectLoader,this.init()}};var Cy=require("core-js/modules/es.typed-array.float32-array.js"),Ty=require("core-js/modules/es.typed-array.at.js"),ky=require("core-js/modules/es.typed-array.fill.js"),Dy=require("core-js/modules/es.typed-array.find-last.js"),Ay=require("core-js/modules/es.typed-array.find-last-index.js"),Oy=require("core-js/modules/es.typed-array.set.js"),Iy=require("core-js/modules/es.typed-array.sort.js"),Ry=require("core-js/modules/es.typed-array.to-reversed.js"),Fy=require("core-js/modules/es.typed-array.to-sorted.js"),Gy=require("core-js/modules/es.typed-array.with.js"),zy=require("core-js/modules/es.array-buffer.constructor.js"),By=require("core-js/modules/es.array-buffer.slice.js"),Wy=require("core-js/modules/es.array-buffer.detached.js"),Uy=require("core-js/modules/es.array-buffer.transfer.js"),Hy=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Ny=require("core-js/modules/web.dom-collections.iterator.js"),j=require("three");var ii=class extends j.Object3D{setColorByIndex(t,e){this.mesh&&(this.mesh.setColorAt(t,new j.Color(e).convertLinearToSRGB()),this.mesh.instanceColor.needsUpdate=!0)}init(){return f(this,null,function*(){this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight+this.options[0].airHeight,this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())})}initMaterial(){this.material=L.GetInstancedGraphicMaterial()}initLineMaterial(){let t=L.GetMergeAttributeGraphicLineMaterial();this.lineMaterial=t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new j.InstancedMesh(this.geometry,this.material,this.options.length);let t=new j.InstancedBufferAttribute(new Float32Array(this.options.length),1),e=new j.InstancedBufferAttribute(new Float32Array(this.options.length),1);this.options.forEach((i,s)=>{let o=i.geometry.coords[0],[n,r,h]=o.slice(0,3),c=Math.sqrt((r[0]-n[0])**2+(r[1]-n[1])**2),l=Math.sqrt((h[0]-r[0])**2+(h[1]-r[1])**2),p=[c,l],d=Math.max(...p),u=Math.min(...p),m;d===c?m=[r[0]-n[0],r[1]-n[1]]:m=[h[0]-r[0],h[1]-r[1]];let[g,y]=m,w=Math.atan2(y,g)-Math.PI/2,M=new j.Matrix4().compose(new j.Vector3(i.center_coord_x,i.center_coord_y,(i.deltaHeight||0)+i.airHeight+i.height/2),new j.Quaternion().setFromAxisAngle(new j.Vector3(0,0,1),w),new j.Vector3(u,d,i.height));this.mesh.setMatrixAt(s,M),this.mesh.setColorAt(s,new j.Color(i.fillColor).convertLinearToSRGB()),t.array[s]=i.fillOpacity||1,e.array[s]=(i.deltaHeight||0)+i.airHeight+i.height}),this.originOpacity=[...t.array],this.geometry.setAttribute("opacity",t),this.geometry.setAttribute("maxZ",e),this.add(this.mesh),this.mesh.instanceMatrix.needsUpdate=!0}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let{points:t,colors:e,opacities:i}=Ts(this.options),s=new j.BufferGeometry().setFromPoints(t);s.setAttribute("color",new j.BufferAttribute(new Float32Array(e),3)),s.setAttribute("opacity",new j.BufferAttribute(new Float32Array(i),1)),this.lineOriginOpacity=[...i],this.lineGeometry=s}createBorder(){this.line&&this.remove(this.line);let t=new j.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}setOpacity(t,e){e===void 0&&(e=!1);let i=this.geometry.getAttribute("opacity");for(let n=0;n<i.count;n++)if(e)i.array[n]=t;else{var s;i.array[n]=Math.min(t,(s=this.originOpacity[n])!=null?s:1)}if(i.needsUpdate=!0,this.lineGeometry){let n=this.lineGeometry.getAttribute("opacity");for(let r=0;r<n.count;r++)if(e)n.array[r]=t;else{var o;n.array[r]=Math.min(t,(o=this.lineOriginOpacity[r])!=null?o:1)}n.needsUpdate=!0}}dispose(){var t,e;this.geometry.dispose(),(t=this.mesh)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.geometry=new j.BoxGeometry(1,1,1),this.options=[],this.originOpacity=[],this.lineOriginOpacity=[],this.options=e.map(i=>x({},fe,i)),this.init()}};var Xy=require("core-js/modules/es.typed-array.float32-array.js"),qy=require("core-js/modules/es.typed-array.at.js"),$y=require("core-js/modules/es.typed-array.fill.js"),Jy=require("core-js/modules/es.typed-array.find-last.js"),Qy=require("core-js/modules/es.typed-array.find-last-index.js"),tv=require("core-js/modules/es.typed-array.set.js"),ev=require("core-js/modules/es.typed-array.sort.js"),iv=require("core-js/modules/es.typed-array.to-reversed.js"),sv=require("core-js/modules/es.typed-array.to-sorted.js"),ov=require("core-js/modules/es.typed-array.with.js"),nv=require("core-js/modules/es.array-buffer.constructor.js"),rv=require("core-js/modules/es.array-buffer.slice.js"),av=require("core-js/modules/es.array-buffer.detached.js"),hv=require("core-js/modules/es.array-buffer.transfer.js"),cv=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),lv=require("core-js/modules/web.dom-collections.iterator.js"),Qt=require("three");var qe=class extends Qt.Object3D{init(){return f(this,null,function*(){this.initMaterial(),this.initMesh()})}initMaterial(){this.material=L.GetInstancedGraphicMaterial()}initMesh(){if(this.mesh&&this.remove(this.mesh),!this.elements)return;this.mesh=new Qt.InstancedMesh(this.geometry,this.material,this.elements.size);let t=new Qt.InstancedBufferAttribute(new Float32Array(this.elements.opacities),1),e=new Qt.InstancedBufferAttribute(new Float32Array(this.elements.maxZs),1);this.originOpacities=[...t.array],this.geometry.setAttribute("opacity",t),this.geometry.setAttribute("maxZ",e),this.mesh.instanceMatrix.set(this.elements.matrixes),this.mesh.instanceColor=new Qt.InstancedBufferAttribute(new Float32Array(this.elements.colors),3),this.add(this.mesh),this.mesh.instanceMatrix.needsUpdate=!0}setColorByIndex(t,e){this.mesh&&(this.mesh.setColorAt(t,new Qt.Color(e).convertLinearToSRGB()),this.mesh.instanceColor.needsUpdate=!0)}setOpacityByIndex(t,e){if(this.mesh){let i=this.geometry.getAttribute("opacity");i.setX(t,e),i.needsUpdate=!0}}setMatrixByIndex(t,e){this.mesh&&(this.mesh.setMatrixAt(t,e),this.mesh.instanceMatrix.needsUpdate=!0)}setMaxZByIndex(t,e){if(this.mesh){let i=this.geometry.getAttribute("maxZ");i.setX(t,e),i.needsUpdate=!0}}setColorById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setColorByIndex(i,e)}setOpacityById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setOpacityByIndex(i,e)}setMatrixById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setMatrixByIndex(i,e)}setMaxZById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setMaxZByIndex(i,e)}setOpacity(t,e){if(e===void 0&&(e=!1),!this.geometry)return;let i=this.geometry.getAttribute("opacity");for(let o=0;o<i.count;o++)if(e)i.array[o]=t;else{var s;i.array[o]=Math.min(t,(s=this.originOpacities[o])!=null?s:1)}i.needsUpdate=!0}pushElements(t){this.elements?(this.elements.size+=t.size,this.elements.colors=[...this.elements.colors,...t.colors],this.elements.matrixes=[...this.elements.matrixes,...t.matrixes],this.elements.opacities=[...this.elements.opacities,...t.opacities],this.elements.maxZs=[...this.elements.maxZs,...t.maxZs],this.elements.ids=[...this.elements.ids,...t.ids],this.originOpacities=[...this.originOpacities,...t.opacities]):this.elements=t,this.refesh()}removeInstanceById(t){if(this.elements){if(this.mesh){let e=this.elements.ids.indexOf(t);e!==-1&&(this.elements.size--,this.elements.colors.splice(e*3,3),this.elements.matrixes.splice(e*16,16),this.elements.opacities.splice(e,1),this.elements.maxZs.splice(e,1),this.elements.ids.splice(e,1),this.originOpacities.splice(e,1))}this.refesh()}}refesh(){this.mesh&&(this.mesh.dispose(),this.remove(this.mesh)),this.init()}dispose(){var t;this.material=null,this.originOpacities.length=0,this.geometry.dispose(),(t=this.mesh)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.geometry=new Qt.BoxGeometry(1,1,1),this.material=null,this.elements=null,this.originOpacities=[],this.elements=e,this.init()}};var mv=require("core-js/modules/es.typed-array.float32-array.js"),fv=require("core-js/modules/es.typed-array.at.js"),gv=require("core-js/modules/es.typed-array.fill.js"),yv=require("core-js/modules/es.typed-array.find-last.js"),vv=require("core-js/modules/es.typed-array.find-last-index.js"),xv=require("core-js/modules/es.typed-array.set.js"),wv=require("core-js/modules/es.typed-array.sort.js"),Mv=require("core-js/modules/es.typed-array.to-reversed.js"),_v=require("core-js/modules/es.typed-array.to-sorted.js"),Pv=require("core-js/modules/es.typed-array.with.js"),bv=require("core-js/modules/es.array-buffer.constructor.js"),Sv=require("core-js/modules/es.array-buffer.slice.js"),Ev=require("core-js/modules/es.array-buffer.detached.js"),Lv=require("core-js/modules/es.array-buffer.transfer.js"),Cv=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Tv=require("core-js/modules/web.dom-collections.iterator.js"),ne=require("three");var is=class extends ne.Object3D{init(){return f(this,null,function*(){this.initMaterial(),this.initMesh()})}initMaterial(){this.material=L.GetInstancedWallMaterial()}initMesh(){if(this.mesh&&this.remove(this.mesh),!this.elements)return;this.mesh=new ne.InstancedMesh(this.geometry,this.material,this.elements.size);let t=new ne.InstancedBufferAttribute(new Float32Array(this.elements.opacities),1),e=new ne.InstancedBufferAttribute(new Float32Array(this.elements.maxZs),1),i=new ne.InstancedBufferAttribute(new Float32Array(this.elements.minZs),1);this.originOpacities=[...t.array],this.geometry.setAttribute("opacity",t),this.geometry.setAttribute("maxZ",e),this.geometry.setAttribute("minZ",i),this.mesh.instanceMatrix.set(this.elements.matrixes),this.mesh.instanceColor=new ne.InstancedBufferAttribute(new Float32Array(this.elements.colors),3),this.add(this.mesh),this.mesh.instanceMatrix.needsUpdate=!0}setOpacityByIndex(t,e){if(this.mesh){let i=this.geometry.getAttribute("opacity");i.setX(t,e),i.needsUpdate=!0}}setOpacity(t,e){e===void 0&&(e=!1),this.elements&&this.elements.opacities.forEach((i,s)=>{let o=e?t:Math.min(t,this.originOpacities[s]);this.setOpacityByIndex(s,o)})}dispose(){this.mesh&&(this.mesh.dispose(),this.remove(this.mesh)),this.material=null,this.geometry&&this.geometry.dispose(),this.elements=null}constructor(t,e){super(),this.geometry=new ne.BoxGeometry(1,1,1),this.material=null,this.elements=null,this.originOpacities=[],this.elements=e,this.init()}};var li=require("three");var Re=class extends li.Object3D{init(){return f(this,null,function*(){this.initLineGeometry(),this.initLineMaterial(),this.createBorder()})}initLineMaterial(){return this.lineMaterial=L.GetMergeAttributeGraphicLineMaterial()}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.loader.parseGeometries([this.options]);this.lineGeometry=t[this.options.uuid]}createBorder(){this.line&&this.remove(this.line);let t=new li.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;(t=this.lineGeometry)==null||t.dispose(),this.lineMaterial=null,this.clear()}constructor(t,e){super(),this.context=t,this.lineMaterial=null,this.loader=new li.ObjectLoader,this.options=x({},fe,e),this.init()}};var Vr=require("three"),Zs=class extends Ht{setEnable(t){super.setEnable(t),Ct(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:i,clientHeight:s}}}=this,o=O(this.startPoint,e,i,s),n=O(this.endPoint,e,i,s),r={x:Math.min(o.x,n.x),y:Math.min(o.y,n.y)},h={x:Math.max(o.x,n.x),y:Math.max(o.y,n.y)},c=this.searchMapInFrustum(r,h);this.dispatchEvent({type:"selected",list:c})}}searchMapInFrustum(t,e){var i;let{context:s}=this;return((i=s.currentFloor)==null?void 0:i.graphicLayer.children.filter(o=>o instanceof gt&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,i){let{context:{camera:s,container:{clientWidth:o,clientHeight:n}}}=this;if(!t)return!1;if(!t.mesh){let d=t.getPosition();if(d){let u=O(d,s,o,n);return Me(u,e,i)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let r=t.mesh.geometry.boundingBox;if(!r)return!1;let{min:h,max:c}=r,l=O(h,s,o,n),p=O(c,s,o,n);return!(!Me(l,e,i)||!Me(p,e,i))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new Vr.Frustum,this.onPointerDown=s=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(s);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=s=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(s);o&&(this.endPoint=o)},this.onPointerUp=s=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(s);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let s=this.getSvgCoordinate(this.startPoint),o=x({},s);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(s.x,o.x),y:Math.min(s.y,o.y)},r=Math.abs(o.x-s.x),h=Math.abs(o.y-s.y);Ct(this.rect,n.x,n.y,r,h)}else Ct(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:i}}}=t;this.rect=_e(i,e),this.svg.appendChild(this.rect),this.registryEvent()}};var ss=class extends Kr.EventDispatcher{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.context=t,this._list=new Set,this.downPoint=null,this.downTime=0,this.isMultipleSelect=!1,this.onPointerDown=e=>{Date.now()-this.downTime<200||(this.downPoint={x:e.offsetX,y:e.offsetY},this.downTime=Date.now())},this.onPointerUp=e=>{if(!this.downPoint)return;let{offsetX:i,offsetY:s}=e,{x:o,y:n}=this.downPoint;if(Math.sqrt((o-i)**2+(n-s)**2)>3)return;let{graphics:r}=this.context.getGraphicsByDeviceXy(i,s),h=new Set(r.map(l=>l.options.id));this.context.getPoisByDeviceXy(i,s).forEach(l=>{if(!h.has(l.options.id)){var p;let d=((p=this.context.currentFloor)==null?void 0:p.graphicLayer.graphicMap.get(l.options.id))||null;d&&d.options.geometry.type==="point"&&(r.push(d),h.add(l.options.id))}}),(Ne?e.metaKey:e.ctrlKey)||this._list.clear(),r.forEach(l=>this._list.add(l)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{Ze(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Ze(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:i}=e;this._list.clear(),i.forEach(s=>{this._list.add(s)}),this.selectEnd()},this.boxSelection=new Zs(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var tx=require("core-js/modules/es.set.difference.v2.js"),ex=require("core-js/modules/es.set.intersection.v2.js"),ix=require("core-js/modules/es.set.is-disjoint-from.v2.js"),sx=require("core-js/modules/es.set.is-subset-of.v2.js"),ox=require("core-js/modules/es.set.is-superset-of.v2.js"),nx=require("core-js/modules/es.set.symmetric-difference.v2.js"),rx=require("core-js/modules/es.set.union.v2.js"),ax=require("core-js/modules/web.dom-collections.iterator.js");var js=require("three");var os=class extends js.EventDispatcher{handleHoverGraphicsChange(t){t===void 0&&(t=this.curGraphics),this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new $,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:i,pois:s,e:o}=e,n=s.map(l=>{var p;return(p=this.context.currentFloor)==null?void 0:p.graphicLayer.graphicMap.get(l.options.id)}).filter(l=>l&&l.options.geometry.type==="point");if(!i.length&&!n.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:r}=this.context.config.hover,h=new Set;if(n.length){let l,p=1e4;n.forEach(d=>{let u=s.find(m=>m.options.id===d.options.id);if(u instanceof Ae){let{x:m,y:g}=u.clientPos,y=Math.sqrt((m-o.offsetX)**2+(g-o.offsetY)**2);y<p&&(p=y,l=d)}else if(u instanceof rt){let{x:m,y:g}=u.box.getCenter(new js.Vector2),y=Math.sqrt((m-o.offsetX)**2+(g-o.offsetY)**2);y<p&&(p=y,l=d)}}),h.add(l)}h.size||i.forEach(l=>h.add(l)),h.forEach(l=>{if(this.graphicTimerMap.get(l)||this.curGraphics.has(l))return;let p=this.timer.setTimeout(()=>{this.curGraphics.add(l),this.graphicTimerMap.delete(l),this.timer.clearTimeout(p),this.handleHoverGraphicsChange()},r);this.graphicTimerMap.set(l,p)}),this.graphicTimerMap.forEach((l,p)=>{h.has(p)||(this.timer.clearTimeout(l),this.graphicTimerMap.delete(p))});let c=this.curGraphics.size;this.curGraphics.forEach(l=>{h.has(l)||this.curGraphics.delete(l)}),c!==this.curGraphics.size&&this.handleHoverGraphicsChange()},this.onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()},this.onBodyPointerMove=e=>{if(this.curGraphics.size){let i=this.context.container.getBoundingClientRect();(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom)&&this.onPointerLevel()}},this.registryEvent()}};var px=require("core-js/modules/web.dom-collections.iterator.js"),Zt=require("three");var ns=require("@turf/turf"),Vs=class{updateBox(){this.box.setFromObject(this.context.scene)}setEnable(t){this.enable=t,t?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(m=>m instanceof oe).length)return null;let e=this.box,{camera:i,clientSize:{width:s,height:o}}=this.context,{min:n,max:r}=e,c=[new Zt.Vector3(n.x,n.y,n.z),new Zt.Vector3(r.x,n.y,n.z),new Zt.Vector3(n.x,r.y,n.z),new Zt.Vector3(r.x,r.y,n.z),new Zt.Vector3(n.x,n.y,r.z),new Zt.Vector3(r.x,n.y,r.z),new Zt.Vector3(n.x,r.y,r.z),new Zt.Vector3(r.x,r.y,r.z)].map(m=>O(m,i,s,o)),l=Math.min(...c.map(m=>m.x)),p=Math.max(...c.map(m=>m.x)),d=Math.min(...c.map(m=>m.y)),u=Math.max(...c.map(m=>m.y));return{left:l,right:p,top:d,bottom:u}}checkDistanceToScreenEdge(t){let{left:e,right:i,top:s,bottom:o}=t,{width:n,height:r}=this.context.clientSize,[h,c,l,p]=this.context.config.cameraBound.padding,d=(0,ns.polygon)([[[e,s],[i,s],[i,o],[e,o],[e,s]]]),u=(0,ns.polygon)([[[p,h],[n-c,h],[n-c,r-l],[p,r-l],[p,h]]]);try{return(0,ns.intersect)(d,u)!==null}catch(m){return console.warn("\u8BA1\u7B97\u4EA4\u96C6\u51FA\u9519:",m),!1}}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new Zt.Vector3,zoom:1,target:new Zt.Vector3},this.enable=!0,this.box=new Zt.Box3,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:i,right:s,top:o,bottom:n}=e;this.checkDistanceToScreenEdge({left:i,right:s,top:o,bottom:n})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var vx=require("core-js/modules/es.promise.finally.js"),qo=require("three"),$e=require("@tweenjs/tween.js");var fx=require("core-js/modules/web.dom-collections.iterator.js"),gx=require("core-js/modules/es.array.push.js"),b=require("three"),Ks=new b.Ray,Yr=new b.Plane,_h=Math.cos(70*b.MathUtils.DEG2RAD),Ys=class extends b.EventDispatcher{dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerUp),this.domElement.removeEventListener("wheel",this.onMouseWheel),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp),this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null)}constructor(t,e){super(),this.rotateLineStart=new b.Vector2,this.rotateLineEnd=new b.Vector2,this.spherical=new b.Spherical,this.sphericalDelta=new b.Spherical,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new b.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.screenSpacePanning=!1,this.mouseButtons={LEFT:b.MOUSE.PAN,MIDDLE:b.MOUSE.DOLLY,RIGHT:b.MOUSE.ROTATE},this.touches={ONE:b.TOUCH.PAN,TWO:b.TOUCH.DOLLY_ROTATE},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return r.phi},this.getAzimuthalAngle=function(){return r.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(v){v.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=v},this.stopListenToKeyEvents=function(){var v;(v=this._domElementKeyEvents)==null||v.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent({type:"change"}),i.update(),o=s.NONE},this.update=function(){let v=new b.Vector3,_=new b.Quaternion().setFromUnitVectors(t.up,new b.Vector3(0,1,0)),Y=_.clone().invert(),ct=new b.Vector3,zt=new b.Quaternion,he=new b.Vector3,ee=2*Math.PI;return function(Mi){Mi===void 0&&(Mi=null);let ve=i.object.position;v.copy(ve).sub(i.target),v.applyQuaternion(_),r.setFromVector3(v),i.autoRotate&&o===s.NONE&&T(A(Mi)),i.enableDamping?(r.theta+=h.theta*i.dampingFactor,r.phi+=h.phi*i.dampingFactor):(r.theta+=h.theta,r.phi+=h.phi);let xe=i.minAzimuthAngle,we=i.maxAzimuthAngle;isFinite(xe)&&isFinite(we)&&(xe<-Math.PI?xe+=ee:xe>Math.PI&&(xe-=ee),we<-Math.PI?we+=ee:we>Math.PI&&(we-=ee),xe<=we?r.theta=Math.max(xe,Math.min(we,r.theta)):r.theta=r.theta>(xe+we)/2?Math.max(xe,r.theta):Math.min(we,r.theta)),r.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,r.phi)),r.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(l,i.dampingFactor):i.target.add(l),i.zoomToCursor&&q||i.object.isOrthographicCamera?r.radius=K(r.radius):r.radius=K(r.radius*c),v.setFromSpherical(r),v.applyQuaternion(Y),ve.copy(i.target).add(v),i.object.lookAt(i.target),i.enableDamping===!0?(h.theta*=1-i.dampingFactor,h.phi*=1-i.dampingFactor,l.multiplyScalar(1-i.dampingFactor)):(h.set(0,0,0),l.set(0,0,0));let Ms=!1;if(i.zoomToCursor&&q){let _i=null;if(i.object.isPerspectiveCamera){let Pi=v.length();_i=K(Pi*c);let _s=Pi-_i;i.object.position.addScaledVector(k,_s),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){let Pi=new b.Vector3(D.x,D.y,0);Pi.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),Ms=!0;let _s=new b.Vector3(D.x,D.y,0);_s.unproject(i.object),i.object.position.sub(_s).add(Pi),i.object.updateMatrixWorld(),_i=v.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;_i!==null&&(i.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(_i).add(i.object.position):(Ks.origin.copy(i.object.position),Ks.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(Ks.direction))<_h?t.lookAt(i.target):(Yr.setFromNormalAndCoplanarPoint(i.object.up,i.target),Ks.intersectPlane(Yr,i.target))))}else i.object.isOrthographicCamera&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),Ms=!0);return c=1,q=!1,Ms||ct.distanceToSquared(i.object.position)>n||8*(1-zt.dot(i.object.quaternion))>n||he.distanceToSquared(i.target)>0?(i.dispatchEvent({type:"change"}),ct.copy(i.object.position),zt.copy(i.object.quaternion),he.copy(i.target),Ms=!1,!0):!1}}();let i=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=s.NONE,n=1e-6,r=new b.Spherical,h=new b.Spherical,c=1,l=new b.Vector3,p=new b.Vector2,d=new b.Vector2,u=new b.Vector2,m=new b.Vector2,g=new b.Vector2,y=new b.Vector2,w=new b.Vector2,M=new b.Vector2,P=new b.Vector2,k=new b.Vector3,D=new b.Vector2,q=!1,E=[],Q={};function A(v){return v!==null?2*Math.PI/60*i.autoRotateSpeed*v:2*Math.PI/60/60*i.autoRotateSpeed}function I(){return Math.pow(.95,i.zoomSpeed)}function T(v){h.theta-=v}function H(v){h.phi-=v}let ot=function(){let v=new b.Vector3;return function(Y,ct){v.setFromMatrixColumn(ct,0),v.multiplyScalar(-Y),l.add(v)}}(),V=function(){let v=new b.Vector3;return function(Y,ct){i.screenSpacePanning===!0?v.setFromMatrixColumn(ct,1):(v.setFromMatrixColumn(ct,0),v.crossVectors(i.object.up,v)),v.multiplyScalar(Y),l.add(v)}}(),B=function(){let v=new b.Vector3;return function(Y,ct){let zt=i.domElement;if(i.object.isPerspectiveCamera){let he=i.object.position;v.copy(he).sub(i.target);let ee=v.length();ee*=Math.tan(i.object.fov/2*Math.PI/180),ot(2*Y*ee/zt.clientHeight,i.object.matrix),V(2*ct*ee/zt.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(ot(Y*(i.object.right-i.object.left)/i.object.zoom/zt.clientWidth,i.object.matrix),V(ct*(i.object.top-i.object.bottom)/i.object.zoom/zt.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function ge(v){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=v:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function Ce(v){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=v:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function N(v){if(!i.zoomToCursor)return;q=!0;let _=i.domElement.getBoundingClientRect(),Y=v.clientX-_.left,ct=v.clientY-_.top,zt=_.width,he=_.height;D.x=Y/zt*2-1,D.y=-(ct/he)*2+1,k.set(D.x,D.y,1).unproject(i.object).sub(i.object.position).normalize()}function K(v){return Math.max(i.minDistance,Math.min(i.maxDistance,v))}function ht(v){p.set(v.clientX,v.clientY)}function nt(v){N(v),w.set(v.clientX,v.clientY)}function re(v){m.set(v.clientX,v.clientY)}function ae(v){d.set(v.clientX,v.clientY),u.subVectors(d,p).multiplyScalar(i.rotateSpeed);let _=i.domElement;T(2*Math.PI*u.x/_.clientHeight),H(2*Math.PI*u.y/_.clientHeight),p.copy(d),i.update()}function Te(v){M.set(v.clientX,v.clientY),P.subVectors(M,w),P.y>0?ge(I()):P.y<0&&Ce(I()),w.copy(M),i.update()}function ye(v){g.set(v.clientX,v.clientY),y.subVectors(g,m).multiplyScalar(i.panSpeed),B(y.x,y.y),m.copy(g),i.update()}function wi(v){N(v),v.deltaY<0?Ce(I()):v.deltaY>0&&ge(I()),i.update()}function wa(v){let _=!1;switch(v.code){case i.keys.UP:v.ctrlKey||v.metaKey||v.shiftKey?H(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):B(0,i.keyPanSpeed),_=!0;break;case i.keys.BOTTOM:v.ctrlKey||v.metaKey||v.shiftKey?H(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):B(0,-i.keyPanSpeed),_=!0;break;case i.keys.LEFT:v.ctrlKey||v.metaKey||v.shiftKey?T(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):B(i.keyPanSpeed,0),_=!0;break;case i.keys.RIGHT:v.ctrlKey||v.metaKey||v.shiftKey?T(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):B(-i.keyPanSpeed,0),_=!0;break}_&&(v.preventDefault(),i.update())}function En(){if(E.length===1)p.set(E[0].pageX,E[0].pageY);else{let v=(E[0].pageX-E[0].pageY)/(E[1].pageX-E[1].pageY),_=E[0].pageY-v*E[0].pageX;i.rotateLineStart.set(v,_);let Y=.5*(E[0].pageX+E[1].pageX),ct=.5*(E[0].pageY+E[1].pageY);p.set(Y,ct)}}function Ln(){if(E.length===1)m.set(E[0].pageX,E[0].pageY);else{let v=.5*(E[0].pageX+E[1].pageX),_=.5*(E[0].pageY+E[1].pageY);m.set(v,_)}}function Cn(){let v=E[0].pageX-E[1].pageX,_=E[0].pageY-E[1].pageY,Y=Math.sqrt(v*v+_*_);w.set(0,Y)}function Ma(){i.enableZoom&&Cn(),i.enablePan&&Ln()}function _a(){i.enableZoom&&Cn(),i.enableRotate&&En()}function Tn(v){if(E.length==1)d.set(v.pageX,v.pageY);else{let Y=mo(v),ct=.5*(v.pageX+Y.x),zt=.5*(v.pageY+Y.y);d.set(ct,zt);let he=(v.pageY-Y.y)/(v.pageX-Y.x),ee=Y.y-he*Y.x;if(i.rotateLineEnd.set(he,ee),Number.isFinite(i.rotateLineEnd.x)&&Number.isFinite(i.rotateLineStart.x)){let fo=(i.rotateLineStart.y-i.rotateLineEnd.y)/(i.rotateLineEnd.x-i.rotateLineStart.x),Mi=he*fo+ee;if(Number.isFinite(fo)&&Number.isFinite(Mi)){let ve=Math.atan(i.rotateLineEnd.x)-Math.atan(i.rotateLineStart.x);Math.PI-Math.abs(ve)<.5&&(ve=-Math.sign(ve)*(Math.PI-Math.abs(ve))),Math.abs(ve)<.1&&(h.theta+=ve)}}i.rotateLineStart.copy(i.rotateLineEnd)}u.subVectors(d,p).multiplyScalar(i.rotateSpeed);let _=i.domElement;H(2*Math.PI*u.y/_.clientHeight),p.copy(d)}function kn(v){if(E.length===1)g.set(v.pageX,v.pageY);else{let _=mo(v),Y=.5*(v.pageX+_.x),ct=.5*(v.pageY+_.y);g.set(Y,ct)}y.subVectors(g,m).multiplyScalar(i.panSpeed),B(y.x,y.y),m.copy(g)}function Dn(v){let _=mo(v),Y=v.pageX-_.x,ct=v.pageY-_.y,zt=Math.sqrt(Y*Y+ct*ct);M.set(0,zt),P.set(0,Math.pow(M.y/w.y,i.zoomSpeed)),ge(P.y),w.copy(M)}function Pa(v){i.enableZoom&&Dn(v),i.enablePan&&kn(v)}function ba(v){i.enableZoom&&Dn(v),i.enableRotate&&Tn(v)}this.onPointerDown=function(_){i.enabled!==!1&&(E.length===0&&(i.domElement.setPointerCapture(_.pointerId),i.domElement.addEventListener("pointermove",i.onPointerMove),i.domElement.addEventListener("pointerup",i.onPointerUp)),Ta(_),_.pointerType==="touch"?La(_):Sa(_))},this.onPointerMove=function(_){i.enabled!==!1&&(_.pointerType==="touch"?Ca(_):Ea(_))},this.onPointerUp=function(_){ka(_),E.length===0&&(i.domElement.releasePointerCapture(_.pointerId),i.domElement.removeEventListener("pointermove",i.onPointerMove),i.domElement.removeEventListener("pointerup",i.onPointerUp)),i.dispatchEvent({type:"end"}),o=s.NONE};function Sa(v){let _;switch(v.button){case 0:_=i.mouseButtons.LEFT;break;case 1:_=i.mouseButtons.MIDDLE;break;case 2:_=i.mouseButtons.RIGHT;break;default:_=-1}switch(_){case b.MOUSE.DOLLY:if(i.enableZoom===!1)return;nt(v),o=s.DOLLY;break;case b.MOUSE.ROTATE:if(v.ctrlKey||v.metaKey||v.shiftKey){if(i.enablePan===!1)return;re(v),o=s.PAN}else{if(i.enableRotate===!1)return;ht(v),o=s.ROTATE}break;case b.MOUSE.PAN:if(v.ctrlKey||v.metaKey||v.shiftKey){if(i.enableRotate===!1)return;ht(v),o=s.ROTATE}else{if(i.enablePan===!1)return;re(v),o=s.PAN}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent({type:"start"})}function Ea(v){switch(o){case s.ROTATE:if(i.enableRotate===!1)return;ae(v);break;case s.DOLLY:if(i.enableZoom===!1)return;Te(v);break;case s.PAN:if(i.enablePan===!1)return;ye(v);break}}this.onMouseWheel=function(_){i.enabled===!1||i.enableZoom===!1||o!==s.NONE||(_.preventDefault(),i.dispatchEvent({type:"start"}),wi(_),i.dispatchEvent({type:"end"}))},this.onKeyDown=function(_){i.enabled===!1||i.enablePan===!1||wa(_)};function La(v){switch(An(v),E.length){case 1:switch(i.touches.ONE){case b.TOUCH.ROTATE:if(i.enableRotate===!1)return;En(),o=s.TOUCH_ROTATE;break;case b.TOUCH.PAN:if(i.enablePan===!1)return;Ln(),o=s.TOUCH_PAN;break;default:o=s.NONE}break;case 2:switch(i.touches.TWO){case b.TOUCH.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Ma(),o=s.TOUCH_DOLLY_PAN;break;case b.TOUCH.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;_a(),o=s.TOUCH_DOLLY_ROTATE;break;default:o=s.NONE}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent({type:"start"})}function Ca(v){switch(An(v),o){case s.TOUCH_ROTATE:if(i.enableRotate===!1)return;Tn(v),i.update();break;case s.TOUCH_PAN:if(i.enablePan===!1)return;kn(v),i.update();break;case s.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Pa(v),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;ba(v),i.update();break;default:o=s.NONE}}this.onContextMenu=function(_){i.enabled!==!1&&_.preventDefault()};function Ta(v){E.push(v)}function ka(v){delete Q[v.pointerId];for(let _=0;_<E.length;_++)if(E[_].pointerId==v.pointerId){E.splice(_,1);return}}function An(v){let _=Q[v.pointerId];_===void 0&&(_=new b.Vector2,Q[v.pointerId]=_),_.set(v.pageX,v.pageY)}function mo(v){let _=v.pointerId===E[0].pointerId?E[1]:E[0];return Q[_.pointerId]}i.domElement.addEventListener("contextmenu",this.onContextMenu),i.domElement.addEventListener("pointerdown",this.onPointerDown),i.domElement.addEventListener("pointercancel",this.onPointerUp),i.domElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),this.update()}};var rs=class extends Ys{registryEvent(){this.addEventListener("change",this.onChange),this.context.addEventListener("update",this.tweenUpdate)}unRegistryEvent(){this.removeEventListener("change",this.onChange),this.context.removeEventListener("update",this.tweenUpdate)}setPolarAngle(t,e){e===void 0&&(e=!1);let{maxPolarAngle:i,minPolarAngle:s}=this,o=i===s;(e||t<=i&&t>=s)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=i,this.minPolarAngle=s)}setPolarAngleByDuration(t,e,i){return f(this,null,function*(){return e===void 0&&(e=!1),i===void 0&&(i=500),i<=0?this.setPolarAngle(t,e):Wt(new Promise(s=>{let o={polar:this.getPolarAngle()},n={polar:t},r=new $e.Tween(o,this.tweenGroup).to(n,i).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(r),s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:i,minAzimuthAngle:s}=this,o=i===s;(e||t<=i&&t>=s)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=i,this.minAzimuthAngle=s)}setAzimuthalAngleDuration(t,e,i){return e===void 0&&(e=!1),i===void 0&&(i=500),i<=0?this.setAzimuthalAngle(t,e):Wt(new Promise(s=>{let o={azimuthal:this.getAzimuthalAngle()},n={azimuthal:t},r=new $e.Tween(o,this.tweenGroup).to(n,i).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(r),s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)}getCameraLookAt(){return new qo.Vector3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return f(this,null,function*(){let i=this.target.clone(),s=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(s)),this.target.copy(t.clone()),this.update();return}return Wt(new Promise(o=>{let n=new $e.Tween(i,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(i.clone().sub(s)),this.target.copy(i.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(n),this.enabled=!0,o(!0)}).onStart(()=>{this.enabled=!1}).start()}),e+500)})}setZoom(t,e,i){i===void 0&&(i=!1);let{minZoom:s,maxZoom:o}=this;(i||t>=s&&t<=o)&&(this.camera.position.copy(e.clone().sub(this.getCameraLookAt())),this.target.copy(e),this.camera.zoom=t,this.update())}setZoomByDuration(t,e,i,s){return f(this,null,function*(){i===void 0&&(i=!1),s===void 0&&(s=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return s?Wt(new Promise(n=>{let r=new $e.Tween(o,this.tweenGroup).to({zoom:t,target:e},s).onUpdate(()=>{this.setZoom(o.zoom,o.target,i)}).onComplete(()=>{this.tweenGroup.remove(r),this.enabled=!0,n(!0)}).onStart(()=>{this.enabled=!1}).start()}),s+500).finally(()=>{this.enabled=!0}):this.setZoom(t,e,i)})}setTargetByOffset(t,e){if(e===void 0&&(e=this.target.clone()),this.camera.updateMatrix(),t){let i=new qo.Vector3;i.setFromMatrixColumn(this.camera.matrix,1),i.normalize(),i.multiplyScalar(t/this.camera.zoom),e.add(i)}this.setCameraPositionByTarget(e,0)}clearTween(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}dispose(){super.dispose(),this.unRegistryEvent(),this.clearTween()}constructor(t,e,i){super(e,i),this.context=t,this.camera=e,this.domElement=i,this.prevCameraZoom=1,this.tweenGroup=new $e.Group,this.offsetY=0,this.onChange=()=>{let s=this.camera.zoom;s!==this.prevCameraZoom&&(this.prevCameraZoom=s,this.dispatchEvent({type:"change-zoom",zoom:s}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};var pi=require("three");var as=class extends pi.WebGLRenderer{setCameraAndScene(t,e){this.scene=t,this.camera=e}autoRender(){if(this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.context.config.renderAnimation==="requestAnimationFrame")this.timer.requestAnimationFrame(()=>{this.autoRender()});else{let t=1e3/this.context.config.fps;this.timer.setTimeout(()=>{this.autoRender()},t)}}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(t,e){this.event.addEventListener(t,e)}removeEventListener(t,e){this.event.removeEventListener(t,e)}constructor(t,e){super(x({antialias:!0,alpha:!0},e)),this.context=t,this.event=new pi.EventDispatcher,this.enable=!0,this.timer=new $,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.toneMapping=pi.LinearToneMapping,this.toneMappingExposure=1;let i=this.dispose;this.dispose=()=>{this.timer.dispose(),this.enable=!1,i.call(this),this.domElement.remove(),this.domElement=null,this.shadowMap=null,this.info.programs&&(this.info.programs.length=0),this.info=null}}};var Jr=require("three");var Xr=require("three"),qr=require("three/examples/jsm/environments/RoomEnvironment.js");function $r(a,t){t===void 0&&(t=.85);let e=new Xr.PMREMGenerator(a);return e.compileEquirectangularShader(),e.fromScene(new qr.RoomEnvironment).texture}var hs=class extends Jr.Scene{dispose(){var t;(t=this.environment)==null||t.dispose(),this.environment=null,G(this),this.clear()}constructor(t){super(),this.environment=$r(t)}};var Qr=require("three"),cs=class extends Qr.OrthographicCamera{constructor(t,e){super(-t/2,t/2,e/2,-e/2,-1e4,5e4),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var $o=require("@turf/turf");var Dx=require("core-js/modules/es.array.unshift.js"),Ax=require("core-js/modules/es.array.push.js"),ta=require("three"),Xs=class{registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-change",this.onControlChange),this.context.addEventListener("resize",this.onControlChange)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-change",this.onControlChange),this.context.removeEventListener("resize",this.onControlChange)}changePoiLevelOrCollisionEnable(t){let e=this.objects.findIndex(i=>i===t);e!==-1&&(this.objects.splice(e,1),this.addObject(t))}addObject(t){if(!this.objects.includes(t)){if(this.needsUpdate=!0,!t.options.collision_enable){this.objects.unshift(t);return}if(t.options.level===0){this.objects.push(t);return}for(let e=0;e<this.objects.length;e++){let i=this.objects[e];if(i.options.collision_enable&&i.options.level<=t.options.level){this.objects.splice(e,0,t);return}}this.objects.push(t)}}removeObject(t){let e=this.objects.indexOf(t);e!==-1&&(this.objects.splice(e,1),this.needsUpdate=!0)}removeObjects(t){this.objects=this.objects.filter(e=>!t.includes(e)),this.needsUpdate=!0}getObjectById(t){return this.objects.find(e=>e.options.id===t)||null}validShowParkingSpace(t){t===void 0&&(t=60);let{clientSize:{width:e,height:i},control:s,camera:o}=this.context,n=Math.min(e/t,i/t,s.maxZoom-1);return o.zoom>=n}detectCollisions(){if(!this.needsUpdate)return;let t=[],{camera:e}=this.context;e.updateMatrixWorld();let i=l=>l<=1&&l>=-1,s=e.projectionMatrix.clone();s.multiply(e.matrixWorldInverse);let o=e.zoom/this.context.basicZoom,n=25/30,r=Math.min(25,Math.max(1,o*n)),h=this.validShowParkingSpace();this.objects.filter(l=>{if(l.visible){if(!(r<=l.options.maxWeight&&r>=l.options.minWeight)||!h&&l.userData.type==="parkingSpace")return l.parentSetVisible(!1),!1;let p=l.getWorldPosition(new ta.Vector3);return p.applyMatrix4(s),l.screenPosition=p,i(p.x)&&i(p.y)&&i(p.z)?!0:(l.parentSetVisible(!1),!1)}return!1}).forEach((l,p)=>{let d=l.getBox(l.screenPosition);if(d===null){l.parentSetVisible(!1);return}if(p===0||!l.options.collision_enable){t.push(d),l.parentSetVisible(!0);return}let u=t.some(m=>m.intersectsBox(d));l.parentSetVisible(!u),u||t.push(d)}),this.needsUpdate=!1}markForUpdate(){this.needsUpdate=!0}clear(){this.objects=[],this.needsUpdate=!0}dispose(){this.objects=[],this.unRegistryEvent()}constructor(t){this.context=t,this.objects=[],this.needsUpdate=!0,this.onUpdate=()=>{this.detectCollisions()},this.onControlChange=()=>{this.needsUpdate=!0},this.registryEvent()}};var ls=class extends U.EventDispatcher{get config(){return this.bmap.config}get center(){return this.bmap.buildingCenter}setRange(t){this.range=(0,$o.polygon)([t])}resizeClientSize(){let{x:t,y:e,width:i,height:s}=this.container.getBoundingClientRect();this.clientSize={width:i||this.container.clientWidth,height:s||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new cs(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new rs(this,this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",this.onControlChange),this.control.addEventListener("change-zoom",this.onControlChangeZoom),this.renderer.addEventListener("update",this.onRendererUpdate),this.cameraBound=new Vs(this)}getRatio(t,e){t===void 0&&(t=new U.Vector3(0,0,0)),e===void 0&&(e=new U.Vector3(100,0,0));let{clientWidth:i,clientHeight:s}=this.container,o=O(t,this.camera,i,s),n=O(e,this.camera,i,s);return Math.ceil(Math.sqrt((n.x-o.x)**2+(n.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof U.AmbientLight&&(e.color=new U.Color(t))})}switchFloor(t,e){e===void 0&&(e=!0),console.log("switchFloor",e),this.currentFloor&&(this.scene.remove(this.currentFloor),e?this.currentFloor.dispose():this.currentFloor.onRemoveFromScene()),this.currentFloor=t,this.setRange(t.userData.range||[]),this.scene.add(t),t.onAddToScene("scene"),this.cameraBound.updateBox()}getGraphicsByDeviceXy(t,e){var i;let s=new U.Vector2;s.x=t/this.clientSize.width*2-1,s.y=e/this.clientSize.height*-2+1;let o=new U.Raycaster;return o.setFromCamera(s,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),((i=this.currentFloor)==null?void 0:i.graphicLayer.getGraphicByRaycaster(o))||{graphics:[],position:null}}getPoisByDeviceXy(t,e){var i,s;let o=(i=this.currentFloor)==null?void 0:i.poiLayer.getPoiByDeviceXy(t,e),n=(s=this.currentFloor)==null?void 0:s.poiLayer2.getPoiByDeviceXy(t,e);return(o||[]).concat(n||[])}registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange),this.control.removeEventListener("change",this.onControlChange),this.control.removeEventListener("change-zoom",this.onControlChangeZoom),this.renderer.removeEventListener("update",this.onRendererUpdate)}setPolarAngle(t,e){return e===void 0&&(e=500),this.control.setPolarAngleByDuration(t,!0,e)}setAzimuthalAngle(t,e){return e===void 0&&(e=500),this.control.setAzimuthalAngleDuration(t,!0,e)}getCameraLookAt(){return this.control.getCameraLookAt()}setZoom(t,e,i){return i===void 0&&(i=500),this.control.setZoomByDuration(t,e,!0,i)}getFitCameraToObjectZoom(t,e,i){return e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=!0),this.getFitCameraToBoxZoom(new U.Box3().setFromObject(t),e,i)}getFitCameraToBoxZoom(t,e,i){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=!0);let[s,o,n,r]=e,{clientSize:{width:h,height:c}}=this,l=this.control.getPolarAngle();i&&this.setPolarAngle(0,0),this.setPolarAngle(l,0);let{max:p,min:d}=t,u=new U.Vector3(d.x,p.y,p.z),m=new U.Vector3(p.x,p.y,p.z),g=new U.Vector3(p.x,d.y,d.z),y=new U.Vector3(d.x,d.y,d.z),w=O(u,this.camera,h,c),M=O(m,this.camera,h,c),P=O(y,this.camera,h,c),k=O(g,this.camera,h,c),q=new U.Box2().setFromPoints([new U.Vector2(w.x,w.y),new U.Vector2(M.x,M.y),new U.Vector2(P.x,P.y),new U.Vector2(k.x,k.y)]).getSize(new U.Vector2),E=(h-o-r)/q.x,Q=(c-s-n)/q.y,A=Math.min(E,Q),I=new U.Vector3((p.x+d.x)/2,(p.y+d.y)/2,(p.z+d.z)/2),T=A*this.camera.zoom,H=this.camera.clone();H.zoom=T,H.updateMatrix();let ot=(o-r)/2,V=(s-n)/2;if(ot){let B=new U.Vector3;B.setFromMatrixColumn(H.matrix,0),B.normalize(),B.multiplyScalar(ot/T),I.add(B)}if(V){let B=new U.Vector3;B.setFromMatrixColumn(H.matrix,1),B.normalize(),B.multiplyScalar(V/T),I.add(B)}return{zoom:A*this.camera.zoom,center:I}}fitCameraToObject(t,e,i,s){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500),s===void 0&&(s=!0);let{zoom:o,center:n}=this.getFitCameraToObjectZoom(t,e,s);return this.setZoom(o,n,i)}fitCameraToBox(t,e,i,s){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500),s===void 0&&(s=!0);let{zoom:o,center:n}=this.getFitCameraToBoxZoom(t,e,s);return this.setZoom(o,n,i)}getFitCameraToGroundZoom(t,e,i){if(t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),i===void 0&&(i=!0),this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,i).zoom}fitCameraToGround(t,e,i){return t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),i===void 0&&(i=!0),this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundLayer,t,e,i):Promise.resolve(!1)}setCameraPosition(t,e){return f(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}forceUpdate(){this.collisionSystem.needsUpdate=!0}dispose(){var t;this.collisionSystem.dispose(),(t=this.currentFloor)==null||t.dispose(),this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.dispose(),this.lights.children.forEach(e=>e.dispose()),this.scene.dispose(),this.container=null,this.renderer=null}constructor(t,e){super(),this.container=t,this.lights=vo(),this.range=(0,$o.polygon)([]),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,this.basicZoom=1,this.onControlChange=()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})},this.onControlChangeZoom=i=>{let{zoom:s}=i;this.dispatchEvent({type:"control-zoom-change",zoom:s})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:i,camera:s,renderer:o}=this,{clientWidth:n,clientHeight:r}=i;n=Math.max(1,n),r=Math.max(1,r),s.left=-n/2,s.right=n/2,s.top=r/2,s.bottom=-r/2,s.updateProjectionMatrix(),o.setSize(n,r),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:n,height:r})},this.onClick=i=>{let{graphics:s,position:o}=this.getGraphicsByDeviceXy(i.offsetX,i.offsetY);s.length&&this.dispatchEvent({type:"graphic-click",graphics:s,position:o});let n=this.getPoisByDeviceXy(i.offsetX,i.offsetY);n.length&&this.dispatchEvent({type:"poi-click",pois:n})},this.onPointerover=i=>{let{graphics:s,position:o}=this.getGraphicsByDeviceXy(i.offsetX,i.offsetY),n=this.getPoisByDeviceXy(i.offsetX,i.offsetY);this.dispatchEvent({type:"pointer-over",e:i,graphics:s,pois:n,position:o})},this.onPointermove=i=>{let{graphics:s,position:o}=this.getGraphicsByDeviceXy(i.offsetX,i.offsetY),n=this.getPoisByDeviceXy(i.offsetX,i.offsetY);this.dispatchEvent({type:"pointer-move",e:i,graphics:s,pois:n,position:o})},this.onPointerleave=i=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=i=>{let{graphics:s,isMultipleSelect:o}=i;this.dispatchEvent({type:"select-graphic",graphics:s,isMultipleSelect:o})},this.onHoverChange=i=>{let{graphics:s}=i;this.dispatchEvent({type:"hover",graphics:s})},this.bmap=e,this.container.style.position="relative",this.container.style.overflow="hidden",this.renderer=new as(this),this.scene=new hs(this.renderer),this.collisionSystem=new Xs(this),this.init(),this.selection=new ss(this),this.hoverHelper=new os(this),this.resizeClientSize(),this.registryEvent()}};var ea=require("lodash"),ia={placeId:0,fps:30,apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get",loadPlaceInfo:"https://screen.aibee.cn/ai-map/map/get-floor-map"},enableBoxSelect:!0,resizeObserver:{enable:!1,debounceTime:5},initTransToMark:!1,heatMap:{radius:50,minOpacity:.1,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0,maxZoomScale:30},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1},loaderPlaceConfig:{textFontSize:14},renderAnimation:"setTimeout"};function Jo(a){return typeof a.resizeObserver=="boolean"&&(a.resizeObserver={enable:a.resizeObserver}),(0,ea.merge)({},ia,a)}var ra=require("lodash");var n0=require("core-js/modules/web.dom-collections.iterator.js");var Js=require("three");var $x=require("core-js/modules/es.array.push.js"),Jx=require("core-js/modules/web.dom-collections.iterator.js");var Kx=require("core-js/modules/es.array.sort.js");var di=function(a){return a.LAYERED_RENDER_VERSION="layeredRender",a.MERGED_RENDER_VERSION="mergedRender",a}({});function qs(a,t){let e=a.poi_info.showName||a.store_name||a.poi_info.text;switch(t){case"zh-cn":return e;case"en":var i;return((i=a.store_info_ext)==null?void 0:i.poi_name)||e;case"zh-hk":var s;return((s=a.store_info_ext)==null?void 0:s.traditional_name)||e}}function $s(a,t){let e=a.poi_info.showName||a.store_name||a.poi_info.text;switch(t){case"zh-cn":return e;case"en":var i;return((i=a.infra_info_ext)==null?void 0:i.poi_name)||e;case"zh-hk":var s;return((s=a.infra_info_ext)==null?void 0:s.traditional_name)||e}}var Qo=["range","ground","store","facility","parkingSpace"];function sa(a){return Qo.indexOf(a.l_type)===-1?Qo.length:Qo.indexOf(a.l_type)}function Ph(a){a.layers.sort((t,e)=>sa(t)-sa(e))}function bh(a){let t=a.layers.find(i=>i.l_type==="range"),e=[t.elements[0].center_x,t.elements[0].center_y];a.layers.map(i=>{if(i.l_type!=="range")return Di(i.elements,e)})}function ps(a){Ph(a),bh(a)}function ui(a,t){return t===void 0&&(t=5),a.floor_id+"_"+a.version_id+(t?"_"+t:"")}function oa(a,t,e){switch(a.l_type){case"ground":return tn(a,t);case"graph":return Sh(a,t);case"wall":return Eh(a,t);case"lane":return Lh(a,t);case"texture2d":case"texture3d":return Ch(a,t);case"glb":return Th(a,t);case"store":return kh(a,t,e);case"facility":return Ah(a,t,e);case"parkingSpace":return Ih(a,t,e);case"text":return Fh(a,t)}}function na(a,t,e,i,s){switch(a.l_type){case"store":return Dh(a,t,e,i,s);case"facility":return Oh(a,t,e,i,s);case"parkingSpace":return Rh(a,t,i,s)}}function Sh(a,t){t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements)}function tn(a,t){let e=a.elements.map(i=>new gt(t.context,x({},i,{dashed:!1})));t.addGrounds(e)}function Eh(a,t){if(a.mergedElements)a.mergedElements.map(e=>{if(e.instancedGeometry){let i=new is(t.context,e.instancedGeometry);t.wallLayer.add(i)}if(e.mergedGeometry){let i=new ts(t.context,e);t.wallLayer.add(i)}});else{let e=a.elements.reduce((i,s)=>{let{fillColor:o,fillOpacity:n,strokeColor:r,strokeOpacity:h,height:c}=s,l=o.toLowerCase()+"-"+n+"-"+r.toLowerCase()+"-"+h+"-"+c;return h===0&&(l=o.toLowerCase()+"-"+n+"-"+c),i[l]?i[l].push(s):i[l]=[s],i},{});Object.values(e).forEach(i=>{let s=new $i(t.context,i);t.wallLayer.add(s)})}}function Lh(a,t){if(a.mergedElements){let e=new es(t.context,a.mergedElements);t.laneLayer.add(e)}else{let e=new Ji(t.context,a.elements);t.laneLayer.add(e)}}function Ch(a,t){if(a.mergedMatrixes)a.mergedMatrixes.map(e=>{let i=new Ie(t.context,e);t.textureLayer.add(i)});else if(a.elements.length){let e=new Oe(t.context,a.elements);t.textureLayer.add(e)}}function Th(a,t){t.glbModelLayer.addModels(a.elements.map(e=>x({},e,{url:e.secondUrl,rotate:e.secondRotate,width:e.secondWidth,center_x:e.center_coord_x,center_y:e.center_coord_y,deltaHeight:0})))}function kh(a,t,e){e.mergeGraphic?t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements):a.elements.map(i=>{let s=t.addGraphic(x({},i,{dashed:!1}));t.userData.graphics.push(s),t.userData.graphicMap.set(i.id,s)})}function Dh(a,t,e,i,s){a.elements.filter(o=>s.filterPoi(o)).map(o=>{try{let n=qs(o,e),r=new rt(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:n,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},icon_size:[24,24],level:o.poi_info.level||0,hide_text:!i.showStoreName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:i.textFontSize});t.poiLayer2.pushPoi(r),r&&(r.userData.type="store",r.userData.data=o,r.userData.floor=t.name)}catch(n){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",n,o)}})}function Ah(a,t,e){e.mergeGraphic?t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements):a.elements.map(i=>{let s=t.addGraphic(x({},i,{dashed:!1}));t.userData.graphics.push(s),t.userData.graphicMap.set(i.id,s)})}function Oh(a,t,e,i,s){a.elements.filter(o=>o.poi_info).filter(o=>s.filterPoi(o)).map(o=>{try{let n=$s(o,e),r=new rt(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:n,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},icon_size:[24,24],level:o.poi_info.level||0,hide_text:!i.showFacilityName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:i.textFontSize});t.poiLayer2.pushPoi(r),r.userData.type="facility",r.userData.data=o,r.userData.floor=t.name}catch(n){console.log("\u6DFB\u52A0facility\u5931\u8D25",n,o)}})}function Ih(a,t,e){t.parkingSpaceLayer.load(a,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function Rh(a,t,e,i){return f(this,null,function*(){a.elements.filter(o=>o.texts[0]).filter(o=>i.filterPoi(o)).forEach(o=>{try{let n=o.displayName||o.texts[0],r=new rt(t.context,{id:o.id,text:n,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},text_font_size:e.textFontSize});r&&(r.userData.type="parkingSpace",r.userData.data=o,r.userData.floor=t.name),t.poiLayer2.pushPoi(r)}catch(n){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",n,o)}})})}function Fh(a,t){let e=new Qi(t.context,a.elements.map(i=>x({},i,{center_x:i.center_coord_x,center_y:i.center_coord_y})));t.textTextureLayer.add(e)}var Gh={};function en(){return new Worker(new URL("./worker/loader.worker-IS25OEA2.js",Gh.url))}var zh={mergeParkingSpace:!0,mergeGraphic:!0,renderVersion:di.MERGED_RENDER_VERSION,layers:["graph","wall","lane","texture2d","texture3d","glb","store","facility","parkingSpace","text"],filterPoi:()=>!0},Je=class extends lt{initDb(){return f(this,null,function*(){try{let{db:t}=yield ks();this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return f(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=x({},this.placeConfig,e));else if(typeof t=="string"){let i=yield fetch(t).then(s=>s.json());i.code===200&&(this.floors=i.data.list,this.placeConfig=x({},this.placeConfig,JSON.parse(i.data.config||"{}")))}else return this.load("https://screen.aibee.cn/ai-map/map/get-floor-map?place_id="+t);this.getOtherDataByFreeTime()})}setCacheData(t,e,i){return f(this,null,function*(){return this.initDbPromise.then(()=>Ds(t,""+e,i))})}getCacheData(t,e){return f(this,null,function*(){return this.initDbPromise.then(()=>Ri(t,""+e))})}getFloorData(t){return f(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return f(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=qs(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=$s(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return f(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(i=>f(this,null,function*(){let s=ui(t),o=yield fetch(t.map_url).then(n=>n.json());o.floor=t.floor,ps(o),this.setCacheData(Dt.MAP_DATA,s,o),this.setCacheData(Dt.MAP_VERSION,s,t.version_id),i(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return f(this,null,function*(){let e=this.floors.find(i=>i.floor===t);return e?new Promise(i=>f(this,null,function*(){let s=ui(e,this.options.renderVersion===di.LAYERED_RENDER_VERSION?1:void 0);try{let o=ui(e),n=yield this.getCacheData(Dt.MAP_DATA,o);if(n&&n.transformed){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u5408\u5E76\u540E\u7684\u6570\u636E"),i(n);return}if(this.options.renderVersion===di.LAYERED_RENDER_VERSION){let r=yield this.getCacheData(Dt.MAP_DATA,s);if(r){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u6570\u636E"),i(r);return}}if(console.log("\u7F13\u5B58\u4E2D\u6CA1\u6709\u6570\u636E"),this.loadWorker){X(this.loadWorker,"adjust_floor_priority",{floor:t});let r=h=>{if(h.data.type==="floor_success"&&h.data.data.floor===t){var c;(c=this.loadWorker)==null||c.removeEventListener("message",r),i(this.getFloorJsonData(t))}};this.loadWorker.addEventListener("message",r)}else i(this.getFloorJsonDataByFloorInfo(e))}catch(o){console.log("[get floor data error]",o),i(this.getFloorJsonDataByFloorInfo(e))}})):null})}getRoadNetworkData(){return f(this,null,function*(){return(yield Promise.all(this.floors.map(e=>f(this,null,function*(){let i=ui(e,0);try{let s=yield this.getCacheData(Dt.ROAD_NETWORK_DATA,i);if(s)return s;let o=yield fetch(e.route_url).then(n=>n.json());return this.setCacheData(Dt.ROAD_NETWORK_DATA,i,o),this.setCacheData(Dt.ROUTE_VERSION,i,e.version_id),o}catch(s){let o=yield fetch(e.route_url).then(n=>n.json());return this.setCacheData(Dt.ROAD_NETWORK_DATA,i,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return f(this,null,function*(){let t=this.floors.reduce((s,o)=>s.updated_at>o.updated_at?s:o,this.floors[0]);if(!t)return null;let e=ui(t,0),i=()=>f(this,null,function*(){let s=yield fetch(t.entry_infra_url).then(o=>o.json());return s&&(this.setCacheData(Dt.FACILITY_DATA,e,s),this.setCacheData(Dt.FACILITY_VERSION,e,t.version_id)),s});try{let s=yield this.getCacheData(Dt.FACILITY_DATA,e);return s||i()}catch(s){return console.log("[get facility error]",s),i()}})}getOtherDataByFreeTime(){return f(this,null,function*(){yield this.initDbPromise,yield X(this.loadWorker,"load",{floors:this.floors,version:this.options.renderVersion}),this.closeWorker()})}getMulFloorsData(t){return f(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(i=>i))})}getDataByUrl(t){return f(this,null,function*(){let e=yield fetch(t).then(i=>i.json());return this.getDataByJson(e)})}getDataByJson(t,e,i){return f(this,null,function*(){ps(t),e=this.getFloorBaseLayer(t,e);let s=x({},this.placeConfig,i);return yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,s),this.changeFloorBox(t,e),e})}getDataByJsonStep(t,e,i){return f(this,null,function*(){ps(t),e=this.getFloorBaseLayer(t,e);let s=x({},this.placeConfig,i);return this.changeFloorBox(t,e),requestAnimationFrame(()=>f(this,null,function*(){yield this.getFloorContentLayer(t,e),this.changeFloorBox(t,e),requestAnimationFrame(()=>f(this,null,function*(){yield this.getFloorPoi(t,e,s),this.changeFloorBox(t,e)}))})),e})}changeFloorBox(t,e){e.updateBox();let i=e.box.getSize(new Js.Vector3),s=Math.max(i.x,i.y,i.z);e.userData.height=s/4+t.floorHeight}switchFloor(t,e){return f(this,null,function*(){return new Promise(i=>{let s={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(s),n=r=>{let{task:h,res:c}=r;h.tid===o&&(this.taskQueue.removeEventListener("active-task-end",n),i(c))};this.taskQueue.addEventListener("active-task-end",n)})})}_switchFloor(t,e){return f(this,null,function*(){var i;let s=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)s=l;else return null}else ps(t);let o=x({},this.placeConfig,e),n=new oe(this.bmap.context);n.userData.data=t;let r=this.floors.find(l=>l.floor===s.floor);var h;let c=(h=r==null?void 0:r.map_angle)!=null?h:0;return this.bmap.dispatchEvent({type:_t.SWITCH_FLOOR_BEFORE,data:{curFloor:n,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:n,graphics:[],floorData:s}}),this.bmap.context.scene.background=new Js.Color(o.backgroundColor),this.getFloorBaseLayer(s,n),this.changeFloorBox(s,n),this.bmap.buildingCenter=n.userData.center,this.bmap.currentBuildGround=(i=n.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:i.elements[0],this.bmap.context.switchFloor(n),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(c/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:n,graphics:[]}}),this.bmap.dispatchEvent({type:_t.SWITCH_FLOOR_GROUND,data:{curFloor:n}}),yield Ps(),yield this.getFloorContentLayer(s,n),this.changeFloorBox(s,n),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:n,graphics:[]}}),yield bo(2),yield this.getFloorPoi(s,n,o),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:n,graphics:n.graphicLayer.children}}),this.bmap.dispatchEvent({type:_t.SWITCH_FLOOR_AFTER,data:{curFloor:n,graphics:n.graphicLayer.children}}),n})}getFloorBaseLayer(t,e){e||(e=new oe(this.bmap.context));let i=[0,0];return t.layers.forEach(s=>{switch(s.l_type){case"range":let o=s.elements[0];i=[o.center_x,o.center_y],e.userData.range=o.geometry.cds[0],e.userData.rangeGraphic=o;break;case"ground":tn(s,e);break;default:break}}),e.userData.center=i,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return f(this,null,function*(){e||(e=new oe(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let i=Date.now();for(let s=0;s<t.layers.length;s++){let o=t.layers[s];["range","ground"].includes(o.l_type)||this.options.layers.includes(o.l_type)&&(oa(o,e,this.options),console.log("time",Date.now()-i,o.l_type),i=Date.now())}return e})}getFloorPoi(t,e,i){return f(this,null,function*(){i===void 0&&(i=this.placeConfig);let s=Date.now();yield Promise.all(t.layers.map(n=>{if(this.options.layers.includes(n.l_type))return na(n,e,this.locale,i,this.options)})),console.log("poi time",Date.now()-s);let o=Date.now();Ps().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return f(this,null,function*(){mr(),this.db=null})}closeWorker(){this.loadWorker&&(this.loadWorker.terminate(),this.loadWorker=null)}dispose(){super.dispose(),this.clear(),this.closeWorker(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new Ye,this.loadWorker=en(),this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=x({},zh,e),this.placeConfig=x({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var v0=require("core-js/modules/web.dom-collections.iterator.js");function sn(a,t){return f(this,null,function*(){let{brand:e,project:i}=a,{apiDomain:s,apiPath:{floorRange:o},apiInfo:n}=t,r=""+s+o+"?brand="+e+"&project="+i+"&phase="+i+"&building="+i;return yield fetch(r,n).then(c=>c.json()).then(c=>c.data).then(c=>{let l=(c||[])[0];return l&&(l.info=JSON.parse(l.info)),l})})}function on(a,t){return f(this,null,function*(){let{brand:e,project:i,floor:s,ts:o,resource_type_list:n}=a,{apiDomain:r,apiPath:{floorGraphic:h},apiInfo:c}=t,l=""+r+h+"?brand="+e+"&project="+i+"&phase="+i+"&building="+i+"&floor="+s+"&ts="+o+"&resource_type_list="+n;return yield fetch(l,c).then(d=>d.json()).then(d=>d.data).then(d=>((d||[]).map(u=>u.info=JSON.parse(u.info)),d||[]))})}function Bh(a,t){return f(this,null,function*(){let{project:e,floor:i}=a,{apiDomain:s,apiInfo:o}=t,n=s+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+i;return yield fetch(n,o).then(h=>h.json()).then(h=>h.data).then(h=>JSON.parse(h[0].streetInfo||"{}")).then(h=>h.fileId?Wh(h.fileId,t):null)})}function Wh(a,t){return f(this,null,function*(){let{apiDomain:e,apiInfo:i}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+a,i).then(s=>s.arrayBuffer()).then(s=>{let n=new TextDecoder("utf-8").decode(s);return n?JSON.parse(n):null})})}var nn=class{load(t){return f(this,null,function*(){let e=je(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,i]=yield Promise.all([this.loadBuildGround(t),on(t,this.bmap.config)]),s=je({floor:t.floor,ts:t.ts});Di(i.map(n=>n.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(s)||0),i.forEach(n=>n.info.transformToBuildingGround=!1),this.cacheData.set(e,i);let o=this.floorDataLengthMap.get(s)||0;return this.floorDataLengthMap.set(s,o+i.length),this.loadExternalStreet(t),i})}loadExternalStreet(t){return f(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let i=e.userData.legacyToGraphicMap||new Map,s=e.userData.graphicMap||new Map,{ground:o,markGraphic:n,graphic:r}=this.bmap.config;for(let h=0;h<t.length;h++){let c=t[h],l=x({},c,{info:x({},c.info)});if(c.info.group==="ground"){c.info.fillColor=o.color,c.info.fillOpacity=o.opacity,c.info.height=o.height,c.info.stroke=o.stroke,c.info.strokeColor=o.strokeColor,c.info.strokeOpacity=o.strokeOpacity,e.createGround(c.info);break}else c.info.userData.mark?(c.info.height=n.height,c.info.fillColor=n.color,c.info.fillOpacity=n.opacity,c.info.stroke=n.stroke,c.info.strokeColor=n.strokeColor,c.info.strokeOpacity=n.strokeOpacity):(c.info.fillOpacity=r.fillOpacity,this.bmap.config.initTransToMark&&(c.info.height=n.height,c.info.fillColor=n.color,c.info.stroke=n.stroke,c.info.strokeColor=n.strokeColor,c.info.strokeOpacity=n.strokeOpacity));let p=e.addGraphic(c.info);p.userData.data=l,i.set(c.legacy_id,p),s.set(c.element_uuid,l)}e.userData.legacyToGraphicMap=i,e.userData.graphicMap=s,e.userData.rangeGraphic=this.bmap.currentBuildGround,e.userData.range=this.bmap.currentBuildGround.geometry.cds[0],e.userData.center=this.bmap.buildingCenter,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(_t.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(_t.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let i=e.userData.graphicMap||new Map;return t.filter(s=>!i.has(s.element_uuid))}switchFloorByStoreData(t,e){return f(this,null,function*(){let i=yield this.load(x({},t,{resource_type_list:"6"})),s=this.filterData(i,e);this.switchFloorByData(s,e)})}switchFloorByOtherData(t,e){return f(this,null,function*(){let i=yield this.load(x({},t,{resource_type_list:"1,2,3,4"})),s=this.filterData(i,e);this.switchFloorByData(s,e)})}loadBuildGround(t){return f(this,null,function*(){let{brand:e,project:i}=t,s=yield this.loadBuildingGround({brand:e,project:i});var o;return this.bmap.currentBuildGround=(o=s==null?void 0:s.info)!=null?o:null,this.bmap.changeBuildingCenter(s,{brand:e,project:i}),this.bmap.currentBuildGround})}loadBuildingGround(t){return f(this,null,function*(){let{brand:e,project:i}=t,s=je({brand:e,project:i});if(this.buildingGroundMap.has(s))return this.buildingGroundMap.get(s);let o=sn({brand:e,project:i},this.bmap.config).then(n=>(this.buildingGroundMap.set(s,n),n));return this.buildingGroundMap.set(s,o),o})}switchFloor(t){return f(this,null,function*(){let e=new oe(this.bmap.context);e.userData.graphicMap=new Map,e.name=t.floor;try{yield Promise.all([this.switchFloorByStoreData(t,e),this.switchFloorByOtherData(t,e)])}catch(i){console.log(i)}return e})}dispose(){this.cacheData.clear(),this.floorDataLengthMap.clear(),this.buildingGroundMap.clear()}constructor(t){this.bmap=t,this.cacheData=new Map,this.floorDataLengthMap=new Map,this.buildingGroundMap=new Map,this.externalStreetMap=new Map}};var Uh=function(a){return a[a.D2=0]="D2",a[a.D3=1.1]="D3",a}({}),rn=class extends jt.EventDispatcher{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:i,project:s}=e,o=t?Li(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:s,brand:i})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor(t){return f(this,null,function*(){return this.loader||(this.loader=new Je(this),this.loader.placeConfig=x({},this.loader.placeConfig,this.config.loaderPlaceConfig),yield this.loader.load(this.config.apiPath.loadPlaceInfo+"?place_id="+this.config.placeId+"&env=prod")),this.loader.switchFloor(t)})}switchFloorByFloor(t,e,i){e===void 0&&(e=!0),i===void 0&&(i=t.graphicLayer.children),this.triggerHooks(_t.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:i}),this.buildingCenter=t.userData.center,this.currentBuildGround=t.userData.rangeGraphic,this.context.switchFloor(t,e),this.initialFloorCamera(),this.triggerHooks(_t.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:i})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(this.config.defaultPadding,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*this.config.control.maxZoomScale,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}addModel(t,e){if(t.options.geometry.type==="polygon"){var i;let s=(i=this.context.currentFloor)==null?void 0:i.addModel(x({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(s){let{facilityAngle:o=0,facilityXScale:n=1,facilityYScale:r=1}=t.options.userData;s.rotateZ((180-o)/180*Math.PI),s.scale.set(n,r,1)}}}addHeatmap(t){var e;return(e=this.context.currentFloor)==null?void 0:e.addHeatmap(t)}getLegacyToGraphicMap(){var t;return((t=this.context.currentFloor)==null?void 0:t.userData.legacyToGraphicMap)||new Map}getFloorAllGraphics(){var t;return((t=this.context.currentFloor)==null?void 0:t.getGraphics())||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let i=t.options.center,s=t.getCenter(),o=(i==null?void 0:i[0])||s.x,n=(i==null?void 0:i[1])||s.y;return console.log(o,n,i,s),this.context.currentFloor.addPoi(x({},e,{position:{x:o,y:n,z:s.z+t.options.height/2}}))}return null}createPoi2ByPosition(t,e){if(this.context.currentFloor){let i=this.mercatorToWorld([t.x,t.y]),s=new rt(this.context,x({},e,{position:{x:i.x,y:i.y,z:t.z}}));return this.context.currentFloor.poiLayer2.pushPoi(s),s}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,i,s){e===void 0&&(e=500),i===void 0&&(i=0),s===void 0&&(s=0);let o=t.getPosition().clone(),{context:{camera:n}}=this;if(n.updateMatrix(),s){let r=new jt.Vector3;r.setFromMatrixColumn(n.matrix,1),r.normalize(),r.multiplyScalar(s/n.zoom),o.add(r)}if(i){let r=new jt.Vector3;r.setFromMatrixColumn(n.matrix,0),r.normalize(),r.multiplyScalar(i/n.zoom),o.add(r)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return f(this,null,function*(){return e===void 0&&(e=500),Wt(new Promise(i=>{let s=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:n,height:r},camera:h}=this.context,l=O(o,h,n,r).x-n/2,p=new jt.Vector3;p.setFromMatrixColumn(this.context.camera.matrix,0),p.normalize(),p.multiplyScalar(l/this.context.camera.zoom),s.add(p),this.context.setCameraPosition(s,e).then(i)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:i,clientHeight:s}=this.container;return O(e,this.context.camera,i,s)}changeMapType(t,e){return e===void 0&&(e=500),this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}resetView(t){return f(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let i=this.context.camera.zoom;return this.context.setZoom(i-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let i=this.context.camera.zoom;return this.context.setZoom(i+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver.enable){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t,e){t===void 0&&(t=.1),e===void 0&&(e=500);let i=this.context.control.getAzimuthalAngle();return this.context.setAzimuthalAngle(i+t,e)}measureDistance(){return f(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Xi(this.context);let i=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){i(),e("cancel")},this.svgLine.addEventListener("distance",s=>{let{distance:o}=s;t(o)})})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new qi(this.context);let i=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){i(),e("cancel")},this.svgPolygon.addEventListener("area",s=>{let{area:o}=s;t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}fitCameraByPois(t,e,i){return f(this,null,function*(){if(e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500),!t.length)return;let s=new jt.Box3;return t.forEach(o=>{let{position:n}=o;s.expandByPoint(n)}),this.context.fitCameraToBox(s,e,i,!1)})}fitCameraByPoiNodeIds(t,e,i){return f(this,null,function*(){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500);let s=t.map(o=>this.getPoiById(o)).filter(o=>!!o);if(s.length)return this.fitCameraByPois(s,e,i)})}getGraphicByNodeId(t){var e,i;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((i=this.context.currentFloor)==null?void 0:i.parkingSpaceLayer.graphicMap.get(t))||null}deleteGraphic(t){var e;(e=this.context.currentFloor)==null||e.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){var e;if(!t.transformToBuildingGround&&this.currentBuildGround){let i=Li(this.currentBuildGround.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(s=>{Array.isArray(s)&&s.forEach(o=>{o[0]-=i[0],o[1]-=i[1]})});else{let[s,o]=t.geometry.cds;t.geometry.coords=[s-i[0],o-i[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}mercatorToWorld(t){let e=this.buildingCenter;return new jt.Vector3(t[0]-e[0],t[1]-e[1],0)}removePoiById(t){var e,i;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(i=this.context.currentFloor)==null||i.poiLayer2.removePoiById(t)}getPoiById(t){var e;let i=this.context.collisionSystem.objects;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||i.find(s=>s.options.id===t)}getPois(){var t;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(e=>!e.options.built_in),...this.context.collisionSystem.objects||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}dispose(){this.loader&&(this.loader.dispose(),this.loader=null),this.unRegistryEvent(),this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.plugins=[],this.context.dispose(),this.context=null,this.container=null,mt.dispose(),ft.dispose(),De.dispose(),Tt.dispose(),L.dispose(),se.dispose(),this.debounceResize=null,jt.Sprite.Dispose==null||jt.Sprite.Dispose.call(jt.Sprite)}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new $,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:i}}=this.context;i!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=i)},this.onKeydown=i=>{this.polarKeys.includes(i.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(i.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=i=>{if(this.polarKeys.includes(i.code)){let s=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=s,this.context.control.minPolarAngle=s}if(this.azimuthalKeys.includes(i.code)){let s=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=s,this.context.control.minAzimuthAngle=s}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let i=this.context.control.getAzimuthalAngle(),s=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let o=this.context.getFitCameraToGroundZoom(this.config.defaultPadding,0)||1;this.context.camera.zoom=s,this.context.control.minZoom=o,this.context.control.maxZoom=o*this.config.control.maxZoomScale,this.basicZoom=s,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(i,0),this.context.cameraBound.setEnable(!0)},this.config=Jo(e),this.context=new ls(t,this),this.debounceResize=(0,ra.debounce)(this.resize,this.config.resizeObserver.debounceTime),this.registryEvent()}};var Hh=function(a){return a.HALF="half",a.POWER="power",a.MECHANICAL="mechanical",a.NORMAL="normal",a.VIP="vip",a}({});var W0=require("core-js/modules/web.dom-collections.iterator.js");var at=class extends lt{dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null,super.dispose()}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var an=class extends at{fetchEquipment(){return f(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:i}=this.bmap.config,s=""+t+e;yield fetch(s,i).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(n=>[n.equipment_id,n]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)})}getGraphicEquipment(t){return t.userData.data.info.userData.equipment}changeGraphicToEquipment(t){t.filter(e=>{let i=this.getGraphicEquipment(e);return i&&this.equipmentMap.has(i)}).forEach(e=>{let i=this.equipmentMap.get(this.getGraphicEquipment(e)),s=this.bmap.createGraphicPoi(e,{icon:i==null?void 0:i.equipment_icon,built_in:!0,icon_size:[14,14]});s&&(s.userData.data=i,s.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(_t.SWITCH_FLOOR_AFTER,this.onSwitchFloor),Array.from(((t=this.bmap.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).forEach(e=>{if(e.userData.type==="equipment"){var i;(i=this.bmap.context.currentFloor)==null||i.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:i}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(i)},this.fetchEquipment(),this.bmap.addEventListener(_t.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Nw=require("core-js/modules/es.string.replace.js"),Zw=require("core-js/modules/es.regexp.exec.js"),jw=require("core-js/modules/web.dom-collections.iterator.js"),Vw=require("core-js/modules/es.promise.finally.js");var cw=require("core-js/modules/web.dom-collections.iterator.js"),lw=require("core-js/modules/es.array.push.js"),xt=require("three");var j0=require("core-js/modules/es.typed-array.float32-array.js"),V0=require("core-js/modules/es.typed-array.at.js"),K0=require("core-js/modules/es.typed-array.fill.js"),Y0=require("core-js/modules/es.typed-array.find-last.js"),X0=require("core-js/modules/es.typed-array.find-last-index.js"),q0=require("core-js/modules/es.typed-array.set.js"),$0=require("core-js/modules/es.typed-array.sort.js"),J0=require("core-js/modules/es.typed-array.to-reversed.js"),Q0=require("core-js/modules/es.typed-array.to-sorted.js"),tw=require("core-js/modules/es.typed-array.with.js"),ew=require("core-js/modules/es.array-buffer.constructor.js"),iw=require("core-js/modules/es.array-buffer.slice.js"),sw=require("core-js/modules/es.array-buffer.detached.js"),ow=require("core-js/modules/es.array-buffer.transfer.js"),nw=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),rw=require("core-js/modules/es.array.push.js"),aw=require("core-js/modules/es.typed-array.uint16-array.js"),S=require("three"),Vt=class extends S.BufferGeometry{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new S.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};Vt.prototype.setMatrixWorld=function(a){this.matrixWorld=a};Vt.prototype.setGeometry=function(a,t){this._geometry=a,this.setPoints(a.getAttribute("position").array,t)};Vt.prototype.setPoints=function(a,t){if(!(a instanceof Float32Array)&&!(a instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=a,this.widthCallback=t,this.positions=[],this.counters=[],a.length&&a[0]instanceof S.Vector3)for(var e=0;e<a.length;e++){var i=a[e],s=e/a.length;this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(s),this.counters.push(s)}else for(var e=0;e<a.length;e+=3){var s=e/a.length;this.positions.push(a[e],a[e+1],a[e+2]),this.positions.push(a[e],a[e+1],a[e+2]),this.counters.push(s),this.counters.push(s)}this.process()};function Nh(a,t){var e=new S.Matrix4,i=new S.Ray,s=new S.Sphere,o=new S.Vector3,n=this.geometry;if(n.boundingSphere||n.computeBoundingSphere(),s.copy(n.boundingSphere),s.applyMatrix4(this.matrixWorld),a.ray.intersectSphere(s,o)!==!1){e.copy(this.matrixWorld).invert(),i.copy(a.ray).applyMatrix4(e);var r=new S.Vector3,h=new S.Vector3,c=new S.Vector3,l=this instanceof S.LineSegments?2:1,p=n.index,d=n.attributes;if(p!==null)for(var u=p.array,m=d.position.array,g=d.width.array,y=0,w=u.length-1;y<w;y+=l){var M=u[y],P=u[y+1];r.fromArray(m,M*3),h.fromArray(m,P*3);var k=g[Math.floor(y/3)]!==void 0?g[Math.floor(y/3)]:1,D=a.params.Line.threshold+this.material.lineWidth*k/2,q=D*D,E=i.distanceSqToSegment(r,h,o,c);if(!(E>q)){o.applyMatrix4(this.matrixWorld);var Q=a.ray.origin.distanceTo(o);Q<a.near||Q>a.far||(t.push({distance:Q,point:c.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this}),y=w)}}}}Vt.prototype.raycast=Nh;Vt.prototype.compareV3=function(a,t){var e=a*6,i=t*6;return this.positions[e]===this.positions[i]&&this.positions[e+1]===this.positions[i+1]&&this.positions[e+2]===this.positions[i+2]};Vt.prototype.copyV3=function(a){var t=a*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Vt.prototype.getDistance=function(a){let t=0;for(let e=0;e<a;e++){let i=6*e,s=new S.Vector3(this.positions[i],this.positions[i+1],this.positions[i+2]),o=new S.Vector3(this.positions[i+6],this.positions[i+7],this.positions[i+8]),n=s.distanceTo(o);t+=n}return t};Vt.prototype.process=function(){var a=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(a-1);var i;this.compareV3(0,a-1)?i=this.copyV3(a-2):i=this.copyV3(0),this.previous.push(i[0],i[1],i[2]),this.previous.push(i[0],i[1],i[2]);for(var s=0;s<a;s++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(s/(a-1)):t=1,this.width.push(t),this.width.push(t),s===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(s===a-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let n=this.getDistance(s)/e;this.uvs.push(n,0),this.uvs.push(n,1)}if(s<a-1){i=this.copyV3(s),this.previous.push(i[0],i[1],i[2]),this.previous.push(i[0],i[1],i[2]);var o=s*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}s>0&&(i=this.copyV3(s),this.next.push(i[0],i[1],i[2]),this.next.push(i[0],i[1],i[2]))}this.compareV3(a-1,0)?i=this.copyV3(1):i=this.copyV3(a-1),this.next.push(i[0],i[1],i[2]),this.next.push(i[0],i[1],i[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new S.BufferAttribute(new Float32Array(this.positions),3),previous:new S.BufferAttribute(new Float32Array(this.previous),3),next:new S.BufferAttribute(new Float32Array(this.next),3),side:new S.BufferAttribute(new Float32Array(this.side),1),width:new S.BufferAttribute(new Float32Array(this.width),1),uv:new S.BufferAttribute(new Float32Array(this.uvs),2),index:new S.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new S.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function hn(a,t,e,i,s){var o;if(a=a.subarray||a.slice?a:a.buffer,e=e.subarray||e.slice?e:e.buffer,a=t?a.subarray?a.subarray(t,s&&t+s):a.slice(t,s&&t+s):a,e.set)e.set(a,i);else for(o=0;o<a.length;o++)e[o+i]=a[o];return e}Vt.prototype.advance=function(a){var t=this._attributes.position.array,e=this._attributes.previous.array,i=this._attributes.next.array,s=t.length;hn(t,0,e,0,s),hn(t,6,t,0,s-6),t[s-6]=a.x,t[s-5]=a.y,t[s-4]=a.z,t[s-3]=a.x,t[s-2]=a.y,t[s-1]=a.z,hn(t,6,i,0,s-6),i[s-6]=a.x,i[s-5]=a.y,i[s-4]=a.z,i[s-3]=a.x,i[s-2]=a.y,i[s-1]=a.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};S.ShaderChunk.meshline_vert=["",S.ShaderChunk.logdepthbuf_pars_vertex,S.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",S.ShaderChunk.logdepthbuf_vertex,S.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",S.ShaderChunk.fog_vertex,"}"].join(`
501
+ `,i=-1/0,s=this.geometry.getAttribute("position");if(s)for(let n=0;n<s.count;n++){let r=s.getZ(n);r>i&&(i=r)}let o=new vt.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new vt.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new vt.Color(le(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=L.createLineMaterial({color:this.options[0].strokeColor,opacity:this.options[0].strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new vt.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(i=>{let{coords:s}=i.geometry;for(let o=0;o<s.length;o++){let n=s[o];for(let r=0;r<n.length;r++){let h=n[r],c=r+1===n.length?n[0]:n[r+1];t.push(new vt.Vector3(h[0],h[1],e)),t.push(new vt.Vector3(c[0],c[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new vt.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new vt.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t,e;this.geometry?(this.geometry.dispose(),this._listeners={}):this.addEventListener("init-geometry",()=>{var i;(i=this.geometry)==null||i.dispose(),this._listeners={}}),(t=this.material)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e,i){super(),this.context=t,this.mergedElement=i,this.options=[],i?(this.options=[i],this.initMergedElement()):(this.options=e.map(s=>x({},fe,s)),this.init())}};var Ig=require("core-js/modules/web.dom-collections.iterator.js"),Rg=require("core-js/modules/es.string.trim.js");var Nt=require("three"),Wr=require("three/examples/jsm/utils/BufferGeometryUtils.js");var Ur={airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},texts:[],fillColor:"#ffffff",fillOpacity:0,strokeColor:"#ffffff",strokeOpacity:0,secondHeight:0,secondRotate:0,center_x:0,center_y:0},Qi=class extends Nt.Object3D{init(){return f(this,null,function*(){let t=yield Promise.all(this.options.map(n=>mt.getTextureByText(n.texts[0],{fillStyle:bs(n.fillColor,n.fillOpacity),strokeStyle:bs(n.strokeColor,n.strokeOpacity),lineWidth:6,font:"bold 54px sans-serif",maxWidth:2048}))),e=t.map((n,r)=>{let h=this.options[r],{width:c,height:l}=n.texture.image,p=c/l,d=h.secondHeight*p,u=new Nt.PlaneGeometry(d,h.secondHeight),m=new Nt.Matrix4().makeTranslation(h.center_x,h.center_y,h.airHeight+h.deltaHeight+h.height).multiply(new Nt.Matrix4().makeRotationZ(h.secondRotate));return u.applyMatrix4(m),u}),i=(0,Wr.mergeGeometries)(e,!0);e.forEach(n=>n.dispose());let s=t.map(n=>{let{texture:r}=n,h=new Nt.MeshBasicMaterial({map:r,alphaTest:1,side:Nt.DoubleSide});return r.needsUpdate=!0,h}),o=new Nt.Mesh(i,s);this.mesh=o,this.position.z+=.04,this.add(o)})}setOpacity(t){var e,i;(i=this.mesh)==null||(e=i.material)==null||e.forEach(s=>{s.opacity=t,s.needsUpdate=!0})}dispose(){var t,e,i;(t=this.mesh)==null||t.geometry.dispose(),(i=this.mesh)==null||(e=i.material)==null||e.forEach(s=>s.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(i=>x({},Ur,i)).filter(i=>i.texts[0].trim()),this.options.length&&this.init()}};var Hr=require("three"),Nr=require("three/examples/jsm/lines/Line2.js"),Zr=require("three/examples/jsm/lines/LineGeometry.js"),jr=require("three/examples/jsm/lines/LineMaterial.js"),ai=class extends Hr.Object3D{registryEvent(){this.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.context.removeEventListener("resize",this.onResize)}setPosition(t,e){this.lineGeometry.setPositions([t.x,t.y,t.z,e.x,e.y,e.z]),this.line||this.createLine()}createLine(){this.line=new Nr.Line2(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&G(this.line),this.lineGeometry=null,this.lineMaterial=null,this.clear(),(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,i){super(),this.context=t,this.lineGeometry=new Zr.LineGeometry,this.lineMaterial=new jr.LineMaterial({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:s,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(s,o)},this.onResize(),this.registryEvent(),e&&i&&this.setPosition(e,i)}};var Hg=require("core-js/modules/es.array.push.js"),Ng=require("core-js/modules/web.dom-collections.iterator.js"),ze=require("three");var hi=require("three");var ji=class extends ze.Object3D{loadModel(){return f(this,null,function*(){let t=yield Tt.loadModel(this.options[0].url);t.scene.updateMatrixWorld(!0);let e=t.scene.matrixWorld.clone().invert();t.scene.traverse(h=>{if(h.isMesh){let c=e.clone().multiply(h.matrixWorld),l=h.material;this.subMeshes.push({geometry:h.geometry,material:h.material,initialMatrix:c}),Array.isArray(l)?l.forEach(p=>{p.transparent=!0,this.materialOriginParams.set(p,{opacity:p.opacity})}):(l.transparent=!0,this.materialOriginParams.set(l,{opacity:l.opacity}))}});let i=this.subMeshes.map(h=>{let{geometry:c,material:l}=h;return new ze.InstancedMesh(c,l,this.options.length)});t.scene.rotation.set(Math.PI/2,0,0);let o=new ze.Box3().setFromObject(t.scene).getSize(new ze.Vector3),n=Math.max(o.x,o.y);this.options.map(h=>{let c=new hi.Matrix4,l=h.width/n;return c.multiply(new hi.Matrix4().makeTranslation(h.center_x,h.center_y,h.airHeight+h.deltaHeight)).multiply(new hi.Matrix4().makeScale(l,l,l)).multiply(new hi.Matrix4().makeRotationZ(h.rotate)).multiply(new hi.Matrix4().makeRotationX(Math.PI/2)),h.url==="https://robot-vr-public.cdn.bcebos.com/ai-map-resource/757/1865371442288267264/smzsdrc.glb"&&console.log(h,c),c}).forEach((h,c)=>{i.forEach((l,p)=>{let d=h.clone().multiply(this.subMeshes[p].initialMatrix);l.setMatrixAt(c,d)})}),i.forEach(h=>{h.instanceMatrix.needsUpdate=!0,this.meshSetMaterial(h),this.add(h)})})}meshSetMaterial(t){t.isMesh&&(t.frustumCulled=!1,t.castShadow=!0,Array.isArray(t.material)?t.material.map(e=>{e.emissiveIntensity*=.95}):(t.material.emissiveIntensity*=.95,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map))}setOpacity(t,e){e===void 0&&(e=!1),this.subMeshes.forEach(i=>{let{material:s}=i;if(Array.isArray(s))s.forEach(o=>{if(e)o.opacity=t;else{let n=this.materialOriginParams.get(o)||{opacity:1};t>n.opacity?o.opacity=n.opacity:o.opacity=t}o.needsUpdate=!0});else{let o=this.materialOriginParams.get(s)||{opacity:1};t>o.opacity?s.opacity=o.opacity:s.opacity=t,s.needsUpdate=!0}}),this.children.forEach(i=>{i.instanceMatrix.needsUpdate=!0})}dispose(){this.children.forEach(t=>t.dispose()),G(this),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.subMeshes=[],this.materialOriginParams=new Map,this.loadModel()}};var Be=require("three");var ri=class extends Be.Object3D{init(){return f(this,null,function*(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.deltaHeight+this.options.airHeight,this.options.lineGeometry&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())})}initGeometry(){return this.loader.parseGeometries([this.options.mergedGeometry])[this.options.mergedGeometry.uuid]}initMaterial(){this.material=L.GetMergeAttributeGraphicMaterial()}initLineMaterial(){return this.lineMaterial=L.GetMergeAttributeGraphicLineMaterial()}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new Be.Mesh(this.geometry,this.material),this.add(this.mesh)}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.loader.parseGeometries([this.options.lineGeometry]);this.lineGeometry=t[this.options.lineGeometry.uuid]}createBorder(){this.line&&this.remove(this.line);let t=new Be.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;this.geometry&&this.geometry.dispose(),(t=this.line)==null||t.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.loader=new Be.ObjectLoader,this.options=x({},fe,e),this.init()}};var ci=require("three");var ts=class extends ci.Object3D{initGeometry(){return f(this,null,function*(){let t=new ci.ObjectLoader().parseGeometries([this.options.mergedGeometry]);this.geometry=t[this.options.mergedGeometry.uuid]})}init(){return f(this,null,function*(){var t;yield this.initGeometry();let e=new ci.Mesh(this.geometry,At.GetMergeAttributeWallMaterial());this.add(e);let i=(t=this.geometry)==null?void 0:t.getAttribute("opacity");i&&(this.originOpacities=Array.from(i.array))})}setOpacity(t,e){e===void 0&&(e=!1);var i;let s=(i=this.geometry)==null?void 0:i.getAttribute("opacity");if(s){for(let n=0;n<s.count;n++)if(e)s.setX(n,t);else{var o;s.setX(n,Math.min(t,(o=this.originOpacities[n])!=null?o:1))}s.needsUpdate=!0}}dispose(){var t;(t=this.geometry)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.originOpacities=[],this.init()}};var sy=require("core-js/modules/es.typed-array.float32-array.js"),oy=require("core-js/modules/es.typed-array.at.js"),ny=require("core-js/modules/es.typed-array.fill.js"),ry=require("core-js/modules/es.typed-array.find-last.js"),ay=require("core-js/modules/es.typed-array.find-last-index.js"),hy=require("core-js/modules/es.typed-array.set.js"),cy=require("core-js/modules/es.typed-array.sort.js"),ly=require("core-js/modules/es.typed-array.to-reversed.js"),py=require("core-js/modules/es.typed-array.to-sorted.js"),dy=require("core-js/modules/es.typed-array.with.js"),uy=require("core-js/modules/es.array-buffer.constructor.js"),my=require("core-js/modules/es.array-buffer.slice.js"),fy=require("core-js/modules/es.array-buffer.detached.js"),gy=require("core-js/modules/es.array-buffer.transfer.js"),yy=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js");var pt=require("three");var Ie=class extends pt.Object3D{init(){return f(this,null,function*(){let t=this.options.iconUrl,e=yield ft.getTextureByUrl(t),i=new pt.MeshBasicMaterial({map:e,transparent:!0,alphaTest:.2,side:pt.FrontSide}),s=new pt.InstancedMesh(this.geometry,i,this.options.mergedMatrixes.size);s.instanceMatrix=new pt.InstancedBufferAttribute(new Float32Array(this.options.mergedMatrixes.array),16),this.add(s),this.mesh=s,this.position.z+=.004})}setOpacity(t){this.mesh&&(this.mesh.material.opacity=t,this.mesh.material.needsUpdate=!0,this.mesh.instanceMatrix.needsUpdate=!0)}dispose(){var t;this.mesh&&G(this.mesh),(t=this.mesh)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.geometry=new pt.ShapeGeometry(new pt.Shape([new pt.Vector2(-.5,-.5),new pt.Vector2(-.5,.5),new pt.Vector2(.5,.5),new pt.Vector2(.5,-.5)])),this.options=x({},Ns,e);let i=new pt.Float32BufferAttribute([0,0,0,1,1,1,1,0],2);this.geometry.setAttribute("uv",i),this.init()}};var Py=require("core-js/modules/es.array.push.js"),Ee=require("three");var Yo=require("three/examples/jsm/lines/LineSegments2.js"),Xo=require("three/examples/jsm/lines/LineSegmentsGeometry.js");var es=class extends Ee.Object3D{initGeometry(){return f(this,null,function*(){let t=this.loader.parseGeometries([this.options.mergedGeometry]);this.geometry=t[this.options.mergedGeometry.uuid]})}initMaterial(){let t=L.createMeshBasicMaterial({color:"#ffffff",opacity:1,vertexColors:!0});return this.material=t,t}initDoubleLine(){if(this.options.dashedLineGeometry){let t=L.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:!0,resolution:new Ee.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0});t.transparent=!0,t.needsUpdate=!0;let e=new Xo.LineSegmentsGeometry;e.setPositions(this.options.dashedLineGeometry.positions),e.setColors(this.options.dashedLineGeometry.colors);let i=new Yo.LineSegments2(e,t);i.computeLineDistances(),i.position.z+=.01,this.add(i),this.doubleLines.push(i)}if(this.options.lineGeometry){let t=L.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:!1,resolution:new Ee.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0}),e=new Xo.LineSegmentsGeometry;e.setPositions(this.options.lineGeometry.positions),e.setColors(this.options.lineGeometry.colors);let i=new Yo.LineSegments2(e,t);i.position.z+=.01,this.add(i),this.doubleLines.push(i)}}init(){return f(this,null,function*(){yield this.initGeometry(),this.initMaterial();let t=new Ee.Mesh(this.geometry,this.material);this.add(t),this.initDoubleLine(),this.position.z+=.02})}setOpacity(t){this.material.opacity=t,this.material.needsUpdate=!0,this.doubleLines.forEach(e=>{e.material.opacity=t,e.material.needsUpdate=!0})}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.lineGeometry)==null||e.dispose(),this.doubleLines.map(i=>i.geometry.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.doubleLines=[],this.loader=new Ee.ObjectLoader,this.init()}};var Cy=require("core-js/modules/es.typed-array.float32-array.js"),Ty=require("core-js/modules/es.typed-array.at.js"),ky=require("core-js/modules/es.typed-array.fill.js"),Dy=require("core-js/modules/es.typed-array.find-last.js"),Ay=require("core-js/modules/es.typed-array.find-last-index.js"),Oy=require("core-js/modules/es.typed-array.set.js"),Iy=require("core-js/modules/es.typed-array.sort.js"),Ry=require("core-js/modules/es.typed-array.to-reversed.js"),Fy=require("core-js/modules/es.typed-array.to-sorted.js"),Gy=require("core-js/modules/es.typed-array.with.js"),zy=require("core-js/modules/es.array-buffer.constructor.js"),By=require("core-js/modules/es.array-buffer.slice.js"),Wy=require("core-js/modules/es.array-buffer.detached.js"),Uy=require("core-js/modules/es.array-buffer.transfer.js"),Hy=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Ny=require("core-js/modules/web.dom-collections.iterator.js"),j=require("three");var ii=class extends j.Object3D{setColorByIndex(t,e){this.mesh&&(this.mesh.setColorAt(t,new j.Color(e).convertLinearToSRGB()),this.mesh.instanceColor.needsUpdate=!0)}init(){return f(this,null,function*(){this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight+this.options[0].airHeight,this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())})}initMaterial(){this.material=L.GetInstancedGraphicMaterial()}initLineMaterial(){let t=L.GetMergeAttributeGraphicLineMaterial();this.lineMaterial=t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new j.InstancedMesh(this.geometry,this.material,this.options.length);let t=new j.InstancedBufferAttribute(new Float32Array(this.options.length),1),e=new j.InstancedBufferAttribute(new Float32Array(this.options.length),1);this.options.forEach((i,s)=>{let o=i.geometry.coords[0],[n,r,h]=o.slice(0,3),c=Math.sqrt((r[0]-n[0])**2+(r[1]-n[1])**2),l=Math.sqrt((h[0]-r[0])**2+(h[1]-r[1])**2),p=[c,l],d=Math.max(...p),u=Math.min(...p),m;d===c?m=[r[0]-n[0],r[1]-n[1]]:m=[h[0]-r[0],h[1]-r[1]];let[g,y]=m,w=Math.atan2(y,g)-Math.PI/2,M=new j.Matrix4().compose(new j.Vector3(i.center_coord_x,i.center_coord_y,(i.deltaHeight||0)+i.airHeight+i.height/2),new j.Quaternion().setFromAxisAngle(new j.Vector3(0,0,1),w),new j.Vector3(u,d,i.height));this.mesh.setMatrixAt(s,M),this.mesh.setColorAt(s,new j.Color(i.fillColor).convertLinearToSRGB()),t.array[s]=i.fillOpacity||1,e.array[s]=(i.deltaHeight||0)+i.airHeight+i.height}),this.originOpacity=[...t.array],this.geometry.setAttribute("opacity",t),this.geometry.setAttribute("maxZ",e),this.add(this.mesh),this.mesh.instanceMatrix.needsUpdate=!0}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let{points:t,colors:e,opacities:i}=Ts(this.options),s=new j.BufferGeometry().setFromPoints(t);s.setAttribute("color",new j.BufferAttribute(new Float32Array(e),3)),s.setAttribute("opacity",new j.BufferAttribute(new Float32Array(i),1)),this.lineOriginOpacity=[...i],this.lineGeometry=s}createBorder(){this.line&&this.remove(this.line);let t=new j.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}setOpacity(t,e){e===void 0&&(e=!1);let i=this.geometry.getAttribute("opacity");for(let n=0;n<i.count;n++)if(e)i.array[n]=t;else{var s;i.array[n]=Math.min(t,(s=this.originOpacity[n])!=null?s:1)}if(i.needsUpdate=!0,this.lineGeometry){let n=this.lineGeometry.getAttribute("opacity");for(let r=0;r<n.count;r++)if(e)n.array[r]=t;else{var o;n.array[r]=Math.min(t,(o=this.lineOriginOpacity[r])!=null?o:1)}n.needsUpdate=!0}}dispose(){var t,e;this.geometry.dispose(),(t=this.mesh)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.geometry=new j.BoxGeometry(1,1,1),this.options=[],this.originOpacity=[],this.lineOriginOpacity=[],this.options=e.map(i=>x({},fe,i)),this.init()}};var Xy=require("core-js/modules/es.typed-array.float32-array.js"),qy=require("core-js/modules/es.typed-array.at.js"),$y=require("core-js/modules/es.typed-array.fill.js"),Jy=require("core-js/modules/es.typed-array.find-last.js"),Qy=require("core-js/modules/es.typed-array.find-last-index.js"),tv=require("core-js/modules/es.typed-array.set.js"),ev=require("core-js/modules/es.typed-array.sort.js"),iv=require("core-js/modules/es.typed-array.to-reversed.js"),sv=require("core-js/modules/es.typed-array.to-sorted.js"),ov=require("core-js/modules/es.typed-array.with.js"),nv=require("core-js/modules/es.array-buffer.constructor.js"),rv=require("core-js/modules/es.array-buffer.slice.js"),av=require("core-js/modules/es.array-buffer.detached.js"),hv=require("core-js/modules/es.array-buffer.transfer.js"),cv=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),lv=require("core-js/modules/web.dom-collections.iterator.js"),Qt=require("three");var qe=class extends Qt.Object3D{init(){return f(this,null,function*(){this.initMaterial(),this.initMesh()})}initMaterial(){this.material=L.GetInstancedGraphicMaterial()}initMesh(){if(this.mesh&&this.remove(this.mesh),!this.elements)return;this.mesh=new Qt.InstancedMesh(this.geometry,this.material,this.elements.size);let t=new Qt.InstancedBufferAttribute(new Float32Array(this.elements.opacities),1),e=new Qt.InstancedBufferAttribute(new Float32Array(this.elements.maxZs),1);this.originOpacities=[...t.array],this.geometry.setAttribute("opacity",t),this.geometry.setAttribute("maxZ",e),this.mesh.instanceMatrix.set(this.elements.matrixes),this.mesh.instanceColor=new Qt.InstancedBufferAttribute(new Float32Array(this.elements.colors),3),this.add(this.mesh),this.mesh.instanceMatrix.needsUpdate=!0}setColorByIndex(t,e){this.mesh&&(this.mesh.setColorAt(t,new Qt.Color(e).convertLinearToSRGB()),this.mesh.instanceColor.needsUpdate=!0)}setOpacityByIndex(t,e){if(this.mesh){let i=this.geometry.getAttribute("opacity");i.setX(t,e),i.needsUpdate=!0}}setMatrixByIndex(t,e){this.mesh&&(this.mesh.setMatrixAt(t,e),this.mesh.instanceMatrix.needsUpdate=!0)}setMaxZByIndex(t,e){if(this.mesh){let i=this.geometry.getAttribute("maxZ");i.setX(t,e),i.needsUpdate=!0}}setColorById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setColorByIndex(i,e)}setOpacityById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setOpacityByIndex(i,e)}setMatrixById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setMatrixByIndex(i,e)}setMaxZById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setMaxZByIndex(i,e)}setOpacity(t,e){if(e===void 0&&(e=!1),!this.geometry)return;let i=this.geometry.getAttribute("opacity");for(let o=0;o<i.count;o++)if(e)i.array[o]=t;else{var s;i.array[o]=Math.min(t,(s=this.originOpacities[o])!=null?s:1)}i.needsUpdate=!0}pushElements(t){this.elements?(this.elements.size+=t.size,this.elements.colors=[...this.elements.colors,...t.colors],this.elements.matrixes=[...this.elements.matrixes,...t.matrixes],this.elements.opacities=[...this.elements.opacities,...t.opacities],this.elements.maxZs=[...this.elements.maxZs,...t.maxZs],this.elements.ids=[...this.elements.ids,...t.ids],this.originOpacities=[...this.originOpacities,...t.opacities]):this.elements=t,this.refesh()}removeInstanceById(t){if(this.elements){if(this.mesh){let e=this.elements.ids.indexOf(t);e!==-1&&(this.elements.size--,this.elements.colors.splice(e*3,3),this.elements.matrixes.splice(e*16,16),this.elements.opacities.splice(e,1),this.elements.maxZs.splice(e,1),this.elements.ids.splice(e,1),this.originOpacities.splice(e,1))}this.refesh()}}refesh(){this.mesh&&(this.mesh.dispose(),this.remove(this.mesh)),this.init()}dispose(){var t;this.material=null,this.originOpacities.length=0,this.geometry.dispose(),(t=this.mesh)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.geometry=new Qt.BoxGeometry(1,1,1),this.material=null,this.elements=null,this.originOpacities=[],this.elements=e,this.init()}};var mv=require("core-js/modules/es.typed-array.float32-array.js"),fv=require("core-js/modules/es.typed-array.at.js"),gv=require("core-js/modules/es.typed-array.fill.js"),yv=require("core-js/modules/es.typed-array.find-last.js"),vv=require("core-js/modules/es.typed-array.find-last-index.js"),xv=require("core-js/modules/es.typed-array.set.js"),wv=require("core-js/modules/es.typed-array.sort.js"),Mv=require("core-js/modules/es.typed-array.to-reversed.js"),_v=require("core-js/modules/es.typed-array.to-sorted.js"),Pv=require("core-js/modules/es.typed-array.with.js"),bv=require("core-js/modules/es.array-buffer.constructor.js"),Sv=require("core-js/modules/es.array-buffer.slice.js"),Ev=require("core-js/modules/es.array-buffer.detached.js"),Lv=require("core-js/modules/es.array-buffer.transfer.js"),Cv=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Tv=require("core-js/modules/web.dom-collections.iterator.js"),ne=require("three");var is=class extends ne.Object3D{init(){return f(this,null,function*(){this.initMaterial(),this.initMesh()})}initMaterial(){this.material=L.GetInstancedWallMaterial()}initMesh(){if(this.mesh&&this.remove(this.mesh),!this.elements)return;this.mesh=new ne.InstancedMesh(this.geometry,this.material,this.elements.size);let t=new ne.InstancedBufferAttribute(new Float32Array(this.elements.opacities),1),e=new ne.InstancedBufferAttribute(new Float32Array(this.elements.maxZs),1),i=new ne.InstancedBufferAttribute(new Float32Array(this.elements.minZs),1);this.originOpacities=[...t.array],this.geometry.setAttribute("opacity",t),this.geometry.setAttribute("maxZ",e),this.geometry.setAttribute("minZ",i),this.mesh.instanceMatrix.set(this.elements.matrixes),this.mesh.instanceColor=new ne.InstancedBufferAttribute(new Float32Array(this.elements.colors),3),this.add(this.mesh),this.mesh.instanceMatrix.needsUpdate=!0}setOpacityByIndex(t,e){if(this.mesh){let i=this.geometry.getAttribute("opacity");i.setX(t,e),i.needsUpdate=!0}}setOpacity(t,e){e===void 0&&(e=!1),this.elements&&this.elements.opacities.forEach((i,s)=>{let o=e?t:Math.min(t,this.originOpacities[s]);this.setOpacityByIndex(s,o)})}dispose(){this.mesh&&(this.mesh.dispose(),this.remove(this.mesh)),this.material=null,this.geometry&&this.geometry.dispose(),this.elements=null}constructor(t,e){super(),this.geometry=new ne.BoxGeometry(1,1,1),this.material=null,this.elements=null,this.originOpacities=[],this.elements=e,this.init()}};var li=require("three");var Re=class extends li.Object3D{init(){return f(this,null,function*(){this.initLineGeometry(),this.initLineMaterial(),this.createBorder()})}initLineMaterial(){return this.lineMaterial=L.GetMergeAttributeGraphicLineMaterial()}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.loader.parseGeometries([this.options]);this.lineGeometry=t[this.options.uuid]}createBorder(){this.line&&this.remove(this.line);let t=new li.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;(t=this.lineGeometry)==null||t.dispose(),this.lineMaterial=null,this.clear()}constructor(t,e){super(),this.context=t,this.lineMaterial=null,this.loader=new li.ObjectLoader,this.options=x({},fe,e),this.init()}};var Vr=require("three"),Zs=class extends Ht{setEnable(t){super.setEnable(t),Ct(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:i,clientHeight:s}}}=this,o=O(this.startPoint,e,i,s),n=O(this.endPoint,e,i,s),r={x:Math.min(o.x,n.x),y:Math.min(o.y,n.y)},h={x:Math.max(o.x,n.x),y:Math.max(o.y,n.y)},c=this.searchMapInFrustum(r,h);this.dispatchEvent({type:"selected",list:c})}}searchMapInFrustum(t,e){var i;let{context:s}=this;return((i=s.currentFloor)==null?void 0:i.graphicLayer.children.filter(o=>o instanceof gt&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,i){let{context:{camera:s,container:{clientWidth:o,clientHeight:n}}}=this;if(!t)return!1;if(!t.mesh){let d=t.getPosition();if(d){let u=O(d,s,o,n);return Me(u,e,i)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let r=t.mesh.geometry.boundingBox;if(!r)return!1;let{min:h,max:c}=r,l=O(h,s,o,n),p=O(c,s,o,n);return!(!Me(l,e,i)||!Me(p,e,i))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new Vr.Frustum,this.onPointerDown=s=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(s);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=s=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(s);o&&(this.endPoint=o)},this.onPointerUp=s=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(s);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let s=this.getSvgCoordinate(this.startPoint),o=x({},s);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(s.x,o.x),y:Math.min(s.y,o.y)},r=Math.abs(o.x-s.x),h=Math.abs(o.y-s.y);Ct(this.rect,n.x,n.y,r,h)}else Ct(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:i}}}=t;this.rect=_e(i,e),this.svg.appendChild(this.rect),this.registryEvent()}};var ss=class extends Kr.EventDispatcher{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.context=t,this._list=new Set,this.downPoint=null,this.downTime=0,this.isMultipleSelect=!1,this.onPointerDown=e=>{Date.now()-this.downTime<200||(this.downPoint={x:e.offsetX,y:e.offsetY},this.downTime=Date.now())},this.onPointerUp=e=>{if(!this.downPoint)return;let{offsetX:i,offsetY:s}=e,{x:o,y:n}=this.downPoint;if(Math.sqrt((o-i)**2+(n-s)**2)>3)return;let{graphics:r}=this.context.getGraphicsByDeviceXy(i,s),h=new Set(r.map(l=>l.options.id));this.context.getPoisByDeviceXy(i,s).forEach(l=>{if(!h.has(l.options.id)){var p;let d=((p=this.context.currentFloor)==null?void 0:p.graphicLayer.graphicMap.get(l.options.id))||null;d&&d.options.geometry.type==="point"&&(r.push(d),h.add(l.options.id))}}),(Ne?e.metaKey:e.ctrlKey)||this._list.clear(),r.forEach(l=>this._list.add(l)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{Ze(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Ze(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:i}=e;this._list.clear(),i.forEach(s=>{this._list.add(s)}),this.selectEnd()},this.boxSelection=new Zs(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var tx=require("core-js/modules/es.set.difference.v2.js"),ex=require("core-js/modules/es.set.intersection.v2.js"),ix=require("core-js/modules/es.set.is-disjoint-from.v2.js"),sx=require("core-js/modules/es.set.is-subset-of.v2.js"),ox=require("core-js/modules/es.set.is-superset-of.v2.js"),nx=require("core-js/modules/es.set.symmetric-difference.v2.js"),rx=require("core-js/modules/es.set.union.v2.js"),ax=require("core-js/modules/web.dom-collections.iterator.js");var js=require("three");var os=class extends js.EventDispatcher{handleHoverGraphicsChange(t){t===void 0&&(t=this.curGraphics),this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new $,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:i,pois:s,e:o}=e,n=s.map(l=>{var p;return(p=this.context.currentFloor)==null?void 0:p.graphicLayer.graphicMap.get(l.options.id)}).filter(l=>l&&l.options.geometry.type==="point");if(!i.length&&!n.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:r}=this.context.config.hover,h=new Set;if(n.length){let l,p=1e4;n.forEach(d=>{let u=s.find(m=>m.options.id===d.options.id);if(u instanceof Ae){let{x:m,y:g}=u.clientPos,y=Math.sqrt((m-o.offsetX)**2+(g-o.offsetY)**2);y<p&&(p=y,l=d)}else if(u instanceof rt){let{x:m,y:g}=u.box.getCenter(new js.Vector2),y=Math.sqrt((m-o.offsetX)**2+(g-o.offsetY)**2);y<p&&(p=y,l=d)}}),h.add(l)}h.size||i.forEach(l=>h.add(l)),h.forEach(l=>{if(this.graphicTimerMap.get(l)||this.curGraphics.has(l))return;let p=this.timer.setTimeout(()=>{this.curGraphics.add(l),this.graphicTimerMap.delete(l),this.timer.clearTimeout(p),this.handleHoverGraphicsChange()},r);this.graphicTimerMap.set(l,p)}),this.graphicTimerMap.forEach((l,p)=>{h.has(p)||(this.timer.clearTimeout(l),this.graphicTimerMap.delete(p))});let c=this.curGraphics.size;this.curGraphics.forEach(l=>{h.has(l)||this.curGraphics.delete(l)}),c!==this.curGraphics.size&&this.handleHoverGraphicsChange()},this.onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()},this.onBodyPointerMove=e=>{if(this.curGraphics.size){let i=this.context.container.getBoundingClientRect();(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom)&&this.onPointerLevel()}},this.registryEvent()}};var px=require("core-js/modules/web.dom-collections.iterator.js"),Zt=require("three");var ns=require("@turf/turf"),Vs=class{updateBox(){this.box.setFromObject(this.context.scene)}setEnable(t){this.enable=t,t?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(m=>m instanceof oe).length)return null;let e=this.box,{camera:i,clientSize:{width:s,height:o}}=this.context,{min:n,max:r}=e,c=[new Zt.Vector3(n.x,n.y,n.z),new Zt.Vector3(r.x,n.y,n.z),new Zt.Vector3(n.x,r.y,n.z),new Zt.Vector3(r.x,r.y,n.z),new Zt.Vector3(n.x,n.y,r.z),new Zt.Vector3(r.x,n.y,r.z),new Zt.Vector3(n.x,r.y,r.z),new Zt.Vector3(r.x,r.y,r.z)].map(m=>O(m,i,s,o)),l=Math.min(...c.map(m=>m.x)),p=Math.max(...c.map(m=>m.x)),d=Math.min(...c.map(m=>m.y)),u=Math.max(...c.map(m=>m.y));return{left:l,right:p,top:d,bottom:u}}checkDistanceToScreenEdge(t){let{left:e,right:i,top:s,bottom:o}=t,{width:n,height:r}=this.context.clientSize,[h,c,l,p]=this.context.config.cameraBound.padding,d=(0,ns.polygon)([[[e,s],[i,s],[i,o],[e,o],[e,s]]]),u=(0,ns.polygon)([[[p,h],[n-c,h],[n-c,r-l],[p,r-l],[p,h]]]);try{return(0,ns.intersect)(d,u)!==null}catch(m){return console.warn("\u8BA1\u7B97\u4EA4\u96C6\u51FA\u9519:",m),!1}}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new Zt.Vector3,zoom:1,target:new Zt.Vector3},this.enable=!0,this.box=new Zt.Box3,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:i,right:s,top:o,bottom:n}=e;this.checkDistanceToScreenEdge({left:i,right:s,top:o,bottom:n})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var vx=require("core-js/modules/es.promise.finally.js"),qo=require("three"),$e=require("@tweenjs/tween.js");var fx=require("core-js/modules/web.dom-collections.iterator.js"),gx=require("core-js/modules/es.array.push.js"),b=require("three"),Ks=new b.Ray,Yr=new b.Plane,_h=Math.cos(70*b.MathUtils.DEG2RAD),Ys=class extends b.EventDispatcher{dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerUp),this.domElement.removeEventListener("wheel",this.onMouseWheel),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp),this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null)}constructor(t,e){super(),this.rotateLineStart=new b.Vector2,this.rotateLineEnd=new b.Vector2,this.spherical=new b.Spherical,this.sphericalDelta=new b.Spherical,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new b.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.screenSpacePanning=!1,this.mouseButtons={LEFT:b.MOUSE.PAN,MIDDLE:b.MOUSE.DOLLY,RIGHT:b.MOUSE.ROTATE},this.touches={ONE:b.TOUCH.PAN,TWO:b.TOUCH.DOLLY_ROTATE},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return r.phi},this.getAzimuthalAngle=function(){return r.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(v){v.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=v},this.stopListenToKeyEvents=function(){var v;(v=this._domElementKeyEvents)==null||v.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent({type:"change"}),i.update(),o=s.NONE},this.update=function(){let v=new b.Vector3,_=new b.Quaternion().setFromUnitVectors(t.up,new b.Vector3(0,1,0)),Y=_.clone().invert(),ct=new b.Vector3,zt=new b.Quaternion,he=new b.Vector3,ee=2*Math.PI;return function(Mi){Mi===void 0&&(Mi=null);let ve=i.object.position;v.copy(ve).sub(i.target),v.applyQuaternion(_),r.setFromVector3(v),i.autoRotate&&o===s.NONE&&T(A(Mi)),i.enableDamping?(r.theta+=h.theta*i.dampingFactor,r.phi+=h.phi*i.dampingFactor):(r.theta+=h.theta,r.phi+=h.phi);let xe=i.minAzimuthAngle,we=i.maxAzimuthAngle;isFinite(xe)&&isFinite(we)&&(xe<-Math.PI?xe+=ee:xe>Math.PI&&(xe-=ee),we<-Math.PI?we+=ee:we>Math.PI&&(we-=ee),xe<=we?r.theta=Math.max(xe,Math.min(we,r.theta)):r.theta=r.theta>(xe+we)/2?Math.max(xe,r.theta):Math.min(we,r.theta)),r.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,r.phi)),r.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(l,i.dampingFactor):i.target.add(l),i.zoomToCursor&&q||i.object.isOrthographicCamera?r.radius=K(r.radius):r.radius=K(r.radius*c),v.setFromSpherical(r),v.applyQuaternion(Y),ve.copy(i.target).add(v),i.object.lookAt(i.target),i.enableDamping===!0?(h.theta*=1-i.dampingFactor,h.phi*=1-i.dampingFactor,l.multiplyScalar(1-i.dampingFactor)):(h.set(0,0,0),l.set(0,0,0));let Ms=!1;if(i.zoomToCursor&&q){let _i=null;if(i.object.isPerspectiveCamera){let Pi=v.length();_i=K(Pi*c);let _s=Pi-_i;i.object.position.addScaledVector(k,_s),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){let Pi=new b.Vector3(D.x,D.y,0);Pi.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),Ms=!0;let _s=new b.Vector3(D.x,D.y,0);_s.unproject(i.object),i.object.position.sub(_s).add(Pi),i.object.updateMatrixWorld(),_i=v.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;_i!==null&&(i.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(_i).add(i.object.position):(Ks.origin.copy(i.object.position),Ks.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(Ks.direction))<_h?t.lookAt(i.target):(Yr.setFromNormalAndCoplanarPoint(i.object.up,i.target),Ks.intersectPlane(Yr,i.target))))}else i.object.isOrthographicCamera&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),Ms=!0);return c=1,q=!1,Ms||ct.distanceToSquared(i.object.position)>n||8*(1-zt.dot(i.object.quaternion))>n||he.distanceToSquared(i.target)>0?(i.dispatchEvent({type:"change"}),ct.copy(i.object.position),zt.copy(i.object.quaternion),he.copy(i.target),Ms=!1,!0):!1}}();let i=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=s.NONE,n=1e-6,r=new b.Spherical,h=new b.Spherical,c=1,l=new b.Vector3,p=new b.Vector2,d=new b.Vector2,u=new b.Vector2,m=new b.Vector2,g=new b.Vector2,y=new b.Vector2,w=new b.Vector2,M=new b.Vector2,P=new b.Vector2,k=new b.Vector3,D=new b.Vector2,q=!1,E=[],Q={};function A(v){return v!==null?2*Math.PI/60*i.autoRotateSpeed*v:2*Math.PI/60/60*i.autoRotateSpeed}function I(){return Math.pow(.95,i.zoomSpeed)}function T(v){h.theta-=v}function H(v){h.phi-=v}let ot=function(){let v=new b.Vector3;return function(Y,ct){v.setFromMatrixColumn(ct,0),v.multiplyScalar(-Y),l.add(v)}}(),V=function(){let v=new b.Vector3;return function(Y,ct){i.screenSpacePanning===!0?v.setFromMatrixColumn(ct,1):(v.setFromMatrixColumn(ct,0),v.crossVectors(i.object.up,v)),v.multiplyScalar(Y),l.add(v)}}(),B=function(){let v=new b.Vector3;return function(Y,ct){let zt=i.domElement;if(i.object.isPerspectiveCamera){let he=i.object.position;v.copy(he).sub(i.target);let ee=v.length();ee*=Math.tan(i.object.fov/2*Math.PI/180),ot(2*Y*ee/zt.clientHeight,i.object.matrix),V(2*ct*ee/zt.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(ot(Y*(i.object.right-i.object.left)/i.object.zoom/zt.clientWidth,i.object.matrix),V(ct*(i.object.top-i.object.bottom)/i.object.zoom/zt.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function ge(v){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=v:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function Ce(v){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=v:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function N(v){if(!i.zoomToCursor)return;q=!0;let _=i.domElement.getBoundingClientRect(),Y=v.clientX-_.left,ct=v.clientY-_.top,zt=_.width,he=_.height;D.x=Y/zt*2-1,D.y=-(ct/he)*2+1,k.set(D.x,D.y,1).unproject(i.object).sub(i.object.position).normalize()}function K(v){return Math.max(i.minDistance,Math.min(i.maxDistance,v))}function ht(v){p.set(v.clientX,v.clientY)}function nt(v){N(v),w.set(v.clientX,v.clientY)}function re(v){m.set(v.clientX,v.clientY)}function ae(v){d.set(v.clientX,v.clientY),u.subVectors(d,p).multiplyScalar(i.rotateSpeed);let _=i.domElement;T(2*Math.PI*u.x/_.clientHeight),H(2*Math.PI*u.y/_.clientHeight),p.copy(d),i.update()}function Te(v){M.set(v.clientX,v.clientY),P.subVectors(M,w),P.y>0?ge(I()):P.y<0&&Ce(I()),w.copy(M),i.update()}function ye(v){g.set(v.clientX,v.clientY),y.subVectors(g,m).multiplyScalar(i.panSpeed),B(y.x,y.y),m.copy(g),i.update()}function wi(v){N(v),v.deltaY<0?Ce(I()):v.deltaY>0&&ge(I()),i.update()}function wa(v){let _=!1;switch(v.code){case i.keys.UP:v.ctrlKey||v.metaKey||v.shiftKey?H(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):B(0,i.keyPanSpeed),_=!0;break;case i.keys.BOTTOM:v.ctrlKey||v.metaKey||v.shiftKey?H(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):B(0,-i.keyPanSpeed),_=!0;break;case i.keys.LEFT:v.ctrlKey||v.metaKey||v.shiftKey?T(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):B(i.keyPanSpeed,0),_=!0;break;case i.keys.RIGHT:v.ctrlKey||v.metaKey||v.shiftKey?T(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):B(-i.keyPanSpeed,0),_=!0;break}_&&(v.preventDefault(),i.update())}function En(){if(E.length===1)p.set(E[0].pageX,E[0].pageY);else{let v=(E[0].pageX-E[0].pageY)/(E[1].pageX-E[1].pageY),_=E[0].pageY-v*E[0].pageX;i.rotateLineStart.set(v,_);let Y=.5*(E[0].pageX+E[1].pageX),ct=.5*(E[0].pageY+E[1].pageY);p.set(Y,ct)}}function Ln(){if(E.length===1)m.set(E[0].pageX,E[0].pageY);else{let v=.5*(E[0].pageX+E[1].pageX),_=.5*(E[0].pageY+E[1].pageY);m.set(v,_)}}function Cn(){let v=E[0].pageX-E[1].pageX,_=E[0].pageY-E[1].pageY,Y=Math.sqrt(v*v+_*_);w.set(0,Y)}function Ma(){i.enableZoom&&Cn(),i.enablePan&&Ln()}function _a(){i.enableZoom&&Cn(),i.enableRotate&&En()}function Tn(v){if(E.length==1)d.set(v.pageX,v.pageY);else{let Y=mo(v),ct=.5*(v.pageX+Y.x),zt=.5*(v.pageY+Y.y);d.set(ct,zt);let he=(v.pageY-Y.y)/(v.pageX-Y.x),ee=Y.y-he*Y.x;if(i.rotateLineEnd.set(he,ee),Number.isFinite(i.rotateLineEnd.x)&&Number.isFinite(i.rotateLineStart.x)){let fo=(i.rotateLineStart.y-i.rotateLineEnd.y)/(i.rotateLineEnd.x-i.rotateLineStart.x),Mi=he*fo+ee;if(Number.isFinite(fo)&&Number.isFinite(Mi)){let ve=Math.atan(i.rotateLineEnd.x)-Math.atan(i.rotateLineStart.x);Math.PI-Math.abs(ve)<.5&&(ve=-Math.sign(ve)*(Math.PI-Math.abs(ve))),Math.abs(ve)<.1&&(h.theta+=ve)}}i.rotateLineStart.copy(i.rotateLineEnd)}u.subVectors(d,p).multiplyScalar(i.rotateSpeed);let _=i.domElement;H(2*Math.PI*u.y/_.clientHeight),p.copy(d)}function kn(v){if(E.length===1)g.set(v.pageX,v.pageY);else{let _=mo(v),Y=.5*(v.pageX+_.x),ct=.5*(v.pageY+_.y);g.set(Y,ct)}y.subVectors(g,m).multiplyScalar(i.panSpeed),B(y.x,y.y),m.copy(g)}function Dn(v){let _=mo(v),Y=v.pageX-_.x,ct=v.pageY-_.y,zt=Math.sqrt(Y*Y+ct*ct);M.set(0,zt),P.set(0,Math.pow(M.y/w.y,i.zoomSpeed)),ge(P.y),w.copy(M)}function Pa(v){i.enableZoom&&Dn(v),i.enablePan&&kn(v)}function ba(v){i.enableZoom&&Dn(v),i.enableRotate&&Tn(v)}this.onPointerDown=function(_){i.enabled!==!1&&(E.length===0&&(i.domElement.setPointerCapture(_.pointerId),i.domElement.addEventListener("pointermove",i.onPointerMove),i.domElement.addEventListener("pointerup",i.onPointerUp)),Ta(_),_.pointerType==="touch"?La(_):Sa(_))},this.onPointerMove=function(_){i.enabled!==!1&&(_.pointerType==="touch"?Ca(_):Ea(_))},this.onPointerUp=function(_){ka(_),E.length===0&&(i.domElement.releasePointerCapture(_.pointerId),i.domElement.removeEventListener("pointermove",i.onPointerMove),i.domElement.removeEventListener("pointerup",i.onPointerUp)),i.dispatchEvent({type:"end"}),o=s.NONE};function Sa(v){let _;switch(v.button){case 0:_=i.mouseButtons.LEFT;break;case 1:_=i.mouseButtons.MIDDLE;break;case 2:_=i.mouseButtons.RIGHT;break;default:_=-1}switch(_){case b.MOUSE.DOLLY:if(i.enableZoom===!1)return;nt(v),o=s.DOLLY;break;case b.MOUSE.ROTATE:if(v.ctrlKey||v.metaKey||v.shiftKey){if(i.enablePan===!1)return;re(v),o=s.PAN}else{if(i.enableRotate===!1)return;ht(v),o=s.ROTATE}break;case b.MOUSE.PAN:if(v.ctrlKey||v.metaKey||v.shiftKey){if(i.enableRotate===!1)return;ht(v),o=s.ROTATE}else{if(i.enablePan===!1)return;re(v),o=s.PAN}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent({type:"start"})}function Ea(v){switch(o){case s.ROTATE:if(i.enableRotate===!1)return;ae(v);break;case s.DOLLY:if(i.enableZoom===!1)return;Te(v);break;case s.PAN:if(i.enablePan===!1)return;ye(v);break}}this.onMouseWheel=function(_){i.enabled===!1||i.enableZoom===!1||o!==s.NONE||(_.preventDefault(),i.dispatchEvent({type:"start"}),wi(_),i.dispatchEvent({type:"end"}))},this.onKeyDown=function(_){i.enabled===!1||i.enablePan===!1||wa(_)};function La(v){switch(An(v),E.length){case 1:switch(i.touches.ONE){case b.TOUCH.ROTATE:if(i.enableRotate===!1)return;En(),o=s.TOUCH_ROTATE;break;case b.TOUCH.PAN:if(i.enablePan===!1)return;Ln(),o=s.TOUCH_PAN;break;default:o=s.NONE}break;case 2:switch(i.touches.TWO){case b.TOUCH.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Ma(),o=s.TOUCH_DOLLY_PAN;break;case b.TOUCH.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;_a(),o=s.TOUCH_DOLLY_ROTATE;break;default:o=s.NONE}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent({type:"start"})}function Ca(v){switch(An(v),o){case s.TOUCH_ROTATE:if(i.enableRotate===!1)return;Tn(v),i.update();break;case s.TOUCH_PAN:if(i.enablePan===!1)return;kn(v),i.update();break;case s.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Pa(v),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;ba(v),i.update();break;default:o=s.NONE}}this.onContextMenu=function(_){i.enabled!==!1&&_.preventDefault()};function Ta(v){E.push(v)}function ka(v){delete Q[v.pointerId];for(let _=0;_<E.length;_++)if(E[_].pointerId==v.pointerId){E.splice(_,1);return}}function An(v){let _=Q[v.pointerId];_===void 0&&(_=new b.Vector2,Q[v.pointerId]=_),_.set(v.pageX,v.pageY)}function mo(v){let _=v.pointerId===E[0].pointerId?E[1]:E[0];return Q[_.pointerId]}i.domElement.addEventListener("contextmenu",this.onContextMenu),i.domElement.addEventListener("pointerdown",this.onPointerDown),i.domElement.addEventListener("pointercancel",this.onPointerUp),i.domElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),this.update()}};var rs=class extends Ys{registryEvent(){this.addEventListener("change",this.onChange),this.context.addEventListener("update",this.tweenUpdate)}unRegistryEvent(){this.removeEventListener("change",this.onChange),this.context.removeEventListener("update",this.tweenUpdate)}setPolarAngle(t,e){e===void 0&&(e=!1);let{maxPolarAngle:i,minPolarAngle:s}=this,o=i===s;(e||t<=i&&t>=s)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=i,this.minPolarAngle=s)}setPolarAngleByDuration(t,e,i){return f(this,null,function*(){return e===void 0&&(e=!1),i===void 0&&(i=500),i<=0?this.setPolarAngle(t,e):Wt(new Promise(s=>{let o={polar:this.getPolarAngle()},n={polar:t},r=new $e.Tween(o,this.tweenGroup).to(n,i).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(r),s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:i,minAzimuthAngle:s}=this,o=i===s;(e||t<=i&&t>=s)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=i,this.minAzimuthAngle=s)}setAzimuthalAngleDuration(t,e,i){return e===void 0&&(e=!1),i===void 0&&(i=500),i<=0?this.setAzimuthalAngle(t,e):Wt(new Promise(s=>{let o={azimuthal:this.getAzimuthalAngle()},n={azimuthal:t},r=new $e.Tween(o,this.tweenGroup).to(n,i).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(r),s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)}getCameraLookAt(){return new qo.Vector3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return f(this,null,function*(){let i=this.target.clone(),s=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(s)),this.target.copy(t.clone()),this.update();return}return Wt(new Promise(o=>{let n=new $e.Tween(i,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(i.clone().sub(s)),this.target.copy(i.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(n),this.enabled=!0,o(!0)}).onStart(()=>{this.enabled=!1}).start()}),e+500)})}setZoom(t,e,i){i===void 0&&(i=!1);let{minZoom:s,maxZoom:o}=this;(i||t>=s&&t<=o)&&(this.camera.position.copy(e.clone().sub(this.getCameraLookAt())),this.target.copy(e),this.camera.zoom=t,this.update())}setZoomByDuration(t,e,i,s){return f(this,null,function*(){i===void 0&&(i=!1),s===void 0&&(s=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return s?Wt(new Promise(n=>{let r=new $e.Tween(o,this.tweenGroup).to({zoom:t,target:e},s).onUpdate(()=>{this.setZoom(o.zoom,o.target,i)}).onComplete(()=>{this.tweenGroup.remove(r),this.enabled=!0,n(!0)}).onStart(()=>{this.enabled=!1}).start()}),s+500).finally(()=>{this.enabled=!0}):this.setZoom(t,e,i)})}setTargetByOffset(t,e){if(e===void 0&&(e=this.target.clone()),this.camera.updateMatrix(),t){let i=new qo.Vector3;i.setFromMatrixColumn(this.camera.matrix,1),i.normalize(),i.multiplyScalar(t/this.camera.zoom),e.add(i)}this.setCameraPositionByTarget(e,0)}clearTween(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}dispose(){super.dispose(),this.unRegistryEvent(),this.clearTween()}constructor(t,e,i){super(e,i),this.context=t,this.camera=e,this.domElement=i,this.prevCameraZoom=1,this.tweenGroup=new $e.Group,this.offsetY=0,this.onChange=()=>{let s=this.camera.zoom;s!==this.prevCameraZoom&&(this.prevCameraZoom=s,this.dispatchEvent({type:"change-zoom",zoom:s}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};var pi=require("three");var as=class extends pi.WebGLRenderer{setCameraAndScene(t,e){this.scene=t,this.camera=e}autoRender(){if(this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.context.config.renderAnimation==="requestAnimationFrame")this.timer.requestAnimationFrame(()=>{this.autoRender()});else{let t=1e3/this.context.config.fps;this.timer.setTimeout(()=>{this.autoRender()},t)}}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(t,e){this.event.addEventListener(t,e)}removeEventListener(t,e){this.event.removeEventListener(t,e)}constructor(t,e){super(x({antialias:!0,alpha:!0},e)),this.context=t,this.event=new pi.EventDispatcher,this.enable=!0,this.timer=new $,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.toneMapping=pi.LinearToneMapping,this.toneMappingExposure=1;let i=this.dispose;this.dispose=()=>{this.timer.dispose(),this.enable=!1,i.call(this),this.domElement.remove(),this.domElement=null,this.shadowMap=null,this.info.programs&&(this.info.programs.length=0),this.info=null}}};var Jr=require("three");var Xr=require("three"),qr=require("three/examples/jsm/environments/RoomEnvironment.js");function $r(a,t){t===void 0&&(t=.85);let e=new Xr.PMREMGenerator(a);return e.compileEquirectangularShader(),e.fromScene(new qr.RoomEnvironment).texture}var hs=class extends Jr.Scene{dispose(){var t;(t=this.environment)==null||t.dispose(),this.environment=null,G(this),this.clear()}constructor(t){super(),this.environment=$r(t)}};var Qr=require("three"),cs=class extends Qr.OrthographicCamera{constructor(t,e){super(-t/2,t/2,e/2,-e/2,-1e4,5e4),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var $o=require("@turf/turf");var Dx=require("core-js/modules/es.array.unshift.js"),Ax=require("core-js/modules/es.array.push.js"),ta=require("three"),Xs=class{registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-change",this.onControlChange),this.context.addEventListener("resize",this.onControlChange)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-change",this.onControlChange),this.context.removeEventListener("resize",this.onControlChange)}changePoiLevelOrCollisionEnable(t){let e=this.objects.findIndex(i=>i===t);e!==-1&&(this.objects.splice(e,1),this.addObject(t))}addObject(t){if(!this.objects.includes(t)){if(this.needsUpdate=!0,!t.options.collision_enable){this.objects.unshift(t);return}if(t.options.level===0){this.objects.push(t);return}for(let e=0;e<this.objects.length;e++){let i=this.objects[e];if(i.options.collision_enable&&i.options.level<=t.options.level){this.objects.splice(e,0,t);return}}this.objects.push(t)}}removeObject(t){let e=this.objects.indexOf(t);e!==-1&&(this.objects.splice(e,1),this.needsUpdate=!0)}removeObjects(t){this.objects=this.objects.filter(e=>!t.includes(e)),this.needsUpdate=!0}getObjectById(t){return this.objects.find(e=>e.options.id===t)||null}validShowParkingSpace(t){t===void 0&&(t=60);let{clientSize:{width:e,height:i},control:s,camera:o}=this.context,n=Math.min(e/t,i/t,s.maxZoom-1);return o.zoom>=n}detectCollisions(){if(!this.needsUpdate)return;let t=[],{camera:e}=this.context;e.updateMatrixWorld();let i=l=>l<=1&&l>=-1,s=e.projectionMatrix.clone();s.multiply(e.matrixWorldInverse);let o=e.zoom/this.context.basicZoom,n=25/30,r=Math.min(25,Math.max(1,o*n)),h=this.validShowParkingSpace();this.objects.filter(l=>{if(l.visible){if(!(r<=l.options.maxWeight&&r>=l.options.minWeight)||!h&&l.userData.type==="parkingSpace")return l.parentSetVisible(!1),!1;let p=l.getWorldPosition(new ta.Vector3);return p.applyMatrix4(s),l.screenPosition=p,i(p.x)&&i(p.y)&&i(p.z)?!0:(l.parentSetVisible(!1),!1)}return!1}).forEach((l,p)=>{let d=l.getBox(l.screenPosition);if(d===null){l.parentSetVisible(!1);return}if(p===0||!l.options.collision_enable){t.push(d),l.parentSetVisible(!0);return}let u=t.some(m=>m.intersectsBox(d));l.parentSetVisible(!u),u||t.push(d)}),this.needsUpdate=!1}markForUpdate(){this.needsUpdate=!0}clear(){this.objects=[],this.needsUpdate=!0}dispose(){this.objects=[],this.unRegistryEvent()}constructor(t){this.context=t,this.objects=[],this.needsUpdate=!0,this.onUpdate=()=>{this.detectCollisions()},this.onControlChange=()=>{this.needsUpdate=!0},this.registryEvent()}};var ls=class extends U.EventDispatcher{get config(){return this.bmap.config}get center(){return this.bmap.buildingCenter}setRange(t){this.range=(0,$o.polygon)([t])}resizeClientSize(){let{x:t,y:e,width:i,height:s}=this.container.getBoundingClientRect();this.clientSize={width:i||this.container.clientWidth,height:s||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new cs(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new rs(this,this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",this.onControlChange),this.control.addEventListener("change-zoom",this.onControlChangeZoom),this.renderer.addEventListener("update",this.onRendererUpdate),this.cameraBound=new Vs(this)}getRatio(t,e){t===void 0&&(t=new U.Vector3(0,0,0)),e===void 0&&(e=new U.Vector3(100,0,0));let{clientWidth:i,clientHeight:s}=this.container,o=O(t,this.camera,i,s),n=O(e,this.camera,i,s);return Math.ceil(Math.sqrt((n.x-o.x)**2+(n.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof U.AmbientLight&&(e.color=new U.Color(t))})}switchFloor(t,e){e===void 0&&(e=!0),console.log("switchFloor",e),this.currentFloor&&(this.scene.remove(this.currentFloor),e?this.currentFloor.dispose():this.currentFloor.onRemoveFromScene()),this.currentFloor=t,this.setRange(t.userData.range||[]),this.scene.add(t),t.onAddToScene("scene"),this.cameraBound.updateBox()}getGraphicsByDeviceXy(t,e){var i;let s=new U.Vector2;s.x=t/this.clientSize.width*2-1,s.y=e/this.clientSize.height*-2+1;let o=new U.Raycaster;return o.setFromCamera(s,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),((i=this.currentFloor)==null?void 0:i.graphicLayer.getGraphicByRaycaster(o))||{graphics:[],position:null}}getPoisByDeviceXy(t,e){var i,s;let o=(i=this.currentFloor)==null?void 0:i.poiLayer.getPoiByDeviceXy(t,e),n=(s=this.currentFloor)==null?void 0:s.poiLayer2.getPoiByDeviceXy(t,e);return(o||[]).concat(n||[])}registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange),this.control.removeEventListener("change",this.onControlChange),this.control.removeEventListener("change-zoom",this.onControlChangeZoom),this.renderer.removeEventListener("update",this.onRendererUpdate)}setPolarAngle(t,e){return e===void 0&&(e=500),this.control.setPolarAngleByDuration(t,!0,e)}setAzimuthalAngle(t,e){return e===void 0&&(e=500),this.control.setAzimuthalAngleDuration(t,!0,e)}getCameraLookAt(){return this.control.getCameraLookAt()}setZoom(t,e,i){return i===void 0&&(i=500),this.control.setZoomByDuration(t,e,!0,i)}getFitCameraToObjectZoom(t,e,i){return e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=!0),this.getFitCameraToBoxZoom(new U.Box3().setFromObject(t),e,i)}getFitCameraToBoxZoom(t,e,i){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=!0);let[s,o,n,r]=e,{clientSize:{width:h,height:c}}=this,l=this.control.getPolarAngle();i&&this.setPolarAngle(0,0),this.setPolarAngle(l,0);let{max:p,min:d}=t,u=new U.Vector3(d.x,p.y,p.z),m=new U.Vector3(p.x,p.y,p.z),g=new U.Vector3(p.x,d.y,d.z),y=new U.Vector3(d.x,d.y,d.z),w=O(u,this.camera,h,c),M=O(m,this.camera,h,c),P=O(y,this.camera,h,c),k=O(g,this.camera,h,c),q=new U.Box2().setFromPoints([new U.Vector2(w.x,w.y),new U.Vector2(M.x,M.y),new U.Vector2(P.x,P.y),new U.Vector2(k.x,k.y)]).getSize(new U.Vector2),E=(h-o-r)/q.x,Q=(c-s-n)/q.y,A=Math.min(E,Q),I=new U.Vector3((p.x+d.x)/2,(p.y+d.y)/2,(p.z+d.z)/2),T=A*this.camera.zoom,H=this.camera.clone();H.zoom=T,H.updateMatrix();let ot=(o-r)/2,V=(s-n)/2;if(ot){let B=new U.Vector3;B.setFromMatrixColumn(H.matrix,0),B.normalize(),B.multiplyScalar(ot/T),I.add(B)}if(V){let B=new U.Vector3;B.setFromMatrixColumn(H.matrix,1),B.normalize(),B.multiplyScalar(V/T),I.add(B)}return{zoom:A*this.camera.zoom,center:I}}fitCameraToObject(t,e,i,s){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500),s===void 0&&(s=!0);let{zoom:o,center:n}=this.getFitCameraToObjectZoom(t,e,s);return this.setZoom(o,n,i)}fitCameraToBox(t,e,i,s){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500),s===void 0&&(s=!0);let{zoom:o,center:n}=this.getFitCameraToBoxZoom(t,e,s);return this.setZoom(o,n,i)}getFitCameraToGroundZoom(t,e,i){if(t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),i===void 0&&(i=!0),this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,i).zoom}fitCameraToGround(t,e,i){return t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),i===void 0&&(i=!0),this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundLayer,t,e,i):Promise.resolve(!1)}setCameraPosition(t,e){return f(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}forceUpdate(){this.collisionSystem.needsUpdate=!0}dispose(){var t;this.collisionSystem.dispose(),(t=this.currentFloor)==null||t.dispose(),this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.dispose(),this.lights.children.forEach(e=>e.dispose()),this.scene.dispose(),this.container=null,this.renderer=null}constructor(t,e){super(),this.container=t,this.lights=vo(),this.range=(0,$o.polygon)([]),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,this.basicZoom=1,this.onControlChange=()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})},this.onControlChangeZoom=i=>{let{zoom:s}=i;this.dispatchEvent({type:"control-zoom-change",zoom:s})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:i,camera:s,renderer:o}=this,{clientWidth:n,clientHeight:r}=i;n=Math.max(1,n),r=Math.max(1,r),s.left=-n/2,s.right=n/2,s.top=r/2,s.bottom=-r/2,s.updateProjectionMatrix(),o.setSize(n,r),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:n,height:r})},this.onClick=i=>{let{graphics:s,position:o}=this.getGraphicsByDeviceXy(i.offsetX,i.offsetY);s.length&&this.dispatchEvent({type:"graphic-click",graphics:s,position:o});let n=this.getPoisByDeviceXy(i.offsetX,i.offsetY);n.length&&this.dispatchEvent({type:"poi-click",pois:n})},this.onPointerover=i=>{let{graphics:s,position:o}=this.getGraphicsByDeviceXy(i.offsetX,i.offsetY),n=this.getPoisByDeviceXy(i.offsetX,i.offsetY);this.dispatchEvent({type:"pointer-over",e:i,graphics:s,pois:n,position:o})},this.onPointermove=i=>{let{graphics:s,position:o}=this.getGraphicsByDeviceXy(i.offsetX,i.offsetY),n=this.getPoisByDeviceXy(i.offsetX,i.offsetY);this.dispatchEvent({type:"pointer-move",e:i,graphics:s,pois:n,position:o})},this.onPointerleave=i=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=i=>{let{graphics:s,isMultipleSelect:o}=i;this.dispatchEvent({type:"select-graphic",graphics:s,isMultipleSelect:o})},this.onHoverChange=i=>{let{graphics:s}=i;this.dispatchEvent({type:"hover",graphics:s})},this.bmap=e,this.container.style.position="relative",this.container.style.overflow="hidden",this.renderer=new as(this),this.scene=new hs(this.renderer),this.collisionSystem=new Xs(this),this.init(),this.selection=new ss(this),this.hoverHelper=new os(this),this.resizeClientSize(),this.registryEvent()}};var ea=require("lodash"),ia={placeId:0,fps:30,apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get",loadPlaceInfo:"https://screen.aibee.cn/ai-map/map/get-floor-map"},enableBoxSelect:!0,resizeObserver:{enable:!1,debounceTime:5},initTransToMark:!1,heatMap:{radius:50,minOpacity:.1,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0,maxZoomScale:30},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1},loaderPlaceConfig:{textFontSize:14},renderAnimation:"setTimeout"};function Jo(a){return typeof a.resizeObserver=="boolean"&&(a.resizeObserver={enable:a.resizeObserver}),(0,ea.merge)({},ia,a)}var ra=require("lodash");var n0=require("core-js/modules/web.dom-collections.iterator.js");var Js=require("three");var $x=require("core-js/modules/es.array.push.js"),Jx=require("core-js/modules/web.dom-collections.iterator.js");var Kx=require("core-js/modules/es.array.sort.js");var di=function(a){return a.LAYERED_RENDER_VERSION="layeredRender",a.MERGED_RENDER_VERSION="mergedRender",a}({});function qs(a,t){let e=a.poi_info.showName||a.store_name||a.poi_info.text;switch(t){case"zh-cn":return e;case"en":var i;return((i=a.store_info_ext)==null?void 0:i.poi_name)||e;case"zh-hk":var s;return((s=a.store_info_ext)==null?void 0:s.traditional_name)||e}}function $s(a,t){let e=a.poi_info.showName||a.store_name||a.poi_info.text;switch(t){case"zh-cn":return e;case"en":var i;return((i=a.infra_info_ext)==null?void 0:i.poi_name)||e;case"zh-hk":var s;return((s=a.infra_info_ext)==null?void 0:s.traditional_name)||e}}var Qo=["range","ground","store","facility","parkingSpace"];function sa(a){return Qo.indexOf(a.l_type)===-1?Qo.length:Qo.indexOf(a.l_type)}function Ph(a){a.layers.sort((t,e)=>sa(t)-sa(e))}function bh(a){let t=a.layers.find(i=>i.l_type==="range"),e=[t.elements[0].center_x,t.elements[0].center_y];a.layers.map(i=>{if(i.l_type!=="range")return Di(i.elements,e)})}function ps(a){Ph(a),bh(a)}function ui(a,t){return t===void 0&&(t=5),a.floor_id+"_"+a.version_id+(t?"_"+t:"")}function oa(a,t,e){switch(a.l_type){case"ground":return tn(a,t);case"graph":return Sh(a,t);case"wall":return Eh(a,t);case"lane":return Lh(a,t);case"texture2d":case"texture3d":return Ch(a,t);case"glb":return Th(a,t);case"store":return kh(a,t,e);case"facility":return Ah(a,t,e);case"parkingSpace":return Ih(a,t,e);case"text":return Fh(a,t)}}function na(a,t,e,i,s){switch(a.l_type){case"store":return Dh(a,t,e,i,s);case"facility":return Oh(a,t,e,i,s);case"parkingSpace":return Rh(a,t,i,s)}}function Sh(a,t){t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements)}function tn(a,t){let e=a.elements.map(i=>new gt(t.context,x({},i,{dashed:!1})));t.addGrounds(e)}function Eh(a,t){if(a.mergedElements)a.mergedElements.map(e=>{if(e.instancedGeometry){let i=new is(t.context,e.instancedGeometry);t.wallLayer.add(i)}if(e.mergedGeometry){let i=new ts(t.context,e);t.wallLayer.add(i)}});else{let e=a.elements.reduce((i,s)=>{let{fillColor:o,fillOpacity:n,strokeColor:r,strokeOpacity:h,height:c}=s,l=o.toLowerCase()+"-"+n+"-"+r.toLowerCase()+"-"+h+"-"+c;return h===0&&(l=o.toLowerCase()+"-"+n+"-"+c),i[l]?i[l].push(s):i[l]=[s],i},{});Object.values(e).forEach(i=>{let s=new $i(t.context,i);t.wallLayer.add(s)})}}function Lh(a,t){if(a.mergedElements){let e=new es(t.context,a.mergedElements);t.laneLayer.add(e)}else{let e=new Ji(t.context,a.elements);t.laneLayer.add(e)}}function Ch(a,t){if(a.mergedMatrixes)a.mergedMatrixes.map(e=>{let i=new Ie(t.context,e);t.textureLayer.add(i)});else if(a.elements.length){let e=new Oe(t.context,a.elements);t.textureLayer.add(e)}}function Th(a,t){t.glbModelLayer.addModels(a.elements.map(e=>x({},e,{url:e.secondUrl,rotate:e.secondRotate,width:e.secondWidth,center_x:e.center_coord_x,center_y:e.center_coord_y,deltaHeight:0})))}function kh(a,t,e){e.mergeGraphic?t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements):a.elements.map(i=>{let s=t.addGraphic(x({},i,{dashed:!1}));t.userData.graphics.push(s),t.userData.graphicMap.set(i.id,s)})}function Dh(a,t,e,i,s){a.elements.filter(o=>s.filterPoi(o)).map(o=>{try{let n=qs(o,e),r=new rt(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:n,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},icon_size:[24,24],level:o.poi_info.level||0,hide_text:!i.showStoreName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:i.textFontSize});t.poiLayer2.pushPoi(r),r&&(r.userData.type="store",r.userData.data=o,r.userData.floor=t.name)}catch(n){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",n,o)}})}function Ah(a,t,e){e.mergeGraphic?t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements):a.elements.map(i=>{let s=t.addGraphic(x({},i,{dashed:!1}));t.userData.graphics.push(s),t.userData.graphicMap.set(i.id,s)})}function Oh(a,t,e,i,s){a.elements.filter(o=>o.poi_info).filter(o=>s.filterPoi(o)).map(o=>{try{let n=$s(o,e),r=new rt(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:n,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},icon_size:[24,24],level:o.poi_info.level||0,hide_text:!i.showFacilityName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:i.textFontSize});t.poiLayer2.pushPoi(r),r.userData.type="facility",r.userData.data=o,r.userData.floor=t.name}catch(n){console.log("\u6DFB\u52A0facility\u5931\u8D25",n,o)}})}function Ih(a,t,e){t.parkingSpaceLayer.load(a,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function Rh(a,t,e,i){return f(this,null,function*(){a.elements.filter(o=>o.texts[0]).filter(o=>i.filterPoi(o)).forEach(o=>{try{let n=o.displayName||o.texts[0],r=new rt(t.context,{id:o.id,text:n,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},text_font_size:e.textFontSize});r&&(r.userData.type="parkingSpace",r.userData.data=o,r.userData.floor=t.name),t.poiLayer2.pushPoi(r)}catch(n){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",n,o)}})})}function Fh(a,t){let e=new Qi(t.context,a.elements.map(i=>x({},i,{center_x:i.center_coord_x,center_y:i.center_coord_y})));t.textTextureLayer.add(e)}var Gh={};function en(){return new Worker(new URL("./worker/loader.worker-IS25OEA2.js",Gh.url))}var zh={mergeParkingSpace:!0,mergeGraphic:!0,renderVersion:di.MERGED_RENDER_VERSION,layers:["graph","wall","lane","texture2d","texture3d","glb","store","facility","parkingSpace","text"],filterPoi:()=>!0},Je=class extends lt{initDb(){return f(this,null,function*(){try{let{db:t}=yield ks();this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return f(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=x({},this.placeConfig,e));else if(typeof t=="string"){let i=yield fetch(t).then(s=>s.json());i.code===200&&(this.floors=i.data.list,this.placeConfig=x({},this.placeConfig,JSON.parse(i.data.config||"{}")))}else return this.load("https://screen.aibee.cn/ai-map/map/get-floor-map?place_id="+t);this.getOtherDataByFreeTime()})}setCacheData(t,e,i){return f(this,null,function*(){return this.initDbPromise.then(()=>Ds(t,""+e,i))})}getCacheData(t,e){return f(this,null,function*(){return this.initDbPromise.then(()=>Ri(t,""+e))})}getFloorData(t){return f(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return f(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=qs(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=$s(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return f(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(i=>f(this,null,function*(){let s=ui(t),o=yield fetch(t.map_url).then(n=>n.json());o.floor=t.floor,ps(o),this.setCacheData(Dt.MAP_DATA,s,o),this.setCacheData(Dt.MAP_VERSION,s,t.version_id),i(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return f(this,null,function*(){let e=this.floors.find(i=>i.floor===t);return e?new Promise(i=>f(this,null,function*(){let s=ui(e,this.options.renderVersion===di.LAYERED_RENDER_VERSION?1:void 0);try{let o=ui(e),n=yield this.getCacheData(Dt.MAP_DATA,o);if(n&&n.transformed){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u5408\u5E76\u540E\u7684\u6570\u636E"),i(n);return}if(this.options.renderVersion===di.LAYERED_RENDER_VERSION){let r=yield this.getCacheData(Dt.MAP_DATA,s);if(r){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u6570\u636E"),i(r);return}}if(console.log("\u7F13\u5B58\u4E2D\u6CA1\u6709\u6570\u636E"),this.loadWorker){X(this.loadWorker,"adjust_floor_priority",{floor:t});let r=h=>{if(h.data.type==="floor_success"&&h.data.data.floor===t){var c;(c=this.loadWorker)==null||c.removeEventListener("message",r),i(this.getFloorJsonData(t))}};this.loadWorker.addEventListener("message",r)}else i(this.getFloorJsonDataByFloorInfo(e))}catch(o){console.log("[get floor data error]",o),i(this.getFloorJsonDataByFloorInfo(e))}})):null})}getRoadNetworkData(){return f(this,null,function*(){return(yield Promise.all(this.floors.map(e=>f(this,null,function*(){let i=ui(e,0);try{let s=yield this.getCacheData(Dt.ROAD_NETWORK_DATA,i);if(s)return s;let o=yield fetch(e.route_url).then(n=>n.json());return this.setCacheData(Dt.ROAD_NETWORK_DATA,i,o),this.setCacheData(Dt.ROUTE_VERSION,i,e.version_id),o}catch(s){let o=yield fetch(e.route_url).then(n=>n.json());return this.setCacheData(Dt.ROAD_NETWORK_DATA,i,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return f(this,null,function*(){let t=this.floors.reduce((s,o)=>s.updated_at>o.updated_at?s:o,this.floors[0]);if(!t)return null;let e=ui(t,0),i=()=>f(this,null,function*(){let s=yield fetch(t.entry_infra_url).then(o=>o.json());return s&&(this.setCacheData(Dt.FACILITY_DATA,e,s),this.setCacheData(Dt.FACILITY_VERSION,e,t.version_id)),s});try{let s=yield this.getCacheData(Dt.FACILITY_DATA,e);return s||i()}catch(s){return console.log("[get facility error]",s),i()}})}getOtherDataByFreeTime(){return f(this,null,function*(){yield this.initDbPromise,yield X(this.loadWorker,"load",{floors:this.floors,version:this.options.renderVersion}),this.closeWorker()})}getMulFloorsData(t){return f(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(i=>i))})}getDataByUrl(t){return f(this,null,function*(){let e=yield fetch(t).then(i=>i.json());return this.getDataByJson(e)})}getDataByJson(t,e,i){return f(this,null,function*(){ps(t),e=this.getFloorBaseLayer(t,e);let s=x({},this.placeConfig,i);return yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,s),this.changeFloorBox(t,e),e})}getDataByJsonStep(t,e,i){return f(this,null,function*(){ps(t),e=this.getFloorBaseLayer(t,e);let s=x({},this.placeConfig,i);return this.changeFloorBox(t,e),requestAnimationFrame(()=>f(this,null,function*(){yield this.getFloorContentLayer(t,e),this.changeFloorBox(t,e),requestAnimationFrame(()=>f(this,null,function*(){yield this.getFloorPoi(t,e,s),this.changeFloorBox(t,e)}))})),e})}changeFloorBox(t,e){e.updateBox();let i=e.box.getSize(new Js.Vector3),s=Math.max(i.x,i.y,i.z);e.userData.height=s/4+t.floorHeight}switchFloor(t,e){return f(this,null,function*(){return new Promise(i=>{let s={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(s),n=r=>{let{task:h,res:c}=r;h.tid===o&&(this.taskQueue.removeEventListener("active-task-end",n),i(c))};this.taskQueue.addEventListener("active-task-end",n)})})}_switchFloor(t,e){return f(this,null,function*(){var i;let s=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)s=l;else return null}else ps(t);let o=x({},this.placeConfig,e),n=new oe(this.bmap.context);n.userData.data=t;let r=this.floors.find(l=>l.floor===s.floor);var h;let c=(h=r==null?void 0:r.map_angle)!=null?h:0;return this.bmap.dispatchEvent({type:_t.SWITCH_FLOOR_BEFORE,data:{curFloor:n,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:n,graphics:[],floorData:s}}),this.bmap.context.scene.background=new Js.Color(o.backgroundColor),this.getFloorBaseLayer(s,n),this.changeFloorBox(s,n),this.bmap.buildingCenter=n.userData.center,this.bmap.currentBuildGround=(i=n.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:i.elements[0],this.bmap.context.switchFloor(n),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(c/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:n,graphics:[]}}),this.bmap.dispatchEvent({type:_t.SWITCH_FLOOR_GROUND,data:{curFloor:n}}),yield Ps(),yield this.getFloorContentLayer(s,n),this.changeFloorBox(s,n),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:n,graphics:[]}}),yield bo(2),yield this.getFloorPoi(s,n,o),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:n,graphics:n.graphicLayer.children}}),this.bmap.dispatchEvent({type:_t.SWITCH_FLOOR_AFTER,data:{curFloor:n,graphics:n.graphicLayer.children}}),n})}getFloorBaseLayer(t,e){e||(e=new oe(this.bmap.context));let i=[0,0];return t.layers.forEach(s=>{switch(s.l_type){case"range":let o=s.elements[0];i=[o.center_x,o.center_y],e.userData.range=o.geometry.cds[0],e.userData.rangeGraphic=o;break;case"ground":tn(s,e);break;default:break}}),e.userData.center=i,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return f(this,null,function*(){e||(e=new oe(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let i=Date.now();for(let s=0;s<t.layers.length;s++){let o=t.layers[s];["range","ground"].includes(o.l_type)||this.options.layers.includes(o.l_type)&&(oa(o,e,this.options),console.log("time",Date.now()-i,o.l_type),i=Date.now())}return e})}getFloorPoi(t,e,i){return f(this,null,function*(){i===void 0&&(i=this.placeConfig);let s=Date.now();yield Promise.all(t.layers.map(n=>{if(this.options.layers.includes(n.l_type))return na(n,e,this.locale,i,this.options)})),console.log("poi time",Date.now()-s);let o=Date.now();Ps().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return f(this,null,function*(){mr(),this.db=null})}closeWorker(){this.loadWorker&&(this.loadWorker.terminate(),this.loadWorker=null)}dispose(){super.dispose(),this.clear(),this.closeWorker(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new Ye,this.loadWorker=en(),this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=x({},zh,e),this.placeConfig=x({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var v0=require("core-js/modules/web.dom-collections.iterator.js");function sn(a,t){return f(this,null,function*(){let{brand:e,project:i}=a,{apiDomain:s,apiPath:{floorRange:o},apiInfo:n}=t,r=""+s+o+"?brand="+e+"&project="+i+"&phase="+i+"&building="+i;return yield fetch(r,n).then(c=>c.json()).then(c=>c.data).then(c=>{let l=(c||[])[0];return l&&(l.info=JSON.parse(l.info)),l})})}function on(a,t){return f(this,null,function*(){let{brand:e,project:i,floor:s,ts:o,resource_type_list:n}=a,{apiDomain:r,apiPath:{floorGraphic:h},apiInfo:c}=t,l=""+r+h+"?brand="+e+"&project="+i+"&phase="+i+"&building="+i+"&floor="+s+"&ts="+o+"&resource_type_list="+n;return yield fetch(l,c).then(d=>d.json()).then(d=>d.data).then(d=>((d||[]).map(u=>u.info=JSON.parse(u.info)),d||[]))})}function Bh(a,t){return f(this,null,function*(){let{project:e,floor:i}=a,{apiDomain:s,apiInfo:o}=t,n=s+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+i;return yield fetch(n,o).then(h=>h.json()).then(h=>h.data).then(h=>JSON.parse(h[0].streetInfo||"{}")).then(h=>h.fileId?Wh(h.fileId,t):null)})}function Wh(a,t){return f(this,null,function*(){let{apiDomain:e,apiInfo:i}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+a,i).then(s=>s.arrayBuffer()).then(s=>{let n=new TextDecoder("utf-8").decode(s);return n?JSON.parse(n):null})})}var nn=class{load(t){return f(this,null,function*(){let e=je(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,i]=yield Promise.all([this.loadBuildGround(t),on(t,this.bmap.config)]),s=je({floor:t.floor,ts:t.ts});Di(i.map(n=>n.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(s)||0),i.forEach(n=>n.info.transformToBuildingGround=!1),this.cacheData.set(e,i);let o=this.floorDataLengthMap.get(s)||0;return this.floorDataLengthMap.set(s,o+i.length),this.loadExternalStreet(t),i})}loadExternalStreet(t){return f(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let i=e.userData.legacyToGraphicMap||new Map,s=e.userData.graphicMap||new Map,{ground:o,markGraphic:n,graphic:r}=this.bmap.config;for(let h=0;h<t.length;h++){let c=t[h],l=x({},c,{info:x({},c.info)});if(c.info.group==="ground"){c.info.fillColor=o.color,c.info.fillOpacity=o.opacity,c.info.height=o.height,c.info.stroke=o.stroke,c.info.strokeColor=o.strokeColor,c.info.strokeOpacity=o.strokeOpacity,e.createGround(c.info);continue}else c.info.userData.mark?(c.info.height=n.height,c.info.fillColor=n.color,c.info.fillOpacity=n.opacity,c.info.stroke=n.stroke,c.info.strokeColor=n.strokeColor,c.info.strokeOpacity=n.strokeOpacity):(c.info.fillOpacity=r.fillOpacity,this.bmap.config.initTransToMark&&(c.info.height=n.height,c.info.fillColor=n.color,c.info.stroke=n.stroke,c.info.strokeColor=n.strokeColor,c.info.strokeOpacity=n.strokeOpacity));let p=e.addGraphic(c.info);p.userData.data=l,i.set(c.legacy_id,p),s.set(c.element_uuid,l)}e.userData.legacyToGraphicMap=i,e.userData.graphicMap=s,e.userData.rangeGraphic=this.bmap.currentBuildGround,e.userData.range=this.bmap.currentBuildGround.geometry.cds[0],e.userData.center=this.bmap.buildingCenter,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(_t.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(_t.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let i=e.userData.graphicMap||new Map;return t.filter(s=>!i.has(s.element_uuid))}switchFloorByStoreData(t,e){return f(this,null,function*(){let i=yield this.load(x({},t,{resource_type_list:"6"})),s=this.filterData(i,e);this.switchFloorByData(s,e)})}switchFloorByOtherData(t,e){return f(this,null,function*(){let i=yield this.load(x({},t,{resource_type_list:"1,2,3,4"})),s=this.filterData(i,e);this.switchFloorByData(s,e)})}loadBuildGround(t){return f(this,null,function*(){let{brand:e,project:i}=t,s=yield this.loadBuildingGround({brand:e,project:i});var o;return this.bmap.currentBuildGround=(o=s==null?void 0:s.info)!=null?o:null,this.bmap.changeBuildingCenter(s,{brand:e,project:i}),this.bmap.currentBuildGround})}loadBuildingGround(t){return f(this,null,function*(){let{brand:e,project:i}=t,s=je({brand:e,project:i});if(this.buildingGroundMap.has(s))return this.buildingGroundMap.get(s);let o=sn({brand:e,project:i},this.bmap.config).then(n=>(this.buildingGroundMap.set(s,n),n));return this.buildingGroundMap.set(s,o),o})}switchFloor(t){return f(this,null,function*(){let e=new oe(this.bmap.context);e.userData.graphicMap=new Map,e.name=t.floor;try{yield Promise.all([this.switchFloorByStoreData(t,e),this.switchFloorByOtherData(t,e)])}catch(i){console.log(i)}return e})}dispose(){this.cacheData.clear(),this.floorDataLengthMap.clear(),this.buildingGroundMap.clear()}constructor(t){this.bmap=t,this.cacheData=new Map,this.floorDataLengthMap=new Map,this.buildingGroundMap=new Map,this.externalStreetMap=new Map}};var Uh=function(a){return a[a.D2=0]="D2",a[a.D3=1.1]="D3",a}({}),rn=class extends jt.EventDispatcher{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:i,project:s}=e,o=t?Li(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:s,brand:i})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor(t){return f(this,null,function*(){return this.loader||(this.loader=new Je(this),this.loader.placeConfig=x({},this.loader.placeConfig,this.config.loaderPlaceConfig),yield this.loader.load(this.config.apiPath.loadPlaceInfo+"?place_id="+this.config.placeId+"&env=prod")),this.loader.switchFloor(t)})}switchFloorByFloor(t,e,i){e===void 0&&(e=!0),i===void 0&&(i=t.graphicLayer.children),this.triggerHooks(_t.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:i}),this.buildingCenter=t.userData.center,this.currentBuildGround=t.userData.rangeGraphic,this.context.switchFloor(t,e),this.initialFloorCamera(),this.triggerHooks(_t.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:i})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(this.config.defaultPadding,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*this.config.control.maxZoomScale,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}addModel(t,e){if(t.options.geometry.type==="polygon"){var i;let s=(i=this.context.currentFloor)==null?void 0:i.addModel(x({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(s){let{facilityAngle:o=0,facilityXScale:n=1,facilityYScale:r=1}=t.options.userData;s.rotateZ((180-o)/180*Math.PI),s.scale.set(n,r,1)}}}addHeatmap(t){var e;return(e=this.context.currentFloor)==null?void 0:e.addHeatmap(t)}getLegacyToGraphicMap(){var t;return((t=this.context.currentFloor)==null?void 0:t.userData.legacyToGraphicMap)||new Map}getFloorAllGraphics(){var t;return((t=this.context.currentFloor)==null?void 0:t.getGraphics())||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let i=t.options.center,s=t.getCenter(),o=(i==null?void 0:i[0])||s.x,n=(i==null?void 0:i[1])||s.y;return console.log(o,n,i,s),this.context.currentFloor.addPoi(x({},e,{position:{x:o,y:n,z:s.z+t.options.height/2}}))}return null}createPoi2ByPosition(t,e){if(this.context.currentFloor){let i=this.mercatorToWorld([t.x,t.y]),s=new rt(this.context,x({},e,{position:{x:i.x,y:i.y,z:t.z}}));return this.context.currentFloor.poiLayer2.pushPoi(s),s}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,i,s){e===void 0&&(e=500),i===void 0&&(i=0),s===void 0&&(s=0);let o=t.getPosition().clone(),{context:{camera:n}}=this;if(n.updateMatrix(),s){let r=new jt.Vector3;r.setFromMatrixColumn(n.matrix,1),r.normalize(),r.multiplyScalar(s/n.zoom),o.add(r)}if(i){let r=new jt.Vector3;r.setFromMatrixColumn(n.matrix,0),r.normalize(),r.multiplyScalar(i/n.zoom),o.add(r)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return f(this,null,function*(){return e===void 0&&(e=500),Wt(new Promise(i=>{let s=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:n,height:r},camera:h}=this.context,l=O(o,h,n,r).x-n/2,p=new jt.Vector3;p.setFromMatrixColumn(this.context.camera.matrix,0),p.normalize(),p.multiplyScalar(l/this.context.camera.zoom),s.add(p),this.context.setCameraPosition(s,e).then(i)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:i,clientHeight:s}=this.container;return O(e,this.context.camera,i,s)}changeMapType(t,e){return e===void 0&&(e=500),this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}resetView(t){return f(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let i=this.context.camera.zoom;return this.context.setZoom(i-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let i=this.context.camera.zoom;return this.context.setZoom(i+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver.enable){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t,e){t===void 0&&(t=.1),e===void 0&&(e=500);let i=this.context.control.getAzimuthalAngle();return this.context.setAzimuthalAngle(i+t,e)}measureDistance(){return f(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Xi(this.context);let i=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){i(),e("cancel")},this.svgLine.addEventListener("distance",s=>{let{distance:o}=s;t(o)})})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new qi(this.context);let i=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){i(),e("cancel")},this.svgPolygon.addEventListener("area",s=>{let{area:o}=s;t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}fitCameraByPois(t,e,i){return f(this,null,function*(){if(e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500),!t.length)return;let s=new jt.Box3;return t.forEach(o=>{let{position:n}=o;s.expandByPoint(n)}),this.context.fitCameraToBox(s,e,i,!1)})}fitCameraByPoiNodeIds(t,e,i){return f(this,null,function*(){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500);let s=t.map(o=>this.getPoiById(o)).filter(o=>!!o);if(s.length)return this.fitCameraByPois(s,e,i)})}getGraphicByNodeId(t){var e,i;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((i=this.context.currentFloor)==null?void 0:i.parkingSpaceLayer.graphicMap.get(t))||null}deleteGraphic(t){var e;(e=this.context.currentFloor)==null||e.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){var e;if(!t.transformToBuildingGround&&this.currentBuildGround){let i=Li(this.currentBuildGround.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(s=>{Array.isArray(s)&&s.forEach(o=>{o[0]-=i[0],o[1]-=i[1]})});else{let[s,o]=t.geometry.cds;t.geometry.coords=[s-i[0],o-i[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}mercatorToWorld(t){let e=this.buildingCenter;return new jt.Vector3(t[0]-e[0],t[1]-e[1],0)}removePoiById(t){var e,i;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(i=this.context.currentFloor)==null||i.poiLayer2.removePoiById(t)}getPoiById(t){var e;let i=this.context.collisionSystem.objects;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||i.find(s=>s.options.id===t)}getPois(){var t;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(e=>!e.options.built_in),...this.context.collisionSystem.objects||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}dispose(){this.loader&&(this.loader.dispose(),this.loader=null),this.unRegistryEvent(),this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.plugins=[],this.context.dispose(),this.context=null,this.container=null,mt.dispose(),ft.dispose(),De.dispose(),Tt.dispose(),L.dispose(),se.dispose(),this.debounceResize=null,jt.Sprite.Dispose==null||jt.Sprite.Dispose.call(jt.Sprite)}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new $,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:i}}=this.context;i!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=i)},this.onKeydown=i=>{this.polarKeys.includes(i.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(i.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=i=>{if(this.polarKeys.includes(i.code)){let s=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=s,this.context.control.minPolarAngle=s}if(this.azimuthalKeys.includes(i.code)){let s=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=s,this.context.control.minAzimuthAngle=s}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let i=this.context.control.getAzimuthalAngle(),s=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let o=this.context.getFitCameraToGroundZoom(this.config.defaultPadding,0)||1;this.context.camera.zoom=s,this.context.control.minZoom=o,this.context.control.maxZoom=o*this.config.control.maxZoomScale,this.basicZoom=s,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(i,0),this.context.cameraBound.setEnable(!0)},this.config=Jo(e),this.context=new ls(t,this),this.debounceResize=(0,ra.debounce)(this.resize,this.config.resizeObserver.debounceTime),this.registryEvent()}};var Hh=function(a){return a.HALF="half",a.POWER="power",a.MECHANICAL="mechanical",a.NORMAL="normal",a.VIP="vip",a}({});var W0=require("core-js/modules/web.dom-collections.iterator.js");var at=class extends lt{dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null,super.dispose()}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var an=class extends at{fetchEquipment(){return f(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:i}=this.bmap.config,s=""+t+e;yield fetch(s,i).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(n=>[n.equipment_id,n]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)})}getGraphicEquipment(t){return t.userData.data.info.userData.equipment}changeGraphicToEquipment(t){t.filter(e=>{let i=this.getGraphicEquipment(e);return i&&this.equipmentMap.has(i)}).forEach(e=>{let i=this.equipmentMap.get(this.getGraphicEquipment(e)),s=this.bmap.createGraphicPoi(e,{icon:i==null?void 0:i.equipment_icon,built_in:!0,icon_size:[14,14]});s&&(s.userData.data=i,s.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(_t.SWITCH_FLOOR_AFTER,this.onSwitchFloor),Array.from(((t=this.bmap.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).forEach(e=>{if(e.userData.type==="equipment"){var i;(i=this.bmap.context.currentFloor)==null||i.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:i}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(i)},this.fetchEquipment(),this.bmap.addEventListener(_t.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Nw=require("core-js/modules/es.string.replace.js"),Zw=require("core-js/modules/es.regexp.exec.js"),jw=require("core-js/modules/web.dom-collections.iterator.js"),Vw=require("core-js/modules/es.promise.finally.js");var cw=require("core-js/modules/web.dom-collections.iterator.js"),lw=require("core-js/modules/es.array.push.js"),xt=require("three");var j0=require("core-js/modules/es.typed-array.float32-array.js"),V0=require("core-js/modules/es.typed-array.at.js"),K0=require("core-js/modules/es.typed-array.fill.js"),Y0=require("core-js/modules/es.typed-array.find-last.js"),X0=require("core-js/modules/es.typed-array.find-last-index.js"),q0=require("core-js/modules/es.typed-array.set.js"),$0=require("core-js/modules/es.typed-array.sort.js"),J0=require("core-js/modules/es.typed-array.to-reversed.js"),Q0=require("core-js/modules/es.typed-array.to-sorted.js"),tw=require("core-js/modules/es.typed-array.with.js"),ew=require("core-js/modules/es.array-buffer.constructor.js"),iw=require("core-js/modules/es.array-buffer.slice.js"),sw=require("core-js/modules/es.array-buffer.detached.js"),ow=require("core-js/modules/es.array-buffer.transfer.js"),nw=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),rw=require("core-js/modules/es.array.push.js"),aw=require("core-js/modules/es.typed-array.uint16-array.js"),S=require("three"),Vt=class extends S.BufferGeometry{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new S.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};Vt.prototype.setMatrixWorld=function(a){this.matrixWorld=a};Vt.prototype.setGeometry=function(a,t){this._geometry=a,this.setPoints(a.getAttribute("position").array,t)};Vt.prototype.setPoints=function(a,t){if(!(a instanceof Float32Array)&&!(a instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=a,this.widthCallback=t,this.positions=[],this.counters=[],a.length&&a[0]instanceof S.Vector3)for(var e=0;e<a.length;e++){var i=a[e],s=e/a.length;this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(s),this.counters.push(s)}else for(var e=0;e<a.length;e+=3){var s=e/a.length;this.positions.push(a[e],a[e+1],a[e+2]),this.positions.push(a[e],a[e+1],a[e+2]),this.counters.push(s),this.counters.push(s)}this.process()};function Nh(a,t){var e=new S.Matrix4,i=new S.Ray,s=new S.Sphere,o=new S.Vector3,n=this.geometry;if(n.boundingSphere||n.computeBoundingSphere(),s.copy(n.boundingSphere),s.applyMatrix4(this.matrixWorld),a.ray.intersectSphere(s,o)!==!1){e.copy(this.matrixWorld).invert(),i.copy(a.ray).applyMatrix4(e);var r=new S.Vector3,h=new S.Vector3,c=new S.Vector3,l=this instanceof S.LineSegments?2:1,p=n.index,d=n.attributes;if(p!==null)for(var u=p.array,m=d.position.array,g=d.width.array,y=0,w=u.length-1;y<w;y+=l){var M=u[y],P=u[y+1];r.fromArray(m,M*3),h.fromArray(m,P*3);var k=g[Math.floor(y/3)]!==void 0?g[Math.floor(y/3)]:1,D=a.params.Line.threshold+this.material.lineWidth*k/2,q=D*D,E=i.distanceSqToSegment(r,h,o,c);if(!(E>q)){o.applyMatrix4(this.matrixWorld);var Q=a.ray.origin.distanceTo(o);Q<a.near||Q>a.far||(t.push({distance:Q,point:c.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this}),y=w)}}}}Vt.prototype.raycast=Nh;Vt.prototype.compareV3=function(a,t){var e=a*6,i=t*6;return this.positions[e]===this.positions[i]&&this.positions[e+1]===this.positions[i+1]&&this.positions[e+2]===this.positions[i+2]};Vt.prototype.copyV3=function(a){var t=a*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Vt.prototype.getDistance=function(a){let t=0;for(let e=0;e<a;e++){let i=6*e,s=new S.Vector3(this.positions[i],this.positions[i+1],this.positions[i+2]),o=new S.Vector3(this.positions[i+6],this.positions[i+7],this.positions[i+8]),n=s.distanceTo(o);t+=n}return t};Vt.prototype.process=function(){var a=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(a-1);var i;this.compareV3(0,a-1)?i=this.copyV3(a-2):i=this.copyV3(0),this.previous.push(i[0],i[1],i[2]),this.previous.push(i[0],i[1],i[2]);for(var s=0;s<a;s++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(s/(a-1)):t=1,this.width.push(t),this.width.push(t),s===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(s===a-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let n=this.getDistance(s)/e;this.uvs.push(n,0),this.uvs.push(n,1)}if(s<a-1){i=this.copyV3(s),this.previous.push(i[0],i[1],i[2]),this.previous.push(i[0],i[1],i[2]);var o=s*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}s>0&&(i=this.copyV3(s),this.next.push(i[0],i[1],i[2]),this.next.push(i[0],i[1],i[2]))}this.compareV3(a-1,0)?i=this.copyV3(1):i=this.copyV3(a-1),this.next.push(i[0],i[1],i[2]),this.next.push(i[0],i[1],i[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new S.BufferAttribute(new Float32Array(this.positions),3),previous:new S.BufferAttribute(new Float32Array(this.previous),3),next:new S.BufferAttribute(new Float32Array(this.next),3),side:new S.BufferAttribute(new Float32Array(this.side),1),width:new S.BufferAttribute(new Float32Array(this.width),1),uv:new S.BufferAttribute(new Float32Array(this.uvs),2),index:new S.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new S.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function hn(a,t,e,i,s){var o;if(a=a.subarray||a.slice?a:a.buffer,e=e.subarray||e.slice?e:e.buffer,a=t?a.subarray?a.subarray(t,s&&t+s):a.slice(t,s&&t+s):a,e.set)e.set(a,i);else for(o=0;o<a.length;o++)e[o+i]=a[o];return e}Vt.prototype.advance=function(a){var t=this._attributes.position.array,e=this._attributes.previous.array,i=this._attributes.next.array,s=t.length;hn(t,0,e,0,s),hn(t,6,t,0,s-6),t[s-6]=a.x,t[s-5]=a.y,t[s-4]=a.z,t[s-3]=a.x,t[s-2]=a.y,t[s-1]=a.z,hn(t,6,i,0,s-6),i[s-6]=a.x,i[s-5]=a.y,i[s-4]=a.z,i[s-3]=a.x,i[s-2]=a.y,i[s-1]=a.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};S.ShaderChunk.meshline_vert=["",S.ShaderChunk.logdepthbuf_pars_vertex,S.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",S.ShaderChunk.logdepthbuf_vertex,S.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",S.ShaderChunk.fog_vertex,"}"].join(`
502
502
  `);S.ShaderChunk.meshline_frag=["",S.ShaderChunk.fog_pars_fragment,S.ShaderChunk.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","uniform float thresholdRatio;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {",""," if (vUV.x <= thresholdRatio) {"," discard;"," }",S.ShaderChunk.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",S.ShaderChunk.fog_fragment,"}"].join(`
503
503
  `);var ds=class extends S.ShaderMaterial{constructor(t){super({uniforms:Object.assign({},S.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new S.Color(16777215)},opacity:{value:1},resolution:{value:new S.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new S.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:S.ShaderChunk.meshline_vert,fragmentShader:S.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};ds.prototype.copy=function(a){return S.ShaderMaterial.prototype.copy.call(this,a),this.lineWidth=a.lineWidth,this.map=a.map,this.useMap=a.useMap,this.alphaMap=a.alphaMap,this.useAlphaMap=a.useAlphaMap,this.color.copy(a.color),this.opacity=a.opacity,this.resolution.copy(a.resolution),this.sizeAttenuation=a.sizeAttenuation,this.dashArray.copy(a.dashArray),this.dashOffset.copy(a.dashOffset),this.dashRatio.copy(a.dashRatio),this.useDash=a.useDash,this.visibility=a.visibility,this.alphaTest=a.alphaTest,this.repeat.copy(a.repeat),this};var aa={texture_url:Os,lineWidth:10,color:16777215},Qs=class extends xt.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:i,height:s}}}}}=this,o=t.map(r=>{let[h,c]=r;return O(new xt.Vector3(h,c,0),e,i,s)}).map(r=>{let{x:h,y:c}=r;return[h,c]});return kt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new xt.Vector2(t,1)}loadTexture(t){return new Promise((e,i)=>{new xt.TextureLoader().load(t,e,void 0,i)})}transformPoints(t){let e=[];for(let i=0;i<t.length;i++)e.push(...t[i],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return f(this,null,function*(){let e=this.geometry=new Vt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=xt.RepeatWrapping}let i=this.material=new ds({useMap:!0,color:new xt.Color(this.config.color),transparent:!0,resolution:new xt.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:xt.NormalBlending,repeat:new xt.Vector2(this.getRepeat(),1)}),s=this.mesh=new xt.Mesh(e,i);return s.renderOrder=99999,this.add(s),s})}dispose(){var t,e,i;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(i=this.texture)==null||i.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=aa,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let i=this.navigation.bmap.context.camera.zoom;i!==this.prevCameraZoom&&(this.prevCameraZoom=i,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:i,height:s}=this.navigation.bmap.context.clientSize;this.material.resolution.set(i,s)}},this.config=Object.assign({},aa,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var fi=require("@tweenjs/tween.js"),Ft=require("three");var yw=require("core-js/modules/es.array.unshift.js"),vw=require("core-js/modules/web.dom-collections.iterator.js"),xw=require("core-js/modules/es.array.push.js"),ha=require("three");var ca=require("@tweenjs/tween.js"),la=require("lodash"),mi=require("@turf/turf");var Zh={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1,destinationDistanceThreshold:10},to=class extends lt{get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){var t;return((t=this.curRoutePath)==null?void 0:t.points)||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}setRoadData(t){this.roadData=t}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,this.offsetDistance=0,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null),t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,e){let{curRoutePathPoints:i,position:s,curRoutePath:o,paths:n,routeIndex:r}=this;if(!i.length)return null;let h=i,c=this.paths[this.routeIndex].floor,l=this.getCurRouteRemainDistance();if(s){let y=ce(i,s);h=h.slice(y+1),h.unshift(s)}let p=[{floor:o==null?void 0:o.floor,points:h},...n.slice(r+1)],{distance:d,closestPoint:u,index:m,i:g}=p.reduce((y,w,M)=>{if(w.floor!==t)return y;let{distance:P,closestPoint:k,index:D}=w.points.reduce((q,E,Q,A)=>{if(!A[Q+1])return x({},q,{distance:q.distance===1/0?F(E,e):q.distance});let{distance:I,closestPoint:T}=To(e,E,A[Q+1]);if(!this.navigation.options.canBack&&c===t){let H=[e,...A.slice(Q+1)],ot=kt(H);if(l-ot>10)return q}return I<q.distance?{distance:I,closestPoint:T,index:Q}:q},{distance:1/0,closestPoint:w.points[0],index:0});return P<y.distance?{distance:P,closestPoint:k,index:M,i:D}:y},{distance:1/0,closestPoint:h[0],index:0,i:0});return{distance:d,closestPoint:u,routeIndex:m+r,pointIndex:m===0?g+this.pointIndex:g}}toPosition(t,e){let i=this.adsorb(t,e);if(!i)return;let{distance:s,closestPoint:o,routeIndex:n,pointIndex:r}=i;this.offsetDistance=s,s>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null)),this.routeIndex=n,this.pointIndex=r,this.position=o,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}pause(){var t;this.tweenUtil.clear(),(t=this.throttleUpdatePosition)==null||t.cancel(),this.paused=!0}continue(){this.paused=!1,this.startCurRouteSimulation()}startCurRouteSimulation(){return f(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(i=>{let s=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),n=o/this.options.simulationSpeed,r=this.throttleUpdatePosition=(0,la.throttle)(c=>{let l=Ve(s,c.distance);l&&(e.push({floor:t.floor,pos:l}),this.toPosition(t.floor,l))},100),h=this.simulationTween=new ca.Tween({distance:0},this.tweenUtil.group).to({distance:o},n*1e3).onUpdate(r).onComplete(()=>{this.tweenUtil.remove(h),r.flush(),r.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{i(this.startCurRouteSimulation())},3e3)):(i(!0),console.log(e,this.routeIndex,this.paths))}).start()})})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.paused||this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:e,position:i}=this;if(!t.length)return 0;let s=[i,...t.slice(e+1)];return kt(s)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:i}=this;if(!t.length)return 0;let s=[...t.slice(0,e+1),i];return kt(s)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((s,o)=>s+o.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:i,position:s,curRoutePath:o}=this,n=e,r=de.FRONT,h=(o==null||(t=o.pointInfos[n])==null?void 0:t.crossName)||"",c=0,l=0,p=0;for(;r===de.FRONT&&n<=i.length;){let g=i[n],y=i[n+1],w=i[n+2];if(!g||!y)r=de.END;else if(c+=F(g,y),!w)r=de.END;else{r=Ss(g,y,w),l=Ue(g,y,w),p=(new ha.Vector2(w[0]-y[0],w[1]-y[1]).angle()*180/Math.PI-90+360)%360;var d;h=(d=o==null?void 0:o.pointInfos[n+1].crossName)!=null?d:"",n+=1}}i[n]&&(c=F(s,i[n]));let u=Es(l);if(r===de.END&&c<=this.options.directionEmitThreshold)return{dir:r,distance:c,crossName:h,angle:l,nextAngle:p,nextDir:u};let m=this.getCurRouteToStartDistance();return e===0&&m<=5?{dir:de.START,distance:c,crossName:h,angle:l,nextAngle:p,nextDir:u}:(c>=this.options.directionEmitThreshold&&(r=de.FRONT),{dir:r,distance:c,crossName:h,angle:l,nextAngle:p,nextDir:u})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(i=>{let s=(0,mi.polygon)(i.cds),o=(0,mi.point)(this.position);return(0,mi.booleanPointInPolygon)(o,s)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),i=this.getNextDirDistance();if(!i)return null;let{dir:s,distance:o,crossName:n,angle:r,nextAngle:h,nextDir:c}=i;e<=this.options.destinationDistanceThreshold&&(s=de.END);let{imageUrl:l}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:o,dir:s,angle:r,nextAngle:h,pos:this.position,routeIndex:this.routeIndex,crossName:n,offset:this.offset,reset:this.reset,imageUrl:l,nextDir:c,offsetDistance:this.offsetDistance}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,i){super(),this.navigation=t,this.offset=!1,this.reset=!1,this.position=[0,0],this.routeIndex=0,this.pointIndex=0,this.paths=[],this.timer=new $,this.resetTimer=null,this.tweenUtil=new Pe,this.paused=!1,this.offsetDistance=0,this.onAddPaths=s=>{let{paths:o}=s;this.paths=o,this.resetStatus(o),this.simulationTween&&!this.paused&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},Zh,e),this.roadData=i,this.registryEvent()}};var Pw=require("core-js/modules/es.typed-array.uint8-array.js"),bw=require("core-js/modules/es.typed-array.at.js"),Sw=require("core-js/modules/es.typed-array.fill.js"),Ew=require("core-js/modules/es.typed-array.find-last.js"),Lw=require("core-js/modules/es.typed-array.find-last-index.js"),Cw=require("core-js/modules/es.typed-array.set.js"),Tw=require("core-js/modules/es.typed-array.sort.js"),kw=require("core-js/modules/es.typed-array.to-reversed.js"),Dw=require("core-js/modules/es.typed-array.to-sorted.js"),Aw=require("core-js/modules/es.typed-array.with.js"),Ow=require("core-js/modules/es.array-buffer.constructor.js"),Iw=require("core-js/modules/es.array-buffer.slice.js"),Rw=require("core-js/modules/es.array-buffer.detached.js"),Fw=require("core-js/modules/es.array-buffer.transfer.js"),Gw=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),zw=require("core-js/modules/es.typed-array.from.js"),Bw=require("core-js/modules/web.dom-collections.iterator.js"),te=require("three");var Le=class a extends rt{addDebug(){a.canvas.style.cssText=`
504
504
  position: fixed;