@reall3d/reall3dviewer 0.0.5 → 0.0.6
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/dist/pkg.d.ts +4 -0
- package/dist/pkg.js +164 -164
- package/dist/pkg.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/pkg.umd.cjs
CHANGED
|
@@ -335,7 +335,7 @@
|
|
|
335
335
|
|
|
336
336
|
gl_FragColor = vec4(cycleColor.rgb, alpha * opacity);
|
|
337
337
|
}
|
|
338
|
-
`}const Ni="currentVisibleRadius",Xi="currentLightRadius",$i="realFocusPosition",gn="splatShTexture12",mn="splatShTexture3",Ki="performanceNow",Ma="waterMarkColor",Zi="showWaterMark",yn="splatTexture0",An="splatTexture1",ji="bigSceneMode",qi="lightFactor",Ji="debugEffect",ts="usingIndex",Ta="cycleColor",ka="splatIndex",es="pointMode",ns="markPoint",is="shDegree",jt="viewport",wn="opacity",ss="focal",as="topY";let z=0;z++;const os=`$${z++}`;z++,z++,z++;const rs=`$${z++}`,Ea=`$${z++}`,cs=`$${z++}`,Ia=`$${z++}`,_a=`$${z++}`,Da=`$${z++}`,Pa=`$${z++}`,La=`$${z++}`;z++;const Ra=`$${z++}`,Fa=`$${z++}`;z++;const Ba=`$${z++}`;z++;const Ua=`$${z++}`;z++;const Oa=`$${z++}`,Va=`$${z++}`,za=`$${z++}`,Qa=`$${z++}`,Ha=`$${z++}`,Wa=`$${z++}`,Ga=`$${z++}`,Ya=`$${z++}`;z++;function Na(i){let t=!1;const e=(l,f,g)=>i.on(l,f,g),n=(l,...f)=>i.fire(l,...f);let a=0,o=0;const s=[];let r=0;e(Pi,()=>r),e(Wn,async()=>{const l=new u.InstancedBufferGeometry;l.setIndex([0,1,2,0,2,3]);const f=new Float32Array(4*3),g=new u.BufferAttribute(f,3);l.setAttribute("position",g),g.setXYZ(0,-2,-2,0),g.setXYZ(1,-2,2,0),g.setXYZ(2,2,2,0),g.setXYZ(3,2,-2,0),g.needsUpdate=!0;let h=new u.InstancedBufferGeometry().copy(l);const A=await n(Vt);if(t)return;const m=new Uint32Array(A),y=new u.InstancedBufferAttribute(m,1,!1);return y.setUsage(u.DynamicDrawUsage),y.needsUpdate=!0,h.setAttribute(ka,y),h.instanceCount=0,e(Xn,(M,b,S,k)=>{n(Kn,b),m.set(M,0),y.clearUpdateRanges(),y.addUpdateRange(0,M.length),y.needsUpdate=!0,h.instanceCount=M.length,n(Y),n(nt,{sortTime:`${S} / ${Date.now()-k}`})}),e(Ls,()=>h),e(Jn,()=>{y.array=null,h.dispose()}),h}),e(Gn,async()=>{const l=await n(Vt);if(t)return;const f=1024*2,g=Math.ceil(2*l/f),h=n(_),A=new u.ShaderMaterial({uniforms:n(Hn),vertexShader:Sa(),fragmentShader:ba(),transparent:!0,alphaTest:1,blending:u.NormalBlending,depthTest:h.depthTest!==!1,depthWrite:!1,side:u.DoubleSide}),m=new Uint32Array(f*g*4);let y=new u.DataTexture(m,f,g,u.RGBAIntegerFormat,u.UnsignedIntType);y.internalFormat="RGBA32UI",y.needsUpdate=!0,A.uniforms[yn].value=y;const M=n(J)?g:1,b=new Uint32Array(f*M*4);let S=new u.DataTexture(b,f,M,u.RGBAIntegerFormat,u.UnsignedIntType);S.internalFormat="RGBA32UI",S.needsUpdate=!0,A.uniforms[An].value=S;const k=await n($t,1),x=new Uint32Array(f*k*4);let C=new u.DataTexture(x,f,k,u.RGBAIntegerFormat,u.UnsignedIntType);C.internalFormat="RGBA32UI",C.needsUpdate=!0,A.uniforms[gn].value=C;const v=await n($t,3),D=new Uint32Array(f*v*4);let I=new u.DataTexture(D,f,v,u.RGBAIntegerFormat,u.UnsignedIntType);I.internalFormat="RGBA32UI",I.needsUpdate=!0,A.uniforms[mn].value=I,A.needsUpdate=!0;let T=!1;e($n,E=>{if(!n(J)){if(T&&!E.renderSplatCount)return;T=!E.renderSplatCount}const P=E.txdata;E.txdata=null;const U=new u.DataTexture(P,f,g,u.RGBAIntegerFormat,u.UnsignedIntType);U.onUpdate=()=>{E.textureReady=!0,E.textureReadyTime=Date.now(),d(E),n(di,E.renderSplatCount)},U.internalFormat="RGBA32UI",U.needsUpdate=!0,E.index?(A.uniforms[An].value=U,S=U):(A.uniforms[yn].value=U,y=U),A.needsUpdate=!0,n(Y)}),e(_i,async E=>{if(n(J)||!E||!E.length)return;const P=new Uint32Array(f*await n($t,1)*4),U=new Uint8Array(P.buffer);for(let H=0,st=0;H<E.length;H++)U.set(E[H],st),st+=E[H].byteLength;const O=new u.DataTexture(P,f,k,u.RGBAIntegerFormat,u.UnsignedIntType);O.internalFormat="RGBA32UI",O.needsUpdate=!0,A.uniforms[gn].value=O,A.needsUpdate=!0,n(Y)}),e(Di,async E=>{if(n(J)||!E||!E.length)return;const P=new Uint32Array(f*await n($t,3)*4),U=new Uint8Array(P.buffer);for(let H=0,st=0;H<E.length;H++)U.set(E[H],st),st+=E[H].byteLength;const O=new u.DataTexture(P,f,k,u.RGBAIntegerFormat,u.UnsignedIntType);O.internalFormat="RGBA32UI",O.needsUpdate=!0,A.uniforms[mn].value=O,A.needsUpdate=!0,n(Y)}),e(Nn,()=>A),e(Le,()=>{const E=n(G),{width:P,height:U}=n(xt),O=Math.abs(E.projectionMatrix.elements[0])*.5*P,H=Math.abs(E.projectionMatrix.elements[5])*.5*U,st=n(Nn);st.uniforms[ss].value.set(O,H),st.uniformsNeedUpdate=!0,n(Y)}),e(Re,()=>{const{width:E,height:P}=n(xt);A.uniforms[jt].value.set(E,P),A.uniformsNeedUpdate=!0,n(Y)}),e(Kn,E=>{A.uniforms[ts].value=E,A.uniformsNeedUpdate=!0,n(Y)}),e(zt,E=>{const P=n(_);E===void 0&&(E=!P.pointcloudMode),A.uniforms[es].value=E?1:0,A.uniformsNeedUpdate=!0,P.pointcloudMode=E,n(Y),P.viewerEvents&&(P.viewerEvents.fire(_).pointcloudMode=E)}),e(Zn,E=>{A.uniforms[ji].value=E?1:0,A.uniformsNeedUpdate=!0;const P=n(_);P.bigSceneMode=E,n(Y)}),e(Qt,E=>{A.uniforms[qi].value=E,A.uniformsNeedUpdate=!0;const P=n(_);P.lightFactor=E,n(Y)});let R=!1;return e(jn,E=>{n(J)||R||(R=!0,A.uniforms[as].value=E,A.uniformsNeedUpdate=!0,n(Y))}),e(te,E=>{A.uniforms[Ni].value=E,A.uniformsNeedUpdate=!0,n(Y)}),e(Fe,E=>{A.uniforms[Xi].value=E,A.uniformsNeedUpdate=!0,n(Y)}),e(ee,(E,P,U,O)=>{A.uniforms[ns].value=[E,P,U,O?1:-1],A.uniformsNeedUpdate=!0,n(Y)}),e(Be,(E=!0)=>{A.uniforms[Zi].value=E?1:0,A.uniformsNeedUpdate=!0,n(Y)}),e(qn,E=>{A.uniforms[Ki].value=E,A.uniformsNeedUpdate=!0}),e(Rs,E=>{A.uniforms[Ji].value=E,A.uniformsNeedUpdate=!0}),e(Ue,async E=>{if(n(J))return;const P=await n(en);E<0&&(E=0),E>P&&(E=P),r=E,A.uniforms[is].value=E,A.uniformsNeedUpdate=!0,n(nt,{shDegree:`${E} / max ${P}`}),n(Y)}),e(ti,()=>{A.dispose(),y&&y.dispose(),S&&S.dispose(),C&&C.dispose(),I&&I.dispose()}),A}),e(Yn,async()=>{const l=new u.Mesh(await n(Wn),await n(Gn));return n(Le),n(Re),n(Zn,n(J)),n(zt,n(Ve)),l});function c(){n(Le),n(Re)}window.addEventListener("resize",c),e(oi,()=>{t=!0,window.removeEventListener("resize",c),n(Jn),n(ti)}),e(ri,async()=>{if(n(J))return;let l=.01,f=.01,g=!1,h=0;n(te,f),n(Ut,()=>{if(t||o<=f)return;f+=(o-f)*l,n(te,f);let A=n(ui);A&&!h&&(h=Date.now());let m=f/a;A&&(m>.9||Date.now()-h>2500)?(n(Ve)&&n(ze,!0),n(te,0),g=!0):A&&m>.7?l=Math.min(l*1.2,.3):A&&m>.5?l=Math.min(l*1.2,.2):m>.4&&(l=Math.min(l*1.05,.1))},()=>!t&&!g,3)}),e(ze,(l=!1)=>{if(n(J))return;for(;s.length;)s.pop().stop=!0;const f=n(_),g=a*.001;let h={currentPointMode:f.pointcloudMode,stepRate:.0015,currentLightRadius:g,stop:!1};s.push(h),n(Ut,()=>{t||(h.currentLightRadius+=a*h.stepRate,n(Fe,h.currentLightRadius),h.currentLightRadius>a?(n(zt,!h.currentPointMode),n(Fe,0),h.stop=!0,s.length===1&&s[0]===h&&s.pop(),l&&n(_)?.viewerEvents?.fire(Nt),n(_)?.viewerEvents?.fire(Ti)):h.currentLightRadius/a<.4?h.stepRate=Math.min(h.stepRate*1.02,.03):h.stepRate*=1.04)},()=>!t&&!h.stop)}),e(Hn,()=>({[yn]:{type:"t",value:null},[An]:{type:"t",value:null},[gn]:{type:"t",value:null},[mn]:{type:"t",value:null},[ss]:{type:"v2",value:new u.Vector2},[jt]:{type:"v2",value:new u.Vector2},[ts]:{type:"int",value:0},[es]:{type:"int",value:0},[Ji]:{type:"int",value:1},[ji]:{type:"int",value:0},[is]:{type:"int",value:0},[qi]:{type:"float",value:1},[as]:{type:"float",value:0},[Ni]:{type:"float",value:0},[Xi]:{type:"float",value:0},[ns]:{type:"v4",value:new u.Vector4(0,0,0,-1)},[Ki]:{type:"float",value:performance.now()},[Ma]:{type:"v4",value:new u.Vector4(1,1,0,.5)},[Zi]:{type:"int",value:1}}));const p=n(Rn);p.onmessage=l=>{const f=l.data;f[os]&&n(Xn,f[os],f[rs],f[Pa],f[Da],f[cs])},e(Ii,(l,f,g)=>{n(J)||(o=f,a=g),n($n,l)});function d(l){const f=l.xyz.slice(0);p.postMessage({[La]:!0,[Ua]:f,[Ya]:l.watermarkCount,[rs]:l.index,[Ea]:l.version,[cs]:l.renderSplatCount,[Ia]:l.visibleSplatCount,[_a]:l.modelSplatCount,[Oa]:l.minX,[Va]:l.maxX,[za]:l.minY,[Qa]:l.maxY,[Ha]:l.minZ,[Wa]:l.maxZ},[f.buffer])}}function Xa(i){const t=(a,...o)=>i.fire(a,...o),e=(a,o,s)=>i.on(a,o,s),n=new Set(ea.split(""));e(xi,async(a="",o=!0,s=!0)=>{const r=a.trim().substring(0,100);let c=await t(Pn,r),p=[];for(let b=0;b<c.length;b++){let S=[],k=c[b];for(let x=0;x<k.length;x++)S.push([(k[x]%20-10)*.02,((k[x]/20|0)-10)*.02]);p.push(S)}let d=[],l=r.split("");for(let b=0;b<l.length;b++)d[b]=n.has(l[b])?.22:.4;let f=l.length/2|0,g=d[f]/2,h=!(l.length%2),A=h?0:-g;for(let b=f-1;b>=0;b--){A-=d[b]/2;for(let S of p[b])S[0]+=A;A-=d[b]/2}g=d[f]/2,A=h?0:g;for(let b=p.length-f;b<p.length;b++){A+=d[b]/2;for(let S of p[b])S[0]+=A;A+=d[b]/2}let m=0;for(let b of p)m+=b.length;const y=new Uint8Array(m*F);let M=0;for(let b of p)for(let S of b)y.set(await ua(S[0],S[1],o,s),F*M++);return y})}function vn(i){const t=(e,n,a)=>i.on(e,n,a);t(St,e=>{e.url;const n={...e};delete n.url;const a=JSON.stringify(n,null,2);console.info(a)}),t(Pn,(e="")=>{const n="https://reall3d.com/gsfont/api/getGaussianText",a=new FormData;return a.append("text",e.substring(0,100)),a.append("ver",Ae),new Promise(o=>{fetch(n,{method:"POST",body:a}).then(s=>s.ok?s.json():{}).then(s=>s.success?o(JSON.parse(s.data)):o([])).catch(s=>o([]))})})}function $a(i){let t=!1;const e=(r,c,p)=>i.on(r,c,p),n=(r,...c)=>i.fire(r,...c);e(ei,()=>t=!0);const a=new Map,o=new Map;e(ne,()=>n(at)&&a.set(Date.now(),1)),e(ie,()=>n(at)&&n(_t,a)),e(se,()=>n(at)&&o.set(Date.now(),1)),e(ae,()=>n(at)&&n(_t,o)),e(Mt,()=>{t||(n(se),n(at)&&n(nt,{fov:n(Ot),position:n(Ct,n(bt)),lookAt:n(Ct,n(yt)),lookUp:n(Ct,n(It))}))},!0);let s=0;e(Dt,()=>{t||(n(Bn),n(at)&&(n(ne),!(s++%5)&&n(nt,{fps:n(ie),realFps:n(ae)})))},!0),e(_t,r=>{let c=[],p=Date.now(),d=0;for(const l of r.keys())p-l<=1e3?d++:c.push(l);return c.forEach(l=>r.delete(l)),Math.min(d,30)}),window.addEventListener("beforeunload",()=>n(oe))}function Ka(i){const t={...i};return t.bigSceneMode??(t.bigSceneMode=!1),t.pointcloudMode??(t.pointcloudMode=!t.bigSceneMode),t.lightFactor??(t.lightFactor=1),t.name??(t.name=""),t.showWatermark??(t.showWatermark=!0),t}function ls(i){const t={...i};return t.position=t.position?[...t.position]:[0,-5,15],t.lookAt=t.lookAt?[...t.lookAt]:[0,0,0],t.lookUp=t.lookUp?[...t.lookUp]:[0,-1,0],t.fov??(t.fov=45),t.near??(t.near=.001),t.far??(t.far=1e3),t.enableDamping??(t.enableDamping=!0),t.autoRotate??(t.autoRotate=!0),t.enableZoom??(t.enableZoom=!0),t.enableRotate??(t.enableRotate=!0),t.enablePan??(t.enablePan=!0),t.enableKeyboard??(t.enableKeyboard=!0),t.bigSceneMode??(t.bigSceneMode=!1),t.pointcloudMode??(t.pointcloudMode=!t.bigSceneMode),t.lightFactor??(t.lightFactor=1.1),t.maxRenderCountOfMobile??(t.maxRenderCountOfMobile=t.bigSceneMode?256*1e4:384*10240),t.maxRenderCountOfPc??(t.maxRenderCountOfPc=t.bigSceneMode?320*1e4:384*1e4),t.debugMode??(t.debugMode=location.protocol==="http:"||/^test\./.test(location.host)),t.markMode??(t.markMode=!1),t.markVisible??(t.markVisible=!0),t.meterScale??(t.meterScale=1),t}function Za(i){let t;i.root?t=typeof i.root=="string"?document.querySelector(i.root)||document.querySelector("#gsviewer"):i.root:t=document.querySelector("#gsviewer"),t||(t=document.createElement("div"),t.id="gsviewer",document.body.appendChild(t));let e=null;return i.renderer?e=i.renderer:(e=new u.WebGLRenderer({antialias:!1,stencil:!0,logarithmicDepthBuffer:!0,precision:"highp"}),e.setSize(t.clientWidth,t.clientHeight),e.setPixelRatio(Math.min(devicePixelRatio,2)),i.renderer=e),e.domElement.classList.add("gsviewer-canvas"),t.appendChild(e.domElement),e}function ja(i){let t=i.camera;if(!t){const e=i.renderer.domElement,n=e.width/e.height;let a=new u.Vector3().fromArray(i.lookUp),o=new u.Vector3().fromArray(i.lookAt),s=new u.Vector3().fromArray(i.position);t=new u.PerspectiveCamera(i.fov,n,i.near,i.far),t.position.copy(s),t.up.copy(a).normalize(),t.lookAt(o),i.camera=t}return i.camera}function qa(i){const{renderer:t,scene:e}=i,n={renderer:t,scene:e};return n.viewerEvents=i.viewerEvents,n.debugMode=i.debugMode,n.renderer=i.renderer,n.scene=i.scene,n.controls=i.controls,n.bigSceneMode=i.bigSceneMode,n.pointcloudMode=i.pointcloudMode,n.maxRenderCountOfMobile=i.maxRenderCountOfMobile,n.maxRenderCountOfPc=i.maxRenderCountOfPc,n.lightFactor=i.lightFactor,n.shDegree=i.shDegree,n}function Ja(i){const t=(s,r,c)=>i.on(s,r,c),e=(s,...r)=>i.fire(s,...r),n="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2xldCBpPTA7aSsrO2NvbnN0IEQ9YCQke2krK31gO2krKyxpKyssaSsrO2NvbnN0IFc9YCQke2krK31gLHA9YCQke2krK31gLFM9YCQke2krK31gLHk9YCQke2krK31gLEM9YCQke2krK31gLEE9YCQke2krK31gLFI9YCQke2krK31gLEc9YCQke2krK31gO2krKztjb25zdCBIPWAkJHtpKyt9YCxKPWAkJHtpKyt9YDtpKys7Y29uc3QgVD1gJCR7aSsrfWA7aSsrO2NvbnN0IEs9YCQke2krK31gO2krKztjb25zdCBMPWAkJHtpKyt9YCxOPWAkJHtpKyt9YCxPPWAkJHtpKyt9YCxRPWAkJHtpKyt9YCxfPWAkJHtpKyt9YCxWPWAkJHtpKyt9YCxqPWAkJHtpKyt9YCxQPWAkJHtpKyt9YDtpKys7Y29uc3Qgbm49bmF2aWdhdG9yLnVzZXJBZ2VudC5pbmNsdWRlcygiTW9iaSIpLGI9c2VsZjtsZXQgWD17aW5kZXg6MCx2ZXJzaW9uOjB9LFk9e2luZGV4OjEsdmVyc2lvbjowfSx3PSExLFo7Y29uc3QgdG49LjI7bGV0IGssZj1bXSxNLHo9MCxCO2Z1bmN0aW9uIGFuKG4pe2lmKCF3KXJldHVybjtsZXQgYT1YLnZlcnNpb24+WS52ZXJzaW9uP1g6WTtpZighYS52ZXJzaW9uKXJldHVybjtjb25zdHt4eXo6dCxyZW5kZXJTcGxhdENvdW50Om8sdmlzaWJsZVNwbGF0Q291bnQ6bSxtb2RlbFNwbGF0Q291bnQ6RSx3YXRlcm1hcmtDb3VudDp4LGluZGV4OkYsdmVyc2lvbjp1fT1hO2lmKHo9PT11JiZNYXRoLmFicyhmWzJdLW5bMl0pK01hdGguYWJzKGZbNl0tbls2XSkrTWF0aC5hYnMoZlsxMF0tblsxMF0pK01hdGguYWJzKGZbMTRdLW5bMTRdKTx0bilyZXR1cm47Zj1uLHo9dTtsZXQgST1EYXRlLm5vdygpLGw7aWYoIW8pe2w9bmV3IFVpbnQzMkFycmF5KDApLGIucG9zdE1lc3NhZ2Uoe1tEXTpsLFtTXTpvLFt5XTptLFtDXTpFLFtXXTpGLFtwXTp1LFtSXTowLFtBXTpJfSxbbC5idWZmZXJdKTtyZXR1cm59bGV0IHE9MDtjb25zdCByPW8teDtsPW5ldyBVaW50MzJBcnJheShvKTtjb25zdHttYXhEZXB0aDp2LG1pbkRlcHRoOmR9PWVuKGEsayk7aWYodi1kPD0xZS01KWZvcihsZXQgcz0wO3M8bztzKyspbFtzXT1zO2Vsc2V7bGV0IHM9TWF0aC5taW4ociw2NTUzNSksZz0ocy0xKS8odi1kKSxjPW5ldyBJbnQzMkFycmF5KHMpO2ZvcihsZXQgZT0wLGg9MDtlPHI7ZSsrKWg9KCQobix0WzMqZV0sdFszKmUrMV0sdFszKmUrMl0pLWQpKmd8MCxjW01bZV09aF0rKztmb3IobGV0IGU9MTtlPHM7ZSsrKWNbZV0rPWNbZS0xXTtmb3IobGV0IGU9MDtlPHI7ZSsrKWxbLS1jW01bZV1dXT1lO2lmKHgpe3M9TWF0aC5taW4oTWF0aC5tYXgoeC84fDAsNTEyKSw2NTUzNSksZz0ocy0xKS8odi1kKSxjPW5ldyBJbnQzMkFycmF5KHMpO2ZvcihsZXQgZT1yLGg9MDtlPG87ZSsrKWg9KCQobix0WzMqZV0sdFszKmUrMV0sdFszKmUrMl0pLWQpKmd8MCxjW01bZS1yXT1oXSsrO2ZvcihsZXQgZT0xO2U8cztlKyspY1tlXSs9Y1tlLTFdO2ZvcihsZXQgZT0wO2U8eDtlKyspbFtyKy0tY1tNW2VdXV09citlfX1xPURhdGUubm93KCktSSxiLnBvc3RNZXNzYWdlKHtbRF06bCxbU106byxbeV06bSxbQ106RSxbV106RixbcF06dSxbQV06SSxbUl06cX0sW2wuYnVmZmVyXSl9ZnVuY3Rpb24gJChuLGEsdCxvKXtyZXR1cm4tKG5bMl0qYStuWzZdKnQrblsxMF0qbyl9ZnVuY3Rpb24gZW4obixhKXtsZXQgdD0tMS8wLG89MS8wLG09MDtyZXR1cm4gbT0kKGEsbi5taW5YLG4ubWluWSxuLm1pblopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5taW5YLG4ubWluWSxuLm1heFopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5taW5YLG4ubWF4WSxuLm1pblopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5taW5YLG4ubWF4WSxuLm1heFopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5tYXhYLG4ubWluWSxuLm1pblopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5tYXhYLG4ubWluWSxuLm1heFopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5tYXhYLG4ubWF4WSxuLm1pblopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5tYXhYLG4ubWF4WSxuLm1heFopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSkse21heERlcHRoOnQsbWluRGVwdGg6b319Y29uc3QgVT0oKT0+e2lmKCFaKXtaPSEwO2NvbnN0IG49azthbihuKSxzZXRUaW1lb3V0KCgpPT4hKFo9ITEpJiZuIT09ayYmVSgpKX19O2Iub25tZXNzYWdlPW49Pntjb25zdCBhPW4uZGF0YTtpZihhW0ddKXtsZXQgdD0hQnx8YVtXXT09PTA/WDpZO3QubWluWD1hW0xdLHQubWF4WD1hW05dLHQubWluWT1hW09dLHQubWF4WT1hW1FdLHQubWluWj1hW19dLHQubWF4Wj1hW1ZdLHQueHl6PW5ldyBGbG9hdDMyQXJyYXkoYVtLXS5idWZmZXIpLHQud2F0ZXJtYXJrQ291bnQ9YVtQXSx0LnZlcnNpb249YVtwXSx0LnJlbmRlclNwbGF0Q291bnQ9YVtTXSx0LnZpc2libGVTcGxhdENvdW50PWFbeV0sdC5tb2RlbFNwbGF0Q291bnQ9YVtDXSx0LnRleHR1cmVSZWFkeT0hMCx0LnRleHR1cmVSZWFkeVRpbWU9RGF0ZS5ub3coKX1lbHNlIGFbVF0/KGs9YVtUXSxVKCkpOmFbal0mJihCPWFbSF0sTT1uZXcgSW50MzJBcnJheShhW0pdKSx3PSEwKX19KSgpOwo=",a=URL.createObjectURL(new Blob([atob(n)],{type:"text/javascript"})),o=new Worker(new URL(a,typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Te&&Te.tagName.toUpperCase()==="SCRIPT"&&Te.src||new URL("pkg.umd.cjs",document.baseURI).href),{type:"module"});t(Rn,()=>o),t(Vn,()=>o.postMessage({[Ba]:e(On)})),t(zn,()=>o.terminate()),(async()=>o.postMessage({[Ga]:!0,[Fa]:await e(Vt),[Ra]:e(J)}))()}class lt extends u.Mesh{constructor(t){super(),this.isSplatMesh=!0,this.disposed=!1;const e=new on,n=(r,c,p)=>e.on(r,c,p),a=(r,...c)=>e.fire(r,...c),o=Ka(t),s=o.controls.object;n(_,()=>o),n(Et,()=>o.renderer.domElement),n(G,()=>s),n(Ot,()=>s.fov),n(bt,(r=!1)=>r?s.position.clone():s.position),n(yt,(r=!1)=>r?o.controls.target.clone():o.controls.target),n(On,()=>s.projectionMatrix.clone().multiply(s.matrixWorldInverse).multiply(this.matrix).toArray()),n(_s,()=>s.projectionMatrix.clone().multiply(s.matrixWorldInverse)),n(Ns,()=>s.getWorldDirection(new u.Vector3).toArray()),n(Ht,()=>o.renderer),n(B,()=>o.scene),n(J,()=>o.bigSceneMode),n(Ve,()=>o.pointcloudMode),n(mt,()=>this),n(Y,()=>o.viewerEvents?.fire(K)),pn(e),vn(e),va(e),Ja(e),Na(e),Xa(e),this.name=`${o.name||this.id}`,this.events=e,this.opts=o,(async()=>(this.copy(await e.fire(Yn)),o.matrix&&this.applyMatrix4(o.matrix),this.frustumCulled=!1,this.onBeforeRender=()=>{a(Vn),a(qn,performance.now())},this.onAfterRender=()=>{a(si,1e4)&&a(Y)}))()}options(t){if(this.disposed)return;const e=(a,...o)=>this.events.fire(a,...o),n=this.opts;return t&&(t.pointcloudMode!==void 0&&e(zt,t.pointcloudMode),t.lightFactor!==void 0&&e(Qt,t.lightFactor),t.maxRenderCountOfMobile!==void 0&&(n.maxRenderCountOfMobile=t.maxRenderCountOfMobile),t.maxRenderCountOfPc!==void 0&&(n.maxRenderCountOfPc=t.maxRenderCountOfPc),e(Y)),{...n}}async addModel(t,e){this.disposed||(this.meta=e,await this.events.fire(ii,t,e))}fire(t,...e){if(!this.disposed)return this.events.fire(t,...e)}dispose(){if(this.disposed)return;this.disposed=!0;const t=(e,...n)=>this.events.fire(e,...n);t(vt,this),t(B).remove(this),t(Oe),t(ai),t(zn),t(oi),this.events.clear(),this.events=null,this.opts=null,this.onAfterRender=null}}class to extends u.Object3D{constructor(t=new u.Vector3(0,0,1),e=new u.Vector3(0,0,0),n=1,a=.1,o=16776960,s=n*.2,r=s*.2){super(),this._axis=new u.Vector3,this.type="ArrowHelper";const c=new u.CylinderGeometry(a,a,n,32);c.translate(0,n/2,0);const p=new u.CylinderGeometry(0,r,s,32);p.translate(0,n,0),this.position.copy(e);const d=new u.MeshBasicMaterial({color:o,toneMapped:!1});d.side=u.DoubleSide,this.line=new u.Mesh(c,d),this.line.matrixAutoUpdate=!1,this.line.ignoreIntersect=!0,this.add(this.line);const l=new u.MeshBasicMaterial({color:o,toneMapped:!1});l.side=u.DoubleSide,this.cone=new u.Mesh(p,l),this.cone.matrixAutoUpdate=!1,this.cone.ignoreIntersect=!0,this.add(this.cone),this.setDirection(t),this.renderOrder=99999}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{this._axis.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(this._axis,e)}}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}function eo(i){const t=(A,m,y)=>i.on(A,m,y),e=(A,...m)=>i.fire(A,...m),n=new u.PlaneGeometry(1,1);n.rotateX(-Math.PI/2);const a=new u.MeshBasicMaterial({color:16777215});a.transparent=!0,a.opacity=.6,a.depthTest=!1,a.depthWrite=!1,a.side=u.DoubleSide;const o=new u.Mesh(n,a);o.ignoreIntersect=!0;const s=new u.Vector3(0,-1,0);s.normalize();const r=new u.Vector3(0,0,0),c=.5,p=.01,d=16777062,l=.1,f=.03,g=new to(s,r,c,p,d,l,f),h=new u.Object3D;h.add(o),h.add(g),h.renderOrder=99999,o.renderOrder=99999,h.visible=!1,e(B).add(h),t(Vs,()=>h),t(de,A=>{e(ue,!0),h.visible=A===void 0?!h.visible:A,e(K)}),t(Ye,()=>h.visible),t(ue,(A=!1)=>{if(A||h.visible){const m=new u.Quaternion,y=new u.Vector3(0,-1,0);m.setFromUnitVectors(y,e(It)),h.position.copy(e(yt)),h.quaternion.copy(m)}})}const ds={type:"change"},Sn={type:"start"},us={type:"end"},be=new u.Ray,ps=new u.Plane,no=Math.cos(70*u.MathUtils.DEG2RAD),X=new u.Vector3,it=2*Math.PI,Q={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},bn=1e-6;class fs extends u.Controls{constructor(t,e=null){super(t,e),this.state=Q.NONE,this.enabled=!0,this.target=new u.Vector3,this.cursor=new u.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=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.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:u.MOUSE.ROTATE,MIDDLE:u.MOUSE.DOLLY,RIGHT:u.MOUSE.PAN},this.touches={ONE:u.TOUCH.ROTATE,TWO:u.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new u.Vector3,this._lastQuaternion=new u.Quaternion,this._lastTargetPosition=new u.Vector3,this._quat=new u.Quaternion().setFromUnitVectors(t.up,new u.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new u.Spherical,this._sphericalDelta=new u.Spherical,this._scale=1,this._panOffset=new u.Vector3,this._rotateStart=new u.Vector2,this._rotateEnd=new u.Vector2,this._rotateDelta=new u.Vector2,this._panStart=new u.Vector2,this._panEnd=new u.Vector2,this._panDelta=new u.Vector2,this._dollyStart=new u.Vector2,this._dollyEnd=new u.Vector2,this._dollyDelta=new u.Vector2,this._dollyDirection=new u.Vector3,this._mouse=new u.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=so.bind(this),this._onPointerDown=io.bind(this),this._onPointerUp=ao.bind(this),this._onContextMenu=fo.bind(this),this._onMouseWheel=co.bind(this),this._onKeyDown=lo.bind(this),this._onTouchStart=uo.bind(this),this._onTouchMove=po.bind(this),this._onMouseDown=oo.bind(this),this._onMouseMove=ro.bind(this),this._interceptControlDown=ho.bind(this),this._interceptControlUp=go.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=t}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(ds),this.update(),this.state=Q.NONE}update(t=null){const e=this.object.position;X.copy(e).sub(this.target),X.applyQuaternion(this._quat),this._spherical.setFromVector3(X),this.autoRotate&&this.state===Q.NONE&&this._rotateLeft(this._getAutoRotationAngle(t)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,a=this.maxAzimuthAngle;isFinite(n)&&isFinite(a)&&(n<-Math.PI?n+=it:n>Math.PI&&(n-=it),a<-Math.PI?a+=it:a>Math.PI&&(a-=it),n<=a?this._spherical.theta=Math.max(n,Math.min(a,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+a)/2?Math.max(n,this._spherical.theta):Math.min(a,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let o=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const s=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),o=s!=this._spherical.radius}if(X.setFromSpherical(this._spherical),X.applyQuaternion(this._quatInverse),e.copy(this.target).add(X),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let s=null;if(this.object.isPerspectiveCamera){const r=X.length();s=this._clampDistance(r*this._scale);const c=r-s;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),o=!!c}else if(this.object.isOrthographicCamera){const r=new u.Vector3(this._mouse.x,this._mouse.y,0);r.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),o=c!==this.object.zoom;const p=new u.Vector3(this._mouse.x,this._mouse.y,0);p.unproject(this.object),this.object.position.sub(p).add(r),this.object.updateMatrixWorld(),s=X.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;s!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(s).add(this.object.position):(be.origin.copy(this.object.position),be.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(be.direction))<no?this.object.lookAt(this.target):(ps.setFromNormalAndCoplanarPoint(this.object.up,this.target),be.intersectPlane(ps,this.target))))}else if(this.object.isOrthographicCamera){const s=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),s!==this.object.zoom&&(this.object.updateProjectionMatrix(),o=!0)}return this._scale=1,this._performCursorZoom=!1,o||this._lastPosition.distanceToSquared(this.object.position)>bn||8*(1-this._lastQuaternion.dot(this.object.quaternion))>bn||this._lastTargetPosition.distanceToSquared(this.target)>bn?(this.dispatchEvent(ds),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?it/60*this.autoRotateSpeed*t:it/60/60*this.autoRotateSpeed}_getZoomScale(t){const e=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*e)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,e){X.setFromMatrixColumn(e,0),X.multiplyScalar(-t),this._panOffset.add(X)}_panUp(t,e){this.screenSpacePanning===!0?X.setFromMatrixColumn(e,1):(X.setFromMatrixColumn(e,0),X.crossVectors(this.object.up,X)),X.multiplyScalar(t),this._panOffset.add(X)}_pan(t,e){const n=this.domElement;if(this.object.isPerspectiveCamera){const a=this.object.position;X.copy(a).sub(this.target);let o=X.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*o/n.clientHeight,this.object.matrix),this._panUp(2*e*o/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,e){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),a=t-n.left,o=e-n.top,s=n.width,r=n.height;this._mouse.x=a/s*2-1,this._mouse.y=-(o/r)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(it*this._rotateDelta.x/e.clientHeight),this._rotateUp(it*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let e=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(it*this.rotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),e=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-it*this.rotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),e=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(it*this.rotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),e=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-it*this.rotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),e=!0;break}e&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._rotateStart.set(n,a)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._panStart.set(n,a)}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),n=t.pageX-e.x,a=t.pageY-e.y,o=Math.sqrt(n*n+a*a);this._dollyStart.set(0,o)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const n=this._getSecondPointerPosition(t),a=.5*(t.pageX+n.x),o=.5*(t.pageY+n.y);this._rotateEnd.set(a,o)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(it*this._rotateDelta.x/e.clientHeight),this._rotateUp(it*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._panEnd.set(n,a)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const e=this._getSecondPointerPosition(t),n=t.pageX-e.x,a=t.pageY-e.y,o=Math.sqrt(n*n+a*a);this._dollyEnd.set(0,o),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const s=(t.pageX+e.x)*.5,r=(t.pageY+e.y)*.5;this._updateZoomParameters(s,r)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId){this._pointers.splice(e,1);return}}_isTrackingPointer(t){for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId)return!0;return!1}_trackPointer(t){let e=this._pointerPositions[t.pointerId];e===void 0&&(e=new u.Vector2,this._pointerPositions[t.pointerId]=e),e.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const e=t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[e]}_customWheelEvent(t){const e=t.deltaMode,n={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(e){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function io(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i)))}function so(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function ao(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(us),this.state=Q.NONE;break;case 1:const t=this._pointers[0],e=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:e.x,pageY:e.y});break}}function oo(i){let t;switch(i.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case u.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=Q.DOLLY;break;case u.MOUSE.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Q.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Q.ROTATE}break;case u.MOUSE.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Q.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Q.PAN}break;default:this.state=Q.NONE}this.state!==Q.NONE&&this.dispatchEvent(Sn)}function ro(i){switch(this.state){case Q.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case Q.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case Q.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function co(i){this.enabled===!1||this.enableZoom===!1||this.state!==Q.NONE||(i.preventDefault(),this.dispatchEvent(Sn),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(us))}function lo(i){this.enabled!==!1&&this._handleKeyDown(i)}function uo(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case u.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=Q.TOUCH_ROTATE;break;case u.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=Q.TOUCH_PAN;break;default:this.state=Q.NONE}break;case 2:switch(this.touches.TWO){case u.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=Q.TOUCH_DOLLY_PAN;break;case u.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=Q.TOUCH_DOLLY_ROTATE;break;default:this.state=Q.NONE}break;default:this.state=Q.NONE}this.state!==Q.NONE&&this.dispatchEvent(Sn)}function po(i){switch(this._trackPointer(i),this.state){case Q.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case Q.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case Q.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case Q.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=Q.NONE}}function fo(i){this.enabled!==!1&&i.preventDefault()}function ho(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function go(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class mo extends fs{constructor(t){const e=t.camera;super(e,t.renderer.domElement);const n=this;n.dampingFactor=.1,n.rotateSpeed=.4,n.updateByOptions(t)}updateByOptions(t={}){const e=this;t.enableDamping!==void 0&&(e.enableDamping=t.enableDamping),t.autoRotate!==void 0&&(e.autoRotate=t.autoRotate),t.enableZoom!==void 0&&(e.enableZoom=t.enableZoom),t.enableRotate!==void 0&&(e.enableRotate=t.enableRotate),t.enablePan!==void 0&&(e.enablePan=t.enablePan),t.minDistance!==void 0&&(e.minDistance=t.minDistance),t.maxDistance!==void 0&&(e.maxDistance=t.maxDistance),t.minPolarAngle!==void 0&&(e.minPolarAngle=t.minPolarAngle),t.maxPolarAngle!==void 0&&(e.maxPolarAngle=t.maxPolarAngle),t.fov!==void 0&&(e.object.fov=t.fov),t.near!==void 0&&(e.object.near=t.near),t.far!==void 0&&(e.object.far=t.far),t.position&&e.object.position.fromArray(t.position),t.lookAt&&e.target.fromArray(t.lookAt),t.lookUp&&e.object.up.fromArray(t.lookUp),rt&&e._dollyOut?.(.75),e.updateRotateAxis(),e.update()}updateRotateAxis(){this._quat?.setFromUnitVectors?.(this.object.up,new u.Vector3(0,1,0)),this._quatInverse=this._quat?.clone?.()?.invert?.()}}class yo extends fs{constructor(t,e){super(t,e),this.screenSpacePanning=!1,this.mouseButtons={LEFT:u.MOUSE.PAN,MIDDLE:u.MOUSE.DOLLY,RIGHT:u.MOUSE.ROTATE},this.touches={ONE:u.TOUCH.PAN,TWO:u.TOUCH.DOLLY_ROTATE}}}const hs=new u.Box3,xe=new u.Vector3;class gs extends u.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const t=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],e=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new u.Float32BufferAttribute(t,3)),this.setAttribute("uv",new u.Float32BufferAttribute(e,2))}applyMatrix4(t){const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new u.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new u.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new u.InterleavedBufferAttribute(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new u.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new u.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new u.InterleavedBufferAttribute(n,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new u.WireframeGeometry(t.geometry)),this}fromLineSegments(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new u.Box3);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;t!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(t),hs.setFromBufferAttribute(e),this.boundingBox.union(hs))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new u.Sphere),this.boundingBox===null&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(t!==void 0&&e!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let a=0;for(let o=0,s=t.count;o<s;o++)xe.fromBufferAttribute(t,o),a=Math.max(a,n.distanceToSquared(xe)),xe.fromBufferAttribute(e,o),a=Math.max(a,n.distanceToSquared(xe));this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}u.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new u.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},u.ShaderLib.line={uniforms:u.UniformsUtils.merge([u.UniformsLib.common,u.UniformsLib.fog,u.UniformsLib.line]),vertexShader:`
|
|
338
|
+
`}const Ni="currentVisibleRadius",Xi="currentLightRadius",$i="realFocusPosition",gn="splatShTexture12",mn="splatShTexture3",Ki="performanceNow",Ma="waterMarkColor",Zi="showWaterMark",yn="splatTexture0",An="splatTexture1",ji="bigSceneMode",qi="lightFactor",Ji="debugEffect",ts="usingIndex",Ta="cycleColor",ka="splatIndex",es="pointMode",ns="markPoint",is="shDegree",jt="viewport",wn="opacity",ss="focal",as="topY";let z=0;z++;const os=`$${z++}`;z++,z++,z++;const rs=`$${z++}`,Ea=`$${z++}`,cs=`$${z++}`,Ia=`$${z++}`,_a=`$${z++}`,Da=`$${z++}`,Pa=`$${z++}`,La=`$${z++}`;z++;const Ra=`$${z++}`,Fa=`$${z++}`;z++;const Ba=`$${z++}`;z++;const Ua=`$${z++}`;z++;const Oa=`$${z++}`,Va=`$${z++}`,za=`$${z++}`,Qa=`$${z++}`,Ha=`$${z++}`,Wa=`$${z++}`,Ga=`$${z++}`,Ya=`$${z++}`;z++;function Na(i){let t=!1;const e=(l,f,g)=>i.on(l,f,g),n=(l,...f)=>i.fire(l,...f);let a=0,o=0;const s=[];let r=0;e(Pi,()=>r),e(Wn,async()=>{const l=new u.InstancedBufferGeometry;l.setIndex([0,1,2,0,2,3]);const f=new Float32Array(4*3),g=new u.BufferAttribute(f,3);l.setAttribute("position",g),g.setXYZ(0,-2,-2,0),g.setXYZ(1,-2,2,0),g.setXYZ(2,2,2,0),g.setXYZ(3,2,-2,0),g.needsUpdate=!0;let h=new u.InstancedBufferGeometry().copy(l);const A=await n(Vt);if(t)return;const m=new Uint32Array(A),y=new u.InstancedBufferAttribute(m,1,!1);return y.setUsage(u.DynamicDrawUsage),y.needsUpdate=!0,h.setAttribute(ka,y),h.instanceCount=0,e(Xn,(M,b,S,k)=>{n(Kn,b),m.set(M,0),y.clearUpdateRanges(),y.addUpdateRange(0,M.length),y.needsUpdate=!0,h.instanceCount=M.length,n(Y),n(nt,{sortTime:`${S} / ${Date.now()-k}`})}),e(Ls,()=>h),e(Jn,()=>{y.array=null,h.dispose()}),h}),e(Gn,async()=>{const l=await n(Vt);if(t)return;const f=1024*2,g=Math.ceil(2*l/f),h=n(_),A=new u.ShaderMaterial({uniforms:n(Hn),vertexShader:Sa(),fragmentShader:ba(),transparent:!0,alphaTest:1,blending:u.NormalBlending,depthTest:h.depthTest!==!1,depthWrite:!1,side:u.DoubleSide}),m=new Uint32Array(f*g*4);let y=new u.DataTexture(m,f,g,u.RGBAIntegerFormat,u.UnsignedIntType);y.internalFormat="RGBA32UI",y.needsUpdate=!0,A.uniforms[yn].value=y;const M=n(J)?g:1,b=new Uint32Array(f*M*4);let S=new u.DataTexture(b,f,M,u.RGBAIntegerFormat,u.UnsignedIntType);S.internalFormat="RGBA32UI",S.needsUpdate=!0,A.uniforms[An].value=S;const k=await n($t,1),x=new Uint32Array(f*k*4);let C=new u.DataTexture(x,f,k,u.RGBAIntegerFormat,u.UnsignedIntType);C.internalFormat="RGBA32UI",C.needsUpdate=!0,A.uniforms[gn].value=C;const v=await n($t,3),D=new Uint32Array(f*v*4);let I=new u.DataTexture(D,f,v,u.RGBAIntegerFormat,u.UnsignedIntType);I.internalFormat="RGBA32UI",I.needsUpdate=!0,A.uniforms[mn].value=I,A.needsUpdate=!0;let T=!1;e($n,E=>{if(!n(J)){if(T&&!E.renderSplatCount)return;T=!E.renderSplatCount}const P=E.txdata;E.txdata=null;const U=new u.DataTexture(P,f,g,u.RGBAIntegerFormat,u.UnsignedIntType);U.onUpdate=()=>{E.textureReady=!0,E.textureReadyTime=Date.now(),d(E),n(di,E.renderSplatCount)},U.internalFormat="RGBA32UI",U.needsUpdate=!0,E.index?(A.uniforms[An].value=U,S=U):(A.uniforms[yn].value=U,y=U),A.needsUpdate=!0,n(Y)}),e(_i,async E=>{if(n(J)||!E||!E.length)return;const P=new Uint32Array(f*await n($t,1)*4),U=new Uint8Array(P.buffer);for(let H=0,st=0;H<E.length;H++)U.set(E[H],st),st+=E[H].byteLength;const O=new u.DataTexture(P,f,k,u.RGBAIntegerFormat,u.UnsignedIntType);O.internalFormat="RGBA32UI",O.needsUpdate=!0,A.uniforms[gn].value=O,A.needsUpdate=!0,n(Y)}),e(Di,async E=>{if(n(J)||!E||!E.length)return;const P=new Uint32Array(f*await n($t,3)*4),U=new Uint8Array(P.buffer);for(let H=0,st=0;H<E.length;H++)U.set(E[H],st),st+=E[H].byteLength;const O=new u.DataTexture(P,f,k,u.RGBAIntegerFormat,u.UnsignedIntType);O.internalFormat="RGBA32UI",O.needsUpdate=!0,A.uniforms[mn].value=O,A.needsUpdate=!0,n(Y)}),e(Nn,()=>A),e(Le,()=>{const E=n(G),{width:P,height:U}=n(xt),O=Math.abs(E.projectionMatrix.elements[0])*.5*P,H=Math.abs(E.projectionMatrix.elements[5])*.5*U,st=n(Nn);st.uniforms[ss].value.set(O,H),st.uniformsNeedUpdate=!0,n(Y)}),e(Re,()=>{const{width:E,height:P}=n(xt);A.uniforms[jt].value.set(E,P),A.uniformsNeedUpdate=!0,n(Y)}),e(Kn,E=>{A.uniforms[ts].value=E,A.uniformsNeedUpdate=!0,n(Y)}),e(zt,E=>{const P=n(_);E===void 0&&(E=!P.pointcloudMode),A.uniforms[es].value=E?1:0,A.uniformsNeedUpdate=!0,P.pointcloudMode=E,n(Y),P.viewerEvents&&(P.viewerEvents.fire(_).pointcloudMode=E)}),e(Zn,E=>{A.uniforms[ji].value=E?1:0,A.uniformsNeedUpdate=!0;const P=n(_);P.bigSceneMode=E,n(Y)}),e(Qt,E=>{A.uniforms[qi].value=E,A.uniformsNeedUpdate=!0;const P=n(_);P.lightFactor=E,n(Y)});let R=!1;return e(jn,E=>{n(J)||R||(R=!0,A.uniforms[as].value=E,A.uniformsNeedUpdate=!0,n(Y))}),e(te,E=>{A.uniforms[Ni].value=E,A.uniformsNeedUpdate=!0,n(Y)}),e(Fe,E=>{A.uniforms[Xi].value=E,A.uniformsNeedUpdate=!0,n(Y)}),e(ee,(E,P,U,O)=>{A.uniforms[ns].value=[E,P,U,O?1:-1],A.uniformsNeedUpdate=!0,n(Y)}),e(Be,(E=!0)=>{A.uniforms[Zi].value=E?1:0,A.uniformsNeedUpdate=!0,n(Y)}),e(qn,E=>{A.uniforms[Ki].value=E,A.uniformsNeedUpdate=!0}),e(Rs,E=>{A.uniforms[Ji].value=E,A.uniformsNeedUpdate=!0}),e(Ue,async E=>{if(n(J))return;const P=await n(en);E<0&&(E=0),E>P&&(E=P),r=E,A.uniforms[is].value=E,A.uniformsNeedUpdate=!0,n(nt,{shDegree:`${E} / max ${P}`}),n(Y)}),e(ti,()=>{A.dispose(),y&&y.dispose(),S&&S.dispose(),C&&C.dispose(),I&&I.dispose()}),A}),e(Yn,async()=>{const l=new u.Mesh(await n(Wn),await n(Gn));return n(Le),n(Re),n(Zn,n(J)),n(zt,n(Ve)),l});function c(){n(Le),n(Re)}window.addEventListener("resize",c),e(oi,()=>{t=!0,window.removeEventListener("resize",c),n(Jn),n(ti)}),e(ri,async()=>{if(n(J))return;let l=.01,f=.01,g=!1,h=0;n(te,f),n(Ut,()=>{if(t||o<=f)return;f+=(o-f)*l,n(te,f);let A=n(ui);A&&!h&&(h=Date.now());let m=f/a;A&&(m>.9||Date.now()-h>2500)?(n(Ve)&&n(ze,!0),n(te,0),g=!0):A&&m>.7?l=Math.min(l*1.2,.3):A&&m>.5?l=Math.min(l*1.2,.2):m>.4&&(l=Math.min(l*1.05,.1))},()=>!t&&!g,3)}),e(ze,(l=!1)=>{if(n(J))return;for(;s.length;)s.pop().stop=!0;const f=n(_),g=a*.001;let h={currentPointMode:f.pointcloudMode,stepRate:.0015,currentLightRadius:g,stop:!1};s.push(h),n(Ut,()=>{t||(h.currentLightRadius+=a*h.stepRate,n(Fe,h.currentLightRadius),h.currentLightRadius>a?(n(zt,!h.currentPointMode),n(Fe,0),h.stop=!0,s.length===1&&s[0]===h&&s.pop(),l&&n(_)?.viewerEvents?.fire(Nt),n(_)?.viewerEvents?.fire(Ti)):h.currentLightRadius/a<.4?h.stepRate=Math.min(h.stepRate*1.02,.03):h.stepRate*=1.04)},()=>!t&&!h.stop)}),e(Hn,()=>({[yn]:{type:"t",value:null},[An]:{type:"t",value:null},[gn]:{type:"t",value:null},[mn]:{type:"t",value:null},[ss]:{type:"v2",value:new u.Vector2},[jt]:{type:"v2",value:new u.Vector2},[ts]:{type:"int",value:0},[es]:{type:"int",value:0},[Ji]:{type:"int",value:1},[ji]:{type:"int",value:0},[is]:{type:"int",value:0},[qi]:{type:"float",value:1},[as]:{type:"float",value:0},[Ni]:{type:"float",value:0},[Xi]:{type:"float",value:0},[ns]:{type:"v4",value:new u.Vector4(0,0,0,-1)},[Ki]:{type:"float",value:performance.now()},[Ma]:{type:"v4",value:new u.Vector4(1,1,0,.5)},[Zi]:{type:"int",value:1}}));const p=n(Rn);p.onmessage=l=>{const f=l.data;f[os]&&n(Xn,f[os],f[rs],f[Pa],f[Da],f[cs])},e(Ii,(l,f,g)=>{n(J)||(o=f,a=g),n($n,l)});function d(l){const f=l.xyz.slice(0);p.postMessage({[La]:!0,[Ua]:f,[Ya]:l.watermarkCount,[rs]:l.index,[Ea]:l.version,[cs]:l.renderSplatCount,[Ia]:l.visibleSplatCount,[_a]:l.modelSplatCount,[Oa]:l.minX,[Va]:l.maxX,[za]:l.minY,[Qa]:l.maxY,[Ha]:l.minZ,[Wa]:l.maxZ},[f.buffer])}}function Xa(i){const t=(a,...o)=>i.fire(a,...o),e=(a,o,s)=>i.on(a,o,s),n=new Set(ea.split(""));e(xi,async(a="",o=!0,s=!0)=>{const r=a.trim().substring(0,100);let c=await t(Pn,r),p=[];for(let b=0;b<c.length;b++){let S=[],k=c[b];for(let x=0;x<k.length;x++)S.push([(k[x]%20-10)*.02,((k[x]/20|0)-10)*.02]);p.push(S)}let d=[],l=r.split("");for(let b=0;b<l.length;b++)d[b]=n.has(l[b])?.22:.4;let f=l.length/2|0,g=d[f]/2,h=!(l.length%2),A=h?0:-g;for(let b=f-1;b>=0;b--){A-=d[b]/2;for(let S of p[b])S[0]+=A;A-=d[b]/2}g=d[f]/2,A=h?0:g;for(let b=p.length-f;b<p.length;b++){A+=d[b]/2;for(let S of p[b])S[0]+=A;A+=d[b]/2}let m=0;for(let b of p)m+=b.length;const y=new Uint8Array(m*F);let M=0;for(let b of p)for(let S of b)y.set(await ua(S[0],S[1],o,s),F*M++);return y})}function vn(i){const t=(e,n,a)=>i.on(e,n,a);t(St,e=>{e.url;const n={...e};delete n.url;const a=JSON.stringify(n,null,2);console.info(a)}),t(Pn,(e="")=>{const n="https://reall3d.com/gsfont/api/getGaussianText",a=new FormData;return a.append("text",e.substring(0,100)),a.append("ver",Ae),new Promise(o=>{fetch(n,{method:"POST",body:a}).then(s=>s.ok?s.json():{}).then(s=>s.success?o(JSON.parse(s.data)):o([])).catch(s=>o([]))})})}function $a(i){let t=!1;const e=(r,c,p)=>i.on(r,c,p),n=(r,...c)=>i.fire(r,...c);e(ei,()=>t=!0);const a=new Map,o=new Map;e(ne,()=>n(at)&&a.set(Date.now(),1)),e(ie,()=>n(at)&&n(_t,a)),e(se,()=>n(at)&&o.set(Date.now(),1)),e(ae,()=>n(at)&&n(_t,o)),e(Mt,()=>{t||(n(se),n(at)&&n(nt,{fov:n(Ot),position:n(Ct,n(bt)),lookAt:n(Ct,n(yt)),lookUp:n(Ct,n(It))}))},!0);let s=0;e(Dt,()=>{t||(n(Bn),n(at)&&(n(ne),!(s++%5)&&n(nt,{fps:n(ie),realFps:n(ae)})))},!0),e(_t,r=>{let c=[],p=Date.now(),d=0;for(const l of r.keys())p-l<=1e3?d++:c.push(l);return c.forEach(l=>r.delete(l)),Math.min(d,30)}),window.addEventListener("beforeunload",()=>n(oe))}function Ka(i){const t={...i};return t.bigSceneMode??(t.bigSceneMode=!1),t.pointcloudMode??(t.pointcloudMode=!t.bigSceneMode),t.lightFactor??(t.lightFactor=1),t.name??(t.name=""),t.showWatermark??(t.showWatermark=!0),t}function ls(i){const t={...i};return t.position=t.position?[...t.position]:[0,-5,15],t.lookAt=t.lookAt?[...t.lookAt]:[0,0,0],t.lookUp=t.lookUp?[...t.lookUp]:[0,-1,0],t.fov??(t.fov=45),t.near??(t.near=.001),t.far??(t.far=1e3),t.enableDamping??(t.enableDamping=!0),t.autoRotate??(t.autoRotate=!0),t.enableZoom??(t.enableZoom=!0),t.enableRotate??(t.enableRotate=!0),t.enablePan??(t.enablePan=!0),t.enableKeyboard??(t.enableKeyboard=!0),t.bigSceneMode??(t.bigSceneMode=!1),t.pointcloudMode??(t.pointcloudMode=!t.bigSceneMode),t.lightFactor??(t.lightFactor=1.1),t.maxRenderCountOfMobile??(t.maxRenderCountOfMobile=t.bigSceneMode?256*1e4:384*10240),t.maxRenderCountOfPc??(t.maxRenderCountOfPc=t.bigSceneMode?320*1e4:384*1e4),t.debugMode??(t.debugMode=location.protocol==="http:"||/^test\./.test(location.host)),t.markMode??(t.markMode=!1),t.markVisible??(t.markVisible=!0),t.meterScale??(t.meterScale=1),t.background??(t.background="#000000"),t}function Za(i){let t;i.root?t=typeof i.root=="string"?document.querySelector(i.root)||document.querySelector("#gsviewer"):i.root:t=document.querySelector("#gsviewer"),t||(t=document.createElement("div"),t.id="gsviewer",document.body.appendChild(t));let e=null;return i.renderer?e=i.renderer:(e=new u.WebGLRenderer({antialias:!1,stencil:!0,logarithmicDepthBuffer:!0,precision:"highp"}),e.setSize(t.clientWidth,t.clientHeight),e.setPixelRatio(Math.min(devicePixelRatio,2)),i.renderer=e),e.domElement.classList.add("gsviewer-canvas"),t.appendChild(e.domElement),e}function ja(i){let t=i.camera;if(!t){const e=i.renderer.domElement,n=e.width/e.height;let a=new u.Vector3().fromArray(i.lookUp),o=new u.Vector3().fromArray(i.lookAt),s=new u.Vector3().fromArray(i.position);t=new u.PerspectiveCamera(i.fov,n,i.near,i.far),t.position.copy(s),t.up.copy(a).normalize(),t.lookAt(o),i.camera=t}return i.camera}function qa(i){const{renderer:t,scene:e}=i,n={renderer:t,scene:e};return n.viewerEvents=i.viewerEvents,n.debugMode=i.debugMode,n.renderer=i.renderer,n.scene=i.scene,n.controls=i.controls,n.bigSceneMode=i.bigSceneMode,n.pointcloudMode=i.pointcloudMode,n.maxRenderCountOfMobile=i.maxRenderCountOfMobile,n.maxRenderCountOfPc=i.maxRenderCountOfPc,n.lightFactor=i.lightFactor,n.shDegree=i.shDegree,n}function Ja(i){const t=(s,r,c)=>i.on(s,r,c),e=(s,...r)=>i.fire(s,...r),n="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2xldCBpPTA7aSsrO2NvbnN0IEQ9YCQke2krK31gO2krKyxpKyssaSsrO2NvbnN0IFc9YCQke2krK31gLHA9YCQke2krK31gLFM9YCQke2krK31gLHk9YCQke2krK31gLEM9YCQke2krK31gLEE9YCQke2krK31gLFI9YCQke2krK31gLEc9YCQke2krK31gO2krKztjb25zdCBIPWAkJHtpKyt9YCxKPWAkJHtpKyt9YDtpKys7Y29uc3QgVD1gJCR7aSsrfWA7aSsrO2NvbnN0IEs9YCQke2krK31gO2krKztjb25zdCBMPWAkJHtpKyt9YCxOPWAkJHtpKyt9YCxPPWAkJHtpKyt9YCxRPWAkJHtpKyt9YCxfPWAkJHtpKyt9YCxWPWAkJHtpKyt9YCxqPWAkJHtpKyt9YCxQPWAkJHtpKyt9YDtpKys7Y29uc3Qgbm49bmF2aWdhdG9yLnVzZXJBZ2VudC5pbmNsdWRlcygiTW9iaSIpLGI9c2VsZjtsZXQgWD17aW5kZXg6MCx2ZXJzaW9uOjB9LFk9e2luZGV4OjEsdmVyc2lvbjowfSx3PSExLFo7Y29uc3QgdG49LjI7bGV0IGssZj1bXSxNLHo9MCxCO2Z1bmN0aW9uIGFuKG4pe2lmKCF3KXJldHVybjtsZXQgYT1YLnZlcnNpb24+WS52ZXJzaW9uP1g6WTtpZighYS52ZXJzaW9uKXJldHVybjtjb25zdHt4eXo6dCxyZW5kZXJTcGxhdENvdW50Om8sdmlzaWJsZVNwbGF0Q291bnQ6bSxtb2RlbFNwbGF0Q291bnQ6RSx3YXRlcm1hcmtDb3VudDp4LGluZGV4OkYsdmVyc2lvbjp1fT1hO2lmKHo9PT11JiZNYXRoLmFicyhmWzJdLW5bMl0pK01hdGguYWJzKGZbNl0tbls2XSkrTWF0aC5hYnMoZlsxMF0tblsxMF0pK01hdGguYWJzKGZbMTRdLW5bMTRdKTx0bilyZXR1cm47Zj1uLHo9dTtsZXQgST1EYXRlLm5vdygpLGw7aWYoIW8pe2w9bmV3IFVpbnQzMkFycmF5KDApLGIucG9zdE1lc3NhZ2Uoe1tEXTpsLFtTXTpvLFt5XTptLFtDXTpFLFtXXTpGLFtwXTp1LFtSXTowLFtBXTpJfSxbbC5idWZmZXJdKTtyZXR1cm59bGV0IHE9MDtjb25zdCByPW8teDtsPW5ldyBVaW50MzJBcnJheShvKTtjb25zdHttYXhEZXB0aDp2LG1pbkRlcHRoOmR9PWVuKGEsayk7aWYodi1kPD0xZS01KWZvcihsZXQgcz0wO3M8bztzKyspbFtzXT1zO2Vsc2V7bGV0IHM9TWF0aC5taW4ociw2NTUzNSksZz0ocy0xKS8odi1kKSxjPW5ldyBJbnQzMkFycmF5KHMpO2ZvcihsZXQgZT0wLGg9MDtlPHI7ZSsrKWg9KCQobix0WzMqZV0sdFszKmUrMV0sdFszKmUrMl0pLWQpKmd8MCxjW01bZV09aF0rKztmb3IobGV0IGU9MTtlPHM7ZSsrKWNbZV0rPWNbZS0xXTtmb3IobGV0IGU9MDtlPHI7ZSsrKWxbLS1jW01bZV1dXT1lO2lmKHgpe3M9TWF0aC5taW4oTWF0aC5tYXgoeC84fDAsNTEyKSw2NTUzNSksZz0ocy0xKS8odi1kKSxjPW5ldyBJbnQzMkFycmF5KHMpO2ZvcihsZXQgZT1yLGg9MDtlPG87ZSsrKWg9KCQobix0WzMqZV0sdFszKmUrMV0sdFszKmUrMl0pLWQpKmd8MCxjW01bZS1yXT1oXSsrO2ZvcihsZXQgZT0xO2U8cztlKyspY1tlXSs9Y1tlLTFdO2ZvcihsZXQgZT0wO2U8eDtlKyspbFtyKy0tY1tNW2VdXV09citlfX1xPURhdGUubm93KCktSSxiLnBvc3RNZXNzYWdlKHtbRF06bCxbU106byxbeV06bSxbQ106RSxbV106RixbcF06dSxbQV06SSxbUl06cX0sW2wuYnVmZmVyXSl9ZnVuY3Rpb24gJChuLGEsdCxvKXtyZXR1cm4tKG5bMl0qYStuWzZdKnQrblsxMF0qbyl9ZnVuY3Rpb24gZW4obixhKXtsZXQgdD0tMS8wLG89MS8wLG09MDtyZXR1cm4gbT0kKGEsbi5taW5YLG4ubWluWSxuLm1pblopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5taW5YLG4ubWluWSxuLm1heFopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5taW5YLG4ubWF4WSxuLm1pblopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5taW5YLG4ubWF4WSxuLm1heFopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5tYXhYLG4ubWluWSxuLm1pblopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5tYXhYLG4ubWluWSxuLm1heFopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5tYXhYLG4ubWF4WSxuLm1pblopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5tYXhYLG4ubWF4WSxuLm1heFopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSkse21heERlcHRoOnQsbWluRGVwdGg6b319Y29uc3QgVT0oKT0+e2lmKCFaKXtaPSEwO2NvbnN0IG49azthbihuKSxzZXRUaW1lb3V0KCgpPT4hKFo9ITEpJiZuIT09ayYmVSgpKX19O2Iub25tZXNzYWdlPW49Pntjb25zdCBhPW4uZGF0YTtpZihhW0ddKXtsZXQgdD0hQnx8YVtXXT09PTA/WDpZO3QubWluWD1hW0xdLHQubWF4WD1hW05dLHQubWluWT1hW09dLHQubWF4WT1hW1FdLHQubWluWj1hW19dLHQubWF4Wj1hW1ZdLHQueHl6PW5ldyBGbG9hdDMyQXJyYXkoYVtLXS5idWZmZXIpLHQud2F0ZXJtYXJrQ291bnQ9YVtQXSx0LnZlcnNpb249YVtwXSx0LnJlbmRlclNwbGF0Q291bnQ9YVtTXSx0LnZpc2libGVTcGxhdENvdW50PWFbeV0sdC5tb2RlbFNwbGF0Q291bnQ9YVtDXSx0LnRleHR1cmVSZWFkeT0hMCx0LnRleHR1cmVSZWFkeVRpbWU9RGF0ZS5ub3coKX1lbHNlIGFbVF0/KGs9YVtUXSxVKCkpOmFbal0mJihCPWFbSF0sTT1uZXcgSW50MzJBcnJheShhW0pdKSx3PSEwKX19KSgpOwo=",a=URL.createObjectURL(new Blob([atob(n)],{type:"text/javascript"})),o=new Worker(new URL(a,typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Te&&Te.tagName.toUpperCase()==="SCRIPT"&&Te.src||new URL("pkg.umd.cjs",document.baseURI).href),{type:"module"});t(Rn,()=>o),t(Vn,()=>o.postMessage({[Ba]:e(On)})),t(zn,()=>o.terminate()),(async()=>o.postMessage({[Ga]:!0,[Fa]:await e(Vt),[Ra]:e(J)}))()}class lt extends u.Mesh{constructor(t){super(),this.isSplatMesh=!0,this.disposed=!1;const e=new on,n=(r,c,p)=>e.on(r,c,p),a=(r,...c)=>e.fire(r,...c),o=Ka(t),s=o.controls.object;n(_,()=>o),n(Et,()=>o.renderer.domElement),n(G,()=>s),n(Ot,()=>s.fov),n(bt,(r=!1)=>r?s.position.clone():s.position),n(yt,(r=!1)=>r?o.controls.target.clone():o.controls.target),n(On,()=>s.projectionMatrix.clone().multiply(s.matrixWorldInverse).multiply(this.matrix).toArray()),n(_s,()=>s.projectionMatrix.clone().multiply(s.matrixWorldInverse)),n(Ns,()=>s.getWorldDirection(new u.Vector3).toArray()),n(Ht,()=>o.renderer),n(B,()=>o.scene),n(J,()=>o.bigSceneMode),n(Ve,()=>o.pointcloudMode),n(mt,()=>this),n(Y,()=>o.viewerEvents?.fire(K)),pn(e),vn(e),va(e),Ja(e),Na(e),Xa(e),this.name=`${o.name||this.id}`,this.events=e,this.opts=o,(async()=>(this.copy(await e.fire(Yn)),o.matrix&&this.applyMatrix4(o.matrix),this.frustumCulled=!1,this.onBeforeRender=()=>{a(Vn),a(qn,performance.now())},this.onAfterRender=()=>{a(si,1e4)&&a(Y)}))()}options(t){if(this.disposed)return;const e=(a,...o)=>this.events.fire(a,...o),n=this.opts;return t&&(t.pointcloudMode!==void 0&&e(zt,t.pointcloudMode),t.lightFactor!==void 0&&e(Qt,t.lightFactor),t.maxRenderCountOfMobile!==void 0&&(n.maxRenderCountOfMobile=t.maxRenderCountOfMobile),t.maxRenderCountOfPc!==void 0&&(n.maxRenderCountOfPc=t.maxRenderCountOfPc),e(Y)),{...n}}async addModel(t,e){this.disposed||(this.meta=e,await this.events.fire(ii,t,e))}fire(t,...e){if(!this.disposed)return this.events.fire(t,...e)}dispose(){if(this.disposed)return;this.disposed=!0;const t=(e,...n)=>this.events.fire(e,...n);t(vt,this),t(B).remove(this),t(Oe),t(ai),t(zn),t(oi),this.events.clear(),this.events=null,this.opts=null,this.onAfterRender=null}}class to extends u.Object3D{constructor(t=new u.Vector3(0,0,1),e=new u.Vector3(0,0,0),n=1,a=.1,o=16776960,s=n*.2,r=s*.2){super(),this._axis=new u.Vector3,this.type="ArrowHelper";const c=new u.CylinderGeometry(a,a,n,32);c.translate(0,n/2,0);const p=new u.CylinderGeometry(0,r,s,32);p.translate(0,n,0),this.position.copy(e);const d=new u.MeshBasicMaterial({color:o,toneMapped:!1});d.side=u.DoubleSide,this.line=new u.Mesh(c,d),this.line.matrixAutoUpdate=!1,this.line.ignoreIntersect=!0,this.add(this.line);const l=new u.MeshBasicMaterial({color:o,toneMapped:!1});l.side=u.DoubleSide,this.cone=new u.Mesh(p,l),this.cone.matrixAutoUpdate=!1,this.cone.ignoreIntersect=!0,this.add(this.cone),this.setDirection(t),this.renderOrder=99999}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{this._axis.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(this._axis,e)}}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}function eo(i){const t=(A,m,y)=>i.on(A,m,y),e=(A,...m)=>i.fire(A,...m),n=new u.PlaneGeometry(1,1);n.rotateX(-Math.PI/2);const a=new u.MeshBasicMaterial({color:16777215});a.transparent=!0,a.opacity=.6,a.depthTest=!1,a.depthWrite=!1,a.side=u.DoubleSide;const o=new u.Mesh(n,a);o.ignoreIntersect=!0;const s=new u.Vector3(0,-1,0);s.normalize();const r=new u.Vector3(0,0,0),c=.5,p=.01,d=16777062,l=.1,f=.03,g=new to(s,r,c,p,d,l,f),h=new u.Object3D;h.add(o),h.add(g),h.renderOrder=99999,o.renderOrder=99999,h.visible=!1,e(B).add(h),t(Vs,()=>h),t(de,A=>{e(ue,!0),h.visible=A===void 0?!h.visible:A,e(K)}),t(Ye,()=>h.visible),t(ue,(A=!1)=>{if(A||h.visible){const m=new u.Quaternion,y=new u.Vector3(0,-1,0);m.setFromUnitVectors(y,e(It)),h.position.copy(e(yt)),h.quaternion.copy(m)}})}const ds={type:"change"},Sn={type:"start"},us={type:"end"},be=new u.Ray,ps=new u.Plane,no=Math.cos(70*u.MathUtils.DEG2RAD),X=new u.Vector3,it=2*Math.PI,Q={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},bn=1e-6;class fs extends u.Controls{constructor(t,e=null){super(t,e),this.state=Q.NONE,this.enabled=!0,this.target=new u.Vector3,this.cursor=new u.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=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.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:u.MOUSE.ROTATE,MIDDLE:u.MOUSE.DOLLY,RIGHT:u.MOUSE.PAN},this.touches={ONE:u.TOUCH.ROTATE,TWO:u.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new u.Vector3,this._lastQuaternion=new u.Quaternion,this._lastTargetPosition=new u.Vector3,this._quat=new u.Quaternion().setFromUnitVectors(t.up,new u.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new u.Spherical,this._sphericalDelta=new u.Spherical,this._scale=1,this._panOffset=new u.Vector3,this._rotateStart=new u.Vector2,this._rotateEnd=new u.Vector2,this._rotateDelta=new u.Vector2,this._panStart=new u.Vector2,this._panEnd=new u.Vector2,this._panDelta=new u.Vector2,this._dollyStart=new u.Vector2,this._dollyEnd=new u.Vector2,this._dollyDelta=new u.Vector2,this._dollyDirection=new u.Vector3,this._mouse=new u.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=so.bind(this),this._onPointerDown=io.bind(this),this._onPointerUp=ao.bind(this),this._onContextMenu=fo.bind(this),this._onMouseWheel=co.bind(this),this._onKeyDown=lo.bind(this),this._onTouchStart=uo.bind(this),this._onTouchMove=po.bind(this),this._onMouseDown=oo.bind(this),this._onMouseMove=ro.bind(this),this._interceptControlDown=ho.bind(this),this._interceptControlUp=go.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=t}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(ds),this.update(),this.state=Q.NONE}update(t=null){const e=this.object.position;X.copy(e).sub(this.target),X.applyQuaternion(this._quat),this._spherical.setFromVector3(X),this.autoRotate&&this.state===Q.NONE&&this._rotateLeft(this._getAutoRotationAngle(t)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,a=this.maxAzimuthAngle;isFinite(n)&&isFinite(a)&&(n<-Math.PI?n+=it:n>Math.PI&&(n-=it),a<-Math.PI?a+=it:a>Math.PI&&(a-=it),n<=a?this._spherical.theta=Math.max(n,Math.min(a,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+a)/2?Math.max(n,this._spherical.theta):Math.min(a,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let o=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const s=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),o=s!=this._spherical.radius}if(X.setFromSpherical(this._spherical),X.applyQuaternion(this._quatInverse),e.copy(this.target).add(X),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let s=null;if(this.object.isPerspectiveCamera){const r=X.length();s=this._clampDistance(r*this._scale);const c=r-s;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),o=!!c}else if(this.object.isOrthographicCamera){const r=new u.Vector3(this._mouse.x,this._mouse.y,0);r.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),o=c!==this.object.zoom;const p=new u.Vector3(this._mouse.x,this._mouse.y,0);p.unproject(this.object),this.object.position.sub(p).add(r),this.object.updateMatrixWorld(),s=X.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;s!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(s).add(this.object.position):(be.origin.copy(this.object.position),be.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(be.direction))<no?this.object.lookAt(this.target):(ps.setFromNormalAndCoplanarPoint(this.object.up,this.target),be.intersectPlane(ps,this.target))))}else if(this.object.isOrthographicCamera){const s=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),s!==this.object.zoom&&(this.object.updateProjectionMatrix(),o=!0)}return this._scale=1,this._performCursorZoom=!1,o||this._lastPosition.distanceToSquared(this.object.position)>bn||8*(1-this._lastQuaternion.dot(this.object.quaternion))>bn||this._lastTargetPosition.distanceToSquared(this.target)>bn?(this.dispatchEvent(ds),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?it/60*this.autoRotateSpeed*t:it/60/60*this.autoRotateSpeed}_getZoomScale(t){const e=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*e)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,e){X.setFromMatrixColumn(e,0),X.multiplyScalar(-t),this._panOffset.add(X)}_panUp(t,e){this.screenSpacePanning===!0?X.setFromMatrixColumn(e,1):(X.setFromMatrixColumn(e,0),X.crossVectors(this.object.up,X)),X.multiplyScalar(t),this._panOffset.add(X)}_pan(t,e){const n=this.domElement;if(this.object.isPerspectiveCamera){const a=this.object.position;X.copy(a).sub(this.target);let o=X.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*o/n.clientHeight,this.object.matrix),this._panUp(2*e*o/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,e){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),a=t-n.left,o=e-n.top,s=n.width,r=n.height;this._mouse.x=a/s*2-1,this._mouse.y=-(o/r)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(it*this._rotateDelta.x/e.clientHeight),this._rotateUp(it*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let e=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(it*this.rotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),e=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-it*this.rotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),e=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(it*this.rotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),e=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-it*this.rotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),e=!0;break}e&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._rotateStart.set(n,a)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._panStart.set(n,a)}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),n=t.pageX-e.x,a=t.pageY-e.y,o=Math.sqrt(n*n+a*a);this._dollyStart.set(0,o)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const n=this._getSecondPointerPosition(t),a=.5*(t.pageX+n.x),o=.5*(t.pageY+n.y);this._rotateEnd.set(a,o)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(it*this._rotateDelta.x/e.clientHeight),this._rotateUp(it*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._panEnd.set(n,a)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const e=this._getSecondPointerPosition(t),n=t.pageX-e.x,a=t.pageY-e.y,o=Math.sqrt(n*n+a*a);this._dollyEnd.set(0,o),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const s=(t.pageX+e.x)*.5,r=(t.pageY+e.y)*.5;this._updateZoomParameters(s,r)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId){this._pointers.splice(e,1);return}}_isTrackingPointer(t){for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId)return!0;return!1}_trackPointer(t){let e=this._pointerPositions[t.pointerId];e===void 0&&(e=new u.Vector2,this._pointerPositions[t.pointerId]=e),e.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const e=t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[e]}_customWheelEvent(t){const e=t.deltaMode,n={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(e){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function io(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i)))}function so(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function ao(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(us),this.state=Q.NONE;break;case 1:const t=this._pointers[0],e=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:e.x,pageY:e.y});break}}function oo(i){let t;switch(i.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case u.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=Q.DOLLY;break;case u.MOUSE.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Q.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Q.ROTATE}break;case u.MOUSE.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Q.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Q.PAN}break;default:this.state=Q.NONE}this.state!==Q.NONE&&this.dispatchEvent(Sn)}function ro(i){switch(this.state){case Q.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case Q.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case Q.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function co(i){this.enabled===!1||this.enableZoom===!1||this.state!==Q.NONE||(i.preventDefault(),this.dispatchEvent(Sn),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(us))}function lo(i){this.enabled!==!1&&this._handleKeyDown(i)}function uo(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case u.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=Q.TOUCH_ROTATE;break;case u.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=Q.TOUCH_PAN;break;default:this.state=Q.NONE}break;case 2:switch(this.touches.TWO){case u.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=Q.TOUCH_DOLLY_PAN;break;case u.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=Q.TOUCH_DOLLY_ROTATE;break;default:this.state=Q.NONE}break;default:this.state=Q.NONE}this.state!==Q.NONE&&this.dispatchEvent(Sn)}function po(i){switch(this._trackPointer(i),this.state){case Q.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case Q.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case Q.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case Q.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=Q.NONE}}function fo(i){this.enabled!==!1&&i.preventDefault()}function ho(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function go(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class mo extends fs{constructor(t){const e=t.camera;super(e,t.renderer.domElement);const n=this;n.dampingFactor=.1,n.rotateSpeed=.4,n.updateByOptions(t)}updateByOptions(t={}){const e=this;t.enableDamping!==void 0&&(e.enableDamping=t.enableDamping),t.autoRotate!==void 0&&(e.autoRotate=t.autoRotate),t.enableZoom!==void 0&&(e.enableZoom=t.enableZoom),t.enableRotate!==void 0&&(e.enableRotate=t.enableRotate),t.enablePan!==void 0&&(e.enablePan=t.enablePan),t.minDistance!==void 0&&(e.minDistance=t.minDistance),t.maxDistance!==void 0&&(e.maxDistance=t.maxDistance),t.minPolarAngle!==void 0&&(e.minPolarAngle=t.minPolarAngle),t.maxPolarAngle!==void 0&&(e.maxPolarAngle=t.maxPolarAngle),t.fov!==void 0&&(e.object.fov=t.fov),t.near!==void 0&&(e.object.near=t.near),t.far!==void 0&&(e.object.far=t.far),t.position&&e.object.position.fromArray(t.position),t.lookAt&&e.target.fromArray(t.lookAt),t.lookUp&&e.object.up.fromArray(t.lookUp),rt&&e._dollyOut?.(.75),e.updateRotateAxis(),e.update()}updateRotateAxis(){this._quat?.setFromUnitVectors?.(this.object.up,new u.Vector3(0,1,0)),this._quatInverse=this._quat?.clone?.()?.invert?.()}}class yo extends fs{constructor(t,e){super(t,e),this.screenSpacePanning=!1,this.mouseButtons={LEFT:u.MOUSE.PAN,MIDDLE:u.MOUSE.DOLLY,RIGHT:u.MOUSE.ROTATE},this.touches={ONE:u.TOUCH.PAN,TWO:u.TOUCH.DOLLY_ROTATE}}}const hs=new u.Box3,xe=new u.Vector3;class gs extends u.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const t=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],e=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new u.Float32BufferAttribute(t,3)),this.setAttribute("uv",new u.Float32BufferAttribute(e,2))}applyMatrix4(t){const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new u.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new u.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new u.InterleavedBufferAttribute(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new u.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new u.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new u.InterleavedBufferAttribute(n,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new u.WireframeGeometry(t.geometry)),this}fromLineSegments(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new u.Box3);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;t!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(t),hs.setFromBufferAttribute(e),this.boundingBox.union(hs))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new u.Sphere),this.boundingBox===null&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(t!==void 0&&e!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let a=0;for(let o=0,s=t.count;o<s;o++)xe.fromBufferAttribute(t,o),a=Math.max(a,n.distanceToSquared(xe)),xe.fromBufferAttribute(e,o),a=Math.max(a,n.distanceToSquared(xe));this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}u.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new u.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},u.ShaderLib.line={uniforms:u.UniformsUtils.merge([u.UniformsLib.common,u.UniformsLib.fog,u.UniformsLib.line]),vertexShader:`
|
|
339
339
|
#include <common>
|
|
340
340
|
#include <color_pars_vertex>
|
|
341
341
|
#include <fog_pars_vertex>
|
|
@@ -720,6 +720,6 @@
|
|
|
720
720
|
<span class="${o.name}-main-tag" style="color:${o.mainTagColor};background:${o.mainTagBackground};opacity:${o.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${o.title}</span>
|
|
721
721
|
</div>`,d.classList.add("mark-wrap-circle",`${o.name}`,"main-warp"),d.style.position="absolute",d.style.borderRadius="4px",d.style.cursor="pointer",d.onclick=()=>{if(n.events.fire(_).markMode)return;const h=parent?.onActiveMark;h?.(n.getMarkData(!0)),n.events.fire($)},d.oncontextmenu=h=>h.preventDefault();const l=new et(d);l.position.copy(t),l.element.style.pointerEvents="none",l.scale.set(.01,.01,.01),l.visible=o.mainTagVisible;const f=document.createElement("div");f.innerHTML=`<span class="${e}-circle-tag" style="color:${o.circleTagColor};background:${o.circleTagBackground};opacity:${o.circleTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;"></span>`,f.classList.add("mark-wrap-circle",`${e}`,"circle-warp"),f.style.position="absolute",f.style.borderRadius="4px",f.style.pointerEvents="none";const g=new et(f);g.position.set(t.x+Math.min(o.radius/2,.5),t.y,t.z),g.element.style.pointerEvents="none",g.scale.set(.008,.008,.008),g.visible=!1,n.add(c,l,g),n.data=o,n.circleMesh=c,n.css3dTag=g,n.css3dMainTag=l,n.events.fire(At,n)}drawUpdate(t,e=!0,n){if(this.disposed)return;const a=this;if(n){const o=new u.Vector3().fromArray(a.data.startPoint),s=o.distanceTo(new u.Vector3(n.x,o.y,n.z));e&&(a.data.radius=s),a.circleMesh.geometry.copy(new u.CircleGeometry(s,128)),a.css3dTag.visible=s>.3;const r=s*a.events.fire(_).meterScale,c=(Math.PI*r*r).toFixed(2)+" m²";a.css3dTag.element.childNodes[0].innerText=c,a.css3dTag.position.set(o.x+Math.min(a.data.radius/2,.5),o.y,o.z)}if(t?.radius){const o=new u.Vector3().fromArray(a.data.startPoint),s=t?.radius;e&&(a.data.radius=s),a.circleMesh.geometry.copy(new u.CircleGeometry(s,128)),a.css3dTag.visible=s>.3;const r=s*a.events.fire(_).meterScale,c=(Math.PI*r*r).toFixed(2)+" m²";a.css3dTag.element.childNodes[0].innerText=c,a.css3dTag.position.set(o.x+Math.min(s/2,.5),o.y,o.z)}t?.circleColor&&(e&&(a.data.circleColor=t.circleColor),a.circleMesh.material.color.set(t.circleColor)),t?.circleOpacity&&(e&&(a.data.circleOpacity=t.circleOpacity),a.circleMesh.material.opacity=t.circleOpacity),t?.mainTagColor&&(e&&(a.data.mainTagColor=t.mainTagColor),document.querySelector(`.${a.data.name}-main-tag`).style.color=t.mainTagColor),t?.mainTagBackground&&(e&&(a.data.mainTagBackground=t.mainTagBackground),document.querySelector(`.${a.data.name}-main-tag`).style.background=t.mainTagBackground),t?.mainTagOpacity&&(e&&(a.data.mainTagOpacity=t.mainTagOpacity),document.querySelector(`.${a.data.name}-main-tag`).style.opacity=t.mainTagOpacity.toString()),t?.mainTagVisible!==void 0&&(e&&(a.data.mainTagVisible=t.mainTagVisible),a.css3dMainTag.visible=t.mainTagVisible),t?.circleTagColor&&(e&&(a.data.circleTagColor=t.circleTagColor),document.querySelector(`.${a.data.name}-circle-tag`).style.color=t.circleTagColor),t?.circleTagBackground&&(e&&(a.data.circleTagBackground=t.circleTagBackground),document.querySelector(`.${a.data.name}-circle-tag`).style.background=t.circleTagBackground),t?.circleTagOpacity&&(e&&(a.data.circleTagOpacity=t.circleTagOpacity),document.querySelector(`.${a.data.name}-circle-tag`).style.opacity=t.circleTagOpacity.toString()),t?.circleTagVisible!==void 0&&(e&&(a.data.circleTagVisible=t.circleTagVisible),a.css3dTag.visible=t.circleTagVisible),t?.title!==void 0&&(e&&(a.data.title=t.title),this.css3dMainTag.element.querySelector(`.${a.data.name}-main-tag`).innerText=t.title),t?.note!==void 0&&e&&(a.data.note=t.note),a.events.fire(K)}updateByMeterScale(t){const e=this,n=e.data.radius*t,a=(Math.PI*n*n).toFixed(2)+" m²";e.css3dTag.element.childNodes[0].innerText=a}drawFinish(t){if(this.disposed)return;const e=this,n=new u.Vector3().fromArray(e.data.startPoint),a=n.distanceTo(new u.Vector3(t.x,n.y,t.z));e.data.radius=a,e.circleMesh.geometry.copy(new u.CircleGeometry(a,128));const o=e.data.radius*e.events.fire(_).meterScale,s=(Math.PI*o*o).toFixed(2)+" m²";e.css3dTag.element.childNodes[0].innerText=s,e.events.fire(wt);const r=parent?.onActiveMark,c=e.getMarkData(!0);c.isNew=!0,c.meterScale=e.events.fire(_).meterScale,r?.(c)}draw(t){if(this.disposed)return;const e=this,n={type:"MarkCirclePlan",name:t.name||"circle"+Date.now(),startPoint:[...t.startPoint],radius:t.radius,circleColor:t.circleColor||"#eeee00",circleOpacity:t.circleOpacity||.5,mainTagColor:t.mainTagColor||"#c4c4c4",mainTagBackground:t.mainTagBackground||"#2E2E30",mainTagOpacity:t.mainTagOpacity||.8,mainTagVisible:t.mainTagVisible===void 0?!0:t.mainTagVisible,circleTagColor:t.circleTagColor||"#000000",circleTagBackground:t.circleTagBackground||"#e0ffff",circleTagOpacity:t.circleTagOpacity||.9,circleTagVisible:t.circleTagVisible===void 0?!0:t.circleTagVisible,title:t.title||"标记圆面"},a=new u.CircleGeometry(n.radius,128),o=new u.MeshBasicMaterial({color:n.circleColor,side:u.DoubleSide,transparent:!0});o.opacity=n.circleOpacity;const s=new u.Mesh(a,o);s.position.fromArray(n.startPoint),s.isMark=!0,s.renderOrder=1;const r=new u.Vector3(0,1,0).normalize();s.lookAt(s.position.clone().add(r));const c=n.name,p=document.createElement("div");p.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
722
722
|
<span class="${c}-main-tag" style="color:${n.mainTagColor};background:${n.mainTagBackground};opacity:${n.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: auto;">${n.title}</span>
|
|
723
|
-
</div>`,p.classList.add("mark-wrap-circle",`${n.name}`,"main-warp"),p.style.position="absolute",p.style.borderRadius="4px",p.style.cursor="pointer",p.onclick=()=>{if(e.events.fire(_).markMode)return;const m=parent?.onActiveMark;m?.(e.getMarkData(!0)),e.events.fire($)},p.oncontextmenu=m=>m.preventDefault();const d=new u.Vector3().fromArray(n.startPoint),l=n.radius*e.events.fire(_).meterScale,f=(Math.PI*l*l).toFixed(2)+" m²",g=new et(p);g.position.copy(d),g.element.style.pointerEvents="none",g.scale.set(.01,.01,.01),g.visible=n.mainTagVisible;const h=document.createElement("div");h.innerHTML=`<span class="${c}-distance-tag ${c}-circle-tag" style="color:${n.circleTagColor};background:${n.circleTagBackground};opacity:${n.circleTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${f}</span>`,h.classList.add("mark-wrap-circle",`${c}`,"circle-warp"),h.style.position="absolute",h.style.borderRadius="4px",h.style.pointerEvents="none";const A=new et(h);A.position.set(d.x+Math.min(n.radius/2,.5),d.y,d.z),A.element.style.pointerEvents="none",A.scale.set(.008,.008,.008),A.visible=n.circleTagVisible,e.add(s,g,A),e.data=n,e.circleMesh=s,e.css3dTag=A,e.css3dMainTag=g,e.events.fire(At,e)}getMarkData(t=!1){const e={...this.data};return t?(delete e.startPoint,delete e.radius):e.startPoint=[...e.startPoint],e}dispose(){if(this.disposed)return;const t=this;t.disposed=!0,t.events.fire(vt,t),t.events.fire(B).remove(t),t.events.fire(Pt,t),document.querySelectorAll(`.${t.data.name}`).forEach(n=>n.parentElement?.removeChild(n)),t.events=null,t.data=null,t.circleMesh=null,t.css3dTag=null,t.css3dMainTag=null}}let Mo=class{constructor(){this.down=0,this.move=!1,this.downTime=0,this.isDbClick=!1,this.x=0,this.y=0,this.lastClickX=0,this.lastClickY=0,this.lastClickPointTime=0,this.lastMovePoint=null,this.lastMovePointTime=0}};function To(i){const t=(v,D,I)=>i.on(v,D,I),e=(v,...D)=>i.fire(v,...D),n=e(Et);let a=new Set,o,s=new Mo,r;t(Qn,()=>{e(W).autoRotate=e(_).autoRotate=!0}),t($,(v=!0)=>{e(W).autoRotate=e(_).autoRotate=!1,v&&e(ye)}),t(Qe,(v=!0)=>{if(o)return;const D=e(W),I=v?Math.PI/128:-(Math.PI/128),T=new u.Matrix4().makeRotationAxis(new u.Vector3(0,0,-1).transformDirection(D.object.matrixWorld),I);D.object.up.transformDirection(T),e(K)}),t(pi,()=>{o||i.fire(Qe,!0)}),t(fi,()=>{o||i.fire(Qe,!1)}),t(fe,v=>{const D=e(_);v??(v=!D.pointcloudMode),D.pointcloudMode=v,e(B).traverse(T=>T instanceof lt&&T.fire(zt,v))}),t(he,()=>{e(B).traverse(D=>D instanceof lt&&D.fire(ze))}),t(Qt,v=>{e(B).traverse(I=>I instanceof lt&&I.fire(Qt,v))}),t(Ri,()=>{const v=e(B);let D;v.traverse(I=>I instanceof lt&&(D=I)),D&&e(De,D.fire(Li))}),t(ce,()=>{if(!a.size)return;const v=e(_);if(!v.enableKeyboard)return a.clear();if(v.markMode&&a.has("Escape")){e(Xt),a.clear();return}a.has("Space")?(v.bigSceneMode?e(fe):e(he),a.clear()):a.has("KeyR")?(v.autoRotate?e($):e(Qn),a.clear()):a.has("KeyM")?(e(Nt,!v.markVisible),a.clear()):a.has("ArrowLeft")?(e(pi),e(de,!0),a.clear()):a.has("ArrowRight")?(e(fi),e(de,!0),a.clear()):a.has("KeyP")?(e(me,!0),a.clear()):a.has("Equal")?(e(je),a.clear()):a.has("Minus")?(e(qe),a.clear()):a.has("KeyY")?(e($e),a.clear()):a.has("KeyI")?(e(Ei),a.clear()):a.has("KeyF")?(e(Ri),a.clear()):a.has("F2")&&(!v.bigSceneMode&&window.open("/editor/index.html?url="+encodeURIComponent(e(mt).meta.url)),a.clear())}),t(Wt,async(v,D)=>{if(s.move)return;const I=await e(le,v,D);I.length&&e(De,I[0],!0)}),t(ot,async(v,D)=>{const I=e(B),T=[];I.traverse(E=>E instanceof lt&&T.push(E));const R=await e(le,v,D);return R.length?(T.length&&T[0].fire(ee,R[0].x,R[0].y,R[0].z,!0),new u.Vector3(R[0].x,R[0].y,R[0].z)):(T.length&&T[0].fire(ee,0,0,0,!1),null)}),t(Ge,async()=>{const v=e(B),D=[];v.traverse(I=>I instanceof lt&&D.push(I));for(let I=0;I<D.length;I++)D[I].fire(ee,0,0,0,!1)});const c=v=>{v.target.type!=="text"&&(o||v.code==="F5"||(v.preventDefault(),v.code!=="KeyR"&&(a.add(v.code),e($)),r=Date.now()))},p=v=>{v.target.type!=="text"&&(o||(v.code==="KeyR"&&a.add(v.code),(v.code==="ArrowLeft"||v.code==="ArrowRight")&&e(Un),r=Date.now()))};t(Mt,()=>{e(Ye)&&Date.now()-r>2e3&&(e(de,!1),e($e))},!0);const d=()=>{a.clear()},l=v=>{parent&&setTimeout(()=>window.focus()),v.preventDefault(),!o&&(e($),r=Date.now())},f=v=>{v.preventDefault(),!o&&(e($),r=Date.now())};let g,h,A,m;t(Xt,()=>{g?.dispose(),h?.dispose(),A?.dispose(),m?.dispose(),g=null,h=null,A=null,m=null,s.lastMovePoint=null,e(wt)});const y=async v=>{parent&&setTimeout(()=>window.focus()),v.preventDefault(),!o&&(e($),s.down=v.button===2?2:1,s.move=!1,s.isDbClick=Date.now()-s.downTime<300,r=Date.now(),s.downTime=Date.now())},M=async v=>{if(v.preventDefault(),o)return;s.down&&(s.move=!0,r=Date.now());const D=e(_);if(D.markMode){const I=await e(ot,v.clientX,v.clientY);I&&!s.down&&D.markType==="distance"&&g?g.drawUpdate({endPoint:I.toArray()}):!s.down&&D.markType==="circle"&&m?I?(m.drawUpdate(null,!0,I),s.lastMovePoint=I,s.lastMovePointTime=Date.now()):(s.lastMovePoint=null,s.lastMovePointTime=0):!s.down&&D.markType==="lines"&&h?I?(h.drawUpdate(null,!0,I),s.lastMovePoint=I,s.lastMovePointTime=Date.now()):(s.lastMovePoint=null,s.lastMovePointTime=0):!s.down&&D.markType==="plans"&&A&&(I?(A.drawUpdate(null,!0,I),s.lastMovePoint=I,s.lastMovePointTime=Date.now()):(s.lastMovePoint=null,s.lastMovePointTime=0))}},b=async v=>{if(v.preventDefault(),o)return;const D=e(_);if(s.isDbClick&&(h?Math.abs(v.clientX-s.lastClickX)<2&&Math.abs(v.clientY-s.lastClickY)<2&&(h.drawFinish(s.lastClickPointTime>0),h=null,s.lastMovePoint=null):A&&Math.abs(v.clientX-s.lastClickX)<2&&Math.abs(v.clientY-s.lastClickY)<2&&(A.drawFinish(s.lastClickPointTime>0),A=null,s.lastMovePoint=null)),D.markMode&&s.down===1&&!s.move&&Date.now()-s.downTime<500){if(D.markType==="point"){if(await e(ot,v.clientX,v.clientY)){const T=new bs(i,await e(ot,v.clientX,v.clientY));e(B).add(T),T.drawFinish()}}else if(D.markType==="distance")if(g){const I=await e(ot,v.clientX,v.clientY);I?(g.drawFinish(I),g=null):s.isDbClick&&e(Xt)}else{const I=await e(ot,v.clientX,v.clientY);I&&(g=new Tn(i),g.drawStart(I),e(B).add(g))}else if(D.markType==="lines")if(h)if(s.lastMovePoint&&e(We,v.clientX,v.clientY,s.lastMovePoint)<.03)h.drawUpdate(null,!0,s.lastMovePoint,!0),s.lastClickPointTime=Date.now();else{const I=await e(ot,v.clientX,v.clientY);I?(h.drawUpdate(null,!0,I,!0),s.lastClickPointTime=Date.now()):s.lastClickPointTime=0}else{const I=await e(ot,v.clientX,v.clientY);I&&(h=new kn(i),h.drawStart(I),e(B).add(h))}else if(D.markType==="plans")if(A)if(s.lastMovePoint&&e(We,v.clientX,v.clientY,s.lastMovePoint)<.03)A.drawUpdate(null,!0,s.lastMovePoint,!0),s.lastClickPointTime=Date.now();else{const I=await e(ot,v.clientX,v.clientY);I?(A.drawUpdate(null,!0,I,!0),s.lastClickPointTime=Date.now()):s.lastClickPointTime=0}else{const I=await e(ot,v.clientX,v.clientY);I&&(A=new En(i),A.drawStart(I),e(B).add(A))}else if(D.markType==="circle")if(m){const I=await e(ot,v.clientX,v.clientY);I?(m.drawFinish(I),m=null):s.isDbClick&&e(Xt)}else{const I=await e(ot,v.clientX,v.clientY);I&&(m=new xs(i),m.drawStart(I),e(B).add(m))}s.lastClickX=v.clientX,s.lastClickY=v.clientY}s.down===2&&!s.move&&e(Wt,v.clientX,v.clientY),s.down=0,s.move=!1,r=Date.now()};function S(v){v.preventDefault(),!o&&(e($),s.down=v.touches.length,s.down===1&&(s.move=!1,s.x=v.touches[0].clientX,s.y=v.touches[0].clientY))}function k(v){v.touches.length===1&&(s.move=!0)}function x(v){s.down===1&&!s.move&&e(Wt,s.x,s.y)}window.addEventListener("keydown",c),window.addEventListener("keyup",p),window.addEventListener("blur",d),window.addEventListener("wheel",l,{passive:!1}),n.addEventListener("contextmenu",f),n.addEventListener("mousedown",y),n.addEventListener("mousemove",M),n.addEventListener("mouseup",b),n.addEventListener("touchstart",S,{passive:!1}),n.addEventListener("touchmove",k,{passive:!1}),n.addEventListener("touchend",x,{passive:!1}),window.addEventListener("resize",C),C();function C(){const{width:v,height:D,top:I,left:T}=e(xt),R=e(G);R.aspect=v/D,R.updateProjectionMatrix();const E=e(Ne);E.setSize(v,D),E.domElement.style.position="absolute",E.domElement.style.left=`${T}px`,E.domElement.style.top=`${I}px`;const P=e(Ht);P.setPixelRatio(Math.min(devicePixelRatio,2)),P.setSize(v,D)}t(Pe,()=>{o=!0,window.removeEventListener("keydown",c),window.removeEventListener("keyup",p),window.removeEventListener("blur",d),window.removeEventListener("wheel",l),n.removeEventListener("contextmenu",f),n.removeEventListener("mousedown",y),n.removeEventListener("mousemove",M),n.removeEventListener("mouseup",b),n.removeEventListener("touchstart",S),n.removeEventListener("touchmove",k),n.removeEventListener("touchend",x),window.removeEventListener("resize",C)})}function Cs(i){const t=new u.Raycaster,e=.02,n=(o,s,r)=>i.on(o,s,r),a=(o,...s)=>i.fire(o,...s);n(le,async(o,s)=>{const{width:r,height:c,left:p,top:d}=a(xt),l=new u.Vector2;l.x=(o-p)/r*2-1,l.y=(d-s)/c*2+1;const f=a(G);t.setFromCamera(l,f);const g=[],h=a(B),A=[],m=[];h.traverse(function(S){S instanceof lt?m.push(S):S.isMesh&&!S.ignoreIntersect&&!S.isMark&&A.push(S)});const y=t.intersectObjects(A,!0);for(let S=0;S<y.length;S++)g.push(new u.Sphere(y[S].point,t.ray.distanceToPoint(y[S].point)));const M=f.projectionMatrix.clone().multiply(f.matrixWorldInverse);for(let S=0;S<m.length;S++){const k=m[S].fire(He);if(k)if(k.length!==void 0){const x=k,C=x.length/3;for(let v=0;v<C;v++){const D=new u.Vector3(x[3*v+0],x[3*v+1],x[3*v+2]),I=new u.Vector4(D.x,D.y,D.z,1).applyMatrix4(M),T=I.x/I.w,R=I.y/I.w;Math.sqrt((T-l.x)**2+(R-l.y)**2)<=e&&g.push(new u.Sphere(D,t.ray.distanceToPoint(D)))}}else for(let x of Object.keys(k)){const C=x.split(","),v=new u.Vector3(Number(C[0]),Number(C[1]),Number(C[2]));if(t.ray.distanceToPoint(v)<=1.4143){const D=k[x];for(let I=0,T=D.length/3;I<T;I++){const R=new u.Vector3(D[3*I+0],D[3*I+1],D[3*I+2]),E=new u.Vector4(R.x,R.y,R.z,1).applyMatrix4(M),P=E.x/E.w,U=E.y/E.w;Math.sqrt((P-l.x)**2+(U-l.y)**2)<=e&&g.push(new u.Sphere(R,t.ray.distanceToPoint(R)))}}}}g.sort((S,k)=>S.radius-k.radius);const b=[];for(let S=0;S<g.length;S++)b.push(g[S].center);return b}),n(We,(o,s,r)=>{const{width:c,height:p,left:d,top:l}=a(xt),f=new u.Vector2;f.x=(o-d)/c*2-1,f.y=(l-s)/p*2+1;const g=a(G);return t.setFromCamera(f,g),t.ray.distanceToPoint(r)})}function ko(i){const t=(r,c,p)=>i.on(r,c,p),e=(r,...c)=>i.fire(r,...c);t(Ot,()=>e(G).fov),t(bt,(r=!1)=>r?e(G).position.clone():e(G).position),t(yt,(r=!1)=>r?e(W).target.clone():e(W).target),t(It,(r=!1)=>r?e(G).up.clone():e(G).up),t(De,(r,c=!1)=>{if(e(gi,r),!c){e(W).target.copy(r),e(ue);return}const p=e(W).target.clone();let d=0;e(Ut,()=>{d+=.03,e(W).target.copy(p.clone().lerp(r,d)),e(ue)},()=>d<1)}),t(Fn,()=>{let r=e(bt).toArray(),c=e(It).toArray(),p=e(yt).toArray();return{position:r,lookUp:c,lookAt:p}}),t(Bn,()=>e(W).update()),t(Un,()=>e(W).updateRotateAxis());const n=.01;let a=new u.Vector3,o=new u.Vector3,s=0;t(ni,()=>{const r=e(W).object,c=r.fov,p=r.position.clone(),d=r.getWorldDirection(new u.Vector3);return Math.abs(s-c)<n&&Math.abs(p.x-a.x)<n&&Math.abs(p.y-a.y)<n&&Math.abs(p.z-a.z)<n&&Math.abs(d.x-o.x)<n&&Math.abs(d.y-o.y)<n&&Math.abs(d.z-o.z)<n?!1:(s=c,a=p,o=d,!0)})}class Eo extends u.Mesh{constructor(){super(...arguments),this.ignoreIntersect=!0}}function Io(i){let t=!1;const e=(r,c,p)=>i.on(r,c,p),n=(r,...c)=>i.fire(r,...c),a=[],o=new u.Vector3,s=new u.Matrix4;e(hi,()=>{const r=new u.SphereGeometry(.5,32,32),c=_o();c.depthTest=!1,c.depthWrite=!1,c.transparent=!0;const p=new Eo;return p.copy(new u.Mesh(r,c)),e(Us,()=>c),e(mi,d=>{t||(c.uniforms[wn].value=d,d<=.01?p.visible=!1:p.visible=!0,c.uniformsNeedUpdate=!0,n(K))}),e(gi,d=>{if(t)return;const l=n(G);s.copy(l.matrixWorld).invert(),o.copy(d).applyMatrix4(s),o.normalize().multiplyScalar(10),o.applyMatrix4(l.matrixWorld);const{width:f,height:g}=n(xt);c.uniforms[jt].value.set(f,g),p.position.copy(o),c.uniforms[$i].value.copy(d),c.uniforms[jt].value.set(f,g),c.uniforms[wn].value=1,c.uniformsNeedUpdate=!0,n(yi),n(K)}),e(Os,()=>{t||(t=!0,c.dispose(),r.dispose())}),p.renderOrder=99999,p}),e(yi,()=>{for(;a.length;)a.pop().opacity=0;let r={opacity:1};a.push(r),n(ke,()=>{!t&&r.opacity>0&&(r.opacity<.2?r.opacity=0:r.opacity>.6?r.opacity=Math.max(r.opacity-=.01,0):r.opacity=Math.max(r.opacity-=.03,0),n(mi,r.opacity))},()=>!t&&r.opacity>0)})}function _o(){const i={[Ta]:{type:"v3",value:new u.Color},[$i]:{type:"v3",value:new u.Vector3},[jt]:{type:"v2",value:new u.Vector2},[wn]:{value:0}};return new u.ShaderMaterial({uniforms:i,vertexShader:xa(),fragmentShader:Ca(),transparent:!0,depthTest:!1,depthWrite:!1,side:u.FrontSide})}function Ms(i){const t=(s,r,c)=>i.on(s,r,c),e=(s,...r)=>i.fire(s,...r),n=new Map,a=document.createElement("div");a.classList.add("mark-warp"),document.body.appendChild(a);const o=new Co;o.setSize(innerWidth,innerHeight),o.domElement.style.position="absolute",o.domElement.style.top="0px",o.domElement.style.pointerEvents="none",a.appendChild(o.domElement),t(Qs,()=>a),t(Ne,()=>o),t(Xe,()=>document.body.removeChild(a)),t(Mt,()=>o.render(e(B),e(G)),!0),t(At,s=>{const r=s?.getMarkData?.()?.name||s?.name;r&&n.set(r,new WeakRef(s))}),t(Pt,s=>{const r=s?.getMarkData?.()?.name||s?.name;n.delete(r)}),t(Yt,s=>n.get(s)?.deref()),t(Hs,(s,r)=>{const c=e(Yt,s);!c||!r||c.drawUpdate?.(r)}),t(Ws,s=>{const r=e(Yt,s);return r?r.getMarkData?.():{}}),t(Nt,s=>{s!==void 0&&(e(_).markVisible=s),e(B).traverse(r=>r.isMark&&(r.visible=e(_).markVisible)),e(K)}),t($e,async()=>{const s=[];e(B).traverse(c=>{if(c.isMark){const p=c.getMarkData?.();p&&s.push(p)}});const r=e(mt).meta||{};return s.length?r.marks=s:delete r.marks,r.cameraInfo=e(Fn),await e(St,r)}),t(ge,async()=>{const s=[];e(B).traverse(c=>{if(c.isMark){const p=c.getMarkData?.();p&&s.push(p)}});const r=e(mt).meta||{};return s.length?r.marks=s:delete r.marks,await e(St,r)}),t(Si,async()=>{const s=e(mt).meta||{};delete s.marks;const r=await e(St,s),c=[];return n.forEach(p=>c.push(p)),c.forEach(p=>p.deref()?.dispose?.()),e(K),r}),t(bi,async()=>{e(B).traverse(r=>{r.isMark&&r.getMarkData?.()});const s=e(mt).meta||{};return s.watermark=e(Ai)||"",await e(St,s)}),t(Ke,s=>{s.meterScale&&(e(_).meterScale=s.meterScale,e(nt,{scale:`1 : ${e(_).meterScale} m`})),e(W).updateByOptions({...s,...s.cameraInfo||{}}),(s.marks||[]).forEach(c=>{if(c.type==="MarkSinglePoint"){const p=new bs(i,c);p.visible=!1,e(B).add(p)}else if(c.type==="MarkDistanceLine"){const p=new Tn(i);p.draw(c),p.visible=!1,e(B).add(p)}else if(c.type==="MarkMultiLines"){const p=new kn(i);p.draw(c,!0),p.visible=!1,e(B).add(p)}else if(c.type==="MarkMultiPlans"){const p=new En(i);p.draw(c,!0),p.visible=!1,e(B).add(p)}else if(c.type==="MarkCirclePlan"){const p=new xs(i);p.draw(c),p.visible=!1,e(B).add(p)}}),e(Je,s.flyPositions||[]),e(tn,s.flyTargets||[])}),t(wt,()=>{const s=e(_);s.markMode=!1,e(Ge),e(K)}),t(vi,(s,r=!0)=>{const c=s?.meterScale;if(c){if(typeof c!="number"||c<=0){console.warn("meterScale is not a number or <= 0",s);return}r&&(e(_).meterScale=s.meterScale),e(nt,{scale:`1 : ${c} m`});for(const p of n.values()){const d=p.deref();d&&(d instanceof Tn||d instanceof kn||d instanceof En)&&d.updateByMeterScale(c)}}}),t(Ee,s=>{const r=new u.Vector3().fromArray(s.slice(0,3)),c=new u.Vector3().fromArray(s.slice(-6,-3)),p=new u.Vector3().fromArray(s.slice(-3)),d=r.distanceTo(p)<1e-4,l=c.distanceTo(p)<1e-4,f=new u.Vector3,g=d||l?s.length/3-1:s.length/3;for(let h=0;h<g;h++)f.add(new u.Vector3(s[h*3],s[h*3+1],s[h*3+2]));return f.divideScalar(g),f}),t(Ie,s=>{const r=[];for(let l=0,f=s.length/3;l<f;l++)r.push(new u.Vector3(s[l*3],s[l*3+1],s[l*3+2]));const c=r[0].distanceTo(r[r.length-1])<1e-4,p=r[r.length-2].distanceTo(r[r.length-1])<1e-4;if((c||p)&&r.pop(),r.length<3)return 0;let d=0;for(let l=0,f=r.length-2;l<f;l++)d+=e(_e,r[0],r[l+1],r[l+2],e(_).meterScale);return d}),t(Ln,(s,r)=>{let c=0;for(let p=0,d=s.length-2;p<d;p++)c+=e(_e,s[0],s[p+1],s[p+2],r);return c}),t(_e,(s,r,c,p)=>{const d=s.distanceTo(r)*p,l=r.distanceTo(c)*p,f=c.distanceTo(s)*p,g=(d+l+f)/2;return Math.sqrt(g*(g-d)*(g-l)*(g-f))})}function Do(i){const t=(f,...g)=>i.fire(f,...g),e=(f,g,h)=>i.on(f,g,h),n=[],a=[];let o=!1,s=!1;e(ye,()=>o=!1),e(ki,()=>o=!0),e(Ci,()=>n),e(Gs,()=>{const f=[];for(let g=0,h=n.length;g<h;g++)f.push(...n[g].toArray());return f}),e(Ys,()=>{const f=[];for(let g=0,h=a.length;g<h;g++)f.push(...a[g].toArray());return f}),e(Je,f=>{for(let g=0,h=f.length/3|0;g<h;g++)n[g]=new u.Vector3(f[g*3+0],f[g*3+1],f[g*3+2])}),e(tn,f=>{for(let g=0,h=f.length/3|0;g<h;g++)a[g]=new u.Vector3(f[g*3+0],f[g*3+1],f[g*3+2])}),e(je,()=>{const f=t(W);n.push(f.object.position.clone()),a.push(f.target.clone())}),e(qe,()=>{n.length=0,a.length=0}),e(Mi,async()=>{const f=t(mt).meta||{};if(n.length){const g=[],h=[];for(let A=0,m=n.length;A<m;A++)g.push(...n[A].toArray()),h.push(...a[A].toArray());f.flyPositions=g,f.flyTargets=h}else delete f.flyPositions,delete f.flyTargets;return await t(St,f)}),e(Ti,()=>{s||(s=!0)&&t(me)});let r=0;const c=120*1e3;let p=0,d,l;e(me,f=>{if(r=0,p=Date.now(),d=null,l=null,!n.length||!f&&!t(W).autoRotate)return;const g=t(W),h=[g.object.position.clone()],A=[g.target.clone()],m=t(Ci)||[];for(let y=0,M=Math.min(m.length,100);y<M;y++)m[y]&&h.push(m[y]),a[y]&&A.push(a[y]);d=new u.CatmullRomCurve3(h),d.closed=!0,l=new u.CatmullRomCurve3(A),l.closed=!0,t(ki),t($,!1)}),e(Gt,()=>{if(Date.now()-p>c&&t(ye),!o||!d||!l)return;const f=t(W);r=(Date.now()-p)/c;const g=d.getPoint(r),h=l.getPoint(r);f.object.position.set(g.x,g.y,g.z),f.target.set(h.x,h.y,h.z)},!0)}class Po{constructor(t={}){this.disposed=!1,this.updateTime=0,this.needUpdate=!0,console.info("Reall3dViewer",Ae),this.init(ls(t)),!t.disableDropLocalFile&&this.enableDropLocalFile()}init(t){const e=this;t.position=t.position?[...t.position]:[0,-5,15],t.lookAt=t.lookAt?[...t.lookAt]:[0,0,0],t.lookUp=t.lookUp?[...t.lookUp]:[0,-1,0];const n=Za(t),a=t.scene=t.scene||new u.Scene;ja(t);const o=t.controls=new mo(t);o.updateByOptions(t);const s=new on;t.viewerEvents=s,e.events=s;const r=(l,f,g)=>s.on(l,f,g),c=(l,...f)=>s.fire(l,...f);r(_,()=>t),r(Et,()=>n.domElement),r(Ht,()=>n),r(B,()=>a),r(W,()=>o),r(G,()=>o.object),r(J,()=>t.bigSceneMode),r(zs,l=>t.pointcloudMode=l);const p=[];r(K,()=>{for(e.needUpdate=!0;p.length;)p.pop().stop=!0;let l={count:0,stop:!1};p.push(l),c(ke,()=>{!e.disposed&&(e.needUpdate=!0),l.count++>=600&&(l.stop=!0)},()=>!e.disposed&&(c(Ye)||!l.stop),10)}),pn(s),$a(s),vn(s),ko(s),Ms(s),To(s),Cs(s),Io(s),Do(s),e.splatMesh=new lt(qa(t)),r(mt,()=>e.splatMesh),a.add(e.splatMesh),eo(s),a.add(new u.AmbientLight("#ffffff",2)),a.add(c(hi)),n.setAnimationLoop(e.update.bind(e)),r(wi,()=>{o.update(),!e.needUpdate&&c(ni)&&c(K)}),r(Dt,()=>c(ce),!0),r(Dt,()=>c(wi),!0),r(Mt,()=>{try{!(e.needUpdate=!1)&&n.render(a,c(G))}catch(l){console.warn(l.message)}},!0),r(Gt,()=>{},!0),r(oe,()=>e.dispose()),r(Ei,()=>console.info(JSON.stringify(c(mt).meta||{},null,2)));let d="";r(pe,(l="")=>{d=l,e.splatMesh.fire(Ze,d,!0)}),r(Ai,()=>d),c(nt,{scale:`1 : ${c(_).meterScale} m`}),e.initGsApi()}enableDropLocalFile(){const t=this;document.addEventListener("dragover",function(e){e.preventDefault(),e.stopPropagation()}),document.addEventListener("drop",async function(e){e.preventDefault(),e.stopPropagation();let n=e.dataTransfer.files[0];if(!n)return;let a;if(n.name.endsWith(".spx"))a="spx";else if(n.name.endsWith(".splat"))a="splat";else if(n.name.endsWith(".ply"))a="ply";else if(n.name.endsWith(".spz"))a="spz";else return console.error("unsupported format:",n.name);const o=URL.createObjectURL(n),s=t.events.fire(_);s.bigSceneMode=!1,s.pointcloudMode=!0,s.autoRotate=!0,s.debugMode=!0,t.reset(s),setTimeout(async()=>{await t.addModel({url:o,format:a}),URL.revokeObjectURL(o)})})}update(){const t=this;if(t.disposed)return;const e=(n,...a)=>t.events.fire(n,...a);Date.now()-t.updateTime>30&&(e(Dt),t.needUpdate&&e(Mt),e(Gt))}fire(t,e,n){const a=this;t===1&&a.splatMesh.fire(Be,e),t===2&&a.events.fire(je),t===3&&a.events.fire(me,!0),t===4&&a.events.fire(qe),t===5&&a.events.fire(Mi),t===6&&a.events.fire(ge),t===7&&a.events.fire(Si),t===8&&(async()=>{let o=await a.splatMesh.fire(en);e&&(o=a.splatMesh.fire(Pi)+e),a.splatMesh.fire(Ue,o)})()}options(t){const e=this;if(e.disposed)return{};const n=(r,...c)=>e.events.fire(r,...c);let a;return n(B).traverse(r=>!a&&r instanceof lt&&(a=r.options())),t&&(t.autoRotate!==void 0&&(n(W).autoRotate=t.autoRotate,n(_).autoRotate=t.autoRotate),t.pointcloudMode!==void 0&&n(fe,t.pointcloudMode),t.lightFactor!==void 0&&n(Qt,t.lightFactor),t.maxRenderCountOfMobile&&(n(_).maxRenderCountOfMobile=t.maxRenderCountOfMobile),t.maxRenderCountOfPc&&(n(_).maxRenderCountOfPc=t.maxRenderCountOfPc),t.debugMode!==void 0&&(n(_).debugMode=t.debugMode),t.markType!==void 0&&(n(_).markType=t.markType),t.markVisible!==void 0&&n(Nt,t.markVisible),t.meterScale!==void 0&&(n(_).meterScale=t.meterScale),t.markMode!==void 0&&(n(_).markMode=t.markMode,!t.markMode&&n(Ge),n(W).autoRotate=n(_).autoRotate=!1)),n(W).updateByOptions(t),n(nt,{scale:`1 : ${n(_).meterScale} m`}),Object.assign({...n(_)},a)}reset(t={}){const e=this;e.dispose(),e.disposed=!1,e.init(ls(t))}switchDeiplayMode(){const t=this;t.disposed||t.events.fire(he)}async addScene(t){const e=this;if(e.disposed)return;const n=(s,...r)=>e.events.fire(s,...r);let a={};try{const s=await fetch(t,{mode:"cors",credentials:"omit",cache:"reload"});if(s.status===200)a=await s.json();else return console.error("scene file fetch failed, status:",s.status)}catch(s){return console.error("scene file fetch failed",s.message)}if(!a.url)return console.error("missing model file url");if(!a.url.endsWith(".bin")&&!a.url.endsWith(".spx"))return console.error("The format is unsupported in the large scene mode",a.url);const o={...a,...a.cameraInfo||{}};a.autoCut=Math.min(Math.max(a.autoCut||0,0),50),o.bigSceneMode=a.autoCut>1,e.reset({...o}),!o.bigSceneMode&&delete a.autoCut,e.splatMesh.meta=a,rt&&(a.cameraInfo?.position||a.cameraInfo?.lookAt)&&e.events.fire(W)._dollyOut(.75),o.bigSceneMode?(n(Je,a.flyPositions||[]),n(tn,a.flyTargets||[])):n(Ke,a),await e.splatMesh.addModel({url:a.url},a),await n(pe,a.watermark),n(W).updateRotateAxis()}async addModel(t){const e=this;if(e.disposed)return;const n=(c,...p)=>e.events.fire(c,...p);let a="",o={url:""};if(Object.prototype.toString.call(t)==="[object String]"?t.endsWith(".meta.json")?a=t:o.url=t:o=t,!o.url&&!a)return console.error("model url is empty");const s=n(_);s.bigSceneMode=!1;let r={};if(!o.url.startsWith("blob:"))try{a=a||o.url.substring(0,o.url.lastIndexOf("."))+".meta.json";const c=await fetch(a,{mode:"cors",credentials:"omit",cache:"reload"});c.status===200?r=await c.json():console.warn("meta file fetch failed, status:",c.status)}catch(c){console.warn("meta file fetch failed",c.message,o.url)}if(r.showWatermark=r.showWatermark!==!1,r.url=r.url||o.url,delete r.autoCut,!o.format)if(o.url=o.url||r.url,o.url.endsWith(".spx"))o.format="spx";else if(o.url.endsWith(".splat"))o.format="splat";else if(o.url.endsWith(".ply"))o.format="ply";else if(o.url.endsWith(".spz"))o.format="spz";else{console.error("unknow format!",o.url);return}n(Ke,r),await e.splatMesh.addModel(o,r),await n(pe,r.watermark)}initGsApi(){const t=(d,...l)=>this.events.fire(d,...l),e=()=>{setTimeout(()=>window.focus()),t(ye),t(W).autoRotate=t(_).autoRotate=!t(_).autoRotate},n=(d=!0)=>{setTimeout(()=>window.focus()),d=!!d;const l=t(_);l.pointcloudMode!==d&&(l.bigSceneMode?t(fe,d):t(he))},a=(d=!0)=>{setTimeout(()=>window.focus()),t(Nt,!!d)},o=d=>{setTimeout(()=>window.focus());const l=t(_);if(l.markMode)return!1;if(d===1)l.markType="point";else if(d===2)l.markType="lines";else if(d===3)l.markType="plans";else if(d===4)l.markType="distance";else return!1;return l.markMode=!0,t($),!0},s=async d=>(setTimeout(()=>window.focus()),d?(t(Yt,d)?.dispose(),t(K),await t(ge)):!1),r=async(d,l=!0)=>(t(vi,d,l),t(Yt,d?.name)?.drawUpdate?.(d,l),t(K),l?(setTimeout(()=>window.focus()),await t(ge)):!0),c=(d=!0)=>{setTimeout(()=>window.focus()),t(Be,!!d)},p=(d,l=!0)=>{t(pe,d),l&&t(bi,d)};window.$api={switchAutoRotate:e,changePointCloudMode:n,showMark:a,startMark:o,deleteMark:s,updateMark:r,showWaterMark:c,setWaterMark:p}}dispose(){const t=this;if(t.disposed)return;t.disposed=!0;const e=(o,...s)=>t.events.fire(o,...s),n=e(Ht),a=n.domElement;e(Oe),e(ei),e(Xe),e(Pe),e(W).dispose(),e(vt,e(B)),n.clear(),n.dispose(),a.parentElement.removeChild(a),t.splatMesh=null,t.events.clear(),t.events=null}}function Lo(i){const t=(s,r,c)=>i.on(s,r,c),e=(s,...r)=>i.fire(s,...r),n=rt?1:20,a=new Map,o=new Map;t(ne,()=>e(at)&&a.set(Date.now(),1)),t(ie,()=>e(at)&&e(_t,a)),t(se,()=>e(at)&&o.set(Date.now(),1)),t(ae,()=>e(at)&&e(_t,o)),t(_t,s=>{let r=[],c=Date.now(),p=0;for(const d of s.keys())c-d<=1e3?p++:r.push(d);return r.forEach(d=>s.delete(d)),Math.min(p,30)}),t(N,()=>{const s=e(B),r=e(G),c=[];return s?.traverse(function(p){p.isWarpSplatMesh&&p.splatMesh?.visible&&c.push(p)}),c.sort((p,d)=>r.position.distanceTo(p.position)-r.position.distanceTo(d.position)),window.splat=c[0]?.splatMesh,c[0]?.splatMesh}),t(zi,()=>{const s=e(B),r=e(G),c=[];s?.traverse(function(p){p.isWarpSplatMesh&&c.push(p)}),c.sort((p,d)=>r.position.distanceTo(p.position)-r.position.distanceTo(d.position));for(let p=0;p<c.length;p++)c[p].active=p<n,c[p].splatMesh&&(c[p].splatMesh.renderOrder=1e3-p)}),t(Qi,()=>{const s=e(B),r=[];s?.traverse(c=>r.push(c)),r.forEach(c=>{c.dispose?c.dispose():(c.geometry?.dispose?.(),c.material&&c.material instanceof Array?c.material.forEach(p=>p?.dispose?.()):c.material?.dispose?.())}),s?.clear()}),t(nn,(s=.1)=>{const r=e(N);r&&r.visible&&r.rotateOnAxis(new u.Vector3(1,0,0),u.MathUtils.degToRad(s))}),t(sn,(s=.1)=>{const r=e(N);r&&r.visible&&r.rotateOnAxis(new u.Vector3(0,1,0),u.MathUtils.degToRad(s))}),t(an,(s=.1)=>{const r=e(N);r&&r.visible&&r.rotateOnAxis(new u.Vector3(0,0,1),u.MathUtils.degToRad(s))}),t(Xs,(s=.01)=>{const r=e(N);r&&r.visible&&(r.position.x+=s)}),t(Vi,(s=.01)=>{const r=e(N);r&&r.visible&&(r.position.y+=s)}),t($s,(s=.01)=>{const r=e(N);r&&r.visible&&(r.position.z+=s)}),t(Ks,s=>{const r=e(N);r&&r.visible&&s&&r.position.copy(s),console.info(r,s)}),t(Zs,(s=.01)=>{const r=e(N);r&&r.visible&&r.scale.set(r.scale.x+s,r.scale.y+s,r.scale.z+s)}),t(js,()=>{const s=e(N);s&&(s.visible=!s.visible)}),t(qs,async s=>{if(!s&&(s=e(N)),!s)return;const r=s.meta||{};return r.transform=s.matrix.toArray(),await e(St,JSON.stringify(r),s.meta.url)}),t(Fi,()=>{const s=e(_).root,r=new u.WebGLRenderer({antialias:!1,logarithmicDepthBuffer:!0,stencil:!0,alpha:!0,precision:"highp"});return r.setSize(s.clientWidth,s.clientHeight),r.setPixelRatio(Math.min(devicePixelRatio,2)),t(Ht,()=>r),t(Et,()=>r.domElement),r}),t(Bi,()=>{const s=new u.Scene,r=14414079;return s.background=new u.Color(r),s.fog=new u.FogExp2(r,0),t(B,()=>s),s}),t(Ui,()=>{const r=e(G),c=e(B),p=e(_),d=new yo(e(G),p.root);return d.screenSpacePanning=!1,d.minDistance=.1,d.maxDistance=1e5,d.maxPolarAngle=1.2,d.enableDamping=!0,d.dampingFactor=.07,d.zoomToCursor=!0,d.addEventListener("change",()=>{const l=Math.max(d.getPolarAngle(),.1),f=Math.max(d.getDistance(),.1);d.zoomSpeed=Math.max(Math.log(f),0)+.5,r.far=u.MathUtils.clamp(f/l*8,100,2e5),r.near=r.far/1e3,r.updateProjectionMatrix(),c.fog instanceof u.FogExp2&&(c.fog.density=l/(f+5)*1*.25),d.maxPolarAngle=Math.min(Math.pow(1e4/f,4),1.2)}),t(W,()=>d),t(Ot,()=>r.fov),t(bt,(l=!1)=>l?r.position.clone():r.position),t(yt,(l=!1)=>l?d.target.clone():d.target),t(It,(l=!1)=>l?r.up.clone():r.up),d}),t(Oi,()=>{const s=new u.DirectionalLight(16777215,1);return s.position.set(0,2e3,1e3),s}),window.addEventListener("beforeunload",()=>e(oe))}function Ro(i){let{root:t="#map",debugMode:e}=i;t?t=typeof t=="string"?document.querySelector(t)||document.querySelector("#map"):t:t=document.querySelector("#map"),t||(t=document.createElement("div"),t.id="map",(document.querySelector("#gsviewer")||document.querySelector("body")).appendChild(t));const n={...i};return n.root=t,n}function Fo(){const i=Dn.TileSource.create({dataType:"image",attribution:"ArcGIS",url:"https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"}),t=new Dn.TileMap({imgSource:i,lon0:90,minLevel:2,maxLevel:16});return t.scale.set(10,10,10),t.rotateX(-Math.PI/2),t.autoUpdate=!1,t}class Bo{constructor(){this.down=0,this.move=!1,this.downTime=0,this.isDbClick=!1,this.x=0,this.y=0,this.lastClickX=0,this.lastClickY=0,this.lastClickPointTime=0,this.lastMovePoint=null,this.lastMovePointTime=0}}function Uo(i){const t=(x,C,v)=>i.on(x,C,v),e=(x,...C)=>i.fire(x,...C),n=e(Et);let a=new Set,o,s=new Bo;t(ce,()=>{if(!a.size)return;if(!e(_).enableKeyboard)return a.clear();if(a.has("KeyH")){const C=e(N);C&&(C.visible=!C.visible),a.clear()}else if(a.has("Equal")){const C=e(N);if(!C||!C.visible)return a.clear();if(a.has("KeyX")){const v=u.MathUtils.degToRad(.1);C.rotateOnAxis(new u.Vector3(1,0,0),v)}else C.scale.set(C.scale.x+.01,C.scale.y+.01,C.scale.z+.01)}else if(a.has("Minus")){const C=e(N);if(!C||!C.visible)return a.clear();if(a.has("KeyX")){const v=u.MathUtils.degToRad(-.1);C.rotateOnAxis(new u.Vector3(1,0,0),v)}else C.scale.set(C.scale.x-.01,C.scale.y-.01,C.scale.z-.01)}else if(a.has("ArrowUp")){const C=e(N);C&&C.visible&&(C.position.z+=.1)}else if(a.has("ArrowDown")){const C=e(N);C&&C.visible&&(C.position.z-=.1)}else if(a.has("ArrowRight")){const C=e(N);C&&C.visible&&(C.position.x+=.1)}else if(a.has("ArrowLeft")){const C=e(N);C&&C.visible&&(C.position.x-=.1)}else if(a.has("KeyU")){const C=e(N);if(C){const v=C.meta||{};v.transform=C.matrix.toArray()}}else a.has("KeyQ")?e(nn,.1):a.has("KeyW")?e(sn,.1):a.has("KeyE")?e(an,.1):a.has("KeyA")?e(nn,-.1):a.has("KeyS")?e(sn,-.1):a.has("KeyD")?e(an,-.1):a.has("KeyY")?e(Vi,a.has("ShiftLeft")||a.has("ShiftRight")?-.1:.1):a.has("KeyC")&&console.info("position=",e(bt).toArray(),"lookat=",e(yt).toArray())});const r=x=>{console.info(x.code),x.target.type!=="text"&&(o||x.code==="F5"||(x.preventDefault(),a.add(x.code)))},c=x=>{x.target.type!=="text"&&(o||a.clear())},p=()=>{a.clear()},d=x=>{parent&&setTimeout(()=>window.focus()),x.preventDefault()},l=async x=>{x.preventDefault()};let f,g,h,A;t(Xt,()=>{f?.dispose(),g?.dispose(),h?.dispose(),A?.dispose(),f=null,g=null,h=null,A=null,s.lastMovePoint=null,e(wt)});const m=async x=>{parent&&setTimeout(()=>window.focus()),x.preventDefault(),!o&&(s.down=x.button===2?2:1,s.move=!1,s.isDbClick=Date.now()-s.downTime<300,s.downTime=Date.now())},y=async x=>{x.preventDefault(),!o&&s.down&&(s.move=!0)},M=async x=>{x.preventDefault(),!o&&(s.down=0,s.move=!1)};function b(x){x.preventDefault(),!o&&(s.down=x.touches.length,s.down===1&&(s.move=!1,s.x=x.touches[0].clientX,s.y=x.touches[0].clientY))}function S(x){x.touches.length===1&&(s.move=!0)}function k(x){s.down===1&&!s.move&&e(Wt,s.x,s.y)}window.addEventListener("keydown",r),window.addEventListener("keyup",c),window.addEventListener("blur",p),window.addEventListener("wheel",d,{passive:!1}),n.addEventListener("contextmenu",l),n.addEventListener("mousedown",m),n.addEventListener("mousemove",y),n.addEventListener("mouseup",M),n.addEventListener("touchstart",b,{passive:!1}),n.addEventListener("touchmove",S,{passive:!1}),n.addEventListener("touchend",k,{passive:!1}),t(Pe,()=>{o=!0,window.removeEventListener("keydown",r),window.removeEventListener("keyup",c),window.removeEventListener("blur",p),window.removeEventListener("wheel",d),n.removeEventListener("contextmenu",l),n.removeEventListener("mousedown",m),n.removeEventListener("mousemove",y),n.removeEventListener("mouseup",M),n.removeEventListener("touchstart",b),n.removeEventListener("touchmove",S),n.removeEventListener("touchend",k)}),t(Wt,async(x,C)=>await e(le,x,C))}var Bt=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var t=1.70158;return i===1?1:i*i*((t+1)*i-t)},Out:function(i){var t=1.70158;return i===0?0:--i*i*((t+1)*i+t)+1},InOut:function(i){var t=2.5949095;return(i*=2)<1?.5*(i*i*((t+1)*i-t)):.5*((i-=2)*i*((t+1)*i+t)+2)}}),Bounce:Object.freeze({In:function(i){return 1-Bt.Bounce.Out(1-i)},Out:function(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},InOut:function(i){return i<.5?Bt.Bounce.In(i*2)*.5:Bt.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(t){return Math.pow(t,i)},Out:function(t){return 1-Math.pow(1-t,i)},InOut:function(t){return t<.5?Math.pow(t*2,i)/2:(1-Math.pow(2-t*2,i))/2+.5}}}}),Jt=function(){return performance.now()},Oo=function(){function i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return i.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var a=0,o=e;a<o.length;a++){var s=o[a];(t=s._group)===null||t===void 0||t.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},i.prototype.remove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=0,a=t;n<a.length;n++){var o=a[n];o._group=void 0,delete this._tweens[o.getId()],delete this._tweensAddedDuringUpdate[o.getId()]}},i.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},i.prototype.update=function(t,e){t===void 0&&(t=Jt()),e===void 0&&(e=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var a=0;a<n.length;a++){var o=this._tweens[n[a]],s=!e;o&&o.update(t,s)===!1&&!e&&this.remove(o)}n=Object.keys(this._tweensAddedDuringUpdate)}},i}(),In={Linear:function(i,t){var e=i.length-1,n=e*t,a=Math.floor(n),o=In.Utils.Linear;return t<0?o(i[0],i[1],n):t>1?o(i[e],i[e-1],e-n):o(i[a],i[a+1>e?e:a+1],n-a)},Utils:{Linear:function(i,t,e){return(t-i)*e+i}}},Ts=function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i}(),_n=new Oo,Vo=function(){function i(t,e){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Bt.Linear.None,this._interpolationFunction=In.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Ts.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof e=="object"?(this._group=e,e.add(this)):e===!0&&(this._group=_n,_n.add(this))}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(t,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},i.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},i.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},i.prototype.start=function(t,e){if(t===void 0&&(t=Jt()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var a={};for(var o in this._valuesEnd)a[o]=this._valuesEnd[o];this._valuesEnd=a}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},i.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},i.prototype._setupProperties=function(t,e,n,a,o){for(var s in n){var r=t[s],c=Array.isArray(r),p=c?"array":typeof r,d=!c&&Array.isArray(n[s]);if(!(p==="undefined"||p==="function")){if(d){var l=n[s];if(l.length===0)continue;for(var f=[r],g=0,h=l.length;g<h;g+=1){var A=this._handleRelativeValue(r,l[g]);if(isNaN(A)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}f.push(A)}d&&(n[s]=f)}if((p==="object"||c)&&r&&!d){e[s]=c?[]:{};var m=r;for(var y in m)e[s][y]=m[y];a[s]=c?[]:{};var l=n[s];if(!this._isDynamic){var M={};for(var y in l)M[y]=l[y];n[s]=l=M}this._setupProperties(m,e[s],l,a[s],o)}else(typeof e[s]>"u"||o)&&(e[s]=r),c||(e[s]*=1),d?a[s]=n[s].slice().reverse():a[s]=e[s]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},i.prototype.pause=function(t){return t===void 0&&(t=Jt()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},i.prototype.resume=function(t){return t===void 0&&(t=Jt()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},i.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},i.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},i.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},i.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},i.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},i.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},i.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},i.prototype.easing=function(t){return t===void 0&&(t=Bt.Linear.None),this._easingFunction=t,this},i.prototype.interpolation=function(t){return t===void 0&&(t=In.Linear),this._interpolationFunction=t,this},i.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},i.prototype.onStart=function(t){return this._onStartCallback=t,this},i.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},i.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},i.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},i.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},i.prototype.onStop=function(t){return this._onStopCallback=t,this},i.prototype.update=function(t,e){var n=this,a;if(t===void 0&&(t=Jt()),e===void 0&&(e=i.autoStartOnUpdate),this._isPaused)return!0;var o;if(!this._goToEnd&&!this._isPlaying)if(e)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var s=t-this._startTime,r=this._duration+((a=this._repeatDelayTime)!==null&&a!==void 0?a:this._delayTime),c=this._duration+this._repeat*r,p=function(){if(n._duration===0||s>c)return 1;var A=Math.trunc(s/r),m=s-A*r,y=Math.min(m/n._duration,1);return y===0&&s===n._duration?1:y},d=p(),l=this._easingFunction(d);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,l),this._onUpdateCallback&&this._onUpdateCallback(this._object,d),this._duration===0||s>=this._duration)if(this._repeat>0){var f=Math.min(Math.trunc((s-this._duration)/r)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=f);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=r*f,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var g=0,h=this._chainedTweens.length;g<h;g++)this._chainedTweens[g].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(t,e,n,a){for(var o in n)if(e[o]!==void 0){var s=e[o]||0,r=n[o],c=Array.isArray(t[o]),p=Array.isArray(r),d=!c&&p;d?t[o]=this._interpolationFunction(r,a):typeof r=="object"&&r?this._updateProperties(t[o],s,r,a):(r=this._handleRelativeValue(s,r),typeof r=="number"&&(t[o]=s+(r-s)*a))}},i.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},i.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},i.autoStartOnUpdate=!1,i}();Ts.nextId;var ht=_n;ht.getAll.bind(ht),ht.removeAll.bind(ht),ht.add.bind(ht),ht.remove.bind(ht),ht.update.bind(ht);const ks=navigator.userAgent.includes("Mobi");class zo extends u.Mesh{constructor(t,e){super(),this.isWarpSplatMesh=!0,this.lastActiveTime=Date.now(),this.active=!1,this.disposed=!1,this.mapViewer=e,this.addScene(t),this.frustumCulled=!1}async addScene(t){const e=this,{renderer:n,scene:a,controls:o,tileMap:s}=e.mapViewer;fetch(t,{mode:"cors",credentials:"omit",cache:"reload"}).then(r=>r.ok?r.json():{}).then(r=>{const c=new u.Matrix4;if(r.transform)c.fromArray(r.transform);else if(r.WGS84){const h=s.geo2world(new u.Vector3().fromArray(r.WGS84));c.makeTranslation(h.x,h.y,h.z)}r.autoCut&&(r.autoCut=Math.min(Math.max(r.autoCut,1),50));const p=r.autoCut&&r.autoCut>1,d=!1,l=!1,f=r.showWatermark!==!1,g={renderer:n,scene:a,controls:o,pointcloudMode:d,bigSceneMode:p,matrix:c,showWatermark:f,depthTest:l};g.maxRenderCountOfMobile??(g.maxRenderCountOfMobile=g.bigSceneMode?128*10240:400*1e4),g.maxRenderCountOfPc??(g.maxRenderCountOfPc=g.bigSceneMode?320*1e4:400*1e4),g.debugMode=this.mapViewer.events.fire(_).debugMode,e.opts=g,e.meta=r,a.add(e),e.initCSS3DSprite(g),e.applyMatrix4(c)}).catch(r=>{console.error(r.message)})}async initCSS3DSprite(t){const e=this,n=document.createElement("div");n.innerHTML=`<div title="${e.meta.name}" style='flex-direction: column;align-items: center;display: flex;pointer-events: auto;margin-bottom: 20px;'>
|
|
723
|
+
</div>`,p.classList.add("mark-wrap-circle",`${n.name}`,"main-warp"),p.style.position="absolute",p.style.borderRadius="4px",p.style.cursor="pointer",p.onclick=()=>{if(e.events.fire(_).markMode)return;const m=parent?.onActiveMark;m?.(e.getMarkData(!0)),e.events.fire($)},p.oncontextmenu=m=>m.preventDefault();const d=new u.Vector3().fromArray(n.startPoint),l=n.radius*e.events.fire(_).meterScale,f=(Math.PI*l*l).toFixed(2)+" m²",g=new et(p);g.position.copy(d),g.element.style.pointerEvents="none",g.scale.set(.01,.01,.01),g.visible=n.mainTagVisible;const h=document.createElement("div");h.innerHTML=`<span class="${c}-distance-tag ${c}-circle-tag" style="color:${n.circleTagColor};background:${n.circleTagBackground};opacity:${n.circleTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${f}</span>`,h.classList.add("mark-wrap-circle",`${c}`,"circle-warp"),h.style.position="absolute",h.style.borderRadius="4px",h.style.pointerEvents="none";const A=new et(h);A.position.set(d.x+Math.min(n.radius/2,.5),d.y,d.z),A.element.style.pointerEvents="none",A.scale.set(.008,.008,.008),A.visible=n.circleTagVisible,e.add(s,g,A),e.data=n,e.circleMesh=s,e.css3dTag=A,e.css3dMainTag=g,e.events.fire(At,e)}getMarkData(t=!1){const e={...this.data};return t?(delete e.startPoint,delete e.radius):e.startPoint=[...e.startPoint],e}dispose(){if(this.disposed)return;const t=this;t.disposed=!0,t.events.fire(vt,t),t.events.fire(B).remove(t),t.events.fire(Pt,t),document.querySelectorAll(`.${t.data.name}`).forEach(n=>n.parentElement?.removeChild(n)),t.events=null,t.data=null,t.circleMesh=null,t.css3dTag=null,t.css3dMainTag=null}}let Mo=class{constructor(){this.down=0,this.move=!1,this.downTime=0,this.isDbClick=!1,this.x=0,this.y=0,this.lastClickX=0,this.lastClickY=0,this.lastClickPointTime=0,this.lastMovePoint=null,this.lastMovePointTime=0}};function To(i){const t=(v,D,I)=>i.on(v,D,I),e=(v,...D)=>i.fire(v,...D),n=e(Et);let a=new Set,o,s=new Mo,r;t(Qn,()=>{e(W).autoRotate=e(_).autoRotate=!0}),t($,(v=!0)=>{e(W).autoRotate=e(_).autoRotate=!1,v&&e(ye)}),t(Qe,(v=!0)=>{if(o)return;const D=e(W),I=v?Math.PI/128:-(Math.PI/128),T=new u.Matrix4().makeRotationAxis(new u.Vector3(0,0,-1).transformDirection(D.object.matrixWorld),I);D.object.up.transformDirection(T),e(K)}),t(pi,()=>{o||i.fire(Qe,!0)}),t(fi,()=>{o||i.fire(Qe,!1)}),t(fe,v=>{const D=e(_);v??(v=!D.pointcloudMode),D.pointcloudMode=v,e(B).traverse(T=>T instanceof lt&&T.fire(zt,v))}),t(he,()=>{e(B).traverse(D=>D instanceof lt&&D.fire(ze))}),t(Qt,v=>{e(B).traverse(I=>I instanceof lt&&I.fire(Qt,v))}),t(Ri,()=>{const v=e(B);let D;v.traverse(I=>I instanceof lt&&(D=I)),D&&e(De,D.fire(Li))}),t(ce,()=>{if(!a.size)return;const v=e(_);if(!v.enableKeyboard)return a.clear();if(v.markMode&&a.has("Escape")){e(Xt),a.clear();return}a.has("Space")?(v.bigSceneMode?e(fe):e(he),a.clear()):a.has("KeyR")?(v.autoRotate?e($):e(Qn),a.clear()):a.has("KeyM")?(e(Nt,!v.markVisible),a.clear()):a.has("ArrowLeft")?(e(pi),e(de,!0),a.clear()):a.has("ArrowRight")?(e(fi),e(de,!0),a.clear()):a.has("KeyP")?(e(me,!0),a.clear()):a.has("Equal")?(e(je),a.clear()):a.has("Minus")?(e(qe),a.clear()):a.has("KeyY")?(e($e),a.clear()):a.has("KeyI")?(e(Ei),a.clear()):a.has("KeyF")?(e(Ri),a.clear()):a.has("F2")&&(!v.bigSceneMode&&window.open("/editor/index.html?url="+encodeURIComponent(e(mt).meta.url)),a.clear())}),t(Wt,async(v,D)=>{if(s.move)return;const I=await e(le,v,D);I.length&&e(De,I[0],!0)}),t(ot,async(v,D)=>{const I=e(B),T=[];I.traverse(E=>E instanceof lt&&T.push(E));const R=await e(le,v,D);return R.length?(T.length&&T[0].fire(ee,R[0].x,R[0].y,R[0].z,!0),new u.Vector3(R[0].x,R[0].y,R[0].z)):(T.length&&T[0].fire(ee,0,0,0,!1),null)}),t(Ge,async()=>{const v=e(B),D=[];v.traverse(I=>I instanceof lt&&D.push(I));for(let I=0;I<D.length;I++)D[I].fire(ee,0,0,0,!1)});const c=v=>{v.target.type!=="text"&&(o||v.code==="F5"||(v.preventDefault(),v.code!=="KeyR"&&(a.add(v.code),e($)),r=Date.now()))},p=v=>{v.target.type!=="text"&&(o||(v.code==="KeyR"&&a.add(v.code),(v.code==="ArrowLeft"||v.code==="ArrowRight")&&e(Un),r=Date.now()))};t(Mt,()=>{e(Ye)&&Date.now()-r>2e3&&(e(de,!1),e($e))},!0);const d=()=>{a.clear()},l=v=>{parent&&setTimeout(()=>window.focus()),v.preventDefault(),!o&&(e($),r=Date.now())},f=v=>{v.preventDefault(),!o&&(e($),r=Date.now())};let g,h,A,m;t(Xt,()=>{g?.dispose(),h?.dispose(),A?.dispose(),m?.dispose(),g=null,h=null,A=null,m=null,s.lastMovePoint=null,e(wt)});const y=async v=>{parent&&setTimeout(()=>window.focus()),v.preventDefault(),!o&&(e($),s.down=v.button===2?2:1,s.move=!1,s.isDbClick=Date.now()-s.downTime<300,r=Date.now(),s.downTime=Date.now())},M=async v=>{if(v.preventDefault(),o)return;s.down&&(s.move=!0,r=Date.now());const D=e(_);if(D.markMode){const I=await e(ot,v.clientX,v.clientY);I&&!s.down&&D.markType==="distance"&&g?g.drawUpdate({endPoint:I.toArray()}):!s.down&&D.markType==="circle"&&m?I?(m.drawUpdate(null,!0,I),s.lastMovePoint=I,s.lastMovePointTime=Date.now()):(s.lastMovePoint=null,s.lastMovePointTime=0):!s.down&&D.markType==="lines"&&h?I?(h.drawUpdate(null,!0,I),s.lastMovePoint=I,s.lastMovePointTime=Date.now()):(s.lastMovePoint=null,s.lastMovePointTime=0):!s.down&&D.markType==="plans"&&A&&(I?(A.drawUpdate(null,!0,I),s.lastMovePoint=I,s.lastMovePointTime=Date.now()):(s.lastMovePoint=null,s.lastMovePointTime=0))}},b=async v=>{if(v.preventDefault(),o)return;const D=e(_);if(s.isDbClick&&(h?Math.abs(v.clientX-s.lastClickX)<2&&Math.abs(v.clientY-s.lastClickY)<2&&(h.drawFinish(s.lastClickPointTime>0),h=null,s.lastMovePoint=null):A&&Math.abs(v.clientX-s.lastClickX)<2&&Math.abs(v.clientY-s.lastClickY)<2&&(A.drawFinish(s.lastClickPointTime>0),A=null,s.lastMovePoint=null)),D.markMode&&s.down===1&&!s.move&&Date.now()-s.downTime<500){if(D.markType==="point"){if(await e(ot,v.clientX,v.clientY)){const T=new bs(i,await e(ot,v.clientX,v.clientY));e(B).add(T),T.drawFinish()}}else if(D.markType==="distance")if(g){const I=await e(ot,v.clientX,v.clientY);I?(g.drawFinish(I),g=null):s.isDbClick&&e(Xt)}else{const I=await e(ot,v.clientX,v.clientY);I&&(g=new Tn(i),g.drawStart(I),e(B).add(g))}else if(D.markType==="lines")if(h)if(s.lastMovePoint&&e(We,v.clientX,v.clientY,s.lastMovePoint)<.03)h.drawUpdate(null,!0,s.lastMovePoint,!0),s.lastClickPointTime=Date.now();else{const I=await e(ot,v.clientX,v.clientY);I?(h.drawUpdate(null,!0,I,!0),s.lastClickPointTime=Date.now()):s.lastClickPointTime=0}else{const I=await e(ot,v.clientX,v.clientY);I&&(h=new kn(i),h.drawStart(I),e(B).add(h))}else if(D.markType==="plans")if(A)if(s.lastMovePoint&&e(We,v.clientX,v.clientY,s.lastMovePoint)<.03)A.drawUpdate(null,!0,s.lastMovePoint,!0),s.lastClickPointTime=Date.now();else{const I=await e(ot,v.clientX,v.clientY);I?(A.drawUpdate(null,!0,I,!0),s.lastClickPointTime=Date.now()):s.lastClickPointTime=0}else{const I=await e(ot,v.clientX,v.clientY);I&&(A=new En(i),A.drawStart(I),e(B).add(A))}else if(D.markType==="circle")if(m){const I=await e(ot,v.clientX,v.clientY);I?(m.drawFinish(I),m=null):s.isDbClick&&e(Xt)}else{const I=await e(ot,v.clientX,v.clientY);I&&(m=new xs(i),m.drawStart(I),e(B).add(m))}s.lastClickX=v.clientX,s.lastClickY=v.clientY}s.down===2&&!s.move&&e(Wt,v.clientX,v.clientY),s.down=0,s.move=!1,r=Date.now()};function S(v){v.preventDefault(),!o&&(e($),s.down=v.touches.length,s.down===1&&(s.move=!1,s.x=v.touches[0].clientX,s.y=v.touches[0].clientY))}function k(v){v.touches.length===1&&(s.move=!0)}function x(v){s.down===1&&!s.move&&e(Wt,s.x,s.y)}window.addEventListener("keydown",c),window.addEventListener("keyup",p),window.addEventListener("blur",d),window.addEventListener("wheel",l,{passive:!1}),n.addEventListener("contextmenu",f),n.addEventListener("mousedown",y),n.addEventListener("mousemove",M),n.addEventListener("mouseup",b),n.addEventListener("touchstart",S,{passive:!1}),n.addEventListener("touchmove",k,{passive:!1}),n.addEventListener("touchend",x,{passive:!1}),window.addEventListener("resize",C),C();function C(){const{width:v,height:D,top:I,left:T}=e(xt),R=e(G);R.aspect=v/D,R.updateProjectionMatrix();const E=e(Ne);E.setSize(v,D),E.domElement.style.position="absolute",E.domElement.style.left=`${T}px`,E.domElement.style.top=`${I}px`;const P=e(Ht);P.setPixelRatio(Math.min(devicePixelRatio,2)),P.setSize(v,D)}t(Pe,()=>{o=!0,window.removeEventListener("keydown",c),window.removeEventListener("keyup",p),window.removeEventListener("blur",d),window.removeEventListener("wheel",l),n.removeEventListener("contextmenu",f),n.removeEventListener("mousedown",y),n.removeEventListener("mousemove",M),n.removeEventListener("mouseup",b),n.removeEventListener("touchstart",S),n.removeEventListener("touchmove",k),n.removeEventListener("touchend",x),window.removeEventListener("resize",C)})}function Cs(i){const t=new u.Raycaster,e=.02,n=(o,s,r)=>i.on(o,s,r),a=(o,...s)=>i.fire(o,...s);n(le,async(o,s)=>{const{width:r,height:c,left:p,top:d}=a(xt),l=new u.Vector2;l.x=(o-p)/r*2-1,l.y=(d-s)/c*2+1;const f=a(G);t.setFromCamera(l,f);const g=[],h=a(B),A=[],m=[];h.traverse(function(S){S instanceof lt?m.push(S):S.isMesh&&!S.ignoreIntersect&&!S.isMark&&A.push(S)});const y=t.intersectObjects(A,!0);for(let S=0;S<y.length;S++)g.push(new u.Sphere(y[S].point,t.ray.distanceToPoint(y[S].point)));const M=f.projectionMatrix.clone().multiply(f.matrixWorldInverse);for(let S=0;S<m.length;S++){const k=m[S].fire(He);if(k)if(k.length!==void 0){const x=k,C=x.length/3;for(let v=0;v<C;v++){const D=new u.Vector3(x[3*v+0],x[3*v+1],x[3*v+2]),I=new u.Vector4(D.x,D.y,D.z,1).applyMatrix4(M),T=I.x/I.w,R=I.y/I.w;Math.sqrt((T-l.x)**2+(R-l.y)**2)<=e&&g.push(new u.Sphere(D,t.ray.distanceToPoint(D)))}}else for(let x of Object.keys(k)){const C=x.split(","),v=new u.Vector3(Number(C[0]),Number(C[1]),Number(C[2]));if(t.ray.distanceToPoint(v)<=1.4143){const D=k[x];for(let I=0,T=D.length/3;I<T;I++){const R=new u.Vector3(D[3*I+0],D[3*I+1],D[3*I+2]),E=new u.Vector4(R.x,R.y,R.z,1).applyMatrix4(M),P=E.x/E.w,U=E.y/E.w;Math.sqrt((P-l.x)**2+(U-l.y)**2)<=e&&g.push(new u.Sphere(R,t.ray.distanceToPoint(R)))}}}}g.sort((S,k)=>S.radius-k.radius);const b=[];for(let S=0;S<g.length;S++)b.push(g[S].center);return b}),n(We,(o,s,r)=>{const{width:c,height:p,left:d,top:l}=a(xt),f=new u.Vector2;f.x=(o-d)/c*2-1,f.y=(l-s)/p*2+1;const g=a(G);return t.setFromCamera(f,g),t.ray.distanceToPoint(r)})}function ko(i){const t=(r,c,p)=>i.on(r,c,p),e=(r,...c)=>i.fire(r,...c);t(Ot,()=>e(G).fov),t(bt,(r=!1)=>r?e(G).position.clone():e(G).position),t(yt,(r=!1)=>r?e(W).target.clone():e(W).target),t(It,(r=!1)=>r?e(G).up.clone():e(G).up),t(De,(r,c=!1)=>{if(e(gi,r),!c){e(W).target.copy(r),e(ue);return}const p=e(W).target.clone();let d=0;e(Ut,()=>{d+=.03,e(W).target.copy(p.clone().lerp(r,d)),e(ue)},()=>d<1)}),t(Fn,()=>{let r=e(bt).toArray(),c=e(It).toArray(),p=e(yt).toArray();return{position:r,lookUp:c,lookAt:p}}),t(Bn,()=>e(W).update()),t(Un,()=>e(W).updateRotateAxis());const n=.01;let a=new u.Vector3,o=new u.Vector3,s=0;t(ni,()=>{const r=e(W).object,c=r.fov,p=r.position.clone(),d=r.getWorldDirection(new u.Vector3);return Math.abs(s-c)<n&&Math.abs(p.x-a.x)<n&&Math.abs(p.y-a.y)<n&&Math.abs(p.z-a.z)<n&&Math.abs(d.x-o.x)<n&&Math.abs(d.y-o.y)<n&&Math.abs(d.z-o.z)<n?!1:(s=c,a=p,o=d,!0)})}class Eo extends u.Mesh{constructor(){super(...arguments),this.ignoreIntersect=!0}}function Io(i){let t=!1;const e=(r,c,p)=>i.on(r,c,p),n=(r,...c)=>i.fire(r,...c),a=[],o=new u.Vector3,s=new u.Matrix4;e(hi,()=>{const r=new u.SphereGeometry(.5,32,32),c=_o();c.depthTest=!1,c.depthWrite=!1,c.transparent=!0;const p=new Eo;return p.copy(new u.Mesh(r,c)),e(Us,()=>c),e(mi,d=>{t||(c.uniforms[wn].value=d,d<=.01?p.visible=!1:p.visible=!0,c.uniformsNeedUpdate=!0,n(K))}),e(gi,d=>{if(t)return;const l=n(G);s.copy(l.matrixWorld).invert(),o.copy(d).applyMatrix4(s),o.normalize().multiplyScalar(10),o.applyMatrix4(l.matrixWorld);const{width:f,height:g}=n(xt);c.uniforms[jt].value.set(f,g),p.position.copy(o),c.uniforms[$i].value.copy(d),c.uniforms[jt].value.set(f,g),c.uniforms[wn].value=1,c.uniformsNeedUpdate=!0,n(yi),n(K)}),e(Os,()=>{t||(t=!0,c.dispose(),r.dispose())}),p.renderOrder=99999,p}),e(yi,()=>{for(;a.length;)a.pop().opacity=0;let r={opacity:1};a.push(r),n(ke,()=>{!t&&r.opacity>0&&(r.opacity<.2?r.opacity=0:r.opacity>.6?r.opacity=Math.max(r.opacity-=.01,0):r.opacity=Math.max(r.opacity-=.03,0),n(mi,r.opacity))},()=>!t&&r.opacity>0)})}function _o(){const i={[Ta]:{type:"v3",value:new u.Color},[$i]:{type:"v3",value:new u.Vector3},[jt]:{type:"v2",value:new u.Vector2},[wn]:{value:0}};return new u.ShaderMaterial({uniforms:i,vertexShader:xa(),fragmentShader:Ca(),transparent:!0,depthTest:!1,depthWrite:!1,side:u.FrontSide})}function Ms(i){const t=(s,r,c)=>i.on(s,r,c),e=(s,...r)=>i.fire(s,...r),n=new Map,a=document.createElement("div");a.classList.add("mark-warp"),document.body.appendChild(a);const o=new Co;o.setSize(innerWidth,innerHeight),o.domElement.style.position="absolute",o.domElement.style.top="0px",o.domElement.style.pointerEvents="none",a.appendChild(o.domElement),t(Qs,()=>a),t(Ne,()=>o),t(Xe,()=>document.body.removeChild(a)),t(Mt,()=>o.render(e(B),e(G)),!0),t(At,s=>{const r=s?.getMarkData?.()?.name||s?.name;r&&n.set(r,new WeakRef(s))}),t(Pt,s=>{const r=s?.getMarkData?.()?.name||s?.name;n.delete(r)}),t(Yt,s=>n.get(s)?.deref()),t(Hs,(s,r)=>{const c=e(Yt,s);!c||!r||c.drawUpdate?.(r)}),t(Ws,s=>{const r=e(Yt,s);return r?r.getMarkData?.():{}}),t(Nt,s=>{s!==void 0&&(e(_).markVisible=s),e(B).traverse(r=>r.isMark&&(r.visible=e(_).markVisible)),e(K)}),t($e,async()=>{const s=[];e(B).traverse(c=>{if(c.isMark){const p=c.getMarkData?.();p&&s.push(p)}});const r=e(mt).meta||{};return s.length?r.marks=s:delete r.marks,r.cameraInfo=e(Fn),await e(St,r)}),t(ge,async()=>{const s=[];e(B).traverse(c=>{if(c.isMark){const p=c.getMarkData?.();p&&s.push(p)}});const r=e(mt).meta||{};return s.length?r.marks=s:delete r.marks,await e(St,r)}),t(Si,async()=>{const s=e(mt).meta||{};delete s.marks;const r=await e(St,s),c=[];return n.forEach(p=>c.push(p)),c.forEach(p=>p.deref()?.dispose?.()),e(K),r}),t(bi,async()=>{e(B).traverse(r=>{r.isMark&&r.getMarkData?.()});const s=e(mt).meta||{};return s.watermark=e(Ai)||"",await e(St,s)}),t(Ke,s=>{s.meterScale&&(e(_).meterScale=s.meterScale,e(nt,{scale:`1 : ${e(_).meterScale} m`})),e(W).updateByOptions({...s,...s.cameraInfo||{}}),(s.marks||[]).forEach(c=>{if(c.type==="MarkSinglePoint"){const p=new bs(i,c);p.visible=!1,e(B).add(p)}else if(c.type==="MarkDistanceLine"){const p=new Tn(i);p.draw(c),p.visible=!1,e(B).add(p)}else if(c.type==="MarkMultiLines"){const p=new kn(i);p.draw(c,!0),p.visible=!1,e(B).add(p)}else if(c.type==="MarkMultiPlans"){const p=new En(i);p.draw(c,!0),p.visible=!1,e(B).add(p)}else if(c.type==="MarkCirclePlan"){const p=new xs(i);p.draw(c),p.visible=!1,e(B).add(p)}}),e(Je,s.flyPositions||[]),e(tn,s.flyTargets||[])}),t(wt,()=>{const s=e(_);s.markMode=!1,e(Ge),e(K)}),t(vi,(s,r=!0)=>{const c=s?.meterScale;if(c){if(typeof c!="number"||c<=0){console.warn("meterScale is not a number or <= 0",s);return}r&&(e(_).meterScale=s.meterScale),e(nt,{scale:`1 : ${c} m`});for(const p of n.values()){const d=p.deref();d&&(d instanceof Tn||d instanceof kn||d instanceof En)&&d.updateByMeterScale(c)}}}),t(Ee,s=>{const r=new u.Vector3().fromArray(s.slice(0,3)),c=new u.Vector3().fromArray(s.slice(-6,-3)),p=new u.Vector3().fromArray(s.slice(-3)),d=r.distanceTo(p)<1e-4,l=c.distanceTo(p)<1e-4,f=new u.Vector3,g=d||l?s.length/3-1:s.length/3;for(let h=0;h<g;h++)f.add(new u.Vector3(s[h*3],s[h*3+1],s[h*3+2]));return f.divideScalar(g),f}),t(Ie,s=>{const r=[];for(let l=0,f=s.length/3;l<f;l++)r.push(new u.Vector3(s[l*3],s[l*3+1],s[l*3+2]));const c=r[0].distanceTo(r[r.length-1])<1e-4,p=r[r.length-2].distanceTo(r[r.length-1])<1e-4;if((c||p)&&r.pop(),r.length<3)return 0;let d=0;for(let l=0,f=r.length-2;l<f;l++)d+=e(_e,r[0],r[l+1],r[l+2],e(_).meterScale);return d}),t(Ln,(s,r)=>{let c=0;for(let p=0,d=s.length-2;p<d;p++)c+=e(_e,s[0],s[p+1],s[p+2],r);return c}),t(_e,(s,r,c,p)=>{const d=s.distanceTo(r)*p,l=r.distanceTo(c)*p,f=c.distanceTo(s)*p,g=(d+l+f)/2;return Math.sqrt(g*(g-d)*(g-l)*(g-f))})}function Do(i){const t=(f,...g)=>i.fire(f,...g),e=(f,g,h)=>i.on(f,g,h),n=[],a=[];let o=!1,s=!1;e(ye,()=>o=!1),e(ki,()=>o=!0),e(Ci,()=>n),e(Gs,()=>{const f=[];for(let g=0,h=n.length;g<h;g++)f.push(...n[g].toArray());return f}),e(Ys,()=>{const f=[];for(let g=0,h=a.length;g<h;g++)f.push(...a[g].toArray());return f}),e(Je,f=>{for(let g=0,h=f.length/3|0;g<h;g++)n[g]=new u.Vector3(f[g*3+0],f[g*3+1],f[g*3+2])}),e(tn,f=>{for(let g=0,h=f.length/3|0;g<h;g++)a[g]=new u.Vector3(f[g*3+0],f[g*3+1],f[g*3+2])}),e(je,()=>{const f=t(W);n.push(f.object.position.clone()),a.push(f.target.clone())}),e(qe,()=>{n.length=0,a.length=0}),e(Mi,async()=>{const f=t(mt).meta||{};if(n.length){const g=[],h=[];for(let A=0,m=n.length;A<m;A++)g.push(...n[A].toArray()),h.push(...a[A].toArray());f.flyPositions=g,f.flyTargets=h}else delete f.flyPositions,delete f.flyTargets;return await t(St,f)}),e(Ti,()=>{s||(s=!0)&&t(me)});let r=0;const c=120*1e3;let p=0,d,l;e(me,f=>{if(r=0,p=Date.now(),d=null,l=null,!n.length||!f&&!t(W).autoRotate)return;const g=t(W),h=[g.object.position.clone()],A=[g.target.clone()],m=t(Ci)||[];for(let y=0,M=Math.min(m.length,100);y<M;y++)m[y]&&h.push(m[y]),a[y]&&A.push(a[y]);d=new u.CatmullRomCurve3(h),d.closed=!0,l=new u.CatmullRomCurve3(A),l.closed=!0,t(ki),t($,!1)}),e(Gt,()=>{if(Date.now()-p>c&&t(ye),!o||!d||!l)return;const f=t(W);r=(Date.now()-p)/c;const g=d.getPoint(r),h=l.getPoint(r);f.object.position.set(g.x,g.y,g.z),f.target.set(h.x,h.y,h.z)},!0)}class Po{constructor(t={}){this.disposed=!1,this.updateTime=0,this.needUpdate=!0,console.info("Reall3dViewer",Ae),this.init(ls(t)),!t.disableDropLocalFile&&this.enableDropLocalFile()}init(t){const e=this;t.position=t.position?[...t.position]:[0,-5,15],t.lookAt=t.lookAt?[...t.lookAt]:[0,0,0],t.lookUp=t.lookUp?[...t.lookUp]:[0,-1,0];const n=Za(t),a=t.scene=t.scene||new u.Scene;a.background=new u.Color(t.background),ja(t);const o=t.controls=new mo(t);o.updateByOptions(t);const s=new on;t.viewerEvents=s,e.events=s;const r=(l,f,g)=>s.on(l,f,g),c=(l,...f)=>s.fire(l,...f);r(_,()=>t),r(Et,()=>n.domElement),r(Ht,()=>n),r(B,()=>a),r(W,()=>o),r(G,()=>o.object),r(J,()=>t.bigSceneMode),r(zs,l=>t.pointcloudMode=l);const p=[];r(K,()=>{for(e.needUpdate=!0;p.length;)p.pop().stop=!0;let l={count:0,stop:!1};p.push(l),c(ke,()=>{!e.disposed&&(e.needUpdate=!0),l.count++>=600&&(l.stop=!0)},()=>!e.disposed&&(c(Ye)||!l.stop),10)}),pn(s),$a(s),vn(s),ko(s),Ms(s),To(s),Cs(s),Io(s),Do(s),e.splatMesh=new lt(qa(t)),r(mt,()=>e.splatMesh),a.add(e.splatMesh),eo(s),a.add(new u.AmbientLight("#ffffff",2)),a.add(c(hi)),n.setAnimationLoop(e.update.bind(e)),r(wi,()=>{o.update(),!e.needUpdate&&c(ni)&&c(K)}),r(Dt,()=>c(ce),!0),r(Dt,()=>c(wi),!0),r(Mt,()=>{try{!(e.needUpdate=!1)&&n.render(a,c(G))}catch(l){console.warn(l.message)}},!0),r(Gt,()=>{},!0),r(oe,()=>e.dispose()),r(Ei,()=>console.info(JSON.stringify(c(mt).meta||{},null,2)));let d="";r(pe,(l="")=>{d=l,e.splatMesh.fire(Ze,d,!0)}),r(Ai,()=>d),c(nt,{scale:`1 : ${c(_).meterScale} m`}),e.initGsApi()}enableDropLocalFile(){const t=this;document.addEventListener("dragover",function(e){e.preventDefault(),e.stopPropagation()}),document.addEventListener("drop",async function(e){e.preventDefault(),e.stopPropagation();let n=e.dataTransfer.files[0];if(!n)return;let a;if(n.name.endsWith(".spx"))a="spx";else if(n.name.endsWith(".splat"))a="splat";else if(n.name.endsWith(".ply"))a="ply";else if(n.name.endsWith(".spz"))a="spz";else return console.error("unsupported format:",n.name);const o=URL.createObjectURL(n),s=t.events.fire(_);s.bigSceneMode=!1,s.pointcloudMode=!0,s.autoRotate=!0,s.debugMode=!0,t.reset(s),setTimeout(async()=>{await t.addModel({url:o,format:a}),URL.revokeObjectURL(o)})})}update(){const t=this;if(t.disposed)return;const e=(n,...a)=>t.events.fire(n,...a);Date.now()-t.updateTime>30&&(e(Dt),t.needUpdate&&e(Mt),e(Gt))}fire(t,e,n){const a=this;t===1&&a.splatMesh.fire(Be,e),t===2&&a.events.fire(je),t===3&&a.events.fire(me,!0),t===4&&a.events.fire(qe),t===5&&a.events.fire(Mi),t===6&&a.events.fire(ge),t===7&&a.events.fire(Si),t===8&&(async()=>{let o=await a.splatMesh.fire(en);e&&(o=a.splatMesh.fire(Pi)+e),a.splatMesh.fire(Ue,o)})()}options(t){const e=this;if(e.disposed)return{};const n=(r,...c)=>e.events.fire(r,...c);let a;return n(B).traverse(r=>!a&&r instanceof lt&&(a=r.options())),t&&(t.autoRotate!==void 0&&(n(W).autoRotate=t.autoRotate,n(_).autoRotate=t.autoRotate),t.pointcloudMode!==void 0&&n(fe,t.pointcloudMode),t.lightFactor!==void 0&&n(Qt,t.lightFactor),t.maxRenderCountOfMobile&&(n(_).maxRenderCountOfMobile=t.maxRenderCountOfMobile),t.maxRenderCountOfPc&&(n(_).maxRenderCountOfPc=t.maxRenderCountOfPc),t.debugMode!==void 0&&(n(_).debugMode=t.debugMode),t.markType!==void 0&&(n(_).markType=t.markType),t.markVisible!==void 0&&n(Nt,t.markVisible),t.meterScale!==void 0&&(n(_).meterScale=t.meterScale),t.markMode!==void 0&&(n(_).markMode=t.markMode,!t.markMode&&n(Ge),n(W).autoRotate=n(_).autoRotate=!1)),n(W).updateByOptions(t),n(nt,{scale:`1 : ${n(_).meterScale} m`}),Object.assign({...n(_)},a)}reset(t={}){const e=this;e.dispose(),e.disposed=!1,e.init(ls(t))}switchDeiplayMode(){const t=this;t.disposed||t.events.fire(he)}async addScene(t){const e=this;if(e.disposed)return;const n=(s,...r)=>e.events.fire(s,...r);let a={};try{const s=await fetch(t,{mode:"cors",credentials:"omit",cache:"reload"});if(s.status===200)a=await s.json();else return console.error("scene file fetch failed, status:",s.status)}catch(s){return console.error("scene file fetch failed",s.message)}if(!a.url)return console.error("missing model file url");if(!a.url.endsWith(".bin")&&!a.url.endsWith(".spx"))return console.error("The format is unsupported in the large scene mode",a.url);const o={...a,...a.cameraInfo||{}};a.autoCut=Math.min(Math.max(a.autoCut||0,0),50),o.bigSceneMode=a.autoCut>1,e.reset({...o}),!o.bigSceneMode&&delete a.autoCut,e.splatMesh.meta=a,rt&&(a.cameraInfo?.position||a.cameraInfo?.lookAt)&&e.events.fire(W)._dollyOut(.75),o.bigSceneMode?(n(Je,a.flyPositions||[]),n(tn,a.flyTargets||[])):n(Ke,a),await e.splatMesh.addModel({url:a.url},a),await n(pe,a.watermark),n(W).updateRotateAxis()}async addModel(t){const e=this;if(e.disposed)return;const n=(c,...p)=>e.events.fire(c,...p);let a="",o={url:""};if(Object.prototype.toString.call(t)==="[object String]"?t.endsWith(".meta.json")?a=t:o.url=t:o=t,!o.url&&!a)return console.error("model url is empty");const s=n(_);s.bigSceneMode=!1;let r={};if(!o.url.startsWith("blob:"))try{a=a||o.url.substring(0,o.url.lastIndexOf("."))+".meta.json";const c=await fetch(a,{mode:"cors",credentials:"omit",cache:"reload"});c.status===200?r=await c.json():console.warn("meta file fetch failed, status:",c.status)}catch(c){console.warn("meta file fetch failed",c.message,o.url)}if(r.showWatermark=r.showWatermark!==!1,r.url=r.url||o.url,delete r.autoCut,!o.format)if(o.url=o.url||r.url,o.url.endsWith(".spx"))o.format="spx";else if(o.url.endsWith(".splat"))o.format="splat";else if(o.url.endsWith(".ply"))o.format="ply";else if(o.url.endsWith(".spz"))o.format="spz";else{console.error("unknow format!",o.url);return}n(Ke,r),await e.splatMesh.addModel(o,r),await n(pe,r.watermark)}initGsApi(){const t=(d,...l)=>this.events.fire(d,...l),e=()=>{setTimeout(()=>window.focus()),t(ye),t(W).autoRotate=t(_).autoRotate=!t(_).autoRotate},n=(d=!0)=>{setTimeout(()=>window.focus()),d=!!d;const l=t(_);l.pointcloudMode!==d&&(l.bigSceneMode?t(fe,d):t(he))},a=(d=!0)=>{setTimeout(()=>window.focus()),t(Nt,!!d)},o=d=>{setTimeout(()=>window.focus());const l=t(_);if(l.markMode)return!1;if(d===1)l.markType="point";else if(d===2)l.markType="lines";else if(d===3)l.markType="plans";else if(d===4)l.markType="distance";else return!1;return l.markMode=!0,t($),!0},s=async d=>(setTimeout(()=>window.focus()),d?(t(Yt,d)?.dispose(),t(K),await t(ge)):!1),r=async(d,l=!0)=>(t(vi,d,l),t(Yt,d?.name)?.drawUpdate?.(d,l),t(K),l?(setTimeout(()=>window.focus()),await t(ge)):!0),c=(d=!0)=>{setTimeout(()=>window.focus()),t(Be,!!d)},p=(d,l=!0)=>{t(pe,d),l&&t(bi,d)};window.$api={switchAutoRotate:e,changePointCloudMode:n,showMark:a,startMark:o,deleteMark:s,updateMark:r,showWaterMark:c,setWaterMark:p}}dispose(){const t=this;if(t.disposed)return;t.disposed=!0;const e=(o,...s)=>t.events.fire(o,...s),n=e(Ht),a=n.domElement;e(Oe),e(ei),e(Xe),e(Pe),e(W).dispose(),e(vt,e(B)),n.clear(),n.dispose(),a.parentElement.removeChild(a),t.splatMesh=null,t.events.clear(),t.events=null}}function Lo(i){const t=(s,r,c)=>i.on(s,r,c),e=(s,...r)=>i.fire(s,...r),n=rt?1:20,a=new Map,o=new Map;t(ne,()=>e(at)&&a.set(Date.now(),1)),t(ie,()=>e(at)&&e(_t,a)),t(se,()=>e(at)&&o.set(Date.now(),1)),t(ae,()=>e(at)&&e(_t,o)),t(_t,s=>{let r=[],c=Date.now(),p=0;for(const d of s.keys())c-d<=1e3?p++:r.push(d);return r.forEach(d=>s.delete(d)),Math.min(p,30)}),t(N,()=>{const s=e(B),r=e(G),c=[];return s?.traverse(function(p){p.isWarpSplatMesh&&p.splatMesh?.visible&&c.push(p)}),c.sort((p,d)=>r.position.distanceTo(p.position)-r.position.distanceTo(d.position)),window.splat=c[0]?.splatMesh,c[0]?.splatMesh}),t(zi,()=>{const s=e(B),r=e(G),c=[];s?.traverse(function(p){p.isWarpSplatMesh&&c.push(p)}),c.sort((p,d)=>r.position.distanceTo(p.position)-r.position.distanceTo(d.position));for(let p=0;p<c.length;p++)c[p].active=p<n,c[p].splatMesh&&(c[p].splatMesh.renderOrder=1e3-p)}),t(Qi,()=>{const s=e(B),r=[];s?.traverse(c=>r.push(c)),r.forEach(c=>{c.dispose?c.dispose():(c.geometry?.dispose?.(),c.material&&c.material instanceof Array?c.material.forEach(p=>p?.dispose?.()):c.material?.dispose?.())}),s?.clear()}),t(nn,(s=.1)=>{const r=e(N);r&&r.visible&&r.rotateOnAxis(new u.Vector3(1,0,0),u.MathUtils.degToRad(s))}),t(sn,(s=.1)=>{const r=e(N);r&&r.visible&&r.rotateOnAxis(new u.Vector3(0,1,0),u.MathUtils.degToRad(s))}),t(an,(s=.1)=>{const r=e(N);r&&r.visible&&r.rotateOnAxis(new u.Vector3(0,0,1),u.MathUtils.degToRad(s))}),t(Xs,(s=.01)=>{const r=e(N);r&&r.visible&&(r.position.x+=s)}),t(Vi,(s=.01)=>{const r=e(N);r&&r.visible&&(r.position.y+=s)}),t($s,(s=.01)=>{const r=e(N);r&&r.visible&&(r.position.z+=s)}),t(Ks,s=>{const r=e(N);r&&r.visible&&s&&r.position.copy(s),console.info(r,s)}),t(Zs,(s=.01)=>{const r=e(N);r&&r.visible&&r.scale.set(r.scale.x+s,r.scale.y+s,r.scale.z+s)}),t(js,()=>{const s=e(N);s&&(s.visible=!s.visible)}),t(qs,async s=>{if(!s&&(s=e(N)),!s)return;const r=s.meta||{};return r.transform=s.matrix.toArray(),await e(St,JSON.stringify(r),s.meta.url)}),t(Fi,()=>{const s=e(_).root,r=new u.WebGLRenderer({antialias:!1,logarithmicDepthBuffer:!0,stencil:!0,alpha:!0,precision:"highp"});return r.setSize(s.clientWidth,s.clientHeight),r.setPixelRatio(Math.min(devicePixelRatio,2)),t(Ht,()=>r),t(Et,()=>r.domElement),r}),t(Bi,()=>{const s=new u.Scene,r=14414079;return s.background=new u.Color(r),s.fog=new u.FogExp2(r,0),t(B,()=>s),s}),t(Ui,()=>{const r=e(G),c=e(B),p=e(_),d=new yo(e(G),p.root);return d.screenSpacePanning=!1,d.minDistance=.1,d.maxDistance=1e5,d.maxPolarAngle=1.2,d.enableDamping=!0,d.dampingFactor=.07,d.zoomToCursor=!0,d.addEventListener("change",()=>{const l=Math.max(d.getPolarAngle(),.1),f=Math.max(d.getDistance(),.1);d.zoomSpeed=Math.max(Math.log(f),0)+.5,r.far=u.MathUtils.clamp(f/l*8,100,2e5),r.near=r.far/1e3,r.updateProjectionMatrix(),c.fog instanceof u.FogExp2&&(c.fog.density=l/(f+5)*1*.25),d.maxPolarAngle=Math.min(Math.pow(1e4/f,4),1.2)}),t(W,()=>d),t(Ot,()=>r.fov),t(bt,(l=!1)=>l?r.position.clone():r.position),t(yt,(l=!1)=>l?d.target.clone():d.target),t(It,(l=!1)=>l?r.up.clone():r.up),d}),t(Oi,()=>{const s=new u.DirectionalLight(16777215,1);return s.position.set(0,2e3,1e3),s}),window.addEventListener("beforeunload",()=>e(oe))}function Ro(i){let{root:t="#map",debugMode:e}=i;t?t=typeof t=="string"?document.querySelector(t)||document.querySelector("#map"):t:t=document.querySelector("#map"),t||(t=document.createElement("div"),t.id="map",(document.querySelector("#gsviewer")||document.querySelector("body")).appendChild(t));const n={...i};return n.root=t,n}function Fo(){const i=Dn.TileSource.create({dataType:"image",attribution:"ArcGIS",url:"https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"}),t=new Dn.TileMap({imgSource:i,lon0:90,minLevel:2,maxLevel:16});return t.scale.set(10,10,10),t.rotateX(-Math.PI/2),t.autoUpdate=!1,t}class Bo{constructor(){this.down=0,this.move=!1,this.downTime=0,this.isDbClick=!1,this.x=0,this.y=0,this.lastClickX=0,this.lastClickY=0,this.lastClickPointTime=0,this.lastMovePoint=null,this.lastMovePointTime=0}}function Uo(i){const t=(x,C,v)=>i.on(x,C,v),e=(x,...C)=>i.fire(x,...C),n=e(Et);let a=new Set,o,s=new Bo;t(ce,()=>{if(!a.size)return;if(!e(_).enableKeyboard)return a.clear();if(a.has("KeyH")){const C=e(N);C&&(C.visible=!C.visible),a.clear()}else if(a.has("Equal")){const C=e(N);if(!C||!C.visible)return a.clear();if(a.has("KeyX")){const v=u.MathUtils.degToRad(.1);C.rotateOnAxis(new u.Vector3(1,0,0),v)}else C.scale.set(C.scale.x+.01,C.scale.y+.01,C.scale.z+.01)}else if(a.has("Minus")){const C=e(N);if(!C||!C.visible)return a.clear();if(a.has("KeyX")){const v=u.MathUtils.degToRad(-.1);C.rotateOnAxis(new u.Vector3(1,0,0),v)}else C.scale.set(C.scale.x-.01,C.scale.y-.01,C.scale.z-.01)}else if(a.has("ArrowUp")){const C=e(N);C&&C.visible&&(C.position.z+=.1)}else if(a.has("ArrowDown")){const C=e(N);C&&C.visible&&(C.position.z-=.1)}else if(a.has("ArrowRight")){const C=e(N);C&&C.visible&&(C.position.x+=.1)}else if(a.has("ArrowLeft")){const C=e(N);C&&C.visible&&(C.position.x-=.1)}else if(a.has("KeyU")){const C=e(N);if(C){const v=C.meta||{};v.transform=C.matrix.toArray()}}else a.has("KeyQ")?e(nn,.1):a.has("KeyW")?e(sn,.1):a.has("KeyE")?e(an,.1):a.has("KeyA")?e(nn,-.1):a.has("KeyS")?e(sn,-.1):a.has("KeyD")?e(an,-.1):a.has("KeyY")?e(Vi,a.has("ShiftLeft")||a.has("ShiftRight")?-.1:.1):a.has("KeyC")&&console.info("position=",e(bt).toArray(),"lookat=",e(yt).toArray())});const r=x=>{console.info(x.code),x.target.type!=="text"&&(o||x.code==="F5"||(x.preventDefault(),a.add(x.code)))},c=x=>{x.target.type!=="text"&&(o||a.clear())},p=()=>{a.clear()},d=x=>{parent&&setTimeout(()=>window.focus()),x.preventDefault()},l=async x=>{x.preventDefault()};let f,g,h,A;t(Xt,()=>{f?.dispose(),g?.dispose(),h?.dispose(),A?.dispose(),f=null,g=null,h=null,A=null,s.lastMovePoint=null,e(wt)});const m=async x=>{parent&&setTimeout(()=>window.focus()),x.preventDefault(),!o&&(s.down=x.button===2?2:1,s.move=!1,s.isDbClick=Date.now()-s.downTime<300,s.downTime=Date.now())},y=async x=>{x.preventDefault(),!o&&s.down&&(s.move=!0)},M=async x=>{x.preventDefault(),!o&&(s.down=0,s.move=!1)};function b(x){x.preventDefault(),!o&&(s.down=x.touches.length,s.down===1&&(s.move=!1,s.x=x.touches[0].clientX,s.y=x.touches[0].clientY))}function S(x){x.touches.length===1&&(s.move=!0)}function k(x){s.down===1&&!s.move&&e(Wt,s.x,s.y)}window.addEventListener("keydown",r),window.addEventListener("keyup",c),window.addEventListener("blur",p),window.addEventListener("wheel",d,{passive:!1}),n.addEventListener("contextmenu",l),n.addEventListener("mousedown",m),n.addEventListener("mousemove",y),n.addEventListener("mouseup",M),n.addEventListener("touchstart",b,{passive:!1}),n.addEventListener("touchmove",S,{passive:!1}),n.addEventListener("touchend",k,{passive:!1}),t(Pe,()=>{o=!0,window.removeEventListener("keydown",r),window.removeEventListener("keyup",c),window.removeEventListener("blur",p),window.removeEventListener("wheel",d),n.removeEventListener("contextmenu",l),n.removeEventListener("mousedown",m),n.removeEventListener("mousemove",y),n.removeEventListener("mouseup",M),n.removeEventListener("touchstart",b),n.removeEventListener("touchmove",S),n.removeEventListener("touchend",k)}),t(Wt,async(x,C)=>await e(le,x,C))}var Bt=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var t=1.70158;return i===1?1:i*i*((t+1)*i-t)},Out:function(i){var t=1.70158;return i===0?0:--i*i*((t+1)*i+t)+1},InOut:function(i){var t=2.5949095;return(i*=2)<1?.5*(i*i*((t+1)*i-t)):.5*((i-=2)*i*((t+1)*i+t)+2)}}),Bounce:Object.freeze({In:function(i){return 1-Bt.Bounce.Out(1-i)},Out:function(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},InOut:function(i){return i<.5?Bt.Bounce.In(i*2)*.5:Bt.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(t){return Math.pow(t,i)},Out:function(t){return 1-Math.pow(1-t,i)},InOut:function(t){return t<.5?Math.pow(t*2,i)/2:(1-Math.pow(2-t*2,i))/2+.5}}}}),Jt=function(){return performance.now()},Oo=function(){function i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return i.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var a=0,o=e;a<o.length;a++){var s=o[a];(t=s._group)===null||t===void 0||t.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},i.prototype.remove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=0,a=t;n<a.length;n++){var o=a[n];o._group=void 0,delete this._tweens[o.getId()],delete this._tweensAddedDuringUpdate[o.getId()]}},i.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},i.prototype.update=function(t,e){t===void 0&&(t=Jt()),e===void 0&&(e=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var a=0;a<n.length;a++){var o=this._tweens[n[a]],s=!e;o&&o.update(t,s)===!1&&!e&&this.remove(o)}n=Object.keys(this._tweensAddedDuringUpdate)}},i}(),In={Linear:function(i,t){var e=i.length-1,n=e*t,a=Math.floor(n),o=In.Utils.Linear;return t<0?o(i[0],i[1],n):t>1?o(i[e],i[e-1],e-n):o(i[a],i[a+1>e?e:a+1],n-a)},Utils:{Linear:function(i,t,e){return(t-i)*e+i}}},Ts=function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i}(),_n=new Oo,Vo=function(){function i(t,e){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Bt.Linear.None,this._interpolationFunction=In.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Ts.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof e=="object"?(this._group=e,e.add(this)):e===!0&&(this._group=_n,_n.add(this))}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(t,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},i.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},i.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},i.prototype.start=function(t,e){if(t===void 0&&(t=Jt()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var a={};for(var o in this._valuesEnd)a[o]=this._valuesEnd[o];this._valuesEnd=a}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},i.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},i.prototype._setupProperties=function(t,e,n,a,o){for(var s in n){var r=t[s],c=Array.isArray(r),p=c?"array":typeof r,d=!c&&Array.isArray(n[s]);if(!(p==="undefined"||p==="function")){if(d){var l=n[s];if(l.length===0)continue;for(var f=[r],g=0,h=l.length;g<h;g+=1){var A=this._handleRelativeValue(r,l[g]);if(isNaN(A)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}f.push(A)}d&&(n[s]=f)}if((p==="object"||c)&&r&&!d){e[s]=c?[]:{};var m=r;for(var y in m)e[s][y]=m[y];a[s]=c?[]:{};var l=n[s];if(!this._isDynamic){var M={};for(var y in l)M[y]=l[y];n[s]=l=M}this._setupProperties(m,e[s],l,a[s],o)}else(typeof e[s]>"u"||o)&&(e[s]=r),c||(e[s]*=1),d?a[s]=n[s].slice().reverse():a[s]=e[s]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},i.prototype.pause=function(t){return t===void 0&&(t=Jt()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},i.prototype.resume=function(t){return t===void 0&&(t=Jt()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},i.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},i.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},i.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},i.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},i.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},i.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},i.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},i.prototype.easing=function(t){return t===void 0&&(t=Bt.Linear.None),this._easingFunction=t,this},i.prototype.interpolation=function(t){return t===void 0&&(t=In.Linear),this._interpolationFunction=t,this},i.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},i.prototype.onStart=function(t){return this._onStartCallback=t,this},i.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},i.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},i.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},i.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},i.prototype.onStop=function(t){return this._onStopCallback=t,this},i.prototype.update=function(t,e){var n=this,a;if(t===void 0&&(t=Jt()),e===void 0&&(e=i.autoStartOnUpdate),this._isPaused)return!0;var o;if(!this._goToEnd&&!this._isPlaying)if(e)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var s=t-this._startTime,r=this._duration+((a=this._repeatDelayTime)!==null&&a!==void 0?a:this._delayTime),c=this._duration+this._repeat*r,p=function(){if(n._duration===0||s>c)return 1;var A=Math.trunc(s/r),m=s-A*r,y=Math.min(m/n._duration,1);return y===0&&s===n._duration?1:y},d=p(),l=this._easingFunction(d);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,l),this._onUpdateCallback&&this._onUpdateCallback(this._object,d),this._duration===0||s>=this._duration)if(this._repeat>0){var f=Math.min(Math.trunc((s-this._duration)/r)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=f);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=r*f,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var g=0,h=this._chainedTweens.length;g<h;g++)this._chainedTweens[g].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(t,e,n,a){for(var o in n)if(e[o]!==void 0){var s=e[o]||0,r=n[o],c=Array.isArray(t[o]),p=Array.isArray(r),d=!c&&p;d?t[o]=this._interpolationFunction(r,a):typeof r=="object"&&r?this._updateProperties(t[o],s,r,a):(r=this._handleRelativeValue(s,r),typeof r=="number"&&(t[o]=s+(r-s)*a))}},i.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},i.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},i.autoStartOnUpdate=!1,i}();Ts.nextId;var ht=_n;ht.getAll.bind(ht),ht.removeAll.bind(ht),ht.add.bind(ht),ht.remove.bind(ht),ht.update.bind(ht);const ks=navigator.userAgent.includes("Mobi");class zo extends u.Mesh{constructor(t,e){super(),this.isWarpSplatMesh=!0,this.lastActiveTime=Date.now(),this.active=!1,this.disposed=!1,this.mapViewer=e,this.addScene(t),this.frustumCulled=!1}async addScene(t){const e=this,{renderer:n,scene:a,controls:o,tileMap:s}=e.mapViewer;fetch(t,{mode:"cors",credentials:"omit",cache:"reload"}).then(r=>r.ok?r.json():{}).then(r=>{const c=new u.Matrix4;if(r.transform)c.fromArray(r.transform);else if(r.WGS84){const h=s.geo2world(new u.Vector3().fromArray(r.WGS84));c.makeTranslation(h.x,h.y,h.z)}r.autoCut&&(r.autoCut=Math.min(Math.max(r.autoCut,1),50));const p=r.autoCut&&r.autoCut>1,d=!1,l=!1,f=r.showWatermark!==!1,g={renderer:n,scene:a,controls:o,pointcloudMode:d,bigSceneMode:p,matrix:c,showWatermark:f,depthTest:l};g.maxRenderCountOfMobile??(g.maxRenderCountOfMobile=g.bigSceneMode?128*10240:400*1e4),g.maxRenderCountOfPc??(g.maxRenderCountOfPc=g.bigSceneMode?320*1e4:400*1e4),g.debugMode=this.mapViewer.events.fire(_).debugMode,e.opts=g,e.meta=r,a.add(e),e.initCSS3DSprite(g),e.applyMatrix4(c)}).catch(r=>{console.error(r.message)})}async initCSS3DSprite(t){const e=this,n=document.createElement("div");n.innerHTML=`<div title="${e.meta.name}" style='flex-direction: column;align-items: center;display: flex;pointer-events: auto;margin-bottom: 20px;'>
|
|
724
724
|
<svg height="20" width="20" style="color:#eeee00;opacity:0.9;"><use href="#svgicon-point3" fill="currentColor" /></svg>
|
|
725
725
|
</div>`,n.classList.add("splatmesh-point"),n.style.position="absolute",n.style.borderRadius="4px",n.style.cursor="pointer";let a=null;n.onclick=()=>{if(a)return;const s=e.position,r=t.controls,c=r.object.position.clone(),p=ks?6:2,d=s.clone().sub(c).normalize(),l=s.clone().sub(d.multiplyScalar(p)),f={x:c.x,y:c.y,z:c.z,tx:r.target.x,ty:r.target.y,tz:r.target.z},g={x:l.x,y:l.y,z:l.z,tx:s.x,ty:s.y,tz:s.z};a=new Vo(f).to(g,3e3),a.easing(Bt.Sinusoidal.InOut).start().onUpdate(()=>{const h=f.y<.1?.1:f.y;r.object.position.set(f.x,h,f.z),r.target.set(f.tx,f.ty,f.tz)}).onComplete(()=>{a=null})},n.oncontextmenu=s=>s.preventDefault();const o=new et(n);o.element.style.pointerEvents="none",o.visible=!1,o.applyMatrix4(t.matrix),e.css3dTag=o,t.scene.add(o),e.onBeforeRender=()=>{a?.update();const s=ks?50:30,r=e.position.distanceTo(e.mapViewer.controls.object.position);if(r>s){e.css3dTag.visible=e.opts.controls.object.position.y>2;let c=.002*r;o.scale.set(c,c,c),e.css3dTag.visible=!0,e.splatMesh&&(e.splatMesh.visible=!1)}else{if(!e.active){e.splatMesh&&(e.splatMesh.visible=!1);let c=.002*r;o.scale.set(c,c,c),e.css3dTag.visible=!0;return}if(e.lastActiveTime=Date.now(),e.css3dTag.visible=!1,e.splatMesh)e.splatMesh.visible=!0;else{const c=e.meta,p={...e.opts};c.autoCut&&(p.bigSceneMode=!0);const d=new lt(p);e.splatMesh=d,e.opts.scene.add(d),d.applyMatrix4(e.opts.matrix),d.meta=c;const l=c.watermark||c.name||"";c.showWatermark=c.showWatermark!==!1,d.fire(Ze,l,!0,!1),d.addModel({url:e.meta.url},e.meta)}}},e.onAfterRender=()=>{e.splatMesh&&(!e.active||Date.now()-e.lastActiveTime>1*60*1e3)&&setTimeout(()=>{e.splatMesh?.dispose(),e.splatMesh=null},5)}}dispose(){const t=this;t.disposed||(t.disposed=!0,t.opts.scene.remove(t.css3dTag),t.splatMesh?.dispose(),t.meta=null,t.splatMesh=null,t.opts=null,t.css3dTag=null,t.mapViewer=null)}}class Qo extends u.EventDispatcher{constructor(t={}){console.info("Reall3dMapViewer",Ae),super(),this.clock=new u.Clock,this.updateTime=0,this.disposed=!1;const e=this,n=new on;e.events=n;const a=(r,c,p)=>n.on(r,c,p),o=(r,...c)=>n.fire(r,...c);e.tileMap=Fo();const s=Ro(t);a(_,()=>s),pn(n),vn(n),Lo(n),Cs(n),e.camera=new u.PerspectiveCamera(60,1,.01,1e4),a(G,()=>e.camera),e.container=s.root,e.renderer=o(Fi),e.scene=o(Bi),e.controls=o(Ui),e.ambLight=new u.AmbientLight(16777215,1),e.scene.add(e.ambLight),e.dirLight=o(Oi),e.scene.add(e.dirLight),e.scene.add(e.tileMap),e.container.appendChild(e.renderer.domElement),Ms(n),Uo(n),window.addEventListener("resize",e.resize.bind(e)),e.resize(),e.renderer.setAnimationLoop(e.animate.bind(e)),a(oe,()=>e.dispose()),a(Dt,()=>{o(se),e.controls.update(),o(zi),o(ce)},!0),a(Gt,()=>{e.dispatchEvent({type:"update",delta:e.clock.getDelta()}),e.updateTime=Date.now(),o(at)&&o(nt,{fps:o(ie),realFps:o(ae),fov:o(Ot),position:o(Ct,o(bt)),lookAt:o(Ct,o(yt)),lookUp:o(Ct,o(It))})},!0),a(Mt,()=>{e.tileMap.update(e.camera);try{e.renderer.render(e.scene,e.camera)}catch(r){console.warn(r.message)}},!0)}addScenes(t){const e=this;fetch(t,{mode:"cors",credentials:"omit",cache:"reload"}).then(n=>n.ok?n.json():{}).then(n=>{const a=new u.Vector3().fromArray(n.position||[17e3,3e4,-35e3]),o=new u.Vector3().fromArray(n.lookAt||[17e3,0,-35e3]);e.controls.object.position.copy(a),e.controls.target.copy(o),e.dirLight.target.position.copy(o);const s=new Set;for(let r of n.scenes)s.has(r)||(new zo(r,e),s.add(r))}).catch(n=>{console.error(n.message)})}resize(){const t=this;if(t.disposed)return;const{width:e,height:n,top:a,left:o}=t.container.getBoundingClientRect();t.renderer.setPixelRatio(Math.min(devicePixelRatio,2)),t.renderer.setSize(e,n),t.camera.aspect=e/n,t.camera.updateProjectionMatrix();const s=t.events.fire(Ne);s.setSize(e,n),s.domElement.style.position="absolute",s.domElement.style.left=`${o}px`,s.domElement.style.top=`${a}px`}animate(){const t=this,e=(n,...a)=>t.events.fire(n,...a);e(ne),Date.now()-t.updateTime>30&&(e(Dt),e(Mt),e(Gt))}dispose(){const t=this;if(t.disposed)return;t.disposed=!0;const e=t.renderer.domElement;t.events.fire(Xe),t.events.fire(Qi),t.renderer.clear(),t.renderer.dispose(),t.events.clear(),t.scene=null,t.renderer=null,t.camera=null,t.controls=null,t.ambLight=null,t.dirLight=null,t.container.removeChild(e),t.container.classList.add("hidden"),t.container=null,t.clock=null,t.events=null,t.tileMap=null}}gt.Reall3dMapViewer=Qo,gt.Reall3dViewer=Po,Object.defineProperty(gt,Symbol.toStringTag,{value:"Module"})});
|