gl-draw 0.16.0-beta.31 → 0.16.0-beta.32

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.
@@ -1,7 +1,7 @@
1
- "use strict";var pe=Object.defineProperty,me=Object.defineProperties;var ve=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var te=Math.pow,J=(n,e,t)=>e in n?pe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,_=(n,e)=>{for(var t in e||(e={}))H.call(e,t)&&J(n,t,e[t]);if(U)for(var t of U(e))ee.call(e,t)&&J(n,t,e[t]);return n},R=(n,e)=>me(n,ve(e));var ie=(n,e)=>{var t={};for(var i in n)H.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&U)for(var i of U(n))e.indexOf(i)<0&&ee.call(n,i)&&(t[i]=n[i]);return t};var re=(n,e,t)=>new Promise((i,r)=>{var a=c=>{try{s(t.next(c))}catch(l){r(l)}},u=c=>{try{s(t.throw(c))}catch(l){r(l)}},s=c=>c.done?i(c.value):Promise.resolve(c.value).then(a,u);s((t=t.apply(n,e)).next())});const o=require("three"),ye=require("three/examples/jsm/renderers/CSS2DRenderer"),ne=require("three/examples/jsm/renderers/CSS3DRenderer"),E=require("d3-geo");require("d3-geo-projection");const Q=require("./polar2Cartesian.js"),L=require("d3-array"),X=require("earcut"),be=require("@turf/boolean-clockwise"),ge=require("delaunator"),Me=require("@turf/boolean-point-in-polygon"),xe=require("d3-geo-voronoi"),se=require("d3-scale"),Se=require("three/examples/jsm/lines/LineSegmentsGeometry"),we=0,je=1,Ae=2,Ce=!1;class fe{constructor(){this.resources=new Set,this.disposeMaterial=!0,this.disposeVideo=!0}track(e){if(!e)return e;if(Array.isArray(e))return e.forEach(t=>this.track(t)),e;if(!this.disposeMaterial&&e instanceof o.Material)return e;if(e instanceof Y?(e.disposeTrack&&e.object3d?this.track(e.object3d):this.resources.add(e),Object.values(e.materialList).map(t=>this.track(t))):(e instanceof o.Object3D||Reflect.has(e,"dispose"))&&this.resources.add(e),e instanceof Y)e.children.forEach(t=>{t.disposeTrack=!1}),this.track(e.children);else if(e instanceof o.Object3D){const t=e;this.track(t.geometry),this.track(t.material),this.track(t.children)}else if(e instanceof o.Material){for(const i of Object.values(e))i instanceof o.Texture&&this.track(i);const t=e;if(t.uniforms){for(const i of Object.values(t.uniforms))if(i){const r=i.value;(r instanceof o.Texture||Array.isArray(r))&&this.track(r)}}}else this.disposeVideo&&e.isVideoTexture&&e.source.data&&this.resources.add(e.source.data);return e}dispose(){const e=[];for(const t of this.resources)t instanceof o.Object3D?e.push(t):t instanceof HTMLVideoElement&&t.pause(),Reflect.has(t,"dispose")&&t.dispose();e.forEach(t=>{t.removeFromParent()}),e.length=0,this.resources.clear()}}const Be=(n,e=1)=>{const t=new o.BufferGeometry;t.setAttribute("position",new o.Float32BufferAttribute(new Array(e*3).fill(0),3)),t.setAttribute("scaleAtt",new o.Float32BufferAttribute(new Array(e).fill(1),1));const i=n.material,r=new o.PointsMaterial({size:10,map:i.map,alphaMap:i.alphaMap,color:i.color,blending:i.blending,depthTest:i.depthTest,depthWrite:!1,opacity:i.opacity,transparent:!0,alphaTest:i.alphaTest,sizeAttenuation:!1});return r.onBeforeCompile=a=>{a.vertexShader=`
1
+ "use strict";var pe=Object.defineProperty,me=Object.defineProperties;var ve=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var te=Math.pow,J=(n,e,t)=>e in n?pe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,_=(n,e)=>{for(var t in e||(e={}))H.call(e,t)&&J(n,t,e[t]);if(N)for(var t of N(e))ee.call(e,t)&&J(n,t,e[t]);return n},R=(n,e)=>me(n,ve(e));var ie=(n,e)=>{var t={};for(var i in n)H.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&N)for(var i of N(n))e.indexOf(i)<0&&ee.call(n,i)&&(t[i]=n[i]);return t};var re=(n,e,t)=>new Promise((i,r)=>{var o=c=>{try{s(t.next(c))}catch(l){r(l)}},u=c=>{try{s(t.throw(c))}catch(l){r(l)}},s=c=>c.done?i(c.value):Promise.resolve(c.value).then(o,u);s((t=t.apply(n,e)).next())});const a=require("three"),ye=require("three/examples/jsm/renderers/CSS2DRenderer"),ne=require("three/examples/jsm/renderers/CSS3DRenderer"),E=require("d3-geo");require("d3-geo-projection");const Q=require("./polar2Cartesian.js"),L=require("d3-array"),X=require("earcut"),be=require("@turf/boolean-clockwise"),ge=require("delaunator"),Me=require("@turf/boolean-point-in-polygon"),xe=require("d3-geo-voronoi"),se=require("d3-scale"),Se=require("three/examples/jsm/lines/LineSegmentsGeometry"),we=0,je=1,Ae=2,Ce=!1;class fe{constructor(){this.resources=new Set,this.disposeMaterial=!0,this.disposeVideo=!0}track(e){if(!e)return e;if(Array.isArray(e))return e.forEach(t=>this.track(t)),e;if(!this.disposeMaterial&&e instanceof a.Material)return e;if(e instanceof Y?(e.disposeTrack&&e.object3d?this.track(e.object3d):this.resources.add(e),Object.values(e.materialList).map(t=>this.track(t))):(e instanceof a.Object3D||Reflect.has(e,"dispose"))&&this.resources.add(e),e instanceof Y)e.children.forEach(t=>{t.disposeTrack=!1}),this.track(e.children);else if(e instanceof a.Object3D){const t=e;this.track(t.geometry),this.track(t.material),this.track(t.children)}else if(e instanceof a.Material){for(const i of Object.values(e))i instanceof a.Texture&&this.track(i);const t=e;if(t.uniforms){for(const i of Object.values(t.uniforms))if(i){const r=i.value;(r instanceof a.Texture||Array.isArray(r))&&this.track(r)}}}else this.disposeVideo&&e.isVideoTexture&&e.source.data&&this.resources.add(e.source.data);return e}dispose(){const e=[];for(const t of this.resources)t instanceof a.Object3D?e.push(t):t instanceof HTMLVideoElement&&t.pause(),Reflect.has(t,"dispose")&&t.dispose();e.forEach(t=>{t.removeFromParent()}),e.length=0,this.resources.clear()}}const Be=(n,e=1)=>{const t=new a.BufferGeometry;t.setAttribute("position",new a.Float32BufferAttribute(new Array(e*3).fill(0),3)),t.setAttribute("scaleAtt",new a.Float32BufferAttribute(new Array(e).fill(1),1));const i=n.material,r=new a.PointsMaterial({size:10,map:i.map,alphaMap:i.alphaMap,color:i.color,blending:i.blending,depthTest:i.depthTest,depthWrite:!1,opacity:i.opacity,transparent:!0,alphaTest:i.alphaTest,sizeAttenuation:!1});return r.onBeforeCompile=o=>{o.vertexShader=`
2
2
  attribute float scaleAtt;
3
- ${a.vertexShader.replace("gl_PointSize = size;","gl_PointSize = size * scaleAtt;")}
4
- `},new o.Points(t,r)},Ie=(n,e)=>{const t=new o.Object3D;e.forEach((i,r)=>{const a=Q.parseVector3(i.position),u=Q.parseVector3(i.scale||[1,1,1]);t.position.copy(a),t.scale.copy(u),t.updateMatrix();const s=t.matrix.clone();if(n instanceof o.InstancedMesh||n.isInstantiate)n.setMatrixAt(r,s);else if(n instanceof o.Points||n.type==="Points"){const l=n.geometry,f=l.attributes.position.array,h=l.attributes.scaleAtt.array,p=new o.Vector3,d=new o.Vector3,v=new o.Quaternion,m=r*3,y=r*1;s.decompose(p,v,d),f[m]=p.x,f[m+1]=p.y,f[m+2]=p.z,h[y]=Math.max(d.x,d.y,d.z),l.attributes.position.needsUpdate=!0,l.attributes.scaleAtt.needsUpdate=!0}})};class Pe{constructor(){this.onPointerIndex=[]}onPointerEvent(e,t){const i=this.lead.handlePick([this],e,t);this.onPointerIndex.push(i)}onClick(e){this.onPointerEvent("click",e)}onPointerEnter(e){this.onPointerEvent("enter",e)}onPointerLeave(e){this.onPointerEvent("leave",e)}onPointerMove(e){this.onPointerEvent("move",e)}onPointerDown(e){this.onPointerEvent("down",e)}dispose(){this.onPointerIndex.forEach(e=>{this.lead.removePick(e)})}}class De extends Pe{constructor(){super(...arguments),this.userData={},this.materialList={},this.useMaterialType="origin",this.disposeMaterialIfNotUsed=!0}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(i=>{const r=i.userData;i.userData={};const a=i.clone();return i.userData=r,a});{const i=t.userData;t.userData={};const r=t.clone();return t.userData=i,r}}setMaterialList(e,t){const i=this.object3d;if(!i||!i.material)return;this.materialList.origin||(this.materialList.origin=i.material);const r=t==="clone"?this.cloneMaterial():Array.isArray(t)?t.slice():t;return this.materialList[e]=r,r}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}useMListById(e,t){if(!this.mList)return;const i=this.mList.get(e);if(!i)return;const r=this.object3d;Array.isArray(r.material)&&t!==void 0?r.material[t]=i:r.material=i}useMListByName(e,t){if(!this.mList)return;const i=this.mList.getKeyByName(e);i&&this.useMListById(i,t)}dispose(){super.dispose(),this.mList.rmBaseObjectMap(this,void 0,this.disposeMaterialIfNotUsed)}}class Y extends De{constructor(){super(...arguments),this.key="",this.objectType="BaseObject",this.userData={},this.isPrefab=!1,this.isInstantiate=!1,this.isBloom=!1,this.isBaseObject=!0,this.disposeTrack=!0}get parent(){const e=this.object3d.parent;return e&&this.lead.objMap.get(e)||null}get children(){return this.object3d.children.map(e=>this.lead.objMap.get(e)).filter(e=>!!e)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}get lookAt(){return this.object3d.lookAt}add(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.object3d.add(t):this.lead.createBaseObject(t,{target:this})})}remove(...e){[...e].forEach(t=>{var i;this.lead.objMap.get(t)?(i=this.lead.objMap.get(t))==null||i.erase():this.object3d.remove(t)})}get visible(){return this.object3d.visible}get visibleWithAncestors(){if(this.visible){let e=this.parent;for(;e;){if(!e.visible)return!1;e=e.parent}return!0}else return!1}create(){this.createGroup()}render(){}update(e,t){}resize(e,t){}show(){return this.object3d.visible=!0,this.object3d.layers.set(we),this.isBloom&&this.enableBloom(),this}hide(){return this.object3d.visible=!1,this.object3d.layers.set(Ae),this}createGroup(){return this.object3d=new o.Group,this}createMesh(...e){return this.object3d=new o.Mesh(...e),this}createPoints(...e){return this.object3d=new o.Points(...e),this}createCSS2DObject(e){return this.object3d=new ye.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new ne.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new ne.CSS3DSprite(e),this}createSprite(e){return this.object3d=new o.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d)}),this}getSize(){const e=new o.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new o.Vector3),center:e.getCenter(new o.Vector3)}}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}instantiate(e){return re(this,null,function*(){var c,l;const t=(c=e==null?void 0:e.recursive)!=null?c:!0,i=(l=e==null?void 0:e.cloneMaterial)!=null?l:!1,{objectType:r,objectOptions:a}=this;let u=e==null?void 0:e.create,s;return this.objectType==="BaseObject"?s=this.lead.createBaseObject(this.object3d.clone(!1),{target:(e==null?void 0:e.target)||this.parent}):(u===void 0&&(u=f=>{var h;if(this.object3d){if((h=e==null?void 0:e.instancedAttr)!=null&&h.length){const p=e.instancedAttr.length;if(this.object3d instanceof o.Sprite)f.object3d=Be(this.object3d,p);else{const d=this.object3d,v=i?this.cloneMaterial():d.material;f.object3d=new o.InstancedMesh(d.geometry,v,p)}Ie(f.object3d,e==null?void 0:e.instancedAttr)}else f.object3d=this.object3d.clone(!1),i&&f.object3d.material&&(f.object3d.material=this.cloneMaterial());f.object3d.userData.prefab&&delete f.object3d.userData.prefab}}),s=yield this.lead.draw(r,R(_({},a||{}),{create:u,prefab:!1,keyType:this.keyType,key:(e==null?void 0:e.key)||this.keyName,uId:(e==null?void 0:e.uId)||this.keyUId,target:(e==null?void 0:e.target)||this.parent}))),this.isBloom&&s.enableBloom(),t&&(yield Promise.all(this.children.map(f=>f.instantiate({key:f.keyUId?`${f.keyName}-${f.keyUId}`:f.key,uId:e==null?void 0:e.uId,cloneMaterial:i,target:s})))),s.isInstantiate=!0,s})}erase(){this.lead.erase(this)}handleMaterialChange(e){}enableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!0),this.isBloom=!0}disableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!1),this.isBloom=!1}dispose(){var e;if(super.dispose(),(e=this.pencil.composerController)==null||e.bloomSelection.delete(this),this.lead&&(this.lead.objects.delete(this.key),this.lead.objectWrapChindIdMap.delete(this),this.object3d&&this.lead.objMap.delete(this.object3d)),this.disposeTrack){const t=new fe;t.disposeMaterial=!1,t.track(this),t.dispose()}}}function Te(n,e){return n.map(t=>{const i=[];let r;return t.forEach(a=>{if(r){const u=E.geoDistance(a,r)*180/Math.PI;if(u>e){const s=E.geoInterpolate(r,a),c=1/Math.ceil(u/e);let l=c;for(;l<1;)i.push(s(l)),l+=c}}i.push(r=a)}),i})}function Ve(n,{minLng:e,maxLng:t,minLat:i,maxLat:r}={}){const a=Math.round(te(360/n,2)/Math.PI),u=(1+Math.sqrt(5))/2,s=d=>d/u*360%360-180,c=d=>Math.acos(2*d/a-1)/Math.PI*180-90,l=d=>a*(Math.cos((d+90)*Math.PI/180)+1)/2,f=[r!==void 0?Math.ceil(l(r)):0,i!==void 0?Math.floor(l(i)):a-1],h=e===void 0&&t===void 0?()=>!0:e===void 0?d=>d<=t:t===void 0?d=>d>=e:t>=e?d=>d>=e&&d<=t:d=>d>=e||d<=t,p=[];for(let d=f[0];d<=f[1];d++){const v=s(d);h(v)&&p.push([v,c(d)])}return p}function Z(n,e,t=!1){return t?E.geoContains(e,n):Me(n,e)}function Oe(n,e){const t={type:"Polygon",coordinates:n},[[i,r],[a,u]]=E.geoBounds(t);if(Math.min(Math.abs(a-i),Math.abs(u-r))<e)return[];const s=i>a||u>=89||r<=-89;return Ve(e,{minLng:i,maxLng:a,minLat:r,maxLat:u}).filter(c=>Z(c,t,s))}function ze(n,{resolution:e=1/0,bbox:t,projection:i}={}){const r=Te(n,e),a=L.merge(r),u=Oe(n,e),s=[...a,...u],c={type:"Polygon",coordinates:n},[[l,f],[h,p]]=E.geoBounds(c),d=l>h||p>=89||f<=-89;let v=[];if(d){const b=xe.geoVoronoi(s).triangles(),S=new Map(s.map(([C,B],O)=>[`${C}-${B}`,O]));b.features.forEach(C=>{const B=C.geometry.coordinates[0].slice(0,3).reverse(),O=[];if(B.forEach(([I,q])=>{const k=`${I}-${q}`;S.has(k)&&O.push(S.get(k))}),O.length===3){if(O.some(I=>I<a.length)){const I=C.properties.circumcenter;if(!Z(I,c,d))return}v.push(...O)}})}else if(u.length){const b=ge.from(s);for(let S=0,C=b.triangles.length;S<C;S+=3){const B=[2,1,0].map(I=>b.triangles[S+I]),O=B.map(I=>s[I]);if(B.some(I=>I<a.length)){const I=[0,1].map(q=>L.mean(O,k=>k[q]));if(!Z(I,c,d))continue}v.push(...B)}}else{const{vertices:b,holes:S=[]}=X.flatten(r);v=X(b,S,2)}let m=t?[t[0],t[2]]:L.extent(s,b=>b[0]),y=t?[t[1],t[3]]:L.extent(s,b=>b[1]);if(i){const[b,S]=i([m[0],y[0]]),[C,B]=i([m[1],y[1]]);m=[b,C],y=[-S,-B]}const w=se.scaleLinear(m,[0,1]),j=se.scaleLinear(y,[0,1]),P=s.map(([b,S])=>{if(i){const[C,B]=i([b,S]);return[w(C),j(-B)]}else return[w(b),j(S)]});return{contour:r,triangles:{points:s,indices:v,uvs:P}}}const oe=new o.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function G(n,e,t,i){const r=n.map(a=>a.map(([u,s])=>{if(i){const[c,l]=i([u,s]);return[c,-l,e]}return t?Q.polar2Cartesian(u,s,e):[u,s,e]}));return X.flatten(r)}function Le(n,e,t,i,r){const{vertices:a,holes:u}=G(n,e,i,r),{vertices:s}=G(n,t,i,r),c=L.merge([s,a]),l=Math.round(s.length/3),f=new Set(u);let h=0;const p=[];for(let v=0;v<l;v++){let m=v+1;if(m===l)m=h;else if(f.has(m)){const y=m;m=h,h=y}p.push(v,v+l,m+l),p.push(m+l,m,v)}const d=[];for(let v=1;v>=0;v--)for(let m=0;m<l;m+=1)d.push(m/(l-1),v);return{indices:p,vertices:c,uvs:d,topVerts:s}}function ae(n,e,t,i,r,a){return{indices:i?n.indices:n.indices.slice().reverse(),vertices:G([n.points],e,r,a).vertices,uvs:t}}const he=({polygonGeoJson:n,startHeight:e,endHeight:t,curvatureResolution:i=1,cartesian:r=!0,hasSide:a=!0,hasBottom:u=!1,hasTop:s=!1,projection:c,bbox:l})=>{n.forEach(w=>{be(w)||w.reverse()});const{contour:f,triangles:h}=ze(n,{resolution:i,bbox:l,projection:c});let p={},d;a&&(p=Le(f,e!=null?e:t,t!=null?t:e,r,c),d=p.topVerts);let v=[];(u||s)&&(v=L.merge(h.uvs));let m={};u&&(m=ae(h,e,v,!1,r,c));let y={};return s&&(y=ae(h,t,v,!0,r,c)),{contour:f,triangles:h,sideTorso:p,bottomCap:m,topCap:y,topVerts:d}};class _e extends o.BufferGeometry{constructor(e,t={}){super(),this.type="PolygonBufferGeometry",this.parameters=_({polygonGeoJson:e,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},t);const{endHeight:i,hasTop:r,topFirst:a,hasBottom:u,hasSide:s,cartesian:c,userDataRsoOffset:l,projection:f}=this.parameters,{contour:h,sideTorso:p,topVerts:d,bottomCap:v,topCap:m}=he(_({},this.parameters));let y=[],w=[],j=[],P=0;const A=b=>{const S=Math.round(y.length/3),C=j.length;y=y.concat(b.vertices),w=w.concat(b.uvs),j=j.concat(S?b.indices.map(B=>B+S):b.indices),this.addGroup(C,j.length-C,P++)};r&&a&&A(m),s&&(A(p),this.userData.topVerts=l?G(h,i+l,c,f).vertices:d),u&&A(v),r&&!a&&A(m),this.setIndex(j),this[oe]("position",new o.Float32BufferAttribute(y,3)),this[oe]("uv",new o.Float32BufferAttribute(w,2)),this.computeVertexNormals()}}const Ee=`
3
+ ${o.vertexShader.replace("gl_PointSize = size;","gl_PointSize = size * scaleAtt;")}
4
+ `},new a.Points(t,r)},Ie=(n,e)=>{const t=new a.Object3D;e.forEach((i,r)=>{const o=Q.parseVector3(i.position),u=Q.parseVector3(i.scale||[1,1,1]);t.position.copy(o),t.scale.copy(u),t.updateMatrix();const s=t.matrix.clone();if(n instanceof a.InstancedMesh||n.isInstantiate)n.setMatrixAt(r,s);else if(n instanceof a.Points||n.type==="Points"){const l=n.geometry,f=l.attributes.position.array,h=l.attributes.scaleAtt.array,p=new a.Vector3,d=new a.Vector3,v=new a.Quaternion,m=r*3,y=r*1;s.decompose(p,v,d),f[m]=p.x,f[m+1]=p.y,f[m+2]=p.z,h[y]=Math.max(d.x,d.y,d.z),l.attributes.position.needsUpdate=!0,l.attributes.scaleAtt.needsUpdate=!0}})};class Pe{constructor(){this.onPointerIndex=[]}onPointerEvent(e,t){const i=this.lead.handlePick([this],e,t);this.onPointerIndex.push(i)}onClick(e){this.onPointerEvent("click",e)}onPointerEnter(e){this.onPointerEvent("enter",e)}onPointerLeave(e){this.onPointerEvent("leave",e)}onPointerMove(e){this.onPointerEvent("move",e)}onPointerDown(e){this.onPointerEvent("down",e)}dispose(){this.onPointerIndex.forEach(e=>{this.lead.removePick(e)})}}class De extends Pe{constructor(){super(...arguments),this.userData={},this.materialList={},this.useMaterialType="origin",this.disposeMaterialIfNotUsed=!0}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(i=>{const r=i.userData;i.userData={};const o=i.clone();return i.userData=r,o});{const i=t.userData;t.userData={};const r=t.clone();return t.userData=i,r}}setMaterialList(e,t){const i=this.object3d;if(!i||!i.material)return;this.materialList.origin||(this.materialList.origin=i.material);const r=t==="clone"?this.cloneMaterial():Array.isArray(t)?t.slice():t;return this.materialList[e]=r,r}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}useMListById(e,t){if(!this.mList)return;const i=this.mList.get(e);if(!i)return;const r=this.object3d;Array.isArray(r.material)&&t!==void 0?r.material[t]=i:r.material=i}useMListByName(e,t){if(!this.mList)return;const i=this.mList.getKeyByName(e);i&&this.useMListById(i,t)}dispose(){super.dispose(),this.mList.rmBaseObjectMap(this,void 0,this.disposeMaterialIfNotUsed)}}class Y extends De{constructor(){super(...arguments),this.key="",this.objectType="BaseObject",this.userData={},this.isPrefab=!1,this.isInstantiate=!1,this.isBloom=!1,this.isBaseObject=!0,this.disposeTrack=!0}get parent(){const e=this.object3d.parent;return e&&this.lead.objMap.get(e)||null}get children(){return this.object3d.children.map(e=>this.lead.objMap.get(e)).filter(e=>!!e)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}get lookAt(){return this.object3d.lookAt}add(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.object3d.add(t):this.lead.createBaseObject(t,{target:this})})}remove(...e){[...e].forEach(t=>{var i;this.lead.objMap.get(t)?(i=this.lead.objMap.get(t))==null||i.erase():this.object3d.remove(t)})}get visible(){return this.object3d.visible}get visibleWithAncestors(){if(this.visible){let e=this.parent;for(;e;){if(!e.visible)return!1;e=e.parent}return!0}else return!1}create(){this.createGroup()}render(){}update(e,t){}resize(e,t){}show(){return this.object3d.visible=!0,this.object3d.layers.set(we),this.isBloom&&this.enableBloom(),this}hide(){return this.object3d.visible=!1,this.object3d.layers.set(Ae),this}createGroup(){return this.object3d=new a.Group,this}createMesh(...e){return this.object3d=new a.Mesh(...e),this}createPoints(...e){return this.object3d=new a.Points(...e),this}createCSS2DObject(e){return this.object3d=new ye.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new ne.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new ne.CSS3DSprite(e),this}createSprite(e){return this.object3d=new a.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d)}),this}getSize(){const e=new a.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new a.Vector3),center:e.getCenter(new a.Vector3)}}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}instantiate(e){return re(this,null,function*(){var c,l;const t=(c=e==null?void 0:e.recursive)!=null?c:!0,i=(l=e==null?void 0:e.cloneMaterial)!=null?l:!1,{objectType:r,objectOptions:o}=this;let u=e==null?void 0:e.create,s;return this.objectType==="BaseObject"?s=this.lead.createBaseObject(this.object3d.clone(!1),{target:(e==null?void 0:e.target)||this.parent}):(u===void 0&&(u=f=>{var h;if(this.object3d){if((h=e==null?void 0:e.instancedAttr)!=null&&h.length){const p=e.instancedAttr.length;if(this.object3d instanceof a.Sprite)f.object3d=Be(this.object3d,p);else{const d=this.object3d,v=i?this.cloneMaterial():d.material;f.object3d=new a.InstancedMesh(d.geometry,v,p)}Ie(f.object3d,e==null?void 0:e.instancedAttr)}else f.object3d=this.object3d.clone(!1),i&&f.object3d.material&&(f.object3d.material=this.cloneMaterial());f.object3d.userData.prefab&&delete f.object3d.userData.prefab}}),s=yield this.lead.draw(r,R(_({},o||{}),{create:u,prefab:!1,keyType:this.keyType,key:(e==null?void 0:e.key)||this.keyName,uId:(e==null?void 0:e.uId)||this.keyUId,target:(e==null?void 0:e.target)||this.parent}))),this.isBloom&&s.enableBloom(),t&&(yield Promise.all(this.children.map(f=>f.instantiate({key:f.keyUId?`${f.keyName}-${f.keyUId}`:f.keyName,uId:e==null?void 0:e.uId,cloneMaterial:i,target:s})))),s.isInstantiate=!0,s})}erase(){this.lead.erase(this)}handleMaterialChange(e){}enableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!0),this.isBloom=!0}disableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!1),this.isBloom=!1}dispose(){var e;if(super.dispose(),(e=this.pencil.composerController)==null||e.bloomSelection.delete(this),this.lead&&(this.lead.objects.delete(this.key),this.lead.objectWrapChindIdMap.delete(this),this.object3d&&this.lead.objMap.delete(this.object3d)),this.disposeTrack){const t=new fe;t.disposeMaterial=!1,t.track(this),t.dispose()}}}function Te(n,e){return n.map(t=>{const i=[];let r;return t.forEach(o=>{if(r){const u=E.geoDistance(o,r)*180/Math.PI;if(u>e){const s=E.geoInterpolate(r,o),c=1/Math.ceil(u/e);let l=c;for(;l<1;)i.push(s(l)),l+=c}}i.push(r=o)}),i})}function Ve(n,{minLng:e,maxLng:t,minLat:i,maxLat:r}={}){const o=Math.round(te(360/n,2)/Math.PI),u=(1+Math.sqrt(5))/2,s=d=>d/u*360%360-180,c=d=>Math.acos(2*d/o-1)/Math.PI*180-90,l=d=>o*(Math.cos((d+90)*Math.PI/180)+1)/2,f=[r!==void 0?Math.ceil(l(r)):0,i!==void 0?Math.floor(l(i)):o-1],h=e===void 0&&t===void 0?()=>!0:e===void 0?d=>d<=t:t===void 0?d=>d>=e:t>=e?d=>d>=e&&d<=t:d=>d>=e||d<=t,p=[];for(let d=f[0];d<=f[1];d++){const v=s(d);h(v)&&p.push([v,c(d)])}return p}function Z(n,e,t=!1){return t?E.geoContains(e,n):Me(n,e)}function Oe(n,e){const t={type:"Polygon",coordinates:n},[[i,r],[o,u]]=E.geoBounds(t);if(Math.min(Math.abs(o-i),Math.abs(u-r))<e)return[];const s=i>o||u>=89||r<=-89;return Ve(e,{minLng:i,maxLng:o,minLat:r,maxLat:u}).filter(c=>Z(c,t,s))}function ze(n,{resolution:e=1/0,bbox:t,projection:i}={}){const r=Te(n,e),o=L.merge(r),u=Oe(n,e),s=[...o,...u],c={type:"Polygon",coordinates:n},[[l,f],[h,p]]=E.geoBounds(c),d=l>h||p>=89||f<=-89;let v=[];if(d){const b=xe.geoVoronoi(s).triangles(),S=new Map(s.map(([C,B],O)=>[`${C}-${B}`,O]));b.features.forEach(C=>{const B=C.geometry.coordinates[0].slice(0,3).reverse(),O=[];if(B.forEach(([I,q])=>{const k=`${I}-${q}`;S.has(k)&&O.push(S.get(k))}),O.length===3){if(O.some(I=>I<o.length)){const I=C.properties.circumcenter;if(!Z(I,c,d))return}v.push(...O)}})}else if(u.length){const b=ge.from(s);for(let S=0,C=b.triangles.length;S<C;S+=3){const B=[2,1,0].map(I=>b.triangles[S+I]),O=B.map(I=>s[I]);if(B.some(I=>I<o.length)){const I=[0,1].map(q=>L.mean(O,k=>k[q]));if(!Z(I,c,d))continue}v.push(...B)}}else{const{vertices:b,holes:S=[]}=X.flatten(r);v=X(b,S,2)}let m=t?[t[0],t[2]]:L.extent(s,b=>b[0]),y=t?[t[1],t[3]]:L.extent(s,b=>b[1]);if(i){const[b,S]=i([m[0],y[0]]),[C,B]=i([m[1],y[1]]);m=[b,C],y=[-S,-B]}const w=se.scaleLinear(m,[0,1]),j=se.scaleLinear(y,[0,1]),P=s.map(([b,S])=>{if(i){const[C,B]=i([b,S]);return[w(C),j(-B)]}else return[w(b),j(S)]});return{contour:r,triangles:{points:s,indices:v,uvs:P}}}const ae=new a.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function G(n,e,t,i){const r=n.map(o=>o.map(([u,s])=>{if(i){const[c,l]=i([u,s]);return[c,-l,e]}return t?Q.polar2Cartesian(u,s,e):[u,s,e]}));return X.flatten(r)}function Le(n,e,t,i,r){const{vertices:o,holes:u}=G(n,e,i,r),{vertices:s}=G(n,t,i,r),c=L.merge([s,o]),l=Math.round(s.length/3),f=new Set(u);let h=0;const p=[];for(let v=0;v<l;v++){let m=v+1;if(m===l)m=h;else if(f.has(m)){const y=m;m=h,h=y}p.push(v,v+l,m+l),p.push(m+l,m,v)}const d=[];for(let v=1;v>=0;v--)for(let m=0;m<l;m+=1)d.push(m/(l-1),v);return{indices:p,vertices:c,uvs:d,topVerts:s}}function oe(n,e,t,i,r,o){return{indices:i?n.indices:n.indices.slice().reverse(),vertices:G([n.points],e,r,o).vertices,uvs:t}}const he=({polygonGeoJson:n,startHeight:e,endHeight:t,curvatureResolution:i=1,cartesian:r=!0,hasSide:o=!0,hasBottom:u=!1,hasTop:s=!1,projection:c,bbox:l})=>{n.forEach(w=>{be(w)||w.reverse()});const{contour:f,triangles:h}=ze(n,{resolution:i,bbox:l,projection:c});let p={},d;o&&(p=Le(f,e!=null?e:t,t!=null?t:e,r,c),d=p.topVerts);let v=[];(u||s)&&(v=L.merge(h.uvs));let m={};u&&(m=oe(h,e,v,!1,r,c));let y={};return s&&(y=oe(h,t,v,!0,r,c)),{contour:f,triangles:h,sideTorso:p,bottomCap:m,topCap:y,topVerts:d}};class _e extends a.BufferGeometry{constructor(e,t={}){super(),this.type="PolygonBufferGeometry",this.parameters=_({polygonGeoJson:e,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},t);const{endHeight:i,hasTop:r,topFirst:o,hasBottom:u,hasSide:s,cartesian:c,userDataRsoOffset:l,projection:f}=this.parameters,{contour:h,sideTorso:p,topVerts:d,bottomCap:v,topCap:m}=he(_({},this.parameters));let y=[],w=[],j=[],P=0;const A=b=>{const S=Math.round(y.length/3),C=j.length;y=y.concat(b.vertices),w=w.concat(b.uvs),j=j.concat(S?b.indices.map(B=>B+S):b.indices),this.addGroup(C,j.length-C,P++)};r&&o&&A(m),s&&(A(p),this.userData.topVerts=l?G(h,i+l,c,f).vertices:d),u&&A(v),r&&!o&&A(m),this.setIndex(j),this[ae]("position",new a.Float32BufferAttribute(y,3)),this[ae]("uv",new a.Float32BufferAttribute(w,2)),this.computeVertexNormals()}}const Ee=`
5
5
  #include <fog_pars_fragment>
6
6
  #include <logdepthbuf_pars_fragment>
7
7
 
@@ -137,4 +137,4 @@ void main() {
137
137
  #include <logdepthbuf_vertex>
138
138
  #include <fog_vertex>
139
139
  }
140
- `;class Ue extends o.ShaderMaterial{constructor(e={}){const j=e,{lineWidth:t=1,color:i="#ffffff",opacity:r=1,map:a=null,dashOffset:u=0,dashArray:s=0,dashRatio:c=0,sizeAttenuation:l=!0,offsetLoop:f=!0,offset:h=new o.Vector2(0,0),scaleDown:p=0,alphaMap:d=void 0,alphaTest:v=0,repeat:m=new o.Vector2(1,1),resolution:y=new o.Vector2(1,1)}=j,w=ie(j,["lineWidth","color","opacity","map","dashOffset","dashArray","dashRatio","sizeAttenuation","offsetLoop","offset","scaleDown","alphaMap","alphaTest","repeat","resolution"]);super(R(_({},w),{uniforms:{lineWidth:{value:t},color:{value:new o.Color(i)},opacity:{value:r},map:{value:a},useMap:{value:a?1:0},resolution:{value:y},sizeAttenuation:{value:l?1:0},offset:{value:h},offsetLoop:{value:f?1:0},dashArray:{value:s},dashOffset:{value:u},dashRatio:{value:c},useDash:{value:s>0?1:0},scaleDown:{value:p/10},alphaTest:{value:v},alphaMap:{value:d},useAlphaMap:{value:d?1:0},repeat:{value:m}},vertexShader:ke,fragmentShader:Ee})),this.type="MeshLineMaterial"}get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=new o.Color(e)}get opacity(){var e;return((e=this.uniforms)==null?void 0:e.opacity.value)||1}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get alphaTest(){return this.uniforms.alphaTest.value}set alphaTest(e){this.uniforms&&(this.uniforms.alphaTest.value=e)}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e,this.uniforms.useMap.value=e?1:0}get repeat(){return this.uniforms.repeat.value}set repeat(e){this.uniforms.repeat.value.copy(e)}get lineWidth(){return this.uniforms.lineWidth.value}set lineWidth(e){this.uniforms.lineWidth.value=e}get sizeAttenuation(){return this.uniforms.sizeAttenuation.value===1}set sizeAttenuation(e){this.uniforms.sizeAttenuation.value=e?1:0}}const F=new o.Vector4,ce=new o.Vector3,le=new o.Vector3,g=new o.Vector4,M=new o.Vector4,D=new o.Vector4,$=new o.Vector3,K=new o.Matrix4,x=new o.Line3,ue=new o.Vector3,W=new o.Box3,N=new o.Sphere,T=new o.Vector4;let V,z;function de(n,e,t){return T.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),T.multiplyScalar(1/T.w),T.x=z/t.width,T.y=z/t.height,T.applyMatrix4(n.projectionMatrixInverse),T.multiplyScalar(1/T.w),Math.abs(Math.max(T.x,T.y))}function We(n,e){const t=n.matrixWorld,i=n.geometry,r=i.attributes.instanceStart,a=i.attributes.instanceEnd,u=Math.min(i.instanceCount,r.count);for(let s=0,c=u;s<c;s++){x.start.fromBufferAttribute(r,s),x.end.fromBufferAttribute(a,s),x.applyMatrix4(t);const l=new o.Vector3,f=new o.Vector3;V.distanceSqToSegment(x.start,x.end,f,l),f.distanceTo(l)<z*.5&&e.push({point:f,pointOnLine:l,distance:V.origin.distanceTo(f),object:n,face:null,faceIndex:s,uv:null,uv1:null})}}function Ne(n,e,t){const i=e.projectionMatrix,a=n.material.resolution,u=n.matrixWorld,s=n.geometry,c=s.attributes.instanceStart,l=s.attributes.instanceEnd,f=Math.min(s.instanceCount,c.count),h=-e.near;V.at(1,D),D.w=1,D.applyMatrix4(e.matrixWorldInverse),D.applyMatrix4(i),D.multiplyScalar(1/D.w),D.x*=a.x/2,D.y*=a.y/2,D.z=0,$.copy(D),K.multiplyMatrices(e.matrixWorldInverse,u);for(let p=0,d=f;p<d;p++){if(g.fromBufferAttribute(c,p),M.fromBufferAttribute(l,p),g.w=1,M.w=1,g.applyMatrix4(K),M.applyMatrix4(K),g.z>h&&M.z>h)continue;if(g.z>h){const P=g.z-M.z,A=(g.z-h)/P;g.lerp(M,A)}else if(M.z>h){const P=M.z-g.z,A=(M.z-h)/P;M.lerp(g,A)}g.applyMatrix4(i),M.applyMatrix4(i),g.multiplyScalar(1/g.w),M.multiplyScalar(1/M.w),g.x*=a.x/2,g.y*=a.y/2,M.x*=a.x/2,M.y*=a.y/2,x.start.copy(g),x.start.z=0,x.end.copy(M),x.end.z=0;const m=x.closestPointToPointParameter($,!0);x.at(m,ue);const y=o.MathUtils.lerp(g.z,M.z,m),w=y>=-1&&y<=1,j=$.distanceTo(ue)<z*.5;if(w&&j){x.start.fromBufferAttribute(c,p),x.end.fromBufferAttribute(l,p),x.start.applyMatrix4(u),x.end.applyMatrix4(u);const P=new o.Vector3,A=new o.Vector3;V.distanceSqToSegment(x.start,x.end,A,P),t.push({point:A,pointOnLine:P,distance:V.origin.distanceTo(A),object:n,face:null,faceIndex:p,uv:null,uv1:null})}}}class Ge extends o.Mesh{constructor(e=new Se.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let u=0,s=0,c=t.count;u<c;u++,s+=2)ce.fromBufferAttribute(t,u),le.fromBufferAttribute(i,u),r[s]=s===0?0:r[s-1],r[s+1]=r[s]+ce.distanceTo(le);const a=new o.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new o.InterleavedBufferAttribute(a,1,0)),e.setAttribute("instanceDistanceEnd",new o.InterleavedBufferAttribute(a,1,1)),this}raycast(e,t){const i=this.material.worldUnits,r=e.camera;r===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const a=e.params.Line2!==void 0&&e.params.Line2.threshold||0;V=e.ray;const u=this.matrixWorld,s=this.geometry,c=this.material;z=c.linewidth+a,s.boundingSphere===null&&s.computeBoundingSphere(),N.copy(s.boundingSphere).applyMatrix4(u);let l;if(i)l=z*.5;else{const h=Math.max(r.near,N.distanceToPoint(V.origin));l=de(r,h,c.resolution)}if(N.radius+=l,V.intersectsSphere(N)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),W.copy(s.boundingBox).applyMatrix4(u);let f;if(i)f=z*.5;else{const h=Math.max(r.near,W.distanceToPoint(V.origin));f=de(r,h,c.resolution)}W.expandByScalar(f),V.intersectsBox(W)!==!1&&(i?We(this,t):Ne(this,r,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(F),this.material.uniforms.resolution.value.set(F.z,F.w))}}exports.BLOOM_SCENE=je;exports.BaseObject=Y;exports.IS_DEV=Ce;exports.LineSegments2=Ge;exports.MeshLineMaterial=Ue;exports.PolygonGeometry=_e;exports.ResourceTracker=fe;exports.getMetas=he;
140
+ `;class Ne extends a.ShaderMaterial{constructor(e={}){const j=e,{lineWidth:t=1,color:i="#ffffff",opacity:r=1,map:o=null,dashOffset:u=0,dashArray:s=0,dashRatio:c=0,sizeAttenuation:l=!0,offsetLoop:f=!0,offset:h=new a.Vector2(0,0),scaleDown:p=0,alphaMap:d=void 0,alphaTest:v=0,repeat:m=new a.Vector2(1,1),resolution:y=new a.Vector2(1,1)}=j,w=ie(j,["lineWidth","color","opacity","map","dashOffset","dashArray","dashRatio","sizeAttenuation","offsetLoop","offset","scaleDown","alphaMap","alphaTest","repeat","resolution"]);super(R(_({},w),{uniforms:{lineWidth:{value:t},color:{value:new a.Color(i)},opacity:{value:r},map:{value:o},useMap:{value:o?1:0},resolution:{value:y},sizeAttenuation:{value:l?1:0},offset:{value:h},offsetLoop:{value:f?1:0},dashArray:{value:s},dashOffset:{value:u},dashRatio:{value:c},useDash:{value:s>0?1:0},scaleDown:{value:p/10},alphaTest:{value:v},alphaMap:{value:d},useAlphaMap:{value:d?1:0},repeat:{value:m}},vertexShader:ke,fragmentShader:Ee})),this.type="MeshLineMaterial"}get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=new a.Color(e)}get opacity(){var e;return((e=this.uniforms)==null?void 0:e.opacity.value)||1}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get alphaTest(){return this.uniforms.alphaTest.value}set alphaTest(e){this.uniforms&&(this.uniforms.alphaTest.value=e)}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e,this.uniforms.useMap.value=e?1:0}get repeat(){return this.uniforms.repeat.value}set repeat(e){this.uniforms.repeat.value.copy(e)}get lineWidth(){return this.uniforms.lineWidth.value}set lineWidth(e){this.uniforms.lineWidth.value=e}get sizeAttenuation(){return this.uniforms.sizeAttenuation.value===1}set sizeAttenuation(e){this.uniforms.sizeAttenuation.value=e?1:0}}const F=new a.Vector4,ce=new a.Vector3,le=new a.Vector3,g=new a.Vector4,M=new a.Vector4,D=new a.Vector4,$=new a.Vector3,K=new a.Matrix4,x=new a.Line3,ue=new a.Vector3,U=new a.Box3,W=new a.Sphere,T=new a.Vector4;let V,z;function de(n,e,t){return T.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),T.multiplyScalar(1/T.w),T.x=z/t.width,T.y=z/t.height,T.applyMatrix4(n.projectionMatrixInverse),T.multiplyScalar(1/T.w),Math.abs(Math.max(T.x,T.y))}function Ue(n,e){const t=n.matrixWorld,i=n.geometry,r=i.attributes.instanceStart,o=i.attributes.instanceEnd,u=Math.min(i.instanceCount,r.count);for(let s=0,c=u;s<c;s++){x.start.fromBufferAttribute(r,s),x.end.fromBufferAttribute(o,s),x.applyMatrix4(t);const l=new a.Vector3,f=new a.Vector3;V.distanceSqToSegment(x.start,x.end,f,l),f.distanceTo(l)<z*.5&&e.push({point:f,pointOnLine:l,distance:V.origin.distanceTo(f),object:n,face:null,faceIndex:s,uv:null,uv1:null})}}function We(n,e,t){const i=e.projectionMatrix,o=n.material.resolution,u=n.matrixWorld,s=n.geometry,c=s.attributes.instanceStart,l=s.attributes.instanceEnd,f=Math.min(s.instanceCount,c.count),h=-e.near;V.at(1,D),D.w=1,D.applyMatrix4(e.matrixWorldInverse),D.applyMatrix4(i),D.multiplyScalar(1/D.w),D.x*=o.x/2,D.y*=o.y/2,D.z=0,$.copy(D),K.multiplyMatrices(e.matrixWorldInverse,u);for(let p=0,d=f;p<d;p++){if(g.fromBufferAttribute(c,p),M.fromBufferAttribute(l,p),g.w=1,M.w=1,g.applyMatrix4(K),M.applyMatrix4(K),g.z>h&&M.z>h)continue;if(g.z>h){const P=g.z-M.z,A=(g.z-h)/P;g.lerp(M,A)}else if(M.z>h){const P=M.z-g.z,A=(M.z-h)/P;M.lerp(g,A)}g.applyMatrix4(i),M.applyMatrix4(i),g.multiplyScalar(1/g.w),M.multiplyScalar(1/M.w),g.x*=o.x/2,g.y*=o.y/2,M.x*=o.x/2,M.y*=o.y/2,x.start.copy(g),x.start.z=0,x.end.copy(M),x.end.z=0;const m=x.closestPointToPointParameter($,!0);x.at(m,ue);const y=a.MathUtils.lerp(g.z,M.z,m),w=y>=-1&&y<=1,j=$.distanceTo(ue)<z*.5;if(w&&j){x.start.fromBufferAttribute(c,p),x.end.fromBufferAttribute(l,p),x.start.applyMatrix4(u),x.end.applyMatrix4(u);const P=new a.Vector3,A=new a.Vector3;V.distanceSqToSegment(x.start,x.end,A,P),t.push({point:A,pointOnLine:P,distance:V.origin.distanceTo(A),object:n,face:null,faceIndex:p,uv:null,uv1:null})}}}class Ge extends a.Mesh{constructor(e=new Se.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let u=0,s=0,c=t.count;u<c;u++,s+=2)ce.fromBufferAttribute(t,u),le.fromBufferAttribute(i,u),r[s]=s===0?0:r[s-1],r[s+1]=r[s]+ce.distanceTo(le);const o=new a.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new a.InterleavedBufferAttribute(o,1,0)),e.setAttribute("instanceDistanceEnd",new a.InterleavedBufferAttribute(o,1,1)),this}raycast(e,t){const i=this.material.worldUnits,r=e.camera;r===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;V=e.ray;const u=this.matrixWorld,s=this.geometry,c=this.material;z=c.linewidth+o,s.boundingSphere===null&&s.computeBoundingSphere(),W.copy(s.boundingSphere).applyMatrix4(u);let l;if(i)l=z*.5;else{const h=Math.max(r.near,W.distanceToPoint(V.origin));l=de(r,h,c.resolution)}if(W.radius+=l,V.intersectsSphere(W)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),U.copy(s.boundingBox).applyMatrix4(u);let f;if(i)f=z*.5;else{const h=Math.max(r.near,U.distanceToPoint(V.origin));f=de(r,h,c.resolution)}U.expandByScalar(f),V.intersectsBox(U)!==!1&&(i?Ue(this,t):We(this,r,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(F),this.material.uniforms.resolution.value.set(F.z,F.w))}}exports.BLOOM_SCENE=je;exports.BaseObject=Y;exports.IS_DEV=Ce;exports.LineSegments2=Ge;exports.MeshLineMaterial=Ne;exports.PolygonGeometry=_e;exports.ResourceTracker=fe;exports.getMetas=he;
@@ -1,106 +1,106 @@
1
- var Ct = Object.defineProperty, It = Object.defineProperties;
2
- var Pt = Object.getOwnPropertyDescriptors;
1
+ var Ce = Object.defineProperty, Ie = Object.defineProperties;
2
+ var Pe = Object.getOwnPropertyDescriptors;
3
3
  var V = Object.getOwnPropertySymbols;
