@aibee/crc-bmap 0.9.1 → 0.9.3
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.min.js +1 -1
- package/lib/index.online.esm.min.js +1 -1
- package/lib/index.online.min.js +1 -1
- package/lib/platform/wrapper.cjs +1 -1
- package/lib/platform/wrapper.esm.min.js +1 -1
- package/lib/platform/wrapper.min.js +1 -1
- package/lib/platform/wrapper.online.esm.min.js +1 -1
- package/lib/platform/wrapper.online.min.js +1 -1
- package/lib/src/bmap.d.ts +1 -1
- package/lib/src/bmap.js +3 -2
- package/lib/src/loader/AibeeLoader/index.d.ts +2 -2
- package/lib/src/loader/AibeeLoader/index.js +8 -5
- package/package.json +3 -3
|
@@ -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,i=this.geometry.getAttribute("position");if(i)for(let s=0;s<i.count;s++){let a=i.getZ(s);a>n&&(n=a)}let o=new dz({uniforms:{maxZ:{value:n},uColor:{value:new G6(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new G6(Ue(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=W.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 hz(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:i}=n.geometry;for(let o=0;o<i.length;o++){let s=i[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 z6(u[0],u[1],e)),t.push(new z6(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new pz().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new fz(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=>S({},Oc,n)),this.init()}};var j7=d(P(),1),Y7=d(jo(),1);import{Box2 as Fc,Object3D as gz,Sprite as k6,SpriteMaterial as V6,Vector2 as la}from"three";import{isNil as zi}from"lodash";var mz={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 gz{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:i,text_texture_offset_y:o}=this.options;return!zi(t)&&!zi(e)&&!zi(n)&&!zi(i)&&!zi(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=>E(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 E(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>E(this,null,function*(){let e;if(this.options.icon_border){let{icon:i,icon_size:o,icon_border:s}=this.options;e=yield ct.getUrlTextureBorder(i,o[0]-s.width*2,s)}else e=yield ct.getTextureByUrl(this.options.icon);let n=new k6(new V6({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:i,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(i/t.image.width,o/t.image.height),this.textAspect=i/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 k6(new V6({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,i=0,{icon:o}=this.options;o?this.hasText?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):this.hasText?(i=.5,n=0):(n=0,i=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,i)}init(){return E(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,i=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 Fc(new la(i-s,o-this.iconHeight),new la(i+s,o)),u=this.textWidth/2,l=new Fc(new la(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new la(i+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 Fc,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 i;this.options=Zn(S({},mz,e,{text:(i=(n=e.text)==null?void 0:n.trim())!=null?i:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var nZ=d(jo(),1);import{DoubleSide as vz,Matrix4 as H6,Mesh as _z,MeshBasicMaterial as yz,Object3D as xz,PlaneGeometry as Ez}from"three";import{mergeGeometries as Sz}from"three/examples/jsm/utils/BufferGeometryUtils.js";var bz={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},ca=class extends xz{init(){return E(this,null,function*(){let t=this.options.map(s=>tt.getTextureByText(s.texts[0],{fillStyle:w0(s.fillColor,s.fillOpacity),strokeStyle:w0(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 Ez(p,u.secondHeight),m=new H6().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new H6().makeRotationZ(u.secondRotate));return f.applyMatrix4(m),f}),n=Sz(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let{texture:a}=s,u=new yz({map:a,alphaTest:1,side:vz});return a.needsUpdate=!0,u}),o=new _z(n,i);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(i=>i.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>S({},bz,n)).filter(n=>n.texts[0].trim()),this.options.length&&this.init()}};import{Object3D as Mz}from"three";import{Line2 as wz}from"three/examples/jsm/lines/Line2.js";import{LineGeometry as Tz}from"three/examples/jsm/lines/LineGeometry.js";import{LineMaterial as Az}from"three/examples/jsm/lines/LineMaterial.js";var Gi=class extends Mz{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 wz(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&J(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 Tz,this.lineMaterial=new Az({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:i,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(i,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};import{Frustum as Cz}from"three";var ha=class extends Kt{setEnable(t){super.setEnable(t),mt(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:i}}}=this,o=L(this.startPoint,e,n,i),s=L(this.endPoint,e,n,i),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:i}=this;return((n=i.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof et&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let f=L(p,i,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=L(u,i,o,s),h=L(l,i,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 Cz,this.onPointerDown=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=i=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o)},this.onPointerUp=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let i=this.getSvgCoordinate(this.startPoint),o=S({},i);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(i.x,o.x),y:Math.min(i.y,o.y)},a=Math.abs(o.x-i.x),u=Math.abs(o.y-i.y);mt(this.rect,s.x,s.y,a,u)}else mt(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 pa=class extends Rz{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:i}=e,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-n)**2+(s-i)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,i),u=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(n,i).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))}}),(Jn?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=>{Qn(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Qn(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(i=>{this._list.add(i)}),this.selectEnd()},this.boxSelection=new ha(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var QZ=d(de(),1),t$=d(ge(),1),e$=d(me(),1),n$=d(ve(),1),r$=d(_e(),1),i$=d(ye(),1),o$=d(xe(),1),s$=d(P(),1);import{EventDispatcher as Pz,Vector2 as Iz}from"three";var fa=class extends Pz{handleHoverGraphicsChange(t){t===void 0&&(t=this.curGraphics),this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new j,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:n,pois:i,e:o}=e,s=i.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=i.find(m=>m.options.id===p.options.id);if(f instanceof On){let{x:m,y:v}=f.clientPos,_=Math.sqrt((m-o.offsetX)**2+(v-o.offsetY)**2);_<h&&(h=_,c=p)}else if(f instanceof nt){let{x:m,y:v}=f.box.getCenter(new Iz),_=Math.sqrt((m-o.offsetX)**2+(v-o.offsetY)**2);_<h&&(h=_,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 _$=d(P(),1);import{Box3 as Lz,Vector3 as Ae}from"three";import{polygon as W6,intersect as Nz}from"@turf/turf";var da=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 Yt).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,l=[new Ae(s.x,s.y,s.z),new Ae(a.x,s.y,s.z),new Ae(s.x,a.y,s.z),new Ae(a.x,a.y,s.z),new Ae(s.x,s.y,a.z),new Ae(a.x,s.y,a.z),new Ae(s.x,a.y,a.z),new Ae(a.x,a.y,a.z)].map(m=>L(m,n,i,o)),c=Math.min(...l.map(m=>m.x)),h=Math.max(...l.map(m=>m.x)),p=Math.min(...l.map(m=>m.y)),f=Math.max(...l.map(m=>m.y));return{left:c,right:h,top:p,bottom:f}}checkDistanceToScreenEdge(t){let{left:e,right:n,top:i,bottom:o}=t,{width:s,height:a}=this.context.clientSize,[u,l,c,h]=this.context.config.cameraBound.padding,p=W6([[[e,i],[n,i],[n,o],[e,o],[e,i]]]),f=W6([[[h,u],[s-l,u],[s-l,a-c],[h,a-c],[h,u]]]);try{return Nz(p,f)!==null}catch(m){return console.warn("\u8BA1\u7B97\u4EA4\u96C6\u51FA\u9519:",m),!1}}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new Ae,zoom:1,target:new Ae},this.enable=!0,this.box=new Lz,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:n,right:i,top:o,bottom:s}=e;this.checkDistanceToScreenEdge({left:n,right:i,top:o,bottom:s})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var O$=d(Gc(),1);import{Vector3 as s3}from"three";import{Tween as ya,Group as eG}from"@tweenjs/tween.js";var P$=d(P(),1),I$=d(B(),1);import{EventDispatcher as Zz,MOUSE as Mr,Quaternion as i3,Spherical as ma,TOUCH as wr,Vector2 as It,Vector3 as Zt,Plane as $z,Ray as Jz,MathUtils as Qz}from"three";var va=new Jz,o3=new $z,tG=Math.cos(70*Qz.DEG2RAD),_a=class extends Zz{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 It,this.rotateLineEnd=new It,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 Zt,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:Mr.PAN,MIDDLE:Mr.DOLLY,RIGHT:Mr.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(y){y.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=y},this.stopListenToKeyEvents=function(){var y;(y=this._domElementKeyEvents)==null||y.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){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=i.NONE},this.update=function(){let y=new Zt,w=new i3().setFromUnitVectors(t.up,new Zt(0,1,0)),H=w.clone().invert(),Z=new Zt,At=new i3,he=new Zt,$t=2*Math.PI;return function(Ir){Ir===void 0&&(Ir=null);let Ce=n.object.position;y.copy(Ce).sub(n.target),y.applyQuaternion(w),a.setFromVector3(y),n.autoRotate&&o===i.NONE&&D(z(Ir)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let Re=n.minAzimuthAngle,Pe=n.maxAzimuthAngle;isFinite(Re)&&isFinite(Pe)&&(Re<-Math.PI?Re+=$t:Re>Math.PI&&(Re-=$t),Pe<-Math.PI?Pe+=$t:Pe>Math.PI&&(Pe-=$t),Re<=Pe?a.theta=Math.max(Re,Math.min(Pe,a.theta)):a.theta=a.theta>(Re+Pe)/2?Math.max(Re,a.theta):Math.min(Pe,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&&C||n.object.isOrthographicCamera?a.radius=Tt(a.radius):a.radius=Tt(a.radius*l),y.setFromSpherical(a),y.applyQuaternion(H),Ce.copy(n.target).add(y),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 ji=!1;if(n.zoomToCursor&&C){let Lr=null;if(n.object.isPerspectiveCamera){let Nr=y.length();Lr=Tt(Nr*l);let Yi=Nr-Lr;n.object.position.addScaledVector(I,Yi),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let Nr=new Zt(T.x,T.y,0);Nr.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),ji=!0;let Yi=new Zt(T.x,T.y,0);Yi.unproject(n.object),n.object.position.sub(Yi).add(Nr),n.object.updateMatrixWorld(),Lr=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Lr!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Lr).add(n.object.position):(va.origin.copy(n.object.position),va.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(va.direction))<tG?t.lookAt(n.target):(o3.setFromNormalAndCoplanarPoint(n.object.up,n.target),va.intersectPlane(o3,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),ji=!0);return l=1,C=!1,ji||Z.distanceToSquared(n.object.position)>s||8*(1-At.dot(n.object.quaternion))>s||he.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),Z.copy(n.object.position),At.copy(n.object.quaternion),he.copy(n.target),ji=!1,!0):!1}}();let n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=i.NONE,s=1e-6,a=new ma,u=new ma,l=1,c=new Zt,h=new It,p=new It,f=new It,m=new It,v=new It,_=new It,x=new It,M=new It,A=new It,I=new Zt,T=new It,C=!1,b=[],R={};function z(y){return y!==null?2*Math.PI/60*n.autoRotateSpeed*y:2*Math.PI/60/60*n.autoRotateSpeed}function N(){return Math.pow(.95,n.zoomSpeed)}function D(y){u.theta-=y}function rt(y){u.phi-=y}let st=function(){let y=new Zt;return function(H,Z){y.setFromMatrixColumn(Z,0),y.multiplyScalar(-H),c.add(y)}}(),wt=function(){let y=new Zt;return function(H,Z){n.screenSpacePanning===!0?y.setFromMatrixColumn(Z,1):(y.setFromMatrixColumn(Z,0),y.crossVectors(n.object.up,y)),y.multiplyScalar(H),c.add(y)}}(),Ot=function(){let y=new Zt;return function(H,Z){let At=n.domElement;if(n.object.isPerspectiveCamera){let he=n.object.position;y.copy(he).sub(n.target);let $t=y.length();$t*=Math.tan(n.object.fov/2*Math.PI/180),st(2*H*$t/At.clientHeight,n.object.matrix),wt(2*Z*$t/At.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(st(H*(n.object.right-n.object.left)/n.object.zoom/At.clientWidth,n.object.matrix),wt(Z*(n.object.top-n.object.bottom)/n.object.zoom/At.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Fn(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Rr(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Pr(y){if(!n.zoomToCursor)return;C=!0;let w=n.domElement.getBoundingClientRect(),H=y.clientX-w.left,Z=y.clientY-w.top,At=w.width,he=w.height;T.x=H/At*2-1,T.y=-(Z/he)*2+1,I.set(T.x,T.y,1).unproject(n.object).sub(n.object.position).normalize()}function Tt(y){return Math.max(n.minDistance,Math.min(n.maxDistance,y))}function th(y){h.set(y.clientX,y.clientY)}function X3(y){Pr(y),x.set(y.clientX,y.clientY)}function eh(y){m.set(y.clientX,y.clientY)}function j3(y){p.set(y.clientX,y.clientY),f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let w=n.domElement;D(2*Math.PI*f.x/w.clientHeight),rt(2*Math.PI*f.y/w.clientHeight),h.copy(p),n.update()}function Y3(y){M.set(y.clientX,y.clientY),A.subVectors(M,x),A.y>0?Fn(N()):A.y<0&&Rr(N()),x.copy(M),n.update()}function K3(y){v.set(y.clientX,y.clientY),_.subVectors(v,m).multiplyScalar(n.panSpeed),Ot(_.x,_.y),m.copy(v),n.update()}function Z3(y){Pr(y),y.deltaY<0?Rr(N()):y.deltaY>0&&Fn(N()),n.update()}function $3(y){let w=!1;switch(y.code){case n.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?rt(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(0,n.keyPanSpeed),w=!0;break;case n.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?rt(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(0,-n.keyPanSpeed),w=!0;break;case n.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?D(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(n.keyPanSpeed,0),w=!0;break;case n.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?D(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(-n.keyPanSpeed,0),w=!0;break}w&&(y.preventDefault(),n.update())}function nh(){if(b.length===1)h.set(b[0].pageX,b[0].pageY);else{let y=(b[0].pageX-b[0].pageY)/(b[1].pageX-b[1].pageY),w=b[0].pageY-y*b[0].pageX;n.rotateLineStart.set(y,w);let H=.5*(b[0].pageX+b[1].pageX),Z=.5*(b[0].pageY+b[1].pageY);h.set(H,Z)}}function rh(){if(b.length===1)m.set(b[0].pageX,b[0].pageY);else{let y=.5*(b[0].pageX+b[1].pageX),w=.5*(b[0].pageY+b[1].pageY);m.set(y,w)}}function ih(){let y=b[0].pageX-b[1].pageX,w=b[0].pageY-b[1].pageY,H=Math.sqrt(y*y+w*w);x.set(0,H)}function J3(){n.enableZoom&&ih(),n.enablePan&&rh()}function Q3(){n.enableZoom&&ih(),n.enableRotate&&nh()}function oh(y){if(b.length==1)p.set(y.pageX,y.pageY);else{let H=Ya(y),Z=.5*(y.pageX+H.x),At=.5*(y.pageY+H.y);p.set(Z,At);let he=(y.pageY-H.y)/(y.pageX-H.x),$t=H.y-he*H.x;if(n.rotateLineEnd.set(he,$t),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let Ka=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Ir=he*Ka+$t;if(Number.isFinite(Ka)&&Number.isFinite(Ir)){let Ce=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(Ce)<.5&&(Ce=-Math.sign(Ce)*(Math.PI-Math.abs(Ce))),Math.abs(Ce)<.1&&(u.theta+=Ce)}}n.rotateLineStart.copy(n.rotateLineEnd)}f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let w=n.domElement;rt(2*Math.PI*f.y/w.clientHeight),h.copy(p)}function sh(y){if(b.length===1)v.set(y.pageX,y.pageY);else{let w=Ya(y),H=.5*(y.pageX+w.x),Z=.5*(y.pageY+w.y);v.set(H,Z)}_.subVectors(v,m).multiplyScalar(n.panSpeed),Ot(_.x,_.y),m.copy(v)}function ah(y){let w=Ya(y),H=y.pageX-w.x,Z=y.pageY-w.y,At=Math.sqrt(H*H+Z*Z);M.set(0,At),A.set(0,Math.pow(M.y/x.y,n.zoomSpeed)),Fn(A.y),x.copy(M)}function t1(y){n.enableZoom&&ah(y),n.enablePan&&sh(y)}function e1(y){n.enableZoom&&ah(y),n.enableRotate&&oh(y)}this.onPointerDown=function(w){n.enabled!==!1&&(b.length===0&&(n.domElement.setPointerCapture(w.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),s1(w),w.pointerType==="touch"?i1(w):n1(w))},this.onPointerMove=function(w){n.enabled!==!1&&(w.pointerType==="touch"?o1(w):r1(w))},this.onPointerUp=function(w){a1(w),b.length===0&&(n.domElement.releasePointerCapture(w.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=i.NONE};function n1(y){let w;switch(y.button){case 0:w=n.mouseButtons.LEFT;break;case 1:w=n.mouseButtons.MIDDLE;break;case 2:w=n.mouseButtons.RIGHT;break;default:w=-1}switch(w){case Mr.DOLLY:if(n.enableZoom===!1)return;X3(y),o=i.DOLLY;break;case Mr.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enablePan===!1)return;eh(y),o=i.PAN}else{if(n.enableRotate===!1)return;th(y),o=i.ROTATE}break;case Mr.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enableRotate===!1)return;th(y),o=i.ROTATE}else{if(n.enablePan===!1)return;eh(y),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function r1(y){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;j3(y);break;case i.DOLLY:if(n.enableZoom===!1)return;Y3(y);break;case i.PAN:if(n.enablePan===!1)return;K3(y);break}}this.onMouseWheel=function(w){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(w.preventDefault(),n.dispatchEvent({type:"start"}),Z3(w),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(w){n.enabled===!1||n.enablePan===!1||$3(w)};function i1(y){switch(uh(y),b.length){case 1:switch(n.touches.ONE){case wr.ROTATE:if(n.enableRotate===!1)return;nh(),o=i.TOUCH_ROTATE;break;case wr.PAN:if(n.enablePan===!1)return;rh(),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case wr.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;J3(),o=i.TOUCH_DOLLY_PAN;break;case wr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Q3(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function o1(y){switch(uh(y),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;oh(y),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;sh(y),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;t1(y),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;e1(y),n.update();break;default:o=i.NONE}}this.onContextMenu=function(w){n.enabled!==!1&&w.preventDefault()};function s1(y){b.push(y)}function a1(y){delete R[y.pointerId];for(let w=0;w<b.length;w++)if(b[w].pointerId==y.pointerId){b.splice(w,1);return}}function uh(y){let w=R[y.pointerId];w===void 0&&(w=new It,R[y.pointerId]=w),w.set(y.pageX,y.pageY)}function Ya(y){let w=y.pointerId===b[0].pointerId?b[1]:b[0];return R[w.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 xa=class extends _a{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:i}=this,o=n===i;(e||t<=n&&t>=i)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=n,this.minPolarAngle=i)}setPolarAngleByDuration(t,e,n){return E(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):zt(new Promise(i=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new ya(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:n,minAzimuthAngle:i}=this,o=n===i;(e||t<=n&&t>=i)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=n,this.minAzimuthAngle=i)}setAzimuthalAngleDuration(t,e,n){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setAzimuthalAngle(t,e):zt(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new ya(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}getCameraLookAt(){return new s3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return E(this,null,function*(){let n=this.target.clone(),i=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(i)),this.target.copy(t.clone()),this.update();return}return zt(new Promise(o=>{let s=new ya(n,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(n.clone().sub(i)),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:i,maxZoom:o}=this;(n||t>=i&&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,i){return E(this,null,function*(){n===void 0&&(n=!1),i===void 0&&(i=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return i?zt(new Promise(s=>{let a=new ya(o,this.tweenGroup).to({zoom:t,target:e},i).onUpdate(()=>{this.setZoom(o.zoom,o.target,n)}).onComplete(()=>{this.tweenGroup.remove(a),this.enabled=!0,s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+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 s3;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 eG,this.offsetY=0,this.onChange=()=>{let i=this.camera.zoom;i!==this.prevCameraZoom&&(this.prevCameraZoom=i,this.dispatchEvent({type:"change-zoom",zoom:i}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};import{EventDispatcher as nG,PCFSoftShadowMap as rG,WebGLRenderer as iG}from"three";var Ea=class extends iG{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(S({antialias:!0,alpha:!0},t)),this.event=new nG,this.enable=!0,this.timer=new j,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=rG}};import{Euler as oG,Matrix4 as sG,Scene as aG,EquirectangularReflectionMapping as uG}from"three";import{RGBELoader as lG}from"three/examples/jsm/loaders/RGBELoader.js";var Sa=class extends aG{constructor(){super(),new lG().load(T6,t=>{t.mapping=uG,this.environment=t;let e=new sG;e.makeRotationX(Math.PI/2),this.environmentRotation=new oG().setFromRotationMatrix(e)})}};import{OrthographicCamera as cG}from"three";var ba=class extends cG{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 Ma=class extends hG{resizeClientSize(){let{x:t,y:e,width:n,height:i}=this.container.getBoundingClientRect();this.clientSize={width:n||this.container.clientWidth,height:i||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new ba(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new xa(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 da(this)}getRatio(t,e){t===void 0&&(t=new qe(0,0,0)),e===void 0&&(e=new qe(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=L(t,this.camera,n,i),s=L(e,this.camera,n,i);return Math.ceil(Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof mG&&(e.color=new gG(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 i=new Tr;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new fG;return o.setFromCamera(i,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,i;let o=(n=this.currentFloor)==null?void 0:n.poiLayer.getPoiByDeviceXy(t,e),s=(i=this.currentFloor)==null?void 0:i.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,i){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),i===void 0&&(i=!0);let[o,s,a,u]=e,{clientSize:{width:l,height:c}}=this,h=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let p=new dG().setFromObject(t);this.setPolarAngle(h,0);let{max:f,min:m}=p,v=new qe(m.x,f.y,f.z),_=new qe(f.x,f.y,f.z),x=new qe(f.x,m.y,m.z),M=new qe(m.x,m.y,m.z),A=L(v,this.camera,l,c),I=L(_,this.camera,l,c),T=L(M,this.camera,l,c),C=L(x,this.camera,l,c),R=new pG().setFromPoints([new Tr(A.x,A.y),new Tr(I.x,I.y),new Tr(T.x,T.y),new Tr(C.x,C.y)]).getSize(new Tr),z=(l-s-u)/R.x,N=(c-o-a)/R.y,D=Math.min(z,N),rt=new qe((f.x+m.x)/2,(f.y+m.y)/2,(f.z+m.z)/2),st=D*this.camera.zoom,wt=this.camera.clone();wt.zoom=st,wt.updateMatrix();let Ot=(l-R.x*D)/2,Fn=(c-R.y*D)/2,Rr=(s-u)/2,Pr=(o-a)/2;if(Rr){let Tt=new qe;Tt.setFromMatrixColumn(wt.matrix,0),Tt.normalize(),Tt.multiplyScalar(Rr/st),rt.add(Tt)}if(Pr){let Tt=new qe;Tt.setFromMatrixColumn(wt.matrix,1),Tt.normalize(),Tt.multiplyScalar(Pr/st),rt.add(Tt)}return{zoom:D*this.camera.zoom,center:rt}}fitCameraToObject(t,e,n,i){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),i===void 0&&(i=!0);let{zoom:o,center:s}=this.getFitCameraToObjectZoom(t,e,n,i);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 E(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()),J(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new Sa,this.renderer=new Ea,this.lights=Wg(),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:i}=n;this.dispatchEvent({type:"control-zoom-change",zoom:i})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:i,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),i.left=-s/2,i.right=s/2,i.top=a/2,i.bottom=-a/2,i.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);i.length&&this.dispatchEvent({type:"graphic-click",graphics:i,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:i,pois:s,position:o})},this.onPointermove=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:i,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:i,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:i,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:i}=n;this.dispatchEvent({type:"hover",graphics:i})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new pa(this),this.hoverHelper=new fa(this),this.resizeClientSize(),this.registryEvent()}};import{merge as vG}from"lodash";var _G={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 a3(r){return vG({},_G,r)}import{debounce as UG}from"lodash";var bJ=d(P(),1);var le;function u3(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(le)return e({db:le,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){le=o.target.result,console.log("onupgradeneeded"),e({db:le,type:"onupgradeneeded"})},i.onsuccess=o=>{le=o.target.result,e({db:le,type:"success"})},i.onerror=o=>{n(o)}})}function kc(r,t,e){return e===void 0&&(e=le),new Promise((n,i)=>{e||i("\u6CA1\u6709db");let s=e.transaction([r],"readonly").objectStore(r).get(t);s.onsuccess=()=>{s.result?n(s.result.value):n(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),n(null)}})}function l3(r,t,e,n){return n===void 0&&(n=le),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>E(this,null,function*(){let u=yield kc(r,t),l=n.transaction([r],"readwrite").objectStore(r),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 Dn(r,t){t===void 0&&(t=le),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function c3(r){r===void 0&&(r=le),r==null||r.close(),le=null}import{Vector3 as IG,Color as LG}from"three";var gJ=d(B(),1),mJ=d(P(),1);function wa(r,t){let e=r.poi_info.showName||r.store_name||r.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=r.store_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var i;return((i=r.store_info_ext)==null?void 0:i.traditional_name)||e}}function Ta(r,t){let e=r.poi_info.showName||r.store_name||r.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=r.infra_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var i;return((i=r.infra_info_ext)==null?void 0:i.traditional_name)||e}}function h3(r,t,e){switch(r.l_type){case"graph":return yG(r,t);case"wall":return xG(r,t);case"lane":return EG(r,t);case"texture2d":case"texture3d":return SG(r,t);case"glb":return bG(r,t);case"store":return MG(r,t);case"facility":return TG(r,t);case"parkingSpace":return CG(r,t,e);case"text":return PG(r,t)}}function p3(r,t,e,n){switch(r.l_type){case"store":return wG(r,t,e,n);case"facility":return AG(r,t,e,n);case"parkingSpace":return RG(r,t,n)}}function yG(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=i,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(i):n[h]=[i],n},{});Object.values(e).forEach(n=>{let i=new br(t.context,n);t.mergeGraphicLayer.add(i)})}function xG(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l}=i,c=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l;return u===0&&(c=o.toLowerCase()+"-"+s+"-"+l),n[c]?n[c].push(i):n[c]=[i],n},{});Object.values(e).forEach(n=>{let i=new sa(t.context,n);t.wallLayer.add(i)})}function EG(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u}=i,l=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u;return u===0&&(l=o.toLowerCase()+"-"+s),n[l]?n[l].push(i):n[l]=[i],n},{});Object.values(e).forEach(n=>{let i=new ua(t.context,n);t.laneLayer.add(i)})}function SG(r,t){if(r.elements.length){let e=new Sr(t.context,r.elements);t.textureLayer.add(e)}}function bG(r,t){r.elements.forEach(e=>{let n=new aa(t.context,S({},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 MG(r,t){r.elements.map(e=>{let n=t.addGraphic(S({},e,{dashed:!1}));t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function wG(r,t,e,n){r.elements.map(i=>{try{let o=wa(i,e),s=new nt(t.context,{id:i.id,icon:i.poi_info.showImageUrl||i.poi_info.icon,text:o,position:{x:i.center_coord_x,y:i.center_coord_y,z:i.airHeight+i.height},icon_size:[24,24],level:i.poi_info.level||0,hide_text:!n.showStoreName,maxWeight:i.poi_info.maxWeight||25,minWeight:i.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(s),s&&(s.userData.type="store",s.userData.data=i,s.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,i)}})}function TG(r,t){r.elements.map(e=>{let n=t.addGraphic(S({},e,{dashed:!1}));t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function AG(r,t,e,n){r.elements.filter(o=>o.poi_info).map(o=>{try{let s=Ta(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 CG(r,t,e){t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function RG(r,t,e){return E(this,null,function*(){let n=r.elements.filter(s=>s.texts[0]),i=n.map(s=>s.texts[0]),o=yield tt.lazyGetTextureByTexts(i,{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 PG(r,t){let e=new ca(t.context,r.elements.map(n=>S({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var f3="map_version",d3="route_version",g3="facility_version",Vc="map_data",Aa="road_network_data",Hc="facility_data",NG={mergeParkingSpace:!0},Ar=class extends ft{initDb(){return E(this,null,function*(){try{let{db:t,type:e}=yield u3("aibee_map",2);e==="onupgradeneeded"&&(Dn(f3),Dn(d3),Dn(g3),Dn(Vc),Dn(Aa),Dn(Hc)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return E(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=S({},this.placeConfig,e));else{let n=yield fetch(t).then(i=>i.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=S({},this.placeConfig,JSON.parse(n.data.config||"{}")))}this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return this.initDbPromise.then(()=>l3(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>kc(t,""+e,this.db))}getFloorCacheKey(t){return t.floor_id+"_"+t.version_id}getFloorData(t){return E(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return E(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=wa(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=Ta(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return E(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>E(this,null,function*(){let i=this.getFloorCacheKey(t),o=yield fetch(t.map_url).then(s=>s.json());o.floor=t.floor,this.setCacheData(Vc,i,o),this.setCacheData(f3,i,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return E(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{let i=yield this.getCacheData(Vc,n);return i||this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return E(this,null,function*(){return(yield Promise.all(this.floors.map(e=>E(this,null,function*(){let n=this.getFloorCacheKey(e);try{let i=yield this.getCacheData(Aa,n);if(i)return i;let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Aa,n,o),this.setCacheData(d3,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Aa,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return E(this,null,function*(){let t=this.floors.reduce((i,o)=>i.updated_at>o.updated_at?i:o,this.floors[0]);if(!t)return null;let e=this.getFloorCacheKey(t),n=()=>E(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(Hc,e,i),this.setCacheData(g3,e,t.version_id)),i});try{let i=yield this.getCacheData(Hc,e);return i||n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return E(this,null,function*(){for(let t=0;t<this.floors.length;t++){let e=this.floors[t];this.getFloorJsonData(e.floor)}})}getMulFloorsData(t){return E(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return E(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return E(this,null,function*(){return e=this.getFloorBaseLayer(t,e),n=S({},this.placeConfig,n),t.layers.forEach(i=>{["range","ground"].includes(i.l_type)||rr(i.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 IG),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return E(this,null,function*(){return new Promise(n=>{let i={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(i),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 E(this,null,function*(){var n;let i=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)i=l;else return null}e=S({},this.placeConfig,e);let o=new Yt(this.bmap.context);o.userData.data=t;let s=this.floors.find(l=>l.floor===i.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:i}}),this.bmap.context.scene.background=new LG(e.backgroundColor),this.getFloorBaseLayer(i,o),this.changeFloorBox(i,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(),i.layers.forEach(l=>{["range","ground"].includes(l.l_type)||rr(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 Wo(),yield this.getFloorContentLayer(i,o),this.changeFloorBox(i,o),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield Um(2),yield this.getFloorPoi(i,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 Yt(this.bmap.context));let n=[0,0];return t.layers.forEach(i=>{switch(i.l_type){case"range":let o=i.elements[0];n=[o.center_x,o.center_y];break;case"ground":rr(i.elements,n);let s=i.elements.map(a=>new et(this.bmap.context,S({},a,{dashed:!1})));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return E(this,null,function*(){e||(e=new Yt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let i=0;i<t.layers.length;i++){let o=t.layers[i];["range","ground"].includes(o.l_type)||(h3(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Wo(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return E(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(s=>p3(s,e,this.locale,n))),console.log("poi time",Date.now()-i);let o=Date.now();Wo().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return E(this,null,function*(){var t;c3((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 ir,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=S({},NG,e),this.placeConfig=S({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var BJ=d(P(),1);function m3(r,t){return E(this,null,function*(){let{brand:e,project:n}=r,{apiDomain:i,apiPath:{floorRange:o},apiInfo:s}=t,a=""+i+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 v3(r,t){return E(this,null,function*(){let{brand:e,project:n,floor:i,ts:o,resource_type_list:s}=r,{apiDomain:a,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+a+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+i+"&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 LJ(r,t){return E(this,null,function*(){let{project:e,floor:n}=r,{apiDomain:i,apiInfo:o}=t,s=i+"/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?OG(u.fileId,t):null)})}function OG(r,t){return E(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+r,n).then(i=>i.arrayBuffer()).then(i=>{let s=new TextDecoder("utf-8").decode(i);return s?JSON.parse(s):null})})}var _3=class{load(t){return E(this,null,function*(){let e=tr(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),v3(t,this.bmap.config)]),i=tr({floor:t.floor,ts:t.ts});rr(n.map(s=>s.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),n.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return E(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,i=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)}i.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=i,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(i=>!n.has(i.element_uuid))}switchFloorByStoreData(t,e){return E(this,null,function*(){let n=yield this.load(S({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return E(this,null,function*(){let n=yield this.load(S({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return E(this,null,function*(){let{brand:e,project:n}=t,i=yield this.loadBuildingGround({brand:e,project:n});return this.bmap.currentBuildGround=i,this.bmap.changeBuildingCenter(i,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return E(this,null,function*(){let{brand:e,project:n}=t,i=tr({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=m3({brand:e,project:n},this.bmap.config).then(s=>(this.buildingGroundMap.set(i,s),s));return this.buildingGroundMap.set(i,o),o})}switchFloor(t){return E(this,null,function*(){let e=new Yt(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 sQ=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),Ca=class extends DG{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?Bo(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:i,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 E(this,null,function*(){return this.loader||(this.loader=new Ar(this),this.loader.placeConfig=S({},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 i=(n=this.context.currentFloor)==null?void 0:n.addModel(S({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(i){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;i.rotateZ((180-o)/180*Math.PI),i.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,i=t.getCenter(),o=(n==null?void 0:n[0])||i.x,s=(n==null?void 0:n[1])||i.y;return console.log(o,s,n,i),this.context.currentFloor.addPoi(S({},e,{position:{x:o,y:s,z:i.z+t.options.height/2}}))}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,i){e===void 0&&(e=500),n===void 0&&(n=0),i===void 0&&(i=0);let o=t.getPosition().clone(),{context:{camera:s}}=this;if(s.updateMatrix(),i){let a=new Wc;a.setFromMatrixColumn(s.matrix,1),a.normalize(),a.multiplyScalar(i/s.zoom),o.add(a)}if(n){let a=new Wc;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 E(this,null,function*(){return e===void 0&&(e=500),zt(new Promise(n=>{let i=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:s,height:a},camera:u}=this.context,c=L(o,u,s,a).x-s/2,h=new Wc;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),i.add(h),this.context.setCameraPosition(i,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:i}=this.container;return L(e,this.context.camera,n,i)}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 E(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 E(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new ia(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",i=>{let{distance:o}=i;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 oa(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",i=>{let{area:o}=i;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=Bo(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(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[i,o]=t.geometry.cds;t.geometry.coords=[i-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(),bt.dispose(),W.dispose(),ue.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 j,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 i=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=i,this.context.control.minPolarAngle=i}if(this.azimuthalKeys.includes(n.code)){let i=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=i,this.context.control.minAzimuthAngle=i}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),i=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=i,this.context.control.minZoom=o,this.context.control.maxZoom=o*30,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=a3(e),this.context=new Ma(t,this.config),this.debounceResize=UG(this.resize,5),this.registryEvent()}};var hQ=d(P(),1);import{EventDispatcher as FG}from"three";var Mt=class extends FG{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 y3=class extends Mt{fetchEquipment(){return E(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,i=""+t+e;yield fetch(i,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)),i=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=n,i.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 btt=d(ti(),1),Mtt=d(Bt(),1),wtt=d(P(),1),Ttt=d(Gc(),1);var FQ=d(P(),1),BQ=d(B(),1);import{Mesh as qG,Object3D as XG,TextureLoader as jG,Color as YG,Vector2 as Xc,Vector3 as KG,NormalBlending as ZG,RepeatWrapping as $G}from"three";var _Q=d(kl(),1),yQ=d(hi(),1),xQ=d(pi(),1),EQ=d(di(),1),SQ=d(gi(),1),bQ=d(mi(),1),MQ=d(_i(),1),wQ=d(yi(),1),TQ=d(xi(),1),AQ=d(Ei(),1),CQ=d(Si(),1),RQ=d(bi(),1),PQ=d(Mi(),1),IQ=d(Ti(),1),LQ=d(Ai(),1),NQ=d(B(),1),OQ=d(Pc(),1);import{BufferGeometry as BG,Matrix4 as E3,Vector3 as Un,Ray as zG,Sphere as GG,LineSegments as kG,BufferAttribute as _n,ShaderChunk as Lt,ShaderMaterial as S3,UniformsLib as VG,Color as HG,Vector2 as x3}from"three";var Nt=class extends BG{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 E3,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)}}})}};Nt.prototype.setMatrixWorld=function(r){this.matrixWorld=r};Nt.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};Nt.prototype.setPoints=function(r,t){if(!(r instanceof Float32Array)&&!(r instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=r,this.widthCallback=t,this.positions=[],this.counters=[],r.length&&r[0]instanceof Un)for(var e=0;e<r.length;e++){var n=r[e],i=e/r.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(i),this.counters.push(i)}else for(var e=0;e<r.length;e+=3){var i=e/r.length;this.positions.push(r[e],r[e+1],r[e+2]),this.positions.push(r[e],r[e+1],r[e+2]),this.counters.push(i),this.counters.push(i)}this.process()};function WG(r,t){var e=new E3,n=new zG,i=new GG,o=new Un,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(e);var a=new Un,u=new Un,l=new Un,c=this instanceof kG?2:1,h=s.index,p=s.attributes;if(h!==null)for(var f=h.array,m=p.position.array,v=p.width.array,_=0,x=f.length-1;_<x;_+=c){var M=f[_],A=f[_+1];a.fromArray(m,M*3),u.fromArray(m,A*3);var I=v[Math.floor(_/3)]!==void 0?v[Math.floor(_/3)]:1,T=r.params.Line.threshold+this.material.lineWidth*I/2,C=T*T,b=n.distanceSqToSegment(a,u,o,l);if(!(b>C)){o.applyMatrix4(this.matrixWorld);var R=r.ray.origin.distanceTo(o);R<r.near||R>r.far||(t.push({distance:R,point:l.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this}),_=x)}}}}Nt.prototype.raycast=WG;Nt.prototype.compareV3=function(r,t){var e=r*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]};Nt.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Nt.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new Un(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new Un(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=i.distanceTo(o);t+=s}return t};Nt.prototype.process=function(){var r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(r-1);var n;this.compareV3(0,r-1)?n=this.copyV3(r-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 i=0;i<r;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(i/(r-1)):t=1,this.width.push(t),this.width.push(t),i===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(i===r-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(i)/e;this.uvs.push(s,0),this.uvs.push(s,1)}if(i<r-1){n=this.copyV3(i),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=i*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}i>0&&(n=this.copyV3(i),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(r-1,0)?n=this.copyV3(1):n=this.copyV3(r-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 _n(new Float32Array(this.positions),3),previous:new _n(new Float32Array(this.previous),3),next:new _n(new Float32Array(this.next),3),side:new _n(new Float32Array(this.side),1),width:new _n(new Float32Array(this.width),1),uv:new _n(new Float32Array(this.uvs),2),index:new _n(new Uint16Array(this.indices_array),1),counters:new _n(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 qc(r,t,e,n,i){var o;if(r=r.subarray||r.slice?r:r.buffer,e=e.subarray||e.slice?e:e.buffer,r=t?r.subarray?r.subarray(t,i&&t+i):r.slice(t,i&&t+i):r,e.set)e.set(r,n);else for(o=0;o<r.length;o++)e[o+n]=r[o];return e}Nt.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;qc(t,0,e,0,i),qc(t,6,t,0,i-6),t[i-6]=r.x,t[i-5]=r.y,t[i-4]=r.z,t[i-3]=r.x,t[i-2]=r.y,t[i-1]=r.z,qc(t,6,n,0,i-6),n[i-6]=r.x,n[i-5]=r.y,n[i-4]=r.z,n[i-3]=r.x,n[i-2]=r.y,n[i-1]=r.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};Lt.meshline_vert=["",Lt.logdepthbuf_pars_vertex,Lt.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;","",Lt.logdepthbuf_vertex,Lt.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Lt.fog_vertex,"}"].join(`
|
|
3911
|
+
`,n=-1/0,i=this.geometry.getAttribute("position");if(i)for(let s=0;s<i.count;s++){let a=i.getZ(s);a>n&&(n=a)}let o=new dz({uniforms:{maxZ:{value:n},uColor:{value:new G6(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new G6(Ue(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=W.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 hz(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:i}=n.geometry;for(let o=0;o<i.length;o++){let s=i[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 z6(u[0],u[1],e)),t.push(new z6(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new pz().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new fz(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=>S({},Oc,n)),this.init()}};var j7=d(P(),1),Y7=d(jo(),1);import{Box2 as Fc,Object3D as gz,Sprite as k6,SpriteMaterial as V6,Vector2 as la}from"three";import{isNil as zi}from"lodash";var mz={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 gz{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:i,text_texture_offset_y:o}=this.options;return!zi(t)&&!zi(e)&&!zi(n)&&!zi(i)&&!zi(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=>E(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 E(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>E(this,null,function*(){let e;if(this.options.icon_border){let{icon:i,icon_size:o,icon_border:s}=this.options;e=yield ct.getUrlTextureBorder(i,o[0]-s.width*2,s)}else e=yield ct.getTextureByUrl(this.options.icon);let n=new k6(new V6({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:i,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(i/t.image.width,o/t.image.height),this.textAspect=i/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 k6(new V6({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,i=0,{icon:o}=this.options;o?this.hasText?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):this.hasText?(i=.5,n=0):(n=0,i=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,i)}init(){return E(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,i=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 Fc(new la(i-s,o-this.iconHeight),new la(i+s,o)),u=this.textWidth/2,l=new Fc(new la(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new la(i+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 Fc,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 i;this.options=Zn(S({},mz,e,{text:(i=(n=e.text)==null?void 0:n.trim())!=null?i:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var nZ=d(jo(),1);import{DoubleSide as vz,Matrix4 as H6,Mesh as _z,MeshBasicMaterial as yz,Object3D as xz,PlaneGeometry as Ez}from"three";import{mergeGeometries as Sz}from"three/examples/jsm/utils/BufferGeometryUtils.js";var bz={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},ca=class extends xz{init(){return E(this,null,function*(){let t=this.options.map(s=>tt.getTextureByText(s.texts[0],{fillStyle:w0(s.fillColor,s.fillOpacity),strokeStyle:w0(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 Ez(p,u.secondHeight),m=new H6().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new H6().makeRotationZ(u.secondRotate));return f.applyMatrix4(m),f}),n=Sz(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let{texture:a}=s,u=new yz({map:a,alphaTest:1,side:vz});return a.needsUpdate=!0,u}),o=new _z(n,i);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(i=>i.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>S({},bz,n)).filter(n=>n.texts[0].trim()),this.options.length&&this.init()}};import{Object3D as Mz}from"three";import{Line2 as wz}from"three/examples/jsm/lines/Line2.js";import{LineGeometry as Tz}from"three/examples/jsm/lines/LineGeometry.js";import{LineMaterial as Az}from"three/examples/jsm/lines/LineMaterial.js";var Gi=class extends Mz{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 wz(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&J(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 Tz,this.lineMaterial=new Az({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:i,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(i,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};import{Frustum as Cz}from"three";var ha=class extends Kt{setEnable(t){super.setEnable(t),mt(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:i}}}=this,o=L(this.startPoint,e,n,i),s=L(this.endPoint,e,n,i),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:i}=this;return((n=i.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof et&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let f=L(p,i,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=L(u,i,o,s),h=L(l,i,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 Cz,this.onPointerDown=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=i=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o)},this.onPointerUp=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let i=this.getSvgCoordinate(this.startPoint),o=S({},i);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(i.x,o.x),y:Math.min(i.y,o.y)},a=Math.abs(o.x-i.x),u=Math.abs(o.y-i.y);mt(this.rect,s.x,s.y,a,u)}else mt(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 pa=class extends Rz{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:i}=e,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-n)**2+(s-i)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,i),u=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(n,i).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))}}),(Jn?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=>{Qn(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Qn(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(i=>{this._list.add(i)}),this.selectEnd()},this.boxSelection=new ha(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var QZ=d(de(),1),t$=d(ge(),1),e$=d(me(),1),n$=d(ve(),1),r$=d(_e(),1),i$=d(ye(),1),o$=d(xe(),1),s$=d(P(),1);import{EventDispatcher as Pz,Vector2 as Iz}from"three";var fa=class extends Pz{handleHoverGraphicsChange(t){t===void 0&&(t=this.curGraphics),this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new j,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:n,pois:i,e:o}=e,s=i.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=i.find(m=>m.options.id===p.options.id);if(f instanceof On){let{x:m,y:v}=f.clientPos,_=Math.sqrt((m-o.offsetX)**2+(v-o.offsetY)**2);_<h&&(h=_,c=p)}else if(f instanceof nt){let{x:m,y:v}=f.box.getCenter(new Iz),_=Math.sqrt((m-o.offsetX)**2+(v-o.offsetY)**2);_<h&&(h=_,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 _$=d(P(),1);import{Box3 as Lz,Vector3 as Ae}from"three";import{polygon as W6,intersect as Nz}from"@turf/turf";var da=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 Yt).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,l=[new Ae(s.x,s.y,s.z),new Ae(a.x,s.y,s.z),new Ae(s.x,a.y,s.z),new Ae(a.x,a.y,s.z),new Ae(s.x,s.y,a.z),new Ae(a.x,s.y,a.z),new Ae(s.x,a.y,a.z),new Ae(a.x,a.y,a.z)].map(m=>L(m,n,i,o)),c=Math.min(...l.map(m=>m.x)),h=Math.max(...l.map(m=>m.x)),p=Math.min(...l.map(m=>m.y)),f=Math.max(...l.map(m=>m.y));return{left:c,right:h,top:p,bottom:f}}checkDistanceToScreenEdge(t){let{left:e,right:n,top:i,bottom:o}=t,{width:s,height:a}=this.context.clientSize,[u,l,c,h]=this.context.config.cameraBound.padding,p=W6([[[e,i],[n,i],[n,o],[e,o],[e,i]]]),f=W6([[[h,u],[s-l,u],[s-l,a-c],[h,a-c],[h,u]]]);try{return Nz(p,f)!==null}catch(m){return console.warn("\u8BA1\u7B97\u4EA4\u96C6\u51FA\u9519:",m),!1}}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new Ae,zoom:1,target:new Ae},this.enable=!0,this.box=new Lz,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:n,right:i,top:o,bottom:s}=e;this.checkDistanceToScreenEdge({left:n,right:i,top:o,bottom:s})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var O$=d(Gc(),1);import{Vector3 as s3}from"three";import{Tween as ya,Group as eG}from"@tweenjs/tween.js";var P$=d(P(),1),I$=d(B(),1);import{EventDispatcher as Zz,MOUSE as Mr,Quaternion as i3,Spherical as ma,TOUCH as wr,Vector2 as It,Vector3 as Zt,Plane as $z,Ray as Jz,MathUtils as Qz}from"three";var va=new Jz,o3=new $z,tG=Math.cos(70*Qz.DEG2RAD),_a=class extends Zz{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 It,this.rotateLineEnd=new It,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 Zt,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:Mr.PAN,MIDDLE:Mr.DOLLY,RIGHT:Mr.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(y){y.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=y},this.stopListenToKeyEvents=function(){var y;(y=this._domElementKeyEvents)==null||y.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){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=i.NONE},this.update=function(){let y=new Zt,w=new i3().setFromUnitVectors(t.up,new Zt(0,1,0)),H=w.clone().invert(),Z=new Zt,At=new i3,he=new Zt,$t=2*Math.PI;return function(Ir){Ir===void 0&&(Ir=null);let Ce=n.object.position;y.copy(Ce).sub(n.target),y.applyQuaternion(w),a.setFromVector3(y),n.autoRotate&&o===i.NONE&&D(z(Ir)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let Re=n.minAzimuthAngle,Pe=n.maxAzimuthAngle;isFinite(Re)&&isFinite(Pe)&&(Re<-Math.PI?Re+=$t:Re>Math.PI&&(Re-=$t),Pe<-Math.PI?Pe+=$t:Pe>Math.PI&&(Pe-=$t),Re<=Pe?a.theta=Math.max(Re,Math.min(Pe,a.theta)):a.theta=a.theta>(Re+Pe)/2?Math.max(Re,a.theta):Math.min(Pe,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&&C||n.object.isOrthographicCamera?a.radius=Tt(a.radius):a.radius=Tt(a.radius*l),y.setFromSpherical(a),y.applyQuaternion(H),Ce.copy(n.target).add(y),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 ji=!1;if(n.zoomToCursor&&C){let Lr=null;if(n.object.isPerspectiveCamera){let Nr=y.length();Lr=Tt(Nr*l);let Yi=Nr-Lr;n.object.position.addScaledVector(I,Yi),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let Nr=new Zt(T.x,T.y,0);Nr.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),ji=!0;let Yi=new Zt(T.x,T.y,0);Yi.unproject(n.object),n.object.position.sub(Yi).add(Nr),n.object.updateMatrixWorld(),Lr=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Lr!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Lr).add(n.object.position):(va.origin.copy(n.object.position),va.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(va.direction))<tG?t.lookAt(n.target):(o3.setFromNormalAndCoplanarPoint(n.object.up,n.target),va.intersectPlane(o3,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),ji=!0);return l=1,C=!1,ji||Z.distanceToSquared(n.object.position)>s||8*(1-At.dot(n.object.quaternion))>s||he.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),Z.copy(n.object.position),At.copy(n.object.quaternion),he.copy(n.target),ji=!1,!0):!1}}();let n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=i.NONE,s=1e-6,a=new ma,u=new ma,l=1,c=new Zt,h=new It,p=new It,f=new It,m=new It,v=new It,_=new It,x=new It,M=new It,A=new It,I=new Zt,T=new It,C=!1,b=[],R={};function z(y){return y!==null?2*Math.PI/60*n.autoRotateSpeed*y:2*Math.PI/60/60*n.autoRotateSpeed}function N(){return Math.pow(.95,n.zoomSpeed)}function D(y){u.theta-=y}function rt(y){u.phi-=y}let st=function(){let y=new Zt;return function(H,Z){y.setFromMatrixColumn(Z,0),y.multiplyScalar(-H),c.add(y)}}(),wt=function(){let y=new Zt;return function(H,Z){n.screenSpacePanning===!0?y.setFromMatrixColumn(Z,1):(y.setFromMatrixColumn(Z,0),y.crossVectors(n.object.up,y)),y.multiplyScalar(H),c.add(y)}}(),Ot=function(){let y=new Zt;return function(H,Z){let At=n.domElement;if(n.object.isPerspectiveCamera){let he=n.object.position;y.copy(he).sub(n.target);let $t=y.length();$t*=Math.tan(n.object.fov/2*Math.PI/180),st(2*H*$t/At.clientHeight,n.object.matrix),wt(2*Z*$t/At.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(st(H*(n.object.right-n.object.left)/n.object.zoom/At.clientWidth,n.object.matrix),wt(Z*(n.object.top-n.object.bottom)/n.object.zoom/At.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Fn(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Rr(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Pr(y){if(!n.zoomToCursor)return;C=!0;let w=n.domElement.getBoundingClientRect(),H=y.clientX-w.left,Z=y.clientY-w.top,At=w.width,he=w.height;T.x=H/At*2-1,T.y=-(Z/he)*2+1,I.set(T.x,T.y,1).unproject(n.object).sub(n.object.position).normalize()}function Tt(y){return Math.max(n.minDistance,Math.min(n.maxDistance,y))}function th(y){h.set(y.clientX,y.clientY)}function X3(y){Pr(y),x.set(y.clientX,y.clientY)}function eh(y){m.set(y.clientX,y.clientY)}function j3(y){p.set(y.clientX,y.clientY),f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let w=n.domElement;D(2*Math.PI*f.x/w.clientHeight),rt(2*Math.PI*f.y/w.clientHeight),h.copy(p),n.update()}function Y3(y){M.set(y.clientX,y.clientY),A.subVectors(M,x),A.y>0?Fn(N()):A.y<0&&Rr(N()),x.copy(M),n.update()}function K3(y){v.set(y.clientX,y.clientY),_.subVectors(v,m).multiplyScalar(n.panSpeed),Ot(_.x,_.y),m.copy(v),n.update()}function Z3(y){Pr(y),y.deltaY<0?Rr(N()):y.deltaY>0&&Fn(N()),n.update()}function $3(y){let w=!1;switch(y.code){case n.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?rt(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(0,n.keyPanSpeed),w=!0;break;case n.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?rt(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(0,-n.keyPanSpeed),w=!0;break;case n.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?D(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(n.keyPanSpeed,0),w=!0;break;case n.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?D(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(-n.keyPanSpeed,0),w=!0;break}w&&(y.preventDefault(),n.update())}function nh(){if(b.length===1)h.set(b[0].pageX,b[0].pageY);else{let y=(b[0].pageX-b[0].pageY)/(b[1].pageX-b[1].pageY),w=b[0].pageY-y*b[0].pageX;n.rotateLineStart.set(y,w);let H=.5*(b[0].pageX+b[1].pageX),Z=.5*(b[0].pageY+b[1].pageY);h.set(H,Z)}}function rh(){if(b.length===1)m.set(b[0].pageX,b[0].pageY);else{let y=.5*(b[0].pageX+b[1].pageX),w=.5*(b[0].pageY+b[1].pageY);m.set(y,w)}}function ih(){let y=b[0].pageX-b[1].pageX,w=b[0].pageY-b[1].pageY,H=Math.sqrt(y*y+w*w);x.set(0,H)}function J3(){n.enableZoom&&ih(),n.enablePan&&rh()}function Q3(){n.enableZoom&&ih(),n.enableRotate&&nh()}function oh(y){if(b.length==1)p.set(y.pageX,y.pageY);else{let H=Ya(y),Z=.5*(y.pageX+H.x),At=.5*(y.pageY+H.y);p.set(Z,At);let he=(y.pageY-H.y)/(y.pageX-H.x),$t=H.y-he*H.x;if(n.rotateLineEnd.set(he,$t),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let Ka=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Ir=he*Ka+$t;if(Number.isFinite(Ka)&&Number.isFinite(Ir)){let Ce=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(Ce)<.5&&(Ce=-Math.sign(Ce)*(Math.PI-Math.abs(Ce))),Math.abs(Ce)<.1&&(u.theta+=Ce)}}n.rotateLineStart.copy(n.rotateLineEnd)}f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let w=n.domElement;rt(2*Math.PI*f.y/w.clientHeight),h.copy(p)}function sh(y){if(b.length===1)v.set(y.pageX,y.pageY);else{let w=Ya(y),H=.5*(y.pageX+w.x),Z=.5*(y.pageY+w.y);v.set(H,Z)}_.subVectors(v,m).multiplyScalar(n.panSpeed),Ot(_.x,_.y),m.copy(v)}function ah(y){let w=Ya(y),H=y.pageX-w.x,Z=y.pageY-w.y,At=Math.sqrt(H*H+Z*Z);M.set(0,At),A.set(0,Math.pow(M.y/x.y,n.zoomSpeed)),Fn(A.y),x.copy(M)}function t1(y){n.enableZoom&&ah(y),n.enablePan&&sh(y)}function e1(y){n.enableZoom&&ah(y),n.enableRotate&&oh(y)}this.onPointerDown=function(w){n.enabled!==!1&&(b.length===0&&(n.domElement.setPointerCapture(w.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),s1(w),w.pointerType==="touch"?i1(w):n1(w))},this.onPointerMove=function(w){n.enabled!==!1&&(w.pointerType==="touch"?o1(w):r1(w))},this.onPointerUp=function(w){a1(w),b.length===0&&(n.domElement.releasePointerCapture(w.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=i.NONE};function n1(y){let w;switch(y.button){case 0:w=n.mouseButtons.LEFT;break;case 1:w=n.mouseButtons.MIDDLE;break;case 2:w=n.mouseButtons.RIGHT;break;default:w=-1}switch(w){case Mr.DOLLY:if(n.enableZoom===!1)return;X3(y),o=i.DOLLY;break;case Mr.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enablePan===!1)return;eh(y),o=i.PAN}else{if(n.enableRotate===!1)return;th(y),o=i.ROTATE}break;case Mr.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enableRotate===!1)return;th(y),o=i.ROTATE}else{if(n.enablePan===!1)return;eh(y),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function r1(y){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;j3(y);break;case i.DOLLY:if(n.enableZoom===!1)return;Y3(y);break;case i.PAN:if(n.enablePan===!1)return;K3(y);break}}this.onMouseWheel=function(w){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(w.preventDefault(),n.dispatchEvent({type:"start"}),Z3(w),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(w){n.enabled===!1||n.enablePan===!1||$3(w)};function i1(y){switch(uh(y),b.length){case 1:switch(n.touches.ONE){case wr.ROTATE:if(n.enableRotate===!1)return;nh(),o=i.TOUCH_ROTATE;break;case wr.PAN:if(n.enablePan===!1)return;rh(),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case wr.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;J3(),o=i.TOUCH_DOLLY_PAN;break;case wr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Q3(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function o1(y){switch(uh(y),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;oh(y),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;sh(y),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;t1(y),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;e1(y),n.update();break;default:o=i.NONE}}this.onContextMenu=function(w){n.enabled!==!1&&w.preventDefault()};function s1(y){b.push(y)}function a1(y){delete R[y.pointerId];for(let w=0;w<b.length;w++)if(b[w].pointerId==y.pointerId){b.splice(w,1);return}}function uh(y){let w=R[y.pointerId];w===void 0&&(w=new It,R[y.pointerId]=w),w.set(y.pageX,y.pageY)}function Ya(y){let w=y.pointerId===b[0].pointerId?b[1]:b[0];return R[w.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 xa=class extends _a{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:i}=this,o=n===i;(e||t<=n&&t>=i)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=n,this.minPolarAngle=i)}setPolarAngleByDuration(t,e,n){return E(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):zt(new Promise(i=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new ya(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:n,minAzimuthAngle:i}=this,o=n===i;(e||t<=n&&t>=i)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=n,this.minAzimuthAngle=i)}setAzimuthalAngleDuration(t,e,n){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setAzimuthalAngle(t,e):zt(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new ya(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}getCameraLookAt(){return new s3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return E(this,null,function*(){let n=this.target.clone(),i=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(i)),this.target.copy(t.clone()),this.update();return}return zt(new Promise(o=>{let s=new ya(n,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(n.clone().sub(i)),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:i,maxZoom:o}=this;(n||t>=i&&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,i){return E(this,null,function*(){n===void 0&&(n=!1),i===void 0&&(i=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return i?zt(new Promise(s=>{let a=new ya(o,this.tweenGroup).to({zoom:t,target:e},i).onUpdate(()=>{this.setZoom(o.zoom,o.target,n)}).onComplete(()=>{this.tweenGroup.remove(a),this.enabled=!0,s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+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 s3;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 eG,this.offsetY=0,this.onChange=()=>{let i=this.camera.zoom;i!==this.prevCameraZoom&&(this.prevCameraZoom=i,this.dispatchEvent({type:"change-zoom",zoom:i}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};import{EventDispatcher as nG,PCFSoftShadowMap as rG,WebGLRenderer as iG}from"three";var Ea=class extends iG{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(S({antialias:!0,alpha:!0},t)),this.event=new nG,this.enable=!0,this.timer=new j,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=rG}};import{Euler as oG,Matrix4 as sG,Scene as aG,EquirectangularReflectionMapping as uG}from"three";import{RGBELoader as lG}from"three/examples/jsm/loaders/RGBELoader.js";var Sa=class extends aG{constructor(){super(),new lG().load(T6,t=>{t.mapping=uG,this.environment=t;let e=new sG;e.makeRotationX(Math.PI/2),this.environmentRotation=new oG().setFromRotationMatrix(e)})}};import{OrthographicCamera as cG}from"three";var ba=class extends cG{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 Ma=class extends hG{resizeClientSize(){let{x:t,y:e,width:n,height:i}=this.container.getBoundingClientRect();this.clientSize={width:n||this.container.clientWidth,height:i||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new ba(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new xa(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 da(this)}getRatio(t,e){t===void 0&&(t=new qe(0,0,0)),e===void 0&&(e=new qe(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=L(t,this.camera,n,i),s=L(e,this.camera,n,i);return Math.ceil(Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof mG&&(e.color=new gG(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 i=new Tr;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new fG;return o.setFromCamera(i,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,i;let o=(n=this.currentFloor)==null?void 0:n.poiLayer.getPoiByDeviceXy(t,e),s=(i=this.currentFloor)==null?void 0:i.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,i){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),i===void 0&&(i=!0);let[o,s,a,u]=e,{clientSize:{width:l,height:c}}=this,h=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let p=new dG().setFromObject(t);this.setPolarAngle(h,0);let{max:f,min:m}=p,v=new qe(m.x,f.y,f.z),_=new qe(f.x,f.y,f.z),x=new qe(f.x,m.y,m.z),M=new qe(m.x,m.y,m.z),A=L(v,this.camera,l,c),I=L(_,this.camera,l,c),T=L(M,this.camera,l,c),C=L(x,this.camera,l,c),R=new pG().setFromPoints([new Tr(A.x,A.y),new Tr(I.x,I.y),new Tr(T.x,T.y),new Tr(C.x,C.y)]).getSize(new Tr),z=(l-s-u)/R.x,N=(c-o-a)/R.y,D=Math.min(z,N),rt=new qe((f.x+m.x)/2,(f.y+m.y)/2,(f.z+m.z)/2),st=D*this.camera.zoom,wt=this.camera.clone();wt.zoom=st,wt.updateMatrix();let Ot=(l-R.x*D)/2,Fn=(c-R.y*D)/2,Rr=(s-u)/2,Pr=(o-a)/2;if(Rr){let Tt=new qe;Tt.setFromMatrixColumn(wt.matrix,0),Tt.normalize(),Tt.multiplyScalar(Rr/st),rt.add(Tt)}if(Pr){let Tt=new qe;Tt.setFromMatrixColumn(wt.matrix,1),Tt.normalize(),Tt.multiplyScalar(Pr/st),rt.add(Tt)}return{zoom:D*this.camera.zoom,center:rt}}fitCameraToObject(t,e,n,i){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),i===void 0&&(i=!0);let{zoom:o,center:s}=this.getFitCameraToObjectZoom(t,e,n,i);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 E(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()),J(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new Sa,this.renderer=new Ea,this.lights=Wg(),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:i}=n;this.dispatchEvent({type:"control-zoom-change",zoom:i})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:i,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),i.left=-s/2,i.right=s/2,i.top=a/2,i.bottom=-a/2,i.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);i.length&&this.dispatchEvent({type:"graphic-click",graphics:i,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:i,pois:s,position:o})},this.onPointermove=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:i,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:i,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:i,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:i}=n;this.dispatchEvent({type:"hover",graphics:i})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new pa(this),this.hoverHelper=new fa(this),this.resizeClientSize(),this.registryEvent()}};import{merge as vG}from"lodash";var _G={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 a3(r){return vG({},_G,r)}import{debounce as UG}from"lodash";var bJ=d(P(),1);var le;function u3(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(le)return e({db:le,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){le=o.target.result,console.log("onupgradeneeded"),e({db:le,type:"onupgradeneeded"})},i.onsuccess=o=>{le=o.target.result,e({db:le,type:"success"})},i.onerror=o=>{n(o)}})}function kc(r,t,e){return e===void 0&&(e=le),new Promise((n,i)=>{e||i("\u6CA1\u6709db");let s=e.transaction([r],"readonly").objectStore(r).get(t);s.onsuccess=()=>{s.result?n(s.result.value):n(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),n(null)}})}function l3(r,t,e,n){return n===void 0&&(n=le),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>E(this,null,function*(){let u=yield kc(r,t),l=n.transaction([r],"readwrite").objectStore(r),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 Dn(r,t){t===void 0&&(t=le),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function c3(r){r===void 0&&(r=le),r==null||r.close(),le=null}import{Vector3 as IG,Color as LG}from"three";var gJ=d(B(),1),mJ=d(P(),1);function wa(r,t){let e=r.poi_info.showName||r.store_name||r.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=r.store_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var i;return((i=r.store_info_ext)==null?void 0:i.traditional_name)||e}}function Ta(r,t){let e=r.poi_info.showName||r.store_name||r.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=r.infra_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var i;return((i=r.infra_info_ext)==null?void 0:i.traditional_name)||e}}function h3(r,t,e){switch(r.l_type){case"graph":return yG(r,t);case"wall":return xG(r,t);case"lane":return EG(r,t);case"texture2d":case"texture3d":return SG(r,t);case"glb":return bG(r,t);case"store":return MG(r,t);case"facility":return TG(r,t);case"parkingSpace":return CG(r,t,e);case"text":return PG(r,t)}}function p3(r,t,e,n){switch(r.l_type){case"store":return wG(r,t,e,n);case"facility":return AG(r,t,e,n);case"parkingSpace":return RG(r,t,n)}}function yG(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=i,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(i):n[h]=[i],n},{});Object.values(e).forEach(n=>{let i=new br(t.context,n);t.mergeGraphicLayer.add(i)})}function xG(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l}=i,c=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l;return u===0&&(c=o.toLowerCase()+"-"+s+"-"+l),n[c]?n[c].push(i):n[c]=[i],n},{});Object.values(e).forEach(n=>{let i=new sa(t.context,n);t.wallLayer.add(i)})}function EG(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u}=i,l=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u;return u===0&&(l=o.toLowerCase()+"-"+s),n[l]?n[l].push(i):n[l]=[i],n},{});Object.values(e).forEach(n=>{let i=new ua(t.context,n);t.laneLayer.add(i)})}function SG(r,t){if(r.elements.length){let e=new Sr(t.context,r.elements);t.textureLayer.add(e)}}function bG(r,t){r.elements.forEach(e=>{let n=new aa(t.context,S({},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 MG(r,t){r.elements.map(e=>{let n=t.addGraphic(S({},e,{dashed:!1}));t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function wG(r,t,e,n){r.elements.map(i=>{try{let o=wa(i,e),s=new nt(t.context,{id:i.id,icon:i.poi_info.showImageUrl||i.poi_info.icon,text:o,position:{x:i.center_coord_x,y:i.center_coord_y,z:i.airHeight+i.height},icon_size:[24,24],level:i.poi_info.level||0,hide_text:!n.showStoreName,maxWeight:i.poi_info.maxWeight||25,minWeight:i.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(s),s&&(s.userData.type="store",s.userData.data=i,s.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,i)}})}function TG(r,t){r.elements.map(e=>{let n=t.addGraphic(S({},e,{dashed:!1}));t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function AG(r,t,e,n){r.elements.filter(o=>o.poi_info).map(o=>{try{let s=Ta(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 CG(r,t,e){t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function RG(r,t,e){return E(this,null,function*(){let n=r.elements.filter(s=>s.texts[0]),i=n.map(s=>s.texts[0]),o=yield tt.lazyGetTextureByTexts(i,{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 PG(r,t){let e=new ca(t.context,r.elements.map(n=>S({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var f3="map_version",d3="route_version",g3="facility_version",Vc="map_data",Aa="road_network_data",Hc="facility_data",NG={mergeParkingSpace:!0},Ar=class extends ft{initDb(){return E(this,null,function*(){try{let{db:t,type:e}=yield u3("aibee_map",2);e==="onupgradeneeded"&&(Dn(f3),Dn(d3),Dn(g3),Dn(Vc),Dn(Aa),Dn(Hc)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return E(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=S({},this.placeConfig,e));else{let n=yield fetch(t).then(i=>i.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=S({},this.placeConfig,JSON.parse(n.data.config||"{}")))}this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return this.initDbPromise.then(()=>l3(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>kc(t,""+e,this.db))}getFloorCacheKey(t){return t.floor_id+"_"+t.version_id}getFloorData(t){return E(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return E(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=wa(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=Ta(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return E(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>E(this,null,function*(){let i=this.getFloorCacheKey(t),o=yield fetch(t.map_url).then(s=>s.json());o.floor=t.floor,this.setCacheData(Vc,i,o),this.setCacheData(f3,i,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return E(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{let i=yield this.getCacheData(Vc,n);return i?(console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u6570\u636E"),i):(console.log("\u7F13\u5B58\u4E2D\u6CA1\u6709\u6570\u636E"),this.getFloorJsonDataByFloorInfo(e))}catch(i){return console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u6570\u636E"),console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return E(this,null,function*(){return(yield Promise.all(this.floors.map(e=>E(this,null,function*(){let n=this.getFloorCacheKey(e);try{let i=yield this.getCacheData(Aa,n);if(i)return i;let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Aa,n,o),this.setCacheData(d3,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Aa,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return E(this,null,function*(){let t=this.floors.reduce((i,o)=>i.updated_at>o.updated_at?i:o,this.floors[0]);if(!t)return null;let e=this.getFloorCacheKey(t),n=()=>E(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(Hc,e,i),this.setCacheData(g3,e,t.version_id)),i});try{let i=yield this.getCacheData(Hc,e);return i||n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return E(this,null,function*(){for(let t=0;t<this.floors.length;t++){let e=this.floors[t];this.getFloorJsonData(e.floor)}})}getMulFloorsData(t){return E(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return E(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return E(this,null,function*(){e=this.getFloorBaseLayer(t,e);let i=S({},this.placeConfig,n);return t.layers.forEach(o=>{["range","ground"].includes(o.l_type)||rr(o.elements,e.userData.center)}),yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,i),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new IG),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return E(this,null,function*(){return new Promise(n=>{let i={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(i),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 E(this,null,function*(){var n;let i=t;if(typeof t=="string"){let c=yield this.getFloorJsonData(t);if(c)i=c;else return null}let o=S({},this.placeConfig,e),s=new Yt(this.bmap.context);s.userData.data=t;let a=this.floors.find(c=>c.floor===i.floor);var u;let l=(u=a==null?void 0:a.map_angle)!=null?u:0;return this.bmap.dispatchEvent({type:pt.SWITCH_FLOOR_BEFORE,data:{curFloor:s,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:s,graphics:[],floorData:i}}),this.bmap.context.scene.background=new LG(o.backgroundColor),this.getFloorBaseLayer(i,s),this.changeFloorBox(i,s),this.bmap.buildingCenter=s.userData.center,this.bmap.currentBuildGround=(n=s.userData.data.layers.find(c=>c.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(s),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(l/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),i.layers.forEach(c=>{["range","ground"].includes(c.l_type)||rr(c.elements,s.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:s,graphics:[]}}),this.bmap.dispatchEvent({type:pt.SWITCH_FLOOR_GROUND,data:{curFloor:s}}),yield Wo(),yield this.getFloorContentLayer(i,s),this.changeFloorBox(i,s),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:s,graphics:[]}}),yield Um(2),yield this.getFloorPoi(i,s,o),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:s,graphics:s.graphicLayer.children}}),this.bmap.dispatchEvent({type:pt.SWITCH_FLOOR_AFTER,data:{curFloor:s,graphics:s.graphicLayer.children}}),s})}getFloorBaseLayer(t,e){e||(e=new Yt(this.bmap.context));let n=[0,0];return t.layers.forEach(i=>{switch(i.l_type){case"range":let o=i.elements[0];n=[o.center_x,o.center_y];break;case"ground":rr(i.elements,n);let s=i.elements.map(a=>new et(this.bmap.context,S({},a,{dashed:!1})));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return E(this,null,function*(){e||(e=new Yt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let i=0;i<t.layers.length;i++){let o=t.layers[i];["range","ground"].includes(o.l_type)||(h3(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Wo(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return E(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(s=>p3(s,e,this.locale,n))),console.log("poi time",Date.now()-i);let o=Date.now();Wo().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return E(this,null,function*(){var t;c3((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 ir,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=S({},NG,e),this.placeConfig=S({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var BJ=d(P(),1);function m3(r,t){return E(this,null,function*(){let{brand:e,project:n}=r,{apiDomain:i,apiPath:{floorRange:o},apiInfo:s}=t,a=""+i+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 v3(r,t){return E(this,null,function*(){let{brand:e,project:n,floor:i,ts:o,resource_type_list:s}=r,{apiDomain:a,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+a+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+i+"&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 LJ(r,t){return E(this,null,function*(){let{project:e,floor:n}=r,{apiDomain:i,apiInfo:o}=t,s=i+"/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?OG(u.fileId,t):null)})}function OG(r,t){return E(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+r,n).then(i=>i.arrayBuffer()).then(i=>{let s=new TextDecoder("utf-8").decode(i);return s?JSON.parse(s):null})})}var _3=class{load(t){return E(this,null,function*(){let e=tr(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),v3(t,this.bmap.config)]),i=tr({floor:t.floor,ts:t.ts});rr(n.map(s=>s.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),n.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return E(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,i=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)}i.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=i,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(i=>!n.has(i.element_uuid))}switchFloorByStoreData(t,e){return E(this,null,function*(){let n=yield this.load(S({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return E(this,null,function*(){let n=yield this.load(S({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return E(this,null,function*(){let{brand:e,project:n}=t,i=yield this.loadBuildingGround({brand:e,project:n});return this.bmap.currentBuildGround=i,this.bmap.changeBuildingCenter(i,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return E(this,null,function*(){let{brand:e,project:n}=t,i=tr({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=m3({brand:e,project:n},this.bmap.config).then(s=>(this.buildingGroundMap.set(i,s),s));return this.buildingGroundMap.set(i,o),o})}switchFloor(t){return E(this,null,function*(){let e=new Yt(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 sQ=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),Ca=class extends DG{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?Bo(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:i,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 E(this,null,function*(){return this.loader||(this.loader=new Ar(this),this.loader.placeConfig=S({},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 i=(n=this.context.currentFloor)==null?void 0:n.addModel(S({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(i){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;i.rotateZ((180-o)/180*Math.PI),i.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,i=t.getCenter(),o=(n==null?void 0:n[0])||i.x,s=(n==null?void 0:n[1])||i.y;return console.log(o,s,n,i),this.context.currentFloor.addPoi(S({},e,{position:{x:o,y:s,z:i.z+t.options.height/2}}))}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,i){e===void 0&&(e=500),n===void 0&&(n=0),i===void 0&&(i=0);let o=t.getPosition().clone(),{context:{camera:s}}=this;if(s.updateMatrix(),i){let a=new Wc;a.setFromMatrixColumn(s.matrix,1),a.normalize(),a.multiplyScalar(i/s.zoom),o.add(a)}if(n){let a=new Wc;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 E(this,null,function*(){return e===void 0&&(e=500),zt(new Promise(n=>{let i=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:s,height:a},camera:u}=this.context,c=L(o,u,s,a).x-s/2,h=new Wc;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),i.add(h),this.context.setCameraPosition(i,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:i}=this.container;return L(e,this.context.camera,n,i)}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 E(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,e){t===void 0&&(t=.1),e===void 0&&(e=500);let n=this.context.control.getAzimuthalAngle();return this.context.setAzimuthalAngle(n+t,e)}measureDistance(){return E(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new ia(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",i=>{let{distance:o}=i;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 oa(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",i=>{let{area:o}=i;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=Bo(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(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[i,o]=t.geometry.cds;t.geometry.coords=[i-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(),bt.dispose(),W.dispose(),ue.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 j,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 i=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=i,this.context.control.minPolarAngle=i}if(this.azimuthalKeys.includes(n.code)){let i=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=i,this.context.control.minAzimuthAngle=i}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),i=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=i,this.context.control.minZoom=o,this.context.control.maxZoom=o*30,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=a3(e),this.context=new Ma(t,this.config),this.debounceResize=UG(this.resize,5),this.registryEvent()}};var hQ=d(P(),1);import{EventDispatcher as FG}from"three";var Mt=class extends FG{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 y3=class extends Mt{fetchEquipment(){return E(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,i=""+t+e;yield fetch(i,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)),i=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=n,i.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 btt=d(ti(),1),Mtt=d(Bt(),1),wtt=d(P(),1),Ttt=d(Gc(),1);var FQ=d(P(),1),BQ=d(B(),1);import{Mesh as qG,Object3D as XG,TextureLoader as jG,Color as YG,Vector2 as Xc,Vector3 as KG,NormalBlending as ZG,RepeatWrapping as $G}from"three";var _Q=d(kl(),1),yQ=d(hi(),1),xQ=d(pi(),1),EQ=d(di(),1),SQ=d(gi(),1),bQ=d(mi(),1),MQ=d(_i(),1),wQ=d(yi(),1),TQ=d(xi(),1),AQ=d(Ei(),1),CQ=d(Si(),1),RQ=d(bi(),1),PQ=d(Mi(),1),IQ=d(Ti(),1),LQ=d(Ai(),1),NQ=d(B(),1),OQ=d(Pc(),1);import{BufferGeometry as BG,Matrix4 as E3,Vector3 as Un,Ray as zG,Sphere as GG,LineSegments as kG,BufferAttribute as _n,ShaderChunk as Lt,ShaderMaterial as S3,UniformsLib as VG,Color as HG,Vector2 as x3}from"three";var Nt=class extends BG{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 E3,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)}}})}};Nt.prototype.setMatrixWorld=function(r){this.matrixWorld=r};Nt.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};Nt.prototype.setPoints=function(r,t){if(!(r instanceof Float32Array)&&!(r instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=r,this.widthCallback=t,this.positions=[],this.counters=[],r.length&&r[0]instanceof Un)for(var e=0;e<r.length;e++){var n=r[e],i=e/r.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(i),this.counters.push(i)}else for(var e=0;e<r.length;e+=3){var i=e/r.length;this.positions.push(r[e],r[e+1],r[e+2]),this.positions.push(r[e],r[e+1],r[e+2]),this.counters.push(i),this.counters.push(i)}this.process()};function WG(r,t){var e=new E3,n=new zG,i=new GG,o=new Un,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(e);var a=new Un,u=new Un,l=new Un,c=this instanceof kG?2:1,h=s.index,p=s.attributes;if(h!==null)for(var f=h.array,m=p.position.array,v=p.width.array,_=0,x=f.length-1;_<x;_+=c){var M=f[_],A=f[_+1];a.fromArray(m,M*3),u.fromArray(m,A*3);var I=v[Math.floor(_/3)]!==void 0?v[Math.floor(_/3)]:1,T=r.params.Line.threshold+this.material.lineWidth*I/2,C=T*T,b=n.distanceSqToSegment(a,u,o,l);if(!(b>C)){o.applyMatrix4(this.matrixWorld);var R=r.ray.origin.distanceTo(o);R<r.near||R>r.far||(t.push({distance:R,point:l.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this}),_=x)}}}}Nt.prototype.raycast=WG;Nt.prototype.compareV3=function(r,t){var e=r*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]};Nt.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Nt.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new Un(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new Un(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=i.distanceTo(o);t+=s}return t};Nt.prototype.process=function(){var r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(r-1);var n;this.compareV3(0,r-1)?n=this.copyV3(r-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 i=0;i<r;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(i/(r-1)):t=1,this.width.push(t),this.width.push(t),i===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(i===r-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(i)/e;this.uvs.push(s,0),this.uvs.push(s,1)}if(i<r-1){n=this.copyV3(i),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=i*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}i>0&&(n=this.copyV3(i),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(r-1,0)?n=this.copyV3(1):n=this.copyV3(r-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 _n(new Float32Array(this.positions),3),previous:new _n(new Float32Array(this.previous),3),next:new _n(new Float32Array(this.next),3),side:new _n(new Float32Array(this.side),1),width:new _n(new Float32Array(this.width),1),uv:new _n(new Float32Array(this.uvs),2),index:new _n(new Uint16Array(this.indices_array),1),counters:new _n(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 qc(r,t,e,n,i){var o;if(r=r.subarray||r.slice?r:r.buffer,e=e.subarray||e.slice?e:e.buffer,r=t?r.subarray?r.subarray(t,i&&t+i):r.slice(t,i&&t+i):r,e.set)e.set(r,n);else for(o=0;o<r.length;o++)e[o+n]=r[o];return e}Nt.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;qc(t,0,e,0,i),qc(t,6,t,0,i-6),t[i-6]=r.x,t[i-5]=r.y,t[i-4]=r.z,t[i-3]=r.x,t[i-2]=r.y,t[i-1]=r.z,qc(t,6,n,0,i-6),n[i-6]=r.x,n[i-5]=r.y,n[i-4]=r.z,n[i-3]=r.x,n[i-2]=r.y,n[i-1]=r.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};Lt.meshline_vert=["",Lt.logdepthbuf_pars_vertex,Lt.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;","",Lt.logdepthbuf_vertex,Lt.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Lt.fog_vertex,"}"].join(`
|
|
3912
3912
|
`);Lt.meshline_frag=["",Lt.fog_pars_fragment,Lt.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() {","",Lt.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);","",Lt.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
|
|
3913
3913
|
`);var ki=class extends S3{constructor(t){super({uniforms:Object.assign({},VG.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new HG(16777215)},opacity:{value:1},resolution:{value:new x3(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 x3(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:Lt.meshline_vert,fragmentShader:Lt.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)}};ki.prototype.copy=function(r){return S3.prototype.copy.call(this,r),this.lineWidth=r.lineWidth,this.map=r.map,this.useMap=r.useMap,this.alphaMap=r.alphaMap,this.useAlphaMap=r.useAlphaMap,this.color.copy(r.color),this.opacity=r.opacity,this.resolution.copy(r.resolution),this.sizeAttenuation=r.sizeAttenuation,this.dashArray.copy(r.dashArray),this.dashOffset.copy(r.dashOffset),this.dashRatio.copy(r.dashRatio),this.useDash=r.useDash,this.visibility=r.visibility,this.alphaTest=r.alphaTest,this.repeat.copy(r.repeat),this};var b3={texture_url:Xs,lineWidth:10,color:16777215},Ra=class extends XG{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:i}}}}}=this,o=t.map(a=>{let[u,l]=a;return L(new KG(u,l,0),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return xt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new Xc(t,1)}loadTexture(t){return new Promise((e,n)=>{new jG().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 E(this,null,function*(){let e=this.geometry=new Nt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=$G}let n=this.material=new ki({useMap:!0,color:new YG(this.config.color),transparent:!0,resolution:new Xc(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:ZG,repeat:new Xc(this.getRepeat(),1)}),i=this.mesh=new qG(e,n);return i.renderOrder=99999,this.add(i),i})}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=b3,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:i}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,i)}},this.config=Object.assign({},b3,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as jc,Easing as lk}from"@tweenjs/tween.js";import{Vector2 as ck,Vector3 as ce}from"three";var XQ=d(Qs(),1),jQ=d(P(),1),YQ=d(B(),1);import{EventDispatcher as JG,Vector2 as QG}from"three";import{Tween as tk}from"@tweenjs/tween.js";import{throttle as ek}from"lodash";import{booleanPointInPolygon as nk,point as rk,polygon as ik}from"@turf/turf";var ok={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},Pa=class extends JG{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:i,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(i){let _=De(n,i);u=u.slice(_+1),u.unshift(i)}let h=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:p,closestPoint:f,index:m,i:v}=h.reduce((_,x,M)=>{if(x.floor!==t)return _;let{distance:A,closestPoint:I,index:T}=x.points.reduce((C,b,R,z)=>{if(!z[R+1])return S({},C,{distance:C.distance===1/0?V(b,e):C.distance});let{distance:N,closestPoint:D}=xv(e,b,z[R+1]);if(l===t){let rt=[e,...z.slice(R+1)],st=xt(rt);if(c-st>10)return C}return N<C.distance?{distance:N,closestPoint:D,index:R}:C},{distance:1/0,closestPoint:x.points[0],index:0});return A<_.distance?{distance:A,closestPoint:I,index:M,i:T}:_},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:p,closestPoint:f,routeIndex:m+a,pointIndex:m===0?v+this.pointIndex:v}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:i,closestPoint:o,routeIndex:s,pointIndex:a}=n;i>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 E(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let i=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),s=o/this.options.simulationSpeed,a=this.throttleUpdatePosition=ek(l=>{let c=er(i,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new tk({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 i=[n,...t.slice(e+1)];return xt(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return xt(i)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((i,o)=>i+o.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:i,curRoutePath:o}=this,s=e,a=Fe.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===Fe.FRONT&&s<=n.length;){let m=n[s],v=n[s+1],_=n[s+2];if(!m||!v)a=Fe.END;else if(l+=V(m,v),!_)a=Fe.END;else{a=A0(m,v,_),c=zo(m,v,_),h=(new QG(_[0]-v[0],_[1]-v[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=V(i,n[s])),a===Fe.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:Fe.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=Fe.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 i=ik(n.cds),o=rk(this.position);return nk(o,i)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:i,distance:o,crossName:s,angle:a,nextAngle:u}=n;e<=10&&(i=Fe.END);let{imageUrl:l}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:o,dir:i,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 j,this.resetTimer=null,this.tweenUtil=new un,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o),this.simulationTween&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},ok,e),this.roadData=n,this.registryEvent()}};var ntt=d(Ms(),1),rtt=d(hi(),1),itt=d(pi(),1),ott=d(di(),1),stt=d(gi(),1),att=d(mi(),1),utt=d(_i(),1),ltt=d(yi(),1),ctt=d(xi(),1),htt=d(Ei(),1),ptt=d(Si(),1),ftt=d(bi(),1),dtt=d(Mi(),1),gtt=d(Ti(),1),mtt=d(Ai(),1),vtt=d(zl(),1),_tt=d(P(),1);import{DataTexture as sk,LinearFilter as M3,RGBAFormat as w3,Sprite as ak,SpriteMaterial as uk}from"three";var Xe=class r extends nt{addDebug(){r.canvas.style.cssText=`
|
|
3914
3914
|
position: fixed;
|