@aibee/crc-bmap 0.8.64 → 0.8.65

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.
@@ -106,7 +106,7 @@
106
106
  }
107
107
  `,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 at.ShaderMaterial({uniforms:{maxZ:{value:n},uColor:{value:new at.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new at.Color(Oe(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=B.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 at.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(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 at.Vector3(u[0],u[1],e)),t.push(new at.Vector3(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new at.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new at.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;this.geometry.dispose(),this.material.dispose(),(t=this.line)==null||t.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},Pa,n)),this.init()}};var oL=d(W(),1);var mt=require("three");var Nr=require("lodash");var Q4={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},ot=class extends mt.Object3D{get durIconAndText(){return this.options.icon&&this.options.text?2:0}get offset(){return this.options.icon&&this.options.text?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.options.text?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.options.text?this.options.text_font_size: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!(0,Nr.isNil)(t)&&!(0,Nr.isNil)(e)&&!(0,Nr.isNil)(n)&&!(0,Nr.isNil)(i)&&!(0,Nr.isNil)(o)}get deltaZ(){return!this.options.icon&&this.options.text?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>j(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text_font_size",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&this._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)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return j(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>j(this,null,function*(){let e=yield $t.getTextureByUrl(this.options.icon),n=new mt.Sprite(new mt.SpriteMaterial({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));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.options.text){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 t=Ut.getTextureByText(this.options.text),this.textAspect=t.image.width/t.image.height;let e=new mt.Sprite(new mt.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test}));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,text:s}=this.options;o?s?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):s?(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 j(this,null,function*(){yield Promise.all([this.initIcon(),new Promise(t=>{this.initText(),t(!0)})]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:n}}=this.context,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 mt.Box2(new mt.Vector2(i-s,o-this.iconHeight),new mt.Vector2(i+s,o)),u=this.textWidth/2,l=new mt.Box2(new mt.Vector2(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new mt.Vector2(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){super(),this.context=t,this.textAspect=1,this.box=new mt.Box2,this._initIconPromise=null,this._initScale=n=>{let{zoom:i}=n;if(this.spriteText){let s=this.textHeight/i;this.spriteText.scale.set(this.textAspect*s,s,.1)}if(this.spriteIcon){var o;(o=this.spriteIcon)==null||o.scale.set(this.options.icon_size[0]/i,this.options.icon_size[1]/i,.1)}this.resetZ()},this.options=zn(T({},Q4,e),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var Vt=require("three"),Y1=require("three/examples/jsm/utils/BufferGeometryUtils");var E1={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},So=class extends Vt.Object3D{init(){return j(this,null,function*(){let t=this.options.map(s=>Ut.getTextureByText(s.texts[0],{fillStyle:vs(s.fillColor,s.fillOpacity),strokeStyle:vs(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"54px sans-serif"})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.image,h=l/c,p=u.secondHeight*h,m=new Vt.PlaneGeometry(p,u.secondHeight),g=new Vt.Matrix4().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new Vt.Matrix4().makeRotationZ(u.secondRotate));return m.applyMatrix4(g),m}),n=(0,Y1.mergeGeometries)(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let a=new Vt.MeshBasicMaterial({map:s,alphaTest:1,side:Vt.DoubleSide});return s.needsUpdate=!0,a}),o=new Vt.Mesh(n,i);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e;(t=this.mesh)==null||t.geometry.dispose(),((e=this.mesh)==null?void 0:e.material).forEach(n=>n.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},E1,n)),this.init()}};var Dn=require("three"),bo=class extends Dn.Object3D{setPosition(t,e){this.geometry.setFromPoints([t,e]),this.line||this.createLine()}createLine(){this.line=new Dn.Line(this.geometry,this.material),this.add(this.line)}dispose(){this.line&&q(this.line),this.geometry=null,this.material=null}constructor(t,e,n){super(),this.context=t,this.geometry=new Dn.BufferGeometry,this.material=new Dn.LineBasicMaterial({color:0}),e&&n&&this.setPosition(e,n)}};var D1=require("three"),va=class extends kt{setEnable(t){super.setEnable(t),yt(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=I(this.startPoint,e,n,i),s=I(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 m=I(p,i,o,s);return He(m,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=I(u,i,o,s),h=I(l,i,o,s);return!(!He(c,e,n)||!He(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new D1.Frustum,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=T({},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);yt(this.rect,s.x,s.y,a,u)}else yt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=qe(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var vo=class extends X1.EventDispatcher{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.context=t,this._list=new Set,this.downPoint=null,this.downTime=0,this.isMultipleSelect=!1,this.onPointerDown=e=>{Date.now()-this.downTime<200||(this.downPoint={x:e.offsetX,y:e.offsetY},this.downTime=Date.now())},this.onPointerUp=e=>{if(!this.downPoint)return;let{offsetX: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))}}),(Un?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=>{Gn(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Gn(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 va(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var DL=d(_e(),1),XL=d(We(),1),ZL=d(xe(),1),CL=d(Ie(),1),OL=d(Ye(),1),KL=d(Ee(),1),RL=d(De(),1),FL=d(W(),1);var _a=require("three");var _o=class extends _a.EventDispatcher{handleHoverGraphicsChange(t){t===void 0&&(t=this.curGraphics),this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new rt,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 m=i.find(g=>g.options.id===p.options.id);if(m instanceof In){let{x:g,y:M}=m.clientPos,P=Math.sqrt((g-o.offsetX)**2+(M-o.offsetY)**2);P<h&&(h=P,c=p)}else if(m instanceof ot){let{x:g,y:M}=m.box.getCenter(new _a.Vector2),P=Math.sqrt((g-o.offsetX)**2+(M-o.offsetY)**2);P<h&&(h=P,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 GL=d(W(),1),or=require("three");var Wa=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(P=>P instanceof Gt).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,u=I(s,n,i,o),l=I(a,n,i,o),c=I(new or.Vector3(s.x,a.y,a.z),n,i,o),h=I(new or.Vector3(a.x,s.y,s.z),n,i,o),p=Math.min(u.x,l.x,c.x,h.x),m=Math.max(u.x,l.x,c.x,h.x),g=Math.min(u.y,l.y,c.y,h.y),M=Math.max(u.y,l.y,c.y,h.y);return{left:p,right:m,top:g,bottom:M}}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=n>=h,m=s-e>=l,g=a-i>=c,M=o>=u;return p&&m&&g&&M}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new or.Vector3,zoom:1,target:new or.Vector3},this.enable=!0,this.box=new or.Box3,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 r7=d(oh(),1),sh=require("three"),sr=require("@tweenjs/tween.js");var t7=d(W(),1),e7=d(K(),1),b=require("three"),Ia=new b.Ray,L1=new b.Plane,f9=Math.cos(70*b.MathUtils.DEG2RAD),Ya=class extends b.EventDispatcher{dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerUp),this.domElement.removeEventListener("wheel",this.onMouseWheel),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp),this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null)}constructor(t,e){super(),this.rotateLineStart=new b.Vector2,this.rotateLineEnd=new b.Vector2,this.spherical=new b.Spherical,this.sphericalDelta=new b.Spherical,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new b.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.screenSpacePanning=!1,this.mouseButtons={LEFT:b.MOUSE.PAN,MIDDLE:b.MOUSE.DOLLY,RIGHT:b.MOUSE.ROTATE},this.touches={ONE:b.TOUCH.PAN,TWO:b.TOUCH.DOLLY_ROTATE},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return 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 b.Vector3,w=new b.Quaternion().setFromUnitVectors(t.up,new b.Vector3(0,1,0)),U=w.clone().invert(),H=new b.Vector3,Ct=new b.Quaternion,Se=new b.Vector3,ce=2*Math.PI;return function(qr){qr===void 0&&(qr=null);let ke=n.object.position;y.copy(ke).sub(n.target),y.applyQuaternion(w),a.setFromVector3(y),n.autoRotate&&o===i.NONE&&Ue(Br(qr)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let Ve=n.minAzimuthAngle,Je=n.maxAzimuthAngle;isFinite(Ve)&&isFinite(Je)&&(Ve<-Math.PI?Ve+=ce:Ve>Math.PI&&(Ve-=ce),Je<-Math.PI?Je+=ce:Je>Math.PI&&(Je-=ce),Ve<=Je?a.theta=Math.max(Ve,Math.min(Je,a.theta)):a.theta=a.theta>(Ve+Je)/2?Math.max(Ve,a.theta):Math.min(Je,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&&z||n.object.isOrthographicCamera?a.radius=Zt(a.radius):a.radius=Zt(a.radius*l),y.setFromSpherical(a),y.applyQuaternion(U),ke.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 Zo=!1;if(n.zoomToCursor&&z){let $r=null;if(n.object.isPerspectiveCamera){let ti=y.length();$r=Zt(ti*l);let Co=ti-$r;n.object.position.addScaledVector(D,Co),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let ti=new b.Vector3(E.x,E.y,0);ti.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Zo=!0;let Co=new b.Vector3(E.x,E.y,0);Co.unproject(n.object),n.object.position.sub(Co).add(ti),n.object.updateMatrixWorld(),$r=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;$r!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar($r).add(n.object.position):(Ia.origin.copy(n.object.position),Ia.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Ia.direction))<f9?t.lookAt(n.target):(L1.setFromNormalAndCoplanarPoint(n.object.up,n.target),Ia.intersectPlane(L1,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Zo=!0);return l=1,z=!1,Zo||H.distanceToSquared(n.object.position)>s||8*(1-Ct.dot(n.object.quaternion))>s||Se.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),H.copy(n.object.position),Ct.copy(n.object.quaternion),Se.copy(n.target),Zo=!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 b.Spherical,u=new b.Spherical,l=1,c=new b.Vector3,h=new b.Vector2,p=new b.Vector2,m=new b.Vector2,g=new b.Vector2,M=new b.Vector2,P=new b.Vector2,A=new b.Vector2,S=new b.Vector2,x=new b.Vector2,D=new b.Vector3,E=new b.Vector2,z=!1,v=[],L={};function Br(y){return y!==null?2*Math.PI/60*n.autoRotateSpeed*y:2*Math.PI/60/60*n.autoRotateSpeed}function lr(){return Math.pow(.95,n.zoomSpeed)}function Ue(y){u.theta-=y}function un(y){u.phi-=y}let cr=function(){let y=new b.Vector3;return function(U,H){y.setFromMatrixColumn(H,0),y.multiplyScalar(-U),c.add(y)}}(),Zn=function(){let y=new b.Vector3;return function(U,H){n.screenSpacePanning===!0?y.setFromMatrixColumn(H,1):(y.setFromMatrixColumn(H,0),y.crossVectors(n.object.up,y)),y.multiplyScalar(U),c.add(y)}}(),Ge=function(){let y=new b.Vector3;return function(U,H){let Ct=n.domElement;if(n.object.isPerspectiveCamera){let Se=n.object.position;y.copy(Se).sub(n.target);let ce=y.length();ce*=Math.tan(n.object.fov/2*Math.PI/180),cr(2*U*ce/Ct.clientHeight,n.object.matrix),Zn(2*H*ce/Ct.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(cr(U*(n.object.right-n.object.left)/n.object.zoom/Ct.clientWidth,n.object.matrix),Zn(H*(n.object.top-n.object.bottom)/n.object.zoom/Ct.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function hr(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 Qr(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 Hr(y){if(!n.zoomToCursor)return;z=!0;let w=n.domElement.getBoundingClientRect(),U=y.clientX-w.left,H=y.clientY-w.top,Ct=w.width,Se=w.height;E.x=U/Ct*2-1,E.y=-(H/Se)*2+1,D.set(E.x,E.y,1).unproject(n.object).sub(n.object.position).normalize()}function Zt(y){return Math.max(n.minDistance,Math.min(n.maxDistance,y))}function Dh(y){h.set(y.clientX,y.clientY)}function TT(y){Hr(y),A.set(y.clientX,y.clientY)}function Xh(y){g.set(y.clientX,y.clientY)}function wT(y){p.set(y.clientX,y.clientY),m.subVectors(p,h).multiplyScalar(n.rotateSpeed);let w=n.domElement;Ue(2*Math.PI*m.x/w.clientHeight),un(2*Math.PI*m.y/w.clientHeight),h.copy(p),n.update()}function ST(y){S.set(y.clientX,y.clientY),x.subVectors(S,A),x.y>0?hr(lr()):x.y<0&&Qr(lr()),A.copy(S),n.update()}function bT(y){M.set(y.clientX,y.clientY),P.subVectors(M,g).multiplyScalar(n.panSpeed),Ge(P.x,P.y),g.copy(M),n.update()}function vT(y){Hr(y),y.deltaY<0?Qr(lr()):y.deltaY>0&&hr(lr()),n.update()}function _T(y){let w=!1;switch(y.code){case n.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?un(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ge(0,n.keyPanSpeed),w=!0;break;case n.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?un(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ge(0,-n.keyPanSpeed),w=!0;break;case n.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?Ue(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ge(n.keyPanSpeed,0),w=!0;break;case n.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?Ue(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ge(-n.keyPanSpeed,0),w=!0;break}w&&(y.preventDefault(),n.update())}function Zh(){if(v.length===1)h.set(v[0].pageX,v[0].pageY);else{let y=(v[0].pageX-v[0].pageY)/(v[1].pageX-v[1].pageY),w=v[0].pageY-y*v[0].pageX;n.rotateLineStart.set(y,w);let U=.5*(v[0].pageX+v[1].pageX),H=.5*(v[0].pageY+v[1].pageY);h.set(U,H)}}function Ch(){if(v.length===1)g.set(v[0].pageX,v[0].pageY);else{let y=.5*(v[0].pageX+v[1].pageX),w=.5*(v[0].pageY+v[1].pageY);g.set(y,w)}}function Oh(){let y=v[0].pageX-v[1].pageX,w=v[0].pageY-v[1].pageY,U=Math.sqrt(y*y+w*w);A.set(0,U)}function WT(){n.enableZoom&&Oh(),n.enablePan&&Ch()}function xT(){n.enableZoom&&Oh(),n.enableRotate&&Zh()}function Kh(y){if(v.length==1)p.set(y.pageX,y.pageY);else{let U=eu(y),H=.5*(y.pageX+U.x),Ct=.5*(y.pageY+U.y);p.set(H,Ct);let Se=(y.pageY-U.y)/(y.pageX-U.x),ce=U.y-Se*U.x;if(n.rotateLineEnd.set(Se,ce),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let nu=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),qr=Se*nu+ce;if(Number.isFinite(nu)&&Number.isFinite(qr)){let ke=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(ke)<.5&&(ke=-Math.sign(ke)*(Math.PI-Math.abs(ke))),Math.abs(ke)<.1&&(u.theta+=ke)}}n.rotateLineStart.copy(n.rotateLineEnd)}m.subVectors(p,h).multiplyScalar(n.rotateSpeed);let w=n.domElement;un(2*Math.PI*m.y/w.clientHeight),h.copy(p)}function Rh(y){if(v.length===1)M.set(y.pageX,y.pageY);else{let w=eu(y),U=.5*(y.pageX+w.x),H=.5*(y.pageY+w.y);M.set(U,H)}P.subVectors(M,g).multiplyScalar(n.panSpeed),Ge(P.x,P.y),g.copy(M)}function Fh(y){let w=eu(y),U=y.pageX-w.x,H=y.pageY-w.y,Ct=Math.sqrt(U*U+H*H);S.set(0,Ct),x.set(0,Math.pow(S.y/A.y,n.zoomSpeed)),hr(x.y),A.copy(S)}function IT(y){n.enableZoom&&Fh(y),n.enablePan&&Rh(y)}function YT(y){n.enableZoom&&Fh(y),n.enableRotate&&Kh(y)}this.onPointerDown=function(w){n.enabled!==!1&&(v.length===0&&(n.domElement.setPointerCapture(w.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),CT(w),w.pointerType==="touch"?XT(w):ET(w))},this.onPointerMove=function(w){n.enabled!==!1&&(w.pointerType==="touch"?ZT(w):DT(w))},this.onPointerUp=function(w){OT(w),v.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 ET(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 b.MOUSE.DOLLY:if(n.enableZoom===!1)return;TT(y),o=i.DOLLY;break;case b.MOUSE.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enablePan===!1)return;Xh(y),o=i.PAN}else{if(n.enableRotate===!1)return;Dh(y),o=i.ROTATE}break;case b.MOUSE.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enableRotate===!1)return;Dh(y),o=i.ROTATE}else{if(n.enablePan===!1)return;Xh(y),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function DT(y){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;wT(y);break;case i.DOLLY:if(n.enableZoom===!1)return;ST(y);break;case i.PAN:if(n.enablePan===!1)return;bT(y);break}}this.onMouseWheel=function(w){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(w.preventDefault(),n.dispatchEvent({type:"start"}),vT(w),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(w){n.enabled===!1||n.enablePan===!1||_T(w)};function XT(y){switch(zh(y),v.length){case 1:switch(n.touches.ONE){case b.TOUCH.ROTATE:if(n.enableRotate===!1)return;Zh(),o=i.TOUCH_ROTATE;break;case b.TOUCH.PAN:if(n.enablePan===!1)return;Ch(),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case b.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;WT(),o=i.TOUCH_DOLLY_PAN;break;case b.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;xT(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function ZT(y){switch(zh(y),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;Kh(y),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;Rh(y),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;IT(y),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;YT(y),n.update();break;default:o=i.NONE}}this.onContextMenu=function(w){n.enabled!==!1&&w.preventDefault()};function CT(y){v.push(y)}function OT(y){delete L[y.pointerId];for(let w=0;w<v.length;w++)if(v[w].pointerId==y.pointerId){v.splice(w,1);return}}function zh(y){let w=L[y.pointerId];w===void 0&&(w=new b.Vector2,L[y.pointerId]=w),w.set(y.pageX,y.pageY)}function eu(y){let w=y.pointerId===v[0].pointerId?v[1]:v[0];return L[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 Ea=class extends Ya{registryEvent(){this.addEventListener("change",this.onChange),this.context.addEventListener("update",this.tweenUpdate)}unRegistryEvent(){this.removeEventListener("change",this.onChange),this.context.removeEventListener("update",this.tweenUpdate)}setPolarAngle(t,e){e===void 0&&(e=!1);let{maxPolarAngle:n,minPolarAngle: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 j(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 sr.Tween(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 sr.Tween(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 sh.Vector3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return j(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 sr.Tween(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 j(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 sr.Tween(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()),!t)return;this.camera.updateMatrix();let n=new sh.Vector3;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 sr.Group,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()}};var Ur=require("three");var Da=class extends Ur.WebGLRenderer{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()}constructor(t){super(T({antialias:!0,alpha:!0},t)),this.event=new Ur.EventDispatcher,this.enable=!0,this.timer=new rt,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=Ur.PCFSoftShadowMap}};var Xn=require("three"),B1=require("three/examples/jsm/loaders/RGBELoader.js");var Xa=class extends Xn.Scene{constructor(){super(),new B1.RGBELoader().load(y1,t=>{t.mapping=Xn.EquirectangularReflectionMapping,this.environment=t;let e=new Xn.Matrix4;e.makeRotationX(Math.PI/2),this.environmentRotation=new Xn.Euler().setFromRotationMatrix(e)})}};var Q1=require("three"),Za=class extends Q1.OrthographicCamera{constructor(t,e){super(-t/2,t/2,e/2,-e/2,-1e4,5e4),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var Wo=class extends F.EventDispatcher{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 Za(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new Ea(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 Wa(this)}getRatio(t,e){t===void 0&&(t=new F.Vector3(0,0,0)),e===void 0&&(e=new F.Vector3(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=I(t,this.camera,n,i),s=I(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 F.AmbientLight&&(e.color=new F.Color(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 F.Vector2;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new F.Raycaster;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 F.Box3().setFromObject(t);this.setPolarAngle(h,0);let{max:m,min:g}=p,M=new F.Vector3(g.x,m.y,m.z),P=new F.Vector3(m.x,m.y,m.z),A=new F.Vector3(m.x,g.y,g.z),S=new F.Vector3(g.x,g.y,g.z),x=I(M,this.camera,l,c),D=I(P,this.camera,l,c),E=I(S,this.camera,l,c),z=I(A,this.camera,l,c),L=new F.Box2().setFromPoints([new F.Vector2(x.x,x.y),new F.Vector2(D.x,D.y),new F.Vector2(E.x,E.y),new F.Vector2(z.x,z.y)]).getSize(new F.Vector2),Br=(l-s-u)/L.x,lr=(c-o-a)/L.y,Ue=Math.min(Br,lr),un=new F.Vector3((m.x+g.x)/2,(m.y+g.y)/2,(m.z+g.z)/2),cr=Ue*this.camera.zoom,Zn=this.camera.clone();Zn.zoom=cr,Zn.updateMatrix();let Ge=(l-L.x*Ue)/2,hr=(c-L.y*Ue)/2,Qr=Ge<s||Ge<u?(s-u)/2:0,Hr=hr<o||hr<a?(o-a)/2:0;if(Qr){let Zt=new F.Vector3;Zt.setFromMatrixColumn(Zn.matrix,0),Zt.normalize(),Zt.multiplyScalar(Qr/cr),un.add(Zt)}if(Hr){let Zt=new F.Vector3;Zt.setFromMatrixColumn(Zn.matrix,1),Zt.normalize(),Zt.multiplyScalar(Hr/cr),un.add(Zt)}return{zoom:Ue*this.camera.zoom,center:un}}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 j(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){var t;(t=this.currentFloor)==null||t.dispose(),this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.renderer.dispose(),this.lights.children.forEach(e=>e.dispose()),q(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new Xa,this.renderer=new Da,this.lights=s0(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,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 vo(this),this.hoverHelper=new _o(this),this.resizeClientSize(),this.registryEvent()}};var H1=require("lodash"),q1={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}};function ah(r){return(0,H1.merge)({},q1,r)}var iT=require("lodash");var O7=d(W(),1);var we;function $1(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(we)return e({db:we,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){we=o.target.result,console.log("onupgradeneeded"),e({db:we,type:"onupgradeneeded"})},i.onsuccess=o=>{we=o.target.result,e({db:we,type:"success"})},i.onerror=o=>{n(o)}})}function uh(r,t,e){return e===void 0&&(e=we),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 tT(r,t,e,n){return n===void 0&&(n=we),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>j(this,null,function*(){let u=yield uh(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 ar(r,t){t===void 0&&(t=we),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function eT(r){r===void 0&&(r=we),r==null||r.close(),we=null}var Ra=require("three");var I7=d(K(),1),Y7=d(W(),1);function Ca(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 Oa(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 nT(r,t,e){switch(r.l_type){case"graph":return d9(r,t);case"wall":return m9(r,t);case"lane":return g9(r,t);case"texture2d":case"texture3d":return y9(r,t);case"glb":return M9(r,t);case"store":return P9(r,t);case"facility":return A9(r,t);case"parkingSpace":return w9(r,t,e);case"text":return b9(r,t)}}function rT(r,t,e){switch(r.l_type){case"store":return j9(r,t,e);case"facility":return T9(r,t,e);case"parkingSpace":return S9(r,t)}}function d9(r,t){let e=t.userData.center;At(r.elements,e);let n=[];r.elements.forEach(o=>{o.group==="ground"?t.createGround(o):n.push(o)});let i=n.reduce((o,s)=>{let{fillColor:a,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:h,airHeight:p}=s,m=a.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+h+"-"+p;return c===0&&(m=a.toLowerCase()+"-"+u+"-"+h+"-"+p),o[m]?o[m].push(s):o[m]=[s],o},{});Object.values(i).forEach(o=>{let s=new ir(t.context,o);t.mergeGraphicLayer.add(s)})}function m9(r,t){let e=t.userData.center;At(r.elements,e);let n=r.elements.reduce((i,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:u,strokeOpacity:l,height:c}=o,h=s.toLowerCase()+"-"+a+"-"+u.toLowerCase()+"-"+l+"-"+c;return l===0&&(h=s.toLowerCase()+"-"+a+"-"+c),i[h]?i[h].push(o):i[h]=[o],i},{});Object.values(n).forEach(i=>{let o=new Ao(t.context,i);t.wallLayer.add(o)})}function g9(r,t){let e=t.userData.center;At(r.elements,e);let n=r.elements.reduce((i,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:u,strokeOpacity:l}=o,c=s.toLowerCase()+"-"+a+"-"+u.toLowerCase()+"-"+l;return l===0&&(c=s.toLowerCase()+"-"+a),i[c]?i[c].push(o):i[c]=[o],i},{});Object.values(n).forEach(i=>{let o=new wo(t.context,i);t.laneLayer.add(o)})}function y9(r,t){let e=t.userData.center;if(At(r.elements,e),r.elements.length){let n=new rr(t.context,r.elements);t.textureLayer.add(n)}}function M9(r,t){let e=t.userData.center;At(r.elements,e),r.elements.forEach(n=>{let i=new To(t.context,T({},n,{url:n.secondUrl,rotate:n.secondRotate,width:n.secondWidth,center_x:n.center_coord_x,center_y:n.center_coord_y}));t.glbModelLayer.add(i)})}function P9(r,t){let e=t.userData.center;At(r.elements,e),r.elements.map(n=>{let i=t.addGraphic(n);t.userData.graphics.push(i),t.userData.graphicMap.set(n.id,i)})}function j9(r,t,e){r.elements.map(n=>{try{let i=Ca(n,e),o=new ot(t.context,{id:n.id,icon:n.poi_info.icon,text:i,position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height},icon_size:[24,24],level:n.poi_info.level||0});t.poiLayer2.pushPoi(o),o&&(o.userData.type="store",o.userData.data=n,o.userData.floor=t.name)}catch(i){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",i,n)}})}function A9(r,t){let e=t.userData.center;At(r.elements,e),r.elements.map(n=>{let i=t.addGraphic(n);t.userData.graphics.push(i),t.userData.graphicMap.set(n.id,i)})}function T9(r,t,e){r.elements.filter(i=>i.poi_info).map(i=>{try{let o=Oa(i,e),s=new ot(t.context,{id:i.id,icon: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});t.poiLayer2.pushPoi(s),s.userData.type="facility",s.userData.data=i,s.userData.floor=t.name}catch(o){console.log("\u6DFB\u52A0facility\u5931\u8D25",o,i)}})}function w9(r,t,e){let n=t.userData.center;At(r.elements,n),t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function S9(r,t){r.elements.filter(n=>n.texts[0]).forEach(n=>{try{let i=new ot(t.context,{id:n.id,text:n.texts[0],position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height}});i&&(i.userData.type="parkingSpace",i.userData.data=n,i.userData.floor=t.name),t.poiLayer2.pushPoi(i)}catch(i){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",i,n)}})}function b9(r,t){let e=t.userData.center;At(r.elements,e);let n=new So(t.context,r.elements.map(i=>T({},i,{center_x:i.center_coord_x,center_y:i.center_coord_y})));t.textTextureLayer.add(n)}var lh="map_version",ch="route_version",hh="facility_version",ph="map_data",Ka="road_network_data",fh="facility_data",v9={mergeParkingSpace:!0},xo=class extends Ra.EventDispatcher{initDb(){return j(this,null,function*(){try{let{db:t,type:e}=yield $1("aibee_map",2);e==="onupgradeneeded"&&(ar(lh),ar(ch),ar(hh),ar(ph),ar(Ka),ar(fh)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t){return j(this,null,function*(){if(Array.isArray(t))this.floors=t;else{let e=yield fetch(t).then(n=>n.json());e.code===200&&(this.floors=e.data.list)}})}setCacheData(t,e,n){return this.initDbPromise.then(()=>tT(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>uh(t,""+e,this.db))}getFloorCacheKey(t){return""+t.floor_id}getFloorData(t){return j(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return j(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=Ca(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=Oa(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return j(this,null,function*(){let e=this.getFloorCacheKey(t);console.time("zstd_json");let n=yield fetch(t.map_url).then(i=>i.json());return n.floor=t.floor,console.timeEnd("zstd_json"),this.setCacheData(ph,e,n),this.setCacheData(lh,e,t.version_id),n})}getFloorJsonData(t){return j(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(lh,n))===e.version_id){let o=yield this.getCacheData(ph,n);if(o)return o}return this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return j(this,null,function*(){return(yield Promise.all(this.floors.map(e=>j(this,null,function*(){let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(ch,n))===e.version_id){let s=yield this.getCacheData(Ka,n);if(s)return s}let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Ka,n,o),this.setCacheData(ch,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Ka,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return j(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=()=>j(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(fh,e,i),this.setCacheData(hh,e,t.version_id)),i});try{if((yield this.getCacheData(hh,e))===t.version_id){let o=yield this.getCacheData(fh,e);if(o)return o}return n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return j(this,null,function*(){})}getMulFloorsData(t){return j(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return j(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e){return j(this,null,function*(){return e=this.getFloorBaseLayer(t,e),yield this.getFloorContentLayer(t,e),this.getFloorPoi(t,e),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new Ra.Vector3),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t){return j(this,null,function*(){return new Promise(e=>{let n={run:()=>this._switchFloor(t),meta:{type:"switchFloor"}},i=this.taskQueue.replaceByMetaType(n),o=s=>{let{task:a,res:u}=s;a.tid===i&&(this.taskQueue.removeEventListener("active-task-end",o),e(u))};this.taskQueue.addEventListener("active-task-end",o)})})}_switchFloor(t){return j(this,null,function*(){var e;let n=t;if(typeof t=="string"){let u=yield this.getFloorJsonData(t);if(u)n=u;else return null}let i=new Gt(this.bmap.context),o=this.floors.find(u=>u.floor===n.floor);var s;let a=(s=o==null?void 0:o.map_angle)!=null?s:0;return this.bmap.dispatchEvent({type:Mt.SWITCH_FLOOR_BEFORE,data:{curFloor:i,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:i,graphics:[]}}),this.bmap.context.control.setAzimuthalAngle(a/180*Math.PI,!0),this.getFloorBaseLayer(n,i),this.changeFloorBox(n,i),this.bmap.buildingCenter=i.userData.center,this.bmap.currentBuildGround=(e=i.userData.data.layers.find(u=>u.l_type==="range"))==null?void 0:e.elements[0],this.bmap.context.switchFloor(i),this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:i,graphics:[]}}),yield bi(),yield this.getFloorContentLayer(n,i),this.changeFloorBox(n,i),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:i,graphics:[]}}),yield T0(2),this.getFloorPoi(n,i),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:i,graphics:i.graphicLayer.children}}),this.bmap.dispatchEvent({type:Mt.SWITCH_FLOOR_AFTER,data:{curFloor:i,graphics:i.graphicLayer.children}}),i})}getFloorBaseLayer(t,e){e||(e=new Gt(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":At(i.elements,n);let s=i.elements.map(a=>new et(this.bmap.context,a));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return j(this,null,function*(){e||(e=new Gt(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)||(nT(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield bi(),n=Date.now()))}return e})}getFloorPoi(t,e){let n=Date.now();t.layers.map(o=>{rT(o,e,this.locale)}),console.log("poi time",Date.now()-n);let i=Date.now();bi().then(()=>{console.log("poi render time",Date.now()-i)})}clear(){return j(this,null,function*(){var t;eT((t=this.db)!=null?t:void 0)})}dispose(){this.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new Ln,this.locale="zh-cn",this.options=T({},v9,e),this.initDbPromise=this.initDb()}};var L7=d(W(),1);function dh(r,t){return j(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 mh(r,t){return j(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(m=>m.info=JSON.parse(m.info)),p||[]))})}function _9(r,t){return j(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?W9(u.fileId,t):null)})}function W9(r,t){return j(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 gh=class{load(t){return j(this,null,function*(){let e=kn(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),mh(t,this.bmap.config)]),i=kn({floor:t.floor,ts:t.ts});At(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 j(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(Mt.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(Mt.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 j(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return j(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return j(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 j(this,null,function*(){let{brand:e,project:n}=t,i=kn({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=dh({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 j(this,null,function*(){let e=new Gt(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 x9=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),yh=class extends Fa.EventDispatcher{changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?Ai(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 j(this,null,function*(){return this.loader||(this.loader=new xo(this),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(Mt.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(Mt.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(T({},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(T({},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){e===void 0&&(e=500);let n=t.getPosition();return this.context.setCameraPosition(n,e)}translateElementToCenterX(t,e){return j(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=I(o,u,s,a).x-s/2,h=new Fa.Vector3;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 I(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 j(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t){t===void 0&&(t=.1);let e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}measureDistance(){return j(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Po(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 jo(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=Ai(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,Ut.dispose(),$t.dispose(),jn.dispose(),Yt.dispose(),B.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.basicZoom=1,this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new rt,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*25,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=ah(e),this.context=new Wo(t,this.config),this.debounceResize=(0,iT.debounce)(this.resize,5),this.registryEvent()}};var dB=d(W(),1);var oT=require("three"),Dt=class extends oT.EventDispatcher{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 Mh=class extends Dt{fetchEquipment(){return j(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(Mt.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(Mt.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var y8=d(vi(),1),M8=d(Xe(),1),P8=d(W(),1),j8=d(oh(),1);var OB=d(W(),1),KB=d(K(),1),ut=require("three");var PB=d(uc(),1),jB=d(Ri(),1),AB=d(Fi(),1),TB=d(Ni(),1),wB=d(Ui(),1),SB=d(Gi(),1),bB=d(Vi(),1),vB=d(Ji(),1),_B=d(Li(),1),WB=d(Bi(),1),xB=d(Qi(),1),IB=d(Hi(),1),YB=d(qi(),1),EB=d(to(),1),DB=d(eo(),1),XB=d(K(),1),ZB=d(Jc(),1),_=require("three"),_t=class extends _.BufferGeometry{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new _.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};_t.prototype.setMatrixWorld=function(r){this.matrixWorld=r};_t.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};_t.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 _.Vector3)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 I9(r,t){var e=new _.Matrix4,n=new _.Ray,i=new _.Sphere,o=new _.Vector3,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 _.Vector3,u=new _.Vector3,l=new _.Vector3,c=this instanceof _.LineSegments?2:1,h=s.index,p=s.attributes;if(h!==null)for(var m=h.array,g=p.position.array,M=p.width.array,P=0,A=m.length-1;P<A;P+=c){var S=m[P],x=m[P+1];a.fromArray(g,S*3),u.fromArray(g,x*3);var D=M[Math.floor(P/3)]!==void 0?M[Math.floor(P/3)]:1,E=r.params.Line.threshold+this.material.lineWidth*D/2,z=E*E,v=n.distanceSqToSegment(a,u,o,l);if(!(v>z)){o.applyMatrix4(this.matrixWorld);var L=r.ray.origin.distanceTo(o);L<r.near||L>r.far||(t.push({distance:L,point:l.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this}),P=A)}}}}_t.prototype.raycast=I9;_t.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]};_t.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};_t.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new _.Vector3(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new _.Vector3(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=i.distanceTo(o);t+=s}return t};_t.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 _.BufferAttribute(new Float32Array(this.positions),3),previous:new _.BufferAttribute(new Float32Array(this.previous),3),next:new _.BufferAttribute(new Float32Array(this.next),3),side:new _.BufferAttribute(new Float32Array(this.side),1),width:new _.BufferAttribute(new Float32Array(this.width),1),uv:new _.BufferAttribute(new Float32Array(this.uvs),2),index:new _.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new _.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Ph(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}_t.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;Ph(t,0,e,0,i),Ph(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,Ph(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};_.ShaderChunk.meshline_vert=["",_.ShaderChunk.logdepthbuf_pars_vertex,_.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",_.ShaderChunk.logdepthbuf_vertex,_.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",_.ShaderChunk.fog_vertex,"}"].join(`
