@aibee/crc-bmap 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +1 -1
- package/lib/index.esm.min.js +1 -1
- package/lib/index.min.js +1 -1
- package/lib/index.online.esm.min.js +1 -1
- package/lib/index.online.min.js +1 -1
- package/lib/platform/wrapper.cjs +1 -1
- package/lib/platform/wrapper.esm.min.js +1 -1
- package/lib/platform/wrapper.min.js +1 -1
- package/lib/platform/wrapper.online.esm.min.js +1 -1
- package/lib/platform/wrapper.online.min.js +1 -1
- package/lib/src/loader/AibeeLoader/index.d.ts +2 -2
- package/lib/src/loader/AibeeLoader/index.js +5 -5
- package/package.json +3 -3
package/lib/index.cjs
CHANGED
|
@@ -3908,7 +3908,7 @@ void main() {
|
|
|
3908
3908
|
gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
3909
3909
|
}
|
|
3910
3910
|
}
|
|
3911
|
-
`,n=-1/0,i=this.geometry.getAttribute("position");if(i)for(let s=0;s<i.count;s++){let a=i.getZ(s);a>n&&(n=a)}let o=new Wt.ShaderMaterial({uniforms:{maxZ:{value:n},uColor:{value:new Wt.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new Wt.Color(Je(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 Wt.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 Wt.Vector3(u[0],u[1],e)),t.push(new Wt.Vector3(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new Wt.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new Wt.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t,e,n;(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.line)==null||n.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},Ca,n)),this.init()}};var nB=f(Y(),1),rB=f(Os(),1);var wt=require("three");var Vr=require("lodash");var DO={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1},at=class extends wt.Object3D{get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:i,text_texture_offset_y:o}=this.options;return!(0,Vr.isNil)(t)&&!(0,Vr.isNil)(e)&&!(0,Vr.isNil)(n)&&!(0,Vr.isNil)(i)&&!(0,Vr.isNil)(o)}get deltaZ(){return!this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>j(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text_font_size",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&(this.initSize(),this._initScale({zoom:this.context.camera.zoom}))}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return j(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>j(this,null,function*(){let e;if(this.options.icon_border){let{icon:i,icon_size:o,icon_border:s}=this.options;e=yield Tt.getUrlTextureBorder(i,o[0]-s.width*2,s)}else e=yield Tt.getTextureByUrl(this.options.icon);let n=new wt.Sprite(new wt.SpriteMaterial({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));n.visible=!1,n.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(n),this.spriteIcon=n,t(n)})).then(()=>{this._initIconPromise=null})})}initText(){if(this.hasText){let t;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:i,text_texture_height:o,text_texture_offset_x:s,text_texture_offset_y:a}=this.options;t=this.options.text_texture.clone(),t.uuid=n.uuid,t.offset.set(s/t.image.width,1-(o+a)/t.image.height),t.repeat.set(i/t.image.width,o/t.image.height),this.textAspect=i/o}else{let n=ct.getTextureByText(this.options.text);t=n.texture,this.textureLines=n.lines,this.textAspect=t.image.width/t.image.height}let e=new wt.Sprite(new wt.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}}initSize(){var t,e;let n=0,i=0,{icon:o}=this.options;o?this.hasText?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):this.hasText?(i=.5,n=0):(n=0,i=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,i)}init(){return 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 wt.Box2(new wt.Vector2(i-s,o-this.iconHeight),new wt.Vector2(i+s,o)),u=this.textWidth/2,l=new wt.Box2(new wt.Vector2(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new wt.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){var n;super(),this.context=t,this.textAspect=1,this.box=new wt.Box2,this._initIconPromise=null,this.textureLines=1,this._initScale=o=>{let{zoom:s}=o;if(this.spriteText){let u=this.textHeight/s;this.spriteText.scale.set(this.textAspect*u,u,.1)}if(this.spriteIcon){var a;(a=this.spriteIcon)==null||a.scale.set(this.options.icon_size[0]/s,this.options.icon_size[1]/s,.1)}this.resetZ()};var i;this.options=Qn(T({},DO,e,{text:(i=(n=e.text)==null?void 0:n.trim())!=null?i:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var lB=f(Os(),1);var ne=require("three"),k1=require("three/examples/jsm/utils/BufferGeometryUtils.js");var V1={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},Do=class extends ne.Object3D{init(){return j(this,null,function*(){let t=this.options.map(s=>ct.getTextureByText(s.texts[0],{fillStyle:Rs(s.fillColor,s.fillOpacity),strokeStyle:Rs(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"bold 54px sans-serif",maxWidth:2048})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.texture.image,h=l/c,p=u.secondHeight*h,d=new ne.PlaneGeometry(p,u.secondHeight),g=new ne.Matrix4().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new ne.Matrix4().makeRotationZ(u.secondRotate));return d.applyMatrix4(g),d}),n=(0,k1.mergeGeometries)(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let{texture:a}=s,u=new ne.MeshBasicMaterial({map:a,alphaTest:1,side:ne.DoubleSide});return a.needsUpdate=!0,u}),o=new ne.Mesh(n,i);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e,n;(t=this.mesh)==null||t.geometry.dispose(),(n=this.mesh)==null||(e=n.material)==null||e.forEach(i=>i.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},V1,n)).filter(n=>n.texts[0].trim()),this.options.length&&this.init()}};var L1=require("three"),J1=require("three/examples/jsm/lines/Line2.js"),B1=require("three/examples/jsm/lines/LineGeometry.js"),H1=require("three/examples/jsm/lines/LineMaterial.js"),Lr=class extends L1.Object3D{registryEvent(){this.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.context.removeEventListener("resize",this.onResize)}setPosition(t,e){this.lineGeometry.setPositions([t.x,t.y,t.z,e.x,e.y,e.z]),this.line||this.createLine()}createLine(){this.line=new J1.Line2(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&rt(this.line),this.lineGeometry=null,this.lineMaterial=null,this.clear(),(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,n){super(),this.context=t,this.lineGeometry=new B1.LineGeometry,this.lineMaterial=new H1.LineMaterial({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:i,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(i,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};var Q1=require("three"),Na=class extends te{setEnable(t){super.setEnable(t),xt(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=X(this.startPoint,e,n,i),s=X(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 st&&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 d=X(p,i,o,s);return an(d,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=X(u,i,o,s),h=X(l,i,o,s);return!(!an(c,e,n)||!an(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new Q1.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);xt(this.rect,s.x,s.y,a,u)}else xt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=un(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var Co=class extends q1.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))}}),($n?e.metaKey:e.ctrlKey)||this._list.clear(),a.forEach(c=>this._list.add(c)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{tr(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{tr(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(i=>{this._list.add(i)}),this.selectEnd()},this.boxSelection=new Na(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var YB=f(Fe(),1),DB=f(Ke(),1),CB=f(Ne(),1),XB=f(ze(),1),ZB=f(Ue(),1),OB=f(Ge(),1),RB=f(ke(),1),FB=f(Y(),1);var za=require("three");var Xo=class extends za.EventDispatcher{handleHoverGraphicsChange(t){t===void 0&&(t=this.curGraphics),this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new J,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics: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 d=i.find(g=>g.options.id===p.options.id);if(d instanceof Fn){let{x:g,y}=d.clientPos,M=Math.sqrt((g-o.offsetX)**2+(y-o.offsetY)**2);M<h&&(h=M,c=p)}else if(d instanceof at){let{x:g,y}=d.box.getCenter(new za.Vector2),M=Math.sqrt((g-o.offsetX)**2+(y-o.offsetY)**2);M<h&&(h=M,c=p)}}),u.add(c)}u.size||n.forEach(c=>u.add(c)),u.forEach(c=>{if(this.graphicTimerMap.get(c)||this.curGraphics.has(c))return;let h=this.timer.setTimeout(()=>{this.curGraphics.add(c),this.graphicTimerMap.delete(c),this.timer.clearTimeout(h),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(c,h)}),this.graphicTimerMap.forEach((c,h)=>{u.has(h)||(this.timer.clearTimeout(c),this.graphicTimerMap.delete(h))});let l=this.curGraphics.size;this.curGraphics.forEach(c=>{u.has(c)||this.curGraphics.delete(c)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()},this.onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()},this.onBodyPointerMove=e=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)&&this.onPointerLevel()}},this.registryEvent()}};var UB=f(Y(),1),re=require("three");var Zo=require("@turf/turf"),Ua=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(g=>g instanceof $t).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,l=[new re.Vector3(s.x,s.y,s.z),new re.Vector3(a.x,s.y,s.z),new re.Vector3(s.x,a.y,s.z),new re.Vector3(a.x,a.y,s.z),new re.Vector3(s.x,s.y,a.z),new re.Vector3(a.x,s.y,a.z),new re.Vector3(s.x,a.y,a.z),new re.Vector3(a.x,a.y,a.z)].map(g=>X(g,n,i,o)),c=Math.min(...l.map(g=>g.x)),h=Math.max(...l.map(g=>g.x)),p=Math.min(...l.map(g=>g.y)),d=Math.max(...l.map(g=>g.y));return{left:c,right:h,top:p,bottom:d}}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=(0,Zo.polygon)([[[e,i],[n,i],[n,o],[e,o],[e,i]]]),d=(0,Zo.polygon)([[[h,u],[s-l,u],[s-l,a-c],[h,a-c],[h,u]]]);try{return(0,Zo.intersect)(p,d)!==null}catch(g){return console.warn("\u8BA1\u7B97\u4EA4\u96C6\u51FA\u9519:",g),!1}}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new re.Vector3,zoom:1,target:new re.Vector3},this.enable=!0,this.box=new re.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 n7=f(Mh(),1),Ph=require("three"),dr=require("@tweenjs/tween.js");var $B=f(Y(),1),t7=f(N(),1),x=require("three"),ka=new x.Ray,pT=new x.Plane,HO=Math.cos(70*x.MathUtils.DEG2RAD),Va=class extends x.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 x.Vector2,this.rotateLineEnd=new x.Vector2,this.spherical=new x.Spherical,this.sphericalDelta=new x.Spherical,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new x.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:x.MOUSE.PAN,MIDDLE:x.MOUSE.DOLLY,RIGHT:x.MOUSE.ROTATE},this.touches={ONE:x.TOUCH.PAN,TWO:x.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(P){P.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=P},this.stopListenToKeyEvents=function(){var P;(P=this._domElementKeyEvents)==null||P.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent({type:"change"}),n.update(),o=i.NONE},this.update=function(){let P=new x.Vector3,b=new x.Quaternion().setFromUnitVectors(t.up,new x.Vector3(0,1,0)),L=b.clone().invert(),nt=new x.Vector3,Lt=new x.Quaternion,Ze=new x.Vector3,ve=2*Math.PI;return function(ii){ii===void 0&&(ii=null);let tn=n.object.position;P.copy(tn).sub(n.target),P.applyQuaternion(b),a.setFromVector3(P),n.autoRotate&&o===i.NONE&&R(z(ii)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let en=n.minAzimuthAngle,nn=n.maxAzimuthAngle;isFinite(en)&&isFinite(nn)&&(en<-Math.PI?en+=ve:en>Math.PI&&(en-=ve),nn<-Math.PI?nn+=ve:nn>Math.PI&&(nn-=ve),en<=nn?a.theta=Math.max(en,Math.min(nn,a.theta)):a.theta=a.theta>(en+nn)/2?Math.max(en,a.theta):Math.min(nn,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&&W||n.object.isOrthographicCamera?a.radius=Vt(a.radius):a.radius=Vt(a.radius*l),P.setFromSpherical(a),P.applyQuaternion(L),tn.copy(n.target).add(P),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),c.set(0,0,0));let Lo=!1;if(n.zoomToCursor&&W){let oi=null;if(n.object.isPerspectiveCamera){let si=P.length();oi=Vt(si*l);let Jo=si-oi;n.object.position.addScaledVector(D,Jo),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let si=new x.Vector3(w.x,w.y,0);si.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Lo=!0;let Jo=new x.Vector3(w.x,w.y,0);Jo.unproject(n.object),n.object.position.sub(Jo).add(si),n.object.updateMatrixWorld(),oi=P.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;oi!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(oi).add(n.object.position):(ka.origin.copy(n.object.position),ka.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(ka.direction))<HO?t.lookAt(n.target):(pT.setFromNormalAndCoplanarPoint(n.object.up,n.target),ka.intersectPlane(pT,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Lo=!0);return l=1,W=!1,Lo||nt.distanceToSquared(n.object.position)>s||8*(1-Lt.dot(n.object.quaternion))>s||Ze.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),nt.copy(n.object.position),Lt.copy(n.object.quaternion),Ze.copy(n.target),Lo=!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 x.Spherical,u=new x.Spherical,l=1,c=new x.Vector3,h=new x.Vector2,p=new x.Vector2,d=new x.Vector2,g=new x.Vector2,y=new x.Vector2,M=new x.Vector2,A=new x.Vector2,S=new x.Vector2,_=new x.Vector2,D=new x.Vector3,w=new x.Vector2,W=!1,v=[],I={};function z(P){return P!==null?2*Math.PI/60*n.autoRotateSpeed*P:2*Math.PI/60/60*n.autoRotateSpeed}function Z(){return Math.pow(.95,n.zoomSpeed)}function R(P){u.theta-=P}function pt(P){u.phi-=P}let mt=function(){let P=new x.Vector3;return function(L,nt){P.setFromMatrixColumn(nt,0),P.multiplyScalar(-L),c.add(P)}}(),kt=function(){let P=new x.Vector3;return function(L,nt){n.screenSpacePanning===!0?P.setFromMatrixColumn(nt,1):(P.setFromMatrixColumn(nt,0),P.crossVectors(n.object.up,P)),P.multiplyScalar(L),c.add(P)}}(),oe=function(){let P=new x.Vector3;return function(L,nt){let Lt=n.domElement;if(n.object.isPerspectiveCamera){let Ze=n.object.position;P.copy(Ze).sub(n.target);let ve=P.length();ve*=Math.tan(n.object.fov/2*Math.PI/180),mt(2*L*ve/Lt.clientHeight,n.object.matrix),kt(2*nt*ve/Lt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(mt(L*(n.object.right-n.object.left)/n.object.zoom/Lt.clientWidth,n.object.matrix),kt(nt*(n.object.top-n.object.bottom)/n.object.zoom/Lt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function gr(P){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ni(P){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ri(P){if(!n.zoomToCursor)return;W=!0;let b=n.domElement.getBoundingClientRect(),L=P.clientX-b.left,nt=P.clientY-b.top,Lt=b.width,Ze=b.height;w.x=L/Lt*2-1,w.y=-(nt/Ze)*2+1,D.set(w.x,w.y,1).unproject(n.object).sub(n.object.position).normalize()}function Vt(P){return Math.max(n.minDistance,Math.min(n.maxDistance,P))}function Gh(P){h.set(P.clientX,P.clientY)}function zT(P){ri(P),A.set(P.clientX,P.clientY)}function kh(P){g.set(P.clientX,P.clientY)}function UT(P){p.set(P.clientX,P.clientY),d.subVectors(p,h).multiplyScalar(n.rotateSpeed);let b=n.domElement;R(2*Math.PI*d.x/b.clientHeight),pt(2*Math.PI*d.y/b.clientHeight),h.copy(p),n.update()}function GT(P){S.set(P.clientX,P.clientY),_.subVectors(S,A),_.y>0?gr(Z()):_.y<0&&ni(Z()),A.copy(S),n.update()}function kT(P){y.set(P.clientX,P.clientY),M.subVectors(y,g).multiplyScalar(n.panSpeed),oe(M.x,M.y),g.copy(y),n.update()}function VT(P){ri(P),P.deltaY<0?ni(Z()):P.deltaY>0&&gr(Z()),n.update()}function LT(P){let b=!1;switch(P.code){case n.keys.UP:P.ctrlKey||P.metaKey||P.shiftKey?pt(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):oe(0,n.keyPanSpeed),b=!0;break;case n.keys.BOTTOM:P.ctrlKey||P.metaKey||P.shiftKey?pt(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):oe(0,-n.keyPanSpeed),b=!0;break;case n.keys.LEFT:P.ctrlKey||P.metaKey||P.shiftKey?R(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):oe(n.keyPanSpeed,0),b=!0;break;case n.keys.RIGHT:P.ctrlKey||P.metaKey||P.shiftKey?R(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):oe(-n.keyPanSpeed,0),b=!0;break}b&&(P.preventDefault(),n.update())}function Vh(){if(v.length===1)h.set(v[0].pageX,v[0].pageY);else{let P=(v[0].pageX-v[0].pageY)/(v[1].pageX-v[1].pageY),b=v[0].pageY-P*v[0].pageX;n.rotateLineStart.set(P,b);let L=.5*(v[0].pageX+v[1].pageX),nt=.5*(v[0].pageY+v[1].pageY);h.set(L,nt)}}function Lh(){if(v.length===1)g.set(v[0].pageX,v[0].pageY);else{let P=.5*(v[0].pageX+v[1].pageX),b=.5*(v[0].pageY+v[1].pageY);g.set(P,b)}}function Jh(){let P=v[0].pageX-v[1].pageX,b=v[0].pageY-v[1].pageY,L=Math.sqrt(P*P+b*b);A.set(0,L)}function JT(){n.enableZoom&&Jh(),n.enablePan&&Lh()}function BT(){n.enableZoom&&Jh(),n.enableRotate&&Vh()}function Bh(P){if(v.length==1)p.set(P.pageX,P.pageY);else{let L=du(P),nt=.5*(P.pageX+L.x),Lt=.5*(P.pageY+L.y);p.set(nt,Lt);let Ze=(P.pageY-L.y)/(P.pageX-L.x),ve=L.y-Ze*L.x;if(n.rotateLineEnd.set(Ze,ve),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let mu=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),ii=Ze*mu+ve;if(Number.isFinite(mu)&&Number.isFinite(ii)){let tn=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(tn)<.5&&(tn=-Math.sign(tn)*(Math.PI-Math.abs(tn))),Math.abs(tn)<.1&&(u.theta+=tn)}}n.rotateLineStart.copy(n.rotateLineEnd)}d.subVectors(p,h).multiplyScalar(n.rotateSpeed);let b=n.domElement;pt(2*Math.PI*d.y/b.clientHeight),h.copy(p)}function Hh(P){if(v.length===1)y.set(P.pageX,P.pageY);else{let b=du(P),L=.5*(P.pageX+b.x),nt=.5*(P.pageY+b.y);y.set(L,nt)}M.subVectors(y,g).multiplyScalar(n.panSpeed),oe(M.x,M.y),g.copy(y)}function Qh(P){let b=du(P),L=P.pageX-b.x,nt=P.pageY-b.y,Lt=Math.sqrt(L*L+nt*nt);S.set(0,Lt),_.set(0,Math.pow(S.y/A.y,n.zoomSpeed)),gr(_.y),A.copy(S)}function HT(P){n.enableZoom&&Qh(P),n.enablePan&&Hh(P)}function QT(P){n.enableZoom&&Qh(P),n.enableRotate&&Bh(P)}this.onPointerDown=function(b){n.enabled!==!1&&(v.length===0&&(n.domElement.setPointerCapture(b.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),nv(b),b.pointerType==="touch"?tv(b):qT(b))},this.onPointerMove=function(b){n.enabled!==!1&&(b.pointerType==="touch"?ev(b):$T(b))},this.onPointerUp=function(b){rv(b),v.length===0&&(n.domElement.releasePointerCapture(b.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=i.NONE};function qT(P){let b;switch(P.button){case 0:b=n.mouseButtons.LEFT;break;case 1:b=n.mouseButtons.MIDDLE;break;case 2:b=n.mouseButtons.RIGHT;break;default:b=-1}switch(b){case x.MOUSE.DOLLY:if(n.enableZoom===!1)return;zT(P),o=i.DOLLY;break;case x.MOUSE.ROTATE:if(P.ctrlKey||P.metaKey||P.shiftKey){if(n.enablePan===!1)return;kh(P),o=i.PAN}else{if(n.enableRotate===!1)return;Gh(P),o=i.ROTATE}break;case x.MOUSE.PAN:if(P.ctrlKey||P.metaKey||P.shiftKey){if(n.enableRotate===!1)return;Gh(P),o=i.ROTATE}else{if(n.enablePan===!1)return;kh(P),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function $T(P){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;UT(P);break;case i.DOLLY:if(n.enableZoom===!1)return;GT(P);break;case i.PAN:if(n.enablePan===!1)return;kT(P);break}}this.onMouseWheel=function(b){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(b.preventDefault(),n.dispatchEvent({type:"start"}),VT(b),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(b){n.enabled===!1||n.enablePan===!1||LT(b)};function tv(P){switch(qh(P),v.length){case 1:switch(n.touches.ONE){case x.TOUCH.ROTATE:if(n.enableRotate===!1)return;Vh(),o=i.TOUCH_ROTATE;break;case x.TOUCH.PAN:if(n.enablePan===!1)return;Lh(),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case x.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;JT(),o=i.TOUCH_DOLLY_PAN;break;case x.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;BT(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function ev(P){switch(qh(P),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;Bh(P),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;Hh(P),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;HT(P),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;QT(P),n.update();break;default:o=i.NONE}}this.onContextMenu=function(b){n.enabled!==!1&&b.preventDefault()};function nv(P){v.push(P)}function rv(P){delete I[P.pointerId];for(let b=0;b<v.length;b++)if(v[b].pointerId==P.pointerId){v.splice(b,1);return}}function qh(P){let b=I[P.pointerId];b===void 0&&(b=new x.Vector2,I[P.pointerId]=b),b.set(P.pageX,P.pageY)}function du(P){let b=P.pointerId===v[0].pointerId?v[1]:v[0];return I[b.pointerId]}n.domElement.addEventListener("contextmenu",this.onContextMenu),n.domElement.addEventListener("pointerdown",this.onPointerDown),n.domElement.addEventListener("pointercancel",this.onPointerUp),n.domElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),this.update()}};var La=class extends Va{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):Qt(new Promise(i=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new dr.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):Qt(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new dr.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 Ph.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 Qt(new Promise(o=>{let s=new dr.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?Qt(new Promise(s=>{let a=new dr.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()),this.camera.updateMatrix(),t){let n=new Ph.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 dr.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 Jr=require("three");var Ja=class extends Jr.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(),this.domElement=null}constructor(t){super(T({antialias:!0,alpha:!0},t)),this.event=new Jr.EventDispatcher,this.enable=!0,this.timer=new J,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=Jr.PCFSoftShadowMap}};var zn=require("three"),fT=require("three/examples/jsm/loaders/RGBELoader.js");var Ba=class extends zn.Scene{constructor(){super(),new fT.RGBELoader().load(I1,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 dT=require("three"),Ha=class extends dT.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 Oo=class extends V.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 Ha(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new La(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 Ua(this)}getRatio(t,e){t===void 0&&(t=new V.Vector3(0,0,0)),e===void 0&&(e=new V.Vector3(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=X(t,this.camera,n,i),s=X(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 V.AmbientLight&&(e.color=new V.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 V.Vector2;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new V.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 V.Box3().setFromObject(t);this.setPolarAngle(h,0);let{max:d,min:g}=p,y=new V.Vector3(g.x,d.y,d.z),M=new V.Vector3(d.x,d.y,d.z),A=new V.Vector3(d.x,g.y,g.z),S=new V.Vector3(g.x,g.y,g.z),_=X(y,this.camera,l,c),D=X(M,this.camera,l,c),w=X(S,this.camera,l,c),W=X(A,this.camera,l,c),I=new V.Box2().setFromPoints([new V.Vector2(_.x,_.y),new V.Vector2(D.x,D.y),new V.Vector2(w.x,w.y),new V.Vector2(W.x,W.y)]).getSize(new V.Vector2),z=(l-s-u)/I.x,Z=(c-o-a)/I.y,R=Math.min(z,Z),pt=new V.Vector3((d.x+g.x)/2,(d.y+g.y)/2,(d.z+g.z)/2),mt=R*this.camera.zoom,kt=this.camera.clone();kt.zoom=mt,kt.updateMatrix();let oe=(l-I.x*R)/2,gr=(c-I.y*R)/2,ni=(s-u)/2,ri=(o-a)/2;if(ni){let Vt=new V.Vector3;Vt.setFromMatrixColumn(kt.matrix,0),Vt.normalize(),Vt.multiplyScalar(ni/mt),pt.add(Vt)}if(ri){let Vt=new V.Vector3;Vt.setFromMatrixColumn(kt.matrix,1),Vt.normalize(),Vt.multiplyScalar(ri/mt),pt.add(Vt)}return{zoom:R*this.camera.zoom,center:pt}}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()),rt(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new Ba,this.renderer=new Ja,this.lights=j0(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,this.basicZoom=1,this.onControlChange=()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})},this.onControlChangeZoom=n=>{let{zoom:i}=n;this.dispatchEvent({type:"control-zoom-change",zoom:i})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:i,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),i.left=-s/2,i.right=s/2,i.top=a/2,i.bottom=-a/2,i.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);i.length&&this.dispatchEvent({type:"graphic-click",graphics:i,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:i,pois:s,position:o})},this.onPointermove=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:i,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:i,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:i,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:i}=n;this.dispatchEvent({type:"hover",graphics:i})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new Co(this),this.hoverHelper=new Xo(this),this.resizeClientSize(),this.registryEvent()}};var mT=require("lodash"),gT={placeId:0,apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get",loadPlaceInfo:"https://screen.aibee.cn/ai-map/map/get-floor-map"},enableBoxSelect:!0,resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1},loaderPlaceConfig:{textFontSize:14}};function Ah(r){return(0,mT.merge)({},gT,r)}var bT=require("lodash");var O7=f(Y(),1);var Xe;function yT(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(Xe)return e({db:Xe,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){Xe=o.target.result,console.log("onupgradeneeded"),e({db:Xe,type:"onupgradeneeded"})},i.onsuccess=o=>{Xe=o.target.result,e({db:Xe,type:"success"})},i.onerror=o=>{n(o)}})}function jh(r,t,e){return e===void 0&&(e=Xe),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 MT(r,t,e,n){return n===void 0&&(n=Xe),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>j(this,null,function*(){let u=yield jh(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 mr(r,t){t===void 0&&(t=Xe),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function PT(r){r===void 0&&(r=Xe),r==null||r.close(),Xe=null}var tu=require("three");var W7=f(N(),1),I7=f(Y(),1);function Qa(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 qa(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 AT(r,t,e){switch(r.l_type){case"graph":return QO(r,t);case"wall":return qO(r,t);case"lane":return $O(r,t);case"texture2d":case"texture3d":return tR(r,t);case"glb":return eR(r,t);case"store":return nR(r,t);case"facility":return iR(r,t);case"parkingSpace":return sR(r,t,e);case"text":return uR(r,t)}}function jT(r,t,e,n){switch(r.l_type){case"store":return rR(r,t,e,n);case"facility":return oR(r,t,e,n);case"parkingSpace":return aR(r,t,n)}}function QO(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=i,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(i):n[h]=[i],n},{});Object.values(e).forEach(n=>{let i=new fr(t.context,n);t.mergeGraphicLayer.add(i)})}function qO(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l}=i,c=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l;return u===0&&(c=o.toLowerCase()+"-"+s+"-"+l),n[c]?n[c].push(i):n[c]=[i],n},{});Object.values(e).forEach(n=>{let i=new Io(t.context,n);t.wallLayer.add(i)})}function $O(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u}=i,l=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u;return u===0&&(l=o.toLowerCase()+"-"+s),n[l]?n[l].push(i):n[l]=[i],n},{});Object.values(e).forEach(n=>{let i=new Yo(t.context,n);t.laneLayer.add(i)})}function tR(r,t){if(r.elements.length){let e=new pr(t.context,r.elements);t.textureLayer.add(e)}}function eR(r,t){r.elements.forEach(e=>{let n=new Eo(t.context,T({},e,{url:e.secondUrl,rotate:e.secondRotate,width:e.secondWidth,center_x:e.center_coord_x,center_y:e.center_coord_y}));t.glbModelLayer.add(n)})}function nR(r,t){r.elements.map(e=>{let n=t.addGraphic(T({},e,{dashed:!1}));t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function rR(r,t,e,n){r.elements.map(i=>{try{let o=Qa(i,e),s=new at(t.context,{id:i.id,icon:i.poi_info.showImageUrl||i.poi_info.icon,text:o,position:{x:i.center_coord_x,y:i.center_coord_y,z:i.airHeight+i.height},icon_size:[24,24],level:i.poi_info.level||0,hide_text:!n.showStoreName,maxWeight:i.poi_info.maxWeight||25,minWeight:i.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(s),s&&(s.userData.type="store",s.userData.data=i,s.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,i)}})}function iR(r,t){r.elements.map(e=>{let n=t.addGraphic(T({},e,{dashed:!1}));t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function oR(r,t,e,n){r.elements.filter(o=>o.poi_info).map(o=>{try{let s=qa(o,e),a=new at(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:s,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},icon_size:[24,24],level:o.poi_info.level||0,hide_text:!n.showFacilityName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(a),a.userData.type="facility",a.userData.data=o,a.userData.floor=t.name}catch(s){console.log("\u6DFB\u52A0facility\u5931\u8D25",s,o)}})}function sR(r,t,e){t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function aR(r,t,e){return j(this,null,function*(){let n=r.elements.filter(s=>s.texts[0]),i=n.map(s=>s.texts[0]),o=yield ct.lazyGetTextureByTexts(i,{height:64});n.forEach(s=>{try{let a=s.texts[0],u=new at(t.context,{id:s.id,text:a,position:{x:s.center_coord_x,y:s.center_coord_y,z:s.airHeight+s.height},text_texture:o[a].texture,text_texture_width:o[a].width,text_texture_height:o[a].height,text_texture_offset_x:o[a].x,text_texture_offset_y:o[a].y,text_font_size:e.textFontSize});u&&(u.userData.type="parkingSpace",u.userData.data=s,u.userData.floor=t.name),t.poiLayer2.pushPoi(u)}catch(a){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",a,s)}}),Object.values(o).forEach(s=>{s.texture.dispose()})})}function uR(r,t){let e=new Do(t.context,r.elements.map(n=>T({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var TT="map_version",vT="route_version",ST="facility_version",Th="map_data",$a="road_network_data",vh="facility_data",lR={mergeParkingSpace:!0},Ro=class extends At{initDb(){return j(this,null,function*(){try{let{db:t,type:e}=yield yT("aibee_map",2);e==="onupgradeneeded"&&(mr(TT),mr(vT),mr(ST),mr(Th),mr($a),mr(vh)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return j(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=T({},this.placeConfig,e));else{let n=yield fetch(t).then(i=>i.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=T({},this.placeConfig,JSON.parse(n.data.config||"{}")))}this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return this.initDbPromise.then(()=>MT(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>jh(t,""+e,this.db))}getFloorCacheKey(t){return t.floor_id+"_"+t.version_id}getFloorData(t){return j(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return j(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=Qa(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=qa(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return j(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>j(this,null,function*(){let i=this.getFloorCacheKey(t),o=yield fetch(t.map_url).then(s=>s.json());o.floor=t.floor,this.setCacheData(Th,i,o),this.setCacheData(TT,i,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return j(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{let i=yield this.getCacheData(Th,n);return i||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{let i=yield this.getCacheData($a,n);if(i)return i;let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData($a,n,o),this.setCacheData(vT,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData($a,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(vh,e,i),this.setCacheData(ST,e,t.version_id)),i});try{let i=yield this.getCacheData(vh,e);return i||n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return j(this,null,function*(){for(let t=0;t<this.floors.length;t++){let e=this.floors[t];this.getFloorJsonData(e.floor)}})}getMulFloorsData(t){return j(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return j(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return j(this,null,function*(){return e=this.getFloorBaseLayer(t,e),n=T({},this.placeConfig,n),t.layers.forEach(i=>{["range","ground"].includes(i.l_type)||ir(i.elements,e.userData.center)}),yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,n),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new tu.Vector3),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return j(this,null,function*(){return new Promise(n=>{let i={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(i),s=a=>{let{task:u,res:l}=a;u.tid===o&&(this.taskQueue.removeEventListener("active-task-end",s),n(l))};this.taskQueue.addEventListener("active-task-end",s)})})}_switchFloor(t,e){return j(this,null,function*(){var n;let i=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)i=l;else return null}e=T({},this.placeConfig,e);let o=new $t(this.bmap.context);o.userData.data=t;let s=this.floors.find(l=>l.floor===i.floor);var a;let u=(a=s==null?void 0:s.map_angle)!=null?a:0;return this.bmap.dispatchEvent({type:Mt.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:i}}),this.bmap.context.scene.background=new tu.Color(e.backgroundColor),this.getFloorBaseLayer(i,o),this.changeFloorBox(i,o),this.bmap.buildingCenter=o.userData.center,this.bmap.currentBuildGround=(n=o.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(o),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(u/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),i.layers.forEach(l=>{["range","ground"].includes(l.l_type)||ir(l.elements,o.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:Mt.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield Ei(),yield this.getFloorContentLayer(i,o),this.changeFloorBox(i,o),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield O0(2),yield this.getFloorPoi(i,o,e),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:Mt.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new $t(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":ir(i.elements,n);let s=i.elements.map(a=>new st(this.bmap.context,T({},a,{dashed:!1})));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return j(this,null,function*(){e||(e=new $t(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)||(AT(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Ei(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return j(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(s=>jT(s,e,this.locale,n))),console.log("poi time",Date.now()-i);let o=Date.now();Ei().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return j(this,null,function*(){var t;PT((t=this.db)!=null?t:void 0)})}dispose(){super.dispose(),this.clear(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new or,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=T({},lR,e),this.placeConfig=T({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var J7=f(Y(),1);function Sh(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 bh(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(d=>d.info=JSON.parse(d.info)),p||[]))})}function cR(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?hR(u.fileId,t):null)})}function hR(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 wh=class{load(t){return j(this,null,function*(){let e=er(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),bh(t,this.bmap.config)]),i=er({floor:t.floor,ts:t.ts});ir(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=er({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=Sh({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 $t(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 pR=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),_h=class extends Br.EventDispatcher{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?_i(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 Ro(this),this.loader.placeConfig=T({},this.loader.placeConfig,this.config.loaderPlaceConfig),yield this.loader.load(this.config.apiPath.loadPlaceInfo+"?place_id="+this.config.placeId+"&env=prod")),this.loader.switchFloor(t)})}switchFloorByFloor(t,e){e===void 0&&(e=t.graphicLayer.children),this.triggerHooks(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 st))||[]}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,n,i){e===void 0&&(e=500),n===void 0&&(n=0),i===void 0&&(i=0);let o=t.getPosition().clone(),{context:{camera:s}}=this;if(s.updateMatrix(),i){let a=new Br.Vector3;a.setFromMatrixColumn(s.matrix,1),a.normalize(),a.multiplyScalar(i/s.zoom),o.add(a)}if(n){let a=new Br.Vector3;a.setFromMatrixColumn(s.matrix,0),a.normalize(),a.multiplyScalar(n/s.zoom),o.add(a)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return j(this,null,function*(){return e===void 0&&(e=500),Qt(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=X(o,u,s,a).x-s/2,h=new Br.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 X(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 xo(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 Wo(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=_i(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,ct.dispose(),Tt.dispose(),Wn.dispose(),Kt.dispose(),B.dispose(),Ce.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new J,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:n}}=this.context;n!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=n)},this.onKeydown=n=>{this.polarKeys.includes(n.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(n.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=n=>{if(this.polarKeys.includes(n.code)){let i=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=i,this.context.control.minPolarAngle=i}if(this.azimuthalKeys.includes(n.code)){let i=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=i,this.context.control.minAzimuthAngle=i}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),i=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let o=this.context.getFitCameraToGroundZoom(this.config.defaultPadding,0)||1;this.context.camera.zoom=i,this.context.control.minZoom=o,this.context.control.maxZoom=o*30,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=Ah(e),this.context=new Oo(t,this.config),this.debounceResize=(0,bT.debounce)(this.resize,5),this.registryEvent()}};var d8=f(Y(),1);var wT=require("three"),zt=class extends wT.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 xh=class extends zt{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 yH=f(Yi(),1),MH=f(ce(),1),PH=f(Y(),1),AH=f(Mh(),1);var O8=f(Y(),1),R8=f(N(),1),ft=require("three");var P8=f(jc(),1),A8=f(Li(),1),j8=f(Ji(),1),T8=f(Hi(),1),v8=f(Qi(),1),S8=f(qi(),1),b8=f(to(),1),w8=f(eo(),1),_8=f(no(),1),x8=f(ro(),1),W8=f(io(),1),I8=f(oo(),1),E8=f(so(),1),Y8=f(uo(),1),D8=f(lo(),1),C8=f(N(),1),X8=f(ch(),1),E=require("three"),ie=class extends E.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 E.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)}}})}};ie.prototype.setMatrixWorld=function(r){this.matrixWorld=r};ie.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};ie.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 E.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 fR(r,t){var e=new E.Matrix4,n=new E.Ray,i=new E.Sphere,o=new E.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 E.Vector3,u=new E.Vector3,l=new E.Vector3,c=this instanceof E.LineSegments?2:1,h=s.index,p=s.attributes;if(h!==null)for(var d=h.array,g=p.position.array,y=p.width.array,M=0,A=d.length-1;M<A;M+=c){var S=d[M],_=d[M+1];a.fromArray(g,S*3),u.fromArray(g,_*3);var D=y[Math.floor(M/3)]!==void 0?y[Math.floor(M/3)]:1,w=r.params.Line.threshold+this.material.lineWidth*D/2,W=w*w,v=n.distanceSqToSegment(a,u,o,l);if(!(v>W)){o.applyMatrix4(this.matrixWorld);var I=r.ray.origin.distanceTo(o);I<r.near||I>r.far||(t.push({distance:I,point:l.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this}),M=A)}}}}ie.prototype.raycast=fR;ie.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]};ie.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};ie.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new E.Vector3(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new E.Vector3(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=i.distanceTo(o);t+=s}return t};ie.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 E.BufferAttribute(new Float32Array(this.positions),3),previous:new E.BufferAttribute(new Float32Array(this.previous),3),next:new E.BufferAttribute(new Float32Array(this.next),3),side:new E.BufferAttribute(new Float32Array(this.side),1),width:new E.BufferAttribute(new Float32Array(this.width),1),uv:new E.BufferAttribute(new Float32Array(this.uvs),2),index:new E.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new E.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 Wh(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}ie.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;Wh(t,0,e,0,i),Wh(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,Wh(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};E.ShaderChunk.meshline_vert=["",E.ShaderChunk.logdepthbuf_pars_vertex,E.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;","",E.ShaderChunk.logdepthbuf_vertex,E.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",E.ShaderChunk.fog_vertex,"}"].join(`
|
|
3911
|
+
`,n=-1/0,i=this.geometry.getAttribute("position");if(i)for(let s=0;s<i.count;s++){let a=i.getZ(s);a>n&&(n=a)}let o=new Wt.ShaderMaterial({uniforms:{maxZ:{value:n},uColor:{value:new Wt.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new Wt.Color(Je(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 Wt.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 Wt.Vector3(u[0],u[1],e)),t.push(new Wt.Vector3(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new Wt.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new Wt.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t,e,n;(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.line)==null||n.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},Ca,n)),this.init()}};var nB=f(Y(),1),rB=f(Os(),1);var wt=require("three");var Vr=require("lodash");var DO={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1},at=class extends wt.Object3D{get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:i,text_texture_offset_y:o}=this.options;return!(0,Vr.isNil)(t)&&!(0,Vr.isNil)(e)&&!(0,Vr.isNil)(n)&&!(0,Vr.isNil)(i)&&!(0,Vr.isNil)(o)}get deltaZ(){return!this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>j(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text_font_size",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&(this.initSize(),this._initScale({zoom:this.context.camera.zoom}))}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return j(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>j(this,null,function*(){let e;if(this.options.icon_border){let{icon:i,icon_size:o,icon_border:s}=this.options;e=yield Tt.getUrlTextureBorder(i,o[0]-s.width*2,s)}else e=yield Tt.getTextureByUrl(this.options.icon);let n=new wt.Sprite(new wt.SpriteMaterial({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));n.visible=!1,n.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(n),this.spriteIcon=n,t(n)})).then(()=>{this._initIconPromise=null})})}initText(){if(this.hasText){let t;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:i,text_texture_height:o,text_texture_offset_x:s,text_texture_offset_y:a}=this.options;t=this.options.text_texture.clone(),t.uuid=n.uuid,t.offset.set(s/t.image.width,1-(o+a)/t.image.height),t.repeat.set(i/t.image.width,o/t.image.height),this.textAspect=i/o}else{let n=ct.getTextureByText(this.options.text);t=n.texture,this.textureLines=n.lines,this.textAspect=t.image.width/t.image.height}let e=new wt.Sprite(new wt.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}}initSize(){var t,e;let n=0,i=0,{icon:o}=this.options;o?this.hasText?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):this.hasText?(i=.5,n=0):(n=0,i=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,i)}init(){return 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 wt.Box2(new wt.Vector2(i-s,o-this.iconHeight),new wt.Vector2(i+s,o)),u=this.textWidth/2,l=new wt.Box2(new wt.Vector2(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new wt.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){var n;super(),this.context=t,this.textAspect=1,this.box=new wt.Box2,this._initIconPromise=null,this.textureLines=1,this._initScale=o=>{let{zoom:s}=o;if(this.spriteText){let u=this.textHeight/s;this.spriteText.scale.set(this.textAspect*u,u,.1)}if(this.spriteIcon){var a;(a=this.spriteIcon)==null||a.scale.set(this.options.icon_size[0]/s,this.options.icon_size[1]/s,.1)}this.resetZ()};var i;this.options=Qn(T({},DO,e,{text:(i=(n=e.text)==null?void 0:n.trim())!=null?i:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var lB=f(Os(),1);var ne=require("three"),k1=require("three/examples/jsm/utils/BufferGeometryUtils.js");var V1={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},Do=class extends ne.Object3D{init(){return j(this,null,function*(){let t=this.options.map(s=>ct.getTextureByText(s.texts[0],{fillStyle:Rs(s.fillColor,s.fillOpacity),strokeStyle:Rs(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"bold 54px sans-serif",maxWidth:2048})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.texture.image,h=l/c,p=u.secondHeight*h,d=new ne.PlaneGeometry(p,u.secondHeight),g=new ne.Matrix4().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new ne.Matrix4().makeRotationZ(u.secondRotate));return d.applyMatrix4(g),d}),n=(0,k1.mergeGeometries)(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let{texture:a}=s,u=new ne.MeshBasicMaterial({map:a,alphaTest:1,side:ne.DoubleSide});return a.needsUpdate=!0,u}),o=new ne.Mesh(n,i);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e,n;(t=this.mesh)==null||t.geometry.dispose(),(n=this.mesh)==null||(e=n.material)==null||e.forEach(i=>i.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},V1,n)).filter(n=>n.texts[0].trim()),this.options.length&&this.init()}};var L1=require("three"),J1=require("three/examples/jsm/lines/Line2.js"),B1=require("three/examples/jsm/lines/LineGeometry.js"),H1=require("three/examples/jsm/lines/LineMaterial.js"),Lr=class extends L1.Object3D{registryEvent(){this.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.context.removeEventListener("resize",this.onResize)}setPosition(t,e){this.lineGeometry.setPositions([t.x,t.y,t.z,e.x,e.y,e.z]),this.line||this.createLine()}createLine(){this.line=new J1.Line2(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&rt(this.line),this.lineGeometry=null,this.lineMaterial=null,this.clear(),(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,n){super(),this.context=t,this.lineGeometry=new B1.LineGeometry,this.lineMaterial=new H1.LineMaterial({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:i,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(i,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};var Q1=require("three"),Na=class extends te{setEnable(t){super.setEnable(t),xt(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=X(this.startPoint,e,n,i),s=X(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 st&&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 d=X(p,i,o,s);return an(d,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=X(u,i,o,s),h=X(l,i,o,s);return!(!an(c,e,n)||!an(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new Q1.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);xt(this.rect,s.x,s.y,a,u)}else xt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=un(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var Co=class extends q1.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))}}),($n?e.metaKey:e.ctrlKey)||this._list.clear(),a.forEach(c=>this._list.add(c)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{tr(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{tr(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(i=>{this._list.add(i)}),this.selectEnd()},this.boxSelection=new Na(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var YB=f(Fe(),1),DB=f(Ke(),1),CB=f(Ne(),1),XB=f(ze(),1),ZB=f(Ue(),1),OB=f(Ge(),1),RB=f(ke(),1),FB=f(Y(),1);var za=require("three");var Xo=class extends za.EventDispatcher{handleHoverGraphicsChange(t){t===void 0&&(t=this.curGraphics),this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new J,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics: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 d=i.find(g=>g.options.id===p.options.id);if(d instanceof Fn){let{x:g,y}=d.clientPos,M=Math.sqrt((g-o.offsetX)**2+(y-o.offsetY)**2);M<h&&(h=M,c=p)}else if(d instanceof at){let{x:g,y}=d.box.getCenter(new za.Vector2),M=Math.sqrt((g-o.offsetX)**2+(y-o.offsetY)**2);M<h&&(h=M,c=p)}}),u.add(c)}u.size||n.forEach(c=>u.add(c)),u.forEach(c=>{if(this.graphicTimerMap.get(c)||this.curGraphics.has(c))return;let h=this.timer.setTimeout(()=>{this.curGraphics.add(c),this.graphicTimerMap.delete(c),this.timer.clearTimeout(h),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(c,h)}),this.graphicTimerMap.forEach((c,h)=>{u.has(h)||(this.timer.clearTimeout(c),this.graphicTimerMap.delete(h))});let l=this.curGraphics.size;this.curGraphics.forEach(c=>{u.has(c)||this.curGraphics.delete(c)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()},this.onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()},this.onBodyPointerMove=e=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)&&this.onPointerLevel()}},this.registryEvent()}};var UB=f(Y(),1),re=require("three");var Zo=require("@turf/turf"),Ua=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(g=>g instanceof $t).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,l=[new re.Vector3(s.x,s.y,s.z),new re.Vector3(a.x,s.y,s.z),new re.Vector3(s.x,a.y,s.z),new re.Vector3(a.x,a.y,s.z),new re.Vector3(s.x,s.y,a.z),new re.Vector3(a.x,s.y,a.z),new re.Vector3(s.x,a.y,a.z),new re.Vector3(a.x,a.y,a.z)].map(g=>X(g,n,i,o)),c=Math.min(...l.map(g=>g.x)),h=Math.max(...l.map(g=>g.x)),p=Math.min(...l.map(g=>g.y)),d=Math.max(...l.map(g=>g.y));return{left:c,right:h,top:p,bottom:d}}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=(0,Zo.polygon)([[[e,i],[n,i],[n,o],[e,o],[e,i]]]),d=(0,Zo.polygon)([[[h,u],[s-l,u],[s-l,a-c],[h,a-c],[h,u]]]);try{return(0,Zo.intersect)(p,d)!==null}catch(g){return console.warn("\u8BA1\u7B97\u4EA4\u96C6\u51FA\u9519:",g),!1}}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new re.Vector3,zoom:1,target:new re.Vector3},this.enable=!0,this.box=new re.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 n7=f(Mh(),1),Ph=require("three"),dr=require("@tweenjs/tween.js");var $B=f(Y(),1),t7=f(N(),1),x=require("three"),ka=new x.Ray,pT=new x.Plane,HO=Math.cos(70*x.MathUtils.DEG2RAD),Va=class extends x.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 x.Vector2,this.rotateLineEnd=new x.Vector2,this.spherical=new x.Spherical,this.sphericalDelta=new x.Spherical,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new x.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:x.MOUSE.PAN,MIDDLE:x.MOUSE.DOLLY,RIGHT:x.MOUSE.ROTATE},this.touches={ONE:x.TOUCH.PAN,TWO:x.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(P){P.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=P},this.stopListenToKeyEvents=function(){var P;(P=this._domElementKeyEvents)==null||P.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent({type:"change"}),n.update(),o=i.NONE},this.update=function(){let P=new x.Vector3,b=new x.Quaternion().setFromUnitVectors(t.up,new x.Vector3(0,1,0)),L=b.clone().invert(),nt=new x.Vector3,Lt=new x.Quaternion,Ze=new x.Vector3,ve=2*Math.PI;return function(ii){ii===void 0&&(ii=null);let tn=n.object.position;P.copy(tn).sub(n.target),P.applyQuaternion(b),a.setFromVector3(P),n.autoRotate&&o===i.NONE&&R(z(ii)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let en=n.minAzimuthAngle,nn=n.maxAzimuthAngle;isFinite(en)&&isFinite(nn)&&(en<-Math.PI?en+=ve:en>Math.PI&&(en-=ve),nn<-Math.PI?nn+=ve:nn>Math.PI&&(nn-=ve),en<=nn?a.theta=Math.max(en,Math.min(nn,a.theta)):a.theta=a.theta>(en+nn)/2?Math.max(en,a.theta):Math.min(nn,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&&W||n.object.isOrthographicCamera?a.radius=Vt(a.radius):a.radius=Vt(a.radius*l),P.setFromSpherical(a),P.applyQuaternion(L),tn.copy(n.target).add(P),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),c.set(0,0,0));let Lo=!1;if(n.zoomToCursor&&W){let oi=null;if(n.object.isPerspectiveCamera){let si=P.length();oi=Vt(si*l);let Jo=si-oi;n.object.position.addScaledVector(D,Jo),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let si=new x.Vector3(w.x,w.y,0);si.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Lo=!0;let Jo=new x.Vector3(w.x,w.y,0);Jo.unproject(n.object),n.object.position.sub(Jo).add(si),n.object.updateMatrixWorld(),oi=P.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;oi!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(oi).add(n.object.position):(ka.origin.copy(n.object.position),ka.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(ka.direction))<HO?t.lookAt(n.target):(pT.setFromNormalAndCoplanarPoint(n.object.up,n.target),ka.intersectPlane(pT,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Lo=!0);return l=1,W=!1,Lo||nt.distanceToSquared(n.object.position)>s||8*(1-Lt.dot(n.object.quaternion))>s||Ze.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),nt.copy(n.object.position),Lt.copy(n.object.quaternion),Ze.copy(n.target),Lo=!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 x.Spherical,u=new x.Spherical,l=1,c=new x.Vector3,h=new x.Vector2,p=new x.Vector2,d=new x.Vector2,g=new x.Vector2,y=new x.Vector2,M=new x.Vector2,A=new x.Vector2,S=new x.Vector2,_=new x.Vector2,D=new x.Vector3,w=new x.Vector2,W=!1,v=[],I={};function z(P){return P!==null?2*Math.PI/60*n.autoRotateSpeed*P:2*Math.PI/60/60*n.autoRotateSpeed}function Z(){return Math.pow(.95,n.zoomSpeed)}function R(P){u.theta-=P}function pt(P){u.phi-=P}let mt=function(){let P=new x.Vector3;return function(L,nt){P.setFromMatrixColumn(nt,0),P.multiplyScalar(-L),c.add(P)}}(),kt=function(){let P=new x.Vector3;return function(L,nt){n.screenSpacePanning===!0?P.setFromMatrixColumn(nt,1):(P.setFromMatrixColumn(nt,0),P.crossVectors(n.object.up,P)),P.multiplyScalar(L),c.add(P)}}(),oe=function(){let P=new x.Vector3;return function(L,nt){let Lt=n.domElement;if(n.object.isPerspectiveCamera){let Ze=n.object.position;P.copy(Ze).sub(n.target);let ve=P.length();ve*=Math.tan(n.object.fov/2*Math.PI/180),mt(2*L*ve/Lt.clientHeight,n.object.matrix),kt(2*nt*ve/Lt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(mt(L*(n.object.right-n.object.left)/n.object.zoom/Lt.clientWidth,n.object.matrix),kt(nt*(n.object.top-n.object.bottom)/n.object.zoom/Lt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function gr(P){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ni(P){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ri(P){if(!n.zoomToCursor)return;W=!0;let b=n.domElement.getBoundingClientRect(),L=P.clientX-b.left,nt=P.clientY-b.top,Lt=b.width,Ze=b.height;w.x=L/Lt*2-1,w.y=-(nt/Ze)*2+1,D.set(w.x,w.y,1).unproject(n.object).sub(n.object.position).normalize()}function Vt(P){return Math.max(n.minDistance,Math.min(n.maxDistance,P))}function Gh(P){h.set(P.clientX,P.clientY)}function zT(P){ri(P),A.set(P.clientX,P.clientY)}function kh(P){g.set(P.clientX,P.clientY)}function UT(P){p.set(P.clientX,P.clientY),d.subVectors(p,h).multiplyScalar(n.rotateSpeed);let b=n.domElement;R(2*Math.PI*d.x/b.clientHeight),pt(2*Math.PI*d.y/b.clientHeight),h.copy(p),n.update()}function GT(P){S.set(P.clientX,P.clientY),_.subVectors(S,A),_.y>0?gr(Z()):_.y<0&&ni(Z()),A.copy(S),n.update()}function kT(P){y.set(P.clientX,P.clientY),M.subVectors(y,g).multiplyScalar(n.panSpeed),oe(M.x,M.y),g.copy(y),n.update()}function VT(P){ri(P),P.deltaY<0?ni(Z()):P.deltaY>0&&gr(Z()),n.update()}function LT(P){let b=!1;switch(P.code){case n.keys.UP:P.ctrlKey||P.metaKey||P.shiftKey?pt(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):oe(0,n.keyPanSpeed),b=!0;break;case n.keys.BOTTOM:P.ctrlKey||P.metaKey||P.shiftKey?pt(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):oe(0,-n.keyPanSpeed),b=!0;break;case n.keys.LEFT:P.ctrlKey||P.metaKey||P.shiftKey?R(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):oe(n.keyPanSpeed,0),b=!0;break;case n.keys.RIGHT:P.ctrlKey||P.metaKey||P.shiftKey?R(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):oe(-n.keyPanSpeed,0),b=!0;break}b&&(P.preventDefault(),n.update())}function Vh(){if(v.length===1)h.set(v[0].pageX,v[0].pageY);else{let P=(v[0].pageX-v[0].pageY)/(v[1].pageX-v[1].pageY),b=v[0].pageY-P*v[0].pageX;n.rotateLineStart.set(P,b);let L=.5*(v[0].pageX+v[1].pageX),nt=.5*(v[0].pageY+v[1].pageY);h.set(L,nt)}}function Lh(){if(v.length===1)g.set(v[0].pageX,v[0].pageY);else{let P=.5*(v[0].pageX+v[1].pageX),b=.5*(v[0].pageY+v[1].pageY);g.set(P,b)}}function Jh(){let P=v[0].pageX-v[1].pageX,b=v[0].pageY-v[1].pageY,L=Math.sqrt(P*P+b*b);A.set(0,L)}function JT(){n.enableZoom&&Jh(),n.enablePan&&Lh()}function BT(){n.enableZoom&&Jh(),n.enableRotate&&Vh()}function Bh(P){if(v.length==1)p.set(P.pageX,P.pageY);else{let L=du(P),nt=.5*(P.pageX+L.x),Lt=.5*(P.pageY+L.y);p.set(nt,Lt);let Ze=(P.pageY-L.y)/(P.pageX-L.x),ve=L.y-Ze*L.x;if(n.rotateLineEnd.set(Ze,ve),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let mu=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),ii=Ze*mu+ve;if(Number.isFinite(mu)&&Number.isFinite(ii)){let tn=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(tn)<.5&&(tn=-Math.sign(tn)*(Math.PI-Math.abs(tn))),Math.abs(tn)<.1&&(u.theta+=tn)}}n.rotateLineStart.copy(n.rotateLineEnd)}d.subVectors(p,h).multiplyScalar(n.rotateSpeed);let b=n.domElement;pt(2*Math.PI*d.y/b.clientHeight),h.copy(p)}function Hh(P){if(v.length===1)y.set(P.pageX,P.pageY);else{let b=du(P),L=.5*(P.pageX+b.x),nt=.5*(P.pageY+b.y);y.set(L,nt)}M.subVectors(y,g).multiplyScalar(n.panSpeed),oe(M.x,M.y),g.copy(y)}function Qh(P){let b=du(P),L=P.pageX-b.x,nt=P.pageY-b.y,Lt=Math.sqrt(L*L+nt*nt);S.set(0,Lt),_.set(0,Math.pow(S.y/A.y,n.zoomSpeed)),gr(_.y),A.copy(S)}function HT(P){n.enableZoom&&Qh(P),n.enablePan&&Hh(P)}function QT(P){n.enableZoom&&Qh(P),n.enableRotate&&Bh(P)}this.onPointerDown=function(b){n.enabled!==!1&&(v.length===0&&(n.domElement.setPointerCapture(b.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),nv(b),b.pointerType==="touch"?tv(b):qT(b))},this.onPointerMove=function(b){n.enabled!==!1&&(b.pointerType==="touch"?ev(b):$T(b))},this.onPointerUp=function(b){rv(b),v.length===0&&(n.domElement.releasePointerCapture(b.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=i.NONE};function qT(P){let b;switch(P.button){case 0:b=n.mouseButtons.LEFT;break;case 1:b=n.mouseButtons.MIDDLE;break;case 2:b=n.mouseButtons.RIGHT;break;default:b=-1}switch(b){case x.MOUSE.DOLLY:if(n.enableZoom===!1)return;zT(P),o=i.DOLLY;break;case x.MOUSE.ROTATE:if(P.ctrlKey||P.metaKey||P.shiftKey){if(n.enablePan===!1)return;kh(P),o=i.PAN}else{if(n.enableRotate===!1)return;Gh(P),o=i.ROTATE}break;case x.MOUSE.PAN:if(P.ctrlKey||P.metaKey||P.shiftKey){if(n.enableRotate===!1)return;Gh(P),o=i.ROTATE}else{if(n.enablePan===!1)return;kh(P),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function $T(P){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;UT(P);break;case i.DOLLY:if(n.enableZoom===!1)return;GT(P);break;case i.PAN:if(n.enablePan===!1)return;kT(P);break}}this.onMouseWheel=function(b){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(b.preventDefault(),n.dispatchEvent({type:"start"}),VT(b),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(b){n.enabled===!1||n.enablePan===!1||LT(b)};function tv(P){switch(qh(P),v.length){case 1:switch(n.touches.ONE){case x.TOUCH.ROTATE:if(n.enableRotate===!1)return;Vh(),o=i.TOUCH_ROTATE;break;case x.TOUCH.PAN:if(n.enablePan===!1)return;Lh(),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case x.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;JT(),o=i.TOUCH_DOLLY_PAN;break;case x.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;BT(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function ev(P){switch(qh(P),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;Bh(P),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;Hh(P),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;HT(P),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;QT(P),n.update();break;default:o=i.NONE}}this.onContextMenu=function(b){n.enabled!==!1&&b.preventDefault()};function nv(P){v.push(P)}function rv(P){delete I[P.pointerId];for(let b=0;b<v.length;b++)if(v[b].pointerId==P.pointerId){v.splice(b,1);return}}function qh(P){let b=I[P.pointerId];b===void 0&&(b=new x.Vector2,I[P.pointerId]=b),b.set(P.pageX,P.pageY)}function du(P){let b=P.pointerId===v[0].pointerId?v[1]:v[0];return I[b.pointerId]}n.domElement.addEventListener("contextmenu",this.onContextMenu),n.domElement.addEventListener("pointerdown",this.onPointerDown),n.domElement.addEventListener("pointercancel",this.onPointerUp),n.domElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),this.update()}};var La=class extends Va{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):Qt(new Promise(i=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new dr.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):Qt(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new dr.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 Ph.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 Qt(new Promise(o=>{let s=new dr.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?Qt(new Promise(s=>{let a=new dr.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()),this.camera.updateMatrix(),t){let n=new Ph.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 dr.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 Jr=require("three");var Ja=class extends Jr.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(),this.domElement=null}constructor(t){super(T({antialias:!0,alpha:!0},t)),this.event=new Jr.EventDispatcher,this.enable=!0,this.timer=new J,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=Jr.PCFSoftShadowMap}};var zn=require("three"),fT=require("three/examples/jsm/loaders/RGBELoader.js");var Ba=class extends zn.Scene{constructor(){super(),new fT.RGBELoader().load(I1,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 dT=require("three"),Ha=class extends dT.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 Oo=class extends V.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 Ha(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new La(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 Ua(this)}getRatio(t,e){t===void 0&&(t=new V.Vector3(0,0,0)),e===void 0&&(e=new V.Vector3(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=X(t,this.camera,n,i),s=X(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 V.AmbientLight&&(e.color=new V.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 V.Vector2;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new V.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 V.Box3().setFromObject(t);this.setPolarAngle(h,0);let{max:d,min:g}=p,y=new V.Vector3(g.x,d.y,d.z),M=new V.Vector3(d.x,d.y,d.z),A=new V.Vector3(d.x,g.y,g.z),S=new V.Vector3(g.x,g.y,g.z),_=X(y,this.camera,l,c),D=X(M,this.camera,l,c),w=X(S,this.camera,l,c),W=X(A,this.camera,l,c),I=new V.Box2().setFromPoints([new V.Vector2(_.x,_.y),new V.Vector2(D.x,D.y),new V.Vector2(w.x,w.y),new V.Vector2(W.x,W.y)]).getSize(new V.Vector2),z=(l-s-u)/I.x,Z=(c-o-a)/I.y,R=Math.min(z,Z),pt=new V.Vector3((d.x+g.x)/2,(d.y+g.y)/2,(d.z+g.z)/2),mt=R*this.camera.zoom,kt=this.camera.clone();kt.zoom=mt,kt.updateMatrix();let oe=(l-I.x*R)/2,gr=(c-I.y*R)/2,ni=(s-u)/2,ri=(o-a)/2;if(ni){let Vt=new V.Vector3;Vt.setFromMatrixColumn(kt.matrix,0),Vt.normalize(),Vt.multiplyScalar(ni/mt),pt.add(Vt)}if(ri){let Vt=new V.Vector3;Vt.setFromMatrixColumn(kt.matrix,1),Vt.normalize(),Vt.multiplyScalar(ri/mt),pt.add(Vt)}return{zoom:R*this.camera.zoom,center:pt}}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()),rt(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new Ba,this.renderer=new Ja,this.lights=j0(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,this.basicZoom=1,this.onControlChange=()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})},this.onControlChangeZoom=n=>{let{zoom:i}=n;this.dispatchEvent({type:"control-zoom-change",zoom:i})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:i,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),i.left=-s/2,i.right=s/2,i.top=a/2,i.bottom=-a/2,i.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);i.length&&this.dispatchEvent({type:"graphic-click",graphics:i,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:i,pois:s,position:o})},this.onPointermove=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:i,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:i,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:i,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:i}=n;this.dispatchEvent({type:"hover",graphics:i})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new Co(this),this.hoverHelper=new Xo(this),this.resizeClientSize(),this.registryEvent()}};var mT=require("lodash"),gT={placeId:0,apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get",loadPlaceInfo:"https://screen.aibee.cn/ai-map/map/get-floor-map"},enableBoxSelect:!0,resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1},loaderPlaceConfig:{textFontSize:14}};function Ah(r){return(0,mT.merge)({},gT,r)}var bT=require("lodash");var O7=f(Y(),1);var Xe;function yT(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(Xe)return e({db:Xe,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){Xe=o.target.result,console.log("onupgradeneeded"),e({db:Xe,type:"onupgradeneeded"})},i.onsuccess=o=>{Xe=o.target.result,e({db:Xe,type:"success"})},i.onerror=o=>{n(o)}})}function jh(r,t,e){return e===void 0&&(e=Xe),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 MT(r,t,e,n){return n===void 0&&(n=Xe),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>j(this,null,function*(){let u=yield jh(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 mr(r,t){t===void 0&&(t=Xe),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function PT(r){r===void 0&&(r=Xe),r==null||r.close(),Xe=null}var tu=require("three");var W7=f(N(),1),I7=f(Y(),1);function Qa(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 qa(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 AT(r,t,e){switch(r.l_type){case"graph":return QO(r,t);case"wall":return qO(r,t);case"lane":return $O(r,t);case"texture2d":case"texture3d":return tR(r,t);case"glb":return eR(r,t);case"store":return nR(r,t);case"facility":return iR(r,t);case"parkingSpace":return sR(r,t,e);case"text":return uR(r,t)}}function jT(r,t,e,n){switch(r.l_type){case"store":return rR(r,t,e,n);case"facility":return oR(r,t,e,n);case"parkingSpace":return aR(r,t,n)}}function QO(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=i,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(i):n[h]=[i],n},{});Object.values(e).forEach(n=>{let i=new fr(t.context,n);t.mergeGraphicLayer.add(i)})}function qO(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l}=i,c=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l;return u===0&&(c=o.toLowerCase()+"-"+s+"-"+l),n[c]?n[c].push(i):n[c]=[i],n},{});Object.values(e).forEach(n=>{let i=new Io(t.context,n);t.wallLayer.add(i)})}function $O(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u}=i,l=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u;return u===0&&(l=o.toLowerCase()+"-"+s),n[l]?n[l].push(i):n[l]=[i],n},{});Object.values(e).forEach(n=>{let i=new Yo(t.context,n);t.laneLayer.add(i)})}function tR(r,t){if(r.elements.length){let e=new pr(t.context,r.elements);t.textureLayer.add(e)}}function eR(r,t){r.elements.forEach(e=>{let n=new Eo(t.context,T({},e,{url:e.secondUrl,rotate:e.secondRotate,width:e.secondWidth,center_x:e.center_coord_x,center_y:e.center_coord_y}));t.glbModelLayer.add(n)})}function nR(r,t){r.elements.map(e=>{let n=t.addGraphic(T({},e,{dashed:!1}));t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function rR(r,t,e,n){r.elements.map(i=>{try{let o=Qa(i,e),s=new at(t.context,{id:i.id,icon:i.poi_info.showImageUrl||i.poi_info.icon,text:o,position:{x:i.center_coord_x,y:i.center_coord_y,z:i.airHeight+i.height},icon_size:[24,24],level:i.poi_info.level||0,hide_text:!n.showStoreName,maxWeight:i.poi_info.maxWeight||25,minWeight:i.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(s),s&&(s.userData.type="store",s.userData.data=i,s.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,i)}})}function iR(r,t){r.elements.map(e=>{let n=t.addGraphic(T({},e,{dashed:!1}));t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function oR(r,t,e,n){r.elements.filter(o=>o.poi_info).map(o=>{try{let s=qa(o,e),a=new at(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:s,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},icon_size:[24,24],level:o.poi_info.level||0,hide_text:!n.showFacilityName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(a),a.userData.type="facility",a.userData.data=o,a.userData.floor=t.name}catch(s){console.log("\u6DFB\u52A0facility\u5931\u8D25",s,o)}})}function sR(r,t,e){t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function aR(r,t,e){return j(this,null,function*(){let n=r.elements.filter(s=>s.texts[0]),i=n.map(s=>s.texts[0]),o=yield ct.lazyGetTextureByTexts(i,{height:64});n.forEach(s=>{try{let a=s.texts[0],u=new at(t.context,{id:s.id,text:a,position:{x:s.center_coord_x,y:s.center_coord_y,z:s.airHeight+s.height},text_texture:o[a].texture,text_texture_width:o[a].width,text_texture_height:o[a].height,text_texture_offset_x:o[a].x,text_texture_offset_y:o[a].y,text_font_size:e.textFontSize});u&&(u.userData.type="parkingSpace",u.userData.data=s,u.userData.floor=t.name),t.poiLayer2.pushPoi(u)}catch(a){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",a,s)}}),Object.values(o).forEach(s=>{s.texture.dispose()})})}function uR(r,t){let e=new Do(t.context,r.elements.map(n=>T({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var TT="map_version",vT="route_version",ST="facility_version",Th="map_data",$a="road_network_data",vh="facility_data",lR={mergeParkingSpace:!0},Ro=class extends At{initDb(){return j(this,null,function*(){try{let{db:t,type:e}=yield yT("aibee_map",2);e==="onupgradeneeded"&&(mr(TT),mr(vT),mr(ST),mr(Th),mr($a),mr(vh)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return j(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=T({},this.placeConfig,e));else{let n=yield fetch(t).then(i=>i.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=T({},this.placeConfig,JSON.parse(n.data.config||"{}")))}this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return this.initDbPromise.then(()=>MT(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>jh(t,""+e,this.db))}getFloorCacheKey(t){return t.floor_id+"_"+t.version_id}getFloorData(t){return j(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return j(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=Qa(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=qa(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return j(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>j(this,null,function*(){let i=this.getFloorCacheKey(t),o=yield fetch(t.map_url).then(s=>s.json());o.floor=t.floor,this.setCacheData(Th,i,o),this.setCacheData(TT,i,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return j(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{let i=yield this.getCacheData(Th,n);return i||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{let i=yield this.getCacheData($a,n);if(i)return i;let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData($a,n,o),this.setCacheData(vT,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData($a,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(vh,e,i),this.setCacheData(ST,e,t.version_id)),i});try{let i=yield this.getCacheData(vh,e);return i||n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return j(this,null,function*(){for(let t=0;t<this.floors.length;t++){let e=this.floors[t];this.getFloorJsonData(e.floor)}})}getMulFloorsData(t){return j(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return j(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return j(this,null,function*(){e=this.getFloorBaseLayer(t,e);let i=T({},this.placeConfig,n);return t.layers.forEach(o=>{["range","ground"].includes(o.l_type)||ir(o.elements,e.userData.center)}),yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,i),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new tu.Vector3),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return j(this,null,function*(){return new Promise(n=>{let i={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(i),s=a=>{let{task:u,res:l}=a;u.tid===o&&(this.taskQueue.removeEventListener("active-task-end",s),n(l))};this.taskQueue.addEventListener("active-task-end",s)})})}_switchFloor(t,e){return j(this,null,function*(){var n;let i=t;if(typeof t=="string"){let c=yield this.getFloorJsonData(t);if(c)i=c;else return null}let o=T({},this.placeConfig,e),s=new $t(this.bmap.context);s.userData.data=t;let a=this.floors.find(c=>c.floor===i.floor);var u;let l=(u=a==null?void 0:a.map_angle)!=null?u:0;return this.bmap.dispatchEvent({type:Mt.SWITCH_FLOOR_BEFORE,data:{curFloor:s,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:s,graphics:[],floorData:i}}),this.bmap.context.scene.background=new tu.Color(o.backgroundColor),this.getFloorBaseLayer(i,s),this.changeFloorBox(i,s),this.bmap.buildingCenter=s.userData.center,this.bmap.currentBuildGround=(n=s.userData.data.layers.find(c=>c.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(s),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(l/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),i.layers.forEach(c=>{["range","ground"].includes(c.l_type)||ir(c.elements,s.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:s,graphics:[]}}),this.bmap.dispatchEvent({type:Mt.SWITCH_FLOOR_GROUND,data:{curFloor:s}}),yield Ei(),yield this.getFloorContentLayer(i,s),this.changeFloorBox(i,s),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:s,graphics:[]}}),yield O0(2),yield this.getFloorPoi(i,s,o),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:s,graphics:s.graphicLayer.children}}),this.bmap.dispatchEvent({type:Mt.SWITCH_FLOOR_AFTER,data:{curFloor:s,graphics:s.graphicLayer.children}}),s})}getFloorBaseLayer(t,e){e||(e=new $t(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":ir(i.elements,n);let s=i.elements.map(a=>new st(this.bmap.context,T({},a,{dashed:!1})));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return j(this,null,function*(){e||(e=new $t(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)||(AT(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Ei(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return j(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(s=>jT(s,e,this.locale,n))),console.log("poi time",Date.now()-i);let o=Date.now();Ei().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return j(this,null,function*(){var t;PT((t=this.db)!=null?t:void 0)})}dispose(){super.dispose(),this.clear(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new or,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=T({},lR,e),this.placeConfig=T({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var J7=f(Y(),1);function Sh(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 bh(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(d=>d.info=JSON.parse(d.info)),p||[]))})}function cR(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?hR(u.fileId,t):null)})}function hR(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 wh=class{load(t){return j(this,null,function*(){let e=er(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),bh(t,this.bmap.config)]),i=er({floor:t.floor,ts:t.ts});ir(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=er({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=Sh({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 $t(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 pR=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),_h=class extends Br.EventDispatcher{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?_i(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 Ro(this),this.loader.placeConfig=T({},this.loader.placeConfig,this.config.loaderPlaceConfig),yield this.loader.load(this.config.apiPath.loadPlaceInfo+"?place_id="+this.config.placeId+"&env=prod")),this.loader.switchFloor(t)})}switchFloorByFloor(t,e){e===void 0&&(e=t.graphicLayer.children),this.triggerHooks(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 st))||[]}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,n,i){e===void 0&&(e=500),n===void 0&&(n=0),i===void 0&&(i=0);let o=t.getPosition().clone(),{context:{camera:s}}=this;if(s.updateMatrix(),i){let a=new Br.Vector3;a.setFromMatrixColumn(s.matrix,1),a.normalize(),a.multiplyScalar(i/s.zoom),o.add(a)}if(n){let a=new Br.Vector3;a.setFromMatrixColumn(s.matrix,0),a.normalize(),a.multiplyScalar(n/s.zoom),o.add(a)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return j(this,null,function*(){return e===void 0&&(e=500),Qt(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=X(o,u,s,a).x-s/2,h=new Br.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 X(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 xo(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 Wo(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=_i(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,ct.dispose(),Tt.dispose(),Wn.dispose(),Kt.dispose(),B.dispose(),Ce.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new J,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:n}}=this.context;n!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=n)},this.onKeydown=n=>{this.polarKeys.includes(n.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(n.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=n=>{if(this.polarKeys.includes(n.code)){let i=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=i,this.context.control.minPolarAngle=i}if(this.azimuthalKeys.includes(n.code)){let i=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=i,this.context.control.minAzimuthAngle=i}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),i=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let o=this.context.getFitCameraToGroundZoom(this.config.defaultPadding,0)||1;this.context.camera.zoom=i,this.context.control.minZoom=o,this.context.control.maxZoom=o*30,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=Ah(e),this.context=new Oo(t,this.config),this.debounceResize=(0,bT.debounce)(this.resize,5),this.registryEvent()}};var d8=f(Y(),1);var wT=require("three"),zt=class extends wT.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 xh=class extends zt{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 yH=f(Yi(),1),MH=f(ce(),1),PH=f(Y(),1),AH=f(Mh(),1);var O8=f(Y(),1),R8=f(N(),1),ft=require("three");var P8=f(jc(),1),A8=f(Li(),1),j8=f(Ji(),1),T8=f(Hi(),1),v8=f(Qi(),1),S8=f(qi(),1),b8=f(to(),1),w8=f(eo(),1),_8=f(no(),1),x8=f(ro(),1),W8=f(io(),1),I8=f(oo(),1),E8=f(so(),1),Y8=f(uo(),1),D8=f(lo(),1),C8=f(N(),1),X8=f(ch(),1),E=require("three"),ie=class extends E.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 E.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)}}})}};ie.prototype.setMatrixWorld=function(r){this.matrixWorld=r};ie.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};ie.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 E.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 fR(r,t){var e=new E.Matrix4,n=new E.Ray,i=new E.Sphere,o=new E.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 E.Vector3,u=new E.Vector3,l=new E.Vector3,c=this instanceof E.LineSegments?2:1,h=s.index,p=s.attributes;if(h!==null)for(var d=h.array,g=p.position.array,y=p.width.array,M=0,A=d.length-1;M<A;M+=c){var S=d[M],_=d[M+1];a.fromArray(g,S*3),u.fromArray(g,_*3);var D=y[Math.floor(M/3)]!==void 0?y[Math.floor(M/3)]:1,w=r.params.Line.threshold+this.material.lineWidth*D/2,W=w*w,v=n.distanceSqToSegment(a,u,o,l);if(!(v>W)){o.applyMatrix4(this.matrixWorld);var I=r.ray.origin.distanceTo(o);I<r.near||I>r.far||(t.push({distance:I,point:l.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this}),M=A)}}}}ie.prototype.raycast=fR;ie.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]};ie.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};ie.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new E.Vector3(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new E.Vector3(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=i.distanceTo(o);t+=s}return t};ie.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 E.BufferAttribute(new Float32Array(this.positions),3),previous:new E.BufferAttribute(new Float32Array(this.previous),3),next:new E.BufferAttribute(new Float32Array(this.next),3),side:new E.BufferAttribute(new Float32Array(this.side),1),width:new E.BufferAttribute(new Float32Array(this.width),1),uv:new E.BufferAttribute(new Float32Array(this.uvs),2),index:new E.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new E.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 Wh(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}ie.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;Wh(t,0,e,0,i),Wh(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,Wh(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};E.ShaderChunk.meshline_vert=["",E.ShaderChunk.logdepthbuf_pars_vertex,E.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;","",E.ShaderChunk.logdepthbuf_vertex,E.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",E.ShaderChunk.fog_vertex,"}"].join(`
|
|
3912
3912
|
`);E.ShaderChunk.meshline_frag=["",E.ShaderChunk.fog_pars_fragment,E.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() {","",E.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);","",E.ShaderChunk.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
|
|
3913
3913
|
`);var Fo=class extends E.ShaderMaterial{constructor(t){super({uniforms:Object.assign({},E.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new E.Color(16777215)},opacity:{value:1},resolution:{value:new E.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 E.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:E.ShaderChunk.meshline_vert,fragmentShader:E.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)}};Fo.prototype.copy=function(r){return E.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 _T={texture_url:Ya,lineWidth:10,color:16777215},eu=class extends ft.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:i}}}}}=this,o=t.map(a=>{let[u,l]=a;return X(new ft.Vector3(u,l,0),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return Dt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new ft.Vector2(t,1)}loadTexture(t){return new Promise((e,n)=>{new ft.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 ie;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=ft.RepeatWrapping}let n=this.material=new Fo({useMap:!0,color:new ft.Color(this.config.color),transparent:!0,resolution:new ft.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:ft.NormalBlending,repeat:new ft.Vector2(this.getRepeat(),1)}),i=this.mesh=new ft.Mesh(e,n);return i.renderOrder=99999,this.add(i),i})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=_T,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({},_T,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var Qr=require("@tweenjs/tween.js"),Ut=require("three");var k8=f(Ra(),1),V8=f(Y(),1),L8=f(N(),1),ru=require("three");var xT=require("@tweenjs/tween.js"),WT=require("lodash"),Hr=require("@turf/turf");var dR={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},nu=class extends ru.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)}setRoadData(t){this.roadData=t}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null),t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,e){let{curRoutePathPoints:n,position:i,curRoutePath:o,paths:s,routeIndex:a}=this;if(!n.length)return null;let u=n,l=this.paths[this.routeIndex].floor,c=this.getCurRouteRemainDistance();if(i){let M=Ve(n,i);u=u.slice(M+1),u.unshift(i)}let h=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:p,closestPoint:d,index:g,i:y}=h.reduce((M,A,S)=>{if(A.floor!==t)return M;let{distance:_,closestPoint:D,index:w}=A.points.reduce((W,v,I,z)=>{if(!z[I+1])return T({},W,{distance:W.distance===1/0?k(v,e):W.distance});let{distance:Z,closestPoint:R}=il(e,v,z[I+1]);if(l===t){let pt=[e,...z.slice(I+1)],mt=Dt(pt);if(c-mt>10)return W}return Z<W.distance?{distance:Z,closestPoint:R,index:I}:W},{distance:1/0,closestPoint:A.points[0],index:0});return _<M.distance?{distance:_,closestPoint:D,index:S,i:w}:M},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:p,closestPoint:d,routeIndex:g+a,pointIndex:g===0?y+this.pointIndex:y}}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,WT.throttle)(l=>{let c=nr(i,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new xT.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 Dt(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return Dt(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=Be.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===Be.FRONT&&s<=n.length;){let g=n[s],y=n[s+1],M=n[s+2];if(!g||!y)a=Be.END;else if(l+=k(g,y),!M)a=Be.END;else{a=Ks(g,y,M),c=xi(g,y,M),h=(new ru.Vector2(M[0]-y[0],M[1]-y[1]).angle()*180/Math.PI-90+360)%360;var p;u=(p=o==null?void 0:o.pointInfos[s+1].crossName)!=null?p:"",s+=1}}if(n[s]&&(l=k(i,n[s])),a===Be.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let d=this.getCurRouteToStartDistance();return e===0&&d<=5?{dir:Be.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=Be.FRONT),{dir:a,distance:l,crossName:u,angle:c,nextAngle:h})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let i=(0,Hr.polygon)(n.cds),o=(0,Hr.point)(this.position);return(0,Hr.booleanPointInPolygon)(o,i)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:i,distance:o,crossName:s,angle:a,nextAngle:u}=n;e<=10&&(i=Be.END);let{imageUrl:l}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:o,dir:i,angle:a,nextAngle:u,pos:this.position,routeIndex:this.routeIndex,crossName:s,offset:this.offset,reset:this.reset,imageUrl:l}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,n){super(),this.navigation=t,this.offset=!1,this.reset=!1,this.position=[0,0],this.routeIndex=0,this.pointIndex=0,this.paths=[],this.timer=new J,this.resetTimer=null,this.tweenUtil=new ln,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o),this.simulationTween&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},dR,e),this.roadData=n,this.registryEvent()}};var Q8=f(ha(),1),q8=f(Li(),1),$8=f(Ji(),1),tH=f(Hi(),1),eH=f(Qi(),1),nH=f(qi(),1),rH=f(to(),1),iH=f(eo(),1),oH=f(no(),1),sH=f(ro(),1),aH=f(io(),1),uH=f(oo(),1),lH=f(so(),1),cH=f(uo(),1),hH=f(lo(),1),pH=f(Pc(),1),fH=f(Y(),1),Te=require("three");var gn=class r extends at{addDebug(){r.canvas.style.cssText=`
|
|
3914
3914
|
position: fixed;
|