@aibee/crc-bmap 0.8.111 → 0.8.112
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 +1 -1
- package/lib/index.esm.min.js +1 -1
- package/lib/index.js +1 -1
- package/lib/index.online.esm.min.js +1 -1
- package/lib/platform/wrapper.cjs +1 -1
- package/lib/platform/wrapper.esm.min.js +1 -1
- package/lib/platform/wrapper.js +1 -1
- package/lib/platform/wrapper.online.esm.min.js +1 -1
- package/lib/src/loader/AibeeLoader/index.js +1 -0
- package/package.json +1 -1
|
@@ -3908,7 +3908,7 @@ void main() {
|
|
|
3908
3908
|
gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
3909
3909
|
}
|
|
3910
3910
|
}
|
|
3911
|
-
`,n=-1/0,r=this.geometry.getAttribute("position");if(r)for(let s=0;s<r.count;s++){let a=r.getZ(s);a>n&&(n=a)}let o=new zR({uniforms:{maxZ:{value:n},uColor:{value:new u1(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new u1(Ze(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=G.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 FR(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(n=>{let{coords:r}=n.geometry;for(let o=0;o<r.length;o++){let s=r[o];for(let a=0;a<s.length;a++){let u=s[a],l=a+1===s.length?s[0]:s[a+1];t.push(new a1(u[0],u[1],e)),t.push(new a1(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new KR().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new NR(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t,e,n;(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.line)==null||n.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},Yc,n)),this.init()}};var QH=d(I(),1),qH=d(Lo(),1);import{Box2 as Xc,Object3D as UR,Sprite as l1,SpriteMaterial as c1,Vector2 as aa}from"three";import{isNil as Ki}from"lodash";var GR={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1},nt=class extends UR{get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:r,text_texture_offset_y:o}=this.options;return!Ki(t)&&!Ki(e)&&!Ki(n)&&!Ki(r)&&!Ki(o)}get deltaZ(){return!this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>j(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text_font_size",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&(this.initSize(),this._initScale({zoom:this.context.camera.zoom}))}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return j(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>j(this,null,function*(){let e;if(this.options.icon_border){let{icon:r,icon_size:o,icon_border:s}=this.options;e=yield ct.getUrlTextureBorder(r,o[0]-s.width*2,s)}else e=yield ct.getTextureByUrl(this.options.icon);let n=new l1(new c1({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));n.visible=!1,n.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(n),this.spriteIcon=n,t(n)})).then(()=>{this._initIconPromise=null})})}initText(){if(this.hasText){let t;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:r,text_texture_height:o,text_texture_offset_x:s,text_texture_offset_y:a}=this.options;t=this.options.text_texture.clone(),t.uuid=n.uuid,t.offset.set(s/t.image.width,1-(o+a)/t.image.height),t.repeat.set(r/t.image.width,o/t.image.height),this.textAspect=r/o}else{let n=tt.getTextureByText(this.options.text);t=n.texture,this.textureLines=n.lines,this.textAspect=t.image.width/t.image.height}let e=new l1(new c1({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}}initSize(){var t,e;let n=0,r=0,{icon:o}=this.options;o?this.hasText?(n=0,r=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,r=0):this.hasText?(r=.5,n=0):(n=0,r=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,r)}init(){return j(this,null,function*(){yield Promise.all([this.initIcon(),new Promise(t=>{this.initText(),t(!0)})]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:n}}=this.context,r=e*(t.x+1)/2,o=n*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let s=this.iconWidth/2,a=new Xc(new aa(r-s,o-this.iconHeight),new aa(r+s,o)),u=this.textWidth/2,l=new Xc(new aa(r-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new aa(r+u,o-this.iconHeight-this.durIconAndText));return this.box=l.union(a),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="999",n.style.border="1px solid red",n.style.pointerEvents="none",this.boxHelper=n,this.context.container.appendChild(n)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}parentSetVisible(t){this.spriteText&&(this.spriteText.visible=t),this.spriteIcon&&(this.spriteIcon.visible=t),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.clear(),this.unRegistryEvent(),this.spriteText=void 0,this.spriteIcon=void 0}constructor(t,e){var n;super(),this.context=t,this.textAspect=1,this.box=new Xc,this._initIconPromise=null,this.textureLines=1,this._initScale=o=>{let{zoom:s}=o;if(this.spriteText){let u=this.textHeight/s;this.spriteText.scale.set(this.textAspect*u,u,.1)}if(this.spriteIcon){var a;(a=this.spriteIcon)==null||a.scale.set(this.options.icon_size[0]/s,this.options.icon_size[1]/s,.1)}this.resetZ()};var r;this.options=Qn(T({},GR,e,{text:(r=(n=e.text)==null?void 0:n.trim())!=null?r:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var s5=d(Lo(),1);import{DoubleSide as kR,Matrix4 as h1,Mesh as VR,MeshBasicMaterial as LR,Object3D as JR,PlaneGeometry as BR}from"three";import{mergeGeometries as HR}from"three/examples/jsm/utils/BufferGeometryUtils";var QR={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},ua=class extends JR{init(){return j(this,null,function*(){let t=this.options.map(s=>tt.getTextureByText(s.texts[0],{fillStyle:j0(s.fillColor,s.fillOpacity),strokeStyle:j0(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"bold 54px sans-serif",maxWidth:2048})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.texture.image,h=l/c,p=u.secondHeight*h,f=new BR(p,u.secondHeight),g=new h1().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new h1().makeRotationZ(u.secondRotate));return f.applyMatrix4(g),f}),n=HR(e,!0);e.forEach(s=>s.dispose());let r=t.map(s=>{let{texture:a}=s,u=new LR({map:a,alphaTest:1,side:kR});return a.needsUpdate=!0,u}),o=new VR(n,r);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e,n;(t=this.mesh)==null||t.geometry.dispose(),(n=this.mesh)==null||(e=n.material)==null||e.forEach(r=>r.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},QR,n)).filter(n=>n.texts[0].trim()),this.options.length&&this.init()}};import{Object3D as qR}from"three";import{Line2 as $R}from"three/examples/jsm/lines/Line2";import{LineGeometry as t9}from"three/examples/jsm/lines/LineGeometry";import{LineMaterial as e9}from"three/examples/jsm/lines/LineMaterial";var Ni=class extends qR{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 $R(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&q(this.line),this.lineGeometry=null,this.lineMaterial=null,this.clear(),(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,n){super(),this.context=t,this.lineGeometry=new t9,this.lineMaterial=new e9({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:r,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(r,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};import{Frustum as n9}from"three";var la=class extends Ht{setEnable(t){super.setEnable(t),gt(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:n,clientHeight:r}}}=this,o=Y(this.startPoint,e,n,r),s=Y(this.endPoint,e,n,r),a={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},u={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},l=this.searchMapInFrustum(a,u);this.dispatchEvent({type:"selected",list:l})}}searchMapInFrustum(t,e){var n;let{context:r}=this;return((n=r.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof et&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:r,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let f=Y(p,r,o,s);return nn(f,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:u,max:l}=a,c=Y(u,r,o,s),h=Y(l,r,o,s);return!(!nn(c,e,n)||!nn(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new n9,this.onPointerDown=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=r=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o)},this.onPointerUp=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let r=this.getSvgCoordinate(this.startPoint),o=T({},r);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(r.x,o.x),y:Math.min(r.y,o.y)},a=Math.abs(o.x-r.x),u=Math.abs(o.y-r.y);gt(this.rect,s.x,s.y,a,u)}else gt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=rn(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var ca=class extends r9{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:n,offsetY:r}=e,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-n)**2+(s-r)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,r),u=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(n,r).forEach(c=>{if(!u.has(c.options.id)){var h;let p=((h=this.context.currentFloor)==null?void 0:h.graphicLayer.graphicMap.get(c.options.id))||null;p&&p.options.geometry.type==="point"&&(a.push(p),u.add(c.options.id))}}),($n?e.metaKey:e.ctrlKey)||this._list.clear(),a.forEach(c=>this._list.add(c)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{tr(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{tr(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(r=>{this._list.add(r)}),this.selectEnd()},this.boxSelection=new la(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var O5=d(me(),1),R5=d(ge(),1),F5=d(ye(),1),K5=d(Me(),1),N5=d(Pe(),1),z5=d(Ae(),1),U5=d(je(),1),G5=d(I(),1);import{EventDispatcher as i9,Vector2 as o9}from"three";var ha=class extends i9{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 L,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:n,pois:r,e:o}=e,s=r.map(c=>{var h;return(h=this.context.currentFloor)==null?void 0:h.graphicLayer.graphicMap.get(c.options.id)}).filter(c=>c&&c.options.geometry.type==="point");if(!n.length&&!s.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:a}=this.context.config.hover,u=new Set;if(s.length){let c,h=1e4;s.forEach(p=>{let f=r.find(g=>g.options.id===p.options.id);if(f instanceof Cn){let{x:g,y}=f.clientPos,M=Math.sqrt((g-o.offsetX)**2+(y-o.offsetY)**2);M<h&&(h=M,c=p)}else if(f instanceof nt){let{x:g,y}=f.box.getCenter(new o9),M=Math.sqrt((g-o.offsetX)**2+(y-o.offsetY)**2);M<h&&(h=M,c=p)}}),u.add(c)}u.size||n.forEach(c=>u.add(c)),u.forEach(c=>{if(this.graphicTimerMap.get(c)||this.curGraphics.has(c))return;let h=this.timer.setTimeout(()=>{this.curGraphics.add(c),this.graphicTimerMap.delete(c),this.timer.clearTimeout(h),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(c,h)}),this.graphicTimerMap.forEach((c,h)=>{u.has(h)||(this.timer.clearTimeout(c),this.graphicTimerMap.delete(h))});let l=this.curGraphics.size;this.curGraphics.forEach(c=>{u.has(c)||this.curGraphics.delete(c)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()},this.onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()},this.onBodyPointerMove=e=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)&&this.onPointerLevel()}},this.registryEvent()}};var B5=d(I(),1);import{Box3 as s9,Vector3 as pa}from"three";var fa=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 Bt).length)return null;let e=this.box,{camera:n,clientSize:{width:r,height:o}}=this.context,{min:s,max:a}=e,u=Y(s,n,r,o),l=Y(a,n,r,o),c=Y(new pa(s.x,a.y,a.z),n,r,o),h=Y(new pa(a.x,s.y,s.z),n,r,o),p=Math.min(u.x,l.x,c.x,h.x),f=Math.max(u.x,l.x,c.x,h.x),g=Math.min(u.y,l.y,c.y,h.y),y=Math.max(u.y,l.y,c.y,h.y);return{left:p,right:f,top:g,bottom:y}}checkDistanceToScreenEdge(t){let{left:e,right:n,top:r,bottom:o}=t,{width:s,height:a}=this.context.clientSize,[u,l,c,h]=this.context.config.cameraBound.padding,p=n>=h,f=s-e>=l,g=a-r>=c,y=o>=u;return p&&f&&g&&y}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new pa,zoom:1,target:new pa},this.enable=!0,this.box=new s9,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:n,right:r,top:o,bottom:s}=e;this.checkDistanceToScreenEdge({left:n,right:r,top:o,bottom:s})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var cQ=d(Rc(),1);import{Vector3 as _1}from"three";import{Tween as Ma,Group as x9}from"@tweenjs/tween.js";var sQ=d(I(),1),aQ=d(R(),1);import{EventDispatcher as v9,MOUSE as br,Quaternion as b1,Spherical as ma,TOUCH as wr,Vector2 as Yt,Vector3 as Qt,Plane as S9,Ray as b9,MathUtils as w9}from"three";var ga=new b9,w1=new S9,_9=Math.cos(70*w9.DEG2RAD),ya=class extends v9{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 Yt,this.rotateLineEnd=new Yt,this.spherical=new ma,this.sphericalDelta=new ma,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Qt,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:br.PAN,MIDDLE:br.DOLLY,RIGHT:br.ROTATE},this.touches={ONE:wr.PAN,TWO:wr.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 a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(P){P.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=P},this.stopListenToKeyEvents=function(){var P;(P=this._domElementKeyEvents)==null||P.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent({type:"change"}),n.update(),o=r.NONE},this.update=function(){let P=new Qt,b=new b1().setFromUnitVectors(t.up,new Qt(0,1,0)),U=b.clone().invert(),H=new Qt,_t=new b1,pe=new Qt,qt=2*Math.PI;return function(Yr){Yr===void 0&&(Yr=null);let xe=n.object.position;P.copy(xe).sub(n.target),P.applyQuaternion(b),a.setFromVector3(P),n.autoRotate&&o===r.NONE&&X(F(Yr)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let We=n.minAzimuthAngle,Ie=n.maxAzimuthAngle;isFinite(We)&&isFinite(Ie)&&(We<-Math.PI?We+=qt:We>Math.PI&&(We-=qt),Ie<-Math.PI?Ie+=qt:Ie>Math.PI&&(Ie-=qt),We<=Ie?a.theta=Math.max(We,Math.min(Ie,a.theta)):a.theta=a.theta>(We+Ie)/2?Math.max(We,a.theta):Math.min(Ie,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),n.zoomToCursor&&x||n.object.isOrthographicCamera?a.radius=wt(a.radius):a.radius=wt(a.radius*l),P.setFromSpherical(a),P.applyQuaternion(U),xe.copy(n.target).add(P),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),c.set(0,0,0));let Li=!1;if(n.zoomToCursor&&x){let Dr=null;if(n.object.isPerspectiveCamera){let Cr=P.length();Dr=wt(Cr*l);let Ji=Cr-Dr;n.object.position.addScaledVector(E,Ji),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let Cr=new Qt(w.x,w.y,0);Cr.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Li=!0;let Ji=new Qt(w.x,w.y,0);Ji.unproject(n.object),n.object.position.sub(Ji).add(Cr),n.object.updateMatrixWorld(),Dr=P.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Dr!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Dr).add(n.object.position):(ga.origin.copy(n.object.position),ga.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(ga.direction))<_9?t.lookAt(n.target):(w1.setFromNormalAndCoplanarPoint(n.object.up,n.target),ga.intersectPlane(w1,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Li=!0);return l=1,x=!1,Li||H.distanceToSquared(n.object.position)>s||8*(1-_t.dot(n.object.quaternion))>s||pe.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),H.copy(n.object.position),_t.copy(n.object.quaternion),pe.copy(n.target),Li=!1,!0):!1}}();let n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=r.NONE,s=1e-6,a=new ma,u=new ma,l=1,c=new Qt,h=new Yt,p=new Yt,f=new Yt,g=new Yt,y=new Yt,M=new Yt,A=new Yt,S=new Yt,_=new Yt,E=new Qt,w=new Yt,x=!1,v=[],W={};function F(P){return P!==null?2*Math.PI/60*n.autoRotateSpeed*P:2*Math.PI/60/60*n.autoRotateSpeed}function D(){return Math.pow(.95,n.zoomSpeed)}function X(P){u.theta-=P}function rt(P){u.phi-=P}let st=function(){let P=new Qt;return function(U,H){P.setFromMatrixColumn(H,0),P.multiplyScalar(-U),c.add(P)}}(),bt=function(){let P=new Qt;return function(U,H){n.screenSpacePanning===!0?P.setFromMatrixColumn(H,1):(P.setFromMatrixColumn(H,0),P.crossVectors(n.object.up,P)),P.multiplyScalar(U),c.add(P)}}(),Ct=function(){let P=new Qt;return function(U,H){let _t=n.domElement;if(n.object.isPerspectiveCamera){let pe=n.object.position;P.copy(pe).sub(n.target);let qt=P.length();qt*=Math.tan(n.object.fov/2*Math.PI/180),st(2*U*qt/_t.clientHeight,n.object.matrix),bt(2*H*qt/_t.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(st(U*(n.object.right-n.object.left)/n.object.zoom/_t.clientWidth,n.object.matrix),bt(H*(n.object.top-n.object.bottom)/n.object.zoom/_t.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Rn(P){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ir(P){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Er(P){if(!n.zoomToCursor)return;x=!0;let b=n.domElement.getBoundingClientRect(),U=P.clientX-b.left,H=P.clientY-b.top,_t=b.width,pe=b.height;w.x=U/_t*2-1,w.y=-(H/pe)*2+1,E.set(w.x,w.y,1).unproject(n.object).sub(n.object.position).normalize()}function wt(P){return Math.max(n.minDistance,Math.min(n.maxDistance,P))}function qc(P){h.set(P.clientX,P.clientY)}function hT(P){Er(P),A.set(P.clientX,P.clientY)}function $c(P){g.set(P.clientX,P.clientY)}function pT(P){p.set(P.clientX,P.clientY),f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let b=n.domElement;X(2*Math.PI*f.x/b.clientHeight),rt(2*Math.PI*f.y/b.clientHeight),h.copy(p),n.update()}function fT(P){S.set(P.clientX,P.clientY),_.subVectors(S,A),_.y>0?Rn(D()):_.y<0&&Ir(D()),A.copy(S),n.update()}function dT(P){y.set(P.clientX,P.clientY),M.subVectors(y,g).multiplyScalar(n.panSpeed),Ct(M.x,M.y),g.copy(y),n.update()}function mT(P){Er(P),P.deltaY<0?Ir(D()):P.deltaY>0&&Rn(D()),n.update()}function gT(P){let b=!1;switch(P.code){case n.keys.UP:P.ctrlKey||P.metaKey||P.shiftKey?rt(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ct(0,n.keyPanSpeed),b=!0;break;case n.keys.BOTTOM:P.ctrlKey||P.metaKey||P.shiftKey?rt(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ct(0,-n.keyPanSpeed),b=!0;break;case n.keys.LEFT:P.ctrlKey||P.metaKey||P.shiftKey?X(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ct(n.keyPanSpeed,0),b=!0;break;case n.keys.RIGHT:P.ctrlKey||P.metaKey||P.shiftKey?X(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ct(-n.keyPanSpeed,0),b=!0;break}b&&(P.preventDefault(),n.update())}function th(){if(v.length===1)h.set(v[0].pageX,v[0].pageY);else{let P=(v[0].pageX-v[0].pageY)/(v[1].pageX-v[1].pageY),b=v[0].pageY-P*v[0].pageX;n.rotateLineStart.set(P,b);let U=.5*(v[0].pageX+v[1].pageX),H=.5*(v[0].pageY+v[1].pageY);h.set(U,H)}}function eh(){if(v.length===1)g.set(v[0].pageX,v[0].pageY);else{let P=.5*(v[0].pageX+v[1].pageX),b=.5*(v[0].pageY+v[1].pageY);g.set(P,b)}}function nh(){let P=v[0].pageX-v[1].pageX,b=v[0].pageY-v[1].pageY,U=Math.sqrt(P*P+b*b);A.set(0,U)}function yT(){n.enableZoom&&nh(),n.enablePan&&eh()}function MT(){n.enableZoom&&nh(),n.enableRotate&&th()}function rh(P){if(v.length==1)p.set(P.pageX,P.pageY);else{let U=Ga(P),H=.5*(P.pageX+U.x),_t=.5*(P.pageY+U.y);p.set(H,_t);let pe=(P.pageY-U.y)/(P.pageX-U.x),qt=U.y-pe*U.x;if(n.rotateLineEnd.set(pe,qt),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let ka=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Yr=pe*ka+qt;if(Number.isFinite(ka)&&Number.isFinite(Yr)){let xe=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(xe)<.5&&(xe=-Math.sign(xe)*(Math.PI-Math.abs(xe))),Math.abs(xe)<.1&&(u.theta+=xe)}}n.rotateLineStart.copy(n.rotateLineEnd)}f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let b=n.domElement;rt(2*Math.PI*f.y/b.clientHeight),h.copy(p)}function ih(P){if(v.length===1)y.set(P.pageX,P.pageY);else{let b=Ga(P),U=.5*(P.pageX+b.x),H=.5*(P.pageY+b.y);y.set(U,H)}M.subVectors(y,g).multiplyScalar(n.panSpeed),Ct(M.x,M.y),g.copy(y)}function oh(P){let b=Ga(P),U=P.pageX-b.x,H=P.pageY-b.y,_t=Math.sqrt(U*U+H*H);S.set(0,_t),_.set(0,Math.pow(S.y/A.y,n.zoomSpeed)),Rn(_.y),A.copy(S)}function PT(P){n.enableZoom&&oh(P),n.enablePan&&ih(P)}function AT(P){n.enableZoom&&oh(P),n.enableRotate&&rh(P)}this.onPointerDown=function(b){n.enabled!==!1&&(v.length===0&&(n.domElement.setPointerCapture(b.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),bT(b),b.pointerType==="touch"?vT(b):jT(b))},this.onPointerMove=function(b){n.enabled!==!1&&(b.pointerType==="touch"?ST(b):TT(b))},this.onPointerUp=function(b){wT(b),v.length===0&&(n.domElement.releasePointerCapture(b.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=r.NONE};function jT(P){let b;switch(P.button){case 0:b=n.mouseButtons.LEFT;break;case 1:b=n.mouseButtons.MIDDLE;break;case 2:b=n.mouseButtons.RIGHT;break;default:b=-1}switch(b){case br.DOLLY:if(n.enableZoom===!1)return;hT(P),o=r.DOLLY;break;case br.ROTATE:if(P.ctrlKey||P.metaKey||P.shiftKey){if(n.enablePan===!1)return;$c(P),o=r.PAN}else{if(n.enableRotate===!1)return;qc(P),o=r.ROTATE}break;case br.PAN:if(P.ctrlKey||P.metaKey||P.shiftKey){if(n.enableRotate===!1)return;qc(P),o=r.ROTATE}else{if(n.enablePan===!1)return;$c(P),o=r.PAN}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent({type:"start"})}function TT(P){switch(o){case r.ROTATE:if(n.enableRotate===!1)return;pT(P);break;case r.DOLLY:if(n.enableZoom===!1)return;fT(P);break;case r.PAN:if(n.enablePan===!1)return;dT(P);break}}this.onMouseWheel=function(b){n.enabled===!1||n.enableZoom===!1||o!==r.NONE||(b.preventDefault(),n.dispatchEvent({type:"start"}),mT(b),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(b){n.enabled===!1||n.enablePan===!1||gT(b)};function vT(P){switch(sh(P),v.length){case 1:switch(n.touches.ONE){case wr.ROTATE:if(n.enableRotate===!1)return;th(),o=r.TOUCH_ROTATE;break;case wr.PAN:if(n.enablePan===!1)return;eh(),o=r.TOUCH_PAN;break;default:o=r.NONE}break;case 2:switch(n.touches.TWO){case wr.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;yT(),o=r.TOUCH_DOLLY_PAN;break;case wr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;MT(),o=r.TOUCH_DOLLY_ROTATE;break;default:o=r.NONE}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent({type:"start"})}function ST(P){switch(sh(P),o){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;rh(P),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;ih(P),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;PT(P),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;AT(P),n.update();break;default:o=r.NONE}}this.onContextMenu=function(b){n.enabled!==!1&&b.preventDefault()};function bT(P){v.push(P)}function wT(P){delete W[P.pointerId];for(let b=0;b<v.length;b++)if(v[b].pointerId==P.pointerId){v.splice(b,1);return}}function sh(P){let b=W[P.pointerId];b===void 0&&(b=new Yt,W[P.pointerId]=b),b.set(P.pageX,P.pageY)}function Ga(P){let b=P.pointerId===v[0].pointerId?v[1]:v[0];return W[b.pointerId]}n.domElement.addEventListener("contextmenu",this.onContextMenu),n.domElement.addEventListener("pointerdown",this.onPointerDown),n.domElement.addEventListener("pointercancel",this.onPointerUp),n.domElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),this.update()}};var Pa=class extends ya{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:n,minPolarAngle:r}=this,o=n===r;(e||t<=n&&t>=r)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=n,this.minPolarAngle=r)}setPolarAngleByDuration(t,e,n){return j(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):Kt(new Promise(r=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new Ma(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),r(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:n,minAzimuthAngle:r}=this,o=n===r;(e||t<=n&&t>=r)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=n,this.minAzimuthAngle=r)}setAzimuthalAngleDuration(t,e,n){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setAzimuthalAngle(t,e):Kt(new Promise(r=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new Ma(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),r(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}getCameraLookAt(){return new _1().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return j(this,null,function*(){let n=this.target.clone(),r=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(r)),this.target.copy(t.clone()),this.update();return}return Kt(new Promise(o=>{let s=new Ma(n,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(n.clone().sub(r)),this.target.copy(n.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(s),this.enabled=!0,o(!0)}).onStart(()=>{this.enabled=!1}).start()}),e+500)})}setZoom(t,e,n){n===void 0&&(n=!1);let{minZoom:r,maxZoom:o}=this;(n||t>=r&&t<=o)&&(this.camera.position.copy(e.clone().sub(this.getCameraLookAt())),this.target.copy(e),this.camera.zoom=t,this.update())}setZoomByDuration(t,e,n,r){return j(this,null,function*(){n===void 0&&(n=!1),r===void 0&&(r=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return r?Kt(new Promise(s=>{let a=new Ma(o,this.tweenGroup).to({zoom:t,target:e},r).onUpdate(()=>{this.setZoom(o.zoom,o.target,n)}).onComplete(()=>{this.tweenGroup.remove(a),this.enabled=!0,s(!0)}).onStart(()=>{this.enabled=!1}).start()}),r+500).finally(()=>{this.enabled=!0}):this.setZoom(t,e,n)})}setTargetByOffset(t,e){if(e===void 0&&(e=this.target.clone()),this.camera.updateMatrix(),t){let n=new _1;n.setFromMatrixColumn(this.camera.matrix,1),n.normalize(),n.multiplyScalar(t/this.camera.zoom),e.add(n)}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,n){super(e,n),this.context=t,this.camera=e,this.domElement=n,this.prevCameraZoom=1,this.tweenGroup=new x9,this.offsetY=0,this.onChange=()=>{let r=this.camera.zoom;r!==this.prevCameraZoom&&(this.prevCameraZoom=r,this.dispatchEvent({type:"change-zoom",zoom:r}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};import{EventDispatcher as W9,PCFSoftShadowMap as I9,WebGLRenderer as E9}from"three";var Aa=class extends E9{setCameraAndScene(t,e){this.scene=t,this.camera=e}autoRender(){this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.timer.requestAnimationFrame(()=>{this.autoRender()})}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(t,e){this.event.addEventListener(t,e)}removeEventListener(t,e){this.event.removeEventListener(t,e)}dispose(){this.timer.dispose(),this.enable=!1,super.dispose(),this.domElement=null}constructor(t){super(T({antialias:!0,alpha:!0},t)),this.event=new W9,this.enable=!0,this.timer=new L,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=I9}};import{Euler as Y9,Matrix4 as D9,Scene as C9,EquirectangularReflectionMapping as X9}from"three";import{RGBELoader as Z9}from"three/examples/jsm/loaders/RGBELoader.js";var ja=class extends C9{constructor(){super(),new Z9().load(Jj,t=>{t.mapping=X9,this.environment=t;let e=new D9;e.makeRotationX(Math.PI/2),this.environmentRotation=new Y9().setFromRotationMatrix(e)})}};import{OrthographicCamera as O9}from"three";var Ta=class extends O9{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 va=class extends R9{resizeClientSize(){let{x:t,y:e,width:n,height:r}=this.container.getBoundingClientRect();this.clientSize={width:n||this.container.clientWidth,height:r||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new Ta(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new Pa(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 fa(this)}getRatio(t,e){t===void 0&&(t=new ke(0,0,0)),e===void 0&&(e=new ke(100,0,0));let{clientWidth:n,clientHeight:r}=this.container,o=Y(t,this.camera,n,r),s=Y(e,this.camera,n,r);return Math.ceil(Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof U9&&(e.color=new z9(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let e=t.getCenter();e&&(this.lights.position.x=e.x,this.lights.position.y=e.y),this.cameraBound.updateBox()}getGraphicsByDeviceXy(t,e){var n;let r=new _r;r.x=t/this.clientSize.width*2-1,r.y=e/this.clientSize.height*-2+1;let o=new K9;return o.setFromCamera(r,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),((n=this.currentFloor)==null?void 0:n.graphicLayer.getGraphicByRaycaster(o))||{graphics:[],position:null}}getPoisByDeviceXy(t,e){var n,r;let o=(n=this.currentFloor)==null?void 0:n.poiLayer.getPoiByDeviceXy(t,e),s=(r=this.currentFloor)==null?void 0:r.poiLayer2.getPoiByDeviceXy(t,e);return(o||[]).concat(s||[])}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,n){return n===void 0&&(n=500),this.control.setZoomByDuration(t,e,!0,n)}getFitCameraToObjectZoom(t,e,n,r){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),r===void 0&&(r=!0);let[o,s,a,u]=e,{clientSize:{width:l,height:c}}=this,h=this.control.getPolarAngle();r&&this.setPolarAngle(0,0);let p=new N9().setFromObject(t);this.setPolarAngle(h,0);let{max:f,min:g}=p,y=new ke(g.x,f.y,f.z),M=new ke(f.x,f.y,f.z),A=new ke(f.x,g.y,g.z),S=new ke(g.x,g.y,g.z),_=Y(y,this.camera,l,c),E=Y(M,this.camera,l,c),w=Y(S,this.camera,l,c),x=Y(A,this.camera,l,c),W=new F9().setFromPoints([new _r(_.x,_.y),new _r(E.x,E.y),new _r(w.x,w.y),new _r(x.x,x.y)]).getSize(new _r),F=(l-s-u)/W.x,D=(c-o-a)/W.y,X=Math.min(F,D),rt=new ke((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2),st=X*this.camera.zoom,bt=this.camera.clone();bt.zoom=st,bt.updateMatrix();let Ct=(l-W.x*X)/2,Rn=(c-W.y*X)/2,Ir=(s-u)/2,Er=(o-a)/2;if(Ir){let wt=new ke;wt.setFromMatrixColumn(bt.matrix,0),wt.normalize(),wt.multiplyScalar(Ir/st),rt.add(wt)}if(Er){let wt=new ke;wt.setFromMatrixColumn(bt.matrix,1),wt.normalize(),wt.multiplyScalar(Er/st),rt.add(wt)}return{zoom:X*this.camera.zoom,center:rt}}fitCameraToObject(t,e,n,r){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),r===void 0&&(r=!0);let{zoom:o,center:s}=this.getFitCameraToObjectZoom(t,e,n,r);return this.setZoom(o,s,n)}getFitCameraToGroundZoom(t,e,n){if(t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),n===void 0&&(n=!0),this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,e,n).zoom}fitCameraToGround(t,e,n){return t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),n===void 0&&(n=!0),this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundLayer,t,e,n):Promise.resolve(!1)}setCameraPosition(t,e){return j(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){var t;(t=this.currentFloor)==null||t.dispose(),this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.renderer.dispose(),this.lights.children.forEach(e=>e.dispose()),q(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new ja,this.renderer=new Aa,this.lights=Gm(),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=n=>{let{zoom:r}=n;this.dispatchEvent({type:"control-zoom-change",zoom:r})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:r,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),r.left=-s/2,r.right=s/2,r.top=a/2,r.bottom=-a/2,r.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);r.length&&this.dispatchEvent({type:"graphic-click",graphics:r,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:r,pois:s,position:o})},this.onPointermove=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:r,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:r,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:r,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:r}=n;this.dispatchEvent({type:"hover",graphics:r})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new ca(this),this.hoverHelper=new ha(this),this.resizeClientSize(),this.registryEvent()}};import{merge as G9}from"lodash";var k9={placeId:0,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:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},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}};function x1(i){return G9({},k9,i)}import{debounce as lF}from"lodash";var $Q=d(I(),1);var ce;function W1(i,t){return i===void 0&&(i="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(ce)return e({db:ce,type:"success"});let r=indexedDB.open(i,t);r.onupgradeneeded=function(o){ce=o.target.result,console.log("onupgradeneeded"),e({db:ce,type:"onupgradeneeded"})},r.onsuccess=o=>{ce=o.target.result,e({db:ce,type:"success"})},r.onerror=o=>{n(o)}})}function Fc(i,t,e){return e===void 0&&(e=ce),new Promise((n,r)=>{e||r("\u6CA1\u6709db");let s=e.transaction([i],"readonly").objectStore(i).get(t);s.onsuccess=()=>{s.result?n(s.result.value):n(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),n(null)}})}function I1(i,t,e,n){return n===void 0&&(n=ce),new Promise((r,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>j(this,null,function*(){let u=yield Fc(i,t),l=n.transaction([i],"readwrite").objectStore(i),c=u!==null?l.put({key:t,value:e}):l.add({key:t,value:e});c.onsuccess=function(h){s(h)},c.onerror=function(h){a(h)}}))))}function Xn(i,t){t===void 0&&(t=ce),t&&(t.objectStoreNames.contains(i)||t.createObjectStore(i,{keyPath:"key"}))}function E1(i){i===void 0&&(i=ce),i==null||i.close(),ce=null}import{Vector3 as iF,Color as oF}from"three";var kQ=d(R(),1),VQ=d(I(),1);function Sa(i,t){let e=i.poi_info.showName||i.store_name||i.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=i.store_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var r;return((r=i.store_info_ext)==null?void 0:r.traditional_name)||e}}function ba(i,t){let e=i.poi_info.showName||i.store_name||i.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=i.infra_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var r;return((r=i.infra_info_ext)==null?void 0:r.traditional_name)||e}}function Y1(i,t,e){switch(i.l_type){case"graph":return V9(i,t);case"wall":return L9(i,t);case"lane":return J9(i,t);case"texture2d":case"texture3d":return B9(i,t);case"glb":return H9(i,t);case"store":return Q9(i,t);case"facility":return $9(i,t);case"parkingSpace":return eF(i,t,e);case"text":return rF(i,t)}}function D1(i,t,e,n){switch(i.l_type){case"store":return q9(i,t,e,n);case"facility":return tF(i,t,e,n);case"parkingSpace":return nF(i,t,n)}}function V9(i,t){let e=i.elements.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=r,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(r):n[h]=[r],n},{});Object.values(e).forEach(n=>{let r=new Sr(t.context,n);t.mergeGraphicLayer.add(r)})}function L9(i,t){let e=i.elements.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l}=r,c=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l;return u===0&&(c=o.toLowerCase()+"-"+s+"-"+l),n[c]?n[c].push(r):n[c]=[r],n},{});Object.values(e).forEach(n=>{let r=new ia(t.context,n);t.wallLayer.add(r)})}function J9(i,t){let e=i.elements.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u}=r,l=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u;return u===0&&(l=o.toLowerCase()+"-"+s),n[l]?n[l].push(r):n[l]=[r],n},{});Object.values(e).forEach(n=>{let r=new sa(t.context,n);t.laneLayer.add(r)})}function B9(i,t){if(i.elements.length){let e=new vr(t.context,i.elements);t.textureLayer.add(e)}}function H9(i,t){i.elements.forEach(e=>{let n=new oa(t.context,T({},e,{url:e.secondUrl,rotate:e.secondRotate,width:e.secondWidth,center_x:e.center_coord_x,center_y:e.center_coord_y}));t.glbModelLayer.add(n)})}function Q9(i,t){i.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function q9(i,t,e,n){i.elements.map(r=>{try{let o=Sa(r,e),s=new nt(t.context,{id:r.id,icon:r.poi_info.showImageUrl||r.poi_info.icon,text:o,position:{x:r.center_coord_x,y:r.center_coord_y,z:r.airHeight+r.height},icon_size:[24,24],level:r.poi_info.level||0,hide_text:!n.showStoreName,maxWeight:r.poi_info.maxWeight||25,minWeight:r.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(s),s&&(s.userData.type="store",s.userData.data=r,s.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,r)}})}function $9(i,t){i.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function tF(i,t,e,n){i.elements.filter(o=>o.poi_info).map(o=>{try{let s=ba(o,e),a=new nt(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:s,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:!n.showFacilityName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(a),a.userData.type="facility",a.userData.data=o,a.userData.floor=t.name}catch(s){console.log("\u6DFB\u52A0facility\u5931\u8D25",s,o)}})}function eF(i,t,e){t.parkingSpaceLayer.createParkings(i.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function nF(i,t,e){return j(this,null,function*(){let n=i.elements.filter(s=>s.texts[0]),r=n.map(s=>s.texts[0]),o=yield tt.lazyGetTextureByTexts(r,{height:64});n.forEach(s=>{try{let a=s.texts[0],u=new nt(t.context,{id:s.id,text:a,position:{x:s.center_coord_x,y:s.center_coord_y,z:s.airHeight+s.height},text_texture:o[a].texture,text_texture_width:o[a].width,text_texture_height:o[a].height,text_texture_offset_x:o[a].x,text_texture_offset_y:o[a].y,text_font_size:e.textFontSize});u&&(u.userData.type="parkingSpace",u.userData.data=s,u.userData.floor=t.name),t.poiLayer2.pushPoi(u)}catch(a){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",a,s)}}),Object.values(o).forEach(s=>{s.texture.dispose()})})}function rF(i,t){let e=new ua(t.context,i.elements.map(n=>T({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var C1="map_version",X1="route_version",Z1="facility_version",Kc="map_data",wa="road_network_data",Nc="facility_data",sF={mergeParkingSpace:!0},xr=class extends ft{initDb(){return j(this,null,function*(){try{let{db:t,type:e}=yield W1("aibee_map",2);e==="onupgradeneeded"&&(Xn(C1),Xn(X1),Xn(Z1),Xn(Kc),Xn(wa),Xn(Nc)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return j(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=T({},this.placeConfig,e));else{let n=yield fetch(t).then(r=>r.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=T({},this.placeConfig,JSON.parse(n.data.config||"{}")))}this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return this.initDbPromise.then(()=>I1(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Fc(t,""+e,this.db))}getFloorCacheKey(t){return t.floor_id+"_"+t.version_id}getFloorData(t){return j(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return j(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=Sa(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=ba(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return j(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>j(this,null,function*(){let r=this.getFloorCacheKey(t),o=yield fetch(t.map_url).then(s=>s.json());o.floor=t.floor,this.setCacheData(Kc,r,o),this.setCacheData(C1,r,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return j(this,null,function*(){let e=this.floors.find(r=>r.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{let r=yield this.getCacheData(Kc,n);return r||this.getFloorJsonDataByFloorInfo(e)}catch(r){return console.log("[get floor data error]",r),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return j(this,null,function*(){return(yield Promise.all(this.floors.map(e=>j(this,null,function*(){let n=this.getFloorCacheKey(e);try{let r=yield this.getCacheData(wa,n);if(r)return r;let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(wa,n,o),this.setCacheData(X1,n,e.version_id),o}catch(r){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(wa,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return j(this,null,function*(){let t=this.floors.reduce((r,o)=>r.updated_at>o.updated_at?r:o,this.floors[0]);if(!t)return null;let e=this.getFloorCacheKey(t),n=()=>j(this,null,function*(){let r=yield fetch(t.entry_infra_url).then(o=>o.json());return r&&(this.setCacheData(Nc,e,r),this.setCacheData(Z1,e,t.version_id)),r});try{let r=yield this.getCacheData(Nc,e);return r||n()}catch(r){return console.log("[get facility error]",r),n()}})}getOtherDataByFreeTime(){return j(this,null,function*(){for(let t=0;t<this.floors.length;t++){let e=this.floors[t];this.getFloorJsonData(e.floor)}})}getMulFloorsData(t){return j(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return j(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return j(this,null,function*(){return e=this.getFloorBaseLayer(t,e),n=T({},this.placeConfig,n),t.layers.forEach(r=>{["range","ground"].includes(r.l_type)||ir(r.elements,e.userData.center)}),yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,n),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new iF),r=Math.max(n.x,n.y,n.z);e.userData.height=r/4+t.floorHeight}switchFloor(t,e){return j(this,null,function*(){return new Promise(n=>{let r={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(r),s=a=>{let{task:u,res:l}=a;u.tid===o&&(this.taskQueue.removeEventListener("active-task-end",s),n(l))};this.taskQueue.addEventListener("active-task-end",s)})})}_switchFloor(t,e){return j(this,null,function*(){var n;let r=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)r=l;else return null}e=T({},this.placeConfig,e);let o=new Bt(this.bmap.context);o.userData.data=t;let s=this.floors.find(l=>l.floor===r.floor);var a;let u=(a=s==null?void 0:s.map_angle)!=null?a:0;return this.bmap.dispatchEvent({type:pt.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:r}}),this.bmap.context.scene.background=new oF(e.backgroundColor),this.getFloorBaseLayer(r,o),this.changeFloorBox(r,o),this.bmap.buildingCenter=o.userData.center,this.bmap.currentBuildGround=(n=o.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(o),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(u/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),r.layers.forEach(l=>{["range","ground"].includes(l.l_type)||ir(l.elements,o.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:pt.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield Go(),yield this.getFloorContentLayer(r,o),this.changeFloorBox(r,o),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield Zg(2),yield this.getFloorPoi(r,o,e),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:pt.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new Bt(this.bmap.context));let n=[0,0];return t.layers.forEach(r=>{switch(r.l_type){case"range":let o=r.elements[0];n=[o.center_x,o.center_y];break;case"ground":ir(r.elements,n);let s=r.elements.map(a=>new et(this.bmap.context,a));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return j(this,null,function*(){e||(e=new Bt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let r=0;r<t.layers.length;r++){let o=t.layers[r];["range","ground"].includes(o.l_type)||(Y1(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Go(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return j(this,null,function*(){n===void 0&&(n=this.placeConfig);let r=Date.now();yield Promise.all(t.layers.map(s=>D1(s,e,this.locale,n))),console.log("poi time",Date.now()-r);let o=Date.now();Go().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return j(this,null,function*(){var t;E1((t=this.db)!=null?t:void 0)})}dispose(){super.dispose(),this.clear(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new or,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=T({},sF,e),this.initDbPromise=this.initDb()}};var pq=d(I(),1);function O1(i,t){return j(this,null,function*(){let{brand:e,project:n}=i,{apiDomain:r,apiPath:{floorRange:o},apiInfo:s}=t,a=""+r+o+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(a,s).then(l=>l.json()).then(l=>l.data).then(l=>{let c=(l||[])[0];return c&&(c.info=JSON.parse(c.info)),c})})}function R1(i,t){return j(this,null,function*(){let{brand:e,project:n,floor:r,ts:o,resource_type_list:s}=i,{apiDomain:a,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+a+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+r+"&ts="+o+"&resource_type_list="+s;return yield fetch(c,l).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))})}function uq(i,t){return j(this,null,function*(){let{project:e,floor:n}=i,{apiDomain:r,apiInfo:o}=t,s=r+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(s,o).then(u=>u.json()).then(u=>u.data).then(u=>JSON.parse(u[0].streetInfo||"{}")).then(u=>u.fileId?aF(u.fileId,t):null)})}function aF(i,t){return j(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+i,n).then(r=>r.arrayBuffer()).then(r=>{let s=new TextDecoder("utf-8").decode(r);return s?JSON.parse(s):null})})}var F1=class{load(t){return j(this,null,function*(){let e=er(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),R1(t,this.bmap.config)]),r=er({floor:t.floor,ts:t.ts});ir(n.map(s=>s.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(r)||0),n.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(r)||0;return this.floorDataLengthMap.set(r,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return j(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,r=e.userData.graphicMap||new Map,{ground:o,markGraphic:s,graphic:a}=this.bmap.config;for(let u=0;u<t.length;u++){let l=t[u];l.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):l.info.userData.mark?(l.info.height=s.height,l.info.fillColor=s.color,l.info.fillOpacity=s.opacity,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity):(l.info.fillOpacity=a.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=s.height,l.info.fillColor=s.color,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity))}for(let u of t){if(u.info.group==="ground")e.createGround(u.info);else{let l=e.addGraphic(u.info);l.userData.data=u,n.set(u.legacy_id,l)}r.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=r,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(pt.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(pt.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let n=e.userData.graphicMap||new Map;return t.filter(r=>!n.has(r.element_uuid))}switchFloorByStoreData(t,e){return j(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"6"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}switchFloorByOtherData(t,e){return j(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"1,2,3,4"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}loadBuildGround(t){return j(this,null,function*(){let{brand:e,project:n}=t,r=yield this.loadBuildingGround({brand:e,project:n});return this.bmap.currentBuildGround=r,this.bmap.changeBuildingCenter(r,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return j(this,null,function*(){let{brand:e,project:n}=t,r=er({brand:e,project:n});if(this.buildingGroundMap.has(r))return this.buildingGroundMap.get(r);let o=O1({brand:e,project:n},this.bmap.config).then(s=>(this.buildingGroundMap.set(r,s),s));return this.buildingGroundMap.set(r,o),o})}switchFloor(t){return j(this,null,function*(){let e=new Bt(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(n){console.log(n)}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 Eq=function(i){return i[i.D2=0]="D2",i[i.D3=1.1]="D3",i}({}),_a=class extends uF{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:r}=e,o=t?Ro(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:r,brand:n})}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 j(this,null,function*(){return this.loader||(this.loader=new xr(this),this.loader.placeConfig=T({},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){e===void 0&&(e=t.graphicLayer.children),this.triggerHooks(pt.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(pt.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:e})}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*30,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 n;let r=(n=this.context.currentFloor)==null?void 0:n.addModel(T({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(r){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;r.rotateZ((180-o)/180*Math.PI),r.scale.set(s,a,1)}}}addHeatmap(t){var e;return(e=this.context.currentFloor)==null?void 0:e.addHeatmap(t)}getLegacyToGraphicMap(){var t;return((t=this.context.currentFloor)==null?void 0:t.userData.legacyToGraphicMap)||new Map}getFloorAllGraphics(){var t;return((t=this.context.currentFloor)==null?void 0:t.graphicLayer.children.filter(e=>e instanceof et))||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let n=t.options.center,r=t.getCenter(),o=(n==null?void 0:n[0])||r.x,s=(n==null?void 0:n[1])||r.y;return console.log(o,s,n,r),this.context.currentFloor.addPoi(T({},e,{position:{x:o,y:s,z:r.z+t.options.height/2}}))}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,r){e===void 0&&(e=500),n===void 0&&(n=0),r===void 0&&(r=0);let o=t.getPosition().clone(),{context:{camera:s}}=this;if(s.updateMatrix(),r){let a=new zc;a.setFromMatrixColumn(s.matrix,1),a.normalize(),a.multiplyScalar(r/s.zoom),o.add(a)}if(n){let a=new zc;a.setFromMatrixColumn(s.matrix,0),a.normalize(),a.multiplyScalar(n/s.zoom),o.add(a)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return j(this,null,function*(){return e===void 0&&(e=500),Kt(new Promise(n=>{let r=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:s,height:a},camera:u}=this.context,c=Y(o,u,s,a).x-s/2,h=new zc;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),r.add(h),this.context.setCameraPosition(r,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:r}=this.container;return Y(e,this.context.camera,n,r)}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 j(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 n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){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){t===void 0&&(t=.1);let e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}measureDistance(){return j(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new na(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",r=>{let{distance:o}=r;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 ra(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",r=>{let{area:o}=r;t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((n=this.context.currentFloor)==null?void 0:n.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 n=Ro(this.currentBuildGround.info.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[r,o]=t.geometry.cds;t.geometry.coords=[r-n[0],o-n[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}removePoiById(t){var e,n;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(n=this.context.currentFloor)==null||n.poiLayer2.removePoiById(t)}getPoiById(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||((n=this.context.currentFloor)==null?void 0:n.poiLayer2.getPoiById(t))}getPois(){var t,e;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(n=>!n.options.built_in),...((e=this.context.currentFloor)==null?void 0:e.poiLayer2.pois)||[]]}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,tt.dispose(),ct.dispose(),an.dispose(),vt.dispose(),G.dispose(),le.dispose(),this.debounceResize=null}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 L,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:n}}=this.context;n!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=n)},this.onKeydown=n=>{this.polarKeys.includes(n.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(n.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=n=>{if(this.polarKeys.includes(n.code)){let r=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=r,this.context.control.minPolarAngle=r}if(this.azimuthalKeys.includes(n.code)){let r=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=r,this.context.control.minAzimuthAngle=r}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),r=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=r,this.context.control.minZoom=o,this.context.control.maxZoom=o*30,this.basicZoom=r,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=x1(e),this.context=new va(t,this.config),this.debounceResize=lF(this.resize,5),this.registryEvent()}};var Zq=d(I(),1);import{EventDispatcher as cF}from"three";var St=class extends cF{dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var K1=class extends St{fetchEquipment(){return j(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,r=""+t+e;yield fetch(r,n).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(s=>[s.equipment_id,s]))}),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 n=this.getGraphicEquipment(e);return n&&this.equipmentMap.has(n)}).forEach(e=>{let n=this.equipmentMap.get(this.getGraphicEquipment(e)),r=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=n,r.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(pt.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 n;(n=this.bmap.context.currentFloor)==null||n.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:n}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(n)},this.fetchEquipment(),this.bmap.addEventListener(pt.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var V$=d(ei(),1),L$=d(Ft(),1),J$=d(I(),1),B$=d(Rc(),1);var s$=d(I(),1),a$=d(R(),1);import{Mesh as MF,Object3D as PF,TextureLoader as AF,Color as jF,Vector2 as Gc,Vector3 as TF,NormalBlending as vF,RepeatWrapping as SF}from"three";var Nq=d(Fl(),1),zq=d(pi(),1),Uq=d(fi(),1),Gq=d(mi(),1),kq=d(gi(),1),Vq=d(yi(),1),Lq=d(Pi(),1),Jq=d(Ai(),1),Bq=d(ji(),1),Hq=d(Ti(),1),Qq=d(vi(),1),qq=d(Si(),1),$q=d(bi(),1),t$=d(_i(),1),e$=d(xi(),1),n$=d(R(),1),r$=d(xc(),1);import{BufferGeometry as hF,Matrix4 as z1,Vector3 as Zn,Ray as pF,Sphere as fF,LineSegments as dF,BufferAttribute as Mn,ShaderChunk as Dt,ShaderMaterial as U1,UniformsLib as mF,Color as gF,Vector2 as N1}from"three";var At=class extends hF{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 z1,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)}}})}};At.prototype.setMatrixWorld=function(i){this.matrixWorld=i};At.prototype.setGeometry=function(i,t){this._geometry=i,this.setPoints(i.getAttribute("position").array,t)};At.prototype.setPoints=function(i,t){if(!(i instanceof Float32Array)&&!(i instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=i,this.widthCallback=t,this.positions=[],this.counters=[],i.length&&i[0]instanceof Zn)for(var e=0;e<i.length;e++){var n=i[e],r=e/i.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(var e=0;e<i.length;e+=3){var r=e/i.length;this.positions.push(i[e],i[e+1],i[e+2]),this.positions.push(i[e],i[e+1],i[e+2]),this.counters.push(r),this.counters.push(r)}this.process()};function yF(i,t){var e=new z1,n=new pF,r=new fF,o=new Zn,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(this.matrixWorld),i.ray.intersectSphere(r,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(i.ray).applyMatrix4(e);var a=new Zn,u=new Zn,l=new Zn,c=this instanceof dF?2:1,h=s.index,p=s.attributes;if(h!==null)for(var f=h.array,g=p.position.array,y=p.width.array,M=0,A=f.length-1;M<A;M+=c){var S=f[M],_=f[M+1];a.fromArray(g,S*3),u.fromArray(g,_*3);var E=y[Math.floor(M/3)]!==void 0?y[Math.floor(M/3)]:1,w=i.params.Line.threshold+this.material.lineWidth*E/2,x=w*w,v=n.distanceSqToSegment(a,u,o,l);if(!(v>x)){o.applyMatrix4(this.matrixWorld);var W=i.ray.origin.distanceTo(o);W<i.near||W>i.far||(t.push({distance:W,point:l.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this}),M=A)}}}}At.prototype.raycast=yF;At.prototype.compareV3=function(i,t){var e=i*6,n=t*6;return this.positions[e]===this.positions[n]&&this.positions[e+1]===this.positions[n+1]&&this.positions[e+2]===this.positions[n+2]};At.prototype.copyV3=function(i){var t=i*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};At.prototype.getDistance=function(i){let t=0;for(let e=0;e<i;e++){let n=6*e,r=new Zn(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new Zn(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=r.distanceTo(o);t+=s}return t};At.prototype.process=function(){var i=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(i-1);var n;this.compareV3(0,i-1)?n=this.copyV3(i-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var r=0;r<i;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(r/(i-1)):t=1,this.width.push(t),this.width.push(t),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===i-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(r)/e;this.uvs.push(s,0),this.uvs.push(s,1)}if(r<i-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=r*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(i-1,0)?n=this.copyV3(1):n=this.copyV3(i-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new Mn(new Float32Array(this.positions),3),previous:new Mn(new Float32Array(this.previous),3),next:new Mn(new Float32Array(this.next),3),side:new Mn(new Float32Array(this.side),1),width:new Mn(new Float32Array(this.width),1),uv:new Mn(new Float32Array(this.uvs),2),index:new Mn(new Uint16Array(this.indices_array),1),counters:new Mn(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 Uc(i,t,e,n,r){var o;if(i=i.subarray||i.slice?i:i.buffer,e=e.subarray||e.slice?e:e.buffer,i=t?i.subarray?i.subarray(t,r&&t+r):i.slice(t,r&&t+r):i,e.set)e.set(i,n);else for(o=0;o<i.length;o++)e[o+n]=i[o];return e}At.prototype.advance=function(i){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,r=t.length;Uc(t,0,e,0,r),Uc(t,6,t,0,r-6),t[r-6]=i.x,t[r-5]=i.y,t[r-4]=i.z,t[r-3]=i.x,t[r-2]=i.y,t[r-1]=i.z,Uc(t,6,n,0,r-6),n[r-6]=i.x,n[r-5]=i.y,n[r-4]=i.z,n[r-3]=i.x,n[r-2]=i.y,n[r-1]=i.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};Dt.meshline_vert=["",Dt.logdepthbuf_pars_vertex,Dt.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;","",Dt.logdepthbuf_vertex,Dt.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Dt.fog_vertex,"}"].join(`
|
|
3911
|
+
`,n=-1/0,r=this.geometry.getAttribute("position");if(r)for(let s=0;s<r.count;s++){let a=r.getZ(s);a>n&&(n=a)}let o=new zR({uniforms:{maxZ:{value:n},uColor:{value:new u1(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new u1(Ze(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=G.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 FR(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(n=>{let{coords:r}=n.geometry;for(let o=0;o<r.length;o++){let s=r[o];for(let a=0;a<s.length;a++){let u=s[a],l=a+1===s.length?s[0]:s[a+1];t.push(new a1(u[0],u[1],e)),t.push(new a1(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new KR().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new NR(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t,e,n;(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.line)==null||n.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},Yc,n)),this.init()}};var QH=d(I(),1),qH=d(Lo(),1);import{Box2 as Xc,Object3D as UR,Sprite as l1,SpriteMaterial as c1,Vector2 as aa}from"three";import{isNil as Ki}from"lodash";var GR={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1},nt=class extends UR{get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:r,text_texture_offset_y:o}=this.options;return!Ki(t)&&!Ki(e)&&!Ki(n)&&!Ki(r)&&!Ki(o)}get deltaZ(){return!this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>j(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text_font_size",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&(this.initSize(),this._initScale({zoom:this.context.camera.zoom}))}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return j(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>j(this,null,function*(){let e;if(this.options.icon_border){let{icon:r,icon_size:o,icon_border:s}=this.options;e=yield ct.getUrlTextureBorder(r,o[0]-s.width*2,s)}else e=yield ct.getTextureByUrl(this.options.icon);let n=new l1(new c1({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));n.visible=!1,n.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(n),this.spriteIcon=n,t(n)})).then(()=>{this._initIconPromise=null})})}initText(){if(this.hasText){let t;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:r,text_texture_height:o,text_texture_offset_x:s,text_texture_offset_y:a}=this.options;t=this.options.text_texture.clone(),t.uuid=n.uuid,t.offset.set(s/t.image.width,1-(o+a)/t.image.height),t.repeat.set(r/t.image.width,o/t.image.height),this.textAspect=r/o}else{let n=tt.getTextureByText(this.options.text);t=n.texture,this.textureLines=n.lines,this.textAspect=t.image.width/t.image.height}let e=new l1(new c1({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}}initSize(){var t,e;let n=0,r=0,{icon:o}=this.options;o?this.hasText?(n=0,r=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,r=0):this.hasText?(r=.5,n=0):(n=0,r=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,r)}init(){return j(this,null,function*(){yield Promise.all([this.initIcon(),new Promise(t=>{this.initText(),t(!0)})]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:n}}=this.context,r=e*(t.x+1)/2,o=n*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let s=this.iconWidth/2,a=new Xc(new aa(r-s,o-this.iconHeight),new aa(r+s,o)),u=this.textWidth/2,l=new Xc(new aa(r-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new aa(r+u,o-this.iconHeight-this.durIconAndText));return this.box=l.union(a),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="999",n.style.border="1px solid red",n.style.pointerEvents="none",this.boxHelper=n,this.context.container.appendChild(n)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}parentSetVisible(t){this.spriteText&&(this.spriteText.visible=t),this.spriteIcon&&(this.spriteIcon.visible=t),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.clear(),this.unRegistryEvent(),this.spriteText=void 0,this.spriteIcon=void 0}constructor(t,e){var n;super(),this.context=t,this.textAspect=1,this.box=new Xc,this._initIconPromise=null,this.textureLines=1,this._initScale=o=>{let{zoom:s}=o;if(this.spriteText){let u=this.textHeight/s;this.spriteText.scale.set(this.textAspect*u,u,.1)}if(this.spriteIcon){var a;(a=this.spriteIcon)==null||a.scale.set(this.options.icon_size[0]/s,this.options.icon_size[1]/s,.1)}this.resetZ()};var r;this.options=Qn(T({},GR,e,{text:(r=(n=e.text)==null?void 0:n.trim())!=null?r:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var s5=d(Lo(),1);import{DoubleSide as kR,Matrix4 as h1,Mesh as VR,MeshBasicMaterial as LR,Object3D as JR,PlaneGeometry as BR}from"three";import{mergeGeometries as HR}from"three/examples/jsm/utils/BufferGeometryUtils";var QR={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},ua=class extends JR{init(){return j(this,null,function*(){let t=this.options.map(s=>tt.getTextureByText(s.texts[0],{fillStyle:j0(s.fillColor,s.fillOpacity),strokeStyle:j0(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"bold 54px sans-serif",maxWidth:2048})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.texture.image,h=l/c,p=u.secondHeight*h,f=new BR(p,u.secondHeight),g=new h1().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new h1().makeRotationZ(u.secondRotate));return f.applyMatrix4(g),f}),n=HR(e,!0);e.forEach(s=>s.dispose());let r=t.map(s=>{let{texture:a}=s,u=new LR({map:a,alphaTest:1,side:kR});return a.needsUpdate=!0,u}),o=new VR(n,r);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e,n;(t=this.mesh)==null||t.geometry.dispose(),(n=this.mesh)==null||(e=n.material)==null||e.forEach(r=>r.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},QR,n)).filter(n=>n.texts[0].trim()),this.options.length&&this.init()}};import{Object3D as qR}from"three";import{Line2 as $R}from"three/examples/jsm/lines/Line2";import{LineGeometry as t9}from"three/examples/jsm/lines/LineGeometry";import{LineMaterial as e9}from"three/examples/jsm/lines/LineMaterial";var Ni=class extends qR{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 $R(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&q(this.line),this.lineGeometry=null,this.lineMaterial=null,this.clear(),(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,n){super(),this.context=t,this.lineGeometry=new t9,this.lineMaterial=new e9({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:r,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(r,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};import{Frustum as n9}from"three";var la=class extends Ht{setEnable(t){super.setEnable(t),gt(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:n,clientHeight:r}}}=this,o=Y(this.startPoint,e,n,r),s=Y(this.endPoint,e,n,r),a={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},u={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},l=this.searchMapInFrustum(a,u);this.dispatchEvent({type:"selected",list:l})}}searchMapInFrustum(t,e){var n;let{context:r}=this;return((n=r.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof et&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:r,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let f=Y(p,r,o,s);return nn(f,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:u,max:l}=a,c=Y(u,r,o,s),h=Y(l,r,o,s);return!(!nn(c,e,n)||!nn(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new n9,this.onPointerDown=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=r=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o)},this.onPointerUp=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let r=this.getSvgCoordinate(this.startPoint),o=T({},r);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(r.x,o.x),y:Math.min(r.y,o.y)},a=Math.abs(o.x-r.x),u=Math.abs(o.y-r.y);gt(this.rect,s.x,s.y,a,u)}else gt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=rn(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var ca=class extends r9{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:n,offsetY:r}=e,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-n)**2+(s-r)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,r),u=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(n,r).forEach(c=>{if(!u.has(c.options.id)){var h;let p=((h=this.context.currentFloor)==null?void 0:h.graphicLayer.graphicMap.get(c.options.id))||null;p&&p.options.geometry.type==="point"&&(a.push(p),u.add(c.options.id))}}),($n?e.metaKey:e.ctrlKey)||this._list.clear(),a.forEach(c=>this._list.add(c)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{tr(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{tr(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(r=>{this._list.add(r)}),this.selectEnd()},this.boxSelection=new la(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var O5=d(me(),1),R5=d(ge(),1),F5=d(ye(),1),K5=d(Me(),1),N5=d(Pe(),1),z5=d(Ae(),1),U5=d(je(),1),G5=d(I(),1);import{EventDispatcher as i9,Vector2 as o9}from"three";var ha=class extends i9{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 L,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:n,pois:r,e:o}=e,s=r.map(c=>{var h;return(h=this.context.currentFloor)==null?void 0:h.graphicLayer.graphicMap.get(c.options.id)}).filter(c=>c&&c.options.geometry.type==="point");if(!n.length&&!s.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:a}=this.context.config.hover,u=new Set;if(s.length){let c,h=1e4;s.forEach(p=>{let f=r.find(g=>g.options.id===p.options.id);if(f instanceof Cn){let{x:g,y}=f.clientPos,M=Math.sqrt((g-o.offsetX)**2+(y-o.offsetY)**2);M<h&&(h=M,c=p)}else if(f instanceof nt){let{x:g,y}=f.box.getCenter(new o9),M=Math.sqrt((g-o.offsetX)**2+(y-o.offsetY)**2);M<h&&(h=M,c=p)}}),u.add(c)}u.size||n.forEach(c=>u.add(c)),u.forEach(c=>{if(this.graphicTimerMap.get(c)||this.curGraphics.has(c))return;let h=this.timer.setTimeout(()=>{this.curGraphics.add(c),this.graphicTimerMap.delete(c),this.timer.clearTimeout(h),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(c,h)}),this.graphicTimerMap.forEach((c,h)=>{u.has(h)||(this.timer.clearTimeout(c),this.graphicTimerMap.delete(h))});let l=this.curGraphics.size;this.curGraphics.forEach(c=>{u.has(c)||this.curGraphics.delete(c)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()},this.onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()},this.onBodyPointerMove=e=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)&&this.onPointerLevel()}},this.registryEvent()}};var B5=d(I(),1);import{Box3 as s9,Vector3 as pa}from"three";var fa=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 Bt).length)return null;let e=this.box,{camera:n,clientSize:{width:r,height:o}}=this.context,{min:s,max:a}=e,u=Y(s,n,r,o),l=Y(a,n,r,o),c=Y(new pa(s.x,a.y,a.z),n,r,o),h=Y(new pa(a.x,s.y,s.z),n,r,o),p=Math.min(u.x,l.x,c.x,h.x),f=Math.max(u.x,l.x,c.x,h.x),g=Math.min(u.y,l.y,c.y,h.y),y=Math.max(u.y,l.y,c.y,h.y);return{left:p,right:f,top:g,bottom:y}}checkDistanceToScreenEdge(t){let{left:e,right:n,top:r,bottom:o}=t,{width:s,height:a}=this.context.clientSize,[u,l,c,h]=this.context.config.cameraBound.padding,p=n>=h,f=s-e>=l,g=a-r>=c,y=o>=u;return p&&f&&g&&y}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new pa,zoom:1,target:new pa},this.enable=!0,this.box=new s9,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:n,right:r,top:o,bottom:s}=e;this.checkDistanceToScreenEdge({left:n,right:r,top:o,bottom:s})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var cQ=d(Rc(),1);import{Vector3 as _1}from"three";import{Tween as Ma,Group as x9}from"@tweenjs/tween.js";var sQ=d(I(),1),aQ=d(R(),1);import{EventDispatcher as v9,MOUSE as br,Quaternion as b1,Spherical as ma,TOUCH as wr,Vector2 as Yt,Vector3 as Qt,Plane as S9,Ray as b9,MathUtils as w9}from"three";var ga=new b9,w1=new S9,_9=Math.cos(70*w9.DEG2RAD),ya=class extends v9{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 Yt,this.rotateLineEnd=new Yt,this.spherical=new ma,this.sphericalDelta=new ma,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Qt,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:br.PAN,MIDDLE:br.DOLLY,RIGHT:br.ROTATE},this.touches={ONE:wr.PAN,TWO:wr.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 a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(P){P.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=P},this.stopListenToKeyEvents=function(){var P;(P=this._domElementKeyEvents)==null||P.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent({type:"change"}),n.update(),o=r.NONE},this.update=function(){let P=new Qt,b=new b1().setFromUnitVectors(t.up,new Qt(0,1,0)),U=b.clone().invert(),H=new Qt,_t=new b1,pe=new Qt,qt=2*Math.PI;return function(Yr){Yr===void 0&&(Yr=null);let xe=n.object.position;P.copy(xe).sub(n.target),P.applyQuaternion(b),a.setFromVector3(P),n.autoRotate&&o===r.NONE&&X(F(Yr)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let We=n.minAzimuthAngle,Ie=n.maxAzimuthAngle;isFinite(We)&&isFinite(Ie)&&(We<-Math.PI?We+=qt:We>Math.PI&&(We-=qt),Ie<-Math.PI?Ie+=qt:Ie>Math.PI&&(Ie-=qt),We<=Ie?a.theta=Math.max(We,Math.min(Ie,a.theta)):a.theta=a.theta>(We+Ie)/2?Math.max(We,a.theta):Math.min(Ie,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),n.zoomToCursor&&x||n.object.isOrthographicCamera?a.radius=wt(a.radius):a.radius=wt(a.radius*l),P.setFromSpherical(a),P.applyQuaternion(U),xe.copy(n.target).add(P),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),c.set(0,0,0));let Li=!1;if(n.zoomToCursor&&x){let Dr=null;if(n.object.isPerspectiveCamera){let Cr=P.length();Dr=wt(Cr*l);let Ji=Cr-Dr;n.object.position.addScaledVector(E,Ji),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let Cr=new Qt(w.x,w.y,0);Cr.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Li=!0;let Ji=new Qt(w.x,w.y,0);Ji.unproject(n.object),n.object.position.sub(Ji).add(Cr),n.object.updateMatrixWorld(),Dr=P.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Dr!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Dr).add(n.object.position):(ga.origin.copy(n.object.position),ga.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(ga.direction))<_9?t.lookAt(n.target):(w1.setFromNormalAndCoplanarPoint(n.object.up,n.target),ga.intersectPlane(w1,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Li=!0);return l=1,x=!1,Li||H.distanceToSquared(n.object.position)>s||8*(1-_t.dot(n.object.quaternion))>s||pe.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),H.copy(n.object.position),_t.copy(n.object.quaternion),pe.copy(n.target),Li=!1,!0):!1}}();let n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=r.NONE,s=1e-6,a=new ma,u=new ma,l=1,c=new Qt,h=new Yt,p=new Yt,f=new Yt,g=new Yt,y=new Yt,M=new Yt,A=new Yt,S=new Yt,_=new Yt,E=new Qt,w=new Yt,x=!1,v=[],W={};function F(P){return P!==null?2*Math.PI/60*n.autoRotateSpeed*P:2*Math.PI/60/60*n.autoRotateSpeed}function D(){return Math.pow(.95,n.zoomSpeed)}function X(P){u.theta-=P}function rt(P){u.phi-=P}let st=function(){let P=new Qt;return function(U,H){P.setFromMatrixColumn(H,0),P.multiplyScalar(-U),c.add(P)}}(),bt=function(){let P=new Qt;return function(U,H){n.screenSpacePanning===!0?P.setFromMatrixColumn(H,1):(P.setFromMatrixColumn(H,0),P.crossVectors(n.object.up,P)),P.multiplyScalar(U),c.add(P)}}(),Ct=function(){let P=new Qt;return function(U,H){let _t=n.domElement;if(n.object.isPerspectiveCamera){let pe=n.object.position;P.copy(pe).sub(n.target);let qt=P.length();qt*=Math.tan(n.object.fov/2*Math.PI/180),st(2*U*qt/_t.clientHeight,n.object.matrix),bt(2*H*qt/_t.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(st(U*(n.object.right-n.object.left)/n.object.zoom/_t.clientWidth,n.object.matrix),bt(H*(n.object.top-n.object.bottom)/n.object.zoom/_t.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Rn(P){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ir(P){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Er(P){if(!n.zoomToCursor)return;x=!0;let b=n.domElement.getBoundingClientRect(),U=P.clientX-b.left,H=P.clientY-b.top,_t=b.width,pe=b.height;w.x=U/_t*2-1,w.y=-(H/pe)*2+1,E.set(w.x,w.y,1).unproject(n.object).sub(n.object.position).normalize()}function wt(P){return Math.max(n.minDistance,Math.min(n.maxDistance,P))}function qc(P){h.set(P.clientX,P.clientY)}function hT(P){Er(P),A.set(P.clientX,P.clientY)}function $c(P){g.set(P.clientX,P.clientY)}function pT(P){p.set(P.clientX,P.clientY),f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let b=n.domElement;X(2*Math.PI*f.x/b.clientHeight),rt(2*Math.PI*f.y/b.clientHeight),h.copy(p),n.update()}function fT(P){S.set(P.clientX,P.clientY),_.subVectors(S,A),_.y>0?Rn(D()):_.y<0&&Ir(D()),A.copy(S),n.update()}function dT(P){y.set(P.clientX,P.clientY),M.subVectors(y,g).multiplyScalar(n.panSpeed),Ct(M.x,M.y),g.copy(y),n.update()}function mT(P){Er(P),P.deltaY<0?Ir(D()):P.deltaY>0&&Rn(D()),n.update()}function gT(P){let b=!1;switch(P.code){case n.keys.UP:P.ctrlKey||P.metaKey||P.shiftKey?rt(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ct(0,n.keyPanSpeed),b=!0;break;case n.keys.BOTTOM:P.ctrlKey||P.metaKey||P.shiftKey?rt(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ct(0,-n.keyPanSpeed),b=!0;break;case n.keys.LEFT:P.ctrlKey||P.metaKey||P.shiftKey?X(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ct(n.keyPanSpeed,0),b=!0;break;case n.keys.RIGHT:P.ctrlKey||P.metaKey||P.shiftKey?X(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ct(-n.keyPanSpeed,0),b=!0;break}b&&(P.preventDefault(),n.update())}function th(){if(v.length===1)h.set(v[0].pageX,v[0].pageY);else{let P=(v[0].pageX-v[0].pageY)/(v[1].pageX-v[1].pageY),b=v[0].pageY-P*v[0].pageX;n.rotateLineStart.set(P,b);let U=.5*(v[0].pageX+v[1].pageX),H=.5*(v[0].pageY+v[1].pageY);h.set(U,H)}}function eh(){if(v.length===1)g.set(v[0].pageX,v[0].pageY);else{let P=.5*(v[0].pageX+v[1].pageX),b=.5*(v[0].pageY+v[1].pageY);g.set(P,b)}}function nh(){let P=v[0].pageX-v[1].pageX,b=v[0].pageY-v[1].pageY,U=Math.sqrt(P*P+b*b);A.set(0,U)}function yT(){n.enableZoom&&nh(),n.enablePan&&eh()}function MT(){n.enableZoom&&nh(),n.enableRotate&&th()}function rh(P){if(v.length==1)p.set(P.pageX,P.pageY);else{let U=Ga(P),H=.5*(P.pageX+U.x),_t=.5*(P.pageY+U.y);p.set(H,_t);let pe=(P.pageY-U.y)/(P.pageX-U.x),qt=U.y-pe*U.x;if(n.rotateLineEnd.set(pe,qt),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let ka=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Yr=pe*ka+qt;if(Number.isFinite(ka)&&Number.isFinite(Yr)){let xe=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(xe)<.5&&(xe=-Math.sign(xe)*(Math.PI-Math.abs(xe))),Math.abs(xe)<.1&&(u.theta+=xe)}}n.rotateLineStart.copy(n.rotateLineEnd)}f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let b=n.domElement;rt(2*Math.PI*f.y/b.clientHeight),h.copy(p)}function ih(P){if(v.length===1)y.set(P.pageX,P.pageY);else{let b=Ga(P),U=.5*(P.pageX+b.x),H=.5*(P.pageY+b.y);y.set(U,H)}M.subVectors(y,g).multiplyScalar(n.panSpeed),Ct(M.x,M.y),g.copy(y)}function oh(P){let b=Ga(P),U=P.pageX-b.x,H=P.pageY-b.y,_t=Math.sqrt(U*U+H*H);S.set(0,_t),_.set(0,Math.pow(S.y/A.y,n.zoomSpeed)),Rn(_.y),A.copy(S)}function PT(P){n.enableZoom&&oh(P),n.enablePan&&ih(P)}function AT(P){n.enableZoom&&oh(P),n.enableRotate&&rh(P)}this.onPointerDown=function(b){n.enabled!==!1&&(v.length===0&&(n.domElement.setPointerCapture(b.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),bT(b),b.pointerType==="touch"?vT(b):jT(b))},this.onPointerMove=function(b){n.enabled!==!1&&(b.pointerType==="touch"?ST(b):TT(b))},this.onPointerUp=function(b){wT(b),v.length===0&&(n.domElement.releasePointerCapture(b.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=r.NONE};function jT(P){let b;switch(P.button){case 0:b=n.mouseButtons.LEFT;break;case 1:b=n.mouseButtons.MIDDLE;break;case 2:b=n.mouseButtons.RIGHT;break;default:b=-1}switch(b){case br.DOLLY:if(n.enableZoom===!1)return;hT(P),o=r.DOLLY;break;case br.ROTATE:if(P.ctrlKey||P.metaKey||P.shiftKey){if(n.enablePan===!1)return;$c(P),o=r.PAN}else{if(n.enableRotate===!1)return;qc(P),o=r.ROTATE}break;case br.PAN:if(P.ctrlKey||P.metaKey||P.shiftKey){if(n.enableRotate===!1)return;qc(P),o=r.ROTATE}else{if(n.enablePan===!1)return;$c(P),o=r.PAN}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent({type:"start"})}function TT(P){switch(o){case r.ROTATE:if(n.enableRotate===!1)return;pT(P);break;case r.DOLLY:if(n.enableZoom===!1)return;fT(P);break;case r.PAN:if(n.enablePan===!1)return;dT(P);break}}this.onMouseWheel=function(b){n.enabled===!1||n.enableZoom===!1||o!==r.NONE||(b.preventDefault(),n.dispatchEvent({type:"start"}),mT(b),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(b){n.enabled===!1||n.enablePan===!1||gT(b)};function vT(P){switch(sh(P),v.length){case 1:switch(n.touches.ONE){case wr.ROTATE:if(n.enableRotate===!1)return;th(),o=r.TOUCH_ROTATE;break;case wr.PAN:if(n.enablePan===!1)return;eh(),o=r.TOUCH_PAN;break;default:o=r.NONE}break;case 2:switch(n.touches.TWO){case wr.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;yT(),o=r.TOUCH_DOLLY_PAN;break;case wr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;MT(),o=r.TOUCH_DOLLY_ROTATE;break;default:o=r.NONE}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent({type:"start"})}function ST(P){switch(sh(P),o){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;rh(P),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;ih(P),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;PT(P),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;AT(P),n.update();break;default:o=r.NONE}}this.onContextMenu=function(b){n.enabled!==!1&&b.preventDefault()};function bT(P){v.push(P)}function wT(P){delete W[P.pointerId];for(let b=0;b<v.length;b++)if(v[b].pointerId==P.pointerId){v.splice(b,1);return}}function sh(P){let b=W[P.pointerId];b===void 0&&(b=new Yt,W[P.pointerId]=b),b.set(P.pageX,P.pageY)}function Ga(P){let b=P.pointerId===v[0].pointerId?v[1]:v[0];return W[b.pointerId]}n.domElement.addEventListener("contextmenu",this.onContextMenu),n.domElement.addEventListener("pointerdown",this.onPointerDown),n.domElement.addEventListener("pointercancel",this.onPointerUp),n.domElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),this.update()}};var Pa=class extends ya{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:n,minPolarAngle:r}=this,o=n===r;(e||t<=n&&t>=r)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=n,this.minPolarAngle=r)}setPolarAngleByDuration(t,e,n){return j(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):Kt(new Promise(r=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new Ma(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),r(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:n,minAzimuthAngle:r}=this,o=n===r;(e||t<=n&&t>=r)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=n,this.minAzimuthAngle=r)}setAzimuthalAngleDuration(t,e,n){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setAzimuthalAngle(t,e):Kt(new Promise(r=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new Ma(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),r(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}getCameraLookAt(){return new _1().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return j(this,null,function*(){let n=this.target.clone(),r=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(r)),this.target.copy(t.clone()),this.update();return}return Kt(new Promise(o=>{let s=new Ma(n,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(n.clone().sub(r)),this.target.copy(n.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(s),this.enabled=!0,o(!0)}).onStart(()=>{this.enabled=!1}).start()}),e+500)})}setZoom(t,e,n){n===void 0&&(n=!1);let{minZoom:r,maxZoom:o}=this;(n||t>=r&&t<=o)&&(this.camera.position.copy(e.clone().sub(this.getCameraLookAt())),this.target.copy(e),this.camera.zoom=t,this.update())}setZoomByDuration(t,e,n,r){return j(this,null,function*(){n===void 0&&(n=!1),r===void 0&&(r=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return r?Kt(new Promise(s=>{let a=new Ma(o,this.tweenGroup).to({zoom:t,target:e},r).onUpdate(()=>{this.setZoom(o.zoom,o.target,n)}).onComplete(()=>{this.tweenGroup.remove(a),this.enabled=!0,s(!0)}).onStart(()=>{this.enabled=!1}).start()}),r+500).finally(()=>{this.enabled=!0}):this.setZoom(t,e,n)})}setTargetByOffset(t,e){if(e===void 0&&(e=this.target.clone()),this.camera.updateMatrix(),t){let n=new _1;n.setFromMatrixColumn(this.camera.matrix,1),n.normalize(),n.multiplyScalar(t/this.camera.zoom),e.add(n)}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,n){super(e,n),this.context=t,this.camera=e,this.domElement=n,this.prevCameraZoom=1,this.tweenGroup=new x9,this.offsetY=0,this.onChange=()=>{let r=this.camera.zoom;r!==this.prevCameraZoom&&(this.prevCameraZoom=r,this.dispatchEvent({type:"change-zoom",zoom:r}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};import{EventDispatcher as W9,PCFSoftShadowMap as I9,WebGLRenderer as E9}from"three";var Aa=class extends E9{setCameraAndScene(t,e){this.scene=t,this.camera=e}autoRender(){this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.timer.requestAnimationFrame(()=>{this.autoRender()})}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(t,e){this.event.addEventListener(t,e)}removeEventListener(t,e){this.event.removeEventListener(t,e)}dispose(){this.timer.dispose(),this.enable=!1,super.dispose(),this.domElement=null}constructor(t){super(T({antialias:!0,alpha:!0},t)),this.event=new W9,this.enable=!0,this.timer=new L,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=I9}};import{Euler as Y9,Matrix4 as D9,Scene as C9,EquirectangularReflectionMapping as X9}from"three";import{RGBELoader as Z9}from"three/examples/jsm/loaders/RGBELoader.js";var ja=class extends C9{constructor(){super(),new Z9().load(Jj,t=>{t.mapping=X9,this.environment=t;let e=new D9;e.makeRotationX(Math.PI/2),this.environmentRotation=new Y9().setFromRotationMatrix(e)})}};import{OrthographicCamera as O9}from"three";var Ta=class extends O9{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 va=class extends R9{resizeClientSize(){let{x:t,y:e,width:n,height:r}=this.container.getBoundingClientRect();this.clientSize={width:n||this.container.clientWidth,height:r||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new Ta(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new Pa(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 fa(this)}getRatio(t,e){t===void 0&&(t=new ke(0,0,0)),e===void 0&&(e=new ke(100,0,0));let{clientWidth:n,clientHeight:r}=this.container,o=Y(t,this.camera,n,r),s=Y(e,this.camera,n,r);return Math.ceil(Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof U9&&(e.color=new z9(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let e=t.getCenter();e&&(this.lights.position.x=e.x,this.lights.position.y=e.y),this.cameraBound.updateBox()}getGraphicsByDeviceXy(t,e){var n;let r=new _r;r.x=t/this.clientSize.width*2-1,r.y=e/this.clientSize.height*-2+1;let o=new K9;return o.setFromCamera(r,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),((n=this.currentFloor)==null?void 0:n.graphicLayer.getGraphicByRaycaster(o))||{graphics:[],position:null}}getPoisByDeviceXy(t,e){var n,r;let o=(n=this.currentFloor)==null?void 0:n.poiLayer.getPoiByDeviceXy(t,e),s=(r=this.currentFloor)==null?void 0:r.poiLayer2.getPoiByDeviceXy(t,e);return(o||[]).concat(s||[])}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,n){return n===void 0&&(n=500),this.control.setZoomByDuration(t,e,!0,n)}getFitCameraToObjectZoom(t,e,n,r){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),r===void 0&&(r=!0);let[o,s,a,u]=e,{clientSize:{width:l,height:c}}=this,h=this.control.getPolarAngle();r&&this.setPolarAngle(0,0);let p=new N9().setFromObject(t);this.setPolarAngle(h,0);let{max:f,min:g}=p,y=new ke(g.x,f.y,f.z),M=new ke(f.x,f.y,f.z),A=new ke(f.x,g.y,g.z),S=new ke(g.x,g.y,g.z),_=Y(y,this.camera,l,c),E=Y(M,this.camera,l,c),w=Y(S,this.camera,l,c),x=Y(A,this.camera,l,c),W=new F9().setFromPoints([new _r(_.x,_.y),new _r(E.x,E.y),new _r(w.x,w.y),new _r(x.x,x.y)]).getSize(new _r),F=(l-s-u)/W.x,D=(c-o-a)/W.y,X=Math.min(F,D),rt=new ke((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2),st=X*this.camera.zoom,bt=this.camera.clone();bt.zoom=st,bt.updateMatrix();let Ct=(l-W.x*X)/2,Rn=(c-W.y*X)/2,Ir=(s-u)/2,Er=(o-a)/2;if(Ir){let wt=new ke;wt.setFromMatrixColumn(bt.matrix,0),wt.normalize(),wt.multiplyScalar(Ir/st),rt.add(wt)}if(Er){let wt=new ke;wt.setFromMatrixColumn(bt.matrix,1),wt.normalize(),wt.multiplyScalar(Er/st),rt.add(wt)}return{zoom:X*this.camera.zoom,center:rt}}fitCameraToObject(t,e,n,r){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),r===void 0&&(r=!0);let{zoom:o,center:s}=this.getFitCameraToObjectZoom(t,e,n,r);return this.setZoom(o,s,n)}getFitCameraToGroundZoom(t,e,n){if(t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),n===void 0&&(n=!0),this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,e,n).zoom}fitCameraToGround(t,e,n){return t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),n===void 0&&(n=!0),this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundLayer,t,e,n):Promise.resolve(!1)}setCameraPosition(t,e){return j(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){var t;(t=this.currentFloor)==null||t.dispose(),this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.renderer.dispose(),this.lights.children.forEach(e=>e.dispose()),q(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new ja,this.renderer=new Aa,this.lights=Gm(),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=n=>{let{zoom:r}=n;this.dispatchEvent({type:"control-zoom-change",zoom:r})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:r,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),r.left=-s/2,r.right=s/2,r.top=a/2,r.bottom=-a/2,r.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);r.length&&this.dispatchEvent({type:"graphic-click",graphics:r,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:r,pois:s,position:o})},this.onPointermove=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:r,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:r,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:r,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:r}=n;this.dispatchEvent({type:"hover",graphics:r})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new ca(this),this.hoverHelper=new ha(this),this.resizeClientSize(),this.registryEvent()}};import{merge as G9}from"lodash";var k9={placeId:0,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:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},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}};function x1(i){return G9({},k9,i)}import{debounce as lF}from"lodash";var $Q=d(I(),1);var ce;function W1(i,t){return i===void 0&&(i="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(ce)return e({db:ce,type:"success"});let r=indexedDB.open(i,t);r.onupgradeneeded=function(o){ce=o.target.result,console.log("onupgradeneeded"),e({db:ce,type:"onupgradeneeded"})},r.onsuccess=o=>{ce=o.target.result,e({db:ce,type:"success"})},r.onerror=o=>{n(o)}})}function Fc(i,t,e){return e===void 0&&(e=ce),new Promise((n,r)=>{e||r("\u6CA1\u6709db");let s=e.transaction([i],"readonly").objectStore(i).get(t);s.onsuccess=()=>{s.result?n(s.result.value):n(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),n(null)}})}function I1(i,t,e,n){return n===void 0&&(n=ce),new Promise((r,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>j(this,null,function*(){let u=yield Fc(i,t),l=n.transaction([i],"readwrite").objectStore(i),c=u!==null?l.put({key:t,value:e}):l.add({key:t,value:e});c.onsuccess=function(h){s(h)},c.onerror=function(h){a(h)}}))))}function Xn(i,t){t===void 0&&(t=ce),t&&(t.objectStoreNames.contains(i)||t.createObjectStore(i,{keyPath:"key"}))}function E1(i){i===void 0&&(i=ce),i==null||i.close(),ce=null}import{Vector3 as iF,Color as oF}from"three";var kQ=d(R(),1),VQ=d(I(),1);function Sa(i,t){let e=i.poi_info.showName||i.store_name||i.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=i.store_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var r;return((r=i.store_info_ext)==null?void 0:r.traditional_name)||e}}function ba(i,t){let e=i.poi_info.showName||i.store_name||i.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=i.infra_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var r;return((r=i.infra_info_ext)==null?void 0:r.traditional_name)||e}}function Y1(i,t,e){switch(i.l_type){case"graph":return V9(i,t);case"wall":return L9(i,t);case"lane":return J9(i,t);case"texture2d":case"texture3d":return B9(i,t);case"glb":return H9(i,t);case"store":return Q9(i,t);case"facility":return $9(i,t);case"parkingSpace":return eF(i,t,e);case"text":return rF(i,t)}}function D1(i,t,e,n){switch(i.l_type){case"store":return q9(i,t,e,n);case"facility":return tF(i,t,e,n);case"parkingSpace":return nF(i,t,n)}}function V9(i,t){let e=i.elements.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=r,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(r):n[h]=[r],n},{});Object.values(e).forEach(n=>{let r=new Sr(t.context,n);t.mergeGraphicLayer.add(r)})}function L9(i,t){let e=i.elements.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l}=r,c=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l;return u===0&&(c=o.toLowerCase()+"-"+s+"-"+l),n[c]?n[c].push(r):n[c]=[r],n},{});Object.values(e).forEach(n=>{let r=new ia(t.context,n);t.wallLayer.add(r)})}function J9(i,t){let e=i.elements.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u}=r,l=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u;return u===0&&(l=o.toLowerCase()+"-"+s),n[l]?n[l].push(r):n[l]=[r],n},{});Object.values(e).forEach(n=>{let r=new sa(t.context,n);t.laneLayer.add(r)})}function B9(i,t){if(i.elements.length){let e=new vr(t.context,i.elements);t.textureLayer.add(e)}}function H9(i,t){i.elements.forEach(e=>{let n=new oa(t.context,T({},e,{url:e.secondUrl,rotate:e.secondRotate,width:e.secondWidth,center_x:e.center_coord_x,center_y:e.center_coord_y}));t.glbModelLayer.add(n)})}function Q9(i,t){i.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function q9(i,t,e,n){i.elements.map(r=>{try{let o=Sa(r,e),s=new nt(t.context,{id:r.id,icon:r.poi_info.showImageUrl||r.poi_info.icon,text:o,position:{x:r.center_coord_x,y:r.center_coord_y,z:r.airHeight+r.height},icon_size:[24,24],level:r.poi_info.level||0,hide_text:!n.showStoreName,maxWeight:r.poi_info.maxWeight||25,minWeight:r.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(s),s&&(s.userData.type="store",s.userData.data=r,s.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,r)}})}function $9(i,t){i.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function tF(i,t,e,n){i.elements.filter(o=>o.poi_info).map(o=>{try{let s=ba(o,e),a=new nt(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:s,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:!n.showFacilityName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(a),a.userData.type="facility",a.userData.data=o,a.userData.floor=t.name}catch(s){console.log("\u6DFB\u52A0facility\u5931\u8D25",s,o)}})}function eF(i,t,e){t.parkingSpaceLayer.createParkings(i.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function nF(i,t,e){return j(this,null,function*(){let n=i.elements.filter(s=>s.texts[0]),r=n.map(s=>s.texts[0]),o=yield tt.lazyGetTextureByTexts(r,{height:64});n.forEach(s=>{try{let a=s.texts[0],u=new nt(t.context,{id:s.id,text:a,position:{x:s.center_coord_x,y:s.center_coord_y,z:s.airHeight+s.height},text_texture:o[a].texture,text_texture_width:o[a].width,text_texture_height:o[a].height,text_texture_offset_x:o[a].x,text_texture_offset_y:o[a].y,text_font_size:e.textFontSize});u&&(u.userData.type="parkingSpace",u.userData.data=s,u.userData.floor=t.name),t.poiLayer2.pushPoi(u)}catch(a){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",a,s)}}),Object.values(o).forEach(s=>{s.texture.dispose()})})}function rF(i,t){let e=new ua(t.context,i.elements.map(n=>T({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var C1="map_version",X1="route_version",Z1="facility_version",Kc="map_data",wa="road_network_data",Nc="facility_data",sF={mergeParkingSpace:!0},xr=class extends ft{initDb(){return j(this,null,function*(){try{let{db:t,type:e}=yield W1("aibee_map",2);e==="onupgradeneeded"&&(Xn(C1),Xn(X1),Xn(Z1),Xn(Kc),Xn(wa),Xn(Nc)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return j(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=T({},this.placeConfig,e));else{let n=yield fetch(t).then(r=>r.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=T({},this.placeConfig,JSON.parse(n.data.config||"{}")))}this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return this.initDbPromise.then(()=>I1(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Fc(t,""+e,this.db))}getFloorCacheKey(t){return t.floor_id+"_"+t.version_id}getFloorData(t){return j(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return j(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=Sa(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=ba(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return j(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>j(this,null,function*(){let r=this.getFloorCacheKey(t),o=yield fetch(t.map_url).then(s=>s.json());o.floor=t.floor,this.setCacheData(Kc,r,o),this.setCacheData(C1,r,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return j(this,null,function*(){let e=this.floors.find(r=>r.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{let r=yield this.getCacheData(Kc,n);return r||this.getFloorJsonDataByFloorInfo(e)}catch(r){return console.log("[get floor data error]",r),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return j(this,null,function*(){return(yield Promise.all(this.floors.map(e=>j(this,null,function*(){let n=this.getFloorCacheKey(e);try{let r=yield this.getCacheData(wa,n);if(r)return r;let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(wa,n,o),this.setCacheData(X1,n,e.version_id),o}catch(r){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(wa,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return j(this,null,function*(){let t=this.floors.reduce((r,o)=>r.updated_at>o.updated_at?r:o,this.floors[0]);if(!t)return null;let e=this.getFloorCacheKey(t),n=()=>j(this,null,function*(){let r=yield fetch(t.entry_infra_url).then(o=>o.json());return r&&(this.setCacheData(Nc,e,r),this.setCacheData(Z1,e,t.version_id)),r});try{let r=yield this.getCacheData(Nc,e);return r||n()}catch(r){return console.log("[get facility error]",r),n()}})}getOtherDataByFreeTime(){return j(this,null,function*(){for(let t=0;t<this.floors.length;t++){let e=this.floors[t];this.getFloorJsonData(e.floor)}})}getMulFloorsData(t){return j(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return j(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return j(this,null,function*(){return e=this.getFloorBaseLayer(t,e),n=T({},this.placeConfig,n),t.layers.forEach(r=>{["range","ground"].includes(r.l_type)||ir(r.elements,e.userData.center)}),yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,n),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new iF),r=Math.max(n.x,n.y,n.z);e.userData.height=r/4+t.floorHeight}switchFloor(t,e){return j(this,null,function*(){return new Promise(n=>{let r={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(r),s=a=>{let{task:u,res:l}=a;u.tid===o&&(this.taskQueue.removeEventListener("active-task-end",s),n(l))};this.taskQueue.addEventListener("active-task-end",s)})})}_switchFloor(t,e){return j(this,null,function*(){var n;let r=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)r=l;else return null}e=T({},this.placeConfig,e);let o=new Bt(this.bmap.context);o.userData.data=t;let s=this.floors.find(l=>l.floor===r.floor);var a;let u=(a=s==null?void 0:s.map_angle)!=null?a:0;return this.bmap.dispatchEvent({type:pt.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:r}}),this.bmap.context.scene.background=new oF(e.backgroundColor),this.getFloorBaseLayer(r,o),this.changeFloorBox(r,o),this.bmap.buildingCenter=o.userData.center,this.bmap.currentBuildGround=(n=o.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(o),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(u/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),r.layers.forEach(l=>{["range","ground"].includes(l.l_type)||ir(l.elements,o.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:pt.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield Go(),yield this.getFloorContentLayer(r,o),this.changeFloorBox(r,o),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield Zg(2),yield this.getFloorPoi(r,o,e),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:pt.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new Bt(this.bmap.context));let n=[0,0];return t.layers.forEach(r=>{switch(r.l_type){case"range":let o=r.elements[0];n=[o.center_x,o.center_y];break;case"ground":ir(r.elements,n);let s=r.elements.map(a=>new et(this.bmap.context,a));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return j(this,null,function*(){e||(e=new Bt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let r=0;r<t.layers.length;r++){let o=t.layers[r];["range","ground"].includes(o.l_type)||(Y1(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Go(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return j(this,null,function*(){n===void 0&&(n=this.placeConfig);let r=Date.now();yield Promise.all(t.layers.map(s=>D1(s,e,this.locale,n))),console.log("poi time",Date.now()-r);let o=Date.now();Go().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return j(this,null,function*(){var t;E1((t=this.db)!=null?t:void 0)})}dispose(){super.dispose(),this.clear(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new or,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=T({},sF,e),this.placeConfig=T({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var pq=d(I(),1);function O1(i,t){return j(this,null,function*(){let{brand:e,project:n}=i,{apiDomain:r,apiPath:{floorRange:o},apiInfo:s}=t,a=""+r+o+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(a,s).then(l=>l.json()).then(l=>l.data).then(l=>{let c=(l||[])[0];return c&&(c.info=JSON.parse(c.info)),c})})}function R1(i,t){return j(this,null,function*(){let{brand:e,project:n,floor:r,ts:o,resource_type_list:s}=i,{apiDomain:a,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+a+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+r+"&ts="+o+"&resource_type_list="+s;return yield fetch(c,l).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))})}function uq(i,t){return j(this,null,function*(){let{project:e,floor:n}=i,{apiDomain:r,apiInfo:o}=t,s=r+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(s,o).then(u=>u.json()).then(u=>u.data).then(u=>JSON.parse(u[0].streetInfo||"{}")).then(u=>u.fileId?aF(u.fileId,t):null)})}function aF(i,t){return j(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+i,n).then(r=>r.arrayBuffer()).then(r=>{let s=new TextDecoder("utf-8").decode(r);return s?JSON.parse(s):null})})}var F1=class{load(t){return j(this,null,function*(){let e=er(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),R1(t,this.bmap.config)]),r=er({floor:t.floor,ts:t.ts});ir(n.map(s=>s.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(r)||0),n.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(r)||0;return this.floorDataLengthMap.set(r,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return j(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,r=e.userData.graphicMap||new Map,{ground:o,markGraphic:s,graphic:a}=this.bmap.config;for(let u=0;u<t.length;u++){let l=t[u];l.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):l.info.userData.mark?(l.info.height=s.height,l.info.fillColor=s.color,l.info.fillOpacity=s.opacity,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity):(l.info.fillOpacity=a.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=s.height,l.info.fillColor=s.color,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity))}for(let u of t){if(u.info.group==="ground")e.createGround(u.info);else{let l=e.addGraphic(u.info);l.userData.data=u,n.set(u.legacy_id,l)}r.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=r,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(pt.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(pt.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let n=e.userData.graphicMap||new Map;return t.filter(r=>!n.has(r.element_uuid))}switchFloorByStoreData(t,e){return j(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"6"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}switchFloorByOtherData(t,e){return j(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"1,2,3,4"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}loadBuildGround(t){return j(this,null,function*(){let{brand:e,project:n}=t,r=yield this.loadBuildingGround({brand:e,project:n});return this.bmap.currentBuildGround=r,this.bmap.changeBuildingCenter(r,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return j(this,null,function*(){let{brand:e,project:n}=t,r=er({brand:e,project:n});if(this.buildingGroundMap.has(r))return this.buildingGroundMap.get(r);let o=O1({brand:e,project:n},this.bmap.config).then(s=>(this.buildingGroundMap.set(r,s),s));return this.buildingGroundMap.set(r,o),o})}switchFloor(t){return j(this,null,function*(){let e=new Bt(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(n){console.log(n)}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 Eq=function(i){return i[i.D2=0]="D2",i[i.D3=1.1]="D3",i}({}),_a=class extends uF{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:r}=e,o=t?Ro(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:r,brand:n})}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 j(this,null,function*(){return this.loader||(this.loader=new xr(this),this.loader.placeConfig=T({},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){e===void 0&&(e=t.graphicLayer.children),this.triggerHooks(pt.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(pt.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:e})}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*30,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 n;let r=(n=this.context.currentFloor)==null?void 0:n.addModel(T({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(r){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;r.rotateZ((180-o)/180*Math.PI),r.scale.set(s,a,1)}}}addHeatmap(t){var e;return(e=this.context.currentFloor)==null?void 0:e.addHeatmap(t)}getLegacyToGraphicMap(){var t;return((t=this.context.currentFloor)==null?void 0:t.userData.legacyToGraphicMap)||new Map}getFloorAllGraphics(){var t;return((t=this.context.currentFloor)==null?void 0:t.graphicLayer.children.filter(e=>e instanceof et))||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let n=t.options.center,r=t.getCenter(),o=(n==null?void 0:n[0])||r.x,s=(n==null?void 0:n[1])||r.y;return console.log(o,s,n,r),this.context.currentFloor.addPoi(T({},e,{position:{x:o,y:s,z:r.z+t.options.height/2}}))}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,r){e===void 0&&(e=500),n===void 0&&(n=0),r===void 0&&(r=0);let o=t.getPosition().clone(),{context:{camera:s}}=this;if(s.updateMatrix(),r){let a=new zc;a.setFromMatrixColumn(s.matrix,1),a.normalize(),a.multiplyScalar(r/s.zoom),o.add(a)}if(n){let a=new zc;a.setFromMatrixColumn(s.matrix,0),a.normalize(),a.multiplyScalar(n/s.zoom),o.add(a)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return j(this,null,function*(){return e===void 0&&(e=500),Kt(new Promise(n=>{let r=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:s,height:a},camera:u}=this.context,c=Y(o,u,s,a).x-s/2,h=new zc;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),r.add(h),this.context.setCameraPosition(r,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:r}=this.container;return Y(e,this.context.camera,n,r)}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 j(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 n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){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){t===void 0&&(t=.1);let e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}measureDistance(){return j(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new na(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",r=>{let{distance:o}=r;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 ra(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",r=>{let{area:o}=r;t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((n=this.context.currentFloor)==null?void 0:n.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 n=Ro(this.currentBuildGround.info.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[r,o]=t.geometry.cds;t.geometry.coords=[r-n[0],o-n[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}removePoiById(t){var e,n;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(n=this.context.currentFloor)==null||n.poiLayer2.removePoiById(t)}getPoiById(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||((n=this.context.currentFloor)==null?void 0:n.poiLayer2.getPoiById(t))}getPois(){var t,e;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(n=>!n.options.built_in),...((e=this.context.currentFloor)==null?void 0:e.poiLayer2.pois)||[]]}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,tt.dispose(),ct.dispose(),an.dispose(),vt.dispose(),G.dispose(),le.dispose(),this.debounceResize=null}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 L,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:n}}=this.context;n!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=n)},this.onKeydown=n=>{this.polarKeys.includes(n.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(n.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=n=>{if(this.polarKeys.includes(n.code)){let r=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=r,this.context.control.minPolarAngle=r}if(this.azimuthalKeys.includes(n.code)){let r=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=r,this.context.control.minAzimuthAngle=r}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),r=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=r,this.context.control.minZoom=o,this.context.control.maxZoom=o*30,this.basicZoom=r,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=x1(e),this.context=new va(t,this.config),this.debounceResize=lF(this.resize,5),this.registryEvent()}};var Zq=d(I(),1);import{EventDispatcher as cF}from"three";var St=class extends cF{dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var K1=class extends St{fetchEquipment(){return j(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,r=""+t+e;yield fetch(r,n).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(s=>[s.equipment_id,s]))}),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 n=this.getGraphicEquipment(e);return n&&this.equipmentMap.has(n)}).forEach(e=>{let n=this.equipmentMap.get(this.getGraphicEquipment(e)),r=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=n,r.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(pt.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 n;(n=this.bmap.context.currentFloor)==null||n.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:n}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(n)},this.fetchEquipment(),this.bmap.addEventListener(pt.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var V$=d(ei(),1),L$=d(Ft(),1),J$=d(I(),1),B$=d(Rc(),1);var s$=d(I(),1),a$=d(R(),1);import{Mesh as MF,Object3D as PF,TextureLoader as AF,Color as jF,Vector2 as Gc,Vector3 as TF,NormalBlending as vF,RepeatWrapping as SF}from"three";var Nq=d(Fl(),1),zq=d(pi(),1),Uq=d(fi(),1),Gq=d(mi(),1),kq=d(gi(),1),Vq=d(yi(),1),Lq=d(Pi(),1),Jq=d(Ai(),1),Bq=d(ji(),1),Hq=d(Ti(),1),Qq=d(vi(),1),qq=d(Si(),1),$q=d(bi(),1),t$=d(_i(),1),e$=d(xi(),1),n$=d(R(),1),r$=d(xc(),1);import{BufferGeometry as hF,Matrix4 as z1,Vector3 as Zn,Ray as pF,Sphere as fF,LineSegments as dF,BufferAttribute as Mn,ShaderChunk as Dt,ShaderMaterial as U1,UniformsLib as mF,Color as gF,Vector2 as N1}from"three";var At=class extends hF{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 z1,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)}}})}};At.prototype.setMatrixWorld=function(i){this.matrixWorld=i};At.prototype.setGeometry=function(i,t){this._geometry=i,this.setPoints(i.getAttribute("position").array,t)};At.prototype.setPoints=function(i,t){if(!(i instanceof Float32Array)&&!(i instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=i,this.widthCallback=t,this.positions=[],this.counters=[],i.length&&i[0]instanceof Zn)for(var e=0;e<i.length;e++){var n=i[e],r=e/i.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(var e=0;e<i.length;e+=3){var r=e/i.length;this.positions.push(i[e],i[e+1],i[e+2]),this.positions.push(i[e],i[e+1],i[e+2]),this.counters.push(r),this.counters.push(r)}this.process()};function yF(i,t){var e=new z1,n=new pF,r=new fF,o=new Zn,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(this.matrixWorld),i.ray.intersectSphere(r,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(i.ray).applyMatrix4(e);var a=new Zn,u=new Zn,l=new Zn,c=this instanceof dF?2:1,h=s.index,p=s.attributes;if(h!==null)for(var f=h.array,g=p.position.array,y=p.width.array,M=0,A=f.length-1;M<A;M+=c){var S=f[M],_=f[M+1];a.fromArray(g,S*3),u.fromArray(g,_*3);var E=y[Math.floor(M/3)]!==void 0?y[Math.floor(M/3)]:1,w=i.params.Line.threshold+this.material.lineWidth*E/2,x=w*w,v=n.distanceSqToSegment(a,u,o,l);if(!(v>x)){o.applyMatrix4(this.matrixWorld);var W=i.ray.origin.distanceTo(o);W<i.near||W>i.far||(t.push({distance:W,point:l.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this}),M=A)}}}}At.prototype.raycast=yF;At.prototype.compareV3=function(i,t){var e=i*6,n=t*6;return this.positions[e]===this.positions[n]&&this.positions[e+1]===this.positions[n+1]&&this.positions[e+2]===this.positions[n+2]};At.prototype.copyV3=function(i){var t=i*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};At.prototype.getDistance=function(i){let t=0;for(let e=0;e<i;e++){let n=6*e,r=new Zn(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new Zn(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=r.distanceTo(o);t+=s}return t};At.prototype.process=function(){var i=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(i-1);var n;this.compareV3(0,i-1)?n=this.copyV3(i-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var r=0;r<i;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(r/(i-1)):t=1,this.width.push(t),this.width.push(t),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===i-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(r)/e;this.uvs.push(s,0),this.uvs.push(s,1)}if(r<i-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=r*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(i-1,0)?n=this.copyV3(1):n=this.copyV3(i-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new Mn(new Float32Array(this.positions),3),previous:new Mn(new Float32Array(this.previous),3),next:new Mn(new Float32Array(this.next),3),side:new Mn(new Float32Array(this.side),1),width:new Mn(new Float32Array(this.width),1),uv:new Mn(new Float32Array(this.uvs),2),index:new Mn(new Uint16Array(this.indices_array),1),counters:new Mn(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 Uc(i,t,e,n,r){var o;if(i=i.subarray||i.slice?i:i.buffer,e=e.subarray||e.slice?e:e.buffer,i=t?i.subarray?i.subarray(t,r&&t+r):i.slice(t,r&&t+r):i,e.set)e.set(i,n);else for(o=0;o<i.length;o++)e[o+n]=i[o];return e}At.prototype.advance=function(i){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,r=t.length;Uc(t,0,e,0,r),Uc(t,6,t,0,r-6),t[r-6]=i.x,t[r-5]=i.y,t[r-4]=i.z,t[r-3]=i.x,t[r-2]=i.y,t[r-1]=i.z,Uc(t,6,n,0,r-6),n[r-6]=i.x,n[r-5]=i.y,n[r-4]=i.z,n[r-3]=i.x,n[r-2]=i.y,n[r-1]=i.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};Dt.meshline_vert=["",Dt.logdepthbuf_pars_vertex,Dt.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;","",Dt.logdepthbuf_vertex,Dt.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Dt.fog_vertex,"}"].join(`
|
|
3912
3912
|
`);Dt.meshline_frag=["",Dt.fog_pars_fragment,Dt.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() {","",Dt.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);","",Dt.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
|
|
3913
3913
|
`);var On=class extends U1{constructor(t){super({uniforms:Object.assign({},mF.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new gF(16777215)},opacity:{value:1},resolution:{value:new N1(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 N1(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:Dt.meshline_vert,fragmentShader:Dt.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)}};On.prototype.copy=function(i){return U1.prototype.copy.call(this,i),this.lineWidth=i.lineWidth,this.map=i.map,this.useMap=i.useMap,this.alphaMap=i.alphaMap,this.useAlphaMap=i.useAlphaMap,this.color.copy(i.color),this.opacity=i.opacity,this.resolution.copy(i.resolution),this.sizeAttenuation=i.sizeAttenuation,this.dashArray.copy(i.dashArray),this.dashOffset.copy(i.dashOffset),this.dashRatio.copy(i.dashRatio),this.useDash=i.useDash,this.visibility=i.visibility,this.alphaTest=i.alphaTest,this.repeat.copy(i.repeat),this};var G1={texture_url:Gs,lineWidth:10,color:16777215},xa=class extends PF{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:n,height:r}}}}}=this,o=t.map(a=>{let[u,l]=a;return Y(new TF(u,l,0),e,n,r)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return It(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new Gc(t,1)}loadTexture(t){return new Promise((e,n)=>{new AF().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],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 j(this,null,function*(){let e=this.geometry=new At;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=SF}let n=this.material=new On({useMap:!0,color:new jF(this.config.color),transparent:!0,resolution:new Gc(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:vF,repeat:new Gc(this.getRepeat(),1)}),r=this.mesh=new MF(e,n);return r.renderOrder=99999,this.add(r),r})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.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=G1,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:r}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,r)}},this.config=Object.assign({},G1,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as kc,Easing as ZF}from"@tweenjs/tween.js";import{Vector2 as OF,Vector3 as he}from"three";var m$=d(Qs(),1),g$=d(I(),1),y$=d(R(),1);import{EventDispatcher as bF,Vector2 as wF}from"three";import{Tween as _F}from"@tweenjs/tween.js";import{throttle as xF}from"lodash";import{booleanPointInPolygon as WF,point as IF,polygon as EF}from"@turf/turf";var YF={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},Wa=class extends bF{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.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:n,position:r,curRoutePath:o,paths:s,routeIndex:a}=this;if(!n.length)return null;let u=n,l=this.paths[this.routeIndex].floor,c=this.getCurRouteRemainDistance();if(r){let M=Xe(n,r);u=u.slice(M+1),u.unshift(r)}let h=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:p,closestPoint:f,index:g,i:y}=h.reduce((M,A,S)=>{if(A.floor!==t)return M;let{distance:_,closestPoint:E,index:w}=A.points.reduce((x,v,W,F)=>{if(!F[W+1])return T({},x,{distance:x.distance===1/0?z(v,e):x.distance});let{distance:D,closestPoint:X}=A2(e,v,F[W+1]);if(l===t){let rt=[e,...F.slice(W+1)],st=It(rt);if(c-st>10)return x}return D<x.distance?{distance:D,closestPoint:X,index:W}:x},{distance:1/0,closestPoint:A.points[0],index:0});return _<M.distance?{distance:_,closestPoint:E,index:S,i:w}:M},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:p,closestPoint:f,routeIndex:g+a,pointIndex:g===0?y+this.pointIndex:y}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:r,closestPoint:o,routeIndex:s,pointIndex:a}=n;r>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=s,this.pointIndex=a,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 j(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let r=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),s=o/this.options.simulationSpeed,a=this.throttleUpdatePosition=xF(l=>{let c=nr(r,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new _F({distance:0},this.tweenUtil.group).to({distance:o},s*1e3).onUpdate(a).onComplete(()=>{this.tweenUtil.remove(u),a.flush(),a.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{n(this.startCurRouteSimulation())},3e3)):(n(!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:n}=this;if(!t.length)return 0;let r=[n,...t.slice(e+1)];return It(r)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[...t.slice(0,e+1),n];return It(r)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((r,o)=>r+o.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:r,curRoutePath:o}=this,s=e,a=Oe.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===Oe.FRONT&&s<=n.length;){let g=n[s],y=n[s+1],M=n[s+2];if(!g||!y)a=Oe.END;else if(l+=z(g,y),!M)a=Oe.END;else{a=v0(g,y,M),c=Fo(g,y,M),h=(new wF(M[0]-y[0],M[1]-y[1]).angle()*180/Math.PI-90+360)%360;var p;u=(p=o==null?void 0:o.pointInfos[s+1].crossName)!=null?p:"",s+=1}}if(n[s]&&(l=z(r,n[s])),a===Oe.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let f=this.getCurRouteToStartDistance();return e===0&&f<=5?{dir:Oe.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=Oe.FRONT),{dir:a,distance:l,crossName:u,angle:c,nextAngle:h})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let r=EF(n.cds),o=IF(this.position);return WF(o,r)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:r,distance:o,crossName:s,angle:a,nextAngle:u}=n;e<=10&&(r=Oe.END);let{imageUrl:l}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:o,dir:r,angle:a,nextAngle:u,pos:this.position,routeIndex:this.routeIndex,crossName:s,offset:this.offset,reset:this.reset,imageUrl:l}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,n){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 L,this.resetTimer=null,this.tweenUtil=new un,this.paused=!1,this.onAddPaths=r=>{let{paths:o}=r;this.paths=o,this.resetStatus(o),this.simulationTween&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},YF,e),this.roadData=n,this.registryEvent()}};var b$=d(Ts(),1),w$=d(pi(),1),_$=d(fi(),1),x$=d(mi(),1),W$=d(gi(),1),I$=d(yi(),1),E$=d(Pi(),1),Y$=d(Ai(),1),D$=d(ji(),1),C$=d(Ti(),1),X$=d(vi(),1),Z$=d(Si(),1),O$=d(bi(),1),R$=d(_i(),1),F$=d(xi(),1),K$=d(Ol(),1),N$=d(I(),1);import{DataTexture as DF,LinearFilter as k1,RGBAFormat as V1,Sprite as CF,SpriteMaterial as XF}from"three";var Ve=class i extends nt{addDebug(){i.canvas.style.cssText=`
|
|
3914
3914
|
position: fixed;
|