4
- var et = Object.prototype.hasOwnProperty, it = Object.prototype.propertyIsEnumerable;
5
- var nt = Math.pow, tt = (s, t, e) => t in s ? Ct(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, k = (s, t) => {
6
- for (var e in t || (t = {}))
7
- et.call(t, e) && tt(s, e, t[e]);
4
+ var te = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
5
+ var ne = Math.pow, ee = (s, e, t) => e in s ? Ce(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, k = (s, e) => {
6
+ for (var t in e || (e = {}))
7
+ te.call(e, t) && ee(s, t, e[t]);
8
8
  if (V)
9
- for (var e of V(t))
10
- it.call(t, e) && tt(s, e, t[e]);
9
+ for (var t of V(e))
10
+ ie.call(e, t) && ee(s, t, e[t]);
11
11
  return s;
12
- }, $ = (s, t) => It(s, Pt(t));
13
- var st = (s, t) => {
14
- var e = {};
12
+ }, $ = (s, e) => Ie(s, Pe(e));
13
+ var se = (s, e) => {
14
+ var t = {};
15
15
  for (var i in s)
16
- et.call(s, i) && t.indexOf(i) < 0 && (e[i] = s[i]);
16
+ te.call(s, i) && e.indexOf(i) < 0 && (t[i] = s[i]);
17
17
  if (s != null && V)
18
18
  for (var i of V(s))
19
- t.indexOf(i) < 0 && it.call(s, i) && (e[i] = s[i]);
20
- return e;
19
+ e.indexOf(i) < 0 && ie.call(s, i) && (t[i] = s[i]);
20
+ return t;
21
21
  };
22
- var rt = (s, t, e) => new Promise((i, n) => {
22
+ var re = (s, e, t) => new Promise((i, n) => {
23
23
  var a = (o) => {
24
24
  try {
25
- r(e.next(o));
25
+ r(t.next(o));
26
26
  } catch (c) {
27
27
  n(c);
28
28
  }
29
29
  }, l = (o) => {
30
30
  try {
31
- r(e.throw(o));
31
+ r(t.throw(o));
32
32
  } catch (c) {
33
33
  n(c);
34
34
  }
35
35
  }, r = (o) => o.done ? i(o.value) : Promise.resolve(o.value).then(a, l);
36
- r((e = e.apply(s, t)).next());
36
+ r((t = t.apply(s, e)).next());
37
37
  });
38
- import { Material as at, Object3D as N, Texture as ot, BufferGeometry as Z, Float32BufferAttribute as R, PointsMaterial as Bt, Points as J, InstancedMesh as xt, Vector3 as P, Quaternion as Dt, Group as Tt, Mesh as wt, Sprite as ct, Box3 as St, ShaderMaterial as zt, Vector2 as q, Color as lt, Vector4 as E, Matrix4 as Ot, Line3 as _t, Sphere as kt, InstancedInterleavedBuffer as Et, InterleavedBufferAttribute as ut, MathUtils as Lt } from "three";
39
- import { CSS2DObject as Vt } from "three/examples/jsm/renderers/CSS2DRenderer";
40
- import { CSS3DObject as Ut, CSS3DSprite as Wt } from "three/examples/jsm/renderers/CSS3DRenderer";
41
- import { geoBounds as jt, geoContains as Nt, geoDistance as Rt, geoInterpolate as Gt } from "d3-geo";
38
+ import { Material as ae, Object3D as N, Texture as oe, BufferGeometry as Z, Float32BufferAttribute as R, PointsMaterial as Be, Points as J, InstancedMesh as xe, Vector3 as P, Quaternion as De, Group as Te, Mesh as we, Sprite as ce, Box3 as Se, ShaderMaterial as ze, Vector2 as q, Color as le, Vector4 as E, Matrix4 as Oe, Line3 as _e, Sphere as ke, InstancedInterleavedBuffer as Ee, InterleavedBufferAttribute as ue, MathUtils as Le } from "three";
39
+ import { CSS2DObject as Ve } from "three/examples/jsm/renderers/CSS2DRenderer";
40
+ import { CSS3DObject as Ue, CSS3DSprite as We } from "three/examples/jsm/renderers/CSS3DRenderer";
41
+ import { geoBounds as je, geoContains as Ne, geoDistance as Re, geoInterpolate as Ge } from "d3-geo";
42
42
  import "d3-geo-projection";
43
- import { p as ft, a as Ft } from "./polar2Cartesian.module.js";
44
- import { merge as H, mean as $t, extent as dt } from "d3-array";
45
- import qt, { flatten as At } from "earcut";
46
- import Kt from "@turf/boolean-clockwise";
47
- import Qt from "delaunator";
48
- import Xt from "@turf/boolean-point-in-polygon";
49
- import { geoVoronoi as Yt } from "d3-geo-voronoi";
50
- import { scaleLinear as ht } from "d3-scale";
51
- import { LineSegmentsGeometry as Zt } from "three/examples/jsm/lines/LineSegmentsGeometry";
52
- const Jt = 0, De = 1, Ht = 2, Te = !1;
53
- class te {
43
+ import { p as fe, a as Fe } from "./polar2Cartesian.module.js";
44
+ import { merge as H, mean as $e, extent as de } from "d3-array";
45
+ import qe, { flatten as Ae } from "earcut";
46
+ import Ke from "@turf/boolean-clockwise";
47
+ import Qe from "delaunator";
48
+ import Xe from "@turf/boolean-point-in-polygon";
49
+ import { geoVoronoi as Ye } from "d3-geo-voronoi";
50
+ import { scaleLinear as he } from "d3-scale";
51
+ import { LineSegmentsGeometry as Ze } from "three/examples/jsm/lines/LineSegmentsGeometry";
52
+ const Je = 0, Dt = 1, He = 2, Tt = !1;
53
+ class et {
54
54
  constructor() {
55
55
  this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
56
56
  }
57
- track(t) {
58
- if (!t)
59
- return t;
60
- if (Array.isArray(t))
61
- return t.forEach((e) => this.track(e)), t;
62
- if (!this.disposeMaterial && t instanceof at)
63
- return t;
64
- if (t instanceof pt ? (t.disposeTrack && t.object3d ? this.track(t.object3d) : this.resources.add(t), Object.values(t.materialList).map((e) => this.track(e))) : (t instanceof N || Reflect.has(t, "dispose")) && this.resources.add(t), t instanceof pt)
65
- t.children.forEach((e) => {
66
- e.disposeTrack = !1;
67
- }), this.track(t.children);
68
- else if (t instanceof N) {
69
- const e = t;
70
- this.track(e.geometry), this.track(e.material), this.track(e.children);
71
- } else if (t instanceof at) {
72
- for (const i of Object.values(t))
73
- i instanceof ot && this.track(i);
74
- const e = t;
75
- if (e.uniforms) {
76
- for (const i of Object.values(e.uniforms))
57
+ track(e) {
58
+ if (!e)
59
+ return e;
60
+ if (Array.isArray(e))
61
+ return e.forEach((t) => this.track(t)), e;
62
+ if (!this.disposeMaterial && e instanceof ae)
63
+ return e;
64
+ if (e instanceof pe ? (e.disposeTrack && e.object3d ? this.track(e.object3d) : this.resources.add(e), Object.values(e.materialList).map((t) => this.track(t))) : (e instanceof N || Reflect.has(e, "dispose")) && this.resources.add(e), e instanceof pe)
65
+ e.children.forEach((t) => {
66
+ t.disposeTrack = !1;
67
+ }), this.track(e.children);
68
+ else if (e instanceof N) {
69
+ const t = e;
70
+ this.track(t.geometry), this.track(t.material), this.track(t.children);
71
+ } else if (e instanceof ae) {
72
+ for (const i of Object.values(e))
73
+ i instanceof oe && this.track(i);
74
+ const t = e;
75
+ if (t.uniforms) {
76
+ for (const i of Object.values(t.uniforms))
77
77
  if (i) {
78
78
  const n = i.value;
79
- (n instanceof ot || Array.isArray(n)) && this.track(n);
79
+ (n instanceof oe || Array.isArray(n)) && this.track(n);
80
80
  }
81
81
  }
82
- } else this.disposeVideo && t.isVideoTexture && t.source.data && this.resources.add(t.source.data);
83
- return t;
82
+ } else this.disposeVideo && e.isVideoTexture && e.source.data && this.resources.add(e.source.data);
83
+ return e;
84
84
  }
85
85
  dispose() {
86
- const t = [];
87
- for (const e of this.resources)
88
- e instanceof N ? t.push(e) : e instanceof HTMLVideoElement && e.pause(), Reflect.has(e, "dispose") && e.dispose();
89
- t.forEach((e) => {
90
- e.removeFromParent();
91
- }), t.length = 0, this.resources.clear();
86
+ const e = [];
87
+ for (const t of this.resources)
88
+ t instanceof N ? e.push(t) : t instanceof HTMLVideoElement && t.pause(), Reflect.has(t, "dispose") && t.dispose();
89
+ e.forEach((t) => {
90
+ t.removeFromParent();
91
+ }), e.length = 0, this.resources.clear();
92
92
  }
93
93
  }
94
- const ee = (s, t = 1) => {
95
- const e = new Z();
96
- e.setAttribute(
94
+ const tt = (s, e = 1) => {
95
+ const t = new Z();
96
+ t.setAttribute(
97
97
  "position",
98
- new R(new Array(t * 3).fill(0), 3)
99
- ), e.setAttribute(
98
+ new R(new Array(e * 3).fill(0), 3)
99
+ ), t.setAttribute(
100
100
  "scaleAtt",
101
- new R(new Array(t).fill(1), 1)
101
+ new R(new Array(e).fill(1), 1)
102
102
  );
103
- const i = s.material, n = new Bt({
103
+ const i = s.material, n = new Be({
104
104
  size: 10,
105
105
  map: i.map,
106
106
  alphaMap: i.alphaMap,
@@ -121,99 +121,99 @@ const ee = (s, t = 1) => {
121
121
  "gl_PointSize = size * scaleAtt;"
122
122
  )}
123
123
  `;
124
- }, new J(e, n);
125
- }, ie = (s, t) => {
126
- const e = new N();
127
- t.forEach((i, n) => {
128
- const a = ft(i.position), l = ft(i.scale || [1, 1, 1]);
129
- e.position.copy(a), e.scale.copy(l), e.updateMatrix();
130
- const r = e.matrix.clone();
131
- if (s instanceof xt || s.isInstantiate)
124
+ }, new J(t, n);
125
+ }, it = (s, e) => {
126
+ const t = new N();
127
+ e.forEach((i, n) => {
128
+ const a = fe(i.position), l = fe(i.scale || [1, 1, 1]);
129
+ t.position.copy(a), t.scale.copy(l), t.updateMatrix();
130
+ const r = t.matrix.clone();
131
+ if (s instanceof xe || s.isInstantiate)
132
132
  s.setMatrixAt(n, r);
133
133
  else if (s instanceof J || s.type === "Points") {
134
- const c = s.geometry, f = c.attributes.position.array, d = c.attributes.scaleAtt.array, h = new P(), u = new P(), m = new Dt(), p = n * 3, v = n * 1;
134
+ const c = s.geometry, f = c.attributes.position.array, d = c.attributes.scaleAtt.array, h = new P(), u = new P(), m = new De(), p = n * 3, v = n * 1;
135
135
  r.decompose(h, m, u), f[p] = h.x, f[p + 1] = h.y, f[p + 2] = h.z, d[v] = Math.max(u.x, u.y, u.z), c.attributes.position.needsUpdate = !0, c.attributes.scaleAtt.needsUpdate = !0;
136
136
  }
137
137
  });
138
138
  };
139
- class ne {
139
+ class nt {
140
140
  constructor() {
141
141
  this.onPointerIndex = [];
142
142
  }
143
- onPointerEvent(t, e) {
144
- const i = this.lead.handlePick([this], t, e);
143
+ onPointerEvent(e, t) {
144
+ const i = this.lead.handlePick([this], e, t);
145
145
  this.onPointerIndex.push(i);
146
146
  }
147
- onClick(t) {
148
- this.onPointerEvent("click", t);
147
+ onClick(e) {
148
+ this.onPointerEvent("click", e);
149
149
  }
150
- onPointerEnter(t) {
151
- this.onPointerEvent("enter", t);
150
+ onPointerEnter(e) {
151
+ this.onPointerEvent("enter", e);
152
152
  }
153
- onPointerLeave(t) {
154
- this.onPointerEvent("leave", t);
153
+ onPointerLeave(e) {
154
+ this.onPointerEvent("leave", e);
155
155
  }
156
- onPointerMove(t) {
157
- this.onPointerEvent("move", t);
156
+ onPointerMove(e) {
157
+ this.onPointerEvent("move", e);
158
158
  }
159
- onPointerDown(t) {
160
- this.onPointerEvent("down", t);
159
+ onPointerDown(e) {
160
+ this.onPointerEvent("down", e);
161
161
  }
162
162
  dispose() {
163
- this.onPointerIndex.forEach((t) => {
164
- this.lead.removePick(t);
163
+ this.onPointerIndex.forEach((e) => {
164
+ this.lead.removePick(e);
165
165
  });
166
166
  }
167
167
  }
168
- class se extends ne {
168
+ class st extends nt {
169
169
  constructor() {
170
170
  super(...arguments), this.userData = {}, this.materialList = {}, this.useMaterialType = "origin", this.disposeMaterialIfNotUsed = !0;
171
171
  }
172
172
  cloneMaterial() {
173
- const t = this.object3d;
174
- if (!t || !t.material)
173
+ const e = this.object3d;
174
+ if (!e || !e.material)
175
175
  return;
176
- const e = t.material;
177
- if (Array.isArray(e))
178
- return e.map((i) => {
176
+ const t = e.material;
177
+ if (Array.isArray(t))
178
+ return t.map((i) => {
179
179
  const n = i.userData;
180
180
  i.userData = {};
181
181
  const a = i.clone();
182
182
  return i.userData = n, a;
183
183
  });
184
184
  {
185
- const i = e.userData;
186
- e.userData = {};
187
- const n = e.clone();
188
- return e.userData = i, n;
185
+ const i = t.userData;
186
+ t.userData = {};
187
+ const n = t.clone();
188
+ return t.userData = i, n;
189
189
  }
190
190
  }
191
- setMaterialList(t, e) {
191
+ setMaterialList(e, t) {
192
192
  const i = this.object3d;
193
193
  if (!i || !i.material)
194
194
  return;
195
195
  this.materialList.origin || (this.materialList.origin = i.material);
196
- const n = e === "clone" ? this.cloneMaterial() : Array.isArray(e) ? e.slice() : e;
197
- return this.materialList[t] = n, n;
196
+ const n = t === "clone" ? this.cloneMaterial() : Array.isArray(t) ? t.slice() : t;
197
+ return this.materialList[e] = n, n;
198
198
  }
199
- useMaterial(t) {
200
- const e = this.object3d;
201
- !e || !e.material || this.useMaterialType === t || !this.materialList[t] || (this.useMaterialType = t, e.material = this.materialList[t]);
199
+ useMaterial(e) {
200
+ const t = this.object3d;
201
+ !t || !t.material || this.useMaterialType === e || !this.materialList[e] || (this.useMaterialType = e, t.material = this.materialList[e]);
202
202
  }
203
- useMListById(t, e) {
203
+ useMListById(e, t) {
204
204
  if (!this.mList)
205
205
  return;
206
- const i = this.mList.get(t);
206
+ const i = this.mList.get(e);
207
207
  if (!i)
208
208
  return;
209
209
  const n = this.object3d;
210
- Array.isArray(n.material) && e !== void 0 ? n.material[e] = i : n.material = i;
210
+ Array.isArray(n.material) && t !== void 0 ? n.material[t] = i : n.material = i;
211
211
  }
212
- useMListByName(t, e) {
212
+ useMListByName(e, t) {
213
213
  if (!this.mList)
214
214
  return;
215
- const i = this.mList.getKeyByName(t);
216
- i && this.useMListById(i, e);
215
+ const i = this.mList.getKeyByName(e);
216
+ i && this.useMListById(i, t);
217
217
  }
218
218
  dispose() {
219
219
  super.dispose(), this.mList.rmBaseObjectMap(
@@ -223,16 +223,16 @@ class se extends ne {
223
223
  );
224
224
  }
225
225
  }
226
- class pt extends se {
226
+ class pe extends st {
227
227
  constructor() {
228
228
  super(...arguments), this.key = "", this.objectType = "BaseObject", this.userData = {}, this.isPrefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.isBaseObject = !0, this.disposeTrack = !0;
229
229
  }
230
230
  get parent() {
231
- const t = this.object3d.parent;
232
- return t && this.lead.objMap.get(t) || null;
231
+ const e = this.object3d.parent;
232
+ return e && this.lead.objMap.get(e) || null;
233
233
  }
234
234
  get children() {
235
- return this.object3d.children.map((t) => this.lead.objMap.get(t)).filter((t) => !!t);
235
+ return this.object3d.children.map((e) => this.lead.objMap.get(e)).filter((e) => !!e);
236
236
  }
237
237
  get position() {
238
238
  return this.object3d.position;
@@ -246,17 +246,17 @@ class pt extends se {
246
246
  get lookAt() {
247
247
  return this.object3d.lookAt;
248
248
  }
249
- add(...t) {
250
- [...t].forEach((e) => {
251
- this.lead.objMap.get(e) ? this.object3d.add(e) : this.lead.createBaseObject(e, {
249
+ add(...e) {
250
+ [...e].forEach((t) => {
251
+ this.lead.objMap.get(t) ? this.object3d.add(t) : this.lead.createBaseObject(t, {
252
252
  target: this
253
253
  });
254
254
  });
255
255
  }
256
- remove(...t) {
257
- [...t].forEach((e) => {
256
+ remove(...e) {
257
+ [...e].forEach((t) => {
258
258
  var i;
259
- this.lead.objMap.get(e) ? (i = this.lead.objMap.get(e)) == null || i.erase() : this.object3d.remove(e);
259
+ this.lead.objMap.get(t) ? (i = this.lead.objMap.get(t)) == null || i.erase() : this.object3d.remove(t);
260
260
  });
261
261
  }
262
262
  get visible() {
@@ -264,11 +264,11 @@ class pt extends se {
264
264
  }
265
265
  get visibleWithAncestors() {
266
266
  if (this.visible) {
267
- let t = this.parent;
268
- for (; t; ) {
269
- if (!t.visible)
267
+ let e = this.parent;
268
+ for (; e; ) {
269
+ if (!e.visible)
270
270
  return !1;
271
- t = t.parent;
271
+ e = e.parent;
272
272
  }
273
273
  return !0;
274
274
  } else
@@ -279,82 +279,82 @@ class pt extends se {
279
279
  }
280
280
  render() {
281
281
  }
282
- update(t, e) {
282
+ update(e, t) {
283
283
  }
284
- resize(t, e) {
284
+ resize(e, t) {
285
285
  }
286
286
  show() {
287
- return this.object3d.visible = !0, this.object3d.layers.set(Jt), this.isBloom && this.enableBloom(), this;
287
+ return this.object3d.visible = !0, this.object3d.layers.set(Je), this.isBloom && this.enableBloom(), this;
288
288
  }
289
289
  hide() {
290
- return this.object3d.visible = !1, this.object3d.layers.set(Ht), this;
290
+ return this.object3d.visible = !1, this.object3d.layers.set(He), this;
291
291
  }
292
292
  createGroup() {
293
- return this.object3d = new Tt(), this;
293
+ return this.object3d = new Te(), this;
294
294
  }
295
- createMesh(...t) {
296
- return this.object3d = new wt(...t), this;
295
+ createMesh(...e) {
296
+ return this.object3d = new we(...e), this;
297
297
  }
298
- createPoints(...t) {
299
- return this.object3d = new J(...t), this;
298
+ createPoints(...e) {
299
+ return this.object3d = new J(...e), this;
300
300
  }
301
- createCSS2DObject(t) {
302
- return this.object3d = new Vt(t), this;
301
+ createCSS2DObject(e) {
302
+ return this.object3d = new Ve(e), this;
303
303
  }
304
- createCSS3DObject(t) {
305
- return this.object3d = new Ut(t), this;
304
+ createCSS3DObject(e) {
305
+ return this.object3d = new Ue(e), this;
306
306
  }
307
- createCSS3DSprite(t) {
308
- return this.object3d = new Wt(t), this;
307
+ createCSS3DSprite(e) {
308
+ return this.object3d = new We(e), this;
309
309
  }
310
- createSprite(t) {
311
- return this.object3d = new ct(t), this;
310
+ createSprite(e) {
311
+ return this.object3d = new ce(e), this;
312
312
  }
313
- attach(...t) {
314
- return [...t].forEach((e) => {
315
- this.object3d.attach(e.object3d);
313
+ attach(...e) {
314
+ return [...e].forEach((t) => {
315
+ this.object3d.attach(t.object3d);
316
316
  }), this;
317
317
  }
318
318
  getSize() {
319
- const t = new St().setFromObject(this.object3d);
319
+ const e = new Se().setFromObject(this.object3d);
320
320
  return {
321
- min: t.min,
322
- max: t.max,
323
- size: t.getSize(new P()),
324
- center: t.getCenter(new P())
321
+ min: e.min,
322
+ max: e.max,
323
+ size: e.getSize(new P()),
324
+ center: e.getCenter(new P())
325
325
  };
326
326
  }
327
- setTop(t) {
328
- this.object3d && (this.object3d.renderOrder = t);
327
+ setTop(e) {
328
+ this.object3d && (this.object3d.renderOrder = e);
329
329
  }
330
- traverse(t) {
331
- t(this), this.children.forEach((e) => {
332
- e.traverse(t);
330
+ traverse(e) {
331
+ e(this), this.children.forEach((t) => {
332
+ t.traverse(e);
333
333
  });
334
334
  }
335
- instantiate(t) {
336
- return rt(this, null, function* () {
335
+ instantiate(e) {
336
+ return re(this, null, function* () {
337
337
  var o, c;
338
- const e = (o = t == null ? void 0 : t.recursive) != null ? o : !0, i = (c = t == null ? void 0 : t.cloneMaterial) != null ? c : !1, { objectType: n, objectOptions: a } = this;
339
- let l = t == null ? void 0 : t.create, r;
338
+ const t = (o = e == null ? void 0 : e.recursive) != null ? o : !0, i = (c = e == null ? void 0 : e.cloneMaterial) != null ? c : !1, { objectType: n, objectOptions: a } = this;
339
+ let l = e == null ? void 0 : e.create, r;
340
340
  return this.objectType === "BaseObject" ? r = this.lead.createBaseObject(this.object3d.clone(!1), {
341
- target: (t == null ? void 0 : t.target) || this.parent
341
+ target: (e == null ? void 0 : e.target) || this.parent
342
342
  }) : (l === void 0 && (l = (f) => {
343
343
  var d;
344
344
  if (this.object3d) {
345
- if ((d = t == null ? void 0 : t.instancedAttr) != null && d.length) {
346
- const h = t.instancedAttr.length;
347
- if (this.object3d instanceof ct)
348
- f.object3d = ee(this.object3d, h);
345
+ if ((d = e == null ? void 0 : e.instancedAttr) != null && d.length) {
346
+ const h = e.instancedAttr.length;
347
+ if (this.object3d instanceof ce)
348
+ f.object3d = tt(this.object3d, h);
349
349
  else {
350
350
  const u = this.object3d, m = i ? this.cloneMaterial() : u.material;
351
- f.object3d = new xt(
351
+ f.object3d = new xe(
352
352
  u.geometry,
353
353
  m,
354
354
  h
355
355
  );
356
356
  }
357
- ie(f.object3d, t == null ? void 0 : t.instancedAttr);
357
+ it(f.object3d, e == null ? void 0 : e.instancedAttr);
358
358
  } else
359
359
  f.object3d = this.object3d.clone(!1), i && f.object3d.material && (f.object3d.material = this.cloneMaterial());
360
360
  f.object3d.userData.prefab && delete f.object3d.userData.prefab;
@@ -363,14 +363,14 @@ class pt extends se {
363
363
  create: l,
364
364
  prefab: !1,
365
365
  keyType: this.keyType,
366
- key: (t == null ? void 0 : t.key) || this.keyName,
367
- uId: (t == null ? void 0 : t.uId) || this.keyUId,
368
- target: (t == null ? void 0 : t.target) || this.parent
369
- }))), this.isBloom && r.enableBloom(), e && (yield Promise.all(
366
+ key: (e == null ? void 0 : e.key) || this.keyName,
367
+ uId: (e == null ? void 0 : e.uId) || this.keyUId,
368
+ target: (e == null ? void 0 : e.target) || this.parent
369
+ }))), this.isBloom && r.enableBloom(), t && (yield Promise.all(
370
370
  this.children.map(
371
371
  (f) => f.instantiate({
372
- key: f.keyUId ? `${f.keyName}-${f.keyUId}` : f.key,
373
- uId: t == null ? void 0 : t.uId,
372
+ key: f.keyUId ? `${f.keyName}-${f.keyUId}` : f.keyName,
373
+ uId: e == null ? void 0 : e.uId,
374
374
  cloneMaterial: i,
375
375
  target: r
376
376
  })
@@ -381,33 +381,33 @@ class pt extends se {
381
381
  erase() {
382
382
  this.lead.erase(this);
383
383
  }
384
- handleMaterialChange(t) {
384
+ handleMaterialChange(e) {
385
385
  }
386
386
  enableBloom() {
387
- var t;
388
- (t = this.pencil.composerController) == null || t.setBloomSelection(this, !0), this.isBloom = !0;
387
+ var e;
388
+ (e = this.pencil.composerController) == null || e.setBloomSelection(this, !0), this.isBloom = !0;
389
389
  }
390
390
  disableBloom() {
391
- var t;
392
- (t = this.pencil.composerController) == null || t.setBloomSelection(this, !1), this.isBloom = !1;
391
+ var e;
392
+ (e = this.pencil.composerController) == null || e.setBloomSelection(this, !1), this.isBloom = !1;
393
393
  }
394
394
  dispose() {
395
- var t;
396
- if (super.dispose(), (t = this.pencil.composerController) == null || t.bloomSelection.delete(this), this.lead && (this.lead.objects.delete(this.key), this.lead.objectWrapChindIdMap.delete(this), this.object3d && this.lead.objMap.delete(this.object3d)), this.disposeTrack) {
397
- const e = new te();
398
- e.disposeMaterial = !1, e.track(this), e.dispose();
395
+ var e;
396
+ if (super.dispose(), (e = this.pencil.composerController) == null || e.bloomSelection.delete(this), this.lead && (this.lead.objects.delete(this.key), this.lead.objectWrapChindIdMap.delete(this), this.object3d && this.lead.objMap.delete(this.object3d)), this.disposeTrack) {
397
+ const t = new et();
398
+ t.disposeMaterial = !1, t.track(this), t.dispose();
399
399
  }
400
400
  }
401
401
  }
402
- function re(s, t) {
403
- return s.map((e) => {
402
+ function rt(s, e) {
403
+ return s.map((t) => {
404
404
  const i = [];
405
405
  let n;
406
- return e.forEach((a) => {
406
+ return t.forEach((a) => {
407
407
  if (n) {
408
- const l = Rt(a, n) * 180 / Math.PI;
409
- if (l > t) {
410
- const r = Gt(n, a), o = 1 / Math.ceil(l / t);
408
+ const l = Re(a, n) * 180 / Math.PI;
409
+ if (l > e) {
410
+ const r = Ge(n, a), o = 1 / Math.ceil(l / e);
411
411
  let c = o;
412
412
  for (; c < 1; )
413
413
  i.push(r(c)), c += o;
@@ -417,41 +417,41 @@ function re(s, t) {
417
417
  }), i;
418
418
  });
419
419
  }
420
- function ae(s, { minLng: t, maxLng: e, minLat: i, maxLat: n } = {}) {
421
- const a = Math.round(nt(360 / s, 2) / Math.PI), l = (1 + Math.sqrt(5)) / 2, r = (u) => u / l * 360 % 360 - 180, o = (u) => Math.acos(2 * u / a - 1) / Math.PI * 180 - 90, c = (u) => a * (Math.cos((u + 90) * Math.PI / 180) + 1) / 2, f = [
420
+ function at(s, { minLng: e, maxLng: t, minLat: i, maxLat: n } = {}) {
421
+ const a = Math.round(ne(360 / s, 2) / Math.PI), l = (1 + Math.sqrt(5)) / 2, r = (u) => u / l * 360 % 360 - 180, o = (u) => Math.acos(2 * u / a - 1) / Math.PI * 180 - 90, c = (u) => a * (Math.cos((u + 90) * Math.PI / 180) + 1) / 2, f = [
422
422
  n !== void 0 ? Math.ceil(c(n)) : 0,
423
423
  i !== void 0 ? Math.floor(c(i)) : a - 1
424
- ], d = t === void 0 && e === void 0 ? () => !0 : t === void 0 ? (u) => u <= e : e === void 0 ? (u) => u >= t : e >= t ? (u) => u >= t && u <= e : (u) => u >= t || u <= e, h = [];
424
+ ], d = e === void 0 && t === void 0 ? () => !0 : e === void 0 ? (u) => u <= t : t === void 0 ? (u) => u >= e : t >= e ? (u) => u >= e && u <= t : (u) => u >= e || u <= t, h = [];
425
425
  for (let u = f[0]; u <= f[1]; u++) {
426
426
  const m = r(u);
427
427
  d(m) && h.push([m, o(u)]);
428
428
  }
429
429
  return h;
430
430
  }
431
- function Y(s, t, e = !1) {
432
- return e ? Nt(t, s) : Xt(s, t);
431
+ function Y(s, e, t = !1) {
432
+ return t ? Ne(e, s) : Xe(s, e);
433
433
  }
434
- function oe(s, t) {
435
- const e = { type: "Polygon", coordinates: s }, [[i, n], [a, l]] = jt(e);
436
- if (Math.min(Math.abs(a - i), Math.abs(l - n)) < t)
434
+ function ot(s, e) {
435
+ const t = { type: "Polygon", coordinates: s }, [[i, n], [a, l]] = je(t);
436
+ if (Math.min(Math.abs(a - i), Math.abs(l - n)) < e)
437
437
  return [];
438
438
  const r = i > a || l >= 89 || n <= -89;
439
- return ae(t, {
439
+ return at(e, {
440
440
  minLng: i,
441
441
  maxLng: a,
442
442
  minLat: n,
443
443
  maxLat: l
444
444
  }).filter(
445
- (o) => Y(o, e, r)
445
+ (o) => Y(o, t, r)
446
446
  );
447
447
  }
448
- function ce(s, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
449
- const n = re(s, t), a = H(n), l = oe(s, t), r = [...a, ...l], o = { type: "Polygon", coordinates: s }, [[c, f], [d, h]] = jt(o), u = c > d || // crosses antimeridian
448
+ function ct(s, { resolution: e = 1 / 0, bbox: t, projection: i } = {}) {
449
+ const n = rt(s, e), a = H(n), l = ot(s, e), r = [...a, ...l], o = { type: "Polygon", coordinates: s }, [[c, f], [d, h]] = je(o), u = c > d || // crosses antimeridian
450
450
  h >= 89 || // crosses north pole
451
451
  f <= -89;
452
452
  let m = [];
453
453
  if (u) {
454
- const y = Yt(r).triangles(), x = new Map(
454
+ const y = Ye(r).triangles(), x = new Map(
455
455
  r.map(([A, C], O) => [`${A}-${C}`, O])
456
456
  );
457
457
  y.features.forEach((A) => {
@@ -473,12 +473,12 @@ function ce(s, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
473
473
  }
474
474
  });
475
475
  } else if (l.length) {
476
- const y = Qt.from(r);
476
+ const y = Qe.from(r);
477
477
  for (let x = 0, A = y.triangles.length; x < A; x += 3) {
478
478
  const C = [2, 1, 0].map((I) => y.triangles[x + I]), O = C.map((I) => r[I]);
479
479
  if (C.some((I) => I < a.length)) {
480
480
  const I = [0, 1].map(
481
- (F) => $t(O, (L) => L[F])
481
+ (F) => $e(O, (L) => L[F])
482
482
  );
483
483
  if (!Y(
484
484
  I,
@@ -490,15 +490,15 @@ function ce(s, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
490
490
  m.push(...C);
491
491
  }
492
492
  } else {
493
- const { vertices: y, holes: x = [] } = At(n);
494
- m = qt(y, x, 2);
493
+ const { vertices: y, holes: x = [] } = Ae(n);
494
+ m = qe(y, x, 2);
495
495
  }
496
- let p = e ? [e[0], e[2]] : dt(r, (y) => y[0]), v = e ? [e[1], e[3]] : dt(r, (y) => y[1]);
496
+ let p = t ? [t[0], t[2]] : de(r, (y) => y[0]), v = t ? [t[1], t[3]] : de(r, (y) => y[1]);
497
497
  if (i) {
498
498
  const [y, x] = i([p[0], v[0]]), [A, C] = i([p[1], v[1]]);
499
499
  p = [y, A], v = [-x, -C];
500
500
  }
501
- const w = ht(p, [0, 1]), S = ht(v, [0, 1]), B = r.map(([y, x]) => {
501
+ const w = he(p, [0, 1]), S = he(v, [0, 1]), B = r.map(([y, x]) => {
502
502
  if (i) {
503
503
  const [A, C] = i([y, x]);
504
504
  return [w(A), S(-C)];
@@ -507,28 +507,28 @@ function ce(s, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
507
507
  });
508
508
  return { contour: n, triangles: { points: r, indices: m, uvs: B } };
509
509
  }
510
- const mt = new Z().setAttribute ? "setAttribute" : "addAttribute";
511
- function G(s, t, e, i) {
510
+ const me = new Z().setAttribute ? "setAttribute" : "addAttribute";
511
+ function G(s, e, t, i) {
512
512
  const n = s.map(
513
513
  (a) => a.map(([l, r]) => {
514
514
  if (i) {
515
515
  const [o, c] = i([l, r]);
516
- return [o, -c, t];
516
+ return [o, -c, e];
517
517
  }
518
- return e ? Ft(l, r, t) : [l, r, t];
518
+ return t ? Fe(l, r, e) : [l, r, e];
519
519
  })
520
520
  );
521
- return At(n);
521
+ return Ae(n);
522
522
  }
523
- function le(s, t, e, i, n) {
523
+ function lt(s, e, t, i, n) {
524
524
  const { vertices: a, holes: l } = G(
525
525
  s,
526
- t,
526
+ e,
527
527
  i,
528
528
  n
529
529
  ), { vertices: r } = G(
530
530
  s,
531
- e,
531
+ t,
532
532
  i,
533
533
  n
534
534
  ), o = H([r, a]), c = Math.round(r.length / 3), f = new Set(l);
@@ -549,22 +549,22 @@ function le(s, t, e, i, n) {
549
549
  for (let p = 0; p < c; p += 1) u.push(p / (c - 1), m);
550
550
  return { indices: h, vertices: o, uvs: u, topVerts: r };
551
551
  }
552
- function vt(s, t, e, i, n, a) {
552
+ function ve(s, e, t, i, n, a) {
553
553
  return {
554
554
  indices: i ? s.indices : s.indices.slice().reverse(),
555
555
  vertices: G(
556
556
  [s.points],
557
- t,
557
+ e,
558
558
  n,
559
559
  a
560
560
  ).vertices,
561
- uvs: e
561
+ uvs: t
562
562
  };
563
563
  }
564
- const ue = ({
564
+ const ut = ({
565
565
  polygonGeoJson: s,
566
- startHeight: t,
567
- endHeight: e,
566
+ startHeight: e,
567
+ endHeight: t,
568
568
  curvatureResolution: i = 1,
569
569
  cartesian: n = !0,
570
570
  hasSide: a = !0,
@@ -574,46 +574,46 @@ const ue = ({
574
574
  bbox: c
575
575
  }) => {
576
576
  s.forEach((w) => {
577
- Kt(w) || w.reverse();
577
+ Ke(w) || w.reverse();
578
578
  });
579
- const { contour: f, triangles: d } = ce(s, {
579
+ const { contour: f, triangles: d } = ct(s, {
580
580
  resolution: i,
581
581
  bbox: c,
582
582
  projection: o
583
583
  });
584
584
  let h = {}, u;
585
- a && (h = le(
585
+ a && (h = lt(
586
586
  f,
587
- t != null ? t : e,
588
587
  e != null ? e : t,
588
+ t != null ? t : e,
589
589
  n,
590
590
  o
591
591
  ), u = h.topVerts);
592
592
  let m = [];
593
593
  (l || r) && (m = H(d.uvs));
594
594
  let p = {};
595
- l && (p = vt(
595
+ l && (p = ve(
596
596
  d,
597
- t,
597
+ e,
598
598
  m,
599
599
  !1,
600
600
  n,
601
601
  o
602
602
  ));
603
603
  let v = {};
604
- return r && (v = vt(
604
+ return r && (v = ve(
605
605
  d,
606
- e,
606
+ t,
607
607
  m,
608
608
  !0,
609
609
  n,
610
610
  o
611
611
  )), { contour: f, triangles: d, sideTorso: h, bottomCap: p, topCap: v, topVerts: u };
612
612
  };
613
- class ze extends Z {
614
- constructor(t, e = {}) {
613
+ class zt extends Z {
614
+ constructor(e, t = {}) {
615
615
  super(), this.type = "PolygonBufferGeometry", this.parameters = k({
616
- polygonGeoJson: t,
616
+ polygonGeoJson: e,
617
617
  startHeight: 0,
618
618
  endHeight: 1,
619
619
  hasTop: !0,
@@ -623,7 +623,7 @@ class ze extends Z {
623
623
  curvatureResolution: 1,
624
624
  cartesian: !0,
625
625
  userDataRsoOffset: 0
626
- }, e);
626
+ }, t);
627
627
  const {
628
628
  endHeight: i,
629
629
  hasTop: n,
@@ -633,7 +633,7 @@ class ze extends Z {
633
633
  cartesian: o,
634
634
  userDataRsoOffset: c,
635
635
  projection: f
636
- } = this.parameters, { contour: d, sideTorso: h, topVerts: u, bottomCap: m, topCap: p } = ue(k({}, this.parameters));
636
+ } = this.parameters, { contour: d, sideTorso: h, topVerts: u, bottomCap: m, topCap: p } = ut(k({}, this.parameters));
637
637
  let v = [], w = [], S = [], B = 0;
638
638
  const j = (y) => {
639
639
  const x = Math.round(v.length / 3), A = S.length;
@@ -646,10 +646,10 @@ class ze extends Z {
646
646
  i + c,
647
647
  o,
648
648
  f
649
- ).vertices : u), l && j(m), n && !a && j(p), this.setIndex(S), this[mt]("position", new R(v, 3)), this[mt]("uv", new R(w, 2)), this.computeVertexNormals();
649
+ ).vertices : u), l && j(m), n && !a && j(p), this.setIndex(S), this[me]("position", new R(v, 3)), this[me]("uv", new R(w, 2)), this.computeVertexNormals();
650
650
  }
651
651
  }
652
- const fe = `
652
+ const ft = `
653
653
  #include <fog_pars_fragment>
654
654
  #include <logdepthbuf_pars_fragment>
655
655
 
@@ -693,7 +693,7 @@ void main() {
693
693
  #include <tonemapping_fragment>
694
694
  #include <colorspace_fragment>
695
695
  }
696
- `, de = `
696
+ `, dt = `
697
697
  #include <common>
698
698
  #include <logdepthbuf_pars_vertex>
699
699
  #include <fog_pars_vertex>
@@ -786,10 +786,10 @@ void main() {
786
786
  #include <fog_vertex>
787
787
  }
788
788
  `;
789
- class Oe extends zt {
790
- constructor(t = {}) {
791
- const S = t, {
792
- lineWidth: e = 1,
789
+ class Ot extends ze {
790
+ constructor(e = {}) {
791
+ const S = e, {
792
+ lineWidth: t = 1,
793
793
  color: i = "#ffffff",
794
794
  opacity: n = 1,
795
795
  map: a = null,
@@ -804,7 +804,7 @@ class Oe extends zt {
804
804
  alphaTest: m = 0,
805
805
  repeat: p = new q(1, 1),
806
806
  resolution: v = new q(1, 1)
807
- } = S, w = st(S, [
807
+ } = S, w = se(S, [
808
808
  "lineWidth",
809
809
  "color",
810
810
  "opacity",
@@ -823,8 +823,8 @@ class Oe extends zt {
823
823
  ]);
824
824
  super($(k({}, w), {
825
825
  uniforms: {
826
- lineWidth: { value: e },
827
- color: { value: new lt(i) },
826
+ lineWidth: { value: t },
827
+ color: { value: new le(i) },
828
828
  opacity: { value: n },
829
829
  map: { value: a },
830
830
  useMap: { value: a ? 1 : 0 },
@@ -842,69 +842,69 @@ class Oe extends zt {
842
842
  useAlphaMap: { value: u ? 1 : 0 },
843
843
  repeat: { value: p }
844
844
  },
845
- vertexShader: de,
846
- fragmentShader: fe
845
+ vertexShader: dt,
846
+ fragmentShader: ft
847
847
  })), this.type = "MeshLineMaterial";
848
848
  }
849
849
  // Getter and setter for color
850
850
  get color() {
851
851
  return this.uniforms.color.value;
852
852
  }
853
- set color(t) {
854
- this.uniforms.color.value = new lt(t);
853
+ set color(e) {
854
+ this.uniforms.color.value = new le(e);
855
855
  }
856
856
  get opacity() {
857
- var t;
858
- return ((t = this.uniforms) == null ? void 0 : t.opacity.value) || 1;
857
+ var e;
858
+ return ((e = this.uniforms) == null ? void 0 : e.opacity.value) || 1;
859
859
  }
860
- set opacity(t) {
861
- this.uniforms && (this.uniforms.opacity.value = t);
860
+ set opacity(e) {
861
+ this.uniforms && (this.uniforms.opacity.value = e);
862
862
  }
863
863
  get alphaTest() {
864
864
  return this.uniforms.alphaTest.value;
865
865
  }
866
- set alphaTest(t) {
867
- this.uniforms && (this.uniforms.alphaTest.value = t);
866
+ set alphaTest(e) {
867
+ this.uniforms && (this.uniforms.alphaTest.value = e);
868
868
  }
869
869
  // Getter and setter for map
870
870
  get map() {
871
871
  return this.uniforms.map.value;
872
872
  }
873
- set map(t) {
874
- this.uniforms.map.value = t, this.uniforms.useMap.value = t ? 1 : 0;
873
+ set map(e) {
874
+ this.uniforms.map.value = e, this.uniforms.useMap.value = e ? 1 : 0;
875
875
  }
876
876
  get repeat() {
877
877
  return this.uniforms.repeat.value;
878
878
  }
879
- set repeat(t) {
880
- this.uniforms.repeat.value.copy(t);
879
+ set repeat(e) {
880
+ this.uniforms.repeat.value.copy(e);
881
881
  }
882
882
  // Getter and setter for lineWidth
883
883
  get lineWidth() {
884
884
  return this.uniforms.lineWidth.value;
885
885
  }
886
- set lineWidth(t) {
887
- this.uniforms.lineWidth.value = t;
886
+ set lineWidth(e) {
887
+ this.uniforms.lineWidth.value = e;
888
888
  }
889
889
  // Getter and setter for sizeAttenuation
890
890
  get sizeAttenuation() {
891
891
  return this.uniforms.sizeAttenuation.value === 1;
892
892
  }
893
- set sizeAttenuation(t) {
894
- this.uniforms.sizeAttenuation.value = t ? 1 : 0;
893
+ set sizeAttenuation(e) {
894
+ this.uniforms.sizeAttenuation.value = e ? 1 : 0;
895
895
  }
896
896
  }
897
- const K = new E(), yt = new P(), bt = new P(), b = new E(), g = new E(), D = new E(), Q = new P(), X = new Ot(), M = new _t(), gt = new P(), U = new St(), W = new kt(), T = new E();
897
+ const K = new E(), ye = new P(), be = new P(), b = new E(), g = new E(), D = new E(), Q = new P(), X = new Oe(), M = new _e(), ge = new P(), U = new Se(), W = new ke(), T = new E();
898
898
  let z, _;
899
- function Mt(s, t, e) {
900
- return T.set(0, 0, -t, 1).applyMatrix4(s.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = _ / e.width, T.y = _ / e.height, T.applyMatrix4(s.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
899
+ function Me(s, e, t) {
900
+ return T.set(0, 0, -e, 1).applyMatrix4(s.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = _ / t.width, T.y = _ / t.height, T.applyMatrix4(s.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
901
901
  }
902
- function he(s, t) {
903
- const e = s.matrixWorld, i = s.geometry, n = i.attributes.instanceStart, a = i.attributes.instanceEnd, l = Math.min(i.instanceCount, n.count);
902
+ function ht(s, e) {
903
+ const t = s.matrixWorld, i = s.geometry, n = i.attributes.instanceStart, a = i.attributes.instanceEnd, l = Math.min(i.instanceCount, n.count);
904
904
  for (let r = 0, o = l; r < o; r++) {
905
- M.start.fromBufferAttribute(n, r), M.end.fromBufferAttribute(a, r), M.applyMatrix4(e);
905
+ M.start.fromBufferAttribute(n, r), M.end.fromBufferAttribute(a, r), M.applyMatrix4(t);
906
906
  const c = new P(), f = new P();
907
- z.distanceSqToSegment(M.start, M.end, f, c), f.distanceTo(c) < _ * 0.5 && t.push({
907
+ z.distanceSqToSegment(M.start, M.end, f, c), f.distanceTo(c) < _ * 0.5 && e.push({
908
908
  point: f,
909
909
  pointOnLine: c,
910
910
  distance: z.origin.distanceTo(f),
@@ -916,9 +916,9 @@ function he(s, t) {
916
916
  });
917
917
  }
918
918
  }
919
- function pe(s, t, e) {
920
- const i = t.projectionMatrix, a = s.material.resolution, l = s.matrixWorld, r = s.geometry, o = r.attributes.instanceStart, c = r.attributes.instanceEnd, f = Math.min(r.instanceCount, o.count), d = -t.near;
921
- z.at(1, D), D.w = 1, D.applyMatrix4(t.matrixWorldInverse), D.applyMatrix4(i), D.multiplyScalar(1 / D.w), D.x *= a.x / 2, D.y *= a.y / 2, D.z = 0, Q.copy(D), X.multiplyMatrices(t.matrixWorldInverse, l);
919
+ function pt(s, e, t) {
920
+ const i = e.projectionMatrix, a = s.material.resolution, l = s.matrixWorld, r = s.geometry, o = r.attributes.instanceStart, c = r.attributes.instanceEnd, f = Math.min(r.instanceCount, o.count), d = -e.near;
921
+ z.at(1, D), D.w = 1, D.applyMatrix4(e.matrixWorldInverse), D.applyMatrix4(i), D.multiplyScalar(1 / D.w), D.x *= a.x / 2, D.y *= a.y / 2, D.z = 0, Q.copy(D), X.multiplyMatrices(e.matrixWorldInverse, l);
922
922
  for (let h = 0, u = f; h < u; h++) {
923
923
  if (b.fromBufferAttribute(o, h), g.fromBufferAttribute(c, h), b.w = 1, g.w = 1, b.applyMatrix4(X), g.applyMatrix4(X), b.z > d && g.z > d)
924
924
  continue;
@@ -931,12 +931,12 @@ function pe(s, t, e) {
931
931
  }
932
932
  b.applyMatrix4(i), g.applyMatrix4(i), b.multiplyScalar(1 / b.w), g.multiplyScalar(1 / g.w), b.x *= a.x / 2, b.y *= a.y / 2, g.x *= a.x / 2, g.y *= a.y / 2, M.start.copy(b), M.start.z = 0, M.end.copy(g), M.end.z = 0;
933
933
  const p = M.closestPointToPointParameter(Q, !0);
934
- M.at(p, gt);
935
- const v = Lt.lerp(b.z, g.z, p), w = v >= -1 && v <= 1, S = Q.distanceTo(gt) < _ * 0.5;
934
+ M.at(p, ge);
935
+ const v = Le.lerp(b.z, g.z, p), w = v >= -1 && v <= 1, S = Q.distanceTo(ge) < _ * 0.5;
936
936
  if (w && S) {
937
937
  M.start.fromBufferAttribute(o, h), M.end.fromBufferAttribute(c, h), M.start.applyMatrix4(l), M.end.applyMatrix4(l);
938
938
  const B = new P(), j = new P();
939
- z.distanceSqToSegment(M.start, M.end, j, B), e.push({
939
+ z.distanceSqToSegment(M.start, M.end, j, B), t.push({
940
940
  point: j,
941
941
  pointOnLine: B,
942
942
  distance: z.origin.distanceTo(j),
@@ -949,35 +949,35 @@ function pe(s, t, e) {
949
949
  }
950
950
  }
951
951
  }
952
- class _e extends wt {
953
- constructor(t = new Zt(), e) {
954
- super(t, e), this.isLineSegments2 = !0, this.type = "LineSegments2";
952
+ class _t extends we {
953
+ constructor(e = new Ze(), t) {
954
+ super(e, t), this.isLineSegments2 = !0, this.type = "LineSegments2";
955
955
  }
956
956
  // for backwards-compatibility, but could be a method of LineSegmentsGeometry...
957
957
  computeLineDistances() {
958
- const t = this.geometry, e = t.attributes.instanceStart, i = t.attributes.instanceEnd, n = new Float32Array(2 * e.count);
959
- for (let l = 0, r = 0, o = e.count; l < o; l++, r += 2)
960
- yt.fromBufferAttribute(e, l), bt.fromBufferAttribute(i, l), n[r] = r === 0 ? 0 : n[r - 1], n[r + 1] = n[r] + yt.distanceTo(bt);
961
- const a = new Et(
958
+ const e = this.geometry, t = e.attributes.instanceStart, i = e.attributes.instanceEnd, n = new Float32Array(2 * t.count);
959
+ for (let l = 0, r = 0, o = t.count; l < o; l++, r += 2)
960
+ ye.fromBufferAttribute(t, l), be.fromBufferAttribute(i, l), n[r] = r === 0 ? 0 : n[r - 1], n[r + 1] = n[r] + ye.distanceTo(be);
961
+ const a = new Ee(
962
962
  n,
963
963
  2,
964
964
  1
965
965
  );
966
- return t.setAttribute(
966
+ return e.setAttribute(
967
967
  "instanceDistanceStart",
968
- new ut(a, 1, 0)
969
- ), t.setAttribute(
968
+ new ue(a, 1, 0)
969
+ ), e.setAttribute(
970
970
  "instanceDistanceEnd",
971
- new ut(a, 1, 1)
971
+ new ue(a, 1, 1)
972
972
  ), this;
973
973
  }
974
- raycast(t, e) {
975
- const i = this.material.worldUnits, n = t.camera;
974
+ raycast(e, t) {
975
+ const i = this.material.worldUnits, n = e.camera;
976
976
  n === null && !i && console.error(
977
977
  'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
978
978
  );
979
- const a = t.params.Line2 !== void 0 && t.params.Line2.threshold || 0;
980
- z = t.ray;
979
+ const a = e.params.Line2 !== void 0 && e.params.Line2.threshold || 0;
980
+ z = e.ray;
981
981
  const l = this.matrixWorld, r = this.geometry, o = this.material;
982
982
  _ = o.linewidth + a, r.boundingSphere === null && r.computeBoundingSphere(), W.copy(r.boundingSphere).applyMatrix4(l);
983
983
  let c;
@@ -988,7 +988,7 @@ class _e extends wt {
988
988
  n.near,
989
989
  W.distanceToPoint(z.origin)
990
990
  );
991
- c = Mt(
991
+ c = Me(
992
992
  n,
993
993
  d,
994
994
  o.resolution
@@ -1005,26 +1005,26 @@ class _e extends wt {
1005
1005
  n.near,
1006
1006
  U.distanceToPoint(z.origin)
1007
1007
  );
1008
- f = Mt(
1008
+ f = Me(
1009
1009
  n,
1010
1010
  d,
1011
1011
  o.resolution
1012
1012
  );
1013
1013
  }
1014
- U.expandByScalar(f), z.intersectsBox(U) !== !1 && (i ? he(this, e) : pe(this, n, e));
1014
+ U.expandByScalar(f), z.intersectsBox(U) !== !1 && (i ? ht(this, t) : pt(this, n, t));
1015
1015
  }
1016
- onBeforeRender(t) {
1017
- const e = this.material.uniforms;
1018
- e && e.resolution && (t.getViewport(K), this.material.uniforms.resolution.value.set(K.z, K.w));
1016
+ onBeforeRender(e) {
1017
+ const t = this.material.uniforms;
1018
+ t && t.resolution && (e.getViewport(K), this.material.uniforms.resolution.value.set(K.z, K.w));
1019
1019
  }
1020
1020
  }
1021
1021
  export {
1022
- De as B,
1023
- Te as I,
1024
- _e as L,
1025
- Oe as M,
1026
- ze as P,
1027
- te as R,
1028
- pt as a,
1029
- ue as g
1022
+ Dt as B,
1023
+ Tt as I,
1024
+ _t as L,
1025
+ Ot as M,
1026
+ zt as P,
1027
+ et as R,
1028
+ pe as a,
1029
+ ut as g
1030
1030
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gl-draw",
3
- "version": "0.16.0-beta.31",
3
+ "version": "0.16.0-beta.32",
4
4
  "author": "gitplus <hstits@gmail.com>",
5
5
  "scripts": {
6
6
  "start": "bundler-dev",