108
108
  `);_.ShaderChunk.meshline_frag=["",_.ShaderChunk.fog_pars_fragment,_.ShaderChunk.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","uniform float thresholdRatio;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {","",_.ShaderChunk.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",_.ShaderChunk.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
109
- `);var ur=class extends _.ShaderMaterial{constructor(t){super({uniforms:Object.assign({},_.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new _.Color(16777215)},opacity:{value:1},resolution:{value:new _.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new _.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:_.ShaderChunk.meshline_vert,fragmentShader:_.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};ur.prototype.copy=function(r){return _.ShaderMaterial.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 sT={texture_url:ya,lineWidth:10,color:16777215},za=class extends ut.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:i}}}}}=this,o=t.map(a=>{let[u,l]=a;return I(new ut.Vector3(u,l,0),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return Ft(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new ut.Vector2(t,1)}loadTexture(t){return new Promise((e,n)=>{new ut.TextureLoader().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return j(this,null,function*(){let e=this.geometry=new _t;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=ut.RepeatWrapping}let n=this.material=new ur({useMap:!0,color:new ut.Color(this.config.color),transparent:!0,resolution:new ut.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:ut.NormalBlending,repeat:new ut.Vector2(this.getRepeat(),1)}),i=this.mesh=new ut.Mesh(e,n);return i.renderOrder=9,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=sT,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({},sT,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var Gr=require("@tweenjs/tween.js"),le=require("three");var kB=d(wa(),1),VB=d(W(),1),JB=d(K(),1),Ua=require("three");var aT=require("@tweenjs/tween.js"),uT=require("lodash");var Y9={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},Na=class extends Ua.EventDispatcher{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)}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,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;if(i){let g=Ze(n,i);u=u.slice(g+1),u.unshift(i)}let l=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:c,closestPoint:h,index:p,i:m}=l.reduce((g,M,P)=>{if(M.floor!==t)return g;let{distance:A,closestPoint:S,index:x}=M.points.reduce((D,E,z,v)=>{if(!v[z+1])return T({},D,{distance:D.distance===1/0?N(E,e):D.distance});let{distance:L,closestPoint:Br}=U0(e,E,v[z+1]);return L<D.distance?{distance:L,closestPoint:Br,index:z}:D},{distance:1/0,closestPoint:M.points[0],index:0});return A<g.distance?{distance:A,closestPoint:S,index:P,i:x}:g},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:c,closestPoint:h,routeIndex:p+a,pointIndex:p===0?m+this.pointIndex:m}}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 j(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let i=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),s=o/this.options.simulationSpeed,a=this.throttleUpdatePosition=(0,uT.throttle)(l=>{let c=Vn(i,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new aT.Tween({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 Ft(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return Ft(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=Ke.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===Ke.FRONT&&s<=n.length;){let g=n[s],M=n[s+1],P=n[s+2];if(!g||!M)a=Ke.END;else if(l+=N(g,M),!P)a=Ke.END;else{a=xs(g,M,P),c=Ti(g,M,P),h=(new Ua.Vector2(P[0]-M[0],P[1]-M[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=N(i,n[s])),a===Ke.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let m=this.getCurRouteToStartDistance();return e===0&&m<=5?{dir:Ke.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=Ke.FRONT),{dir:a,distance:l,crossName:u,angle:c,nextAngle:h})}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;return e<=10&&(i=Ke.END),{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}}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 rt,this.resetTimer=null,this.tweenUtil=new $e,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o)},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},Y9,e),this.roadData=n,this.registryEvent()}};var HB=d(Qs(),1),qB=d(Ri(),1),$B=d(Fi(),1),t8=d(Ni(),1),e8=d(Ui(),1),n8=d(Gi(),1),r8=d(Vi(),1),i8=d(Ji(),1),o8=d(Li(),1),s8=d(Bi(),1),a8=d(Qi(),1),u8=d(Hi(),1),l8=d(qi(),1),c8=d(to(),1),h8=d(eo(),1),p8=d(ac(),1),f8=d(W(),1),ue=require("three");var an=class r extends ot{addDebug(){r.canvas.style.cssText=`
109
+ `);var ur=class extends _.ShaderMaterial{constructor(t){super({uniforms:Object.assign({},_.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new _.Color(16777215)},opacity:{value:1},resolution:{value:new _.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new _.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:_.ShaderChunk.meshline_vert,fragmentShader:_.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};ur.prototype.copy=function(r){return _.ShaderMaterial.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 sT={texture_url:ya,lineWidth:10,color:16777215},za=class extends ut.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:i}}}}}=this,o=t.map(a=>{let[u,l]=a;return I(new ut.Vector3(u,l,0),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return Ft(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new ut.Vector2(t,1)}loadTexture(t){return new Promise((e,n)=>{new ut.TextureLoader().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return j(this,null,function*(){let e=this.geometry=new _t;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=ut.RepeatWrapping}let n=this.material=new ur({useMap:!0,color:new ut.Color(this.config.color),transparent:!0,resolution:new ut.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:ut.NormalBlending,repeat:new ut.Vector2(this.getRepeat(),1)}),i=this.mesh=new ut.Mesh(e,n);return i.renderOrder=100009,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=sT,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({},sT,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var Gr=require("@tweenjs/tween.js"),le=require("three");var kB=d(wa(),1),VB=d(W(),1),JB=d(K(),1),Ua=require("three");var aT=require("@tweenjs/tween.js"),uT=require("lodash");var Y9={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},Na=class extends Ua.EventDispatcher{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)}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,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;if(i){let g=Ze(n,i);u=u.slice(g+1),u.unshift(i)}let l=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:c,closestPoint:h,index:p,i:m}=l.reduce((g,M,P)=>{if(M.floor!==t)return g;let{distance:A,closestPoint:S,index:x}=M.points.reduce((D,E,z,v)=>{if(!v[z+1])return T({},D,{distance:D.distance===1/0?N(E,e):D.distance});let{distance:L,closestPoint:Br}=U0(e,E,v[z+1]);return L<D.distance?{distance:L,closestPoint:Br,index:z}:D},{distance:1/0,closestPoint:M.points[0],index:0});return A<g.distance?{distance:A,closestPoint:S,index:P,i:x}:g},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:c,closestPoint:h,routeIndex:p+a,pointIndex:p===0?m+this.pointIndex:m}}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 j(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let i=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),s=o/this.options.simulationSpeed,a=this.throttleUpdatePosition=(0,uT.throttle)(l=>{let c=Vn(i,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new aT.Tween({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 Ft(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return Ft(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=Ke.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===Ke.FRONT&&s<=n.length;){let g=n[s],M=n[s+1],P=n[s+2];if(!g||!M)a=Ke.END;else if(l+=N(g,M),!P)a=Ke.END;else{a=xs(g,M,P),c=Ti(g,M,P),h=(new Ua.Vector2(P[0]-M[0],P[1]-M[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=N(i,n[s])),a===Ke.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let m=this.getCurRouteToStartDistance();return e===0&&m<=5?{dir:Ke.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=Ke.FRONT),{dir:a,distance:l,crossName:u,angle:c,nextAngle:h})}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;return e<=10&&(i=Ke.END),{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}}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 rt,this.resetTimer=null,this.tweenUtil=new $e,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o)},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},Y9,e),this.roadData=n,this.registryEvent()}};var HB=d(Qs(),1),qB=d(Ri(),1),$B=d(Fi(),1),t8=d(Ni(),1),e8=d(Ui(),1),n8=d(Gi(),1),r8=d(Vi(),1),i8=d(Ji(),1),o8=d(Li(),1),s8=d(Bi(),1),a8=d(Qi(),1),u8=d(Hi(),1),l8=d(qi(),1),c8=d(to(),1),h8=d(eo(),1),p8=d(ac(),1),f8=d(W(),1),ue=require("three");var an=class r extends ot{addDebug(){r.canvas.style.cssText=`
110
110
  position: fixed;
111
111
  top: 0;
112
112
  left: 0;
package/lib/bmap.esm.js CHANGED
@@ -19396,7 +19396,7 @@ var Path2 = class extends Object3D15 {
19396
19396
  repeat: new Vector214(this.getRepeat(), 1)
19397
19397
  });
19398
19398
  const mesh = this.mesh = new Mesh11(lineGeometry, material);
19399
- mesh.renderOrder = 9;
19399
+ mesh.renderOrder = 100009;
19400
19400
  this.add(mesh);
19401
19401
  return mesh;
19402
19402
  });
@@ -106,7 +106,7 @@ var hT=Object.create;var kc=Object.defineProperty;var pT=Object.getOwnPropertyDe
106
106
  }
107
107
  `,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 sO({uniforms:{maxZ:{value:n},uColor:{value:new BA(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new BA(We(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=G.createLineMaterial({color:this.options[0].strokeColor,opacity:this.options[0].strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new rO(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 LA(u[0],u[1],e)),t.push(new LA(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new iO().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new oO(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;this.geometry.dispose(),this.material.dispose(),(t=this.line)==null||t.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},mc,n)),this.init()}};var tQ=d(v(),1);import{Box2 as Mc,Object3D as uO,Sprite as QA,SpriteMaterial as HA,Vector2 as ks}from"three";import{isNil as Di}from"lodash";var lO={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},$=class extends uO{get durIconAndText(){return this.options.icon&&this.options.text?2:0}get offset(){return this.options.icon&&this.options.text?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.options.text?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.options.text?this.options.text_font_size: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!Di(t)&&!Di(e)&&!Di(n)&&!Di(i)&&!Di(o)}get deltaZ(){return!this.options.icon&&this.options.text?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>j(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text_font_size",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&this._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)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return j(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>j(this,null,function*(){let e=yield Et.getTextureByUrl(this.options.icon),n=new QA(new HA({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));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.options.text){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 t=wt.getTextureByText(this.options.text),this.textAspect=t.image.width/t.image.height;let e=new QA(new HA({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test}));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,text:s}=this.options;o?s?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):s?(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 j(this,null,function*(){yield Promise.all([this.initIcon(),new Promise(t=>{this.initText(),t(!0)})]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:n}}=this.context,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 Mc(new ks(i-s,o-this.iconHeight),new ks(i+s,o)),u=this.textWidth/2,l=new Mc(new ks(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new ks(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){super(),this.context=t,this.textAspect=1,this.box=new Mc,this._initIconPromise=null,this._initScale=n=>{let{zoom:i}=n;if(this.spriteText){let s=this.textHeight/i;this.spriteText.scale.set(this.textAspect*s,s,.1)}if(this.spriteIcon){var o;(o=this.spriteIcon)==null||o.scale.set(this.options.icon_size[0]/i,this.options.icon_size[1]/i,.1)}this.resetZ()},this.options=kn(T({},lO,e),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};import{DoubleSide as cO,Matrix4 as qA,Mesh as hO,MeshBasicMaterial as pO,Object3D as fO,PlaneGeometry as dO}from"three";import{mergeGeometries as mO}from"three/examples/jsm/utils/BufferGeometryUtils";var gO={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},Vs=class extends fO{init(){return j(this,null,function*(){let t=this.options.map(s=>wt.getTextureByText(s.texts[0],{fillStyle:t0(s.fillColor,s.fillOpacity),strokeStyle:t0(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"54px sans-serif"})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.image,h=l/c,p=u.secondHeight*h,m=new dO(p,u.secondHeight),g=new qA().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new qA().makeRotationZ(u.secondRotate));return m.applyMatrix4(g),m}),n=mO(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let a=new pO({map:s,alphaTest:1,side:cO});return s.needsUpdate=!0,a}),o=new hO(n,i);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e;(t=this.mesh)==null||t.geometry.dispose(),((e=this.mesh)==null?void 0:e.material).forEach(n=>n.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},gO,n)),this.init()}};import{BufferGeometry as yO,Line as MO,LineBasicMaterial as PO,Object3D as jO}from"three";var Js=class extends jO{setPosition(t,e){this.geometry.setFromPoints([t,e]),this.line||this.createLine()}createLine(){this.line=new MO(this.geometry,this.material),this.add(this.line)}dispose(){this.line&&L(this.line),this.geometry=null,this.material=null}constructor(t,e,n){super(),this.context=t,this.geometry=new yO,this.material=new PO({color:0}),e&&n&&this.setPosition(e,n)}};import{Frustum as AO}from"three";var Ls=class extends Ft{setEnable(t){super.setEnable(t),st(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=W(this.startPoint,e,n,i),s=W(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 Q&&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 m=W(p,i,o,s);return Be(m,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=W(u,i,o,s),h=W(l,i,o,s);return!(!Be(c,e,n)||!Be(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new AO,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=T({},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);st(this.rect,s.x,s.y,a,u)}else st(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=Qe(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var Bs=class extends TO{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=>{Ln(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Ln(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 Ls(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var ZQ=d(ie(),1),CQ=d(oe(),1),OQ=d(se(),1),KQ=d(ae(),1),RQ=d(ue(),1),FQ=d(le(),1),zQ=d(ce(),1),NQ=d(v(),1);import{EventDispatcher as wO,Vector2 as SO}from"three";var Qs=class extends wO{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 H,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 m=i.find(g=>g.options.id===p.options.id);if(m instanceof Wn){let{x:g,y:M}=m.clientPos,P=Math.sqrt((g-o.offsetX)**2+(M-o.offsetY)**2);P<h&&(h=P,c=p)}else if(m instanceof $){let{x:g,y:M}=m.box.getCenter(new SO),P=Math.sqrt((g-o.offsetX)**2+(M-o.offsetY)**2);P<h&&(h=P,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 JQ=d(v(),1);import{Box3 as bO,Vector3 as Hs}from"three";var qs=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(P=>P instanceof Rt).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,u=W(s,n,i,o),l=W(a,n,i,o),c=W(new Hs(s.x,a.y,a.z),n,i,o),h=W(new Hs(a.x,s.y,s.z),n,i,o),p=Math.min(u.x,l.x,c.x,h.x),m=Math.max(u.x,l.x,c.x,h.x),g=Math.min(u.y,l.y,c.y,h.y),M=Math.max(u.y,l.y,c.y,h.y);return{left:p,right:m,top:g,bottom:M}}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=n>=h,m=s-e>=l,g=a-i>=c,M=o>=u;return p&&m&&g&&M}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new Hs,zoom:1,target:new Hs},this.enable=!0,this.box=new bO,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 u5=d(Ac(),1);import{Vector3 as d1}from"three";import{Tween as ra,Group as JO}from"@tweenjs/tween.js";var i5=d(v(),1),o5=d(Z(),1);import{EventDispatcher as NO,MOUSE as yr,Quaternion as p1,Spherical as ta,TOUCH as Mr,Vector2 as St,Vector3 as zt,Plane as UO,Ray as GO,MathUtils as kO}from"three";var ea=new GO,f1=new UO,VO=Math.cos(70*kO.DEG2RAD),na=class extends NO{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 St,this.rotateLineEnd=new St,this.spherical=new ta,this.sphericalDelta=new ta,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:yr.PAN,MIDDLE:yr.DOLLY,RIGHT:yr.ROTATE},this.touches={ONE:Mr.PAN,TWO:Mr.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 p1().setFromUnitVectors(t.up,new zt(0,1,0)),R=w.clone().invert(),V=new zt,Mt=new p1,ee=new zt,Nt=2*Math.PI;return function(Sr){Sr===void 0&&(Sr=null);let je=n.object.position;y.copy(je).sub(n.target),y.applyQuaternion(w),a.setFromVector3(y),n.autoRotate&&o===i.NONE&&Me(Ar(Sr)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let Ae=n.minAzimuthAngle,Te=n.maxAzimuthAngle;isFinite(Ae)&&isFinite(Te)&&(Ae<-Math.PI?Ae+=Nt:Ae>Math.PI&&(Ae-=Nt),Te<-Math.PI?Te+=Nt:Te>Math.PI&&(Te-=Nt),Ae<=Te?a.theta=Math.max(Ae,Math.min(Te,a.theta)):a.theta=a.theta>(Ae+Te)/2?Math.max(Ae,a.theta):Math.min(Te,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&&O||n.object.isOrthographicCamera?a.radius=yt(a.radius):a.radius=yt(a.radius*l),y.setFromSpherical(a),y.applyQuaternion(R),je.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 Ki=!1;if(n.zoomToCursor&&O){let br=null;if(n.object.isPerspectiveCamera){let vr=y.length();br=yt(vr*l);let Ri=vr-br;n.object.position.addScaledVector(I,Ri),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let vr=new zt(x.x,x.y,0);vr.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Ki=!0;let Ri=new zt(x.x,x.y,0);Ri.unproject(n.object),n.object.position.sub(Ri).add(vr),n.object.updateMatrixWorld(),br=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;br!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(br).add(n.object.position):(ea.origin.copy(n.object.position),ea.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(ea.direction))<VO?t.lookAt(n.target):(f1.setFromNormalAndCoplanarPoint(n.object.up,n.target),ea.intersectPlane(f1,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Ki=!0);return l=1,O=!1,Ki||V.distanceToSquared(n.object.position)>s||8*(1-Mt.dot(n.object.quaternion))>s||ee.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),V.copy(n.object.position),Mt.copy(n.object.quaternion),ee.copy(n.target),Ki=!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 ta,u=new ta,l=1,c=new zt,h=new St,p=new St,m=new St,g=new St,M=new St,P=new St,A=new St,S=new St,_=new St,I=new zt,x=new St,O=!1,b=[],U={};function Ar(y){return y!==null?2*Math.PI/60*n.autoRotateSpeed*y:2*Math.PI/60/60*n.autoRotateSpeed}function En(){return Math.pow(.95,n.zoomSpeed)}function Me(y){u.theta-=y}function Fe(y){u.phi-=y}let Dn=function(){let y=new zt;return function(R,V){y.setFromMatrixColumn(V,0),y.multiplyScalar(-R),c.add(y)}}(),dn=function(){let y=new zt;return function(R,V){n.screenSpacePanning===!0?y.setFromMatrixColumn(V,1):(y.setFromMatrixColumn(V,0),y.crossVectors(n.object.up,y)),y.multiplyScalar(R),c.add(y)}}(),Pe=function(){let y=new zt;return function(R,V){let Mt=n.domElement;if(n.object.isPerspectiveCamera){let ee=n.object.position;y.copy(ee).sub(n.target);let Nt=y.length();Nt*=Math.tan(n.object.fov/2*Math.PI/180),Dn(2*R*Nt/Mt.clientHeight,n.object.matrix),dn(2*V*Nt/Mt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(Dn(R*(n.object.right-n.object.left)/n.object.zoom/Mt.clientWidth,n.object.matrix),dn(V*(n.object.top-n.object.bottom)/n.object.zoom/Mt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Xn(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 Tr(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 wr(y){if(!n.zoomToCursor)return;O=!0;let w=n.domElement.getBoundingClientRect(),R=y.clientX-w.left,V=y.clientY-w.top,Mt=w.width,ee=w.height;x.x=R/Mt*2-1,x.y=-(V/ee)*2+1,I.set(x.x,x.y,1).unproject(n.object).sub(n.object.position).normalize()}function yt(y){return Math.max(n.minDistance,Math.min(n.maxDistance,y))}function Cc(y){h.set(y.clientX,y.clientY)}function B1(y){wr(y),A.set(y.clientX,y.clientY)}function Oc(y){g.set(y.clientX,y.clientY)}function Q1(y){p.set(y.clientX,y.clientY),m.subVectors(p,h).multiplyScalar(n.rotateSpeed);let w=n.domElement;Me(2*Math.PI*m.x/w.clientHeight),Fe(2*Math.PI*m.y/w.clientHeight),h.copy(p),n.update()}function H1(y){S.set(y.clientX,y.clientY),_.subVectors(S,A),_.y>0?Xn(En()):_.y<0&&Tr(En()),A.copy(S),n.update()}function q1(y){M.set(y.clientX,y.clientY),P.subVectors(M,g).multiplyScalar(n.panSpeed),Pe(P.x,P.y),g.copy(M),n.update()}function $1(y){wr(y),y.deltaY<0?Tr(En()):y.deltaY>0&&Xn(En()),n.update()}function tT(y){let w=!1;switch(y.code){case n.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?Fe(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Pe(0,n.keyPanSpeed),w=!0;break;case n.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?Fe(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Pe(0,-n.keyPanSpeed),w=!0;break;case n.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?Me(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Pe(n.keyPanSpeed,0),w=!0;break;case n.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?Me(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Pe(-n.keyPanSpeed,0),w=!0;break}w&&(y.preventDefault(),n.update())}function Kc(){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 R=.5*(b[0].pageX+b[1].pageX),V=.5*(b[0].pageY+b[1].pageY);h.set(R,V)}}function Rc(){if(b.length===1)g.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);g.set(y,w)}}function Fc(){let y=b[0].pageX-b[1].pageX,w=b[0].pageY-b[1].pageY,R=Math.sqrt(y*y+w*w);A.set(0,R)}function eT(){n.enableZoom&&Fc(),n.enablePan&&Rc()}function nT(){n.enableZoom&&Fc(),n.enableRotate&&Kc()}function zc(y){if(b.length==1)p.set(y.pageX,y.pageY);else{let R=Wa(y),V=.5*(y.pageX+R.x),Mt=.5*(y.pageY+R.y);p.set(V,Mt);let ee=(y.pageY-R.y)/(y.pageX-R.x),Nt=R.y-ee*R.x;if(n.rotateLineEnd.set(ee,Nt),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let xa=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Sr=ee*xa+Nt;if(Number.isFinite(xa)&&Number.isFinite(Sr)){let je=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(je)<.5&&(je=-Math.sign(je)*(Math.PI-Math.abs(je))),Math.abs(je)<.1&&(u.theta+=je)}}n.rotateLineStart.copy(n.rotateLineEnd)}m.subVectors(p,h).multiplyScalar(n.rotateSpeed);let w=n.domElement;Fe(2*Math.PI*m.y/w.clientHeight),h.copy(p)}function Nc(y){if(b.length===1)M.set(y.pageX,y.pageY);else{let w=Wa(y),R=.5*(y.pageX+w.x),V=.5*(y.pageY+w.y);M.set(R,V)}P.subVectors(M,g).multiplyScalar(n.panSpeed),Pe(P.x,P.y),g.copy(M)}function Uc(y){let w=Wa(y),R=y.pageX-w.x,V=y.pageY-w.y,Mt=Math.sqrt(R*R+V*V);S.set(0,Mt),_.set(0,Math.pow(S.y/A.y,n.zoomSpeed)),Xn(_.y),A.copy(S)}function rT(y){n.enableZoom&&Uc(y),n.enablePan&&Nc(y)}function iT(y){n.enableZoom&&Uc(y),n.enableRotate&&zc(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)),lT(w),w.pointerType==="touch"?aT(w):oT(w))},this.onPointerMove=function(w){n.enabled!==!1&&(w.pointerType==="touch"?uT(w):sT(w))},this.onPointerUp=function(w){cT(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 oT(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 yr.DOLLY:if(n.enableZoom===!1)return;B1(y),o=i.DOLLY;break;case yr.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enablePan===!1)return;Oc(y),o=i.PAN}else{if(n.enableRotate===!1)return;Cc(y),o=i.ROTATE}break;case yr.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enableRotate===!1)return;Cc(y),o=i.ROTATE}else{if(n.enablePan===!1)return;Oc(y),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function sT(y){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;Q1(y);break;case i.DOLLY:if(n.enableZoom===!1)return;H1(y);break;case i.PAN:if(n.enablePan===!1)return;q1(y);break}}this.onMouseWheel=function(w){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(w.preventDefault(),n.dispatchEvent({type:"start"}),$1(w),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(w){n.enabled===!1||n.enablePan===!1||tT(w)};function aT(y){switch(Gc(y),b.length){case 1:switch(n.touches.ONE){case Mr.ROTATE:if(n.enableRotate===!1)return;Kc(),o=i.TOUCH_ROTATE;break;case Mr.PAN:if(n.enablePan===!1)return;Rc(),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case Mr.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;eT(),o=i.TOUCH_DOLLY_PAN;break;case Mr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nT(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function uT(y){switch(Gc(y),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;zc(y),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;Nc(y),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;rT(y),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;iT(y),n.update();break;default:o=i.NONE}}this.onContextMenu=function(w){n.enabled!==!1&&w.preventDefault()};function lT(y){b.push(y)}function cT(y){delete U[y.pointerId];for(let w=0;w<b.length;w++)if(b[w].pointerId==y.pointerId){b.splice(w,1);return}}function Gc(y){let w=U[y.pointerId];w===void 0&&(w=new St,U[y.pointerId]=w),w.set(y.pageX,y.pageY)}function Wa(y){let w=y.pointerId===b[0].pointerId?b[1]:b[0];return U[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 ia=class extends na{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 j(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):It(new Promise(i=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new ra(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):It(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new ra(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 d1().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return j(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 It(new Promise(o=>{let s=new ra(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 j(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?It(new Promise(s=>{let a=new ra(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()),!t)return;this.camera.updateMatrix();let n=new d1;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 JO,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 LO,PCFSoftShadowMap as BO,WebGLRenderer as QO}from"three";var oa=class extends QO{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()}constructor(t){super(T({antialias:!0,alpha:!0},t)),this.event=new LO,this.enable=!0,this.timer=new H,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=BO}};import{Euler as HO,Matrix4 as qO,Scene as $O,EquirectangularReflectionMapping as tK}from"three";import{RGBELoader as eK}from"three/examples/jsm/loaders/RGBELoader.js";var sa=class extends $O{constructor(){super(),new eK().load(XA,t=>{t.mapping=tK,this.environment=t;let e=new qO;e.makeRotationX(Math.PI/2),this.environmentRotation=new HO().setFromRotationMatrix(e)})}};import{OrthographicCamera as nK}from"three";var aa=class extends nK{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 ua=class extends rK{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 aa(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new ia(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 qs(this)}getRatio(t,e){t===void 0&&(t=new Oe(0,0,0)),e===void 0&&(e=new Oe(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=W(t,this.camera,n,i),s=W(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 uK&&(e.color=new aK(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 Pr;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new oK;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 sK().setFromObject(t);this.setPolarAngle(h,0);let{max:m,min:g}=p,M=new Oe(g.x,m.y,m.z),P=new Oe(m.x,m.y,m.z),A=new Oe(m.x,g.y,g.z),S=new Oe(g.x,g.y,g.z),_=W(M,this.camera,l,c),I=W(P,this.camera,l,c),x=W(S,this.camera,l,c),O=W(A,this.camera,l,c),U=new iK().setFromPoints([new Pr(_.x,_.y),new Pr(I.x,I.y),new Pr(x.x,x.y),new Pr(O.x,O.y)]).getSize(new Pr),Ar=(l-s-u)/U.x,En=(c-o-a)/U.y,Me=Math.min(Ar,En),Fe=new Oe((m.x+g.x)/2,(m.y+g.y)/2,(m.z+g.z)/2),Dn=Me*this.camera.zoom,dn=this.camera.clone();dn.zoom=Dn,dn.updateMatrix();let Pe=(l-U.x*Me)/2,Xn=(c-U.y*Me)/2,Tr=Pe<s||Pe<u?(s-u)/2:0,wr=Xn<o||Xn<a?(o-a)/2:0;if(Tr){let yt=new Oe;yt.setFromMatrixColumn(dn.matrix,0),yt.normalize(),yt.multiplyScalar(Tr/Dn),Fe.add(yt)}if(wr){let yt=new Oe;yt.setFromMatrixColumn(dn.matrix,1),yt.normalize(),yt.multiplyScalar(wr/Dn),Fe.add(yt)}return{zoom:Me*this.camera.zoom,center:Fe}}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 j(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){var t;(t=this.currentFloor)==null||t.dispose(),this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.renderer.dispose(),this.lights.children.forEach(e=>e.dispose()),L(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 oa,this.lights=sm(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,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 Bs(this),this.hoverHelper=new Qs(this),this.resizeClientSize(),this.registryEvent()}};import{merge as lK}from"lodash";var cK={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}};function m1(r){return lK({},cK,r)}import{debounce as xK}from"lodash";var Q5=d(v(),1);var te;function g1(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(te)return e({db:te,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){te=o.target.result,console.log("onupgradeneeded"),e({db:te,type:"onupgradeneeded"})},i.onsuccess=o=>{te=o.target.result,e({db:te,type:"success"})},i.onerror=o=>{n(o)}})}function Tc(r,t,e){return e===void 0&&(e=te),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 y1(r,t,e,n){return n===void 0&&(n=te),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>j(this,null,function*(){let u=yield Tc(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 xn(r,t){t===void 0&&(t=te),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function M1(r){r===void 0&&(r=te),r==null||r.close(),te=null}import{Vector3 as wK,EventDispatcher as SK}from"three";var U5=d(Z(),1),G5=d(v(),1);function la(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 ca(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 P1(r,t,e){switch(r.l_type){case"graph":return hK(r,t);case"wall":return pK(r,t);case"lane":return fK(r,t);case"texture2d":case"texture3d":return dK(r,t);case"glb":return mK(r,t);case"store":return gK(r,t);case"facility":return MK(r,t);case"parkingSpace":return jK(r,t,e);case"text":return TK(r,t)}}function j1(r,t,e){switch(r.l_type){case"store":return yK(r,t,e);case"facility":return PK(r,t,e);case"parkingSpace":return AK(r,t)}}function hK(r,t){let e=t.userData.center;pt(r.elements,e);let n=[];r.elements.forEach(o=>{o.group==="ground"?t.createGround(o):n.push(o)});let i=n.reduce((o,s)=>{let{fillColor:a,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:h,airHeight:p}=s,m=a.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+h+"-"+p;return c===0&&(m=a.toLowerCase()+"-"+u+"-"+h+"-"+p),o[m]?o[m].push(s):o[m]=[s],o},{});Object.values(i).forEach(o=>{let s=new gr(t.context,o);t.mergeGraphicLayer.add(s)})}function pK(r,t){let e=t.userData.center;pt(r.elements,e);let n=r.elements.reduce((i,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:u,strokeOpacity:l,height:c}=o,h=s.toLowerCase()+"-"+a+"-"+u.toLowerCase()+"-"+l+"-"+c;return l===0&&(h=s.toLowerCase()+"-"+a+"-"+c),i[h]?i[h].push(o):i[h]=[o],i},{});Object.values(n).forEach(i=>{let o=new Ns(t.context,i);t.wallLayer.add(o)})}function fK(r,t){let e=t.userData.center;pt(r.elements,e);let n=r.elements.reduce((i,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:u,strokeOpacity:l}=o,c=s.toLowerCase()+"-"+a+"-"+u.toLowerCase()+"-"+l;return l===0&&(c=s.toLowerCase()+"-"+a),i[c]?i[c].push(o):i[c]=[o],i},{});Object.values(n).forEach(i=>{let o=new Gs(t.context,i);t.laneLayer.add(o)})}function dK(r,t){let e=t.userData.center;if(pt(r.elements,e),r.elements.length){let n=new mr(t.context,r.elements);t.textureLayer.add(n)}}function mK(r,t){let e=t.userData.center;pt(r.elements,e),r.elements.forEach(n=>{let i=new Us(t.context,T({},n,{url:n.secondUrl,rotate:n.secondRotate,width:n.secondWidth,center_x:n.center_coord_x,center_y:n.center_coord_y}));t.glbModelLayer.add(i)})}function gK(r,t){let e=t.userData.center;pt(r.elements,e),r.elements.map(n=>{let i=t.addGraphic(n);t.userData.graphics.push(i),t.userData.graphicMap.set(n.id,i)})}function yK(r,t,e){r.elements.map(n=>{try{let i=la(n,e),o=new $(t.context,{id:n.id,icon:n.poi_info.icon,text:i,position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height},icon_size:[24,24],level:n.poi_info.level||0});t.poiLayer2.pushPoi(o),o&&(o.userData.type="store",o.userData.data=n,o.userData.floor=t.name)}catch(i){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",i,n)}})}function MK(r,t){let e=t.userData.center;pt(r.elements,e),r.elements.map(n=>{let i=t.addGraphic(n);t.userData.graphics.push(i),t.userData.graphicMap.set(n.id,i)})}function PK(r,t,e){r.elements.filter(i=>i.poi_info).map(i=>{try{let o=ca(i,e),s=new $(t.context,{id:i.id,icon: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});t.poiLayer2.pushPoi(s),s.userData.type="facility",s.userData.data=i,s.userData.floor=t.name}catch(o){console.log("\u6DFB\u52A0facility\u5931\u8D25",o,i)}})}function jK(r,t,e){let n=t.userData.center;pt(r.elements,n),t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function AK(r,t){r.elements.filter(n=>n.texts[0]).forEach(n=>{try{let i=new $(t.context,{id:n.id,text:n.texts[0],position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height}});i&&(i.userData.type="parkingSpace",i.userData.data=n,i.userData.floor=t.name),t.poiLayer2.pushPoi(i)}catch(i){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",i,n)}})}function TK(r,t){let e=t.userData.center;pt(r.elements,e);let n=new Vs(t.context,r.elements.map(i=>T({},i,{center_x:i.center_coord_x,center_y:i.center_coord_y})));t.textTextureLayer.add(n)}var wc="map_version",Sc="route_version",bc="facility_version",vc="map_data",ha="road_network_data",_c="facility_data",bK={mergeParkingSpace:!0},pa=class extends SK{initDb(){return j(this,null,function*(){try{let{db:t,type:e}=yield g1("aibee_map",2);e==="onupgradeneeded"&&(xn(wc),xn(Sc),xn(bc),xn(vc),xn(ha),xn(_c)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t){return j(this,null,function*(){if(Array.isArray(t))this.floors=t;else{let e=yield fetch(t).then(n=>n.json());e.code===200&&(this.floors=e.data.list)}})}setCacheData(t,e,n){return this.initDbPromise.then(()=>y1(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Tc(t,""+e,this.db))}getFloorCacheKey(t){return""+t.floor_id}getFloorData(t){return j(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return j(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=la(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=ca(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return j(this,null,function*(){let e=this.getFloorCacheKey(t);console.time("zstd_json");let n=yield fetch(t.map_url).then(i=>i.json());return n.floor=t.floor,console.timeEnd("zstd_json"),this.setCacheData(vc,e,n),this.setCacheData(wc,e,t.version_id),n})}getFloorJsonData(t){return j(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(wc,n))===e.version_id){let o=yield this.getCacheData(vc,n);if(o)return o}return this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return j(this,null,function*(){return(yield Promise.all(this.floors.map(e=>j(this,null,function*(){let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Sc,n))===e.version_id){let s=yield this.getCacheData(ha,n);if(s)return s}let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(ha,n,o),this.setCacheData(Sc,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(ha,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return j(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=()=>j(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(_c,e,i),this.setCacheData(bc,e,t.version_id)),i});try{if((yield this.getCacheData(bc,e))===t.version_id){let o=yield this.getCacheData(_c,e);if(o)return o}return n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return j(this,null,function*(){})}getMulFloorsData(t){return j(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return j(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e){return j(this,null,function*(){return e=this.getFloorBaseLayer(t,e),yield this.getFloorContentLayer(t,e),this.getFloorPoi(t,e),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new wK),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t){return j(this,null,function*(){return new Promise(e=>{let n={run:()=>this._switchFloor(t),meta:{type:"switchFloor"}},i=this.taskQueue.replaceByMetaType(n),o=s=>{let{task:a,res:u}=s;a.tid===i&&(this.taskQueue.removeEventListener("active-task-end",o),e(u))};this.taskQueue.addEventListener("active-task-end",o)})})}_switchFloor(t){return j(this,null,function*(){var e;let n=t;if(typeof t=="string"){let u=yield this.getFloorJsonData(t);if(u)n=u;else return null}let i=new Rt(this.bmap.context),o=this.floors.find(u=>u.floor===n.floor);var s;let a=(s=o==null?void 0:o.map_angle)!=null?s:0;return this.bmap.dispatchEvent({type:at.SWITCH_FLOOR_BEFORE,data:{curFloor:i,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:i,graphics:[]}}),this.bmap.context.control.setAzimuthalAngle(a/180*Math.PI,!0),this.getFloorBaseLayer(n,i),this.changeFloorBox(n,i),this.bmap.buildingCenter=i.userData.center,this.bmap.currentBuildGround=(e=i.userData.data.layers.find(u=>u.l_type==="range"))==null?void 0:e.elements[0],this.bmap.context.switchFloor(i),this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:i,graphics:[]}}),yield Eo(),yield this.getFloorContentLayer(n,i),this.changeFloorBox(n,i),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:i,graphics:[]}}),yield qm(2),this.getFloorPoi(n,i),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:i,graphics:i.graphicLayer.children}}),this.bmap.dispatchEvent({type:at.SWITCH_FLOOR_AFTER,data:{curFloor:i,graphics:i.graphicLayer.children}}),i})}getFloorBaseLayer(t,e){e||(e=new Rt(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":pt(i.elements,n);let s=i.elements.map(a=>new Q(this.bmap.context,a));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return j(this,null,function*(){e||(e=new Rt(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)||(P1(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Eo(),n=Date.now()))}return e})}getFloorPoi(t,e){let n=Date.now();t.layers.map(o=>{j1(o,e,this.locale)}),console.log("poi time",Date.now()-n);let i=Date.now();Eo().then(()=>{console.log("poi render time",Date.now()-i)})}clear(){return j(this,null,function*(){var t;M1((t=this.db)!=null?t:void 0)})}dispose(){this.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new qn,this.locale="zh-cn",this.options=T({},bK,e),this.initDbPromise=this.initDb()}};var lH=d(v(),1);function A1(r,t){return j(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 T1(r,t){return j(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(m=>m.info=JSON.parse(m.info)),p||[]))})}function oH(r,t){return j(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?vK(u.fileId,t):null)})}function vK(r,t){return j(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 w1=class{load(t){return j(this,null,function*(){let e=Bn(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),T1(t,this.bmap.config)]),i=Bn({floor:t.floor,ts:t.ts});pt(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 j(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(at.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(at.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 j(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return j(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return j(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 j(this,null,function*(){let{brand:e,project:n}=t,i=Bn({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=A1({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 j(this,null,function*(){let e=new Rt(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 WH=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),S1=class extends _K{changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?vo(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 j(this,null,function*(){return this.loader||(this.loader=new pa(this),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(at.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(at.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(T({},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 Q))||[]}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(T({},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){e===void 0&&(e=500);let n=t.getPosition();return this.context.setCameraPosition(n,e)}translateElementToCenterX(t,e){return j(this,null,function*(){return e===void 0&&(e=500),It(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=W(o,u,s,a).x-s/2,h=new WK;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 W(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 j(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t){t===void 0&&(t=.1);let e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}measureDistance(){return j(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Fs(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 zs(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=vo(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,wt.dispose(),Et.dispose(),tn.dispose(),mt.dispose(),G.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.basicZoom=1,this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new H,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*25,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=m1(e),this.context=new ua(t,this.config),this.debounceResize=xK(this.resize,5),this.registryEvent()}};var DH=d(v(),1);import{EventDispatcher as IK}from"three";var gt=class extends IK{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 b1=class extends gt{fetchEquipment(){return j(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(at.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(at.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Nq=d(Lr(),1),Uq=d(pe(),1),Gq=d(v(),1),kq=d(Ac(),1);var rq=d(v(),1),iq=d(Z(),1);import{Mesh as KK,Object3D as RK,TextureLoader as FK,Color as zK,Vector2 as xc,Vector3 as NK,NormalBlending as UK,RepeatWrapping as GK}from"three";var KH=d(Sl(),1),RH=d(ai(),1),FH=d(ui(),1),zH=d(ci(),1),NH=d(hi(),1),UH=d(pi(),1),GH=d(di(),1),kH=d(mi(),1),VH=d(gi(),1),JH=d(yi(),1),LH=d(Mi(),1),BH=d(Pi(),1),QH=d(ji(),1),HH=d(Ti(),1),qH=d(wi(),1),$H=d(Z(),1),tq=d(lc(),1);import{BufferGeometry as YK,Matrix4 as _1,Vector3 as In,Ray as EK,Sphere as DK,LineSegments as XK,BufferAttribute as pn,ShaderChunk as bt,ShaderMaterial as W1,UniformsLib as ZK,Color as CK,Vector2 as v1}from"three";var ht=class extends YK{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 _1,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)}}})}};ht.prototype.setMatrixWorld=function(r){this.matrixWorld=r};ht.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};ht.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 In)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 OK(r,t){var e=new _1,n=new EK,i=new DK,o=new In,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 In,u=new In,l=new In,c=this instanceof XK?2:1,h=s.index,p=s.attributes;if(h!==null)for(var m=h.array,g=p.position.array,M=p.width.array,P=0,A=m.length-1;P<A;P+=c){var S=m[P],_=m[P+1];a.fromArray(g,S*3),u.fromArray(g,_*3);var I=M[Math.floor(P/3)]!==void 0?M[Math.floor(P/3)]:1,x=r.params.Line.threshold+this.material.lineWidth*I/2,O=x*x,b=n.distanceSqToSegment(a,u,o,l);if(!(b>O)){o.applyMatrix4(this.matrixWorld);var U=r.ray.origin.distanceTo(o);U<r.near||U>r.far||(t.push({distance:U,point:l.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this}),P=A)}}}}ht.prototype.raycast=OK;ht.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]};ht.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};ht.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new In(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new In(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=i.distanceTo(o);t+=s}return t};ht.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 pn(new Float32Array(this.positions),3),previous:new pn(new Float32Array(this.previous),3),next:new pn(new Float32Array(this.next),3),side:new pn(new Float32Array(this.side),1),width:new pn(new Float32Array(this.width),1),uv:new pn(new Float32Array(this.uvs),2),index:new pn(new Uint16Array(this.indices_array),1),counters:new pn(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 Wc(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}ht.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;Wc(t,0,e,0,i),Wc(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,Wc(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};bt.meshline_vert=["",bt.logdepthbuf_pars_vertex,bt.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;","",bt.logdepthbuf_vertex,bt.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",bt.fog_vertex,"}"].join(`
108
108
  `);bt.meshline_frag=["",bt.fog_pars_fragment,bt.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() {","",bt.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);","",bt.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
109
- `);var Yn=class extends W1{constructor(t){super({uniforms:Object.assign({},ZK.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new CK(16777215)},opacity:{value:1},resolution:{value:new v1(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 v1(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:bt.meshline_vert,fragmentShader:bt.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)}};Yn.prototype.copy=function(r){return W1.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 x1={texture_url:_s,lineWidth:10,color:16777215},fa=class extends RK{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 W(new NK(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 FK().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return j(this,null,function*(){let e=this.geometry=new ht;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=GK}let n=this.material=new Yn({useMap:!0,color:new zK(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:UK,repeat:new xc(this.getRepeat(),1)}),i=this.mesh=new KK(e,n);return i.renderOrder=9,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=x1,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({},x1,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as Ic,Easing as $K}from"@tweenjs/tween.js";import{Vector2 as tR,Vector3 as Re}from"three";var pq=d(Zs(),1),fq=d(v(),1),dq=d(Z(),1);import{EventDispatcher as kK,Vector2 as VK}from"three";import{Tween as JK}from"@tweenjs/tween.js";import{throttle as LK}from"lodash";var BK={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},da=class extends kK{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)}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,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;if(i){let g=_e(n,i);u=u.slice(g+1),u.unshift(i)}let l=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:c,closestPoint:h,index:p,i:m}=l.reduce((g,M,P)=>{if(M.floor!==t)return g;let{distance:A,closestPoint:S,index:_}=M.points.reduce((I,x,O,b)=>{if(!b[O+1])return T({},I,{distance:I.distance===1/0?K(x,e):I.distance});let{distance:U,closestPoint:Ar}=ng(e,x,b[O+1]);return U<I.distance?{distance:U,closestPoint:Ar,index:O}:I},{distance:1/0,closestPoint:M.points[0],index:0});return A<g.distance?{distance:A,closestPoint:S,index:P,i:_}:g},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:c,closestPoint:h,routeIndex:p+a,pointIndex:p===0?m+this.pointIndex:m}}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 j(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let i=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),s=o/this.options.simulationSpeed,a=this.throttleUpdatePosition=LK(l=>{let c=Qn(i,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new JK({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=xe.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===xe.FRONT&&s<=n.length;){let g=n[s],M=n[s+1],P=n[s+2];if(!g||!M)a=xe.END;else if(l+=K(g,M),!P)a=xe.END;else{a=u0(g,M,P),c=_o(g,M,P),h=(new VK(P[0]-M[0],P[1]-M[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=K(i,n[s])),a===xe.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let m=this.getCurRouteToStartDistance();return e===0&&m<=5?{dir:xe.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=xe.FRONT),{dir:a,distance:l,crossName:u,angle:c,nextAngle:h})}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;return e<=10&&(i=xe.END),{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}}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 H,this.resetTimer=null,this.tweenUtil=new en,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o)},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},BK,e),this.roadData=n,this.registryEvent()}};var Aq=d(os(),1),Tq=d(ai(),1),wq=d(ui(),1),Sq=d(ci(),1),bq=d(hi(),1),vq=d(pi(),1),_q=d(di(),1),Wq=d(mi(),1),xq=d(gi(),1),Iq=d(yi(),1),Yq=d(Mi(),1),Eq=d(Pi(),1),Dq=d(ji(),1),Xq=d(Ti(),1),Zq=d(wi(),1),Cq=d(wl(),1),Oq=d(v(),1);import{DataTexture as QK,LinearFilter as I1,RGBAFormat as Y1,Sprite as HK,SpriteMaterial as qK}from"three";var Ke=class r extends ${addDebug(){r.canvas.style.cssText=`
109
+ `);var Yn=class extends W1{constructor(t){super({uniforms:Object.assign({},ZK.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new CK(16777215)},opacity:{value:1},resolution:{value:new v1(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 v1(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:bt.meshline_vert,fragmentShader:bt.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)}};Yn.prototype.copy=function(r){return W1.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 x1={texture_url:_s,lineWidth:10,color:16777215},fa=class extends RK{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 W(new NK(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 FK().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return j(this,null,function*(){let e=this.geometry=new ht;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=GK}let n=this.material=new Yn({useMap:!0,color:new zK(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:UK,repeat:new xc(this.getRepeat(),1)}),i=this.mesh=new KK(e,n);return i.renderOrder=100009,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=x1,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({},x1,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as Ic,Easing as $K}from"@tweenjs/tween.js";import{Vector2 as tR,Vector3 as Re}from"three";var pq=d(Zs(),1),fq=d(v(),1),dq=d(Z(),1);import{EventDispatcher as kK,Vector2 as VK}from"three";import{Tween as JK}from"@tweenjs/tween.js";import{throttle as LK}from"lodash";var BK={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},da=class extends kK{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)}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,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;if(i){let g=_e(n,i);u=u.slice(g+1),u.unshift(i)}let l=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:c,closestPoint:h,index:p,i:m}=l.reduce((g,M,P)=>{if(M.floor!==t)return g;let{distance:A,closestPoint:S,index:_}=M.points.reduce((I,x,O,b)=>{if(!b[O+1])return T({},I,{distance:I.distance===1/0?K(x,e):I.distance});let{distance:U,closestPoint:Ar}=ng(e,x,b[O+1]);return U<I.distance?{distance:U,closestPoint:Ar,index:O}:I},{distance:1/0,closestPoint:M.points[0],index:0});return A<g.distance?{distance:A,closestPoint:S,index:P,i:_}:g},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:c,closestPoint:h,routeIndex:p+a,pointIndex:p===0?m+this.pointIndex:m}}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 j(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let i=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),s=o/this.options.simulationSpeed,a=this.throttleUpdatePosition=LK(l=>{let c=Qn(i,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new JK({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=xe.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===xe.FRONT&&s<=n.length;){let g=n[s],M=n[s+1],P=n[s+2];if(!g||!M)a=xe.END;else if(l+=K(g,M),!P)a=xe.END;else{a=u0(g,M,P),c=_o(g,M,P),h=(new VK(P[0]-M[0],P[1]-M[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=K(i,n[s])),a===xe.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let m=this.getCurRouteToStartDistance();return e===0&&m<=5?{dir:xe.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=xe.FRONT),{dir:a,distance:l,crossName:u,angle:c,nextAngle:h})}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;return e<=10&&(i=xe.END),{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}}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 H,this.resetTimer=null,this.tweenUtil=new en,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o)},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},BK,e),this.roadData=n,this.registryEvent()}};var Aq=d(os(),1),Tq=d(ai(),1),wq=d(ui(),1),Sq=d(ci(),1),bq=d(hi(),1),vq=d(pi(),1),_q=d(di(),1),Wq=d(mi(),1),xq=d(gi(),1),Iq=d(yi(),1),Yq=d(Mi(),1),Eq=d(Pi(),1),Dq=d(ji(),1),Xq=d(Ti(),1),Zq=d(wi(),1),Cq=d(wl(),1),Oq=d(v(),1);import{DataTexture as QK,LinearFilter as I1,RGBAFormat as Y1,Sprite as HK,SpriteMaterial as qK}from"three";var Ke=class r extends ${addDebug(){r.canvas.style.cssText=`
110
110
  position: fixed;
111
111
  top: 0;
112
112
  left: 0;
package/lib/bmap.min.js CHANGED
@@ -106,7 +106,7 @@
106
106
  }
107
107
  `,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 ut.ShaderMaterial({uniforms:{maxZ:{value:n},uColor:{value:new ut.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new ut.Color(Ke(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=Q.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 ut.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(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 ut.Vector3(u[0],u[1],e)),t.push(new ut.Vector3(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new ut.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new ut.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;this.geometry.dispose(),this.material.dispose(),(t=this.line)==null||t.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>w({},ja,n)),this.init()}};var sL=d(x(),1);var gt=A("three");var Ur=A("lodash");var H4={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},st=class extends gt.Object3D{get durIconAndText(){return this.options.icon&&this.options.text?2:0}get offset(){return this.options.icon&&this.options.text?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.options.text?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.options.text?this.options.text_font_size: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!(0,Ur.isNil)(t)&&!(0,Ur.isNil)(e)&&!(0,Ur.isNil)(n)&&!(0,Ur.isNil)(i)&&!(0,Ur.isNil)(o)}get deltaZ(){return!this.options.icon&&this.options.text?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>j(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text_font_size",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&this._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)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return j(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>j(this,null,function*(){let e=yield te.getTextureByUrl(this.options.icon),n=new gt.Sprite(new gt.SpriteMaterial({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));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.options.text){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 t=Gt.getTextureByText(this.options.text),this.textAspect=t.image.width/t.image.height;let e=new gt.Sprite(new gt.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test}));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,text:s}=this.options;o?s?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):s?(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 j(this,null,function*(){yield Promise.all([this.initIcon(),new Promise(t=>{this.initText(),t(!0)})]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:n}}=this.context,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 gt.Box2(new gt.Vector2(i-s,o-this.iconHeight),new gt.Vector2(i+s,o)),u=this.textWidth/2,l=new gt.Box2(new gt.Vector2(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new gt.Vector2(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){super(),this.context=t,this.textAspect=1,this.box=new gt.Box2,this._initIconPromise=null,this._initScale=n=>{let{zoom:i}=n;if(this.spriteText){let s=this.textHeight/i;this.spriteText.scale.set(this.textAspect*s,s,.1)}if(this.spriteIcon){var o;(o=this.spriteIcon)==null||o.scale.set(this.options.icon_size[0]/i,this.options.icon_size[1]/i,.1)}this.resetZ()},this.options=Nn(w({},H4,e),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var Jt=A("three"),E1=A("three/examples/jsm/utils/BufferGeometryUtils");var D1={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},bo=class extends Jt.Object3D{init(){return j(this,null,function*(){let t=this.options.map(s=>Gt.getTextureByText(s.texts[0],{fillStyle:_s(s.fillColor,s.fillOpacity),strokeStyle:_s(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"54px sans-serif"})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.image,h=l/c,p=u.secondHeight*h,m=new Jt.PlaneGeometry(p,u.secondHeight),g=new Jt.Matrix4().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new Jt.Matrix4().makeRotationZ(u.secondRotate));return m.applyMatrix4(g),m}),n=(0,E1.mergeGeometries)(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let a=new Jt.MeshBasicMaterial({map:s,alphaTest:1,side:Jt.DoubleSide});return s.needsUpdate=!0,a}),o=new Jt.Mesh(n,i);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e;(t=this.mesh)==null||t.geometry.dispose(),((e=this.mesh)==null?void 0:e.material).forEach(n=>n.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>w({},D1,n)),this.init()}};var Xn=A("three"),vo=class extends Xn.Object3D{setPosition(t,e){this.geometry.setFromPoints([t,e]),this.line||this.createLine()}createLine(){this.line=new Xn.Line(this.geometry,this.material),this.add(this.line)}dispose(){this.line&&$(this.line),this.geometry=null,this.material=null}constructor(t,e,n){super(),this.context=t,this.geometry=new Xn.BufferGeometry,this.material=new Xn.LineBasicMaterial({color:0}),e&&n&&this.setPosition(e,n)}};var X1=A("three"),_a=class extends Vt{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=Y(this.startPoint,e,n,i),s=Y(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 nt&&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 m=Y(p,i,o,s);return qe(m,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:u,max:l}=a,c=Y(u,i,o,s),h=Y(l,i,o,s);return!(!qe(c,e,n)||!qe(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new X1.Frustum,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=w({},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=$e(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var _o=class extends Z1.EventDispatcher{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.context=t,this._list=new Set,this.downPoint=null,this.downTime=0,this.isMultipleSelect=!1,this.onPointerDown=e=>{Date.now()-this.downTime<200||(this.downPoint={x:e.offsetX,y:e.offsetY},this.downTime=Date.now())},this.onPointerUp=e=>{if(!this.downPoint)return;let{offsetX: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))}}),(Gn?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=>{kn(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{kn(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 _a(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var XL=d(We(),1),ZL=d(xe(),1),CL=d(Ie(),1),OL=d(Ye(),1),KL=d(Ee(),1),RL=d(De(),1),FL=d(Xe(),1),zL=d(x(),1);var Wa=A("three");var Wo=class extends Wa.EventDispatcher{handleHoverGraphicsChange(t){t===void 0&&(t=this.curGraphics),this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new it,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 m=i.find(g=>g.options.id===p.options.id);if(m instanceof Yn){let{x:g,y:M}=m.clientPos,P=Math.sqrt((g-o.offsetX)**2+(M-o.offsetY)**2);P<h&&(h=P,c=p)}else if(m instanceof st){let{x:g,y:M}=m.box.getCenter(new Wa.Vector2),P=Math.sqrt((g-o.offsetX)**2+(M-o.offsetY)**2);P<h&&(h=P,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 kL=d(x(),1),sr=A("three");var xa=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(P=>P instanceof kt).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,u=Y(s,n,i,o),l=Y(a,n,i,o),c=Y(new sr.Vector3(s.x,a.y,a.z),n,i,o),h=Y(new sr.Vector3(a.x,s.y,s.z),n,i,o),p=Math.min(u.x,l.x,c.x,h.x),m=Math.max(u.x,l.x,c.x,h.x),g=Math.min(u.y,l.y,c.y,h.y),M=Math.max(u.y,l.y,c.y,h.y);return{left:p,right:m,top:g,bottom:M}}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=n>=h,m=s-e>=l,g=a-i>=c,M=o>=u;return p&&m&&g&&M}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new sr.Vector3,zoom:1,target:new sr.Vector3},this.enable=!0,this.box=new sr.Box3,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 i7=d(sh(),1),ah=A("three"),ar=A("@tweenjs/tween.js");var e7=d(x(),1),n7=d(R(),1),v=A("three"),Ya=new v.Ray,B1=new v.Plane,d9=Math.cos(70*v.MathUtils.DEG2RAD),Ea=class extends v.EventDispatcher{dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerUp),this.domElement.removeEventListener("wheel",this.onMouseWheel),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp),this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null)}constructor(t,e){super(),this.rotateLineStart=new v.Vector2,this.rotateLineEnd=new v.Vector2,this.spherical=new v.Spherical,this.sphericalDelta=new v.Spherical,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new v.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.screenSpacePanning=!1,this.mouseButtons={LEFT:v.MOUSE.PAN,MIDDLE:v.MOUSE.DOLLY,RIGHT:v.MOUSE.ROTATE},this.touches={ONE:v.TOUCH.PAN,TWO:v.TOUCH.DOLLY_ROTATE},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return 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 v.Vector3,S=new v.Quaternion().setFromUnitVectors(t.up,new v.Vector3(0,1,0)),G=S.clone().invert(),q=new v.Vector3,Ot=new v.Quaternion,be=new v.Vector3,he=2*Math.PI;return function($r){$r===void 0&&($r=null);let Ve=n.object.position;y.copy(Ve).sub(n.target),y.applyQuaternion(S),a.setFromVector3(y),n.autoRotate&&o===i.NONE&&Ge(Qr($r)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let Je=n.minAzimuthAngle,Le=n.maxAzimuthAngle;isFinite(Je)&&isFinite(Le)&&(Je<-Math.PI?Je+=he:Je>Math.PI&&(Je-=he),Le<-Math.PI?Le+=he:Le>Math.PI&&(Le-=he),Je<=Le?a.theta=Math.max(Je,Math.min(Le,a.theta)):a.theta=a.theta>(Je+Le)/2?Math.max(Je,a.theta):Math.min(Le,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&&N||n.object.isOrthographicCamera?a.radius=Ct(a.radius):a.radius=Ct(a.radius*l),y.setFromSpherical(a),y.applyQuaternion(G),Ve.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 Co=!1;if(n.zoomToCursor&&N){let ti=null;if(n.object.isPerspectiveCamera){let ei=y.length();ti=Ct(ei*l);let Oo=ei-ti;n.object.position.addScaledVector(X,Oo),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let ei=new v.Vector3(D.x,D.y,0);ei.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Co=!0;let Oo=new v.Vector3(D.x,D.y,0);Oo.unproject(n.object),n.object.position.sub(Oo).add(ei),n.object.updateMatrixWorld(),ti=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;ti!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(ti).add(n.object.position):(Ya.origin.copy(n.object.position),Ya.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Ya.direction))<d9?t.lookAt(n.target):(B1.setFromNormalAndCoplanarPoint(n.object.up,n.target),Ya.intersectPlane(B1,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Co=!0);return l=1,N=!1,Co||q.distanceToSquared(n.object.position)>s||8*(1-Ot.dot(n.object.quaternion))>s||be.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),q.copy(n.object.position),Ot.copy(n.object.quaternion),be.copy(n.target),Co=!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 v.Spherical,u=new v.Spherical,l=1,c=new v.Vector3,h=new v.Vector2,p=new v.Vector2,m=new v.Vector2,g=new v.Vector2,M=new v.Vector2,P=new v.Vector2,T=new v.Vector2,b=new v.Vector2,I=new v.Vector2,X=new v.Vector3,D=new v.Vector2,N=!1,_=[],B={};function Qr(y){return y!==null?2*Math.PI/60*n.autoRotateSpeed*y:2*Math.PI/60/60*n.autoRotateSpeed}function cr(){return Math.pow(.95,n.zoomSpeed)}function Ge(y){u.theta-=y}function ln(y){u.phi-=y}let hr=function(){let y=new v.Vector3;return function(G,q){y.setFromMatrixColumn(q,0),y.multiplyScalar(-G),c.add(y)}}(),Cn=function(){let y=new v.Vector3;return function(G,q){n.screenSpacePanning===!0?y.setFromMatrixColumn(q,1):(y.setFromMatrixColumn(q,0),y.crossVectors(n.object.up,y)),y.multiplyScalar(G),c.add(y)}}(),ke=function(){let y=new v.Vector3;return function(G,q){let Ot=n.domElement;if(n.object.isPerspectiveCamera){let be=n.object.position;y.copy(be).sub(n.target);let he=y.length();he*=Math.tan(n.object.fov/2*Math.PI/180),hr(2*G*he/Ot.clientHeight,n.object.matrix),Cn(2*q*he/Ot.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(hr(G*(n.object.right-n.object.left)/n.object.zoom/Ot.clientWidth,n.object.matrix),Cn(q*(n.object.top-n.object.bottom)/n.object.zoom/Ot.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function pr(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 Hr(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 qr(y){if(!n.zoomToCursor)return;N=!0;let S=n.domElement.getBoundingClientRect(),G=y.clientX-S.left,q=y.clientY-S.top,Ot=S.width,be=S.height;D.x=G/Ot*2-1,D.y=-(q/be)*2+1,X.set(D.x,D.y,1).unproject(n.object).sub(n.object.position).normalize()}function Ct(y){return Math.max(n.minDistance,Math.min(n.maxDistance,y))}function Xh(y){h.set(y.clientX,y.clientY)}function wT(y){qr(y),T.set(y.clientX,y.clientY)}function Zh(y){g.set(y.clientX,y.clientY)}function ST(y){p.set(y.clientX,y.clientY),m.subVectors(p,h).multiplyScalar(n.rotateSpeed);let S=n.domElement;Ge(2*Math.PI*m.x/S.clientHeight),ln(2*Math.PI*m.y/S.clientHeight),h.copy(p),n.update()}function bT(y){b.set(y.clientX,y.clientY),I.subVectors(b,T),I.y>0?pr(cr()):I.y<0&&Hr(cr()),T.copy(b),n.update()}function vT(y){M.set(y.clientX,y.clientY),P.subVectors(M,g).multiplyScalar(n.panSpeed),ke(P.x,P.y),g.copy(M),n.update()}function _T(y){qr(y),y.deltaY<0?Hr(cr()):y.deltaY>0&&pr(cr()),n.update()}function WT(y){let S=!1;switch(y.code){case n.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?ln(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):ke(0,n.keyPanSpeed),S=!0;break;case n.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?ln(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):ke(0,-n.keyPanSpeed),S=!0;break;case n.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?Ge(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):ke(n.keyPanSpeed,0),S=!0;break;case n.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?Ge(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):ke(-n.keyPanSpeed,0),S=!0;break}S&&(y.preventDefault(),n.update())}function Ch(){if(_.length===1)h.set(_[0].pageX,_[0].pageY);else{let y=(_[0].pageX-_[0].pageY)/(_[1].pageX-_[1].pageY),S=_[0].pageY-y*_[0].pageX;n.rotateLineStart.set(y,S);let G=.5*(_[0].pageX+_[1].pageX),q=.5*(_[0].pageY+_[1].pageY);h.set(G,q)}}function Oh(){if(_.length===1)g.set(_[0].pageX,_[0].pageY);else{let y=.5*(_[0].pageX+_[1].pageX),S=.5*(_[0].pageY+_[1].pageY);g.set(y,S)}}function Kh(){let y=_[0].pageX-_[1].pageX,S=_[0].pageY-_[1].pageY,G=Math.sqrt(y*y+S*S);T.set(0,G)}function xT(){n.enableZoom&&Kh(),n.enablePan&&Oh()}function IT(){n.enableZoom&&Kh(),n.enableRotate&&Ch()}function Rh(y){if(_.length==1)p.set(y.pageX,y.pageY);else{let G=nu(y),q=.5*(y.pageX+G.x),Ot=.5*(y.pageY+G.y);p.set(q,Ot);let be=(y.pageY-G.y)/(y.pageX-G.x),he=G.y-be*G.x;if(n.rotateLineEnd.set(be,he),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let ru=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),$r=be*ru+he;if(Number.isFinite(ru)&&Number.isFinite($r)){let Ve=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(Ve)<.5&&(Ve=-Math.sign(Ve)*(Math.PI-Math.abs(Ve))),Math.abs(Ve)<.1&&(u.theta+=Ve)}}n.rotateLineStart.copy(n.rotateLineEnd)}m.subVectors(p,h).multiplyScalar(n.rotateSpeed);let S=n.domElement;ln(2*Math.PI*m.y/S.clientHeight),h.copy(p)}function Fh(y){if(_.length===1)M.set(y.pageX,y.pageY);else{let S=nu(y),G=.5*(y.pageX+S.x),q=.5*(y.pageY+S.y);M.set(G,q)}P.subVectors(M,g).multiplyScalar(n.panSpeed),ke(P.x,P.y),g.copy(M)}function zh(y){let S=nu(y),G=y.pageX-S.x,q=y.pageY-S.y,Ot=Math.sqrt(G*G+q*q);b.set(0,Ot),I.set(0,Math.pow(b.y/T.y,n.zoomSpeed)),pr(I.y),T.copy(b)}function YT(y){n.enableZoom&&zh(y),n.enablePan&&Fh(y)}function ET(y){n.enableZoom&&zh(y),n.enableRotate&&Rh(y)}this.onPointerDown=function(S){n.enabled!==!1&&(_.length===0&&(n.domElement.setPointerCapture(S.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),OT(S),S.pointerType==="touch"?ZT(S):DT(S))},this.onPointerMove=function(S){n.enabled!==!1&&(S.pointerType==="touch"?CT(S):XT(S))},this.onPointerUp=function(S){KT(S),_.length===0&&(n.domElement.releasePointerCapture(S.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=i.NONE};function DT(y){let S;switch(y.button){case 0:S=n.mouseButtons.LEFT;break;case 1:S=n.mouseButtons.MIDDLE;break;case 2:S=n.mouseButtons.RIGHT;break;default:S=-1}switch(S){case v.MOUSE.DOLLY:if(n.enableZoom===!1)return;wT(y),o=i.DOLLY;break;case v.MOUSE.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enablePan===!1)return;Zh(y),o=i.PAN}else{if(n.enableRotate===!1)return;Xh(y),o=i.ROTATE}break;case v.MOUSE.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enableRotate===!1)return;Xh(y),o=i.ROTATE}else{if(n.enablePan===!1)return;Zh(y),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function XT(y){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;ST(y);break;case i.DOLLY:if(n.enableZoom===!1)return;bT(y);break;case i.PAN:if(n.enablePan===!1)return;vT(y);break}}this.onMouseWheel=function(S){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(S.preventDefault(),n.dispatchEvent({type:"start"}),_T(S),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(S){n.enabled===!1||n.enablePan===!1||WT(S)};function ZT(y){switch(Nh(y),_.length){case 1:switch(n.touches.ONE){case v.TOUCH.ROTATE:if(n.enableRotate===!1)return;Ch(),o=i.TOUCH_ROTATE;break;case v.TOUCH.PAN:if(n.enablePan===!1)return;Oh(),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case v.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xT(),o=i.TOUCH_DOLLY_PAN;break;case v.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;IT(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function CT(y){switch(Nh(y),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;Rh(y),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;Fh(y),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;YT(y),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ET(y),n.update();break;default:o=i.NONE}}this.onContextMenu=function(S){n.enabled!==!1&&S.preventDefault()};function OT(y){_.push(y)}function KT(y){delete B[y.pointerId];for(let S=0;S<_.length;S++)if(_[S].pointerId==y.pointerId){_.splice(S,1);return}}function Nh(y){let S=B[y.pointerId];S===void 0&&(S=new v.Vector2,B[y.pointerId]=S),S.set(y.pageX,y.pageY)}function nu(y){let S=y.pointerId===_[0].pointerId?_[1]:_[0];return B[S.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 Da=class extends Ea{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 j(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):Nt(new Promise(i=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new ar.Tween(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):Nt(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new ar.Tween(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 ah.Vector3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return j(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 Nt(new Promise(o=>{let s=new ar.Tween(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 j(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?Nt(new Promise(s=>{let a=new ar.Tween(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()),!t)return;this.camera.updateMatrix();let n=new ah.Vector3;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 ar.Group,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()}};var Gr=A("three");var Xa=class extends Gr.WebGLRenderer{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()}constructor(t){super(w({antialias:!0,alpha:!0},t)),this.event=new Gr.EventDispatcher,this.enable=!0,this.timer=new it,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=Gr.PCFSoftShadowMap}};var Zn=A("three"),Q1=A("three/examples/jsm/loaders/RGBELoader.js");var Za=class extends Zn.Scene{constructor(){super(),new Q1.RGBELoader().load(M1,t=>{t.mapping=Zn.EquirectangularReflectionMapping,this.environment=t;let e=new Zn.Matrix4;e.makeRotationX(Math.PI/2),this.environmentRotation=new Zn.Euler().setFromRotationMatrix(e)})}};var H1=A("three"),Ca=class extends H1.OrthographicCamera{constructor(t,e){super(-t/2,t/2,e/2,-e/2,-1e4,5e4),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var xo=class extends z.EventDispatcher{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 Ca(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new Da(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 xa(this)}getRatio(t,e){t===void 0&&(t=new z.Vector3(0,0,0)),e===void 0&&(e=new z.Vector3(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=Y(t,this.camera,n,i),s=Y(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 z.AmbientLight&&(e.color=new z.Color(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 z.Vector2;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new z.Raycaster;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 z.Box3().setFromObject(t);this.setPolarAngle(h,0);let{max:m,min:g}=p,M=new z.Vector3(g.x,m.y,m.z),P=new z.Vector3(m.x,m.y,m.z),T=new z.Vector3(m.x,g.y,g.z),b=new z.Vector3(g.x,g.y,g.z),I=Y(M,this.camera,l,c),X=Y(P,this.camera,l,c),D=Y(b,this.camera,l,c),N=Y(T,this.camera,l,c),B=new z.Box2().setFromPoints([new z.Vector2(I.x,I.y),new z.Vector2(X.x,X.y),new z.Vector2(D.x,D.y),new z.Vector2(N.x,N.y)]).getSize(new z.Vector2),Qr=(l-s-u)/B.x,cr=(c-o-a)/B.y,Ge=Math.min(Qr,cr),ln=new z.Vector3((m.x+g.x)/2,(m.y+g.y)/2,(m.z+g.z)/2),hr=Ge*this.camera.zoom,Cn=this.camera.clone();Cn.zoom=hr,Cn.updateMatrix();let ke=(l-B.x*Ge)/2,pr=(c-B.y*Ge)/2,Hr=ke<s||ke<u?(s-u)/2:0,qr=pr<o||pr<a?(o-a)/2:0;if(Hr){let Ct=new z.Vector3;Ct.setFromMatrixColumn(Cn.matrix,0),Ct.normalize(),Ct.multiplyScalar(Hr/hr),ln.add(Ct)}if(qr){let Ct=new z.Vector3;Ct.setFromMatrixColumn(Cn.matrix,1),Ct.normalize(),Ct.multiplyScalar(qr/hr),ln.add(Ct)}return{zoom:Ge*this.camera.zoom,center:ln}}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 j(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){var t;(t=this.currentFloor)==null||t.dispose(),this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.renderer.dispose(),this.lights.children.forEach(e=>e.dispose()),$(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new Za,this.renderer=new Xa,this.lights=a0(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,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 _o(this),this.hoverHelper=new Wo(this),this.resizeClientSize(),this.registryEvent()}};var q1=A("lodash"),$1={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}};function uh(r){return(0,q1.merge)({},$1,r)}var oT=A("lodash");var K7=d(x(),1);var Se;function tT(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(Se)return e({db:Se,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){Se=o.target.result,console.log("onupgradeneeded"),e({db:Se,type:"onupgradeneeded"})},i.onsuccess=o=>{Se=o.target.result,e({db:Se,type:"success"})},i.onerror=o=>{n(o)}})}function lh(r,t,e){return e===void 0&&(e=Se),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 eT(r,t,e,n){return n===void 0&&(n=Se),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>j(this,null,function*(){let u=yield lh(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 ur(r,t){t===void 0&&(t=Se),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function nT(r){r===void 0&&(r=Se),r==null||r.close(),Se=null}var Fa=A("three");var Y7=d(R(),1),E7=d(x(),1);function Oa(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 Ka(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 rT(r,t,e){switch(r.l_type){case"graph":return m9(r,t);case"wall":return g9(r,t);case"lane":return y9(r,t);case"texture2d":case"texture3d":return M9(r,t);case"glb":return P9(r,t);case"store":return j9(r,t);case"facility":return T9(r,t);case"parkingSpace":return S9(r,t,e);case"text":return v9(r,t)}}function iT(r,t,e){switch(r.l_type){case"store":return A9(r,t,e);case"facility":return w9(r,t,e);case"parkingSpace":return b9(r,t)}}function m9(r,t){let e=t.userData.center;Tt(r.elements,e);let n=[];r.elements.forEach(o=>{o.group==="ground"?t.createGround(o):n.push(o)});let i=n.reduce((o,s)=>{let{fillColor:a,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:h,airHeight:p}=s,m=a.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+h+"-"+p;return c===0&&(m=a.toLowerCase()+"-"+u+"-"+h+"-"+p),o[m]?o[m].push(s):o[m]=[s],o},{});Object.values(i).forEach(o=>{let s=new or(t.context,o);t.mergeGraphicLayer.add(s)})}function g9(r,t){let e=t.userData.center;Tt(r.elements,e);let n=r.elements.reduce((i,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:u,strokeOpacity:l,height:c}=o,h=s.toLowerCase()+"-"+a+"-"+u.toLowerCase()+"-"+l+"-"+c;return l===0&&(h=s.toLowerCase()+"-"+a+"-"+c),i[h]?i[h].push(o):i[h]=[o],i},{});Object.values(n).forEach(i=>{let o=new To(t.context,i);t.wallLayer.add(o)})}function y9(r,t){let e=t.userData.center;Tt(r.elements,e);let n=r.elements.reduce((i,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:u,strokeOpacity:l}=o,c=s.toLowerCase()+"-"+a+"-"+u.toLowerCase()+"-"+l;return l===0&&(c=s.toLowerCase()+"-"+a),i[c]?i[c].push(o):i[c]=[o],i},{});Object.values(n).forEach(i=>{let o=new So(t.context,i);t.laneLayer.add(o)})}function M9(r,t){let e=t.userData.center;if(Tt(r.elements,e),r.elements.length){let n=new ir(t.context,r.elements);t.textureLayer.add(n)}}function P9(r,t){let e=t.userData.center;Tt(r.elements,e),r.elements.forEach(n=>{let i=new wo(t.context,w({},n,{url:n.secondUrl,rotate:n.secondRotate,width:n.secondWidth,center_x:n.center_coord_x,center_y:n.center_coord_y}));t.glbModelLayer.add(i)})}function j9(r,t){let e=t.userData.center;Tt(r.elements,e),r.elements.map(n=>{let i=t.addGraphic(n);t.userData.graphics.push(i),t.userData.graphicMap.set(n.id,i)})}function A9(r,t,e){r.elements.map(n=>{try{let i=Oa(n,e),o=new st(t.context,{id:n.id,icon:n.poi_info.icon,text:i,position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height},icon_size:[24,24],level:n.poi_info.level||0});t.poiLayer2.pushPoi(o),o&&(o.userData.type="store",o.userData.data=n,o.userData.floor=t.name)}catch(i){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",i,n)}})}function T9(r,t){let e=t.userData.center;Tt(r.elements,e),r.elements.map(n=>{let i=t.addGraphic(n);t.userData.graphics.push(i),t.userData.graphicMap.set(n.id,i)})}function w9(r,t,e){r.elements.filter(i=>i.poi_info).map(i=>{try{let o=Ka(i,e),s=new st(t.context,{id:i.id,icon: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});t.poiLayer2.pushPoi(s),s.userData.type="facility",s.userData.data=i,s.userData.floor=t.name}catch(o){console.log("\u6DFB\u52A0facility\u5931\u8D25",o,i)}})}function S9(r,t,e){let n=t.userData.center;Tt(r.elements,n),t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function b9(r,t){r.elements.filter(n=>n.texts[0]).forEach(n=>{try{let i=new st(t.context,{id:n.id,text:n.texts[0],position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height}});i&&(i.userData.type="parkingSpace",i.userData.data=n,i.userData.floor=t.name),t.poiLayer2.pushPoi(i)}catch(i){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",i,n)}})}function v9(r,t){let e=t.userData.center;Tt(r.elements,e);let n=new bo(t.context,r.elements.map(i=>w({},i,{center_x:i.center_coord_x,center_y:i.center_coord_y})));t.textTextureLayer.add(n)}var ch="map_version",hh="route_version",ph="facility_version",fh="map_data",Ra="road_network_data",dh="facility_data",_9={mergeParkingSpace:!0},Io=class extends Fa.EventDispatcher{initDb(){return j(this,null,function*(){try{let{db:t,type:e}=yield tT("aibee_map",2);e==="onupgradeneeded"&&(ur(ch),ur(hh),ur(ph),ur(fh),ur(Ra),ur(dh)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t){return j(this,null,function*(){if(Array.isArray(t))this.floors=t;else{let e=yield fetch(t).then(n=>n.json());e.code===200&&(this.floors=e.data.list)}})}setCacheData(t,e,n){return this.initDbPromise.then(()=>eT(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>lh(t,""+e,this.db))}getFloorCacheKey(t){return""+t.floor_id}getFloorData(t){return j(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return j(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=Oa(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=Ka(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return j(this,null,function*(){let e=this.getFloorCacheKey(t);console.time("zstd_json");let n=yield fetch(t.map_url).then(i=>i.json());return n.floor=t.floor,console.timeEnd("zstd_json"),this.setCacheData(fh,e,n),this.setCacheData(ch,e,t.version_id),n})}getFloorJsonData(t){return j(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(ch,n))===e.version_id){let o=yield this.getCacheData(fh,n);if(o)return o}return this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return j(this,null,function*(){return(yield Promise.all(this.floors.map(e=>j(this,null,function*(){let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(hh,n))===e.version_id){let s=yield this.getCacheData(Ra,n);if(s)return s}let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Ra,n,o),this.setCacheData(hh,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Ra,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return j(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=()=>j(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(dh,e,i),this.setCacheData(ph,e,t.version_id)),i});try{if((yield this.getCacheData(ph,e))===t.version_id){let o=yield this.getCacheData(dh,e);if(o)return o}return n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return j(this,null,function*(){})}getMulFloorsData(t){return j(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return j(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e){return j(this,null,function*(){return e=this.getFloorBaseLayer(t,e),yield this.getFloorContentLayer(t,e),this.getFloorPoi(t,e),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new Fa.Vector3),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t){return j(this,null,function*(){return new Promise(e=>{let n={run:()=>this._switchFloor(t),meta:{type:"switchFloor"}},i=this.taskQueue.replaceByMetaType(n),o=s=>{let{task:a,res:u}=s;a.tid===i&&(this.taskQueue.removeEventListener("active-task-end",o),e(u))};this.taskQueue.addEventListener("active-task-end",o)})})}_switchFloor(t){return j(this,null,function*(){var e;let n=t;if(typeof t=="string"){let u=yield this.getFloorJsonData(t);if(u)n=u;else return null}let i=new kt(this.bmap.context),o=this.floors.find(u=>u.floor===n.floor);var s;let a=(s=o==null?void 0:o.map_angle)!=null?s:0;return this.bmap.dispatchEvent({type:Pt.SWITCH_FLOOR_BEFORE,data:{curFloor:i,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:i,graphics:[]}}),this.bmap.context.control.setAzimuthalAngle(a/180*Math.PI,!0),this.getFloorBaseLayer(n,i),this.changeFloorBox(n,i),this.bmap.buildingCenter=i.userData.center,this.bmap.currentBuildGround=(e=i.userData.data.layers.find(u=>u.l_type==="range"))==null?void 0:e.elements[0],this.bmap.context.switchFloor(i),this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:i,graphics:[]}}),yield vi(),yield this.getFloorContentLayer(n,i),this.changeFloorBox(n,i),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:i,graphics:[]}}),yield w0(2),this.getFloorPoi(n,i),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:i,graphics:i.graphicLayer.children}}),this.bmap.dispatchEvent({type:Pt.SWITCH_FLOOR_AFTER,data:{curFloor:i,graphics:i.graphicLayer.children}}),i})}getFloorBaseLayer(t,e){e||(e=new kt(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":Tt(i.elements,n);let s=i.elements.map(a=>new nt(this.bmap.context,a));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return j(this,null,function*(){e||(e=new kt(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)||(rT(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield vi(),n=Date.now()))}return e})}getFloorPoi(t,e){let n=Date.now();t.layers.map(o=>{iT(o,e,this.locale)}),console.log("poi time",Date.now()-n);let i=Date.now();vi().then(()=>{console.log("poi render time",Date.now()-i)})}clear(){return j(this,null,function*(){var t;nT((t=this.db)!=null?t:void 0)})}dispose(){this.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new Bn,this.locale="zh-cn",this.options=w({},_9,e),this.initDbPromise=this.initDb()}};var B7=d(x(),1);function mh(r,t){return j(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 gh(r,t){return j(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(m=>m.info=JSON.parse(m.info)),p||[]))})}function W9(r,t){return j(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?x9(u.fileId,t):null)})}function x9(r,t){return j(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 yh=class{load(t){return j(this,null,function*(){let e=Vn(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),gh(t,this.bmap.config)]),i=Vn({floor:t.floor,ts:t.ts});Tt(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 j(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 j(this,null,function*(){let n=yield this.load(w({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return j(this,null,function*(){let n=yield this.load(w({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return j(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 j(this,null,function*(){let{brand:e,project:n}=t,i=Vn({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=mh({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 j(this,null,function*(){let e=new kt(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 I9=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),Mh=class extends za.EventDispatcher{changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?Ti(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 j(this,null,function*(){return this.loader||(this.loader=new Io(this),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(w({},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 nt))||[]}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(w({},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){e===void 0&&(e=500);let n=t.getPosition();return this.context.setCameraPosition(n,e)}translateElementToCenterX(t,e){return j(this,null,function*(){return e===void 0&&(e=500),Nt(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=Y(o,u,s,a).x-s/2,h=new za.Vector3;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 Y(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 j(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t){t===void 0&&(t=.1);let e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}measureDistance(){return j(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new jo(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 Ao(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=Ti(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,Gt.dispose(),te.dispose(),An.dispose(),Et.dispose(),Q.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.basicZoom=1,this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new it,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*25,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=uh(e),this.context=new xo(t,this.config),this.debounceResize=(0,oT.debounce)(this.resize,5),this.registryEvent()}};var mB=d(x(),1);var sT=A("three"),Xt=class extends sT.EventDispatcher{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 Ph=class extends Xt{fetchEquipment(){return j(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 M8=d(_i(),1),P8=d(Ze(),1),j8=d(x(),1),A8=d(sh(),1);var KB=d(x(),1),RB=d(R(),1),lt=A("three");var jB=d(lc(),1),AB=d(Fi(),1),TB=d(zi(),1),wB=d(Ui(),1),SB=d(Gi(),1),bB=d(ki(),1),vB=d(Ji(),1),_B=d(Li(),1),WB=d(Bi(),1),xB=d(Qi(),1),IB=d(Hi(),1),YB=d(qi(),1),EB=d($i(),1),DB=d(eo(),1),XB=d(no(),1),ZB=d(R(),1),CB=d(Lc(),1),W=A("three"),Wt=class extends W.BufferGeometry{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new W.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};Wt.prototype.setMatrixWorld=function(r){this.matrixWorld=r};Wt.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};Wt.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 W.Vector3)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 Y9(r,t){var e=new W.Matrix4,n=new W.Ray,i=new W.Sphere,o=new W.Vector3,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 W.Vector3,u=new W.Vector3,l=new W.Vector3,c=this instanceof W.LineSegments?2:1,h=s.index,p=s.attributes;if(h!==null)for(var m=h.array,g=p.position.array,M=p.width.array,P=0,T=m.length-1;P<T;P+=c){var b=m[P],I=m[P+1];a.fromArray(g,b*3),u.fromArray(g,I*3);var X=M[Math.floor(P/3)]!==void 0?M[Math.floor(P/3)]:1,D=r.params.Line.threshold+this.material.lineWidth*X/2,N=D*D,_=n.distanceSqToSegment(a,u,o,l);if(!(_>N)){o.applyMatrix4(this.matrixWorld);var B=r.ray.origin.distanceTo(o);B<r.near||B>r.far||(t.push({distance:B,point:l.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this}),P=T)}}}}Wt.prototype.raycast=Y9;Wt.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]};Wt.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Wt.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new W.Vector3(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new W.Vector3(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=i.distanceTo(o);t+=s}return t};Wt.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 W.BufferAttribute(new Float32Array(this.positions),3),previous:new W.BufferAttribute(new Float32Array(this.previous),3),next:new W.BufferAttribute(new Float32Array(this.next),3),side:new W.BufferAttribute(new Float32Array(this.side),1),width:new W.BufferAttribute(new Float32Array(this.width),1),uv:new W.BufferAttribute(new Float32Array(this.uvs),2),index:new W.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new W.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function jh(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}Wt.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;jh(t,0,e,0,i),jh(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,jh(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};W.ShaderChunk.meshline_vert=["",W.ShaderChunk.logdepthbuf_pars_vertex,W.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",W.ShaderChunk.logdepthbuf_vertex,W.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",W.ShaderChunk.fog_vertex,"}"].join(`
108
108
  `);W.ShaderChunk.meshline_frag=["",W.ShaderChunk.fog_pars_fragment,W.ShaderChunk.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","uniform float thresholdRatio;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {","",W.ShaderChunk.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",W.ShaderChunk.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
109
- `);var lr=class extends W.ShaderMaterial{constructor(t){super({uniforms:Object.assign({},W.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new W.Color(16777215)},opacity:{value:1},resolution:{value:new W.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new W.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:W.ShaderChunk.meshline_vert,fragmentShader:W.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};lr.prototype.copy=function(r){return W.ShaderMaterial.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 aT={texture_url:Ma,lineWidth:10,color:16777215},Na=class extends lt.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:i}}}}}=this,o=t.map(a=>{let[u,l]=a;return Y(new lt.Vector3(u,l,0),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return zt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new lt.Vector2(t,1)}loadTexture(t){return new Promise((e,n)=>{new lt.TextureLoader().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return j(this,null,function*(){let e=this.geometry=new Wt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=lt.RepeatWrapping}let n=this.material=new lr({useMap:!0,color:new lt.Color(this.config.color),transparent:!0,resolution:new lt.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:lt.NormalBlending,repeat:new lt.Vector2(this.getRepeat(),1)}),i=this.mesh=new lt.Mesh(e,n);return i.renderOrder=9,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=aT,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({},aT,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var kr=A("@tweenjs/tween.js"),ce=A("three");var VB=d(Sa(),1),JB=d(x(),1),LB=d(R(),1),Ga=A("three");var uT=A("@tweenjs/tween.js"),lT=A("lodash");var E9={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},Ua=class extends Ga.EventDispatcher{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)}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,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;if(i){let g=Ce(n,i);u=u.slice(g+1),u.unshift(i)}let l=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:c,closestPoint:h,index:p,i:m}=l.reduce((g,M,P)=>{if(M.floor!==t)return g;let{distance:T,closestPoint:b,index:I}=M.points.reduce((X,D,N,_)=>{if(!_[N+1])return w({},X,{distance:X.distance===1/0?U(D,e):X.distance});let{distance:B,closestPoint:Qr}=G0(e,D,_[N+1]);return B<X.distance?{distance:B,closestPoint:Qr,index:N}:X},{distance:1/0,closestPoint:M.points[0],index:0});return T<g.distance?{distance:T,closestPoint:b,index:P,i:I}:g},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:c,closestPoint:h,routeIndex:p+a,pointIndex:p===0?m+this.pointIndex:m}}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 j(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let i=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),s=o/this.options.simulationSpeed,a=this.throttleUpdatePosition=(0,lT.throttle)(l=>{let c=Jn(i,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new uT.Tween({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 zt(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return zt(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=Re.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===Re.FRONT&&s<=n.length;){let g=n[s],M=n[s+1],P=n[s+2];if(!g||!M)a=Re.END;else if(l+=U(g,M),!P)a=Re.END;else{a=Is(g,M,P),c=wi(g,M,P),h=(new Ga.Vector2(P[0]-M[0],P[1]-M[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=U(i,n[s])),a===Re.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let m=this.getCurRouteToStartDistance();return e===0&&m<=5?{dir:Re.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=Re.FRONT),{dir:a,distance:l,crossName:u,angle:c,nextAngle:h})}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;return e<=10&&(i=Re.END),{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}}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 it,this.resetTimer=null,this.tweenUtil=new tn,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o)},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},E9,e),this.roadData=n,this.registryEvent()}};var qB=d(Hs(),1),$B=d(Fi(),1),t8=d(zi(),1),e8=d(Ui(),1),n8=d(Gi(),1),r8=d(ki(),1),i8=d(Ji(),1),o8=d(Li(),1),s8=d(Bi(),1),a8=d(Qi(),1),u8=d(Hi(),1),l8=d(qi(),1),c8=d($i(),1),h8=d(eo(),1),p8=d(no(),1),f8=d(uc(),1),d8=d(x(),1),le=A("three");var un=class r extends st{addDebug(){r.canvas.style.cssText=`
109
+ `);var lr=class extends W.ShaderMaterial{constructor(t){super({uniforms:Object.assign({},W.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new W.Color(16777215)},opacity:{value:1},resolution:{value:new W.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new W.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:W.ShaderChunk.meshline_vert,fragmentShader:W.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};lr.prototype.copy=function(r){return W.ShaderMaterial.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 aT={texture_url:Ma,lineWidth:10,color:16777215},Na=class extends lt.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:i}}}}}=this,o=t.map(a=>{let[u,l]=a;return Y(new lt.Vector3(u,l,0),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return zt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new lt.Vector2(t,1)}loadTexture(t){return new Promise((e,n)=>{new lt.TextureLoader().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return j(this,null,function*(){let e=this.geometry=new Wt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=lt.RepeatWrapping}let n=this.material=new lr({useMap:!0,color:new lt.Color(this.config.color),transparent:!0,resolution:new lt.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:lt.NormalBlending,repeat:new lt.Vector2(this.getRepeat(),1)}),i=this.mesh=new lt.Mesh(e,n);return i.renderOrder=100009,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=aT,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({},aT,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var kr=A("@tweenjs/tween.js"),ce=A("three");var VB=d(Sa(),1),JB=d(x(),1),LB=d(R(),1),Ga=A("three");var uT=A("@tweenjs/tween.js"),lT=A("lodash");var E9={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},Ua=class extends Ga.EventDispatcher{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)}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,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;if(i){let g=Ce(n,i);u=u.slice(g+1),u.unshift(i)}let l=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:c,closestPoint:h,index:p,i:m}=l.reduce((g,M,P)=>{if(M.floor!==t)return g;let{distance:T,closestPoint:b,index:I}=M.points.reduce((X,D,N,_)=>{if(!_[N+1])return w({},X,{distance:X.distance===1/0?U(D,e):X.distance});let{distance:B,closestPoint:Qr}=G0(e,D,_[N+1]);return B<X.distance?{distance:B,closestPoint:Qr,index:N}:X},{distance:1/0,closestPoint:M.points[0],index:0});return T<g.distance?{distance:T,closestPoint:b,index:P,i:I}:g},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:c,closestPoint:h,routeIndex:p+a,pointIndex:p===0?m+this.pointIndex:m}}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 j(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let i=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),s=o/this.options.simulationSpeed,a=this.throttleUpdatePosition=(0,lT.throttle)(l=>{let c=Jn(i,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new uT.Tween({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 zt(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return zt(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=Re.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===Re.FRONT&&s<=n.length;){let g=n[s],M=n[s+1],P=n[s+2];if(!g||!M)a=Re.END;else if(l+=U(g,M),!P)a=Re.END;else{a=Is(g,M,P),c=wi(g,M,P),h=(new Ga.Vector2(P[0]-M[0],P[1]-M[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=U(i,n[s])),a===Re.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let m=this.getCurRouteToStartDistance();return e===0&&m<=5?{dir:Re.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=Re.FRONT),{dir:a,distance:l,crossName:u,angle:c,nextAngle:h})}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;return e<=10&&(i=Re.END),{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}}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 it,this.resetTimer=null,this.tweenUtil=new tn,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o)},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},E9,e),this.roadData=n,this.registryEvent()}};var qB=d(Hs(),1),$B=d(Fi(),1),t8=d(zi(),1),e8=d(Ui(),1),n8=d(Gi(),1),r8=d(ki(),1),i8=d(Ji(),1),o8=d(Li(),1),s8=d(Bi(),1),a8=d(Qi(),1),u8=d(Hi(),1),l8=d(qi(),1),c8=d($i(),1),h8=d(eo(),1),p8=d(no(),1),f8=d(uc(),1),d8=d(x(),1),le=A("three");var un=class r extends st{addDebug(){r.canvas.style.cssText=`
110
110
  position: fixed;
111
111
  top: 0;
112
112
  left: 0;
@@ -91,7 +91,7 @@ export class Path extends Object3D {
91
91
  });
92
92
  // 生成模型
93
93
  const mesh = this.mesh = new Mesh(lineGeometry, material);
94
- mesh.renderOrder = 9;
94
+ mesh.renderOrder = 100009;
95
95
  this.add(mesh);
96
96
  return mesh;
97
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibee/crc-bmap",
3
- "version": "0.8.64",
3
+ "version": "0.8.65",
4
4
  "description": "",
5
5
  "main": "lib/bmap.min.js",
6
6
  "module": "lib/bmap.esm.js",