@aibee/crc-bmap 0.14.2 → 0.14.4
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 +2 -2
- package/lib/index.esm.min.js +2 -2
- package/lib/meta.json +5 -5
- package/lib/src/loader/AibeeLoader/layer.d.ts +1 -1
- package/lib/src/plugins/recommend-parking-space/recommand-parking-space.d.ts +2 -0
- package/lib/src/plugins/recommend-parking-space/recommend.worker.d.ts +5 -1
- package/package.json +1 -1
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 dt.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new dt.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new dt.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=T.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 dt.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 dt.Vector3(h[0],h[1],e)),t.push(new dt.Vector3(c[0],c[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new dt.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new dt.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({},ge,s)),this.init())}};var Fg=require("core-js/modules/web.dom-collections.iterator.js"),zg=require("core-js/modules/es.string.trim.js");var Ut=require("three"),Nr=require("three/examples/jsm/utils/BufferGeometryUtils.js");var Zr={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},ts=class extends Ut.Object3D{init(){return f(this,null,function*(){let t=yield Promise.all(this.options.map(n=>Q.getTextureByText(n.texts[0],{fillStyle:Ss(n.fillColor,n.fillOpacity),strokeStyle:Ss(n.strokeColor,n.strokeOpacity),lineWidth:2,font:"bold 28px 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 Ut.PlaneGeometry(d,h.secondHeight),m=new Ut.Matrix4().makeTranslation(h.center_x,h.center_y,h.airHeight+h.deltaHeight+h.height).multiply(new Ut.Matrix4().makeRotationZ(h.secondRotate));return u.applyMatrix4(m),u}),i=(0,Nr.mergeGeometries)(e,!0);e.forEach(n=>n.dispose());let s=t.map(n=>{let{texture:r}=n,h=new Ut.MeshBasicMaterial({map:r,alphaTest:.9,side:Ut.DoubleSide});return r.needsUpdate=!0,h}),o=new Ut.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({},Zr,i)).filter(i=>i.texts[0].trim()),this.options.length&&this.init()}};var jr=require("three"),Vr=require("three/examples/jsm/lines/Line2.js"),Kr=require("three/examples/jsm/lines/LineGeometry.js"),Xr=require("three/examples/jsm/lines/LineMaterial.js"),ai=class extends jr.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 Vr.Line2(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&I(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 Kr.LineGeometry,this.lineMaterial=new Xr.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 jg=require("core-js/modules/es.array.push.js"),Vg=require("core-js/modules/web.dom-collections.iterator.js"),Fe=require("three");var hi=require("three");var ji=class extends Fe.Object3D{loadModel(){return f(this,null,function*(){let t=yield St.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 Fe.InstancedMesh(c,l,this.options.length)});t.scene.rotation.set(Math.PI/2,0,0);let o=new Fe.Box3().setFromObject(t.scene).getSize(new Fe.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()),I(this),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.subMeshes=[],this.materialOriginParams=new Map,this.loadModel()}};var ze=require("three");var ri=class extends ze.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=T.GetMergeAttributeGraphicMaterial()}initLineMaterial(){return this.lineMaterial=T.GetMergeAttributeGraphicLineMaterial()}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new ze.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 ze.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 ze.ObjectLoader,this.options=x({},ge,e),this.init()}};var ci=require("three");var es=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,Lt.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 ry=require("core-js/modules/es.typed-array.float32-array.js"),ay=require("core-js/modules/es.typed-array.at.js"),hy=require("core-js/modules/es.typed-array.fill.js"),cy=require("core-js/modules/es.typed-array.find-last.js"),ly=require("core-js/modules/es.typed-array.find-last-index.js"),py=require("core-js/modules/es.typed-array.set.js"),dy=require("core-js/modules/es.typed-array.sort.js"),uy=require("core-js/modules/es.typed-array.to-reversed.js"),my=require("core-js/modules/es.typed-array.to-sorted.js"),fy=require("core-js/modules/es.typed-array.with.js"),gy=require("core-js/modules/es.array-buffer.constructor.js"),yy=require("core-js/modules/es.array-buffer.slice.js"),vy=require("core-js/modules/es.array-buffer.detached.js"),xy=require("core-js/modules/es.array-buffer.transfer.js"),wy=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js");var ot=require("three");var Oe=class extends ot.Object3D{init(){return f(this,null,function*(){let t=this.options.iconUrl,e=yield ct.getTextureByUrl(t),i=new ot.MeshBasicMaterial({map:e,transparent:!0,alphaTest:.2,side:ot.FrontSide}),s=new ot.InstancedMesh(this.geometry,i,this.options.mergedMatrixes.size);s.instanceMatrix=new ot.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&&I(this.mesh),(t=this.mesh)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.geometry=new ot.ShapeGeometry(new ot.Shape([new ot.Vector2(-.5,-.5),new ot.Vector2(-.5,.5),new ot.Vector2(.5,.5),new ot.Vector2(.5,-.5)])),this.options=x({},Ns,e);let i=new ot.Float32BufferAttribute([0,0,0,1,1,1,1,0],2);this.geometry.setAttribute("uv",i),this.init()}};var Ey=require("core-js/modules/es.array.push.js"),be=require("three");var qo=require("three/examples/jsm/lines/LineSegments2.js"),$o=require("three/examples/jsm/lines/LineSegmentsGeometry.js");var is=class extends be.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=T.createMeshBasicMaterial({color:"#ffffff",opacity:1,vertexColors:!0});return this.material=t,t}initDoubleLine(){if(this.options.dashedLineGeometry){let t=T.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:!0,resolution:new be.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0});t.transparent=!0,t.needsUpdate=!0;let e=new $o.LineSegmentsGeometry;e.setPositions(this.options.dashedLineGeometry.positions),e.setColors(this.options.dashedLineGeometry.colors);let i=new qo.LineSegments2(e,t);i.computeLineDistances(),i.position.z+=.01,this.add(i),this.doubleLines.push(i)}if(this.options.lineGeometry){let t=T.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:!1,resolution:new be.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0}),e=new $o.LineSegmentsGeometry;e.setPositions(this.options.lineGeometry.positions),e.setColors(this.options.lineGeometry.colors);let i=new qo.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 be.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 be.ObjectLoader,this.init()}};var Dy=require("core-js/modules/es.typed-array.float32-array.js"),Ay=require("core-js/modules/es.typed-array.at.js"),Oy=require("core-js/modules/es.typed-array.fill.js"),Iy=require("core-js/modules/es.typed-array.find-last.js"),Ry=require("core-js/modules/es.typed-array.find-last-index.js"),Gy=require("core-js/modules/es.typed-array.set.js"),Fy=require("core-js/modules/es.typed-array.sort.js"),zy=require("core-js/modules/es.typed-array.to-reversed.js"),By=require("core-js/modules/es.typed-array.to-sorted.js"),Wy=require("core-js/modules/es.typed-array.with.js"),Uy=require("core-js/modules/es.array-buffer.constructor.js"),Hy=require("core-js/modules/es.array-buffer.slice.js"),Ny=require("core-js/modules/es.array-buffer.detached.js"),Zy=require("core-js/modules/es.array-buffer.transfer.js"),jy=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Vy=require("core-js/modules/web.dom-collections.iterator.js"),W=require("three");var ii=class extends W.Object3D{setColorByIndex(t,e){this.mesh&&(this.mesh.setColorAt(t,new W.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=T.GetInstancedGraphicMaterial()}initLineMaterial(){let t=T.GetMergeAttributeGraphicLineMaterial();this.lineMaterial=t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new W.InstancedMesh(this.geometry,this.material,this.options.length);let t=new W.InstancedBufferAttribute(new Float32Array(this.options.length),1),e=new W.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,v]=m,w=Math.atan2(v,g)-Math.PI/2,M=new W.Matrix4().compose(new W.Vector3(i.center_coord_x,i.center_coord_y,(i.deltaHeight||0)+i.airHeight+i.height/2),new W.Quaternion().setFromAxisAngle(new W.Vector3(0,0,1),w),new W.Vector3(u,d,i.height));this.mesh.setMatrixAt(s,M),this.mesh.setColorAt(s,new W.Color(i.fillColor).convertLinearToSRGB());var P;t.array[s]=(P=i.fillOpacity)!=null?P:1;var C;e.array[s]=((C=i.deltaHeight)!=null?C: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}=ks(this.options),s=new W.BufferGeometry().setFromPoints(t);s.setAttribute("color",new W.BufferAttribute(new Float32Array(e),3)),s.setAttribute("opacity",new W.BufferAttribute(new Float32Array(i),1)),this.lineOriginOpacity=[...i],this.lineGeometry=s}createBorder(){this.line&&this.remove(this.line);let t=new W.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 W.BoxGeometry(1,1,1),this.options=[],this.originOpacity=[],this.lineOriginOpacity=[],this.options=e.map(i=>x({},ge,i)),this.init()}};var Jy=require("core-js/modules/es.typed-array.float32-array.js"),Qy=require("core-js/modules/es.typed-array.at.js"),tv=require("core-js/modules/es.typed-array.fill.js"),ev=require("core-js/modules/es.typed-array.find-last.js"),iv=require("core-js/modules/es.typed-array.find-last-index.js"),sv=require("core-js/modules/es.typed-array.set.js"),ov=require("core-js/modules/es.typed-array.sort.js"),nv=require("core-js/modules/es.typed-array.to-reversed.js"),rv=require("core-js/modules/es.typed-array.to-sorted.js"),av=require("core-js/modules/es.typed-array.with.js"),hv=require("core-js/modules/es.array-buffer.constructor.js"),cv=require("core-js/modules/es.array-buffer.slice.js"),lv=require("core-js/modules/es.array-buffer.detached.js"),pv=require("core-js/modules/es.array-buffer.transfer.js"),dv=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),uv=require("core-js/modules/web.dom-collections.iterator.js"),$t=require("three");var Xe=class extends $t.Object3D{init(){return f(this,null,function*(){this.initMaterial(),this.initMesh()})}initMaterial(){this.material=T.GetInstancedGraphicMaterial()}initMesh(){if(this.mesh&&this.remove(this.mesh),!this.elements)return;this.mesh=new $t.InstancedMesh(this.geometry,this.material,this.elements.size);let t=new $t.InstancedBufferAttribute(new Float32Array(this.elements.opacities),1),e=new $t.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 $t.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 $t.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 $t.BoxGeometry(1,1,1),this.material=null,this.elements=null,this.originOpacities=[],this.elements=e,this.init()}};var yv=require("core-js/modules/es.typed-array.float32-array.js"),vv=require("core-js/modules/es.typed-array.at.js"),xv=require("core-js/modules/es.typed-array.fill.js"),wv=require("core-js/modules/es.typed-array.find-last.js"),Mv=require("core-js/modules/es.typed-array.find-last-index.js"),_v=require("core-js/modules/es.typed-array.set.js"),Pv=require("core-js/modules/es.typed-array.sort.js"),bv=require("core-js/modules/es.typed-array.to-reversed.js"),Sv=require("core-js/modules/es.typed-array.to-sorted.js"),Ev=require("core-js/modules/es.typed-array.with.js"),Lv=require("core-js/modules/es.array-buffer.constructor.js"),Cv=require("core-js/modules/es.array-buffer.slice.js"),Tv=require("core-js/modules/es.array-buffer.detached.js"),kv=require("core-js/modules/es.array-buffer.transfer.js"),Dv=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Av=require("core-js/modules/web.dom-collections.iterator.js"),oe=require("three");var ss=class extends oe.Object3D{init(){return f(this,null,function*(){this.initMaterial(),this.initMesh()})}initMaterial(){this.material=T.GetInstancedWallMaterial()}initMesh(){if(this.mesh&&this.remove(this.mesh),!this.elements)return;this.mesh=new oe.InstancedMesh(this.geometry,this.material,this.elements.size);let t=new oe.InstancedBufferAttribute(new Float32Array(this.elements.opacities),1),e=new oe.InstancedBufferAttribute(new Float32Array(this.elements.maxZs),1),i=new oe.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 oe.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 oe.BoxGeometry(1,1,1),this.material=null,this.elements=null,this.originOpacities=[],this.elements=e,this.init()}};var li=require("three");var Ie=class extends li.Object3D{init(){return f(this,null,function*(){this.initLineGeometry(),this.initLineMaterial(),this.createBorder()})}initLineMaterial(){return this.lineMaterial=T.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({},ge,e),this.init()}};var Yr=require("three"),Zs=class extends Wt{setEnable(t){super.setEnable(t),bt(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=D(this.startPoint,e,i,s),n=D(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 lt&&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=D(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=D(h,s,o,n),p=D(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 Yr.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);bt(this.rect,n.x,n.y,r,h)}else bt(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 os=class extends qr.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))}}),(He?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=>{Ne(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Ne(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 sx=require("core-js/modules/es.set.difference.v2.js"),ox=require("core-js/modules/es.set.intersection.v2.js"),nx=require("core-js/modules/es.set.is-disjoint-from.v2.js"),rx=require("core-js/modules/es.set.is-subset-of.v2.js"),ax=require("core-js/modules/es.set.is-superset-of.v2.js"),hx=require("core-js/modules/es.set.symmetric-difference.v2.js"),cx=require("core-js/modules/es.set.union.v2.js"),lx=require("core-js/modules/web.dom-collections.iterator.js");var js=require("three");var ns=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 j,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 De){let{x:m,y:g}=u.clientPos,v=Math.sqrt((m-o.offsetX)**2+(g-o.offsetY)**2);v<p&&(p=v,l=d)}else if(u instanceof tt){let{x:m,y:g}=u.box.getCenter(new js.Vector2),v=Math.sqrt((m-o.offsetX)**2+(g-o.offsetY)**2);v<p&&(p=v,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 mx=require("core-js/modules/web.dom-collections.iterator.js"),Ht=require("three");var rs=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 se).length)return null;let e=this.box,{camera:i,clientSize:{width:s,height:o}}=this.context,{min:n,max:r}=e,c=[new Ht.Vector3(n.x,n.y,n.z),new Ht.Vector3(r.x,n.y,n.z),new Ht.Vector3(n.x,r.y,n.z),new Ht.Vector3(r.x,r.y,n.z),new Ht.Vector3(n.x,n.y,r.z),new Ht.Vector3(r.x,n.y,r.z),new Ht.Vector3(n.x,r.y,r.z),new Ht.Vector3(r.x,r.y,r.z)].map(m=>D(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,rs.polygon)([[[e,s],[i,s],[i,o],[e,o],[e,s]]]),u=(0,rs.polygon)([[[p,h],[n-c,h],[n-c,r-l],[p,r-l],[p,h]]]);try{return(0,rs.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 Ht.Vector3,zoom:1,target:new Ht.Vector3},this.enable=!0,this.box=new Ht.Box3,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:i,right:s,top:o,bottom:n}=e;if([i,s,o,n].every(h=>!h))return;this.checkDistanceToScreenEdge({left:i,right:s,top:o,bottom:n})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var Mx=require("core-js/modules/es.promise.finally.js"),Jo=require("three"),Ye=require("@tweenjs/tween.js");var vx=require("core-js/modules/web.dom-collections.iterator.js"),xx=require("core-js/modules/es.array.push.js"),b=require("three"),Ks=new b.Ray,$r=new b.Plane,Sh=Math.cos(70*b.MathUtils.DEG2RAD),Xs=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(y){y.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=y},this.stopListenToKeyEvents=function(){var y;(y=this._domElementKeyEvents)==null||y.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 y=new b.Vector3,_=new b.Quaternion().setFromUnitVectors(t.up,new b.Vector3(0,1,0)),N=_.clone().invert(),it=new b.Vector3,Rt=new b.Quaternion,he=new b.Vector3,Qt=2*Math.PI;return function(_i){_i===void 0&&(_i=null);let ve=i.object.position;y.copy(ve).sub(i.target),y.applyQuaternion(_),r.setFromVector3(y),i.autoRotate&&o===s.NONE&&It(Tt(_i)),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+=Qt:xe>Math.PI&&(xe-=Qt),we<-Math.PI?we+=Qt:we>Math.PI&&(we-=Qt),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&&G||i.object.isOrthographicCamera?r.radius=H(r.radius):r.radius=H(r.radius*c),y.setFromSpherical(r),y.applyQuaternion(N),ve.copy(i.target).add(y),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 _s=!1;if(i.zoomToCursor&&G){let Pi=null;if(i.object.isPerspectiveCamera){let bi=y.length();Pi=H(bi*c);let Ps=bi-Pi;i.object.position.addScaledVector(C,Ps),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){let bi=new b.Vector3(S.x,S.y,0);bi.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),_s=!0;let Ps=new b.Vector3(S.x,S.y,0);Ps.unproject(i.object),i.object.position.sub(Ps).add(bi),i.object.updateMatrixWorld(),Pi=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;Pi!==null&&(i.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(Pi).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))<Sh?t.lookAt(i.target):($r.setFromNormalAndCoplanarPoint(i.object.up,i.target),Ks.intersectPlane($r,i.target))))}else i.object.isOrthographicCamera&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),_s=!0);return c=1,G=!1,_s||it.distanceToSquared(i.object.position)>n||8*(1-Rt.dot(i.object.quaternion))>n||he.distanceToSquared(i.target)>0?(i.dispatchEvent({type:"change"}),it.copy(i.object.position),Rt.copy(i.object.quaternion),he.copy(i.target),_s=!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,v=new b.Vector2,w=new b.Vector2,M=new b.Vector2,P=new b.Vector2,C=new b.Vector3,S=new b.Vector2,G=!1,E=[],nt={};function Tt(y){return y!==null?2*Math.PI/60*i.autoRotateSpeed*y:2*Math.PI/60/60*i.autoRotateSpeed}function gt(){return Math.pow(.95,i.zoomSpeed)}function It(y){h.theta-=y}function kt(y){h.phi-=y}let ne=function(){let y=new b.Vector3;return function(N,it){y.setFromMatrixColumn(it,0),y.multiplyScalar(-N),l.add(y)}}(),Ee=function(){let y=new b.Vector3;return function(N,it){i.screenSpacePanning===!0?y.setFromMatrixColumn(it,1):(y.setFromMatrixColumn(it,0),y.crossVectors(i.object.up,y)),y.multiplyScalar(N),l.add(y)}}(),ht=function(){let y=new b.Vector3;return function(N,it){let Rt=i.domElement;if(i.object.isPerspectiveCamera){let he=i.object.position;y.copy(he).sub(i.target);let Qt=y.length();Qt*=Math.tan(i.object.fov/2*Math.PI/180),ne(2*N*Qt/Rt.clientHeight,i.object.matrix),Ee(2*it*Qt/Rt.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(ne(N*(i.object.right-i.object.left)/i.object.zoom/Rt.clientWidth,i.object.matrix),Ee(it*(i.object.top-i.object.bottom)/i.object.zoom/Rt.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function $e(y){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function wi(y){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function U(y){if(!i.zoomToCursor)return;G=!0;let _=i.domElement.getBoundingClientRect(),N=y.clientX-_.left,it=y.clientY-_.top,Rt=_.width,he=_.height;S.x=N/Rt*2-1,S.y=-(it/he)*2+1,C.set(S.x,S.y,1).unproject(i.object).sub(i.object.position).normalize()}function H(y){return Math.max(i.minDistance,Math.min(i.maxDistance,y))}function et(y){p.set(y.clientX,y.clientY)}function J(y){U(y),w.set(y.clientX,y.clientY)}function re(y){m.set(y.clientX,y.clientY)}function ae(y){d.set(y.clientX,y.clientY),u.subVectors(d,p).multiplyScalar(i.rotateSpeed);let _=i.domElement;It(2*Math.PI*u.x/_.clientHeight),kt(2*Math.PI*u.y/_.clientHeight),p.copy(d),i.update()}function Le(y){M.set(y.clientX,y.clientY),P.subVectors(M,w),P.y>0?$e(gt()):P.y<0&&wi(gt()),w.copy(M),i.update()}function ye(y){g.set(y.clientX,y.clientY),v.subVectors(g,m).multiplyScalar(i.panSpeed),ht(v.x,v.y),m.copy(g),i.update()}function Mi(y){U(y),y.deltaY<0?wi(gt()):y.deltaY>0&&$e(gt()),i.update()}function Pa(y){let _=!1;switch(y.code){case i.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?kt(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(0,i.keyPanSpeed),_=!0;break;case i.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?kt(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(0,-i.keyPanSpeed),_=!0;break;case i.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?It(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(i.keyPanSpeed,0),_=!0;break;case i.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?It(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(-i.keyPanSpeed,0),_=!0;break}_&&(y.preventDefault(),i.update())}function Tn(){if(E.length===1)p.set(E[0].pageX,E[0].pageY);else{let y=(E[0].pageX-E[0].pageY)/(E[1].pageX-E[1].pageY),_=E[0].pageY-y*E[0].pageX;i.rotateLineStart.set(y,_);let N=.5*(E[0].pageX+E[1].pageX),it=.5*(E[0].pageY+E[1].pageY);p.set(N,it)}}function kn(){if(E.length===1)m.set(E[0].pageX,E[0].pageY);else{let y=.5*(E[0].pageX+E[1].pageX),_=.5*(E[0].pageY+E[1].pageY);m.set(y,_)}}function Dn(){let y=E[0].pageX-E[1].pageX,_=E[0].pageY-E[1].pageY,N=Math.sqrt(y*y+_*_);w.set(0,N)}function ba(){i.enableZoom&&Dn(),i.enablePan&&kn()}function Sa(){i.enableZoom&&Dn(),i.enableRotate&&Tn()}function An(y){if(E.length==1)d.set(y.pageX,y.pageY);else{let N=fo(y),it=.5*(y.pageX+N.x),Rt=.5*(y.pageY+N.y);d.set(it,Rt);let he=(y.pageY-N.y)/(y.pageX-N.x),Qt=N.y-he*N.x;if(i.rotateLineEnd.set(he,Qt),Number.isFinite(i.rotateLineEnd.x)&&Number.isFinite(i.rotateLineStart.x)){let go=(i.rotateLineStart.y-i.rotateLineEnd.y)/(i.rotateLineEnd.x-i.rotateLineStart.x),_i=he*go+Qt;if(Number.isFinite(go)&&Number.isFinite(_i)){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;kt(2*Math.PI*u.y/_.clientHeight),p.copy(d)}function On(y){if(E.length===1)g.set(y.pageX,y.pageY);else{let _=fo(y),N=.5*(y.pageX+_.x),it=.5*(y.pageY+_.y);g.set(N,it)}v.subVectors(g,m).multiplyScalar(i.panSpeed),ht(v.x,v.y),m.copy(g)}function In(y){let _=fo(y),N=y.pageX-_.x,it=y.pageY-_.y,Rt=Math.sqrt(N*N+it*it);M.set(0,Rt),P.set(0,Math.pow(M.y/w.y,i.zoomSpeed)),$e(P.y),w.copy(M)}function Ea(y){i.enableZoom&&In(y),i.enablePan&&On(y)}function La(y){i.enableZoom&&In(y),i.enableRotate&&An(y)}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)),Aa(_),_.pointerType==="touch"?ka(_):Ca(_))},this.onPointerMove=function(_){i.enabled!==!1&&(_.pointerType==="touch"?Da(_):Ta(_))},this.onPointerUp=function(_){Oa(_),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 Ca(y){let _;switch(y.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;J(y),o=s.DOLLY;break;case b.MOUSE.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(i.enablePan===!1)return;re(y),o=s.PAN}else{if(i.enableRotate===!1)return;et(y),o=s.ROTATE}break;case b.MOUSE.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(i.enableRotate===!1)return;et(y),o=s.ROTATE}else{if(i.enablePan===!1)return;re(y),o=s.PAN}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent({type:"start"})}function Ta(y){switch(o){case s.ROTATE:if(i.enableRotate===!1)return;ae(y);break;case s.DOLLY:if(i.enableZoom===!1)return;Le(y);break;case s.PAN:if(i.enablePan===!1)return;ye(y);break}}this.onMouseWheel=function(_){i.enabled===!1||i.enableZoom===!1||o!==s.NONE||(_.preventDefault(),i.dispatchEvent({type:"start"}),Mi(_),i.dispatchEvent({type:"end"}))},this.onKeyDown=function(_){i.enabled===!1||i.enablePan===!1||Pa(_)};function ka(y){switch(Rn(y),E.length){case 1:switch(i.touches.ONE){case b.TOUCH.ROTATE:if(i.enableRotate===!1)return;Tn(),o=s.TOUCH_ROTATE;break;case b.TOUCH.PAN:if(i.enablePan===!1)return;kn(),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;ba(),o=s.TOUCH_DOLLY_PAN;break;case b.TOUCH.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Sa(),o=s.TOUCH_DOLLY_ROTATE;break;default:o=s.NONE}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent({type:"start"})}function Da(y){switch(Rn(y),o){case s.TOUCH_ROTATE:if(i.enableRotate===!1)return;An(y),i.update();break;case s.TOUCH_PAN:if(i.enablePan===!1)return;On(y),i.update();break;case s.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Ea(y),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;La(y),i.update();break;default:o=s.NONE}}this.onContextMenu=function(_){i.enabled!==!1&&_.preventDefault()};function Aa(y){E.push(y)}function Oa(y){delete nt[y.pointerId];for(let _=0;_<E.length;_++)if(E[_].pointerId==y.pointerId){E.splice(_,1);return}}function Rn(y){let _=nt[y.pointerId];_===void 0&&(_=new b.Vector2,nt[y.pointerId]=_),_.set(y.pageX,y.pageY)}function fo(y){let _=y.pointerId===E[0].pointerId?E[1]:E[0];return nt[_.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 as=class extends Xs{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):Ft(new Promise(s=>{let o={polar:this.getPolarAngle()},n={polar:t},r=new Ye.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):Ft(new Promise(s=>{let o={azimuthal:this.getAzimuthalAngle()},n={azimuthal:t},r=new Ye.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 Jo.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 Ft(new Promise(o=>{let n=new Ye.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?Ft(new Promise(n=>{let r=new Ye.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 Jo.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 Ye.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 hs=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 j,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 ea=require("three");var Jr=require("three"),Qr=require("three/examples/jsm/environments/RoomEnvironment.js");function ta(a,t){t===void 0&&(t=.85);let e=new Jr.PMREMGenerator(a);return e.compileEquirectangularShader(),e.fromScene(new Qr.RoomEnvironment).texture}var cs=class extends ea.Scene{dispose(){var t;(t=this.environment)==null||t.dispose(),this.environment=null,I(this),this.clear()}constructor(t){super(),this.environment=ta(t)}};var ia=require("three"),ls=class extends ia.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 Qo=require("@turf/turf");var Ix=require("core-js/modules/es.array.unshift.js"),Rx=require("core-js/modules/es.array.push.js"),sa=require("three"),Ys=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 sa.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 ps=class extends z.EventDispatcher{get config(){return this.bmap.config}get center(){return this.bmap.buildingCenter}setRange(t){this.range=(0,Qo.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 ls(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new as(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 z.Vector3(0,0,0)),e===void 0&&(e=new z.Vector3(100,0,0));let{clientWidth:i,clientHeight:s}=this.container,o=D(t,this.camera,i,s),n=D(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 z.AmbientLight&&(e.color=new z.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 z.Vector2;s.x=t/this.clientSize.width*2-1,s.y=e/this.clientSize.height*-2+1;let o=new z.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 z.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),this.camera.updateMatrixWorld(),this.camera.updateProjectionMatrix();let{max:p,min:d}=t,u=new z.Vector3(d.x,p.y,p.z),m=new z.Vector3(p.x,p.y,p.z),g=new z.Vector3(p.x,d.y,d.z),v=new z.Vector3(d.x,d.y,d.z),w=D(u,this.camera,h,c),M=D(m,this.camera,h,c),P=D(v,this.camera,h,c),C=D(g,this.camera,h,c),G=new z.Box2().setFromPoints([new z.Vector2(w.x,w.y),new z.Vector2(M.x,M.y),new z.Vector2(P.x,P.y),new z.Vector2(C.x,C.y)]).getSize(new z.Vector2),E=(h-o-r)/G.x,nt=(c-s-n)/G.y,Tt=Math.min(E,nt),gt=new z.Vector3((p.x+d.x)/2,(p.y+d.y)/2,(p.z+d.z)/2),It=Tt*this.camera.zoom,kt=this.camera.clone();kt.zoom=It,kt.updateMatrix();let ne=(o-r)/2,Ee=(s-n)/2;if(ne){let ht=new z.Vector3;ht.setFromMatrixColumn(kt.matrix,0),ht.normalize(),ht.multiplyScalar(ne/It),gt.add(ht)}if(Ee){let ht=new z.Vector3;ht.setFromMatrixColumn(kt.matrix,1),ht.normalize(),ht.multiplyScalar(Ee/It),gt.add(ht)}return{zoom:Tt*this.camera.zoom,center:gt}}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=xo(),this.range=(0,Qo.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 hs(this),this.scene=new cs(this.renderer),this.collisionSystem=new Ys(this),this.init(),this.selection=new os(this),this.hoverHelper=new ns(this),this.resizeClientSize(),this.registryEvent()}};var oa=require("lodash"),na={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 tn(a){return typeof a.resizeObserver=="boolean"&&(a.resizeObserver={enable:a.resizeObserver}),(0,oa.merge)({},na,a)}var ca=require("lodash");var h0=require("core-js/modules/web.dom-collections.iterator.js");var Js=require("three");var t0=require("core-js/modules/es.array.push.js"),e0=require("core-js/modules/web.dom-collections.iterator.js");var qx=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 en=["range","ground","store","facility","parkingSpace"];function ra(a){return en.indexOf(a.l_type)===-1?en.length:en.indexOf(a.l_type)}function Eh(a){a.layers.sort((t,e)=>ra(t)-ra(e))}function Lh(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 Ai(i.elements,e)})}function ds(a){Eh(a),Lh(a)}function ui(a,t){return t===void 0&&(t=6),a.floor_id+"_"+a.version_id+(t?"_"+t:"")}function aa(a,t,e){switch(a.l_type){case"ground":return sn(a,t);case"graph":return Ch(a,t);case"wall":return Th(a,t);case"lane":return kh(a,t);case"texture2d":case"texture3d":return Dh(a,t);case"glb":return Ah(a,t);case"store":return Oh(a,t,e);case"facility":return Rh(a,t,e);case"parkingSpace":return Fh(a,t,e);case"text":return Bh(a,t)}}function ha(a,t,e,i,s){switch(a.l_type){case"store":return Ih(a,t,e,i,s);case"facility":return Gh(a,t,e,i,s);case"parkingSpace":return zh(a,t,i,s)}}function Ch(a,t){t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements)}function sn(a,t){let e=a.elements.map(i=>new lt(t.context,x({},i,{dashed:!1})));t.addGrounds(e)}function Th(a,t){if(a.mergedElements)a.mergedElements.map(e=>{if(e.instancedGeometry){let i=new ss(t.context,e.instancedGeometry);t.wallLayer.add(i)}if(e.mergedGeometry){let i=new es(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 Ji(t.context,i);t.wallLayer.add(s)})}}function kh(a,t){if(a.mergedElements){let e=new is(t.context,a.mergedElements);t.laneLayer.add(e)}else{let e=new Qi(t.context,a.elements);t.laneLayer.add(e)}}function Dh(a,t){if(a.mergedMatrixes)a.mergedMatrixes.map(e=>{let i=new Oe(t.context,e);t.textureLayer.add(i)});else if(a.elements.length){let e=new Ae(t.context,a.elements);t.textureLayer.add(e)}}function Ah(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 Oh(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 Ih(a,t,e,i,s){a.elements.filter(o=>s.filterPoi(o)).map(o=>{try{let n=qs(o,e),r=new tt(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 Rh(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 Gh(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 tt(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 Fh(a,t,e){t.parkingSpaceLayer.load(a,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function zh(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 tt(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 Bh(a,t){let e=new ts(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 Wh={};function on(){return new Worker(new URL("./worker/loader.worker-XI4MI7KE.js",Wh.url))}var Uh={mergeParkingSpace:!0,mergeGraphic:!0,renderVersion:di.MERGED_RENDER_VERSION,layers:["graph","wall","lane","texture2d","texture3d","glb","store","facility","parkingSpace","text"],filterPoi:()=>!0},qe=class extends st{initDb(){return f(this,null,function*(){try{let{db:t}=yield Ds();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||"{}"),e))}else return this.load("https://screen.aibee.cn/ai-map/map/get-floor-map?place_id="+t,e);this.getOtherDataByFreeTime()})}setCacheData(t,e,i){return f(this,null,function*(){return this.initDbPromise.then(()=>Gi(t,""+e,i))})}getCacheData(t,e){return f(this,null,function*(){return this.initDbPromise.then(()=>ei(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,ds(o),this.setCacheData(xt.MAP_DATA,s,o),this.setCacheData(xt.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(xt.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(xt.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){Z(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(xt.ROAD_NETWORK_DATA,i);if(s)return s;let o=yield fetch(e.route_url).then(n=>n.json());return this.setCacheData(xt.ROAD_NETWORK_DATA,i,o),this.setCacheData(xt.ROUTE_VERSION,i,e.version_id),o}catch(s){let o=yield fetch(e.route_url).then(n=>n.json());return this.setCacheData(xt.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(xt.FACILITY_DATA,e,s),this.setCacheData(xt.FACILITY_VERSION,e,t.version_id)),s});try{let s=yield this.getCacheData(xt.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,this.loadWorker&&(yield Z(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*(){ds(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*(){ds(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 ds(t);let o=x({},this.placeConfig,e),n=new se(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:yt.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.config.control.defaultAzimuthal=c/180*Math.PI,this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:n,graphics:[]}}),this.bmap.dispatchEvent({type:yt.SWITCH_FLOOR_GROUND,data:{curFloor:n}}),yield bs(),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 So(2),yield this.getFloorPoi(s,n,o),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:n,graphics:n.graphicLayer.children}}),this.bmap.dispatchEvent({type:yt.SWITCH_FLOOR_AFTER,data:{curFloor:n,graphics:n.graphicLayer.children}}),n})}getFloorBaseLayer(t,e){e||(e=new se(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":sn(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 se(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)&&(aa(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 ha(n,e,this.locale,i,this.options)})),console.log("poi time",Date.now()-s);let o=Date.now();bs().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return f(this,null,function*(){yr(),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 Ve,this.loadWorker=on(),this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=x({},Uh,e),this.placeConfig=x({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var M0=require("core-js/modules/web.dom-collections.iterator.js");function nn(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 rn(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 Hh(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?Nh(h.fileId,t):null)})}function Nh(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 an=class{load(t){return f(this,null,function*(){let e=Te(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,i]=yield Promise.all([this.loadBuildGround(t),rn(t,this.bmap.config)]),s=Te({floor:t.floor,ts:t.ts});Ai(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"){l.info.fillColor=o.color,l.info.fillOpacity=o.opacity,l.info.height=o.height,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity,e.createGround(l.info);continue}else c.info.userData.mark?(l.info.height=n.height,l.info.fillColor=n.color,l.info.fillOpacity=n.opacity,l.info.stroke=n.stroke,l.info.strokeColor=n.strokeColor,l.info.strokeOpacity=n.strokeOpacity):(l.info.fillOpacity=r.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=n.height,l.info.fillColor=n.color,l.info.stroke=n.stroke,l.info.strokeColor=n.strokeColor,l.info.strokeOpacity=n.strokeOpacity));let p=e.addGraphic(l.info);p.userData.data=c,i.set(c.legacy_id,p),s.set(c.element_uuid,c)}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(yt.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(yt.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=Te({brand:e,project:i});if(this.buildingGroundMap.has(s))return this.buildingGroundMap.get(s);let o=nn({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 se(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 Zh=function(a){return a[a.D2=0]="D2",a[a.D3=1.1]="D3",a}({}),hn=class extends Nt.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?Ci(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 qe(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(yt.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(yt.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)}}}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.centerCoords,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 tt(this.context,x({},e,{position:{x:i.x,y:i.y,z:t.z}}));return this.context.currentFloor.poiLayer2.pushPoi(s),s}return null}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 Nt.Vector3;r.setFromMatrixColumn(n.matrix,1),r.normalize(),r.multiplyScalar(s/n.zoom),o.add(r)}if(i){let r=new Nt.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),Ft(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=D(o,h,n,r).x-n/2,p=new Nt.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 D(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 qi(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 $i(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 Nt.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=Ci(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 Nt.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,Q.dispose(),ct.dispose(),ke.dispose(),St.dispose(),T.dispose(),ee.dispose(),this.debounceResize=null,Nt.Sprite.Dispose==null||Nt.Sprite.Dispose.call(Nt.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 j,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=tn(e),this.context=new ps(t,this),this.debounceResize=(0,ca.debounce)(this.resize,this.config.resizeObserver.debounceTime),this.registryEvent()}};var jh=function(a){return a.HALF="half",a.POWER="power",a.MECHANICAL="mechanical",a.NORMAL="normal",a.VIP="vip",a}({});var N0=require("core-js/modules/web.dom-collections.iterator.js");var X=class extends st{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 cn=class extends X{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(yt.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(yt.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Vw=require("core-js/modules/es.string.replace.js"),Kw=require("core-js/modules/es.regexp.exec.js"),Xw=require("core-js/modules/web.dom-collections.iterator.js"),Yw=require("core-js/modules/es.promise.finally.js");var dw=require("core-js/modules/web.dom-collections.iterator.js"),uw=require("core-js/modules/es.array.push.js"),ut=require("three");var X0=require("core-js/modules/es.typed-array.float32-array.js"),Y0=require("core-js/modules/es.typed-array.at.js"),q0=require("core-js/modules/es.typed-array.fill.js"),$0=require("core-js/modules/es.typed-array.find-last.js"),J0=require("core-js/modules/es.typed-array.find-last-index.js"),Q0=require("core-js/modules/es.typed-array.set.js"),tw=require("core-js/modules/es.typed-array.sort.js"),ew=require("core-js/modules/es.typed-array.to-reversed.js"),iw=require("core-js/modules/es.typed-array.to-sorted.js"),sw=require("core-js/modules/es.typed-array.with.js"),ow=require("core-js/modules/es.array-buffer.constructor.js"),nw=require("core-js/modules/es.array-buffer.slice.js"),rw=require("core-js/modules/es.array-buffer.detached.js"),aw=require("core-js/modules/es.array-buffer.transfer.js"),hw=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),cw=require("core-js/modules/es.array.push.js"),lw=require("core-js/modules/es.typed-array.uint16-array.js"),L=require("three"),Zt=class extends L.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 L.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)}}})}};Zt.prototype.setMatrixWorld=function(a){this.matrixWorld=a};Zt.prototype.setGeometry=function(a,t){this._geometry=a,this.setPoints(a.getAttribute("position").array,t)};Zt.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 L.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 Vh(a,t){var e=new L.Matrix4,i=new L.Ray,s=new L.Sphere,o=new L.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 L.Vector3,h=new L.Vector3,c=new L.Vector3,l=this instanceof L.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,v=0,w=u.length-1;v<w;v+=l){var M=u[v],P=u[v+1];r.fromArray(m,M*3),h.fromArray(m,P*3);var C=g[Math.floor(v/3)]!==void 0?g[Math.floor(v/3)]:1,S=a.params.Line.threshold+this.material.lineWidth*C/2,G=S*S,E=i.distanceSqToSegment(r,h,o,c);if(!(E>G)){o.applyMatrix4(this.matrixWorld);var nt=a.ray.origin.distanceTo(o);nt<a.near||nt>a.far||(t.push({distance:nt,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}),v=w)}}}}Zt.prototype.raycast=Vh;Zt.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]};Zt.prototype.copyV3=function(a){var t=a*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Zt.prototype.getDistance=function(a){let t=0;for(let e=0;e<a;e++){let i=6*e,s=new L.Vector3(this.positions[i],this.positions[i+1],this.positions[i+2]),o=new L.Vector3(this.positions[i+6],this.positions[i+7],this.positions[i+8]),n=s.distanceTo(o);t+=n}return t};Zt.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 L.BufferAttribute(new Float32Array(this.positions),3),previous:new L.BufferAttribute(new Float32Array(this.previous),3),next:new L.BufferAttribute(new Float32Array(this.next),3),side:new L.BufferAttribute(new Float32Array(this.side),1),width:new L.BufferAttribute(new Float32Array(this.width),1),uv:new L.BufferAttribute(new Float32Array(this.uvs),2),index:new L.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new L.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 ln(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}Zt.prototype.advance=function(a){var t=this._attributes.position.array,e=this._attributes.previous.array,i=this._attributes.next.array,s=t.length;ln(t,0,e,0,s),ln(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,ln(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};L.ShaderChunk.meshline_vert=["",L.ShaderChunk.logdepthbuf_pars_vertex,L.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;","",L.ShaderChunk.logdepthbuf_vertex,L.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",L.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 dt.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new dt.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new dt.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=T.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 dt.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 dt.Vector3(h[0],h[1],e)),t.push(new dt.Vector3(c[0],c[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new dt.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new dt.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({},ge,s)),this.init())}};var Fg=require("core-js/modules/web.dom-collections.iterator.js"),zg=require("core-js/modules/es.string.trim.js");var Ut=require("three"),Nr=require("three/examples/jsm/utils/BufferGeometryUtils.js");var Zr={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},ts=class extends Ut.Object3D{init(){return f(this,null,function*(){let t=yield Promise.all(this.options.map(n=>Q.getTextureByText(n.texts[0],{fillStyle:Ss(n.fillColor,n.fillOpacity),strokeStyle:Ss(n.strokeColor,n.strokeOpacity),lineWidth:2,font:"bold 28px 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 Ut.PlaneGeometry(d,h.secondHeight),m=new Ut.Matrix4().makeTranslation(h.center_x,h.center_y,h.airHeight+h.deltaHeight+h.height).multiply(new Ut.Matrix4().makeRotationZ(h.secondRotate));return u.applyMatrix4(m),u}),i=(0,Nr.mergeGeometries)(e,!0);e.forEach(n=>n.dispose());let s=t.map(n=>{let{texture:r}=n,h=new Ut.MeshBasicMaterial({map:r,alphaTest:.9,side:Ut.DoubleSide});return r.needsUpdate=!0,h}),o=new Ut.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({},Zr,i)).filter(i=>i.texts[0].trim()),this.options.length&&this.init()}};var jr=require("three"),Vr=require("three/examples/jsm/lines/Line2.js"),Kr=require("three/examples/jsm/lines/LineGeometry.js"),Xr=require("three/examples/jsm/lines/LineMaterial.js"),ai=class extends jr.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 Vr.Line2(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&I(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 Kr.LineGeometry,this.lineMaterial=new Xr.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 jg=require("core-js/modules/es.array.push.js"),Vg=require("core-js/modules/web.dom-collections.iterator.js"),Fe=require("three");var hi=require("three");var ji=class extends Fe.Object3D{loadModel(){return f(this,null,function*(){let t=yield St.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 Fe.InstancedMesh(c,l,this.options.length)});t.scene.rotation.set(Math.PI/2,0,0);let o=new Fe.Box3().setFromObject(t.scene).getSize(new Fe.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()),I(this),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.subMeshes=[],this.materialOriginParams=new Map,this.loadModel()}};var ze=require("three");var ri=class extends ze.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=T.GetMergeAttributeGraphicMaterial()}initLineMaterial(){return this.lineMaterial=T.GetMergeAttributeGraphicLineMaterial()}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new ze.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 ze.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 ze.ObjectLoader,this.options=x({},ge,e),this.init()}};var ci=require("three");var es=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,Lt.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 ry=require("core-js/modules/es.typed-array.float32-array.js"),ay=require("core-js/modules/es.typed-array.at.js"),hy=require("core-js/modules/es.typed-array.fill.js"),cy=require("core-js/modules/es.typed-array.find-last.js"),ly=require("core-js/modules/es.typed-array.find-last-index.js"),py=require("core-js/modules/es.typed-array.set.js"),dy=require("core-js/modules/es.typed-array.sort.js"),uy=require("core-js/modules/es.typed-array.to-reversed.js"),my=require("core-js/modules/es.typed-array.to-sorted.js"),fy=require("core-js/modules/es.typed-array.with.js"),gy=require("core-js/modules/es.array-buffer.constructor.js"),yy=require("core-js/modules/es.array-buffer.slice.js"),vy=require("core-js/modules/es.array-buffer.detached.js"),xy=require("core-js/modules/es.array-buffer.transfer.js"),wy=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js");var ot=require("three");var Oe=class extends ot.Object3D{init(){return f(this,null,function*(){let t=this.options.iconUrl,e=yield ct.getTextureByUrl(t),i=new ot.MeshBasicMaterial({map:e,transparent:!0,alphaTest:.2,side:ot.FrontSide}),s=new ot.InstancedMesh(this.geometry,i,this.options.mergedMatrixes.size);s.instanceMatrix=new ot.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&&I(this.mesh),(t=this.mesh)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.geometry=new ot.ShapeGeometry(new ot.Shape([new ot.Vector2(-.5,-.5),new ot.Vector2(-.5,.5),new ot.Vector2(.5,.5),new ot.Vector2(.5,-.5)])),this.options=x({},Ns,e);let i=new ot.Float32BufferAttribute([0,0,0,1,1,1,1,0],2);this.geometry.setAttribute("uv",i),this.init()}};var Ey=require("core-js/modules/es.array.push.js"),be=require("three");var qo=require("three/examples/jsm/lines/LineSegments2.js"),$o=require("three/examples/jsm/lines/LineSegmentsGeometry.js");var is=class extends be.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=T.createMeshBasicMaterial({color:"#ffffff",opacity:1,vertexColors:!0});return this.material=t,t}initDoubleLine(){if(this.options.dashedLineGeometry){let t=T.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:!0,resolution:new be.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0});t.transparent=!0,t.needsUpdate=!0;let e=new $o.LineSegmentsGeometry;e.setPositions(this.options.dashedLineGeometry.positions),e.setColors(this.options.dashedLineGeometry.colors);let i=new qo.LineSegments2(e,t);i.computeLineDistances(),i.position.z+=.01,this.add(i),this.doubleLines.push(i)}if(this.options.lineGeometry){let t=T.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:!1,resolution:new be.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0}),e=new $o.LineSegmentsGeometry;e.setPositions(this.options.lineGeometry.positions),e.setColors(this.options.lineGeometry.colors);let i=new qo.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 be.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 be.ObjectLoader,this.init()}};var Dy=require("core-js/modules/es.typed-array.float32-array.js"),Ay=require("core-js/modules/es.typed-array.at.js"),Oy=require("core-js/modules/es.typed-array.fill.js"),Iy=require("core-js/modules/es.typed-array.find-last.js"),Ry=require("core-js/modules/es.typed-array.find-last-index.js"),Gy=require("core-js/modules/es.typed-array.set.js"),Fy=require("core-js/modules/es.typed-array.sort.js"),zy=require("core-js/modules/es.typed-array.to-reversed.js"),By=require("core-js/modules/es.typed-array.to-sorted.js"),Wy=require("core-js/modules/es.typed-array.with.js"),Uy=require("core-js/modules/es.array-buffer.constructor.js"),Hy=require("core-js/modules/es.array-buffer.slice.js"),Ny=require("core-js/modules/es.array-buffer.detached.js"),Zy=require("core-js/modules/es.array-buffer.transfer.js"),jy=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Vy=require("core-js/modules/web.dom-collections.iterator.js"),W=require("three");var ii=class extends W.Object3D{setColorByIndex(t,e){this.mesh&&(this.mesh.setColorAt(t,new W.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=T.GetInstancedGraphicMaterial()}initLineMaterial(){let t=T.GetMergeAttributeGraphicLineMaterial();this.lineMaterial=t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new W.InstancedMesh(this.geometry,this.material,this.options.length);let t=new W.InstancedBufferAttribute(new Float32Array(this.options.length),1),e=new W.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,v]=m,w=Math.atan2(v,g)-Math.PI/2,M=new W.Matrix4().compose(new W.Vector3(i.center_coord_x,i.center_coord_y,(i.deltaHeight||0)+i.airHeight+i.height/2),new W.Quaternion().setFromAxisAngle(new W.Vector3(0,0,1),w),new W.Vector3(u,d,i.height));this.mesh.setMatrixAt(s,M),this.mesh.setColorAt(s,new W.Color(i.fillColor).convertLinearToSRGB());var P;t.array[s]=(P=i.fillOpacity)!=null?P:1;var C;e.array[s]=((C=i.deltaHeight)!=null?C: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}=ks(this.options),s=new W.BufferGeometry().setFromPoints(t);s.setAttribute("color",new W.BufferAttribute(new Float32Array(e),3)),s.setAttribute("opacity",new W.BufferAttribute(new Float32Array(i),1)),this.lineOriginOpacity=[...i],this.lineGeometry=s}createBorder(){this.line&&this.remove(this.line);let t=new W.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 W.BoxGeometry(1,1,1),this.options=[],this.originOpacity=[],this.lineOriginOpacity=[],this.options=e.map(i=>x({},ge,i)),this.init()}};var Jy=require("core-js/modules/es.typed-array.float32-array.js"),Qy=require("core-js/modules/es.typed-array.at.js"),tv=require("core-js/modules/es.typed-array.fill.js"),ev=require("core-js/modules/es.typed-array.find-last.js"),iv=require("core-js/modules/es.typed-array.find-last-index.js"),sv=require("core-js/modules/es.typed-array.set.js"),ov=require("core-js/modules/es.typed-array.sort.js"),nv=require("core-js/modules/es.typed-array.to-reversed.js"),rv=require("core-js/modules/es.typed-array.to-sorted.js"),av=require("core-js/modules/es.typed-array.with.js"),hv=require("core-js/modules/es.array-buffer.constructor.js"),cv=require("core-js/modules/es.array-buffer.slice.js"),lv=require("core-js/modules/es.array-buffer.detached.js"),pv=require("core-js/modules/es.array-buffer.transfer.js"),dv=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),uv=require("core-js/modules/web.dom-collections.iterator.js"),$t=require("three");var Xe=class extends $t.Object3D{init(){return f(this,null,function*(){this.initMaterial(),this.initMesh()})}initMaterial(){this.material=T.GetInstancedGraphicMaterial()}initMesh(){if(this.mesh&&this.remove(this.mesh),!this.elements)return;this.mesh=new $t.InstancedMesh(this.geometry,this.material,this.elements.size);let t=new $t.InstancedBufferAttribute(new Float32Array(this.elements.opacities),1),e=new $t.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 $t.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 $t.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 $t.BoxGeometry(1,1,1),this.material=null,this.elements=null,this.originOpacities=[],this.elements=e,this.init()}};var yv=require("core-js/modules/es.typed-array.float32-array.js"),vv=require("core-js/modules/es.typed-array.at.js"),xv=require("core-js/modules/es.typed-array.fill.js"),wv=require("core-js/modules/es.typed-array.find-last.js"),Mv=require("core-js/modules/es.typed-array.find-last-index.js"),_v=require("core-js/modules/es.typed-array.set.js"),Pv=require("core-js/modules/es.typed-array.sort.js"),bv=require("core-js/modules/es.typed-array.to-reversed.js"),Sv=require("core-js/modules/es.typed-array.to-sorted.js"),Ev=require("core-js/modules/es.typed-array.with.js"),Lv=require("core-js/modules/es.array-buffer.constructor.js"),Cv=require("core-js/modules/es.array-buffer.slice.js"),Tv=require("core-js/modules/es.array-buffer.detached.js"),kv=require("core-js/modules/es.array-buffer.transfer.js"),Dv=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Av=require("core-js/modules/web.dom-collections.iterator.js"),oe=require("three");var ss=class extends oe.Object3D{init(){return f(this,null,function*(){this.initMaterial(),this.initMesh()})}initMaterial(){this.material=T.GetInstancedWallMaterial()}initMesh(){if(this.mesh&&this.remove(this.mesh),!this.elements)return;this.mesh=new oe.InstancedMesh(this.geometry,this.material,this.elements.size);let t=new oe.InstancedBufferAttribute(new Float32Array(this.elements.opacities),1),e=new oe.InstancedBufferAttribute(new Float32Array(this.elements.maxZs),1),i=new oe.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 oe.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 oe.BoxGeometry(1,1,1),this.material=null,this.elements=null,this.originOpacities=[],this.elements=e,this.init()}};var li=require("three");var Ie=class extends li.Object3D{init(){return f(this,null,function*(){this.initLineGeometry(),this.initLineMaterial(),this.createBorder()})}initLineMaterial(){return this.lineMaterial=T.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({},ge,e),this.init()}};var Yr=require("three"),Zs=class extends Wt{setEnable(t){super.setEnable(t),bt(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=D(this.startPoint,e,i,s),n=D(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 lt&&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=D(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=D(h,s,o,n),p=D(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 Yr.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);bt(this.rect,n.x,n.y,r,h)}else bt(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 os=class extends qr.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))}}),(He?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=>{Ne(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Ne(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 sx=require("core-js/modules/es.set.difference.v2.js"),ox=require("core-js/modules/es.set.intersection.v2.js"),nx=require("core-js/modules/es.set.is-disjoint-from.v2.js"),rx=require("core-js/modules/es.set.is-subset-of.v2.js"),ax=require("core-js/modules/es.set.is-superset-of.v2.js"),hx=require("core-js/modules/es.set.symmetric-difference.v2.js"),cx=require("core-js/modules/es.set.union.v2.js"),lx=require("core-js/modules/web.dom-collections.iterator.js");var js=require("three");var ns=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 j,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 De){let{x:m,y:g}=u.clientPos,v=Math.sqrt((m-o.offsetX)**2+(g-o.offsetY)**2);v<p&&(p=v,l=d)}else if(u instanceof tt){let{x:m,y:g}=u.box.getCenter(new js.Vector2),v=Math.sqrt((m-o.offsetX)**2+(g-o.offsetY)**2);v<p&&(p=v,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 mx=require("core-js/modules/web.dom-collections.iterator.js"),Ht=require("three");var rs=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 se).length)return null;let e=this.box,{camera:i,clientSize:{width:s,height:o}}=this.context,{min:n,max:r}=e,c=[new Ht.Vector3(n.x,n.y,n.z),new Ht.Vector3(r.x,n.y,n.z),new Ht.Vector3(n.x,r.y,n.z),new Ht.Vector3(r.x,r.y,n.z),new Ht.Vector3(n.x,n.y,r.z),new Ht.Vector3(r.x,n.y,r.z),new Ht.Vector3(n.x,r.y,r.z),new Ht.Vector3(r.x,r.y,r.z)].map(m=>D(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,rs.polygon)([[[e,s],[i,s],[i,o],[e,o],[e,s]]]),u=(0,rs.polygon)([[[p,h],[n-c,h],[n-c,r-l],[p,r-l],[p,h]]]);try{return(0,rs.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 Ht.Vector3,zoom:1,target:new Ht.Vector3},this.enable=!0,this.box=new Ht.Box3,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:i,right:s,top:o,bottom:n}=e;if([i,s,o,n].every(h=>!h))return;this.checkDistanceToScreenEdge({left:i,right:s,top:o,bottom:n})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var Mx=require("core-js/modules/es.promise.finally.js"),Jo=require("three"),Ye=require("@tweenjs/tween.js");var vx=require("core-js/modules/web.dom-collections.iterator.js"),xx=require("core-js/modules/es.array.push.js"),b=require("three"),Ks=new b.Ray,$r=new b.Plane,Sh=Math.cos(70*b.MathUtils.DEG2RAD),Xs=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(y){y.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=y},this.stopListenToKeyEvents=function(){var y;(y=this._domElementKeyEvents)==null||y.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 y=new b.Vector3,_=new b.Quaternion().setFromUnitVectors(t.up,new b.Vector3(0,1,0)),N=_.clone().invert(),it=new b.Vector3,Rt=new b.Quaternion,he=new b.Vector3,Qt=2*Math.PI;return function(_i){_i===void 0&&(_i=null);let ve=i.object.position;y.copy(ve).sub(i.target),y.applyQuaternion(_),r.setFromVector3(y),i.autoRotate&&o===s.NONE&&It(Tt(_i)),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+=Qt:xe>Math.PI&&(xe-=Qt),we<-Math.PI?we+=Qt:we>Math.PI&&(we-=Qt),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&&G||i.object.isOrthographicCamera?r.radius=H(r.radius):r.radius=H(r.radius*c),y.setFromSpherical(r),y.applyQuaternion(N),ve.copy(i.target).add(y),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 _s=!1;if(i.zoomToCursor&&G){let Pi=null;if(i.object.isPerspectiveCamera){let bi=y.length();Pi=H(bi*c);let Ps=bi-Pi;i.object.position.addScaledVector(C,Ps),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){let bi=new b.Vector3(S.x,S.y,0);bi.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),_s=!0;let Ps=new b.Vector3(S.x,S.y,0);Ps.unproject(i.object),i.object.position.sub(Ps).add(bi),i.object.updateMatrixWorld(),Pi=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;Pi!==null&&(i.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(Pi).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))<Sh?t.lookAt(i.target):($r.setFromNormalAndCoplanarPoint(i.object.up,i.target),Ks.intersectPlane($r,i.target))))}else i.object.isOrthographicCamera&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),_s=!0);return c=1,G=!1,_s||it.distanceToSquared(i.object.position)>n||8*(1-Rt.dot(i.object.quaternion))>n||he.distanceToSquared(i.target)>0?(i.dispatchEvent({type:"change"}),it.copy(i.object.position),Rt.copy(i.object.quaternion),he.copy(i.target),_s=!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,v=new b.Vector2,w=new b.Vector2,M=new b.Vector2,P=new b.Vector2,C=new b.Vector3,S=new b.Vector2,G=!1,E=[],nt={};function Tt(y){return y!==null?2*Math.PI/60*i.autoRotateSpeed*y:2*Math.PI/60/60*i.autoRotateSpeed}function gt(){return Math.pow(.95,i.zoomSpeed)}function It(y){h.theta-=y}function kt(y){h.phi-=y}let ne=function(){let y=new b.Vector3;return function(N,it){y.setFromMatrixColumn(it,0),y.multiplyScalar(-N),l.add(y)}}(),Ee=function(){let y=new b.Vector3;return function(N,it){i.screenSpacePanning===!0?y.setFromMatrixColumn(it,1):(y.setFromMatrixColumn(it,0),y.crossVectors(i.object.up,y)),y.multiplyScalar(N),l.add(y)}}(),ht=function(){let y=new b.Vector3;return function(N,it){let Rt=i.domElement;if(i.object.isPerspectiveCamera){let he=i.object.position;y.copy(he).sub(i.target);let Qt=y.length();Qt*=Math.tan(i.object.fov/2*Math.PI/180),ne(2*N*Qt/Rt.clientHeight,i.object.matrix),Ee(2*it*Qt/Rt.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(ne(N*(i.object.right-i.object.left)/i.object.zoom/Rt.clientWidth,i.object.matrix),Ee(it*(i.object.top-i.object.bottom)/i.object.zoom/Rt.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function $e(y){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function wi(y){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function U(y){if(!i.zoomToCursor)return;G=!0;let _=i.domElement.getBoundingClientRect(),N=y.clientX-_.left,it=y.clientY-_.top,Rt=_.width,he=_.height;S.x=N/Rt*2-1,S.y=-(it/he)*2+1,C.set(S.x,S.y,1).unproject(i.object).sub(i.object.position).normalize()}function H(y){return Math.max(i.minDistance,Math.min(i.maxDistance,y))}function et(y){p.set(y.clientX,y.clientY)}function J(y){U(y),w.set(y.clientX,y.clientY)}function re(y){m.set(y.clientX,y.clientY)}function ae(y){d.set(y.clientX,y.clientY),u.subVectors(d,p).multiplyScalar(i.rotateSpeed);let _=i.domElement;It(2*Math.PI*u.x/_.clientHeight),kt(2*Math.PI*u.y/_.clientHeight),p.copy(d),i.update()}function Le(y){M.set(y.clientX,y.clientY),P.subVectors(M,w),P.y>0?$e(gt()):P.y<0&&wi(gt()),w.copy(M),i.update()}function ye(y){g.set(y.clientX,y.clientY),v.subVectors(g,m).multiplyScalar(i.panSpeed),ht(v.x,v.y),m.copy(g),i.update()}function Mi(y){U(y),y.deltaY<0?wi(gt()):y.deltaY>0&&$e(gt()),i.update()}function Pa(y){let _=!1;switch(y.code){case i.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?kt(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(0,i.keyPanSpeed),_=!0;break;case i.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?kt(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(0,-i.keyPanSpeed),_=!0;break;case i.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?It(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(i.keyPanSpeed,0),_=!0;break;case i.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?It(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(-i.keyPanSpeed,0),_=!0;break}_&&(y.preventDefault(),i.update())}function Tn(){if(E.length===1)p.set(E[0].pageX,E[0].pageY);else{let y=(E[0].pageX-E[0].pageY)/(E[1].pageX-E[1].pageY),_=E[0].pageY-y*E[0].pageX;i.rotateLineStart.set(y,_);let N=.5*(E[0].pageX+E[1].pageX),it=.5*(E[0].pageY+E[1].pageY);p.set(N,it)}}function kn(){if(E.length===1)m.set(E[0].pageX,E[0].pageY);else{let y=.5*(E[0].pageX+E[1].pageX),_=.5*(E[0].pageY+E[1].pageY);m.set(y,_)}}function Dn(){let y=E[0].pageX-E[1].pageX,_=E[0].pageY-E[1].pageY,N=Math.sqrt(y*y+_*_);w.set(0,N)}function ba(){i.enableZoom&&Dn(),i.enablePan&&kn()}function Sa(){i.enableZoom&&Dn(),i.enableRotate&&Tn()}function An(y){if(E.length==1)d.set(y.pageX,y.pageY);else{let N=fo(y),it=.5*(y.pageX+N.x),Rt=.5*(y.pageY+N.y);d.set(it,Rt);let he=(y.pageY-N.y)/(y.pageX-N.x),Qt=N.y-he*N.x;if(i.rotateLineEnd.set(he,Qt),Number.isFinite(i.rotateLineEnd.x)&&Number.isFinite(i.rotateLineStart.x)){let go=(i.rotateLineStart.y-i.rotateLineEnd.y)/(i.rotateLineEnd.x-i.rotateLineStart.x),_i=he*go+Qt;if(Number.isFinite(go)&&Number.isFinite(_i)){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;kt(2*Math.PI*u.y/_.clientHeight),p.copy(d)}function On(y){if(E.length===1)g.set(y.pageX,y.pageY);else{let _=fo(y),N=.5*(y.pageX+_.x),it=.5*(y.pageY+_.y);g.set(N,it)}v.subVectors(g,m).multiplyScalar(i.panSpeed),ht(v.x,v.y),m.copy(g)}function In(y){let _=fo(y),N=y.pageX-_.x,it=y.pageY-_.y,Rt=Math.sqrt(N*N+it*it);M.set(0,Rt),P.set(0,Math.pow(M.y/w.y,i.zoomSpeed)),$e(P.y),w.copy(M)}function Ea(y){i.enableZoom&&In(y),i.enablePan&&On(y)}function La(y){i.enableZoom&&In(y),i.enableRotate&&An(y)}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)),Aa(_),_.pointerType==="touch"?ka(_):Ca(_))},this.onPointerMove=function(_){i.enabled!==!1&&(_.pointerType==="touch"?Da(_):Ta(_))},this.onPointerUp=function(_){Oa(_),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 Ca(y){let _;switch(y.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;J(y),o=s.DOLLY;break;case b.MOUSE.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(i.enablePan===!1)return;re(y),o=s.PAN}else{if(i.enableRotate===!1)return;et(y),o=s.ROTATE}break;case b.MOUSE.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(i.enableRotate===!1)return;et(y),o=s.ROTATE}else{if(i.enablePan===!1)return;re(y),o=s.PAN}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent({type:"start"})}function Ta(y){switch(o){case s.ROTATE:if(i.enableRotate===!1)return;ae(y);break;case s.DOLLY:if(i.enableZoom===!1)return;Le(y);break;case s.PAN:if(i.enablePan===!1)return;ye(y);break}}this.onMouseWheel=function(_){i.enabled===!1||i.enableZoom===!1||o!==s.NONE||(_.preventDefault(),i.dispatchEvent({type:"start"}),Mi(_),i.dispatchEvent({type:"end"}))},this.onKeyDown=function(_){i.enabled===!1||i.enablePan===!1||Pa(_)};function ka(y){switch(Rn(y),E.length){case 1:switch(i.touches.ONE){case b.TOUCH.ROTATE:if(i.enableRotate===!1)return;Tn(),o=s.TOUCH_ROTATE;break;case b.TOUCH.PAN:if(i.enablePan===!1)return;kn(),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;ba(),o=s.TOUCH_DOLLY_PAN;break;case b.TOUCH.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Sa(),o=s.TOUCH_DOLLY_ROTATE;break;default:o=s.NONE}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent({type:"start"})}function Da(y){switch(Rn(y),o){case s.TOUCH_ROTATE:if(i.enableRotate===!1)return;An(y),i.update();break;case s.TOUCH_PAN:if(i.enablePan===!1)return;On(y),i.update();break;case s.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Ea(y),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;La(y),i.update();break;default:o=s.NONE}}this.onContextMenu=function(_){i.enabled!==!1&&_.preventDefault()};function Aa(y){E.push(y)}function Oa(y){delete nt[y.pointerId];for(let _=0;_<E.length;_++)if(E[_].pointerId==y.pointerId){E.splice(_,1);return}}function Rn(y){let _=nt[y.pointerId];_===void 0&&(_=new b.Vector2,nt[y.pointerId]=_),_.set(y.pageX,y.pageY)}function fo(y){let _=y.pointerId===E[0].pointerId?E[1]:E[0];return nt[_.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 as=class extends Xs{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):Ft(new Promise(s=>{let o={polar:this.getPolarAngle()},n={polar:t},r=new Ye.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):Ft(new Promise(s=>{let o={azimuthal:this.getAzimuthalAngle()},n={azimuthal:t},r=new Ye.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 Jo.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 Ft(new Promise(o=>{let n=new Ye.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?Ft(new Promise(n=>{let r=new Ye.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 Jo.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 Ye.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 hs=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 j,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 ea=require("three");var Jr=require("three"),Qr=require("three/examples/jsm/environments/RoomEnvironment.js");function ta(a,t){t===void 0&&(t=.85);let e=new Jr.PMREMGenerator(a);return e.compileEquirectangularShader(),e.fromScene(new Qr.RoomEnvironment).texture}var cs=class extends ea.Scene{dispose(){var t;(t=this.environment)==null||t.dispose(),this.environment=null,I(this),this.clear()}constructor(t){super(),this.environment=ta(t)}};var ia=require("three"),ls=class extends ia.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 Qo=require("@turf/turf");var Ix=require("core-js/modules/es.array.unshift.js"),Rx=require("core-js/modules/es.array.push.js"),sa=require("three"),Ys=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 sa.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 ps=class extends z.EventDispatcher{get config(){return this.bmap.config}get center(){return this.bmap.buildingCenter}setRange(t){this.range=(0,Qo.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 ls(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new as(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 z.Vector3(0,0,0)),e===void 0&&(e=new z.Vector3(100,0,0));let{clientWidth:i,clientHeight:s}=this.container,o=D(t,this.camera,i,s),n=D(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 z.AmbientLight&&(e.color=new z.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 z.Vector2;s.x=t/this.clientSize.width*2-1,s.y=e/this.clientSize.height*-2+1;let o=new z.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 z.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),this.camera.updateMatrixWorld(),this.camera.updateProjectionMatrix();let{max:p,min:d}=t,u=new z.Vector3(d.x,p.y,p.z),m=new z.Vector3(p.x,p.y,p.z),g=new z.Vector3(p.x,d.y,d.z),v=new z.Vector3(d.x,d.y,d.z),w=D(u,this.camera,h,c),M=D(m,this.camera,h,c),P=D(v,this.camera,h,c),C=D(g,this.camera,h,c),G=new z.Box2().setFromPoints([new z.Vector2(w.x,w.y),new z.Vector2(M.x,M.y),new z.Vector2(P.x,P.y),new z.Vector2(C.x,C.y)]).getSize(new z.Vector2),E=(h-o-r)/G.x,nt=(c-s-n)/G.y,Tt=Math.min(E,nt),gt=new z.Vector3((p.x+d.x)/2,(p.y+d.y)/2,(p.z+d.z)/2),It=Tt*this.camera.zoom,kt=this.camera.clone();kt.zoom=It,kt.updateMatrix();let ne=(o-r)/2,Ee=(s-n)/2;if(ne){let ht=new z.Vector3;ht.setFromMatrixColumn(kt.matrix,0),ht.normalize(),ht.multiplyScalar(ne/It),gt.add(ht)}if(Ee){let ht=new z.Vector3;ht.setFromMatrixColumn(kt.matrix,1),ht.normalize(),ht.multiplyScalar(Ee/It),gt.add(ht)}return{zoom:Tt*this.camera.zoom,center:gt}}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=xo(),this.range=(0,Qo.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 hs(this),this.scene=new cs(this.renderer),this.collisionSystem=new Ys(this),this.init(),this.selection=new os(this),this.hoverHelper=new ns(this),this.resizeClientSize(),this.registryEvent()}};var oa=require("lodash"),na={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 tn(a){return typeof a.resizeObserver=="boolean"&&(a.resizeObserver={enable:a.resizeObserver}),(0,oa.merge)({},na,a)}var ca=require("lodash");var h0=require("core-js/modules/web.dom-collections.iterator.js");var Js=require("three");var t0=require("core-js/modules/es.array.push.js"),e0=require("core-js/modules/web.dom-collections.iterator.js");var qx=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 en=["range","ground","store","facility","parkingSpace"];function ra(a){return en.indexOf(a.l_type)===-1?en.length:en.indexOf(a.l_type)}function Eh(a){a.layers.sort((t,e)=>ra(t)-ra(e))}function Lh(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 Ai(i.elements,e)})}function ds(a){Eh(a),Lh(a)}function ui(a,t){return t===void 0&&(t=6),a.floor_id+"_"+a.version_id+(t?"_"+t:"")}function aa(a,t,e){switch(a.l_type){case"ground":return sn(a,t);case"graph":return Ch(a,t,e);case"wall":return Th(a,t);case"lane":return kh(a,t);case"texture2d":case"texture3d":return Dh(a,t);case"glb":return Ah(a,t);case"store":return Oh(a,t,e);case"facility":return Rh(a,t,e);case"parkingSpace":return Fh(a,t,e);case"text":return Bh(a,t)}}function ha(a,t,e,i,s){switch(a.l_type){case"store":return Ih(a,t,e,i,s);case"facility":return Gh(a,t,e,i,s);case"parkingSpace":return zh(a,t,i,s)}}function Ch(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 sn(a,t){let e=a.elements.map(i=>new lt(t.context,x({},i,{dashed:!1})));t.addGrounds(e)}function Th(a,t){if(a.mergedElements)a.mergedElements.map(e=>{if(e.instancedGeometry){let i=new ss(t.context,e.instancedGeometry);t.wallLayer.add(i)}if(e.mergedGeometry){let i=new es(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 Ji(t.context,i);t.wallLayer.add(s)})}}function kh(a,t){if(a.mergedElements){let e=new is(t.context,a.mergedElements);t.laneLayer.add(e)}else{let e=new Qi(t.context,a.elements);t.laneLayer.add(e)}}function Dh(a,t){if(a.mergedMatrixes)a.mergedMatrixes.map(e=>{let i=new Oe(t.context,e);t.textureLayer.add(i)});else if(a.elements.length){let e=new Ae(t.context,a.elements);t.textureLayer.add(e)}}function Ah(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 Oh(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 Ih(a,t,e,i,s){a.elements.filter(o=>s.filterPoi(o)).map(o=>{try{let n=qs(o,e),r=new tt(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 Rh(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 Gh(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 tt(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 Fh(a,t,e){t.parkingSpaceLayer.load(a,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function zh(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 tt(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 Bh(a,t){let e=new ts(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 Wh={};function on(){return new Worker(new URL("./worker/loader.worker-XI4MI7KE.js",Wh.url))}var Uh={mergeParkingSpace:!0,mergeGraphic:!0,renderVersion:di.MERGED_RENDER_VERSION,layers:["graph","wall","lane","texture2d","texture3d","glb","store","facility","parkingSpace","text"],filterPoi:()=>!0},qe=class extends st{initDb(){return f(this,null,function*(){try{let{db:t}=yield Ds();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||"{}"),e))}else return this.load("https://screen.aibee.cn/ai-map/map/get-floor-map?place_id="+t,e);this.getOtherDataByFreeTime()})}setCacheData(t,e,i){return f(this,null,function*(){return this.initDbPromise.then(()=>Gi(t,""+e,i))})}getCacheData(t,e){return f(this,null,function*(){return this.initDbPromise.then(()=>ei(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,ds(o),this.setCacheData(xt.MAP_DATA,s,o),this.setCacheData(xt.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(xt.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(xt.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){Z(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(xt.ROAD_NETWORK_DATA,i);if(s)return s;let o=yield fetch(e.route_url).then(n=>n.json());return this.setCacheData(xt.ROAD_NETWORK_DATA,i,o),this.setCacheData(xt.ROUTE_VERSION,i,e.version_id),o}catch(s){let o=yield fetch(e.route_url).then(n=>n.json());return this.setCacheData(xt.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(xt.FACILITY_DATA,e,s),this.setCacheData(xt.FACILITY_VERSION,e,t.version_id)),s});try{let s=yield this.getCacheData(xt.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,this.loadWorker&&(yield Z(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*(){ds(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*(){ds(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 ds(t);let o=x({},this.placeConfig,e),n=new se(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:yt.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.config.control.defaultAzimuthal=c/180*Math.PI,this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:n,graphics:[]}}),this.bmap.dispatchEvent({type:yt.SWITCH_FLOOR_GROUND,data:{curFloor:n}}),yield bs(),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 So(2),yield this.getFloorPoi(s,n,o),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:n,graphics:n.graphicLayer.children}}),this.bmap.dispatchEvent({type:yt.SWITCH_FLOOR_AFTER,data:{curFloor:n,graphics:n.graphicLayer.children}}),n})}getFloorBaseLayer(t,e){e||(e=new se(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":sn(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 se(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)&&(aa(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 ha(n,e,this.locale,i,this.options)})),console.log("poi time",Date.now()-s);let o=Date.now();bs().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return f(this,null,function*(){yr(),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 Ve,this.loadWorker=on(),this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=x({},Uh,e),this.placeConfig=x({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var M0=require("core-js/modules/web.dom-collections.iterator.js");function nn(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 rn(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 Hh(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?Nh(h.fileId,t):null)})}function Nh(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 an=class{load(t){return f(this,null,function*(){let e=Te(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,i]=yield Promise.all([this.loadBuildGround(t),rn(t,this.bmap.config)]),s=Te({floor:t.floor,ts:t.ts});Ai(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"){l.info.fillColor=o.color,l.info.fillOpacity=o.opacity,l.info.height=o.height,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity,e.createGround(l.info);continue}else c.info.userData.mark?(l.info.height=n.height,l.info.fillColor=n.color,l.info.fillOpacity=n.opacity,l.info.stroke=n.stroke,l.info.strokeColor=n.strokeColor,l.info.strokeOpacity=n.strokeOpacity):(l.info.fillOpacity=r.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=n.height,l.info.fillColor=n.color,l.info.stroke=n.stroke,l.info.strokeColor=n.strokeColor,l.info.strokeOpacity=n.strokeOpacity));let p=e.addGraphic(l.info);p.userData.data=c,i.set(c.legacy_id,p),s.set(c.element_uuid,c)}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(yt.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(yt.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=Te({brand:e,project:i});if(this.buildingGroundMap.has(s))return this.buildingGroundMap.get(s);let o=nn({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 se(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 Zh=function(a){return a[a.D2=0]="D2",a[a.D3=1.1]="D3",a}({}),hn=class extends Nt.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?Ci(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 qe(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(yt.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(yt.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)}}}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.centerCoords,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 tt(this.context,x({},e,{position:{x:i.x,y:i.y,z:t.z}}));return this.context.currentFloor.poiLayer2.pushPoi(s),s}return null}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 Nt.Vector3;r.setFromMatrixColumn(n.matrix,1),r.normalize(),r.multiplyScalar(s/n.zoom),o.add(r)}if(i){let r=new Nt.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),Ft(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=D(o,h,n,r).x-n/2,p=new Nt.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 D(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 qi(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 $i(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 Nt.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=Ci(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 Nt.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,Q.dispose(),ct.dispose(),ke.dispose(),St.dispose(),T.dispose(),ee.dispose(),this.debounceResize=null,Nt.Sprite.Dispose==null||Nt.Sprite.Dispose.call(Nt.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 j,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=tn(e),this.context=new ps(t,this),this.debounceResize=(0,ca.debounce)(this.resize,this.config.resizeObserver.debounceTime),this.registryEvent()}};var jh=function(a){return a.HALF="half",a.POWER="power",a.MECHANICAL="mechanical",a.NORMAL="normal",a.VIP="vip",a}({});var N0=require("core-js/modules/web.dom-collections.iterator.js");var X=class extends st{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 cn=class extends X{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(yt.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(yt.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Vw=require("core-js/modules/es.string.replace.js"),Kw=require("core-js/modules/es.regexp.exec.js"),Xw=require("core-js/modules/web.dom-collections.iterator.js"),Yw=require("core-js/modules/es.promise.finally.js");var dw=require("core-js/modules/web.dom-collections.iterator.js"),uw=require("core-js/modules/es.array.push.js"),ut=require("three");var X0=require("core-js/modules/es.typed-array.float32-array.js"),Y0=require("core-js/modules/es.typed-array.at.js"),q0=require("core-js/modules/es.typed-array.fill.js"),$0=require("core-js/modules/es.typed-array.find-last.js"),J0=require("core-js/modules/es.typed-array.find-last-index.js"),Q0=require("core-js/modules/es.typed-array.set.js"),tw=require("core-js/modules/es.typed-array.sort.js"),ew=require("core-js/modules/es.typed-array.to-reversed.js"),iw=require("core-js/modules/es.typed-array.to-sorted.js"),sw=require("core-js/modules/es.typed-array.with.js"),ow=require("core-js/modules/es.array-buffer.constructor.js"),nw=require("core-js/modules/es.array-buffer.slice.js"),rw=require("core-js/modules/es.array-buffer.detached.js"),aw=require("core-js/modules/es.array-buffer.transfer.js"),hw=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),cw=require("core-js/modules/es.array.push.js"),lw=require("core-js/modules/es.typed-array.uint16-array.js"),L=require("three"),Zt=class extends L.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 L.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)}}})}};Zt.prototype.setMatrixWorld=function(a){this.matrixWorld=a};Zt.prototype.setGeometry=function(a,t){this._geometry=a,this.setPoints(a.getAttribute("position").array,t)};Zt.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 L.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 Vh(a,t){var e=new L.Matrix4,i=new L.Ray,s=new L.Sphere,o=new L.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 L.Vector3,h=new L.Vector3,c=new L.Vector3,l=this instanceof L.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,v=0,w=u.length-1;v<w;v+=l){var M=u[v],P=u[v+1];r.fromArray(m,M*3),h.fromArray(m,P*3);var C=g[Math.floor(v/3)]!==void 0?g[Math.floor(v/3)]:1,S=a.params.Line.threshold+this.material.lineWidth*C/2,G=S*S,E=i.distanceSqToSegment(r,h,o,c);if(!(E>G)){o.applyMatrix4(this.matrixWorld);var nt=a.ray.origin.distanceTo(o);nt<a.near||nt>a.far||(t.push({distance:nt,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}),v=w)}}}}Zt.prototype.raycast=Vh;Zt.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]};Zt.prototype.copyV3=function(a){var t=a*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Zt.prototype.getDistance=function(a){let t=0;for(let e=0;e<a;e++){let i=6*e,s=new L.Vector3(this.positions[i],this.positions[i+1],this.positions[i+2]),o=new L.Vector3(this.positions[i+6],this.positions[i+7],this.positions[i+8]),n=s.distanceTo(o);t+=n}return t};Zt.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 L.BufferAttribute(new Float32Array(this.positions),3),previous:new L.BufferAttribute(new Float32Array(this.previous),3),next:new L.BufferAttribute(new Float32Array(this.next),3),side:new L.BufferAttribute(new Float32Array(this.side),1),width:new L.BufferAttribute(new Float32Array(this.width),1),uv:new L.BufferAttribute(new Float32Array(this.uvs),2),index:new L.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new L.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 ln(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}Zt.prototype.advance=function(a){var t=this._attributes.position.array,e=this._attributes.previous.array,i=this._attributes.next.array,s=t.length;ln(t,0,e,0,s),ln(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,ln(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};L.ShaderChunk.meshline_vert=["",L.ShaderChunk.logdepthbuf_pars_vertex,L.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;","",L.ShaderChunk.logdepthbuf_vertex,L.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",L.ShaderChunk.fog_vertex,"}"].join(`
|
|
502
502
|
`);L.ShaderChunk.meshline_frag=["",L.ShaderChunk.fog_pars_fragment,L.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;"," }",L.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);","",L.ShaderChunk.fog_fragment,"}"].join(`
|
|
503
503
|
`);var us=class extends L.ShaderMaterial{constructor(t){super({uniforms:Object.assign({},L.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new L.Color(16777215)},opacity:{value:1},resolution:{value:new L.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 L.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:L.ShaderChunk.meshline_vert,fragmentShader:L.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)}};us.prototype.copy=function(a){return L.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 la={texture_url:Os,lineWidth:10,color:16777215},Qs=class extends ut.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 D(new ut.Vector3(h,c,0),e,i,s)}).map(r=>{let{x:h,y:c}=r;return[h,c]});return Et(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new ut.Vector2(t,1)}loadTexture(t){return new Promise((e,i)=>{new ut.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 Zt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=ut.RepeatWrapping}let i=this.material=new us({useMap:!0,color:new ut.Color(this.config.color),transparent:!0,resolution:new ut.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:ut.NormalBlending,repeat:new ut.Vector2(this.getRepeat(),1)}),s=this.mesh=new ut.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=la,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({},la,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var fi=require("@tweenjs/tween.js"),At=require("three");var ww=require("core-js/modules/es.array.unshift.js"),Mw=require("core-js/modules/web.dom-collections.iterator.js"),_w=require("core-js/modules/es.array.push.js"),pa=require("three");var da=require("@tweenjs/tween.js"),ua=require("lodash"),mi=require("@turf/turf");var Kh={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1,destinationDistanceThreshold:10},to=class extends st{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 v=ce(i,s);h=h.slice(v+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((v,w,M)=>{if(w.floor!==t)return v;let{distance:P,closestPoint:C,index:S}=w.points.reduce((G,E,nt,Tt)=>{if(!Tt[nt+1])return x({},G,{distance:G.distance===1/0?O(E,e):G.distance});let{distance:gt,closestPoint:It}=ko(e,E,Tt[nt+1]);if(!this.navigation.options.canBack&&c===t){let kt=[e,...Tt.slice(nt+1)],ne=Et(kt);if(l-ne>10)return G}return gt<G.distance?{distance:gt,closestPoint:It,index:nt}:G},{distance:1/0,closestPoint:w.points[0],index:0});return P<v.distance?{distance:P,closestPoint:C,index:M,i:S}:v},{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,ua.throttle)(c=>{let l=Ze(s,c.distance);l&&(e.push({floor:t.floor,pos:l}),this.toPosition(t.floor,l))},100),h=this.simulationTween=new da.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 Et(s)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:i}=this;if(!t.length)return 0;let s=[...t.slice(0,e+1),i];return Et(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],v=i[n+1],w=i[n+2];if(!g||!v)r=de.END;else if(c+=O(g,v),!w)r=de.END;else{r=Es(g,v,w),l=We(g,v,w),p=(new pa.Vector2(w[0]-v[0],w[1]-v[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=O(s,i[n]));let u=Ls(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 j,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({},Kh,e),this.roadData=i,this.registryEvent()}};var Ew=require("core-js/modules/es.typed-array.uint8-array.js"),Lw=require("core-js/modules/es.typed-array.at.js"),Cw=require("core-js/modules/es.typed-array.fill.js"),Tw=require("core-js/modules/es.typed-array.find-last.js"),kw=require("core-js/modules/es.typed-array.find-last-index.js"),Dw=require("core-js/modules/es.typed-array.set.js"),Aw=require("core-js/modules/es.typed-array.sort.js"),Ow=require("core-js/modules/es.typed-array.to-reversed.js"),Iw=require("core-js/modules/es.typed-array.to-sorted.js"),Rw=require("core-js/modules/es.typed-array.with.js"),Gw=require("core-js/modules/es.array-buffer.constructor.js"),Fw=require("core-js/modules/es.array-buffer.slice.js"),zw=require("core-js/modules/es.array-buffer.detached.js"),Bw=require("core-js/modules/es.array-buffer.transfer.js"),Ww=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Uw=require("core-js/modules/es.typed-array.from.js"),Hw=require("core-js/modules/web.dom-collections.iterator.js"),Jt=require("three");var Se=class a extends tt{addDebug(){a.canvas.style.cssText=`
|
|
504
504
|
position: fixed;
|
|
@@ -698,4 +698,4 @@
|
|
|
698
698
|
float uvx = prevUv + (vUv.y + 1.0) / 2.0 * vCustomUv;
|
|
699
699
|
gl_FragColor = diffuseColor * texture2D(map, vec2(uvx, (vUv.x + 1.0) / 2.0) * repeat);
|
|
700
700
|
}
|
|
701
|
-
`};var ao=class extends mt.ShaderMaterial{constructor(t){super({type:"ArrowLineMaterial",uniforms:Object.assign({},mt.UniformsUtils.clone(mt.ShaderLib["custom-line"].uniforms),{map:{value:null}}),vertexShader:mt.ShaderLib["custom-line"].vertexShader,fragmentShader:mt.ShaderLib["custom-line"].fragmentShader,clipping:!0}),this.dashed=!1,Object.defineProperties(this,{map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},allDistance:{enumerable:!0,get:function(){return this.uniforms.allDistance.value},set:function(e){this.uniforms.allDistance.value=e}}}),this.setValues(t),this.isLineMaterial=!0}};var xa=require("three/examples/jsm/lines/LineGeometry.js"),wa=require("three/examples/jsm/lines/Line2.js");var va={texture_url:Os,lineWidth:8,color:16777215},ho=class extends ft.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,l]=r;return D(new ft.Vector3(h,c,l),e,i,s)}).map(r=>{let{x:h,y:c}=r;return[h,c]});return Et(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new ft.Vector2(t,1)}loadTexture(t){return new Promise((e,i)=>{new ft.TextureLoader().load(t,e,void 0,i)})}transformPoints(t){let e=[];for(let i=0;i<t.length;i++)e.push(...t[i]);return e}updatePoints(t){if(this.points=t,this.mesh){var e,i;this.remove(this.mesh),(e=this.material)==null||e.dispose(),(i=this.geometry)==null||i.dispose()}this.geometry=new xa.LineGeometry,this.geometry.setPositions(t.flat(2));let s=Et(t.map(r=>{let[h,c]=r;return[h,c]})),o=this.material=new ao({color:new ft.Color(this.config.color),transparent:!0,resolution:new ft.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,depthWrite:!0,linewidth:this.config.lineWidth,map:this.texture,blending:ft.NormalBlending,repeat:new ft.Vector2(this.getRepeat(),1),allDistance:s}),n=this.mesh=new wa.Line2(this.geometry,o);return n.computeLineDistances(),n.renderOrder=9,this.add(n),n}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return f(this,null,function*(){if(!this.texture){let e=this.texture=yield this.loadTexture(this.config.texture_url);e.wrapS=e.wrapT=ft.RepeatWrapping}return this.updatePoints(t)})}getBoundingBox(){return this.mesh?(this.mesh.geometry.computeBoundingBox(),new ft.Box3().copy(this.mesh.geometry.boundingBox).applyMatrix4(this.mesh.matrixWorld)):null}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=va,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({},va,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var Ma=require("@tweenjs/tween.js");var jt=require("three"),co=class extends jt.Object3D{meshSetMaterial(t){t instanceof jt.Mesh&&(t.material.emissiveIntensity=.5,t.material.shininess=0,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map,t.material.transparent=!0,t.material.depthTest=!1,t.renderOrder=1e6),t.children.forEach(i=>{this.meshSetMaterial(i)})}getBaseScale(t){let{clientSize:{height:e},camera:i}=this.bmap.context,o=(i.top-i.bottom)/i.zoom/e;return this.options.size*o/this.modelMaxLength}registryEvent(){this.bmap.context.addEventListener("update",this._update),this.bmap.context.addEventListener("control-zoom-change",this._onChangeZoom)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this._update),this.bmap.context.removeEventListener("control-zoom-change",this._onChangeZoom)}lookAtCamera(){if(this.model&&this.bmap&&this.bmap.context){let t=this.bmap.context.camera,e=new jt.Euler;e.setFromQuaternion(t.quaternion,"ZYX"),this.group.rotation.copy(e)}}setClips(t){this.clearClips(),t.length&&(this.mixer=new jt.AnimationMixer(this.model.scene),t.forEach(e=>this.mixer.clipAction(e).play()))}startClips(){var t;this.setClips(((t=this.model)==null?void 0:t.animations)||[])}clearClips(){this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.mixer.getRoot()),this.mixer=null)}dispose(){this.unRegistryEvent(),this.clearClips(),this.clear(),this.model&&I(this.model.scene),this.bmap=null}constructor(t,e,i={}){super(),this.bmap=t,this.group=new jt.Object3D,this.mixer=null,this.previewTime=0,this.modelMaxLength=0,this.options={size:40},this._update=()=>{let s=Date.now();if(!this.previewTime)this.previewTime=s;else{var o;let n=s-this.previewTime;this.previewTime=s,(o=this.mixer)==null||o.update(n/1e3)}this.lookAtCamera()},this._onChangeZoom=s=>{let{zoom:o}=s;var n;if(!this.model)return;let r=this.getBaseScale(this.model.scene);(n=this.model)==null||n.scene.scale.set(r,r,r)},this.options=x({},this.options,i),this.add(this.group),St.loadModel(e,!1).then(s=>{this.model=s;let n=new jt.Box3().setFromObject(s.scene).getSize(new jt.Vector3),r=Math.max(n.x,n.y,n.z);this.modelMaxLength=r;let h=this.getBaseScale(s.scene);s.scene.scale.set(h,h,h),this.meshSetMaterial(s.scene),this.group.add(s.scene),this.setClips(s.animations),this.group.rotation.set(Math.PI/2,Math.PI,0),this.dispatchEvent({type:"loaded"})}),this.registryEvent()}};var lo=require("three");var yn=class extends X{registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate)}pauseAnimation(){this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate)}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.movedDistance=0,this.clearTween()),this.startModel&&(this.startModel.visible=!1),this.translatePath=null}addPath(t){this.paths=t;let e=t.map(i=>x({},i,{points:this.translatePoints(i.points)}));if(this.clearTween(),this.movedDistance=0,this.bmap.currentBuildGround)this.renderPath(e);else{let i=()=>{this.bmap.removeEventListener("center-change",i),this.renderPath(e)};this.bmap.addEventListener("center-change",i)}this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,i]=this.bmap.buildingCenter;return t.map(s=>[s[0]-e,s[1]-i])}renderPath(t){return f(this,null,function*(){if(!t.length)return this.clearPath();let e=[];t.forEach((i,s,o)=>{let n=this.mulFloor.floors.find(r=>r.name===i.floor);e.push(...i.points.map(r=>{let[h,c]=r;return[h,c,n.position.z+n.groundMaxHeight]}))}),this.cPath=e,this.animationPathOptions={cPathIndex:0},this.path?this.path.updatePoints(e):(this.path=new ho(this),yield this.path.create(e),this.path.position.z=.5,this.bmap.context.scene.add(this.path)),this.startModel&&(this.startModel.position.set(e[0][0],e[0][1],e[0][2]),this.startModel.visible=!0),this.dispatchEvent({type:"render-path",path:this.path})})}catmullRomCurve3(t){return Di(t,!1,!0,.1,170,2.5)}getPathDirection(t,e){if(t.length<2)return null;let i=ce(t,e),s=t[i],o=t[i+1],n=new lo.Vector3(o[0]-s[0],o[1]-s[1],0).normalize(),r=new lo.Vector3(0,1,0).normalize(),h=n.angleTo(r),c=new lo.Vector3().crossVectors(r,n);return(Object.is(c.y,0)?-1:1)*h}startSimulation(t){return f(this,null,function*(){t===void 0&&(t=1);let{paths:e,movedDistance:i}=this;if(!e.length)return;let s=e.reduce((n,r)=>n+r.distance,0);if(!s||i>=s)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let o=s/t;return this.startModel.startClips(),new Promise(n=>{let r=this.simulationTween=new Ma.Tween({distance:this.movedDistance},this.tweenUtil.group).to({distance:s},o*1e3).onUpdate(h=>{var c;this.movedDistance=h.distance;let l=h.distance,p=0;for(let v=0;v<e.length;v++)if(e[v].distance>=l){p=v;break}else l-=e[v].distance;let d=Ze(e[p].points,l);if(d===null)return;this.currentPathPosition=d;let u=this.translatePoints([d])[0],m=this.mulFloor.floors.find(v=>v.name===e[p].floor),g=m?m.position.z+m.groundMaxHeight:(c=this.startModel)==null?void 0:c.position.z;this.startModel&&this.startModel.position.set(u[0],u[1],g)}).onComplete(()=>{if(this.tweenUtil.remove(r),this.startModel.clearClips(),this.startModel){var h,c,l,p;let d=(l=e.slice(-1)[0])==null||(c=l.points)==null||(h=c.slice(-1))==null?void 0:h[0];if(!d)return;let u=this.mulFloor.floors.find(v=>{var w;return v.name===((w=e.slice(-1)[0])==null?void 0:w.floor)});if(!u)return;let m=u?u.position.z+u.groundMaxHeight:(p=this.startModel)==null?void 0:p.position.z,g=this.translatePoints([d])[0];this.startModel.position.set(g[0],g[1],m)}n(!0)}).start()})})}setStartPoiRotate(t){if(this.startPoi){let i=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-t-i)%360}}dispose(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.startModel&&(this.bmap.context.scene.remove(this.startModel),this.startModel.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),super.dispose()}constructor(t,e,i={}){super(t),this.mulFloor=e,this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.pathTween=null,this.startPoi=null,this.movedDistance=0,this.tweenUtil=new Pe,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onUpdate=()=>{this.tweenUtil.update()},this.startModel=new co(t,br,i.startModel),this.startModel.visible=!1,this.bmap.context.scene.add(this.startModel),this.registryEvent()}};var G_=require("core-js/modules/es.array.flat.js"),F_=require("core-js/modules/es.array.unscopables.flat.js"),po=require("three");var vn=class extends X{registryEvent(){this.clickHelper.addEventListener("click",this._click)}unRegistryEvent(){this.clickHelper.removeEventListener("click",this._click)}dispose(){this.unRegistryEvent(),this.clickHelper.dispose(),this.mulFloors=null,super.dispose()}constructor(t,e){super(t),this.mulFloors=e,this._click=i=>{let{e:s}=i;if(!this.mulFloors.showStatus)return;let o=new po.Vector2,{offsetX:n,offsetY:r}=s,h=this.mulFloors.floors.map(d=>d.poiLayer2.getPoiByDeviceXy(n,r)).flat(2),{clientSize:c}=this.bmap.context;o.x=n/c.width*2-1,o.y=r/c.height*-2+1;let l=new po.Raycaster;l.setFromCamera(o,this.bmap.context.camera),l.ray.origin.sub(l.ray.direction.clone().multiplyScalar(1e4));let p=this.mulFloors.floors.map(d=>d.graphicLayer.getGraphicByRaycaster(l).graphics).flat();this.dispatchEvent({type:"select",pois:h,graphics:p})},this.clickHelper=new Oi(this.bmap.context.container),this.registryEvent()}};var K_=require("core-js/modules/es.array.find-last-index.js"),X_=require("core-js/modules/es.array.find-last.js"),Y_=require("core-js/modules/es.array.push.js");var U_=require("core-js/modules/web.dom-collections.iterator.js"),H_=require("core-js/modules/es.array.push.js"),N_=require("core-js/modules/es.array.sort.js"),yi=require("three");function tc(a){let t=a.length,e=0,i=0,s=0,o=0;a.forEach(h=>{e+=h[0],i+=h[1],s+=h[0]*h[1],o+=h[0]*h[0]});let n=(t*s-e*i)/(t*o-e*e),r=(i-n*e)/t;return{m:n,b:r}}function ec(a,t,e){let i=e[0][0],s=e.slice(-1)[0][0],o=a*i+t,n=a*s+t;return{start:[i,o],end:[s,n]}}function xs(a){if(a.length<2)return null;let t=a.filter((h,c)=>{let l=[...a];return l.splice(c,1),l.every(p=>p[0]!==h[0]&&p[1]!==h[1])});if(t.length<2)return null;let{m:e,b:i}=tc(t),{start:s,end:o}=ec(e,i,t),r=360-(new yi.Vector2().subVectors(new yi.Vector2(o[0],o[1]),new yi.Vector2(s[0],s[1])).angle()/Math.PI*180-90+360)%360;return Number.isNaN(r)?null:r}function ic(a){let t=[];for(let e=1;e<a.length;e++){let i=a[e-1],s=a[e],o=s.position[0]-i.position[0],n=s.position[1]-i.position[1],r=Math.sqrt(o**2+n**2),h=s.time-i.time;if(h>0){let c=r/h;console.log("speedDelta",i.type,s.type,uo(c),r,h),t.push(c)}else t.push(0)}return t}function sc(a,t){let e=a[0],i=a.slice(-1)[0],s=O(i.position,e.position),o=i.time-e.time;return o<100||s<3?null:s/o}function uo(a){return a*60*60}function vi(a,t,e,i){let s=(e+90)%360*(Math.PI/180),o=t*i,n=new yi.Vector2(a[0],a[1]),r=Math.cos(s),h=Math.sin(s),c=new yi.Vector2(r,h);return n.add(c.normalize().multiplyScalar(o)),[n.x,n.y]}function oc(a){let t=[...a].sort((c,l)=>c-l),e=_a(t,25),i=_a(t,75),s=i-e,o=e-1.5*s,n=i+1.5*s,r=t.filter(c=>c>=o&&c<=n);return a.filter(c=>r.includes(c))}function _a(a,t){let e=t/100*(a.length-1),i=Math.floor(e),s=Math.ceil(e);if(i===s)return a[i];let o=e-i;return a[i]*(1-o)+a[s]*o}var ws=require("lodash"),Ms=class extends st{setPathAngle(t){this.pathAngle=t,this.dispatchEvent({type:"change-compass",value:this.pathAngle}),(0,ws.isNil)(this.angle)&&(this.angle=t)}changeSpeed(){let t=this.history.filter(h=>["vision"].includes(h.type));if(t.length<2){this.speedFilter.filter(0),this.speed=0;return}let e=t[0],i=t.slice(-1)[0],s=O(i.position,e.position),o=i.time-e.time,n=o>0?s/o:0,r=this.speedFilter.filter(n);this.speed=r}changeAngle(t){t===void 0&&(t=this.visionHistory),t.length<2&&(this.angle=null);let e=xs(t.map(i=>i.position));e!==null&&this.setAngle(e)}setAngle(t,e){e===void 0&&(e=!0),this.angle=t,e&&this.dispatchEvent({type:"change-position-compass",value:t})}setPosition(t,e,i){let s={position:t,time:e,clientTime:Date.now()-i,type:"vision"};if(this._setVisionHistoryForAngle(s),(0,ws.isNil)(this.angle)||!this.speed){this.addHistory(s);return}let o=this.history.findLastIndex(r=>r.type==="vision"),n=this.history[o];if(n){if(n.time>e)return;let r=xs([this.history.slice(-1)[0].position,t]);if(r&&Math.abs(r-this.angle)<60){this.addHistory(s);return}let h=vi(t,this.speed,360-this.pathAngle,i);O(h,this.history.slice(-1)[0].position)>5?this.visionExcessesCount++:this.visionExcessesCount=0,this.visionExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21\u89C6\u89C9\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528\u89C6\u89C9\u6821\u51C6"),this.addHistory(s),this.visionExcessesCount=0)}}resetPdrPosition(){let t=this.history.findLast(e=>e.type==="vision");if(t&&this.speed){let e=vi(t.position,this.speed,360-this.pathAngle,Date.now()-t.clientTime);e&&this.history.push({position:e,time:Date.now(),clientTime:Date.now(),type:"pdr"})}}getLastVisionPdrPos(){let t=this.history.findLastIndex(i=>i.type==="vision");if(t!==-1){var e;return(e=this.history[t+1])!=null?e:this.history[t]}return null}_setVisionHistoryForAngle(t){if(!this.visionHistory.length){this.visionHistory.push(t);return}let e=xs([this.visionHistory.slice(-1)[0].position,t.position]);if(e!==null&&(this.angle&&Math.abs(this.angle-e)>60?this.angleExcessesCount++:(this.angleExcessesCount=0,this.visionHistory.push(t))),this.angleExcessesCount>3)console.warn("\u8FDE\u7EED\u4E09\u6B21\u89D2\u5EA6\u6BD4\u8F83\u6B6A\uFF0C\u91CD\u65B0\u77EB\u6B63"),this.visionHistory=[t],this.angleExcessesCount=0;else{let i=O(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position);for(;i>5&&this.visionHistory.length>15;)this.visionHistory.shift(),i=O(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position)}this.changeAngle()}addHistory(t){this.history.push(t);let e=this.history.filter(r=>r.type==="vision"),i=e.length?Date.now()-e.slice(-1)[0].clientTime:0,s=O(this.history[0].position,this.history.slice(-1)[0].position),o=i>5e3?10:3,n=i>5e3?0:5;for(i>5e3&&console.warn("\u89C6\u89C9\u7ED3\u679C\u8D85\u51FA5s\u4E0D\u53EF\u7528\uFF0C\u5168\u90E8\u6E05\u7A7A");e.length>n&&s>o;)this.history.shift(),e=this.history.filter(r=>r.type==="vision"),s=O(this.history[0].position,this.history.slice(-1)[0].position);n===0?this.changeSpeed():t.type==="vision"&&this.changeSpeed(),this.changePosition(t.type)}setBeaconPosition(t,e,i){let s=Date.now()-i,o={position:t,time:e,clientTime:s,type:"beacon"},n=this.history.findLastIndex(l=>l.type!=="pdr"),r=this.history[n];if(!r){this.addHistory(o);return}if((0,ws.isNil)(this.pathAngle)||!this.speed){this.addHistory(o);return}if(r&&r.time>e)return;let h=vi(t,this.speed,360-this.pathAngle,i);O(h,this.history.slice(-1)[0].position)>5?this.beaconExcessesCount++:this.beaconExcessesCount=0,this.beaconExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21beacon\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528beacon\u6821\u51C6"),this.addHistory(o),this.beaconExcessesCount=0)}startPositionTimer(){this.positionTimer&&this.timer.clearInterval(this.positionTimer),this.positionTimer=this.timer.setInterval(()=>{this.changePosition()},20)}stopPositionTimer(){this.positionTimer&&(this.timer.clearInterval(this.positionTimer),this.positionTimer=null)}changePosition(t){t===void 0&&(t="pdr");let e=this.getPosition(t);e.success&&(this.history.push({position:e.pos,time:Date.now(),clientTime:Date.now(),type:"pdr"}),this.speed?this.dispatchEvent({type:"change-pos",value:x({},e)}):this.dispatchEvent({type:"change-pos",value:e}))}getPosition(t){if(this.history.length===0)return{success:!1,pos:[0,0],compass:null,speed:0};let e=this.history.slice(-1)[0];if(this.history.length<2)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};if((0,ws.isNil)(this.pathAngle)||!this.speed)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};let i=e.clientTime,s=Date.now()-i;return{success:!0,pos:this.pathAngle?vi(e.position,this.speed,360-this.pathAngle,s):e.position,compass:this.pathAngle,speed:uo(this.speed)}}dispose(){this.timer.dispose()}constructor(){super(),this.history=[],this.visionHistory=[],this.speed=0,this.angle=null,this.timer=new j,this.positionTimer=null,this.speedFilter=new Ri,this.visionExcessesCount=0,this.beaconExcessesCount=0,this.angleExcessesCount=0,this.pathAngle=0,this.startPositionTimer()}};var iP=require("core-js/modules/es.json.stringify.js");var nc={};function xn(){return new Worker(new URL("./worker/recommend.worker-FFNYEN5G.js",nc.url))}var rc={placeId:0,catLotStatusApi:"https://vrapi.aibee.cn/parking/cat-lot-status"},wn=class{setRoadData(t,e){return Z(this.worker,"set_road_info",{roadData:t,facilities:e})}recommend(t){return f(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(i=>i.json()).then(i=>i.data.filter(s=>s.status===0));return Z(this.worker,"recommend",x({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=xn(),this.options=x({},rc,t)}};var uP=require("core-js/modules/es.json.stringify.js"),mP=require("core-js/modules/web.dom-collections.iterator.js"),fP=require("core-js/modules/es.array.sort.js"),gP=require("core-js/modules/es.array.push.js"),yP=require("core-js/modules/web.url-search-params.js"),vP=require("core-js/modules/web.url-search-params.delete.js"),xP=require("core-js/modules/web.url-search-params.has.js"),wP=require("core-js/modules/web.url-search-params.size.js"),MP=require("core-js/modules/es.regexp.exec.js");var hP=require("core-js/modules/es.json.stringify.js");var ac={url:"",reconnect:!0,heartBeat:2e3,heartMsg:JSON.stringify({command:"PING"}),reconnectTime:3e3,reconnectMaxCount:1e6,noMessageTime:6e3},xi=class extends st{initWebsocket(){this.ws=new WebSocket(this.options.url),this.ws.onopen=()=>{this.alive=!0,this.startHeart(),this.startOnMessageTimer(),this.stopReconnect(),this.dispatchEvent({type:"open"})},this.ws.onerror=()=>{this.alive=!1,this.ws=null,this.stopHeart(),this.stopOnMessageTimer(),this.startReconnect(),this.registryEvent()},this.ws.onclose=()=>{this.alive=!1,this.ws=null,this.stopHeart(),this.stopOnMessageTimer(),this.startReconnect()},this.ws.onmessage=t=>{this.startOnMessageTimer(),this.dispatchEvent({type:"message",message:t})}}startHeart(){this.stopHeart(),this.heartTimer=this.timer.setInterval(()=>{this.send(this.options.heartMsg)&&this.dispatchEvent({type:"send-heart"})},this.options.heartBeat)}stopHeart(){this.heartTimer&&(this.timer.clearInterval(this.heartTimer),this.heartTimer=null)}startReconnect(t){t===void 0&&(t=this.options.reconnectTime),this.stopReconnect(),this.options.reconnect&&(this.options.reconnectMaxCount--,this.options.reconnectMaxCount>=0&&(this.reconnectTimer=this.timer.setTimeout(()=>{this.initWebsocket()},t)))}stopReconnect(){this.reconnectTimer&&(this.timer.clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}startOnMessageTimer(){this.stopOnMessageTimer(),this.noMessageTimer=this.timer.setTimeout(()=>{var t;(t=this.ws)==null||t.close(),this.dispatchEvent({type:"no-message-timeout"})},this.options.noMessageTime)}stopOnMessageTimer(){this.noMessageTimer&&(this.timer.clearTimeout(this.noMessageTimer),this.noMessageTimer=null)}send(t){var e;let i=typeof t=="string"?t:JSON.stringify(t);return this.alive&&((e=this.ws)==null?void 0:e.readyState)===1?(this.ws.send(i),this.dispatchEvent({type:"send-success",msg:i}),!0):(this.dispatchEvent({type:"send-fail",msg:i}),!1)}registryEvent(){window.addEventListener("online",this.onOnline)}unRegistryEvent(){window.removeEventListener("online",this.onOnline)}close(){var t;this.unRegistryEvent(),this.options.reconnect=!1,this.alive=!1,this.stopHeart(),this.stopReconnect(),this.stopOnMessageTimer(),(t=this.ws)==null||t.close(),this.ws=null,this.dispatchEvent({type:"close"})}dispose(){this.close(),this.timer.dispose(),super.dispose()}constructor(t){super(),this.ws=null,this.alive=!1,this.timer=new j,this.heartTimer=null,this.reconnectTimer=null,this.noMessageTimer=null,this.onOnline=()=>{this.startReconnect()},this.options=x({},ac,t||{}),this.options.url&&this.initWebsocket()}};var _n=require("lodash");var Mn=a=>{let t=a.toString(2),e=""+Array(16-t.length+1).join("0")+t,i=parseInt(e.slice(0,4),2)*10,s=parseInt(e.slice(4,16),2);return[i,s]};var Pn=class extends st{initPositionWebSocket(){let t=x({},this.options.ext_position_params,{place_id:this.options.place_id,token:this.options.access_token}),e=Object.keys(t).filter(i=>!(0,_n.isNil)(t[i])).map(i=>i+"="+t[i]).join("&");this.positionWebSocket=new xi({url:this.options.wss_position_url+"?"+e}),this.positionWebSocket.addEventListener("message",i=>{let{message:s}=i,o=(()=>{try{return JSON.parse(s.data)}catch(U){return s.data}})();if(this.dispatchEvent({type:"ws-message",data:o}),o.command==="POSITION_RESULT"&&o.data.success)if(["POSITION","FLOOR","PARK_POSITION","AOA"].includes(o.data.success_type)&&this.useGpsFloorTimer&&(this.positionFloor=o.data.floor,this.timer.clearTimeout(this.useGpsFloorTimer),this.useGpsFloorTimer=null),o.data.success_type==="AOA"){let{x:U,y:H,time:et,floor:J,ts:re}=o.data,ae=this.positionFloor!==J;if(this.positionFloor=J,this.dispatchEvent({type:"ws-position",floor:J,x:U,y:H,time:et,_type:"aoa"}),this.options.upload_position){var n;(n=this.positionWebSocket)==null||n.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:U,y:H,floor:J,type:"aoa"}),serverData:JSON.stringify(o)})}if(!this.options.use_pdr){this.dispatchEvent({type:"position",floor:J,x:U,y:H,time:new Date(re).getTime()-o.lag-o.duration});return}if(this.options.type!==1){var r;if(ae){var h,c,l;(l=this.pdrPosition)==null||(c=l.pdr)==null||(h=c.particleFilter)==null||h.setPosInitFlag(!1)}(r=this.pdrPosition)==null||r.setBeaconPosition({x:U,y:H},new Date(re).getTime()-o.lag-o.duration)}else if(ae){var p;if(this.resetPdr(),(p=this.carInertialPosition)==null||p.stopPositionTimer(),this.path){let Le=this.path.findIndex(Mi=>Mi.floor===J),ye=this.path[Le];if(ye){var d;this.resetPdr(),(d=this.carInertialPosition)==null||d.setBeaconPosition(ye.points[0],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}else{var u;(u=this.carInertialPosition)==null||u.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var m;(m=this.carInertialPosition)==null||m.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var g;(g=this.carInertialPosition)==null||g.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else if(o.data.success_type==="POSITION"){let{x:U,y:H,time:et,floor:J,ts:re}=o.data,ae=this.positionFloor!==J;if(this.positionFloor=J,this.dispatchEvent({type:"ws-position",floor:J,x:U,y:H,time:et,_type:"beacon"}),console.log("positionFloor",J,ae),this.options.upload_position){var v;(v=this.positionWebSocket)==null||v.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:U,y:H,floor:J,type:"originBeacon"}),serverData:JSON.stringify(o)})}if(!this.options.use_pdr){this.dispatchEvent({type:"position",floor:J,x:U,y:H,time:new Date(re).getTime()-o.lag-o.duration});return}if(this.options.type!==1){var w;if(ae){var M,P,C;(C=this.pdrPosition)==null||(P=C.pdr)==null||(M=P.particleFilter)==null||M.setPosInitFlag(!1)}(w=this.pdrPosition)==null||w.setBeaconPosition({x:U,y:H},new Date(re).getTime()-o.lag-o.duration)}else if(ae){var S;if(this.resetPdr(),(S=this.carInertialPosition)==null||S.stopPositionTimer(),this.path){let Le=this.path.findIndex(Mi=>Mi.floor===J),ye=this.path[Le];if(ye){var G;this.resetPdr(),(G=this.carInertialPosition)==null||G.setBeaconPosition(ye.points[0],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}else{var E;(E=this.carInertialPosition)==null||E.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var nt;(nt=this.carInertialPosition)==null||nt.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var Tt;(Tt=this.carInertialPosition)==null||Tt.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else if(o.data.success_type==="PARK_POSITION"&&o.data.success){if(this.options.type===1){let{x:U,y:H,time:et,floor:J}=o.data,re=this.positionFloor!==J;if(this.positionFloor=o.data.floor,this.dispatchEvent({type:"ws-position",floor:J,x:U,y:H,time:et,_type:"vision"}),!this.options.use_pdr){this.dispatchEvent({type:"position",floor:J,x:U,y:H,time:new Date(et).getTime()});return}if(re){var gt;if(this.resetPdr(),(gt=this.carInertialPosition)==null||gt.stopPositionTimer(),this.path){let ae=this.path.findIndex(ye=>ye.floor===J),Le=this.path[ae];if(Le){var It;this.resetPdr(),(It=this.carInertialPosition)==null||It.setPosition(Le.points[0],new Date(et).getTime(),o.duration)}else{var kt;(kt=this.carInertialPosition)==null||kt.setPosition([U,H],new Date(et).getTime(),o.duration)}}else{var ne;(ne=this.carInertialPosition)==null||ne.setPosition([U,H],new Date(et).getTime(),o.duration)}}else{var Ee,ht;if((Ee=this.carInertialPosition)==null||Ee.setPosition([U,H],new Date(et).getTime(),o.duration),!((ht=this.carInertialPosition)!=null&&ht.positionTimer)){var $e;($e=this.carInertialPosition)==null||$e.startPositionTimer()}}if(this.options.upload_position){var wi;(wi=this.positionWebSocket)==null||wi.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:U,y:H,floor:J,type:"vision"}),serverData:JSON.stringify(o)})}}}else this.dispatchEvent({type:"floor",floor:o.data.floor,time:o.data.time})})}initSensorWebSocket(){let t=x({},this.options.ext_sensor_params,{token:this.options.access_token,place_id:this.options.place_id,record_sensor:1}),e=Object.keys(t).filter(i=>!(0,_n.isNil)(t[i])).map(i=>i+"="+t[i]).join("&");this.sensorWebSocket=new xi({url:this.options.wss_sensor_url+"?"+e})}initPdr(){this.options.type===1?(this.carInertialPosition=new Ms,this.carInertialPosition.addEventListener("change-pos",t=>{let{value:e}=t,{pos:i,success:s,speed:o}=e;if(s&&(this.dispatchEvent({type:"position",floor:this.positionFloor,x:i[0],y:i[1],time:Date.now(),speed:o}),this.options.upload_position)){var n;(n=this.positionWebSocket)==null||n.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:i[0],y:i[1],floor:this.positionFloor,type:"vision_pdr"})})}}),this.carInertialPosition.addEventListener("change-compass",t=>{let{value:e}=t;this.dispatchEvent({type:"compass",value:e})})):(this.pdrPosition=new vs(this.bmap,{pdr:{using_gps:this.options.use_gps},sensor:{elements:[F.COMPASS,F.ACCELERATION,F.DEVICE_MOTION].concat(this.options.use_gps?[F.GPS]:[])}}),this.requestDeviceOrientationPermission(),this.options.upload_position&&this.pdrPosition.sensor.addEventListener("sensor-data",t=>{let{data:e}=t;var i;(i=this.positionWebSocket)==null||i.send({command:"UPLOAD_SENSOR",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify(e)})}),this.pdrPosition.sensor.addEventListener("add-data-item",t=>{t.item.type==="compass"&&this.dispatchEvent({type:"compass",value:t.item.res})}),this.pdrPosition.addEventListener("position",t=>{let{x:e,y:i,_type:s}=t;if(console.log("_type",s,e,i,this.positionFloor,this.gpsFloor),s==="gps"&&!this.useGpsFloorTimer){let n=()=>{this.useGpsFloorTimer=this.timer.setTimeout(()=>{this.gpsFloor?this.positionFloor=this.gpsFloor:n()},5e3)};n()}if(this.positionFloor&&(this.dispatchEvent({type:"position",floor:this.positionFloor,x:e,y:i,time:Date.now()}),this.options.upload_position)){var o;(o=this.positionWebSocket)==null||o.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:e,y:i,floor:this.positionFloor,type:s})})}}))}setSensor(t){this.pdrPosition&&this.pdrPosition.setSensor(t)}requestDeviceOrientationPermission(){return f(this,null,function*(){if(this.pdrPosition){let t=yield this.pdrPosition.checkSensor();return t.deviceOrientation?this.pdrPosition.start():(this.dispatchEvent(x({type:"check-sensor"},t)),!t.deviceOrientation&&this.options.use_default_permission),t}else return null})}getGpsFloor(){return f(this,null,function*(){if(this.options.use_gps&&this.options.get_gps_floor_url){let t=yield fetch(this.options.get_gps_floor_url+"/"+this.options.place_id).then(e=>e.json());t.code===200&&(this.gpsFloor=t.data.gps_floor)}})}pausePdr(){if(this.options.type===1){var t;(t=this.carInertialPosition)==null||t.stopPositionTimer()}else{var e;(e=this.pdrPosition)==null||e.pause()}}continuePdr(){if(this.options.type===1)this.carInertialPosition&&(this.carInertialPosition.positionTimer||this.carInertialPosition.startPositionTimer());else{var t;(t=this.pdrPosition)==null||t.continue()}}setPathAngle(t){if(this.options.type===1){var e;(e=this.carInertialPosition)==null||e.setPathAngle(t)}}getForwardAngle(){if(this.options.type===1){var t,e;return(e=(t=this.carInertialPosition)==null?void 0:t.angle)!=null?e:null}else return null}resetPdr(){this.carInertialPosition&&(this.carInertialPosition.history=[],this.carInertialPosition.setPathAngle(0),this.carInertialPosition.speed=0),this.pdrPosition&&this.pdrPosition.pdr.particleFilter.setPosInitFlag(!1)}setPath(t){this.path=t}sendBeacon(t){var e;let i=[];if(pe)i=t.map(o=>{let[n,r]=Mn(o.major);return[o.uuid,r,o.minor,o.rssi,o.accuracy,n]}).filter(o=>o[3]!==0).sort((o,n)=>n[3]-o[3]);else{let o=t.reduce((n,r)=>{var h,c;let[l,p]=Mn(r.major),d=""+p+r.minor;return(h=n)[c=d]||(h[c]=[]),n[d].push(x({},r,{battery:l,major:p})),n},{});Object.entries(o).forEach(n=>{let[r,h]=n,{uuid:c,major:l,minor:p,accuracy:d,battery:u}=h[0];if(h.length>1){let m=h.filter(v=>v.rssi<0),g=m.reduce((v,w)=>v+w.rssi,0);i.push([c,l,p,g/m.length,d,u])}else i.push([c,l,p,h[0].rssi,d,u])})}let s={command:"POSITION",index:this.uploadIndex++,ts:Date.now(),beacons:JSON.stringify([{type:"ibeacon",timestamp:Date.now()/1e3,res:i}]),ext_sensors:JSON.stringify({})};(e=this.sensorWebSocket)==null||e.send(s)}dispose(){var t,e,i,s;this.timer.dispose(),(t=this.positionWebSocket)==null||t.dispose(),this.positionWebSocket=null,(e=this.sensorWebSocket)==null||e.dispose(),this.sensorWebSocket=null,(i=this.pdrPosition)==null||i.dispose(),this.pdrPosition=null,(s=this.carInertialPosition)==null||s.dispose(),this.carInertialPosition=null,super.dispose()}constructor(t,e){super(),this.bmap=t,this.positionWebSocket=null,this.sensorWebSocket=null,this.pdrPosition=null,this.carInertialPosition=null,this.gpsFloor="",this.positionFloor="",this.useGpsFloorTimer=null,this.uploadIndex=0,this.path=null,this.timer=new j;let i=new URLSearchParams(location.search),s=i.get("server_env")||"prod",o={test:"nav-test.aibee.cn",prod:"nav.aibee.cn"},n="wss://"+o[s]+"/aether-walker/indoor/position",r="wss://"+o[s]+"/aether-walker/indoor/sensor";this.options=x({place_id:i.get("place_id"),access_token:i.get("access_token"),env:s,wss_position_url:n,wss_sensor_url:r,get_gps_floor_url:"https://"+o[s]+"/aether-walker/indoor/conf",use_sensor:!1,type:-1,use_gps:!0,use_pdr:!0,upload_position:!0,use_default_permission:!0,ext_position_params:{},ext_sensor_params:{}},e),this.initPositionWebSocket(),this.options.use_sensor&&this.initSensorWebSocket(),this.options.use_pdr&&this.initPdr(),this.options.use_gps&&this.getGpsFloor()}};var kP=require("core-js/modules/web.dom-collections.iterator.js");var bn=class extends X{showMyPosition(t,e){var i;let s=(i=this.bmap.context.currentFloor)==null?void 0:i.getGraphicPosition(t);if(s){let o=new Ke(this.bmap.context,{autoUpdate:!0,appendToBody:!1});o.div.appendChild(e),o.position.copy(this.bmap.mercatorToWorld(s)),this.myPositionOverlay=o,console.log("graphicPos",s,this)}else console.warn("[showMyPosition] \u6CA1\u6709\u627E\u5230\u56FE\u5143\u6240\u5728\u7684\u4F4D\u7F6E")}hideMyPosition(){this.myPositionOverlay&&(this.myPositionOverlay.dispose(),this.myPositionOverlay=null)}dispose(){this.hideMyPosition()}constructor(...t){super(...t),this.myPositionOverlay=null}};var Sn=class extends X{highlightPoi(t,e){e===void 0&&(e={icon_size:[40,40],collision_enable:!1}),t.map(s=>this.bmap.getPoiById(s)).filter(s=>!!s).forEach(s=>{var o;(o=s.userData).restore||(o.restore={});for(let h in e)if(h in s.options){var n,r;(n=s.userData.restore)[r=h]||(n[r]=s.options[h]),s.options[h]=e[h]}})}restorePoi(t){t.map(i=>this.bmap.getPoiById(i)).filter(i=>!!i).forEach(i=>{console.log("poi.userData.restore",i.userData.restore);for(let s in i.userData.restore)s in i.options&&(i.options[s]=i.userData.restore[s]);i.userData.restore={}})}};var GP=require("core-js/modules/web.dom-collections.iterator.js"),FP=require("core-js/modules/es.array.sort.js");var En=class extends X{sortByDistance(t,e,i){return f(this,null,function*(){i===void 0&&(i=!1);let s=[...e];if(i||e.length<20)return yield Promise.all(s.map(o=>f(this,null,function*(){o.distance=yield this._getDistance(t,{floor:o.floor,x:o.center_x,y:o.center_y})}))),s.sort((o,n)=>o.distance-n.distance);{let o=s.sort((r,h)=>{let c=Math.sqrt((r.center_x-t.x)**2+(r.center_y-t.y)**2)+(t.floor===r.floor?0:100),l=Math.sqrt((h.center_x-t.x)**2+(h.center_y-t.y)**2)+(t.floor===h.floor?0:100);return c-l});return[...(yield Promise.all(o.slice(0,20).map(r=>f(this,null,function*(){return r.distance=yield this._getDistance(t,{floor:r.floor,x:r.center_x,y:r.center_y}),r})))).sort((r,h)=>r.distance-h.distance),...o.slice(20)]}})}_getDistance(t,e){return f(this,null,function*(){return this.navPath.getPath({floor:t.floor,coord:[t.x,t.y]},{floor:e.floor,coord:[e.x,e.y]},"",0).then(i=>i.reduce((s,o,n)=>{if(s+=o.distance,n!==i.length-1)switch(o.endType){case"escalator":case"straightLadder":case"staircase":case"ramp":s+=100;break}return s},0)).catch(i=>i==="near"?0:1/0)})}dispose(){super.dispose(),this.needDisposeNavPath&&this.navPath.dispose()}constructor(t,e){if(super(t),this.needDisposeNavPath=!1,e)this.navPath=e;else{this.navPath=new fs;let i=new qe(t);this.needDisposeNavPath=!0,i.load(t.config.apiPath.loadPlaceInfo+"?place_id="+t.config.placeId+"&env=prod").then(s=>f(this,null,function*(){let[o,n]=yield Promise.all([i.getRoadNetworkData(),i.getFacilitiesData()]);this.navPath.setRoadData(o,n.infrastructures)}))}}};var hc="https://robot-vr-public.bj.bcebos.com/v1/static_resource/satellite_tiles",cc={base_url:hc},Ln=class extends X{setVisible(t){this.tileLayer.setVisibility(t)}dispose(){this.bmap.context.scene.remove(this.tileLayer),this.tileLayer.dispose(),super.dispose()}constructor(t,e){super(t),this.options=x({},cc,e),this.tileLayer=new Re(t.context,this.options),this.tileLayer.position.z=-1,this.bmap.context.scene.add(this.tileLayer)}};var mo=require("three");var Cn=class extends X{addHeatmap(t,e){this.heatmap||(this.heatmap=new Yi(this.bmap.context),this.group.add(this.heatmap)),this.heatmap.loadData(t);let i=new mo.Box3().setFromObject(e.graphicLayer);return this.heatmap.position.setZ(i.max.z+.1),this.heatmap}removeHeatMap(){this.heatmap&&(this.group.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=null)}dispose(){this.removeHeatMap(),this.bmap.context.scene.remove(this.group)}constructor(t){super(t),this.heatmap=null,this.group=new mo.Group,this.bmap.context.scene.add(this.group)}};
|
|
701
|
+
`};var ao=class extends mt.ShaderMaterial{constructor(t){super({type:"ArrowLineMaterial",uniforms:Object.assign({},mt.UniformsUtils.clone(mt.ShaderLib["custom-line"].uniforms),{map:{value:null}}),vertexShader:mt.ShaderLib["custom-line"].vertexShader,fragmentShader:mt.ShaderLib["custom-line"].fragmentShader,clipping:!0}),this.dashed=!1,Object.defineProperties(this,{map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},allDistance:{enumerable:!0,get:function(){return this.uniforms.allDistance.value},set:function(e){this.uniforms.allDistance.value=e}}}),this.setValues(t),this.isLineMaterial=!0}};var xa=require("three/examples/jsm/lines/LineGeometry.js"),wa=require("three/examples/jsm/lines/Line2.js");var va={texture_url:Os,lineWidth:8,color:16777215},ho=class extends ft.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,l]=r;return D(new ft.Vector3(h,c,l),e,i,s)}).map(r=>{let{x:h,y:c}=r;return[h,c]});return Et(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new ft.Vector2(t,1)}loadTexture(t){return new Promise((e,i)=>{new ft.TextureLoader().load(t,e,void 0,i)})}transformPoints(t){let e=[];for(let i=0;i<t.length;i++)e.push(...t[i]);return e}updatePoints(t){if(this.points=t,this.mesh){var e,i;this.remove(this.mesh),(e=this.material)==null||e.dispose(),(i=this.geometry)==null||i.dispose()}this.geometry=new xa.LineGeometry,this.geometry.setPositions(t.flat(2));let s=Et(t.map(r=>{let[h,c]=r;return[h,c]})),o=this.material=new ao({color:new ft.Color(this.config.color),transparent:!0,resolution:new ft.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,depthWrite:!0,linewidth:this.config.lineWidth,map:this.texture,blending:ft.NormalBlending,repeat:new ft.Vector2(this.getRepeat(),1),allDistance:s}),n=this.mesh=new wa.Line2(this.geometry,o);return n.computeLineDistances(),n.renderOrder=9,this.add(n),n}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return f(this,null,function*(){if(!this.texture){let e=this.texture=yield this.loadTexture(this.config.texture_url);e.wrapS=e.wrapT=ft.RepeatWrapping}return this.updatePoints(t)})}getBoundingBox(){return this.mesh?(this.mesh.geometry.computeBoundingBox(),new ft.Box3().copy(this.mesh.geometry.boundingBox).applyMatrix4(this.mesh.matrixWorld)):null}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=va,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({},va,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var Ma=require("@tweenjs/tween.js");var jt=require("three"),co=class extends jt.Object3D{meshSetMaterial(t){t instanceof jt.Mesh&&(t.material.emissiveIntensity=.5,t.material.shininess=0,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map,t.material.transparent=!0,t.material.depthTest=!1,t.renderOrder=1e6),t.children.forEach(i=>{this.meshSetMaterial(i)})}getBaseScale(t){let{clientSize:{height:e},camera:i}=this.bmap.context,o=(i.top-i.bottom)/i.zoom/e;return this.options.size*o/this.modelMaxLength}registryEvent(){this.bmap.context.addEventListener("update",this._update),this.bmap.context.addEventListener("control-zoom-change",this._onChangeZoom)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this._update),this.bmap.context.removeEventListener("control-zoom-change",this._onChangeZoom)}lookAtCamera(){if(this.model&&this.bmap&&this.bmap.context){let t=this.bmap.context.camera,e=new jt.Euler;e.setFromQuaternion(t.quaternion,"ZYX"),this.group.rotation.copy(e)}}setClips(t){this.clearClips(),t.length&&(this.mixer=new jt.AnimationMixer(this.model.scene),t.forEach(e=>this.mixer.clipAction(e).play()))}startClips(){var t;this.setClips(((t=this.model)==null?void 0:t.animations)||[])}clearClips(){this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.mixer.getRoot()),this.mixer=null)}dispose(){this.unRegistryEvent(),this.clearClips(),this.clear(),this.model&&I(this.model.scene),this.bmap=null}constructor(t,e,i={}){super(),this.bmap=t,this.group=new jt.Object3D,this.mixer=null,this.previewTime=0,this.modelMaxLength=0,this.options={size:40},this._update=()=>{let s=Date.now();if(!this.previewTime)this.previewTime=s;else{var o;let n=s-this.previewTime;this.previewTime=s,(o=this.mixer)==null||o.update(n/1e3)}this.lookAtCamera()},this._onChangeZoom=s=>{let{zoom:o}=s;var n;if(!this.model)return;let r=this.getBaseScale(this.model.scene);(n=this.model)==null||n.scene.scale.set(r,r,r)},this.options=x({},this.options,i),this.add(this.group),St.loadModel(e,!1).then(s=>{this.model=s;let n=new jt.Box3().setFromObject(s.scene).getSize(new jt.Vector3),r=Math.max(n.x,n.y,n.z);this.modelMaxLength=r;let h=this.getBaseScale(s.scene);s.scene.scale.set(h,h,h),this.meshSetMaterial(s.scene),this.group.add(s.scene),this.setClips(s.animations),this.group.rotation.set(Math.PI/2,Math.PI,0),this.dispatchEvent({type:"loaded"})}),this.registryEvent()}};var lo=require("three");var yn=class extends X{registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate)}pauseAnimation(){this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate)}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.movedDistance=0,this.clearTween()),this.startModel&&(this.startModel.visible=!1),this.translatePath=null}addPath(t){this.paths=t;let e=t.map(i=>x({},i,{points:this.translatePoints(i.points)}));if(this.clearTween(),this.movedDistance=0,this.bmap.currentBuildGround)this.renderPath(e);else{let i=()=>{this.bmap.removeEventListener("center-change",i),this.renderPath(e)};this.bmap.addEventListener("center-change",i)}this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,i]=this.bmap.buildingCenter;return t.map(s=>[s[0]-e,s[1]-i])}renderPath(t){return f(this,null,function*(){if(!t.length)return this.clearPath();let e=[];t.forEach((i,s,o)=>{let n=this.mulFloor.floors.find(r=>r.name===i.floor);e.push(...i.points.map(r=>{let[h,c]=r;return[h,c,n.position.z+n.groundMaxHeight]}))}),this.cPath=e,this.animationPathOptions={cPathIndex:0},this.path?this.path.updatePoints(e):(this.path=new ho(this),yield this.path.create(e),this.path.position.z=.5,this.bmap.context.scene.add(this.path)),this.startModel&&(this.startModel.position.set(e[0][0],e[0][1],e[0][2]),this.startModel.visible=!0),this.dispatchEvent({type:"render-path",path:this.path})})}catmullRomCurve3(t){return Di(t,!1,!0,.1,170,2.5)}getPathDirection(t,e){if(t.length<2)return null;let i=ce(t,e),s=t[i],o=t[i+1],n=new lo.Vector3(o[0]-s[0],o[1]-s[1],0).normalize(),r=new lo.Vector3(0,1,0).normalize(),h=n.angleTo(r),c=new lo.Vector3().crossVectors(r,n);return(Object.is(c.y,0)?-1:1)*h}startSimulation(t){return f(this,null,function*(){t===void 0&&(t=1);let{paths:e,movedDistance:i}=this;if(!e.length)return;let s=e.reduce((n,r)=>n+r.distance,0);if(!s||i>=s)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let o=s/t;return this.startModel.startClips(),new Promise(n=>{let r=this.simulationTween=new Ma.Tween({distance:this.movedDistance},this.tweenUtil.group).to({distance:s},o*1e3).onUpdate(h=>{var c;this.movedDistance=h.distance;let l=h.distance,p=0;for(let v=0;v<e.length;v++)if(e[v].distance>=l){p=v;break}else l-=e[v].distance;let d=Ze(e[p].points,l);if(d===null)return;this.currentPathPosition=d;let u=this.translatePoints([d])[0],m=this.mulFloor.floors.find(v=>v.name===e[p].floor),g=m?m.position.z+m.groundMaxHeight:(c=this.startModel)==null?void 0:c.position.z;this.startModel&&this.startModel.position.set(u[0],u[1],g)}).onComplete(()=>{if(this.tweenUtil.remove(r),this.startModel.clearClips(),this.startModel){var h,c,l,p;let d=(l=e.slice(-1)[0])==null||(c=l.points)==null||(h=c.slice(-1))==null?void 0:h[0];if(!d)return;let u=this.mulFloor.floors.find(v=>{var w;return v.name===((w=e.slice(-1)[0])==null?void 0:w.floor)});if(!u)return;let m=u?u.position.z+u.groundMaxHeight:(p=this.startModel)==null?void 0:p.position.z,g=this.translatePoints([d])[0];this.startModel.position.set(g[0],g[1],m)}n(!0)}).start()})})}setStartPoiRotate(t){if(this.startPoi){let i=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-t-i)%360}}dispose(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.startModel&&(this.bmap.context.scene.remove(this.startModel),this.startModel.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),super.dispose()}constructor(t,e,i={}){super(t),this.mulFloor=e,this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.pathTween=null,this.startPoi=null,this.movedDistance=0,this.tweenUtil=new Pe,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onUpdate=()=>{this.tweenUtil.update()},this.startModel=new co(t,br,i.startModel),this.startModel.visible=!1,this.bmap.context.scene.add(this.startModel),this.registryEvent()}};var G_=require("core-js/modules/es.array.flat.js"),F_=require("core-js/modules/es.array.unscopables.flat.js"),po=require("three");var vn=class extends X{registryEvent(){this.clickHelper.addEventListener("click",this._click)}unRegistryEvent(){this.clickHelper.removeEventListener("click",this._click)}dispose(){this.unRegistryEvent(),this.clickHelper.dispose(),this.mulFloors=null,super.dispose()}constructor(t,e){super(t),this.mulFloors=e,this._click=i=>{let{e:s}=i;if(!this.mulFloors.showStatus)return;let o=new po.Vector2,{offsetX:n,offsetY:r}=s,h=this.mulFloors.floors.map(d=>d.poiLayer2.getPoiByDeviceXy(n,r)).flat(2),{clientSize:c}=this.bmap.context;o.x=n/c.width*2-1,o.y=r/c.height*-2+1;let l=new po.Raycaster;l.setFromCamera(o,this.bmap.context.camera),l.ray.origin.sub(l.ray.direction.clone().multiplyScalar(1e4));let p=this.mulFloors.floors.map(d=>d.graphicLayer.getGraphicByRaycaster(l).graphics).flat();this.dispatchEvent({type:"select",pois:h,graphics:p})},this.clickHelper=new Oi(this.bmap.context.container),this.registryEvent()}};var K_=require("core-js/modules/es.array.find-last-index.js"),X_=require("core-js/modules/es.array.find-last.js"),Y_=require("core-js/modules/es.array.push.js");var U_=require("core-js/modules/web.dom-collections.iterator.js"),H_=require("core-js/modules/es.array.push.js"),N_=require("core-js/modules/es.array.sort.js"),yi=require("three");function tc(a){let t=a.length,e=0,i=0,s=0,o=0;a.forEach(h=>{e+=h[0],i+=h[1],s+=h[0]*h[1],o+=h[0]*h[0]});let n=(t*s-e*i)/(t*o-e*e),r=(i-n*e)/t;return{m:n,b:r}}function ec(a,t,e){let i=e[0][0],s=e.slice(-1)[0][0],o=a*i+t,n=a*s+t;return{start:[i,o],end:[s,n]}}function xs(a){if(a.length<2)return null;let t=a.filter((h,c)=>{let l=[...a];return l.splice(c,1),l.every(p=>p[0]!==h[0]&&p[1]!==h[1])});if(t.length<2)return null;let{m:e,b:i}=tc(t),{start:s,end:o}=ec(e,i,t),r=360-(new yi.Vector2().subVectors(new yi.Vector2(o[0],o[1]),new yi.Vector2(s[0],s[1])).angle()/Math.PI*180-90+360)%360;return Number.isNaN(r)?null:r}function ic(a){let t=[];for(let e=1;e<a.length;e++){let i=a[e-1],s=a[e],o=s.position[0]-i.position[0],n=s.position[1]-i.position[1],r=Math.sqrt(o**2+n**2),h=s.time-i.time;if(h>0){let c=r/h;console.log("speedDelta",i.type,s.type,uo(c),r,h),t.push(c)}else t.push(0)}return t}function sc(a,t){let e=a[0],i=a.slice(-1)[0],s=O(i.position,e.position),o=i.time-e.time;return o<100||s<3?null:s/o}function uo(a){return a*60*60}function vi(a,t,e,i){let s=(e+90)%360*(Math.PI/180),o=t*i,n=new yi.Vector2(a[0],a[1]),r=Math.cos(s),h=Math.sin(s),c=new yi.Vector2(r,h);return n.add(c.normalize().multiplyScalar(o)),[n.x,n.y]}function oc(a){let t=[...a].sort((c,l)=>c-l),e=_a(t,25),i=_a(t,75),s=i-e,o=e-1.5*s,n=i+1.5*s,r=t.filter(c=>c>=o&&c<=n);return a.filter(c=>r.includes(c))}function _a(a,t){let e=t/100*(a.length-1),i=Math.floor(e),s=Math.ceil(e);if(i===s)return a[i];let o=e-i;return a[i]*(1-o)+a[s]*o}var ws=require("lodash"),Ms=class extends st{setPathAngle(t){this.pathAngle=t,this.dispatchEvent({type:"change-compass",value:this.pathAngle}),(0,ws.isNil)(this.angle)&&(this.angle=t)}changeSpeed(){let t=this.history.filter(h=>["vision"].includes(h.type));if(t.length<2){this.speedFilter.filter(0),this.speed=0;return}let e=t[0],i=t.slice(-1)[0],s=O(i.position,e.position),o=i.time-e.time,n=o>0?s/o:0,r=this.speedFilter.filter(n);this.speed=r}changeAngle(t){t===void 0&&(t=this.visionHistory),t.length<2&&(this.angle=null);let e=xs(t.map(i=>i.position));e!==null&&this.setAngle(e)}setAngle(t,e){e===void 0&&(e=!0),this.angle=t,e&&this.dispatchEvent({type:"change-position-compass",value:t})}setPosition(t,e,i){let s={position:t,time:e,clientTime:Date.now()-i,type:"vision"};if(this._setVisionHistoryForAngle(s),(0,ws.isNil)(this.angle)||!this.speed){this.addHistory(s);return}let o=this.history.findLastIndex(r=>r.type==="vision"),n=this.history[o];if(n){if(n.time>e)return;let r=xs([this.history.slice(-1)[0].position,t]);if(r&&Math.abs(r-this.angle)<60){this.addHistory(s);return}let h=vi(t,this.speed,360-this.pathAngle,i);O(h,this.history.slice(-1)[0].position)>5?this.visionExcessesCount++:this.visionExcessesCount=0,this.visionExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21\u89C6\u89C9\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528\u89C6\u89C9\u6821\u51C6"),this.addHistory(s),this.visionExcessesCount=0)}}resetPdrPosition(){let t=this.history.findLast(e=>e.type==="vision");if(t&&this.speed){let e=vi(t.position,this.speed,360-this.pathAngle,Date.now()-t.clientTime);e&&this.history.push({position:e,time:Date.now(),clientTime:Date.now(),type:"pdr"})}}getLastVisionPdrPos(){let t=this.history.findLastIndex(i=>i.type==="vision");if(t!==-1){var e;return(e=this.history[t+1])!=null?e:this.history[t]}return null}_setVisionHistoryForAngle(t){if(!this.visionHistory.length){this.visionHistory.push(t);return}let e=xs([this.visionHistory.slice(-1)[0].position,t.position]);if(e!==null&&(this.angle&&Math.abs(this.angle-e)>60?this.angleExcessesCount++:(this.angleExcessesCount=0,this.visionHistory.push(t))),this.angleExcessesCount>3)console.warn("\u8FDE\u7EED\u4E09\u6B21\u89D2\u5EA6\u6BD4\u8F83\u6B6A\uFF0C\u91CD\u65B0\u77EB\u6B63"),this.visionHistory=[t],this.angleExcessesCount=0;else{let i=O(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position);for(;i>5&&this.visionHistory.length>15;)this.visionHistory.shift(),i=O(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position)}this.changeAngle()}addHistory(t){this.history.push(t);let e=this.history.filter(r=>r.type==="vision"),i=e.length?Date.now()-e.slice(-1)[0].clientTime:0,s=O(this.history[0].position,this.history.slice(-1)[0].position),o=i>5e3?10:3,n=i>5e3?0:5;for(i>5e3&&console.warn("\u89C6\u89C9\u7ED3\u679C\u8D85\u51FA5s\u4E0D\u53EF\u7528\uFF0C\u5168\u90E8\u6E05\u7A7A");e.length>n&&s>o;)this.history.shift(),e=this.history.filter(r=>r.type==="vision"),s=O(this.history[0].position,this.history.slice(-1)[0].position);n===0?this.changeSpeed():t.type==="vision"&&this.changeSpeed(),this.changePosition(t.type)}setBeaconPosition(t,e,i){let s=Date.now()-i,o={position:t,time:e,clientTime:s,type:"beacon"},n=this.history.findLastIndex(l=>l.type!=="pdr"),r=this.history[n];if(!r){this.addHistory(o);return}if((0,ws.isNil)(this.pathAngle)||!this.speed){this.addHistory(o);return}if(r&&r.time>e)return;let h=vi(t,this.speed,360-this.pathAngle,i);O(h,this.history.slice(-1)[0].position)>5?this.beaconExcessesCount++:this.beaconExcessesCount=0,this.beaconExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21beacon\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528beacon\u6821\u51C6"),this.addHistory(o),this.beaconExcessesCount=0)}startPositionTimer(){this.positionTimer&&this.timer.clearInterval(this.positionTimer),this.positionTimer=this.timer.setInterval(()=>{this.changePosition()},20)}stopPositionTimer(){this.positionTimer&&(this.timer.clearInterval(this.positionTimer),this.positionTimer=null)}changePosition(t){t===void 0&&(t="pdr");let e=this.getPosition(t);e.success&&(this.history.push({position:e.pos,time:Date.now(),clientTime:Date.now(),type:"pdr"}),this.speed?this.dispatchEvent({type:"change-pos",value:x({},e)}):this.dispatchEvent({type:"change-pos",value:e}))}getPosition(t){if(this.history.length===0)return{success:!1,pos:[0,0],compass:null,speed:0};let e=this.history.slice(-1)[0];if(this.history.length<2)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};if((0,ws.isNil)(this.pathAngle)||!this.speed)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};let i=e.clientTime,s=Date.now()-i;return{success:!0,pos:this.pathAngle?vi(e.position,this.speed,360-this.pathAngle,s):e.position,compass:this.pathAngle,speed:uo(this.speed)}}dispose(){this.timer.dispose()}constructor(){super(),this.history=[],this.visionHistory=[],this.speed=0,this.angle=null,this.timer=new j,this.positionTimer=null,this.speedFilter=new Ri,this.visionExcessesCount=0,this.beaconExcessesCount=0,this.angleExcessesCount=0,this.pathAngle=0,this.startPositionTimer()}};var iP=require("core-js/modules/es.json.stringify.js");var nc={};function xn(){return new Worker(new URL("./worker/recommend.worker-FFNYEN5G.js",nc.url))}var rc={placeId:0,catLotStatusApi:"https://vrapi.aibee.cn/parking/cat-lot-status"},wn=class{setRoadData(t,e){return Z(this.worker,"set_road_info",{roadData:t,facilities:e})}recommend(t){return f(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(i=>i.json()).then(i=>i.data.filter(s=>s.status===0)).then(i=>{var s;return i.filter((s=this.options.filterCarLotStatus)!=null?s:()=>!0)});return Z(this.worker,"recommend",x({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=xn(),this.options=x({},rc,t)}};var uP=require("core-js/modules/es.json.stringify.js"),mP=require("core-js/modules/web.dom-collections.iterator.js"),fP=require("core-js/modules/es.array.sort.js"),gP=require("core-js/modules/es.array.push.js"),yP=require("core-js/modules/web.url-search-params.js"),vP=require("core-js/modules/web.url-search-params.delete.js"),xP=require("core-js/modules/web.url-search-params.has.js"),wP=require("core-js/modules/web.url-search-params.size.js"),MP=require("core-js/modules/es.regexp.exec.js");var hP=require("core-js/modules/es.json.stringify.js");var ac={url:"",reconnect:!0,heartBeat:2e3,heartMsg:JSON.stringify({command:"PING"}),reconnectTime:3e3,reconnectMaxCount:1e6,noMessageTime:6e3},xi=class extends st{initWebsocket(){this.ws=new WebSocket(this.options.url),this.ws.onopen=()=>{this.alive=!0,this.startHeart(),this.startOnMessageTimer(),this.stopReconnect(),this.dispatchEvent({type:"open"})},this.ws.onerror=()=>{this.alive=!1,this.ws=null,this.stopHeart(),this.stopOnMessageTimer(),this.startReconnect(),this.registryEvent()},this.ws.onclose=()=>{this.alive=!1,this.ws=null,this.stopHeart(),this.stopOnMessageTimer(),this.startReconnect()},this.ws.onmessage=t=>{this.startOnMessageTimer(),this.dispatchEvent({type:"message",message:t})}}startHeart(){this.stopHeart(),this.heartTimer=this.timer.setInterval(()=>{this.send(this.options.heartMsg)&&this.dispatchEvent({type:"send-heart"})},this.options.heartBeat)}stopHeart(){this.heartTimer&&(this.timer.clearInterval(this.heartTimer),this.heartTimer=null)}startReconnect(t){t===void 0&&(t=this.options.reconnectTime),this.stopReconnect(),this.options.reconnect&&(this.options.reconnectMaxCount--,this.options.reconnectMaxCount>=0&&(this.reconnectTimer=this.timer.setTimeout(()=>{this.initWebsocket()},t)))}stopReconnect(){this.reconnectTimer&&(this.timer.clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}startOnMessageTimer(){this.stopOnMessageTimer(),this.noMessageTimer=this.timer.setTimeout(()=>{var t;(t=this.ws)==null||t.close(),this.dispatchEvent({type:"no-message-timeout"})},this.options.noMessageTime)}stopOnMessageTimer(){this.noMessageTimer&&(this.timer.clearTimeout(this.noMessageTimer),this.noMessageTimer=null)}send(t){var e;let i=typeof t=="string"?t:JSON.stringify(t);return this.alive&&((e=this.ws)==null?void 0:e.readyState)===1?(this.ws.send(i),this.dispatchEvent({type:"send-success",msg:i}),!0):(this.dispatchEvent({type:"send-fail",msg:i}),!1)}registryEvent(){window.addEventListener("online",this.onOnline)}unRegistryEvent(){window.removeEventListener("online",this.onOnline)}close(){var t;this.unRegistryEvent(),this.options.reconnect=!1,this.alive=!1,this.stopHeart(),this.stopReconnect(),this.stopOnMessageTimer(),(t=this.ws)==null||t.close(),this.ws=null,this.dispatchEvent({type:"close"})}dispose(){this.close(),this.timer.dispose(),super.dispose()}constructor(t){super(),this.ws=null,this.alive=!1,this.timer=new j,this.heartTimer=null,this.reconnectTimer=null,this.noMessageTimer=null,this.onOnline=()=>{this.startReconnect()},this.options=x({},ac,t||{}),this.options.url&&this.initWebsocket()}};var _n=require("lodash");var Mn=a=>{let t=a.toString(2),e=""+Array(16-t.length+1).join("0")+t,i=parseInt(e.slice(0,4),2)*10,s=parseInt(e.slice(4,16),2);return[i,s]};var Pn=class extends st{initPositionWebSocket(){let t=x({},this.options.ext_position_params,{place_id:this.options.place_id,token:this.options.access_token}),e=Object.keys(t).filter(i=>!(0,_n.isNil)(t[i])).map(i=>i+"="+t[i]).join("&");this.positionWebSocket=new xi({url:this.options.wss_position_url+"?"+e}),this.positionWebSocket.addEventListener("message",i=>{let{message:s}=i,o=(()=>{try{return JSON.parse(s.data)}catch(U){return s.data}})();if(this.dispatchEvent({type:"ws-message",data:o}),o.command==="POSITION_RESULT"&&o.data.success)if(["POSITION","FLOOR","PARK_POSITION","AOA"].includes(o.data.success_type)&&this.useGpsFloorTimer&&(this.positionFloor=o.data.floor,this.timer.clearTimeout(this.useGpsFloorTimer),this.useGpsFloorTimer=null),o.data.success_type==="AOA"){let{x:U,y:H,time:et,floor:J,ts:re}=o.data,ae=this.positionFloor!==J;if(this.positionFloor=J,this.dispatchEvent({type:"ws-position",floor:J,x:U,y:H,time:et,_type:"aoa"}),this.options.upload_position){var n;(n=this.positionWebSocket)==null||n.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:U,y:H,floor:J,type:"aoa"}),serverData:JSON.stringify(o)})}if(!this.options.use_pdr){this.dispatchEvent({type:"position",floor:J,x:U,y:H,time:new Date(re).getTime()-o.lag-o.duration});return}if(this.options.type!==1){var r;if(ae){var h,c,l;(l=this.pdrPosition)==null||(c=l.pdr)==null||(h=c.particleFilter)==null||h.setPosInitFlag(!1)}(r=this.pdrPosition)==null||r.setBeaconPosition({x:U,y:H},new Date(re).getTime()-o.lag-o.duration)}else if(ae){var p;if(this.resetPdr(),(p=this.carInertialPosition)==null||p.stopPositionTimer(),this.path){let Le=this.path.findIndex(Mi=>Mi.floor===J),ye=this.path[Le];if(ye){var d;this.resetPdr(),(d=this.carInertialPosition)==null||d.setBeaconPosition(ye.points[0],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}else{var u;(u=this.carInertialPosition)==null||u.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var m;(m=this.carInertialPosition)==null||m.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var g;(g=this.carInertialPosition)==null||g.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else if(o.data.success_type==="POSITION"){let{x:U,y:H,time:et,floor:J,ts:re}=o.data,ae=this.positionFloor!==J;if(this.positionFloor=J,this.dispatchEvent({type:"ws-position",floor:J,x:U,y:H,time:et,_type:"beacon"}),console.log("positionFloor",J,ae),this.options.upload_position){var v;(v=this.positionWebSocket)==null||v.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:U,y:H,floor:J,type:"originBeacon"}),serverData:JSON.stringify(o)})}if(!this.options.use_pdr){this.dispatchEvent({type:"position",floor:J,x:U,y:H,time:new Date(re).getTime()-o.lag-o.duration});return}if(this.options.type!==1){var w;if(ae){var M,P,C;(C=this.pdrPosition)==null||(P=C.pdr)==null||(M=P.particleFilter)==null||M.setPosInitFlag(!1)}(w=this.pdrPosition)==null||w.setBeaconPosition({x:U,y:H},new Date(re).getTime()-o.lag-o.duration)}else if(ae){var S;if(this.resetPdr(),(S=this.carInertialPosition)==null||S.stopPositionTimer(),this.path){let Le=this.path.findIndex(Mi=>Mi.floor===J),ye=this.path[Le];if(ye){var G;this.resetPdr(),(G=this.carInertialPosition)==null||G.setBeaconPosition(ye.points[0],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}else{var E;(E=this.carInertialPosition)==null||E.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var nt;(nt=this.carInertialPosition)==null||nt.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var Tt;(Tt=this.carInertialPosition)==null||Tt.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else if(o.data.success_type==="PARK_POSITION"&&o.data.success){if(this.options.type===1){let{x:U,y:H,time:et,floor:J}=o.data,re=this.positionFloor!==J;if(this.positionFloor=o.data.floor,this.dispatchEvent({type:"ws-position",floor:J,x:U,y:H,time:et,_type:"vision"}),!this.options.use_pdr){this.dispatchEvent({type:"position",floor:J,x:U,y:H,time:new Date(et).getTime()});return}if(re){var gt;if(this.resetPdr(),(gt=this.carInertialPosition)==null||gt.stopPositionTimer(),this.path){let ae=this.path.findIndex(ye=>ye.floor===J),Le=this.path[ae];if(Le){var It;this.resetPdr(),(It=this.carInertialPosition)==null||It.setPosition(Le.points[0],new Date(et).getTime(),o.duration)}else{var kt;(kt=this.carInertialPosition)==null||kt.setPosition([U,H],new Date(et).getTime(),o.duration)}}else{var ne;(ne=this.carInertialPosition)==null||ne.setPosition([U,H],new Date(et).getTime(),o.duration)}}else{var Ee,ht;if((Ee=this.carInertialPosition)==null||Ee.setPosition([U,H],new Date(et).getTime(),o.duration),!((ht=this.carInertialPosition)!=null&&ht.positionTimer)){var $e;($e=this.carInertialPosition)==null||$e.startPositionTimer()}}if(this.options.upload_position){var wi;(wi=this.positionWebSocket)==null||wi.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:U,y:H,floor:J,type:"vision"}),serverData:JSON.stringify(o)})}}}else this.dispatchEvent({type:"floor",floor:o.data.floor,time:o.data.time})})}initSensorWebSocket(){let t=x({},this.options.ext_sensor_params,{token:this.options.access_token,place_id:this.options.place_id,record_sensor:1}),e=Object.keys(t).filter(i=>!(0,_n.isNil)(t[i])).map(i=>i+"="+t[i]).join("&");this.sensorWebSocket=new xi({url:this.options.wss_sensor_url+"?"+e})}initPdr(){this.options.type===1?(this.carInertialPosition=new Ms,this.carInertialPosition.addEventListener("change-pos",t=>{let{value:e}=t,{pos:i,success:s,speed:o}=e;if(s&&(this.dispatchEvent({type:"position",floor:this.positionFloor,x:i[0],y:i[1],time:Date.now(),speed:o}),this.options.upload_position)){var n;(n=this.positionWebSocket)==null||n.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:i[0],y:i[1],floor:this.positionFloor,type:"vision_pdr"})})}}),this.carInertialPosition.addEventListener("change-compass",t=>{let{value:e}=t;this.dispatchEvent({type:"compass",value:e})})):(this.pdrPosition=new vs(this.bmap,{pdr:{using_gps:this.options.use_gps},sensor:{elements:[F.COMPASS,F.ACCELERATION,F.DEVICE_MOTION].concat(this.options.use_gps?[F.GPS]:[])}}),this.requestDeviceOrientationPermission(),this.options.upload_position&&this.pdrPosition.sensor.addEventListener("sensor-data",t=>{let{data:e}=t;var i;(i=this.positionWebSocket)==null||i.send({command:"UPLOAD_SENSOR",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify(e)})}),this.pdrPosition.sensor.addEventListener("add-data-item",t=>{t.item.type==="compass"&&this.dispatchEvent({type:"compass",value:t.item.res})}),this.pdrPosition.addEventListener("position",t=>{let{x:e,y:i,_type:s}=t;if(console.log("_type",s,e,i,this.positionFloor,this.gpsFloor),s==="gps"&&!this.useGpsFloorTimer){let n=()=>{this.useGpsFloorTimer=this.timer.setTimeout(()=>{this.gpsFloor?this.positionFloor=this.gpsFloor:n()},5e3)};n()}if(this.positionFloor&&(this.dispatchEvent({type:"position",floor:this.positionFloor,x:e,y:i,time:Date.now()}),this.options.upload_position)){var o;(o=this.positionWebSocket)==null||o.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:e,y:i,floor:this.positionFloor,type:s})})}}))}setSensor(t){this.pdrPosition&&this.pdrPosition.setSensor(t)}requestDeviceOrientationPermission(){return f(this,null,function*(){if(this.pdrPosition){let t=yield this.pdrPosition.checkSensor();return t.deviceOrientation?this.pdrPosition.start():(this.dispatchEvent(x({type:"check-sensor"},t)),!t.deviceOrientation&&this.options.use_default_permission),t}else return null})}getGpsFloor(){return f(this,null,function*(){if(this.options.use_gps&&this.options.get_gps_floor_url){let t=yield fetch(this.options.get_gps_floor_url+"/"+this.options.place_id).then(e=>e.json());t.code===200&&(this.gpsFloor=t.data.gps_floor)}})}pausePdr(){if(this.options.type===1){var t;(t=this.carInertialPosition)==null||t.stopPositionTimer()}else{var e;(e=this.pdrPosition)==null||e.pause()}}continuePdr(){if(this.options.type===1)this.carInertialPosition&&(this.carInertialPosition.positionTimer||this.carInertialPosition.startPositionTimer());else{var t;(t=this.pdrPosition)==null||t.continue()}}setPathAngle(t){if(this.options.type===1){var e;(e=this.carInertialPosition)==null||e.setPathAngle(t)}}getForwardAngle(){if(this.options.type===1){var t,e;return(e=(t=this.carInertialPosition)==null?void 0:t.angle)!=null?e:null}else return null}resetPdr(){this.carInertialPosition&&(this.carInertialPosition.history=[],this.carInertialPosition.setPathAngle(0),this.carInertialPosition.speed=0),this.pdrPosition&&this.pdrPosition.pdr.particleFilter.setPosInitFlag(!1)}setPath(t){this.path=t}sendBeacon(t){var e;let i=[];if(pe)i=t.map(o=>{let[n,r]=Mn(o.major);return[o.uuid,r,o.minor,o.rssi,o.accuracy,n]}).filter(o=>o[3]!==0).sort((o,n)=>n[3]-o[3]);else{let o=t.reduce((n,r)=>{var h,c;let[l,p]=Mn(r.major),d=""+p+r.minor;return(h=n)[c=d]||(h[c]=[]),n[d].push(x({},r,{battery:l,major:p})),n},{});Object.entries(o).forEach(n=>{let[r,h]=n,{uuid:c,major:l,minor:p,accuracy:d,battery:u}=h[0];if(h.length>1){let m=h.filter(v=>v.rssi<0),g=m.reduce((v,w)=>v+w.rssi,0);i.push([c,l,p,g/m.length,d,u])}else i.push([c,l,p,h[0].rssi,d,u])})}let s={command:"POSITION",index:this.uploadIndex++,ts:Date.now(),beacons:JSON.stringify([{type:"ibeacon",timestamp:Date.now()/1e3,res:i}]),ext_sensors:JSON.stringify({})};(e=this.sensorWebSocket)==null||e.send(s)}dispose(){var t,e,i,s;this.timer.dispose(),(t=this.positionWebSocket)==null||t.dispose(),this.positionWebSocket=null,(e=this.sensorWebSocket)==null||e.dispose(),this.sensorWebSocket=null,(i=this.pdrPosition)==null||i.dispose(),this.pdrPosition=null,(s=this.carInertialPosition)==null||s.dispose(),this.carInertialPosition=null,super.dispose()}constructor(t,e){super(),this.bmap=t,this.positionWebSocket=null,this.sensorWebSocket=null,this.pdrPosition=null,this.carInertialPosition=null,this.gpsFloor="",this.positionFloor="",this.useGpsFloorTimer=null,this.uploadIndex=0,this.path=null,this.timer=new j;let i=new URLSearchParams(location.search),s=i.get("server_env")||"prod",o={test:"nav-test.aibee.cn",prod:"nav.aibee.cn"},n="wss://"+o[s]+"/aether-walker/indoor/position",r="wss://"+o[s]+"/aether-walker/indoor/sensor";this.options=x({place_id:i.get("place_id"),access_token:i.get("access_token"),env:s,wss_position_url:n,wss_sensor_url:r,get_gps_floor_url:"https://"+o[s]+"/aether-walker/indoor/conf",use_sensor:!1,type:-1,use_gps:!0,use_pdr:!0,upload_position:!0,use_default_permission:!0,ext_position_params:{},ext_sensor_params:{}},e),this.initPositionWebSocket(),this.options.use_sensor&&this.initSensorWebSocket(),this.options.use_pdr&&this.initPdr(),this.options.use_gps&&this.getGpsFloor()}};var kP=require("core-js/modules/web.dom-collections.iterator.js");var bn=class extends X{showMyPosition(t,e){var i;let s=(i=this.bmap.context.currentFloor)==null?void 0:i.getGraphicPosition(t);if(s){let o=new Ke(this.bmap.context,{autoUpdate:!0,appendToBody:!1});o.div.appendChild(e),o.position.copy(this.bmap.mercatorToWorld(s)),this.myPositionOverlay=o,console.log("graphicPos",s,this)}else console.warn("[showMyPosition] \u6CA1\u6709\u627E\u5230\u56FE\u5143\u6240\u5728\u7684\u4F4D\u7F6E")}hideMyPosition(){this.myPositionOverlay&&(this.myPositionOverlay.dispose(),this.myPositionOverlay=null)}dispose(){this.hideMyPosition()}constructor(...t){super(...t),this.myPositionOverlay=null}};var Sn=class extends X{highlightPoi(t,e){e===void 0&&(e={icon_size:[40,40],collision_enable:!1}),t.map(s=>this.bmap.getPoiById(s)).filter(s=>!!s).forEach(s=>{var o;(o=s.userData).restore||(o.restore={});for(let h in e)if(h in s.options){var n,r;(n=s.userData.restore)[r=h]||(n[r]=s.options[h]),s.options[h]=e[h]}})}restorePoi(t){t.map(i=>this.bmap.getPoiById(i)).filter(i=>!!i).forEach(i=>{console.log("poi.userData.restore",i.userData.restore);for(let s in i.userData.restore)s in i.options&&(i.options[s]=i.userData.restore[s]);i.userData.restore={}})}};var GP=require("core-js/modules/web.dom-collections.iterator.js"),FP=require("core-js/modules/es.array.sort.js");var En=class extends X{sortByDistance(t,e,i){return f(this,null,function*(){i===void 0&&(i=!1);let s=[...e];if(i||e.length<20)return yield Promise.all(s.map(o=>f(this,null,function*(){o.distance=yield this._getDistance(t,{floor:o.floor,x:o.center_x,y:o.center_y})}))),s.sort((o,n)=>o.distance-n.distance);{let o=s.sort((r,h)=>{let c=Math.sqrt((r.center_x-t.x)**2+(r.center_y-t.y)**2)+(t.floor===r.floor?0:100),l=Math.sqrt((h.center_x-t.x)**2+(h.center_y-t.y)**2)+(t.floor===h.floor?0:100);return c-l});return[...(yield Promise.all(o.slice(0,20).map(r=>f(this,null,function*(){return r.distance=yield this._getDistance(t,{floor:r.floor,x:r.center_x,y:r.center_y}),r})))).sort((r,h)=>r.distance-h.distance),...o.slice(20)]}})}_getDistance(t,e){return f(this,null,function*(){return this.navPath.getPath({floor:t.floor,coord:[t.x,t.y]},{floor:e.floor,coord:[e.x,e.y]},"",0).then(i=>i.reduce((s,o,n)=>{if(s+=o.distance,n!==i.length-1)switch(o.endType){case"escalator":case"straightLadder":case"staircase":case"ramp":s+=100;break}return s},0)).catch(i=>i==="near"?0:1/0)})}dispose(){super.dispose(),this.needDisposeNavPath&&this.navPath.dispose()}constructor(t,e){if(super(t),this.needDisposeNavPath=!1,e)this.navPath=e;else{this.navPath=new fs;let i=new qe(t);this.needDisposeNavPath=!0,i.load(t.config.apiPath.loadPlaceInfo+"?place_id="+t.config.placeId+"&env=prod").then(s=>f(this,null,function*(){let[o,n]=yield Promise.all([i.getRoadNetworkData(),i.getFacilitiesData()]);this.navPath.setRoadData(o,n.infrastructures)}))}}};var hc="https://robot-vr-public.bj.bcebos.com/v1/static_resource/satellite_tiles",cc={base_url:hc},Ln=class extends X{setVisible(t){this.tileLayer.setVisibility(t)}dispose(){this.bmap.context.scene.remove(this.tileLayer),this.tileLayer.dispose(),super.dispose()}constructor(t,e){super(t),this.options=x({},cc,e),this.tileLayer=new Re(t.context,this.options),this.tileLayer.position.z=-1,this.bmap.context.scene.add(this.tileLayer)}};var mo=require("three");var Cn=class extends X{addHeatmap(t,e){this.heatmap||(this.heatmap=new Yi(this.bmap.context),this.group.add(this.heatmap)),this.heatmap.loadData(t);let i=new mo.Box3().setFromObject(e.graphicLayer);return this.heatmap.position.setZ(i.max.z+.1),this.heatmap}removeHeatMap(){this.heatmap&&(this.group.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=null)}dispose(){this.removeHeatMap(),this.bmap.context.scene.remove(this.group)}constructor(t){super(t),this.heatmap=null,this.group=new mo.Group,this.bmap.context.scene.add(this.group)}};
|