@reall3d/reall3dviewer 2.4.0 → 2.4.1

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.umd.cjs CHANGED
@@ -1,10 +1,10 @@
1
- (function(Et,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("three"),require("@gotoeasy/three-tile")):typeof define=="function"&&define.amd?define(["exports","three","@gotoeasy/three-tile"],g):(Et=typeof globalThis<"u"?globalThis:Et||self,g(Et.reall3dviewer={},Et.THREE,Et.tt))})(this,(function(Et,g,Ee){"use strict";var iu=Object.defineProperty;var ou=(Et,g,Ee)=>g in Et?iu(Et,g,{enumerable:!0,configurable:!0,writable:!0,value:Ee}):Et[g]=Ee;var os=(Et,g,Ee)=>ou(Et,typeof g!="symbol"?g+"":g,Ee);var as=typeof document<"u"?document.currentScript:null;function xr(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>n[e]})}}return t.default=n,Object.freeze(t)}const ki=xr(Ee);let E=1;const he=E++,Ti=E++,se=E++,Li=E++,rs=E++,As=E++,Ri=E++,cs=E++,Fi=E++,Qe=E++,Qt=E++,st=E++,Ui=E++,ls=E++,Jt=E++,be=E++,Ut=E++,Oe=E++,Pi=E++,Vi=E++,Ni=E++,us=E++,Hi=E++,_i=E++,ds=E++,vr=E++,Dr=E++,Gi=E++,mt=E++;E++;const ut=E++,pe=E++,Be=E++,Wi=E++,Oi=E++,zi=E++,Yi=E++,kr=E++,Ji=E++,hn=E++,pn=E++,Ki=E++,Xi=E++,Zi=E++,Ce=E++,ji=E++,ze=E++,qi=E++,Ye=E++,Je=E++,Cn=E++,$i=E++,gs=E++,Tr=E++,Ke=E++,fs=E++,hs=E++,mn=E++,In=E++,yn=E++,wn=E++,to=E++,ps=E++,R=E++,me=E++,Se=E++,X=E++,En=E++,Cs=E++,Lr=E++,bt=E++,ms=E++,Tt=E++,eo=E++,no=E++,so=E++,io=E++,Is=E++,oo=E++,Ie=E++,ys=E++,ws=E++,Xe=E++,Rr=E++,ao=E++,ro=E++;E++;const Qn=E++,Es=E++,Ao=E++,co=E++,bn=E++,Bn=E++,Qs=E++,Ze=E++,Pt=E++,bs=E++;E++;const lo=E++,uo=E++,Sn=E++,Bs=E++,Ss=E++,Fr=E++,Mn=E++,xn=E++,Ms=E++,Me=E++,xe=E++,vn=E++,Dn=E++,go=E++,it=E++,Ct=E++,Ur=E++,fo=E++,kn=E++,Tn=E++,Pr=E++,xs=E++,vs=E++,ue=E++,je=E++,ve=E++,Vr=E++,ho=E++,Nr=E++;E++,E++,E++,E++,E++;const de=E++,qe=E++,Ln=E++,Ds=E++,po=E++,Co=E++,ks=E++,ie=E++,$e=E++,mo=E++,Ts=E++,Io=E++,Hr=E++,_r=E++,tn=E++,en=E++,nn=E++,Rn=E++,Fn=E++,Kt=E++,yo=E++,wo=E++,Un=E++,xt=E++,Eo=E++,Pn=E++,Qo=E++,sn=E++,bo=E++,Bo=E++,Ls=E++,So=E++,Mo=E++,xo=E++,vo=E++,Rs=E++,Gr=E++,Wr=E++,Do=E++,Fs=E++,Or=E++,ko=E++,Vn=E++,De=E++,Nn=E++,Us=E++,Ps=E++,Vs=E++,Ns=E++,Hs=E++,_s=E++,To=E++,Lo=E++;E++,E++,E++,E++;const zr=E++,Ro=E++,Fo=E++,Gs=E++,Uo=E++,Yr=E++,on=E++,Po=E++,Vo=E++,Ws=E++,No=E++,Ho=E++,Jr=E++,_o=E++,Go=E++;E++;const Wo=E++,Oo=E++,ht=E++,Os=E++,zs=E++,Ys=E++,Kr=E++,zo=E++,Xr=E++,Zr=E++,jr=E++,qr=E++,$r=E++,Yo=E++,Jo=E++;E++,E++;const tA=E++,Js=E++,Ks=E++,Xs=E++,Zs=E++,Ko=E++,eA=E++,Xo=E++,Zo=E++,js=E++,nA=E++;class Hn{constructor(){this.map=new Map}on(t,e=null,s=!1){if(!t)return console.error("Invalid event key",t),null;if(!e)return this.map.get(t);if(s){let i=this.map.get(t);i?typeof i=="function"?console.error("Invalid event type","multiFn=true",t):i.push(e):(i=[],this.map.set(t,i),i.push(e))}else{let i=this.map.get(t);i?typeof i=="function"?console.warn("Replace event",t):console.error("Invalid event type","multiFn=false",t):this.map.set(t,e)}return this.map.get(t)}fire(t,...e){const s=this.map.get(t);if(!s){this.map.size&&[...e];return}if(typeof s=="function")return s(...e);let i=[];return s.forEach(a=>i.push(a(...e))),i}tryFire(t,...e){return this.map.get(t)?this.fire(t,...e):void 0}off(t){this.map.delete(t)}clear(){this.map.clear()}}class sA{}class qs{constructor(t,e={}){this.fileSize=0,this.downloadSize=0,this.status=0,this.splatData=null,this.watermarkData=null,this.dataSplatCount=0,this.watermarkCount=0,this.sh12Data=[],this.sh3Data=[],this.sh12Count=0,this.sh3Count=0,this.rowLength=0,this.modelSplatCount=-1,this.downloadSplatCount=0,this.renderSplatCount=0,this.header=null,this.CompressionRatio="",this.dataShDegree=0,this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0,this.minZ=1/0,this.maxZ=-1/0,this.topY=0,this.currentRadius=0,this.maxRadius=0,this.textWatermarkVersion=0,this.lastTextWatermarkVersion=0,this.fetchLimit=0,this.opts={...t};const s=this;s.meta=e,e.isLargeScene&&(s.map=new Map),s.metaMatrix=e.transform?new g.Matrix4().fromArray(e.transform):null,t.format||(t.url?.endsWith(".spx")?s.opts.format="spx":t.url?.endsWith(".splat")?s.opts.format="splat":t.url?.endsWith(".ply")?s.opts.format="ply":t.url?.endsWith(".spz")?s.opts.format="spz":t.url?.endsWith(".sog")||t.url?.endsWith("meta.json")?s.opts.format="sog":console.error("unknown format!")),s.abortController=new AbortController}}var P=(n=>(n[n.FetchReady=0]="FetchReady",n[n.Fetching=1]="Fetching",n[n.FetchDone=2]="FetchDone",n[n.FetchAborted=3]="FetchAborted",n[n.FetchFailed=4]="FetchFailed",n[n.Invalid=5]="Invalid",n))(P||{});const _n="v2.4.0",dt=!navigator.userAgent.includes("cloudphone")&&navigator.userAgent.includes("Mobi"),iA="QWERTYUIOPLKJHGFDSAZXCVBNM1234567890qwertyuioplkjhgfdsazxcvbnm`~!@#$%^&*()-_=+\\|]}[{'\";::,<.>//? ",oA=dt?600:300,jo=dt?2e3:500,Vt=128,Gn=32,K=32,qo=20,aA=16,$o=64*1024,rA=1024*1e4,AA=10240*1e4,Xt=.28209479177387814,ta=0,cA=220,lA=8,uA=9,dA=20,gA=190,fA=10190,an=1,oe=2,ke=3,hA=4,ea=3141592653;var vt=(n=>(n[n.L1=1]="L1",n[n.L2=2]="L2",n[n.L3=3]="L3",n[n.L4=4]="L4",n[n.Default5=5]="Default5",n[n.L6=6]="L6",n[n.L7=7]="L7",n[n.L8=8]="L8",n[n.L9=9]="L9",n))(vt||{}),Te=(n=>(n[n.Default1=1]="Default1",n[n.ZdepthFrontNearest2010=2010]="ZdepthFrontNearest2010",n[n.ZdepthFront2011=2011]="ZdepthFront2011",n[n.ZdepthFrontNearFar2012=2012]="ZdepthFrontNearFar2012",n[n.ZdepthFullNearFar2112=2112]="ZdepthFullNearFar2112",n))(Te||{});function pA(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var t=n.default;if(typeof t=="function"){var e=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(s){var i=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return n[s]}})}),e}var Wn={exports:{}};const CA=pA(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));/*!
1
+ (function(Et,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("three"),require("@gotoeasy/three-tile")):typeof define=="function"&&define.amd?define(["exports","three","@gotoeasy/three-tile"],d):(Et=typeof globalThis<"u"?globalThis:Et||self,d(Et.reall3dviewer={},Et.THREE,Et.tt))})(this,(function(Et,d,Qe){"use strict";var nu=Object.defineProperty;var su=(Et,d,Qe)=>d in Et?nu(Et,d,{enumerable:!0,configurable:!0,writable:!0,value:Qe}):Et[d]=Qe;var is=(Et,d,Qe)=>su(Et,typeof d!="symbol"?d+"":d,Qe);var os=typeof document<"u"?document.currentScript:null;function br(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>n[e]})}}return t.default=n,Object.freeze(t)}const vi=br(Qe);let E=1;const pe=E++,Di=E++,ie=E++,ki=E++,as=E++,rs=E++,Ti=E++,As=E++,Li=E++,be=E++,Bt=E++,it=E++,Ri=E++,cs=E++,Jt=E++,Se=E++,Ut=E++,We=E++,Fi=E++,Ui=E++,Pi=E++,ls=E++,Vi=E++,Ni=E++,us=E++,Sr=E++,xr=E++,_i=E++,Ct=E++;E++;const ut=E++,Ce=E++,xe=E++,Hi=E++,Gi=E++,Wi=E++,Yi=E++,Mr=E++,zi=E++,fn=E++,hn=E++,Oi=E++,Ji=E++,Ki=E++,me=E++,Xi=E++,Ye=E++,Zi=E++,ze=E++,Oe=E++,pn=E++,ji=E++,ds=E++,vr=E++,Je=E++,gs=E++,fs=E++,Cn=E++,mn=E++,In=E++,yn=E++,qi=E++,hs=E++,L=E++,Ie=E++,Me=E++,j=E++,wn=E++,ps=E++,Dr=E++,Qt=E++,Cs=E++,Tt=E++,$i=E++,to=E++,eo=E++,no=E++,ms=E++,so=E++,ye=E++,Is=E++,ys=E++,Ke=E++,kr=E++,io=E++,oo=E++;E++;const En=E++,ws=E++,ao=E++,ro=E++,Bn=E++,Qn=E++,Es=E++,Xe=E++,Pt=E++,Bs=E++;E++;const Ao=E++,co=E++,bn=E++,Qs=E++,bs=E++,Tr=E++,Sn=E++,xn=E++,Ss=E++,ve=E++,De=E++,Mn=E++,vn=E++,lo=E++,ot=E++,pt=E++,Lr=E++,uo=E++,Dn=E++,kn=E++,Rr=E++,xs=E++,Ms=E++,ge=E++,Ze=E++,ke=E++,Fr=E++,go=E++,Ur=E++;E++,E++,E++,E++,E++;const fe=E++,je=E++,Tn=E++,vs=E++,fo=E++,ho=E++,Ds=E++,oe=E++,qe=E++,po=E++,ks=E++,Co=E++,Pr=E++,Vr=E++,$e=E++,tn=E++,en=E++,Ln=E++,Rn=E++,Kt=E++,mo=E++,Io=E++,Fn=E++,Mt=E++,yo=E++,Un=E++,wo=E++,nn=E++,Eo=E++,Bo=E++,Ts=E++,Qo=E++,bo=E++,So=E++,xo=E++,Ls=E++,Nr=E++,_r=E++,Mo=E++,Rs=E++,Hr=E++,vo=E++,Pn=E++,Te=E++,Vn=E++,Fs=E++,Us=E++,Ps=E++,Vs=E++,Ns=E++,_s=E++,Do=E++,ko=E++;E++,E++,E++,E++;const Gr=E++,To=E++,Lo=E++,Hs=E++,Ro=E++,Wr=E++,sn=E++,Fo=E++,Uo=E++,Gs=E++,Po=E++,Vo=E++,Yr=E++,No=E++,_o=E++;E++;const Ho=E++,Go=E++,ft=E++,Ws=E++,Ys=E++,zs=E++,zr=E++,Wo=E++,Or=E++,Jr=E++,Kr=E++,Xr=E++,Zr=E++,Yo=E++,zo=E++;E++,E++;const jr=E++,Os=E++,Js=E++,Ks=E++,Xs=E++,Oo=E++,qr=E++,Jo=E++,Ko=E++,Zs=E++,$r=E++;class Nn{constructor(){this.map=new Map}on(t,e=null,s=!1){if(!t)return console.error("Invalid event key",t),null;if(!e)return this.map.get(t);if(s){let i=this.map.get(t);i?typeof i=="function"?console.error("Invalid event type","multiFn=true",t):i.push(e):(i=[],this.map.set(t,i),i.push(e))}else{let i=this.map.get(t);i?typeof i=="function"?console.warn("Replace event",t):console.error("Invalid event type","multiFn=false",t):this.map.set(t,e)}return this.map.get(t)}fire(t,...e){const s=this.map.get(t);if(!s){this.map.size&&[...e];return}if(typeof s=="function")return s(...e);let i=[];return s.forEach(a=>i.push(a(...e))),i}tryFire(t,...e){return this.map.get(t)?this.fire(t,...e):void 0}off(t){this.map.delete(t)}clear(){this.map.clear()}}class tA{}class js{constructor(t,e={}){this.fileSize=0,this.downloadSize=0,this.status=0,this.splatData=null,this.watermarkData=null,this.dataSplatCount=0,this.watermarkCount=0,this.sh12Data=[],this.sh3Data=[],this.sh12Count=0,this.sh3Count=0,this.rowLength=0,this.modelSplatCount=-1,this.downloadSplatCount=0,this.renderSplatCount=0,this.header=null,this.CompressionRatio="",this.dataShDegree=0,this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0,this.minZ=1/0,this.maxZ=-1/0,this.topY=0,this.currentRadius=0,this.maxRadius=0,this.textWatermarkVersion=0,this.lastTextWatermarkVersion=0,this.fetchLimit=0,this.opts={...t};const s=this;s.meta=e,e.isLargeScene&&(s.map=new Map),s.metaMatrix=e.transform?new d.Matrix4().fromArray(e.transform):null,t.format||(t.url?.endsWith(".spx")?s.opts.format="spx":t.url?.endsWith(".splat")?s.opts.format="splat":t.url?.endsWith(".ply")?s.opts.format="ply":t.url?.endsWith(".spz")?s.opts.format="spz":t.url?.endsWith(".sog")||t.url?.endsWith("meta.json")?s.opts.format="sog":console.error("unknown format!")),s.abortController=new AbortController}}var V=(n=>(n[n.FetchReady=0]="FetchReady",n[n.Fetching=1]="Fetching",n[n.FetchDone=2]="FetchDone",n[n.FetchAborted=3]="FetchAborted",n[n.FetchFailed=4]="FetchFailed",n[n.Invalid=5]="Invalid",n))(V||{});const _n="v2.4.1",dt=!navigator.userAgent.includes("cloudphone")&&navigator.userAgent.includes("Mobi"),eA="QWERTYUIOPLKJHGFDSAZXCVBNM1234567890qwertyuioplkjhgfdsazxcvbnm`~!@#$%^&*()-_=+\\|]}[{'\";::,<.>//? ",nA=dt?600:300,Xo=dt?2e3:500,Le=128,Hn=32,K=32,sA=20,iA=16,Zo=64*1024,oA=1024*1e4,aA=10240*1e4,Xt=.28209479177387814,rA=0,AA=220,cA=230,lA=8,uA=9,dA=20,gA=190,fA=10190,on=1,ae=2,Re=3,hA=4,pA=3141592653;var vt=(n=>(n[n.L1=1]="L1",n[n.L2=2]="L2",n[n.L3=3]="L3",n[n.L4=4]="L4",n[n.Default5=5]="Default5",n[n.L6=6]="L6",n[n.L7=7]="L7",n[n.L8=8]="L8",n[n.L9=9]="L9",n))(vt||{}),Fe=(n=>(n[n.Default1=1]="Default1",n[n.ZdepthFrontNearest2010=2010]="ZdepthFrontNearest2010",n[n.ZdepthFront2011=2011]="ZdepthFront2011",n[n.ZdepthFrontNearFar2012=2012]="ZdepthFrontNearFar2012",n[n.ZdepthFullNearFar2112=2112]="ZdepthFullNearFar2112",n))(Fe||{});function CA(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var t=n.default;if(typeof t=="function"){var e=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(s){var i=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return n[s]}})}),e}var Gn={exports:{}};const mA=CA(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));/*!
2
2
  * Based on xzwasm (c) Steve Sanderson. License: MIT - https://github.com/SteveSanderson/xzwasm
3
3
  * Contains xz-embedded by Lasse Collin and Igor Pavlov. License: Public domain - https://tukaani.org/xz/embedded.html
4
4
  * and walloc (c) 2020 Igalia, S.L. License: MIT - https://github.com/wingo/walloc
5
- */var mA=Wn.exports,na;function IA(){return na||(na=1,(function(n,t){(function(s,i){n.exports=i(CA)})(mA,e=>(()=>{var s=[,(r=>{r.exports="data:application/wasm;base64,AGFzbQEAAAABOApgAX8Bf2ABfwBgAABgA39/fwF/YAABf2ACf38AYAN/f34BfmACf38Bf2AEf39/fwF/YAN/f38AAyEg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wF+QgAhAANAQQghASAAIQIDQEIAIAJCAYN9QsKenLzd8pW2SYMgAkIBiIUhAiABQX9qIgENAAsgAKdBA3RB8JCAgABqIAI3AwAgAEIBfCIAQoACUg0ACwtPAAJAIAFFDQAgAkJ/hSECA0AgAkL/AYMgADEAAIWnQQN0QfCQgIAAaikDACACQgiIhSECIABBAWohACABQX9qIgENAAsgAkJ/hSECCyACC8oQAgx/An4CQAJAIAAoAiRFDQAgACgCACECDAELQQAhAiAAQQA6ACggAEIANwMAIABCADcDGCAAQcgAakEAQeQAEIaAgIAAGiAAQawBakEMNgIACyAAIAEoAgQiAzYCECAAQeAAaiEEIABByABqIQUgAEG2AWohBiAAQbABaiEHIABBqAFqIQggASgCECEJAkACQAJAAkADQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCACDgoBAgAEBQYHCAkKDwsgASgCACEKIAAoAqgBIQIgACgCrAEhCyABKAIEIQwgASgCCCENDAILIAcgACgCqAEiDGogASgCACABKAIEIgJqIAEoAgggAmsiAiAAKAKsASAMayIMIAIgDEkbIgIQh4CAgAAaIAEgASgCBCACajYCBEEAIQwgAEEAIAAoAqgBIAJqIgIgAiAAKAKsASILRhs2AqgBIAIgC0cNESAAQQE2AgACQCAHQaiIgIAAQQYQhICAgABFDQBBBSEMDBILIAZBAkEAEI2AgIAAIAAoALgBRw0QQQYhDCAGLQAADREgACAALQC3ASICNgIgIAJBBEsNEUEBIAJ0QRNxRQ0RCyABKAIEIgwgASgCCCINRg0OAkAgASgCACIKIAxqLQAAIgsNACAAIAw2AhAgASAMQQFqNgIEQQYhAgwMC0EAIQIgAEEANgKoASAAQQI2AgAgACALQQJ0QQRqIgs2AqwBIAAgCzYCQAsgByACaiAKIAxqIA0gDGsiDCALIAJrIgIgDCACSRsiAhCHgICAABogASABKAIEIAJqNgIEQQAhDCAAQQAgACgCqAEgAmoiAiACIAAoAqwBIgtGGzYCqAEgAiALRw0PIAAgAkF8aiICNgKsAUEHIQwgByACQQAQjYCAg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>{r.exports=e})],i={};function a(r){var c=i[r];if(c!==void 0)return c.exports;var A=i[r]={exports:{}};return s[r](A,A.exports,a),A.exports}a.d=(r,c)=>{for(var A in c)a.o(c,A)&&!a.o(r,A)&&Object.defineProperty(r,A,{enumerable:!0,get:c[A]})},a.o=(r,c)=>Object.prototype.hasOwnProperty.call(r,c),a.r=r=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var o={};return(()=>{a.r(o),a.d(o,{XzReadableStream:()=>h});var r=a(1);const c=globalThis.ReadableStream||a(2).ReadableStream,A=0,u=1;class l{constructor(d){this.exports=d.exports,this.memory=this.exports.memory,this.ptr=this.exports.create_context(),this._refresh(),this.bufSize=this.mem32[0],this.inStart=this.mem32[1]-this.ptr,this.inEnd=this.inStart+this.bufSize,this.outStart=this.mem32[4]-this.ptr}supplyInput(d){this._refresh(),this.mem8.subarray(this.inStart,this.inEnd).set(d,0),this.exports.supply_input(this.ptr,d.byteLength),this._refresh()}getNextOutput(){const d=this.exports.get_next_output(this.ptr);if(this._refresh(),d!==A&&d!==u)throw new Error(`get_next_output failed with error code ${d}`);return{outChunk:this.mem8.slice(this.outStart,this.outStart+this.mem32[5]),finished:d===u}}needsMoreInput(){return this.mem32[2]===this.mem32[3]}outputBufferIsFull(){return this.mem32[5]===this.bufSize}resetOutputBuffer(){this.outPos=this.mem32[5]=0}dispose(){this.exports.destroy_context(this.ptr),this.exports=null}_refresh(){this.memory.buffer!==this.mem8?.buffer&&(this.mem8=new Uint8Array(this.memory.buffer,this.ptr),this.mem32=new Uint32Array(this.memory.buffer,this.ptr))}}class C{constructor(){this.locked=!1,this.waitQueue=[]}async acquire(){if(!this.locked){this.locked=!0;return}return new Promise(d=>{this.waitQueue.push(d)})}release(){this.waitQueue.length>0?this.waitQueue.shift()():this.locked=!1}}const m=class m extends c{static async _getModuleInstance(){const d=r.replace("data:application/wasm;base64,",""),p=Uint8Array.from(atob(d),w=>w.charCodeAt(0)).buffer,f={},D=await WebAssembly.instantiate(p,f);m._moduleInstance=D.instance}constructor(d){let p,f=null;const D=d.getReader();super({async start(w){await m._contextMutex.acquire();try{m._moduleInstance||await(m._moduleInstancePromise||(m._moduleInstancePromise=m._getModuleInstance())),p=new l(m._moduleInstance)}catch(x){throw m._contextMutex.release(),x}},async pull(w){try{if(p.needsMoreInput()){if(f===null||f.byteLength===0){const{done:Q,value:y}=await D.read();Q||(f=y)}const b=Math.min(p.bufSize,f.byteLength);p.supplyInput(f.subarray(0,b)),f=f.subarray(b)}const x=p.getNextOutput();w.enqueue(x.outChunk),p.resetOutputBuffer(),x.finished&&(p.dispose(),m._contextMutex.release(),w.close())}catch(x){throw p&&p.dispose(),m._contextMutex.release(),x}},cancel(){try{return p&&p.dispose(),D.cancel()}finally{m._contextMutex.release()}}})}};os(m,"_moduleInstancePromise"),os(m,"_moduleInstance"),os(m,"_contextMutex",new C);let h=m})(),o})())})(Wn)),Wn.exports}var yA=IA(),Lt=Uint8Array,Le=Uint16Array,wA=Int32Array,sa=new Lt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ia=new Lt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),EA=new Lt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),oa=function(n,t){for(var e=new Le(31),s=0;s<31;++s)e[s]=t+=1<<n[s-1];for(var i=new wA(e[30]),s=1;s<30;++s)for(var a=e[s];a<e[s+1];++a)i[a]=a-e[s]<<5|s;return{b:e,r:i}},aa=oa(sa,2),ra=aa.b,QA=aa.r;ra[28]=258,QA[258]=28;for(var bA=oa(ia,0),BA=bA.b,$s=new Le(32768),ct=0;ct<32768;++ct){var ge=(ct&43690)>>1|(ct&21845)<<1;ge=(ge&52428)>>2|(ge&13107)<<2,ge=(ge&61680)>>4|(ge&3855)<<4,$s[ct]=((ge&65280)>>8|(ge&255)<<8)>>1}for(var rn=(function(n,t,e){for(var s=n.length,i=0,a=new Le(t);i<s;++i)n[i]&&++a[n[i]-1];var o=new Le(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var r;if(e){r=new Le(1<<t);var c=15-t;for(i=0;i<s;++i)if(n[i])for(var A=i<<4|n[i],u=t-n[i],l=o[n[i]-1]++<<u,C=l|(1<<u)-1;l<=C;++l)r[$s[l]>>c]=A}else for(r=new Le(s),i=0;i<s;++i)n[i]&&(r[i]=$s[o[n[i]-1]++]>>15-n[i]);return r}),An=new Lt(288),ct=0;ct<144;++ct)An[ct]=8;for(var ct=144;ct<256;++ct)An[ct]=9;for(var ct=256;ct<280;++ct)An[ct]=7;for(var ct=280;ct<288;++ct)An[ct]=8;for(var Aa=new Lt(32),ct=0;ct<32;++ct)Aa[ct]=5;var SA=rn(An,9,1),MA=rn(Aa,5,1),ti=function(n){for(var t=n[0],e=1;e<n.length;++e)n[e]>t&&(t=n[e]);return t},_t=function(n,t,e){var s=t/8|0;return(n[s]|n[s+1]<<8)>>(t&7)&e},ei=function(n,t){var e=t/8|0;return(n[e]|n[e+1]<<8|n[e+2]<<16)>>(t&7)},xA=function(n){return(n+7)/8|0},ni=function(n,t,e){return(t==null||t<0)&&(t=0),(e==null||e>n.length)&&(e=n.length),new Lt(n.subarray(t,e))},vA=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Nt=function(n,t,e){var s=new Error(t||vA[n]);if(s.code=n,Error.captureStackTrace&&Error.captureStackTrace(s,Nt),!e)throw s;return s},DA=function(n,t,e,s){var i=n.length,a=s?s.length:0;if(!i||t.f&&!t.l)return e||new Lt(0);var o=!e,r=o||t.i!=2,c=t.i;o&&(e=new Lt(i*3));var A=function(at){var St=e.length;if(at>St){var ne=new Lt(Math.max(St*2,at));ne.set(e),e=ne}},u=t.f||0,l=t.p||0,C=t.b||0,h=t.l,m=t.d,I=t.m,d=t.n,p=i*8;do{if(!h){u=_t(n,l,1);var f=_t(n,l+1,3);if(l+=3,f)if(f==1)h=SA,m=MA,I=9,d=5;else if(f==2){var b=_t(n,l,31)+257,Q=_t(n,l+10,15)+4,y=b+_t(n,l+5,31)+1;l+=14;for(var S=new Lt(y),v=new Lt(19),M=0;M<Q;++M)v[EA[M]]=_t(n,l+M*3,7);l+=Q*3;for(var N=ti(v),O=(1<<N)-1,z=rn(v,N,1),M=0;M<y;){var W=z[_t(n,l,O)];l+=W&15;var D=W>>4;if(D<16)S[M++]=D;else{var J=0,k=0;for(D==16?(k=3+_t(n,l,3),l+=2,J=S[M-1]):D==17?(k=3+_t(n,l,7),l+=3):D==18&&(k=11+_t(n,l,127),l+=7);k--;)S[M++]=J}}var B=S.subarray(0,b),T=S.subarray(b);I=ti(B),d=ti(T),h=rn(B,I,1),m=rn(T,d,1)}else Nt(1);else{var D=xA(l)+4,w=n[D-4]|n[D-3]<<8,x=D+w;if(x>i){c&&Nt(0);break}r&&A(C+w),e.set(n.subarray(D,x),C),t.b=C+=w,t.p=l=x*8,t.f=u;continue}if(l>p){c&&Nt(0);break}}r&&A(C+131072);for(var F=(1<<I)-1,L=(1<<d)-1,U=l;;U=l){var J=h[ei(n,l)&F],V=J>>4;if(l+=J&15,l>p){c&&Nt(0);break}if(J||Nt(2),V<256)e[C++]=V;else if(V==256){U=l,h=null;break}else{var j=V-254;if(V>264){var M=V-257,_=sa[M];j=_t(n,l,(1<<_)-1)+ra[M],l+=_}var G=m[ei(n,l)&L],lt=G>>4;G||Nt(3),l+=G&15;var T=BA[lt];if(lt>3){var _=ia[lt];T+=ei(n,l)&(1<<_)-1,l+=_}if(l>p){c&&Nt(0);break}r&&A(C+131072);var Z=C+j;if(C<T){var Ft=a-T,Ot=Math.min(T,Z);for(Ft+C<0&&Nt(3);C<Ot;++C)e[C]=s[Ft+C]}for(;C<Z;++C)e[C]=e[C-T]}}t.l=h,t.p=U,t.b=C,t.f=u,h&&(u=1,t.m=I,t.d=m,t.n=d)}while(!u);return C!=e.length&&o?ni(e,0,C):e.subarray(0,C)},kA=new Lt(0),Zt=function(n,t){return n[t]|n[t+1]<<8},Gt=function(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0},si=function(n,t){return Gt(n,t)+Gt(n,t+4)*4294967296};function TA(n,t){return DA(n,{i:2},t&&t.out,t&&t.dictionary)}var ii=typeof TextDecoder<"u"&&new TextDecoder,LA=0;try{ii.decode(kA,{stream:!0}),LA=1}catch{}var RA=function(n){for(var t="",e=0;;){var s=n[e++],i=(s>127)+(s>223)+(s>239);if(e+i>n.length)return{s:t,r:ni(n,e-1)};i?i==3?(s=((s&15)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,t+=String.fromCharCode(55296|s>>10,56320|s&1023)):i&1?t+=String.fromCharCode((s&31)<<6|n[e++]&63):t+=String.fromCharCode((s&15)<<12|(n[e++]&63)<<6|n[e++]&63):t+=String.fromCharCode(s)}};function FA(n,t){if(t){for(var e="",s=0;s<n.length;s+=16384)e+=String.fromCharCode.apply(null,n.subarray(s,s+16384));return e}else{if(ii)return ii.decode(n);var i=RA(n),a=i.s,e=i.r;return e.length&&Nt(8),a}}var UA=function(n,t){return t+30+Zt(n,t+26)+Zt(n,t+28)},PA=function(n,t,e){var s=Zt(n,t+28),i=FA(n.subarray(t+46,t+46+s),!(Zt(n,t+8)&2048)),a=t+46+s,o=Gt(n,t+20),r=e&&o==4294967295?VA(n,a):[o,Gt(n,t+24),Gt(n,t+42)],c=r[0],A=r[1],u=r[2];return[Zt(n,t+10),c,A,i,a+Zt(n,t+30)+Zt(n,t+32),u]},VA=function(n,t){for(;Zt(n,t)!=1;t+=4+Zt(n,t+2));return[si(n,t+12),si(n,t+4),si(n,t+20)]};function NA(n,t){for(var e={},s=n.length-22;Gt(n,s)!=101010256;--s)(!s||n.length-s>65558)&&Nt(13);var i=Zt(n,s+8);if(!i)return{};var a=Gt(n,s+16),o=a==4294967295||i==65535;if(o){var r=Gt(n,s-12);o=Gt(n,r)==101075792,o&&(i=Gt(n,r+32),a=Gt(n,r+48))}for(var c=0;c<i;++c){var A=PA(n,a,o),u=A[0],l=A[1],C=A[2],h=A[3],m=A[4],I=A[5],d=UA(n,I);a=m,u?u==8?e[h]=TA(n.subarray(d,d+l),{out:new Lt(C)}):Nt(14,"unknown compression type "+u):e[h]=ni(n,d,d+l)}return e}function oi(n){let t=!1;const e=(h,m,I)=>n.on(h,m,I),s=(h,...m)=>n.fire(h,...m);e(Tt,()=>s(R).debugMode),e(ps,()=>t=!0),e(on,h=>{const m=s(Se).capabilities.maxTextureSize,I=2*h;let d=1024;for(;d*m<I;)d*=2;d=Math.min(d,m/2);const p=Math.min(Math.ceil(I/d),m);return{texwidth:d,texheight:p}});let i=0;(function h(){i++,!t&&requestAnimationFrame(h)})(),e(he,(h,m=null,I=0)=>{const d=()=>{t||(I>0?!(i%I)&&h(i):h(i),m&&m()&&requestAnimationFrame(d))};d()}),e(Ti,(h,m=null,I=20)=>{const d=()=>{t||(h(),m&&m()&&setTimeout(d,I))};d()});let a=!1,o=0,r=0;e(Jr,()=>a),e(Ho,h=>{a=h,h?(async()=>document.querySelector("#gsviewer .logo")?.classList.add("loading"))():(async()=>document.querySelector("#gsviewer .logo")?.classList.remove("loading"))(),(async()=>{const m=document.querySelector("#gsviewer #progressBarWrap");m&&m.style.display!="none"&&(m.style.display="none")})()}),e(ys,()=>{a=!0,(async()=>{const h=document.querySelector("#gsviewer #progressBarWrap");if(h){h.style.display="block";const m=document.querySelector("#gsviewer #progressBar");m&&(m.style.width="0%")}})(),(async()=>document.querySelector("#gsviewer .logo")?.classList.add("loading"))(),parent?.onProgress&&parent.onProgress(.001,"0.001%"),window.onProgress&&window.onProgress(.001,"0.001%")}),e(Xe,h=>{h&&(o=h),a=!1,h!==void 0&&((async()=>{const m=document.querySelector("#gsviewer #progressBarWrap");m&&(m.style.display="none")})(),(async()=>document.querySelector("#gsviewer .logo")?.classList.remove("loading"))(),parent?.onProgress&&parent.onProgress(0,"100%",9),window.onProgress&&window.onProgress(0,"100%",9))}),e(ws,h=>{a=!0,(async()=>{const m=document.querySelector("#gsviewer #progressBar");m&&(m.style.width=`${h}%`)})(),parent?.onProgress&&parent.onProgress(h,`${h}%`),window.onProgress&&window.onProgress(h,`${h}%`)}),e(Rr,()=>a),e(ao,h=>{r=h}),e(ro,()=>!a&&o&&r>=o),e(me,()=>{const m=s(Qe).parentElement.getBoundingClientRect();return{width:m.width,height:m.height,left:m.left,top:m.top}}),e(Ie,h=>{let m=h.x.toFixed(3).split("."),I=h.y.toFixed(3).split("."),d=h.z.toFixed(3).split(".");return(m[1]==="000"||m[1]==="00000")&&(m[1]="0"),(I[1]==="000"||I[1]==="00000")&&(I[1]="0"),(d[1]==="000"||d[1]==="00000")&&(d[1]="0"),`${m.join(".")}, ${I.join(".")}, ${d.join(".")}`}),e(vr,h=>btoa(h)),e(Dr,h=>atob(h));const c=.001;let A=new g.Vector3,u=new g.Vector3,l=0;e(Lr,()=>{const h=s(Qt),m=h.fov,I=h.position.clone(),d=h.getWorldDirection(new g.Vector3);return Math.abs(l-m)<c&&Math.abs(I.x-A.x)<c&&Math.abs(I.y-A.y)<c&&Math.abs(I.z-A.z)<c&&Math.abs(d.x-u.x)<c&&Math.abs(d.y-u.y)<c&&Math.abs(d.z-u.z)<c?!1:(l=m,A=I,u=d,!0)}),e(ie,h=>{if(!h)return;const m=[];h.traverse(I=>m.push(I)),m.forEach(I=>{I.dispose?I.dispose():(I.geometry?.dispose?.(),I.material&&I.material instanceof Array?I.material.forEach(d=>d?.dispose?.()):I.material?.dispose?.())}),h.clear()}),e(ut,async({renderSplatCount:h,visibleSplatCount:m,modelSplatCount:I,fps:d,realFps:p,sortTime:f,bucketBits:D,sortType:w,qualityLevel:x,fov:b,position:Q,lookUp:y,lookAt:S,worker:v,scene:M,scale:N,lodTotalCount:O,cuts:z,shDegree:W}={})=>{if(!s(Tt))return;W!==void 0&&C("shDegree",`${W}`),h!==void 0&&C("renderSplatCount",`${h}`),m!==void 0&&C("visibleSplatCount",`${m}`),I!==void 0&&C("modelSplatCount",`${I}`),d!==void 0&&C("fps",d),p!==void 0&&C("realFps",`raw ${p}`),f!==void 0&&C("sort",`${f} ms (L ${s(R).qualityLevel||vt.Default5}, ${D||""} B, T ${w||""})`),z!==void 0&&(O!==void 0?C("cuts",z===""?"":`${O}(${z} cuts)`):C("cuts",z===""?"":`(${z} cuts)`)),v&&C("worker",`${v}`),M&&C("scene",M),b&&C("fov",b),Q&&C("position",Q),y&&C("lookUp",y),S&&C("lookAt",S),S&&C("viewer-version",_n);let J=performance.memory||{usedJSHeapSize:0,totalJSHeapSize:0,jsHeapSizeLimit:0},k="",B=J.usedJSHeapSize/1024/1024;B>1e3?k+=(B/1024).toFixed(2)+" G":k+=B.toFixed(0)+" M",k+=" / ";let T=J.totalJSHeapSize/1024/1024;T>1e3?k+=(T/1024).toFixed(2)+" G":k+=T.toFixed(0)+" M";let F=J.jsHeapSizeLimit/1024/1024;k+=" / ",F>1e3?k+=(F/1024).toFixed(2)+" G":k+=F.toFixed(0)+" M",C("memory",k),N&&C("scale",N)});async function C(h,m){let I=document.querySelector(`#gsviewer .debug .${h}`);I&&(I.innerText=m)}}const cn=g.ShaderChunk;function HA(n=0){const t=new Date;return t.setDate(t.getDate()-7),n>=t.getFullYear()*1e4+(t.getMonth()+1)*100+t.getDate()}function q(n){return n<0?0:n>255?255:n|0}function On(n){const t=q(Math.round(n*128)+128);return q(Math.floor((t+4)/8)*8)}function zn(n,t){return((1500+n*248)/t).toFixed(2)+"x"}async function ai(n){try{const t=new ReadableStream({async start(s){s.enqueue(n),s.close()}}),e=new Response(t.pipeThrough(new DecompressionStream("gzip")));return new Uint8Array(await e.arrayBuffer())}catch(t){return console.error("Decompress gzip failed:",t),null}}async function ca(n){try{const t=URL.createObjectURL(new Blob([n],{type:"application/octet-stream"})),e=await fetch(t),s=new Response(new yA.XzReadableStream(e.body));return new Uint8Array(await s.arrayBuffer())}catch(t){return console.error("Decompress xz failed:",t),null}}async function _A(n){const t=new Uint32Array(n.slice(0,12).buffer),e=t[0],s=t[2];let i=8;const a=n.subarray(i+4,i+4+s),{rgba:o}=await gt(a);i+=4+s;const r=new Uint32Array(n.slice(i,i+4).buffer)[0],c=n.subarray(i+4,i+4+r),{rgba:A}=await gt(c);i+=4+r;const u=new Uint32Array(n.slice(i,i+4).buffer)[0],l=n.subarray(i+4,i+4+u),{rgba:C}=await gt(l);i+=4+u;const h=new Uint32Array(n.slice(i,i+4).buffer)[0],m=n.subarray(i+4,i+4+h),{rgba:I}=await gt(m),d=new Uint8Array(8+e*19);let p=0;d[p]=n[p++],d[p]=n[p++],d[p]=n[p++],d[p]=n[p++],d[p++]=19,d[p++]=0,d[p++]=0,d[p++]=0;for(let f=0;f<e;f++)d[p++]=o[f*4+0];for(let f=0;f<e;f++)d[p++]=o[f*4+1];for(let f=0;f<e;f++)d[p++]=o[f*4+2];for(let f=0;f<e;f++)d[p++]=o[e*4+f*4+0];for(let f=0;f<e;f++)d[p++]=o[e*4+f*4+1];for(let f=0;f<e;f++)d[p++]=o[e*4+f*4+2];for(let f=0;f<e;f++)d[p++]=o[e*8+f*4+0];for(let f=0;f<e;f++)d[p++]=o[e*8+f*4+1];for(let f=0;f<e;f++)d[p++]=o[e*8+f*4+2];for(let f=0;f<e;f++)d[p++]=A[f*4+0];for(let f=0;f<e;f++)d[p++]=A[f*4+1];for(let f=0;f<e;f++)d[p++]=A[f*4+2];for(let f=0;f<e;f++)d[p++]=C[f*4+0];for(let f=0;f<e;f++)d[p++]=C[f*4+1];for(let f=0;f<e;f++)d[p++]=C[f*4+2];for(let f=0;f<e;f++)d[p++]=C[f*4+3];for(let f=0;f<e;f++)d[p++]=I[f*4+0];for(let f=0;f<e;f++)d[p++]=I[f*4+1];for(let f=0;f<e;f++)d[p++]=I[f*4+2];return d}async function GA(n){const t=new Uint32Array(n.slice(0,16).buffer),e=t[0],s=t[3];let i=12;const a=n.subarray(i+4,i+4+s),{rgba:o}=await gt(a);i+=4+s;const r=new Uint32Array(n.slice(i,i+4).buffer)[0],c=n.subarray(i+4,i+4+r),{rgba:A}=await gt(c);i+=4+r;const u=new Uint32Array(n.slice(i,i+4).buffer)[0],l=n.subarray(i+4,i+4+u),{rgba:C}=await gt(l);i+=4+u;const h=new Uint32Array(n.slice(i,i+4).buffer)[0],m=n.subarray(i+4,i+4+h),{rgba:I}=await gt(m),d=new Uint8Array(8+e*19);let p=0;d[p]=n[p++],d[p]=n[p++],d[p]=n[p++],d[p]=n[p++],d[p++]=35,d[p++]=39,d[p++]=0,d[p++]=0,d[p]=n[p++],d[p]=n[p++],d[p]=n[p++],d[p]=n[p++];for(let f=0;f<e;f++)d[p++]=o[f*4+0];for(let f=0;f<e;f++)d[p++]=o[f*4+1];for(let f=0;f<e;f++)d[p++]=o[f*4+2];for(let f=0;f<e;f++)d[p++]=o[e*4+f*4+0];for(let f=0;f<e;f++)d[p++]=o[e*4+f*4+1];for(let f=0;f<e;f++)d[p++]=o[e*4+f*4+2];for(let f=0;f<e;f++)d[p++]=o[e*8+f*4+0];for(let f=0;f<e;f++)d[p++]=o[e*8+f*4+1];for(let f=0;f<e;f++)d[p++]=o[e*8+f*4+2];for(let f=0;f<e;f++)d[p++]=A[f*4+0];for(let f=0;f<e;f++)d[p++]=A[f*4+1];for(let f=0;f<e;f++)d[p++]=A[f*4+2];for(let f=0;f<e;f++)d[p++]=C[f*4+0];for(let f=0;f<e;f++)d[p++]=C[f*4+1];for(let f=0;f<e;f++)d[p++]=C[f*4+2];for(let f=0;f<e;f++)d[p++]=C[f*4+3];for(let f=0;f<e;f++)d[p++]=I[f*4+0];for(let f=0;f<e;f++)d[p++]=I[f*4+1];for(let f=0;f<e;f++)d[p++]=I[f*4+2];return d}async function WA(n){const e=new Uint32Array(n.slice(0,4).buffer)[0];let s=8;const i=[];for(;s<n.length;){const o=new Uint32Array(n.slice(s,s+4).buffer)[0],r=n.subarray(s+4,s+4+o),{rgba:c}=await gt(r);i.push(c),s+=4+o}const a=new Uint8Array(8+e*4*i.length);a.set(n.subarray(0,8));for(let o=0,r=8;o<i.length;o++)a.set(i[o].subarray(0,e*4),r),r+=e*4;return a}async function OA(n){const e=new Uint32Array(n.slice(0,8).buffer)[0],s=n.subarray(8),{rgba:i}=await gt(s),a=new Uint8Array(8+e*9);let o=0;a[o]=n[o++],a[o]=n[o++],a[o]=n[o++],a[o]=n[o++],a[o++]=1,a[o++]=0,a[o++]=0,a[o++]=0;for(let r=0;r<e;r++)for(let c=0;c<3;c++)a[o++]=i[r*60+c*4+0],a[o++]=i[r*60+c*4+1],a[o++]=i[r*60+c*4+2];return a}async function la(n){const e=new Uint32Array(n.slice(0,8).buffer)[0],s=n.subarray(8),{rgba:i}=await gt(s),a=new Uint8Array(8+e*24);let o=0;a[o]=n[o++],a[o]=n[o++],a[o]=n[o++],a[o]=n[o++],a[o++]=2,a[o++]=0,a[o++]=0,a[o++]=0;for(let r=0;r<e;r++)for(let c=0;c<8;c++)a[o++]=i[r*60+c*4+0],a[o++]=i[r*60+c*4+1],a[o++]=i[r*60+c*4+2];return a}async function zA(n){const e=new Uint32Array(n.slice(0,8).buffer)[0],s=n.subarray(8),{rgba:i}=await gt(s),a=new Uint8Array(8+e*21);let o=0;a[o]=n[o++],a[o]=n[o++],a[o]=n[o++],a[o]=n[o++],a[o++]=3,a[o++]=0,a[o++]=0,a[o++]=0;for(let r=0;r<e;r++)for(let c=8;c<15;c++)a[o++]=i[r*60+c*4+0],a[o++]=i[r*60+c*4+1],a[o++]=i[r*60+c*4+2];return a}async function gt(n){const t=new Blob([n],{type:"image/webp"}),e=URL.createObjectURL(t),s=await createImageBitmap(await fetch(e).then(A=>A.blob())),a=new OffscreenCanvas(s.width,s.height).getContext("2d");a.drawImage(s,0,0);const o=a.getImageData(0,0,s.width,s.height),r=s.width,c=s.height;return s.close(),URL.revokeObjectURL(e),{width:r,height:c,rgba:o.data}}function YA(n){const t=new Map;try{const e=NA(n);for(const[s,i]of Object.entries(e))if(i){const a=new Uint8Array(i);t.set(s,a)}}catch(e){console.error("解压失败:",e)}return t}function JA(n){return new TextDecoder("utf-8").decode(n)}function ua(n,t=null,e=20){const s=()=>{n(),t?.()&&setTimeout(s,e)};s()}const da=new g.Frustum,ga=new g.Matrix4,fa=new g.Matrix4;function KA(n,t){return fa.copy(n.matrixWorld).invert(),ga.multiplyMatrices(n.projectionMatrix,fa),da.setFromProjectionMatrix(ga),da.containsPoint(t)}function XA(n){return((n?.Flags||0)&1)>0}function ha(n){return((n?.Flags||0)&128)>0}function ZA(n,t){const e=n.elements;let s=0;t[s++].set(new g.Vector3(e[3]+e[2],e[7]+e[6],e[11]+e[10]),e[15]+e[14]).normalize(),t[s++].set(new g.Vector3(e[3]+e[0],e[7]+e[4],e[11]+e[8]),e[15]+e[12]).normalize(),t[s++].set(new g.Vector3(e[3]-e[0],e[7]-e[4],e[11]-e[8]),e[15]-e[12]).normalize(),t[s++].set(new g.Vector3(e[3]+e[1],e[7]+e[5],e[11]+e[9]),e[15]+e[13]).normalize(),t[s++].set(new g.Vector3(e[3]-e[1],e[7]-e[5],e[11]-e[9]),e[15]-e[13]).normalize(),t[s++].set(new g.Vector3(e[3]-e[2],e[7]-e[6],e[11]-e[10]),e[15]-e[14]).normalize()}const jA=new g.Vector3;function pa(n,t){const e=jA.fromArray(t.center).distanceTo(n);return e>=0?Math.max(0,e-t.radius):Math.min(0,e+t.radius)}function Re(n,t){try{return t?new URL(n,t).href:n}catch{return n}}const qA="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEeBmABfQF9YAAAYAJ/fwF/YAF9AX9gAX8Bf2ACf38AAhoCA2VudgRleHBmAAADZW52Bm1lbW9yeQIAAAMGBQECAwQFByEEEV9fd2FzbV9jYWxsX2N0b3JzAAEBSAAEAXcABQFEAAIKhA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er),e=new Float32Array(n.buffer),s=new sA;s.Fixed=String.fromCharCode(n[0])+String.fromCharCode(n[1])+String.fromCharCode(n[2]),s.Version=n[3],s.SplatCount=t[1],s.MinX=e[2],s.MaxX=e[3],s.MinY=e[4],s.MaxY=e[5],s.MinZ=e[6],s.MaxZ=e[7],s.MinTopY=e[8],s.MaxTopY=e[9],s.CreateDate=t[10],s.CreaterId=t[11],s.ExclusiveId=t[12],s.ShDegree=n[52],s.Flags=n[53],s.Lod=n[54],s.Reserve3=n[55],s.Reserve1=t[14],s.Reserve2=t[15];let i="";for(let C=64;C<124;C++)i+=String.fromCharCode(n[C]);if(s.Comment=i.trim(),s.HashCheck=!0,s.Fixed!=="spx")return null;const a=s.ExclusiveId?ma:ri,o=WebAssembly.compile(Uint8Array.from(atob(a),C=>C.charCodeAt(0)).buffer),r=new WebAssembly.Memory({initial:1,maximum:1}),A=(await WebAssembly.instantiate(await o,{env:{memory:r,expf:Yn}})).exports.H;return new Uint8Array(r.buffer).set(n,0),A(0)&&(s.HashCheck=!1),s}async function Rt(n,t=null){let e=new Uint32Array(n.slice(0,8).buffer);const s=e[0],i=e[1],a=[cA,300222],o=t?.Version>=3&&a.includes(i);if(i==lA){const A=n.subarray(8);return{splatCount:0,blockFormat:i,palettes:A,success:!0}}else if(i==uA){const{rgba:c}=await gt(n.subarray(8));return{splatCount:0,blockFormat:i,palettes:c,success:!0}}let r=t?.ShDegree||0;if(i==hA){if(t.ShDegree==an){const c=await OA(n);return ln(s,an,c,t.Version,r)}else if(t.ShDegree==oe){const c=await la(n);return ln(s,oe,c,t.Version,r)}else if(t.ShDegree==ke){const c=await la(n),A=await zA(n),u=await ln(s,oe,c,t.Version,r),l=await ln(s,ke,A,t.Version,r);return u.success=u.success&&l.success,u.isSh23=!0,u.dataSh3=l.datas,u}}return o?n=await WA(n):i==gA?n=await _A(n):i==fA&&(n=await GA(n)),ln(s,i,n,t?.Version||1,r)}async function ln(n,t,e,s,i){const a=an==t,o=oe==t,r=ke==t,c=a||o||r,A=!c,u=[ri,qA,Ca,ma],l=t<65536?0:s,C=n*(c?aA:K),h=WebAssembly.compile(Uint8Array.from(atob(u[l]),w=>w.charCodeAt(0)).buffer),m=Math.ceil((C+e.byteLength)/$o)+1,I=new WebAssembly.Memory({initial:m,maximum:m}),p=(await WebAssembly.instantiate(await h,{env:{memory:I,expf:Yn}})).exports.D,f=new Uint8Array(I.buffer);return f.set(e,C),p(0,C,i)?{splatCount:n,blockFormat:t,success:!1}:{splatCount:n,blockFormat:t,success:!0,datas:f.slice(0,C),isSplat:A,isSh:c,isSh1:a,isSh2:o,isSh3:r}}async function un(n,t){const e=WebAssembly.compile(Uint8Array.from(atob(ri),A=>A.charCodeAt(0)).buffer),s=Math.ceil(t*K/$o)+1,i=new WebAssembly.Memory({initial:s,maximum:s}),o=(await WebAssembly.instantiate(await e,{env:{memory:i,expf:Yn}})).exports.s,r=new Uint8Array(i.buffer);r.set(n.subarray(0,t*K),0);const c=o(0,t);return c?(console.error("splat data parser failed:",c),new Uint8Array(0)):r.slice(0,t*K)}async function $A(n,t,e=!0,s=!0){const i=WebAssembly.compile(Uint8Array.from(atob(Ca),l=>l.charCodeAt(0)).buffer),a=new WebAssembly.Memory({initial:1,maximum:1}),r=(await WebAssembly.instantiate(await i,{env:{memory:a,expf:Yn}})).exports.w,c=new Uint8Array(a.buffer),A=new Float32Array(c.buffer),u=s?-1:1;return A[0]=n,e?A[1]=u*t:A[2]=u*t,r(0,e?1:0),c.slice(0,K)}function Yn(n){return Math.exp(n)}const dn=dt?20480:512e3;async function tc(n){try{n.status=P.Fetching;const i=n.abortController.signal,a=n.opts.fetchReload?"reload":"default",o=await fetch(n.opts.url,{mode:"cors",credentials:"omit",cache:a,signal:i});if(o.status!=200){console.warn(`fetch error: ${o.status}`),n.status===P.Fetching&&(n.status=P.FetchFailed);return}const r=o.body.getReader(),c=parseInt(o.headers.get("content-length")||"0");n.fileSize=c,n.downloadSize=0,n.downloadSplatCount=0,n.watermarkData=new Uint8Array(0);let A=new Uint8Array(256),u=0,l=[],C;for(;;){let{done:h,value:m}=await r.read();if(h)break;if(n.downloadSize+=m.byteLength,l){if(l.push(m),n.downloadSize<200)continue;const I=new Uint8Array(n.downloadSize);for(let d=0,p=0;d<l.length;d++)I.set(l[d],p),p+=l[d].byteLength;if(C=s(I),!C){l=[I];continue}l=null,m=I.slice(C.headerLength),n.rowLength=C.rowLength,n.dataShDegree=C.shDegree,n.modelSplatCount=C.vertexCount,n.splatData=new Uint8Array(Math.min(n.modelSplatCount,n.fetchLimit)*32)}u+m.byteLength<n.rowLength?(A.set(m,u),u+=m.byteLength):(u=await t(C,n,u,A,m),u&&A.set(m.subarray(m.byteLength-u),0)),n.downloadSplatCount>=n.fetchLimit&&n.abortController.abort()}}catch(i){i.name==="AbortError"?(n.opts.url,n.status===P.Fetching&&(n.status=P.FetchAborted)):(console.error(i),n.status===P.Fetching&&(n.status=P.FetchFailed))}finally{n.status===P.Fetching&&(n.status=P.FetchDone)}async function t(i,a,o,r,c){return new Promise(async A=>{let u=(o+c.byteLength)/a.rowLength|0,l=(o+c.byteLength)%a.rowLength,C;o?(C=new Uint8Array(u*a.rowLength),C.set(r.subarray(0,o),0),C.set(c.subarray(0,c.byteLength-l),o)):C=c.slice(0,u*a.rowLength),a.downloadSplatCount+u>a.fetchLimit&&(u=a.fetchLimit-a.downloadSplatCount,l=0);const h=async()=>{if(u>dn){const m=await e(i,C,dn);ya(a,m),a.downloadSplatCount+=dn,u-=dn,C=C.slice(dn*a.rowLength),setTimeout(h)}else{const m=await e(i,C,u);ya(a,m),a.downloadSplatCount+=u,A(l)}};await h()})}async function e(i,a,o){const r=new Uint8Array(o*Gn),c=new Float32Array(a.buffer),A=new Float32Array(r.buffer);for(let u=0;u<o;u++)A[u*8+0]=c[(u*n.rowLength+i.offsets.x)/4],A[u*8+1]=c[(u*n.rowLength+i.offsets.y)/4],A[u*8+2]=c[(u*n.rowLength+i.offsets.z)/4],A[u*8+3]=Math.exp(c[(u*n.rowLength+i.offsets.scale_0)/4]),A[u*8+4]=Math.exp(c[(u*n.rowLength+i.offsets.scale_1)/4]),A[u*8+5]=Math.exp(c[(u*n.rowLength+i.offsets.scale_2)/4]),r[u*32+24]=q((.5+Xt*c[(u*n.rowLength+i.offsets.f_dc_0)/4])*255),r[u*32+25]=q((.5+Xt*c[(u*n.rowLength+i.offsets.f_dc_1)/4])*255),r[u*32+26]=q((.5+Xt*c[(u*n.rowLength+i.offsets.f_dc_2)/4])*255),r[u*32+27]=q(1/(1+Math.exp(-c[(u*n.rowLength+i.offsets.opacity)/4]))*255),r[u*32+28]=q(c[(u*n.rowLength+i.offsets.rot_0)/4]*128+128),r[u*32+29]=q(c[(u*n.rowLength+i.offsets.rot_1)/4]*128+128),r[u*32+30]=q(c[(u*n.rowLength+i.offsets.rot_2)/4]*128+128),r[u*32+31]=q(c[(u*n.rowLength+i.offsets.rot_3)/4]*128+128);if(i.shDegree==3){const l=new Uint8Array(o*24+8),C=new Uint8Array(o*21+8),h=new Uint32Array(2);h[0]=o,h[1]=oe,l.set(new Uint8Array(h.buffer),0);const m=new Uint32Array(2);m[0]=o,m[1]=ke,C.set(new Uint8Array(m.buffer),0);for(let p=0,f=0;p<o;p++)for(let D=0;D<8;D++)for(let w=0;w<3;w++)l[8+f++]=On(c[(p*n.rowLength+i.offsets["f_rest_"+(D+w*15)])/4]);for(let p=0,f=0;p<o;p++)for(let D=8;D<15;D++)for(let w=0;w<3;w++)C[8+f++]=On(c[(p*n.rowLength+i.offsets["f_rest_"+(D+w*15)])/4]);const I=await Rt(l);n.sh12Data.push(I.datas);const d=await Rt(C);n.sh3Data.push(d.datas)}else if(i.shDegree==2){const l=new Uint8Array(o*24+8),C=new Uint32Array(2);C[0]=o,C[1]=oe,l.set(new Uint8Array(C.buffer),0);for(let m=0,I=0;m<o;m++)for(let d=0;d<8;d++)for(let p=0;p<3;p++)l[8+I++]=On(c[(m*n.rowLength+i.offsets["f_rest_"+(d+p*8)])/4]);const h=await Rt(l);n.sh12Data.push(h.datas)}else if(i.shDegree==1){const l=new Uint8Array(o*9+8),C=new Uint32Array(2);C[0]=o,C[1]=an,l.set(new Uint8Array(C.buffer),0);for(let m=0,I=0;m<o;m++)for(let d=0;d<3;d++)for(let p=0;p<3;p++)l[8+I++]=On(c[(m*n.rowLength+i.offsets["f_rest_"+(d+p*3)])/4]);const h=await Rt(l);n.sh12Data.push(h.datas)}return await un(r,o)}function s(i){let a=new TextDecoder().decode(i.slice(0,2048));const o=`end_header
5
+ */var IA=Gn.exports,jo;function yA(){return jo||(jo=1,(function(n,t){(function(s,i){n.exports=i(mA)})(IA,e=>(()=>{var s=[,(r=>{r.exports="data:application/wasm;base64,AGFzbQEAAAABOApgAX8Bf2ABfwBgAABgA39/fwF/YAABf2ACf38AYAN/f34BfmACf38Bf2AEf39/fwF/YAN/f38AAyEgAAABAgMDAwMEAQUAAgMCBgcIBwUDAAMHAQcABwcBAwkFAwEAAgYIAX8BQfCgBAsHTgUGbWVtb3J5AgAOY3JlYXRlX2NvbnRleHQACA9kZXN0cm95X2NvbnRleHQACQxzdXBwbHlfaW5wdXQACg9nZXRfbmV4dF9vdXRwdXQACwqQYCDfAgEFf0EAIQECQCAAQQdqIgJBEEkNAEEBIQEgAkEDdiIDQQJGDQBBAiEBIAJBIEkNAEEDIQEgA0EERg0AQQQhASACQTBJDQBBBSEBIANBBkYNAEEGIQEgAkHIAEkNAEEHIQEgAkHYAEkNAEEIIQEgAkGIAUkNAEEJIQEgAkGIAkkNACAAEIGAgIAAIgBBCGpBACAAGw8LAkACQCABQQJ0QcCIgIAAaiIEKAIAIgANAEEAIQACQAJAQQAoAuSIgIAAIgJFDQBBACACKAIANgLkiICAAAwBC0EAEIGAgIAAIgJFDQILIAJBgIB8cSIAIAJBCHZB/wFxIgJyIAE6AAAgACACQQh0ckGAAmohAEEAIQJBACABQQJ0QYCIgIAAaigCACIDayEFIAMhAQNAIAAgBWoiACACNgIAIAAhAiABIANqIgFBgQJJDQALIAQ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E6AOiIgIAAEIyAgIAAEI6AgIAAC0GggAgQgICAgAAiAEGAgAQ2AgBBAkGAgIAgEJeAgIAAIQEgAEEUakKAgICAgIDAADcCACAAQRBqIABBoIAEajYCACAAQQhqQgA3AgAgACAAQSBqNgIEIAAgATYCHCAACxUAIAAoAhwQmICAgAAgABCCgICAAAsWACAAQQxqIAE2AgAgAEEIakEANgIACxsAIAAoAhwgAEEEaiAAQQxqKAIARRCWgICAAAtUAQN/QQAhAANAQQghASAAIQIDQEEAIAJBAXFrQaCG4u1+cSACQQF2cyECIAFBf2oiAQ0ACyAAQQJ0QfCIgIAAaiACNgIAIABBAWoiAEGAAkcNAAsLTgACQCABRQ0AIAJBf3MhAgNAIAJB/wFxIAAtAABzQQJ0QfCIgIAAaigCACACQQh2cyECIABBAWohACABQX9qIgENAAsgAkF/cyECCyACC10DAX4BfwF+QgAhAANAQQghASAAIQIDQEIAIAJCAYN9QsKenLzd8pW2SYMgAkIBiIUhAiABQX9qIgENAAsgAKdBA3RB8JCAgABqIAI3AwAgAEIBfCIAQoACUg0ACwtPAAJAIAFFDQAgAkJ/hSECA0AgAkL/AYMgADEAAIWnQQN0QfCQgIAAaikDACACQgiIhSECIABBAWohACABQX9qIgENAAsgAkJ/hSECCyACC8oQAgx/An4CQAJAIAAoAiRFDQAgACgCACECDAELQQAhAiAAQQA6ACggAEIANwMAIABCADcDGCAAQcgAakEAQeQAEIaAgIAAGiAAQawBakEMNgIACyAAIAEoAgQiAzYCECAAQeAAaiEEIABByABqIQUgAEG2AWohBiAAQbABaiEHIABBqAFqIQggASgCECEJAkACQAJAAkADQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCACDgoBAgAEBQYHCAkKDwsgASgCACEKIAAoAqgBIQIgACgCrAEhCyABKAIEIQwgASgCCCENDAILIAcgACgCqAEiDGogASgCACABKAIEIgJqIAEoAgggAmsiAiAAKAKsASAMayIMIAIgDEkbIgIQh4CAgAAaIAEgASgCBCACajYCBEEAIQwgAEEA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ooAABHDQAgAEGAAWopAwBCAoggADUAtAFSDQAgAEG4AWotAAANAEEBQQcgACgCICAAQbkBai0AAEYbIQELIAELwAIBA38CQAJAAkAgACgCJA0AIABBADoAKCAAQQA2AgBBASECDAELAkAgACgCAEEKRw0AQQAhAwwCC0ECIQMMAQtBASEDCwJAAkADQAJAAkACQAJAIAMOAwABAwMLIAEoAgQiAyABKAIIIgRGDQQgASgCACEFAkADQCAFIANqLQAADQEgASADQQFqIgM2AgQgACAAKAIEQQFqQQNxNgIEIAQgA0YNBgwACwsCQCAAKAIERQ0AQQcPCyAAKAIkRQ0BIABBADoAKCAAQQA2AgBBASEDDAMLIABCADcDGCAAQQA2AgQgAEHIAGpBAEHkABCGgICAABogAEGsAWpBDDYCAAtBAiEDDAELIAAgARCQgICAACIDQQFHDQIgAEEKNgIAQQAhAwwACwsCQCACDQBBAA8LQQdBASAAKAIEGyEDCyADC3UBAX8CQEG4CRCAgICAACICRQ0AIAIgADYCJCACIAAgARCbgICAACIANgKwCQJAIABFDQAgAkEAOgAoIAJCADcDACACQgA3AxggAkHIAGpBAEHkABCGgICAABogAkGsAWpBDDYCACACDwsgAhCCgICAAAtBAAseAAJAIABFDQAgACgCsAkQnYCAgAAgABCCgICAAAsL3RABCn8gAEHo3QFqIQIgAEHUAGohAyAAQRxqIgRBCGohBQJAAkADQCAAKAJAIQYCQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgASgCBCIHIAEoAghJDQAgBkEHRg0BDBELIAYOCQECAwQFBgcACQ4LIAAoAkwhBgwHC0EBIQYgASAHQQFqNgIEIAEoAgAgB2otAAAiB0UNCAJAAkAgB0HfAUsNACAHQQFHDQELIABBgAI7AVACQCAAKAI8DQAgACABKAIMIAEoAhAiBmo2AhggACABKAIUIAZrNgIsCyAEQgA3AgAgBUIANwIADAoLIAAtAFBFDQkMDQsgASAHQQFqNgIEIAEoAgAgB2otAAAhByAAQQI2AkAgACAHQQh0IAAoAkhqNgJIDAsLIAEgB0EBajY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QCaiEHQQghCEEKIQEMAQsgACADIAZrNgIAIAAgBCAGazYCBCABIAUgBUEFdms7AQIgAUGEBGohB0GAAiEIQRIhAQsgAEHoAGogATYCAEEBIQEDQCAHIAFBAXQiAWohBAJAAkAgACgCACIDQYCAgAhJDQAgACgCBCECDAELIAAgA0EIdCIDNgIAIAAgACgCECIFQQFqNgIQIAAgACgCBEEIdCAFIAAoAgxqLQAAciICNgIECwJAAkAgAiADQQt2IAQvAQAiBmwiBUkNACAAIAIgBWs2AgQgAyAFayEFIAFBAXIhASAGIAZBBXZrIQMMAQsgBkGAECAGa0EFdmohAwsgACAFNgIAIAQgAzsBACABIAhJDQALIABB6ABqIgAgASAIayAAKAIAajYCAAsLNQEAQYAICy4IAAAAEAAAABgAAAAgAAAAKAAAADAAAABAAAAAUAAAAIAAAAAAAQAA/Td6WFoA"}),(r=>{r.exports=e})],i={};function a(r){var c=i[r];if(c!==void 0)return c.exports;var A=i[r]={exports:{}};return s[r](A,A.exports,a),A.exports}a.d=(r,c)=>{for(var A in c)a.o(c,A)&&!a.o(r,A)&&Object.defineProperty(r,A,{enumerable:!0,get:c[A]})},a.o=(r,c)=>Object.prototype.hasOwnProperty.call(r,c),a.r=r=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var o={};return(()=>{a.r(o),a.d(o,{XzReadableStream:()=>h});var r=a(1);const c=globalThis.ReadableStream||a(2).ReadableStream,A=0,u=1;class l{constructor(g){this.exports=g.exports,this.memory=this.exports.memory,this.ptr=this.exports.create_context(),this._refresh(),this.bufSize=this.mem32[0],this.inStart=this.mem32[1]-this.ptr,this.inEnd=this.inStart+this.bufSize,this.outStart=this.mem32[4]-this.ptr}supplyInput(g){this._refresh(),this.mem8.subarray(this.inStart,this.inEnd).set(g,0),this.exports.supply_input(this.ptr,g.byteLength),this._refresh()}getNextOutput(){const g=this.exports.get_next_output(this.ptr);if(this._refresh(),g!==A&&g!==u)throw new Error(`get_next_output failed with error code ${g}`);return{outChunk:this.mem8.slice(this.outStart,this.outStart+this.mem32[5]),finished:g===u}}needsMoreInput(){return this.mem32[2]===this.mem32[3]}outputBufferIsFull(){return this.mem32[5]===this.bufSize}resetOutputBuffer(){this.outPos=this.mem32[5]=0}dispose(){this.exports.destroy_context(this.ptr),this.exports=null}_refresh(){this.memory.buffer!==this.mem8?.buffer&&(this.mem8=new Uint8Array(this.memory.buffer,this.ptr),this.mem32=new Uint32Array(this.memory.buffer,this.ptr))}}class C{constructor(){this.locked=!1,this.waitQueue=[]}async acquire(){if(!this.locked){this.locked=!0;return}return new Promise(g=>{this.waitQueue.push(g)})}release(){this.waitQueue.length>0?this.waitQueue.shift()():this.locked=!1}}const m=class m extends c{static async _getModuleInstance(){const g=r.replace("data:application/wasm;base64,",""),p=Uint8Array.from(atob(g),w=>w.charCodeAt(0)).buffer,f={},D=await WebAssembly.instantiate(p,f);m._moduleInstance=D.instance}constructor(g){let p,f=null;const D=g.getReader();super({async start(w){await m._contextMutex.acquire();try{m._moduleInstance||await(m._moduleInstancePromise||(m._moduleInstancePromise=m._getModuleInstance())),p=new l(m._moduleInstance)}catch(x){throw m._contextMutex.release(),x}},async pull(w){try{if(p.needsMoreInput()){if(f===null||f.byteLength===0){const{done:B,value:y}=await D.read();B||(f=y)}const b=Math.min(p.bufSize,f.byteLength);p.supplyInput(f.subarray(0,b)),f=f.subarray(b)}const x=p.getNextOutput();w.enqueue(x.outChunk),p.resetOutputBuffer(),x.finished&&(p.dispose(),m._contextMutex.release(),w.close())}catch(x){throw p&&p.dispose(),m._contextMutex.release(),x}},cancel(){try{return p&&p.dispose(),D.cancel()}finally{m._contextMutex.release()}}})}};is(m,"_moduleInstancePromise"),is(m,"_moduleInstance"),is(m,"_contextMutex",new C);let h=m})(),o})())})(Gn)),Gn.exports}var wA=yA(),Lt=Uint8Array,Ue=Uint16Array,EA=Int32Array,qo=new Lt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),$o=new Lt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),BA=new Lt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ta=function(n,t){for(var e=new Ue(31),s=0;s<31;++s)e[s]=t+=1<<n[s-1];for(var i=new EA(e[30]),s=1;s<30;++s)for(var a=e[s];a<e[s+1];++a)i[a]=a-e[s]<<5|s;return{b:e,r:i}},ea=ta(qo,2),na=ea.b,QA=ea.r;na[28]=258,QA[258]=28;for(var bA=ta($o,0),SA=bA.b,qs=new Ue(32768),ct=0;ct<32768;++ct){var he=(ct&43690)>>1|(ct&21845)<<1;he=(he&52428)>>2|(he&13107)<<2,he=(he&61680)>>4|(he&3855)<<4,qs[ct]=((he&65280)>>8|(he&255)<<8)>>1}for(var an=(function(n,t,e){for(var s=n.length,i=0,a=new Ue(t);i<s;++i)n[i]&&++a[n[i]-1];var o=new Ue(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var r;if(e){r=new Ue(1<<t);var c=15-t;for(i=0;i<s;++i)if(n[i])for(var A=i<<4|n[i],u=t-n[i],l=o[n[i]-1]++<<u,C=l|(1<<u)-1;l<=C;++l)r[qs[l]>>c]=A}else for(r=new Ue(s),i=0;i<s;++i)n[i]&&(r[i]=qs[o[n[i]-1]++]>>15-n[i]);return r}),rn=new Lt(288),ct=0;ct<144;++ct)rn[ct]=8;for(var ct=144;ct<256;++ct)rn[ct]=9;for(var ct=256;ct<280;++ct)rn[ct]=7;for(var ct=280;ct<288;++ct)rn[ct]=8;for(var sa=new Lt(32),ct=0;ct<32;++ct)sa[ct]=5;var xA=an(rn,9,1),MA=an(sa,5,1),$s=function(n){for(var t=n[0],e=1;e<n.length;++e)n[e]>t&&(t=n[e]);return t},Gt=function(n,t,e){var s=t/8|0;return(n[s]|n[s+1]<<8)>>(t&7)&e},ti=function(n,t){var e=t/8|0;return(n[e]|n[e+1]<<8|n[e+2]<<16)>>(t&7)},vA=function(n){return(n+7)/8|0},ei=function(n,t,e){return(t==null||t<0)&&(t=0),(e==null||e>n.length)&&(e=n.length),new Lt(n.subarray(t,e))},DA=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Vt=function(n,t,e){var s=new Error(t||DA[n]);if(s.code=n,Error.captureStackTrace&&Error.captureStackTrace(s,Vt),!e)throw s;return s},kA=function(n,t,e,s){var i=n.length,a=s?s.length:0;if(!i||t.f&&!t.l)return e||new Lt(0);var o=!e,r=o||t.i!=2,c=t.i;o&&(e=new Lt(i*3));var A=function(rt){var St=e.length;if(rt>St){var ne=new Lt(Math.max(St*2,rt));ne.set(e),e=ne}},u=t.f||0,l=t.p||0,C=t.b||0,h=t.l,m=t.d,I=t.m,g=t.n,p=i*8;do{if(!h){u=Gt(n,l,1);var f=Gt(n,l+1,3);if(l+=3,f)if(f==1)h=xA,m=MA,I=9,g=5;else if(f==2){var b=Gt(n,l,31)+257,B=Gt(n,l+10,15)+4,y=b+Gt(n,l+5,31)+1;l+=14;for(var v=new Lt(y),M=new Lt(19),S=0;S<B;++S)M[BA[S]]=Gt(n,l+S*3,7);l+=B*3;for(var N=$s(M),Y=(1<<N)-1,z=an(M,N,1),S=0;S<y;){var W=z[Gt(n,l,Y)];l+=W&15;var D=W>>4;if(D<16)v[S++]=D;else{var O=0,k=0;for(D==16?(k=3+Gt(n,l,3),l+=2,O=v[S-1]):D==17?(k=3+Gt(n,l,7),l+=3):D==18&&(k=11+Gt(n,l,127),l+=7);k--;)v[S++]=O}}var Q=v.subarray(0,b),T=v.subarray(b);I=$s(Q),g=$s(T),h=an(Q,I,1),m=an(T,g,1)}else Vt(1);else{var D=vA(l)+4,w=n[D-4]|n[D-3]<<8,x=D+w;if(x>i){c&&Vt(0);break}r&&A(C+w),e.set(n.subarray(D,x),C),t.b=C+=w,t.p=l=x*8,t.f=u;continue}if(l>p){c&&Vt(0);break}}r&&A(C+131072);for(var F=(1<<I)-1,R=(1<<g)-1,U=l;;U=l){var O=h[ti(n,l)&F],P=O>>4;if(l+=O&15,l>p){c&&Vt(0);break}if(O||Vt(2),P<256)e[C++]=P;else if(P==256){U=l,h=null;break}else{var q=P-254;if(P>264){var S=P-257,_=qo[S];q=Gt(n,l,(1<<_)-1)+na[S],l+=_}var H=m[ti(n,l)&R],lt=H>>4;H||Vt(3),l+=H&15;var T=SA[lt];if(lt>3){var _=$o[lt];T+=ti(n,l)&(1<<_)-1,l+=_}if(l>p){c&&Vt(0);break}r&&A(C+131072);var $=C+q;if(C<T){var Ft=a-T,zt=Math.min(T,$);for(Ft+C<0&&Vt(3);C<zt;++C)e[C]=s[Ft+C]}for(;C<$;++C)e[C]=e[C-T]}}t.l=h,t.p=U,t.b=C,t.f=u,h&&(u=1,t.m=I,t.d=m,t.n=g)}while(!u);return C!=e.length&&o?ei(e,0,C):e.subarray(0,C)},TA=new Lt(0),Zt=function(n,t){return n[t]|n[t+1]<<8},Wt=function(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0},ni=function(n,t){return Wt(n,t)+Wt(n,t+4)*4294967296};function LA(n,t){return kA(n,{i:2},t&&t.out,t&&t.dictionary)}var si=typeof TextDecoder<"u"&&new TextDecoder,RA=0;try{si.decode(TA,{stream:!0}),RA=1}catch{}var FA=function(n){for(var t="",e=0;;){var s=n[e++],i=(s>127)+(s>223)+(s>239);if(e+i>n.length)return{s:t,r:ei(n,e-1)};i?i==3?(s=((s&15)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,t+=String.fromCharCode(55296|s>>10,56320|s&1023)):i&1?t+=String.fromCharCode((s&31)<<6|n[e++]&63):t+=String.fromCharCode((s&15)<<12|(n[e++]&63)<<6|n[e++]&63):t+=String.fromCharCode(s)}};function UA(n,t){if(t){for(var e="",s=0;s<n.length;s+=16384)e+=String.fromCharCode.apply(null,n.subarray(s,s+16384));return e}else{if(si)return si.decode(n);var i=FA(n),a=i.s,e=i.r;return e.length&&Vt(8),a}}var PA=function(n,t){return t+30+Zt(n,t+26)+Zt(n,t+28)},VA=function(n,t,e){var s=Zt(n,t+28),i=UA(n.subarray(t+46,t+46+s),!(Zt(n,t+8)&2048)),a=t+46+s,o=Wt(n,t+20),r=e&&o==4294967295?NA(n,a):[o,Wt(n,t+24),Wt(n,t+42)],c=r[0],A=r[1],u=r[2];return[Zt(n,t+10),c,A,i,a+Zt(n,t+30)+Zt(n,t+32),u]},NA=function(n,t){for(;Zt(n,t)!=1;t+=4+Zt(n,t+2));return[ni(n,t+12),ni(n,t+4),ni(n,t+20)]};function _A(n,t){for(var e={},s=n.length-22;Wt(n,s)!=101010256;--s)(!s||n.length-s>65558)&&Vt(13);var i=Zt(n,s+8);if(!i)return{};var a=Wt(n,s+16),o=a==4294967295||i==65535;if(o){var r=Wt(n,s-12);o=Wt(n,r)==101075792,o&&(i=Wt(n,r+32),a=Wt(n,r+48))}for(var c=0;c<i;++c){var A=VA(n,a,o),u=A[0],l=A[1],C=A[2],h=A[3],m=A[4],I=A[5],g=PA(n,I);a=m,u?u==8?e[h]=LA(n.subarray(g,g+l),{out:new Lt(C)}):Vt(14,"unknown compression type "+u):e[h]=ei(n,g,g+l)}return e}function ii(n){let t=!1;const e=(h,m,I)=>n.on(h,m,I),s=(h,...m)=>n.fire(h,...m);e(Tt,()=>s(L).debugMode),e(hs,()=>t=!0),e(sn,h=>{const m=s(Me).capabilities.maxTextureSize,I=2*h;let g=1024;for(;g*m<I;)g*=2;g=Math.min(g,m/2);const p=Math.min(Math.ceil(I/g),m);return{texwidth:g,texheight:p}});let i=0;(function h(){i++,!t&&requestAnimationFrame(h)})(),e(pe,(h,m=null,I=0)=>{const g=()=>{t||(I>0?!(i%I)&&h(i):h(i),m&&m()&&requestAnimationFrame(g))};g()}),e(Di,(h,m=null,I=20)=>{const g=()=>{t||(h(),m&&m()&&setTimeout(g,I))};g()});let a=!1,o=0,r=0;e(Yr,()=>a),e(Vo,h=>{a=h,h?(async()=>document.querySelector("#gsviewer .logo")?.classList.add("loading"))():(async()=>document.querySelector("#gsviewer .logo")?.classList.remove("loading"))(),(async()=>{const m=document.querySelector("#gsviewer #progressBarWrap");m&&m.style.display!="none"&&(m.style.display="none")})()}),e(Is,()=>{a=!0,(async()=>{const h=document.querySelector("#gsviewer #progressBarWrap");if(h){h.style.display="block";const m=document.querySelector("#gsviewer #progressBar");m&&(m.style.width="0%")}})(),(async()=>document.querySelector("#gsviewer .logo")?.classList.add("loading"))(),parent?.onProgress&&parent.onProgress(.001,"0.001%"),window.onProgress&&window.onProgress(.001,"0.001%")}),e(Ke,h=>{h&&(o=h),a=!1,h!==void 0&&((async()=>{const m=document.querySelector("#gsviewer #progressBarWrap");m&&(m.style.display="none")})(),(async()=>document.querySelector("#gsviewer .logo")?.classList.remove("loading"))(),parent?.onProgress&&parent.onProgress(0,"100%",9),window.onProgress&&window.onProgress(0,"100%",9))}),e(ys,h=>{a=!0,(async()=>{const m=document.querySelector("#gsviewer #progressBar");m&&(m.style.width=`${h}%`)})(),parent?.onProgress&&parent.onProgress(h,`${h}%`),window.onProgress&&window.onProgress(h,`${h}%`)}),e(kr,()=>a),e(io,h=>{r=h}),e(oo,()=>!a&&o&&r>=o),e(Ie,()=>{const m=s(be).parentElement.getBoundingClientRect();return{width:m.width,height:m.height,left:m.left,top:m.top}}),e(ye,h=>{let m=h.x.toFixed(3).split("."),I=h.y.toFixed(3).split("."),g=h.z.toFixed(3).split(".");return(m[1]==="000"||m[1]==="00000")&&(m[1]="0"),(I[1]==="000"||I[1]==="00000")&&(I[1]="0"),(g[1]==="000"||g[1]==="00000")&&(g[1]="0"),`${m.join(".")}, ${I.join(".")}, ${g.join(".")}`}),e(Sr,h=>btoa(h)),e(xr,h=>atob(h));const c=.001;let A=new d.Vector3,u=new d.Vector3,l=0;e(Dr,()=>{const h=s(Bt),m=h.fov,I=h.position.clone(),g=h.getWorldDirection(new d.Vector3);return Math.abs(l-m)<c&&Math.abs(I.x-A.x)<c&&Math.abs(I.y-A.y)<c&&Math.abs(I.z-A.z)<c&&Math.abs(g.x-u.x)<c&&Math.abs(g.y-u.y)<c&&Math.abs(g.z-u.z)<c?!1:(l=m,A=I,u=g,!0)}),e(oe,h=>{if(!h)return;const m=[];h.traverse(I=>m.push(I)),m.forEach(I=>{I.dispose?I.dispose():(I.geometry?.dispose?.(),I.material&&I.material instanceof Array?I.material.forEach(g=>g?.dispose?.()):I.material?.dispose?.())}),h.clear()}),e(ut,async({renderSplatCount:h,visibleSplatCount:m,modelSplatCount:I,fps:g,realFps:p,sortTime:f,bucketBits:D,sortType:w,qualityLevel:x,fov:b,position:B,lookUp:y,lookAt:v,worker:M,scene:S,scale:N,lodTotalCount:Y,cuts:z,shDegree:W}={})=>{if(!s(Tt))return;W!==void 0&&C("shDegree",`${W}`),h!==void 0&&C("renderSplatCount",`${h}`),m!==void 0&&C("visibleSplatCount",`${m}`),I!==void 0&&C("modelSplatCount",`${I}`),g!==void 0&&C("fps",g),p!==void 0&&C("realFps",`raw ${p}`),f!==void 0&&C("sort",`${f} ms (L ${s(L).qualityLevel||vt.Default5}, ${D||""} B, T ${w||""})`),z!==void 0&&(Y!==void 0?C("cuts",z===""?"":`${Y}(${z} cuts)`):C("cuts",z===""?"":`(${z} cuts)`)),M&&C("worker",`${M}`),S&&C("scene",S),b&&C("fov",b),B&&C("position",B),y&&C("lookUp",y),v&&C("lookAt",v),v&&C("viewer-version",_n);let O=performance.memory||{usedJSHeapSize:0,totalJSHeapSize:0,jsHeapSizeLimit:0},k="",Q=O.usedJSHeapSize/1024/1024;Q>1e3?k+=(Q/1024).toFixed(2)+" G":k+=Q.toFixed(0)+" M",k+=" / ";let T=O.totalJSHeapSize/1024/1024;T>1e3?k+=(T/1024).toFixed(2)+" G":k+=T.toFixed(0)+" M";let F=O.jsHeapSizeLimit/1024/1024;k+=" / ",F>1e3?k+=(F/1024).toFixed(2)+" G":k+=F.toFixed(0)+" M",C("memory",k),N&&C("scale",N)});async function C(h,m){let I=document.querySelector(`#gsviewer .debug .${h}`);I&&(I.innerText=m)}}const An=d.ShaderChunk;function HA(n=0){const t=new Date;return t.setDate(t.getDate()-7),n>=t.getFullYear()*1e4+(t.getMonth()+1)*100+t.getDate()}function tt(n){return n<0?0:n>255?255:n|0}function Wn(n){const t=tt(Math.round(n*128)+128);return tt(Math.floor((t+4)/8)*8)}function Yn(n,t){return((1500+n*248)/t).toFixed(2)+"x"}async function ia(n){try{const t=new ReadableStream({async start(s){s.enqueue(n),s.close()}}),e=new Response(t.pipeThrough(new DecompressionStream("gzip")));return new Uint8Array(await e.arrayBuffer())}catch(t){return console.error("Decompress gzip failed:",t),null}}async function GA(n){try{const t=URL.createObjectURL(new Blob([n],{type:"application/octet-stream"})),e=await fetch(t),s=new Response(new wA.XzReadableStream(e.body));return new Uint8Array(await s.arrayBuffer())}catch(t){return console.error("Decompress xz failed:",t),null}}async function WA(n){const t=new Uint32Array(n.slice(0,12).buffer),e=t[0],s=t[2];let i=8;const a=n.subarray(i+4,i+4+s),{rgba:o}=await gt(a);i+=4+s;const r=new Uint32Array(n.slice(i,i+4).buffer)[0],c=n.subarray(i+4,i+4+r),{rgba:A}=await gt(c);i+=4+r;const u=new Uint32Array(n.slice(i,i+4).buffer)[0],l=n.subarray(i+4,i+4+u),{rgba:C}=await gt(l);i+=4+u;const h=new Uint32Array(n.slice(i,i+4).buffer)[0],m=n.subarray(i+4,i+4+h),{rgba:I}=await gt(m),g=new Uint8Array(8+e*19);let p=0;g[p]=n[p++],g[p]=n[p++],g[p]=n[p++],g[p]=n[p++],g[p++]=19,g[p++]=0,g[p++]=0,g[p++]=0;for(let f=0;f<e;f++)g[p++]=o[f*4+0];for(let f=0;f<e;f++)g[p++]=o[f*4+1];for(let f=0;f<e;f++)g[p++]=o[f*4+2];for(let f=0;f<e;f++)g[p++]=o[e*4+f*4+0];for(let f=0;f<e;f++)g[p++]=o[e*4+f*4+1];for(let f=0;f<e;f++)g[p++]=o[e*4+f*4+2];for(let f=0;f<e;f++)g[p++]=o[e*8+f*4+0];for(let f=0;f<e;f++)g[p++]=o[e*8+f*4+1];for(let f=0;f<e;f++)g[p++]=o[e*8+f*4+2];for(let f=0;f<e;f++)g[p++]=A[f*4+0];for(let f=0;f<e;f++)g[p++]=A[f*4+1];for(let f=0;f<e;f++)g[p++]=A[f*4+2];for(let f=0;f<e;f++)g[p++]=C[f*4+0];for(let f=0;f<e;f++)g[p++]=C[f*4+1];for(let f=0;f<e;f++)g[p++]=C[f*4+2];for(let f=0;f<e;f++)g[p++]=C[f*4+3];for(let f=0;f<e;f++)g[p++]=I[f*4+0];for(let f=0;f<e;f++)g[p++]=I[f*4+1];for(let f=0;f<e;f++)g[p++]=I[f*4+2];return g}async function YA(n){const t=new Uint32Array(n.slice(0,16).buffer),e=t[0],s=t[3];let i=12;const a=n.subarray(i+4,i+4+s),{rgba:o}=await gt(a);i+=4+s;const r=new Uint32Array(n.slice(i,i+4).buffer)[0],c=n.subarray(i+4,i+4+r),{rgba:A}=await gt(c);i+=4+r;const u=new Uint32Array(n.slice(i,i+4).buffer)[0],l=n.subarray(i+4,i+4+u),{rgba:C}=await gt(l);i+=4+u;const h=new Uint32Array(n.slice(i,i+4).buffer)[0],m=n.subarray(i+4,i+4+h),{rgba:I}=await gt(m),g=new Uint8Array(8+e*19);let p=0;g[p]=n[p++],g[p]=n[p++],g[p]=n[p++],g[p]=n[p++],g[p++]=35,g[p++]=39,g[p++]=0,g[p++]=0,g[p]=n[p++],g[p]=n[p++],g[p]=n[p++],g[p]=n[p++];for(let f=0;f<e;f++)g[p++]=o[f*4+0];for(let f=0;f<e;f++)g[p++]=o[f*4+1];for(let f=0;f<e;f++)g[p++]=o[f*4+2];for(let f=0;f<e;f++)g[p++]=o[e*4+f*4+0];for(let f=0;f<e;f++)g[p++]=o[e*4+f*4+1];for(let f=0;f<e;f++)g[p++]=o[e*4+f*4+2];for(let f=0;f<e;f++)g[p++]=o[e*8+f*4+0];for(let f=0;f<e;f++)g[p++]=o[e*8+f*4+1];for(let f=0;f<e;f++)g[p++]=o[e*8+f*4+2];for(let f=0;f<e;f++)g[p++]=A[f*4+0];for(let f=0;f<e;f++)g[p++]=A[f*4+1];for(let f=0;f<e;f++)g[p++]=A[f*4+2];for(let f=0;f<e;f++)g[p++]=C[f*4+0];for(let f=0;f<e;f++)g[p++]=C[f*4+1];for(let f=0;f<e;f++)g[p++]=C[f*4+2];for(let f=0;f<e;f++)g[p++]=C[f*4+3];for(let f=0;f<e;f++)g[p++]=I[f*4+0];for(let f=0;f<e;f++)g[p++]=I[f*4+1];for(let f=0;f<e;f++)g[p++]=I[f*4+2];return g}async function zA(n){const e=new Uint32Array(n.slice(0,4).buffer)[0];let s=8;const i=[];for(;s<n.length;){const o=new Uint32Array(n.slice(s,s+4).buffer)[0],r=n.subarray(s+4,s+4+o),{rgba:c}=await gt(r);i.push(c),s+=4+o}const a=new Uint8Array(8+e*4*i.length);a.set(n.subarray(0,8));for(let o=0,r=8;o<i.length;o++)a.set(i[o].subarray(0,e*4),r),r+=e*4;return a}async function OA(n){const e=new Uint32Array(n.slice(0,8).buffer)[0],s=n.subarray(8),{rgba:i}=await gt(s),a=new Uint8Array(8+e*9);let o=0;a[o]=n[o++],a[o]=n[o++],a[o]=n[o++],a[o]=n[o++],a[o++]=1,a[o++]=0,a[o++]=0,a[o++]=0;for(let r=0;r<e;r++)for(let c=0;c<3;c++)a[o++]=i[r*60+c*4+0],a[o++]=i[r*60+c*4+1],a[o++]=i[r*60+c*4+2];return a}async function oa(n){const e=new Uint32Array(n.slice(0,8).buffer)[0],s=n.subarray(8),{rgba:i}=await gt(s),a=new Uint8Array(8+e*24);let o=0;a[o]=n[o++],a[o]=n[o++],a[o]=n[o++],a[o]=n[o++],a[o++]=2,a[o++]=0,a[o++]=0,a[o++]=0;for(let r=0;r<e;r++)for(let c=0;c<8;c++)a[o++]=i[r*60+c*4+0],a[o++]=i[r*60+c*4+1],a[o++]=i[r*60+c*4+2];return a}async function JA(n){const e=new Uint32Array(n.slice(0,8).buffer)[0],s=n.subarray(8),{rgba:i}=await gt(s),a=new Uint8Array(8+e*21);let o=0;a[o]=n[o++],a[o]=n[o++],a[o]=n[o++],a[o]=n[o++],a[o++]=3,a[o++]=0,a[o++]=0,a[o++]=0;for(let r=0;r<e;r++)for(let c=8;c<15;c++)a[o++]=i[r*60+c*4+0],a[o++]=i[r*60+c*4+1],a[o++]=i[r*60+c*4+2];return a}async function gt(n){const t=new Blob([n],{type:"image/webp"}),e=URL.createObjectURL(t),s=await createImageBitmap(await fetch(e).then(A=>A.blob())),a=new OffscreenCanvas(s.width,s.height).getContext("2d");a.drawImage(s,0,0);const o=a.getImageData(0,0,s.width,s.height),r=s.width,c=s.height;return s.close(),URL.revokeObjectURL(e),{width:r,height:c,rgba:o.data}}function KA(n){const t=new Map;try{const e=_A(n);for(const[s,i]of Object.entries(e))if(i){const a=new Uint8Array(i);t.set(s,a)}}catch(e){console.error("解压失败:",e)}return t}function XA(n){return new TextDecoder("utf-8").decode(n)}function aa(n,t=null,e=20){const s=()=>{n(),t?.()&&setTimeout(s,e)};s()}const ra=new d.Frustum,Aa=new d.Matrix4,ca=new d.Matrix4;function ZA(n,t){return ca.copy(n.matrixWorld).invert(),Aa.multiplyMatrices(n.projectionMatrix,ca),ra.setFromProjectionMatrix(Aa),ra.containsPoint(t)}function jA(n){return((n?.Flags||0)&1)>0}function la(n){return((n?.Flags||0)&128)>0}function qA(n,t){const e=n.elements;let s=0;t[s++].set(new d.Vector3(e[3]+e[2],e[7]+e[6],e[11]+e[10]),e[15]+e[14]).normalize(),t[s++].set(new d.Vector3(e[3]+e[0],e[7]+e[4],e[11]+e[8]),e[15]+e[12]).normalize(),t[s++].set(new d.Vector3(e[3]-e[0],e[7]-e[4],e[11]-e[8]),e[15]-e[12]).normalize(),t[s++].set(new d.Vector3(e[3]+e[1],e[7]+e[5],e[11]+e[9]),e[15]+e[13]).normalize(),t[s++].set(new d.Vector3(e[3]-e[1],e[7]-e[5],e[11]-e[9]),e[15]-e[13]).normalize(),t[s++].set(new d.Vector3(e[3]-e[2],e[7]-e[6],e[11]-e[10]),e[15]-e[14]).normalize()}const $A=new d.Vector3;function ua(n,t){const e=$A.fromArray(t.center).distanceTo(n);return e>=0?Math.max(0,e-t.radius):Math.min(0,e+t.radius)}function Pe(n,t){try{return t?new URL(n,t).href:n}catch{return n}}const tc="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEeBmABfQF9YAAAYAJ/fwF/YAF9AX9gAX8Bf2ACf38AAhoCA2VudgRleHBmAAADZW52Bm1lbW9yeQIAAAMGBQECAwQFByEEEV9fd2FzbV9jYWxsX2N0b3JzAAEBSAAEAXcABQFEAAIKhAsFAwABC6MJAyh/Dn0EfCABKAIEQYvwCUcEQEEBDwsgASgCACIEQQBMBEBBAA8LIAFBCWoiAiAEQRNsaiEHIAIgBEESbGohCCACIARBEWxqIQkgAiAEQQR0aiEKIAIgBEEPbGohCyACIARBDmxqIQwgAiAEQQ1saiENIAIgBEEMbGohDiACIARBC2xqIQ8gAiAEQQpsaiEQIAIgBEEJbGohESACIARBBmxqIRIgAiAEQQNsaiETQQAhAiABLQAIIRQDQCACIAhqLQAAIRUgAiAJai0AACEWIAIgCmotAAAhFyACIAtqLQAAIRggAiAMai0AACEZIAIgDWotAAAhGiACIA5qLQAAIRsgAiAPai0AACEcIAIgEGotAAAhHSACIBFqLQAAIR4gEiACQQNsIgNqIgUtAAAhHyADIBNqIgYtAAAhICABIANqIgMtAAohISADLQAJISIgBS0AASEjIAYtAAEhJCADLQALIiXAISYgBS0AAiInwCEoIAYtAAIiBsAhKUEAIQUgFARAIAcgAkEBdGoiAy0AASIFQQh0QYD+AXEgAy0AAHIgBUEJdEGAgARxciEFCyAAIAJBBXRqIgMgBTYCDCADICNBCHQgH3IgJ0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UNACACQfAATQRAIAFBgICABHJB8QAgAmt2IQEMAQsgAkGNAUsEQEGA+AEhA0EAIQEMAQsgAkEKdEGAgAdrIQMLIAMgBEEQdkGAgAJxciABQQ12cgs=";async function ec(n){const t=new Uint32Array(n.buffer),e=new Float32Array(n.buffer),s=new tA;s.Fixed=String.fromCharCode(n[0])+String.fromCharCode(n[1])+String.fromCharCode(n[2]),s.Version=n[3],s.SplatCount=t[1],s.MinX=e[2],s.MaxX=e[3],s.MinY=e[4],s.MaxY=e[5],s.MinZ=e[6],s.MaxZ=e[7],s.MinTopY=e[8],s.MaxTopY=e[9],s.CreateDate=t[10],s.CreaterId=t[11],s.ExclusiveId=t[12],s.ShDegree=n[52],s.Flags=n[53],s.Lod=n[54],s.Reserve3=n[55],s.Reserve1=t[14],s.Reserve2=t[15];let i="";for(let C=64;C<124;C++)i+=String.fromCharCode(n[C]);if(s.Comment=i.trim(),s.HashCheck=!0,s.Fixed!=="spx")return null;const a=s.ExclusiveId?ga:oi,o=WebAssembly.compile(Uint8Array.from(atob(a),C=>C.charCodeAt(0)).buffer),r=new WebAssembly.Memory({initial:1,maximum:1}),A=(await WebAssembly.instantiate(await o,{env:{memory:r,expf:zn}})).exports.H;return new Uint8Array(r.buffer).set(n,0),A(0)&&(s.HashCheck=!1),s}async function Nt(n,t=null){let e=new Uint32Array(n.slice(0,8).buffer);const s=e[0],i=e[1],a=[AA,cA,300222,300232],o=t?.Version>=3&&a.includes(i);if(i==lA){const A=n.subarray(8);return{splatCount:0,blockFormat:i,palettes:A,success:!0}}else if(i==uA){const{rgba:c}=await gt(n.subarray(8));return{splatCount:0,blockFormat:i,palettes:c,success:!0}}let r=t?.ShDegree||0;if(i==hA){if(t.ShDegree==on){const c=await OA(n);return cn(s,on,c,t.Version,r)}else if(t.ShDegree==ae){const c=await oa(n);return cn(s,ae,c,t.Version,r)}else if(t.ShDegree==Re){const c=await oa(n),A=await JA(n),u=await cn(s,ae,c,t.Version,r),l=await cn(s,Re,A,t.Version,r);return u.success=u.success&&l.success,u.isSh23=!0,u.dataSh3=l.datas,u}}return o?n=await zA(n):i==gA?n=await WA(n):i==fA&&(n=await YA(n)),cn(s,i,n,t?.Version||1,r)}async function cn(n,t,e,s,i){const a=on==t,o=ae==t,r=Re==t,c=a||o||r,A=!c,u=[oi,tc,da,ga],l=t<65536?0:s,C=n*(c?iA:K),h=WebAssembly.compile(Uint8Array.from(atob(u[l]),w=>w.charCodeAt(0)).buffer),m=Math.ceil((C+e.byteLength)/Zo)+1,I=new WebAssembly.Memory({initial:m,maximum:m}),p=(await WebAssembly.instantiate(await h,{env:{memory:I,expf:zn}})).exports.D,f=new Uint8Array(I.buffer);return f.set(e,C),p(0,C,i)?{splatCount:n,blockFormat:t,success:!1}:{splatCount:n,blockFormat:t,success:!0,datas:f.slice(0,C),isSplat:A,isSh:c,isSh1:a,isSh2:o,isSh3:r}}async function ln(n,t){const e=WebAssembly.compile(Uint8Array.from(atob(oi),A=>A.charCodeAt(0)).buffer),s=Math.ceil(t*K/Zo)+1,i=new WebAssembly.Memory({initial:s,maximum:s}),o=(await WebAssembly.instantiate(await e,{env:{memory:i,expf:zn}})).exports.s,r=new Uint8Array(i.buffer);r.set(n.subarray(0,t*K),0);const c=o(0,t);return c?(console.error("splat data parser failed:",c),new Uint8Array(0)):r.slice(0,t*K)}async function nc(n,t,e=!0,s=!0){const i=WebAssembly.compile(Uint8Array.from(atob(da),l=>l.charCodeAt(0)).buffer),a=new WebAssembly.Memory({initial:1,maximum:1}),r=(await WebAssembly.instantiate(await i,{env:{memory:a,expf:zn}})).exports.w,c=new Uint8Array(a.buffer),A=new Float32Array(c.buffer),u=s?-1:1;return A[0]=n,e?A[1]=u*t:A[2]=u*t,r(0,e?1:0),c.slice(0,K)}function zn(n){return Math.exp(n)}const un=dt?20480:512e3;async function sc(n){try{n.status=V.Fetching;const i=n.abortController.signal,a=n.opts.fetchReload?"reload":"default",o=await fetch(n.opts.url,{mode:"cors",credentials:"omit",cache:a,signal:i});if(o.status!=200){console.warn(`fetch error: ${o.status}`),n.status===V.Fetching&&(n.status=V.FetchFailed);return}const r=o.body.getReader(),c=parseInt(o.headers.get("content-length")||"0");n.fileSize=c,n.downloadSize=0,n.downloadSplatCount=0,n.watermarkData=new Uint8Array(0);let A=new Uint8Array(256),u=0,l=[],C;for(;;){let{done:h,value:m}=await r.read();if(h)break;if(n.downloadSize+=m.byteLength,l){if(l.push(m),n.downloadSize<200)continue;const I=new Uint8Array(n.downloadSize);for(let g=0,p=0;g<l.length;g++)I.set(l[g],p),p+=l[g].byteLength;if(C=s(I),!C){l=[I];continue}l=null,m=I.slice(C.headerLength),n.rowLength=C.rowLength,n.dataShDegree=C.shDegree,n.modelSplatCount=C.vertexCount,n.splatData=new Uint8Array(Math.min(n.modelSplatCount,n.fetchLimit)*32)}u+m.byteLength<n.rowLength?(A.set(m,u),u+=m.byteLength):(u=await t(C,n,u,A,m),u&&A.set(m.subarray(m.byteLength-u),0)),n.downloadSplatCount>=n.fetchLimit&&n.abortController.abort()}}catch(i){i.name==="AbortError"?(n.opts.url,n.status===V.Fetching&&(n.status=V.FetchAborted)):(console.error(i),n.status===V.Fetching&&(n.status=V.FetchFailed))}finally{n.status===V.Fetching&&(n.status=V.FetchDone)}async function t(i,a,o,r,c){return new Promise(async A=>{let u=(o+c.byteLength)/a.rowLength|0,l=(o+c.byteLength)%a.rowLength,C;o?(C=new Uint8Array(u*a.rowLength),C.set(r.subarray(0,o),0),C.set(c.subarray(0,c.byteLength-l),o)):C=c.slice(0,u*a.rowLength),a.downloadSplatCount+u>a.fetchLimit&&(u=a.fetchLimit-a.downloadSplatCount,l=0);const h=async()=>{if(u>un){const m=await e(i,C,un);fa(a,m),a.downloadSplatCount+=un,u-=un,C=C.slice(un*a.rowLength),setTimeout(h)}else{const m=await e(i,C,u);fa(a,m),a.downloadSplatCount+=u,A(l)}};await h()})}async function e(i,a,o){const r=new Uint8Array(o*Hn),c=new Float32Array(a.buffer),A=new Float32Array(r.buffer);for(let u=0;u<o;u++)A[u*8+0]=c[(u*n.rowLength+i.offsets.x)/4],A[u*8+1]=c[(u*n.rowLength+i.offsets.y)/4],A[u*8+2]=c[(u*n.rowLength+i.offsets.z)/4],A[u*8+3]=Math.exp(c[(u*n.rowLength+i.offsets.scale_0)/4]),A[u*8+4]=Math.exp(c[(u*n.rowLength+i.offsets.scale_1)/4]),A[u*8+5]=Math.exp(c[(u*n.rowLength+i.offsets.scale_2)/4]),r[u*32+24]=tt((.5+Xt*c[(u*n.rowLength+i.offsets.f_dc_0)/4])*255),r[u*32+25]=tt((.5+Xt*c[(u*n.rowLength+i.offsets.f_dc_1)/4])*255),r[u*32+26]=tt((.5+Xt*c[(u*n.rowLength+i.offsets.f_dc_2)/4])*255),r[u*32+27]=tt(1/(1+Math.exp(-c[(u*n.rowLength+i.offsets.opacity)/4]))*255),r[u*32+28]=tt(c[(u*n.rowLength+i.offsets.rot_0)/4]*128+128),r[u*32+29]=tt(c[(u*n.rowLength+i.offsets.rot_1)/4]*128+128),r[u*32+30]=tt(c[(u*n.rowLength+i.offsets.rot_2)/4]*128+128),r[u*32+31]=tt(c[(u*n.rowLength+i.offsets.rot_3)/4]*128+128);if(i.shDegree==3){const l=new Uint8Array(o*24+8),C=new Uint8Array(o*21+8),h=new Uint32Array(2);h[0]=o,h[1]=ae,l.set(new Uint8Array(h.buffer),0);const m=new Uint32Array(2);m[0]=o,m[1]=Re,C.set(new Uint8Array(m.buffer),0);for(let p=0,f=0;p<o;p++)for(let D=0;D<8;D++)for(let w=0;w<3;w++)l[8+f++]=Wn(c[(p*n.rowLength+i.offsets["f_rest_"+(D+w*15)])/4]);for(let p=0,f=0;p<o;p++)for(let D=8;D<15;D++)for(let w=0;w<3;w++)C[8+f++]=Wn(c[(p*n.rowLength+i.offsets["f_rest_"+(D+w*15)])/4]);const I=await Nt(l);n.sh12Data.push(I.datas);const g=await Nt(C);n.sh3Data.push(g.datas)}else if(i.shDegree==2){const l=new Uint8Array(o*24+8),C=new Uint32Array(2);C[0]=o,C[1]=ae,l.set(new Uint8Array(C.buffer),0);for(let m=0,I=0;m<o;m++)for(let g=0;g<8;g++)for(let p=0;p<3;p++)l[8+I++]=Wn(c[(m*n.rowLength+i.offsets["f_rest_"+(g+p*8)])/4]);const h=await Nt(l);n.sh12Data.push(h.datas)}else if(i.shDegree==1){const l=new Uint8Array(o*9+8),C=new Uint32Array(2);C[0]=o,C[1]=on,l.set(new Uint8Array(C.buffer),0);for(let m=0,I=0;m<o;m++)for(let g=0;g<3;g++)for(let p=0;p<3;p++)l[8+I++]=Wn(c[(m*n.rowLength+i.offsets["f_rest_"+(g+p*3)])/4]);const h=await Nt(l);n.sh12Data.push(h.datas)}return await ln(r,o)}function s(i){let a=new TextDecoder().decode(i.slice(0,2048));const o=`end_header
6
6
  `,r=a.indexOf(o);if(r<0){if(i.byteLength>1024*2)throw new Error("Unable to read .ply file header");return null}if(!a.startsWith("ply")||a.indexOf("format binary_little_endian 1.0")<0)throw new Error("Unknow .ply file header");const c=parseInt(/element vertex (\d+)\n/.exec(a)[1]);let A=0,u={},l={};const C={double:"getFloat64",int:"getInt32",uint:"getUint32",float:"getFloat32",short:"getInt16",ushort:"getUint16",uchar:"getUint8"};for(let I of a.slice(0,r).split(`
7
- `).filter(d=>d.startsWith("property "))){const[d,p,f]=I.split(" "),D=C[p]||"getInt8";l[f]=D,u[f]=A,A+=parseInt(D.replace(/[^\d]/g,""))/8}let h=0;l.f_rest_44?h=3:l.f_rest_23?h=2:l.f_rest_8&&(h=1);const m=["x","y","z","scale_0","scale_1","scale_2","f_dc_0","f_dc_1","f_dc_2","opacity","rot_0","rot_1","rot_2","rot_3"];for(let I=0;I<m.length;I++){const d=m[I];if(!l[d])throw new Error(`Property not found: ${d}`)}return{headerLength:r+o.length,offsets:u,rowLength:A,vertexCount:c,shDegree:h}}}function ya(n,t){let e=t.byteLength/K;const s=Math.min(n.fetchLimit,n.modelSplatCount);n.dataSplatCount+e>s?(e=s-n.dataSplatCount,n.splatData.set(t.subarray(0,e*K),n.dataSplatCount*K)):n.splatData.set(t,n.dataSplatCount*K);const i=new Float32Array(t.buffer);for(let o=0,r=0,c=0,A=0;o<e;o++)r=i[o*8],c=i[o*8+1],A=i[o*8+2],n.minX=Math.min(n.minX,r),n.maxX=Math.max(n.maxX,r),n.minY=Math.min(n.minY,c),n.maxY=Math.max(n.maxY,c),n.minZ=Math.min(n.minZ,A),n.maxZ=Math.max(n.maxZ,A);n.dataSplatCount+=e;const a=0;n.currentRadius=Math.sqrt(n.maxX*n.maxX+a*a+n.maxZ*n.maxZ),n.aabbCenter=new g.Vector3((n.minX+n.maxX)/2,(n.minY+n.maxY)/2,(n.minZ+n.maxZ)/2),n.maxRadius=.5*Math.sqrt(Math.pow(n.maxX-n.minX,2)+Math.pow(n.maxY-n.minY,2)+Math.pow(n.maxZ-n.minZ,2)),n.metaMatrix&&n.aabbCenter.applyMatrix4(n.metaMatrix)}const Fe=dt?20480:512e3;async function ec(n){let t=0;try{n.status=P.Fetching;const s=n.abortController.signal,i=n.opts.fetchReload?"reload":"default",a=await fetch(n.opts.url,{mode:"cors",credentials:"omit",cache:i,signal:s});if(a.status!=200){console.warn(`fetch error: ${a.status}`),n.status===P.Fetching&&(n.status=P.FetchFailed);return}const o=a.body.getReader(),r=parseInt(a.headers.get("content-length")||"0");n.rowLength=32,n.fileSize=r;const c=r/n.rowLength|0;if(c<1){console.warn("data empty",n.opts.url),n.status===P.Fetching&&(n.status=P.Invalid);return}n.CompressionRatio="7.75x",n.modelSplatCount=c,n.downloadSplatCount=0,n.splatData=new Uint8Array(Math.min(n.modelSplatCount,n.fetchLimit)*32),n.watermarkData=new Uint8Array(0);let A=new Uint8Array(32),u=0;for(;;){let{done:l,value:C}=await o.read();if(l)break;u+C.byteLength<n.rowLength?(A.set(C,u),u+=C.byteLength,t+=C.length,n.downloadSize=t):(u=await e(n,u,A,C),u&&A.set(C.subarray(C.byteLength-u),0)),n.downloadSplatCount>=n.fetchLimit&&n.abortController.abort()}}catch(s){s.name==="AbortError"?(n.opts.url,n.status===P.Fetching&&(n.status=P.FetchAborted)):(console.error(s),n.status===P.Fetching&&(n.status=P.FetchFailed))}finally{n.status===P.Fetching&&(n.status=P.FetchDone)}async function e(s,i,a,o){return new Promise(async r=>{let c=(i+o.byteLength)/s.rowLength|0,A=(i+o.byteLength)%s.rowLength,u;i?(u=new Uint8Array(c*s.rowLength),u.set(a.subarray(0,i),0),u.set(o.subarray(0,o.byteLength-A),i)):u=o.slice(0,c*s.rowLength),s.downloadSplatCount+c>s.fetchLimit&&(c=s.fetchLimit-s.downloadSplatCount,A=0);const l=async()=>{if(c>Fe){const C=await un(u,Fe);wa(s,C),s.downloadSplatCount+=Fe,t+=Fe*s.rowLength,s.downloadSize=t,c-=Fe,u=u.slice(Fe*s.rowLength),setTimeout(l)}else{const C=await un(u,c);wa(s,C),s.downloadSplatCount+=c,t+=c*s.rowLength,s.downloadSize=t,r(A)}};await l()})}}function wa(n,t){let e=t.byteLength/K;const s=Math.min(n.fetchLimit,n.modelSplatCount);n.dataSplatCount+e>s?(e=s-n.dataSplatCount,n.splatData.set(t.subarray(0,e*K),n.dataSplatCount*K)):n.splatData.set(t,n.dataSplatCount*K);const i=new Float32Array(t.buffer);for(let o=0,r=0,c=0,A=0;o<e;o++)r=i[o*8],c=i[o*8+1],A=i[o*8+2],n.minX=Math.min(n.minX,r),n.maxX=Math.max(n.maxX,r),n.minY=Math.min(n.minY,c),n.maxY=Math.max(n.maxY,c),n.minZ=Math.min(n.minZ,A),n.maxZ=Math.max(n.maxZ,A);n.dataSplatCount+=e;const a=n.header?.MinTopY||0;n.currentRadius=Math.sqrt(n.maxX*n.maxX+a*a+n.maxZ*n.maxZ),n.aabbCenter=new g.Vector3((n.minX+n.maxX)/2,(n.minY+n.maxY)/2,(n.minZ+n.maxZ)/2),n.maxRadius=.5*Math.sqrt(Math.pow(n.maxX-n.minX,2)+Math.pow(n.maxY-n.minY,2)+Math.pow(n.maxZ-n.minZ,2)),n.metaMatrix&&n.aabbCenter.applyMatrix4(n.metaMatrix)}const nc=[ta,ea];async function sc(n){try{n.status=P.Fetching;const t=n.abortController.signal,e=n.opts.fetchReload?"reload":"default",s=await fetch(n.opts.url,{mode:"cors",credentials:"omit",cache:e,signal:t});if(s.status!=200){console.warn(`fetch error: ${s.status}`),n.status===P.Fetching&&(n.status=P.FetchFailed);return}const i=s.body.getReader(),a=parseInt(s.headers.get("content-length")||"0");if(a-Vt<qo){console.warn("data empty",n.opts.url),n.status===P.Fetching&&(n.status=P.Invalid);return}n.fileSize=a;let r=[],c=new Uint8Array(Vt),A=new Uint8Array(K),u=0,l=!1,C=0,h=0,m,I=!1,d=0;for(;;){let{done:p,value:f}=await i.read();if(p)break;if(n.downloadSize+=f.byteLength,r){r.push(f);let x=0;for(let y=0;y<r.length;y++)x+=r[y].byteLength;if(x<Vt)continue;let b=0;for(let y=0;y<r.length;y++)b+r[y].byteLength<Vt?(c.set(r[y],b),b+=r[y].byteLength):(c.set(r[y].subarray(0,Vt-b),b),f=new Uint8Array(r[y].slice(Vt-b)));const Q=await Ia(c);if(!Q){n.abortController.abort(),n.status===P.Fetching&&(n.status=P.Invalid),console.error("invalid spx format");continue}if(n.meta.isLargeScene&&!XA(Q)){n.abortController.abort(),n.status===P.Fetching&&(n.status=P.Invalid),console.error("invalid LOD format");continue}if(n.header=Q,n.CompressionRatio=zn(Q.SplatCount,a),n.modelSplatCount=Q.SplatCount,n.dataShDegree=Q.ShDegree,n.aabbCenter=new g.Vector3((Q.MinX+Q.MaxX)/2,(Q.MinY+Q.MaxY)/2,(Q.MinZ+Q.MaxZ)/2),n.maxRadius=.5*Math.sqrt(Math.pow(Q.MaxX-Q.MinX,2)+Math.pow(Q.MaxY-Q.MinY,2)+Math.pow(Q.MaxZ-Q.MinZ,2)),n.metaMatrix&&n.aabbCenter.applyMatrix4(n.metaMatrix),r=null,c=null,!nc.includes(Q.ExclusiveId)){n.abortController.abort(),n.status=P.Invalid,console.error("Unrecognized format, creater id =",Q.CreaterId,", exclusive id =",Q.ExclusiveId,Q.Comment);continue}}if(!l){if(u+f.byteLength<4){A.set(f,u),u+=f.byteLength;continue}const x=new Uint8Array(u+f.byteLength);x.set(A.subarray(0,u),0),x.set(f,u),f=x.slice(4),u=0,l=!0,m=[],h=0;const b=new Int32Array(x.slice(0,4).buffer)[0];I=b<0,d=Math.abs(b)>>28>>>0,C=Math.abs(b)<<4>>>4}let D=h+f.byteLength;if(m.push(f),D<C){h+=f.byteLength;continue}for(;D>=C;){let x=new Uint8Array(C),b=0;for(let y=0;y<m.length;y++)b+m[y].byteLength<C?(x.set(m[y],b),b+=m[y].byteLength):(x.set(m[y].subarray(0,C-b),b),f=new Uint8Array(m[y].slice(C-b)));I&&(d===0?x=await ai(x):d===1?x=await ca(x):console.error("unsuported compress type:",d));const Q=await Rt(x,n.header);if(!Q.success){console.error("spx block data parser failed. block format:",Q.blockFormat),n.abortController.abort(),n.status=P.Invalid;break}if(Q.isSplat)n.downloadSplatCount+=Q.splatCount,ic(n,Q.datas);else if(Q.palettes)n.palettes=Q.palettes;else{const y=Math.min(n.fetchLimit,n.modelSplatCount);if(Q.isSh23){if(n.sh12Count+Q.splatCount>y){const S=y-n.sh12Count;n.sh12Data.push(Q.datas.slice(0,S*16)),n.sh12Count+=S}else n.sh12Data.push(Q.datas),n.sh12Count+=Q.splatCount;if(n.sh3Count+Q.splatCount>y){const S=y-n.sh3Count;n.sh3Data.push(Q.dataSh3.slice(0,S*16)),n.sh3Count+=S}else n.sh3Data.push(Q.dataSh3),n.sh3Count+=Q.splatCount}else if(Q.isSh3)if(n.sh3Count+Q.splatCount>y){const S=y-n.sh3Count;n.sh3Data.push(Q.datas.slice(0,S*16)),n.sh3Count+=S}else n.sh3Data.push(Q.datas),n.sh3Count+=Q.splatCount;else if(n.sh12Count+Q.splatCount>y){const S=y-n.sh12Count;n.sh12Data.push(Q.datas.slice(0,S*16)),n.sh12Count+=S}else n.sh12Data.push(Q.datas),n.sh12Count+=Q.splatCount}if(f.byteLength<4){A.set(f,0),u=f.byteLength,l=!1;break}else{const y=new Int32Array(f.slice(0,4).buffer)[0];I=y<0,d=Math.abs(y)>>28>>>0,C=Math.abs(y)<<4>>>4,f=f.slice(4),D=f.byteLength,m=[f],h=f.byteLength}}const w=n.fetchLimit;n.header.Version<3&&n.header.ShDegree===3?n.downloadSplatCount>=w&&n.sh12Count>=w&&n.sh3Count>=w&&n.abortController.abort():n.header.Version<3&&n.header.ShDegree?n.downloadSplatCount>=w&&n.sh12Count>=w&&n.abortController.abort():n.downloadSplatCount>=w&&n.abortController.abort()}}catch(t){t.name==="AbortError"?(console.warn("Fetch Abort",n.opts.url),n.status===P.Fetching&&(n.status=P.FetchAborted)):(console.error(t),n.status===P.Fetching&&(n.status=P.FetchFailed),n.abortController.abort())}finally{n.status===P.Fetching&&(n.status=P.FetchDone)}}function ic(n,t){let e=t.byteLength/32;const s=4096;if(!n.meta.isLargeScene){const r=Math.min(n.fetchLimit,n.modelSplatCount);if(!n.splatData&&(n.splatData=new Uint8Array(r*K)),!n.watermarkData&&(n.watermarkData=new Uint8Array(0)),n.dataSplatCount+e>r&&(e=r-n.dataSplatCount,!e))return;const c=new Float32Array(t.buffer),A=new Uint32Array(t.buffer);for(let l=0,C=0,h=0,m=0;l<e;l++)if(C=c[l*8],h=c[l*8+1],m=c[l*8+2],n.minX=Math.min(n.minX,C),n.maxX=Math.max(n.maxX,C),n.minY=Math.min(n.minY,h),n.maxY=Math.max(n.maxY,h),n.minZ=Math.min(n.minZ,m),n.maxZ=Math.max(n.maxZ,m),A[l*8+3]&65536){if(n.watermarkCount*K===n.watermarkData.byteLength){const I=new Uint8Array((n.watermarkCount+s)*K);I.set(n.watermarkData,0),n.watermarkData=I}n.watermarkData.set(t.subarray(l*32,l*32+32),n.watermarkCount++*K)}else n.splatData.set(t.subarray(l*32,l*32+32),n.dataSplatCount++*K);const u=n.header.MinTopY||0;n.currentRadius=Math.sqrt(n.maxX*n.maxX+u*u+n.maxZ*n.maxZ);return}!n.watermarkData&&(n.watermarkData=new Uint8Array(0));const i=new Float32Array(t.buffer),a=new Uint32Array(t.buffer),o=n.meta.cutSize||5*(n.meta.meterScale||1);for(let r=0,c=Math.floor(t.byteLength/K),A=0,u=0,l=0,C="";r<c;r++){if(a[r*8+3]&65536){if(n.watermarkCount*K===n.watermarkData.byteLength){const p=new Uint8Array((n.watermarkCount+s)*K);p.set(n.watermarkData,0),n.watermarkData=p}n.watermarkData.set(t.slice(r*32,r*32+32),n.watermarkCount++*K);continue}A=i[r*8],u=i[r*8+1],l=i[r*8+2];const h=(A-n.header.MinX)/o|0,m=(u-n.header.MinY)/o|0,I=(l-n.header.MinZ)/o|0;C=`${h}-${m}-${I}`;let d=n.map.get(C);if(!d)d={},d.minX=A,d.maxX=A,d.minY=u,d.maxY=u,d.minZ=l,d.maxZ=l,d.center=new g.Vector3(A,u,l),n.metaMatrix&&d.center.applyMatrix4(n.metaMatrix),d.radius=0,d.splatData=new Uint8Array(s*K),d.splatData.set(t.slice(r*K,r*K+K),0),d.splatCount=1,n.map.set(C,d);else{if(d.splatData.byteLength/K==d.splatCount){const w=new Uint8Array(d.splatData.byteLength+s*K);w.set(d.splatData,0),d.splatData=w}d.minX=Math.min(d.minX,A),d.maxX=Math.max(d.maxX,A),d.minY=Math.min(d.minY,u),d.maxY=Math.max(d.maxY,u),d.minZ=Math.min(d.minZ,l),d.maxZ=Math.max(d.maxZ,l),d.center=new g.Vector3((d.maxX+d.minX)/2,(d.maxY+d.minY)/2,(d.maxZ+d.minZ)/2),n.metaMatrix&&d.center.applyMatrix4(n.metaMatrix);const p=d.maxX-d.minX,f=d.maxY-d.minY,D=d.maxZ-d.minZ;d.radius=Math.sqrt(p*p+f*f+D*D)/2,n.metaMatrix&&(d.radius*=n.metaMatrix.getMaxScaleOnAxis()),d.splatData.set(t.slice(r*K,r*K+K),d.splatCount++*K)}n.dataSplatCount++}}const et=dt?20480:512e3,Ai=16,Ea=511;async function oc(n){try{n.status=P.Fetching;const i=n.abortController.signal,a=n.opts.fetchReload?"reload":"default",o=await fetch(n.opts.url,{mode:"cors",credentials:"omit",cache:a,signal:i});if(o.status!=200){console.warn(`fetch error: ${o.status}`),n.status===P.Fetching&&(n.status=P.FetchFailed);return}const r=o.body.getReader(),c=parseInt(o.headers.get("content-length")||"0");n.fileSize=c,n.downloadSize=0,n.downloadSplatCount=0,n.watermarkData=new Uint8Array(0);const A=new Uint8Array(c);for(;;){let{done:C,value:h}=await r.read();if(C)break;A.set(h,n.downloadSize),n.downloadSize+=h.length}const u=await ai(A);if(!u||u.length<16){console.error("Invalid spz format"),n.status=P.Invalid;return}const l=s(u);n.CompressionRatio=zn(l.numPoints,c),n.spzVersion=l.version,n.modelSplatCount=l.numPoints,n.dataShDegree=l.shDegree,n.splatData=new Uint8Array(Math.min(n.modelSplatCount,n.fetchLimit)*32),await t(l,n,u)}catch(i){i.name==="AbortError"?(n.opts.url,n.status===P.Fetching&&(n.status=P.FetchAborted)):(console.error(i),n.status===P.Fetching&&(n.status=P.FetchFailed))}finally{n.status===P.Fetching&&(n.status=P.FetchDone)}async function t(i,a,o){const r=i.numPoints*9,c=i.numPoints,A=i.numPoints*3,u=i.numPoints*3,l=i.numPoints*(i.version==2?3:4),C=Ai,h=C+r,m=h+c,I=m+A,d=I+u,p=d+l,f=Math.min(i.numPoints,a.fetchLimit),D=Math.ceil(f/et);for(let w=0;w<D;w++){let x=w<D-1?et:f-w*et;a.dataSplatCount+x>a.fetchLimit&&(x=a.fetchLimit-a.dataSplatCount);const b=new Uint8Array(x*20+8),Q=new Uint32Array(2);Q[0]=x,Q[1]=dA,b.set(new Uint8Array(Q.buffer),0);let y=8;for(let M=0;M<x;M++)b[y++]=o[C+(w*et+M)*9+0],b[y++]=o[C+(w*et+M)*9+1],b[y++]=o[C+(w*et+M)*9+2];for(let M=0;M<x;M++)b[y++]=o[C+(w*et+M)*9+3],b[y++]=o[C+(w*et+M)*9+4],b[y++]=o[C+(w*et+M)*9+5];for(let M=0;M<x;M++)b[y++]=o[C+(w*et+M)*9+6],b[y++]=o[C+(w*et+M)*9+7],b[y++]=o[C+(w*et+M)*9+8];for(let M=0;M<x;M++)b[y++]=o[I+(w*et+M)*3];for(let M=0;M<x;M++)b[y++]=o[I+(w*et+M)*3+1];for(let M=0;M<x;M++)b[y++]=o[I+(w*et+M)*3+2];for(let M=0;M<x;M++)b[y++]=ci(o[m+(w*et+M)*3]);for(let M=0;M<x;M++)b[y++]=ci(o[m+(w*et+M)*3+1]);for(let M=0;M<x;M++)b[y++]=ci(o[m+(w*et+M)*3+2]);const S=[];if(i.version==2)for(let M=0,N=0,O=0,z=0;M<x;M++)b[y++]=o[h+(w*et+M)],N=o[d+(w*et+M)*3+0],O=o[d+(w*et+M)*3+1],z=o[d+(w*et+M)*3+2],S.push(ac(N,O,z));else for(let M=0,N=0,O=0,z=0,W=0;M<x;M++){b[y++]=o[h+(w*et+M)],N=o[d+(w*et+M)*4+0],O=o[d+(w*et+M)*4+1],z=o[d+(w*et+M)*4+2],W=o[d+(w*et+M)*4+3];const J=N|O<<8|z<<16|W<<24,k=J>>>30;let B=J,T=0,F=[];for(let L=3;L>=0;L--)if(L!==k){const U=B&Ea,V=(B>>9&1)>0;F[L]=Math.SQRT1_2*(U/Ea),V&&(F[L]=-F[L]),T+=F[L]*F[L],B=B>>10}F[k]=Math.sqrt(Math.max(1-T,0));for(let L=0;L<4;L++)F[L]=q(F[L]*128+128);S.push(F)}for(let M=0;M<x;M++)b[y++]=S[M][0];for(let M=0;M<x;M++)b[y++]=S[M][1];for(let M=0;M<x;M++)b[y++]=S[M][2];for(let M=0;M<x;M++)b[y++]=S[M][3];const v=await Rt(b);if(e(i,a,v.datas),i.shDegree===1){const M=new Uint8Array(x*9+8),N=new Uint32Array(2);N[0]=x,N[1]=an,M.set(new Uint8Array(N.buffer),0);for(let z=0,W=8;z<x;z++)M.set(o.subarray(p+(w*et+z)*9,p+(w*et+z)*9+9),W),W+=9;const O=await Rt(M);a.sh12Data.push(O.datas)}else if(i.shDegree===2){const M=new Uint8Array(x*24+8),N=new Uint32Array(2);N[0]=x,N[1]=oe,M.set(new Uint8Array(N.buffer),0);for(let z=0,W=8;z<x;z++)M.set(o.subarray(p+(w*et+z)*24,p+(w*et+z)*24+24),W),W+=24;const O=await Rt(M);a.sh12Data.push(O.datas)}else if(i.shDegree===3){const M=new Uint8Array(x*24+8),N=new Uint32Array(2);N[0]=x,N[1]=oe,M.set(new Uint8Array(N.buffer),0);for(let k=0,B=8;k<x;k++)M.set(o.subarray(p+(w*et+k)*45,p+(w*et+k)*45+24),B),B+=24;const O=await Rt(M);a.sh12Data.push(O.datas);const z=new Uint8Array(x*21+8),W=new Uint32Array(2);W[0]=x,W[1]=ke,z.set(new Uint8Array(W.buffer),0);for(let k=0,B=8;k<x;k++)z.set(o.subarray(p+(w*et+k)*45+24,p+(w*et+k)*45+45),B),B+=21;const J=await Rt(z);a.sh3Data.push(J.datas)}if(a.dataSplatCount>=a.fetchLimit)break}}function e(i,a,o){let r=o.byteLength/K;const c=Math.min(a.fetchLimit,i.numPoints);a.dataSplatCount+r>c?(r=c-a.dataSplatCount,a.splatData.set(o.subarray(0,r*K),a.dataSplatCount*K)):a.splatData.set(o,a.dataSplatCount*K);const A=new Float32Array(o.buffer);for(let l=0,C=0,h=0,m=0;l<r;l++)C=A[l*8],h=A[l*8+1],m=A[l*8+2],a.minX=Math.min(a.minX,C),a.maxX=Math.max(a.maxX,C),a.minY=Math.min(a.minY,h),a.maxY=Math.max(a.maxY,h),a.minZ=Math.min(a.minZ,m),a.maxZ=Math.max(a.maxZ,m);a.dataSplatCount+=r,a.downloadSplatCount+=r;const u=0;a.currentRadius=Math.sqrt(a.maxX*a.maxX+u*u+a.maxZ*a.maxZ),a.aabbCenter=new g.Vector3((a.minX+a.maxX)/2,(a.minY+a.maxY)/2,(a.minZ+a.maxZ)/2),a.maxRadius=.5*Math.sqrt(Math.pow(a.maxX-a.minX,2)+Math.pow(a.maxY-a.minY,2)+Math.pow(a.maxZ-a.minZ,2)),a.metaMatrix&&a.aabbCenter.applyMatrix4(a.metaMatrix)}function s(i){const a=i.slice(0,Ai),o=new Uint32Array(a.buffer),r={};if(r.magic=o[0],r.version=o[1],r.numPoints=o[2],r.shDegree=a[12],r.fractionalBits=a[13],r.flags=a[14],r.reserved=a[15],r.magic!==1347635022)throw new Error("[SPZ ERROR] header not found");if(r.version<2||r.version>3)throw new Error("[SPZ ERROR] version not supported:"+r.version);if(r.shDegree>3)throw new Error("[SPZ ERROR] unsupported SH degree:"+r.shDegree);if(r.fractionalBits!==12)throw new Error("[SPZ ERROR] unsupported FractionalBits:"+r.fractionalBits);const c=r.version==2?19:20;let A=0;if(r.shDegree===1?A=9:r.shDegree===2?A=24:r.shDegree===3&&(A=45),i.length!==Ai+r.numPoints*(c+A))throw new Error("[SPZ ERROR] invalid spz data");return r}}function ci(n){const t=(n-127.5)/38.25;return q((.5+Xt*t)*255)}function ac(n,t,e){const s=n/127.5-1,i=t/127.5-1,a=e/127.5-1,o=Math.sqrt(Math.max(0,1-(s*s+i*i+a*a)));return[q(o*128+128),q(s*128+128),q(i*128+128),q(a*128+128)]}async function ae(n,t){if(!n)return new Uint8Array(0);const e=new AbortController,s=e.signal;try{t?.fire(ys);const i=await fetch(n,{mode:"cors",credentials:"omit",cache:"reload",signal:s});if(i.status!=200)return console.warn(`fetch error: ${i.status}`),null;const a=i.body.getReader(),o=parseInt(i.headers.get("content-length")||"0"),r=new Uint8Array(o);let c=0;for(;;){let{done:A,value:u}=await a.read();if(A)break;r.set(u,c),c+=u.length,t?.fire(ws,100*c/o)}return r}catch(i){console.error(i),e.abort()}return null}const Qa=dt?20480:512e3,Ue=Math.sqrt(2);async function ba(n){try{if(n.status=P.Fetching,n.opts.url.startsWith("blob:")||n.opts.url.endsWith(".sog")){n.status=P.Fetching;const t=n.abortController.signal,e=n.opts.fetchReload?"reload":"default",s=await fetch(n.opts.url,{mode:"cors",credentials:"omit",cache:e,signal:t});if(s.status!=200){console.warn(`fetch error: ${s.status}`),n.status===P.Fetching&&(n.status=P.FetchFailed);return}const i=s.body.getReader(),a=parseInt(s.headers.get("content-length")||"0");n.fileSize=a,n.downloadSize=0,n.downloadSplatCount=0,n.watermarkData=new Uint8Array(0);const o=new Uint8Array(a);for(;;){let{done:u,value:l}=await i.read();if(u)break;o.set(l,n.downloadSize),n.downloadSize+=l.length}const r=YA(o),c=JSON.parse(JA(r.get("meta.json"))),A=c.count||c.means.shape[0];n.modelSplatCount=A,n.CompressionRatio=zn(A,a),n.sogVersion=c.version?c.version:1,await Ba(n,r,c)}else{const t=await fetch(n.opts.url,{mode:"cors",credentials:"omit",cache:"reload"});if(t.status!=200)return console.error(`fetch error: ${t.status}`);const e=await t.json(),s=n.opts.url.split("/"),i=new Map,a=e.count||e.means.shape[0];n.modelSplatCount=a;const o=e.means.files[0];s[s.length-1]=o;const r=s.join("/"),c=e.means.files[1];s[s.length-1]=c;const A=s.join("/"),u=e.scales.files[0];s[s.length-1]=u;const l=s.join("/"),C=e.quats.files[0];s[s.length-1]=C;const h=s.join("/"),m=e.sh0.files[0];s[s.length-1]=m;const I=s.join("/"),d=e.shN?e.shN.files[0]:"shN_centroids.webp";s[s.length-1]=d;const p=s.join("/"),f=e.shN?e.shN.files[1]:"shN_labels.webp";s[s.length-1]=f;const D=s.join("/"),[w,x,b,Q,y,S,v]=await Promise.all([ae(r),ae(A),ae(l),ae(h),ae(I),ae(e.shN?p:""),ae(e.shN?D:"")]);i.set(o,w),i.set(c,x),i.set(u,b),i.set(C,Q),i.set(m,y),i.set(d,S),i.set(f,v);const M=JSON.stringify(e).length+w.length+x.length+b.length+Q.length+y.length+S.length+v.length;n.fileSize=M,n.downloadSize=M,n.watermarkData=new Uint8Array(0),n.CompressionRatio=zn(a,M),n.sogVersion=e.version?e.version:1,await Ba(n,i,e)}}catch(t){t.name==="AbortError"?(n.opts.url,n.status===P.Fetching&&(n.status=P.FetchAborted)):(console.error(t),n.status===P.Fetching&&(n.status=P.FetchFailed))}finally{n.status===P.Fetching&&(n.status=P.FetchDone)}}async function Ba(n,t,e){const s=!e.version||e.version===1,i=s?e.means.shape[0]:e.count,a=Math.min(i,n.fetchLimit),o=e.shN?e.shN.bands||3:0,r=new Uint8Array(a*Gn);n.modelSplatCount=i,n.dataShDegree=o,n.splatData=r;const{rgba:c}=await gt(t.get(e.means.files[0])),{rgba:A}=await gt(t.get(e.means.files[1])),{rgba:u}=await gt(t.get(e.scales.files[0])),{rgba:l}=await gt(t.get(e.quats.files[0])),{rgba:C}=await gt(t.get(e.sh0.files[0])),{rgba:h,width:m}=e.shN?await gt(t.get(e.shN.files[0])):{rgba:null,width:0},{rgba:I}=e.shN?await gt(t.get(e.shN.files[1])):{rgba:null};if(o>0&&!s)if(m==960){const w=new Uint8Array(h.length);for(let x=0;x<h.length;x++)x%4<3&&(w[x]=q(Math.round(e.shN.codebook[h[x]]*128)+128));n.palettes=w}else{const w=m==96?3:8,x=e.shN.count||h.length/4/w;console.info("cnt",x,"dim",w);const b=new Uint8Array(x*15*4);b.fill(128);for(let Q=0,y=0;Q<x;Q++){const S=Q*w;for(let v=0;v<w;v++)b[y*4+0]=q(Math.round(e.shN.codebook[h[(S+v)*4+0]]*128)+128),b[y*4+1]=q(Math.round(e.shN.codebook[h[(S+v)*4+1]]*128)+128),b[y*4+2]=q(Math.round(e.shN.codebook[h[(S+v)*4+2]]*128)+128),y++;y+=15-w}n.palettes=b}for(;a>n.dataSplatCount;){const w=s?await D(n.dataSplatCount):await d(n.dataSplatCount);n.splatData.set(w.subarray(0),n.dataSplatCount*K),p(n,w),n.dataSplatCount+=w.byteLength/K,n.downloadSplatCount=n.dataSplatCount}async function d(w){const x=Math.min(w+Qa,a),b=x-w,Q=new Uint8Array(b*Gn),y=new Float32Array(Q.buffer);for(let v=w,M=0;v<x;v++){let N=(A[v*4+0]<<8|c[v*4+0])/65535,O=(A[v*4+1]<<8|c[v*4+1])/65535,z=(A[v*4+2]<<8|c[v*4+2])/65535,W=e.means.mins[0]+(e.means.maxs[0]-e.means.mins[0])*N,J=e.means.mins[1]+(e.means.maxs[1]-e.means.mins[1])*O,k=e.means.mins[2]+(e.means.maxs[2]-e.means.mins[2])*z;W=Math.sign(W)*(Math.exp(Math.abs(W))-1),J=Math.sign(J)*(Math.exp(Math.abs(J))-1),k=Math.sign(k)*(Math.exp(Math.abs(k))-1);let B=Math.exp(e.scales.codebook[u[v*4+0]]),T=Math.exp(e.scales.codebook[u[v*4+1]]),F=Math.exp(e.scales.codebook[u[v*4+2]]);const{rw:L,rx:U,ry:V,rz:j}=f(l[v*4],l[v*4+1],l[v*4+2],l[v*4+3]);let _=e.sh0.codebook[C[v*4+0]],G=e.sh0.codebook[C[v*4+1]],lt=e.sh0.codebook[C[v*4+2]],Z=C[v*4+3];y[M*8+0]=W,y[M*8+1]=J,y[M*8+2]=k,y[M*8+3]=B,y[M*8+4]=T,y[M*8+5]=F,Q[M*32+24]=q((.5+Xt*_)*255),Q[M*32+25]=q((.5+Xt*G)*255),Q[M*32+26]=q((.5+Xt*lt)*255),Q[M*32+27]=Z,Q[M*32+28]=q(L*128+128),Q[M*32+29]=q(U*128+128),Q[M*32+30]=q(V*128+128),Q[M*32+31]=q(j*128+128),M++}const S=await un(Q,b);if(o>0)for(let v=0;v<b;v++)S[v*32+12]=I[(v+w)*4],S[v*32+13]=I[(v+w)*4+1];return S}function p(w,x){const b=x.byteLength/K,Q=new Float32Array(x.buffer);for(let S=0,v=0,M=0,N=0;S<b;S++)v=Q[S*8],M=Q[S*8+1],N=Q[S*8+2],w.minX=Math.min(w.minX,v),w.maxX=Math.max(w.maxX,v),w.minY=Math.min(w.minY,M),w.maxY=Math.max(w.maxY,M),w.minZ=Math.min(w.minZ,N),w.maxZ=Math.max(w.maxZ,N);const y=0;w.currentRadius=Math.sqrt(w.maxX*w.maxX+y*y+w.maxZ*w.maxZ),w.aabbCenter=new g.Vector3((w.minX+w.maxX)/2,(w.minY+w.maxY)/2,(w.minZ+w.maxZ)/2),w.maxRadius=.5*Math.sqrt(Math.pow(w.maxX-w.minX,2)+Math.pow(w.maxY-w.minY,2)+Math.pow(w.maxZ-w.minZ,2)),w.metaMatrix&&w.aabbCenter.applyMatrix4(w.metaMatrix)}function f(w,x,b,Q){let y=(w/255-.5)*Ue,S=(x/255-.5)*Ue,v=(b/255-.5)*Ue,M=Math.sqrt(Math.max(0,1-y*y-S*S-v*v)),N=Q-252,O,z,W,J;return N==0?(O=M,z=y,W=S,J=v):N==1?(O=y,z=M,W=S,J=v):N==2?(O=y,z=S,W=M,J=v):(O=y,z=S,W=v,J=M),{rw:O,rx:z,ry:W,rz:J}}async function D(w){const x=Math.min(w+Qa,a),b=x-w,Q=new Uint8Array(b*Gn),y=new Float32Array(Q.buffer);for(let S=w,v=0;S<x;S++){let M=(A[S*4+0]<<8|c[S*4+0])/65535,N=(A[S*4+1]<<8|c[S*4+1])/65535,O=(A[S*4+2]<<8|c[S*4+2])/65535,z=e.means.mins[0]+(e.means.maxs[0]-e.means.mins[0])*M,W=e.means.mins[1]+(e.means.maxs[1]-e.means.mins[1])*N,J=e.means.mins[2]+(e.means.maxs[2]-e.means.mins[2])*O;z=Math.sign(z)*(Math.exp(Math.abs(z))-1),W=Math.sign(W)*(Math.exp(Math.abs(W))-1),J=Math.sign(J)*(Math.exp(Math.abs(J))-1);let k=u[S*4+0]/255,B=u[S*4+1]/255,T=u[S*4+2]/255;k=Math.exp(e.scales.mins[0]+(e.scales.maxs[0]-e.scales.mins[0])*k),B=Math.exp(e.scales.mins[1]+(e.scales.maxs[1]-e.scales.mins[1])*B),T=Math.exp(e.scales.mins[2]+(e.scales.maxs[2]-e.scales.mins[2])*T);let F=(l[S*4+0]/255-.5)*Ue,L=(l[S*4+1]/255-.5)*Ue,U=(l[S*4+2]/255-.5)*Ue,V=Math.sqrt(Math.max(0,1-F*F-L*L-U*U)),j=l[S*4+3]-252,_,G,lt,Z;j==0?(_=V,G=F,lt=L,Z=U):j==1?(_=F,G=V,lt=L,Z=U):j==2?(_=F,G=L,lt=V,Z=U):(_=F,G=L,lt=U,Z=V);let Ft=e.sh0.mins[0]+(e.sh0.maxs[0]-e.sh0.mins[0])*(C[S*4+0]/255),Ot=e.sh0.mins[1]+(e.sh0.maxs[1]-e.sh0.mins[1])*(C[S*4+1]/255),at=e.sh0.mins[2]+(e.sh0.maxs[2]-e.sh0.mins[2])*(C[S*4+2]/255),St=e.sh0.mins[3]+(e.sh0.maxs[3]-e.sh0.mins[3])*(C[S*4+3]/255);y[v*8+0]=z,y[v*8+1]=W,y[v*8+2]=J,y[v*8+3]=k,y[v*8+4]=B,y[v*8+5]=T,Q[v*32+24]=q((.5+Xt*Ft)*255),Q[v*32+25]=q((.5+Xt*Ot)*255),Q[v*32+26]=q((.5+Xt*at)*255),Q[v*32+27]=q(1/(1+Math.exp(-St))*255),Q[v*32+28]=q(_*128+128),Q[v*32+29]=q(G*128+128),Q[v*32+30]=q(lt*128+128),Q[v*32+31]=q(Z*128+128),v++}if(o>0){const S=new Uint32Array(2);S[0]=b,S[1]=oe;const v=new Uint8Array(8+b*24);v.set(new Uint8Array(S.buffer),0);const M=new Uint32Array(2);M[0]=b,M[1]=ke;const N=new Uint8Array(8+b*21);N.set(new Uint8Array(M.buffer),0);for(let W=w,J=0;W<x;W++){const k=I[W*4+0]+(I[W*4+1]<<8),B=(k&63)*15,F=(k>>6)*m+B,L=new Uint8Array(9),U=new Uint8Array(15),V=new Uint8Array(21);let j;for(let _=0;_<3;_++){for(let G=0;G<3;G++)j=(e.shN.maxs-e.shN.mins)*h[(F+G)*4+_]/255+e.shN.mins,L[G*3+_]=q(Math.round(j*128)+128);for(let G=0;G<5;G++)j=(e.shN.maxs-e.shN.mins)*h[(F+3+G)*4+_]/255+e.shN.mins,U[G*3+_]=q(Math.round(j*128)+128);for(let G=0;G<7;G++)j=(e.shN.maxs-e.shN.mins)*h[(F+8+G)*4+_]/255+e.shN.mins,V[G*3+_]=q(Math.round(j*128)+128)}v.set(L,8+J*24),v.set(U,8+J*24+9),N.set(V,8+J*21),J++}const O=await Rt(v);n.sh12Data.push(O.datas);const z=await Rt(N);n.sh3Data.push(z.datas)}return await un(Q,b)}}const rc="splat-lod";var ft=(n=>(n[n.None=0]="None",n[n.WaitFetch=1]="WaitFetch",n[n.Fetching=2]="Fetching",n[n.FetchDone=4]="FetchDone",n[n.FetchAborted=8]="FetchAborted",n[n.FetchFailed=16]="FetchFailed",n[n.Invalid=32]="Invalid",n))(ft||{});function Pe(n,t){if(t(n)!==!1){const e=n.children||[];for(let s of e)Pe(s,t)}}const li=7,Jn=new Set;function Ac(n){n&&!n.status&&Jn.add(n)}function cc(n){const t=(c,A,u)=>n.on(c,A,u),e=(c,...A)=>n.fire(c,...A);let s;e(he,()=>a(),()=>!0,30),t(No,async(c,A)=>{const u=Re(c.url,c.baseUrl);if(u.endsWith("lod-meta.json")){let l=null;try{const I=await fetch(u,{mode:"cors",credentials:"omit",cache:"reload"});if(I.status===200)l=await I.json();else return console.error("lod scene file fetch failed, status:",I.status)}catch(I){return console.error("lod scene file fetch failed",I.message)}const C={};for(let I=0;I<l.filenames.length;I++)C[I+""]={url:l.filenames[I]};l.files=C,delete l.filenames;let h=0,m=l.lodLevels;Pe(l.tree,I=>{const d=I,{center:p,radius:f}=lc(d.bound.min,d.bound.max);if(d.center=p,d.radius=f,delete d.bound,d.lods){const D=[];for(let w of Object.keys(d.lods)){const x=m-parseInt(w)-1,b=d.lods[w],Q=b.file+"";D[x]={fileKey:Q,offset:b.offset,count:b.count},C[Q].lod=x,h+=b.count}d.lods=D}}),s=l,s.version=1,s.magic=rc,s.totalCount=h,s.pcLodTargets=A.pcLodTargets,s.mobileLodTargets=A.mobileLodTargets,s.pcLodDistances=A.pcLodDistances,s.mobileLodDistances=A.mobileLodDistances,s.pcLodCacheCount=A.pcLodCacheCount,s.mobileLodCacheCount=A.mobileLodCacheCount,s.fetchSet=new Set,s.lodTargets=o(s,!0),s.lodDistances=r(s);for(let I of Object.keys(s.files)){const d=s.files[I];d.url=Re(d.url,u)}e(R).enableEnvironment&&s.environment&&(s.environment={fileKey:"environment",url:Re(s.environment,u)});return}try{const l=await fetch(u,{mode:"cors",credentials:"omit",cache:"reload"});if(l.status===200){s=await l.json(),s.pcLodTargets=A.pcLodTargets,s.mobileLodTargets=A.mobileLodTargets,s.pcLodDistances=A.pcLodDistances,s.mobileLodDistances=A.mobileLodDistances,s.pcLodCacheCount=A.pcLodCacheCount,s.mobileLodCacheCount=A.mobileLodCacheCount,s.fetchSet=new Set,s.lodTargets=o(s,!1),s.lodDistances=r(s);for(let h of Object.keys(s.files)){const m=s.files[h];m.url=Re(m.url,u)}e(R).enableEnvironment&&s.environment&&(s.environment={fileKey:"environment",url:Re(s.environment,u)})}else return console.error("lod scene file fetch failed, status:",l.status)}catch(l){return console.error("lod scene file fetch failed",l.message)}});function i(){if(!s.topLodReady){for(let c of Object.keys(s.files)){let A=s.files[c];if(A.lod===0&&!A.downloadData)return}s.topLodReady=!0}}function a(){if(!s)return;i();let c=0,A=0,u=[];s?.environment?.url&&!s.environment.status&&u.push(s.environment);for(let h of Object.values(s.files))h.status?h.status<ft.FetchDone&&c++:(A++,h.lod===0&&u.length<li&&u.push(h));if(!A||c>=li)return;for(let h of u)h.downloadCount=0,h.lastTime=Date.now(),h.status=ft.WaitFetch,e(Ws,s,h);if(u.length)return;let l=[...Jn],C=l.filter(h=>h.status>=ft.FetchDone);l=l.filter(h=>!h.status),l.sort((h,m)=>h.currentDistance-m.currentDistance),l=l.slice(0,Math.min(li-c,l.length));for(let h of l)h.downloadCount=0,h.lastTime=Date.now(),h.status=ft.WaitFetch,e(Ws,s,h),Jn.delete(h);for(let h of C)Jn.delete(h)}function o(c,A=!1){let u=[...new Set((dt?c.mobileLodTargets:c.pcLodTargets)||[])];if(u&&u.length>0&&u.length<c.lodLevels){if(A)for(let l=0;l<u.length;l++)u[l]=c.lodLevels-u[l]-1}else{u=[];for(let l=0;l<c.lodLevels;l++)u.push(l)}return u.sort((l,C)=>l-C),u}function r(c){const A=c.lodTargets.length;let u=[...new Set((dt?c.mobileLodDistances:c.pcLodDistances)||[])];if(u.length==A)u.sort((l,C)=>C-l),u[u.length-1]=0;else if(u.length==A-1)u.sort((l,C)=>C-l),u.push(0);else{u=[];for(let l=A;l>1;l--)u.push(l*20);u.push(0)}return delete c.pcLodTargets,delete c.mobileLodTargets,delete c.pcLodDistances,delete c.mobileLodDistances,u}}function lc(n,t){const e=[(t[0]+n[0])/2,(t[1]+n[1])/2,(t[2]+n[2])/2],s=t[0]-n[0],i=t[1]-n[1],a=t[2]-n[2],o=Math.sqrt(s*s+i*i+a*a)/2;return{center:e,radius:o}}const uc=[ta,ea];async function dc(n,t,e){try{e.status|=ft.Fetching,e.abortController=new AbortController,t.fetchSet.add(e.url);const s=e.abortController.signal,a=await fetch(e.url,{mode:"cors",credentials:"omit",cache:"default",signal:s});if(a.status!=200){console.warn(`fetch error: ${a.status}`),e.status|=ft.FetchFailed;return}const o=a.body.getReader();if(parseInt(a.headers.get("content-length")||"0")-Vt<qo){e.status|=ft.Invalid;return}let A=[],u=new Uint8Array(Vt),l=new Uint8Array(K),C=0,h=!1,m=0,I=0,d,p=!1,f=0;for(;;){let{done:D,value:w}=await o.read();if(D)break;if(A){A.push(w);let b=0;for(let S=0;S<A.length;S++)b+=A[S].byteLength;if(b<Vt)continue;let Q=0;for(let S=0;S<A.length;S++)Q+A[S].byteLength<Vt?(u.set(A[S],Q),Q+=A[S].byteLength):(u.set(A[S].subarray(0,Vt-Q),Q),w=new Uint8Array(A[S].slice(Vt-Q)));const y=await Ia(u);if(!y){e.status|=ft.Invalid,console.error("invalid spx format"),e.abortController.abort();break}if(y.Version<3){e.status|=ft.Invalid,console.error("unsupport spx version of lod scene",y.Version),e.abortController.abort();break}if(e.spxHeader=y,n.dataShDegree=y.ShDegree,A=null,u=null,!uc.includes(y.ExclusiveId)){e.status|=ft.Invalid,console.error("Unrecognized format, creater id =",y.CreaterId,", exclusive id =",y.ExclusiveId,y.Comment),e.abortController.abort();break}}if(!h){if(C+w.byteLength<4){l.set(w,C),C+=w.byteLength;continue}const b=new Uint8Array(C+w.byteLength);b.set(l.subarray(0,C),0),b.set(w,C),w=b.slice(4),C=0,h=!0,d=[],I=0;const Q=new Int32Array(b.slice(0,4).buffer)[0];p=Q<0,f=Math.abs(Q)>>28>>>0,m=Math.abs(Q)<<4>>>4}let x=I+w.byteLength;if(d.push(w),x<m){I+=w.byteLength;continue}for(;x>=m;){let b=new Uint8Array(m),Q=0;for(let S=0;S<d.length;S++)Q+d[S].byteLength<m?(b.set(d[S],Q),Q+=d[S].byteLength):(b.set(d[S].subarray(0,m-Q),Q),w=new Uint8Array(d[S].slice(m-Q)));p&&(f===0?b=await ai(b):f===1?b=await ca(b):console.error("unsuported compress type:",f));const y=await Rt(b,e.spxHeader);if(!y.success){console.error("spx block data parser failed. block format:",y.blockFormat),e.status|=ft.Invalid,e.abortController.abort();break}if(y.isSplat?(!e.downloadData&&(e.downloadData=new Uint8Array(e.spxHeader.SplatCount*K)),e.downloadData.set(y.datas,e.downloadCount*K),e.downloadCount+=y.splatCount,n.downloadSplatCount+=y.splatCount):y.palettes?(n.palettes&&console.warn("duplicate palettes"),n.dataShDegree=e.spxHeader.ShDegree,n.palettes=y.palettes):console.warn("ignore unknow spx data"),w.byteLength<4){l.set(w,0),C=w.byteLength,h=!1;break}else{const S=new Int32Array(w.slice(0,4).buffer)[0];p=S<0,f=Math.abs(S)>>28>>>0,m=Math.abs(S)<<4>>>4,w=w.slice(4),x=w.byteLength,d=[w],I=w.byteLength}}}}catch(s){s.name==="AbortError"?(console.warn("Fetch Abort",e.url),e.status|=ft.FetchAborted):(console.error(s),e.status|=ft.FetchFailed,e.abortController.abort())}finally{e.status|=ft.FetchDone,t.fetchSet.delete(e.url),e.abortController=null}}function gc(n,t=0){let e=3735928559^t,s=1103547991^t;if(n instanceof Array)for(let i=0,a;i<n.length;i++)a=n[i],e=Math.imul(e^a,2654435761),s=Math.imul(s^a,1597334677);else for(let i=0,a;i<n.length;i++)a=n.charCodeAt(i),e=Math.imul(e^a,2654435761),s=Math.imul(s^a,1597334677);return e=Math.imul(e^e>>>16,2246822507),e^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(e^e>>>13,3266489909),4294967296*(2097151&s)+(e>>>0)}const fc=n=>gc(n);async function hc(n,t,e){e.status|=ft.Fetching,e.abortController=new AbortController,t.fetchSet.add(e.url);const s=new qs({url:e.url});s.fetchLimit=5e6,s.abortController=e.abortController,await ba(s),s.status==P.FetchDone&&s.downloadSplatCount?(e.downloadData=s.splatData,e.downloadCount=s.downloadSplatCount,e.status|=ft.FetchDone,n.downloadSplatCount+=s.downloadSplatCount):e.status|=ft.FetchFailed|ft.FetchDone,t.fetchSet.delete(e.url)}function pc(n){const t=(k,B,T)=>n.on(k,B,T),e=(k,...B)=>n.fire(k,...B);let s,i=Date.now()+36e5,a=0,o=!1,r=0,c=null,A,u={index:0,version:0,activeTime:0},l={index:1,version:0,activeTime:0},C=!1;const h=e(bt);let m=!1,I=0,d=!1,p=!1;const f=new Array(6).fill(null).map(()=>new g.Plane);t(Mo,()=>A?.aabbCenter||new g.Vector3);let D;const w=new Promise(k=>D=k);t(pe,async()=>{const k=e(R);let B=dt?k.maxRenderCountOfMobile:k.maxRenderCountOfPc;if(!k.bigSceneMode){let T=await w;B=Math.min(T,B)+10240}return B}),t(sn,async(k,B)=>{const T=e(R);if(T.bigSceneMode)return 1;let F=dt?T.maxRenderCountOfMobile:T.maxRenderCountOfPc,L=await w;if(F=Math.min(L,F),!A.dataShDegree)return 1;if(k>=3){if(A.dataShDegree<3)return 1}else if(k>=1){if(A.dataShDegree<1)return 1}else return 1;return Math.ceil(F/B)}),t(Ls,async()=>(await w,A.dataShDegree)),t(Ts,async(k,B=!0)=>{try{await w;const T=ha(A.header);c=await e(mo,k,B,T,A.opts.format),A&&(A.textWatermarkVersion=Date.now())}catch{console.info("failed to generate watermark")}}),t(Qo,k=>{h&&(k?(!l.active&&(l.activeTime=Date.now()),l.active=!0):(!u.active&&(u.activeTime=Date.now()),u.active=!0))}),t(bn,()=>{if(h)return u.version<=l.version?u.xyz:l.xyz;if(A?.status===P.FetchDone||A?.status===P.FetchAborted){if(A.activePoints&&A.activePoints.length===void 0)return A.activePoints;const k={},B=u.xyz;for(let T=0,F=B.length/3,L=0,U=0,V=0,j="";T<F;T++)L=B[T*3],U=B[T*3+1],V=B[T*3+2],j=`${Math.floor(L/2)*2+1},${Math.floor(U/2)*2+1},${Math.floor(V/2)*2+1}`,(k[j]=k[j]||[]).push(L,U,V);return A.activePoints=k}return u.xyz});async function x(k){if(s)return;if(A?.splatTiles){if(!d&&A.palettes&&(e(Gs,A.palettes),e(Ke,A.dataShDegree),d=!0),C)return;C=!0,setTimeout(async()=>{await y(),S(),C=!1});return}if(A&&(A.status===P.Invalid||A.status===P.FetchFailed))return e(R).viewerEvents?.fire(mt),e(Xe,0)||e(ut,{renderSplatCount:0,visibleSplatCount:0,modelSplatCount:0});if(!A||!A.downloadSize)return;const B=A.status!==P.FetchReady&&A.status!==P.Fetching;if(N(B),B){const T=Math.min(A.fetchLimit,A.downloadSplatCount);T&&!A.notifyFetchStopDone&&(A.notifyFetchStopDone=!0)&&e(Xe,T)}else e(ws,100*A.downloadSize/A.fileSize);A.dataSplatCount&&(!d&&A.palettes&&(e(Gs,A.palettes),d=!0),!C&&(C=!0,setTimeout(async()=>{k?await Q(B):await b(B),C=!1})))}async function b(k){if(s)return;const B=u,T=await e(pe),F=c;let L=A.dataSplatCount,U=k?A.watermarkCount:0,V=A.meta.showWatermark&&k?(F?.byteLength||0)/32:0;if(A.renderSplatCount=L+U+V,A.renderSplatCount>=T&&(A.renderSplatCount=T,U=0,V=0,L>T&&(L=T)),e(ut,{visibleSplatCount:A.renderSplatCount,modelSplatCount:A.modelSplatCount+V}),Date.now()-B.textureReadyTime<oA||A.smallSceneUploadDone&&A.lastTextWatermarkVersion==A.textWatermarkVersion)return;if(!B.version){e(qi,(ha(A.header)?A.header.MaxTopY:A.header?.MinTopY)||0);let at=A.opts.format,St=" ";A.opts.format=="spx"?(at="spx v"+A.header.Version+(A.header.ExclusiveId?(", "+A.header.ExclusiveId).substring(0,5):""),St+=A.CompressionRatio):A.opts.format=="spz"?(at="spz v"+A.spzVersion,St+=A.CompressionRatio):A.opts.format=="sog"?(at="sog v"+A.sogVersion,St+=A.CompressionRatio):A.opts.format=="splat"&&(St+=A.CompressionRatio);const ne=" "+(A.fileSize/1024/1024).toFixed(1)+"M";e(ut,{scene:`small (${at}) ${St}${ne}`})}A.lastTextWatermarkVersion=A.textWatermarkVersion,B.textureReady=!1;const{texwidth:j,texheight:_}=e(on,T),G=new Uint32Array(j*_*4),lt=new Float32Array(G.buffer),Z=new Uint8Array(G.buffer);Z.set(A.splatData.subarray(0,L*32),0),U&&Z.set(A.watermarkData.subarray(0,U*32),L*32),V&&Z.set(F.subarray(0,V*32),(L+U)*32);const Ft=new Float32Array(A.renderSplatCount*3);for(let at=0,St=0;at<A.renderSplatCount;at++)Ft[at*3]=lt[at*8],Ft[at*3+1]=lt[at*8+1],Ft[at*3+2]=lt[at*8+2];const Ot=Date.now();if(B.version=Ot,B.txdata=G,B.xyz=Ft,B.renderSplatCount=A.renderSplatCount,B.visibleSplatCount=A.downloadSplatCount+V,B.modelSplatCount=A.downloadSplatCount+V,B.watermarkCount=U+V,B.minX=A.minX,B.maxX=A.maxX,B.minY=A.minY,B.maxY=A.maxY,B.minZ=A.minZ,B.maxZ=A.maxZ,A.meta.particleMode&&!I&&(I=performance.now(),e(Vn,I),e(Ce,!1),e(Nn,1)),A.maxRadius&&e(ko,A.maxRadius),e(Pn,B,A.currentRadius,A.currentRadius),i=Ot,k&&!A.smallSceneUploadDone){A.smallSceneUploadDone=!0,e(bo,A.sh12Data),e(Bo,A.sh3Data),A.sh12Data=null,A.sh3Data=null;const at=e(R);e(Ke,at.shDegree===void 0?3:at.shDegree),e(bn),A.meta.particleMode&&setTimeout(()=>{e(Vn,performance.now()+5e3),e(Nn,2),setTimeout(()=>e(De,!0),5e3)},Math.max(5e3+I-performance.now(),0))}e(ut,{renderSplatCount:A.renderSplatCount})}async function Q(k){if(s)return;k&&!p&&(p=!0,e(R).viewerEvents?.fire(Kt,!0),e(Vo,A.header.Lod>0));const B=await e(pe),{texwidth:T,texheight:F}=e(on,B),L=c,U=0,V=(L?.byteLength||0)/32,j=B-U-V;e(ut,{modelSplatCount:A.downloadSplatCount+V});let _=u.version<=l.version?u:l;if(u.version&&(!_.index&&!l.active||_.index&&!u.active)||Date.now()-_.activeTime<jo)return;if(k){const tt=e(R).viewerEvents;if(tt&&!tt.fire(Cs))return}if(!_.version){let tt=A.opts.format,ot=" ";A.opts.format=="spx"&&(tt="spx"+(A.header.ExclusiveId?(" "+A.header.ExclusiveId).substring(0,6):""),ot+=A.CompressionRatio);const kt=" "+(A.fileSize/1024/1024).toFixed(1)+"M";e(ut,{scene:`large (${tt}) ${ot}${kt}`})}const G=Date.now();_.version=G,_.active=!1;let lt=0;const Z=[],Ft=e(us),Ot=e(Ut),at=e(Jt);for(const tt of A.map.values())M(Ft,Ot,at,tt)&&(Z.push(tt),tt.currentRenderCnt=tt.splatCount,lt+=tt.splatCount);e(ut,{cuts:`${Z.length} / ${A.map.size}`});const St=Math.min(j/lt,1);if(St>.95)for(const tt of Z)tt.currentRenderCnt=tt.splatCount*St|0;else{Z.sort((ot,kt)=>ot.distance-kt.distance);for(const ot of Z)ot.distance<5?ot.distance*=.5:ot.distance<4?ot.distance*=.4:ot.distance<3?ot.distance*=.3:ot.distance<2&&(ot.distance*=.1);v(Z,j);let tt=0;for(let ot of Z)tt+=ot.currentRenderCnt;if(tt>j){let ot=tt-j;for(let kt=Z.length-1;kt>=0&&!(ot<=0);kt--){const Mt=Z[kt];Mt.currentRenderCnt>=ot?(Mt.currentRenderCnt-=ot,ot=0):(ot-=Mt.currentRenderCnt,Mt.currentRenderCnt=0)}}else if(tt<j){let ot=j-tt;for(let kt=0;kt<Z.length&&!(ot<=0);kt++){let Mt=Z[kt];if(Mt.splatCount>Mt.currentRenderCnt)if(Mt.splatCount-Mt.currentRenderCnt>=ot)Mt.currentRenderCnt+=ot,ot=0;else{const Ge=Mt.splatCount-Mt.currentRenderCnt;Mt.currentRenderCnt+=Ge,ot-=Ge}}}}const ne=new Uint32Array(T*F*4),zt=new Float32Array(ne.buffer),He=new Uint8Array(ne.buffer);let Yt=0;for(let tt of Z)He.set(tt.splatData.subarray(0,tt.currentRenderCnt*32),Yt*32),Yt+=tt.currentRenderCnt;V&&He.set(L.subarray(0,V*32),(Yt+U)*32);const fe=Yt+U+V,_e=new Float32Array(fe*3);for(let tt=0,ot=0;tt<fe;tt++)_e[tt*3]=zt[tt*8],_e[tt*3+1]=zt[tt*8+1],_e[tt*3+2]=zt[tt*8+2];_.txdata=ne,_.xyz=_e,_.renderSplatCount=fe,_.visibleSplatCount=lt+A.watermarkCount+V,_.modelSplatCount=A.downloadSplatCount+V,_.watermarkCount=U+V,_.minX=A.header.MinX,_.maxX=A.header.MaxX,_.minY=A.header.MinY,_.maxY=A.header.MaxY,_.minZ=A.header.MinZ,_.maxZ=A.header.MaxZ,e(Pn,_),i=G,e(ut,{visibleSplatCount:_.visibleSplatCount,modelSplatCount:_.modelSplatCount})}async function y(){if(s)return;const k=e(R).enableEnvironment,B=await e(pe),{texwidth:T,texheight:F}=e(on,B),L=c,U=A.watermarkCount,V=(L?.byteLength||0)/32,j=k&&A.splatTiles.environment?.downloadCount||0,_=B-U-V-j;e(Ho,A.splatTiles.fetchSet.size),e(ut,{modelSplatCount:A.downloadSplatCount+V});let G=u.version<=l.version?u:l;if(u.version&&(!G.index&&!l.active||G.index&&!u.active)||Date.now()-Math.max(u.activeTime,l.activeTime)<jo)return;const lt=new g.Vector3,Z=A.splatTiles;if(!Z.topLodReady)return;const Ft=e(us),Ot=e(Ut);ZA(Ft,f);const at=(H,Y,nt=!1)=>{if(!Z.lodTargets.includes(Y))return Y>=0?at(H,Y-1,!0):H.currentRenderLod=-1,H.currentRenderLod;!nt&&Ac(Z.files[H.lods[Y]?.fileKey]);const At=H.lods[Y];return At&&Z.files[At.fileKey]?.downloadCount?H.currentRenderLod=Y:Y>=0?at(H,Y-1,!0):H.currentRenderLod=-1,H.currentRenderLod},St=H=>{const Y=lt.fromArray(H.center),nt=[];for(let At=0;At<5;At++){const We=f[At].distanceToPoint(Y);if(We<-H.radius)return H.currentVisible=!1,0;nt[At]=We}if(H.currentVisible=!0,H.lods)return H.currentDistance=pa(Ot,H),1;H.currentDistance=nt[0]>=0?Math.max(0,nt[0]-H.radius):Math.min(0,nt[0]+H.radius);for(let At of nt)if(At<0||At<H.radius)return-1;return 1},ne=H=>{let Y=-1;const nt=pa(Ot,H);for(let At=0;At<Z.lodDistances.length;At++)if(H.lods[At]&&nt>=Z.lodDistances[At]){Y=Z.lodTargets[At];break}return Y};Pe(Z.tree,H=>{const Y=St(H);if(Y==0)return Pe(H,nt=>{nt.lods&&(nt.currentVisible=!1,nt.currentRenderLod=0)}),!1;Y>0&&Pe(H,nt=>{nt.lods&&(nt.currentVisible=!0,at(nt,ne(nt)))})});let zt=0,He=[],Yt=[],fe=0;Pe(Z.tree,H=>{H.lods&&(H.currentVisible&&fe++,He.push(H),H.currentRenderLod>0&&Yt.push(H),zt+=H.lods[H.currentRenderLod]?.count||0)});let _e=fe>0?zt:0;if(zt>_){const H=Y=>{for(let nt=0;nt<Yt.length;nt++){const At=Yt[nt];if(At.currentRenderLod!=Y)continue;const We=at(At,Y-1);if(We>=0){if(zt+=At.lods[We].count-At.lods[Y].count,zt<=_)break}else zt-=At.lods[Y].count}};for(Yt.sort((Y,nt)=>nt.currentDistance-Y.currentDistance);zt>_;){let Y=0;for(const nt of Yt)Y=Math.max(Y,nt.currentRenderLod);if(Y<1){console.warn("invalid tiles");break}H(Y)}}const tt=Yt.filter(H=>H.currentRenderLod>0);tt.sort((H,Y)=>H.lods[H.currentRenderLod].fileKey===Y.lods[Y.currentRenderLod].fileKey?H.lods[H.currentRenderLod].offset-Y.lods[Y.currentRenderLod].offset:H.lods[H.currentRenderLod].fileKey<Y.lods[Y.currentRenderLod].fileKey?-1:1);let ot="";for(let H of tt){let Y=H.lods[H.currentRenderLod];ot+=`${Y.fileKey},${Y.offset};`}const kt=fc(ot);if(e(bn)&&r===kt)return;r=kt;const Mt=Date.now();G.version=Mt,G.active=!1;const Ge=new Uint32Array(T*F*4),re=new Float32Array(Ge.buffer),ss=new Uint8Array(Ge.buffer);let Ae=0;if(fe>0)for(let H of He){const Y=H.lods[H.currentRenderLod];if(!Y)continue;const nt=Z.files[Y.fileKey];nt.lastTime=Date.now(),ss.set(nt.downloadData.subarray(Y.offset*32,(Y.offset+Y.count)*32),Ae*32),Ae+=Y.count}j&&(ss.set(Z.environment.downloadData.subarray(0,j*32),Ae*32),Ae+=j),U&&(ss.set(A.watermarkData.subarray(0,U*32),Ae*32),Ae+=U),V&&(ss.set(L.subarray(0,V*32),(Ae+U)*32),Ae+=V);const Di=Ae,is=new Float32Array(Di*3),ce=[re[0],re[1],re[2]],le=[re[0],re[1],re[2]];for(let H=0,Y=0,nt=0,At=0;H<Di;H++)Y=re[H*8],nt=re[H*8+1],At=re[H*8+2],is[H*3]=Y,is[H*3+1]=nt,is[H*3+2]=At,ce[0]=Math.min(ce[0],Y),ce[1]=Math.min(ce[1],nt),ce[2]=Math.min(ce[2],At),le[0]=Math.max(le[0],Y),le[1]=Math.max(le[1],nt),le[2]=Math.max(le[2],At);G.txdata=Ge,G.xyz=is,G.renderSplatCount=Di,G.visibleSplatCount=_e+A.watermarkCount+V+j,G.modelSplatCount=A.downloadSplatCount+V,G.watermarkCount=U+V,G.minX=ce[0],G.maxX=le[0],G.minY=ce[1],G.maxY=le[1],G.minZ=ce[2],G.maxZ=le[2],e(Pn,G),i=Mt;const nu=`${fe}/${He.length}`,su=Z.totalCount;e(ut,{scene:"large",lodTotalCount:su,cuts:nu,visibleSplatCount:G.visibleSplatCount,modelSplatCount:G.modelSplatCount}),o||(o=!0,e(R).viewerEvents?.fire(Kt,!0))}function S(){if(!A?.splatTiles)return;const k=dt?A.splatTiles.mobileLodCacheCount||6e6:A.splatTiles.pcLodCacheCount||3e7;if(!(A.downloadSplatCount<k)&&a++%6==0&&A.downloadSplatCount>k){const B=[];for(let L of Object.keys(A.splatTiles.files)){let U=A.splatTiles.files[L];U.downloadCount&&B.push(U)}B.sort((L,U)=>U.lastTime-L.lastTime);let T=A.downloadSplatCount,F=0;for(;B.length&&T>k;){const L=B.pop();F+=L.downloadCount,T-=F,L.downloadCount=0,L.downloadData=null,L.abortController=null,L.lastTime=0,L.spxHeader=null,L.status=ft.None}A.downloadSplatCount-=F}}function v(k,B){const T=k.map(U=>1/(U.distance+1e-6)),F=T.reduce((U,V)=>U+V,0);let L=0;if(k.forEach((U,V)=>{U.currentRenderCnt=Math.min(Math.floor(T[V]/F*B),U.splatCount),L+=U.currentRenderCnt}),L<B){const U=B-L,V=k.map((_,G)=>_.currentRenderCnt<_.splatCount?T[G]:0),j=V.reduce((_,G)=>_+G,0);k.forEach((_,G)=>{if(j>0&&_.currentRenderCnt<_.splatCount){const lt=Math.min(Math.floor(V[G]/j*U),_.splatCount-_.currentRenderCnt);_.currentRenderCnt+=lt}})}}function M(k,B,T,F){if(F.distance=Math.max(F.center.distanceTo(B)-F.radius,0),!F.distance||F.center.distanceTo(T)<=2*F.radius)return!0;const L=new g.Vector4(F.center.x,F.center.y,F.center.z,1).applyMatrix4(k),U=3*L.w;return!(L.z<-U||L.x<-U||L.x>U||L.y<-U||L.y>U)}function N(k){if(!m){if(A.header){m=!0;const B=new g.Vector3(A.header.MinX,A.header.MinY,A.header.MinZ),T=new g.Vector3(A.header.MaxX,A.header.MaxY,A.header.MaxZ);e(Fs,B.x,B.y,B.z,T.x,T.y,T.z,A.meta.showBoundBox)}else if(k){m=!0;const B=new g.Vector3(A.minX,A.minY,A.minZ),T=new g.Vector3(A.maxX,A.maxY,A.maxZ);e(Fs,B.x,B.y,B.z,T.x,T.y,T.z,A.meta.showBoundBox)}}}function O(){if(!s){if(s=!0,A?.abortController?.abort(),A?.map?.clear(),A?.splatTiles){for(let k of Object.values(A.splatTiles.files))k.abortController?.abort();A.splatTiles.environment?.abortController?.abort()}A=null,c=null,u=null,l=null}}function z(k){if(k.opts.format==="spx")sc(k);else if(k.opts.format==="splat")ec(k);else if(k.opts.format==="ply")tc(k);else if(k.opts.format==="spz")oc(k);else if(k.opts.format==="sog")ba(k);else return!1;return!0}function W(k,B){if(s)return;const T=e(R),F=dt?T.maxRenderCountOfMobile:T.maxRenderCountOfPc,L=e(bt);if(k.fetchReload=HA(B.updateDate||0),A=new qs(k,B),L){const V=B.pcDownloadLimitSplatCount||AA,j=B.mobileDownloadLimitSplatCount||rA;A.fetchLimit=dt?j:V}else A.fetchLimit=F;const U=()=>{if(!A||A.status==P.Invalid||A.status==P.FetchFailed)return D(0);A.modelSplatCount>0?(D(A.modelSplatCount),!A.meta.particleMode&&A.dataSplatCount?setTimeout(()=>e(oo),5):setTimeout(U,10)):setTimeout(U,10)};if(U(),!z(A)){console.error("Unsupported format:",k.format),e(Xe,0);return}e(ys),e(ut,{cuts:""})}function J(k,B){s||!k||!B||(!A&&(A=new qs({url:"fake.spx"})),!A.splatTiles&&(A.splatTiles=k),D(k.totalCount),B.url.endsWith(".spx")?dc(A,k,B):B.url.endsWith(".sog")||B.url.endsWith("meta.json")?hc(A,k,B):console.error("Unsupported format:",B.url))}t(eo,(k,B)=>W(k,B)),t(Ws,(k,B)=>J(k,B)),t(no,(k=1e4)=>Date.now()-i<k),t(so,()=>O()),e(he,async()=>await x(h),()=>!s,dt?10:6),cc(n)}var Kn=(n=>(n[n.ModelCenterCirccle=1]="ModelCenterCirccle",n[n.ScreenCenterCircle=2]="ScreenCenterCircle",n[n.ScreenMiddleToLeftRight=3]="ScreenMiddleToLeftRight",n[n.ScreenMiddleToTopBottom=4]="ScreenMiddleToTopBottom",n))(Kn||{});const Sa="currentVisibleRadius",Ma="currentLightRadius",Cc="splatTextureWidth",xa="transitionEffect",ui="splatShTexture12",va="maxPixelDiameter",Da="minPixelDiameter",di="activeFlagValue",gi="splatShTexture3",ka="shPalettesReady",Ta="performanceNow",Xn="performanceAct",mc="waterMarkColor",La="showWaterMark",Ra="useSimilarExp",fi="splatTexture0",hi="splatTexture1",Fa="particleMode",Ua="bigSceneMode",Pa="lightFactor",Va="debugEffect",Na="usingIndex",Ic="splatIndex",pi="shPalettes",Ha="maxRadius",_a="flagValue",Ga="pointMode",Wa="markPoint",Oa="shDegree",za="viewport",Ya="minAlpha",Ja="useLod",Ka="focal",Xa="topY";let $=0;$++;const Za=`$${$++}`,yc=`$${$++}`;$++,$++,$++;const ja=`$${$++}`,wc=`$${$++}`,qa=`$${$++}`,Ec=`$${$++}`,Qc=`$${$++}`,bc=`$${$++}`,Bc=`$${$++}`,Sc=`$${$++}`;$++;const Mc=`$${$++}`,xc=`$${$++}`;$++;const vc=`$${$++}`;$++;const Dc=`$${$++}`;$++;const kc=`$${$++}`,Tc=`$${$++}`,Lc=`$${$++}`,Rc=`$${$++}`,Fc=`$${$++}`,Uc=`$${$++}`,Pc=`$${$++}`,Vc=`$${$++}`,Nc=`$${$++}`,Hc=`$${$++}`,$a=`$${$++}`,_c=`$${$++}`,Gc=`$${$++}`,Ci=`$${$++}`,tr=`$${$++}`,er=`$${$++}`;var Wc=`precision highp float;\r
7
+ `).filter(g=>g.startsWith("property "))){const[g,p,f]=I.split(" "),D=C[p]||"getInt8";l[f]=D,u[f]=A,A+=parseInt(D.replace(/[^\d]/g,""))/8}let h=0;l.f_rest_44?h=3:l.f_rest_23?h=2:l.f_rest_8&&(h=1);const m=["x","y","z","scale_0","scale_1","scale_2","f_dc_0","f_dc_1","f_dc_2","opacity","rot_0","rot_1","rot_2","rot_3"];for(let I=0;I<m.length;I++){const g=m[I];if(!l[g])throw new Error(`Property not found: ${g}`)}return{headerLength:r+o.length,offsets:u,rowLength:A,vertexCount:c,shDegree:h}}}function fa(n,t){let e=t.byteLength/K;const s=Math.min(n.fetchLimit,n.modelSplatCount);n.dataSplatCount+e>s?(e=s-n.dataSplatCount,n.splatData.set(t.subarray(0,e*K),n.dataSplatCount*K)):n.splatData.set(t,n.dataSplatCount*K);const i=new Float32Array(t.buffer);for(let o=0,r=0,c=0,A=0;o<e;o++)r=i[o*8],c=i[o*8+1],A=i[o*8+2],n.minX=Math.min(n.minX,r),n.maxX=Math.max(n.maxX,r),n.minY=Math.min(n.minY,c),n.maxY=Math.max(n.maxY,c),n.minZ=Math.min(n.minZ,A),n.maxZ=Math.max(n.maxZ,A);n.dataSplatCount+=e;const a=0;n.currentRadius=Math.sqrt(n.maxX*n.maxX+a*a+n.maxZ*n.maxZ),n.aabbCenter=new d.Vector3((n.minX+n.maxX)/2,(n.minY+n.maxY)/2,(n.minZ+n.maxZ)/2),n.maxRadius=.5*Math.sqrt(Math.pow(n.maxX-n.minX,2)+Math.pow(n.maxY-n.minY,2)+Math.pow(n.maxZ-n.minZ,2)),n.metaMatrix&&n.aabbCenter.applyMatrix4(n.metaMatrix)}const Ve=dt?20480:512e3;async function ic(n){let t=0;try{n.status=V.Fetching;const s=n.abortController.signal,i=n.opts.fetchReload?"reload":"default",a=await fetch(n.opts.url,{mode:"cors",credentials:"omit",cache:i,signal:s});if(a.status!=200){console.warn(`fetch error: ${a.status}`),n.status===V.Fetching&&(n.status=V.FetchFailed);return}const o=a.body.getReader(),r=parseInt(a.headers.get("content-length")||"0");n.rowLength=32,n.fileSize=r;const c=r/n.rowLength|0;if(c<1){console.warn("data empty",n.opts.url),n.status===V.Fetching&&(n.status=V.Invalid);return}n.CompressionRatio="7.75x",n.modelSplatCount=c,n.downloadSplatCount=0,n.splatData=new Uint8Array(Math.min(n.modelSplatCount,n.fetchLimit)*32),n.watermarkData=new Uint8Array(0);let A=new Uint8Array(32),u=0;for(;;){let{done:l,value:C}=await o.read();if(l)break;u+C.byteLength<n.rowLength?(A.set(C,u),u+=C.byteLength,t+=C.length,n.downloadSize=t):(u=await e(n,u,A,C),u&&A.set(C.subarray(C.byteLength-u),0)),n.downloadSplatCount>=n.fetchLimit&&n.abortController.abort()}}catch(s){s.name==="AbortError"?(n.opts.url,n.status===V.Fetching&&(n.status=V.FetchAborted)):(console.error(s),n.status===V.Fetching&&(n.status=V.FetchFailed))}finally{n.status===V.Fetching&&(n.status=V.FetchDone)}async function e(s,i,a,o){return new Promise(async r=>{let c=(i+o.byteLength)/s.rowLength|0,A=(i+o.byteLength)%s.rowLength,u;i?(u=new Uint8Array(c*s.rowLength),u.set(a.subarray(0,i),0),u.set(o.subarray(0,o.byteLength-A),i)):u=o.slice(0,c*s.rowLength),s.downloadSplatCount+c>s.fetchLimit&&(c=s.fetchLimit-s.downloadSplatCount,A=0);const l=async()=>{if(c>Ve){const C=await ln(u,Ve);ha(s,C),s.downloadSplatCount+=Ve,t+=Ve*s.rowLength,s.downloadSize=t,c-=Ve,u=u.slice(Ve*s.rowLength),setTimeout(l)}else{const C=await ln(u,c);ha(s,C),s.downloadSplatCount+=c,t+=c*s.rowLength,s.downloadSize=t,r(A)}};await l()})}}function ha(n,t){let e=t.byteLength/K;const s=Math.min(n.fetchLimit,n.modelSplatCount);n.dataSplatCount+e>s?(e=s-n.dataSplatCount,n.splatData.set(t.subarray(0,e*K),n.dataSplatCount*K)):n.splatData.set(t,n.dataSplatCount*K);const i=new Float32Array(t.buffer);for(let o=0,r=0,c=0,A=0;o<e;o++)r=i[o*8],c=i[o*8+1],A=i[o*8+2],n.minX=Math.min(n.minX,r),n.maxX=Math.max(n.maxX,r),n.minY=Math.min(n.minY,c),n.maxY=Math.max(n.maxY,c),n.minZ=Math.min(n.minZ,A),n.maxZ=Math.max(n.maxZ,A);n.dataSplatCount+=e;const a=n.header?.MinTopY||0;n.currentRadius=Math.sqrt(n.maxX*n.maxX+a*a+n.maxZ*n.maxZ),n.aabbCenter=new d.Vector3((n.minX+n.maxX)/2,(n.minY+n.maxY)/2,(n.minZ+n.maxZ)/2),n.maxRadius=.5*Math.sqrt(Math.pow(n.maxX-n.minX,2)+Math.pow(n.maxY-n.minY,2)+Math.pow(n.maxZ-n.minZ,2)),n.metaMatrix&&n.aabbCenter.applyMatrix4(n.metaMatrix)}const oc=[rA,pA];async function pa(n){try{n.status=V.Fetching;const t=n.abortController.signal,e=n.opts.fetchReload?"reload":"default",s=await fetch(n.opts.url,{mode:"cors",credentials:"omit",cache:e,signal:t});if(s.status!=200){console.warn(`fetch error: ${s.status}`),n.status===V.Fetching&&(n.status=V.FetchFailed);return}const i=s.body.getReader(),a=parseInt(s.headers.get("content-length")||"0");if(a-Le<sA){console.warn("data empty",n.opts.url),n.status===V.Fetching&&(n.status=V.Invalid);return}n.fileSize=a;let r=[],c=new Uint8Array(Le),A=new Uint8Array(K),u=0,l=!1,C=0,h=0,m,I=!1,g=0;for(;;){let{done:p,value:f}=await i.read();if(p)break;if(n.downloadSize+=f.byteLength,r){r.push(f);let x=0;for(let y=0;y<r.length;y++)x+=r[y].byteLength;if(x<Le)continue;let b=0;for(let y=0;y<r.length;y++)b+r[y].byteLength<Le?(c.set(r[y],b),b+=r[y].byteLength):(c.set(r[y].subarray(0,Le-b),b),f=new Uint8Array(r[y].slice(Le-b)));const B=await ec(c);if(!B){n.abortController.abort(),n.status===V.Fetching&&(n.status=V.Invalid),console.error("invalid spx format");continue}if(n.meta.isLargeScene&&!jA(B)){n.abortController.abort(),n.status===V.Fetching&&(n.status=V.Invalid),console.error("invalid LOD format");continue}if(n.header=B,n.CompressionRatio=Yn(B.SplatCount,a),n.modelSplatCount=B.SplatCount,n.dataShDegree=B.ShDegree,n.aabbCenter=new d.Vector3((B.MinX+B.MaxX)/2,(B.MinY+B.MaxY)/2,(B.MinZ+B.MaxZ)/2),n.maxRadius=.5*Math.sqrt(Math.pow(B.MaxX-B.MinX,2)+Math.pow(B.MaxY-B.MinY,2)+Math.pow(B.MaxZ-B.MinZ,2)),n.metaMatrix&&n.aabbCenter.applyMatrix4(n.metaMatrix),r=null,c=null,!oc.includes(B.ExclusiveId)){n.abortController.abort(),n.status=V.Invalid,console.error("Unrecognized format, creater id =",B.CreaterId,", exclusive id =",B.ExclusiveId,B.Comment);continue}}if(!l){if(u+f.byteLength<4){A.set(f,u),u+=f.byteLength;continue}const x=new Uint8Array(u+f.byteLength);x.set(A.subarray(0,u),0),x.set(f,u),f=x.slice(4),u=0,l=!0,m=[],h=0;const b=new Int32Array(x.slice(0,4).buffer)[0];I=b<0,g=Math.abs(b)>>28>>>0,C=Math.abs(b)<<4>>>4}let D=h+f.byteLength;if(m.push(f),D<C){h+=f.byteLength;continue}for(;D>=C;){let x=new Uint8Array(C),b=0;for(let y=0;y<m.length;y++)b+m[y].byteLength<C?(x.set(m[y],b),b+=m[y].byteLength):(x.set(m[y].subarray(0,C-b),b),f=new Uint8Array(m[y].slice(C-b)));I&&(g===0?x=await ia(x):g===1?x=await GA(x):console.error("unsuported compress type:",g));const B=await Nt(x,n.header);if(!B.success){console.error("spx block data parser failed. block format:",B.blockFormat),n.abortController.abort(),n.status=V.Invalid;break}if(B.isSplat)n.downloadSplatCount+=B.splatCount,ac(n,B.datas);else if(B.palettes)n.palettes=B.palettes;else{const y=Math.min(n.fetchLimit,n.modelSplatCount);if(B.isSh23){if(n.sh12Count+B.splatCount>y){const v=y-n.sh12Count;n.sh12Data.push(B.datas.slice(0,v*16)),n.sh12Count+=v}else n.sh12Data.push(B.datas),n.sh12Count+=B.splatCount;if(n.sh3Count+B.splatCount>y){const v=y-n.sh3Count;n.sh3Data.push(B.dataSh3.slice(0,v*16)),n.sh3Count+=v}else n.sh3Data.push(B.dataSh3),n.sh3Count+=B.splatCount}else if(B.isSh3)if(n.sh3Count+B.splatCount>y){const v=y-n.sh3Count;n.sh3Data.push(B.datas.slice(0,v*16)),n.sh3Count+=v}else n.sh3Data.push(B.datas),n.sh3Count+=B.splatCount;else if(n.sh12Count+B.splatCount>y){const v=y-n.sh12Count;n.sh12Data.push(B.datas.slice(0,v*16)),n.sh12Count+=v}else n.sh12Data.push(B.datas),n.sh12Count+=B.splatCount}if(f.byteLength<4){A.set(f,0),u=f.byteLength,l=!1;break}else{const y=new Int32Array(f.slice(0,4).buffer)[0];I=y<0,g=Math.abs(y)>>28>>>0,C=Math.abs(y)<<4>>>4,f=f.slice(4),D=f.byteLength,m=[f],h=f.byteLength}}const w=n.fetchLimit;n.header.Version<3&&n.header.ShDegree===3?n.downloadSplatCount>=w&&n.sh12Count>=w&&n.sh3Count>=w&&n.abortController.abort():n.header.Version<3&&n.header.ShDegree?n.downloadSplatCount>=w&&n.sh12Count>=w&&n.abortController.abort():n.downloadSplatCount>=w&&n.abortController.abort()}}catch(t){t.name==="AbortError"?(console.warn("Fetch Abort",n.opts.url),n.status===V.Fetching&&(n.status=V.FetchAborted)):(console.error(t),n.status===V.Fetching&&(n.status=V.FetchFailed),n.abortController.abort())}finally{n.status===V.Fetching&&(n.status=V.FetchDone)}}function ac(n,t){let e=t.byteLength/32;const s=4096;if(!n.meta.isLargeScene){const r=Math.min(n.fetchLimit,n.modelSplatCount);if(!n.splatData&&(n.splatData=new Uint8Array(r*K)),!n.watermarkData&&(n.watermarkData=new Uint8Array(0)),n.dataSplatCount+e>r&&(e=r-n.dataSplatCount,!e))return;const c=new Float32Array(t.buffer),A=new Uint32Array(t.buffer);for(let l=0,C=0,h=0,m=0;l<e;l++)if(C=c[l*8],h=c[l*8+1],m=c[l*8+2],n.minX=Math.min(n.minX,C),n.maxX=Math.max(n.maxX,C),n.minY=Math.min(n.minY,h),n.maxY=Math.max(n.maxY,h),n.minZ=Math.min(n.minZ,m),n.maxZ=Math.max(n.maxZ,m),A[l*8+3]&65536){if(n.watermarkCount*K===n.watermarkData.byteLength){const I=new Uint8Array((n.watermarkCount+s)*K);I.set(n.watermarkData,0),n.watermarkData=I}n.watermarkData.set(t.subarray(l*32,l*32+32),n.watermarkCount++*K)}else n.splatData.set(t.subarray(l*32,l*32+32),n.dataSplatCount++*K);const u=n.header.MinTopY||0;n.currentRadius=Math.sqrt(n.maxX*n.maxX+u*u+n.maxZ*n.maxZ);return}!n.watermarkData&&(n.watermarkData=new Uint8Array(0));const i=new Float32Array(t.buffer),a=new Uint32Array(t.buffer),o=n.meta.cutSize||5*(n.meta.meterScale||1);for(let r=0,c=Math.floor(t.byteLength/K),A=0,u=0,l=0,C="";r<c;r++){if(a[r*8+3]&65536){if(n.watermarkCount*K===n.watermarkData.byteLength){const p=new Uint8Array((n.watermarkCount+s)*K);p.set(n.watermarkData,0),n.watermarkData=p}n.watermarkData.set(t.slice(r*32,r*32+32),n.watermarkCount++*K);continue}A=i[r*8],u=i[r*8+1],l=i[r*8+2];const h=(A-n.header.MinX)/o|0,m=(u-n.header.MinY)/o|0,I=(l-n.header.MinZ)/o|0;C=`${h}-${m}-${I}`;let g=n.map.get(C);if(!g)g={},g.minX=A,g.maxX=A,g.minY=u,g.maxY=u,g.minZ=l,g.maxZ=l,g.center=new d.Vector3(A,u,l),n.metaMatrix&&g.center.applyMatrix4(n.metaMatrix),g.radius=0,g.splatData=new Uint8Array(s*K),g.splatData.set(t.slice(r*K,r*K+K),0),g.splatCount=1,n.map.set(C,g);else{if(g.splatData.byteLength/K==g.splatCount){const w=new Uint8Array(g.splatData.byteLength+s*K);w.set(g.splatData,0),g.splatData=w}g.minX=Math.min(g.minX,A),g.maxX=Math.max(g.maxX,A),g.minY=Math.min(g.minY,u),g.maxY=Math.max(g.maxY,u),g.minZ=Math.min(g.minZ,l),g.maxZ=Math.max(g.maxZ,l),g.center=new d.Vector3((g.maxX+g.minX)/2,(g.maxY+g.minY)/2,(g.maxZ+g.minZ)/2),n.metaMatrix&&g.center.applyMatrix4(n.metaMatrix);const p=g.maxX-g.minX,f=g.maxY-g.minY,D=g.maxZ-g.minZ;g.radius=Math.sqrt(p*p+f*f+D*D)/2,n.metaMatrix&&(g.radius*=n.metaMatrix.getMaxScaleOnAxis()),g.splatData.set(t.slice(r*K,r*K+K),g.splatCount++*K)}n.dataSplatCount++}}const nt=dt?20480:512e3,ai=16,Ca=511;async function ma(n){try{n.status=V.Fetching;const i=n.abortController.signal,a=n.opts.fetchReload?"reload":"default",o=await fetch(n.opts.url,{mode:"cors",credentials:"omit",cache:a,signal:i});if(o.status!=200){console.warn(`fetch error: ${o.status}`),n.status===V.Fetching&&(n.status=V.FetchFailed);return}const r=o.body.getReader(),c=parseInt(o.headers.get("content-length")||"0");n.fileSize=c,n.downloadSize=0,n.downloadSplatCount=0,n.watermarkData=new Uint8Array(0);const A=new Uint8Array(c);for(;;){let{done:C,value:h}=await r.read();if(C)break;A.set(h,n.downloadSize),n.downloadSize+=h.length}const u=await ia(A);if(!u||u.length<16){console.error("Invalid spz format"),n.status=V.Invalid;return}const l=s(u);n.CompressionRatio=Yn(l.numPoints,c),n.spzVersion=l.version,n.modelSplatCount=l.numPoints,n.dataShDegree=l.shDegree,n.splatData=new Uint8Array(Math.min(n.modelSplatCount,n.fetchLimit)*32),await t(l,n,u)}catch(i){i.name==="AbortError"?(n.opts.url,n.status===V.Fetching&&(n.status=V.FetchAborted)):(console.error(i),n.status===V.Fetching&&(n.status=V.FetchFailed))}finally{n.status===V.Fetching&&(n.status=V.FetchDone)}async function t(i,a,o){const r=i.numPoints*9,c=i.numPoints,A=i.numPoints*3,u=i.numPoints*3,l=i.numPoints*(i.version==2?3:4),C=ai,h=C+r,m=h+c,I=m+A,g=I+u,p=g+l,f=Math.min(i.numPoints,a.fetchLimit),D=Math.ceil(f/nt);for(let w=0;w<D;w++){let x=w<D-1?nt:f-w*nt;a.dataSplatCount+x>a.fetchLimit&&(x=a.fetchLimit-a.dataSplatCount);const b=new Uint8Array(x*20+8),B=new Uint32Array(2);B[0]=x,B[1]=dA,b.set(new Uint8Array(B.buffer),0);let y=8;for(let S=0;S<x;S++)b[y++]=o[C+(w*nt+S)*9+0],b[y++]=o[C+(w*nt+S)*9+1],b[y++]=o[C+(w*nt+S)*9+2];for(let S=0;S<x;S++)b[y++]=o[C+(w*nt+S)*9+3],b[y++]=o[C+(w*nt+S)*9+4],b[y++]=o[C+(w*nt+S)*9+5];for(let S=0;S<x;S++)b[y++]=o[C+(w*nt+S)*9+6],b[y++]=o[C+(w*nt+S)*9+7],b[y++]=o[C+(w*nt+S)*9+8];for(let S=0;S<x;S++)b[y++]=o[I+(w*nt+S)*3];for(let S=0;S<x;S++)b[y++]=o[I+(w*nt+S)*3+1];for(let S=0;S<x;S++)b[y++]=o[I+(w*nt+S)*3+2];for(let S=0;S<x;S++)b[y++]=ri(o[m+(w*nt+S)*3]);for(let S=0;S<x;S++)b[y++]=ri(o[m+(w*nt+S)*3+1]);for(let S=0;S<x;S++)b[y++]=ri(o[m+(w*nt+S)*3+2]);const v=[];if(i.version==2)for(let S=0,N=0,Y=0,z=0;S<x;S++)b[y++]=o[h+(w*nt+S)],N=o[g+(w*nt+S)*3+0],Y=o[g+(w*nt+S)*3+1],z=o[g+(w*nt+S)*3+2],v.push(rc(N,Y,z));else for(let S=0,N=0,Y=0,z=0,W=0;S<x;S++){b[y++]=o[h+(w*nt+S)],N=o[g+(w*nt+S)*4+0],Y=o[g+(w*nt+S)*4+1],z=o[g+(w*nt+S)*4+2],W=o[g+(w*nt+S)*4+3];const O=N|Y<<8|z<<16|W<<24,k=O>>>30;let Q=O,T=0,F=[];for(let R=3;R>=0;R--)if(R!==k){const U=Q&Ca,P=(Q>>9&1)>0;F[R]=Math.SQRT1_2*(U/Ca),P&&(F[R]=-F[R]),T+=F[R]*F[R],Q=Q>>10}F[k]=Math.sqrt(Math.max(1-T,0));for(let R=0;R<4;R++)F[R]=tt(F[R]*128+128);v.push(F)}for(let S=0;S<x;S++)b[y++]=v[S][0];for(let S=0;S<x;S++)b[y++]=v[S][1];for(let S=0;S<x;S++)b[y++]=v[S][2];for(let S=0;S<x;S++)b[y++]=v[S][3];const M=await Nt(b);if(e(i,a,M.datas),i.shDegree===1){const S=new Uint8Array(x*9+8),N=new Uint32Array(2);N[0]=x,N[1]=on,S.set(new Uint8Array(N.buffer),0);for(let z=0,W=8;z<x;z++)S.set(o.subarray(p+(w*nt+z)*9,p+(w*nt+z)*9+9),W),W+=9;const Y=await Nt(S);a.sh12Data.push(Y.datas)}else if(i.shDegree===2){const S=new Uint8Array(x*24+8),N=new Uint32Array(2);N[0]=x,N[1]=ae,S.set(new Uint8Array(N.buffer),0);for(let z=0,W=8;z<x;z++)S.set(o.subarray(p+(w*nt+z)*24,p+(w*nt+z)*24+24),W),W+=24;const Y=await Nt(S);a.sh12Data.push(Y.datas)}else if(i.shDegree===3){const S=new Uint8Array(x*24+8),N=new Uint32Array(2);N[0]=x,N[1]=ae,S.set(new Uint8Array(N.buffer),0);for(let k=0,Q=8;k<x;k++)S.set(o.subarray(p+(w*nt+k)*45,p+(w*nt+k)*45+24),Q),Q+=24;const Y=await Nt(S);a.sh12Data.push(Y.datas);const z=new Uint8Array(x*21+8),W=new Uint32Array(2);W[0]=x,W[1]=Re,z.set(new Uint8Array(W.buffer),0);for(let k=0,Q=8;k<x;k++)z.set(o.subarray(p+(w*nt+k)*45+24,p+(w*nt+k)*45+45),Q),Q+=21;const O=await Nt(z);a.sh3Data.push(O.datas)}if(a.dataSplatCount>=a.fetchLimit)break}}function e(i,a,o){let r=o.byteLength/K;const c=Math.min(a.fetchLimit,i.numPoints);a.dataSplatCount+r>c?(r=c-a.dataSplatCount,a.splatData.set(o.subarray(0,r*K),a.dataSplatCount*K)):a.splatData.set(o,a.dataSplatCount*K);const A=new Float32Array(o.buffer);for(let l=0,C=0,h=0,m=0;l<r;l++)C=A[l*8],h=A[l*8+1],m=A[l*8+2],a.minX=Math.min(a.minX,C),a.maxX=Math.max(a.maxX,C),a.minY=Math.min(a.minY,h),a.maxY=Math.max(a.maxY,h),a.minZ=Math.min(a.minZ,m),a.maxZ=Math.max(a.maxZ,m);a.dataSplatCount+=r,a.downloadSplatCount+=r;const u=0;a.currentRadius=Math.sqrt(a.maxX*a.maxX+u*u+a.maxZ*a.maxZ),a.aabbCenter=new d.Vector3((a.minX+a.maxX)/2,(a.minY+a.maxY)/2,(a.minZ+a.maxZ)/2),a.maxRadius=.5*Math.sqrt(Math.pow(a.maxX-a.minX,2)+Math.pow(a.maxY-a.minY,2)+Math.pow(a.maxZ-a.minZ,2)),a.metaMatrix&&a.aabbCenter.applyMatrix4(a.metaMatrix)}function s(i){const a=i.slice(0,ai),o=new Uint32Array(a.buffer),r={};if(r.magic=o[0],r.version=o[1],r.numPoints=o[2],r.shDegree=a[12],r.fractionalBits=a[13],r.flags=a[14],r.reserved=a[15],r.magic!==1347635022)throw new Error("[SPZ ERROR] header not found");if(r.version<2||r.version>3)throw new Error("[SPZ ERROR] version not supported:"+r.version);if(r.shDegree>3)throw new Error("[SPZ ERROR] unsupported SH degree:"+r.shDegree);if(r.fractionalBits!==12)throw new Error("[SPZ ERROR] unsupported FractionalBits:"+r.fractionalBits);const c=r.version==2?19:20;let A=0;if(r.shDegree===1?A=9:r.shDegree===2?A=24:r.shDegree===3&&(A=45),i.length!==ai+r.numPoints*(c+A))throw new Error("[SPZ ERROR] invalid spz data");return r}}function ri(n){const t=(n-127.5)/38.25;return tt((.5+Xt*t)*255)}function rc(n,t,e){const s=n/127.5-1,i=t/127.5-1,a=e/127.5-1,o=Math.sqrt(Math.max(0,1-(s*s+i*i+a*a)));return[tt(o*128+128),tt(s*128+128),tt(i*128+128),tt(a*128+128)]}async function re(n,t){if(!n)return new Uint8Array(0);const e=new AbortController,s=e.signal;try{t?.fire(Is);const i=await fetch(n,{mode:"cors",credentials:"omit",cache:"reload",signal:s});if(i.status!=200)return console.warn(`fetch error: ${i.status}`),null;const a=i.body.getReader(),o=parseInt(i.headers.get("content-length")||"0"),r=new Uint8Array(o);let c=0;for(;;){let{done:A,value:u}=await a.read();if(A)break;r.set(u,c),c+=u.length,t?.fire(ys,100*c/o)}return r}catch(i){console.error(i),e.abort()}return null}const Ia=dt?20480:512e3,Ne=Math.sqrt(2);async function ya(n){try{if(n.status=V.Fetching,n.opts.url.startsWith("blob:")||n.opts.url.endsWith(".sog")){n.status=V.Fetching;const t=n.abortController.signal,e=n.opts.fetchReload?"reload":"default",s=await fetch(n.opts.url,{mode:"cors",credentials:"omit",cache:e,signal:t});if(s.status!=200){console.warn(`fetch error: ${s.status}`),n.status===V.Fetching&&(n.status=V.FetchFailed);return}const i=s.body.getReader(),a=parseInt(s.headers.get("content-length")||"0");n.fileSize=a,n.downloadSize=0,n.downloadSplatCount=0,n.watermarkData=new Uint8Array(0);const o=new Uint8Array(a);for(;;){let{done:u,value:l}=await i.read();if(u)break;o.set(l,n.downloadSize),n.downloadSize+=l.length}const r=KA(o),c=JSON.parse(XA(r.get("meta.json"))),A=c.count||c.means.shape[0];n.modelSplatCount=A,n.CompressionRatio=Yn(A,a),n.sogVersion=c.version?c.version:1,await wa(n,r,c)}else{const t=await fetch(n.opts.url,{mode:"cors",credentials:"omit",cache:"reload"});if(t.status!=200)return console.error(`fetch error: ${t.status}`);const e=await t.json(),s=n.opts.url.split("/"),i=new Map,a=e.count||e.means.shape[0];n.modelSplatCount=a;const o=e.means.files[0];s[s.length-1]=o;const r=s.join("/"),c=e.means.files[1];s[s.length-1]=c;const A=s.join("/"),u=e.scales.files[0];s[s.length-1]=u;const l=s.join("/"),C=e.quats.files[0];s[s.length-1]=C;const h=s.join("/"),m=e.sh0.files[0];s[s.length-1]=m;const I=s.join("/"),g=e.shN?e.shN.files[0]:"shN_centroids.webp";s[s.length-1]=g;const p=s.join("/"),f=e.shN?e.shN.files[1]:"shN_labels.webp";s[s.length-1]=f;const D=s.join("/"),[w,x,b,B,y,v,M]=await Promise.all([re(r),re(A),re(l),re(h),re(I),re(e.shN?p:""),re(e.shN?D:"")]);i.set(o,w),i.set(c,x),i.set(u,b),i.set(C,B),i.set(m,y),i.set(g,v),i.set(f,M);const S=JSON.stringify(e).length+w.length+x.length+b.length+B.length+y.length+v.length+M.length;n.fileSize=S,n.downloadSize=S,n.watermarkData=new Uint8Array(0),n.CompressionRatio=Yn(a,S),n.sogVersion=e.version?e.version:1,await wa(n,i,e)}}catch(t){t.name==="AbortError"?(n.opts.url,n.status===V.Fetching&&(n.status=V.FetchAborted)):(console.error(t),n.status===V.Fetching&&(n.status=V.FetchFailed))}finally{n.status===V.Fetching&&(n.status=V.FetchDone)}}async function wa(n,t,e){const s=!e.version||e.version===1,i=s?e.means.shape[0]:e.count,a=Math.min(i,n.fetchLimit),o=e.shN?e.shN.bands||3:0,r=new Uint8Array(a*Hn);n.modelSplatCount=i,n.dataShDegree=o,n.splatData=r;const{rgba:c}=await gt(t.get(e.means.files[0])),{rgba:A}=await gt(t.get(e.means.files[1])),{rgba:u}=await gt(t.get(e.scales.files[0])),{rgba:l}=await gt(t.get(e.quats.files[0])),{rgba:C}=await gt(t.get(e.sh0.files[0])),{rgba:h,width:m}=e.shN?await gt(t.get(e.shN.files[0])):{rgba:null,width:0},{rgba:I}=e.shN?await gt(t.get(e.shN.files[1])):{rgba:null};if(o>0&&!s)if(m==960){const w=new Uint8Array(h.length);for(let x=0;x<h.length;x++)x%4<3&&(w[x]=tt(Math.round(e.shN.codebook[h[x]]*128)+128));n.palettes=w}else{const w=m==96?3:8,x=e.shN.count||h.length/4/w;console.info("cnt",x,"dim",w);const b=new Uint8Array(x*15*4);b.fill(128);for(let B=0,y=0;B<x;B++){const v=B*w;for(let M=0;M<w;M++)b[y*4+0]=tt(Math.round(e.shN.codebook[h[(v+M)*4+0]]*128)+128),b[y*4+1]=tt(Math.round(e.shN.codebook[h[(v+M)*4+1]]*128)+128),b[y*4+2]=tt(Math.round(e.shN.codebook[h[(v+M)*4+2]]*128)+128),y++;y+=15-w}n.palettes=b}for(;a>n.dataSplatCount;){const w=s?await D(n.dataSplatCount):await g(n.dataSplatCount);n.splatData.set(w.subarray(0),n.dataSplatCount*K),p(n,w),n.dataSplatCount+=w.byteLength/K,n.downloadSplatCount=n.dataSplatCount}async function g(w){const x=Math.min(w+Ia,a),b=x-w,B=new Uint8Array(b*Hn),y=new Float32Array(B.buffer);for(let M=w,S=0;M<x;M++){let N=(A[M*4+0]<<8|c[M*4+0])/65535,Y=(A[M*4+1]<<8|c[M*4+1])/65535,z=(A[M*4+2]<<8|c[M*4+2])/65535,W=e.means.mins[0]+(e.means.maxs[0]-e.means.mins[0])*N,O=e.means.mins[1]+(e.means.maxs[1]-e.means.mins[1])*Y,k=e.means.mins[2]+(e.means.maxs[2]-e.means.mins[2])*z;W=Math.sign(W)*(Math.exp(Math.abs(W))-1),O=Math.sign(O)*(Math.exp(Math.abs(O))-1),k=Math.sign(k)*(Math.exp(Math.abs(k))-1);let Q=Math.exp(e.scales.codebook[u[M*4+0]]),T=Math.exp(e.scales.codebook[u[M*4+1]]),F=Math.exp(e.scales.codebook[u[M*4+2]]);const{rw:R,rx:U,ry:P,rz:q}=f(l[M*4],l[M*4+1],l[M*4+2],l[M*4+3]);let _=e.sh0.codebook[C[M*4+0]],H=e.sh0.codebook[C[M*4+1]],lt=e.sh0.codebook[C[M*4+2]],$=C[M*4+3];y[S*8+0]=W,y[S*8+1]=O,y[S*8+2]=k,y[S*8+3]=Q,y[S*8+4]=T,y[S*8+5]=F,B[S*32+24]=tt((.5+Xt*_)*255),B[S*32+25]=tt((.5+Xt*H)*255),B[S*32+26]=tt((.5+Xt*lt)*255),B[S*32+27]=$,B[S*32+28]=tt(R*128+128),B[S*32+29]=tt(U*128+128),B[S*32+30]=tt(P*128+128),B[S*32+31]=tt(q*128+128),S++}const v=await ln(B,b);if(o>0)for(let M=0;M<b;M++)v[M*32+12]=I[(M+w)*4],v[M*32+13]=I[(M+w)*4+1];return v}function p(w,x){const b=x.byteLength/K,B=new Float32Array(x.buffer);for(let v=0,M=0,S=0,N=0;v<b;v++)M=B[v*8],S=B[v*8+1],N=B[v*8+2],w.minX=Math.min(w.minX,M),w.maxX=Math.max(w.maxX,M),w.minY=Math.min(w.minY,S),w.maxY=Math.max(w.maxY,S),w.minZ=Math.min(w.minZ,N),w.maxZ=Math.max(w.maxZ,N);const y=0;w.currentRadius=Math.sqrt(w.maxX*w.maxX+y*y+w.maxZ*w.maxZ),w.aabbCenter=new d.Vector3((w.minX+w.maxX)/2,(w.minY+w.maxY)/2,(w.minZ+w.maxZ)/2),w.maxRadius=.5*Math.sqrt(Math.pow(w.maxX-w.minX,2)+Math.pow(w.maxY-w.minY,2)+Math.pow(w.maxZ-w.minZ,2)),w.metaMatrix&&w.aabbCenter.applyMatrix4(w.metaMatrix)}function f(w,x,b,B){let y=(w/255-.5)*Ne,v=(x/255-.5)*Ne,M=(b/255-.5)*Ne,S=Math.sqrt(Math.max(0,1-y*y-v*v-M*M)),N=B-252,Y,z,W,O;return N==0?(Y=S,z=y,W=v,O=M):N==1?(Y=y,z=S,W=v,O=M):N==2?(Y=y,z=v,W=S,O=M):(Y=y,z=v,W=M,O=S),{rw:Y,rx:z,ry:W,rz:O}}async function D(w){const x=Math.min(w+Ia,a),b=x-w,B=new Uint8Array(b*Hn),y=new Float32Array(B.buffer);for(let v=w,M=0;v<x;v++){let S=(A[v*4+0]<<8|c[v*4+0])/65535,N=(A[v*4+1]<<8|c[v*4+1])/65535,Y=(A[v*4+2]<<8|c[v*4+2])/65535,z=e.means.mins[0]+(e.means.maxs[0]-e.means.mins[0])*S,W=e.means.mins[1]+(e.means.maxs[1]-e.means.mins[1])*N,O=e.means.mins[2]+(e.means.maxs[2]-e.means.mins[2])*Y;z=Math.sign(z)*(Math.exp(Math.abs(z))-1),W=Math.sign(W)*(Math.exp(Math.abs(W))-1),O=Math.sign(O)*(Math.exp(Math.abs(O))-1);let k=u[v*4+0]/255,Q=u[v*4+1]/255,T=u[v*4+2]/255;k=Math.exp(e.scales.mins[0]+(e.scales.maxs[0]-e.scales.mins[0])*k),Q=Math.exp(e.scales.mins[1]+(e.scales.maxs[1]-e.scales.mins[1])*Q),T=Math.exp(e.scales.mins[2]+(e.scales.maxs[2]-e.scales.mins[2])*T);let F=(l[v*4+0]/255-.5)*Ne,R=(l[v*4+1]/255-.5)*Ne,U=(l[v*4+2]/255-.5)*Ne,P=Math.sqrt(Math.max(0,1-F*F-R*R-U*U)),q=l[v*4+3]-252,_,H,lt,$;q==0?(_=P,H=F,lt=R,$=U):q==1?(_=F,H=P,lt=R,$=U):q==2?(_=F,H=R,lt=P,$=U):(_=F,H=R,lt=U,$=P);let Ft=e.sh0.mins[0]+(e.sh0.maxs[0]-e.sh0.mins[0])*(C[v*4+0]/255),zt=e.sh0.mins[1]+(e.sh0.maxs[1]-e.sh0.mins[1])*(C[v*4+1]/255),rt=e.sh0.mins[2]+(e.sh0.maxs[2]-e.sh0.mins[2])*(C[v*4+2]/255),St=e.sh0.mins[3]+(e.sh0.maxs[3]-e.sh0.mins[3])*(C[v*4+3]/255);y[M*8+0]=z,y[M*8+1]=W,y[M*8+2]=O,y[M*8+3]=k,y[M*8+4]=Q,y[M*8+5]=T,B[M*32+24]=tt((.5+Xt*Ft)*255),B[M*32+25]=tt((.5+Xt*zt)*255),B[M*32+26]=tt((.5+Xt*rt)*255),B[M*32+27]=tt(1/(1+Math.exp(-St))*255),B[M*32+28]=tt(_*128+128),B[M*32+29]=tt(H*128+128),B[M*32+30]=tt(lt*128+128),B[M*32+31]=tt($*128+128),M++}if(o>0){const v=new Uint32Array(2);v[0]=b,v[1]=ae;const M=new Uint8Array(8+b*24);M.set(new Uint8Array(v.buffer),0);const S=new Uint32Array(2);S[0]=b,S[1]=Re;const N=new Uint8Array(8+b*21);N.set(new Uint8Array(S.buffer),0);for(let W=w,O=0;W<x;W++){const k=I[W*4+0]+(I[W*4+1]<<8),Q=(k&63)*15,F=(k>>6)*m+Q,R=new Uint8Array(9),U=new Uint8Array(15),P=new Uint8Array(21);let q;for(let _=0;_<3;_++){for(let H=0;H<3;H++)q=(e.shN.maxs-e.shN.mins)*h[(F+H)*4+_]/255+e.shN.mins,R[H*3+_]=tt(Math.round(q*128)+128);for(let H=0;H<5;H++)q=(e.shN.maxs-e.shN.mins)*h[(F+3+H)*4+_]/255+e.shN.mins,U[H*3+_]=tt(Math.round(q*128)+128);for(let H=0;H<7;H++)q=(e.shN.maxs-e.shN.mins)*h[(F+8+H)*4+_]/255+e.shN.mins,P[H*3+_]=tt(Math.round(q*128)+128)}M.set(R,8+O*24),M.set(U,8+O*24+9),N.set(P,8+O*21),O++}const Y=await Nt(M);n.sh12Data.push(Y.datas);const z=await Nt(N);n.sh3Data.push(z.datas)}return await ln(B,b)}}const Ac="splat-lod";var Rt=(n=>(n[n.None=0]="None",n[n.WaitFetch=1]="WaitFetch",n[n.Fetching=2]="Fetching",n[n.FetchDone=4]="FetchDone",n[n.FetchAborted=8]="FetchAborted",n[n.FetchFailed=16]="FetchFailed",n[n.Invalid=32]="Invalid",n))(Rt||{});function _e(n,t){if(t(n)!==!1){const e=n.children||[];for(let s of e)_e(s,t)}}const Ai=7,On=new Set;function cc(n){n&&!n.status&&On.add(n)}function lc(n){const t=(c,A,u)=>n.on(c,A,u),e=(c,...A)=>n.fire(c,...A);let s;e(pe,()=>a(),()=>!0,30),t(Po,async(c,A)=>{const u=Pe(c.url,/^(http:|https:)/.test(A.url)?A.url:c.baseUrl);if(u.endsWith("lod-meta.json")){let l=null;try{const I=await fetch(u,{mode:"cors",credentials:"omit",cache:"reload"});if(I.status===200)l=await I.json();else return console.error("lod scene file fetch failed, status:",I.status)}catch(I){return console.error("lod scene file fetch failed",I.message)}const C={};for(let I=0;I<l.filenames.length;I++)C[I+""]={url:l.filenames[I]};l.files=C,delete l.filenames;let h=0,m=l.lodLevels;_e(l.tree,I=>{const g=I,{center:p,radius:f}=uc(g.bound.min,g.bound.max);if(g.center=p,g.radius=f,delete g.bound,g.lods){const D=[];for(let w of Object.keys(g.lods)){const x=m-parseInt(w)-1,b=g.lods[w],B=b.file+"";D[x]={fileKey:B,offset:b.offset,count:b.count},C[B].lod=x,h+=b.count}g.lods=D}}),s=l,s.version=1,s.magic=Ac,s.totalCount=h,s.pcLodTargets=A.pcLodTargets,s.mobileLodTargets=A.mobileLodTargets,s.pcLodDistances=A.pcLodDistances,s.mobileLodDistances=A.mobileLodDistances,s.pcLodCacheCount=A.pcLodCacheCount,s.mobileLodCacheCount=A.mobileLodCacheCount,s.fetchSet=new Set,s.lodTargets=o(s,!0),s.lodDistances=r(s);for(let I of Object.keys(s.files)){const g=s.files[I];g.url=Pe(g.url,u)}e(L).enableEnvironment&&s.environment&&(s.environment={fileKey:"environment",url:Pe(s.environment,u)});return}try{const l=await fetch(u,{mode:"cors",credentials:"omit",cache:"reload"});if(l.status===200){s=await l.json(),s.pcLodTargets=A.pcLodTargets,s.mobileLodTargets=A.mobileLodTargets,s.pcLodDistances=A.pcLodDistances,s.mobileLodDistances=A.mobileLodDistances,s.pcLodCacheCount=A.pcLodCacheCount,s.mobileLodCacheCount=A.mobileLodCacheCount,s.fetchSet=new Set,s.lodTargets=o(s,!1),s.lodDistances=r(s);for(let h of Object.keys(s.files)){const m=s.files[h];m.url=Pe(m.url,u)}e(L).enableEnvironment&&s.environment&&(s.environment={fileKey:"environment",url:Pe(s.environment,u)})}else return console.error("lod scene file fetch failed, status:",l.status)}catch(l){return console.error("lod scene file fetch failed",l.message)}});function i(){if(s.topLodReady)return;let c=!0,A=0;for(let u of Object.keys(s.files)){let l=s.files[u];if(l.lod===0){if(++A>4)return s.topLodReady=!0;!l.downloadData&&(c=!1)}}s.topLodReady=c}function a(){if(!s)return;i();let c=0,A=0,u=[];s?.environment?.url&&!s.environment.status&&u.push(s.environment);for(let h of Object.values(s.files))h.status?h.status<Rt.FetchDone&&c++:(A++,h.lod===0&&u.length<Ai&&u.push(h));if(!A||c>=Ai)return;for(let h of u)h.downloadCount=0,h.lastTime=Date.now(),h.status=Rt.WaitFetch,e(Gs,s,h);if(u.length)return;let l=[...On],C=l.filter(h=>h.status>=Rt.FetchDone);l=l.filter(h=>!h.status),l.sort((h,m)=>h.currentDistance-m.currentDistance),l=l.slice(0,Math.min(Ai-c,l.length));for(let h of l)h.downloadCount=0,h.lastTime=Date.now(),h.status=Rt.WaitFetch,e(Gs,s,h),On.delete(h);for(let h of C)On.delete(h)}function o(c,A=!1){let u=[...new Set((dt?c.mobileLodTargets:c.pcLodTargets)||[])];if(u&&u.length>0&&u.length<c.lodLevels){if(A)for(let l=0;l<u.length;l++)u[l]=c.lodLevels-u[l]-1}else{u=[];for(let l=0;l<c.lodLevels;l++)u.push(l)}return u.sort((l,C)=>l-C),u}function r(c){const A=c.lodTargets.length;let u=[...new Set((dt?c.mobileLodDistances:c.pcLodDistances)||[])];if(u.length==A)u.sort((l,C)=>C-l),u[u.length-1]=0;else if(u.length==A-1)u.sort((l,C)=>C-l),u.push(0);else{u=[];for(let l=A;l>1;l--)u.push(l*20);u.push(0)}return delete c.pcLodTargets,delete c.mobileLodTargets,delete c.pcLodDistances,delete c.mobileLodDistances,u}}function uc(n,t){const e=[(t[0]+n[0])/2,(t[1]+n[1])/2,(t[2]+n[2])/2],s=t[0]-n[0],i=t[1]-n[1],a=t[2]-n[2],o=Math.sqrt(s*s+i*i+a*a)/2;return{center:e,radius:o}}function dc(n,t=0){let e=3735928559^t,s=1103547991^t;if(n instanceof Array)for(let i=0,a;i<n.length;i++)a=n[i],e=Math.imul(e^a,2654435761),s=Math.imul(s^a,1597334677);else for(let i=0,a;i<n.length;i++)a=n.charCodeAt(i),e=Math.imul(e^a,2654435761),s=Math.imul(s^a,1597334677);return e=Math.imul(e^e>>>16,2246822507),e^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(e^e>>>13,3266489909),4294967296*(2097151&s)+(e>>>0)}const Ea=n=>dc(n);async function gc(n,t,e){const s=e.url.endsWith(".spx"),i=e.url.endsWith(".spz"),a=e.url.endsWith(".sog")||e.url.endsWith("meta.json");if(!s&&!i&&!a){e.status|=Rt.Fetching|Rt.FetchDone|Rt.Invalid;return}e.status|=Rt.Fetching,e.abortController=new AbortController,t.fetchSet.add(e.url);const o=new js({url:e.url});o.fetchLimit=5e6,o.abortController=e.abortController,s?await pa(o):i?await ma(o):a&&await ya(o),o.status==V.FetchDone&&o.downloadSplatCount?(e.downloadData=o.splatData,e.downloadCount=o.downloadSplatCount,e.status|=Rt.FetchDone,n.downloadSplatCount+=o.downloadSplatCount,n.dataShDegree=Math.max(n.dataShDegree,o.dataShDegree)):e.status|=Rt.FetchDone|Rt.FetchFailed,t.fetchSet.delete(e.url),e.abortController=null}function fc(n){const t=(k,Q,T)=>n.on(k,Q,T),e=(k,...Q)=>n.fire(k,...Q);let s,i=Date.now()+36e5,a=0,o=!1,r=0,c=null,A,u={index:0,version:0,activeTime:0},l={index:1,version:0,activeTime:0},C=!1;const h=e(Qt);let m=!1,I=0,g=!1,p=!1;const f=new Array(6).fill(null).map(()=>new d.Plane);t(bo,()=>A?.aabbCenter||new d.Vector3);let D;const w=new Promise(k=>D=k);t(Ce,async()=>{const k=e(L);let Q=dt?k.maxRenderCountOfMobile:k.maxRenderCountOfPc;if(!k.bigSceneMode){let T=await w;Q=Math.min(T,Q)+10240}return Q}),t(nn,async(k,Q)=>{const T=e(L);if(T.bigSceneMode)return 1;let F=dt?T.maxRenderCountOfMobile:T.maxRenderCountOfPc,R=await w;if(F=Math.min(R,F),!A.dataShDegree)return 1;if(k>=3){if(A.dataShDegree<3)return 1}else if(k>=1){if(A.dataShDegree<1)return 1}else return 1;return Math.ceil(F/Q)}),t(Ts,async()=>(await w,A.dataShDegree)),t(ks,async(k,Q=!0)=>{try{await w;const T=la(A.header);c=await e(po,k,Q,T,A.opts.format),A&&(A.textWatermarkVersion=Date.now())}catch{console.info("failed to generate watermark")}}),t(wo,k=>{h&&(k?(!l.active&&(l.activeTime=Date.now()),l.active=!0):(!u.active&&(u.activeTime=Date.now()),u.active=!0))}),t(Bn,()=>{if(h)return u.version<=l.version?u.xyz:l.xyz;if(A?.status===V.FetchDone||A?.status===V.FetchAborted){if(A.activePoints&&A.activePoints.length===void 0)return A.activePoints;const k={},Q=u.xyz;for(let T=0,F=Q.length/3,R=0,U=0,P=0,q="";T<F;T++)R=Q[T*3],U=Q[T*3+1],P=Q[T*3+2],q=`${Math.floor(R/2)*2+1},${Math.floor(U/2)*2+1},${Math.floor(P/2)*2+1}`,(k[q]=k[q]||[]).push(R,U,P);return A.activePoints=k}return u.xyz});async function x(k){if(s)return;if(A?.splatTiles){if(!g&&A.palettes&&(e(Hs,A.palettes),e(Je,A.dataShDegree),g=!0),C)return;C=!0,setTimeout(async()=>{await y(),v(),C=!1});return}if(A&&(A.status===V.Invalid||A.status===V.FetchFailed))return e(L).viewerEvents?.fire(Ct),e(Ke,0)||e(ut,{renderSplatCount:0,visibleSplatCount:0,modelSplatCount:0});if(!A||!A.downloadSize)return;const Q=A.status!==V.FetchReady&&A.status!==V.Fetching;if(N(Q),Q){const T=Math.min(A.fetchLimit,A.downloadSplatCount);T&&!A.notifyFetchStopDone&&(A.notifyFetchStopDone=!0)&&e(Ke,T)}else e(ys,100*A.downloadSize/A.fileSize);A.dataSplatCount&&(!g&&A.palettes&&(e(Hs,A.palettes),g=!0),!C&&(C=!0,setTimeout(async()=>{k?await B(Q):await b(Q),C=!1})))}async function b(k){if(s)return;const Q=u,T=await e(Ce),F=c;let R=A.dataSplatCount,U=k?A.watermarkCount:0,P=A.meta.showWatermark&&k?(F?.byteLength||0)/32:0;if(A.renderSplatCount=R+U+P,A.renderSplatCount>=T&&(A.renderSplatCount=T,U=0,P=0,R>T&&(R=T)),e(ut,{visibleSplatCount:A.renderSplatCount,modelSplatCount:A.modelSplatCount+P}),Date.now()-Q.textureReadyTime<nA||A.smallSceneUploadDone&&A.lastTextWatermarkVersion==A.textWatermarkVersion)return;if(!Q.version){e(Zi,(la(A.header)?A.header.MaxTopY:A.header?.MinTopY)||0);let rt=A.opts.format,St=" ";A.opts.format=="spx"?(rt="spx v"+A.header.Version+(A.header.ExclusiveId?(", "+A.header.ExclusiveId).substring(0,5):""),St+=A.CompressionRatio):A.opts.format=="spz"?(rt="spz v"+A.spzVersion,St+=A.CompressionRatio):A.opts.format=="sog"?(rt="sog v"+A.sogVersion,St+=A.CompressionRatio):A.opts.format=="splat"&&(St+=A.CompressionRatio);const ne=" "+(A.fileSize/1024/1024).toFixed(1)+"M";e(ut,{scene:`small (${rt}) ${St}${ne}`})}A.lastTextWatermarkVersion=A.textWatermarkVersion,Q.textureReady=!1;const{texwidth:q,texheight:_}=e(sn,T),H=new Uint32Array(q*_*4),lt=new Float32Array(H.buffer),$=new Uint8Array(H.buffer);$.set(A.splatData.subarray(0,R*32),0),U&&$.set(A.watermarkData.subarray(0,U*32),R*32),P&&$.set(F.subarray(0,P*32),(R+U)*32);const Ft=new Float32Array(A.renderSplatCount*3);for(let rt=0,St=0;rt<A.renderSplatCount;rt++)Ft[rt*3]=lt[rt*8],Ft[rt*3+1]=lt[rt*8+1],Ft[rt*3+2]=lt[rt*8+2];const zt=Date.now();if(Q.version=zt,Q.txdata=H,Q.xyz=Ft,Q.renderSplatCount=A.renderSplatCount,Q.visibleSplatCount=A.downloadSplatCount+P,Q.modelSplatCount=A.downloadSplatCount+P,Q.watermarkCount=U+P,Q.minX=A.minX,Q.maxX=A.maxX,Q.minY=A.minY,Q.maxY=A.maxY,Q.minZ=A.minZ,Q.maxZ=A.maxZ,A.meta.particleMode&&!I&&(I=performance.now(),e(Pn,I),e(me,!1),e(Vn,1)),A.maxRadius&&e(vo,A.maxRadius),e(Un,Q,A.currentRadius,A.currentRadius),i=zt,k&&!A.smallSceneUploadDone){A.smallSceneUploadDone=!0,e(Eo,A.sh12Data),e(Bo,A.sh3Data),A.sh12Data=null,A.sh3Data=null;const rt=e(L);e(Je,rt.shDegree===void 0?3:rt.shDegree),e(Bn),A.meta.particleMode&&setTimeout(()=>{e(Pn,performance.now()+5e3),e(Vn,2),setTimeout(()=>e(Te,!0),5e3)},Math.max(5e3+I-performance.now(),0))}e(ut,{renderSplatCount:A.renderSplatCount})}async function B(k){if(s)return;k&&!p&&(p=!0,e(L).viewerEvents?.fire(Kt,!0),e(Uo,A.header.Lod>0));const Q=await e(Ce),{texwidth:T,texheight:F}=e(sn,Q),R=c,U=0,P=(R?.byteLength||0)/32,q=Q-U-P;e(ut,{modelSplatCount:A.downloadSplatCount+P});let _=u.version<=l.version?u:l;if(u.version&&(!_.index&&!l.active||_.index&&!u.active)||Date.now()-_.activeTime<Xo)return;if(k){const st=e(L).viewerEvents;if(st&&!st.fire(ps))return}if(!_.version){let st=A.opts.format,at=" ";A.opts.format=="spx"&&(st="spx"+(A.header.ExclusiveId?(" "+A.header.ExclusiveId).substring(0,6):""),at+=A.CompressionRatio);const kt=" "+(A.fileSize/1024/1024).toFixed(1)+"M";e(ut,{scene:`large (${st}) ${at}${kt}`})}const H=Date.now();_.version=H,_.active=!1;let lt=0;const $=[],Ft=e(ls),zt=e(Ut),rt=e(Jt);for(const st of A.map.values())S(Ft,zt,rt,st)&&($.push(st),st.currentRenderCnt=st.splatCount,lt+=st.splatCount);e(ut,{cuts:`${$.length} / ${A.map.size}`});const St=Math.min(q/lt,1);if(St>.95)for(const st of $)st.currentRenderCnt=st.splatCount*St|0;else{$.sort((at,kt)=>at.distance-kt.distance);for(const at of $)at.distance<5?at.distance*=.5:at.distance<4?at.distance*=.4:at.distance<3?at.distance*=.3:at.distance<2&&(at.distance*=.1);M($,q);let st=0;for(let at of $)st+=at.currentRenderCnt;if(st>q){let at=st-q;for(let kt=$.length-1;kt>=0&&!(at<=0);kt--){const wt=$[kt];wt.currentRenderCnt>=at?(wt.currentRenderCnt-=at,at=0):(at-=wt.currentRenderCnt,wt.currentRenderCnt=0)}}else if(st<q){let at=q-st;for(let kt=0;kt<$.length&&!(at<=0);kt++){let wt=$[kt];if(wt.splatCount>wt.currentRenderCnt)if(wt.splatCount-wt.currentRenderCnt>=at)wt.currentRenderCnt+=at,at=0;else{const Ht=wt.splatCount-wt.currentRenderCnt;wt.currentRenderCnt+=Ht,at-=Ht}}}}const ne=new Uint32Array(T*F*4),Ot=new Float32Array(ne.buffer),Ae=new Uint8Array(ne.buffer);let Be=0;for(let st of $)Ae.set(st.splatData.subarray(0,st.currentRenderCnt*32),Be*32),Be+=st.currentRenderCnt;P&&Ae.set(R.subarray(0,P*32),(Be+U)*32);const se=Be+U+P,ce=new Float32Array(se*3);for(let st=0,at=0;st<se;st++)ce[st*3]=Ot[st*8],ce[st*3+1]=Ot[st*8+1],ce[st*3+2]=Ot[st*8+2];_.txdata=ne,_.xyz=ce,_.renderSplatCount=se,_.visibleSplatCount=lt+A.watermarkCount+P,_.modelSplatCount=A.downloadSplatCount+P,_.watermarkCount=U+P,_.minX=A.header.MinX,_.maxX=A.header.MaxX,_.minY=A.header.MinY,_.maxY=A.header.MaxY,_.minZ=A.header.MinZ,_.maxZ=A.header.MaxZ,e(Un,_),i=H,e(ut,{visibleSplatCount:_.visibleSplatCount,modelSplatCount:_.modelSplatCount})}async function y(){if(s)return;const k=e(L).enableEnvironment,Q=await e(Ce),{texwidth:T,texheight:F}=e(sn,Q),R=c,U=A.watermarkCount,P=(R?.byteLength||0)/32,q=k&&A.splatTiles.environment?.downloadCount||0,_=Q-U-P-q;e(Vo,A.splatTiles.fetchSet.size),e(ut,{modelSplatCount:A.downloadSplatCount+P});let H=u.version<=l.version?u:l;if(u.version&&(!H.index&&!l.active||H.index&&!u.active)||Date.now()-Math.max(u.activeTime,l.activeTime)<Xo)return;const lt=new d.Vector3,$=A.splatTiles;if(!$.topLodReady)return;const Ft=e(ls),zt=e(Ut);qA(Ft,f);const rt=(G,J,X=!1)=>{if(!$.lodTargets.includes(J))return J>=0?rt(G,J-1,!0):G.currentRenderLod=-1,G.currentRenderLod;!X&&cc($.files[G.lods[J]?.fileKey]);const Z=G.lods[J];return Z&&$.files[Z.fileKey]?.downloadCount?G.currentRenderLod=J:J>=0?rt(G,J-1,!0):G.currentRenderLod=-1,G.currentRenderLod},St=G=>{const J=lt.fromArray(G.center),X=[];for(let Z=0;Z<5;Z++){const xt=f[Z].distanceToPoint(J);if(xt<-G.radius)return G.currentVisible=!1,0;X[Z]=xt}if(G.currentVisible=!0,G.lods)return G.currentDistance=ua(zt,G),1;G.currentDistance=X[0]>=0?Math.max(0,X[0]-G.radius):Math.min(0,X[0]+G.radius);for(let Z of X)if(Z<0||Z<G.radius)return-1;return 1},ne=G=>{let J=-1;const X=ua(zt,G);for(let Z=0;Z<$.lodDistances.length;Z++)if(G.lods[Z]&&X>=$.lodDistances[Z]){J=$.lodTargets[Z];break}return J};_e($.tree,G=>{const J=St(G);if(J==0)return _e(G,X=>{X.lods&&(X.currentVisible=!1,X.currentRenderLod=0)}),!1;J>0&&_e(G,X=>{X.lods&&(X.currentVisible=!0,rt(X,ne(X)))})});let Ot=0,Ae=[],Be=Ae,se=[],ce=0;_e($.tree,G=>{G.lods&&(G.currentVisible&&ce++,Ae.push(G),G.currentRenderLod>0&&se.push(G),Ot+=G.lods[G.currentRenderLod]?.count||0)});let st=ce>0?Ot:0,at=!1;if(Ot>_){const G=J=>{for(let X=0;X<se.length;X++){const Z=se[X];if(Z.currentRenderLod!=J)continue;const xt=rt(Z,J-1);if(xt>=0){if(Ot+=Z.lods[xt].count-Z.lods[J].count,Ot<=_)break}else Ot-=Z.lods[J].count}};for(se.sort((J,X)=>X.currentDistance-J.currentDistance);Ot>_;){let J=0;for(const X of se)J=Math.max(J,X.currentRenderLod);if(J<1){console.warn("Coarsest LOD data is too large"),at=!0;break}G(J)}}if(at){Ae.sort((X,Z)=>X.currentVisible?-1:Z.currentVisible?1:X.currentDistance-Z.currentDistance);let G=0,J=q+U+P;for(let X of Ae){if(J+=X.lods[0]?.count||0,J>_)break;G++}Be=Ae.slice(0,G),r=Ea(Date.now()+"")}else{const G=se.filter(Z=>Z.currentRenderLod>0);G.sort((Z,xt)=>Z.lods[Z.currentRenderLod].fileKey===xt.lods[xt.currentRenderLod].fileKey?Z.lods[Z.currentRenderLod].offset-xt.lods[xt.currentRenderLod].offset:Z.lods[Z.currentRenderLod].fileKey<xt.lods[xt.currentRenderLod].fileKey?-1:1);let J="";for(let Z of G){let xt=Z.lods[Z.currentRenderLod];J+=`${xt.fileKey},${xt.offset};`}const X=Ea(J);if(e(Bn)&&r===X)return;r=X}const kt=Date.now();H.version=kt,H.active=!1;const wt=new Uint32Array(T*F*4),Ht=new Float32Array(wt.buffer),ns=new Uint8Array(wt.buffer);let le=0;if(ce>0)for(let G of Be){const J=G.lods[G.currentRenderLod];if(!J)continue;const X=$.files[J.fileKey];X.lastTime=Date.now(),ns.set(X.downloadData.subarray(J.offset*32,(J.offset+J.count)*32),le*32),le+=J.count}q&&(ns.set($.environment.downloadData.subarray(0,q*32),le*32),le+=q),U&&(ns.set(A.watermarkData.subarray(0,U*32),le*32),le+=U),P&&(ns.set(R.subarray(0,P*32),(le+U)*32),le+=P);const Mi=le,ss=new Float32Array(Mi*3),ue=[Ht[0],Ht[1],Ht[2]],de=[Ht[0],Ht[1],Ht[2]];for(let G=0,J=0,X=0,Z=0;G<Mi;G++)J=Ht[G*8],X=Ht[G*8+1],Z=Ht[G*8+2],ss[G*3]=J,ss[G*3+1]=X,ss[G*3+2]=Z,ue[0]=Math.min(ue[0],J),ue[1]=Math.min(ue[1],X),ue[2]=Math.min(ue[2],Z),de[0]=Math.max(de[0],J),de[1]=Math.max(de[1],X),de[2]=Math.max(de[2],Z);H.txdata=wt,H.xyz=ss,H.renderSplatCount=Mi,H.visibleSplatCount=st+A.watermarkCount+P+q,H.modelSplatCount=A.downloadSplatCount+P,H.watermarkCount=U+P,H.minX=ue[0],H.maxX=de[0],H.minY=ue[1],H.maxY=de[1],H.minZ=ue[2],H.maxZ=de[2],e(Un,H),i=kt;const tu=`${ce}/${Ae.length}`,eu=$.totalCount;e(ut,{scene:"large",lodTotalCount:eu,cuts:tu,visibleSplatCount:H.visibleSplatCount,modelSplatCount:H.modelSplatCount}),o||(o=!0,e(L).viewerEvents?.fire(Kt,!0))}function v(){if(!A?.splatTiles)return;const k=dt?A.splatTiles.mobileLodCacheCount||6e6:A.splatTiles.pcLodCacheCount||3e7;if(!(A.downloadSplatCount<k)&&a++%6==0&&A.downloadSplatCount>k){const Q=[];for(let R of Object.keys(A.splatTiles.files)){let U=A.splatTiles.files[R];U.downloadCount&&Q.push(U)}Q.sort((R,U)=>U.lastTime-R.lastTime);let T=A.downloadSplatCount,F=0;for(;Q.length&&T>k;){const R=Q.pop();F+=R.downloadCount,T-=F,R.downloadCount=0,R.downloadData=null,R.abortController=null,R.lastTime=0,R.spxHeader=null,R.status=Rt.None}A.downloadSplatCount-=F}}function M(k,Q){const T=k.map(U=>1/(U.distance+1e-6)),F=T.reduce((U,P)=>U+P,0);let R=0;if(k.forEach((U,P)=>{U.currentRenderCnt=Math.min(Math.floor(T[P]/F*Q),U.splatCount),R+=U.currentRenderCnt}),R<Q){const U=Q-R,P=k.map((_,H)=>_.currentRenderCnt<_.splatCount?T[H]:0),q=P.reduce((_,H)=>_+H,0);k.forEach((_,H)=>{if(q>0&&_.currentRenderCnt<_.splatCount){const lt=Math.min(Math.floor(P[H]/q*U),_.splatCount-_.currentRenderCnt);_.currentRenderCnt+=lt}})}}function S(k,Q,T,F){if(F.distance=Math.max(F.center.distanceTo(Q)-F.radius,0),!F.distance||F.center.distanceTo(T)<=2*F.radius)return!0;const R=new d.Vector4(F.center.x,F.center.y,F.center.z,1).applyMatrix4(k),U=3*R.w;return!(R.z<-U||R.x<-U||R.x>U||R.y<-U||R.y>U)}function N(k){if(!m){if(A.header){m=!0;const Q=new d.Vector3(A.header.MinX,A.header.MinY,A.header.MinZ),T=new d.Vector3(A.header.MaxX,A.header.MaxY,A.header.MaxZ);e(Rs,Q.x,Q.y,Q.z,T.x,T.y,T.z,A.meta.showBoundBox)}else if(k){m=!0;const Q=new d.Vector3(A.minX,A.minY,A.minZ),T=new d.Vector3(A.maxX,A.maxY,A.maxZ);e(Rs,Q.x,Q.y,Q.z,T.x,T.y,T.z,A.meta.showBoundBox)}}}function Y(){if(!s){if(s=!0,A?.abortController?.abort(),A?.map?.clear(),A?.splatTiles){for(let k of Object.values(A.splatTiles.files))k.abortController?.abort();A.splatTiles.environment?.abortController?.abort()}A=null,c=null,u=null,l=null}}function z(k){if(k.opts.format==="spx")pa(k);else if(k.opts.format==="splat")ic(k);else if(k.opts.format==="ply")sc(k);else if(k.opts.format==="spz")ma(k);else if(k.opts.format==="sog")ya(k);else return!1;return!0}function W(k,Q){if(s)return;const T=e(L),F=dt?T.maxRenderCountOfMobile:T.maxRenderCountOfPc,R=e(Qt);if(k.fetchReload=HA(Q.updateDate||0),A=new js(k,Q),R){const P=Q.pcDownloadLimitSplatCount||aA,q=Q.mobileDownloadLimitSplatCount||oA;A.fetchLimit=dt?q:P}else A.fetchLimit=F;const U=()=>{if(!A||A.status==V.Invalid||A.status==V.FetchFailed)return D(0);A.modelSplatCount>0?(D(A.modelSplatCount),!A.meta.particleMode&&A.dataSplatCount?setTimeout(()=>e(so),5):setTimeout(U,10)):setTimeout(U,10)};if(U(),!z(A)){console.error("Unsupported format:",k.format),e(Ke,0);return}e(Is),e(ut,{cuts:""})}function O(k,Q){s||!k||!Q||(!A&&(A=new js({url:"fake.spx"})),!A.splatTiles&&(A.splatTiles=k),D(k.totalCount),gc(A,k,Q))}t($i,(k,Q)=>W(k,Q)),t(Gs,(k,Q)=>O(k,Q)),t(to,(k=1e4)=>Date.now()-i<k),t(eo,()=>Y()),e(pe,async()=>await x(h),()=>!s,dt?10:6),lc(n)}var Jn=(n=>(n[n.ModelCenterCirccle=1]="ModelCenterCirccle",n[n.ScreenCenterCircle=2]="ScreenCenterCircle",n[n.ScreenMiddleToLeftRight=3]="ScreenMiddleToLeftRight",n[n.ScreenMiddleToTopBottom=4]="ScreenMiddleToTopBottom",n))(Jn||{});const Ba="currentVisibleRadius",Qa="currentLightRadius",hc="splatTextureWidth",ba="transitionEffect",ci="splatShTexture12",Sa="maxPixelDiameter",xa="minPixelDiameter",li="activeFlagValue",ui="splatShTexture3",Ma="shPalettesReady",va="performanceNow",Kn="performanceAct",pc="waterMarkColor",Da="showWaterMark",ka="useSimilarExp",di="splatTexture0",gi="splatTexture1",Ta="particleMode",La="bigSceneMode",Ra="lightFactor",Fa="debugEffect",Ua="usingIndex",Cc="splatIndex",fi="shPalettes",Pa="maxRadius",Va="flagValue",Na="pointMode",_a="markPoint",Ha="shDegree",Ga="viewport",Wa="minAlpha",Ya="useLod",za="focal",Oa="topY";let et=0;et++;const Ja=`$${et++}`,mc=`$${et++}`;et++,et++,et++;const Ka=`$${et++}`,Ic=`$${et++}`,Xa=`$${et++}`,yc=`$${et++}`,wc=`$${et++}`,Ec=`$${et++}`,Bc=`$${et++}`,Qc=`$${et++}`;et++;const bc=`$${et++}`,Sc=`$${et++}`;et++;const xc=`$${et++}`;et++;const Mc=`$${et++}`;et++;const vc=`$${et++}`,Dc=`$${et++}`,kc=`$${et++}`,Tc=`$${et++}`,Lc=`$${et++}`,Rc=`$${et++}`,Fc=`$${et++}`,Uc=`$${et++}`,Pc=`$${et++}`,Vc=`$${et++}`,Za=`$${et++}`,Nc=`$${et++}`,_c=`$${et++}`,hi=`$${et++}`,ja=`$${et++}`,qa=`$${et++}`;var Hc=`precision highp float;\r
8
8
  precision highp int;
9
9
 
10
10
  uniform highp usampler2D splatTexture0, splatTexture1, splatShTexture12, splatShTexture3;\r
@@ -359,7 +359,7 @@ return;\r
359
359
 
360
360
  vec2 v2Center = vec2(pos2d) / pos2d.w;
361
361
  gl_Position = vec4(v2Center + vPosition.x * majorAxis / viewport + vPosition.y * minorAxis / viewport, 1.0, 1.0);\r
362
- }`,Oc=`precision highp float;
362
+ }`,Gc=`precision highp float;
363
363
 
364
364
  uniform float lightFactor;\r
365
365
  uniform float minAlpha;\r
@@ -390,7 +390,7 @@ void main() {\r
390
390
  }
391
391
 
392
392
  gl_FragColor = vec4(lightFactor * vColor.rgb, alpha);\r
393
- }`,zc=`const float EXP4 = exp(-4.0);\r
393
+ }`,Wc=`const float EXP4 = exp(-4.0);\r
394
394
  const float INV_EXP4 = 1.0 / (1.0 - EXP4);
395
395
 
396
396
  bool fnWatermark(uvec4 cen) {\r
@@ -409,19 +409,19 @@ float fnExp(float r2) {\r
409
409
  return vec4(v4Color.rgb * fnWave(1.0, 1.6, time), v4Color.a);\r
410
410
  }\r
411
411
  return v4Color;\r
412
- }`,Jc=`vec3 WatermarkEffect(vec3 v3Cen, bool isWatermark, bool enableEffect, float time) {\r
412
+ }`,zc=`vec3 WatermarkEffect(vec3 v3Cen, bool isWatermark, bool enableEffect, float time) {\r
413
413
  if (isWatermark && enableEffect) {\r
414
414
  v3Cen.y += sin(time * 0.002 + v3Cen.x) * 0.1;
415
415
  }\r
416
416
  return v3Cen;\r
417
- }`;function Kc(n){let t=!1;const e=(I,d,p)=>n.on(I,d,p),s=(I,...d)=>n.fire(I,...d);let i=0,a=0;const o=[];let r=0,c=0;const A=960;let u=0;e(So,()=>u),e(fs,()=>{},!0),e(hs,()=>{},!0),e(hn,()=>{},!0),e(pn,()=>{},!0),e(Oi,async()=>{const I=new g.InstancedBufferGeometry;I.setIndex([0,1,2,0,2,3]);const d=new Float32Array(12),p=new g.BufferAttribute(d,3);I.setAttribute("position",p),p.setXYZ(0,-2,-2,0),p.setXYZ(1,-2,2,0),p.setXYZ(2,2,2,0),p.setXYZ(3,2,-2,0),p.needsUpdate=!0;let f=new g.InstancedBufferGeometry().copy(I);const D=await s(pe);if(t)return;const w=new Uint32Array(D),x=new g.InstancedBufferAttribute(w,1,!1);return x.setUsage(g.DynamicDrawUsage),x.needsUpdate=!0,f.setAttribute(Ic,x),f.instanceCount=0,e(Ki,(b,Q,y,S,v)=>{s(Zi,Q),w.set(b,0),x.clearUpdateRanges(),x.addUpdateRange(0,v),x.needsUpdate=!0,x.onUpload(()=>{s(Qo,Q),s(ut,{renderSplatCount:v})}),f.instanceCount=v,s(it),s(ut,{sortTime:`${y} / ${Date.now()-S}`,bucketBits:r,sortType:c})}),e(kr,()=>f),e(fs,()=>{x.array=null,f.dispose()},!0),f}),e(Po,()=>{const I={};return s(R).bigSceneMode&&(I.BigSceneMode=""),I}),e(zi,async()=>{if(t)return;const I=s(R),{texwidth:d,texheight:p}=s(on,await s(pe)),f=new g.ShaderMaterial({uniforms:s(Wi,d),vertexShader:l(Wc),fragmentShader:l(Oc),transparent:!0,alphaTest:1,blending:g.NormalBlending,depthTest:I.depthTest!==!1,depthWrite:!1,side:g.DoubleSide,defines:s(Po)}),D=new Uint32Array(d*p*4);let w=new g.DataTexture(D,d,p,g.RGBAIntegerFormat,g.UnsignedIntType);w.internalFormat="RGBA32UI",w.needsUpdate=!0,f.uniforms[fi].value=w;const x=s(bt)?p:1,b=new Uint32Array(d*x*4);let Q=new g.DataTexture(b,d,x,g.RGBAIntegerFormat,g.UnsignedIntType);Q.internalFormat="RGBA32UI",Q.needsUpdate=!0,f.uniforms[hi].value=Q;const y=await s(sn,1,d),S=new Uint32Array(d*y*4);let v=new g.DataTexture(S,d,y,g.RGBAIntegerFormat,g.UnsignedIntType);v.internalFormat="RGBA32UI",v.needsUpdate=!0,f.uniforms[ui].value=v;const M=await s(sn,3,d),N=new Uint32Array(d*M*4);let O=new g.DataTexture(N,d,M,g.RGBAIntegerFormat,g.UnsignedIntType);O.internalFormat="RGBA32UI",O.needsUpdate=!0,f.uniforms[gi].value=O;const z=new Uint8Array(A*4);z.fill(128);let W=new g.DataTexture(z,A,1,g.RGBAIntegerFormat,g.UnsignedByteType);W.internalFormat="RGBA8UI",W.needsUpdate=!0,f.uniforms[pi].value=W,f.needsUpdate=!0;let J=!1;e(Xi,B=>{if(!s(bt)){if(J&&!B.renderSplatCount)return;J=!B.renderSplatCount}const T=B.txdata;B.txdata=null;const F=new g.DataTexture(T,d,p,g.RGBAIntegerFormat,g.UnsignedIntType);F.onUpdate=()=>{B.textureReady=!0,B.textureReadyTime=Date.now(),m(B),s(ao,B.renderSplatCount)},F.internalFormat="RGBA32UI",F.needsUpdate=!0,B.index?(f.uniforms[hi].value=F,Q?.dispose(),Q=F):(f.uniforms[fi].value=F,w?.dispose(),w=F),f.needsUpdate=!0,s(it)}),e(bo,async B=>{if(s(bt)||!B||!B.length)return;const T=new Uint32Array(d*await s(sn,1,d)*4),F=new Uint8Array(T.buffer);for(let U=0,V=0;U<B.length;U++)F.set(B[U],V),V+=B[U].byteLength;const L=new g.DataTexture(T,d,y,g.RGBAIntegerFormat,g.UnsignedIntType);L.internalFormat="RGBA32UI",L.needsUpdate=!0,f.uniforms[ui].value=L,f.needsUpdate=!0,v?.dispose(),v=L,s(it)}),e(Bo,async B=>{if(s(bt)||!B||!B.length)return;const T=new Uint32Array(d*await s(sn,3,d)*4),F=new Uint8Array(T.buffer);for(let U=0,V=0;U<B.length;U++)F.set(B[U],V),V+=B[U].byteLength;const L=new g.DataTexture(T,d,y,g.RGBAIntegerFormat,g.UnsignedIntType);L.internalFormat="RGBA32UI",L.needsUpdate=!0,f.uniforms[gi].value=L,f.needsUpdate=!0,O?.dispose(),O=L,s(it)}),e(Gs,async B=>{if(!B||!B.length)return;const T=1024,F=new Uint8Array(A*T*4);F.fill(128),F.set(B);const L=new g.DataTexture(F,A,T,g.RGBAIntegerFormat,g.UnsignedByteType);W.internalFormat="RGBA8UI",L.onUpdate=()=>s(Uo),L.needsUpdate=!0,f.uniforms[pi].value=L,f.needsUpdate=!0,W?.dispose(),W=L,s(it)}),e(Ji,()=>f),e(hn,()=>{const B=s(Qt),{width:T,height:F}=s(me),L=Math.abs(B.projectionMatrix.elements[0])*.5*T,U=Math.abs(B.projectionMatrix.elements[5])*.5*F,V=s(Ji);V.uniforms[Ka].value.set(L,U),V.uniformsNeedUpdate=!0,s(it)},!0),e(pn,()=>{const{width:B,height:T}=s(me);f.uniforms[za].value.set(B,T),f.uniformsNeedUpdate=!0,s(it)},!0),e(Zi,B=>{f.uniforms[Na].value=B,f.uniformsNeedUpdate=!0,s(it)}),e(To,B=>{f.uniforms[xa].value=B,f.uniformsNeedUpdate=!0,s(it)}),e(Ce,B=>{const T=s(R);B===void 0&&(B=!T.pointcloudMode),f.uniforms[Ga].value=B,f.uniformsNeedUpdate=!0,T.pointcloudMode=B,s(it),T.viewerEvents&&(T.viewerEvents.fire(R).pointcloudMode=B)}),e(ji,B=>{f.uniforms[Ua].value=B,f.uniformsNeedUpdate=!0;const T=s(R);T.bigSceneMode=B,s(it)}),e(Vo,B=>{f.uniforms[Ja].value=B,f.uniformsNeedUpdate=!0,s(it)}),e(ze,B=>{f.uniforms[Pa].value=B,f.uniformsNeedUpdate=!0;const T=s(R);T.lightFactor=B,s(it)});let k=!1;return e(qi,B=>{s(bt)||k||(k=!0,f.uniforms[Xa].value=B,f.uniformsNeedUpdate=!0,s(it))}),e(Ye,B=>{f.uniforms[Sa].value=B,f.uniformsNeedUpdate=!0,s(it)}),e(Je,B=>{f.uniforms[Ma].value=B,f.uniformsNeedUpdate=!0,s(it)}),e(ko,B=>{f.uniforms[Ha].value=B,f.uniformsNeedUpdate=!0,s(it)}),e(Cn,(B,T,F,L)=>{f.uniforms[Wa].value=[B,T,F,L?1:-1],f.uniformsNeedUpdate=!0,s(it)}),e(gs,(B=!0)=>{f.uniforms[La].value=B,f.uniformsNeedUpdate=!0,s(it)}),e(Uo,(B=!0)=>{f.uniforms[ka].value=B,f.uniformsNeedUpdate=!0,s(it)}),e($i,B=>{f.uniforms[Ta].value=B,f.uniformsNeedUpdate=!0}),e(Vn,B=>{f.uniforms[Xn].value=B,f.uniformsNeedUpdate=!0,s(it)}),e(Us,(B,T)=>{f.uniforms[Da].value=B,f.uniforms[va].value=T,f.uniformsNeedUpdate=!0,s(it)}),e(Ps,B=>{f.uniforms[Ya].value=Math.min(Math.max(0,B),255)/255,f.uniformsNeedUpdate=!0,s(it)}),e(Vs,(B=!1)=>{f.uniforms[Ra].value=B,f.uniformsNeedUpdate=!0,s(it)}),e(Nn,B=>{f.uniforms[Fa].value=B,f.uniformsNeedUpdate=!0,s(it)}),e(Tr,B=>{f.uniforms[Va].value=B,f.uniformsNeedUpdate=!0}),e(Ke,async B=>{const T=await s(Ls);u=Math.max(0,Math.min(B,T)),f.uniforms[Oa].value=u,f.uniformsNeedUpdate=!0,s(ut,{shDegree:`${u} / max ${T}`}),s(it)}),e(Gr,(B=0,T=0)=>{f.uniforms[_a].value=B<<16|T,f.uniforms[Xn].value=performance.now(),f.uniformsNeedUpdate=!0,s(it)}),e(Wr,(B=-1)=>{if(B<0)return f.uniforms[di].value;f.uniforms[di].value=B,f.uniforms[Xn].value=performance.now(),f.uniformsNeedUpdate=!0,s(it)}),e(hs,()=>{f.dispose(),w&&w.dispose(),Q&&Q.dispose(),v&&v.dispose(),O&&O.dispose(),W?.dispose()},!0),f});function l(I){return cn.cmn=zc.trim(),cn.FvEffect=(cn["custom-FvEffect"]||Yc).trim(),cn.WatermarkEffect=(cn["custom-WatermarkEffect"]||Jc).trim(),`#include <cmn>
417
+ }`;function Oc(n){let t=!1;const e=(I,g,p)=>n.on(I,g,p),s=(I,...g)=>n.fire(I,...g);let i=0,a=0;const o=[];let r=0,c=0;const A=960;let u=0;e(Qo,()=>u),e(gs,()=>{},!0),e(fs,()=>{},!0),e(fn,()=>{},!0),e(hn,()=>{},!0),e(Gi,async()=>{const I=new d.InstancedBufferGeometry;I.setIndex([0,1,2,0,2,3]);const g=new Float32Array(12),p=new d.BufferAttribute(g,3);I.setAttribute("position",p),p.setXYZ(0,-2,-2,0),p.setXYZ(1,-2,2,0),p.setXYZ(2,2,2,0),p.setXYZ(3,2,-2,0),p.needsUpdate=!0;let f=new d.InstancedBufferGeometry().copy(I);const D=await s(Ce);if(t)return;const w=new Uint32Array(D),x=new d.InstancedBufferAttribute(w,1,!1);return x.setUsage(d.DynamicDrawUsage),x.needsUpdate=!0,f.setAttribute(Cc,x),f.instanceCount=0,e(Oi,(b,B,y,v,M)=>{s(Ki,B),w.set(b,0),x.clearUpdateRanges(),x.addUpdateRange(0,M),x.needsUpdate=!0,x.onUpload(()=>{s(wo,B),s(ut,{renderSplatCount:M})}),f.instanceCount=M,s(ot),s(ut,{sortTime:`${y} / ${Date.now()-v}`,bucketBits:r,sortType:c})}),e(Mr,()=>f),e(gs,()=>{x.array=null,f.dispose()},!0),f}),e(Fo,()=>{const I={};return s(L).bigSceneMode&&(I.BigSceneMode=""),I}),e(Wi,async()=>{if(t)return;const I=s(L),{texwidth:g,texheight:p}=s(sn,await s(Ce)),f=new d.ShaderMaterial({uniforms:s(Hi,g),vertexShader:l(Hc),fragmentShader:l(Gc),transparent:!0,alphaTest:1,blending:d.NormalBlending,depthTest:I.depthTest!==!1,depthWrite:!1,side:d.DoubleSide,defines:s(Fo)}),D=new Uint32Array(g*p*4);let w=new d.DataTexture(D,g,p,d.RGBAIntegerFormat,d.UnsignedIntType);w.internalFormat="RGBA32UI",w.needsUpdate=!0,f.uniforms[di].value=w;const x=s(Qt)?p:1,b=new Uint32Array(g*x*4);let B=new d.DataTexture(b,g,x,d.RGBAIntegerFormat,d.UnsignedIntType);B.internalFormat="RGBA32UI",B.needsUpdate=!0,f.uniforms[gi].value=B;const y=await s(nn,1,g),v=new Uint32Array(g*y*4);let M=new d.DataTexture(v,g,y,d.RGBAIntegerFormat,d.UnsignedIntType);M.internalFormat="RGBA32UI",M.needsUpdate=!0,f.uniforms[ci].value=M;const S=await s(nn,3,g),N=new Uint32Array(g*S*4);let Y=new d.DataTexture(N,g,S,d.RGBAIntegerFormat,d.UnsignedIntType);Y.internalFormat="RGBA32UI",Y.needsUpdate=!0,f.uniforms[ui].value=Y;const z=new Uint8Array(A*4);z.fill(128);let W=new d.DataTexture(z,A,1,d.RGBAIntegerFormat,d.UnsignedByteType);W.internalFormat="RGBA8UI",W.needsUpdate=!0,f.uniforms[fi].value=W,f.needsUpdate=!0;let O=!1;e(Ji,Q=>{if(!s(Qt)){if(O&&!Q.renderSplatCount)return;O=!Q.renderSplatCount}const T=Q.txdata;Q.txdata=null;const F=new d.DataTexture(T,g,p,d.RGBAIntegerFormat,d.UnsignedIntType);F.onUpdate=()=>{Q.textureReady=!0,Q.textureReadyTime=Date.now(),m(Q),s(io,Q.renderSplatCount)},F.internalFormat="RGBA32UI",F.needsUpdate=!0,Q.index?(f.uniforms[gi].value=F,B?.dispose(),B=F):(f.uniforms[di].value=F,w?.dispose(),w=F),f.needsUpdate=!0,s(ot)}),e(Eo,async Q=>{if(s(Qt)||!Q||!Q.length)return;const T=new Uint32Array(g*await s(nn,1,g)*4),F=new Uint8Array(T.buffer);for(let U=0,P=0;U<Q.length;U++)F.set(Q[U],P),P+=Q[U].byteLength;const R=new d.DataTexture(T,g,y,d.RGBAIntegerFormat,d.UnsignedIntType);R.internalFormat="RGBA32UI",R.needsUpdate=!0,f.uniforms[ci].value=R,f.needsUpdate=!0,M?.dispose(),M=R,s(ot)}),e(Bo,async Q=>{if(s(Qt)||!Q||!Q.length)return;const T=new Uint32Array(g*await s(nn,3,g)*4),F=new Uint8Array(T.buffer);for(let U=0,P=0;U<Q.length;U++)F.set(Q[U],P),P+=Q[U].byteLength;const R=new d.DataTexture(T,g,y,d.RGBAIntegerFormat,d.UnsignedIntType);R.internalFormat="RGBA32UI",R.needsUpdate=!0,f.uniforms[ui].value=R,f.needsUpdate=!0,Y?.dispose(),Y=R,s(ot)}),e(Hs,async Q=>{if(!Q||!Q.length)return;const T=1024,F=new Uint8Array(A*T*4);F.fill(128),F.set(Q);const R=new d.DataTexture(F,A,T,d.RGBAIntegerFormat,d.UnsignedByteType);W.internalFormat="RGBA8UI",R.onUpdate=()=>s(Ro),R.needsUpdate=!0,f.uniforms[fi].value=R,f.needsUpdate=!0,W?.dispose(),W=R,s(ot)}),e(zi,()=>f),e(fn,()=>{const Q=s(Bt),{width:T,height:F}=s(Ie),R=Math.abs(Q.projectionMatrix.elements[0])*.5*T,U=Math.abs(Q.projectionMatrix.elements[5])*.5*F,P=s(zi);P.uniforms[za].value.set(R,U),P.uniformsNeedUpdate=!0,s(ot)},!0),e(hn,()=>{const{width:Q,height:T}=s(Ie);f.uniforms[Ga].value.set(Q,T),f.uniformsNeedUpdate=!0,s(ot)},!0),e(Ki,Q=>{f.uniforms[Ua].value=Q,f.uniformsNeedUpdate=!0,s(ot)}),e(Do,Q=>{f.uniforms[ba].value=Q,f.uniformsNeedUpdate=!0,s(ot)}),e(me,Q=>{const T=s(L);Q===void 0&&(Q=!T.pointcloudMode),f.uniforms[Na].value=Q,f.uniformsNeedUpdate=!0,T.pointcloudMode=Q,s(ot),T.viewerEvents&&(T.viewerEvents.fire(L).pointcloudMode=Q)}),e(Xi,Q=>{f.uniforms[La].value=Q,f.uniformsNeedUpdate=!0;const T=s(L);T.bigSceneMode=Q,s(ot)}),e(Uo,Q=>{f.uniforms[Ya].value=Q,f.uniformsNeedUpdate=!0,s(ot)}),e(Ye,Q=>{f.uniforms[Ra].value=Q,f.uniformsNeedUpdate=!0;const T=s(L);T.lightFactor=Q,s(ot)});let k=!1;return e(Zi,Q=>{s(Qt)||k||(k=!0,f.uniforms[Oa].value=Q,f.uniformsNeedUpdate=!0,s(ot))}),e(ze,Q=>{f.uniforms[Ba].value=Q,f.uniformsNeedUpdate=!0,s(ot)}),e(Oe,Q=>{f.uniforms[Qa].value=Q,f.uniformsNeedUpdate=!0,s(ot)}),e(vo,Q=>{f.uniforms[Pa].value=Q,f.uniformsNeedUpdate=!0,s(ot)}),e(pn,(Q,T,F,R)=>{f.uniforms[_a].value=[Q,T,F,R?1:-1],f.uniformsNeedUpdate=!0,s(ot)}),e(ds,(Q=!0)=>{f.uniforms[Da].value=Q,f.uniformsNeedUpdate=!0,s(ot)}),e(Ro,(Q=!0)=>{f.uniforms[Ma].value=Q,f.uniformsNeedUpdate=!0,s(ot)}),e(ji,Q=>{f.uniforms[va].value=Q,f.uniformsNeedUpdate=!0}),e(Pn,Q=>{f.uniforms[Kn].value=Q,f.uniformsNeedUpdate=!0,s(ot)}),e(Fs,(Q,T)=>{f.uniforms[xa].value=Q,f.uniforms[Sa].value=T,f.uniformsNeedUpdate=!0,s(ot)}),e(Us,Q=>{f.uniforms[Wa].value=Math.min(Math.max(0,Q),255)/255,f.uniformsNeedUpdate=!0,s(ot)}),e(Ps,(Q=!1)=>{f.uniforms[ka].value=Q,f.uniformsNeedUpdate=!0,s(ot)}),e(Vn,Q=>{f.uniforms[Ta].value=Q,f.uniformsNeedUpdate=!0,s(ot)}),e(vr,Q=>{f.uniforms[Fa].value=Q,f.uniformsNeedUpdate=!0}),e(Je,async Q=>{const T=await s(Ts);u=Math.max(0,Math.min(Q,T)),f.uniforms[Ha].value=u,f.uniformsNeedUpdate=!0,s(ut,{shDegree:`${u} / max ${T}`}),s(ot)}),e(Nr,(Q=0,T=0)=>{f.uniforms[Va].value=Q<<16|T,f.uniforms[Kn].value=performance.now(),f.uniformsNeedUpdate=!0,s(ot)}),e(_r,(Q=-1)=>{if(Q<0)return f.uniforms[li].value;f.uniforms[li].value=Q,f.uniforms[Kn].value=performance.now(),f.uniformsNeedUpdate=!0,s(ot)}),e(fs,()=>{f.dispose(),w&&w.dispose(),B&&B.dispose(),M&&M.dispose(),Y&&Y.dispose(),W?.dispose()},!0),f});function l(I){return An.cmn=Wc.trim(),An.FvEffect=(An["custom-FvEffect"]||Yc).trim(),An.WatermarkEffect=(An["custom-WatermarkEffect"]||zc).trim(),`#include <cmn>
418
418
  #include <FvEffect>
419
419
  #include <WatermarkEffect>
420
- `+I}e(Yi,async()=>{const I=new g.Mesh(await s(Oi),await s(zi));return s(hn),s(pn),s(ji,s(bt)),s(Ce,s(ms)),I});function C(){s(hn),s(pn)}window.addEventListener("resize",C),e(io,()=>{t=!0,window.removeEventListener("resize",C),s(fs),s(hs)}),e(Ns,()=>{if(!s(Lo))return;const I=s(R),d=s(xt)?.meta||{},p=I.qualityLevel||vt.Default5;if(s(Ke,[0,1,2,3,3,3,3,3,3][p-1]),dt){const D=[4,3,3,2,1,1,1,1,1],w=[128,128,128,256,256,256,512,512,512],x=[7,6,5,4,4,3,2,2,2],b=d.minPixelDiameter||D[p-1],Q=d.maxPixelDiameter||w[p-1];s(Us,b,Q),s(Ps,d.minAlpha||x[p-1]),s(Vs,p<vt.L4)}else{const D=[2,2,2,1,1,1,1,1,1],w=[128,256,256,512,512,1024,1024,1024,1024],x=[5,4,3,2,2,1,1,1,1],b=d.minPixelDiameter||D[p-1],Q=d.maxPixelDiameter||w[p-1];s(Us,b,Q),s(Ps,d.minAlpha||x[p-1]),s(Vs,p<vt.L2)}s(_s)}),e(oo,async()=>{if(s(bt))return;if(s(R).disableTransitionEffectOnLoad)return s(Ye,0);let d=.01,p=.01,f=!1,D=0;s(Ye,p),s(he,()=>{if(t)return;p+=(a-p)*d,s(Ye,p);let w=s(ro);w&&!D&&(D=Date.now());let x=p/i;w&&(x>.9||Date.now()-D>2500)?(s(ms)&&s(Is,!0),s(Ye,0),f=!0):w&&x>.7?d=Math.min(d*1.2,.3):w&&x>.5?d=Math.min(d*1.2,.2):x>.4&&(d=Math.min(d*1.05,.1))},()=>!t&&!f,3)}),e(Is,(I=!1)=>{if(s(bt))return;const d=s(R);if(s(To,d.transitionEffect),d.transitionEffect===Kn.ModelCenterCirccle){for(;o.length;)o.pop().stop=!0;const p=i*.001;let f={currentPointMode:d.pointcloudMode,stepRate:.0015,currentLightRadius:p,stop:!1};o.push(f),s(he,()=>{t||(f.currentLightRadius+=i*f.stepRate,s(Je,f.currentLightRadius),f.currentLightRadius>i?(s(Ce,!f.currentPointMode),s(Je,0),f.stop=!0,o.length===1&&o[0]===f&&o.pop(),s(De,I)):f.currentLightRadius/i<.4?f.stepRate=Math.min(f.stepRate*1.02,.03):f.stepRate*=1.04)},()=>!t&&!f.stop)}else s(Vn,performance.now()),s(Je,.1),setTimeout(()=>{s(Ce),s(Je,0),s(De,I)},500)}),e(De,(I=!1)=>{s(bt)||(s(Nn,0),I&&s(R).viewerEvents?.fire(qe),s(R).viewerEvents?.fire(yo))},!0),e(Wi,I=>({[Cc]:{type:"int",value:I},[fi]:{type:"t",value:null},[hi]:{type:"t",value:null},[ui]:{type:"t",value:null},[gi]:{type:"t",value:null},[pi]:{type:"t",value:null},[ka]:{type:"bool",value:!1},[Ka]:{type:"v2",value:new g.Vector2},[za]:{type:"v2",value:new g.Vector2},[Na]:{type:"int",value:0},[xa]:{type:"int",value:1},[Ga]:{type:"bool",value:!1},[Va]:{type:"bool",value:!0},[Ua]:{type:"bool",value:!1},[Ja]:{type:"bool",value:!1},[Oa]:{type:"int",value:0},[Pa]:{type:"float",value:1},[Xa]:{type:"float",value:0},[Sa]:{type:"float",value:0},[Ma]:{type:"float",value:0},[Ha]:{type:"float",value:0},[Wa]:{type:"v4",value:new g.Vector4(0,0,0,-1)},[Fa]:{type:"int",value:0},[Ta]:{type:"float",value:performance.now()},[Xn]:{type:"float",value:0},[Da]:{type:"float",value:1},[va]:{type:"float",value:1024},[Ya]:{type:"float",value:2/255},[mc]:{type:"v4",value:new g.Vector4(1,1,0,.5)},[La]:{type:"bool",value:!1},[Ra]:{type:"bool",value:!0},[_a]:{type:"uint",value:1},[di]:{type:"uint",value:0}}));const h=s(Fi);h.onmessage=I=>{const d=I.data;if(d[Za]){r=d[Gc],c=d[Ci];const p=d[Za];s(Ki,p,d[ja],d[Bc],d[bc],d[qa]),p.length&&h.postMessage({[yc]:p},[p.buffer])}},e(Pn,(I,d,p)=>{s(bt)||(a=d,i=p),s(Xi,I)});function m(I){const d=I.xyz.slice(0);h.postMessage({[Sc]:!0,[Dc]:d,[Vc]:I.watermarkCount,[ja]:I.index,[wc]:I.version,[qa]:I.renderSplatCount,[Ec]:I.visibleSplatCount,[Qc]:I.modelSplatCount,[kc]:I.minX,[Tc]:I.maxX,[Lc]:I.minY,[Rc]:I.maxY,[Fc]:I.minZ,[Uc]:I.maxZ},[d.buffer])}}function Xc(n){const t=(i,...a)=>n.fire(i,...a),e=(i,a,o)=>n.on(i,a,o),s=new Set(iA.split(""));e(mo,async(i="",a=!0,o=!0,r="")=>{const c=i.trim().substring(0,100);let A=await t(Li,c,r),u=[];for(let w=0;w<A.length;w++){let x=[],b=A[w];for(let Q=0;Q<b.length;Q++)x.push([(b[Q]%20-10)*.02,((b[Q]/20|0)-10)*.02]);u.push(x)}let l=[],C=c.split("");for(let w=0;w<C.length;w++)l[w]=s.has(C[w])?.22:.4;let h=C.length/2|0,m=l[h]/2,I=!(C.length%2),d=I?0:-m;for(let w=h-1;w>=0;w--){d-=l[w]/2;for(let x of u[w])x[0]+=d;d-=l[w]/2}m=l[h]/2,d=I?0:m;for(let w=u.length-h;w<u.length;w++){d+=l[w]/2;for(let x of u[w])x[0]+=d;d+=l[w]/2}let p=0;for(let w of u)p+=w.length;const f=new Uint8Array(p*K);let D=0;for(let w of u)for(let x of w)f.set(await $A(x[0],x[1],a,o),K*D++);return f})}function mi(n){const t=(e,s,i)=>n.on(e,s,i);t(se,e=>{e.url;const s={...e};delete s.url;const i=JSON.stringify(s,null,2);console.info(i)}),t(Li,(e="",s="")=>{const i="https://reall3d.com/gsfont/api/getGaussianText",a=new FormData;return a.append("text",e.substring(0,100)),a.append("fmt",s),a.append("ver",_n),a.append("tk",sessionStorage.getItem("tk-gstext")||""),new Promise(o=>{fetch(i,{method:"POST",body:a}).then(r=>r.ok?r.json():{}).then(r=>r.success?o(JSON.parse(r.data)):o([])).catch(r=>o([]))})})}const Zc=/^[og]\s*(.+)?/,jc=/^mtllib /,qc=/^usemtl /,$c=/^usemap /,nr=/\s+/,sr=new g.Vector3,Ii=new g.Vector3,ir=new g.Vector3,or=new g.Vector3,Ht=new g.Vector3,Zn=new g.Color;function tl(){const n={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(t,e){if(this.object&&this.object.fromDeclaration===!1){this.object.name=t,this.object.fromDeclaration=e!==!1;return}const s=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:t||"",fromDeclaration:e!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(i,a){const o=this._finalize(!1);o&&(o.inherited||o.groupCount<=0)&&this.materials.splice(o.index,1);const r={index:this.materials.length,name:i||"",mtllib:Array.isArray(a)&&a.length>0?a[a.length-1]:"",smooth:o!==void 0?o.smooth:this.smooth,groupStart:o!==void 0?o.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(c){const A={index:typeof c=="number"?c:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return A.clone=this.clone.bind(A),A}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(i){const a=this.currentMaterial();if(a&&a.groupEnd===-1&&(a.groupEnd=this.geometry.vertices.length/3,a.groupCount=a.groupEnd-a.groupStart,a.inherited=!1),i&&this.materials.length>1)for(let o=this.materials.length-1;o>=0;o--)this.materials[o].groupCount<=0&&this.materials.splice(o,1);return i&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),a}},s&&s.name&&typeof s.clone=="function"){const i=s.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(t,e){const s=parseInt(t,10);return(s>=0?s-1:s+e/3)*3},parseNormalIndex:function(t,e){const s=parseInt(t,10);return(s>=0?s-1:s+e/3)*3},parseUVIndex:function(t,e){const s=parseInt(t,10);return(s>=0?s-1:s+e/2)*2},addVertex:function(t,e,s){const i=this.vertices,a=this.object.geometry.vertices;a.push(i[t+0],i[t+1],i[t+2]),a.push(i[e+0],i[e+1],i[e+2]),a.push(i[s+0],i[s+1],i[s+2])},addVertexPoint:function(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addVertexLine:function(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addNormal:function(t,e,s){const i=this.normals,a=this.object.geometry.normals;a.push(i[t+0],i[t+1],i[t+2]),a.push(i[e+0],i[e+1],i[e+2]),a.push(i[s+0],i[s+1],i[s+2])},addFaceNormal:function(t,e,s){const i=this.vertices,a=this.object.geometry.normals;sr.fromArray(i,t),Ii.fromArray(i,e),ir.fromArray(i,s),Ht.subVectors(ir,Ii),or.subVectors(sr,Ii),Ht.cross(or),Ht.normalize(),a.push(Ht.x,Ht.y,Ht.z),a.push(Ht.x,Ht.y,Ht.z),a.push(Ht.x,Ht.y,Ht.z)},addColor:function(t,e,s){const i=this.colors,a=this.object.geometry.colors;i[t]!==void 0&&a.push(i[t+0],i[t+1],i[t+2]),i[e]!==void 0&&a.push(i[e+0],i[e+1],i[e+2]),i[s]!==void 0&&a.push(i[s+0],i[s+1],i[s+2])},addUV:function(t,e,s){const i=this.uvs,a=this.object.geometry.uvs;a.push(i[t+0],i[t+1]),a.push(i[e+0],i[e+1]),a.push(i[s+0],i[s+1])},addDefaultUV:function(){const t=this.object.geometry.uvs;t.push(0,0),t.push(0,0),t.push(0,0)},addUVLine:function(t){const e=this.uvs;this.object.geometry.uvs.push(e[t+0],e[t+1])},addFace:function(t,e,s,i,a,o,r,c,A){const u=this.vertices.length;let l=this.parseVertexIndex(t,u),C=this.parseVertexIndex(e,u),h=this.parseVertexIndex(s,u);if(this.addVertex(l,C,h),this.addColor(l,C,h),r!==void 0&&r!==""){const m=this.normals.length;l=this.parseNormalIndex(r,m),C=this.parseNormalIndex(c,m),h=this.parseNormalIndex(A,m),this.addNormal(l,C,h)}else this.addFaceNormal(l,C,h);if(i!==void 0&&i!==""){const m=this.uvs.length;l=this.parseUVIndex(i,m),C=this.parseUVIndex(a,m),h=this.parseUVIndex(o,m),this.addUV(l,C,h),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(t){this.object.geometry.type="Points";const e=this.vertices.length;for(let s=0,i=t.length;s<i;s++){const a=this.parseVertexIndex(t[s],e);this.addVertexPoint(a),this.addColor(a)}},addLineGeometry:function(t,e){this.object.geometry.type="Line";const s=this.vertices.length,i=this.uvs.length;for(let a=0,o=t.length;a<o;a++)this.addVertexLine(this.parseVertexIndex(t[a],s));for(let a=0,o=e.length;a<o;a++)this.addUVLine(this.parseUVIndex(e[a],i))}};return n.startObject("",!1),n}class el extends g.Loader{constructor(t){super(t),this.materials=null}load(t,e,s,i){const a=this,o=new g.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(r){try{e(a.parse(r))}catch(c){i?i(c):console.error(c),a.manager.itemError(t)}},s,i)}setMaterials(t){return this.materials=t,this}parse(t){const e=new tl;t.indexOf(`\r
420
+ `+I}e(Yi,async()=>{const I=new d.Mesh(await s(Gi),await s(Wi));return s(fn),s(hn),s(Xi,s(Qt)),s(me,s(Cs)),I});function C(){s(fn),s(hn)}window.addEventListener("resize",C),e(no,()=>{t=!0,window.removeEventListener("resize",C),s(gs),s(fs)}),e(Vs,()=>{if(!s(ko))return;const I=s(L),g=s(Mt)?.meta||{},p=I.qualityLevel||vt.Default5;if(s(Je,[0,1,2,3,3,3,3,3,3][p-1]),dt){const D=[4,3,3,2,1,1,1,1,1],w=[128,128,128,256,256,256,512,512,512],x=[7,6,5,4,4,3,2,2,2],b=g.minPixelDiameter||D[p-1],B=g.maxPixelDiameter||w[p-1];s(Fs,b,B),s(Us,g.minAlpha||x[p-1]),s(Ps,p<vt.L4)}else{const D=[2,2,2,1,1,1,1,1,1],w=[128,256,256,512,512,1024,1024,1024,1024],x=[5,4,3,2,2,1,1,1,1],b=g.minPixelDiameter||D[p-1],B=g.maxPixelDiameter||w[p-1];s(Fs,b,B),s(Us,g.minAlpha||x[p-1]),s(Ps,p<vt.L2)}s(_s)}),e(so,async()=>{if(s(Qt))return;if(s(L).disableTransitionEffectOnLoad)return s(ze,0);let g=.01,p=.01,f=!1,D=0;s(ze,p),s(pe,()=>{if(t)return;p+=(a-p)*g,s(ze,p);let w=s(oo);w&&!D&&(D=Date.now());let x=p/i;w&&(x>.9||Date.now()-D>2500)?(s(Cs)&&s(ms,!0),s(ze,0),f=!0):w&&x>.7?g=Math.min(g*1.2,.3):w&&x>.5?g=Math.min(g*1.2,.2):x>.4&&(g=Math.min(g*1.05,.1))},()=>!t&&!f,3)}),e(ms,(I=!1)=>{if(s(Qt))return;const g=s(L);if(s(Do,g.transitionEffect),g.transitionEffect===Jn.ModelCenterCirccle){for(;o.length;)o.pop().stop=!0;const p=i*.001;let f={currentPointMode:g.pointcloudMode,stepRate:.0015,currentLightRadius:p,stop:!1};o.push(f),s(pe,()=>{t||(f.currentLightRadius+=i*f.stepRate,s(Oe,f.currentLightRadius),f.currentLightRadius>i?(s(me,!f.currentPointMode),s(Oe,0),f.stop=!0,o.length===1&&o[0]===f&&o.pop(),s(Te,I)):f.currentLightRadius/i<.4?f.stepRate=Math.min(f.stepRate*1.02,.03):f.stepRate*=1.04)},()=>!t&&!f.stop)}else s(Pn,performance.now()),s(Oe,.1),setTimeout(()=>{s(me),s(Oe,0),s(Te,I)},500)}),e(Te,(I=!1)=>{s(Qt)||(s(Vn,0),I&&s(L).viewerEvents?.fire(je),s(L).viewerEvents?.fire(mo))},!0),e(Hi,I=>({[hc]:{type:"int",value:I},[di]:{type:"t",value:null},[gi]:{type:"t",value:null},[ci]:{type:"t",value:null},[ui]:{type:"t",value:null},[fi]:{type:"t",value:null},[Ma]:{type:"bool",value:!1},[za]:{type:"v2",value:new d.Vector2},[Ga]:{type:"v2",value:new d.Vector2},[Ua]:{type:"int",value:0},[ba]:{type:"int",value:1},[Na]:{type:"bool",value:!1},[Fa]:{type:"bool",value:!0},[La]:{type:"bool",value:!1},[Ya]:{type:"bool",value:!1},[Ha]:{type:"int",value:0},[Ra]:{type:"float",value:1},[Oa]:{type:"float",value:0},[Ba]:{type:"float",value:0},[Qa]:{type:"float",value:0},[Pa]:{type:"float",value:0},[_a]:{type:"v4",value:new d.Vector4(0,0,0,-1)},[Ta]:{type:"int",value:0},[va]:{type:"float",value:performance.now()},[Kn]:{type:"float",value:0},[xa]:{type:"float",value:1},[Sa]:{type:"float",value:1024},[Wa]:{type:"float",value:2/255},[pc]:{type:"v4",value:new d.Vector4(1,1,0,.5)},[Da]:{type:"bool",value:!1},[ka]:{type:"bool",value:!0},[Va]:{type:"uint",value:1},[li]:{type:"uint",value:0}}));const h=s(Li);h.onmessage=I=>{const g=I.data;if(g[Ja]){r=g[_c],c=g[hi];const p=g[Ja];s(Oi,p,g[Ka],g[Bc],g[Ec],g[Xa]),p.length&&h.postMessage({[mc]:p},[p.buffer])}},e(Un,(I,g,p)=>{s(Qt)||(a=g,i=p),s(Ji,I)});function m(I){const g=I.xyz.slice(0);h.postMessage({[Qc]:!0,[Mc]:g,[Uc]:I.watermarkCount,[Ka]:I.index,[Ic]:I.version,[Xa]:I.renderSplatCount,[yc]:I.visibleSplatCount,[wc]:I.modelSplatCount,[vc]:I.minX,[Dc]:I.maxX,[kc]:I.minY,[Tc]:I.maxY,[Lc]:I.minZ,[Rc]:I.maxZ},[g.buffer])}}function Jc(n){const t=(i,...a)=>n.fire(i,...a),e=(i,a,o)=>n.on(i,a,o),s=new Set(eA.split(""));e(po,async(i="",a=!0,o=!0,r="")=>{const c=i.trim().substring(0,100);let A=await t(ki,c,r),u=[];for(let w=0;w<A.length;w++){let x=[],b=A[w];for(let B=0;B<b.length;B++)x.push([(b[B]%20-10)*.02,((b[B]/20|0)-10)*.02]);u.push(x)}let l=[],C=c.split("");for(let w=0;w<C.length;w++)l[w]=s.has(C[w])?.22:.4;let h=C.length/2|0,m=l[h]/2,I=!(C.length%2),g=I?0:-m;for(let w=h-1;w>=0;w--){g-=l[w]/2;for(let x of u[w])x[0]+=g;g-=l[w]/2}m=l[h]/2,g=I?0:m;for(let w=u.length-h;w<u.length;w++){g+=l[w]/2;for(let x of u[w])x[0]+=g;g+=l[w]/2}let p=0;for(let w of u)p+=w.length;const f=new Uint8Array(p*K);let D=0;for(let w of u)for(let x of w)f.set(await nc(x[0],x[1],a,o),K*D++);return f})}function pi(n){const t=(e,s,i)=>n.on(e,s,i);t(ie,e=>{e.url;const s={...e};delete s.url;const i=JSON.stringify(s,null,2);console.info(i)}),t(ki,(e="",s="")=>{const i="https://reall3d.com/gsfont/api/getGaussianText",a=new FormData;return a.append("text",e.substring(0,100)),a.append("fmt",s),a.append("ver",_n),a.append("tk",sessionStorage.getItem("tk-gstext")||""),new Promise(o=>{fetch(i,{method:"POST",body:a}).then(r=>r.ok?r.json():{}).then(r=>r.success?o(JSON.parse(r.data)):o([])).catch(r=>o([]))})})}const Kc=/^[og]\s*(.+)?/,Xc=/^mtllib /,Zc=/^usemtl /,jc=/^usemap /,$a=/\s+/,tr=new d.Vector3,Ci=new d.Vector3,er=new d.Vector3,nr=new d.Vector3,_t=new d.Vector3,Xn=new d.Color;function qc(){const n={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(t,e){if(this.object&&this.object.fromDeclaration===!1){this.object.name=t,this.object.fromDeclaration=e!==!1;return}const s=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:t||"",fromDeclaration:e!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(i,a){const o=this._finalize(!1);o&&(o.inherited||o.groupCount<=0)&&this.materials.splice(o.index,1);const r={index:this.materials.length,name:i||"",mtllib:Array.isArray(a)&&a.length>0?a[a.length-1]:"",smooth:o!==void 0?o.smooth:this.smooth,groupStart:o!==void 0?o.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(c){const A={index:typeof c=="number"?c:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return A.clone=this.clone.bind(A),A}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(i){const a=this.currentMaterial();if(a&&a.groupEnd===-1&&(a.groupEnd=this.geometry.vertices.length/3,a.groupCount=a.groupEnd-a.groupStart,a.inherited=!1),i&&this.materials.length>1)for(let o=this.materials.length-1;o>=0;o--)this.materials[o].groupCount<=0&&this.materials.splice(o,1);return i&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),a}},s&&s.name&&typeof s.clone=="function"){const i=s.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(t,e){const s=parseInt(t,10);return(s>=0?s-1:s+e/3)*3},parseNormalIndex:function(t,e){const s=parseInt(t,10);return(s>=0?s-1:s+e/3)*3},parseUVIndex:function(t,e){const s=parseInt(t,10);return(s>=0?s-1:s+e/2)*2},addVertex:function(t,e,s){const i=this.vertices,a=this.object.geometry.vertices;a.push(i[t+0],i[t+1],i[t+2]),a.push(i[e+0],i[e+1],i[e+2]),a.push(i[s+0],i[s+1],i[s+2])},addVertexPoint:function(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addVertexLine:function(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addNormal:function(t,e,s){const i=this.normals,a=this.object.geometry.normals;a.push(i[t+0],i[t+1],i[t+2]),a.push(i[e+0],i[e+1],i[e+2]),a.push(i[s+0],i[s+1],i[s+2])},addFaceNormal:function(t,e,s){const i=this.vertices,a=this.object.geometry.normals;tr.fromArray(i,t),Ci.fromArray(i,e),er.fromArray(i,s),_t.subVectors(er,Ci),nr.subVectors(tr,Ci),_t.cross(nr),_t.normalize(),a.push(_t.x,_t.y,_t.z),a.push(_t.x,_t.y,_t.z),a.push(_t.x,_t.y,_t.z)},addColor:function(t,e,s){const i=this.colors,a=this.object.geometry.colors;i[t]!==void 0&&a.push(i[t+0],i[t+1],i[t+2]),i[e]!==void 0&&a.push(i[e+0],i[e+1],i[e+2]),i[s]!==void 0&&a.push(i[s+0],i[s+1],i[s+2])},addUV:function(t,e,s){const i=this.uvs,a=this.object.geometry.uvs;a.push(i[t+0],i[t+1]),a.push(i[e+0],i[e+1]),a.push(i[s+0],i[s+1])},addDefaultUV:function(){const t=this.object.geometry.uvs;t.push(0,0),t.push(0,0),t.push(0,0)},addUVLine:function(t){const e=this.uvs;this.object.geometry.uvs.push(e[t+0],e[t+1])},addFace:function(t,e,s,i,a,o,r,c,A){const u=this.vertices.length;let l=this.parseVertexIndex(t,u),C=this.parseVertexIndex(e,u),h=this.parseVertexIndex(s,u);if(this.addVertex(l,C,h),this.addColor(l,C,h),r!==void 0&&r!==""){const m=this.normals.length;l=this.parseNormalIndex(r,m),C=this.parseNormalIndex(c,m),h=this.parseNormalIndex(A,m),this.addNormal(l,C,h)}else this.addFaceNormal(l,C,h);if(i!==void 0&&i!==""){const m=this.uvs.length;l=this.parseUVIndex(i,m),C=this.parseUVIndex(a,m),h=this.parseUVIndex(o,m),this.addUV(l,C,h),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(t){this.object.geometry.type="Points";const e=this.vertices.length;for(let s=0,i=t.length;s<i;s++){const a=this.parseVertexIndex(t[s],e);this.addVertexPoint(a),this.addColor(a)}},addLineGeometry:function(t,e){this.object.geometry.type="Line";const s=this.vertices.length,i=this.uvs.length;for(let a=0,o=t.length;a<o;a++)this.addVertexLine(this.parseVertexIndex(t[a],s));for(let a=0,o=e.length;a<o;a++)this.addUVLine(this.parseUVIndex(e[a],i))}};return n.startObject("",!1),n}class $c extends d.Loader{constructor(t){super(t),this.materials=null}load(t,e,s,i){const a=this,o=new d.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(r){try{e(a.parse(r))}catch(c){i?i(c):console.error(c),a.manager.itemError(t)}},s,i)}setMaterials(t){return this.materials=t,this}parse(t){const e=new qc;t.indexOf(`\r
421
421
  `)!==-1&&(t=t.replace(/\r\n/g,`
422
422
  `)),t.indexOf(`\\
423
423
  `)!==-1&&(t=t.replace(/\\\n/g,""));const s=t.split(`
424
- `);let i=[];for(let r=0,c=s.length;r<c;r++){const A=s[r].trimStart();if(A.length===0)continue;const u=A.charAt(0);if(u!=="#")if(u==="v"){const l=A.split(nr);switch(l[0]){case"v":e.vertices.push(parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3])),l.length>=7?(Zn.setRGB(parseFloat(l[4]),parseFloat(l[5]),parseFloat(l[6]),g.SRGBColorSpace),e.colors.push(Zn.r,Zn.g,Zn.b)):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3]));break;case"vt":e.uvs.push(parseFloat(l[1]),parseFloat(l[2]));break}}else if(u==="f"){const C=A.slice(1).trim().split(nr),h=[];for(let I=0,d=C.length;I<d;I++){const p=C[I];if(p.length>0){const f=p.split("/");h.push(f)}}const m=h[0];for(let I=1,d=h.length-1;I<d;I++){const p=h[I],f=h[I+1];e.addFace(m[0],p[0],f[0],m[1],p[1],f[1],m[2],p[2],f[2])}}else if(u==="l"){const l=A.substring(1).trim().split(" ");let C=[];const h=[];if(A.indexOf("/")===-1)C=l;else for(let m=0,I=l.length;m<I;m++){const d=l[m].split("/");d[0]!==""&&C.push(d[0]),d[1]!==""&&h.push(d[1])}e.addLineGeometry(C,h)}else if(u==="p"){const C=A.slice(1).trim().split(" ");e.addPointGeometry(C)}else if((i=Zc.exec(A))!==null){const l=(" "+i[0].slice(1).trim()).slice(1);e.startObject(l)}else if(qc.test(A))e.object.startMaterial(A.substring(7).trim(),e.materialLibraries);else if(jc.test(A))e.materialLibraries.push(A.substring(7).trim());else if($c.test(A))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(u==="s"){if(i=A.split(" "),i.length>1){const C=i[1].trim().toLowerCase();e.object.smooth=C!=="0"&&C!=="off"}else e.object.smooth=!0;const l=e.object.currentMaterial();l&&(l.smooth=e.object.smooth)}else{if(A==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+A+'"')}}e.finalize();const a=new g.Group;if(a.materialLibraries=[].concat(e.materialLibraries),!(e.objects.length===1&&e.objects[0].geometry.vertices.length===0)===!0)for(let r=0,c=e.objects.length;r<c;r++){const A=e.objects[r],u=A.geometry,l=A.materials,C=u.type==="Line",h=u.type==="Points";let m=!1;if(u.vertices.length===0)continue;const I=new g.BufferGeometry;I.setAttribute("position",new g.Float32BufferAttribute(u.vertices,3)),u.normals.length>0&&I.setAttribute("normal",new g.Float32BufferAttribute(u.normals,3)),u.colors.length>0&&(m=!0,I.setAttribute("color",new g.Float32BufferAttribute(u.colors,3))),u.hasUVIndices===!0&&I.setAttribute("uv",new g.Float32BufferAttribute(u.uvs,2));const d=[];for(let f=0,D=l.length;f<D;f++){const w=l[f],x=w.name+"_"+w.smooth+"_"+m;let b=e.materials[x];if(this.materials!==null){if(b=this.materials.create(w.name),C&&b&&!(b instanceof g.LineBasicMaterial)){const Q=new g.LineBasicMaterial;g.Material.prototype.copy.call(Q,b),Q.color.copy(b.color),b=Q}else if(h&&b&&!(b instanceof g.PointsMaterial)){const Q=new g.PointsMaterial({size:10,sizeAttenuation:!1});g.Material.prototype.copy.call(Q,b),Q.color.copy(b.color),Q.map=b.map,b=Q}}b===void 0&&(C?b=new g.LineBasicMaterial:h?b=new g.PointsMaterial({size:1,sizeAttenuation:!1}):b=new g.MeshPhongMaterial,b.name=w.name,b.flatShading=!w.smooth,b.vertexColors=m,e.materials[x]=b),d.push(b)}let p;if(d.length>1){for(let f=0,D=l.length;f<D;f++){const w=l[f];I.addGroup(w.groupStart,w.groupCount,f)}C?p=new g.LineSegments(I,d):h?p=new g.Points(I,d):p=new g.Mesh(I,d)}else C?p=new g.LineSegments(I,d[0]):h?p=new g.Points(I,d[0]):p=new g.Mesh(I,d[0]);p.name=A.name,a.add(p)}else if(e.vertices.length>0){const r=new g.PointsMaterial({size:1,sizeAttenuation:!1}),c=new g.BufferGeometry;c.setAttribute("position",new g.Float32BufferAttribute(e.vertices,3)),e.colors.length>0&&e.colors[0]!==void 0&&(c.setAttribute("color",new g.Float32BufferAttribute(e.colors,3)),r.vertexColors=!0);const A=new g.Points(c,r);a.add(A)}return a}}function nl(n){let t=!1;const e=(r,c,A)=>n.on(r,c,A),s=(r,...c)=>n.fire(r,...c);e(to,()=>t=!0);const i=new Map,a=new Map;e(mn,()=>s(Tt)&&i.set(Date.now(),1)),e(In,()=>s(Tt)&&s(Be,i)),e(yn,()=>s(Tt)&&a.set(Date.now(),1)),e(wn,()=>s(Tt)&&s(Be,a));let o=0;e(Me,()=>{t||(s(Pi),s(Tt)&&(s(mn),!(o++%5)&&s(ut,{fps:s(In),realFps:s(wn),fov:s(Oe),position:s(Ie,s(Ut)),lookAt:s(Ie,s(Jt)),lookUp:s(Ie,s(be))})))},!0),e(Be,r=>{let c=[],A=Date.now(),u=0;for(const l of r.keys())A-l<=1e3?u++:c.push(l);return c.forEach(l=>r.delete(l)),Math.min(u,60)}),window.addEventListener("beforeunload",()=>s(En)),e(vo,async r=>{s(ut,{scene:"small (obj)"});const c=await ae(r,n);if(c){const A=URL.createObjectURL(new Blob([c],{type:"application/octet-stream"}));new el().load(A,u=>s(X).add(u)),s(Ct,!0),s(Kt,!0)}s(Xe,0)})}function sl(n){const t={...n};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=!1),t.shDegree??(t.shDegree=0),t.depthTest??(t.depthTest=!0),t.debugMode??(t.debugMode=!1),t.maxRenderCountOfMobile??(t.maxRenderCountOfMobile=t.bigSceneMode?256*1e4:384*10240),t.maxRenderCountOfPc??(t.maxRenderCountOfPc=t.bigSceneMode?320*1e4:384*1e4),t.mapMode&&(t.sortType=Te.Default1),t}function ar(n){const t={...n};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=.1),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.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.minDistance??(t.minDistance=.1),t.maxDistance??(t.maxDistance=5e3),t.qualityLevel??(t.qualityLevel=vt.Default5),t.sortType??(t.sortType=Te.Default1),t.transitionEffect??(t.transitionEffect=Kn.ModelCenterCirccle),t}function il(n){let t;n.root?t=typeof n.root=="string"?document.querySelector(n.root)||document.querySelector("#gsviewer"):n.root:t=document.querySelector("#gsviewer"),t||(t=document.createElement("div"),t.id="gsviewer",document.body.appendChild(t));let e=null;return n.renderer?e=n.renderer:(e=new g.WebGLRenderer({antialias:!1,stencil:!1,logarithmicDepthBuffer:!0,premultipliedAlpha:!1,precision:"highp",powerPreference:"high-performance"}),e.setSize(t.clientWidth,t.clientHeight),e.setPixelRatio(Math.min(devicePixelRatio,n.qualityLevel>vt.Default5?2:1)),n.renderer=e),e.domElement.classList.add("gsviewer-canvas"),t.appendChild(e.domElement),e}function ol(n){let t=n.camera;if(!t){const e=n.renderer.domElement,s=e.width/e.height;let i=new g.Vector3().fromArray(n.lookUp),a=new g.Vector3().fromArray(n.lookAt),o=new g.Vector3().fromArray(n.position);t=new g.PerspectiveCamera(n.fov,s,n.near,n.far),t.position.copy(o),t.up.copy(i).normalize(),t.lookAt(a),n.camera=t}return n.camera}function al(n){const{renderer:t,scene:e}=n,s={renderer:t,scene:e};return s.viewerEvents=n.viewerEvents,s.debugMode=n.debugMode,s.renderer=n.renderer,s.scene=n.scene,s.controls=n.controls,s.bigSceneMode=n.bigSceneMode,s.pointcloudMode=n.pointcloudMode,s.maxRenderCountOfMobile=n.maxRenderCountOfMobile,s.maxRenderCountOfPc=n.maxRenderCountOfPc,s.lightFactor=n.lightFactor,s.shDegree=n.shDegree,s.qualityLevel=n.qualityLevel,s.sortType=n.sortType,s.disableTransitionEffectOnLoad=!!n.disableTransitionEffectOnLoad,s.transitionEffect=n.transitionEffect||Kn.ModelCenterCirccle,s.enableEnvironment=!!n.enableEnvironment,s}function rl(n){const t=(o,r,c)=>n.on(o,r,c),e=(o,...r)=>n.fire(o,...r),s="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2xldCBkPTA7ZCsrO2NvbnN0IHR0PWAkJHtkKyt9YCxldD1gJCR7ZCsrfWA7ZCsrLGQrKyxkKys7Y29uc3Qgdj1gJCR7ZCsrfWAsTD1gJCR7ZCsrfWAsVT1gJCR7ZCsrfWAsTz1gJCR7ZCsrfWAsaj1gJCR7ZCsrfWAsbnQ9YCQke2QrK31gLGF0PWAkJHtkKyt9YCwkdD1gJCR7ZCsrfWA7ZCsrO2NvbnN0IHh0PWAkJHtkKyt9YCxrdD1gJCR7ZCsrfWA7ZCsrO2NvbnN0IG90PWAkJHtkKyt9YDtkKys7Y29uc3QgTXQ9YCQke2QrK31gO2QrKztjb25zdCBEdD1gJCR7ZCsrfWAsQ3Q9YCQke2QrK31gLEl0PWAkJHtkKyt9YCxidD1gJCR7ZCsrfWAsV3Q9YCQke2QrK31gLHd0PWAkJHtkKyt9YCxndD1gJCR7ZCsrfWAsWnQ9YCQke2QrK31gLE50PWAkJHtkKyt9YCxGdD1gJCR7ZCsrfWAscnQ9YCQke2QrK31gLEJ0PWAkJHtkKyt9YCxTdD1gJCR7ZCsrfWAscT1gJCR7ZCsrfWAsaXQ9YCQke2QrK31gLHN0PWAkJHtkKyt9YCxjdD0hbmF2aWdhdG9yLnVzZXJBZ2VudC5pbmNsdWRlcygiY2xvdWRwaG9uZSIpJiZuYXZpZ2F0b3IudXNlckFnZW50LmluY2x1ZGVzKCJNb2JpIik7dmFyIEY9KHQ9Pih0W3QuTDE9MV09IkwxIix0W3QuTDI9Ml09Ik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ZS5ub3coKX1lbHNlIG5bb3RdPyhLPW5bb3RdLGh0PW5bTnRdLHV0PW5bRnRdLHB0KCkpOm5bQnRdPyhBPU1hdGgubWF4KEYuTDEsTWF0aC5taW4obltydF18fEYuRGVmYXVsdDUsRi5MOSkpLHc9bltxXXx8dyxYPW5baXRdfHxYLHo9bltzdF18fHopOm5bZXRdP1V0KG5bZXRdKTpuW2d0XSYmKG10PW5beHRdLEM9bltrdF0sQT1NYXRoLm1heChGLkwxLE1hdGgubWluKG5bcnRdfHxGLkRlZmF1bHQ1LEYuTDkpKSx3PW5bcV18fHcsWD1uW2l0XXx8WCx6PW5bc3RdfHx6LGR0PSEwKX19KSgpOwo=",i=URL.createObjectURL(new Blob([atob(s)],{type:"text/javascript"})),a=new Worker(new URL(i,typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:as&&as.tagName.toUpperCase()==="SCRIPT"&&as.src||new URL("pkg.umd.cjs",document.baseURI).href),{type:"module"});t(Fi,()=>a),t(Hi,()=>a.postMessage({[vc]:e(Ni),[Nc]:e(uo),[Hc]:e(Ut).toArray()})),t(_i,()=>a.terminate()),t(_s,()=>a.postMessage({[_c]:!0,[$a]:e(Ks),[Ci]:e(Xs),[tr]:e(xt)?.meta?.depthNearRate,[er]:e(xt)?.meta?.depthNearValue})),(async()=>a.postMessage({[Pc]:!0,[xc]:await e(pe),[Mc]:e(bt),[$a]:e(Ks),[Ci]:e(Xs),[tr]:e(xt)?.meta?.depthNearRate,[er]:e(xt)?.meta?.depthNearValue}))()}class Al extends g.Object3D{constructor(t=0,e=0,s=0,i=0,a=0,o=0){super();const r=this,c=new g.BufferGeometry,A=new g.LineBasicMaterial({color:"#ffffff"});r.boxLines=new g.LineSegments(c,A),r.update(t,e,s,i,a,o),r.add(r.boxLines)}update(t,e,s,i,a,o,r){const c=(i-t)/8,A=(a-e)/8,u=(o-s)/8,l=[new g.Vector3(t,e,s),new g.Vector3(i,e,s),new g.Vector3(i,a,s),new g.Vector3(t,a,s),new g.Vector3(t,e,o),new g.Vector3(i,e,o),new g.Vector3(i,a,o),new g.Vector3(t,a,o)],C=[];l.forEach(h=>{C.push(h.x,h.y,h.z),C.push(h.x+(h.x<i?c:-c),h.y,h.z),C.push(h.x,h.y,h.z),C.push(h.x,h.y+(h.y<a?A:-A),h.z),C.push(h.x,h.y,h.z),C.push(h.x,h.y,h.z+(h.z<o?u:-u))}),this.boxLines.geometry.setAttribute("position",new g.Float32BufferAttribute(C,3)),r&&(this.visible=!0)}dispose(){this.boxLines=null}}const jn=(()=>{const n=new Hn;let t=!1;n.on(eA,async(s="",i=!1,a=.5)=>{const o=e();let r=null;if(new Promise(u=>r=u),o.isPlaying){t?(o?.stop(),r(!1)):r(!0);return}const c=await ae(s||"https://reall3d.com/demo-models/demo/background1.mp3"),A=URL.createObjectURL(new Blob([c],{type:"application/octet-stream"}));new g.AudioLoader().load(A,u=>{t||(o.setBuffer(u),o.setLoop(i),o.setVolume(a),o.play()),r(!t)},()=>r(!1))}),n.on(js,()=>{const s=e(!1);s?.isPlaying&&s.stop()}),n.on(nA,(s=!0)=>((s===!0||s===!1)&&(t=s),t)),n.on(Xo,(s=!1)=>{const i=e(s);if(!i?.isPlaying)return;let a=i.getVolume();ua(()=>{i&&(t?i.stop():i.setVolume(a=Math.max(a*.99,.15)))},()=>a>.15)}),n.on(Zo,(s=!1)=>{const i=e(s);if(!i?.isPlaying)return;let a=i.getVolume();ua(()=>{i&&(t?i.stop():i.setVolume(a=Math.min(a*1.01,.5)))},()=>a<.5)});function e(s=!0){if(t)return null;let i=n.tryFire(Ko);return!i&&s&&(i=new g.Audio(new g.AudioListener),n.on(Ko,()=>i)),i}return n})();class cl{constructor(t={}){const e={...t},s=[],i=t.textDurations||[];for(const a of i)s.push([...a]);e.textDurations=s,this.opts=e}play(t=!1){if(!t&&!this.opts.autoPlay||this.audio)return;const e=new g.Audio(new g.AudioListener);this.audio=e,new g.AudioLoader().load(this.opts.mp3,i=>{jn.fire(Xo),setTimeout(async()=>{e.setBuffer(i),e.setLoop(!1),e.setVolume(1),e.play();for(const a of this.opts.textDurations){const o=a[0],r=a[1];if(!await this.showAudioText(o,r))break}jn.fire(Zo),setTimeout(()=>this.audio=null,this.opts.position?6e4:0)},500)})}showAudioText(t,e){let s=document.querySelector(".tv-text");if(!s){const i=document.createElement("div");i.style.cssText="position:fixed;bottom:30px;left:0;right:0;display:flex;justify-content:center;z-index:99;pointer-events:none;",s=document.createElement("div"),s.style.cssText="background-color:#333;opacity:0.8;color:white;font-size:32px;padding:2px 10px;border-radius:4px;max-width:90%;text-align:center;user-select:none;",i.append(s),document.body.append(i)}return new Promise(i=>{s&&(s.innerText=t,s.style.display="block"),setTimeout(()=>{s.style.display="none",s.innerText="",this.audio?.isPlaying?setTimeout(()=>i(!0),200):i(!1)},e)})}dispose(){this.audio?.stop(),this.audio=null,this.opts=null}}class Wt extends g.Mesh{constructor(t){super(),this.isSplatMesh=!0,this.disposed=!1;const e=this,s=new Hn,i=(l,C,h)=>s.on(l,C,h),a=(l,...C)=>s.fire(l,...C);let o=!1;const r=sl(t),c=r.camera||r.controls?.object;i(R,()=>r),i(Qe,()=>r.renderer.domElement),i(Qt,()=>c),i(Oe,()=>c.fov),i(Ut,(l=!1)=>l?c.position.clone():c.position),i(Jt,(l=!1)=>r.controls?l?r.controls.target.clone():r.controls.target:new g.Vector3),i(Ni,()=>c.projectionMatrix.clone().multiply(c.matrixWorldInverse).multiply(e.matrix).toArray()),i(us,()=>c.projectionMatrix.clone().multiply(c.matrixWorldInverse)),i(uo,()=>c.getWorldDirection(new g.Vector3).toArray()),i(Se,()=>r.renderer),i(X,()=>r.scene),i(bt,()=>r.bigSceneMode),i(ms,()=>r.pointcloudMode),i(xt,()=>e),i(Ks,()=>r.qualityLevel||vt.Default5),i(Xs,()=>r.sortType||Te.Default1),i(Lo,()=>o),i(Ro,(l,C=1)=>Math.abs(c.position.distanceTo(l))<C&&KA(c,l)),i(it,()=>r.viewerEvents?.fire(Ct));let A=!1;i(Fo,()=>A),i(De,()=>A=!0,!0),i(De,()=>!a(bt)&&setTimeout(()=>!e.audioText?.opts.position&&e.audioText?.play(),5e3),!0),oi(s),mi(s),pc(s),rl(s),Kc(s),Xc(s),e.name=`${r.name||e.id}`,e.events=s,e.opts=r,(async()=>(e.copy(await s.fire(Yi)),e.meta.transform&&e.applyMatrix4(new g.Matrix4().fromArray(e.meta.transform)),e.frustumCulled=!1,e.onBeforeRender=()=>{a(Hi),a($i,performance.now()),e.audioText.opts.position&&a(Fo)&&a(Ro,new g.Vector3().fromArray(e.audioText.opts.position),e.audioText.opts.distance)&&e.audioText.play()},e.onAfterRender=()=>{a(no,1e4)&&a(it)},o=!0,a(Ns)))();const u=new Al;u.visible=!1,u.renderOrder=99999,e.boundBox=u,e.add(u),i(Fs,(l,C,h,m,I,d,p)=>{u.update(l,C,h,m,I,d,p)}),i(Or,(l=!0)=>u.visible=l)}options(t){const e=this;if(e.disposed)return;const s=(a,...o)=>e.events.fire(a,...o),i=e.opts;return t&&(t.pointcloudMode!==void 0&&s(Ce,t.pointcloudMode),t.lightFactor!==void 0&&s(ze,t.lightFactor),t.maxRenderCountOfMobile!==void 0&&(i.maxRenderCountOfMobile=t.maxRenderCountOfMobile),t.maxRenderCountOfPc!==void 0&&(i.maxRenderCountOfPc=t.maxRenderCountOfPc),t.qualityLevel!==void 0&&(i.qualityLevel=t.qualityLevel)&&s(Ns),!i.mapMode&&t.sortType!==void 0&&(i.sortType=t.sortType)&&s(_s),s(it)),{...i}}addModel(t,e={}){const s=this;if(s.disposed)return;s.meta=e;const i={autoPlay:e.audio?.autoPlay,mp3:e.audio?.mp3,textDurations:e.audio?.textDurations};e.audio?.position&&(i.event=s.events,i.position=e.audio?.position,i.distance=e.audio?.distance),s.audioText=new cl(i),e.url?.endsWith(".lod.json")||e.url?.endsWith("lod-meta.json")?s.events.fire(No,t,e):s.events.fire(eo,t,e)}fire(t,...e){const s=this;if(!s.disposed)return s.events.fire(t,...e)}dispose(){const t=this;if(t.disposed)return;t.disposed=!0;const e=(s,...i)=>t.events.fire(s,...i);e(ie,t),e(ie,t.boundBox),e(X).remove(t),e(X).remove(t.boundBox),t.audioText?.dispose(),e(ps),e(so),e(_i),e(io),t.events.clear(),t.events=null,t.opts=null,t.onAfterRender=null,t.boundBox=null,t.audioText=null}}class ll extends g.Object3D{constructor(t=new g.Vector3(0,0,1),e=new g.Vector3(0,0,0),s=1,i=.1,a=16776960,o=s*.2,r=o*.2){super(),this._axis=new g.Vector3,this.type="ArrowHelper";const c=new g.CylinderGeometry(i,i,s,32);c.translate(0,s/2,0);const A=new g.CylinderGeometry(0,r,o,32);A.translate(0,s,0),this.position.copy(e);const u=new g.MeshBasicMaterial({color:a,toneMapped:!1});u.side=g.DoubleSide,this.line=new g.Mesh(c,u),this.line.matrixAutoUpdate=!1,this.line.ignoreIntersect=!0,this.add(this.line);const l=new g.MeshBasicMaterial({color:a,toneMapped:!1});l.side=g.DoubleSide,this.cone=new g.Mesh(A,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 ul(n){const t=(I,d,p)=>n.on(I,d,p),e=(I,...d)=>n.fire(I,...d),s=new g.PlaneGeometry(1,1);s.rotateX(-Math.PI/2);const i=new g.MeshBasicMaterial({color:16777215});i.transparent=!0,i.opacity=.6,i.depthTest=!1,i.depthWrite=!1,i.side=g.DoubleSide;const a=new g.Mesh(s,i);a.ignoreIntersect=!0;const o=new g.Vector3(0,-1,0);o.normalize();const r=new g.Vector3(0,0,0),c=.5,A=.01,u=16777062,l=.1,C=.03,h=new ll(o,r,c,A,u,l,C),m=new g.Object3D;m.add(a),m.add(h),m.renderOrder=99999,a.renderOrder=99999,m.visible=!1,e(X).add(m),t(Fr,()=>m),t(Mn,I=>{e(xn,!0),m.visible=I===void 0?!m.visible:I,e(Ct)}),t(Ms,()=>m.visible),t(xn,(I=!1)=>{if(I||m.visible){const d=new g.Quaternion,p=new g.Vector3(0,-1,0);d.setFromUnitVectors(p,e(be)),m.position.copy(e(Jt)),m.quaternion.copy(d)}})}const rr={type:"change"},yi={type:"start"},Ar={type:"end"},qn=new g.Ray,cr=new g.Plane,dl=Math.cos(70*g.MathUtils.DEG2RAD),pt=new g.Vector3,Dt=2*Math.PI,rt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},wi=1e-6;class lr extends g.Controls{constructor(t,e=null){super(t,e),this.state=rt.NONE,this.enabled=!0,this.target=new g.Vector3,this.cursor=new g.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:g.MOUSE.ROTATE,MIDDLE:g.MOUSE.DOLLY,RIGHT:g.MOUSE.PAN},this.touches={ONE:g.TOUCH.ROTATE,TWO:g.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 g.Vector3,this._lastQuaternion=new g.Quaternion,this._lastTargetPosition=new g.Vector3,this._quat=new g.Quaternion().setFromUnitVectors(t.up,new g.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new g.Spherical,this._sphericalDelta=new g.Spherical,this._scale=1,this._panOffset=new g.Vector3,this._rotateStart=new g.Vector2,this._rotateEnd=new g.Vector2,this._rotateDelta=new g.Vector2,this._panStart=new g.Vector2,this._panEnd=new g.Vector2,this._panDelta=new g.Vector2,this._dollyStart=new g.Vector2,this._dollyEnd=new g.Vector2,this._dollyDelta=new g.Vector2,this._dollyDirection=new g.Vector3,this._mouse=new g.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=fl.bind(this),this._onPointerDown=gl.bind(this),this._onPointerUp=hl.bind(this),this._onContextMenu=El.bind(this),this._onMouseWheel=ml.bind(this),this._onKeyDown=Il.bind(this),this._onTouchStart=yl.bind(this),this._onTouchMove=wl.bind(this),this._onMouseDown=pl.bind(this),this._onMouseMove=Cl.bind(this),this._interceptControlDown=Ql.bind(this),this._interceptControlUp=bl.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(rr),this.update(),this.state=rt.NONE}update(t=null){const e=this.object.position;pt.copy(e).sub(this.target),pt.applyQuaternion(this._quat),this._spherical.setFromVector3(pt),this.autoRotate&&this.state===rt.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 s=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(s)&&isFinite(i)&&(s<-Math.PI?s+=Dt:s>Math.PI&&(s-=Dt),i<-Math.PI?i+=Dt:i>Math.PI&&(i-=Dt),s<=i?this._spherical.theta=Math.max(s,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(s+i)/2?Math.max(s,this._spherical.theta):Math.min(i,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 a=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),a=o!=this._spherical.radius}if(pt.setFromSpherical(this._spherical),pt.applyQuaternion(this._quatInverse),e.copy(this.target).add(pt),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 o=null;if(this.object.isPerspectiveCamera){const r=pt.length();o=this._clampDistance(r*this._scale);const c=r-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),a=!!c}else if(this.object.isOrthographicCamera){const r=new g.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(),a=c!==this.object.zoom;const A=new g.Vector3(this._mouse.x,this._mouse.y,0);A.unproject(this.object),this.object.position.sub(A).add(r),this.object.updateMatrixWorld(),o=pt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(qn.origin.copy(this.object.position),qn.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(qn.direction))<dl?this.object.lookAt(this.target):(cr.setFromNormalAndCoplanarPoint(this.object.up,this.target),qn.intersectPlane(cr,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),a=!0)}return this._scale=1,this._performCursorZoom=!1,a||this._lastPosition.distanceToSquared(this.object.position)>wi||8*(1-this._lastQuaternion.dot(this.object.quaternion))>wi||this._lastTargetPosition.distanceToSquared(this.target)>wi?(this.dispatchEvent(rr),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?Dt/60*this.autoRotateSpeed*t:Dt/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){pt.setFromMatrixColumn(e,0),pt.multiplyScalar(-t),this._panOffset.add(pt)}_panUp(t,e){this.screenSpacePanning===!0?pt.setFromMatrixColumn(e,1):(pt.setFromMatrixColumn(e,0),pt.crossVectors(this.object.up,pt)),pt.multiplyScalar(t),this._panOffset.add(pt)}_pan(t,e){const s=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;pt.copy(i).sub(this.target);let a=pt.length();a*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*a/s.clientHeight,this.object.matrix),this._panUp(2*e*a/s.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/s.clientWidth,this.object.matrix),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/s.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 s=this.domElement.getBoundingClientRect(),i=t-s.left,a=e-s.top,o=s.width,r=s.height;this._mouse.x=i/o*2-1,this._mouse.y=-(a/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(Dt*this._rotateDelta.x/e.clientHeight),this._rotateUp(Dt*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(Dt*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(-Dt*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(Dt*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(-Dt*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),s=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);this._rotateStart.set(s,i)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),s=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);this._panStart.set(s,i)}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),s=t.pageX-e.x,i=t.pageY-e.y,a=Math.sqrt(s*s+i*i);this._dollyStart.set(0,a)}_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 s=this._getSecondPointerPosition(t),i=.5*(t.pageX+s.x),a=.5*(t.pageY+s.y);this._rotateEnd.set(i,a)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(Dt*this._rotateDelta.x/e.clientHeight),this._rotateUp(Dt*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),s=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);this._panEnd.set(s,i)}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),s=t.pageX-e.x,i=t.pageY-e.y,a=Math.sqrt(s*s+i*i);this._dollyEnd.set(0,a),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 o=(t.pageX+e.x)*.5,r=(t.pageY+e.y)*.5;this._updateZoomParameters(o,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 g.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,s={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(e){case 1:s.deltaY*=16;break;case 2:s.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(s.deltaY*=10),s}}function gl(n){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(n.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(n)&&(this._addPointer(n),n.pointerType==="touch"?this._onTouchStart(n):this._onMouseDown(n)))}function fl(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function hl(n){switch(this._removePointer(n),this._pointers.length){case 0:this.domElement.releasePointerCapture(n.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Ar),this.state=rt.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 pl(n){let t;switch(n.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 g.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(n),this.state=rt.DOLLY;break;case g.MOUSE.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=rt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=rt.ROTATE}break;case g.MOUSE.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=rt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=rt.PAN}break;default:this.state=rt.NONE}this.state!==rt.NONE&&this.dispatchEvent(yi)}function Cl(n){switch(this.state){case rt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case rt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case rt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function ml(n){this.enabled===!1||this.enableZoom===!1||this.state!==rt.NONE||(n.preventDefault(),this.dispatchEvent(yi),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(Ar))}function Il(n){this.enabled!==!1&&this._handleKeyDown(n)}function yl(n){switch(this._trackPointer(n),this._pointers.length){case 1:switch(this.touches.ONE){case g.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(n),this.state=rt.TOUCH_ROTATE;break;case g.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=rt.TOUCH_PAN;break;default:this.state=rt.NONE}break;case 2:switch(this.touches.TWO){case g.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(n),this.state=rt.TOUCH_DOLLY_PAN;break;case g.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=rt.TOUCH_DOLLY_ROTATE;break;default:this.state=rt.NONE}break;default:this.state=rt.NONE}this.state!==rt.NONE&&this.dispatchEvent(yi)}function wl(n){switch(this._trackPointer(n),this.state){case rt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case rt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case rt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case rt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=rt.NONE}}function El(n){this.enabled!==!1&&n.preventDefault()}function Ql(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function bl(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class Bl extends lr{constructor(t){const e=t.camera;super(e,t.renderer.domElement);const s=this;s.dampingFactor=.1,s.rotateSpeed=.4,s.updateByOptions(t)}updateByOptions(t={}){if(!t)return;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),e.updateRotateAxis(),e.update()}updateRotateAxis(){this._quat?.setFromUnitVectors?.(this.object.up,new g.Vector3(0,1,0)),this._quatInverse=this._quat?.clone?.()?.invert?.()}}class Sl extends lr{constructor(t,e){super(t,e),this.screenSpacePanning=!1,this.mouseButtons={LEFT:g.MOUSE.PAN,MIDDLE:g.MOUSE.DOLLY,RIGHT:g.MOUSE.ROTATE},this.touches={ONE:g.TOUCH.PAN,TWO:g.TOUCH.DOLLY_ROTATE}}}const ur=new g.Box3,$n=new g.Vector3;class dr extends g.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],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(s),this.setAttribute("position",new g.Float32BufferAttribute(t,3)),this.setAttribute("uv",new g.Float32BufferAttribute(e,2))}applyMatrix4(t){const e=this.attributes.instanceStart,s=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(t),s.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 s=new g.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new g.InterleavedBufferAttribute(s,3,0)),this.setAttribute("instanceEnd",new g.InterleavedBufferAttribute(s,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 s=new g.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new g.InterleavedBufferAttribute(s,3,0)),this.setAttribute("instanceColorEnd",new g.InterleavedBufferAttribute(s,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 g.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 g.Box3);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;t!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(t),ur.setFromBufferAttribute(e),this.boundingBox.union(ur))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new g.Sphere),this.boundingBox===null&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(t!==void 0&&e!==void 0){const s=this.boundingSphere.center;this.boundingBox.getCenter(s);let i=0;for(let a=0,o=t.count;a<o;a++)$n.fromBufferAttribute(t,a),i=Math.max(i,s.distanceToSquared($n)),$n.fromBufferAttribute(e,a),i=Math.max(i,s.distanceToSquared($n));this.boundingSphere.radius=Math.sqrt(i),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)}}g.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new g.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},g.ShaderLib.line={uniforms:g.UniformsUtils.merge([g.UniformsLib.common,g.UniformsLib.fog,g.UniformsLib.line]),vertexShader:`
424
+ `);let i=[];for(let r=0,c=s.length;r<c;r++){const A=s[r].trimStart();if(A.length===0)continue;const u=A.charAt(0);if(u!=="#")if(u==="v"){const l=A.split($a);switch(l[0]){case"v":e.vertices.push(parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3])),l.length>=7?(Xn.setRGB(parseFloat(l[4]),parseFloat(l[5]),parseFloat(l[6]),d.SRGBColorSpace),e.colors.push(Xn.r,Xn.g,Xn.b)):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3]));break;case"vt":e.uvs.push(parseFloat(l[1]),parseFloat(l[2]));break}}else if(u==="f"){const C=A.slice(1).trim().split($a),h=[];for(let I=0,g=C.length;I<g;I++){const p=C[I];if(p.length>0){const f=p.split("/");h.push(f)}}const m=h[0];for(let I=1,g=h.length-1;I<g;I++){const p=h[I],f=h[I+1];e.addFace(m[0],p[0],f[0],m[1],p[1],f[1],m[2],p[2],f[2])}}else if(u==="l"){const l=A.substring(1).trim().split(" ");let C=[];const h=[];if(A.indexOf("/")===-1)C=l;else for(let m=0,I=l.length;m<I;m++){const g=l[m].split("/");g[0]!==""&&C.push(g[0]),g[1]!==""&&h.push(g[1])}e.addLineGeometry(C,h)}else if(u==="p"){const C=A.slice(1).trim().split(" ");e.addPointGeometry(C)}else if((i=Kc.exec(A))!==null){const l=(" "+i[0].slice(1).trim()).slice(1);e.startObject(l)}else if(Zc.test(A))e.object.startMaterial(A.substring(7).trim(),e.materialLibraries);else if(Xc.test(A))e.materialLibraries.push(A.substring(7).trim());else if(jc.test(A))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(u==="s"){if(i=A.split(" "),i.length>1){const C=i[1].trim().toLowerCase();e.object.smooth=C!=="0"&&C!=="off"}else e.object.smooth=!0;const l=e.object.currentMaterial();l&&(l.smooth=e.object.smooth)}else{if(A==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+A+'"')}}e.finalize();const a=new d.Group;if(a.materialLibraries=[].concat(e.materialLibraries),!(e.objects.length===1&&e.objects[0].geometry.vertices.length===0)===!0)for(let r=0,c=e.objects.length;r<c;r++){const A=e.objects[r],u=A.geometry,l=A.materials,C=u.type==="Line",h=u.type==="Points";let m=!1;if(u.vertices.length===0)continue;const I=new d.BufferGeometry;I.setAttribute("position",new d.Float32BufferAttribute(u.vertices,3)),u.normals.length>0&&I.setAttribute("normal",new d.Float32BufferAttribute(u.normals,3)),u.colors.length>0&&(m=!0,I.setAttribute("color",new d.Float32BufferAttribute(u.colors,3))),u.hasUVIndices===!0&&I.setAttribute("uv",new d.Float32BufferAttribute(u.uvs,2));const g=[];for(let f=0,D=l.length;f<D;f++){const w=l[f],x=w.name+"_"+w.smooth+"_"+m;let b=e.materials[x];if(this.materials!==null){if(b=this.materials.create(w.name),C&&b&&!(b instanceof d.LineBasicMaterial)){const B=new d.LineBasicMaterial;d.Material.prototype.copy.call(B,b),B.color.copy(b.color),b=B}else if(h&&b&&!(b instanceof d.PointsMaterial)){const B=new d.PointsMaterial({size:10,sizeAttenuation:!1});d.Material.prototype.copy.call(B,b),B.color.copy(b.color),B.map=b.map,b=B}}b===void 0&&(C?b=new d.LineBasicMaterial:h?b=new d.PointsMaterial({size:1,sizeAttenuation:!1}):b=new d.MeshPhongMaterial,b.name=w.name,b.flatShading=!w.smooth,b.vertexColors=m,e.materials[x]=b),g.push(b)}let p;if(g.length>1){for(let f=0,D=l.length;f<D;f++){const w=l[f];I.addGroup(w.groupStart,w.groupCount,f)}C?p=new d.LineSegments(I,g):h?p=new d.Points(I,g):p=new d.Mesh(I,g)}else C?p=new d.LineSegments(I,g[0]):h?p=new d.Points(I,g[0]):p=new d.Mesh(I,g[0]);p.name=A.name,a.add(p)}else if(e.vertices.length>0){const r=new d.PointsMaterial({size:1,sizeAttenuation:!1}),c=new d.BufferGeometry;c.setAttribute("position",new d.Float32BufferAttribute(e.vertices,3)),e.colors.length>0&&e.colors[0]!==void 0&&(c.setAttribute("color",new d.Float32BufferAttribute(e.colors,3)),r.vertexColors=!0);const A=new d.Points(c,r);a.add(A)}return a}}function tl(n){let t=!1;const e=(r,c,A)=>n.on(r,c,A),s=(r,...c)=>n.fire(r,...c);e(qi,()=>t=!0);const i=new Map,a=new Map;e(Cn,()=>s(Tt)&&i.set(Date.now(),1)),e(mn,()=>s(Tt)&&s(xe,i)),e(In,()=>s(Tt)&&a.set(Date.now(),1)),e(yn,()=>s(Tt)&&s(xe,a));let o=0;e(ve,()=>{t||(s(Fi),s(Tt)&&(s(Cn),!(o++%5)&&s(ut,{fps:s(mn),realFps:s(yn),fov:s(We),position:s(ye,s(Ut)),lookAt:s(ye,s(Jt)),lookUp:s(ye,s(Se))})))},!0),e(xe,r=>{let c=[],A=Date.now(),u=0;for(const l of r.keys())A-l<=1e3?u++:c.push(l);return c.forEach(l=>r.delete(l)),Math.min(u,60)}),window.addEventListener("beforeunload",()=>s(wn)),e(xo,async r=>{s(ut,{scene:"small (obj)"});const c=await re(r,n);if(c){const A=URL.createObjectURL(new Blob([c],{type:"application/octet-stream"}));new $c().load(A,u=>s(j).add(u)),s(pt,!0),s(Kt,!0)}s(Ke,0)})}function el(n){const t={...n};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=!1),t.shDegree??(t.shDegree=0),t.depthTest??(t.depthTest=!0),t.debugMode??(t.debugMode=!1),t.maxRenderCountOfMobile??(t.maxRenderCountOfMobile=t.bigSceneMode?256*1e4:384*10240),t.maxRenderCountOfPc??(t.maxRenderCountOfPc=t.bigSceneMode?320*1e4:384*1e4),t.mapMode&&(t.sortType=Fe.Default1),t}function sr(n){const t={...n};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=.1),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.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.minDistance??(t.minDistance=.1),t.maxDistance??(t.maxDistance=5e3),t.qualityLevel??(t.qualityLevel=vt.Default5),t.sortType??(t.sortType=Fe.Default1),t.transitionEffect??(t.transitionEffect=Jn.ModelCenterCirccle),t.disableRightClickFocus??(t.disableRightClickFocus=!1),t}function nl(n){let t;n.root?t=typeof n.root=="string"?document.querySelector(n.root)||document.querySelector("#gsviewer"):n.root:t=document.querySelector("#gsviewer"),t||(t=document.createElement("div"),t.id="gsviewer",document.body.appendChild(t));let e=null;return n.renderer?e=n.renderer:(e=new d.WebGLRenderer({antialias:!1,stencil:!1,logarithmicDepthBuffer:!0,premultipliedAlpha:!1,precision:"highp",powerPreference:"high-performance"}),e.setSize(t.clientWidth,t.clientHeight),e.setPixelRatio(Math.min(devicePixelRatio,n.qualityLevel>vt.Default5?2:1)),n.renderer=e),e.domElement.classList.add("gsviewer-canvas"),t.appendChild(e.domElement),e}function sl(n){let t=n.camera;if(!t){const e=n.renderer.domElement,s=e.width/e.height;let i=new d.Vector3().fromArray(n.lookUp),a=new d.Vector3().fromArray(n.lookAt),o=new d.Vector3().fromArray(n.position);t=new d.PerspectiveCamera(n.fov,s,n.near,n.far),t.position.copy(o),t.up.copy(i).normalize(),t.lookAt(a),n.camera=t}return n.camera}function il(n){const{renderer:t,scene:e}=n,s={renderer:t,scene:e};return s.viewerEvents=n.viewerEvents,s.debugMode=n.debugMode,s.renderer=n.renderer,s.scene=n.scene,s.controls=n.controls,s.bigSceneMode=n.bigSceneMode,s.pointcloudMode=n.pointcloudMode,s.maxRenderCountOfMobile=n.maxRenderCountOfMobile,s.maxRenderCountOfPc=n.maxRenderCountOfPc,s.lightFactor=n.lightFactor,s.shDegree=n.shDegree,s.qualityLevel=n.qualityLevel,s.sortType=n.sortType,s.disableTransitionEffectOnLoad=!!n.disableTransitionEffectOnLoad,s.transitionEffect=n.transitionEffect||Jn.ModelCenterCirccle,s.enableEnvironment=!!n.enableEnvironment,s}function ol(n){const t=(o,r,c)=>n.on(o,r,c),e=(o,...r)=>n.fire(o,...r),s="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2xldCBkPTA7ZCsrO2NvbnN0IHR0PWAkJHtkKyt9YCxldD1gJCR7ZCsrfWA7ZCsrLGQrKyxkKys7Y29uc3Qgdj1gJCR7ZCsrfWAsTD1gJCR7ZCsrfWAsVT1gJCR7ZCsrfWAsTz1gJCR7ZCsrfWAsaj1gJCR7ZCsrfWAsbnQ9YCQke2QrK31gLGF0PWAkJHtkKyt9YCwkdD1gJCR7ZCsrf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EJpdHM6cyxidWNrZXRDbnQ6Mioqc319ZnVuY3Rpb24gTHQoKXtyZXR1cm4gbHQucG9wKCl8fG5ldyBVaW50MzJBcnJheShDKX1mdW5jdGlvbiBVdCh0KXt0LmZpbGwoMCkmJmx0LnB1c2godCl9RS5vbm1lc3NhZ2U9dD0+e2NvbnN0IG49dC5kYXRhO2lmKG5bJHRdKXtsZXQgYT0hbXR8fG5bdl09PT0wP0c6SDthLm1pblg9bltEdF0sYS5tYXhYPW5bQ3RdLGEubWluWT1uW0l0XSxhLm1heFk9bltidF0sYS5taW5aPW5bV3RdLGEubWF4Wj1uW3d0XSxhLnh5ej1uZXcgRmxvYXQzMkFycmF5KG5bTXRdLmJ1ZmZlciksYS53YXRlcm1hcmtDb3VudD1uW1p0XSxhLnZlcnNpb249bltMXSxhLnJlbmRlclNwbGF0Q291bnQ9bltVXSxhLnZpc2libGVTcGxhdENvdW50PW5bT10sYS5tb2RlbFNwbGF0Q291bnQ9bltqXSxhLnRleHR1cmVSZWFkeT0hMCxhLnRleHR1cmVSZWFkeVRpbWU9RGF0ZS5ub3coKX1lbHNlIG5bb3RdPyhLPW5bb3RdLGh0PW5bTnRdLHV0PW5bRnRdLHB0KCkpOm5bQnRdPyhBPU1hdGgubWF4KEYuTDEsTWF0aC5taW4obltydF18fEYuRGVmYXVsdDUsRi5MOSkpLHc9bltxXXx8dyxYPW5baXRdfHxYLHo9bltzdF18fHopOm5bZXRdP1V0KG5bZXRdKTpuW2d0XSYmKG10PW5beHRdLEM9bltrdF0sQT1NYXRoLm1heChGLkwxLE1hdGgubWluKG5bcnRdfHxGLkRlZmF1bHQ1LEYuTDkpKSx3PW5bcV18fHcsWD1uW2l0XXx8WCx6PW5bc3RdfHx6LGR0PSEwKX19KSgpOwo=",i=URL.createObjectURL(new Blob([atob(s)],{type:"text/javascript"})),a=new Worker(new URL(i,typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:os&&os.tagName.toUpperCase()==="SCRIPT"&&os.src||new URL("pkg.umd.cjs",document.baseURI).href),{type:"module"});t(Li,()=>a),t(Vi,()=>a.postMessage({[xc]:e(Pi),[Pc]:e(co),[Vc]:e(Ut).toArray()})),t(Ni,()=>a.terminate()),t(_s,()=>a.postMessage({[Nc]:!0,[Za]:e(Js),[hi]:e(Ks),[ja]:e(Mt)?.meta?.depthNearRate,[qa]:e(Mt)?.meta?.depthNearValue})),(async()=>a.postMessage({[Fc]:!0,[Sc]:await e(Ce),[bc]:e(Qt),[Za]:e(Js),[hi]:e(Ks),[ja]:e(Mt)?.meta?.depthNearRate,[qa]:e(Mt)?.meta?.depthNearValue}))()}class al extends d.Object3D{constructor(t=0,e=0,s=0,i=0,a=0,o=0){super();const r=this,c=new d.BufferGeometry,A=new d.LineBasicMaterial({color:"#ffffff"});r.boxLines=new d.LineSegments(c,A),r.update(t,e,s,i,a,o),r.add(r.boxLines)}update(t,e,s,i,a,o,r){const c=(i-t)/8,A=(a-e)/8,u=(o-s)/8,l=[new d.Vector3(t,e,s),new d.Vector3(i,e,s),new d.Vector3(i,a,s),new d.Vector3(t,a,s),new d.Vector3(t,e,o),new d.Vector3(i,e,o),new d.Vector3(i,a,o),new d.Vector3(t,a,o)],C=[];l.forEach(h=>{C.push(h.x,h.y,h.z),C.push(h.x+(h.x<i?c:-c),h.y,h.z),C.push(h.x,h.y,h.z),C.push(h.x,h.y+(h.y<a?A:-A),h.z),C.push(h.x,h.y,h.z),C.push(h.x,h.y,h.z+(h.z<o?u:-u))}),this.boxLines.geometry.setAttribute("position",new d.Float32BufferAttribute(C,3)),r&&(this.visible=!0)}dispose(){this.boxLines=null}}const Zn=(()=>{const n=new Nn;let t=!1;n.on(qr,async(s="",i=!1,a=.5)=>{const o=e();let r=null;if(new Promise(u=>r=u),o.isPlaying){t?(o?.stop(),r(!1)):r(!0);return}const c=await re(s||"https://reall3d.com/demo-models/demo/background1.mp3"),A=URL.createObjectURL(new Blob([c],{type:"application/octet-stream"}));new d.AudioLoader().load(A,u=>{t||(o.setBuffer(u),o.setLoop(i),o.setVolume(a),o.play()),r(!t)},()=>r(!1))}),n.on(Zs,()=>{const s=e(!1);s?.isPlaying&&s.stop()}),n.on($r,(s=!0)=>((s===!0||s===!1)&&(t=s),t)),n.on(Jo,(s=!1)=>{const i=e(s);if(!i?.isPlaying)return;let a=i.getVolume();aa(()=>{i&&(t?i.stop():i.setVolume(a=Math.max(a*.99,.15)))},()=>a>.15)}),n.on(Ko,(s=!1)=>{const i=e(s);if(!i?.isPlaying)return;let a=i.getVolume();aa(()=>{i&&(t?i.stop():i.setVolume(a=Math.min(a*1.01,.5)))},()=>a<.5)});function e(s=!0){if(t)return null;let i=n.tryFire(Oo);return!i&&s&&(i=new d.Audio(new d.AudioListener),n.on(Oo,()=>i)),i}return n})();class rl{constructor(t={}){const e={...t},s=[],i=t.textDurations||[];for(const a of i)s.push([...a]);e.textDurations=s,this.opts=e}play(t=!1){if(!t&&!this.opts.autoPlay||this.audio)return;const e=new d.Audio(new d.AudioListener);this.audio=e,new d.AudioLoader().load(this.opts.mp3,i=>{Zn.fire(Jo),setTimeout(async()=>{e.setBuffer(i),e.setLoop(!1),e.setVolume(1),e.play();for(const a of this.opts.textDurations){const o=a[0],r=a[1];if(!await this.showAudioText(o,r))break}Zn.fire(Ko),setTimeout(()=>this.audio=null,this.opts.position?6e4:0)},500)})}showAudioText(t,e){let s=document.querySelector(".tv-text");if(!s){const i=document.createElement("div");i.style.cssText="position:fixed;bottom:30px;left:0;right:0;display:flex;justify-content:center;z-index:99;pointer-events:none;",s=document.createElement("div"),s.style.cssText="background-color:#333;opacity:0.8;color:white;font-size:32px;padding:2px 10px;border-radius:4px;max-width:90%;text-align:center;user-select:none;",i.append(s),document.body.append(i)}return new Promise(i=>{s&&(s.innerText=t,s.style.display="block"),setTimeout(()=>{s.style.display="none",s.innerText="",this.audio?.isPlaying?setTimeout(()=>i(!0),200):i(!1)},e)})}dispose(){this.audio?.stop(),this.audio=null,this.opts=null}}class Yt extends d.Mesh{constructor(t){super(),this.isSplatMesh=!0,this.disposed=!1;const e=this,s=new Nn,i=(l,C,h)=>s.on(l,C,h),a=(l,...C)=>s.fire(l,...C);let o=!1;const r=el(t),c=r.camera||r.controls?.object;i(L,()=>r),i(be,()=>r.renderer.domElement),i(Bt,()=>c),i(We,()=>c.fov),i(Ut,(l=!1)=>l?c.position.clone():c.position),i(Jt,(l=!1)=>r.controls?l?r.controls.target.clone():r.controls.target:new d.Vector3),i(Pi,()=>c.projectionMatrix.clone().multiply(c.matrixWorldInverse).multiply(e.matrix).toArray()),i(ls,()=>c.projectionMatrix.clone().multiply(c.matrixWorldInverse)),i(co,()=>c.getWorldDirection(new d.Vector3).toArray()),i(Me,()=>r.renderer),i(j,()=>r.scene),i(Qt,()=>r.bigSceneMode),i(Cs,()=>r.pointcloudMode),i(Mt,()=>e),i(Js,()=>r.qualityLevel||vt.Default5),i(Ks,()=>r.sortType||Fe.Default1),i(ko,()=>o),i(To,(l,C=1)=>Math.abs(c.position.distanceTo(l))<C&&ZA(c,l)),i(ot,()=>r.viewerEvents?.fire(pt));let A=!1;i(Lo,()=>A),i(Te,()=>A=!0,!0),i(Te,()=>!a(Qt)&&setTimeout(()=>!e.audioText?.opts.position&&e.audioText?.play(),5e3),!0),ii(s),pi(s),fc(s),ol(s),Oc(s),Jc(s),e.name=`${r.name||e.id}`,e.events=s,e.opts=r,(async()=>(e.copy(await s.fire(Yi)),e.meta.transform&&e.applyMatrix4(new d.Matrix4().fromArray(e.meta.transform)),e.frustumCulled=!1,e.onBeforeRender=()=>{a(Vi),a(ji,performance.now()),e.audioText.opts.position&&a(Lo)&&a(To,new d.Vector3().fromArray(e.audioText.opts.position),e.audioText.opts.distance)&&e.audioText.play()},e.onAfterRender=()=>{a(to,1e4)&&a(ot)},o=!0,a(Vs)))();const u=new al;u.visible=!1,u.renderOrder=99999,e.boundBox=u,e.add(u),i(Rs,(l,C,h,m,I,g,p)=>{u.update(l,C,h,m,I,g,p)}),i(Hr,(l=!0)=>u.visible=l)}options(t){const e=this;if(e.disposed)return;const s=(a,...o)=>e.events.fire(a,...o),i=e.opts;return t&&(t.pointcloudMode!==void 0&&s(me,t.pointcloudMode),t.lightFactor!==void 0&&s(Ye,t.lightFactor),t.maxRenderCountOfMobile!==void 0&&(i.maxRenderCountOfMobile=t.maxRenderCountOfMobile),t.maxRenderCountOfPc!==void 0&&(i.maxRenderCountOfPc=t.maxRenderCountOfPc),t.qualityLevel!==void 0&&(i.qualityLevel=t.qualityLevel)&&s(Vs),!i.mapMode&&t.sortType!==void 0&&(i.sortType=t.sortType)&&s(_s),s(ot)),{...i}}addModel(t,e={}){const s=this;if(s.disposed)return;s.meta=e;const i={autoPlay:e.audio?.autoPlay,mp3:e.audio?.mp3,textDurations:e.audio?.textDurations};e.audio?.position&&(i.event=s.events,i.position=e.audio?.position,i.distance=e.audio?.distance),s.audioText=new rl(i),e.url?.endsWith(".lod.json")||e.url?.endsWith("lod-meta.json")?s.events.fire(Po,t,e):s.events.fire($i,t,e)}fire(t,...e){const s=this;if(!s.disposed)return s.events.fire(t,...e)}dispose(){const t=this;if(t.disposed)return;t.disposed=!0;const e=(s,...i)=>t.events.fire(s,...i);e(oe,t),e(oe,t.boundBox),e(j).remove(t),e(j).remove(t.boundBox),t.audioText?.dispose(),e(hs),e(eo),e(Ni),e(no),t.events.clear(),t.events=null,t.opts=null,t.onAfterRender=null,t.boundBox=null,t.audioText=null}}class Al extends d.Object3D{constructor(t=new d.Vector3(0,0,1),e=new d.Vector3(0,0,0),s=1,i=.1,a=16776960,o=s*.2,r=o*.2){super(),this._axis=new d.Vector3,this.type="ArrowHelper";const c=new d.CylinderGeometry(i,i,s,32);c.translate(0,s/2,0);const A=new d.CylinderGeometry(0,r,o,32);A.translate(0,s,0),this.position.copy(e);const u=new d.MeshBasicMaterial({color:a,toneMapped:!1});u.side=d.DoubleSide,this.line=new d.Mesh(c,u),this.line.matrixAutoUpdate=!1,this.line.ignoreIntersect=!0,this.add(this.line);const l=new d.MeshBasicMaterial({color:a,toneMapped:!1});l.side=d.DoubleSide,this.cone=new d.Mesh(A,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 cl(n){const t=(I,g,p)=>n.on(I,g,p),e=(I,...g)=>n.fire(I,...g),s=new d.PlaneGeometry(1,1);s.rotateX(-Math.PI/2);const i=new d.MeshBasicMaterial({color:16777215});i.transparent=!0,i.opacity=.6,i.depthTest=!1,i.depthWrite=!1,i.side=d.DoubleSide;const a=new d.Mesh(s,i);a.ignoreIntersect=!0;const o=new d.Vector3(0,-1,0);o.normalize();const r=new d.Vector3(0,0,0),c=.5,A=.01,u=16777062,l=.1,C=.03,h=new Al(o,r,c,A,u,l,C),m=new d.Object3D;m.add(a),m.add(h),m.renderOrder=99999,a.renderOrder=99999,m.visible=!1,e(j).add(m),t(Tr,()=>m),t(Sn,I=>{e(xn,!0),m.visible=I===void 0?!m.visible:I,e(pt)}),t(Ss,()=>m.visible),t(xn,(I=!1)=>{if(I||m.visible){const g=new d.Quaternion,p=new d.Vector3(0,-1,0);g.setFromUnitVectors(p,e(Se)),m.position.copy(e(Jt)),m.quaternion.copy(g)}})}const ir={type:"change"},mi={type:"start"},or={type:"end"},jn=new d.Ray,ar=new d.Plane,ll=Math.cos(70*d.MathUtils.DEG2RAD),ht=new d.Vector3,Dt=2*Math.PI,At={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Ii=1e-6;class rr extends d.Controls{constructor(t,e=null){super(t,e),this.state=At.NONE,this.enabled=!0,this.target=new d.Vector3,this.cursor=new d.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:d.MOUSE.ROTATE,MIDDLE:d.MOUSE.DOLLY,RIGHT:d.MOUSE.PAN},this.touches={ONE:d.TOUCH.ROTATE,TWO:d.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 d.Vector3,this._lastQuaternion=new d.Quaternion,this._lastTargetPosition=new d.Vector3,this._quat=new d.Quaternion().setFromUnitVectors(t.up,new d.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new d.Spherical,this._sphericalDelta=new d.Spherical,this._scale=1,this._panOffset=new d.Vector3,this._rotateStart=new d.Vector2,this._rotateEnd=new d.Vector2,this._rotateDelta=new d.Vector2,this._panStart=new d.Vector2,this._panEnd=new d.Vector2,this._panDelta=new d.Vector2,this._dollyStart=new d.Vector2,this._dollyEnd=new d.Vector2,this._dollyDelta=new d.Vector2,this._dollyDirection=new d.Vector3,this._mouse=new d.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=dl.bind(this),this._onPointerDown=ul.bind(this),this._onPointerUp=gl.bind(this),this._onContextMenu=yl.bind(this),this._onMouseWheel=pl.bind(this),this._onKeyDown=Cl.bind(this),this._onTouchStart=ml.bind(this),this._onTouchMove=Il.bind(this),this._onMouseDown=fl.bind(this),this._onMouseMove=hl.bind(this),this._interceptControlDown=wl.bind(this),this._interceptControlUp=El.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(ir),this.update(),this.state=At.NONE}update(t=null){const e=this.object.position;ht.copy(e).sub(this.target),ht.applyQuaternion(this._quat),this._spherical.setFromVector3(ht),this.autoRotate&&this.state===At.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 s=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(s)&&isFinite(i)&&(s<-Math.PI?s+=Dt:s>Math.PI&&(s-=Dt),i<-Math.PI?i+=Dt:i>Math.PI&&(i-=Dt),s<=i?this._spherical.theta=Math.max(s,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(s+i)/2?Math.max(s,this._spherical.theta):Math.min(i,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 a=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),a=o!=this._spherical.radius}if(ht.setFromSpherical(this._spherical),ht.applyQuaternion(this._quatInverse),e.copy(this.target).add(ht),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 o=null;if(this.object.isPerspectiveCamera){const r=ht.length();o=this._clampDistance(r*this._scale);const c=r-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),a=!!c}else if(this.object.isOrthographicCamera){const r=new d.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(),a=c!==this.object.zoom;const A=new d.Vector3(this._mouse.x,this._mouse.y,0);A.unproject(this.object),this.object.position.sub(A).add(r),this.object.updateMatrixWorld(),o=ht.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(jn.origin.copy(this.object.position),jn.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(jn.direction))<ll?this.object.lookAt(this.target):(ar.setFromNormalAndCoplanarPoint(this.object.up,this.target),jn.intersectPlane(ar,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),a=!0)}return this._scale=1,this._performCursorZoom=!1,a||this._lastPosition.distanceToSquared(this.object.position)>Ii||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Ii||this._lastTargetPosition.distanceToSquared(this.target)>Ii?(this.dispatchEvent(ir),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?Dt/60*this.autoRotateSpeed*t:Dt/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){ht.setFromMatrixColumn(e,0),ht.multiplyScalar(-t),this._panOffset.add(ht)}_panUp(t,e){this.screenSpacePanning===!0?ht.setFromMatrixColumn(e,1):(ht.setFromMatrixColumn(e,0),ht.crossVectors(this.object.up,ht)),ht.multiplyScalar(t),this._panOffset.add(ht)}_pan(t,e){const s=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;ht.copy(i).sub(this.target);let a=ht.length();a*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*a/s.clientHeight,this.object.matrix),this._panUp(2*e*a/s.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/s.clientWidth,this.object.matrix),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/s.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 s=this.domElement.getBoundingClientRect(),i=t-s.left,a=e-s.top,o=s.width,r=s.height;this._mouse.x=i/o*2-1,this._mouse.y=-(a/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(Dt*this._rotateDelta.x/e.clientHeight),this._rotateUp(Dt*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(Dt*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(-Dt*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(Dt*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(-Dt*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),s=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);this._rotateStart.set(s,i)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),s=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);this._panStart.set(s,i)}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),s=t.pageX-e.x,i=t.pageY-e.y,a=Math.sqrt(s*s+i*i);this._dollyStart.set(0,a)}_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 s=this._getSecondPointerPosition(t),i=.5*(t.pageX+s.x),a=.5*(t.pageY+s.y);this._rotateEnd.set(i,a)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(Dt*this._rotateDelta.x/e.clientHeight),this._rotateUp(Dt*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),s=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);this._panEnd.set(s,i)}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),s=t.pageX-e.x,i=t.pageY-e.y,a=Math.sqrt(s*s+i*i);this._dollyEnd.set(0,a),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 o=(t.pageX+e.x)*.5,r=(t.pageY+e.y)*.5;this._updateZoomParameters(o,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 d.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,s={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(e){case 1:s.deltaY*=16;break;case 2:s.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(s.deltaY*=10),s}}function ul(n){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(n.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(n)&&(this._addPointer(n),n.pointerType==="touch"?this._onTouchStart(n):this._onMouseDown(n)))}function dl(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function gl(n){switch(this._removePointer(n),this._pointers.length){case 0:this.domElement.releasePointerCapture(n.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(or),this.state=At.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 fl(n){let t;switch(n.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 d.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(n),this.state=At.DOLLY;break;case d.MOUSE.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=At.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=At.ROTATE}break;case d.MOUSE.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=At.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=At.PAN}break;default:this.state=At.NONE}this.state!==At.NONE&&this.dispatchEvent(mi)}function hl(n){switch(this.state){case At.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case At.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case At.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function pl(n){this.enabled===!1||this.enableZoom===!1||this.state!==At.NONE||(n.preventDefault(),this.dispatchEvent(mi),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(or))}function Cl(n){this.enabled!==!1&&this._handleKeyDown(n)}function ml(n){switch(this._trackPointer(n),this._pointers.length){case 1:switch(this.touches.ONE){case d.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(n),this.state=At.TOUCH_ROTATE;break;case d.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=At.TOUCH_PAN;break;default:this.state=At.NONE}break;case 2:switch(this.touches.TWO){case d.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(n),this.state=At.TOUCH_DOLLY_PAN;break;case d.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=At.TOUCH_DOLLY_ROTATE;break;default:this.state=At.NONE}break;default:this.state=At.NONE}this.state!==At.NONE&&this.dispatchEvent(mi)}function Il(n){switch(this._trackPointer(n),this.state){case At.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case At.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case At.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case At.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=At.NONE}}function yl(n){this.enabled!==!1&&n.preventDefault()}function wl(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function El(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class Bl extends rr{constructor(t){const e=t.camera;super(e,t.renderer.domElement);const s=this;s.dampingFactor=.1,s.rotateSpeed=.4,s.updateByOptions(t)}updateByOptions(t={}){if(!t)return;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),e.updateRotateAxis(),e.update()}updateRotateAxis(){this._quat?.setFromUnitVectors?.(this.object.up,new d.Vector3(0,1,0)),this._quatInverse=this._quat?.clone?.()?.invert?.()}}class Ql extends rr{constructor(t,e){super(t,e),this.screenSpacePanning=!1,this.mouseButtons={LEFT:d.MOUSE.PAN,MIDDLE:d.MOUSE.DOLLY,RIGHT:d.MOUSE.ROTATE},this.touches={ONE:d.TOUCH.PAN,TWO:d.TOUCH.DOLLY_ROTATE}}}const Ar=new d.Box3,qn=new d.Vector3;class cr extends d.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],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(s),this.setAttribute("position",new d.Float32BufferAttribute(t,3)),this.setAttribute("uv",new d.Float32BufferAttribute(e,2))}applyMatrix4(t){const e=this.attributes.instanceStart,s=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(t),s.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 s=new d.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new d.InterleavedBufferAttribute(s,3,0)),this.setAttribute("instanceEnd",new d.InterleavedBufferAttribute(s,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 s=new d.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new d.InterleavedBufferAttribute(s,3,0)),this.setAttribute("instanceColorEnd",new d.InterleavedBufferAttribute(s,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 d.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 d.Box3);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;t!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(t),Ar.setFromBufferAttribute(e),this.boundingBox.union(Ar))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new d.Sphere),this.boundingBox===null&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(t!==void 0&&e!==void 0){const s=this.boundingSphere.center;this.boundingBox.getCenter(s);let i=0;for(let a=0,o=t.count;a<o;a++)qn.fromBufferAttribute(t,a),i=Math.max(i,s.distanceToSquared(qn)),qn.fromBufferAttribute(e,a),i=Math.max(i,s.distanceToSquared(qn));this.boundingSphere.radius=Math.sqrt(i),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)}}d.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new d.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},d.ShaderLib.line={uniforms:d.UniformsUtils.merge([d.UniformsLib.common,d.UniformsLib.fog,d.UniformsLib.line]),vertexShader:`
425
425
  #include <common>
426
426
  #include <color_pars_vertex>
427
427
  #include <fog_pars_vertex>
@@ -791,21 +791,21 @@ float fnExp(float r2) {\r
791
791
  #include <premultiplied_alpha_fragment>
792
792
 
793
793
  }
794
- `};class Ve extends g.ShaderMaterial{constructor(t){super({type:"LineMaterial",uniforms:g.UniformsUtils.clone(g.ShaderLib.line.uniforms),vertexShader:g.ShaderLib.line.vertexShader,fragmentShader:g.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(t)}get color(){return this.uniforms.diffuse.value}set color(t){this.uniforms.diffuse.value=t}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(t){this.uniforms.linewidth&&(this.uniforms.linewidth.value=t)}get dashed(){return"USE_DASH"in this.defines}set dashed(t){t===!0!==this.dashed&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(t){this.uniforms.dashScale.value=t}get dashSize(){return this.uniforms.dashSize.value}set dashSize(t){this.uniforms.dashSize.value=t}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(t){this.uniforms.dashOffset.value=t}get gapSize(){return this.uniforms.gapSize.value}set gapSize(t){this.uniforms.gapSize.value=t}get opacity(){return this.uniforms.opacity.value}set opacity(t){this.uniforms&&(this.uniforms.opacity.value=t)}get resolution(){return this.uniforms.resolution.value}set resolution(t){this.uniforms.resolution.value.copy(t)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(t){this.defines&&(t===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),t===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const Ei=new g.Vector4,gr=new g.Vector3,fr=new g.Vector3,It=new g.Vector4,yt=new g.Vector4,jt=new g.Vector4,Qi=new g.Vector3,bi=new g.Matrix4,wt=new g.Line3,hr=new g.Vector3,ts=new g.Box3,es=new g.Sphere,qt=new g.Vector4;let $t,ye;function pr(n,t,e){return qt.set(0,0,-t,1).applyMatrix4(n.projectionMatrix),qt.multiplyScalar(1/qt.w),qt.x=ye/e.width,qt.y=ye/e.height,qt.applyMatrix4(n.projectionMatrixInverse),qt.multiplyScalar(1/qt.w),Math.abs(Math.max(qt.x,qt.y))}function Ml(n,t){const e=n.matrixWorld,s=n.geometry,i=s.attributes.instanceStart,a=s.attributes.instanceEnd,o=Math.min(s.instanceCount,i.count);for(let r=0,c=o;r<c;r++){wt.start.fromBufferAttribute(i,r),wt.end.fromBufferAttribute(a,r),wt.applyMatrix4(e);const A=new g.Vector3,u=new g.Vector3;$t.distanceSqToSegment(wt.start,wt.end,u,A),u.distanceTo(A)<ye*.5&&t.push({point:u,pointOnLine:A,distance:$t.origin.distanceTo(u),object:n,face:null,faceIndex:r,uv:null,uv1:null})}}function xl(n,t,e){const s=t.projectionMatrix,a=n.material.resolution,o=n.matrixWorld,r=n.geometry,c=r.attributes.instanceStart,A=r.attributes.instanceEnd,u=Math.min(r.instanceCount,c.count),l=-t.near;$t.at(1,jt),jt.w=1,jt.applyMatrix4(t.matrixWorldInverse),jt.applyMatrix4(s),jt.multiplyScalar(1/jt.w),jt.x*=a.x/2,jt.y*=a.y/2,jt.z=0,Qi.copy(jt),bi.multiplyMatrices(t.matrixWorldInverse,o);for(let C=0,h=u;C<h;C++){if(It.fromBufferAttribute(c,C),yt.fromBufferAttribute(A,C),It.w=1,yt.w=1,It.applyMatrix4(bi),yt.applyMatrix4(bi),It.z>l&&yt.z>l)continue;if(It.z>l){const D=It.z-yt.z,w=(It.z-l)/D;It.lerp(yt,w)}else if(yt.z>l){const D=yt.z-It.z,w=(yt.z-l)/D;yt.lerp(It,w)}It.applyMatrix4(s),yt.applyMatrix4(s),It.multiplyScalar(1/It.w),yt.multiplyScalar(1/yt.w),It.x*=a.x/2,It.y*=a.y/2,yt.x*=a.x/2,yt.y*=a.y/2,wt.start.copy(It),wt.start.z=0,wt.end.copy(yt),wt.end.z=0;const I=wt.closestPointToPointParameter(Qi,!0);wt.at(I,hr);const d=g.MathUtils.lerp(It.z,yt.z,I),p=d>=-1&&d<=1,f=Qi.distanceTo(hr)<ye*.5;if(p&&f){wt.start.fromBufferAttribute(c,C),wt.end.fromBufferAttribute(A,C),wt.start.applyMatrix4(o),wt.end.applyMatrix4(o);const D=new g.Vector3,w=new g.Vector3;$t.distanceSqToSegment(wt.start,wt.end,w,D),e.push({point:w,pointOnLine:D,distance:$t.origin.distanceTo(w),object:n,face:null,faceIndex:C,uv:null,uv1:null})}}}class vl extends g.Mesh{constructor(t=new dr,e=new Ve({color:Math.random()*16777215})){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,s=t.attributes.instanceEnd,i=new Float32Array(2*e.count);for(let o=0,r=0,c=e.count;o<c;o++,r+=2)gr.fromBufferAttribute(e,o),fr.fromBufferAttribute(s,o),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+gr.distanceTo(fr);const a=new g.InstancedInterleavedBuffer(i,2,1);return t.setAttribute("instanceDistanceStart",new g.InterleavedBufferAttribute(a,1,0)),t.setAttribute("instanceDistanceEnd",new g.InterleavedBufferAttribute(a,1,1)),this}raycast(t,e){const s=this.material.worldUnits,i=t.camera;i===null&&!s&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const a=t.params.Line2!==void 0&&t.params.Line2.threshold||0;$t=t.ray;const o=this.matrixWorld,r=this.geometry,c=this.material;ye=c.linewidth+a,r.boundingSphere===null&&r.computeBoundingSphere(),es.copy(r.boundingSphere).applyMatrix4(o);let A;if(s)A=ye*.5;else{const l=Math.max(i.near,es.distanceToPoint($t.origin));A=pr(i,l,c.resolution)}if(es.radius+=A,$t.intersectsSphere(es)===!1)return;r.boundingBox===null&&r.computeBoundingBox(),ts.copy(r.boundingBox).applyMatrix4(o);let u;if(s)u=ye*.5;else{const l=Math.max(i.near,ts.distanceToPoint($t.origin));u=pr(i,l,c.resolution)}ts.expandByScalar(u),$t.intersectsBox(ts)!==!1&&(s?Ml(this,e):xl(this,i,e))}onBeforeRender(t){const e=this.material.uniforms;e&&e.resolution&&(t.getViewport(Ei),this.material.uniforms.resolution.value.set(Ei.z,Ei.w))}}class gn extends dr{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(t){const e=t.length-3,s=new Float32Array(2*e);for(let i=0;i<e;i+=3)s[2*i]=t[i],s[2*i+1]=t[i+1],s[2*i+2]=t[i+2],s[2*i+3]=t[i+3],s[2*i+4]=t[i+4],s[2*i+5]=t[i+5];return super.setPositions(s),this}setColors(t){const e=t.length-3,s=new Float32Array(2*e);for(let i=0;i<e;i+=3)s[2*i]=t[i],s[2*i+1]=t[i+1],s[2*i+2]=t[i+2],s[2*i+3]=t[i+3],s[2*i+4]=t[i+4],s[2*i+5]=t[i+5];return super.setColors(s),this}setFromPoints(t){const e=t.length-1,s=new Float32Array(6*e);for(let i=0;i<e;i++)s[6*i]=t[i].x,s[6*i+1]=t[i].y,s[6*i+2]=t[i].z||0,s[6*i+3]=t[i+1].x,s[6*i+4]=t[i+1].y,s[6*i+5]=t[i+1].z||0;return super.setPositions(s),this}fromLine(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}}class we extends vl{constructor(t=new gn,e=new Ve({color:Math.random()*16777215})){super(t,e),this.isLine2=!0,this.type="Line2"}}const Cr=new g.Vector3,Dl=new g.Quaternion,mr=new g.Vector3;class kl extends g.Object3D{constructor(t=document.createElement("div")){super(),this.isCSS3DObject=!0,this.element=t,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(e){e.element instanceof e.element.ownerDocument.defaultView.Element&&e.element.parentNode!==null&&e.element.remove()})})}copy(t,e){return super.copy(t,e),this.element=t.element.cloneNode(!0),this}}class Bt extends kl{constructor(t){super(t),this.isCSS3DSprite=!0,this.rotation2D=0}copy(t,e){return super.copy(t,e),this.rotation2D=t.rotation2D,this}}const te=new g.Matrix4,Tl=new g.Matrix4;class Ll{constructor(t={}){const e=this;let s,i,a,o;const r={camera:{style:""},objects:new WeakMap},c=t.element!==void 0?t.element:document.createElement("div");c.style.overflow="hidden",this.domElement=c;const A=document.createElement("div");A.style.transformOrigin="0 0",A.style.pointerEvents="none",c.appendChild(A);const u=document.createElement("div");u.style.transformStyle="preserve-3d",A.appendChild(u),this.getSize=function(){return{width:s,height:i}},this.render=function(d,p){const f=p.projectionMatrix.elements[5]*o;p.view&&p.view.enabled?(A.style.transform=`translate( ${-p.view.offsetX*(s/p.view.width)}px, ${-p.view.offsetY*(i/p.view.height)}px )`,A.style.transform+=`scale( ${p.view.fullWidth/p.view.width}, ${p.view.fullHeight/p.view.height} )`):A.style.transform="",d.matrixWorldAutoUpdate===!0&&d.updateMatrixWorld(),p.parent===null&&p.matrixWorldAutoUpdate===!0&&p.updateMatrixWorld();let D,w;p.isOrthographicCamera&&(D=-(p.right+p.left)/2,w=(p.top+p.bottom)/2);const x=p.view&&p.view.enabled?p.view.height/p.view.fullHeight:1,b=p.isOrthographicCamera?`scale( ${x} )scale(`+f+")translate("+l(D)+"px,"+l(w)+"px)"+C(p.matrixWorldInverse):`scale( ${x} )translateZ(`+f+"px)"+C(p.matrixWorldInverse),y=(p.isPerspectiveCamera?"perspective("+f+"px) ":"")+b+"translate("+a+"px,"+o+"px)";r.camera.style!==y&&(u.style.transform=y,r.camera.style=y),I(d,d,p)},this.setSize=function(d,p){s=d,i=p,a=s/2,o=i/2,c.style.width=d+"px",c.style.height=p+"px",A.style.width=d+"px",A.style.height=p+"px",u.style.width=d+"px",u.style.height=p+"px"};function l(d){return Math.abs(d)<1e-10?0:d}function C(d){const p=d.elements;return"matrix3d("+l(p[0])+","+l(-p[1])+","+l(p[2])+","+l(p[3])+","+l(p[4])+","+l(-p[5])+","+l(p[6])+","+l(p[7])+","+l(p[8])+","+l(-p[9])+","+l(p[10])+","+l(p[11])+","+l(p[12])+","+l(-p[13])+","+l(p[14])+","+l(p[15])+")"}function h(d){const p=d.elements;return"translate(-50%,-50%)"+("matrix3d("+l(p[0])+","+l(p[1])+","+l(p[2])+","+l(p[3])+","+l(-p[4])+","+l(-p[5])+","+l(-p[6])+","+l(-p[7])+","+l(p[8])+","+l(p[9])+","+l(p[10])+","+l(p[11])+","+l(p[12])+","+l(p[13])+","+l(p[14])+","+l(p[15])+")")}function m(d){d.isCSS3DObject&&(d.element.style.display="none");for(let p=0,f=d.children.length;p<f;p++)m(d.children[p])}function I(d,p,f,D){if(d.visible===!1){m(d);return}if(d.isCSS3DObject){const w=d.layers.test(f.layers)===!0,x=d.element;if(x.style.display=w===!0?"":"none",w===!0){d.onBeforeRender(e,p,f);let b;d.isCSS3DSprite?(te.copy(f.matrixWorldInverse),te.transpose(),d.rotation2D!==0&&te.multiply(Tl.makeRotationZ(d.rotation2D)),d.matrixWorld.decompose(Cr,Dl,mr),te.setPosition(Cr),te.scale(mr),te.elements[3]=0,te.elements[7]=0,te.elements[11]=0,te.elements[15]=1,b=h(te)):b=h(d.matrixWorld);const Q=r.objects.get(d);if(Q===void 0||Q.style!==b){x.style.transform=b;const y={style:b};r.objects.set(d,y)}x.parentNode!==u&&u.appendChild(x),d.onAfterRender(e,p,f)}}for(let w=0,x=d.children.length;w<x;w++)I(d.children[w],p,f)}}}class Bi extends we{constructor(t){super(),this.isMark=!0,this.disposed=!1,this.events=t}drawStart(t,e){if(this.disposed)return;const s=this,i=document.querySelectorAll(".mark-wrap-line.main-warp").length+1,a={type:"MarkDistanceLine",name:e||"line"+Date.now(),startPoint:t.toArray(),endPoint:t.toArray(),lineColor:"#eeee00",lineWidth:3,mainTagColor:"#c4c4c4",mainTagBackground:"#2E2E30",mainTagOpacity:.8,mainTagVisible:!0,distanceTagColor:"#000000",distanceTagBackground:"#e0ffff",distanceTagOpacity:.9,distanceTagVisible:!0,title:"标记距离"+i},o=new gn;o.setPositions([...a.startPoint,...a.endPoint]);const r=new Ve({color:a.lineColor,linewidth:a.lineWidth});r.resolution.set(innerWidth,innerHeight),s.copy(new we(o,r));const c=new g.CircleGeometry(.05,32),A=new g.MeshBasicMaterial({color:16777215,side:g.DoubleSide});A.transparent=!0,A.opacity=.6;const u=new g.Mesh(c,A);u.position.copy(t),u.isMark=!0;const l=new g.Mesh(c,A);l.position.copy(t),l.isMark=!0;const C=document.createElement("div");C.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
794
+ `};class He extends d.ShaderMaterial{constructor(t){super({type:"LineMaterial",uniforms:d.UniformsUtils.clone(d.ShaderLib.line.uniforms),vertexShader:d.ShaderLib.line.vertexShader,fragmentShader:d.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(t)}get color(){return this.uniforms.diffuse.value}set color(t){this.uniforms.diffuse.value=t}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(t){this.uniforms.linewidth&&(this.uniforms.linewidth.value=t)}get dashed(){return"USE_DASH"in this.defines}set dashed(t){t===!0!==this.dashed&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(t){this.uniforms.dashScale.value=t}get dashSize(){return this.uniforms.dashSize.value}set dashSize(t){this.uniforms.dashSize.value=t}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(t){this.uniforms.dashOffset.value=t}get gapSize(){return this.uniforms.gapSize.value}set gapSize(t){this.uniforms.gapSize.value=t}get opacity(){return this.uniforms.opacity.value}set opacity(t){this.uniforms&&(this.uniforms.opacity.value=t)}get resolution(){return this.uniforms.resolution.value}set resolution(t){this.uniforms.resolution.value.copy(t)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(t){this.defines&&(t===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),t===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const yi=new d.Vector4,lr=new d.Vector3,ur=new d.Vector3,mt=new d.Vector4,It=new d.Vector4,jt=new d.Vector4,wi=new d.Vector3,Ei=new d.Matrix4,yt=new d.Line3,dr=new d.Vector3,$n=new d.Box3,ts=new d.Sphere,qt=new d.Vector4;let $t,we;function gr(n,t,e){return qt.set(0,0,-t,1).applyMatrix4(n.projectionMatrix),qt.multiplyScalar(1/qt.w),qt.x=we/e.width,qt.y=we/e.height,qt.applyMatrix4(n.projectionMatrixInverse),qt.multiplyScalar(1/qt.w),Math.abs(Math.max(qt.x,qt.y))}function bl(n,t){const e=n.matrixWorld,s=n.geometry,i=s.attributes.instanceStart,a=s.attributes.instanceEnd,o=Math.min(s.instanceCount,i.count);for(let r=0,c=o;r<c;r++){yt.start.fromBufferAttribute(i,r),yt.end.fromBufferAttribute(a,r),yt.applyMatrix4(e);const A=new d.Vector3,u=new d.Vector3;$t.distanceSqToSegment(yt.start,yt.end,u,A),u.distanceTo(A)<we*.5&&t.push({point:u,pointOnLine:A,distance:$t.origin.distanceTo(u),object:n,face:null,faceIndex:r,uv:null,uv1:null})}}function Sl(n,t,e){const s=t.projectionMatrix,a=n.material.resolution,o=n.matrixWorld,r=n.geometry,c=r.attributes.instanceStart,A=r.attributes.instanceEnd,u=Math.min(r.instanceCount,c.count),l=-t.near;$t.at(1,jt),jt.w=1,jt.applyMatrix4(t.matrixWorldInverse),jt.applyMatrix4(s),jt.multiplyScalar(1/jt.w),jt.x*=a.x/2,jt.y*=a.y/2,jt.z=0,wi.copy(jt),Ei.multiplyMatrices(t.matrixWorldInverse,o);for(let C=0,h=u;C<h;C++){if(mt.fromBufferAttribute(c,C),It.fromBufferAttribute(A,C),mt.w=1,It.w=1,mt.applyMatrix4(Ei),It.applyMatrix4(Ei),mt.z>l&&It.z>l)continue;if(mt.z>l){const D=mt.z-It.z,w=(mt.z-l)/D;mt.lerp(It,w)}else if(It.z>l){const D=It.z-mt.z,w=(It.z-l)/D;It.lerp(mt,w)}mt.applyMatrix4(s),It.applyMatrix4(s),mt.multiplyScalar(1/mt.w),It.multiplyScalar(1/It.w),mt.x*=a.x/2,mt.y*=a.y/2,It.x*=a.x/2,It.y*=a.y/2,yt.start.copy(mt),yt.start.z=0,yt.end.copy(It),yt.end.z=0;const I=yt.closestPointToPointParameter(wi,!0);yt.at(I,dr);const g=d.MathUtils.lerp(mt.z,It.z,I),p=g>=-1&&g<=1,f=wi.distanceTo(dr)<we*.5;if(p&&f){yt.start.fromBufferAttribute(c,C),yt.end.fromBufferAttribute(A,C),yt.start.applyMatrix4(o),yt.end.applyMatrix4(o);const D=new d.Vector3,w=new d.Vector3;$t.distanceSqToSegment(yt.start,yt.end,w,D),e.push({point:w,pointOnLine:D,distance:$t.origin.distanceTo(w),object:n,face:null,faceIndex:C,uv:null,uv1:null})}}}class xl extends d.Mesh{constructor(t=new cr,e=new He({color:Math.random()*16777215})){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,s=t.attributes.instanceEnd,i=new Float32Array(2*e.count);for(let o=0,r=0,c=e.count;o<c;o++,r+=2)lr.fromBufferAttribute(e,o),ur.fromBufferAttribute(s,o),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+lr.distanceTo(ur);const a=new d.InstancedInterleavedBuffer(i,2,1);return t.setAttribute("instanceDistanceStart",new d.InterleavedBufferAttribute(a,1,0)),t.setAttribute("instanceDistanceEnd",new d.InterleavedBufferAttribute(a,1,1)),this}raycast(t,e){const s=this.material.worldUnits,i=t.camera;i===null&&!s&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const a=t.params.Line2!==void 0&&t.params.Line2.threshold||0;$t=t.ray;const o=this.matrixWorld,r=this.geometry,c=this.material;we=c.linewidth+a,r.boundingSphere===null&&r.computeBoundingSphere(),ts.copy(r.boundingSphere).applyMatrix4(o);let A;if(s)A=we*.5;else{const l=Math.max(i.near,ts.distanceToPoint($t.origin));A=gr(i,l,c.resolution)}if(ts.radius+=A,$t.intersectsSphere(ts)===!1)return;r.boundingBox===null&&r.computeBoundingBox(),$n.copy(r.boundingBox).applyMatrix4(o);let u;if(s)u=we*.5;else{const l=Math.max(i.near,$n.distanceToPoint($t.origin));u=gr(i,l,c.resolution)}$n.expandByScalar(u),$t.intersectsBox($n)!==!1&&(s?bl(this,e):Sl(this,i,e))}onBeforeRender(t){const e=this.material.uniforms;e&&e.resolution&&(t.getViewport(yi),this.material.uniforms.resolution.value.set(yi.z,yi.w))}}class dn extends cr{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(t){const e=t.length-3,s=new Float32Array(2*e);for(let i=0;i<e;i+=3)s[2*i]=t[i],s[2*i+1]=t[i+1],s[2*i+2]=t[i+2],s[2*i+3]=t[i+3],s[2*i+4]=t[i+4],s[2*i+5]=t[i+5];return super.setPositions(s),this}setColors(t){const e=t.length-3,s=new Float32Array(2*e);for(let i=0;i<e;i+=3)s[2*i]=t[i],s[2*i+1]=t[i+1],s[2*i+2]=t[i+2],s[2*i+3]=t[i+3],s[2*i+4]=t[i+4],s[2*i+5]=t[i+5];return super.setColors(s),this}setFromPoints(t){const e=t.length-1,s=new Float32Array(6*e);for(let i=0;i<e;i++)s[6*i]=t[i].x,s[6*i+1]=t[i].y,s[6*i+2]=t[i].z||0,s[6*i+3]=t[i+1].x,s[6*i+4]=t[i+1].y,s[6*i+5]=t[i+1].z||0;return super.setPositions(s),this}fromLine(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}}class Ee extends xl{constructor(t=new dn,e=new He({color:Math.random()*16777215})){super(t,e),this.isLine2=!0,this.type="Line2"}}const fr=new d.Vector3,Ml=new d.Quaternion,hr=new d.Vector3;class vl extends d.Object3D{constructor(t=document.createElement("div")){super(),this.isCSS3DObject=!0,this.element=t,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(e){e.element instanceof e.element.ownerDocument.defaultView.Element&&e.element.parentNode!==null&&e.element.remove()})})}copy(t,e){return super.copy(t,e),this.element=t.element.cloneNode(!0),this}}class bt extends vl{constructor(t){super(t),this.isCSS3DSprite=!0,this.rotation2D=0}copy(t,e){return super.copy(t,e),this.rotation2D=t.rotation2D,this}}const te=new d.Matrix4,Dl=new d.Matrix4;class kl{constructor(t={}){const e=this;let s,i,a,o;const r={camera:{style:""},objects:new WeakMap},c=t.element!==void 0?t.element:document.createElement("div");c.style.overflow="hidden",this.domElement=c;const A=document.createElement("div");A.style.transformOrigin="0 0",A.style.pointerEvents="none",c.appendChild(A);const u=document.createElement("div");u.style.transformStyle="preserve-3d",A.appendChild(u),this.getSize=function(){return{width:s,height:i}},this.render=function(g,p){const f=p.projectionMatrix.elements[5]*o;p.view&&p.view.enabled?(A.style.transform=`translate( ${-p.view.offsetX*(s/p.view.width)}px, ${-p.view.offsetY*(i/p.view.height)}px )`,A.style.transform+=`scale( ${p.view.fullWidth/p.view.width}, ${p.view.fullHeight/p.view.height} )`):A.style.transform="",g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),p.parent===null&&p.matrixWorldAutoUpdate===!0&&p.updateMatrixWorld();let D,w;p.isOrthographicCamera&&(D=-(p.right+p.left)/2,w=(p.top+p.bottom)/2);const x=p.view&&p.view.enabled?p.view.height/p.view.fullHeight:1,b=p.isOrthographicCamera?`scale( ${x} )scale(`+f+")translate("+l(D)+"px,"+l(w)+"px)"+C(p.matrixWorldInverse):`scale( ${x} )translateZ(`+f+"px)"+C(p.matrixWorldInverse),y=(p.isPerspectiveCamera?"perspective("+f+"px) ":"")+b+"translate("+a+"px,"+o+"px)";r.camera.style!==y&&(u.style.transform=y,r.camera.style=y),I(g,g,p)},this.setSize=function(g,p){s=g,i=p,a=s/2,o=i/2,c.style.width=g+"px",c.style.height=p+"px",A.style.width=g+"px",A.style.height=p+"px",u.style.width=g+"px",u.style.height=p+"px"};function l(g){return Math.abs(g)<1e-10?0:g}function C(g){const p=g.elements;return"matrix3d("+l(p[0])+","+l(-p[1])+","+l(p[2])+","+l(p[3])+","+l(p[4])+","+l(-p[5])+","+l(p[6])+","+l(p[7])+","+l(p[8])+","+l(-p[9])+","+l(p[10])+","+l(p[11])+","+l(p[12])+","+l(-p[13])+","+l(p[14])+","+l(p[15])+")"}function h(g){const p=g.elements;return"translate(-50%,-50%)"+("matrix3d("+l(p[0])+","+l(p[1])+","+l(p[2])+","+l(p[3])+","+l(-p[4])+","+l(-p[5])+","+l(-p[6])+","+l(-p[7])+","+l(p[8])+","+l(p[9])+","+l(p[10])+","+l(p[11])+","+l(p[12])+","+l(p[13])+","+l(p[14])+","+l(p[15])+")")}function m(g){g.isCSS3DObject&&(g.element.style.display="none");for(let p=0,f=g.children.length;p<f;p++)m(g.children[p])}function I(g,p,f,D){if(g.visible===!1){m(g);return}if(g.isCSS3DObject){const w=g.layers.test(f.layers)===!0,x=g.element;if(x.style.display=w===!0?"":"none",w===!0){g.onBeforeRender(e,p,f);let b;g.isCSS3DSprite?(te.copy(f.matrixWorldInverse),te.transpose(),g.rotation2D!==0&&te.multiply(Dl.makeRotationZ(g.rotation2D)),g.matrixWorld.decompose(fr,Ml,hr),te.setPosition(fr),te.scale(hr),te.elements[3]=0,te.elements[7]=0,te.elements[11]=0,te.elements[15]=1,b=h(te)):b=h(g.matrixWorld);const B=r.objects.get(g);if(B===void 0||B.style!==b){x.style.transform=b;const y={style:b};r.objects.set(g,y)}x.parentNode!==u&&u.appendChild(x),g.onAfterRender(e,p,f)}}for(let w=0,x=g.children.length;w<x;w++)I(g.children[w],p,f)}}}class Bi extends Ee{constructor(t){super(),this.isMark=!0,this.disposed=!1,this.events=t}drawStart(t,e){if(this.disposed)return;const s=this,i=document.querySelectorAll(".mark-wrap-line.main-warp").length+1,a={type:"MarkDistanceLine",name:e||"line"+Date.now(),startPoint:t.toArray(),endPoint:t.toArray(),lineColor:"#eeee00",lineWidth:3,mainTagColor:"#c4c4c4",mainTagBackground:"#2E2E30",mainTagOpacity:.8,mainTagVisible:!0,distanceTagColor:"#000000",distanceTagBackground:"#e0ffff",distanceTagOpacity:.9,distanceTagVisible:!0,title:"标记距离"+i},o=new dn;o.setPositions([...a.startPoint,...a.endPoint]);const r=new He({color:a.lineColor,linewidth:a.lineWidth});r.resolution.set(innerWidth,innerHeight),s.copy(new Ee(o,r));const c=new d.CircleGeometry(.05,32),A=new d.MeshBasicMaterial({color:16777215,side:d.DoubleSide});A.transparent=!0,A.opacity=.6;const u=new d.Mesh(c,A);u.position.copy(t),u.isMark=!0;const l=new d.Mesh(c,A);l.position.copy(t),l.isMark=!0;const C=document.createElement("div");C.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
795
795
  <span class="${a.name}-main-tag" style="color:${a.mainTagColor};background:${a.mainTagBackground};opacity:${a.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${a.title}</span>
796
- </div>`,C.classList.add("mark-wrap-line",`${a.name}`,"main-warp"),C.style.position="absolute",C.style.borderRadius="4px",C.style.cursor="pointer",C.onclick=()=>{if(s.events.fire(R).markMode)return;const d=parent?.onActiveMark;d?.(s.getMarkData(!0)),s.events.fire(mt)},C.oncontextmenu=d=>d.preventDefault();const h=new Bt(C);h.position.copy(t),h.element.style.pointerEvents="none",h.scale.set(.01,.01,.01),h.visible=a.mainTagVisible;const m=document.createElement("div");m.innerHTML=`<span class="${e}-distance-tag ${e}-distance-tag0" style="color:${a.distanceTagColor};background:${a.distanceTagBackground};opacity:${a.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;"></span>`,m.classList.add("mark-wrap-line",`${e}`,"distance-warp"),m.style.position="absolute",m.style.borderRadius="4px",m.style.pointerEvents="none";const I=new Bt(m);I.position.set(t.x,t.y,t.z),I.element.style.pointerEvents="none",I.scale.set(.008,.008,.008),I.visible=!1,s.add(u,l,h,I),s.data=a,s.circleStart=u,s.circleEnd=l,s.css3dTag=I,s.css3dMainTag=h,s.events.fire(ue,s)}drawUpdate(t,e=!0){if(this.disposed)return;const s=this;if(t?.endPoint){e&&(s.data.endPoint=[...t.endPoint]);const i=new g.Vector3().fromArray(s.data.startPoint),a=new g.Vector3().fromArray(t.endPoint);s.geometry.setPositions([...s.data.startPoint,...t.endPoint]);const o=new g.Vector3((i.x+a.x)/2,(i.y+a.y)/2,(i.z+a.z)/2);s.css3dTag.position.set(o.x,o.y,o.z);const r=a.clone().sub(i).normalize();s.circleStart.lookAt(s.circleStart.position.clone().add(r)),s.circleEnd.lookAt(s.circleEnd.position.clone().add(r));const c=i.distanceTo(a);s.css3dTag.visible=c>.5;const A=(c*s.events.fire(R).meterScale).toFixed(2)+" m";s.css3dTag.element.childNodes[0].innerText=A}t?.lineColor&&(e&&(s.data.lineColor=t.lineColor),s.material.color.set(t.lineColor)),t?.lineWidth&&(e&&(s.data.lineWidth=t.lineWidth),s.material.linewidth=t.lineWidth),t?.mainTagColor&&(e&&(s.data.mainTagColor=t.mainTagColor),document.querySelector(`.${s.data.name}-main-tag`).style.color=t.mainTagColor),t?.mainTagBackground&&(e&&(s.data.mainTagBackground=t.mainTagBackground),document.querySelector(`.${s.data.name}-main-tag`).style.background=t.mainTagBackground),t?.mainTagOpacity&&(e&&(s.data.mainTagOpacity=t.mainTagOpacity),document.querySelector(`.${s.data.name}-main-tag`).style.opacity=t.mainTagOpacity.toString()),t?.mainTagVisible!==void 0&&(e&&(s.data.mainTagVisible=t.mainTagVisible),s.css3dMainTag.visible=t.mainTagVisible),t?.distanceTagColor&&(e&&(s.data.distanceTagColor=t.distanceTagColor),document.querySelector(`.${s.data.name}-distance-tag0`).style.color=t.distanceTagColor),t?.distanceTagBackground&&(e&&(s.data.distanceTagBackground=t.distanceTagBackground),document.querySelector(`.${s.data.name}-distance-tag0`).style.background=t.distanceTagBackground),t?.distanceTagOpacity&&(e&&(s.data.distanceTagOpacity=t.distanceTagOpacity),document.querySelector(`.${s.data.name}-distance-tag0`).style.opacity=t.distanceTagOpacity.toString()),t?.distanceTagVisible!==void 0&&(e&&(s.data.distanceTagVisible=t.distanceTagVisible),s.css3dTag.visible=t.distanceTagVisible),t?.title!==void 0&&(e&&(s.data.title=t.title),this.css3dMainTag.element.querySelector(`.${s.data.name}-main-tag`).innerText=t.title),t?.note!==void 0&&e&&(s.data.note=t.note),s.events.fire(Ct)}updateByMeterScale(t){const e=this,s=new g.Vector3().fromArray(e.data.startPoint),i=new g.Vector3().fromArray(e.data.endPoint),a=(s.distanceTo(i)*t).toFixed(2)+" m";e.css3dTag.element.childNodes[0].innerText=a}drawFinish(t){if(this.disposed)return;const e=this;e.data.endPoint=[...t.toArray()];const s=new g.Vector3().fromArray(e.data.startPoint),i=new g.Vector3().fromArray(e.data.endPoint),a=new g.Vector3((s.x+i.x)/2,(s.y+i.y)/2,(s.z+i.z)/2);e.geometry.setPositions([...e.data.startPoint,...e.data.endPoint]),e.css3dTag.position.set(a.x,a.y,a.z);const o=i.clone().sub(s).normalize();e.circleStart.lookAt(e.circleStart.position.clone().add(o)),e.circleEnd.lookAt(e.circleEnd.position.clone().add(o)),e.circleEnd.position.copy(i);const r=s.distanceTo(i);e.css3dTag.visible=!0;const c=(r*e.events.fire(R).meterScale).toFixed(2)+" m";e.css3dTag.element.childNodes[0].innerText=c,e.events.fire(de);const A=parent?.onActiveMark,u=e.getMarkData(!0);u.isNew=!0,u.meterScale=e.events.fire(R).meterScale,A?.(u)}draw(t){if(this.disposed)return;const e=this,s={type:"MarkDistanceLine",name:t.name||"line"+Date.now(),startPoint:[...t.startPoint],endPoint:[...t.endPoint],lineColor:t.lineColor||"#eeee00",lineWidth:t.lineWidth||3,mainTagColor:t.mainTagColor||"#c4c4c4",mainTagBackground:t.mainTagBackground||"#2E2E30",mainTagOpacity:t.mainTagOpacity||.8,mainTagVisible:t.mainTagVisible===void 0?!0:t.mainTagVisible,distanceTagColor:t.distanceTagColor||"#000000",distanceTagBackground:t.distanceTagBackground||"#e0ffff",distanceTagOpacity:t.distanceTagOpacity||.9,distanceTagVisible:t.distanceTagVisible===void 0?!0:t.distanceTagVisible,title:t.title||"标记距离"},i=new g.Vector3().fromArray(s.startPoint),a=new g.Vector3().fromArray(s.endPoint),o=new g.Vector3((i.x+a.x)/2,(i.y+a.y)/2,(i.z+a.z)/2),r=new gn;r.setPositions([...s.startPoint,...s.endPoint]);const c=new Ve({color:s.lineColor,linewidth:s.lineWidth});c.resolution.set(innerWidth,innerHeight),e.copy(new we(r,c));const A=new g.CircleGeometry(.05,32),u=new g.MeshBasicMaterial({color:16777215,side:g.DoubleSide});u.transparent=!0,u.opacity=.6;const l=new g.Mesh(A,u);l.position.copy(i),l.isMark=!0;const C=new g.Mesh(A,u);C.position.copy(a),C.isMark=!0;const h=a.clone().sub(i).normalize();l.lookAt(l.position.clone().add(h)),C.lookAt(C.position.clone().add(h));const m=s.name,I=document.createElement("div");I.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
796
+ </div>`,C.classList.add("mark-wrap-line",`${a.name}`,"main-warp"),C.style.position="absolute",C.style.borderRadius="4px",C.style.cursor="pointer",C.onclick=()=>{if(s.events.fire(L).markMode)return;const g=parent?.onActiveMark;g?.(s.getMarkData(!0)),s.events.fire(Ct)},C.oncontextmenu=g=>g.preventDefault();const h=new bt(C);h.position.copy(t),h.element.style.pointerEvents="none",h.scale.set(.01,.01,.01),h.visible=a.mainTagVisible;const m=document.createElement("div");m.innerHTML=`<span class="${e}-distance-tag ${e}-distance-tag0" style="color:${a.distanceTagColor};background:${a.distanceTagBackground};opacity:${a.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;"></span>`,m.classList.add("mark-wrap-line",`${e}`,"distance-warp"),m.style.position="absolute",m.style.borderRadius="4px",m.style.pointerEvents="none";const I=new bt(m);I.position.set(t.x,t.y,t.z),I.element.style.pointerEvents="none",I.scale.set(.008,.008,.008),I.visible=!1,s.add(u,l,h,I),s.data=a,s.circleStart=u,s.circleEnd=l,s.css3dTag=I,s.css3dMainTag=h,s.events.fire(ge,s)}drawUpdate(t,e=!0){if(this.disposed)return;const s=this;if(t?.endPoint){e&&(s.data.endPoint=[...t.endPoint]);const i=new d.Vector3().fromArray(s.data.startPoint),a=new d.Vector3().fromArray(t.endPoint);s.geometry.setPositions([...s.data.startPoint,...t.endPoint]);const o=new d.Vector3((i.x+a.x)/2,(i.y+a.y)/2,(i.z+a.z)/2);s.css3dTag.position.set(o.x,o.y,o.z);const r=a.clone().sub(i).normalize();s.circleStart.lookAt(s.circleStart.position.clone().add(r)),s.circleEnd.lookAt(s.circleEnd.position.clone().add(r));const c=i.distanceTo(a);s.css3dTag.visible=c>.5;const A=(c*s.events.fire(L).meterScale).toFixed(2)+" m";s.css3dTag.element.childNodes[0].innerText=A}t?.lineColor&&(e&&(s.data.lineColor=t.lineColor),s.material.color.set(t.lineColor)),t?.lineWidth&&(e&&(s.data.lineWidth=t.lineWidth),s.material.linewidth=t.lineWidth),t?.mainTagColor&&(e&&(s.data.mainTagColor=t.mainTagColor),document.querySelector(`.${s.data.name}-main-tag`).style.color=t.mainTagColor),t?.mainTagBackground&&(e&&(s.data.mainTagBackground=t.mainTagBackground),document.querySelector(`.${s.data.name}-main-tag`).style.background=t.mainTagBackground),t?.mainTagOpacity&&(e&&(s.data.mainTagOpacity=t.mainTagOpacity),document.querySelector(`.${s.data.name}-main-tag`).style.opacity=t.mainTagOpacity.toString()),t?.mainTagVisible!==void 0&&(e&&(s.data.mainTagVisible=t.mainTagVisible),s.css3dMainTag.visible=t.mainTagVisible),t?.distanceTagColor&&(e&&(s.data.distanceTagColor=t.distanceTagColor),document.querySelector(`.${s.data.name}-distance-tag0`).style.color=t.distanceTagColor),t?.distanceTagBackground&&(e&&(s.data.distanceTagBackground=t.distanceTagBackground),document.querySelector(`.${s.data.name}-distance-tag0`).style.background=t.distanceTagBackground),t?.distanceTagOpacity&&(e&&(s.data.distanceTagOpacity=t.distanceTagOpacity),document.querySelector(`.${s.data.name}-distance-tag0`).style.opacity=t.distanceTagOpacity.toString()),t?.distanceTagVisible!==void 0&&(e&&(s.data.distanceTagVisible=t.distanceTagVisible),s.css3dTag.visible=t.distanceTagVisible),t?.title!==void 0&&(e&&(s.data.title=t.title),this.css3dMainTag.element.querySelector(`.${s.data.name}-main-tag`).innerText=t.title),t?.note!==void 0&&e&&(s.data.note=t.note),s.events.fire(pt)}updateByMeterScale(t){const e=this,s=new d.Vector3().fromArray(e.data.startPoint),i=new d.Vector3().fromArray(e.data.endPoint),a=(s.distanceTo(i)*t).toFixed(2)+" m";e.css3dTag.element.childNodes[0].innerText=a}drawFinish(t){if(this.disposed)return;const e=this;e.data.endPoint=[...t.toArray()];const s=new d.Vector3().fromArray(e.data.startPoint),i=new d.Vector3().fromArray(e.data.endPoint),a=new d.Vector3((s.x+i.x)/2,(s.y+i.y)/2,(s.z+i.z)/2);e.geometry.setPositions([...e.data.startPoint,...e.data.endPoint]),e.css3dTag.position.set(a.x,a.y,a.z);const o=i.clone().sub(s).normalize();e.circleStart.lookAt(e.circleStart.position.clone().add(o)),e.circleEnd.lookAt(e.circleEnd.position.clone().add(o)),e.circleEnd.position.copy(i);const r=s.distanceTo(i);e.css3dTag.visible=!0;const c=(r*e.events.fire(L).meterScale).toFixed(2)+" m";e.css3dTag.element.childNodes[0].innerText=c,e.events.fire(fe);const A=parent?.onActiveMark,u=e.getMarkData(!0);u.isNew=!0,u.meterScale=e.events.fire(L).meterScale,A?.(u)}draw(t){if(this.disposed)return;const e=this,s={type:"MarkDistanceLine",name:t.name||"line"+Date.now(),startPoint:[...t.startPoint],endPoint:[...t.endPoint],lineColor:t.lineColor||"#eeee00",lineWidth:t.lineWidth||3,mainTagColor:t.mainTagColor||"#c4c4c4",mainTagBackground:t.mainTagBackground||"#2E2E30",mainTagOpacity:t.mainTagOpacity||.8,mainTagVisible:t.mainTagVisible===void 0?!0:t.mainTagVisible,distanceTagColor:t.distanceTagColor||"#000000",distanceTagBackground:t.distanceTagBackground||"#e0ffff",distanceTagOpacity:t.distanceTagOpacity||.9,distanceTagVisible:t.distanceTagVisible===void 0?!0:t.distanceTagVisible,title:t.title||"标记距离"},i=new d.Vector3().fromArray(s.startPoint),a=new d.Vector3().fromArray(s.endPoint),o=new d.Vector3((i.x+a.x)/2,(i.y+a.y)/2,(i.z+a.z)/2),r=new dn;r.setPositions([...s.startPoint,...s.endPoint]);const c=new He({color:s.lineColor,linewidth:s.lineWidth});c.resolution.set(innerWidth,innerHeight),e.copy(new Ee(r,c));const A=new d.CircleGeometry(.05,32),u=new d.MeshBasicMaterial({color:16777215,side:d.DoubleSide});u.transparent=!0,u.opacity=.6;const l=new d.Mesh(A,u);l.position.copy(i),l.isMark=!0;const C=new d.Mesh(A,u);C.position.copy(a),C.isMark=!0;const h=a.clone().sub(i).normalize();l.lookAt(l.position.clone().add(h)),C.lookAt(C.position.clone().add(h));const m=s.name,I=document.createElement("div");I.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
797
797
  <span class="${m}-main-tag" style="color:${s.mainTagColor};background:${s.mainTagBackground};opacity:${s.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: auto;">${s.title}</span>
798
- </div>`,I.classList.add("mark-wrap-line",`${s.name}`,"main-warp"),I.style.position="absolute",I.style.borderRadius="4px",I.style.cursor="pointer",I.onclick=()=>{if(e.events.fire(R).markMode)return;const x=parent?.onActiveMark;x?.(e.getMarkData(!0)),e.events.fire(mt)},I.oncontextmenu=x=>x.preventDefault();const d=new Bt(I);d.position.copy(i),d.element.style.pointerEvents="none",d.scale.set(.01,.01,.01),d.visible=s.mainTagVisible;const f=(i.distanceTo(a)*e.events.fire(R).meterScale).toFixed(2)+" m",D=document.createElement("div");D.innerHTML=`<span class="${m}-distance-tag ${m}-distance-tag0" style="color:${s.distanceTagColor};background:${s.distanceTagBackground};opacity:${s.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${f}</span>`,D.classList.add("mark-wrap-line",`${m}`,"distance-warp"),D.style.position="absolute",D.style.borderRadius="4px",D.style.pointerEvents="none";const w=new Bt(D);w.position.copy(o),w.element.style.pointerEvents="none",w.scale.set(.008,.008,.008),w.visible=s.distanceTagVisible,e.add(l,C,d,w),e.data=s,e.circleStart=l,e.circleEnd=C,e.css3dTag=w,e.css3dMainTag=d,e.events.fire(ue,e)}getMarkData(t=!1){const e={...this.data};return t?(delete e.startPoint,delete e.endPoint):(e.startPoint=[...e.startPoint],e.endPoint=[...e.endPoint]),e}dispose(){if(this.disposed)return;const t=this;t.disposed=!0,t.events.fire(ie,t),t.events.fire(X).remove(t),t.events.fire(ve,t),document.querySelectorAll(`.${t.data.name}`).forEach(s=>s.parentElement?.removeChild(s)),t.events=null,t.data=null,t.circleStart=null,t.circleEnd=null,t.css3dTag=null,t.css3dMainTag=null}}class Si extends we{constructor(t){super(),this.isMark=!0,this.disposed=!1,this.css3dTags=[],this.group=new g.Group,this.add(this.group),this.events=t}drawStart(t,e){if(this.disposed)return;const s=document.querySelectorAll(".mark-wrap-lines.main-warp").length+1,i={type:"MarkMultiLines",name:e||"lines"+Date.now(),points:[...t.toArray(),...t.toArray()],lineColor:"#eeee00",lineWidth:3,mainTagColor:"#c4c4c4",mainTagBackground:"#2E2E30",mainTagOpacity:.8,mainTagVisible:!0,distanceTagColor:"#000000",distanceTagBackground:"#e0ffff",distanceTagOpacity:.9,distanceTagVisible:!0,title:"标记线"+s,note:""};this.draw(i)}drawUpdate(t,e=!0,s,i=!1){if(this.disposed)return;const a=this;if(s)if(i){const o=a.data.points.length,r=a.css3dTags.length-1,c=new g.Vector3().fromArray(a.data.points.slice(o-6,o-3)),A=s,u=new g.Vector3((c.x+A.x)/2,(c.y+A.y)/2,(c.z+A.z)/2),C=(c.distanceTo(A)*a.events.fire(R).meterScale).toFixed(2)+" m";a.css3dTags[r].element.childNodes[0].innerText=C,a.css3dTags[r].position.set(u.x,u.y,u.z),a.css3dTags[r].visible=!0,a.data.points.pop(),a.data.points.pop(),a.data.points.pop(),a.data.points=[...a.data.points,...s.toArray(),...s.toArray()],a.css3dTags[a.css3dTags.length-1].visible=!0,this.draw(this.data)}else{const o=a.data.points.length;a.data.points[o-3]=s.x,a.data.points[o-2]=s.y,a.data.points[o-1]=s.z;const r=a.css3dTags.length-1,c=new g.Vector3().fromArray(a.data.points.slice(o-6,o-3)),A=new g.Vector3().fromArray(a.data.points.slice(o-3)),u=new g.Vector3((c.x+A.x)/2,(c.y+A.y)/2,(c.z+A.z)/2),l=c.distanceTo(A),C=(l*a.events.fire(R).meterScale).toFixed(2)+" m";a.css3dTags[r].element.childNodes[0].innerText=C,a.geometry.setPositions([...a.data.points]),a.css3dTags[r].position.set(u.x,u.y,u.z),a.css3dTags[r].visible=i?!0:l>.5}t?.lineColor&&(e&&(a.data.lineColor=t.lineColor),a.material.color.set(t.lineColor)),t?.lineWidth&&(e&&(a.data.lineWidth=t.lineWidth),a.material.linewidth=t.lineWidth),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?.distanceTagColor&&(e&&(a.data.distanceTagColor=t.distanceTagColor),document.querySelectorAll(`.${a.data.name}-distance-tag`)?.forEach(r=>r.style.color=t.distanceTagColor)),t?.distanceTagBackground&&(e&&(a.data.distanceTagBackground=t.distanceTagBackground),document.querySelectorAll(`.${a.data.name}-distance-tag`)?.forEach(r=>r.style.background=t.distanceTagBackground)),t?.distanceTagOpacity&&(e&&(a.data.distanceTagOpacity=t.distanceTagOpacity),document.querySelectorAll(`.${a.data.name}-distance-tag`)?.forEach(r=>r.style.opacity=t.distanceTagOpacity.toString())),t?.distanceTagVisible!==void 0&&(e&&(a.data.distanceTagVisible=t.distanceTagVisible),a.css3dTags.forEach(o=>o.visible=t.distanceTagVisible)),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(Ct)}updateByMeterScale(t){const e=this,s=[];for(let o=0,r=e.data.points.length/3;o<r;o++)s.push(new g.Vector3(e.data.points[o*3],e.data.points[o*3+1],e.data.points[o*3+2]));let i,a;for(let o=1;o<s.length;o++)i=s[o-1],a=s[o],e.css3dTags[o-1].element.childNodes[0].innerText=(i.distanceTo(a)*t).toFixed(2)+" m"}drawFinish(t){if(this.disposed)return;const e=this,s=e.data.points.length,i=new g.Vector3().fromArray(e.data.points.slice(s-6,s-3)),a=new g.Vector3().fromArray(e.data.points.slice(s-3));if((!t||i.distanceTo(a)<.001)&&(e.data.points.pop(),e.data.points.pop(),e.data.points.pop(),e.draw(e.data)),e.events.fire(de),e.data.points.length<6){e.dispose();return}else{for(;e.css3dTags.length>e.data.points.length/3-1;){const c=e.css3dTags.pop();e.group.remove(c),c.element.parentElement?.removeChild(c.element)}e.css3dTags[e.css3dTags.length-1].visible=!0}const o=parent?.onActiveMark,r=e.getMarkData(!0);r.isNew=!0,r.meterScale=e.events.fire(R).meterScale,o?.(r)}draw(t,e=!1){if(this.disposed)return;const s=this;this.css3dTags=this.css3dTags||[];const i={type:"MarkMultiLines",name:t.name||"lines"+Date.now(),points:[...t.points],lineColor:t.lineColor||"#eeee00",lineWidth:t.lineWidth||3,mainTagColor:t.mainTagColor||"#c4c4c4",mainTagBackground:t.mainTagBackground||"#2E2E30",mainTagOpacity:t.mainTagOpacity||.8,mainTagVisible:t.mainTagVisible===void 0?!0:t.mainTagVisible,distanceTagColor:t.distanceTagColor||"#000000",distanceTagBackground:t.distanceTagBackground||"#e0ffff",distanceTagOpacity:t.distanceTagOpacity||.9,distanceTagVisible:t.distanceTagVisible===void 0?!0:t.distanceTagVisible,title:t.title||"标记线"+(document.querySelectorAll(".mark-wrap-lines.main-warp").length+1),note:t.note||""},a=s.geometry,o=s.material,r=new gn;r.setPositions([...i.points]);const c=new Ve({color:i.lineColor,linewidth:i.lineWidth});c.resolution.set(innerWidth,innerHeight),s.copy(new we(r,c)),a?.dispose(),o?.dispose();const A=i.name,u=i.points.length/3-1;if(!s.css3dMainTag){const l=document.createElement("div");l.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
798
+ </div>`,I.classList.add("mark-wrap-line",`${s.name}`,"main-warp"),I.style.position="absolute",I.style.borderRadius="4px",I.style.cursor="pointer",I.onclick=()=>{if(e.events.fire(L).markMode)return;const x=parent?.onActiveMark;x?.(e.getMarkData(!0)),e.events.fire(Ct)},I.oncontextmenu=x=>x.preventDefault();const g=new bt(I);g.position.copy(i),g.element.style.pointerEvents="none",g.scale.set(.01,.01,.01),g.visible=s.mainTagVisible;const f=(i.distanceTo(a)*e.events.fire(L).meterScale).toFixed(2)+" m",D=document.createElement("div");D.innerHTML=`<span class="${m}-distance-tag ${m}-distance-tag0" style="color:${s.distanceTagColor};background:${s.distanceTagBackground};opacity:${s.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${f}</span>`,D.classList.add("mark-wrap-line",`${m}`,"distance-warp"),D.style.position="absolute",D.style.borderRadius="4px",D.style.pointerEvents="none";const w=new bt(D);w.position.copy(o),w.element.style.pointerEvents="none",w.scale.set(.008,.008,.008),w.visible=s.distanceTagVisible,e.add(l,C,g,w),e.data=s,e.circleStart=l,e.circleEnd=C,e.css3dTag=w,e.css3dMainTag=g,e.events.fire(ge,e)}getMarkData(t=!1){const e={...this.data};return t?(delete e.startPoint,delete e.endPoint):(e.startPoint=[...e.startPoint],e.endPoint=[...e.endPoint]),e}dispose(){if(this.disposed)return;const t=this;t.disposed=!0,t.events.fire(oe,t),t.events.fire(j).remove(t),t.events.fire(ke,t),document.querySelectorAll(`.${t.data.name}`).forEach(s=>s.parentElement?.removeChild(s)),t.events=null,t.data=null,t.circleStart=null,t.circleEnd=null,t.css3dTag=null,t.css3dMainTag=null}}class Qi extends Ee{constructor(t){super(),this.isMark=!0,this.disposed=!1,this.css3dTags=[],this.group=new d.Group,this.add(this.group),this.events=t}drawStart(t,e){if(this.disposed)return;const s=document.querySelectorAll(".mark-wrap-lines.main-warp").length+1,i={type:"MarkMultiLines",name:e||"lines"+Date.now(),points:[...t.toArray(),...t.toArray()],lineColor:"#eeee00",lineWidth:3,mainTagColor:"#c4c4c4",mainTagBackground:"#2E2E30",mainTagOpacity:.8,mainTagVisible:!0,distanceTagColor:"#000000",distanceTagBackground:"#e0ffff",distanceTagOpacity:.9,distanceTagVisible:!0,title:"标记线"+s,note:""};this.draw(i)}drawUpdate(t,e=!0,s,i=!1){if(this.disposed)return;const a=this;if(s)if(i){const o=a.data.points.length,r=a.css3dTags.length-1,c=new d.Vector3().fromArray(a.data.points.slice(o-6,o-3)),A=s,u=new d.Vector3((c.x+A.x)/2,(c.y+A.y)/2,(c.z+A.z)/2),C=(c.distanceTo(A)*a.events.fire(L).meterScale).toFixed(2)+" m";a.css3dTags[r].element.childNodes[0].innerText=C,a.css3dTags[r].position.set(u.x,u.y,u.z),a.css3dTags[r].visible=!0,a.data.points.pop(),a.data.points.pop(),a.data.points.pop(),a.data.points=[...a.data.points,...s.toArray(),...s.toArray()],a.css3dTags[a.css3dTags.length-1].visible=!0,this.draw(this.data)}else{const o=a.data.points.length;a.data.points[o-3]=s.x,a.data.points[o-2]=s.y,a.data.points[o-1]=s.z;const r=a.css3dTags.length-1,c=new d.Vector3().fromArray(a.data.points.slice(o-6,o-3)),A=new d.Vector3().fromArray(a.data.points.slice(o-3)),u=new d.Vector3((c.x+A.x)/2,(c.y+A.y)/2,(c.z+A.z)/2),l=c.distanceTo(A),C=(l*a.events.fire(L).meterScale).toFixed(2)+" m";a.css3dTags[r].element.childNodes[0].innerText=C,a.geometry.setPositions([...a.data.points]),a.css3dTags[r].position.set(u.x,u.y,u.z),a.css3dTags[r].visible=i?!0:l>.5}t?.lineColor&&(e&&(a.data.lineColor=t.lineColor),a.material.color.set(t.lineColor)),t?.lineWidth&&(e&&(a.data.lineWidth=t.lineWidth),a.material.linewidth=t.lineWidth),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?.distanceTagColor&&(e&&(a.data.distanceTagColor=t.distanceTagColor),document.querySelectorAll(`.${a.data.name}-distance-tag`)?.forEach(r=>r.style.color=t.distanceTagColor)),t?.distanceTagBackground&&(e&&(a.data.distanceTagBackground=t.distanceTagBackground),document.querySelectorAll(`.${a.data.name}-distance-tag`)?.forEach(r=>r.style.background=t.distanceTagBackground)),t?.distanceTagOpacity&&(e&&(a.data.distanceTagOpacity=t.distanceTagOpacity),document.querySelectorAll(`.${a.data.name}-distance-tag`)?.forEach(r=>r.style.opacity=t.distanceTagOpacity.toString())),t?.distanceTagVisible!==void 0&&(e&&(a.data.distanceTagVisible=t.distanceTagVisible),a.css3dTags.forEach(o=>o.visible=t.distanceTagVisible)),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(pt)}updateByMeterScale(t){const e=this,s=[];for(let o=0,r=e.data.points.length/3;o<r;o++)s.push(new d.Vector3(e.data.points[o*3],e.data.points[o*3+1],e.data.points[o*3+2]));let i,a;for(let o=1;o<s.length;o++)i=s[o-1],a=s[o],e.css3dTags[o-1].element.childNodes[0].innerText=(i.distanceTo(a)*t).toFixed(2)+" m"}drawFinish(t){if(this.disposed)return;const e=this,s=e.data.points.length,i=new d.Vector3().fromArray(e.data.points.slice(s-6,s-3)),a=new d.Vector3().fromArray(e.data.points.slice(s-3));if((!t||i.distanceTo(a)<.001)&&(e.data.points.pop(),e.data.points.pop(),e.data.points.pop(),e.draw(e.data)),e.events.fire(fe),e.data.points.length<6){e.dispose();return}else{for(;e.css3dTags.length>e.data.points.length/3-1;){const c=e.css3dTags.pop();e.group.remove(c),c.element.parentElement?.removeChild(c.element)}e.css3dTags[e.css3dTags.length-1].visible=!0}const o=parent?.onActiveMark,r=e.getMarkData(!0);r.isNew=!0,r.meterScale=e.events.fire(L).meterScale,o?.(r)}draw(t,e=!1){if(this.disposed)return;const s=this;this.css3dTags=this.css3dTags||[];const i={type:"MarkMultiLines",name:t.name||"lines"+Date.now(),points:[...t.points],lineColor:t.lineColor||"#eeee00",lineWidth:t.lineWidth||3,mainTagColor:t.mainTagColor||"#c4c4c4",mainTagBackground:t.mainTagBackground||"#2E2E30",mainTagOpacity:t.mainTagOpacity||.8,mainTagVisible:t.mainTagVisible===void 0?!0:t.mainTagVisible,distanceTagColor:t.distanceTagColor||"#000000",distanceTagBackground:t.distanceTagBackground||"#e0ffff",distanceTagOpacity:t.distanceTagOpacity||.9,distanceTagVisible:t.distanceTagVisible===void 0?!0:t.distanceTagVisible,title:t.title||"标记线"+(document.querySelectorAll(".mark-wrap-lines.main-warp").length+1),note:t.note||""},a=s.geometry,o=s.material,r=new dn;r.setPositions([...i.points]);const c=new He({color:i.lineColor,linewidth:i.lineWidth});c.resolution.set(innerWidth,innerHeight),s.copy(new Ee(r,c)),a?.dispose(),o?.dispose();const A=i.name,u=i.points.length/3-1;if(!s.css3dMainTag){const l=document.createElement("div");l.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
799
799
  <span class="${A}-main-tag" style="color:${i.mainTagColor};background:${i.mainTagBackground};opacity:${i.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${i.title}</span>
800
- </div>`,l.classList.add("mark-wrap-lines",`${i.name}`,"main-warp"),l.style.position="absolute",l.style.borderRadius="4px",l.style.cursor="pointer",l.onclick=()=>{if(s.events.fire(R).markMode)return;const h=parent?.onActiveMark,m=s.getMarkData(!0);m.meterScale=s.events.fire(R).meterScale,h?.(m),s.events.fire(mt)},l.oncontextmenu=h=>h.preventDefault();const C=new Bt(l);C.position.set(i.points[0],i.points[1],i.points[2]),C.element.style.pointerEvents="none",C.scale.set(.01,.01,.01),C.visible=i.mainTagVisible,s.group.add(C),s.css3dMainTag=C}for(let l=s.css3dTags.length;l<u;l++){const C=new g.Vector3().fromArray(i.points.slice(l*3,l*3+3)),h=new g.Vector3().fromArray(i.points.slice(l*3+3,l*3+6)),m=new g.Vector3((C.x+h.x)/2,(C.y+h.y)/2,(C.z+h.z)/2),d=(C.distanceTo(h)*s.events.fire(R).meterScale).toFixed(2)+" m",p=document.createElement("div");p.innerHTML=`<span class="${A}-distance-tag ${A}-distance-tag${l}" style="color:${i.distanceTagColor};background:${i.distanceTagBackground};opacity:${i.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${d}</span>`,p.classList.add("mark-wrap-lines",`${A}`,"distance-warp"),p.style.position="absolute",p.style.borderRadius="4px",p.style.display="none";const f=new Bt(p);f.position.copy(m),f.element.style.pointerEvents="none",f.scale.set(.008,.008,.008),f.visible=i.distanceTagVisible,s.css3dTags.push(f),s.group.add(f)}e||(s.css3dTags[s.css3dTags.length-1].visible=!1),s.data=i,s.events.fire(ue,s)}getMarkData(t=!1){const e={...this.data};return t?delete e.points:e.points=[...e.points],e}dispose(){if(this.disposed)return;const t=this;t.disposed=!0,t.events.fire(ie,t),t.events.fire(X).remove(t),t.events.fire(ve,t),t.geometry.dispose(),t.material.dispose(),document.querySelectorAll(`.${t.data.name}`).forEach(s=>s.parentElement?.removeChild(s)),t.events=null,t.data=null,t.css3dTags=null,t.group=null}}class Ir extends g.Group{constructor(t,e,s){super(),this.isMark=!0,this.disposed=!1,this.events=t;const i=this;let a;if(e instanceof g.Vector3){const c=document.querySelectorAll(".mark-wrap-point").length+1;a={type:"MarkSinglePoint",name:s||"point"+Date.now(),point:e.toArray(),iconName:"#svgicon-point2",iconColor:"#eeee00",iconOpacity:.8,mainTagColor:"#c4c4c4",mainTagBackground:"#2E2E30",mainTagOpacity:.8,title:"标记点"+c,note:""}}else a={type:"MarkSinglePoint",name:e.name||"point"+Date.now(),point:[...e.point],iconName:e.iconName||"#svgicon-point2",iconColor:e.iconColor||"#eeee00",iconOpacity:e.iconOpacity||.8,mainTagColor:e.mainTagColor||"#c4c4c4",mainTagBackground:e.mainTagBackground||"#2E2E30",mainTagOpacity:e.mainTagOpacity||.8,title:e.title||"标记点",note:e.note||""};const o=document.createElement("div");o.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
800
+ </div>`,l.classList.add("mark-wrap-lines",`${i.name}`,"main-warp"),l.style.position="absolute",l.style.borderRadius="4px",l.style.cursor="pointer",l.onclick=()=>{if(s.events.fire(L).markMode)return;const h=parent?.onActiveMark,m=s.getMarkData(!0);m.meterScale=s.events.fire(L).meterScale,h?.(m),s.events.fire(Ct)},l.oncontextmenu=h=>h.preventDefault();const C=new bt(l);C.position.set(i.points[0],i.points[1],i.points[2]),C.element.style.pointerEvents="none",C.scale.set(.01,.01,.01),C.visible=i.mainTagVisible,s.group.add(C),s.css3dMainTag=C}for(let l=s.css3dTags.length;l<u;l++){const C=new d.Vector3().fromArray(i.points.slice(l*3,l*3+3)),h=new d.Vector3().fromArray(i.points.slice(l*3+3,l*3+6)),m=new d.Vector3((C.x+h.x)/2,(C.y+h.y)/2,(C.z+h.z)/2),g=(C.distanceTo(h)*s.events.fire(L).meterScale).toFixed(2)+" m",p=document.createElement("div");p.innerHTML=`<span class="${A}-distance-tag ${A}-distance-tag${l}" style="color:${i.distanceTagColor};background:${i.distanceTagBackground};opacity:${i.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${g}</span>`,p.classList.add("mark-wrap-lines",`${A}`,"distance-warp"),p.style.position="absolute",p.style.borderRadius="4px",p.style.display="none";const f=new bt(p);f.position.copy(m),f.element.style.pointerEvents="none",f.scale.set(.008,.008,.008),f.visible=i.distanceTagVisible,s.css3dTags.push(f),s.group.add(f)}e||(s.css3dTags[s.css3dTags.length-1].visible=!1),s.data=i,s.events.fire(ge,s)}getMarkData(t=!1){const e={...this.data};return t?delete e.points:e.points=[...e.points],e}dispose(){if(this.disposed)return;const t=this;t.disposed=!0,t.events.fire(oe,t),t.events.fire(j).remove(t),t.events.fire(ke,t),t.geometry.dispose(),t.material.dispose(),document.querySelectorAll(`.${t.data.name}`).forEach(s=>s.parentElement?.removeChild(s)),t.events=null,t.data=null,t.css3dTags=null,t.group=null}}class pr extends d.Group{constructor(t,e,s){super(),this.isMark=!0,this.disposed=!1,this.events=t;const i=this;let a;if(e instanceof d.Vector3){const c=document.querySelectorAll(".mark-wrap-point").length+1;a={type:"MarkSinglePoint",name:s||"point"+Date.now(),point:e.toArray(),iconName:"#svgicon-point2",iconColor:"#eeee00",iconOpacity:.8,mainTagColor:"#c4c4c4",mainTagBackground:"#2E2E30",mainTagOpacity:.8,title:"标记点"+c,note:""}}else a={type:"MarkSinglePoint",name:e.name||"point"+Date.now(),point:[...e.point],iconName:e.iconName||"#svgicon-point2",iconColor:e.iconColor||"#eeee00",iconOpacity:e.iconOpacity||.8,mainTagColor:e.mainTagColor||"#c4c4c4",mainTagBackground:e.mainTagBackground||"#2E2E30",mainTagOpacity:e.mainTagOpacity||.8,title:e.title||"标记点",note:e.note||""};const o=document.createElement("div");o.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
801
801
  <span class="${a.name}" style="color:${a.mainTagColor};background:${a.mainTagBackground};opacity:${a.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: auto;">${a.title}</span>
802
802
  <svg height="20" width="20" style="color:${a.iconColor};opacity:${a.iconOpacity};"><use href="${a.iconName}" fill="currentColor" /></svg>
803
- </div>`,o.classList.add("mark-wrap-point",`mark-wrap-${a.name}`),o.style.position="absolute",o.style.borderRadius="4px",o.style.cursor="pointer",o.onclick=()=>{if(i.events.fire(R).markMode)return;const c=parent?.onActiveMark;c?.(i.getMarkData(!0)),i.events.fire(mt)},o.oncontextmenu=c=>c.preventDefault();const r=new Bt(o);r.position.set(a.point[0],a.point[1],a.point[2]),r.element.style.pointerEvents="none",r.scale.set(.01,.01,.01),i.data=a,i.css3dTag=r,i.add(r),t.fire(ue,i)}drawUpdate(t,e=!0){if(this.disposed)return;const s=this;if(t?.iconName){e&&(s.data.iconName=t.iconName);const i=this.css3dTag.element.querySelector(`.mark-wrap-${s.data.name} svg`);i.innerHTML=`<use href="${t.iconName}" fill="currentColor" />`}if(t?.iconColor){e&&(s.data.iconColor=t.iconColor);const i=this.css3dTag.element.querySelector(`.mark-wrap-${s.data.name} svg`);i.style.color=t.iconColor}if(t?.iconOpacity){e&&(s.data.iconOpacity=t.iconOpacity);const i=this.css3dTag.element.querySelector(`.mark-wrap-${s.data.name} svg`);i.style.opacity=t.iconOpacity.toString()}t?.mainTagColor&&(e&&(s.data.mainTagColor=t.mainTagColor),this.css3dTag.element.querySelector(`.${s.data.name}`).style.color=t.mainTagColor),t?.mainTagBackground&&(e&&(s.data.mainTagBackground=t.mainTagBackground),this.css3dTag.element.querySelector(`.${s.data.name}`).style.background=t.mainTagBackground),t?.mainTagOpacity&&(e&&(s.data.mainTagOpacity=t.mainTagOpacity),this.css3dTag.element.querySelector(`.${s.data.name}`).style.opacity=t.mainTagOpacity.toString()),t?.title!==void 0&&(e&&(s.data.title=t.title),this.css3dTag.element.querySelector(`.${s.data.name}`).innerText=t.title),t?.note!==void 0&&e&&(s.data.note=t.note),s.events.fire(Ct)}resetMeterScale(t){t?.meterScale!==void 0&&(this.events.fire(R).meterScale=t.meterScale)}drawFinish(){if(this.disposed)return;const t=this;t.events.fire(de);const e=parent?.onActiveMark,s=t.getMarkData(!0);s.isNew=!0,s.meterScale=t.events.fire(R).meterScale,e?.(s)}getMarkData(t=!1){const e={...this.data};return t?delete e.point:e.point=[...e.point],e}dispose(){if(this.disposed)return;const t=this;t.disposed=!0,t.events.fire(ie,t),t.events.fire(X).remove(t),t.events.fire(ve,t);const e=document.querySelector(`.mark-wrap-${t.data.name}`);e?.parentElement?.removeChild?.(e),t.events=null,t.data=null,t.css3dTag=null}}class Mi extends we{constructor(t){super(),this.isMark=!0,this.disposed=!1,this.css3dTags=[],this.group=new g.Group,this.add(this.group),this.events=t}drawStart(t,e){if(this.disposed)return;const s=document.querySelectorAll(".mark-wrap-plans.main-warp").length+1,i={type:"MarkMultiPlans",name:e||"plans"+Date.now(),points:[...t.toArray(),...t.toArray()],lineColor:"#eeee00",lineWidth:3,mainTagColor:"#c4c4c4",mainTagBackground:"#2E2E30",mainTagOpacity:.8,mainTagVisible:!0,areaTagColor:"#000000",areaTagBackground:"#e0ffff",areaTagOpacity:.8,distanceTagVisible:!0,areaTagVisible:!0,planOpacity:.5,title:"标记面"+s,note:""};this.draw(i)}drawUpdate(t,e=!0,s,i=!1){if(this.disposed)return;const a=this;if(s)if(i){const o=a.data.points.length,r=a.css3dTags.length-1,c=new g.Vector3().fromArray(a.data.points.slice(o-6,o-3)),A=s,u=new g.Vector3((c.x+A.x)/2,(c.y+A.y)/2,(c.z+A.z)/2),C=(c.distanceTo(A)*a.events.fire(R).meterScale).toFixed(2)+" m";a.css3dTags[r].element.innerText=C,a.css3dTags[r].position.set(u.x,u.y,u.z),a.css3dTags[r].visible=!0,a.data.points.pop(),a.data.points.pop(),a.data.points.pop(),a.data.points=[...a.data.points,...s.toArray(),...s.toArray()],this.draw(this.data)}else{const o=a.data.points.length;a.data.points[o-3]=s.x,a.data.points[o-2]=s.y,a.data.points[o-1]=s.z;const r=a.css3dTags.length-1,c=new g.Vector3().fromArray(a.data.points.slice(o-6,o-3)),A=new g.Vector3().fromArray(a.data.points.slice(o-3)),u=new g.Vector3((c.x+A.x)/2,(c.y+A.y)/2,(c.z+A.z)/2),l=c.distanceTo(A),C=(l*a.events.fire(R).meterScale).toFixed(2)+" m";a.css3dTags[r].element.innerText=C,a.geometry.setPositions([...a.data.points]),a.css3dTags[r].position.set(u.x,u.y,u.z),a.css3dTags[r].visible=i?!0:l>.5,a.meshPlans.geometry.setAttribute("position",new g.BufferAttribute(new Float32Array(a.data.points),3)),a.meshPlans.geometry.attributes.position.needsUpdate=!0;const h=a.events.fire(rs,a.data.points);a.css3dAreaTag.position.copy(h);const m=a.events.fire(As,a.data.points);a.css3dAreaTag.element.childNodes[0].innerText=m.toFixed(2)+" m²"}if(t?.lineColor&&(e&&(a.data.lineColor=t.lineColor),a.material.color.set(t.lineColor),a.meshPlans.material.color.set(t.lineColor)),t?.lineWidth&&(e&&(a.data.lineWidth=t.lineWidth),a.material.linewidth=t.lineWidth),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?.areaTagVisible!==void 0&&(e&&(a.data.areaTagVisible=t.areaTagVisible),a.css3dAreaTag.visible=t.areaTagVisible),t?.areaTagColor){e&&(a.data.areaTagColor=t.areaTagColor);const o=document.querySelector(`.${a.data.name}-area-tag`);o&&(o.style.color=t.areaTagColor)}if(t?.areaTagBackground){e&&(a.data.areaTagBackground=t.areaTagBackground);const o=document.querySelector(`.${a.data.name}-area-tag`);o&&(o.style.background=t.areaTagBackground)}if(t?.areaTagOpacity){e&&(a.data.areaTagOpacity=t.areaTagOpacity);const o=document.querySelector(`.${a.data.name}-area-tag`);o&&(o.style.opacity=t.areaTagOpacity.toString())}t?.distanceTagVisible!==void 0&&(e&&(a.data.distanceTagVisible=t.distanceTagVisible),a.css3dTags.forEach(o=>o.visible=t.distanceTagVisible)),t?.planOpacity&&(e&&(a.data.planOpacity=t.planOpacity),this.meshPlans.material.opacity=t.planOpacity),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(Ct)}updateByMeterScale(t){const e=this,s=[];for(let r=0,c=e.data.points.length/3;r<c;r++)s.push(new g.Vector3(e.data.points[r*3],e.data.points[r*3+1],e.data.points[r*3+2]));let i,a;for(let r=1;r<s.length;r++)i=s[r-1],a=s[r],e.css3dTags[r-1].element.innerText=(i.distanceTo(a)*t).toFixed(2)+" m";const o=e.events.fire(Ri,s,t);e.css3dAreaTag.element.childNodes[0].innerText=o.toFixed(2)+" m²"}drawFinish(t){if(this.disposed)return;const e=this,s=e.data.points.length,i=new g.Vector3().fromArray(e.data.points.slice(s-6,s-3)),a=new g.Vector3().fromArray(e.data.points.slice(s-3));if((!t||i.distanceTo(a)<1e-4)&&(e.data.points.pop(),e.data.points.pop(),e.data.points.pop()),e.events.fire(de),e.data.points.length<9){e.dispose();return}for(;e.css3dTags.length>e.data.points.length/3-1;){const c=e.css3dTags.pop();e.group.remove(c),c.element.parentElement?.removeChild(c.element)}e.data.points.push(e.data.points[0],e.data.points[1],e.data.points[2]),e.draw(e.data,!0),e.css3dTags[e.css3dTags.length-1].visible=!0;const o=parent?.onActiveMark,r=e.getMarkData(!0);r.isNew=!0,r.meterScale=e.events.fire(R).meterScale,o?.(r)}draw(t,e=!1){if(this.disposed)return;const s=this;this.css3dTags=this.css3dTags||[];const i={type:"MarkMultiPlans",name:t.name||"plans"+Date.now(),points:[...t.points],lineColor:t.lineColor||"#eeee00",lineWidth:t.lineWidth||3,mainTagColor:t.mainTagColor||"#c4c4c4",mainTagBackground:t.mainTagBackground||"#2E2E30",mainTagOpacity:t.mainTagOpacity||.8,mainTagVisible:t.mainTagVisible===void 0?!0:t.mainTagVisible,areaTagColor:t.areaTagColor||"#000000",areaTagBackground:t.areaTagBackground||"#e0ffff",areaTagOpacity:t.areaTagOpacity||.9,areaTagVisible:t.areaTagVisible===void 0?!0:t.areaTagVisible,distanceTagVisible:t.distanceTagVisible===void 0?!0:t.distanceTagVisible,planOpacity:t.planOpacity||.5,title:t.title||"标记面"+(document.querySelectorAll(".mark-wrap-plans.main-warp").length+1),note:t.note||""},a=s.geometry,o=s.material,r=new gn;r.setPositions([...i.points]);const c=new Ve({color:i.lineColor,linewidth:i.lineWidth});c.resolution.set(innerWidth,innerHeight),s.copy(new we(r,c)),a?.dispose(),o?.dispose();const A=i.name,u=i.points.length/3-1;if(!s.css3dMainTag){const h=document.createElement("div");h.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
803
+ </div>`,o.classList.add("mark-wrap-point",`mark-wrap-${a.name}`),o.style.position="absolute",o.style.borderRadius="4px",o.style.cursor="pointer",o.onclick=()=>{if(i.events.fire(L).markMode)return;const c=parent?.onActiveMark;c?.(i.getMarkData(!0)),i.events.fire(Ct)},o.oncontextmenu=c=>c.preventDefault();const r=new bt(o);r.position.set(a.point[0],a.point[1],a.point[2]),r.element.style.pointerEvents="none",r.scale.set(.01,.01,.01),i.data=a,i.css3dTag=r,i.add(r),t.fire(ge,i)}drawUpdate(t,e=!0){if(this.disposed)return;const s=this;if(t?.iconName){e&&(s.data.iconName=t.iconName);const i=this.css3dTag.element.querySelector(`.mark-wrap-${s.data.name} svg`);i.innerHTML=`<use href="${t.iconName}" fill="currentColor" />`}if(t?.iconColor){e&&(s.data.iconColor=t.iconColor);const i=this.css3dTag.element.querySelector(`.mark-wrap-${s.data.name} svg`);i.style.color=t.iconColor}if(t?.iconOpacity){e&&(s.data.iconOpacity=t.iconOpacity);const i=this.css3dTag.element.querySelector(`.mark-wrap-${s.data.name} svg`);i.style.opacity=t.iconOpacity.toString()}t?.mainTagColor&&(e&&(s.data.mainTagColor=t.mainTagColor),this.css3dTag.element.querySelector(`.${s.data.name}`).style.color=t.mainTagColor),t?.mainTagBackground&&(e&&(s.data.mainTagBackground=t.mainTagBackground),this.css3dTag.element.querySelector(`.${s.data.name}`).style.background=t.mainTagBackground),t?.mainTagOpacity&&(e&&(s.data.mainTagOpacity=t.mainTagOpacity),this.css3dTag.element.querySelector(`.${s.data.name}`).style.opacity=t.mainTagOpacity.toString()),t?.title!==void 0&&(e&&(s.data.title=t.title),this.css3dTag.element.querySelector(`.${s.data.name}`).innerText=t.title),t?.note!==void 0&&e&&(s.data.note=t.note),s.events.fire(pt)}resetMeterScale(t){t?.meterScale!==void 0&&(this.events.fire(L).meterScale=t.meterScale)}drawFinish(){if(this.disposed)return;const t=this;t.events.fire(fe);const e=parent?.onActiveMark,s=t.getMarkData(!0);s.isNew=!0,s.meterScale=t.events.fire(L).meterScale,e?.(s)}getMarkData(t=!1){const e={...this.data};return t?delete e.point:e.point=[...e.point],e}dispose(){if(this.disposed)return;const t=this;t.disposed=!0,t.events.fire(oe,t),t.events.fire(j).remove(t),t.events.fire(ke,t);const e=document.querySelector(`.mark-wrap-${t.data.name}`);e?.parentElement?.removeChild?.(e),t.events=null,t.data=null,t.css3dTag=null}}class bi extends Ee{constructor(t){super(),this.isMark=!0,this.disposed=!1,this.css3dTags=[],this.group=new d.Group,this.add(this.group),this.events=t}drawStart(t,e){if(this.disposed)return;const s=document.querySelectorAll(".mark-wrap-plans.main-warp").length+1,i={type:"MarkMultiPlans",name:e||"plans"+Date.now(),points:[...t.toArray(),...t.toArray()],lineColor:"#eeee00",lineWidth:3,mainTagColor:"#c4c4c4",mainTagBackground:"#2E2E30",mainTagOpacity:.8,mainTagVisible:!0,areaTagColor:"#000000",areaTagBackground:"#e0ffff",areaTagOpacity:.8,distanceTagVisible:!0,areaTagVisible:!0,planOpacity:.5,title:"标记面"+s,note:""};this.draw(i)}drawUpdate(t,e=!0,s,i=!1){if(this.disposed)return;const a=this;if(s)if(i){const o=a.data.points.length,r=a.css3dTags.length-1,c=new d.Vector3().fromArray(a.data.points.slice(o-6,o-3)),A=s,u=new d.Vector3((c.x+A.x)/2,(c.y+A.y)/2,(c.z+A.z)/2),C=(c.distanceTo(A)*a.events.fire(L).meterScale).toFixed(2)+" m";a.css3dTags[r].element.innerText=C,a.css3dTags[r].position.set(u.x,u.y,u.z),a.css3dTags[r].visible=!0,a.data.points.pop(),a.data.points.pop(),a.data.points.pop(),a.data.points=[...a.data.points,...s.toArray(),...s.toArray()],this.draw(this.data)}else{const o=a.data.points.length;a.data.points[o-3]=s.x,a.data.points[o-2]=s.y,a.data.points[o-1]=s.z;const r=a.css3dTags.length-1,c=new d.Vector3().fromArray(a.data.points.slice(o-6,o-3)),A=new d.Vector3().fromArray(a.data.points.slice(o-3)),u=new d.Vector3((c.x+A.x)/2,(c.y+A.y)/2,(c.z+A.z)/2),l=c.distanceTo(A),C=(l*a.events.fire(L).meterScale).toFixed(2)+" m";a.css3dTags[r].element.innerText=C,a.geometry.setPositions([...a.data.points]),a.css3dTags[r].position.set(u.x,u.y,u.z),a.css3dTags[r].visible=i?!0:l>.5,a.meshPlans.geometry.setAttribute("position",new d.BufferAttribute(new Float32Array(a.data.points),3)),a.meshPlans.geometry.attributes.position.needsUpdate=!0;const h=a.events.fire(as,a.data.points);a.css3dAreaTag.position.copy(h);const m=a.events.fire(rs,a.data.points);a.css3dAreaTag.element.childNodes[0].innerText=m.toFixed(2)+" m²"}if(t?.lineColor&&(e&&(a.data.lineColor=t.lineColor),a.material.color.set(t.lineColor),a.meshPlans.material.color.set(t.lineColor)),t?.lineWidth&&(e&&(a.data.lineWidth=t.lineWidth),a.material.linewidth=t.lineWidth),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?.areaTagVisible!==void 0&&(e&&(a.data.areaTagVisible=t.areaTagVisible),a.css3dAreaTag.visible=t.areaTagVisible),t?.areaTagColor){e&&(a.data.areaTagColor=t.areaTagColor);const o=document.querySelector(`.${a.data.name}-area-tag`);o&&(o.style.color=t.areaTagColor)}if(t?.areaTagBackground){e&&(a.data.areaTagBackground=t.areaTagBackground);const o=document.querySelector(`.${a.data.name}-area-tag`);o&&(o.style.background=t.areaTagBackground)}if(t?.areaTagOpacity){e&&(a.data.areaTagOpacity=t.areaTagOpacity);const o=document.querySelector(`.${a.data.name}-area-tag`);o&&(o.style.opacity=t.areaTagOpacity.toString())}t?.distanceTagVisible!==void 0&&(e&&(a.data.distanceTagVisible=t.distanceTagVisible),a.css3dTags.forEach(o=>o.visible=t.distanceTagVisible)),t?.planOpacity&&(e&&(a.data.planOpacity=t.planOpacity),this.meshPlans.material.opacity=t.planOpacity),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(pt)}updateByMeterScale(t){const e=this,s=[];for(let r=0,c=e.data.points.length/3;r<c;r++)s.push(new d.Vector3(e.data.points[r*3],e.data.points[r*3+1],e.data.points[r*3+2]));let i,a;for(let r=1;r<s.length;r++)i=s[r-1],a=s[r],e.css3dTags[r-1].element.innerText=(i.distanceTo(a)*t).toFixed(2)+" m";const o=e.events.fire(Ti,s,t);e.css3dAreaTag.element.childNodes[0].innerText=o.toFixed(2)+" m²"}drawFinish(t){if(this.disposed)return;const e=this,s=e.data.points.length,i=new d.Vector3().fromArray(e.data.points.slice(s-6,s-3)),a=new d.Vector3().fromArray(e.data.points.slice(s-3));if((!t||i.distanceTo(a)<1e-4)&&(e.data.points.pop(),e.data.points.pop(),e.data.points.pop()),e.events.fire(fe),e.data.points.length<9){e.dispose();return}for(;e.css3dTags.length>e.data.points.length/3-1;){const c=e.css3dTags.pop();e.group.remove(c),c.element.parentElement?.removeChild(c.element)}e.data.points.push(e.data.points[0],e.data.points[1],e.data.points[2]),e.draw(e.data,!0),e.css3dTags[e.css3dTags.length-1].visible=!0;const o=parent?.onActiveMark,r=e.getMarkData(!0);r.isNew=!0,r.meterScale=e.events.fire(L).meterScale,o?.(r)}draw(t,e=!1){if(this.disposed)return;const s=this;this.css3dTags=this.css3dTags||[];const i={type:"MarkMultiPlans",name:t.name||"plans"+Date.now(),points:[...t.points],lineColor:t.lineColor||"#eeee00",lineWidth:t.lineWidth||3,mainTagColor:t.mainTagColor||"#c4c4c4",mainTagBackground:t.mainTagBackground||"#2E2E30",mainTagOpacity:t.mainTagOpacity||.8,mainTagVisible:t.mainTagVisible===void 0?!0:t.mainTagVisible,areaTagColor:t.areaTagColor||"#000000",areaTagBackground:t.areaTagBackground||"#e0ffff",areaTagOpacity:t.areaTagOpacity||.9,areaTagVisible:t.areaTagVisible===void 0?!0:t.areaTagVisible,distanceTagVisible:t.distanceTagVisible===void 0?!0:t.distanceTagVisible,planOpacity:t.planOpacity||.5,title:t.title||"标记面"+(document.querySelectorAll(".mark-wrap-plans.main-warp").length+1),note:t.note||""},a=s.geometry,o=s.material,r=new dn;r.setPositions([...i.points]);const c=new He({color:i.lineColor,linewidth:i.lineWidth});c.resolution.set(innerWidth,innerHeight),s.copy(new Ee(r,c)),a?.dispose(),o?.dispose();const A=i.name,u=i.points.length/3-1;if(!s.css3dMainTag){const h=document.createElement("div");h.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
804
804
  <span class="${A}-main-tag" style="color:${i.mainTagColor};background:${i.mainTagBackground};opacity:${i.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${i.title}</span>
805
- </div>`,h.classList.add("mark-wrap-plans",`${i.name}`,"main-warp"),h.style.position="absolute",h.style.borderRadius="4px",h.style.cursor="pointer",h.onclick=()=>{if(s.events.fire(R).markMode)return;const I=parent?.onActiveMark,d=s.getMarkData(!0);d.meterScale=s.events.fire(R).meterScale,I?.(d),s.events.fire(mt)},h.oncontextmenu=I=>I.preventDefault();const m=new Bt(h);m.position.set(i.points[0],i.points[1],i.points[2]),m.element.style.pointerEvents="none",m.scale.set(.01,.01,.01),m.visible=i.mainTagVisible,s.group.add(m),s.css3dMainTag=m}const l=s.events.fire(As,i.points).toFixed(2)+" m²",C=s.events.fire(rs,i.points);if(s.css3dAreaTag)s.css3dAreaTag.position.copy(C),s.css3dAreaTag.element.childNodes[0].innerText=l;else{const h=document.createElement("div");h.innerHTML=`<span class="${A}-area-tag" style="color:${i.areaTagColor};background:${i.areaTagBackground};opacity:${i.areaTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: none;">${l}</span>`,h.classList.add("mark-wrap-plans",`${i.name}`,"area-warp"),h.style.position="absolute",h.style.borderRadius="4px";const m=new Bt(h);m.position.copy(C),m.element.style.pointerEvents="none",m.scale.set(.01,.01,.01),s.group.add(m),s.css3dAreaTag=m}s.css3dAreaTag.visible=i.points.length>6&&i.areaTagVisible;for(let h=s.css3dTags.length;h<u;h++){const m=new g.Vector3().fromArray(i.points.slice(h*3,h*3+3)),I=new g.Vector3().fromArray(i.points.slice(h*3+3,h*3+6)),d=new g.Vector3((m.x+I.x)/2,(m.y+I.y)/2,(m.z+I.z)/2),f=(m.distanceTo(I)*s.events.fire(R).meterScale).toFixed(2)+" m",D=document.createElement("div");D.innerText=f,D.style.color="white",D.classList.add("mark-wrap-plans",`${A}`,"distance-warp"),D.style.position="absolute",D.style.borderRadius="4px",D.style.display="none";const w=new Bt(D);w.position.copy(d),w.element.style.pointerEvents="none",w.scale.set(.008,.008,.008),w.visible=i.distanceTagVisible,s.css3dTags.push(w),s.group.add(w)}s.drawPlans(i),e||(s.css3dTags[s.css3dTags.length-1].visible=!1),s.data=i,s.events.fire(ue,s)}drawPlans(t){const e=this;if(!e.meshPlans){const s=new g.BufferGeometry;s.setAttribute("position",new g.BufferAttribute(new Float32Array,3)),s.attributes.position.needsUpdate=!0;const i=new g.BufferAttribute(new Uint16Array([]),1);s.setIndex(i);const a=new g.MeshBasicMaterial({color:t.lineColor,transparent:!0,opacity:t.planOpacity,side:g.DoubleSide});e.meshPlans=new g.Mesh(s,a),e.meshPlans.renderOrder=1,e.meshPlans.isMark=!0,e.group.add(e.meshPlans)}if(t.points.length>6){e.meshPlans.geometry.setAttribute("position",new g.BufferAttribute(new Float32Array(t.points),3)),e.meshPlans.geometry.attributes.position.needsUpdate=!0;let s=t.points.length/3-2;const i=new g.Vector3().fromArray(t.points.slice(0,3)),a=new g.Vector3().fromArray(t.points.slice(-3));i.distanceTo(a)<1e-4&&s--;const o=new Uint16Array(s*3);for(let r=0;r<s;r++)o[r*3]=0,o[r*3+1]=r+1,o[r*3+2]=r+2;e.meshPlans.geometry.setIndex(new g.BufferAttribute(o,1))}}getMarkData(t=!1){const e={...this.data};return t?delete e.points:e.points=[...e.points],e}dispose(){if(this.disposed)return;const t=this;t.disposed=!0,t.events.fire(ie,t),t.events.fire(X).remove(t),t.events.fire(ve,t),t.geometry.dispose(),t.material.dispose(),document.querySelectorAll(`.${t.data.name}`).forEach(s=>s.parentElement?.removeChild(s)),t.events=null,t.data=null,t.css3dTags=null,t.group=null,t.meshPlans=null,t.css3dMainTag=null,t.css3dAreaTag=null}}class yr extends g.Group{constructor(t){super(),this.isMark=!0,this.disposed=!1,this.events=t}drawStart(t,e){if(this.disposed)return;const s=this,i=document.querySelectorAll(".mark-wrap-circle.main-warp").length+1,a={type:"MarkCirclePlan",name:e||"circle"+Date.now(),startPoint:t.toArray(),radius:.05,circleColor:"#eeee00",circleOpacity:.5,mainTagColor:"#c4c4c4",mainTagBackground:"#2E2E30",mainTagOpacity:.8,mainTagVisible:!0,circleTagColor:"#000000",circleTagBackground:"#e0ffff",circleTagOpacity:.9,circleTagVisible:!0,title:"标记圆面"+i},o=new g.CircleGeometry(a.radius,32),r=new g.MeshBasicMaterial({color:a.circleColor,side:g.DoubleSide,transparent:!0});r.opacity=a.circleOpacity;const c=new g.Mesh(o,r);c.position.copy(t),c.isMark=!0,c.renderOrder=1;const A=new g.Vector3(0,1,0).normalize();c.lookAt(c.position.clone().add(A));const u=document.createElement("div");u.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
805
+ </div>`,h.classList.add("mark-wrap-plans",`${i.name}`,"main-warp"),h.style.position="absolute",h.style.borderRadius="4px",h.style.cursor="pointer",h.onclick=()=>{if(s.events.fire(L).markMode)return;const I=parent?.onActiveMark,g=s.getMarkData(!0);g.meterScale=s.events.fire(L).meterScale,I?.(g),s.events.fire(Ct)},h.oncontextmenu=I=>I.preventDefault();const m=new bt(h);m.position.set(i.points[0],i.points[1],i.points[2]),m.element.style.pointerEvents="none",m.scale.set(.01,.01,.01),m.visible=i.mainTagVisible,s.group.add(m),s.css3dMainTag=m}const l=s.events.fire(rs,i.points).toFixed(2)+" m²",C=s.events.fire(as,i.points);if(s.css3dAreaTag)s.css3dAreaTag.position.copy(C),s.css3dAreaTag.element.childNodes[0].innerText=l;else{const h=document.createElement("div");h.innerHTML=`<span class="${A}-area-tag" style="color:${i.areaTagColor};background:${i.areaTagBackground};opacity:${i.areaTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: none;">${l}</span>`,h.classList.add("mark-wrap-plans",`${i.name}`,"area-warp"),h.style.position="absolute",h.style.borderRadius="4px";const m=new bt(h);m.position.copy(C),m.element.style.pointerEvents="none",m.scale.set(.01,.01,.01),s.group.add(m),s.css3dAreaTag=m}s.css3dAreaTag.visible=i.points.length>6&&i.areaTagVisible;for(let h=s.css3dTags.length;h<u;h++){const m=new d.Vector3().fromArray(i.points.slice(h*3,h*3+3)),I=new d.Vector3().fromArray(i.points.slice(h*3+3,h*3+6)),g=new d.Vector3((m.x+I.x)/2,(m.y+I.y)/2,(m.z+I.z)/2),f=(m.distanceTo(I)*s.events.fire(L).meterScale).toFixed(2)+" m",D=document.createElement("div");D.innerText=f,D.style.color="white",D.classList.add("mark-wrap-plans",`${A}`,"distance-warp"),D.style.position="absolute",D.style.borderRadius="4px",D.style.display="none";const w=new bt(D);w.position.copy(g),w.element.style.pointerEvents="none",w.scale.set(.008,.008,.008),w.visible=i.distanceTagVisible,s.css3dTags.push(w),s.group.add(w)}s.drawPlans(i),e||(s.css3dTags[s.css3dTags.length-1].visible=!1),s.data=i,s.events.fire(ge,s)}drawPlans(t){const e=this;if(!e.meshPlans){const s=new d.BufferGeometry;s.setAttribute("position",new d.BufferAttribute(new Float32Array,3)),s.attributes.position.needsUpdate=!0;const i=new d.BufferAttribute(new Uint16Array([]),1);s.setIndex(i);const a=new d.MeshBasicMaterial({color:t.lineColor,transparent:!0,opacity:t.planOpacity,side:d.DoubleSide});e.meshPlans=new d.Mesh(s,a),e.meshPlans.renderOrder=1,e.meshPlans.isMark=!0,e.group.add(e.meshPlans)}if(t.points.length>6){e.meshPlans.geometry.setAttribute("position",new d.BufferAttribute(new Float32Array(t.points),3)),e.meshPlans.geometry.attributes.position.needsUpdate=!0;let s=t.points.length/3-2;const i=new d.Vector3().fromArray(t.points.slice(0,3)),a=new d.Vector3().fromArray(t.points.slice(-3));i.distanceTo(a)<1e-4&&s--;const o=new Uint16Array(s*3);for(let r=0;r<s;r++)o[r*3]=0,o[r*3+1]=r+1,o[r*3+2]=r+2;e.meshPlans.geometry.setIndex(new d.BufferAttribute(o,1))}}getMarkData(t=!1){const e={...this.data};return t?delete e.points:e.points=[...e.points],e}dispose(){if(this.disposed)return;const t=this;t.disposed=!0,t.events.fire(oe,t),t.events.fire(j).remove(t),t.events.fire(ke,t),t.geometry.dispose(),t.material.dispose(),document.querySelectorAll(`.${t.data.name}`).forEach(s=>s.parentElement?.removeChild(s)),t.events=null,t.data=null,t.css3dTags=null,t.group=null,t.meshPlans=null,t.css3dMainTag=null,t.css3dAreaTag=null}}class Cr extends d.Group{constructor(t){super(),this.isMark=!0,this.disposed=!1,this.events=t}drawStart(t,e){if(this.disposed)return;const s=this,i=document.querySelectorAll(".mark-wrap-circle.main-warp").length+1,a={type:"MarkCirclePlan",name:e||"circle"+Date.now(),startPoint:t.toArray(),radius:.05,circleColor:"#eeee00",circleOpacity:.5,mainTagColor:"#c4c4c4",mainTagBackground:"#2E2E30",mainTagOpacity:.8,mainTagVisible:!0,circleTagColor:"#000000",circleTagBackground:"#e0ffff",circleTagOpacity:.9,circleTagVisible:!0,title:"标记圆面"+i},o=new d.CircleGeometry(a.radius,32),r=new d.MeshBasicMaterial({color:a.circleColor,side:d.DoubleSide,transparent:!0});r.opacity=a.circleOpacity;const c=new d.Mesh(o,r);c.position.copy(t),c.isMark=!0,c.renderOrder=1;const A=new d.Vector3(0,1,0).normalize();c.lookAt(c.position.clone().add(A));const u=document.createElement("div");u.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
806
806
  <span class="${a.name}-main-tag" style="color:${a.mainTagColor};background:${a.mainTagBackground};opacity:${a.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${a.title}</span>
807
- </div>`,u.classList.add("mark-wrap-circle",`${a.name}`,"main-warp"),u.style.position="absolute",u.style.borderRadius="4px",u.style.cursor="pointer",u.onclick=()=>{if(s.events.fire(R).markMode)return;const m=parent?.onActiveMark;m?.(s.getMarkData(!0)),s.events.fire(mt)},u.oncontextmenu=m=>m.preventDefault();const l=new Bt(u);l.position.copy(t),l.element.style.pointerEvents="none",l.scale.set(.01,.01,.01),l.visible=a.mainTagVisible;const C=document.createElement("div");C.innerHTML=`<span class="${e}-circle-tag" style="color:${a.circleTagColor};background:${a.circleTagBackground};opacity:${a.circleTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;"></span>`,C.classList.add("mark-wrap-circle",`${e}`,"circle-warp"),C.style.position="absolute",C.style.borderRadius="4px",C.style.pointerEvents="none";const h=new Bt(C);h.position.set(t.x+Math.min(a.radius/2,.5),t.y,t.z),h.element.style.pointerEvents="none",h.scale.set(.008,.008,.008),h.visible=!1,s.add(c,l,h),s.data=a,s.circleMesh=c,s.css3dTag=h,s.css3dMainTag=l,s.events.fire(ue,s)}drawUpdate(t,e=!0,s){if(this.disposed)return;const i=this;if(s){const a=new g.Vector3().fromArray(i.data.startPoint),o=a.distanceTo(new g.Vector3(s.x,a.y,s.z));e&&(i.data.radius=o),i.circleMesh.geometry.copy(new g.CircleGeometry(o,128)),i.css3dTag.visible=o>.3;const r=o*i.events.fire(R).meterScale,c=(Math.PI*r*r).toFixed(2)+" m²";i.css3dTag.element.childNodes[0].innerText=c,i.css3dTag.position.set(a.x+Math.min(i.data.radius/2,.5),a.y,a.z)}if(t?.radius){const a=new g.Vector3().fromArray(i.data.startPoint),o=t?.radius;e&&(i.data.radius=o),i.circleMesh.geometry.copy(new g.CircleGeometry(o,128)),i.css3dTag.visible=o>.3;const r=o*i.events.fire(R).meterScale,c=(Math.PI*r*r).toFixed(2)+" m²";i.css3dTag.element.childNodes[0].innerText=c,i.css3dTag.position.set(a.x+Math.min(o/2,.5),a.y,a.z)}t?.circleColor&&(e&&(i.data.circleColor=t.circleColor),i.circleMesh.material.color.set(t.circleColor)),t?.circleOpacity&&(e&&(i.data.circleOpacity=t.circleOpacity),i.circleMesh.material.opacity=t.circleOpacity),t?.mainTagColor&&(e&&(i.data.mainTagColor=t.mainTagColor),document.querySelector(`.${i.data.name}-main-tag`).style.color=t.mainTagColor),t?.mainTagBackground&&(e&&(i.data.mainTagBackground=t.mainTagBackground),document.querySelector(`.${i.data.name}-main-tag`).style.background=t.mainTagBackground),t?.mainTagOpacity&&(e&&(i.data.mainTagOpacity=t.mainTagOpacity),document.querySelector(`.${i.data.name}-main-tag`).style.opacity=t.mainTagOpacity.toString()),t?.mainTagVisible!==void 0&&(e&&(i.data.mainTagVisible=t.mainTagVisible),i.css3dMainTag.visible=t.mainTagVisible),t?.circleTagColor&&(e&&(i.data.circleTagColor=t.circleTagColor),document.querySelector(`.${i.data.name}-circle-tag`).style.color=t.circleTagColor),t?.circleTagBackground&&(e&&(i.data.circleTagBackground=t.circleTagBackground),document.querySelector(`.${i.data.name}-circle-tag`).style.background=t.circleTagBackground),t?.circleTagOpacity&&(e&&(i.data.circleTagOpacity=t.circleTagOpacity),document.querySelector(`.${i.data.name}-circle-tag`).style.opacity=t.circleTagOpacity.toString()),t?.circleTagVisible!==void 0&&(e&&(i.data.circleTagVisible=t.circleTagVisible),i.css3dTag.visible=t.circleTagVisible),t?.title!==void 0&&(e&&(i.data.title=t.title),this.css3dMainTag.element.querySelector(`.${i.data.name}-main-tag`).innerText=t.title),t?.note!==void 0&&e&&(i.data.note=t.note),i.events.fire(Ct)}updateByMeterScale(t){const e=this,s=e.data.radius*t,i=(Math.PI*s*s).toFixed(2)+" m²";e.css3dTag.element.childNodes[0].innerText=i}drawFinish(t){if(this.disposed)return;const e=this,s=new g.Vector3().fromArray(e.data.startPoint),i=s.distanceTo(new g.Vector3(t.x,s.y,t.z));e.data.radius=i,e.circleMesh.geometry.copy(new g.CircleGeometry(i,128));const a=e.data.radius*e.events.fire(R).meterScale,o=(Math.PI*a*a).toFixed(2)+" m²";e.css3dTag.element.childNodes[0].innerText=o,e.events.fire(de);const r=parent?.onActiveMark,c=e.getMarkData(!0);c.isNew=!0,c.meterScale=e.events.fire(R).meterScale,r?.(c)}draw(t){if(this.disposed)return;const e=this,s={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||"标记圆面"},i=new g.CircleGeometry(s.radius,128),a=new g.MeshBasicMaterial({color:s.circleColor,side:g.DoubleSide,transparent:!0});a.opacity=s.circleOpacity;const o=new g.Mesh(i,a);o.position.fromArray(s.startPoint),o.isMark=!0,o.renderOrder=1;const r=new g.Vector3(0,1,0).normalize();o.lookAt(o.position.clone().add(r));const c=s.name,A=document.createElement("div");A.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
807
+ </div>`,u.classList.add("mark-wrap-circle",`${a.name}`,"main-warp"),u.style.position="absolute",u.style.borderRadius="4px",u.style.cursor="pointer",u.onclick=()=>{if(s.events.fire(L).markMode)return;const m=parent?.onActiveMark;m?.(s.getMarkData(!0)),s.events.fire(Ct)},u.oncontextmenu=m=>m.preventDefault();const l=new bt(u);l.position.copy(t),l.element.style.pointerEvents="none",l.scale.set(.01,.01,.01),l.visible=a.mainTagVisible;const C=document.createElement("div");C.innerHTML=`<span class="${e}-circle-tag" style="color:${a.circleTagColor};background:${a.circleTagBackground};opacity:${a.circleTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;"></span>`,C.classList.add("mark-wrap-circle",`${e}`,"circle-warp"),C.style.position="absolute",C.style.borderRadius="4px",C.style.pointerEvents="none";const h=new bt(C);h.position.set(t.x+Math.min(a.radius/2,.5),t.y,t.z),h.element.style.pointerEvents="none",h.scale.set(.008,.008,.008),h.visible=!1,s.add(c,l,h),s.data=a,s.circleMesh=c,s.css3dTag=h,s.css3dMainTag=l,s.events.fire(ge,s)}drawUpdate(t,e=!0,s){if(this.disposed)return;const i=this;if(s){const a=new d.Vector3().fromArray(i.data.startPoint),o=a.distanceTo(new d.Vector3(s.x,a.y,s.z));e&&(i.data.radius=o),i.circleMesh.geometry.copy(new d.CircleGeometry(o,128)),i.css3dTag.visible=o>.3;const r=o*i.events.fire(L).meterScale,c=(Math.PI*r*r).toFixed(2)+" m²";i.css3dTag.element.childNodes[0].innerText=c,i.css3dTag.position.set(a.x+Math.min(i.data.radius/2,.5),a.y,a.z)}if(t?.radius){const a=new d.Vector3().fromArray(i.data.startPoint),o=t?.radius;e&&(i.data.radius=o),i.circleMesh.geometry.copy(new d.CircleGeometry(o,128)),i.css3dTag.visible=o>.3;const r=o*i.events.fire(L).meterScale,c=(Math.PI*r*r).toFixed(2)+" m²";i.css3dTag.element.childNodes[0].innerText=c,i.css3dTag.position.set(a.x+Math.min(o/2,.5),a.y,a.z)}t?.circleColor&&(e&&(i.data.circleColor=t.circleColor),i.circleMesh.material.color.set(t.circleColor)),t?.circleOpacity&&(e&&(i.data.circleOpacity=t.circleOpacity),i.circleMesh.material.opacity=t.circleOpacity),t?.mainTagColor&&(e&&(i.data.mainTagColor=t.mainTagColor),document.querySelector(`.${i.data.name}-main-tag`).style.color=t.mainTagColor),t?.mainTagBackground&&(e&&(i.data.mainTagBackground=t.mainTagBackground),document.querySelector(`.${i.data.name}-main-tag`).style.background=t.mainTagBackground),t?.mainTagOpacity&&(e&&(i.data.mainTagOpacity=t.mainTagOpacity),document.querySelector(`.${i.data.name}-main-tag`).style.opacity=t.mainTagOpacity.toString()),t?.mainTagVisible!==void 0&&(e&&(i.data.mainTagVisible=t.mainTagVisible),i.css3dMainTag.visible=t.mainTagVisible),t?.circleTagColor&&(e&&(i.data.circleTagColor=t.circleTagColor),document.querySelector(`.${i.data.name}-circle-tag`).style.color=t.circleTagColor),t?.circleTagBackground&&(e&&(i.data.circleTagBackground=t.circleTagBackground),document.querySelector(`.${i.data.name}-circle-tag`).style.background=t.circleTagBackground),t?.circleTagOpacity&&(e&&(i.data.circleTagOpacity=t.circleTagOpacity),document.querySelector(`.${i.data.name}-circle-tag`).style.opacity=t.circleTagOpacity.toString()),t?.circleTagVisible!==void 0&&(e&&(i.data.circleTagVisible=t.circleTagVisible),i.css3dTag.visible=t.circleTagVisible),t?.title!==void 0&&(e&&(i.data.title=t.title),this.css3dMainTag.element.querySelector(`.${i.data.name}-main-tag`).innerText=t.title),t?.note!==void 0&&e&&(i.data.note=t.note),i.events.fire(pt)}updateByMeterScale(t){const e=this,s=e.data.radius*t,i=(Math.PI*s*s).toFixed(2)+" m²";e.css3dTag.element.childNodes[0].innerText=i}drawFinish(t){if(this.disposed)return;const e=this,s=new d.Vector3().fromArray(e.data.startPoint),i=s.distanceTo(new d.Vector3(t.x,s.y,t.z));e.data.radius=i,e.circleMesh.geometry.copy(new d.CircleGeometry(i,128));const a=e.data.radius*e.events.fire(L).meterScale,o=(Math.PI*a*a).toFixed(2)+" m²";e.css3dTag.element.childNodes[0].innerText=o,e.events.fire(fe);const r=parent?.onActiveMark,c=e.getMarkData(!0);c.isNew=!0,c.meterScale=e.events.fire(L).meterScale,r?.(c)}draw(t){if(this.disposed)return;const e=this,s={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||"标记圆面"},i=new d.CircleGeometry(s.radius,128),a=new d.MeshBasicMaterial({color:s.circleColor,side:d.DoubleSide,transparent:!0});a.opacity=s.circleOpacity;const o=new d.Mesh(i,a);o.position.fromArray(s.startPoint),o.isMark=!0,o.renderOrder=1;const r=new d.Vector3(0,1,0).normalize();o.lookAt(o.position.clone().add(r));const c=s.name,A=document.createElement("div");A.innerHTML=`<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
808
808
  <span class="${c}-main-tag" style="color:${s.mainTagColor};background:${s.mainTagBackground};opacity:${s.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: auto;">${s.title}</span>
809
- </div>`,A.classList.add("mark-wrap-circle",`${s.name}`,"main-warp"),A.style.position="absolute",A.style.borderRadius="4px",A.style.cursor="pointer",A.onclick=()=>{if(e.events.fire(R).markMode)return;const d=parent?.onActiveMark;d?.(e.getMarkData(!0)),e.events.fire(mt)},A.oncontextmenu=d=>d.preventDefault();const u=new g.Vector3().fromArray(s.startPoint),l=s.radius*e.events.fire(R).meterScale,C=(Math.PI*l*l).toFixed(2)+" m²",h=new Bt(A);h.position.copy(u),h.element.style.pointerEvents="none",h.scale.set(.01,.01,.01),h.visible=s.mainTagVisible;const m=document.createElement("div");m.innerHTML=`<span class="${c}-distance-tag ${c}-circle-tag" style="color:${s.circleTagColor};background:${s.circleTagBackground};opacity:${s.circleTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${C}</span>`,m.classList.add("mark-wrap-circle",`${c}`,"circle-warp"),m.style.position="absolute",m.style.borderRadius="4px",m.style.pointerEvents="none";const I=new Bt(m);I.position.set(u.x+Math.min(s.radius/2,.5),u.y,u.z),I.element.style.pointerEvents="none",I.scale.set(.008,.008,.008),I.visible=s.circleTagVisible,e.add(o,h,I),e.data=s,e.circleMesh=o,e.css3dTag=I,e.css3dMainTag=h,e.events.fire(ue,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(ie,t),t.events.fire(X).remove(t),t.events.fire(ve,t),document.querySelectorAll(`.${t.data.name}`).forEach(s=>s.parentElement?.removeChild(s)),t.events=null,t.data=null,t.circleMesh=null,t.css3dTag=null,t.css3dMainTag=null}}let Rl=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 Fl(n){const t=(y,S,v)=>n.on(y,S,v),e=(y,...S)=>n.fire(y,...S),s=e(Qe);let i=new Set,a,o=new Rl,r;t(Gi,()=>{e(st).autoRotate=e(R).autoRotate=!0}),t(mt,(y=!0)=>{e(st).autoRotate=e(R).autoRotate=!1,y&&e(Un)}),t(Es,(y=!0)=>{if(a)return;const S=e(st),v=y?Math.PI/128:-(Math.PI/128),M=new g.Matrix4().makeRotationAxis(new g.Vector3(0,0,-1).transformDirection(S.object.matrixWorld),v);S.object.up.transformDirection(M),e(Ct)}),t(Ao,()=>{a||n.fire(Es,!0)}),t(co,()=>{a||n.fire(Es,!1)}),t(kn,y=>{const S=e(R);y??(y=!S.pointcloudMode),S.pointcloudMode=y,e(X).traverse(M=>M instanceof Wt&&M.fire(Ce,y))}),t(Tn,()=>{e(X).traverse(S=>S instanceof Wt&&S.fire(Is))}),t(ze,y=>{e(X).traverse(v=>v instanceof Wt&&v.fire(ze,y))}),t(xo,()=>{const y=e(X);let S;y.traverse(v=>v instanceof Wt&&(S=v)),S&&e(ls,S.fire(Mo))}),t(Qn,()=>{if(!i.size)return;const y=e(R);if(!y.enableKeyboard)return i.clear();if(y.markMode&&i.has("Escape")){e($e),i.clear();return}i.has("Space")?(y.bigSceneMode?e(kn):e(Tn),i.clear()):i.has("Escape")?(jn.fire(js),i.clear()):i.has("KeyR")?(y.autoRotate?e(mt):e(Gi),i.clear()):i.has("KeyM")?(e(qe,!y.markVisible),i.clear()):i.has("ArrowLeft")?(e(Ao),e(Mn,!0),i.clear()):i.has("ArrowRight")?(e(co),e(Mn,!0),i.clear()):i.has("KeyP")?(e(Kt,!0),i.clear()):i.has("Equal")?(e(tn),i.clear()):i.has("Minus")?(e(nn),i.clear()):i.has("KeyY")?(e(en,!1),e(Ds),i.clear()):i.has("KeyI")?(e(Eo),i.clear()):i.has("KeyF")?(e(xo),i.clear()):i.has("F2")?(!y.bigSceneMode&&window.open("/editor/index.html?url="+encodeURIComponent(e(xt).meta.url)),i.clear()):i.has("KeyW")?(Vl(e(st),.15),i.clear()):i.has("KeyS")?(Nl(e(st),.15),i.clear()):i.has("KeyA")?(Ul(e(st),.15),i.clear()):i.has("KeyD")?(Pl(e(st),.15),i.clear()):i.has("KeyQ")?(Hl(e(st)),i.clear()):i.has("KeyE")?(_l(e(st)),i.clear()):i.has("KeyC")?(Gl(e(st)),i.clear()):i.has("KeyZ")&&(Wl(e(st)),i.clear())}),t(Ze,async(y,S)=>{if(o.move)return;const v=await e(Bn,y,S);v.length&&e(ls,v[0],!0,!1)}),t(Pt,async(y,S)=>{const v=e(X),M=[];v.traverse(O=>O instanceof Wt&&M.push(O));const N=await e(Bn,y,S);return N.length?(M.length&&M[0].fire(Cn,N[0].x,N[0].y,N[0].z,!0),new g.Vector3(N[0].x,N[0].y,N[0].z)):(M.length&&M[0].fire(Cn,0,0,0,!1),null)}),t(bs,async()=>{const y=e(X),S=[];y.traverse(v=>v instanceof Wt&&S.push(v));for(let v=0;v<S.length;v++)S[v].fire(Cn,0,0,0,!1)});const c=y=>{y.target.type!=="text"&&(a||y.code==="F5"||(y.preventDefault(),y.code!=="KeyR"&&(i.add(y.code),e(mt)),r=Date.now()))},A=y=>{y.target.type!=="text"&&(a||(y.code==="KeyR"&&i.add(y.code),(y.code==="ArrowLeft"||y.code==="ArrowRight")&&e(Vi),r=Date.now()))};t(xe,()=>{e(Ms)&&Date.now()-r>2e3&&(e(Mn,!1),e(Ds))},!0);const u=()=>{i.clear()},l=y=>{parent&&setTimeout(()=>window.focus()),y.preventDefault(),!a&&(e(mt),r=Date.now())},C=y=>{y.preventDefault(),!a&&(e(mt),r=Date.now())};let h,m,I,d;t($e,()=>{h?.dispose(),m?.dispose(),I?.dispose(),d?.dispose(),h=null,m=null,I=null,d=null,o.lastMovePoint=null,e(de)});const p=async y=>{parent&&setTimeout(()=>window.focus()),y.preventDefault(),!a&&(e(mt),o.down=y.button===2?2:1,o.move=!1,o.isDbClick=Date.now()-o.downTime<300,r=Date.now(),o.downTime=Date.now())},f=async y=>{if(y.preventDefault(),a)return;o.down&&(o.move=!0,r=Date.now());const S=e(R);if(S.markMode){const v=await e(Pt,y.clientX,y.clientY);v&&!o.down&&S.markType==="distance"&&h?h.drawUpdate({endPoint:v.toArray()}):!o.down&&S.markType==="circle"&&d?v?(d.drawUpdate(null,!0,v),o.lastMovePoint=v,o.lastMovePointTime=Date.now()):(o.lastMovePoint=null,o.lastMovePointTime=0):!o.down&&S.markType==="lines"&&m?v?(m.drawUpdate(null,!0,v),o.lastMovePoint=v,o.lastMovePointTime=Date.now()):(o.lastMovePoint=null,o.lastMovePointTime=0):!o.down&&S.markType==="plans"&&I&&(v?(I.drawUpdate(null,!0,v),o.lastMovePoint=v,o.lastMovePointTime=Date.now()):(o.lastMovePoint=null,o.lastMovePointTime=0))}},D=async y=>{if(y.preventDefault(),a)return;const S=e(R);if(o.isDbClick&&(m?Math.abs(y.clientX-o.lastClickX)<2&&Math.abs(y.clientY-o.lastClickY)<2&&(m.drawFinish(o.lastClickPointTime>0),m=null,o.lastMovePoint=null):I&&Math.abs(y.clientX-o.lastClickX)<2&&Math.abs(y.clientY-o.lastClickY)<2&&(I.drawFinish(o.lastClickPointTime>0),I=null,o.lastMovePoint=null)),S.markMode&&o.down===1&&!o.move&&Date.now()-o.downTime<500){if(S.markType==="point"){if(await e(Pt,y.clientX,y.clientY)){const M=new Ir(n,await e(Pt,y.clientX,y.clientY));e(X).add(M),M.drawFinish()}}else if(S.markType==="distance")if(h){const v=await e(Pt,y.clientX,y.clientY);v?(h.drawFinish(v),h=null):o.isDbClick&&e($e)}else{const v=await e(Pt,y.clientX,y.clientY);v&&(h=new Bi(n),h.drawStart(v),e(X).add(h))}else if(S.markType==="lines")if(m)if(o.lastMovePoint&&e(Qs,y.clientX,y.clientY,o.lastMovePoint)<.03)m.drawUpdate(null,!0,o.lastMovePoint,!0),o.lastClickPointTime=Date.now();else{const v=await e(Pt,y.clientX,y.clientY);v?(m.drawUpdate(null,!0,v,!0),o.lastClickPointTime=Date.now()):o.lastClickPointTime=0}else{const v=await e(Pt,y.clientX,y.clientY);v&&(m=new Si(n),m.drawStart(v),e(X).add(m))}else if(S.markType==="plans")if(I)if(o.lastMovePoint&&e(Qs,y.clientX,y.clientY,o.lastMovePoint)<.03)I.drawUpdate(null,!0,o.lastMovePoint,!0),o.lastClickPointTime=Date.now();else{const v=await e(Pt,y.clientX,y.clientY);v?(I.drawUpdate(null,!0,v,!0),o.lastClickPointTime=Date.now()):o.lastClickPointTime=0}else{const v=await e(Pt,y.clientX,y.clientY);v&&(I=new Mi(n),I.drawStart(v),e(X).add(I))}else if(S.markType==="circle")if(d){const v=await e(Pt,y.clientX,y.clientY);v?(d.drawFinish(v),d=null):o.isDbClick&&e($e)}else{const v=await e(Pt,y.clientX,y.clientY);v&&(d=new yr(n),d.drawStart(v),e(X).add(d))}o.lastClickX=y.clientX,o.lastClickY=y.clientY}o.down===2&&!o.move&&e(Ze,y.clientX,y.clientY),o.down=0,o.move=!1,r=Date.now()};function w(y){y.preventDefault(),!a&&(e(mt),o.down=y.touches.length,o.down===1&&(o.move=!1,o.x=y.touches[0].clientX,o.y=y.touches[0].clientY))}function x(y){y.touches.length===1&&(o.move=!0)}function b(y){o.down===1&&!o.move&&e(Ze,o.x,o.y)}window.addEventListener("keydown",c),window.addEventListener("keyup",A),window.addEventListener("blur",u),window.addEventListener("wheel",l,{passive:!1}),s.addEventListener("contextmenu",C),s.addEventListener("mousedown",p),s.addEventListener("mousemove",f),s.addEventListener("mouseup",D),s.addEventListener("touchstart",w,{passive:!1}),s.addEventListener("touchmove",x,{passive:!1}),s.addEventListener("touchend",b,{passive:!1}),window.addEventListener("resize",Q),Q();function Q(){const{width:y,height:S,top:v,left:M}=e(me),N=e(Qt);N.aspect=y/S,N.updateProjectionMatrix();const O=e(xs);O.setSize(y,S),O.domElement.style.position="absolute",O.domElement.style.left=`${M}px`,O.domElement.style.top=`${v}px`;const z=e(Se);z.setPixelRatio(Math.min(devicePixelRatio,e(R).qualityLevel>vt.Default5?2:1)),z.setSize(y,S)}t(ds,()=>{a=!0,window.removeEventListener("keydown",c),window.removeEventListener("keyup",A),window.removeEventListener("blur",u),window.removeEventListener("wheel",l),s.removeEventListener("contextmenu",C),s.removeEventListener("mousedown",p),s.removeEventListener("mousemove",f),s.removeEventListener("mouseup",D),s.removeEventListener("touchstart",w),s.removeEventListener("touchmove",x),s.removeEventListener("touchend",b),window.removeEventListener("resize",Q)})}function ns(n,t,e=.012){const s=n.object.up.clone().normalize(),a=new g.Vector3().copy(t).projectOnPlane(s).normalize().multiplyScalar(e);n.object.position.add(a),n.target.add(a),n.update()}function Ul(n,t=.2){const e=new g.Vector3;n.object.getWorldDirection(e);const s=new g.Vector3().crossVectors(n.object.up,e).normalize();ns(n,s,t)}function Pl(n,t=.2){const e=new g.Vector3;n.object.getWorldDirection(e);const s=new g.Vector3().crossVectors(n.object.up,e).normalize().negate();ns(n,s,t)}function Vl(n,t=.2){const e=new g.Vector3;n.object.getWorldDirection(e),ns(n,e,t)}function Nl(n,t=.2){const e=new g.Vector3;n.object.getWorldDirection(e).negate(),ns(n,e,t)}function wr(n,t=.006){const e=n.object.position.clone(),s=n.target.clone(),i=new g.Vector3().subVectors(s,e),a=n.object.up.clone().normalize(),o=new g.Quaternion;o.setFromAxisAngle(a,-t),i.applyQuaternion(o);const r=new g.Vector3().addVectors(e,i);n.target.copy(r),n.update()}function Hl(n){wr(n,-.01)}function _l(n){wr(n,.01)}function Er(n,t=.006){const e=n.object.position.clone(),s=n.target.clone(),i=new g.Vector3().subVectors(s,e),a=new g.Vector3;n.object.getWorldDirection(a);const o=new g.Vector3().crossVectors(n.object.up,a).normalize(),r=new g.Quaternion;r.setFromAxisAngle(o,t),i.applyQuaternion(r);const c=new g.Vector3().addVectors(e,i);n.target.copy(c),n.update()}function Gl(n,t=.01){Er(n,-t)}function Wl(n,t=.01){Er(n,t)}function Qr(n){const t=new g.Raycaster,e=5,s=(a,o,r)=>n.on(a,o,r),i=(a,...o)=>n.fire(a,...o);s(Bn,async(a,o)=>{const{width:r,height:c,left:A,top:u}=i(me),l=new g.Vector2;l.x=(a-A)/r*2-1,l.y=(u-o)/c*2+1;const C=(l.x+1)/2*r,h=(1-l.y)/2*c,m=i(Qt);t.setFromCamera(l,m);const I=[],d=i(X),p=[],f=[];d.traverse(function(Q){Q instanceof Wt?f.push(Q):Q.isMesh&&!Q.ignoreIntersect&&!Q.isMark&&p.push(Q)});const D=t.intersectObjects(p,!0);for(let Q=0;Q<D.length;Q++)I.push({point:D[Q].point,d:t.ray.distanceToPoint(D[Q].point),p:1});const w=i(Do),x=m.projectionMatrix.clone().multiply(m.matrixWorldInverse);for(let Q=0;Q<f.length;Q++){const y=f[Q].fire(bn);if(y)if(y.length!==void 0){const S=y,v=S.length/3;for(let M=0;M<v;M++){const N=new g.Vector3(S[3*M+0],S[3*M+1],S[3*M+2]);w&&N.applyMatrix4(w);const O=new g.Vector4(N.x,N.y,N.z,1).applyMatrix4(x),z=(O.x/O.w+1)/2*r,W=(1-O.y/O.w)/2*c,J=Math.sqrt((z-C)**2+(W-h)**2);J<=e&&I.push({point:N,d:m.position.distanceTo(N),p:J})}}else for(let S of Object.keys(y)){const v=S.split(","),M=new g.Vector3(Number(v[0]),Number(v[1]),Number(v[2]));if(t.ray.distanceToPoint(M)<=1.4143){const N=y[S];for(let O=0,z=N.length/3;O<z;O++){const W=new g.Vector3(N[3*O+0],N[3*O+1],N[3*O+2]);w&&W.applyMatrix4(w);const J=new g.Vector4(W.x,W.y,W.z,1).applyMatrix4(x),k=(J.x/J.w+1)/2*r,B=(1-J.y/J.w)/2*c,T=Math.sqrt((k-C)**2+(B-h)**2);T<=e&&I.push({point:W,d:m.position.distanceTo(W),p:T})}}}}if(!I.length)return[];I.sort((Q,y)=>Q.d-y.d);const b=[];for(let Q=0,y=I[0].d,S=Math.min(I.length,20);Q<S;Q++)I[Q].d-y<.01&&b.push(I[Q]);return b.sort((Q,y)=>Q.p-y.p),[b[0].point]}),s(Qs,(a,o,r)=>{const{width:c,height:A,left:u,top:l}=i(me),C=new g.Vector2;C.x=(a-u)/c*2-1,C.y=(l-o)/A*2+1;const h=i(Qt);return t.setFromCamera(C,h),t.ray.distanceToPoint(r)})}function Ol(n){const t=(l,C,h)=>n.on(l,C,h),e=(l,...C)=>n.fire(l,...C),s=e(st);t(Oe,()=>e(Qt).fov),t(Ut,(l=!1)=>l?s.object.position.clone():s.object.position),t(Jt,(l=!1)=>l?s.target.clone():s.target),t(be,(l=!1)=>l?e(Qt).up.clone():e(Qt).up);let i=!1;t(Yr,()=>{if(i)return;i=!0;const l=new g.Vector3().subVectors(s.target,s.object.position).normalize().multiplyScalar(.01);s.target.copy(s.object.position.clone().add(l)),s.panSpeed=s.target.distanceTo(s.object.position)>s.minDistance?1:50,s.update()});let a;const o=[];t(ls,(l,C=!1,h)=>{if(i=!1,s.panSpeed=s.target.distanceTo(s.object.position)>s.minDistance?1:50,e(lo,l),!C){s.target.copy(l);const D=new g.Vector3().subVectors(l,s.object.position);D.length()<1&&s.object.position.copy(l).sub(D.setLength(1)),D.length()>50&&s.object.position.copy(l).sub(D.setLength(50)),e(xn),e(Ss);return}for(;o.length;)o.pop().stop=!0;let m={alpha:0,time:Date.now(),stop:!1};o.push(m),a=a||{enablePan:s.enablePan,enableRotate:s.enableRotate},s.enablePan=!1,s.enableRotate=!1;const I=e(Jt,!0),d=e(Ut,!0),p=I.clone().sub(d).normalize(),f=l.clone().sub(p.multiplyScalar(l.clone().sub(d).dot(p)));e(he,()=>{m.alpha=(Date.now()-m.time)/600,e(st).target.copy(I.clone().lerp(l,m.alpha)),!h&&e(st).object.position.copy(d.clone().lerp(f,m.alpha)),e(xn),m.alpha>=.9&&(s.enablePan=a.enablePan,s.enableRotate=a.enableRotate),m.alpha>=1&&(m.stop=!0,e(Ss))},()=>!m.stop)}),t(Ui,()=>{let l=e(Ut).toArray(),C=e(be).toArray(),h=e(Jt).toArray();return{position:l,lookUp:C,lookAt:h}}),t(Pi,()=>e(st).update()),t(Vi,()=>e(st).updateRotateAxis());const r=.01;let c=new g.Vector3,A=new g.Vector3,u=0;t(Cs,()=>{const l=e(st).object,C=l.fov,h=l.position.clone(),m=l.getWorldDirection(new g.Vector3);return Math.abs(u-C)<r&&Math.abs(h.x-c.x)<r&&Math.abs(h.y-c.y)<r&&Math.abs(h.z-c.z)<r&&Math.abs(m.x-A.x)<r&&Math.abs(m.y-A.y)<r&&Math.abs(m.z-A.z)<r?!1:(u=C,c=h,A=m,!0)})}function zl(n){const t=(o,r,c)=>n.on(o,r,c),e=(o,...r)=>n.fire(o,...r);let s=a();const i=[];t(Bs,()=>{const{height:o}=e(me),r=e(Ut).distanceTo(s.position)*3.2/o;s.scale.set(r,r,r)}),t(Sn,o=>{e(Bs),s.visible=o>.1,s.element.style.opacity=o+"",e(Ct)}),t(lo,o=>{for(s.position.copy(o);i.length;)i.pop().stop=!0;e(Sn,1),e(Ct)}),t(Ss,()=>{for(;i.length;)i.pop().stop=!0;let o={opacity:1,time:Date.now(),stop:!1};i.push(o),e(he,()=>{o=i[0],!o&&e(Sn,1),o&&(o.opacity=1-Math.min((Date.now()-o.time)/1500,1),o.opacity<.2&&(o.opacity=0,o.stop=!0),e(Sn,o.opacity))},()=>!o?.stop)});function a(){const o=document.createElement("div");o.innerHTML='<svg height="16" width="16" style="fill:white;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M108.8 469.333333C128 279.466667 279.466667 128 469.333333 108.8V64c0-23.466667 19.2-42.666667 42.666667-42.666667s42.666667 19.2 42.666667 42.666667v44.8c189.866667 19.2 341.333333 170.666667 360.533333 360.533333H960c23.466667 0 42.666667 19.2 42.666667 42.666667s-19.2 42.666667-42.666667 42.666667h-44.8c-19.2 189.866667-170.666667 341.333333-360.533333 360.533333V960c0 23.466667-19.2 42.666667-42.666667 42.666667s-42.666667-19.2-42.666667-42.666667v-44.8C279.466667 896 128 744.533333 108.8 554.666667H64c-23.466667 0-42.666667-19.2-42.666667-42.666667s19.2-42.666667 42.666667-42.666667h44.8zM469.333333 194.133333C326.4 213.333333 215.466667 326.4 196.266667 469.333333H234.666667c23.466667 0 42.666667 19.2 42.666666 42.666667s-19.2 42.666667-42.666666 42.666667H196.266667c19.2 142.933333 132.266667 256 275.2 273.066666V789.333333c0-23.466667 19.2-42.666667 42.666666-42.666666s42.666667 19.2 42.666667 42.666666v38.4C697.6 810.666667 810.666667 697.6 829.866667 554.666667H789.333333c-23.466667 0-42.666667-19.2-42.666666-42.666667s19.2-42.666667 42.666666-42.666667h40.533334C810.666667 326.4 697.6 213.333333 554.666667 194.133333V234.666667c0 23.466667-19.2 42.666667-42.666667 42.666666s-42.666667-19.2-42.666667-42.666666V194.133333z"></path></svg>',o.classList.add("css3d-focus-marker"),o.style.position="absolute";const r=new Bt(o);return r.element.style.pointerEvents="none",r.element.style.opacity="1",r.visible=!1,e(X).add(r),r.onBeforeRender=()=>e(Bs),r}}function br(n){const t=(o,r,c)=>n.on(o,r,c),e=(o,...r)=>n.fire(o,...r),s=new Map,i=document.createElement("div");i.classList.add("mark-warp"),document.body.appendChild(i);const a=new Ll;a.setSize(innerWidth,innerHeight),a.domElement.style.position="absolute",a.domElement.style.top="0px",a.domElement.style.pointerEvents="none",i.appendChild(a.domElement),t(Pr,()=>i),t(xs,()=>a),t(vs,()=>document.body.removeChild(i)),t(xe,()=>a.render(e(X),e(Qt)),!0),t(ue,o=>{const r=o?.getMarkData?.()?.name||o?.name;r&&s.set(r,new WeakRef(o))}),t(ve,o=>{const r=o?.getMarkData?.()?.name||o?.name;s.delete(r)}),t(je,o=>s.get(o)?.deref()),t(Vr,(o,r)=>{const c=e(je,o);!c||!r||c.drawUpdate?.(r)}),t(Nr,o=>{const r=e(je,o);return r?r.getMarkData?.():{}}),t(qe,o=>{o!==void 0&&(e(R).markVisible=o),e(X).traverse(r=>r.isMark&&(r.visible=e(R).markVisible)),e(Ct)}),t(Ds,async()=>{const o=[];e(X).traverse(c=>{if(c.isMark){const A=c.getMarkData?.();A&&o.push(A)}});const r=e(xt).meta||{};return o.length?r.marks=o:delete r.marks,r.cameraInfo=e(Ui),await e(se,r)}),t(Ln,async()=>{const o=[];e(X).traverse(c=>{if(c.isMark){const A=c.getMarkData?.();A&&o.push(A)}});const r=e(xt).meta||{};return o.length?r.marks=o:delete r.marks,await e(se,r)}),t(po,async()=>{const o=e(xt).meta||{};delete o.marks;const r=await e(se,o),c=[];return s.forEach(A=>c.push(A)),c.forEach(A=>A.deref()?.dispose?.()),e(Ct),r}),t(Co,async()=>{e(X).traverse(r=>{r.isMark&&r.getMarkData?.()});const o=e(xt).meta||{};return o.watermark=e(go)||"",await e(se,o)}),t(ks,o=>{o.meterScale&&(e(R).meterScale=o.meterScale,e(ut,{scale:`1 : ${e(R).meterScale} m`})),e(st).updateByOptions({...o,...o.cameraInfo||{}}),(o.marks||[]).forEach(c=>{if(c.type==="MarkSinglePoint"){const A=new Ir(n,c);A.visible=!1,e(X).add(A)}else if(c.type==="MarkDistanceLine"){const A=new Bi(n);A.draw(c),A.visible=!1,e(X).add(A)}else if(c.type==="MarkMultiLines"){const A=new Si(n);A.draw(c,!0),A.visible=!1,e(X).add(A)}else if(c.type==="MarkMultiPlans"){const A=new Mi(n);A.draw(c,!0),A.visible=!1,e(X).add(A)}else if(c.type==="MarkCirclePlan"){const A=new yr(n);A.draw(c),A.visible=!1,e(X).add(A)}}),e(Rn,o.flyPositions||[]),e(Fn,o.flyTargets||[])}),t(de,()=>{const o=e(R);o.markMode=!1,e(bs),e(Ct)}),t(ho,(o,r=!0)=>{const c=o?.meterScale;if(c){if(typeof c!="number"||c<=0){console.warn("meterScale is not a number or <= 0",o);return}r&&(e(R).meterScale=o.meterScale),e(ut,{scale:`1 : ${c} m`});for(const A of s.values()){const u=A.deref();u&&(u instanceof Bi||u instanceof Si||u instanceof Mi)&&u.updateByMeterScale(c)}}}),t(rs,o=>{const r=new g.Vector3().fromArray(o.slice(0,3)),c=new g.Vector3().fromArray(o.slice(-6,-3)),A=new g.Vector3().fromArray(o.slice(-3)),u=r.distanceTo(A)<1e-4,l=c.distanceTo(A)<1e-4,C=new g.Vector3,h=u||l?o.length/3-1:o.length/3;for(let m=0;m<h;m++)C.add(new g.Vector3(o[m*3],o[m*3+1],o[m*3+2]));return C.divideScalar(h),C}),t(As,o=>{const r=[];for(let l=0,C=o.length/3;l<C;l++)r.push(new g.Vector3(o[l*3],o[l*3+1],o[l*3+2]));const c=r[0].distanceTo(r[r.length-1])<1e-4,A=r[r.length-2].distanceTo(r[r.length-1])<1e-4;if((c||A)&&r.pop(),r.length<3)return 0;let u=0;for(let l=0,C=r.length-2;l<C;l++)u+=e(cs,r[0],r[l+1],r[l+2],e(R).meterScale);return u}),t(Ri,(o,r)=>{let c=0;for(let A=0,u=o.length-2;A<u;A++)c+=e(cs,o[0],o[A+1],o[A+2],r);return c}),t(cs,(o,r,c,A)=>{const u=o.distanceTo(r)*A,l=r.distanceTo(c)*A,C=c.distanceTo(o)*A,h=(u+l+C)/2;return Math.sqrt(h*(h-u)*(h-l)*(h-C))})}function Br(n){const t=(p,...f)=>n.fire(p,...f),e=(p,f,D)=>n.on(p,f,D),s=[],i=[];let a=!1,o=!1,r=125*1e3;e(Un,()=>a=!1),e(wo,()=>a=!0),e(Io,()=>s),e(Hr,()=>{const p=[];for(let f=0,D=s.length;f<D;f++)p.push(...s[f].toArray());return p}),e(_r,()=>{const p=[];for(let f=0,D=i.length;f<D;f++)p.push(...i[f].toArray());return p}),e(Rn,p=>{for(let f=0,D=p.length/3|0;f<D;f++)s[f]=new g.Vector3(p[f*3+0],p[f*3+1],p[f*3+2])}),e(Fn,p=>{for(let f=0,D=p.length/3|0;f<D;f++)i[f]=new g.Vector3(p[f*3+0],p[f*3+1],p[f*3+2])}),e(Js,(p=125*1e3)=>{r=p}),e(tn,()=>{const p=t(st);s.push(p.object.position.clone()),i.push(p.target.clone())}),e(nn,()=>{s.length=0,i.length=0}),e(en,async(p=!0)=>{const f=t(xt)?.meta||t(Rs);if(f.scenes){const w=f;if(s.length){const b=[],Q=[];for(let y=0,S=s.length;y<S;y++)b.push(...s[y].toArray()),Q.push(...i[y].toArray());w.flyPositions=b,w.flyTargets=Q}else delete w.flyPositions,delete w.flyTargets;const x=t(st);w.position=x.object.position.toArray(),w.lookAt=x.target.toArray(),p&&await t(se,w)}else{const w=f;if(s.length){const x=[],b=[];for(let Q=0,y=s.length;Q<y;Q++)x.push(...s[Q].toArray()),b.push(...i[Q].toArray());w.flyPositions=x,w.flyTargets=b}else delete w.flyPositions,delete w.flyTargets;p&&await t(se,w)}const D=(f.scenes,f);if(s.length){const w=[],x=[];for(let b=0,Q=s.length;b<Q;b++)w.push(...s[b].toArray()),x.push(...i[b].toArray());D.flyPositions=w,D.flyTargets=x}else delete D.flyPositions,delete D.flyTargets;p&&await t(se,D)}),e(yo,()=>{o||(o=!0)&&t(Kt,!0)});let c=0,A=r,u=0,l=0,C=0,h=0,m=1,I,d;e(Kt,p=>{if(c=0,A=r,u=Date.now(),l=0,C=u,h=0,m=1,I=null,d=null,!s.length||!p&&!t(st).autoRotate)return;const f=t(st),D=[f.object.position.clone()],w=[f.target.clone()],x=t(Io)||[];for(let b=0,Q=Math.min(x.length,1e3);b<Q;b++)x[b]&&D.push(x[b]),i[b]&&w.push(i[b]);I=new g.CatmullRomCurve3(D),I.closed=!1,d=new g.CatmullRomCurve3(w),d.closed=!1,t(wo),t(mt,!1)}),e(zr,()=>{l=l||Date.now()}),e(tA,(p,f)=>{f&&(h=f*r),l&&(C=Date.now(),l=0),a||t(Kt,!0),m=p}),e(vn,()=>{const p=t(st);if(l||(h+=m*(Date.now()-C),C=Date.now(),(h<0||h>A)&&t(Un),!a||!I||!d))return;c=h/A;const f=I.getPoint(c),D=d.getPoint(c);p.object.position.set(f.x,f.y,f.z),p.target.set(D.x,D.y,D.z)},!0)}class Yl{constructor(t={}){this.disposed=!1,this.needUpdate=!0,console.info("Reall3dViewer",_n),this.init(ar(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 s=il(t),i=t.scene=t.scene||new g.Scene;i.background=new g.Color(t.background),ol(t);const a=t.controls=new Bl(t);a.updateByOptions(t);const o=a.object,r=new Hn;t.viewerEvents=r,e.events=r;const c=(h,m,I)=>r.on(h,m,I),A=(h,...m)=>r.fire(h,...m);c(Do,()=>e.metaMatrix),c(R,()=>t),c(Qe,()=>s.domElement),c(Se,()=>s),c(X,()=>i),c(st,()=>a),c(Qt,()=>o),c(bt,()=>t.bigSceneMode),c(Ur,h=>t.pointcloudMode=h);const u=[];c(Ct,()=>{for(e.needUpdate=!0;u.length;)u.pop().stop=!0;let h={count:0,stop:!1};u.push(h),A(Ti,()=>{!e.disposed&&(e.needUpdate=!0),h.count++>=600&&(h.stop=!0)},()=>!e.disposed&&(A(Ms)||!h.stop),10)}),oi(r),nl(r),mi(r),Ol(r),br(r),Fl(r),Qr(r),zl(r),Br(r),e.splatMesh=new Wt(al(t)),c(xt,()=>e.splatMesh),i.add(e.splatMesh),ul(r),c(Hs,h=>{t.qualityLevel=h,e.splatMesh.options({qualityLevel:h,renderer:void 0,scene:void 0})}),c(Zs,h=>{t.sortType=h,e.splatMesh.options({sortType:h,renderer:void 0,scene:void 0})}),i.add(new g.AmbientLight("#ffffff",2)),s.setAnimationLoop(e.update.bind(e)),c(fo,()=>{a.update(),!e.needUpdate&&A(Cs)&&A(Ct)}),c(Me,()=>A(Qn),!0),c(Me,()=>A(fo),!0);let l=performance.now();c(xe,()=>{try{const h=performance.now();if(!e.needUpdate||h-l<(dt?25:t.qualityLevel>5?1:18))return;e.needUpdate=!1,l=h,s.render(i,o),A(Tt)&&A(yn)}catch(h){console.warn(h.message)}},!0),c(En,()=>e.dispose()),c(Eo,()=>console.info(JSON.stringify(A(xt).meta||{},null,2)));let C="";c(Dn,(h="")=>{C=h,e.splatMesh.fire(Ts,C,!0)}),c(go,()=>C),A(ut,{scale:`1 : ${A(R).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(),jn.fire(js);let s=e.dataTransfer.files[0];if(!s)return;let i,a=!1;if(s.name.endsWith(".spx"))i="spx";else if(s.name.endsWith(".splat"))i="splat";else if(s.name.endsWith(".ply"))i="ply";else if(s.name.endsWith(".spz"))i="spz";else if(s.name.endsWith(".sog"))i="sog";else if(s.name.endsWith(".obj"))i="obj";else if(s.name.endsWith(".scene.json"))a=!0;else return console.error("unsupported format:",s.name);const o=URL.createObjectURL(s),r=t.events.fire(R);r.bigSceneMode=!1,r.pointcloudMode=!0,r.debugMode=!0,r.autoRotate=i!=="obj",r.maxRenderCountOfPc=10240*1e4,r.qualityLevel=9,r.disableTransitionEffectOnLoad=!1,t.reset(r),a?await t.addScene(o):await t.addModel({url:o,format:i}),URL.revokeObjectURL(o)})}update(){const t=this;if(t.disposed)return;const e=(s,...i)=>t.events.fire(s,...i);e(Me),e(xe),e(vn)}fire(t,e,s){const i=this;if(t===1&&i.splatMesh.fire(gs,e),t===2&&i.events.fire(tn),t===3&&i.events.fire(Kt,!0),t===4&&i.events.fire(nn),t===5&&i.events.fire(en),t===6&&i.events.fire(Ln),t===7&&i.events.fire(po),t===8&&(async()=>{let a=await i.splatMesh.fire(Ls);e&&(a=i.splatMesh.fire(So)+e),i.splatMesh.fire(Ke,a)})(),t===9)if(!e)i.events.fire(Hs,vt.Default5);else{const a=i.events.fire(R).qualityLevel;i.events.fire(Hs,Math.max(vt.L1,Math.min(a+e,vt.L9)))}if(t===10)if(!e)i.events.fire(Zs,Te.Default1);else{const a=[1,2010,2011,2012,2112],o=i.events.fire(R).sortType;let r=a.indexOf(o)+e;r=Math.max(0,Math.min(r,a.length-1)),i.events.fire(Zs,a[r])}}options(t){const e=this;if(e.disposed)return{};const s=(r,...c)=>e.events.fire(r,...c);let i;if(s(X).traverse(r=>!i&&r instanceof Wt&&(i=r.options())),t){const r=s(R);t.autoRotate!==void 0&&(r.autoRotate=t.autoRotate,s(st).autoRotate=t.autoRotate),t.pointcloudMode!==void 0&&s(kn,t.pointcloudMode),t.lightFactor!==void 0&&s(ze,t.lightFactor),t.maxRenderCountOfMobile&&(r.maxRenderCountOfMobile=t.maxRenderCountOfMobile),t.maxRenderCountOfPc&&(r.maxRenderCountOfPc=t.maxRenderCountOfPc),t.debugMode!==void 0&&(r.debugMode=t.debugMode),t.qualityLevel!==void 0&&(r.qualityLevel=t.qualityLevel)&&this.splatMesh.options({qualityLevel:t.qualityLevel}),t.sortType!==void 0&&(r.sortType=t.sortType)&&this.splatMesh.options({sortType:t.sortType}),t.markType!==void 0&&(r.markType=t.markType),t.markVisible!==void 0&&s(qe,t.markVisible),t.meterScale!==void 0&&(r.meterScale=t.meterScale),t.markMode!==void 0&&(r.markMode=t.markMode,!t.markMode&&s(bs),s(st).autoRotate=s(R).autoRotate=!1)}return s(st).updateByOptions(t),s(ut,{scale:`1 : ${s(R).meterScale} m`}),Object.assign({...s(R)},i)}reset(t={}){const e=this;e.dispose(),e.disposed=!1,e.init(ar(t))}switchDeiplayMode(){const t=this;t.disposed||t.events.fire(Tn)}async addScene(t){const e=this;if(e.disposed)return;const s=(o,...r)=>e.events.fire(o,...r);let i={};try{const o=await fetch(t,{mode:"cors",credentials:"omit",cache:"reload"});if(o.status===200)i=await o.json();else return console.error("scene file fetch failed, status:",o.status)}catch(o){return console.error("scene file fetch failed",o.message)}if(!i.url)return console.error("missing model file url");if(!i.url.endsWith(".spx")&&!i.url.endsWith(".json"))return console.error("The format is unsupported in the large scene mode",i.url);const a={...i,...i.cameraInfo||{}};a.bigSceneMode=i.url.endsWith(".json")||!!i.isLargeScene,a.enableEnvironment=i.enableEnvironment===void 0?s(R).enableEnvironment:!!i.enableEnvironment,a.enableEnvironment&&!i.qualityLevel&&(a.qualityLevel=vt.L9),e.reset({...a}),e.metaMatrix=i.transform?new g.Matrix4().fromArray(i.transform):null,e.splatMesh.meta=i,dt&&(i.cameraInfo?.position||i.cameraInfo?.lookAt)&&e.events.fire(st)._dollyOut(.75),a.bigSceneMode?(s(Rn,i.flyPositions||[]),s(Fn,i.flyTargets||[]),s(Js,i.flyDuration)):s(ks,i),e.splatMesh.addModel({url:i.url,baseUrl:Re(t,location.href)},i),await s(Dn,i.watermark||i.name),s(st).updateRotateAxis()}async addModel(t){const e=this;if(e.disposed)return;const s=(A,u,l)=>this.events.on(A,u,l),i=(A,...u)=>e.events.fire(A,...u);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 r=i(R);r.bigSceneMode=!1;let c={};if(!o.url.startsWith("blob:"))try{a=a||o.url.substring(0,o.url.lastIndexOf("."))+".meta.json";const A=await fetch(a,{mode:"cors",credentials:"omit",cache:"reload"});A.status===200?c=await A.json():console.warn("meta file fetch failed, status:",A.status)}catch(A){console.warn("meta file fetch failed",A.message,o.url)}if(c.showWatermark=!!c.showWatermark,c.url=c.url||o.url,delete c.isLargeScene,!o.format)if(o.url=o.url||c.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 if(o.url.endsWith(".sog")||o.url.endsWith("/meta.json")||o.url=="meta.json")o.format="sog";else if(o.url.endsWith(".obj"))o.format="obj";else{console.error("unknow format!",o.url);return}c.qualityLevel=c.qualityLevel||r.qualityLevel||vt.Default5,c.sortType=c.sortType||r.sortType||Te.Default1,s(Rs,()=>c),e.metaMatrix=c.transform?new g.Matrix4().fromArray(c.transform):null,i(ks,c),this.options({qualityLevel:c.qualityLevel,sortType:c.sortType}),o.format==="obj"?(this.options({autoRotate:!1}),await i(vo,o.url)):(this.splatMesh.addModel(o,c),await i(Dn,c.watermark||c.name)),dt&&i(st)._dollyOut?.(.75)}initGsApi(){const t=(u,...l)=>this.events.fire(u,...l),e=()=>{setTimeout(()=>window.focus()),t(Un),t(st).autoRotate=t(R).autoRotate=!t(R).autoRotate},s=(u=!0)=>{setTimeout(()=>window.focus()),u=!!u;const l=t(R);l.pointcloudMode!==u&&(l.bigSceneMode?t(kn,u):t(Tn))},i=(u=!0)=>{setTimeout(()=>window.focus()),t(qe,!!u)},a=u=>{setTimeout(()=>window.focus());const l=t(R);if(l.markMode)return!1;if(u===1)l.markType="point";else if(u===2)l.markType="lines";else if(u===3)l.markType="plans";else if(u===4)l.markType="distance";else return!1;return l.markMode=!0,t(mt),!0},o=async u=>(setTimeout(()=>window.focus()),u?(t(je,u)?.dispose(),t(Ct),await t(Ln)):!1),r=async(u,l=!0)=>(t(ho,u,l),t(je,u?.name)?.drawUpdate?.(u,l),t(Ct),l?(setTimeout(()=>window.focus()),await t(Ln)):!0),c=(u=!0)=>{setTimeout(()=>window.focus()),t(gs,!!u)},A=(u,l=!0)=>{t(Dn,u),l&&t(Co,u)};window.$api={switchAutoRotate:e,changePointCloudMode:s,showMark:i,startMark:a,deleteMark:o,updateMark:r,showWaterMark:c,setWaterMark:A}}dispose(){const t=this;if(t.disposed)return;t.disposed=!0;const e=(a,...o)=>t.events.fire(a,...o),s=e(Se),i=s.domElement;e(ps),e(to),e(vs),e(ds),e(st).dispose(),e(ie,e(X)),s.clear(),s.dispose(),i.parentElement.removeChild(i),t.splatMesh=null,t.events.clear(),t.events=null}}function Jl(n){const t=(o,r,c)=>n.on(o,r,c),e=(o,...r)=>n.fire(o,...r),s=dt?2:20,i=new Map,a=new Map;t(mn,()=>e(Tt)&&i.set(Date.now(),1)),t(In,()=>e(Tt)&&e(Be,i)),t(yn,()=>e(Tt)&&a.set(Date.now(),1)),t(wn,()=>e(Tt)&&e(Be,a)),t(Be,o=>{let r=[],c=Date.now(),A=0;for(const u of o.keys())c-u<=1e3?A++:r.push(u);return r.forEach(u=>o.delete(u)),Math.min(A,60)}),t(ht,()=>{const o=e(X),r=e(Qt),c=[];o?.traverse(function(A){A.isWarpSplatMesh&&A.splatMesh?.visible&&c.push(A)}),c.sort((A,u)=>r.position.distanceTo(A.position)-r.position.distanceTo(u.position));for(let A=0;A<c.length;A++)c[A].splatMesh.boundBox.visible=A<1;return window.splat=c[0]?.splatMesh,c[0]?.splatMesh}),t(Yo,()=>{const o=e(X),r=e(Qt),c=[];o?.traverse(function(A){A.isWarpSplatMesh&&c.push(A)}),c.sort((A,u)=>r.position.distanceTo(A.position)-r.position.distanceTo(u.position));for(let A=0;A<c.length;A++)c[A].active=A<s,c[A].splatMesh&&(c[A].splatMesh.renderOrder=1e3-A)}),t(Jo,()=>{const o=e(X),r=[];o?.traverse(c=>r.push(c)),r.forEach(c=>{c.dispose?c.dispose():(c.geometry?.dispose?.(),c.material&&c.material instanceof Array?c.material.forEach(A=>A?.dispose?.()):c.material?.dispose?.())}),o?.clear()}),t(Os,(o=.1)=>{const r=e(ht);r&&r.visible&&r.rotateOnAxis(new g.Vector3(1,0,0),g.MathUtils.degToRad(o))}),t(zs,(o=.1)=>{const r=e(ht);r&&r.visible&&r.rotateOnAxis(new g.Vector3(0,1,0),g.MathUtils.degToRad(o))}),t(Ys,(o=.1)=>{const r=e(ht);r&&r.visible&&r.rotateOnAxis(new g.Vector3(0,0,1),g.MathUtils.degToRad(o))}),t(Kr,(o=.01)=>{const r=e(ht);r&&r.visible&&(r.position.x+=o)}),t(zo,(o=.01)=>{const r=e(ht);r&&r.visible&&(r.position.y+=o)}),t(Xr,(o=.01)=>{const r=e(ht);r&&r.visible&&(r.position.z+=o)}),t(Zr,o=>{const r=e(ht);r&&r.visible&&o&&r.position.copy(o),console.info(r,o)}),t(jr,(o=.01)=>{const r=e(ht);r&&r.visible&&r.scale.set(r.scale.x+o,r.scale.y+o,r.scale.z+o)}),t(qr,()=>{const o=e(ht);o&&(o.visible=!o.visible)}),t($r,async o=>{if(!o&&(o=e(ht)),!o)return;const r=o.meta||{};return r.transform=o.matrix.toArray(),await e(se,JSON.stringify(r),o.meta.url)}),t(_o,()=>{const o=e(R).root,r=new g.WebGLRenderer({antialias:!1,stencil:!0,alpha:!0,logarithmicDepthBuffer:!0,premultipliedAlpha:!1,precision:"highp",powerPreference:"high-performance"});return r.setSize(o.clientWidth,o.clientHeight),r.setPixelRatio(1),t(Se,()=>r),t(Qe,()=>r.domElement),r}),t(Go,()=>{const o=e(R),r=new g.Scene,c=o.background||"#dbf0ff";return r.background=new g.Color(c),r.fog=new g.FogExp2(c,0),t(X,()=>r),r}),t(Wo,()=>{const r=e(Qt),c=e(X),A=e(R),u=new Sl(e(Qt),A.root);u.screenSpacePanning=!1,u.minDistance=.1,u.maxDistance=6e4,u.maxPolarAngle=1.2,u.enableDamping=!0,u.dampingFactor=.07,u.zoomToCursor=!0;const l=new g.Vector3().fromArray(A.minPan||[-2e4,.1,-6e4]),C=new g.Vector3().fromArray(A.maxPan||[5e4,1e4,0]),h=new g.Vector3;return u.addEventListener("change",()=>{const m=Math.max(u.getPolarAngle(),.1),I=Math.max(u.getDistance(),.1);u.zoomSpeed=Math.max(Math.log(I),0)+.5,r.far=g.MathUtils.clamp(I/m*8,100,1e5),r.near=r.far/1e3,r.updateProjectionMatrix(),c.fog instanceof g.FogExp2&&(c.fog.density=m/(I+5)*1*.25),u.maxPolarAngle=Math.min(Math.pow(1e4/I,4),1.2),h.copy(u.target),u.target.clamp(l,C),h.sub(u.target),r.position.sub(h)}),t(st,()=>u),t(Oe,()=>r.fov),t(Ut,(m=!1)=>m?r.position.clone():r.position),t(Jt,(m=!1)=>m?u.target.clone():u.target),t(be,(m=!1)=>m?r.up.clone():r.up),u}),t(Oo,()=>{const o=new g.DirectionalLight(16777215,1);return o.position.set(0,2e3,1e3),o}),window.addEventListener("beforeunload",()=>e(En))}function Kl(n){let{root:t="#map",debugMode:e}=n;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 s={...n};return s.root=t,s}function Xl(){const n=new ki.plugin.BingSource,t=new ki.TileMap({imgSource:n,lon0:90,minLevel:2,maxLevel:16});return t.scale.set(10,10,10),t.rotateX(-Math.PI/2),t.autoUpdate=!1,t}class Zl{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 jl(n){const t=(b,Q,y)=>n.on(b,Q,y),e=(b,...Q)=>n.fire(b,...Q),s=e(Qe);let i=new Set,a,o=new Zl;t(Qn,()=>{if(!i.size)return;const b=e(R);if(!b.enableKeyboard)return i.clear();const Q=b.editMode;if(i.has("KeyH")){const y=e(ht);y&&(y.visible=!y.visible),i.clear()}else if(i.has("Equal"))if(Q){const y=e(ht);if(!y||!y.visible)return i.clear();if(i.has("KeyX")){const S=g.MathUtils.degToRad(.1);y.rotateOnAxis(new g.Vector3(1,0,0),S)}else y.scale.set(y.scale.x+.01,y.scale.y+.01,y.scale.z+.01)}else e(tn),i.clear();else if(i.has("Minus"))if(Q){const y=e(ht);if(!y||!y.visible)return i.clear();if(i.has("KeyX")){const S=g.MathUtils.degToRad(-.1);y.rotateOnAxis(new g.Vector3(1,0,0),S)}else y.scale.set(y.scale.x-.01,y.scale.y-.01,y.scale.z-.01)}else e(nn),i.clear();else if(i.has("KeyP"))e(Kt,!0),i.clear();else if(i.has("ArrowUp")){if(Q){const y=e(ht);y&&y.visible&&(y.position.z+=.1)}}else if(i.has("ArrowDown")){if(Q){const y=e(ht);y&&y.visible&&(y.position.z-=.1)}}else if(i.has("ArrowRight")){if(Q){const y=e(ht);y&&y.visible&&(y.position.x+=.1)}}else if(i.has("ArrowLeft")){if(Q){const y=e(ht);y&&y.visible&&(y.position.x-=.1)}}else if(i.has("KeyU")){if(Q){const y=e(ht);if(y){const S=y.meta||{};S.transform=y.matrix.toArray()}}}else i.has("KeyQ")?Q&&e(Os,.1):i.has("KeyW")?Q&&e(zs,.1):i.has("KeyE")?Q&&e(Ys,.1):i.has("KeyA")?Q&&e(Os,-.1):i.has("KeyS")?Q&&e(zs,-.1):i.has("KeyD")?Q&&e(Ys,-.1):i.has("KeyY")?Q?e(zo,i.has("ShiftLeft")||i.has("ShiftRight")?-.1:.1):(e(en,!0),i.clear()):i.has("KeyC")&&console.info("position=",e(Ut).toArray(),"lookat=",e(Jt).toArray())});const r=b=>{b.target.type!=="text"&&(a||b.code==="F5"||(b.preventDefault(),i.add(b.code)))},c=b=>{b.target.type!=="text"&&(a||i.clear())},A=()=>{i.clear()},u=b=>{parent&&setTimeout(()=>window.focus()),b.preventDefault()},l=async b=>{b.preventDefault()};let C,h,m,I;t($e,()=>{C?.dispose(),h?.dispose(),m?.dispose(),I?.dispose(),C=null,h=null,m=null,I=null,o.lastMovePoint=null,e(de)});const d=async b=>{parent&&setTimeout(()=>window.focus()),b.preventDefault(),!a&&(o.down=b.button===2?2:1,o.move=!1,o.isDbClick=Date.now()-o.downTime<300,o.downTime=Date.now())},p=async b=>{b.preventDefault(),!a&&o.down&&(o.move=!0)},f=async b=>{b.preventDefault(),!a&&(o.down=0,o.move=!1)};function D(b){b.preventDefault(),!a&&(o.down=b.touches.length,o.down===1&&(o.move=!1,o.x=b.touches[0].clientX,o.y=b.touches[0].clientY))}function w(b){b.touches.length===1&&(o.move=!0)}function x(b){o.down===1&&!o.move&&e(Ze,o.x,o.y)}window.addEventListener("keydown",r),window.addEventListener("keyup",c),window.addEventListener("blur",A),window.addEventListener("wheel",u,{passive:!1}),s.addEventListener("contextmenu",l),s.addEventListener("mousedown",d),s.addEventListener("mousemove",p),s.addEventListener("mouseup",f),s.addEventListener("touchstart",D,{passive:!1}),s.addEventListener("touchmove",w,{passive:!1}),s.addEventListener("touchend",x,{passive:!1}),t(ds,()=>{a=!0,window.removeEventListener("keydown",r),window.removeEventListener("keyup",c),window.removeEventListener("blur",A),window.removeEventListener("wheel",u),s.removeEventListener("contextmenu",l),s.removeEventListener("mousedown",d),s.removeEventListener("mousemove",p),s.removeEventListener("mouseup",f),s.removeEventListener("touchstart",D),s.removeEventListener("touchmove",w),s.removeEventListener("touchend",x)}),t(Ze,async(b,Q)=>await e(Bn,b,Q))}var Ne=Object.freeze({Linear:Object.freeze({None:function(n){return n},In:function(n){return n},Out:function(n){return n},InOut:function(n){return n}}),Quadratic:Object.freeze({In:function(n){return n*n},Out:function(n){return n*(2-n)},InOut:function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}}),Cubic:Object.freeze({In:function(n){return n*n*n},Out:function(n){return--n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}}),Quartic:Object.freeze({In:function(n){return n*n*n*n},Out:function(n){return 1- --n*n*n*n},InOut:function(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}}),Quintic:Object.freeze({In:function(n){return n*n*n*n*n},Out:function(n){return--n*n*n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}}),Sinusoidal:Object.freeze({In:function(n){return 1-Math.sin((1-n)*Math.PI/2)},Out:function(n){return Math.sin(n*Math.PI/2)},InOut:function(n){return .5*(1-Math.sin(Math.PI*(.5-n)))}}),Exponential:Object.freeze({In:function(n){return n===0?0:Math.pow(1024,n-1)},Out:function(n){return n===1?1:1-Math.pow(2,-10*n)},InOut:function(n){return n===0?0:n===1?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}}),Circular:Object.freeze({In:function(n){return 1-Math.sqrt(1-n*n)},Out:function(n){return Math.sqrt(1- --n*n)},InOut:function(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}}),Elastic:Object.freeze({In:function(n){return n===0?0:n===1?1:-Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI)},Out:function(n){return n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n-.1)*5*Math.PI)+1},InOut:function(n){return n===0?0:n===1?1:(n*=2,n<1?-.5*Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin((n-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(n){var t=1.70158;return n===1?1:n*n*((t+1)*n-t)},Out:function(n){var t=1.70158;return n===0?0:--n*n*((t+1)*n+t)+1},InOut:function(n){var t=2.5949095;return(n*=2)<1?.5*(n*n*((t+1)*n-t)):.5*((n-=2)*n*((t+1)*n+t)+2)}}),Bounce:Object.freeze({In:function(n){return 1-Ne.Bounce.Out(1-n)},Out:function(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return n<.5?Ne.Bounce.In(n*2)*.5:Ne.Bounce.Out(n*2-1)*.5+.5}}),generatePow:function(n){return n===void 0&&(n=4),n=n<Number.EPSILON?Number.EPSILON:n,n=n>1e4?1e4:n,{In:function(t){return Math.pow(t,n)},Out:function(t){return 1-Math.pow(1-t,n)},InOut:function(t){return t<.5?Math.pow(t*2,n)/2:(1-Math.pow(2-t*2,n))/2+.5}}}}),fn=function(){return performance.now()},ql=(function(){function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return n.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},n.prototype.removeAll=function(){this._tweens={}},n.prototype.add=function(){for(var t,e=[],s=0;s<arguments.length;s++)e[s]=arguments[s];for(var i=0,a=e;i<a.length;i++){var o=a[i];(t=o._group)===null||t===void 0||t.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},n.prototype.remove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var s=0,i=t;s<i.length;s++){var a=i[s];a._group=void 0,delete this._tweens[a.getId()],delete this._tweensAddedDuringUpdate[a.getId()]}},n.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},n.prototype.update=function(t,e){t===void 0&&(t=fn()),e===void 0&&(e=!0);var s=Object.keys(this._tweens);if(s.length!==0)for(;s.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<s.length;i++){var a=this._tweens[s[i]],o=!e;a&&a.update(t,o)===!1&&!e&&this.remove(a)}s=Object.keys(this._tweensAddedDuringUpdate)}},n})(),xi={Linear:function(n,t){var e=n.length-1,s=e*t,i=Math.floor(s),a=xi.Utils.Linear;return t<0?a(n[0],n[1],s):t>1?a(n[e],n[e-1],e-s):a(n[i],n[i+1>e?e:i+1],s-i)},Utils:{Linear:function(n,t,e){return(t-n)*e+n}}},Sr=(function(){function n(){}return n.nextId=function(){return n._nextId++},n._nextId=0,n})(),vi=new ql,$l=(function(){function n(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=Ne.Linear.None,this._interpolationFunction=xi.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Sr.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=vi,vi.add(this))}return n.prototype.getId=function(){return this._id},n.prototype.isPlaying=function(){return this._isPlaying},n.prototype.isPaused=function(){return this._isPaused},n.prototype.getDuration=function(){return this._duration},n.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},n.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},n.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},n.prototype.start=function(t,e){if(t===void 0&&(t=fn()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var s in this._valuesStartRepeat)this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s]}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 i={};for(var a in this._valuesEnd)i[a]=this._valuesEnd[a];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},n.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},n.prototype._setupProperties=function(t,e,s,i,a){for(var o in s){var r=t[o],c=Array.isArray(r),A=c?"array":typeof r,u=!c&&Array.isArray(s[o]);if(!(A==="undefined"||A==="function")){if(u){var l=s[o];if(l.length===0)continue;for(var C=[r],h=0,m=l.length;h<m;h+=1){var I=this._handleRelativeValue(r,l[h]);if(isNaN(I)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}C.push(I)}u&&(s[o]=C)}if((A==="object"||c)&&r&&!u){e[o]=c?[]:{};var d=r;for(var p in d)e[o][p]=d[p];i[o]=c?[]:{};var l=s[o];if(!this._isDynamic){var f={};for(var p in l)f[p]=l[p];s[o]=l=f}this._setupProperties(d,e[o],l,i[o],a)}else(typeof e[o]>"u"||a)&&(e[o]=r),c||(e[o]*=1),u?i[o]=s[o].slice().reverse():i[o]=e[o]||0}}},n.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},n.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},n.prototype.pause=function(t){return t===void 0&&(t=fn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},n.prototype.resume=function(t){return t===void 0&&(t=fn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},n.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},n.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)},n.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},n.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},n.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},n.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},n.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},n.prototype.easing=function(t){return t===void 0&&(t=Ne.Linear.None),this._easingFunction=t,this},n.prototype.interpolation=function(t){return t===void 0&&(t=xi.Linear),this._interpolationFunction=t,this},n.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},n.prototype.onStart=function(t){return this._onStartCallback=t,this},n.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},n.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},n.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},n.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},n.prototype.onStop=function(t){return this._onStopCallback=t,this},n.prototype.update=function(t,e){var s=this,i;if(t===void 0&&(t=fn()),e===void 0&&(e=n.autoStartOnUpdate),this._isPaused)return!0;var a;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 o=t-this._startTime,r=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),c=this._duration+this._repeat*r,A=function(){if(s._duration===0||o>c)return 1;var I=Math.trunc(o/r),d=o-I*r,p=Math.min(d/s._duration,1);return p===0&&o===s._duration?1:p},u=A(),l=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,l),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||o>=this._duration)if(this._repeat>0){var C=Math.min(Math.trunc((o-this._duration)/r)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=C);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=r*C,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var h=0,m=this._chainedTweens.length;h<m;h++)this._chainedTweens[h].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},n.prototype._updateProperties=function(t,e,s,i){for(var a in s)if(e[a]!==void 0){var o=e[a]||0,r=s[a],c=Array.isArray(t[a]),A=Array.isArray(r),u=!c&&A;u?t[a]=this._interpolationFunction(r,i):typeof r=="object"&&r?this._updateProperties(t[a],o,r,i):(r=this._handleRelativeValue(o,r),typeof r=="number"&&(t[a]=o+(r-o)*i))}},n.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},n.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],s=this._valuesEnd[t];typeof s=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(s):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},n.autoStartOnUpdate=!1,n})();Sr.nextId;var ee=vi;ee.getAll.bind(ee),ee.removeAll.bind(ee),ee.add.bind(ee),ee.remove.bind(ee),ee.update.bind(ee);const Mr=navigator.userAgent.includes("Mobi");class tu extends g.Mesh{constructor(t,e){super(),this.isWarpSplatMesh=!0,this.lastActiveTime=Date.now(),this.active=!1,this.disposed=!1;const s=this;s.mapViewer=e,s.addScene(t),s.frustumCulled=!1}async addScene(t){const e=this,{renderer:s,scene:i,controls:a,tileMap:o}=e.mapViewer;fetch(t,{mode:"cors",credentials:"omit",cache:"reload"}).then(r=>r.ok?r.json():{}).then(r=>{const c=new g.Matrix4;if(r.transform)c.fromArray(r.transform);else if(r.WGS84){const m=o.geo2world(new g.Vector3().fromArray(r.WGS84));c.makeTranslation(m.x,m.y,m.z),r.transform=c.toArray()}e.metaMatrix=c;const A=!!r.isLargeScene,u=!1,l=!1,C=!!r.showWatermark,h={renderer:s,scene:i,controls:a,pointcloudMode:u,bigSceneMode:A,showWatermark:C,depthTest:l,mapMode:!0};h.maxRenderCountOfMobile??(h.maxRenderCountOfMobile=h.bigSceneMode?128*10240:400*1e4),h.maxRenderCountOfPc??(h.maxRenderCountOfPc=h.bigSceneMode?320*1e4:400*1e4),h.debugMode=e.mapViewer.events.fire(R).debugMode,e.opts=h,e.meta=r,i.add(e),e.initCSS3DSprite(h),e.applyMatrix4(c)}).catch(r=>{console.error(r.message)})}async initCSS3DSprite(t){const e=this,s=t.controls,i=document.createElement("div");i.innerHTML=`<div title="${e.meta.name}" style='flex-direction: column;align-items: center;display: flex;pointer-events: auto;margin-bottom: 20px;'>
809
+ </div>`,A.classList.add("mark-wrap-circle",`${s.name}`,"main-warp"),A.style.position="absolute",A.style.borderRadius="4px",A.style.cursor="pointer",A.onclick=()=>{if(e.events.fire(L).markMode)return;const g=parent?.onActiveMark;g?.(e.getMarkData(!0)),e.events.fire(Ct)},A.oncontextmenu=g=>g.preventDefault();const u=new d.Vector3().fromArray(s.startPoint),l=s.radius*e.events.fire(L).meterScale,C=(Math.PI*l*l).toFixed(2)+" m²",h=new bt(A);h.position.copy(u),h.element.style.pointerEvents="none",h.scale.set(.01,.01,.01),h.visible=s.mainTagVisible;const m=document.createElement("div");m.innerHTML=`<span class="${c}-distance-tag ${c}-circle-tag" style="color:${s.circleTagColor};background:${s.circleTagBackground};opacity:${s.circleTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${C}</span>`,m.classList.add("mark-wrap-circle",`${c}`,"circle-warp"),m.style.position="absolute",m.style.borderRadius="4px",m.style.pointerEvents="none";const I=new bt(m);I.position.set(u.x+Math.min(s.radius/2,.5),u.y,u.z),I.element.style.pointerEvents="none",I.scale.set(.008,.008,.008),I.visible=s.circleTagVisible,e.add(o,h,I),e.data=s,e.circleMesh=o,e.css3dTag=I,e.css3dMainTag=h,e.events.fire(ge,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(oe,t),t.events.fire(j).remove(t),t.events.fire(ke,t),document.querySelectorAll(`.${t.data.name}`).forEach(s=>s.parentElement?.removeChild(s)),t.events=null,t.data=null,t.circleMesh=null,t.css3dTag=null,t.css3dMainTag=null}}let Tl=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 Ll(n){const t=(y,v,M)=>n.on(y,v,M),e=(y,...v)=>n.fire(y,...v),s=e(be);let i=new Set,a,o=new Tl,r;t(_i,()=>{e(it).autoRotate=e(L).autoRotate=!0}),t(Ct,(y=!0)=>{e(it).autoRotate=e(L).autoRotate=!1,y&&e(Fn)}),t(ws,(y=!0)=>{if(a)return;const v=e(it),M=y?Math.PI/128:-(Math.PI/128),S=new d.Matrix4().makeRotationAxis(new d.Vector3(0,0,-1).transformDirection(v.object.matrixWorld),M);v.object.up.transformDirection(S),e(pt)}),t(ao,()=>{a||n.fire(ws,!0)}),t(ro,()=>{a||n.fire(ws,!1)}),t(Dn,y=>{const v=e(L);y??(y=!v.pointcloudMode),v.pointcloudMode=y,e(j).traverse(S=>S instanceof Yt&&S.fire(me,y))}),t(kn,()=>{e(j).traverse(v=>v instanceof Yt&&v.fire(ms))}),t(Ye,y=>{e(j).traverse(M=>M instanceof Yt&&M.fire(Ye,y))}),t(So,()=>{const y=e(j);let v;y.traverse(M=>M instanceof Yt&&(v=M)),v&&e(cs,v.fire(bo))}),t(En,()=>{if(!i.size)return;const y=e(L);if(!y.enableKeyboard)return i.clear();if(y.markMode&&i.has("Escape")){e(qe),i.clear();return}i.has("Space")?(y.bigSceneMode?e(Dn):e(kn),i.clear()):i.has("Escape")?(Zn.fire(Zs),i.clear()):i.has("KeyR")?(y.autoRotate?e(Ct):e(_i),i.clear()):i.has("KeyM")?(e(je,!y.markVisible),i.clear()):i.has("ArrowLeft")?(e(ao),e(Sn,!0),i.clear()):i.has("ArrowRight")?(e(ro),e(Sn,!0),i.clear()):i.has("KeyP")?(e(Kt,!0),i.clear()):i.has("Equal")?(e($e),i.clear()):i.has("Minus")?(e(en),i.clear()):i.has("KeyY")?(e(tn,!1),e(vs),i.clear()):i.has("KeyI")?(e(yo),i.clear()):i.has("KeyF")?(e(So),i.clear()):i.has("F2")?(!y.bigSceneMode&&window.open("/editor/index.html?url="+encodeURIComponent(e(Mt).meta.url)),i.clear()):i.has("KeyW")?(Ul(e(it),.15),i.clear()):i.has("KeyS")?(Pl(e(it),.15),i.clear()):i.has("KeyA")?(Rl(e(it),.15),i.clear()):i.has("KeyD")?(Fl(e(it),.15),i.clear()):i.has("KeyQ")?(Vl(e(it)),i.clear()):i.has("KeyE")?(Nl(e(it)),i.clear()):i.has("KeyC")?(_l(e(it)),i.clear()):i.has("KeyZ")&&(Hl(e(it)),i.clear())}),t(Xe,async(y,v)=>{if(o.move||e(L).disableRightClickFocus)return;const M=await e(Qn,y,v);M.length&&e(cs,M[0],!0,!1)}),t(Pt,async(y,v)=>{const M=e(j),S=[];M.traverse(Y=>Y instanceof Yt&&S.push(Y));const N=await e(Qn,y,v);return N.length?(S.length&&S[0].fire(pn,N[0].x,N[0].y,N[0].z,!0),new d.Vector3(N[0].x,N[0].y,N[0].z)):(S.length&&S[0].fire(pn,0,0,0,!1),null)}),t(Bs,async()=>{const y=e(j),v=[];y.traverse(M=>M instanceof Yt&&v.push(M));for(let M=0;M<v.length;M++)v[M].fire(pn,0,0,0,!1)});const c=y=>{y.target.type!=="text"&&(a||y.code==="F5"||(y.preventDefault(),y.code!=="KeyR"&&(i.add(y.code),e(Ct)),r=Date.now()))},A=y=>{y.target.type!=="text"&&(a||(y.code==="KeyR"&&i.add(y.code),(y.code==="ArrowLeft"||y.code==="ArrowRight")&&e(Ui),r=Date.now()))};t(De,()=>{e(Ss)&&Date.now()-r>2e3&&(e(Sn,!1),e(vs))},!0);const u=()=>{i.clear()},l=y=>{parent&&setTimeout(()=>window.focus()),y.preventDefault(),!a&&(e(Ct),r=Date.now())},C=y=>{y.preventDefault(),!a&&(e(Ct),r=Date.now())};let h,m,I,g;t(qe,()=>{h?.dispose(),m?.dispose(),I?.dispose(),g?.dispose(),h=null,m=null,I=null,g=null,o.lastMovePoint=null,e(fe)});const p=async y=>{parent&&setTimeout(()=>window.focus()),y.preventDefault(),!a&&(e(Ct),o.down=y.button===2?2:1,o.move=!1,o.isDbClick=Date.now()-o.downTime<300,r=Date.now(),o.downTime=Date.now())},f=async y=>{if(y.preventDefault(),a)return;o.down&&(o.move=!0,r=Date.now());const v=e(L);if(v.markMode){const M=await e(Pt,y.clientX,y.clientY);M&&!o.down&&v.markType==="distance"&&h?h.drawUpdate({endPoint:M.toArray()}):!o.down&&v.markType==="circle"&&g?M?(g.drawUpdate(null,!0,M),o.lastMovePoint=M,o.lastMovePointTime=Date.now()):(o.lastMovePoint=null,o.lastMovePointTime=0):!o.down&&v.markType==="lines"&&m?M?(m.drawUpdate(null,!0,M),o.lastMovePoint=M,o.lastMovePointTime=Date.now()):(o.lastMovePoint=null,o.lastMovePointTime=0):!o.down&&v.markType==="plans"&&I&&(M?(I.drawUpdate(null,!0,M),o.lastMovePoint=M,o.lastMovePointTime=Date.now()):(o.lastMovePoint=null,o.lastMovePointTime=0))}},D=async y=>{if(y.preventDefault(),a)return;const v=e(L);if(o.isDbClick&&(m?Math.abs(y.clientX-o.lastClickX)<2&&Math.abs(y.clientY-o.lastClickY)<2&&(m.drawFinish(o.lastClickPointTime>0),m=null,o.lastMovePoint=null):I&&Math.abs(y.clientX-o.lastClickX)<2&&Math.abs(y.clientY-o.lastClickY)<2&&(I.drawFinish(o.lastClickPointTime>0),I=null,o.lastMovePoint=null)),v.markMode&&o.down===1&&!o.move&&Date.now()-o.downTime<500){if(v.markType==="point"){if(await e(Pt,y.clientX,y.clientY)){const S=new pr(n,await e(Pt,y.clientX,y.clientY));e(j).add(S),S.drawFinish()}}else if(v.markType==="distance")if(h){const M=await e(Pt,y.clientX,y.clientY);M?(h.drawFinish(M),h=null):o.isDbClick&&e(qe)}else{const M=await e(Pt,y.clientX,y.clientY);M&&(h=new Bi(n),h.drawStart(M),e(j).add(h))}else if(v.markType==="lines")if(m)if(o.lastMovePoint&&e(Es,y.clientX,y.clientY,o.lastMovePoint)<.03)m.drawUpdate(null,!0,o.lastMovePoint,!0),o.lastClickPointTime=Date.now();else{const M=await e(Pt,y.clientX,y.clientY);M?(m.drawUpdate(null,!0,M,!0),o.lastClickPointTime=Date.now()):o.lastClickPointTime=0}else{const M=await e(Pt,y.clientX,y.clientY);M&&(m=new Qi(n),m.drawStart(M),e(j).add(m))}else if(v.markType==="plans")if(I)if(o.lastMovePoint&&e(Es,y.clientX,y.clientY,o.lastMovePoint)<.03)I.drawUpdate(null,!0,o.lastMovePoint,!0),o.lastClickPointTime=Date.now();else{const M=await e(Pt,y.clientX,y.clientY);M?(I.drawUpdate(null,!0,M,!0),o.lastClickPointTime=Date.now()):o.lastClickPointTime=0}else{const M=await e(Pt,y.clientX,y.clientY);M&&(I=new bi(n),I.drawStart(M),e(j).add(I))}else if(v.markType==="circle")if(g){const M=await e(Pt,y.clientX,y.clientY);M?(g.drawFinish(M),g=null):o.isDbClick&&e(qe)}else{const M=await e(Pt,y.clientX,y.clientY);M&&(g=new Cr(n),g.drawStart(M),e(j).add(g))}o.lastClickX=y.clientX,o.lastClickY=y.clientY}o.down===2&&!o.move&&e(Xe,y.clientX,y.clientY),o.down=0,o.move=!1,r=Date.now()};function w(y){y.preventDefault(),!a&&(e(Ct),o.down=y.touches.length,o.down===1&&(o.move=!1,o.x=y.touches[0].clientX,o.y=y.touches[0].clientY))}function x(y){y.touches.length===1&&(o.move=!0)}function b(y){o.down===1&&!o.move&&e(Xe,o.x,o.y)}window.addEventListener("keydown",c),window.addEventListener("keyup",A),window.addEventListener("blur",u),window.addEventListener("wheel",l,{passive:!1}),s.addEventListener("contextmenu",C),s.addEventListener("mousedown",p),s.addEventListener("mousemove",f),s.addEventListener("mouseup",D),s.addEventListener("touchstart",w,{passive:!1}),s.addEventListener("touchmove",x,{passive:!1}),s.addEventListener("touchend",b,{passive:!1}),window.addEventListener("resize",B),B();function B(){const{width:y,height:v,top:M,left:S}=e(Ie),N=e(Bt);N.aspect=y/v,N.updateProjectionMatrix();const Y=e(xs);Y.setSize(y,v),Y.domElement.style.position="absolute",Y.domElement.style.left=`${S}px`,Y.domElement.style.top=`${M}px`;const z=e(Me);z.setPixelRatio(Math.min(devicePixelRatio,e(L).qualityLevel>vt.Default5?2:1)),z.setSize(y,v)}t(us,()=>{a=!0,window.removeEventListener("keydown",c),window.removeEventListener("keyup",A),window.removeEventListener("blur",u),window.removeEventListener("wheel",l),s.removeEventListener("contextmenu",C),s.removeEventListener("mousedown",p),s.removeEventListener("mousemove",f),s.removeEventListener("mouseup",D),s.removeEventListener("touchstart",w),s.removeEventListener("touchmove",x),s.removeEventListener("touchend",b),window.removeEventListener("resize",B)})}function es(n,t,e=.012){const s=n.object.up.clone().normalize(),a=new d.Vector3().copy(t).projectOnPlane(s).normalize().multiplyScalar(e);n.object.position.add(a),n.target.add(a),n.update()}function Rl(n,t=.2){const e=new d.Vector3;n.object.getWorldDirection(e);const s=new d.Vector3().crossVectors(n.object.up,e).normalize();es(n,s,t)}function Fl(n,t=.2){const e=new d.Vector3;n.object.getWorldDirection(e);const s=new d.Vector3().crossVectors(n.object.up,e).normalize().negate();es(n,s,t)}function Ul(n,t=.2){const e=new d.Vector3;n.object.getWorldDirection(e),es(n,e,t)}function Pl(n,t=.2){const e=new d.Vector3;n.object.getWorldDirection(e).negate(),es(n,e,t)}function mr(n,t=.006){const e=n.object.position.clone(),s=n.target.clone(),i=new d.Vector3().subVectors(s,e),a=n.object.up.clone().normalize(),o=new d.Quaternion;o.setFromAxisAngle(a,-t),i.applyQuaternion(o);const r=new d.Vector3().addVectors(e,i);n.target.copy(r),n.update()}function Vl(n){mr(n,-.01)}function Nl(n){mr(n,.01)}function Ir(n,t=.006){const e=n.object.position.clone(),s=n.target.clone(),i=new d.Vector3().subVectors(s,e),a=new d.Vector3;n.object.getWorldDirection(a);const o=new d.Vector3().crossVectors(n.object.up,a).normalize(),r=new d.Quaternion;r.setFromAxisAngle(o,t),i.applyQuaternion(r);const c=new d.Vector3().addVectors(e,i);n.target.copy(c),n.update()}function _l(n,t=.01){Ir(n,-t)}function Hl(n,t=.01){Ir(n,t)}function yr(n){const t=new d.Raycaster,e=5,s=(a,o,r)=>n.on(a,o,r),i=(a,...o)=>n.fire(a,...o);s(Qn,async(a,o)=>{const{width:r,height:c,left:A,top:u}=i(Ie),l=new d.Vector2;l.x=(a-A)/r*2-1,l.y=(u-o)/c*2+1;const C=(l.x+1)/2*r,h=(1-l.y)/2*c,m=i(Bt);t.setFromCamera(l,m);const I=[],g=i(j),p=[],f=[];g.traverse(function(B){B instanceof Yt?f.push(B):B.isMesh&&!B.ignoreIntersect&&!B.isMark&&p.push(B)});const D=t.intersectObjects(p,!0);for(let B=0;B<D.length;B++)I.push({point:D[B].point,d:t.ray.distanceToPoint(D[B].point),p:1});const w=i(Mo),x=m.projectionMatrix.clone().multiply(m.matrixWorldInverse);for(let B=0;B<f.length;B++){const y=f[B].fire(Bn);if(y)if(y.length!==void 0){const v=y,M=v.length/3;for(let S=0;S<M;S++){const N=new d.Vector3(v[3*S+0],v[3*S+1],v[3*S+2]);w&&N.applyMatrix4(w);const Y=new d.Vector4(N.x,N.y,N.z,1).applyMatrix4(x),z=(Y.x/Y.w+1)/2*r,W=(1-Y.y/Y.w)/2*c,O=Math.sqrt((z-C)**2+(W-h)**2);O<=e&&I.push({point:N,d:m.position.distanceTo(N),p:O})}}else for(let v of Object.keys(y)){const M=v.split(","),S=new d.Vector3(Number(M[0]),Number(M[1]),Number(M[2]));if(t.ray.distanceToPoint(S)<=1.4143){const N=y[v];for(let Y=0,z=N.length/3;Y<z;Y++){const W=new d.Vector3(N[3*Y+0],N[3*Y+1],N[3*Y+2]);w&&W.applyMatrix4(w);const O=new d.Vector4(W.x,W.y,W.z,1).applyMatrix4(x),k=(O.x/O.w+1)/2*r,Q=(1-O.y/O.w)/2*c,T=Math.sqrt((k-C)**2+(Q-h)**2);T<=e&&I.push({point:W,d:m.position.distanceTo(W),p:T})}}}}if(!I.length)return[];I.sort((B,y)=>B.d-y.d);const b=[];for(let B=0,y=I[0].d,v=Math.min(I.length,20);B<v;B++)I[B].d-y<.01&&b.push(I[B]);return b.sort((B,y)=>B.p-y.p),[b[0].point]}),s(Es,(a,o,r)=>{const{width:c,height:A,left:u,top:l}=i(Ie),C=new d.Vector2;C.x=(a-u)/c*2-1,C.y=(l-o)/A*2+1;const h=i(Bt);return t.setFromCamera(C,h),t.ray.distanceToPoint(r)})}function Gl(n){const t=(l,C,h)=>n.on(l,C,h),e=(l,...C)=>n.fire(l,...C),s=e(it);t(We,()=>e(Bt).fov),t(Ut,(l=!1)=>l?s.object.position.clone():s.object.position),t(Jt,(l=!1)=>l?s.target.clone():s.target),t(Se,(l=!1)=>l?e(Bt).up.clone():e(Bt).up);let i=!1;t(Wr,()=>{if(i)return;i=!0;const l=new d.Vector3().subVectors(s.target,s.object.position).normalize().multiplyScalar(.01);s.target.copy(s.object.position.clone().add(l)),s.panSpeed=s.target.distanceTo(s.object.position)>s.minDistance?1:50,s.update()});let a;const o=[];t(cs,(l,C=!1,h)=>{if(i=!1,s.panSpeed=s.target.distanceTo(s.object.position)>s.minDistance?1:50,e(Ao,l),!C){s.target.copy(l);const D=new d.Vector3().subVectors(l,s.object.position);D.length()<1&&s.object.position.copy(l).sub(D.setLength(1)),D.length()>50&&s.object.position.copy(l).sub(D.setLength(50)),e(xn),e(bs);return}for(;o.length;)o.pop().stop=!0;let m={alpha:0,time:Date.now(),stop:!1};o.push(m),a=a||{enablePan:s.enablePan,enableRotate:s.enableRotate},s.enablePan=!1,s.enableRotate=!1;const I=e(Jt,!0),g=e(Ut,!0),p=I.clone().sub(g).normalize(),f=l.clone().sub(p.multiplyScalar(l.clone().sub(g).dot(p)));e(pe,()=>{m.alpha=(Date.now()-m.time)/600,e(it).target.copy(I.clone().lerp(l,m.alpha)),!h&&e(it).object.position.copy(g.clone().lerp(f,m.alpha)),e(xn),m.alpha>=.9&&(s.enablePan=a.enablePan,s.enableRotate=a.enableRotate),m.alpha>=1&&(m.stop=!0,e(bs))},()=>!m.stop)}),t(Ri,()=>{let l=e(Ut).toArray(),C=e(Se).toArray(),h=e(Jt).toArray();return{position:l,lookUp:C,lookAt:h}}),t(Fi,()=>e(it).update()),t(Ui,()=>e(it).updateRotateAxis());const r=.01;let c=new d.Vector3,A=new d.Vector3,u=0;t(ps,()=>{const l=e(it).object,C=l.fov,h=l.position.clone(),m=l.getWorldDirection(new d.Vector3);return Math.abs(u-C)<r&&Math.abs(h.x-c.x)<r&&Math.abs(h.y-c.y)<r&&Math.abs(h.z-c.z)<r&&Math.abs(m.x-A.x)<r&&Math.abs(m.y-A.y)<r&&Math.abs(m.z-A.z)<r?!1:(u=C,c=h,A=m,!0)})}function Wl(n){const t=(o,r,c)=>n.on(o,r,c),e=(o,...r)=>n.fire(o,...r);let s=a();const i=[];t(Qs,()=>{const{height:o}=e(Ie),r=e(Ut).distanceTo(s.position)*3.2/o;s.scale.set(r,r,r)}),t(bn,o=>{e(Qs),s.visible=o>.1,s.element.style.opacity=o+"",e(pt)}),t(Ao,o=>{for(s.position.copy(o);i.length;)i.pop().stop=!0;e(bn,1),e(pt)}),t(bs,()=>{for(;i.length;)i.pop().stop=!0;let o={opacity:1,time:Date.now(),stop:!1};i.push(o),e(pe,()=>{o=i[0],!o&&e(bn,1),o&&(o.opacity=1-Math.min((Date.now()-o.time)/1500,1),o.opacity<.2&&(o.opacity=0,o.stop=!0),e(bn,o.opacity))},()=>!o?.stop)});function a(){const o=document.createElement("div");o.innerHTML='<svg height="16" width="16" style="fill:white;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M108.8 469.333333C128 279.466667 279.466667 128 469.333333 108.8V64c0-23.466667 19.2-42.666667 42.666667-42.666667s42.666667 19.2 42.666667 42.666667v44.8c189.866667 19.2 341.333333 170.666667 360.533333 360.533333H960c23.466667 0 42.666667 19.2 42.666667 42.666667s-19.2 42.666667-42.666667 42.666667h-44.8c-19.2 189.866667-170.666667 341.333333-360.533333 360.533333V960c0 23.466667-19.2 42.666667-42.666667 42.666667s-42.666667-19.2-42.666667-42.666667v-44.8C279.466667 896 128 744.533333 108.8 554.666667H64c-23.466667 0-42.666667-19.2-42.666667-42.666667s19.2-42.666667 42.666667-42.666667h44.8zM469.333333 194.133333C326.4 213.333333 215.466667 326.4 196.266667 469.333333H234.666667c23.466667 0 42.666667 19.2 42.666666 42.666667s-19.2 42.666667-42.666666 42.666667H196.266667c19.2 142.933333 132.266667 256 275.2 273.066666V789.333333c0-23.466667 19.2-42.666667 42.666666-42.666666s42.666667 19.2 42.666667 42.666666v38.4C697.6 810.666667 810.666667 697.6 829.866667 554.666667H789.333333c-23.466667 0-42.666667-19.2-42.666666-42.666667s19.2-42.666667 42.666666-42.666667h40.533334C810.666667 326.4 697.6 213.333333 554.666667 194.133333V234.666667c0 23.466667-19.2 42.666667-42.666667 42.666666s-42.666667-19.2-42.666667-42.666666V194.133333z"></path></svg>',o.classList.add("css3d-focus-marker"),o.style.position="absolute";const r=new bt(o);return r.element.style.pointerEvents="none",r.element.style.opacity="1",r.visible=!1,e(j).add(r),r.onBeforeRender=()=>e(Qs),r}}function wr(n){const t=(o,r,c)=>n.on(o,r,c),e=(o,...r)=>n.fire(o,...r),s=new Map,i=document.createElement("div");i.classList.add("mark-warp"),document.body.appendChild(i);const a=new kl;a.setSize(innerWidth,innerHeight),a.domElement.style.position="absolute",a.domElement.style.top="0px",a.domElement.style.pointerEvents="none",i.appendChild(a.domElement),t(Rr,()=>i),t(xs,()=>a),t(Ms,()=>document.body.removeChild(i)),t(De,()=>a.render(e(j),e(Bt)),!0),t(ge,o=>{const r=o?.getMarkData?.()?.name||o?.name;r&&s.set(r,new WeakRef(o))}),t(ke,o=>{const r=o?.getMarkData?.()?.name||o?.name;s.delete(r)}),t(Ze,o=>s.get(o)?.deref()),t(Fr,(o,r)=>{const c=e(Ze,o);!c||!r||c.drawUpdate?.(r)}),t(Ur,o=>{const r=e(Ze,o);return r?r.getMarkData?.():{}}),t(je,o=>{o!==void 0&&(e(L).markVisible=o),e(j).traverse(r=>r.isMark&&(r.visible=e(L).markVisible)),e(pt)}),t(vs,async()=>{const o=[];e(j).traverse(c=>{if(c.isMark){const A=c.getMarkData?.();A&&o.push(A)}});const r=e(Mt).meta||{};return o.length?r.marks=o:delete r.marks,r.cameraInfo=e(Ri),await e(ie,r)}),t(Tn,async()=>{const o=[];e(j).traverse(c=>{if(c.isMark){const A=c.getMarkData?.();A&&o.push(A)}});const r=e(Mt).meta||{};return o.length?r.marks=o:delete r.marks,await e(ie,r)}),t(fo,async()=>{const o=e(Mt).meta||{};delete o.marks;const r=await e(ie,o),c=[];return s.forEach(A=>c.push(A)),c.forEach(A=>A.deref()?.dispose?.()),e(pt),r}),t(ho,async()=>{e(j).traverse(r=>{r.isMark&&r.getMarkData?.()});const o=e(Mt).meta||{};return o.watermark=e(lo)||"",await e(ie,o)}),t(Ds,o=>{o.meterScale&&(e(L).meterScale=o.meterScale,e(ut,{scale:`1 : ${e(L).meterScale} m`})),e(it).updateByOptions({...o,...o.cameraInfo||{}}),(o.marks||[]).forEach(c=>{if(c.type==="MarkSinglePoint"){const A=new pr(n,c);A.visible=!1,e(j).add(A)}else if(c.type==="MarkDistanceLine"){const A=new Bi(n);A.draw(c),A.visible=!1,e(j).add(A)}else if(c.type==="MarkMultiLines"){const A=new Qi(n);A.draw(c,!0),A.visible=!1,e(j).add(A)}else if(c.type==="MarkMultiPlans"){const A=new bi(n);A.draw(c,!0),A.visible=!1,e(j).add(A)}else if(c.type==="MarkCirclePlan"){const A=new Cr(n);A.draw(c),A.visible=!1,e(j).add(A)}}),e(Ln,o.flyPositions||[]),e(Rn,o.flyTargets||[])}),t(fe,()=>{const o=e(L);o.markMode=!1,e(Bs),e(pt)}),t(go,(o,r=!0)=>{const c=o?.meterScale;if(c){if(typeof c!="number"||c<=0){console.warn("meterScale is not a number or <= 0",o);return}r&&(e(L).meterScale=o.meterScale),e(ut,{scale:`1 : ${c} m`});for(const A of s.values()){const u=A.deref();u&&(u instanceof Bi||u instanceof Qi||u instanceof bi)&&u.updateByMeterScale(c)}}}),t(as,o=>{const r=new d.Vector3().fromArray(o.slice(0,3)),c=new d.Vector3().fromArray(o.slice(-6,-3)),A=new d.Vector3().fromArray(o.slice(-3)),u=r.distanceTo(A)<1e-4,l=c.distanceTo(A)<1e-4,C=new d.Vector3,h=u||l?o.length/3-1:o.length/3;for(let m=0;m<h;m++)C.add(new d.Vector3(o[m*3],o[m*3+1],o[m*3+2]));return C.divideScalar(h),C}),t(rs,o=>{const r=[];for(let l=0,C=o.length/3;l<C;l++)r.push(new d.Vector3(o[l*3],o[l*3+1],o[l*3+2]));const c=r[0].distanceTo(r[r.length-1])<1e-4,A=r[r.length-2].distanceTo(r[r.length-1])<1e-4;if((c||A)&&r.pop(),r.length<3)return 0;let u=0;for(let l=0,C=r.length-2;l<C;l++)u+=e(As,r[0],r[l+1],r[l+2],e(L).meterScale);return u}),t(Ti,(o,r)=>{let c=0;for(let A=0,u=o.length-2;A<u;A++)c+=e(As,o[0],o[A+1],o[A+2],r);return c}),t(As,(o,r,c,A)=>{const u=o.distanceTo(r)*A,l=r.distanceTo(c)*A,C=c.distanceTo(o)*A,h=(u+l+C)/2;return Math.sqrt(h*(h-u)*(h-l)*(h-C))})}function Er(n){const t=(p,...f)=>n.fire(p,...f),e=(p,f,D)=>n.on(p,f,D),s=[],i=[];let a=!1,o=!1,r=125*1e3;e(Fn,()=>a=!1),e(Io,()=>a=!0),e(Co,()=>s),e(Pr,()=>{const p=[];for(let f=0,D=s.length;f<D;f++)p.push(...s[f].toArray());return p}),e(Vr,()=>{const p=[];for(let f=0,D=i.length;f<D;f++)p.push(...i[f].toArray());return p}),e(Ln,p=>{for(let f=0,D=p.length/3|0;f<D;f++)s[f]=new d.Vector3(p[f*3+0],p[f*3+1],p[f*3+2])}),e(Rn,p=>{for(let f=0,D=p.length/3|0;f<D;f++)i[f]=new d.Vector3(p[f*3+0],p[f*3+1],p[f*3+2])}),e(Os,(p=125*1e3)=>{r=p}),e($e,()=>{const p=t(it);s.push(p.object.position.clone()),i.push(p.target.clone())}),e(en,()=>{s.length=0,i.length=0}),e(tn,async(p=!0)=>{const f=t(Mt)?.meta||t(Ls);if(f.scenes){const w=f;if(s.length){const b=[],B=[];for(let y=0,v=s.length;y<v;y++)b.push(...s[y].toArray()),B.push(...i[y].toArray());w.flyPositions=b,w.flyTargets=B}else delete w.flyPositions,delete w.flyTargets;const x=t(it);w.position=x.object.position.toArray(),w.lookAt=x.target.toArray(),p&&await t(ie,w)}else{const w=f;if(s.length){const x=[],b=[];for(let B=0,y=s.length;B<y;B++)x.push(...s[B].toArray()),b.push(...i[B].toArray());w.flyPositions=x,w.flyTargets=b}else delete w.flyPositions,delete w.flyTargets;p&&await t(ie,w)}const D=(f.scenes,f);if(s.length){const w=[],x=[];for(let b=0,B=s.length;b<B;b++)w.push(...s[b].toArray()),x.push(...i[b].toArray());D.flyPositions=w,D.flyTargets=x}else delete D.flyPositions,delete D.flyTargets;p&&await t(ie,D)}),e(mo,()=>{o||(o=!0)&&t(Kt,!0)});let c=0,A=r,u=0,l=0,C=0,h=0,m=1,I,g;e(Kt,p=>{if(c=0,A=r,u=Date.now(),l=0,C=u,h=0,m=1,I=null,g=null,!s.length||!p&&!t(it).autoRotate)return;const f=t(it),D=[f.object.position.clone()],w=[f.target.clone()],x=t(Co)||[];for(let b=0,B=Math.min(x.length,1e3);b<B;b++)x[b]&&D.push(x[b]),i[b]&&w.push(i[b]);I=new d.CatmullRomCurve3(D),I.closed=!1,g=new d.CatmullRomCurve3(w),g.closed=!1,t(Io),t(Ct,!1)}),e(Gr,()=>{l=l||Date.now()}),e(jr,(p,f)=>{f&&(h=f*r),l&&(C=Date.now(),l=0),a||t(Kt,!0),m=p}),e(Mn,()=>{const p=t(it);if(l||(h+=m*(Date.now()-C),C=Date.now(),(h<0||h>A)&&t(Fn),!a||!I||!g))return;c=h/A;const f=I.getPoint(c),D=g.getPoint(c);p.object.position.set(f.x,f.y,f.z),p.target.set(D.x,D.y,D.z)},!0)}class Yl{constructor(t={}){this.disposed=!1,this.needUpdate=!0,console.info("Reall3dViewer",_n),this.init(sr(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 s=nl(t),i=t.scene=t.scene||new d.Scene;i.background=new d.Color(t.background),sl(t);const a=t.controls=new Bl(t);a.updateByOptions(t);const o=a.object,r=new Nn;t.viewerEvents=r,e.events=r;const c=(h,m,I)=>r.on(h,m,I),A=(h,...m)=>r.fire(h,...m);c(Mo,()=>e.metaMatrix),c(L,()=>t),c(be,()=>s.domElement),c(Me,()=>s),c(j,()=>i),c(it,()=>a),c(Bt,()=>o),c(Qt,()=>t.bigSceneMode),c(Lr,h=>t.pointcloudMode=h);const u=[];c(pt,()=>{for(e.needUpdate=!0;u.length;)u.pop().stop=!0;let h={count:0,stop:!1};u.push(h),A(Di,()=>{!e.disposed&&(e.needUpdate=!0),h.count++>=600&&(h.stop=!0)},()=>!e.disposed&&(A(Ss)||!h.stop),10)}),ii(r),tl(r),pi(r),Gl(r),wr(r),Ll(r),yr(r),Wl(r),Er(r),e.splatMesh=new Yt(il(t)),c(Mt,()=>e.splatMesh),i.add(e.splatMesh),cl(r),c(Ns,h=>{t.qualityLevel=h,e.splatMesh.options({qualityLevel:h,renderer:void 0,scene:void 0})}),c(Xs,h=>{t.sortType=h,e.splatMesh.options({sortType:h,renderer:void 0,scene:void 0})}),i.add(new d.AmbientLight("#ffffff",2)),s.setAnimationLoop(e.update.bind(e)),c(uo,()=>{a.update(),!e.needUpdate&&A(ps)&&A(pt)}),c(ve,()=>A(En),!0),c(ve,()=>A(uo),!0);let l=performance.now();c(De,()=>{try{const h=performance.now();if(!e.needUpdate||h-l<(dt?25:t.qualityLevel>5?1:18))return;e.needUpdate=!1,l=h,s.render(i,o),A(Tt)&&A(In)}catch(h){console.warn(h.message)}},!0),c(wn,()=>e.dispose()),c(yo,()=>console.info(JSON.stringify(A(Mt).meta||{},null,2)));let C="";c(vn,(h="")=>{C=h,e.splatMesh.fire(ks,C,!0)}),c(lo,()=>C),A(ut,{scale:`1 : ${A(L).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(),Zn.fire(Zs);let s=e.dataTransfer.files[0];if(!s)return;let i,a=!1;if(s.name.endsWith(".spx"))i="spx";else if(s.name.endsWith(".splat"))i="splat";else if(s.name.endsWith(".ply"))i="ply";else if(s.name.endsWith(".spz"))i="spz";else if(s.name.endsWith(".sog"))i="sog";else if(s.name.endsWith(".obj"))i="obj";else if(s.name.endsWith(".scene.json"))a=!0;else return console.error("unsupported format:",s.name);const o=URL.createObjectURL(s),r=t.events.fire(L);r.bigSceneMode=!1,r.pointcloudMode=!0,r.debugMode=!0,r.autoRotate=i!=="obj",r.maxRenderCountOfPc=10240*1e4,r.qualityLevel=9,r.disableTransitionEffectOnLoad=!1,r.maxDistance=1e4,r.disableRightClickFocus=!1,t.reset(r),a?await t.addScene(o):await t.addModel({url:o,format:i}),URL.revokeObjectURL(o)})}update(){const t=this;if(t.disposed)return;const e=(s,...i)=>t.events.fire(s,...i);e(ve),e(De),e(Mn)}fire(t,e,s){const i=this;if(t===1&&i.splatMesh.fire(ds,e),t===2&&i.events.fire($e),t===3&&i.events.fire(Kt,!0),t===4&&i.events.fire(en),t===5&&i.events.fire(tn),t===6&&i.events.fire(Tn),t===7&&i.events.fire(fo),t===8&&(async()=>{let a=await i.splatMesh.fire(Ts);e&&(a=i.splatMesh.fire(Qo)+e),i.splatMesh.fire(Je,a)})(),t===9)if(!e)i.events.fire(Ns,vt.Default5);else{const a=i.events.fire(L).qualityLevel;i.events.fire(Ns,Math.max(vt.L1,Math.min(a+e,vt.L9)))}if(t===10)if(!e)i.events.fire(Xs,Fe.Default1);else{const a=[1,2010,2011,2012,2112],o=i.events.fire(L).sortType;let r=a.indexOf(o)+e;r=Math.max(0,Math.min(r,a.length-1)),i.events.fire(Xs,a[r])}}options(t){const e=this;if(e.disposed)return{};const s=(r,...c)=>e.events.fire(r,...c);let i;if(s(j).traverse(r=>!i&&r instanceof Yt&&(i=r.options())),t){const r=s(L);t.autoRotate!==void 0&&(r.autoRotate=t.autoRotate,s(it).autoRotate=t.autoRotate),t.pointcloudMode!==void 0&&s(Dn,t.pointcloudMode),t.lightFactor!==void 0&&s(Ye,t.lightFactor),t.maxRenderCountOfMobile&&(r.maxRenderCountOfMobile=t.maxRenderCountOfMobile),t.maxRenderCountOfPc&&(r.maxRenderCountOfPc=t.maxRenderCountOfPc),t.debugMode!==void 0&&(r.debugMode=t.debugMode),t.qualityLevel!==void 0&&(r.qualityLevel=t.qualityLevel)&&this.splatMesh.options({qualityLevel:t.qualityLevel}),t.sortType!==void 0&&(r.sortType=t.sortType)&&this.splatMesh.options({sortType:t.sortType}),t.markType!==void 0&&(r.markType=t.markType),t.markVisible!==void 0&&s(je,t.markVisible),t.meterScale!==void 0&&(r.meterScale=t.meterScale),t.markMode!==void 0&&(r.markMode=t.markMode,!t.markMode&&s(Bs),s(it).autoRotate=s(L).autoRotate=!1),t.disableRightClickFocus!==void 0&&(r.disableRightClickFocus=t.disableRightClickFocus)}return s(it).updateByOptions(t),s(ut,{scale:`1 : ${s(L).meterScale} m`}),Object.assign({...s(L)},i)}reset(t={}){const e=this;e.dispose(),e.disposed=!1,e.init(sr(t))}switchDeiplayMode(){const t=this;t.disposed||t.events.fire(kn)}async addScene(t){const e=this;if(e.disposed)return;const s=(r,...c)=>e.events.fire(r,...c);let i={};try{const r=await fetch(t,{mode:"cors",credentials:"omit",cache:"reload"});if(r.status===200)i=await r.json();else return console.error("scene file fetch failed, status:",r.status)}catch(r){return console.error("scene file fetch failed",r.message)}if(!i.url)return console.error("missing model file url");if(!i.url.endsWith(".spx")&&!i.url.endsWith(".json"))return console.error("The format is unsupported in the large scene mode",i.url);const o={root:s(L).root,...i,...i.cameraInfo||{}};o.bigSceneMode=i.url.endsWith(".json")||!!i.isLargeScene,o.enableEnvironment=i.enableEnvironment===void 0?s(L).enableEnvironment:!!i.enableEnvironment,o.enableEnvironment&&!i.qualityLevel&&(o.qualityLevel=vt.L9),e.reset({...o}),e.metaMatrix=i.transform?new d.Matrix4().fromArray(i.transform):null,e.splatMesh.meta=i,dt&&(i.cameraInfo?.position||i.cameraInfo?.lookAt)&&e.events.fire(it)._dollyOut(.75),o.bigSceneMode?(s(Ln,i.flyPositions||[]),s(Rn,i.flyTargets||[]),s(Os,i.flyDuration)):s(Ds,i),e.splatMesh.addModel({url:i.url,baseUrl:Pe(t,location.href)},i),await s(vn,i.watermark||i.name),s(it).updateRotateAxis()}async addModel(t){const e=this;if(e.disposed)return;const s=(A,u,l)=>this.events.on(A,u,l),i=(A,...u)=>e.events.fire(A,...u);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 r=i(L);r.bigSceneMode=!1;let c={};if(!o.url.startsWith("blob:"))try{a=a||o.url.substring(0,o.url.lastIndexOf("."))+".meta.json";const A=await fetch(a,{mode:"cors",credentials:"omit",cache:"reload"});A.status===200?c=await A.json():console.warn("meta file fetch failed, status:",A.status)}catch(A){console.warn("meta file fetch failed",A.message,o.url)}if(c.showWatermark=!!c.showWatermark,c.url=c.url||o.url,delete c.isLargeScene,!o.format)if(o.url=o.url||c.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 if(o.url.endsWith(".sog")||o.url.endsWith("/meta.json")||o.url=="meta.json")o.format="sog";else if(o.url.endsWith(".obj"))o.format="obj";else{console.error("unknow format!",o.url);return}c.qualityLevel=c.qualityLevel||r.qualityLevel||vt.Default5,c.sortType=c.sortType||r.sortType||Fe.Default1,s(Ls,()=>c),e.metaMatrix=c.transform?new d.Matrix4().fromArray(c.transform):null,i(Ds,c),this.options({qualityLevel:c.qualityLevel,sortType:c.sortType}),o.format==="obj"?(this.options({autoRotate:!1}),await i(xo,o.url)):(this.splatMesh.addModel(o,c),await i(vn,c.watermark||c.name)),dt&&i(it)._dollyOut?.(.75)}initGsApi(){const t=(u,...l)=>this.events.fire(u,...l),e=()=>{setTimeout(()=>window.focus()),t(Fn),t(it).autoRotate=t(L).autoRotate=!t(L).autoRotate},s=(u=!0)=>{setTimeout(()=>window.focus()),u=!!u;const l=t(L);l.pointcloudMode!==u&&(l.bigSceneMode?t(Dn,u):t(kn))},i=(u=!0)=>{setTimeout(()=>window.focus()),t(je,!!u)},a=u=>{setTimeout(()=>window.focus());const l=t(L);if(l.markMode)return!1;if(u===1)l.markType="point";else if(u===2)l.markType="lines";else if(u===3)l.markType="plans";else if(u===4)l.markType="distance";else return!1;return l.markMode=!0,t(Ct),!0},o=async u=>(setTimeout(()=>window.focus()),u?(t(Ze,u)?.dispose(),t(pt),await t(Tn)):!1),r=async(u,l=!0)=>(t(go,u,l),t(Ze,u?.name)?.drawUpdate?.(u,l),t(pt),l?(setTimeout(()=>window.focus()),await t(Tn)):!0),c=(u=!0)=>{setTimeout(()=>window.focus()),t(ds,!!u)},A=(u,l=!0)=>{t(vn,u),l&&t(ho,u)};window.$api={switchAutoRotate:e,changePointCloudMode:s,showMark:i,startMark:a,deleteMark:o,updateMark:r,showWaterMark:c,setWaterMark:A}}dispose(){const t=this;if(t.disposed)return;t.disposed=!0;const e=(a,...o)=>t.events.fire(a,...o),s=e(Me),i=s.domElement;e(hs),e(qi),e(Ms),e(us),e(it).dispose(),e(oe,e(j)),s.clear(),s.dispose(),i.parentElement.removeChild(i),t.splatMesh=null,t.events.clear(),t.events=null}}function zl(n){const t=(o,r,c)=>n.on(o,r,c),e=(o,...r)=>n.fire(o,...r),s=dt?2:20,i=new Map,a=new Map;t(Cn,()=>e(Tt)&&i.set(Date.now(),1)),t(mn,()=>e(Tt)&&e(xe,i)),t(In,()=>e(Tt)&&a.set(Date.now(),1)),t(yn,()=>e(Tt)&&e(xe,a)),t(xe,o=>{let r=[],c=Date.now(),A=0;for(const u of o.keys())c-u<=1e3?A++:r.push(u);return r.forEach(u=>o.delete(u)),Math.min(A,60)}),t(ft,()=>{const o=e(j),r=e(Bt),c=[];o?.traverse(function(A){A.isWarpSplatMesh&&A.splatMesh?.visible&&c.push(A)}),c.sort((A,u)=>r.position.distanceTo(A.position)-r.position.distanceTo(u.position));for(let A=0;A<c.length;A++)c[A].splatMesh.boundBox.visible=A<1;return window.splat=c[0]?.splatMesh,c[0]?.splatMesh}),t(Yo,()=>{const o=e(j),r=e(Bt),c=[];o?.traverse(function(A){A.isWarpSplatMesh&&c.push(A)}),c.sort((A,u)=>r.position.distanceTo(A.position)-r.position.distanceTo(u.position));for(let A=0;A<c.length;A++)c[A].active=A<s,c[A].splatMesh&&(c[A].splatMesh.renderOrder=1e3-A)}),t(zo,()=>{const o=e(j),r=[];o?.traverse(c=>r.push(c)),r.forEach(c=>{c.dispose?c.dispose():(c.geometry?.dispose?.(),c.material&&c.material instanceof Array?c.material.forEach(A=>A?.dispose?.()):c.material?.dispose?.())}),o?.clear()}),t(Ws,(o=.1)=>{const r=e(ft);r&&r.visible&&r.rotateOnAxis(new d.Vector3(1,0,0),d.MathUtils.degToRad(o))}),t(Ys,(o=.1)=>{const r=e(ft);r&&r.visible&&r.rotateOnAxis(new d.Vector3(0,1,0),d.MathUtils.degToRad(o))}),t(zs,(o=.1)=>{const r=e(ft);r&&r.visible&&r.rotateOnAxis(new d.Vector3(0,0,1),d.MathUtils.degToRad(o))}),t(zr,(o=.01)=>{const r=e(ft);r&&r.visible&&(r.position.x+=o)}),t(Wo,(o=.01)=>{const r=e(ft);r&&r.visible&&(r.position.y+=o)}),t(Or,(o=.01)=>{const r=e(ft);r&&r.visible&&(r.position.z+=o)}),t(Jr,o=>{const r=e(ft);r&&r.visible&&o&&r.position.copy(o),console.info(r,o)}),t(Kr,(o=.01)=>{const r=e(ft);r&&r.visible&&r.scale.set(r.scale.x+o,r.scale.y+o,r.scale.z+o)}),t(Xr,()=>{const o=e(ft);o&&(o.visible=!o.visible)}),t(Zr,async o=>{if(!o&&(o=e(ft)),!o)return;const r=o.meta||{};return r.transform=o.matrix.toArray(),await e(ie,JSON.stringify(r),o.meta.url)}),t(No,()=>{const o=e(L).root,r=new d.WebGLRenderer({antialias:!1,stencil:!0,alpha:!0,logarithmicDepthBuffer:!0,premultipliedAlpha:!1,precision:"highp",powerPreference:"high-performance"});return r.setSize(o.clientWidth,o.clientHeight),r.setPixelRatio(1),t(Me,()=>r),t(be,()=>r.domElement),r}),t(_o,()=>{const o=e(L),r=new d.Scene,c=o.background||"#dbf0ff";return r.background=new d.Color(c),r.fog=new d.FogExp2(c,0),t(j,()=>r),r}),t(Ho,()=>{const r=e(Bt),c=e(j),A=e(L),u=new Ql(e(Bt),A.root);u.screenSpacePanning=!1,u.minDistance=.1,u.maxDistance=6e4,u.maxPolarAngle=1.2,u.enableDamping=!0,u.dampingFactor=.07,u.zoomToCursor=!0;const l=new d.Vector3().fromArray(A.minPan||[-2e4,.1,-6e4]),C=new d.Vector3().fromArray(A.maxPan||[5e4,1e4,0]),h=new d.Vector3;return u.addEventListener("change",()=>{const m=Math.max(u.getPolarAngle(),.1),I=Math.max(u.getDistance(),.1);u.zoomSpeed=Math.max(Math.log(I),0)+.5,r.far=d.MathUtils.clamp(I/m*8,100,1e5),r.near=r.far/1e3,r.updateProjectionMatrix(),c.fog instanceof d.FogExp2&&(c.fog.density=m/(I+5)*1*.25),u.maxPolarAngle=Math.min(Math.pow(1e4/I,4),1.2),h.copy(u.target),u.target.clamp(l,C),h.sub(u.target),r.position.sub(h)}),t(it,()=>u),t(We,()=>r.fov),t(Ut,(m=!1)=>m?r.position.clone():r.position),t(Jt,(m=!1)=>m?u.target.clone():u.target),t(Se,(m=!1)=>m?r.up.clone():r.up),u}),t(Go,()=>{const o=new d.DirectionalLight(16777215,1);return o.position.set(0,2e3,1e3),o}),window.addEventListener("beforeunload",()=>e(wn))}function Ol(n){let{root:t="#map",debugMode:e}=n;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 s={...n};return s.root=t,s}function Jl(){const n=new vi.plugin.BingSource,t=new vi.TileMap({imgSource:n,lon0:90,minLevel:2,maxLevel:16});return t.scale.set(10,10,10),t.rotateX(-Math.PI/2),t.autoUpdate=!1,t}class Kl{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 Xl(n){const t=(b,B,y)=>n.on(b,B,y),e=(b,...B)=>n.fire(b,...B),s=e(be);let i=new Set,a,o=new Kl;t(En,()=>{if(!i.size)return;const b=e(L);if(!b.enableKeyboard)return i.clear();const B=b.editMode;if(i.has("KeyH")){const y=e(ft);y&&(y.visible=!y.visible),i.clear()}else if(i.has("Equal"))if(B){const y=e(ft);if(!y||!y.visible)return i.clear();if(i.has("KeyX")){const v=d.MathUtils.degToRad(.1);y.rotateOnAxis(new d.Vector3(1,0,0),v)}else y.scale.set(y.scale.x+.01,y.scale.y+.01,y.scale.z+.01)}else e($e),i.clear();else if(i.has("Minus"))if(B){const y=e(ft);if(!y||!y.visible)return i.clear();if(i.has("KeyX")){const v=d.MathUtils.degToRad(-.1);y.rotateOnAxis(new d.Vector3(1,0,0),v)}else y.scale.set(y.scale.x-.01,y.scale.y-.01,y.scale.z-.01)}else e(en),i.clear();else if(i.has("KeyP"))e(Kt,!0),i.clear();else if(i.has("ArrowUp")){if(B){const y=e(ft);y&&y.visible&&(y.position.z+=.1)}}else if(i.has("ArrowDown")){if(B){const y=e(ft);y&&y.visible&&(y.position.z-=.1)}}else if(i.has("ArrowRight")){if(B){const y=e(ft);y&&y.visible&&(y.position.x+=.1)}}else if(i.has("ArrowLeft")){if(B){const y=e(ft);y&&y.visible&&(y.position.x-=.1)}}else if(i.has("KeyU")){if(B){const y=e(ft);if(y){const v=y.meta||{};v.transform=y.matrix.toArray()}}}else i.has("KeyQ")?B&&e(Ws,.1):i.has("KeyW")?B&&e(Ys,.1):i.has("KeyE")?B&&e(zs,.1):i.has("KeyA")?B&&e(Ws,-.1):i.has("KeyS")?B&&e(Ys,-.1):i.has("KeyD")?B&&e(zs,-.1):i.has("KeyY")?B?e(Wo,i.has("ShiftLeft")||i.has("ShiftRight")?-.1:.1):(e(tn,!0),i.clear()):i.has("KeyC")&&console.info("position=",e(Ut).toArray(),"lookat=",e(Jt).toArray())});const r=b=>{b.target.type!=="text"&&(a||b.code==="F5"||(b.preventDefault(),i.add(b.code)))},c=b=>{b.target.type!=="text"&&(a||i.clear())},A=()=>{i.clear()},u=b=>{parent&&setTimeout(()=>window.focus()),b.preventDefault()},l=async b=>{b.preventDefault()};let C,h,m,I;t(qe,()=>{C?.dispose(),h?.dispose(),m?.dispose(),I?.dispose(),C=null,h=null,m=null,I=null,o.lastMovePoint=null,e(fe)});const g=async b=>{parent&&setTimeout(()=>window.focus()),b.preventDefault(),!a&&(o.down=b.button===2?2:1,o.move=!1,o.isDbClick=Date.now()-o.downTime<300,o.downTime=Date.now())},p=async b=>{b.preventDefault(),!a&&o.down&&(o.move=!0)},f=async b=>{b.preventDefault(),!a&&(o.down=0,o.move=!1)};function D(b){b.preventDefault(),!a&&(o.down=b.touches.length,o.down===1&&(o.move=!1,o.x=b.touches[0].clientX,o.y=b.touches[0].clientY))}function w(b){b.touches.length===1&&(o.move=!0)}function x(b){o.down===1&&!o.move&&e(Xe,o.x,o.y)}window.addEventListener("keydown",r),window.addEventListener("keyup",c),window.addEventListener("blur",A),window.addEventListener("wheel",u,{passive:!1}),s.addEventListener("contextmenu",l),s.addEventListener("mousedown",g),s.addEventListener("mousemove",p),s.addEventListener("mouseup",f),s.addEventListener("touchstart",D,{passive:!1}),s.addEventListener("touchmove",w,{passive:!1}),s.addEventListener("touchend",x,{passive:!1}),t(us,()=>{a=!0,window.removeEventListener("keydown",r),window.removeEventListener("keyup",c),window.removeEventListener("blur",A),window.removeEventListener("wheel",u),s.removeEventListener("contextmenu",l),s.removeEventListener("mousedown",g),s.removeEventListener("mousemove",p),s.removeEventListener("mouseup",f),s.removeEventListener("touchstart",D),s.removeEventListener("touchmove",w),s.removeEventListener("touchend",x)}),t(Xe,async(b,B)=>await e(Qn,b,B))}var Ge=Object.freeze({Linear:Object.freeze({None:function(n){return n},In:function(n){return n},Out:function(n){return n},InOut:function(n){return n}}),Quadratic:Object.freeze({In:function(n){return n*n},Out:function(n){return n*(2-n)},InOut:function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}}),Cubic:Object.freeze({In:function(n){return n*n*n},Out:function(n){return--n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}}),Quartic:Object.freeze({In:function(n){return n*n*n*n},Out:function(n){return 1- --n*n*n*n},InOut:function(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}}),Quintic:Object.freeze({In:function(n){return n*n*n*n*n},Out:function(n){return--n*n*n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}}),Sinusoidal:Object.freeze({In:function(n){return 1-Math.sin((1-n)*Math.PI/2)},Out:function(n){return Math.sin(n*Math.PI/2)},InOut:function(n){return .5*(1-Math.sin(Math.PI*(.5-n)))}}),Exponential:Object.freeze({In:function(n){return n===0?0:Math.pow(1024,n-1)},Out:function(n){return n===1?1:1-Math.pow(2,-10*n)},InOut:function(n){return n===0?0:n===1?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}}),Circular:Object.freeze({In:function(n){return 1-Math.sqrt(1-n*n)},Out:function(n){return Math.sqrt(1- --n*n)},InOut:function(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}}),Elastic:Object.freeze({In:function(n){return n===0?0:n===1?1:-Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI)},Out:function(n){return n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n-.1)*5*Math.PI)+1},InOut:function(n){return n===0?0:n===1?1:(n*=2,n<1?-.5*Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin((n-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(n){var t=1.70158;return n===1?1:n*n*((t+1)*n-t)},Out:function(n){var t=1.70158;return n===0?0:--n*n*((t+1)*n+t)+1},InOut:function(n){var t=2.5949095;return(n*=2)<1?.5*(n*n*((t+1)*n-t)):.5*((n-=2)*n*((t+1)*n+t)+2)}}),Bounce:Object.freeze({In:function(n){return 1-Ge.Bounce.Out(1-n)},Out:function(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return n<.5?Ge.Bounce.In(n*2)*.5:Ge.Bounce.Out(n*2-1)*.5+.5}}),generatePow:function(n){return n===void 0&&(n=4),n=n<Number.EPSILON?Number.EPSILON:n,n=n>1e4?1e4:n,{In:function(t){return Math.pow(t,n)},Out:function(t){return 1-Math.pow(1-t,n)},InOut:function(t){return t<.5?Math.pow(t*2,n)/2:(1-Math.pow(2-t*2,n))/2+.5}}}}),gn=function(){return performance.now()},Zl=(function(){function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return n.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},n.prototype.removeAll=function(){this._tweens={}},n.prototype.add=function(){for(var t,e=[],s=0;s<arguments.length;s++)e[s]=arguments[s];for(var i=0,a=e;i<a.length;i++){var o=a[i];(t=o._group)===null||t===void 0||t.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},n.prototype.remove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var s=0,i=t;s<i.length;s++){var a=i[s];a._group=void 0,delete this._tweens[a.getId()],delete this._tweensAddedDuringUpdate[a.getId()]}},n.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},n.prototype.update=function(t,e){t===void 0&&(t=gn()),e===void 0&&(e=!0);var s=Object.keys(this._tweens);if(s.length!==0)for(;s.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<s.length;i++){var a=this._tweens[s[i]],o=!e;a&&a.update(t,o)===!1&&!e&&this.remove(a)}s=Object.keys(this._tweensAddedDuringUpdate)}},n})(),Si={Linear:function(n,t){var e=n.length-1,s=e*t,i=Math.floor(s),a=Si.Utils.Linear;return t<0?a(n[0],n[1],s):t>1?a(n[e],n[e-1],e-s):a(n[i],n[i+1>e?e:i+1],s-i)},Utils:{Linear:function(n,t,e){return(t-n)*e+n}}},Br=(function(){function n(){}return n.nextId=function(){return n._nextId++},n._nextId=0,n})(),xi=new Zl,jl=(function(){function n(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=Ge.Linear.None,this._interpolationFunction=Si.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Br.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=xi,xi.add(this))}return n.prototype.getId=function(){return this._id},n.prototype.isPlaying=function(){return this._isPlaying},n.prototype.isPaused=function(){return this._isPaused},n.prototype.getDuration=function(){return this._duration},n.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},n.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},n.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},n.prototype.start=function(t,e){if(t===void 0&&(t=gn()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var s in this._valuesStartRepeat)this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s]}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 i={};for(var a in this._valuesEnd)i[a]=this._valuesEnd[a];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},n.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},n.prototype._setupProperties=function(t,e,s,i,a){for(var o in s){var r=t[o],c=Array.isArray(r),A=c?"array":typeof r,u=!c&&Array.isArray(s[o]);if(!(A==="undefined"||A==="function")){if(u){var l=s[o];if(l.length===0)continue;for(var C=[r],h=0,m=l.length;h<m;h+=1){var I=this._handleRelativeValue(r,l[h]);if(isNaN(I)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}C.push(I)}u&&(s[o]=C)}if((A==="object"||c)&&r&&!u){e[o]=c?[]:{};var g=r;for(var p in g)e[o][p]=g[p];i[o]=c?[]:{};var l=s[o];if(!this._isDynamic){var f={};for(var p in l)f[p]=l[p];s[o]=l=f}this._setupProperties(g,e[o],l,i[o],a)}else(typeof e[o]>"u"||a)&&(e[o]=r),c||(e[o]*=1),u?i[o]=s[o].slice().reverse():i[o]=e[o]||0}}},n.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},n.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},n.prototype.pause=function(t){return t===void 0&&(t=gn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},n.prototype.resume=function(t){return t===void 0&&(t=gn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},n.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},n.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)},n.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},n.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},n.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},n.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},n.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},n.prototype.easing=function(t){return t===void 0&&(t=Ge.Linear.None),this._easingFunction=t,this},n.prototype.interpolation=function(t){return t===void 0&&(t=Si.Linear),this._interpolationFunction=t,this},n.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},n.prototype.onStart=function(t){return this._onStartCallback=t,this},n.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},n.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},n.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},n.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},n.prototype.onStop=function(t){return this._onStopCallback=t,this},n.prototype.update=function(t,e){var s=this,i;if(t===void 0&&(t=gn()),e===void 0&&(e=n.autoStartOnUpdate),this._isPaused)return!0;var a;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 o=t-this._startTime,r=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),c=this._duration+this._repeat*r,A=function(){if(s._duration===0||o>c)return 1;var I=Math.trunc(o/r),g=o-I*r,p=Math.min(g/s._duration,1);return p===0&&o===s._duration?1:p},u=A(),l=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,l),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||o>=this._duration)if(this._repeat>0){var C=Math.min(Math.trunc((o-this._duration)/r)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=C);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=r*C,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var h=0,m=this._chainedTweens.length;h<m;h++)this._chainedTweens[h].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},n.prototype._updateProperties=function(t,e,s,i){for(var a in s)if(e[a]!==void 0){var o=e[a]||0,r=s[a],c=Array.isArray(t[a]),A=Array.isArray(r),u=!c&&A;u?t[a]=this._interpolationFunction(r,i):typeof r=="object"&&r?this._updateProperties(t[a],o,r,i):(r=this._handleRelativeValue(o,r),typeof r=="number"&&(t[a]=o+(r-o)*i))}},n.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},n.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],s=this._valuesEnd[t];typeof s=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(s):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},n.autoStartOnUpdate=!1,n})();Br.nextId;var ee=xi;ee.getAll.bind(ee),ee.removeAll.bind(ee),ee.add.bind(ee),ee.remove.bind(ee),ee.update.bind(ee);const Qr=navigator.userAgent.includes("Mobi");class ql extends d.Mesh{constructor(t,e){super(),this.isWarpSplatMesh=!0,this.lastActiveTime=Date.now(),this.active=!1,this.disposed=!1;const s=this;s.mapViewer=e,s.addScene(t),s.frustumCulled=!1}async addScene(t){const e=this,{renderer:s,scene:i,controls:a,tileMap:o}=e.mapViewer;fetch(t,{mode:"cors",credentials:"omit",cache:"reload"}).then(r=>r.ok?r.json():{}).then(r=>{const c=new d.Matrix4;if(r.transform)c.fromArray(r.transform);else if(r.WGS84){const m=o.geo2world(new d.Vector3().fromArray(r.WGS84));c.makeTranslation(m.x,m.y,m.z),r.transform=c.toArray()}e.metaMatrix=c;const A=!!r.isLargeScene,u=!1,l=!1,C=!!r.showWatermark,h={renderer:s,scene:i,controls:a,pointcloudMode:u,bigSceneMode:A,showWatermark:C,depthTest:l,mapMode:!0};h.maxRenderCountOfMobile??(h.maxRenderCountOfMobile=h.bigSceneMode?128*10240:400*1e4),h.maxRenderCountOfPc??(h.maxRenderCountOfPc=h.bigSceneMode?320*1e4:400*1e4),h.debugMode=e.mapViewer.events.fire(L).debugMode,e.opts=h,e.meta=r,i.add(e),e.initCSS3DSprite(h),e.applyMatrix4(c)}).catch(r=>{console.error(r.message)})}async initCSS3DSprite(t){const e=this,s=t.controls,i=document.createElement("div");i.innerHTML=`<div title="${e.meta.name}" style='flex-direction: column;align-items: center;display: flex;pointer-events: auto;margin-bottom: 20px;'>
810
810
  <svg height="20" width="20" style="color:#eeee00;opacity:0.9;"><use href="#svgicon-point3" fill="currentColor" /></svg>
811
- </div>`,i.classList.add("splatmesh-point"),i.style.position="absolute",i.style.borderRadius="4px",i.style.cursor="pointer";let a=null;i.onclick=()=>{if(a)return;const c=s.target.clone(),A=s.object.position.clone(),u=e.position.clone(),l=Mr?6:2,h=c.clone().sub(A).normalize().clone(),m=u.clone().sub(h.multiplyScalar(l)),I={x:A.x,y:A.y,z:A.z,tx:c.x,ty:c.y,tz:c.z},d={x:m.x,y:m.y,z:m.z,tx:u.x,ty:u.y,tz:u.z};a=new $l(I).to(d,3500),a.easing(Ne.Sinusoidal.InOut).start().onUpdate(()=>{s.object.position.set(I.x,I.y,I.z),s.target.set(I.tx,I.ty,I.tz)}).onComplete(()=>{a=null})},i.oncontextmenu=c=>c.preventDefault();const o=new Bt(i);o.element.style.pointerEvents="none",o.visible=!1,o.applyMatrix4(e.metaMatrix),e.css3dTag=o,t.scene.add(o);const r=c=>e.mapViewer.controls._onMouseWheel(c);i.addEventListener("wheel",r,{passive:!1}),o.dispose=()=>i.removeEventListener("wheel",r),e.onBeforeRender=()=>{a?.update();const c=Mr?60:30,A=100,u=e.position.distanceTo(e.mapViewer.controls.object.position);if(u>c){e.css3dTag.visible=e.opts.controls.object.position.y>2;let l=.002*u;o.scale.set(l,l,l),e.css3dTag.visible=s.object.position.y<10?u<A:!0,e.splatMesh&&(e.splatMesh.visible=!1)}else{if(!e.active){e.splatMesh&&(e.splatMesh.visible=!1);let l=.002*u;o.scale.set(l,l,l),e.css3dTag.visible=!0,e.splatMesh?.boundBox&&(e.splatMesh.boundBox.visible=!1);return}if(e.lastActiveTime=Date.now(),e.css3dTag.visible=!1,e.splatMesh)e.splatMesh.visible=!0;else{const l=e.meta,C={...e.opts};C.bigSceneMode=!!l.isLargeScene;const h=new Wt(C);e.splatMesh=h,e.opts.scene.add(h),h.meta=l;const m=l.watermark||l.name||"";l.showWatermark=!!l.showWatermark,h.fire(Ts,m,!0,!1),h.addModel({url:l.url},l)}e.splatMesh.meta.showBoundBox&&(e.splatMesh.boundBox.visible=!0)}},e.onAfterRender=()=>{e.splatMesh&&(!e.active||Date.now()-e.lastActiveTime>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,t.metaMatrix=null)}}class eu extends g.EventDispatcher{constructor(t={}){console.info("Reall3dMapViewer",_n),super(),this.clock=new g.Clock,this.updateTime=0,this.disposed=!1;const e=this,s=new Hn;e.events=s;const i=(r,c,A)=>s.on(r,c,A),a=(r,...c)=>s.fire(r,...c);e.tileMap=Xl();const o=Kl(t);i(R,()=>o),oi(s),mi(s),Jl(s),Qr(s),Br(s),e.camera=new g.PerspectiveCamera(60,1,.01,100),i(Qt,()=>e.camera),e.container=o.root,e.renderer=a(_o),e.scene=a(Go),e.controls=a(Wo),e.ambLight=new g.AmbientLight(16777215,1),e.scene.add(e.ambLight),e.dirLight=a(Oo),e.scene.add(e.dirLight),e.scene.add(e.tileMap),e.container.appendChild(e.renderer.domElement),br(s),jl(s),window.addEventListener("resize",e.resize.bind(e)),e.resize(),e.renderer.setAnimationLoop(e.animate.bind(e)),dt&&e.controls._dollyOut?.(.75),i(En,()=>e.dispose()),i(Me,()=>{a(yn),e.controls.update(),a(Yo),a(Qn)},!0),i(xe,()=>{e.tileMap.update(e.camera);try{e.renderer.render(e.scene,e.camera)}catch(r){console.warn(r.message)}},!0),i(vn,()=>{e.dispatchEvent({type:"update",delta:e.clock.getDelta()}),e.updateTime=Date.now(),a(Tt)&&a(ut,{fps:a(In),realFps:a(wn),fov:a(Oe),position:a(Ie,a(Ut)),lookAt:a(Ie,a(Jt)),lookUp:a(Ie,a(be))})},!0)}addScenes(t){const e=(a,o,r)=>this.events.on(a,o,r),s=(a,...o)=>this.events.fire(a,...o),i=this;fetch(t,{mode:"cors",credentials:"omit",cache:"reload"}).then(a=>a.ok?a.json():{}).then(a=>{const o=new g.Vector3().fromArray(a.position||[17e3,3e4,-35e3]),r=new g.Vector3().fromArray(a.lookAt||[17e3,0,-35e3]);i.controls.object.position.copy(o),i.controls.target.copy(r),i.dirLight.target.position.copy(r),e(Rs,()=>a),s(Rn,a.flyPositions||[]),s(Fn,a.flyTargets||[]),s(Js,a.flyDuration);const c=new Set;for(let A of a.scenes)c.has(A)||(new tu(A,i),c.add(A))}).catch(a=>{console.error(a.message)})}fire(t,e,s){const i=this;t===2&&i.events.fire(tn),t===3&&i.events.fire(Kt,!0),t===4&&i.events.fire(nn),t===5&&i.events.fire(en)}resize(){const t=this;if(t.disposed)return;const{width:e,height:s,top:i,left:a}=t.container.getBoundingClientRect();t.renderer.setPixelRatio(1),t.renderer.setSize(e,s),t.camera.aspect=e/s,t.camera.updateProjectionMatrix();const o=t.events.fire(xs);o.setSize(e,s),o.domElement.style.position="absolute",o.domElement.style.left=`${a}px`,o.domElement.style.top=`${i}px`}animate(){const t=this,e=(s,...i)=>t.events.fire(s,...i);e(mn),Date.now()-t.updateTime>17&&(e(Me),e(xe),e(vn))}dispose(){const t=this;if(t.disposed)return;t.disposed=!0;const e=t.renderer.domElement;t.events.fire(vs),t.events.fire(Jo),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,document.querySelector("#gsviewer .debug.dev-panel")?.classList?.remove("map")}}Et.Reall3dMapViewer=eu,Et.Reall3dViewer=Yl,Et.SplatMesh=Wt,Object.defineProperty(Et,Symbol.toStringTag,{value:"Module"})}));
811
+ </div>`,i.classList.add("splatmesh-point"),i.style.position="absolute",i.style.borderRadius="4px",i.style.cursor="pointer";let a=null;i.onclick=()=>{if(a)return;const c=s.target.clone(),A=s.object.position.clone(),u=e.position.clone(),l=Qr?6:2,h=c.clone().sub(A).normalize().clone(),m=u.clone().sub(h.multiplyScalar(l)),I={x:A.x,y:A.y,z:A.z,tx:c.x,ty:c.y,tz:c.z},g={x:m.x,y:m.y,z:m.z,tx:u.x,ty:u.y,tz:u.z};a=new jl(I).to(g,3500),a.easing(Ge.Sinusoidal.InOut).start().onUpdate(()=>{s.object.position.set(I.x,I.y,I.z),s.target.set(I.tx,I.ty,I.tz)}).onComplete(()=>{a=null})},i.oncontextmenu=c=>c.preventDefault();const o=new bt(i);o.element.style.pointerEvents="none",o.visible=!1,o.applyMatrix4(e.metaMatrix),e.css3dTag=o,t.scene.add(o);const r=c=>e.mapViewer.controls._onMouseWheel(c);i.addEventListener("wheel",r,{passive:!1}),o.dispose=()=>i.removeEventListener("wheel",r),e.onBeforeRender=()=>{a?.update();const c=Qr?60:30,A=100,u=e.position.distanceTo(e.mapViewer.controls.object.position);if(u>c){e.css3dTag.visible=e.opts.controls.object.position.y>2;let l=.002*u;o.scale.set(l,l,l),e.css3dTag.visible=s.object.position.y<10?u<A:!0,e.splatMesh&&(e.splatMesh.visible=!1)}else{if(!e.active){e.splatMesh&&(e.splatMesh.visible=!1);let l=.002*u;o.scale.set(l,l,l),e.css3dTag.visible=!0,e.splatMesh?.boundBox&&(e.splatMesh.boundBox.visible=!1);return}if(e.lastActiveTime=Date.now(),e.css3dTag.visible=!1,e.splatMesh)e.splatMesh.visible=!0;else{const l=e.meta,C={...e.opts};C.bigSceneMode=!!l.isLargeScene;const h=new Yt(C);e.splatMesh=h,e.opts.scene.add(h),h.meta=l;const m=l.watermark||l.name||"";l.showWatermark=!!l.showWatermark,h.fire(ks,m,!0,!1),h.addModel({url:l.url},l)}e.splatMesh.meta.showBoundBox&&(e.splatMesh.boundBox.visible=!0)}},e.onAfterRender=()=>{e.splatMesh&&(!e.active||Date.now()-e.lastActiveTime>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,t.metaMatrix=null)}}class $l extends d.EventDispatcher{constructor(t={}){console.info("Reall3dMapViewer",_n),super(),this.clock=new d.Clock,this.updateTime=0,this.disposed=!1;const e=this,s=new Nn;e.events=s;const i=(r,c,A)=>s.on(r,c,A),a=(r,...c)=>s.fire(r,...c);e.tileMap=Jl();const o=Ol(t);i(L,()=>o),ii(s),pi(s),zl(s),yr(s),Er(s),e.camera=new d.PerspectiveCamera(60,1,.01,100),i(Bt,()=>e.camera),e.container=o.root,e.renderer=a(No),e.scene=a(_o),e.controls=a(Ho),e.ambLight=new d.AmbientLight(16777215,1),e.scene.add(e.ambLight),e.dirLight=a(Go),e.scene.add(e.dirLight),e.scene.add(e.tileMap),e.container.appendChild(e.renderer.domElement),wr(s),Xl(s),window.addEventListener("resize",e.resize.bind(e)),e.resize(),e.renderer.setAnimationLoop(e.animate.bind(e)),dt&&e.controls._dollyOut?.(.75),i(wn,()=>e.dispose()),i(ve,()=>{a(In),e.controls.update(),a(Yo),a(En)},!0),i(De,()=>{e.tileMap.update(e.camera);try{e.renderer.render(e.scene,e.camera)}catch(r){console.warn(r.message)}},!0),i(Mn,()=>{e.dispatchEvent({type:"update",delta:e.clock.getDelta()}),e.updateTime=Date.now(),a(Tt)&&a(ut,{fps:a(mn),realFps:a(yn),fov:a(We),position:a(ye,a(Ut)),lookAt:a(ye,a(Jt)),lookUp:a(ye,a(Se))})},!0)}addScenes(t){const e=(a,o,r)=>this.events.on(a,o,r),s=(a,...o)=>this.events.fire(a,...o),i=this;fetch(t,{mode:"cors",credentials:"omit",cache:"reload"}).then(a=>a.ok?a.json():{}).then(a=>{const o=new d.Vector3().fromArray(a.position||[17e3,3e4,-35e3]),r=new d.Vector3().fromArray(a.lookAt||[17e3,0,-35e3]);i.controls.object.position.copy(o),i.controls.target.copy(r),i.dirLight.target.position.copy(r),e(Ls,()=>a),s(Ln,a.flyPositions||[]),s(Rn,a.flyTargets||[]),s(Os,a.flyDuration);const c=new Set;for(let A of a.scenes)c.has(A)||(new ql(A,i),c.add(A))}).catch(a=>{console.error(a.message)})}fire(t,e,s){const i=this;t===2&&i.events.fire($e),t===3&&i.events.fire(Kt,!0),t===4&&i.events.fire(en),t===5&&i.events.fire(tn)}resize(){const t=this;if(t.disposed)return;const{width:e,height:s,top:i,left:a}=t.container.getBoundingClientRect();t.renderer.setPixelRatio(1),t.renderer.setSize(e,s),t.camera.aspect=e/s,t.camera.updateProjectionMatrix();const o=t.events.fire(xs);o.setSize(e,s),o.domElement.style.position="absolute",o.domElement.style.left=`${a}px`,o.domElement.style.top=`${i}px`}animate(){const t=this,e=(s,...i)=>t.events.fire(s,...i);e(Cn),Date.now()-t.updateTime>17&&(e(ve),e(De),e(Mn))}dispose(){const t=this;if(t.disposed)return;t.disposed=!0;const e=t.renderer.domElement;t.events.fire(Ms),t.events.fire(zo),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,document.querySelector("#gsviewer .debug.dev-panel")?.classList?.remove("map")}}Et.Reall3dMapViewer=$l,Et.Reall3dViewer=Yl,Et.SplatMesh=Yt,Object.defineProperty(Et,Symbol.toStringTag,{value:"Module"})}));