diff --git a/README.md b/README.md index 86a0e32..8709978 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ Built clean-room under the [IOExtend](https://github.com/IOExtend) organization. - Packs geometry compactly: positions quantized to 16-bit steps of 2⁻¹⁰ m (error at most 0.49 mm, 0.85 mm for rotated shared geometry; geometry larger than about 64 m, or shared geometry that an instance scales up, stays 32-bit float), octahedral 16-bit normals, 16- or 32-bit indices, all in one base64 block. - Shifts coordinates relative to the model centre (RTC), so georeferenced models with coordinates around 10⁶ m do not jitter. - Draws large models with few draw calls: geometry is merged into spatial chunks per material (very large models draw their repeated shapes as instanced copies instead), and hiding, selection and colouring are per-object data, so they never rebuild geometry. -- Viewer interface in Russian or English, chosen from the browser language: +- Viewer language selection includes English, Russian, Spanish, German, French, Portuguese, Italian, Japanese, Korean, and simplified and traditional Chinese. Strings without a translation use English. The language picker works offline in standalone HTML. Choose Auto to follow the browser’s preferred languages. Changing the language reloads the viewer with its initial view. +- Viewer tools - model tree with search and filters by source model, level and category, a properties panel and a selected/total counter; - toolbar with labelled groups: navigation, sections, measure, display and view; - context menu: properties, hide, isolate, show all, zoom to object, section box around the object, copy Id; diff --git a/src/IOViewer/Viewer/dist/viewer.js b/src/IOViewer/Viewer/dist/viewer.js index 225f4dc..523e89b 100644 --- a/src/IOViewer/Viewer/dist/viewer.js +++ b/src/IOViewer/Viewer/dist/viewer.js @@ -1,10 +1,10 @@ -(()=>{var gu=i=>{throw TypeError(i)};var Hl=(i,t,e)=>t.has(i)||gu("Cannot "+e);var di=(i,t,e)=>(Hl(i,t,"read from private field"),e?e.call(i):t.get(i)),Vl=(i,t,e)=>t.has(i)?gu("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),_u=(i,t,e,n)=>(Hl(i,t,"write to private field"),n?n.call(i,e):t.set(i,e),e),to=(i,t,e)=>(Hl(i,t,"access private method"),e);var Ju=0,Mc=1,ju=2;var yr=1,Qu=2,Ps=3,Yn=0,ze=1,ke=2,$n=0,Ls=1,bc=2,Sc=3,wc=4,td=5;var Wi=100,ed=101,nd=102,id=103,sd=104,rd=200,od=201,ad=202,ld=203,Ec=204,Tc=205,cd=206,hd=207,ud=208,dd=209,fd=210,pd=211,md=212,gd=213,_d=214,Lo=0,Do=1,No=2,_s=3,Uo=4,Fo=5,Bo=6,Oo=7,Mr=0,xd=1,vd=2,En=0,Ac=1,Rc=2,Cc=3,Ic=4,Pc=5,Lc=6,Dc=7;var Nc=300,bi=301,Xi=302,ua=303,da=304,br=306,xs=1e3,Bn=1001,zo=1002,Le=1003,yd=1004;var Sr=1005;var qe=1006,fa=1007;var Si=1008;var rn=1009,Uc=1010,Fc=1011,Ds=1012,pa=1013,Tn=1014,Ye=1015,An=1016,ma=1017,ga=1018,Ns=1020,Bc=35902,Oc=35899,zc=1021,kc=1022,je=1023,On=1026,wi=1027,Us=1028,_a=1029,Ei=1030,xa=1031;var va=1033,wr=33776,Er=33777,Tr=33778,Ar=33779,ya=35840,Ma=35841,ba=35842,Sa=35843,wa=36196,Ea=37492,Ta=37496,Aa=37488,Ra=37489,Rr=37490,Ca=37491,Ia=37808,Pa=37809,La=37810,Da=37811,Na=37812,Ua=37813,Fa=37814,Ba=37815,Oa=37816,za=37817,ka=37818,Ha=37819,Va=37820,Ga=37821,Wa=36492,Xa=36494,qa=36495,Ya=36283,$a=36284,Cr=36285,Za=36286;var nr=2300,ko=2301,Co=2302,dc=2303,fc=2400,pc=2401,mc=2402;var Md=3200;var Ir=0,bd=1,ai="",me="srgb",ir="srgb-linear",sr="linear",fe="srgb";var Io=7680;var Hc=34055,Vc=34056;var Gc=517;var Sd=519,wd=512,Ed=513,Td=514,Ka=515,Ad=516,Rd=517,Ja=518,Cd=519,Wc=35044,Pr=35048;var Xc="300 es",bn=2e3,vs=2001;function bm(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}function Sm(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function ys(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Id(){let i=ys("canvas");return i.style.display="block",i}var xu={},Ms=null;function rr(...i){let t="THREE."+i.shift();Ms?Ms("log",t,...i):console.log(t,...i)}function Pd(i){let t=i[0];if(typeof t=="string"&&t.startsWith("TSL:")){let e=i[1];e&&e.isStackTrace?i[0]+=" "+e.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Wt(...i){i=Pd(i);let t="THREE."+i.shift();if(Ms)Ms("warn",t,...i);else{let e=i[0];e&&e.isStackTrace?console.warn(e.getError(t)):console.warn(t,...i)}}function $t(...i){i=Pd(i);let t="THREE."+i.shift();if(Ms)Ms("error",t,...i);else{let e=i[0];e&&e.isStackTrace?console.error(e.getError(t)):console.error(t,...i)}}function Bi(...i){let t=i.join(" ");t in xu||(xu[t]=!0,Wt(...i))}function Ld(i,t,e){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(t,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,e);break;default:n()}}setTimeout(r,e)})}var Dd={[Lo]:Do,[No]:Bo,[Uo]:Oo,[_s]:Fo,[Do]:Lo,[Bo]:No,[Oo]:Uo,[Fo]:_s},zn=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){let n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){let n=this._listeners;if(n===void 0)return;let s=n[t];if(s!==void 0){let r=s.indexOf(e);r!==-1&&s.splice(r,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let n=e[t.type];if(n!==void 0){t.target=this;let s=n.slice(0);for(let r=0,o=s.length;r>8&255]+Ze[i>>16&255]+Ze[i>>24&255]+"-"+Ze[t&255]+Ze[t>>8&255]+"-"+Ze[t>>16&15|64]+Ze[t>>24&255]+"-"+Ze[e&63|128]+Ze[e>>8&255]+"-"+Ze[e>>16&255]+Ze[e>>24&255]+Ze[n&255]+Ze[n>>8&255]+Ze[n>>16&255]+Ze[n>>24&255]).toLowerCase()}function re(i,t,e){return Math.max(t,Math.min(e,i))}function qc(i,t){return(i%t+t)%t}function wm(i,t,e,n,s){return n+(i-t)*(s-n)/(e-t)}function Em(i,t,e){return i!==t?(e-i)/(t-i):0}function er(i,t,e){return(1-e)*i+e*t}function Tm(i,t,e,n){return er(i,t,1-Math.exp(-e*n))}function Am(i,t=1){return t-Math.abs(qc(i,t*2)-t)}function Rm(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function Cm(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function Im(i,t){return i+Math.floor(Math.random()*(t-i+1))}function Pm(i,t){return i+Math.random()*(t-i)}function Lm(i){return i*(.5-Math.random())}function Dm(i){i!==void 0&&(vu=i);let t=vu+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Nm(i){return i*ms}function Um(i){return i*bs}function Fm(i){return i>0&&Number.isInteger(i)&&2**Math.round(Math.log2(i))===i}function Bm(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Om(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function zm(i,t,e,n,s){let r=Math.cos,o=Math.sin,a=r(e/2),l=o(e/2),c=r((t+n)/2),h=o((t+n)/2),d=r((t-n)/2),u=o((t-n)/2),f=r((n-t)/2),m=o((n-t)/2);switch(s){case"XYX":i.set(a*h,l*d,l*u,a*c);break;case"YZY":i.set(l*u,a*h,l*d,a*c);break;case"ZXZ":i.set(l*d,l*u,a*h,a*c);break;case"XZX":i.set(a*h,l*m,l*f,a*c);break;case"YXY":i.set(l*f,a*h,l*m,a*c);break;case"ZYZ":i.set(l*m,l*f,a*h,a*c);break;default:Wt("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function Mn(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:case Uint8ClampedArray:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function pe(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var le={DEG2RAD:ms,RAD2DEG:bs,generateUUID:si,clamp:re,euclideanModulo:qc,mapLinear:wm,inverseLerp:Em,lerp:er,damp:Tm,pingpong:Am,smoothstep:Rm,smootherstep:Cm,randInt:Im,randFloat:Pm,randFloatSpread:Lm,seededRandom:Dm,degToRad:Nm,radToDeg:Um,isPowerOfTwo:Fm,ceilPowerOfTwo:Bm,floorPowerOfTwo:Om,setQuaternionFromProperEuler:zm,normalize:pe,denormalize:Mn},Jc=class Jc{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6],this.y=s[1]*e+s[4]*n+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=re(this.x,t.x,e.x),this.y=re(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=re(this.x,t,e),this.y=re(this.y,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(re(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(re(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let n=Math.cos(e),s=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*s+t.x,this.y=r*s+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Jc.prototype.isVector2=!0;var qt=Jc,Fe=class{constructor(t=0,e=0,n=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=s}static slerpFlat(t,e,n,s,r,o,a){let l=n[s+0],c=n[s+1],h=n[s+2],d=n[s+3],u=r[o+0],f=r[o+1],m=r[o+2],_=r[o+3];if(d!==_||l!==u||c!==f||h!==m){let g=l*u+c*f+h*m+d*_;g<0&&(u=-u,f=-f,m=-m,_=-_,g=-g);let p=1-a;if(g<.9995){let y=Math.acos(g),w=Math.sin(y);p=Math.sin(p*y)/w,a=Math.sin(a*y)/w,l=l*p+u*a,c=c*p+f*a,h=h*p+m*a,d=d*p+_*a}else{l=l*p+u*a,c=c*p+f*a,h=h*p+m*a,d=d*p+_*a;let y=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=y,c*=y,h*=y,d*=y}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=d}static multiplyQuaternionsFlat(t,e,n,s,r,o){let a=n[s],l=n[s+1],c=n[s+2],h=n[s+3],d=r[o],u=r[o+1],f=r[o+2],m=r[o+3];return t[e]=a*m+h*d+l*f-c*u,t[e+1]=l*m+h*u+c*d-a*f,t[e+2]=c*m+h*f+a*u-l*d,t[e+3]=h*m-a*d-l*u-c*f,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,s){return this._x=t,this._y=e,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,s=t._y,r=t._z,o=t._order,a=Math.cos,l=Math.sin,c=a(n/2),h=a(s/2),d=a(r/2),u=l(n/2),f=l(s/2),m=l(r/2);switch(o){case"XYZ":this._x=u*h*d+c*f*m,this._y=c*f*d-u*h*m,this._z=c*h*m+u*f*d,this._w=c*h*d-u*f*m;break;case"YXZ":this._x=u*h*d+c*f*m,this._y=c*f*d-u*h*m,this._z=c*h*m-u*f*d,this._w=c*h*d+u*f*m;break;case"ZXY":this._x=u*h*d-c*f*m,this._y=c*f*d+u*h*m,this._z=c*h*m+u*f*d,this._w=c*h*d-u*f*m;break;case"ZYX":this._x=u*h*d-c*f*m,this._y=c*f*d+u*h*m,this._z=c*h*m-u*f*d,this._w=c*h*d+u*f*m;break;case"YZX":this._x=u*h*d+c*f*m,this._y=c*f*d+u*h*m,this._z=c*h*m-u*f*d,this._w=c*h*d-u*f*m;break;case"XZY":this._x=u*h*d-c*f*m,this._y=c*f*d-u*h*m,this._z=c*h*m+u*f*d,this._w=c*h*d+u*f*m;break;default:Wt("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,s=Math.sin(n);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],s=e[4],r=e[8],o=e[1],a=e[5],l=e[9],c=e[2],h=e[6],d=e[10],u=n+a+d;if(u>0){let f=.5/Math.sqrt(u+1);this._w=.25/f,this._x=(h-l)*f,this._y=(r-c)*f,this._z=(o-s)*f}else if(n>a&&n>d){let f=2*Math.sqrt(1+n-a-d);this._w=(h-l)/f,this._x=.25*f,this._y=(s+o)/f,this._z=(r+c)/f}else if(a>d){let f=2*Math.sqrt(1+a-n-d);this._w=(r-c)/f,this._x=(s+o)/f,this._y=.25*f,this._z=(l+h)/f}else{let f=2*Math.sqrt(1+d-n-a);this._w=(o-s)/f,this._x=(r+c)/f,this._y=(l+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-8?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(re(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let s=Math.min(1,e/n);return this.slerp(t,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,s=t._y,r=t._z,o=t._w,a=e._x,l=e._y,c=e._z,h=e._w;return this._x=n*h+o*a+s*c-r*l,this._y=s*h+o*l+r*a-n*c,this._z=r*h+o*c+n*l-s*a,this._w=o*h-n*a-s*l-r*c,this._onChangeCallback(),this}slerp(t,e){let n=t._x,s=t._y,r=t._z,o=t._w,a=this.dot(t);a<0&&(n=-n,s=-s,r=-r,o=-o,a=-a);let l=1-e;if(a<.9995){let c=Math.acos(a),h=Math.sin(c);l=Math.sin(l*c)/h,e=Math.sin(e*c)/h,this._x=this._x*l+n*e,this._y=this._y*l+s*e,this._z=this._z*l+r*e,this._w=this._w*l+o*e,this._onChangeCallback()}else this._x=this._x*l+n*e,this._y=this._y*l+s*e,this._z=this._z*l+r*e,this._w=this._w*l+o*e,this.normalize();return this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},jc=class jc{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(yu.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(yu.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*s,this.y=r[1]*e+r[4]*n+r[7]*s,this.z=r[2]*e+r[5]*n+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,s=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*s+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*s+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*s+r[14])*o,this}applyQuaternion(t){let e=this.x,n=this.y,s=this.z,r=t.x,o=t.y,a=t.z,l=t.w,c=2*(o*s-a*n),h=2*(a*e-r*s),d=2*(r*n-o*e);return this.x=e+l*c+o*d-a*h,this.y=n+l*h+a*c-r*d,this.z=s+l*d+r*h-o*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*s,this.y=r[1]*e+r[5]*n+r[9]*s,this.z=r[2]*e+r[6]*n+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=re(this.x,t.x,e.x),this.y=re(this.y,t.y,e.y),this.z=re(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=re(this.x,t,e),this.y=re(this.y,t,e),this.z=re(this.z,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(re(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let n=t.x,s=t.y,r=t.z,o=e.x,a=e.y,l=e.z;return this.x=s*l-r*a,this.y=r*o-n*l,this.z=n*a-s*o,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Gl.copy(this).projectOnVector(t),this.sub(Gl)}reflect(t){return this.sub(Gl.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(re(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,s=this.z-t.z;return e*e+n*n+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let s=Math.sin(e)*t;return this.x=s*Math.sin(n),this.y=Math.cos(e)*t,this.z=s*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};jc.prototype.isVector3=!0;var C=jc,Gl=new C,yu=new Fe,Qc=class Qc{constructor(t,e,n,s,r,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,s,r,o,a,l,c)}set(t,e,n,s,r,o,a,l,c){let h=this.elements;return h[0]=t,h[1]=s,h[2]=a,h[3]=e,h[4]=r,h[5]=l,h[6]=n,h[7]=o,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,s=e.elements,r=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],h=n[4],d=n[7],u=n[2],f=n[5],m=n[8],_=s[0],g=s[3],p=s[6],y=s[1],w=s[4],M=s[7],x=s[2],S=s[5],A=s[8];return r[0]=o*_+a*y+l*x,r[3]=o*g+a*w+l*S,r[6]=o*p+a*M+l*A,r[1]=c*_+h*y+d*x,r[4]=c*g+h*w+d*S,r[7]=c*p+h*M+d*A,r[2]=u*_+f*y+m*x,r[5]=u*g+f*w+m*S,r[8]=u*p+f*M+m*A,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],o=t[4],a=t[5],l=t[6],c=t[7],h=t[8];return e*o*h-e*a*c-n*r*h+n*a*l+s*r*c-s*o*l}invert(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],o=t[4],a=t[5],l=t[6],c=t[7],h=t[8],d=h*o-a*c,u=a*l-h*r,f=c*r-o*l,m=e*d+n*u+s*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let _=1/m;return t[0]=d*_,t[1]=(s*c-h*n)*_,t[2]=(a*n-s*o)*_,t[3]=u*_,t[4]=(h*e-s*l)*_,t[5]=(s*r-a*e)*_,t[6]=f*_,t[7]=(n*l-c*e)*_,t[8]=(o*e-n*r)*_,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,s,r,o,a){let l=Math.cos(r),c=Math.sin(r);return this.set(n*l,n*c,-n*(l*o+c*a)+o+t,-s*c,s*l,-s*(-c*o+l*a)+a+e,0,0,1),this}scale(t,e){return Bi("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Wl.makeScale(t,e)),this}rotate(t){return Bi("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Wl.makeRotation(-t)),this}translate(t,e){return Bi("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Wl.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let s=0;s<9;s++)if(e[s]!==n[s])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}};Qc.prototype.isMatrix3=!0;var Jt=Qc,Wl=new Jt,Mu=new Jt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),bu=new Jt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function km(){let i={enabled:!0,workingColorSpace:ir,spaces:{},convert:function(s,r,o){return this.enabled===!1||r===o||!r||!o||(this.spaces[r].transfer===fe&&(s.r=ri(s.r),s.g=ri(s.g),s.b=ri(s.b)),this.spaces[r].primaries!==this.spaces[o].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===fe&&(s.r=gs(s.r),s.g=gs(s.g),s.b=gs(s.b))),s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===ai?sr:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,o){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,r){return Bi("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return Bi("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(s,r)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[ir]:{primaries:t,whitePoint:n,transfer:sr,toXYZ:Mu,fromXYZ:bu,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:me},outputColorSpaceConfig:{drawingBufferColorSpace:me}},[me]:{primaries:t,whitePoint:n,transfer:fe,toXYZ:Mu,fromXYZ:bu,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:me}}}),i}var se=km();function ri(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function gs(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var ts,Ho=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{ts===void 0&&(ts=ys("canvas")),ts.width=t.width,ts.height=t.height;let s=ts.getContext("2d");t instanceof ImageData?s.putImageData(t,0,0):s.drawImage(t,0,0,t.width,t.height),n=ts}return n.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=ys("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let s=n.getImageData(0,0,t.width,t.height),r=s.data;for(let o=0;o1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(ql).x}get height(){return this.source.getSize(ql).y}get depth(){return this.source.getSize(ql).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let n=t[e];if(n===void 0){Wt(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){Wt(`Texture.setValues(): property '${e}' does not exist.`);continue}s&&n&&s.isVector2&&n.isVector2||s&&n&&s.isVector3&&n.isVector3||s&&n&&s.isMatrix3&&n.isMatrix3?s.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Nc)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case xs:t.x=t.x-Math.floor(t.x);break;case Bn:t.x=t.x<0?0:1;break;case zo:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case xs:t.y=t.y-Math.floor(t.y);break;case Bn:t.y=t.y<0?0:1;break;case zo:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};We.DEFAULT_IMAGE=null;We.DEFAULT_MAPPING=Nc;We.DEFAULT_ANISOTROPY=1;var th=class th{constructor(t=0,e=0,n=0,s=1){this.x=t,this.y=e,this.z=n,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,s){return this.x=t,this.y=e,this.z=n,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,s=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*s+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*s+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*s+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*s+o[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,s,r,l=t.elements,c=l[0],h=l[4],d=l[8],u=l[1],f=l[5],m=l[9],_=l[2],g=l[6],p=l[10];if(Math.abs(h-u)<.01&&Math.abs(d-_)<.01&&Math.abs(m-g)<.01){if(Math.abs(h+u)<.1&&Math.abs(d+_)<.1&&Math.abs(m+g)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let w=(c+1)/2,M=(f+1)/2,x=(p+1)/2,S=(h+u)/4,A=(d+_)/4,v=(m+g)/4;return w>M&&w>x?w<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(w),s=S/n,r=A/n):M>x?M<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(M),n=S/s,r=v/s):x<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(x),n=A/r,s=v/r),this.set(n,s,r,e),this}let y=Math.sqrt((g-m)*(g-m)+(d-_)*(d-_)+(u-h)*(u-h));return Math.abs(y)<.001&&(y=1),this.x=(g-m)/y,this.y=(d-_)/y,this.z=(u-h)/y,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=re(this.x,t.x,e.x),this.y=re(this.y,t.y,e.y),this.z=re(this.z,t.z,e.z),this.w=re(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=re(this.x,t,e),this.y=re(this.y,t,e),this.z=re(this.z,t,e),this.w=re(this.w,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(re(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};th.prototype.isVector4=!0;var ve=th,Vo=class extends zn{constructor(t=1,e=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:qe,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=n.depth,this.scissor=new ve(0,0,t,e),this.scissorTest=!1,this.viewport=new ve(0,0,t,e),this.textures=[];let s={width:t,height:e,depth:n.depth},r=new We(s),o=n.count;for(let a=0;a1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e>>0}enable(t){this.mask|=1<1){for(let e=0;e1){for(let n=0;n0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.pivot!==null&&(s.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(a=>({...a})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),d.length>0&&(n.shapes=d),u.length>0&&(n.skeletons=u),f.length>0&&(n.animations=f),m.length>0&&(n.nodes=m)}return n.object=s,n;function o(a){let l=[];for(let c in a){let h=a[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;nf+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&u<=f-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:t,target:this})));a!==null&&(s=e.getPose(t.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Zm)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let n=new Re;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}},Nd={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},pi={h:0,s:0,l:0},io={h:0,s:0,l:0};function $l(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(t-i)*6*e:e<1/2?t:e<2/3?i+(t-i)*6*(2/3-e):i}var Vt=class{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){let s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=me){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,se.colorSpaceToWorking(this,e),this}setRGB(t,e,n,s=se.workingColorSpace){return this.r=t,this.g=e,this.b=n,se.colorSpaceToWorking(this,s),this}setHSL(t,e,n,s=se.workingColorSpace){if(t=qc(t,1),e=re(e,0,1),n=re(n,0,1),e===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+e):n+e-n*e,o=2*n-r;this.r=$l(o,r,t+1/3),this.g=$l(o,r,t),this.b=$l(o,r,t-1/3)}return se.colorSpaceToWorking(this,s),this}setStyle(t,e=me){function n(r){r!==void 0&&parseFloat(r)<1&&Wt("Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let r,o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:Wt("Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){let r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,e);if(o===6)return this.setHex(parseInt(r,16),e);Wt("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=me){let n=Nd[t.toLowerCase()];return n!==void 0?this.setHex(n,e):Wt("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=ri(t.r),this.g=ri(t.g),this.b=ri(t.b),this}copyLinearToSRGB(t){return this.r=gs(t.r),this.g=gs(t.g),this.b=gs(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=me){return se.workingToColorSpace(Ke.copy(this),t),Math.round(re(Ke.r*255,0,255))*65536+Math.round(re(Ke.g*255,0,255))*256+Math.round(re(Ke.b*255,0,255))}getHexString(t=me){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=se.workingColorSpace){se.workingToColorSpace(Ke.copy(this),e);let n=Ke.r,s=Ke.g,r=Ke.b,o=Math.max(n,s,r),a=Math.min(n,s,r),l,c,h=(a+o)/2;if(a===o)l=0,c=0;else{let d=o-a;switch(c=h<=.5?d/(o+a):d/(2-o-a),o){case n:l=(s-r)/d+(s0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,n,s,r){vn.subVectors(s,e),Qn.subVectors(n,e),Zl.subVectors(t,e);let o=vn.dot(vn),a=vn.dot(Qn),l=vn.dot(Zl),c=Qn.dot(Qn),h=Qn.dot(Zl),d=o*c-a*a;if(d===0)return r.set(0,0,0),null;let u=1/d,f=(c*l-a*h)*u,m=(o*h-a*l)*u;return r.set(1-f-m,m,f)}static containsPoint(t,e,n,s){return this.getBarycoord(t,e,n,s,ti)===null?!1:ti.x>=0&&ti.y>=0&&ti.x+ti.y<=1}static getInterpolation(t,e,n,s,r,o,a,l){return this.getBarycoord(t,e,n,s,ti)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,ti.x),l.addScaledVector(o,ti.y),l.addScaledVector(a,ti.z),l)}static getInterpolatedAttribute(t,e,n,s,r,o){return Ql.setScalar(0),tc.setScalar(0),ec.setScalar(0),Ql.fromBufferAttribute(t,e),tc.fromBufferAttribute(t,n),ec.fromBufferAttribute(t,s),o.setScalar(0),o.addScaledVector(Ql,r.x),o.addScaledVector(tc,r.y),o.addScaledVector(ec,r.z),o}static isFrontFacing(t,e,n,s){return vn.subVectors(n,e),Qn.subVectors(t,e),vn.cross(Qn).dot(s)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,s){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,n,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return vn.subVectors(this.c,this.b),Qn.subVectors(this.a,this.b),vn.cross(Qn).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return i.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return i.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,s,r){return i.getInterpolation(t,this.a,this.b,this.c,e,n,s,r)}containsPoint(t){return i.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return i.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,s=this.b,r=this.c,o,a;ss.subVectors(s,n),rs.subVectors(r,n),Kl.subVectors(t,n);let l=ss.dot(Kl),c=rs.dot(Kl);if(l<=0&&c<=0)return e.copy(n);Jl.subVectors(t,s);let h=ss.dot(Jl),d=rs.dot(Jl);if(h>=0&&d<=h)return e.copy(s);let u=l*d-h*c;if(u<=0&&l>=0&&h<=0)return o=l/(l-h),e.copy(n).addScaledVector(ss,o);jl.subVectors(t,r);let f=ss.dot(jl),m=rs.dot(jl);if(m>=0&&f<=m)return e.copy(r);let _=f*c-l*m;if(_<=0&&c>=0&&m<=0)return a=c/(c-m),e.copy(n).addScaledVector(rs,a);let g=h*m-f*d;if(g<=0&&d-h>=0&&f-m>=0)return Iu.subVectors(r,s),a=(d-h)/(d-h+(f-m)),e.copy(s).addScaledVector(Iu,a);let p=1/(g+_+u);return o=_*p,a=u*p,e.copy(n).addScaledVector(ss,o).addScaledVector(rs,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},ae=class{constructor(t=new C(1/0,1/0,1/0),e=new C(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,yn),yn.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Zs),ro.subVectors(this.max,Zs),os.subVectors(t.a,Zs),as.subVectors(t.b,Zs),ls.subVectors(t.c,Zs),mi.subVectors(as,os),gi.subVectors(ls,as),Di.subVectors(os,ls);let e=[0,-mi.z,mi.y,0,-gi.z,gi.y,0,-Di.z,Di.y,mi.z,0,-mi.x,gi.z,0,-gi.x,Di.z,0,-Di.x,-mi.y,mi.x,0,-gi.y,gi.x,0,-Di.y,Di.x,0];return!nc(e,os,as,ls,ro)||(e=[1,0,0,0,1,0,0,0,1],!nc(e,os,as,ls,ro))?!1:(oo.crossVectors(mi,gi),e=[oo.x,oo.y,oo.z],nc(e,os,as,ls,ro))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,yn).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(yn).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(ei[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ei[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ei[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ei[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ei[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ei[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ei[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ei[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ei),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},ei=[new C,new C,new C,new C,new C,new C,new C,new C],yn=new C,so=new ae,os=new C,as=new C,ls=new C,mi=new C,gi=new C,Di=new C,Zs=new C,ro=new C,oo=new C,Ni=new C;function nc(i,t,e,n,s){for(let r=0,o=i.length-3;r<=o;r+=3){Ni.fromArray(i,r);let a=s.x*Math.abs(Ni.x)+s.y*Math.abs(Ni.y)+s.z*Math.abs(Ni.z),l=t.dot(Ni),c=e.dot(Ni),h=n.dot(Ni);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}var Ne=new C,ao=new qt,Km=0,xe=class extends zn{constructor(t,e,n=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Km++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=Wc,this.updateRanges=[],this.gpuType=Ye,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let s=0,r=this.itemSize;sthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Ks.subVectors(t,this.center);let e=Ks.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),s=(n-this.radius)*.5;this.center.addScaledVector(Ks,s/n),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(ic.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Ks.copy(t.center).add(ic)),this.expandByPoint(Ks.copy(t.center).sub(ic))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},jm=0,fn=new Kt,sc=new Xe,cs=new C,an=new ae,Js=new ae,Ge=new C,he=class i extends zn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:jm++}),this.uuid=si(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(bm(t)?lr:ar)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new Jt().getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(t){return fn.makeRotationFromQuaternion(t),this.applyMatrix4(fn),this}rotateX(t){return fn.makeRotationX(t),this.applyMatrix4(fn),this}rotateY(t){return fn.makeRotationY(t),this.applyMatrix4(fn),this}rotateZ(t){return fn.makeRotationZ(t),this.applyMatrix4(fn),this}translate(t,e,n){return fn.makeTranslation(t,e,n),this.applyMatrix4(fn),this}scale(t,e,n){return fn.makeScale(t,e,n),this.applyMatrix4(fn),this}lookAt(t){return sc.lookAt(t),sc.updateMatrix(),this.applyMatrix4(sc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(cs).negate(),this.translate(cs.x,cs.y,cs.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let n=[];for(let s=0,r=t.length;se.count&&Wt("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ae);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){$t("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new C(-1/0,-1/0,-1/0),new C(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,s=e.length;n0&&(t.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let l in n){let c=n[l];t.data.attributes[l]=c.toJSON(t.data)}let s={},r=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],h=[];for(let d=0,u=c.length;d0&&(s[l]=h,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(t.data.boundingSphere=a.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone());let s=t.attributes;for(let c in s){let h=s[c];this.setAttribute(c,h.clone(e))}let r=t.morphAttributes;for(let c in r){let h=[],d=r[c];for(let u=0,f=d.length;u1)?null:e.copy(t.start).addScaledVector(s,o)}intersectsLine(t){let e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let n=e||tg.getNormalMatrix(t),s=this.coplanarPoint(rc).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(t){return this.normal.fromArray(t.normal),this.constant=t.constant,this}},eg=0,Sn=class extends zn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:eg++}),this.uuid=si(),this.name="",this.type="Material",this.blending=Ls,this.side=Yn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ec,this.blendDst=Tc,this.blendEquation=Wi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Vt(0,0,0),this.blendAlpha=0,this.depthFunc=_s,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Sd,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Io,this.stencilZFail=Io,this.stencilZPass=Io,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let n=t[e];if(n===void 0){Wt(`Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){Wt(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector2&&n&&n.isVector2||s&&s.isEuler&&n&&n.isEuler||s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(r=>r.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.wireframe!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function s(r){let o=[];for(let a in r){let l=r[a];delete l.metadata,o.push(l)}return o}if(e){let r=s(t.textures),o=s(t.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n}fromJSON(t,e){if(t.uuid!==void 0&&(this.uuid=t.uuid),t.name!==void 0&&(this.name=t.name),t.color!==void 0&&this.color!==void 0&&this.color.setHex(t.color),t.roughness!==void 0&&(this.roughness=t.roughness),t.metalness!==void 0&&(this.metalness=t.metalness),t.sheen!==void 0&&(this.sheen=t.sheen),t.sheenColor!==void 0&&(this.sheenColor=new Vt().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(this.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(t.emissive),t.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(t.specular),t.specularIntensity!==void 0&&(this.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(this.shininess=t.shininess),t.clearcoat!==void 0&&(this.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(this.dispersion=t.dispersion),t.retroreflectivity!==void 0&&(this.retroreflectivity=t.retroreflectivity),t.iridescence!==void 0&&(this.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(this.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(this.transmission=t.transmission),t.thickness!==void 0&&(this.thickness=t.thickness),t.attenuationDistance!==void 0&&(this.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(this.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(this.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(this.fog=t.fog),t.flatShading!==void 0&&(this.flatShading=t.flatShading),t.blending!==void 0&&(this.blending=t.blending),t.combine!==void 0&&(this.combine=t.combine),t.side!==void 0&&(this.side=t.side),t.shadowSide!==void 0&&(this.shadowSide=t.shadowSide),t.opacity!==void 0&&(this.opacity=t.opacity),t.transparent!==void 0&&(this.transparent=t.transparent),t.alphaTest!==void 0&&(this.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(this.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(this.depthFunc=t.depthFunc),t.depthTest!==void 0&&(this.depthTest=t.depthTest),t.depthWrite!==void 0&&(this.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(this.colorWrite=t.colorWrite),t.clippingPlanes!==void 0&&(this.clippingPlanes=t.clippingPlanes.map(n=>new Ae().fromJSON(n))),t.clipIntersection!==void 0&&(this.clipIntersection=t.clipIntersection),t.clipShadows!==void 0&&(this.clipShadows=t.clipShadows),t.depthPacking!==void 0&&(this.depthPacking=t.depthPacking),t.blendSrc!==void 0&&(this.blendSrc=t.blendSrc),t.blendDst!==void 0&&(this.blendDst=t.blendDst),t.blendEquation!==void 0&&(this.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(this.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(this.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(this.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(this.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(this.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(this.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(this.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(this.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(this.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(this.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(this.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(this.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(this.rotation=t.rotation),t.linewidth!==void 0&&(this.linewidth=t.linewidth),t.linecap!==void 0&&(this.linecap=t.linecap),t.linejoin!==void 0&&(this.linejoin=t.linejoin),t.dashSize!==void 0&&(this.dashSize=t.dashSize),t.gapSize!==void 0&&(this.gapSize=t.gapSize),t.scale!==void 0&&(this.scale=t.scale),t.polygonOffset!==void 0&&(this.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(this.dithering=t.dithering),t.alphaToCoverage!==void 0&&(this.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(this.forceSinglePass=t.forceSinglePass),t.allowOverride!==void 0&&(this.allowOverride=t.allowOverride),t.visible!==void 0&&(this.visible=t.visible),t.toneMapped!==void 0&&(this.toneMapped=t.toneMapped),t.userData!==void 0&&(this.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?this.vertexColors=t.vertexColors>0:this.vertexColors=t.vertexColors),t.size!==void 0&&(this.size=t.size),t.sizeAttenuation!==void 0&&(this.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(this.map=e[t.map]||null),t.matcap!==void 0&&(this.matcap=e[t.matcap]||null),t.alphaMap!==void 0&&(this.alphaMap=e[t.alphaMap]||null),t.bumpMap!==void 0&&(this.bumpMap=e[t.bumpMap]||null),t.bumpScale!==void 0&&(this.bumpScale=t.bumpScale),t.normalMap!==void 0&&(this.normalMap=e[t.normalMap]||null),t.normalMapType!==void 0&&(this.normalMapType=t.normalMapType),t.normalScale!==void 0){let n=t.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new qt().fromArray(n)}return t.displacementMap!==void 0&&(this.displacementMap=e[t.displacementMap]||null),t.displacementScale!==void 0&&(this.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(this.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(this.roughnessMap=e[t.roughnessMap]||null),t.metalnessMap!==void 0&&(this.metalnessMap=e[t.metalnessMap]||null),t.emissiveMap!==void 0&&(this.emissiveMap=e[t.emissiveMap]||null),t.emissiveIntensity!==void 0&&(this.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(this.specularMap=e[t.specularMap]||null),t.specularIntensityMap!==void 0&&(this.specularIntensityMap=e[t.specularIntensityMap]||null),t.specularColorMap!==void 0&&(this.specularColorMap=e[t.specularColorMap]||null),t.envMap!==void 0&&(this.envMap=e[t.envMap]||null),t.envMapRotation!==void 0&&this.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(this.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(this.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(this.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(this.lightMap=e[t.lightMap]||null),t.lightMapIntensity!==void 0&&(this.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(this.aoMap=e[t.aoMap]||null),t.aoMapIntensity!==void 0&&(this.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(this.gradientMap=e[t.gradientMap]||null),t.clearcoatMap!==void 0&&(this.clearcoatMap=e[t.clearcoatMap]||null),t.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=e[t.clearcoatRoughnessMap]||null),t.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=e[t.clearcoatNormalMap]||null),t.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new qt().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(this.iridescenceMap=e[t.iridescenceMap]||null),t.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=e[t.iridescenceThicknessMap]||null),t.transmissionMap!==void 0&&(this.transmissionMap=e[t.transmissionMap]||null),t.thicknessMap!==void 0&&(this.thicknessMap=e[t.thicknessMap]||null),t.anisotropyMap!==void 0&&(this.anisotropyMap=e[t.anisotropyMap]||null),t.sheenColorMap!==void 0&&(this.sheenColorMap=e[t.sheenColorMap]||null),t.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=e[t.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,n=null;if(e!==null){let s=e.length;n=new Array(s);for(let r=0;r!==s;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}};var ni=new C,oc=new C,lo=new C,co=new C,Oi=class{constructor(t=new C,e=new C(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ni)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=ni.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ni.copy(this.origin).addScaledVector(this.direction,e),ni.distanceToSquared(t))}distanceSqToSegment(t,e,n,s){oc.copy(t).add(e).multiplyScalar(.5),lo.copy(e).sub(t).normalize(),co.copy(this.origin).sub(oc);let r=t.distanceTo(e)*.5,o=-this.direction.dot(lo),a=co.dot(this.direction),l=-co.dot(lo),c=co.lengthSq(),h=Math.abs(1-o*o),d,u,f,m;if(h>0)if(d=o*l-a,u=o*a-l,m=r*h,d>=0)if(u>=-m)if(u<=m){let _=1/h;d*=_,u*=_,f=d*(d+o*u+2*a)+u*(o*d+u+2*l)+c}else u=r,d=Math.max(0,-(o*u+a)),f=-d*d+u*(u+2*l)+c;else u=-r,d=Math.max(0,-(o*u+a)),f=-d*d+u*(u+2*l)+c;else u<=-m?(d=Math.max(0,-(-o*r+a)),u=d>0?-r:Math.min(Math.max(-r,-l),r),f=-d*d+u*(u+2*l)+c):u<=m?(d=0,u=Math.min(Math.max(-r,-l),r),f=u*(u+2*l)+c):(d=Math.max(0,-(o*r+a)),u=d>0?r:Math.min(Math.max(-r,-l),r),f=-d*d+u*(u+2*l)+c);else u=o>0?-r:r,d=Math.max(0,-(o*u+a)),f=-d*d+u*(u+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),s&&s.copy(oc).addScaledVector(lo,u),f}intersectSphere(t,e){if(t.radius<0)return null;ni.subVectors(t.center,this.origin);let n=ni.dot(this.direction),s=ni.dot(ni)-n*n,r=t.radius*t.radius;if(s>r)return null;let o=Math.sqrt(r-s),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,e):this.at(a,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){let n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,s,r,o,a,l,c=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,u=this.origin;return c>=0?(n=(t.min.x-u.x)*c,s=(t.max.x-u.x)*c):(n=(t.max.x-u.x)*c,s=(t.min.x-u.x)*c),h>=0?(r=(t.min.y-u.y)*h,o=(t.max.y-u.y)*h):(r=(t.max.y-u.y)*h,o=(t.min.y-u.y)*h),n>o||r>s||((r>n||isNaN(n))&&(n=r),(o=0?(a=(t.min.z-u.z)*d,l=(t.max.z-u.z)*d):(a=(t.max.z-u.z)*d,l=(t.min.z-u.z)*d),n>l||a>s)||((a>n||n!==n)&&(n=a),(l=0?n:s,e)}intersectsBox(t){return this.intersectBox(t,ni)!==null}intersectTriangle(t,e,n,s,r){let o=this.origin,a=this.direction,l=a.x,c=a.y,h=a.z,d=t.x-o.x,u=t.y-o.y,f=t.z-o.z,m=e.x-o.x,_=e.y-o.y,g=e.z-o.z,p=n.x-o.x,y=n.y-o.y,w=n.z-o.z,M=Math.abs(l),x=Math.abs(c),S=Math.abs(h),A,v,E,R,L,N,B,D,F,H,V,z;if(M>=x&&M>=S?(E=l,N=d,F=m,z=p,l>=0?(A=c,v=h,R=u,L=f,B=_,D=g,H=y,V=w):(A=h,v=c,R=f,L=u,B=g,D=_,H=w,V=y)):x>=S?(E=c,N=u,F=_,z=y,c>=0?(A=h,v=l,R=f,L=d,B=g,D=m,H=w,V=p):(A=l,v=h,R=d,L=f,B=m,D=g,H=p,V=w)):(E=h,N=f,F=g,z=w,h>=0?(A=l,v=c,R=d,L=u,B=m,D=_,H=p,V=y):(A=c,v=l,R=u,L=d,B=_,D=m,H=y,V=p)),E===0)return null;let U=A/E,k=v/E,Y=1/E,G=R-U*N,J=L-k*N,it=B-U*F,nt=D-k*F,at=H-U*z,O=V-k*z,$=at*nt-O*it,rt=G*O-J*at,mt=it*J-nt*G;if(s){if($<0||rt<0||mt<0)return null}else if(($<0||rt<0||mt<0)&&($>0||rt>0||mt>0))return null;let ht=$+rt+mt;if(ht===0)return null;let Et=Y*($*N+rt*F+mt*z);return(ht>0?Et<0:Et>0)?null:this.at(Et/ht,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Je=class extends Sn{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Vt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new kn,this.combine=Mr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},Pu=new Kt,Ui=new Oi,ho=new Oe,Lu=new C,uo=new C,fo=new C,po=new C,ac=new C,mo=new C,Du=new C,go=new C,ge=class extends Xe{constructor(t=new he,e=new Je){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r(t.far-t.near)**2))&&(Pu.copy(r).invert(),Ui.copy(t.ray).applyMatrix4(Pu),!(n.boundingBox!==null&&Ui.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,Ui)))}_computeIntersections(t,e,n){let s,r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,c=r.attributes.uv,h=r.attributes.uv1,d=r.attributes.normal,u=r.groups,f=r.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,_=u.length;m<_;m++){let g=u[m],p=o[g.materialIndex],y=Math.max(g.start,f.start),w=Math.min(a.count,Math.min(g.start+g.count,f.start+f.count));for(let M=y,x=w;Me.far?null:{distance:c,point:go.clone(),object:i}}function _o(i,t,e,n,s,r,o,a,l,c){i.getVertexPosition(a,uo),i.getVertexPosition(l,fo),i.getVertexPosition(c,po);let h=ng(i,t,e,n,uo,fo,po,Du);if(h){let d=new C;ii.getBarycoord(Du,uo,fo,po,d),s&&(h.uv=ii.getInterpolatedAttribute(s,a,l,c,d,new qt)),r&&(h.uv1=ii.getInterpolatedAttribute(r,a,l,c,d,new qt)),o&&(h.normal=ii.getInterpolatedAttribute(o,a,l,c,d,new C),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let u={a,b:l,c,normal:new C,materialIndex:0};ii.getNormal(uo,fo,po,u.normal),h.face=u,h.barycoord=d}return h}var mn=class extends We{constructor(t=null,e=1,n=1,s,r,o,a,l,c=Le,h=Le,d,u){super(null,o,a,l,c,h,s,r,d,u),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var oi=class extends xe{constructor(t,e,n,s=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){let t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}},hs=new Kt,Nu=new Kt,xo=[],Uu=new ae,ig=new Kt,js=new ge,Qs=new Oe,xi=class extends ge{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new oi(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s0?t.max.x:t.min.x,vo.y=s.normal.y>0?t.max.y:t.min.y,vo.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(vo)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};var sn=class extends Sn{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Vt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}},Xo=new C,qo=new C,Fu=new Kt,tr=new Oi,yo=new Oe,lc=new C,Bu=new C,zi=class extends Xe{constructor(t=new he,e=new sn){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[0];for(let s=1,r=e.count;s0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rn)return;lc.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(lc);if(!(ct.far))return{distance:c,point:Bu.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var Ou=new C,zu=new C,ln=class extends zi{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[];for(let s=0,r=e.count;s0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rs.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var cr=class extends We{constructor(t=[],e=bi,n,s,r,o,a,l,c,h){super(t,e,n,s,r,o,a,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},hr=class extends We{constructor(t,e,n,s,r,o,a,l,c){super(t,e,n,s,r,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}};var Gn=class extends We{constructor(t,e,n=Tn,s,r,o,a=Le,l=Le,c,h=On,d=1){if(h!==On&&h!==wi)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let u={width:t,height:e,depth:d};super(u,s,r,o,a,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new Ss(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return e.compareFunction=this.compareFunction,e}},Yo=class extends Gn{constructor(t,e=Tn,n=bi,s,r,o=Le,a=Le,l,c=On){let h={width:t,height:t,depth:1},d=[h,h,h,h,h,h];super(t,t,e,n,s,r,o,a,l,c),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}},ur=class extends We{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}},gn=class i extends he{constructor(t=1,e=1,n=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:s,heightSegments:r,depthSegments:o};let a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);let l=[],c=[],h=[],d=[],u=0,f=0;m("z","y","x",-1,-1,n,e,t,o,r,0),m("z","y","x",1,-1,n,e,-t,o,r,1),m("x","z","y",1,1,t,n,e,s,o,2),m("x","z","y",1,-1,t,n,-e,s,o,3),m("x","y","z",1,-1,t,e,n,s,r,4),m("x","y","z",-1,-1,t,e,-n,s,r,5),this.setIndex(l),this.setAttribute("position",new we(c,3)),this.setAttribute("normal",new we(h,3)),this.setAttribute("uv",new we(d,2));function m(_,g,p,y,w,M,x,S,A,v,E){let R=M/A,L=x/v,N=M/2,B=x/2,D=S/2,F=A+1,H=v+1,V=0,z=0,U=new C;for(let k=0;k0?1:-1,h.push(U.x,U.y,U.z),d.push(G/A),d.push(1-k/v),V+=1}}for(let k=0;k0&&w(!0),e>0&&w(!1)),this.setIndex(h),this.setAttribute("position",new we(d,3)),this.setAttribute("normal",new we(u,3)),this.setAttribute("uv",new we(f,2));function y(){let M=new C,x=new C,S=0,A=(e-t)/n;for(let v=0;v<=r;v++){let E=[],R=v/r,L=R*(e-t)+t;for(let N=0;N<=s;N++){let B=N/s,D=B*l+a,F=Math.sin(D),H=Math.cos(D);x.x=L*F,x.y=-R*n+g,x.z=L*H,d.push(x.x,x.y,x.z),M.set(F,A,H).normalize(),u.push(M.x,M.y,M.z),f.push(B,1-R),E.push(m++)}_.push(E)}for(let v=0;v0||E!==0)&&(h.push(R,L,B),S+=3),(e>0||E!==r-1)&&(h.push(L,N,B),S+=3)}c.addGroup(p,S,0),p+=S}function w(M){let x=m,S=new qt,A=new C,v=0,E=M===!0?t:e,R=M===!0?1:-1;for(let N=1;N<=s;N++)d.push(0,g*R,0),u.push(0,R,0),f.push(.5,.5),m++;let L=m;for(let N=0;N<=s;N++){let D=N/s*l+a,F=Math.cos(D),H=Math.sin(D);A.x=E*H,A.y=g*R,A.z=E*F,d.push(A.x,A.y,A.z),u.push(0,R,0),S.x=F*.5+.5,S.y=H*.5*R+.5,f.push(S.x,S.y),m++}for(let N=0;N0)&&f.push(w,M,S),(p!==n-1||l{var vu=i=>{throw TypeError(i)};var Vl=(i,e,t)=>e.has(i)||vu("Cannot "+t);var di=(i,e,t)=>(Vl(i,e,"read from private field"),t?t.call(i):e.get(i)),Gl=(i,e,t)=>e.has(i)?vu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),yu=(i,e,t,n)=>(Vl(i,e,"write to private field"),n?n.call(i,t):e.set(i,t),t),to=(i,e,t)=>(Vl(i,e,"access private method"),t);var ed=0,Mc=1,td=2;var br=1,nd=2,Ps=3,Yn=0,zt=1,kt=2,$n=0,Ls=1,Sc=2,wc=3,Ec=4,id=5;var Wi=100,sd=101,rd=102,od=103,ad=104,ld=200,cd=201,hd=202,ud=203,Tc=204,Ac=205,dd=206,fd=207,pd=208,md=209,gd=210,_d=211,xd=212,vd=213,yd=214,Do=0,No=1,Uo=2,_s=3,Fo=4,Bo=5,Oo=6,zo=7,Mr=0,bd=1,Md=2,Tn=0,Rc=1,Cc=2,Ic=3,Pc=4,Lc=5,Dc=6,Nc=7;var Uc=300,Mi=301,Xi=302,da=303,fa=304,Sr=306,xs=1e3,Bn=1001,ko=1002,Lt=1003,Sd=1004;var wr=1005;var qt=1006,pa=1007;var Si=1008;var rn=1009,Fc=1010,Bc=1011,Ds=1012,ma=1013,An=1014,Yt=1015,Rn=1016,ga=1017,_a=1018,Ns=1020,Oc=35902,zc=35899,kc=1021,Hc=1022,jt=1023,On=1026,wi=1027,Us=1028,xa=1029,Ei=1030,va=1031;var ya=1033,Er=33776,Tr=33777,Ar=33778,Rr=33779,ba=35840,Ma=35841,Sa=35842,wa=35843,Ea=36196,Ta=37492,Aa=37496,Ra=37488,Ca=37489,Cr=37490,Ia=37491,Pa=37808,La=37809,Da=37810,Na=37811,Ua=37812,Fa=37813,Ba=37814,Oa=37815,za=37816,ka=37817,Ha=37818,Va=37819,Ga=37820,Wa=37821,Xa=36492,qa=36494,Ya=36495,$a=36283,Za=36284,Ir=36285,Ka=36286;var ir=2300,Ho=2301,Io=2302,fc=2303,pc=2400,mc=2401,gc=2402;var wd=3200;var Pr=0,Ed=1,ai="",mt="srgb",sr="srgb-linear",rr="linear",ft="srgb";var Po=7680;var Vc=34055,Gc=34056;var Wc=517;var Td=519,Ad=512,Rd=513,Cd=514,Ja=515,Id=516,Pd=517,ja=518,Ld=519,Xc=35044,Lr=35048;var qc="300 es",Sn=2e3,vs=2001;function Um(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Fm(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function ys(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Dd(){let i=ys("canvas");return i.style.display="block",i}var bu={},bs=null;function or(...i){let e="THREE."+i.shift();bs?bs("log",e,...i):console.log(e,...i)}function Nd(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function We(...i){i=Nd(i);let e="THREE."+i.shift();if(bs)bs("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function $e(...i){i=Nd(i);let e="THREE."+i.shift();if(bs)bs("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Bi(...i){let e=i.join(" ");e in bu||(bu[e]=!0,We(...i))}function Ud(i,e,t){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}var Fd={[Do]:No,[Uo]:Oo,[Fo]:zo,[_s]:Bo,[No]:Do,[Oo]:Uo,[zo]:Fo,[Bo]:_s},zn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let s=n[e];if(s!==void 0){let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let s=n.slice(0);for(let r=0,o=s.length;r>8&255]+Zt[i>>16&255]+Zt[i>>24&255]+"-"+Zt[e&255]+Zt[e>>8&255]+"-"+Zt[e>>16&15|64]+Zt[e>>24&255]+"-"+Zt[t&63|128]+Zt[t>>8&255]+"-"+Zt[t>>16&255]+Zt[t>>24&255]+Zt[n&255]+Zt[n>>8&255]+Zt[n>>16&255]+Zt[n>>24&255]).toLowerCase()}function rt(i,e,t){return Math.max(e,Math.min(t,i))}function Yc(i,e){return(i%e+e)%e}function Bm(i,e,t,n,s){return n+(i-e)*(s-n)/(t-e)}function Om(i,e,t){return i!==e?(t-i)/(e-i):0}function nr(i,e,t){return(1-t)*i+t*e}function zm(i,e,t,n){return nr(i,e,1-Math.exp(-t*n))}function km(i,e=1){return e-Math.abs(Yc(i,e*2)-e)}function Hm(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Vm(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Gm(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Wm(i,e){return i+Math.random()*(e-i)}function Xm(i){return i*(.5-Math.random())}function qm(i){i!==void 0&&(Mu=i);let e=Mu+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Ym(i){return i*ms}function $m(i){return i*Ms}function Zm(i){return i>0&&Number.isInteger(i)&&2**Math.round(Math.log2(i))===i}function Km(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Jm(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function jm(i,e,t,n,s){let r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),c=r((e+n)/2),h=o((e+n)/2),d=r((e-n)/2),u=o((e-n)/2),f=r((n-e)/2),m=o((n-e)/2);switch(s){case"XYX":i.set(a*h,l*d,l*u,a*c);break;case"YZY":i.set(l*u,a*h,l*d,a*c);break;case"ZXZ":i.set(l*d,l*u,a*h,a*c);break;case"XZX":i.set(a*h,l*m,l*f,a*c);break;case"YXY":i.set(l*f,a*h,l*m,a*c);break;case"ZYZ":i.set(l*m,l*f,a*h,a*c);break;default:We("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function Mn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:case Uint8ClampedArray:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function pt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var lt={DEG2RAD:ms,RAD2DEG:Ms,generateUUID:si,clamp:rt,euclideanModulo:Yc,mapLinear:Bm,inverseLerp:Om,lerp:nr,damp:zm,pingpong:km,smoothstep:Hm,smootherstep:Vm,randInt:Gm,randFloat:Wm,randFloatSpread:Xm,seededRandom:qm,degToRad:Ym,radToDeg:$m,isPowerOfTwo:Zm,ceilPowerOfTwo:Km,floorPowerOfTwo:Jm,setQuaternionFromProperEuler:jm,normalize:pt,denormalize:Mn},jc=class jc{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6],this.y=s[1]*t+s[4]*n+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=rt(this.x,e.x,t.x),this.y=rt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=rt(this.x,e,t),this.y=rt(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(rt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(rt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*s+e.x,this.y=r*s+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};jc.prototype.isVector2=!0;var qe=jc,Ft=class{constructor(e=0,t=0,n=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=s}static slerpFlat(e,t,n,s,r,o,a){let l=n[s+0],c=n[s+1],h=n[s+2],d=n[s+3],u=r[o+0],f=r[o+1],m=r[o+2],_=r[o+3];if(d!==_||l!==u||c!==f||h!==m){let g=l*u+c*f+h*m+d*_;g<0&&(u=-u,f=-f,m=-m,_=-_,g=-g);let p=1-a;if(g<.9995){let y=Math.acos(g),w=Math.sin(y);p=Math.sin(p*y)/w,a=Math.sin(a*y)/w,l=l*p+u*a,c=c*p+f*a,h=h*p+m*a,d=d*p+_*a}else{l=l*p+u*a,c=c*p+f*a,h=h*p+m*a,d=d*p+_*a;let y=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=y,c*=y,h*=y,d*=y}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,s,r,o){let a=n[s],l=n[s+1],c=n[s+2],h=n[s+3],d=r[o],u=r[o+1],f=r[o+2],m=r[o+3];return e[t]=a*m+h*d+l*f-c*u,e[t+1]=l*m+h*u+c*d-a*f,e[t+2]=c*m+h*f+a*u-l*d,e[t+3]=h*m-a*d-l*u-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,s){return this._x=e,this._y=t,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),h=a(s/2),d=a(r/2),u=l(n/2),f=l(s/2),m=l(r/2);switch(o){case"XYZ":this._x=u*h*d+c*f*m,this._y=c*f*d-u*h*m,this._z=c*h*m+u*f*d,this._w=c*h*d-u*f*m;break;case"YXZ":this._x=u*h*d+c*f*m,this._y=c*f*d-u*h*m,this._z=c*h*m-u*f*d,this._w=c*h*d+u*f*m;break;case"ZXY":this._x=u*h*d-c*f*m,this._y=c*f*d+u*h*m,this._z=c*h*m+u*f*d,this._w=c*h*d-u*f*m;break;case"ZYX":this._x=u*h*d-c*f*m,this._y=c*f*d+u*h*m,this._z=c*h*m-u*f*d,this._w=c*h*d+u*f*m;break;case"YZX":this._x=u*h*d+c*f*m,this._y=c*f*d+u*h*m,this._z=c*h*m-u*f*d,this._w=c*h*d-u*f*m;break;case"XZY":this._x=u*h*d-c*f*m,this._y=c*f*d-u*h*m,this._z=c*h*m+u*f*d,this._w=c*h*d+u*f*m;break;default:We("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,s=Math.sin(n);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],s=t[4],r=t[8],o=t[1],a=t[5],l=t[9],c=t[2],h=t[6],d=t[10],u=n+a+d;if(u>0){let f=.5/Math.sqrt(u+1);this._w=.25/f,this._x=(h-l)*f,this._y=(r-c)*f,this._z=(o-s)*f}else if(n>a&&n>d){let f=2*Math.sqrt(1+n-a-d);this._w=(h-l)/f,this._x=.25*f,this._y=(s+o)/f,this._z=(r+c)/f}else if(a>d){let f=2*Math.sqrt(1+a-n-d);this._w=(r-c)/f,this._x=(s+o)/f,this._y=.25*f,this._z=(l+h)/f}else{let f=2*Math.sqrt(1+d-n-a);this._w=(o-s)/f,this._x=(r+c)/f,this._y=(l+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(rt(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let s=Math.min(1,t/n);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,s=e._y,r=e._z,o=e._w,a=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+o*a+s*c-r*l,this._y=s*h+o*l+r*a-n*c,this._z=r*h+o*c+n*l-s*a,this._w=o*h-n*a-s*l-r*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,s=e._y,r=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,s=-s,r=-r,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),h=Math.sin(c);l=Math.sin(l*c)/h,t=Math.sin(t*c)/h,this._x=this._x*l+n*t,this._y=this._y*l+s*t,this._z=this._z*l+r*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+s*t,this._z=this._z*l+r*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Qc=class Qc{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Su.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Su.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*s,this.y=r[1]*t+r[4]*n+r[7]*s,this.z=r[2]*t+r[5]*n+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*n+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*s+r[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,s=this.z,r=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*s-a*n),h=2*(a*t-r*s),d=2*(r*n-o*t);return this.x=t+l*c+o*d-a*h,this.y=n+l*h+a*c-r*d,this.z=s+l*d+r*h-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*s,this.y=r[1]*t+r[5]*n+r[9]*s,this.z=r[2]*t+r[6]*n+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=rt(this.x,e.x,t.x),this.y=rt(this.y,e.y,t.y),this.z=rt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=rt(this.x,e,t),this.y=rt(this.y,e,t),this.z=rt(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(rt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*o-n*l,this.z=n*a-s*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Wl.copy(this).projectOnVector(e),this.sub(Wl)}reflect(e){return this.sub(Wl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(rt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,s=this.z-e.z;return t*t+n*n+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let s=Math.sin(t)*e;return this.x=s*Math.sin(n),this.y=Math.cos(t)*e,this.z=s*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Qc.prototype.isVector3=!0;var C=Qc,Wl=new C,Su=new Ft,eh=class eh{constructor(e,t,n,s,r,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,s,r,o,a,l,c)}set(e,t,n,s,r,o,a,l,c){let h=this.elements;return h[0]=e,h[1]=s,h[2]=a,h[3]=t,h[4]=r,h[5]=l,h[6]=n,h[7]=o,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,s=t.elements,r=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],h=n[4],d=n[7],u=n[2],f=n[5],m=n[8],_=s[0],g=s[3],p=s[6],y=s[1],w=s[4],b=s[7],x=s[2],S=s[5],A=s[8];return r[0]=o*_+a*y+l*x,r[3]=o*g+a*w+l*S,r[6]=o*p+a*b+l*A,r[1]=c*_+h*y+d*x,r[4]=c*g+h*w+d*S,r[7]=c*p+h*b+d*A,r[2]=u*_+f*y+m*x,r[5]=u*g+f*w+m*S,r[8]=u*p+f*b+m*A,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8];return t*o*h-t*a*c-n*r*h+n*a*l+s*r*c-s*o*l}invert(){let e=this.elements,t=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],d=h*o-a*c,u=a*l-h*r,f=c*r-o*l,m=t*d+n*u+s*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let _=1/m;return e[0]=d*_,e[1]=(s*c-h*n)*_,e[2]=(a*n-s*o)*_,e[3]=u*_,e[4]=(h*t-s*l)*_,e[5]=(s*r-a*t)*_,e[6]=f*_,e[7]=(n*l-c*t)*_,e[8]=(o*t-n*r)*_,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,s,r,o,a){let l=Math.cos(r),c=Math.sin(r);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-s*c,s*l,-s*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return Bi("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Xl.makeScale(e,t)),this}rotate(e){return Bi("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Xl.makeRotation(-e)),this}translate(e,t){return Bi("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Xl.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let s=0;s<9;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};eh.prototype.isMatrix3=!0;var Je=eh,Xl=new Je,wu=new Je().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Eu=new Je().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Qm(){let i={enabled:!0,workingColorSpace:sr,spaces:{},convert:function(s,r,o){return this.enabled===!1||r===o||!r||!o||(this.spaces[r].transfer===ft&&(s.r=ri(s.r),s.g=ri(s.g),s.b=ri(s.b)),this.spaces[r].primaries!==this.spaces[o].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===ft&&(s.r=gs(s.r),s.g=gs(s.g),s.b=gs(s.b))),s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===ai?rr:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,o){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,r){return Bi("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return Bi("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(s,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[sr]:{primaries:e,whitePoint:n,transfer:rr,toXYZ:wu,fromXYZ:Eu,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:mt},outputColorSpaceConfig:{drawingBufferColorSpace:mt}},[mt]:{primaries:e,whitePoint:n,transfer:ft,toXYZ:wu,fromXYZ:Eu,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:mt}}}),i}var st=Qm();function ri(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function gs(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var es,Vo=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{es===void 0&&(es=ys("canvas")),es.width=e.width,es.height=e.height;let s=es.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),n=es}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=ys("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let s=n.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Yl).x}get height(){return this.source.getSize(Yl).y}get depth(){return this.source.getSize(Yl).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){We(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let s=this[t];if(s===void 0){We(`Texture.setValues(): property '${t}' does not exist.`);continue}s&&n&&s.isVector2&&n.isVector2||s&&n&&s.isVector3&&n.isVector3||s&&n&&s.isMatrix3&&n.isMatrix3?s.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Uc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case xs:e.x=e.x-Math.floor(e.x);break;case Bn:e.x=e.x<0?0:1;break;case ko:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case xs:e.y=e.y-Math.floor(e.y);break;case Bn:e.y=e.y<0?0:1;break;case ko:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Wt.DEFAULT_IMAGE=null;Wt.DEFAULT_MAPPING=Uc;Wt.DEFAULT_ANISOTROPY=1;var th=class th{constructor(e=0,t=0,n=0,s=1){this.x=e,this.y=t,this.z=n,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,s){return this.x=e,this.y=t,this.z=n,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*s+o[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,s,r,l=e.elements,c=l[0],h=l[4],d=l[8],u=l[1],f=l[5],m=l[9],_=l[2],g=l[6],p=l[10];if(Math.abs(h-u)<.01&&Math.abs(d-_)<.01&&Math.abs(m-g)<.01){if(Math.abs(h+u)<.1&&Math.abs(d+_)<.1&&Math.abs(m+g)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let w=(c+1)/2,b=(f+1)/2,x=(p+1)/2,S=(h+u)/4,A=(d+_)/4,v=(m+g)/4;return w>b&&w>x?w<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(w),s=S/n,r=A/n):b>x?b<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(b),n=S/s,r=v/s):x<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(x),n=A/r,s=v/r),this.set(n,s,r,t),this}let y=Math.sqrt((g-m)*(g-m)+(d-_)*(d-_)+(u-h)*(u-h));return Math.abs(y)<.001&&(y=1),this.x=(g-m)/y,this.y=(d-_)/y,this.z=(u-h)/y,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=rt(this.x,e.x,t.x),this.y=rt(this.y,e.y,t.y),this.z=rt(this.z,e.z,t.z),this.w=rt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=rt(this.x,e,t),this.y=rt(this.y,e,t),this.z=rt(this.z,e,t),this.w=rt(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(rt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};th.prototype.isVector4=!0;var vt=th,Go=class extends zn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:qt,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new vt(0,0,e,t),this.scissorTest=!1,this.viewport=new vt(0,0,e,t),this.textures=[];let s={width:e,height:t,depth:n.depth},r=new Wt(s),o=n.count;for(let a=0;a1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.pivot!==null&&(s.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(a=>({...a})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),d.length>0&&(n.shapes=d),u.length>0&&(n.skeletons=u),f.length>0&&(n.animations=f),m.length>0&&(n.nodes=m)}return n.object=s,n;function o(a){let l=[];for(let c in a){let h=a[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nf+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&u<=f-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(s=t.getPose(e.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(lg)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Rt;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},Bd={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},pi={h:0,s:0,l:0},so={h:0,s:0,l:0};function Zl(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var Ve=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=mt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,st.colorSpaceToWorking(this,t),this}setRGB(e,t,n,s=st.workingColorSpace){return this.r=e,this.g=t,this.b=n,st.colorSpaceToWorking(this,s),this}setHSL(e,t,n,s=st.workingColorSpace){if(e=Yc(e,1),t=rt(t,0,1),n=rt(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,o=2*n-r;this.r=Zl(o,r,e+1/3),this.g=Zl(o,r,e),this.b=Zl(o,r,e-1/3)}return st.colorSpaceToWorking(this,s),this}setStyle(e,t=mt){function n(r){r!==void 0&&parseFloat(r)<1&&We("Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:We("Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);We("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=mt){let n=Bd[e.toLowerCase()];return n!==void 0?this.setHex(n,t):We("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ri(e.r),this.g=ri(e.g),this.b=ri(e.b),this}copyLinearToSRGB(e){return this.r=gs(e.r),this.g=gs(e.g),this.b=gs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=mt){return st.workingToColorSpace(Kt.copy(this),e),Math.round(rt(Kt.r*255,0,255))*65536+Math.round(rt(Kt.g*255,0,255))*256+Math.round(rt(Kt.b*255,0,255))}getHexString(e=mt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=st.workingColorSpace){st.workingToColorSpace(Kt.copy(this),t);let n=Kt.r,s=Kt.g,r=Kt.b,o=Math.max(n,s,r),a=Math.min(n,s,r),l,c,h=(a+o)/2;if(a===o)l=0,c=0;else{let d=o-a;switch(c=h<=.5?d/(o+a):d/(2-o-a),o){case n:l=(s-r)/d+(s0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,n,s,r){yn.subVectors(s,t),Qn.subVectors(n,t),Kl.subVectors(e,t);let o=yn.dot(yn),a=yn.dot(Qn),l=yn.dot(Kl),c=Qn.dot(Qn),h=Qn.dot(Kl),d=o*c-a*a;if(d===0)return r.set(0,0,0),null;let u=1/d,f=(c*l-a*h)*u,m=(o*h-a*l)*u;return r.set(1-f-m,m,f)}static containsPoint(e,t,n,s){return this.getBarycoord(e,t,n,s,ei)===null?!1:ei.x>=0&&ei.y>=0&&ei.x+ei.y<=1}static getInterpolation(e,t,n,s,r,o,a,l){return this.getBarycoord(e,t,n,s,ei)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,ei.x),l.addScaledVector(o,ei.y),l.addScaledVector(a,ei.z),l)}static getInterpolatedAttribute(e,t,n,s,r,o){return ec.setScalar(0),tc.setScalar(0),nc.setScalar(0),ec.fromBufferAttribute(e,t),tc.fromBufferAttribute(e,n),nc.fromBufferAttribute(e,s),o.setScalar(0),o.addScaledVector(ec,r.x),o.addScaledVector(tc,r.y),o.addScaledVector(nc,r.z),o}static isFrontFacing(e,t,n,s){return yn.subVectors(n,t),Qn.subVectors(e,t),yn.cross(Qn).dot(s)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,s){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,n,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return yn.subVectors(this.c,this.b),Qn.subVectors(this.a,this.b),yn.cross(Qn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,s,r){return i.getInterpolation(e,this.a,this.b,this.c,t,n,s,r)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,s=this.b,r=this.c,o,a;ss.subVectors(s,n),rs.subVectors(r,n),Jl.subVectors(e,n);let l=ss.dot(Jl),c=rs.dot(Jl);if(l<=0&&c<=0)return t.copy(n);jl.subVectors(e,s);let h=ss.dot(jl),d=rs.dot(jl);if(h>=0&&d<=h)return t.copy(s);let u=l*d-h*c;if(u<=0&&l>=0&&h<=0)return o=l/(l-h),t.copy(n).addScaledVector(ss,o);Ql.subVectors(e,r);let f=ss.dot(Ql),m=rs.dot(Ql);if(m>=0&&f<=m)return t.copy(r);let _=f*c-l*m;if(_<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(n).addScaledVector(rs,a);let g=h*m-f*d;if(g<=0&&d-h>=0&&f-m>=0)return Du.subVectors(r,s),a=(d-h)/(d-h+(f-m)),t.copy(s).addScaledVector(Du,a);let p=1/(g+_+u);return o=_*p,a=u*p,t.copy(n).addScaledVector(ss,o).addScaledVector(rs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},at=class{constructor(e=new C(1/0,1/0,1/0),t=new C(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,bn),bn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ks),oo.subVectors(this.max,Ks),os.subVectors(e.a,Ks),as.subVectors(e.b,Ks),ls.subVectors(e.c,Ks),mi.subVectors(as,os),gi.subVectors(ls,as),Di.subVectors(os,ls);let t=[0,-mi.z,mi.y,0,-gi.z,gi.y,0,-Di.z,Di.y,mi.z,0,-mi.x,gi.z,0,-gi.x,Di.z,0,-Di.x,-mi.y,mi.x,0,-gi.y,gi.x,0,-Di.y,Di.x,0];return!ic(t,os,as,ls,oo)||(t=[1,0,0,0,1,0,0,0,1],!ic(t,os,as,ls,oo))?!1:(ao.crossVectors(mi,gi),t=[ao.x,ao.y,ao.z],ic(t,os,as,ls,oo))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,bn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(bn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ti[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ti[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ti[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ti[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ti[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ti[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ti[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ti[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ti),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},ti=[new C,new C,new C,new C,new C,new C,new C,new C],bn=new C,ro=new at,os=new C,as=new C,ls=new C,mi=new C,gi=new C,Di=new C,Ks=new C,oo=new C,ao=new C,Ni=new C;function ic(i,e,t,n,s){for(let r=0,o=i.length-3;r<=o;r+=3){Ni.fromArray(i,r);let a=s.x*Math.abs(Ni.x)+s.y*Math.abs(Ni.y)+s.z*Math.abs(Ni.z),l=e.dot(Ni),c=t.dot(Ni),h=n.dot(Ni);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}var Nt=new C,lo=new qe,cg=0,xt=class extends zn{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:cg++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Xc,this.updateRanges=[],this.gpuType=Yt,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let s=0,r=this.itemSize;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Js.subVectors(e,this.center);let t=Js.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),s=(n-this.radius)*.5;this.center.addScaledVector(Js,s/n),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(sc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Js.copy(e.center).add(sc)),this.expandByPoint(Js.copy(e.center).sub(sc))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},ug=0,pn=new Ke,rc=new Xt,cs=new C,an=new at,js=new at,Gt=new C,ht=class i extends zn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ug++}),this.uuid=si(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Um(e)?cr:lr)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new Je().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return pn.makeRotationFromQuaternion(e),this.applyMatrix4(pn),this}rotateX(e){return pn.makeRotationX(e),this.applyMatrix4(pn),this}rotateY(e){return pn.makeRotationY(e),this.applyMatrix4(pn),this}rotateZ(e){return pn.makeRotationZ(e),this.applyMatrix4(pn),this}translate(e,t,n){return pn.makeTranslation(e,t,n),this.applyMatrix4(pn),this}scale(e,t,n){return pn.makeScale(e,t,n),this.applyMatrix4(pn),this}lookAt(e){return rc.lookAt(e),rc.updateMatrix(),this.applyMatrix4(rc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(cs).negate(),this.translate(cs.x,cs.y,cs.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let s=0,r=e.length;st.count&&We("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new at);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){$e("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new C(-1/0,-1/0,-1/0),new C(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,s=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let s={},r=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],h=[];for(let d=0,u=c.length;d0&&(s[l]=h,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let s=e.attributes;for(let c in s){let h=s[c];this.setAttribute(c,h.clone(t))}let r=e.morphAttributes;for(let c in r){let h=[],d=r[c];for(let u=0,f=d.length;u1)?null:t.copy(e.start).addScaledVector(s,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||fg.getNormalMatrix(e),s=this.coplanarPoint(oc).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}},pg=0,wn=class extends zn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:pg++}),this.uuid=si(),this.name="",this.type="Material",this.blending=Ls,this.side=Yn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Tc,this.blendDst=Ac,this.blendEquation=Wi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ve(0,0,0),this.blendAlpha=0,this.depthFunc=_s,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Td,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Po,this.stencilZFail=Po,this.stencilZPass=Po,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){We(`Material: parameter '${t}' has value of undefined.`);continue}let s=this[t];if(s===void 0){We(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector2&&n&&n.isVector2||s&&s.isEuler&&n&&n.isEuler||s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(r=>r.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.wireframe!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function s(r){let o=[];for(let a in r){let l=r[a];delete l.metadata,o.push(l)}return o}if(t){let r=s(e.textures),o=s(e.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ve().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.retroreflectivity!==void 0&&(this.retroreflectivity=e.retroreflectivity),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.clippingPlanes!==void 0&&(this.clippingPlanes=e.clippingPlanes.map(n=>new At().fromJSON(n))),e.clipIntersection!==void 0&&(this.clipIntersection=e.clipIntersection),e.clipShadows!==void 0&&(this.clipShadows=e.clipShadows),e.depthPacking!==void 0&&(this.depthPacking=e.depthPacking),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.linecap!==void 0&&(this.linecap=e.linecap),e.linejoin!==void 0&&(this.linejoin=e.linejoin),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new qe().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new qe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let s=t.length;n=new Array(s);for(let r=0;r!==s;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};var ni=new C,ac=new C,co=new C,ho=new C,Oi=class{constructor(e=new C,t=new C(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ni)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=ni.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ni.copy(this.origin).addScaledVector(this.direction,t),ni.distanceToSquared(e))}distanceSqToSegment(e,t,n,s){ac.copy(e).add(t).multiplyScalar(.5),co.copy(t).sub(e).normalize(),ho.copy(this.origin).sub(ac);let r=e.distanceTo(t)*.5,o=-this.direction.dot(co),a=ho.dot(this.direction),l=-ho.dot(co),c=ho.lengthSq(),h=Math.abs(1-o*o),d,u,f,m;if(h>0)if(d=o*l-a,u=o*a-l,m=r*h,d>=0)if(u>=-m)if(u<=m){let _=1/h;d*=_,u*=_,f=d*(d+o*u+2*a)+u*(o*d+u+2*l)+c}else u=r,d=Math.max(0,-(o*u+a)),f=-d*d+u*(u+2*l)+c;else u=-r,d=Math.max(0,-(o*u+a)),f=-d*d+u*(u+2*l)+c;else u<=-m?(d=Math.max(0,-(-o*r+a)),u=d>0?-r:Math.min(Math.max(-r,-l),r),f=-d*d+u*(u+2*l)+c):u<=m?(d=0,u=Math.min(Math.max(-r,-l),r),f=u*(u+2*l)+c):(d=Math.max(0,-(o*r+a)),u=d>0?r:Math.min(Math.max(-r,-l),r),f=-d*d+u*(u+2*l)+c);else u=o>0?-r:r,d=Math.max(0,-(o*u+a)),f=-d*d+u*(u+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),s&&s.copy(ac).addScaledVector(co,u),f}intersectSphere(e,t){if(e.radius<0)return null;ni.subVectors(e.center,this.origin);let n=ni.dot(this.direction),s=ni.dot(ni)-n*n,r=e.radius*e.radius;if(s>r)return null;let o=Math.sqrt(r-s),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,s,r,o,a,l,c=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,u=this.origin;return c>=0?(n=(e.min.x-u.x)*c,s=(e.max.x-u.x)*c):(n=(e.max.x-u.x)*c,s=(e.min.x-u.x)*c),h>=0?(r=(e.min.y-u.y)*h,o=(e.max.y-u.y)*h):(r=(e.max.y-u.y)*h,o=(e.min.y-u.y)*h),n>o||r>s||((r>n||isNaN(n))&&(n=r),(o=0?(a=(e.min.z-u.z)*d,l=(e.max.z-u.z)*d):(a=(e.max.z-u.z)*d,l=(e.min.z-u.z)*d),n>l||a>s)||((a>n||n!==n)&&(n=a),(l=0?n:s,t)}intersectsBox(e){return this.intersectBox(e,ni)!==null}intersectTriangle(e,t,n,s,r){let o=this.origin,a=this.direction,l=a.x,c=a.y,h=a.z,d=e.x-o.x,u=e.y-o.y,f=e.z-o.z,m=t.x-o.x,_=t.y-o.y,g=t.z-o.z,p=n.x-o.x,y=n.y-o.y,w=n.z-o.z,b=Math.abs(l),x=Math.abs(c),S=Math.abs(h),A,v,E,R,L,N,B,D,F,H,V,z;if(b>=x&&b>=S?(E=l,N=d,F=m,z=p,l>=0?(A=c,v=h,R=u,L=f,B=_,D=g,H=y,V=w):(A=h,v=c,R=f,L=u,B=g,D=_,H=w,V=y)):x>=S?(E=c,N=u,F=_,z=y,c>=0?(A=h,v=l,R=f,L=d,B=g,D=m,H=w,V=p):(A=l,v=h,R=d,L=f,B=m,D=g,H=p,V=w)):(E=h,N=f,F=g,z=w,h>=0?(A=l,v=c,R=d,L=u,B=m,D=_,H=p,V=y):(A=c,v=l,R=u,L=d,B=_,D=m,H=y,V=p)),E===0)return null;let U=A/E,k=v/E,Y=1/E,G=R-U*N,J=L-k*N,ie=B-U*F,ne=D-k*F,ae=H-U*z,O=V-k*z,$=ae*ne-O*ie,re=G*O-J*ae,me=ie*J-ne*G;if(s){if($<0||re<0||me<0)return null}else if(($<0||re<0||me<0)&&($>0||re>0||me>0))return null;let he=$+re+me;if(he===0)return null;let Ee=Y*($*N+re*F+me*z);return(he>0?Ee<0:Ee>0)?null:this.at(Ee/he,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Jt=class extends wn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ve(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new kn,this.combine=Mr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Nu=new Ke,Ui=new Oi,uo=new Ot,Uu=new C,fo=new C,po=new C,mo=new C,lc=new C,go=new C,Fu=new C,_o=new C,gt=class extends Xt{constructor(e=new ht,t=new Jt){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r(e.far-e.near)**2))&&(Nu.copy(r).invert(),Ui.copy(e.ray).applyMatrix4(Nu),!(n.boundingBox!==null&&Ui.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ui)))}_computeIntersections(e,t,n){let s,r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,c=r.attributes.uv,h=r.attributes.uv1,d=r.attributes.normal,u=r.groups,f=r.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,_=u.length;m<_;m++){let g=u[m],p=o[g.materialIndex],y=Math.max(g.start,f.start),w=Math.min(a.count,Math.min(g.start+g.count,f.start+f.count));for(let b=y,x=w;bt.far?null:{distance:c,point:_o.clone(),object:i}}function xo(i,e,t,n,s,r,o,a,l,c){i.getVertexPosition(a,fo),i.getVertexPosition(l,po),i.getVertexPosition(c,mo);let h=mg(i,e,t,n,fo,po,mo,Fu);if(h){let d=new C;ii.getBarycoord(Fu,fo,po,mo,d),s&&(h.uv=ii.getInterpolatedAttribute(s,a,l,c,d,new qe)),r&&(h.uv1=ii.getInterpolatedAttribute(r,a,l,c,d,new qe)),o&&(h.normal=ii.getInterpolatedAttribute(o,a,l,c,d,new C),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let u={a,b:l,c,normal:new C,materialIndex:0};ii.getNormal(fo,po,mo,u.normal),h.face=u,h.barycoord=d}return h}var gn=class extends Wt{constructor(e=null,t=1,n=1,s,r,o,a,l,c=Lt,h=Lt,d,u){super(null,o,a,l,c,h,s,r,d,u),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var oi=class extends xt{constructor(e,t,n,s=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},hs=new Ke,Bu=new Ke,vo=[],Ou=new at,gg=new Ke,Qs=new gt,er=new Ot,xi=class extends gt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new oi(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s0?e.max.x:e.min.x,yo.y=s.normal.y>0?e.max.y:e.min.y,yo.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(yo)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};var sn=class extends wn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ve(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},qo=new C,Yo=new C,zu=new Ke,tr=new Oi,bo=new Ot,cc=new C,ku=new C,zi=class extends Xt{constructor(e=new ht,t=new sn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let s=1,r=t.count;s0){let s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rn)return;cc.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(cc);if(!(ce.far))return{distance:c,point:ku.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var Hu=new C,Vu=new C,ln=class extends zi{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let s=0,r=t.count;s0){let s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rs.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var hr=class extends Wt{constructor(e=[],t=Mi,n,s,r,o,a,l,c,h){super(e,t,n,s,r,o,a,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},ur=class extends Wt{constructor(e,t,n,s,r,o,a,l,c){super(e,t,n,s,r,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}};var Gn=class extends Wt{constructor(e,t,n=An,s,r,o,a=Lt,l=Lt,c,h=On,d=1){if(h!==On&&h!==wi)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let u={width:e,height:t,depth:d};super(u,s,r,o,a,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Ss(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}},$o=class extends Gn{constructor(e,t=An,n=Mi,s,r,o=Lt,a=Lt,l,c=On){let h={width:e,height:e,depth:1},d=[h,h,h,h,h,h];super(e,e,t,n,s,r,o,a,l,c),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},dr=class extends Wt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},_n=class i extends ht{constructor(e=1,t=1,n=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:s,heightSegments:r,depthSegments:o};let a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);let l=[],c=[],h=[],d=[],u=0,f=0;m("z","y","x",-1,-1,n,t,e,o,r,0),m("z","y","x",1,-1,n,t,-e,o,r,1),m("x","z","y",1,1,e,n,t,s,o,2),m("x","z","y",1,-1,e,n,-t,s,o,3),m("x","y","z",1,-1,e,t,n,s,r,4),m("x","y","z",-1,-1,e,t,-n,s,r,5),this.setIndex(l),this.setAttribute("position",new wt(c,3)),this.setAttribute("normal",new wt(h,3)),this.setAttribute("uv",new wt(d,2));function m(_,g,p,y,w,b,x,S,A,v,E){let R=b/A,L=x/v,N=b/2,B=x/2,D=S/2,F=A+1,H=v+1,V=0,z=0,U=new C;for(let k=0;k0?1:-1,h.push(U.x,U.y,U.z),d.push(G/A),d.push(1-k/v),V+=1}}for(let k=0;k0&&w(!0),t>0&&w(!1)),this.setIndex(h),this.setAttribute("position",new wt(d,3)),this.setAttribute("normal",new wt(u,3)),this.setAttribute("uv",new wt(f,2));function y(){let b=new C,x=new C,S=0,A=(t-e)/n;for(let v=0;v<=r;v++){let E=[],R=v/r,L=R*(t-e)+e;for(let N=0;N<=s;N++){let B=N/s,D=B*l+a,F=Math.sin(D),H=Math.cos(D);x.x=L*F,x.y=-R*n+g,x.z=L*H,d.push(x.x,x.y,x.z),b.set(F,A,H).normalize(),u.push(b.x,b.y,b.z),f.push(B,1-R),E.push(m++)}_.push(E)}for(let v=0;v0||E!==0)&&(h.push(R,L,B),S+=3),(t>0||E!==r-1)&&(h.push(L,N,B),S+=3)}c.addGroup(p,S,0),p+=S}function w(b){let x=m,S=new qe,A=new C,v=0,E=b===!0?e:t,R=b===!0?1:-1;for(let N=1;N<=s;N++)d.push(0,g*R,0),u.push(0,R,0),f.push(.5,.5),m++;let L=m;for(let N=0;N<=s;N++){let D=N/s*l+a,F=Math.cos(D),H=Math.sin(D);A.x=E*H,A.y=g*R,A.z=E*F,d.push(A.x,A.y,A.z),u.push(0,R,0),S.x=F*.5+.5,S.y=H*.5*R+.5,f.push(S.x,S.y),m++}for(let N=0;N0)&&f.push(w,b,S),(p!==n-1||l0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let n={};for(let s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}fromJSON(t,e){if(super.fromJSON(t,e),t.uniforms!==void 0)for(let n in t.uniforms){let s=t.uniforms[n];switch(this.uniforms[n]={},s.type){case"t":this.uniforms[n].value=e[s.value]||null;break;case"c":this.uniforms[n].value=new Vt().setHex(s.value);break;case"v2":this.uniforms[n].value=new qt().fromArray(s.value);break;case"v3":this.uniforms[n].value=new C().fromArray(s.value);break;case"v4":this.uniforms[n].value=new ve().fromArray(s.value);break;case"m3":this.uniforms[n].value=new Jt().fromArray(s.value);break;case"m4":this.uniforms[n].value=new Kt().fromArray(s.value);break;default:this.uniforms[n].value=s.value}}if(t.defines!==void 0&&(this.defines=t.defines),t.vertexShader!==void 0&&(this.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(this.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(this.glslVersion=t.glslVersion),t.extensions!==void 0)for(let n in t.extensions)this.extensions[n]=t.extensions[n];return t.lights!==void 0&&(this.lights=t.lights),t.clipping!==void 0&&(this.clipping=t.clipping),this}},$o=class extends Ie{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};var fr=class extends Sn{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Vt(16777215),this.specular=new Vt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ir,this.normalScale=new qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new kn,this.combine=Mr,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}};var Rs=class extends Sn{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Vt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ir,this.normalScale=new qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new kn,this.combine=Mr,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},Zo=class extends Sn{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Md,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Ko=class extends Sn{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}};function us(i,t){return!i||i.constructor===t?i:typeof t.BYTES_PER_ELEMENT=="number"?new t(i):Array.prototype.slice.call(i)}function hc(i){return i!==void 0&&i.inTangents!==void 0&&i.outTangents!==void 0}var vi=class{constructor(t,e,n,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,s=e[n],r=e[n-1];n:{t:{let o;e:{i:if(!(t=r)){let a=e[1];t=r)break t}o=n,n=0;break e}break n}for(;n>>1;te;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);let a=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&($t("KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,s=this.values,r=n.length;r===0&&($t("KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let a=0;a!==r;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){$t("KeyframeTrack: Time is not a valid number.",this,a,l),t=!1;break}if(o!==null&&o>l){$t("KeyframeTrack: Out of order keys.",this,a,l,o),t=!1;break}o=l}if(s!==void 0&&Sm(s))for(let a=0,l=s.length;a!==l;++a){let c=s[a];if(isNaN(c)){$t("KeyframeTrack: Value is not a valid number.",this,a,c),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===Co,r=t.length-1,o=1;for(let a=1;a0){t[o]=t[r];for(let a=r*n,l=o*n,c=0;c!==n;++c)e[l+c]=e[a+c];++o}return o!==t.length?(this.times=t.slice(0,o),this.values=e.slice(0,o*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,s=new n(this.name,t,e);return s.createInterpolant=this.createInterpolant,hc(this.settings)&&(s.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),s}};function Gu(i,t){for(let e=0,n=i.length;e!==n;e+=2)i[e]*=t}hn.prototype.ValueTypeName="";hn.prototype.TimeBufferType=Float32Array;hn.prototype.ValueBufferType=Float32Array;hn.prototype.DefaultInterpolation=ko;var yi=class extends hn{constructor(t,e,n){super(t,e,n)}};yi.prototype.ValueTypeName="bool";yi.prototype.ValueBufferType=Array;yi.prototype.DefaultInterpolation=nr;yi.prototype.InterpolantFactoryMethodLinear=void 0;yi.prototype.InterpolantFactoryMethodSmooth=void 0;var ea=class extends hn{constructor(t,e,n,s){super(t,e,n,s)}};ea.prototype.ValueTypeName="color";var na=class extends hn{constructor(t,e,n,s){super(t,e,n,s)}};na.prototype.ValueTypeName="number";var ia=class extends vi{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-e)/(s-e),c=t*a;for(let h=c+a;c!==h;c+=4)Fe.slerpFlat(r,0,o,c-a,o,c,l);return r}},pr=class extends hn{constructor(t,e,n,s){super(t,e,n,s)}InterpolantFactoryMethodLinear(t){return new ia(this.times,this.values,this.getValueSize(),t)}};pr.prototype.ValueTypeName="quaternion";pr.prototype.InterpolantFactoryMethodSmooth=void 0;var Mi=class extends hn{constructor(t,e,n){super(t,e,n)}};Mi.prototype.ValueTypeName="string";Mi.prototype.ValueBufferType=Array;Mi.prototype.DefaultInterpolation=nr;Mi.prototype.InterpolantFactoryMethodLinear=void 0;Mi.prototype.InterpolantFactoryMethodSmooth=void 0;var sa=class extends hn{constructor(t,e,n,s){super(t,e,n,s)}};sa.prototype.ValueTypeName="vector";var Po={enabled:!1,files:{},add:function(i,t){this.enabled!==!1&&(Wu(i)||(this.files[i]=t))},get:function(i){if(this.enabled!==!1&&!Wu(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function Wu(i){try{let t=i.slice(i.indexOf(":")+1);return new URL(t).protocol==="blob:"}catch{return!1}}var ra=class{constructor(t,e,n){let s=this,r=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this._abortController=null,this.itemStart=function(h){a++,r===!1&&s.onStart!==void 0&&s.onStart(h,o,a),r=!0},this.itemEnd=function(h){o++,s.onProgress!==void 0&&s.onProgress(h,o,a),o===a&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(h){s.onError!==void 0&&s.onError(h)},this.resolveURL=function(h){return h=h.normalize("NFC"),l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,d){return c.push(h,d),this},this.removeHandler=function(h){let d=c.indexOf(h);return d!==-1&&c.splice(d,2),this},this.getHandler=function(h){for(let d=0,u=c.length;df.start-m.start);let u=0;for(let f=1;f0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let s=e.uniforms[n];switch(this.uniforms[n]={},s.type){case"t":this.uniforms[n].value=t[s.value]||null;break;case"c":this.uniforms[n].value=new Ve().setHex(s.value);break;case"v2":this.uniforms[n].value=new qe().fromArray(s.value);break;case"v3":this.uniforms[n].value=new C().fromArray(s.value);break;case"v4":this.uniforms[n].value=new vt().fromArray(s.value);break;case"m3":this.uniforms[n].value=new Je().fromArray(s.value);break;case"m4":this.uniforms[n].value=new Ke().fromArray(s.value);break;default:this.uniforms[n].value=s.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},Zo=class extends It{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};var pr=class extends wn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ve(16777215),this.specular=new Ve(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ve(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Pr,this.normalScale=new qe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new kn,this.combine=Mr,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};var Rs=class extends wn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ve(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ve(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Pr,this.normalScale=new qe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new kn,this.combine=Mr,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Ko=class extends wn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=wd,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},Jo=class extends wn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function us(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function uc(i){return i!==void 0&&i.inTangents!==void 0&&i.outTangents!==void 0}var vi=class{constructor(e,t,n,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,s=t[n],r=t[n-1];n:{e:{let o;t:{i:if(!(e=r)){let a=t[1];e=r)break e}o=n,n=0;break t}break n}for(;n>>1;et;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);let a=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&($e("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,s=this.values,r=n.length;r===0&&($e("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){$e("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){$e("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(s!==void 0&&Fm(s))for(let a=0,l=s.length;a!==l;++a){let c=s[a];if(isNaN(c)){$e("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===Io,r=e.length-1,o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,s=new n(this.name,e,t);return s.createInterpolant=this.createInterpolant,uc(this.settings)&&(s.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),s}};function qu(i,e){for(let t=0,n=i.length;t!==n;t+=2)i[t]*=e}hn.prototype.ValueTypeName="";hn.prototype.TimeBufferType=Float32Array;hn.prototype.ValueBufferType=Float32Array;hn.prototype.DefaultInterpolation=Ho;var yi=class extends hn{constructor(e,t,n){super(e,t,n)}};yi.prototype.ValueTypeName="bool";yi.prototype.ValueBufferType=Array;yi.prototype.DefaultInterpolation=ir;yi.prototype.InterpolantFactoryMethodLinear=void 0;yi.prototype.InterpolantFactoryMethodSmooth=void 0;var na=class extends hn{constructor(e,t,n,s){super(e,t,n,s)}};na.prototype.ValueTypeName="color";var ia=class extends hn{constructor(e,t,n,s){super(e,t,n,s)}};ia.prototype.ValueTypeName="number";var sa=class extends vi{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e,t,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(s-t),c=e*a;for(let h=c+a;c!==h;c+=4)Ft.slerpFlat(r,0,o,c-a,o,c,l);return r}},mr=class extends hn{constructor(e,t,n,s){super(e,t,n,s)}InterpolantFactoryMethodLinear(e){return new sa(this.times,this.values,this.getValueSize(),e)}};mr.prototype.ValueTypeName="quaternion";mr.prototype.InterpolantFactoryMethodSmooth=void 0;var bi=class extends hn{constructor(e,t,n){super(e,t,n)}};bi.prototype.ValueTypeName="string";bi.prototype.ValueBufferType=Array;bi.prototype.DefaultInterpolation=ir;bi.prototype.InterpolantFactoryMethodLinear=void 0;bi.prototype.InterpolantFactoryMethodSmooth=void 0;var ra=class extends hn{constructor(e,t,n,s){super(e,t,n,s)}};ra.prototype.ValueTypeName="vector";var Lo={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(Yu(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!Yu(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function Yu(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var oa=class{constructor(e,t,n){let s=this,r=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(h){a++,r===!1&&s.onStart!==void 0&&s.onStart(h,o,a),r=!0},this.itemEnd=function(h){o++,s.onProgress!==void 0&&s.onProgress(h,o,a),o===a&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(h){s.onError!==void 0&&s.onError(h)},this.resolveURL=function(h){return h=h.normalize("NFC"),l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,d){return c.push(h,d),this},this.removeHandler=function(h){let d=c.indexOf(h);return d!==-1&&c.splice(d,2),this},this.getHandler=function(h){for(let d=0,u=c.length;df.start-m.start);let u=0;for(let f=1;f 0 +#endif`,Zg=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; @@ -254,20 +254,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve if ( clipped ) discard; #endif #endif -#endif`,Bg=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Kg=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,Og=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Jg=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,zg=`#if NUM_CLIPPING_PLANES > 0 +#endif`,jg=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,kg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) +#endif`,Qg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; -#endif`,Hg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) +#endif`,e0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) varying vec4 vColor; -#endif`,Vg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) +#endif`,t0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec4 vColor; -#endif`,Gg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) +#endif`,n0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec4( 1.0 ); #endif #ifdef USE_COLOR_ALPHA @@ -280,7 +280,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #endif #ifdef USE_BATCHING_COLOR vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); -#endif`,Wg=`#define PI 3.141592653589793 +#endif`,i0=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -351,7 +351,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,Xg=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,s0=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -444,7 +444,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { return vec4( mix( color0, color1, mipF ), 1.0 ); } } -#endif`,qg=`vec3 transformedNormal = objectNormal; +#endif`,r0=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -470,21 +470,21 @@ transformedNormal = normalMatrix * transformedNormal; #endif #ifdef USE_TANGENT transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; -#endif`,Yg=`#ifdef USE_DISPLACEMENTMAP +#endif`,o0=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,$g=`#ifdef USE_DISPLACEMENTMAP +#endif`,a0=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,Zg=`#ifdef USE_EMISSIVEMAP +#endif`,l0=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE emissiveColor = sRGBTransferEOTF( emissiveColor ); #endif totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,Kg=`#ifdef USE_EMISSIVEMAP +#endif`,c0=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,Jg="gl_FragColor = linearToOutputTexel( gl_FragColor );",jg=`vec4 LinearTransferOETF( in vec4 value ) { +#endif`,h0="gl_FragColor = linearToOutputTexel( gl_FragColor );",u0=`vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferEOTF( in vec4 value ) { @@ -492,7 +492,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) { } vec4 sRGBTransferOETF( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -}`,Qg=`#ifdef USE_ENVMAP +}`,d0=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -519,7 +519,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif -#endif`,t0=`#ifdef USE_ENVMAP +#endif`,f0=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform mat3 envMapRotation; #ifdef ENVMAP_TYPE_CUBE @@ -527,7 +527,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #else uniform sampler2D envMap; #endif -#endif`,e0=`#ifdef USE_ENVMAP +#endif`,p0=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -538,7 +538,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,n0=`#ifdef USE_ENVMAP +#endif`,m0=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -549,7 +549,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,i0=`#ifdef USE_ENVMAP +#endif`,g0=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -566,18 +566,18 @@ vec4 sRGBTransferOETF( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,s0=`#ifdef USE_FOG +#endif`,_0=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,r0=`#ifdef USE_FOG +#endif`,x0=`#ifdef USE_FOG varying float vFogDepth; -#endif`,o0=`#ifdef USE_FOG +#endif`,v0=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,a0=`#ifdef USE_FOG +#endif`,y0=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -586,7 +586,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,l0=`#ifdef USE_GRADIENTMAP +#endif`,b0=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -598,12 +598,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,c0=`#ifdef USE_LIGHTMAP +}`,M0=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,h0=`LambertMaterial material; +#endif`,S0=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,u0=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,w0=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -617,7 +617,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,d0=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,E0=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -746,7 +746,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi return irradiance; } #endif -#include `,f0=`#ifdef USE_ENVMAP +#include `,T0=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); @@ -803,8 +803,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi } #endif #endif -#endif`,p0=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,m0=`varying vec3 vViewPosition; +#endif`,A0=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,R0=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -816,11 +816,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,g0=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,C0=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,_0=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,I0=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -837,7 +837,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,x0=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,P0=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb; material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); material.metalness = metalnessFactor; @@ -930,7 +930,7 @@ material.roughness = min( material.roughness, 1.0 ); material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,v0=`uniform sampler2D dfgLUT; +#endif`,L0=`uniform sampler2D dfgLUT; struct PhysicalMaterial { vec3 diffuseColor; vec3 diffuseContribution; @@ -1297,7 +1297,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,y0=` +}`,D0=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1445,7 +1445,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,M0=`#if defined( RE_IndirectDiffuse ) +#endif`,N0=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1475,7 +1475,7 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,b0=`#if defined( RE_IndirectDiffuse ) +#endif`,U0=`#if defined( RE_IndirectDiffuse ) #if defined( LAMBERT ) || defined( PHONG ) irradiance += iblIrradiance; #endif @@ -1483,7 +1483,7 @@ IncidentLight directLight; #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,S0=`#ifdef USE_LIGHT_PROBES_GRID +#endif`,F0=`#ifdef USE_LIGHT_PROBES_GRID uniform highp sampler3D probesSH; uniform vec3 probesMin; uniform vec3 probesMax; @@ -1528,27 +1528,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { result += c8 * 0.429043 * ( x * x - y * y ); return max( result, vec3( 0.0 ) ); } -#endif`,w0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) +#endif`,B0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,E0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) +#endif`,O0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,T0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER +#endif`,z0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER varying float vFragDepth; varying float vIsPerspective; -#endif`,A0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER +#endif`,k0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,R0=`#ifdef USE_MAP +#endif`,H0=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,C0=`#ifdef USE_MAP +#endif`,V0=`#ifdef USE_MAP uniform sampler2D map; -#endif`,I0=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,G0=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -1560,7 +1560,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,P0=`#if defined( USE_POINTS_UV ) +#endif`,W0=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -1572,19 +1572,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,L0=`float metalnessFactor = metalness; +#endif`,X0=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,D0=`#ifdef USE_METALNESSMAP +#endif`,q0=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,N0=`#ifdef USE_INSTANCING_MORPH +#endif`,Y0=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[ MORPHTARGETS_COUNT ]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } -#endif`,U0=`#if defined( USE_MORPHCOLORS ) +#endif`,$0=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -1593,12 +1593,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,F0=`#ifdef USE_MORPHNORMALS +#endif`,Z0=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } -#endif`,B0=`#ifdef USE_MORPHTARGETS +#endif`,K0=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1612,12 +1612,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } -#endif`,O0=`#ifdef USE_MORPHTARGETS +#endif`,J0=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } -#endif`,z0=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,j0=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1658,7 +1658,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,k0=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,Q0=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1676,19 +1676,19 @@ vec3 nonPerturbedNormal = normal;`,k0=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,H0=`#ifndef FLAT_SHADED +#endif`,e_=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,V0=`#ifndef FLAT_SHADED +#endif`,t_=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,G0=`#ifndef FLAT_SHADED +#endif`,n_=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); @@ -1697,7 +1697,7 @@ vec3 nonPerturbedNormal = normal;`,k0=`#ifdef USE_NORMALMAP_OBJECTSPACE vBitangent = - vBitangent; #endif #endif -#endif`,W0=`#ifdef USE_NORMALMAP +#endif`,i_=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1719,13 +1719,13 @@ vec3 nonPerturbedNormal = normal;`,k0=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,X0=`#ifdef USE_CLEARCOAT +#endif`,s_=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,q0=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,r_=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,Y0=`#ifdef USE_CLEARCOATMAP +#endif`,o_=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1734,18 +1734,18 @@ vec3 nonPerturbedNormal = normal;`,k0=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,$0=`#ifdef USE_IRIDESCENCEMAP +#endif`,a_=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,Z0=`#ifdef OPAQUE +#endif`,l_=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,K0=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,c_=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1824,9 +1824,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const #else return ( near * far ) / ( ( far - near ) * depth - far ); #endif -}`,J0=`#ifdef PREMULTIPLIED_ALPHA +}`,h_=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,j0=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,u_=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -1834,22 +1834,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,Q0=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,d_=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,t_=`#ifdef DITHERING +#endif`,f_=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,e_=`float roughnessFactor = roughness; +#endif`,p_=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,n_=`#ifdef USE_ROUGHNESSMAP +#endif`,m_=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,i_=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,g_=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -2100,7 +2100,7 @@ gl_Position = projectionMatrix * mvPosition;`,Q0=`#ifdef DITHERING } #endif #endif -#endif`,s_=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,__=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -2145,7 +2145,7 @@ gl_Position = projectionMatrix * mvPosition;`,Q0=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,r_=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,x_=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) #ifdef HAS_NORMAL vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); #else @@ -2185,7 +2185,7 @@ gl_Position = projectionMatrix * mvPosition;`,Q0=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,o_=`float getShadowMask() { +#endif`,v_=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_SUN_LIGHT_SHADOWS > 0 @@ -2226,12 +2226,12 @@ gl_Position = projectionMatrix * mvPosition;`,Q0=`#ifdef DITHERING #endif #endif return shadow; -}`,a_=`#ifdef USE_SKINNING +}`,y_=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,l_=`#ifdef USE_SKINNING +#endif`,b_=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2246,7 +2246,7 @@ gl_Position = projectionMatrix * mvPosition;`,Q0=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,c_=`#ifdef USE_SKINNING +#endif`,M_=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -2254,7 +2254,7 @@ gl_Position = projectionMatrix * mvPosition;`,Q0=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,h_=`#ifdef USE_SKINNING +#endif`,S_=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2265,17 +2265,17 @@ gl_Position = projectionMatrix * mvPosition;`,Q0=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,u_=`float specularStrength; +#endif`,w_=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,d_=`#ifdef USE_SPECULARMAP +#endif`,E_=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,f_=`#if defined( TONE_MAPPING ) +#endif`,T_=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,p_=`#ifndef saturate +#endif`,A_=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2372,7 +2372,7 @@ vec3 NeutralToneMapping( vec3 color ) { float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); return mix( color, vec3( newPeak ), g ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,m_=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,R_=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2393,7 +2393,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,m_=`#ifdef USE_TRANSMISS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,g_=`#ifdef USE_TRANSMISSION +#endif`,C_=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2519,7 +2519,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,m_=`#ifdef USE_TRANSMISS float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } -#endif`,__=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,I_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2589,7 +2589,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,m_=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,x_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,P_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2683,7 +2683,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,m_=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,v_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,L_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2754,7 +2754,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,m_=`#ifdef USE_TRANSMISS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,y_=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,D_=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; @@ -2763,12 +2763,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,m_=`#ifdef USE_TRANSMISS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`,M_=`varying vec2 vUv; +#endif`,N_=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,b_=`uniform sampler2D t2D; +}`,U_=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2780,14 +2780,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,S_=`varying vec3 vWorldDirection; +}`,F_=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,w_=`#ifdef ENVMAP_TYPE_CUBE +}`,B_=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -2809,14 +2809,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,E_=`varying vec3 vWorldDirection; +}`,O_=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,T_=`uniform samplerCube tCube; +}`,z_=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2826,7 +2826,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,A_=`#include +}`,k_=`#include #include #include #include @@ -2853,7 +2853,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,R_=`#if DEPTH_PACKING == 3200 +}`,H_=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2891,7 +2891,7 @@ void main() { #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif -}`,C_=`#define DISTANCE +}`,V_=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2918,7 +2918,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,I_=`#define DISTANCE +}`,G_=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2941,13 +2941,13 @@ void main() { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); -}`,P_=`varying vec3 vWorldDirection; +}`,W_=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,L_=`uniform sampler2D tEquirect; +}`,X_=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2956,7 +2956,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,D_=`uniform float scale; +}`,q_=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2978,7 +2978,7 @@ void main() { #include #include #include -}`,N_=`uniform vec3 diffuse; +}`,Y_=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -3006,7 +3006,7 @@ void main() { #include #include #include -}`,U_=`#include +}`,$_=`#include #include #include #include @@ -3038,7 +3038,7 @@ void main() { #include #include #include -}`,F_=`uniform vec3 diffuse; +}`,Z_=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -3086,7 +3086,7 @@ void main() { #include #include #include -}`,B_=`#define LAMBERT +}`,K_=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -3125,7 +3125,7 @@ void main() { #include #include #include -}`,O_=`#define LAMBERT +}`,J_=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3183,7 +3183,7 @@ void main() { #include #include #include -}`,z_=`#define MATCAP +}`,j_=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -3217,7 +3217,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,k_=`#define MATCAP +}`,Q_=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3263,7 +3263,7 @@ void main() { #include #include #include -}`,H_=`#define NORMAL +}`,ex=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -3296,7 +3296,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,V_=`#define NORMAL +}`,tx=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -3317,7 +3317,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,G_=`#define PHONG +}`,nx=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3356,7 +3356,7 @@ void main() { #include #include #include -}`,W_=`#define PHONG +}`,ix=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3416,7 +3416,7 @@ void main() { #include #include #include -}`,X_=`#define STANDARD +}`,sx=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3459,7 +3459,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,q_=`#define STANDARD +}`,rx=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3587,7 +3587,7 @@ void main() { #include #include #include -}`,Y_=`#define TOON +}`,ox=`#define TOON varying vec3 vViewPosition; #include #include @@ -3624,7 +3624,7 @@ void main() { #include #include #include -}`,$_=`#define TOON +}`,ax=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3676,7 +3676,7 @@ void main() { #include #include #include -}`,Z_=`uniform float size; +}`,lx=`uniform float size; uniform float scale; #include #include @@ -3707,7 +3707,7 @@ void main() { #include #include #include -}`,K_=`uniform vec3 diffuse; +}`,cx=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3732,7 +3732,7 @@ void main() { #include #include #include -}`,J_=`#include +}`,hx=`#include #include #include #include @@ -3755,7 +3755,7 @@ void main() { #include #include #include -}`,j_=`uniform vec3 color; +}`,ux=`uniform vec3 color; uniform float opacity; #include #include @@ -3771,7 +3771,7 @@ void main() { #include #include #include -}`,Q_=`uniform float rotation; +}`,dx=`uniform float rotation; uniform vec2 center; #include #include @@ -3795,7 +3795,7 @@ void main() { #include #include #include -}`,tx=`uniform vec3 diffuse; +}`,fx=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3820,7 +3820,7 @@ void main() { #include #include #include -}`,te={alphahash_fragment:Mg,alphahash_pars_fragment:bg,alphamap_fragment:Sg,alphamap_pars_fragment:wg,alphatest_fragment:Eg,alphatest_pars_fragment:Tg,aomap_fragment:Ag,aomap_pars_fragment:Rg,batching_pars_vertex:Cg,batching_vertex:Ig,begin_vertex:Pg,beginnormal_vertex:Lg,bsdfs:Dg,iridescence_fragment:Ng,bumpmap_pars_fragment:Ug,clipping_planes_fragment:Fg,clipping_planes_pars_fragment:Bg,clipping_planes_pars_vertex:Og,clipping_planes_vertex:zg,color_fragment:kg,color_pars_fragment:Hg,color_pars_vertex:Vg,color_vertex:Gg,common:Wg,cube_uv_reflection_fragment:Xg,defaultnormal_vertex:qg,displacementmap_pars_vertex:Yg,displacementmap_vertex:$g,emissivemap_fragment:Zg,emissivemap_pars_fragment:Kg,colorspace_fragment:Jg,colorspace_pars_fragment:jg,envmap_fragment:Qg,envmap_common_pars_fragment:t0,envmap_pars_fragment:e0,envmap_pars_vertex:n0,envmap_physical_pars_fragment:f0,envmap_vertex:i0,fog_vertex:s0,fog_pars_vertex:r0,fog_fragment:o0,fog_pars_fragment:a0,gradientmap_pars_fragment:l0,lightmap_pars_fragment:c0,lights_lambert_fragment:h0,lights_lambert_pars_fragment:u0,lights_pars_begin:d0,lights_toon_fragment:p0,lights_toon_pars_fragment:m0,lights_phong_fragment:g0,lights_phong_pars_fragment:_0,lights_physical_fragment:x0,lights_physical_pars_fragment:v0,lights_fragment_begin:y0,lights_fragment_maps:M0,lights_fragment_end:b0,lightprobes_pars_fragment:S0,logdepthbuf_fragment:w0,logdepthbuf_pars_fragment:E0,logdepthbuf_pars_vertex:T0,logdepthbuf_vertex:A0,map_fragment:R0,map_pars_fragment:C0,map_particle_fragment:I0,map_particle_pars_fragment:P0,metalnessmap_fragment:L0,metalnessmap_pars_fragment:D0,morphinstance_vertex:N0,morphcolor_vertex:U0,morphnormal_vertex:F0,morphtarget_pars_vertex:B0,morphtarget_vertex:O0,normal_fragment_begin:z0,normal_fragment_maps:k0,normal_pars_fragment:H0,normal_pars_vertex:V0,normal_vertex:G0,normalmap_pars_fragment:W0,clearcoat_normal_fragment_begin:X0,clearcoat_normal_fragment_maps:q0,clearcoat_pars_fragment:Y0,iridescence_pars_fragment:$0,opaque_fragment:Z0,packing:K0,premultiplied_alpha_fragment:J0,project_vertex:j0,dithering_fragment:Q0,dithering_pars_fragment:t_,roughnessmap_fragment:e_,roughnessmap_pars_fragment:n_,shadowmap_pars_fragment:i_,shadowmap_pars_vertex:s_,shadowmap_vertex:r_,shadowmask_pars_fragment:o_,skinbase_vertex:a_,skinning_pars_vertex:l_,skinning_vertex:c_,skinnormal_vertex:h_,specularmap_fragment:u_,specularmap_pars_fragment:d_,tonemapping_fragment:f_,tonemapping_pars_fragment:p_,transmission_fragment:m_,transmission_pars_fragment:g_,uv_pars_fragment:__,uv_pars_vertex:x_,uv_vertex:v_,worldpos_vertex:y_,background_vert:M_,background_frag:b_,backgroundCube_vert:S_,backgroundCube_frag:w_,cube_vert:E_,cube_frag:T_,depth_vert:A_,depth_frag:R_,distance_vert:C_,distance_frag:I_,equirect_vert:P_,equirect_frag:L_,linedashed_vert:D_,linedashed_frag:N_,meshbasic_vert:U_,meshbasic_frag:F_,meshlambert_vert:B_,meshlambert_frag:O_,meshmatcap_vert:z_,meshmatcap_frag:k_,meshnormal_vert:H_,meshnormal_frag:V_,meshphong_vert:G_,meshphong_frag:W_,meshphysical_vert:X_,meshphysical_frag:q_,meshtoon_vert:Y_,meshtoon_frag:$_,points_vert:Z_,points_frag:K_,shadow_vert:J_,shadow_frag:j_,sprite_vert:Q_,sprite_frag:tx},St={common:{diffuse:{value:new Vt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Jt},alphaMap:{value:null},alphaMapTransform:{value:new Jt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Jt}},envmap:{envMap:{value:null},envMapRotation:{value:new Jt},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Jt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Jt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Jt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Jt},normalScale:{value:new qt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Jt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Jt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Jt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Jt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Vt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new C},probesMax:{value:new C},probesResolution:{value:new C}},points:{diffuse:{value:new Vt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Jt},alphaTest:{value:0},uvTransform:{value:new Jt}},sprite:{diffuse:{value:new Vt(16777215)},opacity:{value:1},center:{value:new qt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Jt},alphaMap:{value:null},alphaMapTransform:{value:new Jt},alphaTest:{value:0}}},Kn={basic:{uniforms:Qe([St.common,St.specularmap,St.envmap,St.aomap,St.lightmap,St.fog]),vertexShader:te.meshbasic_vert,fragmentShader:te.meshbasic_frag},lambert:{uniforms:Qe([St.common,St.specularmap,St.envmap,St.aomap,St.lightmap,St.emissivemap,St.bumpmap,St.normalmap,St.displacementmap,St.fog,St.lights,{emissive:{value:new Vt(0)},envMapIntensity:{value:1}}]),vertexShader:te.meshlambert_vert,fragmentShader:te.meshlambert_frag},phong:{uniforms:Qe([St.common,St.specularmap,St.envmap,St.aomap,St.lightmap,St.emissivemap,St.bumpmap,St.normalmap,St.displacementmap,St.fog,St.lights,{emissive:{value:new Vt(0)},specular:{value:new Vt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:te.meshphong_vert,fragmentShader:te.meshphong_frag},standard:{uniforms:Qe([St.common,St.envmap,St.aomap,St.lightmap,St.emissivemap,St.bumpmap,St.normalmap,St.displacementmap,St.roughnessmap,St.metalnessmap,St.fog,St.lights,{emissive:{value:new Vt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:te.meshphysical_vert,fragmentShader:te.meshphysical_frag},toon:{uniforms:Qe([St.common,St.aomap,St.lightmap,St.emissivemap,St.bumpmap,St.normalmap,St.displacementmap,St.gradientmap,St.fog,St.lights,{emissive:{value:new Vt(0)}}]),vertexShader:te.meshtoon_vert,fragmentShader:te.meshtoon_frag},matcap:{uniforms:Qe([St.common,St.bumpmap,St.normalmap,St.displacementmap,St.fog,{matcap:{value:null}}]),vertexShader:te.meshmatcap_vert,fragmentShader:te.meshmatcap_frag},points:{uniforms:Qe([St.points,St.fog]),vertexShader:te.points_vert,fragmentShader:te.points_frag},dashed:{uniforms:Qe([St.common,St.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:te.linedashed_vert,fragmentShader:te.linedashed_frag},depth:{uniforms:Qe([St.common,St.displacementmap]),vertexShader:te.depth_vert,fragmentShader:te.depth_frag},normal:{uniforms:Qe([St.common,St.bumpmap,St.normalmap,St.displacementmap,{opacity:{value:1}}]),vertexShader:te.meshnormal_vert,fragmentShader:te.meshnormal_frag},sprite:{uniforms:Qe([St.sprite,St.fog]),vertexShader:te.sprite_vert,fragmentShader:te.sprite_frag},background:{uniforms:{uvTransform:{value:new Jt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:te.background_vert,fragmentShader:te.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Jt}},vertexShader:te.backgroundCube_vert,fragmentShader:te.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:te.cube_vert,fragmentShader:te.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:te.equirect_vert,fragmentShader:te.equirect_frag},distance:{uniforms:Qe([St.common,St.displacementmap,{referencePosition:{value:new C},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:te.distance_vert,fragmentShader:te.distance_frag},shadow:{uniforms:Qe([St.lights,St.fog,{color:{value:new Vt(0)},opacity:{value:1}}]),vertexShader:te.shadow_vert,fragmentShader:te.shadow_frag}};Kn.physical={uniforms:Qe([Kn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Jt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Jt},clearcoatNormalScale:{value:new qt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Jt},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Jt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Jt},sheen:{value:0},sheenColor:{value:new Vt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Jt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Jt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Jt},transmissionSamplerSize:{value:new qt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Jt},attenuationDistance:{value:0},attenuationColor:{value:new Vt(0)},specularColor:{value:new Vt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Jt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Jt},anisotropyVector:{value:new qt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Jt}}]),vertexShader:te.meshphysical_vert,fragmentShader:te.meshphysical_frag};var ja={r:0,b:0,g:0},ex=new Kt,af=new Jt;af.set(-1,0,0,0,1,0,0,0,1);function nx(i,t,e,n,s,r){let o=new Vt(0),a=s===!0?0:1,l,c,h=null,d=0,u=null;function f(y){let w=y.isScene===!0?y.background:null;if(w&&w.isTexture){let M=y.backgroundBlurriness>0;w=t.get(w,M)}return w}function m(y){let w=!1,M=f(y);M===null?g(o,a):M&&M.isColor&&(g(M,1),w=!0);let x=i.xr.getEnvironmentBlendMode();x==="additive"?e.buffers.color.setClear(0,0,0,1,r):x==="alpha-blend"&&e.buffers.color.setClear(0,0,0,0,r),(i.autoClear||w)&&(e.buffers.depth.setTest(!0),e.buffers.depth.setMask(!0),e.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function _(y,w){let M=f(w);M&&(M.isCubeTexture||M.mapping===br)?(c===void 0&&(c=new ge(new gn(1,1,1),new Ie({name:"BackgroundCubeMaterial",uniforms:qi(Kn.backgroundCube.uniforms),vertexShader:Kn.backgroundCube.vertexShader,fragmentShader:Kn.backgroundCube.fragmentShader,side:ze,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(x,S,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=M,c.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(ex.makeRotationFromEuler(w.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(af),c.material.toneMapped=se.getTransfer(M.colorSpace)!==fe,(h!==M||d!==M.version||u!==i.toneMapping)&&(c.material.needsUpdate=!0,h=M,d=M.version,u=i.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null)):M&&M.isTexture&&(l===void 0&&(l=new ge(new cn(2,2),new Ie({name:"BackgroundMaterial",uniforms:qi(Kn.background.uniforms),vertexShader:Kn.background.vertexShader,fragmentShader:Kn.background.fragmentShader,side:Yn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=M,l.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,l.material.toneMapped=se.getTransfer(M.colorSpace)!==fe,M.matrixAutoUpdate===!0&&M.updateMatrix(),l.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||d!==M.version||u!==i.toneMapping)&&(l.material.needsUpdate=!0,h=M,d=M.version,u=i.toneMapping),l.layers.enableAll(),y.unshift(l,l.geometry,l.material,0,0,null))}function g(y,w){y.getRGB(ja,Yc(i)),e.buffers.color.setClear(ja.r,ja.g,ja.b,w,r)}function p(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(y,w=1){o.set(y),a=w,g(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(y){a=y,g(o,a)},render:m,addToRenderList:_,dispose:p}}function ix(i,t){let e=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=u(null),r=s,o=!1;function a(L,N,B,D,F){let H=!1,V=d(L,D,B,N);r!==V&&(r=V,c(r.object)),H=f(L,D,B,F),H&&m(L,D,B,F),F!==null&&t.update(F,i.ELEMENT_ARRAY_BUFFER),(H||o)&&(o=!1,M(L,N,B,D),F!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(F).buffer))}function l(){return i.createVertexArray()}function c(L){return i.bindVertexArray(L)}function h(L){return i.deleteVertexArray(L)}function d(L,N,B,D){let F=D.wireframe===!0,H=n[N.id];H===void 0&&(H={},n[N.id]=H);let V=L.isInstancedMesh===!0?L.id:0,z=H[V];z===void 0&&(z={},H[V]=z);let U=z[B.id];U===void 0&&(U={},z[B.id]=U);let k=U[F];return k===void 0&&(k=u(l()),U[F]=k),k}function u(L){let N=[],B=[],D=[];for(let F=0;F=0){let Y=F[U],G=H[U];if(G===void 0&&(U==="instanceMatrix"&&L.instanceMatrix&&(G=L.instanceMatrix),U==="instanceColor"&&L.instanceColor&&(G=L.instanceColor)),Y===void 0||Y.attribute!==G||G&&Y.data!==G.data)return!0;V++}return r.attributesNum!==V||r.index!==D}function m(L,N,B,D){let F={},H=N.attributes,V=0,z=B.getAttributes();for(let U in z)if(z[U].location>=0){let Y=H[U];Y===void 0&&(U==="instanceMatrix"&&L.instanceMatrix&&(Y=L.instanceMatrix),U==="instanceColor"&&L.instanceColor&&(Y=L.instanceColor));let G={};G.attribute=Y,Y&&Y.data&&(G.data=Y.data),F[U]=G,V++}r.attributes=F,r.attributesNum=V,r.index=D}function _(){let L=r.newAttributes;for(let N=0,B=L.length;N=0){let k=F[z];if(k===void 0&&(z==="instanceMatrix"&&L.instanceMatrix&&(k=L.instanceMatrix),z==="instanceColor"&&L.instanceColor&&(k=L.instanceColor)),k!==void 0){let Y=k.normalized,G=k.itemSize,J=t.get(k);if(J===void 0)continue;let it=J.buffer,nt=J.type,at=J.bytesPerElement,O=nt===i.INT||nt===i.UNSIGNED_INT||k.gpuType===pa;if(k.isInterleavedBufferAttribute){let $=k.data,rt=$.stride,mt=k.offset;if($.isInstancedInterleavedBuffer){for(let ht=0;ht0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=e.precision!==void 0?e.precision:"highp",h=l(c);h!==c&&(Wt("WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);let d=e.logarithmicDepthBuffer===!0,u=e.reversedDepthBuffer===!0&&t.has("EXT_clip_control");e.reversedDepthBuffer===!0&&u===!1&&Wt("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let f=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),m=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_TEXTURE_SIZE),g=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),p=i.getParameter(i.MAX_VERTEX_ATTRIBS),y=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),w=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),x=i.getParameter(i.MAX_SAMPLES),S=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:d,reversedDepthBuffer:u,maxTextures:f,maxVertexTextures:m,maxTextureSize:_,maxCubemapSize:g,maxAttributes:p,maxVertexUniforms:y,maxVaryings:w,maxFragmentUniforms:M,maxSamples:x,samples:S}}function ox(i){let t=this,e=null,n=0,s=!1,r=!1,o=new Ae,a=new Jt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){let f=d.length!==0||u||n!==0||s;return s=u,n=d.length,f},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(d,u){e=h(d,u,0)},this.setState=function(d,u,f){let m=d.clippingPlanes,_=d.clipIntersection,g=d.clipShadows,p=i.get(d);if(!s||m===null||m.length===0||r&&!g)r?h(null):c();else{let y=r?0:n,w=y*4,M=p.clippingState||null;l.value=M,M=h(m,u,w,f);for(let x=0;x!==w;++x)M[x]=e[x];p.clippingState=M,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(d,u,f,m){let _=d!==null?d.length:0,g=null;if(_!==0){if(g=l.value,m!==!0||g===null){let p=f+_*4,y=u.matrixWorldInverse;a.getNormalMatrix(y),(g===null||g.length0&&this._blur(l,0,0,e),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Hd(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=kd(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t2?x:0,x,x),d.setRenderTarget(s),p&&d.render(_,l),d.render(t,l)}d.toneMapping=f,d.autoClear=u,t.background=y}_textureToCubeUV(t,e){let n=this._renderer,s=t.mapping===bi||t.mapping===Xi;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Hd()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=kd());let r=s?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=r;let a=r.uniforms;a.envMap.value=t;let l=this._cubeSize;Fs(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(o,Lr)}_applyPMREM(t){let e=this._renderer,n=e.autoClear;e.autoClear=!1;let s=this._lodMeshes.length;for(let r=1;rm-Bs?n-m+Bs:0),p=4*(this._cubeSize-_);l.envMap.value=t.texture,l.roughness.value=f,l.mipInt.value=m-e,Fs(r,g,p,3*_,2*_),s.setRenderTarget(r),s.render(a,Lr),l.envMap.value=r.texture,l.roughness.value=0,l.mipInt.value=m-n,Fs(t,g,p,3*_,2*_),s.setRenderTarget(t),s.render(a,Lr)}_blur(t,e,n,s){let r=this._pingPongRenderTarget,o=Math.min(s,Math.PI)/Math.SQRT2;this._blurPass(t,r,e,n,o),this._blurPass(r,t,n,n,o)}_blurPass(t,e,n,s,r){let o=this._renderer,a=this._blurMaterial,l=this._lodMeshes[s];l.material=a;let c=a.uniforms;c.envMap.value=t.texture,c.sigma.value=r,c.mipInt.value=this._lodMax-n;let h=this._sizeLods[s],d=3*h*(s>this._lodMax-Bs?s-this._lodMax+Bs:0),u=4*(this._cubeSize-h);Fs(e,d,u,3*h,2*h),o.setRenderTarget(e),o.render(l,Lr)}};function ux(i){let t=[],e=[],n=i,s=i-Bs+1+ax;for(let r=0;r2?0:-1,M=[y,w,0,y+2/3,w,0,y+2/3,w+1,0,y,w,0,y+2/3,w+1,0,y,w+1,0];m.set(M,f*u*p);for(let x=0;xBs&&n--}return{lodMeshes:e,sizeLods:t}}function zd(i,t,e){let n=new Be(i,t,e);return n.texture.mapping=br,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Fs(i,t,e,n,s){i.viewport.set(t,e,n,s),i.scissor.set(t,e,n,s)}function dx(i,t,e){return new Ie({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:cx,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:nl(),fragmentShader:` +}`,et={alphahash_fragment:Ng,alphahash_pars_fragment:Ug,alphamap_fragment:Fg,alphamap_pars_fragment:Bg,alphatest_fragment:Og,alphatest_pars_fragment:zg,aomap_fragment:kg,aomap_pars_fragment:Hg,batching_pars_vertex:Vg,batching_vertex:Gg,begin_vertex:Wg,beginnormal_vertex:Xg,bsdfs:qg,iridescence_fragment:Yg,bumpmap_pars_fragment:$g,clipping_planes_fragment:Zg,clipping_planes_pars_fragment:Kg,clipping_planes_pars_vertex:Jg,clipping_planes_vertex:jg,color_fragment:Qg,color_pars_fragment:e0,color_pars_vertex:t0,color_vertex:n0,common:i0,cube_uv_reflection_fragment:s0,defaultnormal_vertex:r0,displacementmap_pars_vertex:o0,displacementmap_vertex:a0,emissivemap_fragment:l0,emissivemap_pars_fragment:c0,colorspace_fragment:h0,colorspace_pars_fragment:u0,envmap_fragment:d0,envmap_common_pars_fragment:f0,envmap_pars_fragment:p0,envmap_pars_vertex:m0,envmap_physical_pars_fragment:T0,envmap_vertex:g0,fog_vertex:_0,fog_pars_vertex:x0,fog_fragment:v0,fog_pars_fragment:y0,gradientmap_pars_fragment:b0,lightmap_pars_fragment:M0,lights_lambert_fragment:S0,lights_lambert_pars_fragment:w0,lights_pars_begin:E0,lights_toon_fragment:A0,lights_toon_pars_fragment:R0,lights_phong_fragment:C0,lights_phong_pars_fragment:I0,lights_physical_fragment:P0,lights_physical_pars_fragment:L0,lights_fragment_begin:D0,lights_fragment_maps:N0,lights_fragment_end:U0,lightprobes_pars_fragment:F0,logdepthbuf_fragment:B0,logdepthbuf_pars_fragment:O0,logdepthbuf_pars_vertex:z0,logdepthbuf_vertex:k0,map_fragment:H0,map_pars_fragment:V0,map_particle_fragment:G0,map_particle_pars_fragment:W0,metalnessmap_fragment:X0,metalnessmap_pars_fragment:q0,morphinstance_vertex:Y0,morphcolor_vertex:$0,morphnormal_vertex:Z0,morphtarget_pars_vertex:K0,morphtarget_vertex:J0,normal_fragment_begin:j0,normal_fragment_maps:Q0,normal_pars_fragment:e_,normal_pars_vertex:t_,normal_vertex:n_,normalmap_pars_fragment:i_,clearcoat_normal_fragment_begin:s_,clearcoat_normal_fragment_maps:r_,clearcoat_pars_fragment:o_,iridescence_pars_fragment:a_,opaque_fragment:l_,packing:c_,premultiplied_alpha_fragment:h_,project_vertex:u_,dithering_fragment:d_,dithering_pars_fragment:f_,roughnessmap_fragment:p_,roughnessmap_pars_fragment:m_,shadowmap_pars_fragment:g_,shadowmap_pars_vertex:__,shadowmap_vertex:x_,shadowmask_pars_fragment:v_,skinbase_vertex:y_,skinning_pars_vertex:b_,skinning_vertex:M_,skinnormal_vertex:S_,specularmap_fragment:w_,specularmap_pars_fragment:E_,tonemapping_fragment:T_,tonemapping_pars_fragment:A_,transmission_fragment:R_,transmission_pars_fragment:C_,uv_pars_fragment:I_,uv_pars_vertex:P_,uv_vertex:L_,worldpos_vertex:D_,background_vert:N_,background_frag:U_,backgroundCube_vert:F_,backgroundCube_frag:B_,cube_vert:O_,cube_frag:z_,depth_vert:k_,depth_frag:H_,distance_vert:V_,distance_frag:G_,equirect_vert:W_,equirect_frag:X_,linedashed_vert:q_,linedashed_frag:Y_,meshbasic_vert:$_,meshbasic_frag:Z_,meshlambert_vert:K_,meshlambert_frag:J_,meshmatcap_vert:j_,meshmatcap_frag:Q_,meshnormal_vert:ex,meshnormal_frag:tx,meshphong_vert:nx,meshphong_frag:ix,meshphysical_vert:sx,meshphysical_frag:rx,meshtoon_vert:ox,meshtoon_frag:ax,points_vert:lx,points_frag:cx,shadow_vert:hx,shadow_frag:ux,sprite_vert:dx,sprite_frag:fx},Se={common:{diffuse:{value:new Ve(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Je},alphaMap:{value:null},alphaMapTransform:{value:new Je},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Je}},envmap:{envMap:{value:null},envMapRotation:{value:new Je},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Je}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Je}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Je},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Je},normalScale:{value:new qe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Je},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Je}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Je}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Je}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ve(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new C},probesMax:{value:new C},probesResolution:{value:new C}},points:{diffuse:{value:new Ve(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Je},alphaTest:{value:0},uvTransform:{value:new Je}},sprite:{diffuse:{value:new Ve(16777215)},opacity:{value:1},center:{value:new qe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Je},alphaMap:{value:null},alphaMapTransform:{value:new Je},alphaTest:{value:0}}},Kn={basic:{uniforms:Qt([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.fog]),vertexShader:et.meshbasic_vert,fragmentShader:et.meshbasic_frag},lambert:{uniforms:Qt([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new Ve(0)},envMapIntensity:{value:1}}]),vertexShader:et.meshlambert_vert,fragmentShader:et.meshlambert_frag},phong:{uniforms:Qt([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new Ve(0)},specular:{value:new Ve(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:et.meshphong_vert,fragmentShader:et.meshphong_frag},standard:{uniforms:Qt([Se.common,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.roughnessmap,Se.metalnessmap,Se.fog,Se.lights,{emissive:{value:new Ve(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:et.meshphysical_vert,fragmentShader:et.meshphysical_frag},toon:{uniforms:Qt([Se.common,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.gradientmap,Se.fog,Se.lights,{emissive:{value:new Ve(0)}}]),vertexShader:et.meshtoon_vert,fragmentShader:et.meshtoon_frag},matcap:{uniforms:Qt([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,{matcap:{value:null}}]),vertexShader:et.meshmatcap_vert,fragmentShader:et.meshmatcap_frag},points:{uniforms:Qt([Se.points,Se.fog]),vertexShader:et.points_vert,fragmentShader:et.points_frag},dashed:{uniforms:Qt([Se.common,Se.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:et.linedashed_vert,fragmentShader:et.linedashed_frag},depth:{uniforms:Qt([Se.common,Se.displacementmap]),vertexShader:et.depth_vert,fragmentShader:et.depth_frag},normal:{uniforms:Qt([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,{opacity:{value:1}}]),vertexShader:et.meshnormal_vert,fragmentShader:et.meshnormal_frag},sprite:{uniforms:Qt([Se.sprite,Se.fog]),vertexShader:et.sprite_vert,fragmentShader:et.sprite_frag},background:{uniforms:{uvTransform:{value:new Je},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:et.background_vert,fragmentShader:et.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Je}},vertexShader:et.backgroundCube_vert,fragmentShader:et.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:et.cube_vert,fragmentShader:et.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:et.equirect_vert,fragmentShader:et.equirect_frag},distance:{uniforms:Qt([Se.common,Se.displacementmap,{referencePosition:{value:new C},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:et.distance_vert,fragmentShader:et.distance_frag},shadow:{uniforms:Qt([Se.lights,Se.fog,{color:{value:new Ve(0)},opacity:{value:1}}]),vertexShader:et.shadow_vert,fragmentShader:et.shadow_frag}};Kn.physical={uniforms:Qt([Kn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Je},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Je},clearcoatNormalScale:{value:new qe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Je},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Je},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Je},sheen:{value:0},sheenColor:{value:new Ve(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Je},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Je},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Je},transmissionSamplerSize:{value:new qe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Je},attenuationDistance:{value:0},attenuationColor:{value:new Ve(0)},specularColor:{value:new Ve(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Je},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Je},anisotropyVector:{value:new qe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Je}}]),vertexShader:et.meshphysical_vert,fragmentShader:et.meshphysical_frag};var Qa={r:0,b:0,g:0},px=new Ke,hf=new Je;hf.set(-1,0,0,0,1,0,0,0,1);function mx(i,e,t,n,s,r){let o=new Ve(0),a=s===!0?0:1,l,c,h=null,d=0,u=null;function f(y){let w=y.isScene===!0?y.background:null;if(w&&w.isTexture){let b=y.backgroundBlurriness>0;w=e.get(w,b)}return w}function m(y){let w=!1,b=f(y);b===null?g(o,a):b&&b.isColor&&(g(b,1),w=!0);let x=i.xr.getEnvironmentBlendMode();x==="additive"?t.buffers.color.setClear(0,0,0,1,r):x==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(i.autoClear||w)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function _(y,w){let b=f(w);b&&(b.isCubeTexture||b.mapping===Sr)?(c===void 0&&(c=new gt(new _n(1,1,1),new It({name:"BackgroundCubeMaterial",uniforms:qi(Kn.backgroundCube.uniforms),vertexShader:Kn.backgroundCube.vertexShader,fragmentShader:Kn.backgroundCube.fragmentShader,side:zt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(x,S,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=b,c.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(px.makeRotationFromEuler(w.backgroundRotation)).transpose(),b.isCubeTexture&&b.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(hf),c.material.toneMapped=st.getTransfer(b.colorSpace)!==ft,(h!==b||d!==b.version||u!==i.toneMapping)&&(c.material.needsUpdate=!0,h=b,d=b.version,u=i.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null)):b&&b.isTexture&&(l===void 0&&(l=new gt(new cn(2,2),new It({name:"BackgroundMaterial",uniforms:qi(Kn.background.uniforms),vertexShader:Kn.background.vertexShader,fragmentShader:Kn.background.fragmentShader,side:Yn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=b,l.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,l.material.toneMapped=st.getTransfer(b.colorSpace)!==ft,b.matrixAutoUpdate===!0&&b.updateMatrix(),l.material.uniforms.uvTransform.value.copy(b.matrix),(h!==b||d!==b.version||u!==i.toneMapping)&&(l.material.needsUpdate=!0,h=b,d=b.version,u=i.toneMapping),l.layers.enableAll(),y.unshift(l,l.geometry,l.material,0,0,null))}function g(y,w){y.getRGB(Qa,$c(i)),t.buffers.color.setClear(Qa.r,Qa.g,Qa.b,w,r)}function p(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(y,w=1){o.set(y),a=w,g(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(y){a=y,g(o,a)},render:m,addToRenderList:_,dispose:p}}function gx(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=u(null),r=s,o=!1;function a(L,N,B,D,F){let H=!1,V=d(L,D,B,N);r!==V&&(r=V,c(r.object)),H=f(L,D,B,F),H&&m(L,D,B,F),F!==null&&e.update(F,i.ELEMENT_ARRAY_BUFFER),(H||o)&&(o=!1,b(L,N,B,D),F!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(F).buffer))}function l(){return i.createVertexArray()}function c(L){return i.bindVertexArray(L)}function h(L){return i.deleteVertexArray(L)}function d(L,N,B,D){let F=D.wireframe===!0,H=n[N.id];H===void 0&&(H={},n[N.id]=H);let V=L.isInstancedMesh===!0?L.id:0,z=H[V];z===void 0&&(z={},H[V]=z);let U=z[B.id];U===void 0&&(U={},z[B.id]=U);let k=U[F];return k===void 0&&(k=u(l()),U[F]=k),k}function u(L){let N=[],B=[],D=[];for(let F=0;F=0){let Y=F[U],G=H[U];if(G===void 0&&(U==="instanceMatrix"&&L.instanceMatrix&&(G=L.instanceMatrix),U==="instanceColor"&&L.instanceColor&&(G=L.instanceColor)),Y===void 0||Y.attribute!==G||G&&Y.data!==G.data)return!0;V++}return r.attributesNum!==V||r.index!==D}function m(L,N,B,D){let F={},H=N.attributes,V=0,z=B.getAttributes();for(let U in z)if(z[U].location>=0){let Y=H[U];Y===void 0&&(U==="instanceMatrix"&&L.instanceMatrix&&(Y=L.instanceMatrix),U==="instanceColor"&&L.instanceColor&&(Y=L.instanceColor));let G={};G.attribute=Y,Y&&Y.data&&(G.data=Y.data),F[U]=G,V++}r.attributes=F,r.attributesNum=V,r.index=D}function _(){let L=r.newAttributes;for(let N=0,B=L.length;N=0){let k=F[z];if(k===void 0&&(z==="instanceMatrix"&&L.instanceMatrix&&(k=L.instanceMatrix),z==="instanceColor"&&L.instanceColor&&(k=L.instanceColor)),k!==void 0){let Y=k.normalized,G=k.itemSize,J=e.get(k);if(J===void 0)continue;let ie=J.buffer,ne=J.type,ae=J.bytesPerElement,O=ne===i.INT||ne===i.UNSIGNED_INT||k.gpuType===ma;if(k.isInterleavedBufferAttribute){let $=k.data,re=$.stride,me=k.offset;if($.isInstancedInterleavedBuffer){for(let he=0;he0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",h=l(c);h!==c&&(We("WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);let d=t.logarithmicDepthBuffer===!0,u=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&u===!1&&We("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let f=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),m=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_TEXTURE_SIZE),g=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),p=i.getParameter(i.MAX_VERTEX_ATTRIBS),y=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),w=i.getParameter(i.MAX_VARYING_VECTORS),b=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),x=i.getParameter(i.MAX_SAMPLES),S=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:d,reversedDepthBuffer:u,maxTextures:f,maxVertexTextures:m,maxTextureSize:_,maxCubemapSize:g,maxAttributes:p,maxVertexUniforms:y,maxVaryings:w,maxFragmentUniforms:b,maxSamples:x,samples:S}}function vx(i){let e=this,t=null,n=0,s=!1,r=!1,o=new At,a=new Je,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){let f=d.length!==0||u||n!==0||s;return s=u,n=d.length,f},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(d,u){t=h(d,u,0)},this.setState=function(d,u,f){let m=d.clippingPlanes,_=d.clipIntersection,g=d.clipShadows,p=i.get(d);if(!s||m===null||m.length===0||r&&!g)r?h(null):c();else{let y=r?0:n,w=y*4,b=p.clippingState||null;l.value=b,b=h(m,u,w,f);for(let x=0;x!==w;++x)b[x]=t[x];p.clippingState=b,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(d,u,f,m){let _=d!==null?d.length:0,g=null;if(_!==0){if(g=l.value,m!==!0||g===null){let p=f+_*4,y=u.matrixWorldInverse;a.getNormalMatrix(y),(g===null||g.length0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Wd(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Gd(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?x:0,x,x),d.setRenderTarget(s),p&&d.render(_,l),d.render(e,l)}d.toneMapping=f,d.autoClear=u,e.background=y}_textureToCubeUV(e,t){let n=this._renderer,s=e.mapping===Mi||e.mapping===Xi;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Wd()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Gd());let r=s?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=r;let a=r.uniforms;a.envMap.value=e;let l=this._cubeSize;Fs(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,Dr)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let s=this._lodMeshes.length;for(let r=1;rm-Bs?n-m+Bs:0),p=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=f,l.mipInt.value=m-t,Fs(r,g,p,3*_,2*_),s.setRenderTarget(r),s.render(a,Dr),l.envMap.value=r.texture,l.roughness.value=0,l.mipInt.value=m-n,Fs(e,g,p,3*_,2*_),s.setRenderTarget(e),s.render(a,Dr)}_blur(e,t,n,s){let r=this._pingPongRenderTarget,o=Math.min(s,Math.PI)/Math.SQRT2;this._blurPass(e,r,t,n,o),this._blurPass(r,e,n,n,o)}_blurPass(e,t,n,s,r){let o=this._renderer,a=this._blurMaterial,l=this._lodMeshes[s];l.material=a;let c=a.uniforms;c.envMap.value=e.texture,c.sigma.value=r,c.mipInt.value=this._lodMax-n;let h=this._sizeLods[s],d=3*h*(s>this._lodMax-Bs?s-this._lodMax+Bs:0),u=4*(this._cubeSize-h);Fs(t,d,u,3*h,2*h),o.setRenderTarget(t),o.render(l,Dr)}};function wx(i){let e=[],t=[],n=i,s=i-Bs+1+yx;for(let r=0;r2?0:-1,b=[y,w,0,y+2/3,w,0,y+2/3,w+1,0,y,w,0,y+2/3,w+1,0,y,w+1,0];m.set(b,f*u*p);for(let x=0;xBs&&n--}return{lodMeshes:t,sizeLods:e}}function Vd(i,e,t){let n=new Bt(i,e,t);return n.texture.mapping=Sr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Fs(i,e,t,n,s){i.viewport.set(e,t,n,s),i.scissor.set(e,t,n,s)}function Ex(i,e,t){return new It({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Mx,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:il(),fragmentShader:` precision highp float; precision highp int; @@ -3924,7 +3924,7 @@ void main() { gl_FragColor = vec4(prefilteredColor, 1.0); } - `,blending:$n,depthTest:!1,depthWrite:!1})}function fx(i,t,e){return new Ie({name:"SphericalGaussianBlur",defines:{SAMPLES:lx,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},sigma:{value:0},mipInt:{value:0}},vertexShader:nl(),fragmentShader:` + `,blending:$n,depthTest:!1,depthWrite:!1})}function Tx(i,e,t){return new It({name:"SphericalGaussianBlur",defines:{SAMPLES:bx,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},sigma:{value:0},mipInt:{value:0}},vertexShader:il(),fragmentShader:` precision highp float; precision highp int; @@ -3984,7 +3984,7 @@ void main() { gl_FragColor = vec4( accumColor / accumWeight, 1.0 ); } - `,blending:$n,depthTest:!1,depthWrite:!1})}function kd(){return new Ie({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:nl(),fragmentShader:` + `,blending:$n,depthTest:!1,depthWrite:!1})}function Gd(){return new It({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:il(),fragmentShader:` precision mediump float; precision mediump int; @@ -4003,7 +4003,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:$n,depthTest:!1,depthWrite:!1})}function Hd(){return new Ie({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:nl(),fragmentShader:` + `,blending:$n,depthTest:!1,depthWrite:!1})}function Wd(){return new It({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:il(),fragmentShader:` precision mediump float; precision mediump int; @@ -4019,7 +4019,7 @@ void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } - `,blending:$n,depthTest:!1,depthWrite:!1})}function nl(){return` + `,blending:$n,depthTest:!1,depthWrite:!1})}function il(){return` precision mediump float; precision mediump int; @@ -4034,7 +4034,7 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}var el=class extends Be{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let n={width:t,height:t,depth:1},s=[n,n,n,n,n,n];this.texture=new cr(s),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` + `}var nl=class extends Bt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},s=[n,n,n,n,n,n];this.texture=new hr(s),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -4069,7 +4069,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},s=new gn(5,5,5),r=new Ie({name:"CubemapFromEquirect",uniforms:qi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:ze,blending:$n});r.uniforms.tEquirect.value=e;let o=new ge(s,r),a=e.minFilter;return e.minFilter===Si&&(e.minFilter=qe),new la(1,10,this).update(t,o),e.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(t,e=!0,n=!0,s=!0){let r=t.getRenderTarget();for(let o=0;o<6;o++)t.setRenderTarget(this,o),t.clear(e,n,s);t.setRenderTarget(r)}};function px(i){let t=new WeakMap,e=new WeakMap,n=null;function s(u,f=!1){return u==null?null:f?o(u):r(u)}function r(u){if(u&&u.isTexture){let f=u.mapping;if(f===ua||f===da)if(t.has(u)){let m=t.get(u).texture;return a(m,u.mapping)}else{let m=u.image;if(m&&m.height>0){let _=new el(m.height);return _.fromEquirectangularTexture(i,u),t.set(u,_),u.addEventListener("dispose",c),a(_.texture,u.mapping)}else return null}}return u}function o(u){if(u&&u.isTexture){let f=u.mapping,m=f===ua||f===da,_=f===bi||f===Xi;if(m||_){let g=e.get(u),p=g!==void 0?g.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==p)return n===null&&(n=new tl(i)),g=m?n.fromEquirectangular(u,g):n.fromCubemap(u,g),g.texture.pmremVersion=u.pmremVersion,e.set(u,g),g.texture;if(g!==void 0)return g.texture;{let y=u.image;return m&&y&&y.height>0||_&&y&&l(y)?(n===null&&(n=new tl(i)),g=m?n.fromEquirectangular(u):n.fromCubemap(u),g.texture.pmremVersion=u.pmremVersion,e.set(u,g),u.addEventListener("dispose",h),g.texture):null}}}return u}function a(u,f){return f===ua?u.mapping=bi:f===da&&(u.mapping=Xi),u}function l(u){let f=0,m=6;for(let _=0;_=65535?lr:ar)(u,1);g.version=_;let p=r.get(d);p&&t.remove(p),r.set(d,g)}function h(d){let u=r.get(d);if(u){let f=d.index;f!==null&&u.versiont.maxTextureSize&&(x=Math.ceil(M/t.maxTextureSize),M=t.maxTextureSize);let S=new Float32Array(M*x*4*d),A=new or(S,M,x,d);A.type=Ye,A.needsUpdate=!0;let v=w*4;for(let R=0;R0){let _=new nl(m.height);return _.fromEquirectangularTexture(i,u),e.set(u,_),u.addEventListener("dispose",c),a(_.texture,u.mapping)}else return null}}return u}function o(u){if(u&&u.isTexture){let f=u.mapping,m=f===da||f===fa,_=f===Mi||f===Xi;if(m||_){let g=t.get(u),p=g!==void 0?g.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==p)return n===null&&(n=new tl(i)),g=m?n.fromEquirectangular(u,g):n.fromCubemap(u,g),g.texture.pmremVersion=u.pmremVersion,t.set(u,g),g.texture;if(g!==void 0)return g.texture;{let y=u.image;return m&&y&&y.height>0||_&&y&&l(y)?(n===null&&(n=new tl(i)),g=m?n.fromEquirectangular(u):n.fromCubemap(u),g.texture.pmremVersion=u.pmremVersion,t.set(u,g),u.addEventListener("dispose",h),g.texture):null}}}return u}function a(u,f){return f===da?u.mapping=Mi:f===fa&&(u.mapping=Xi),u}function l(u){let f=0,m=6;for(let _=0;_=65535?cr:lr)(u,1);g.version=_;let p=r.get(d);p&&e.remove(p),r.set(d,g)}function h(d){let u=r.get(d);if(u){let f=d.index;f!==null&&u.versione.maxTextureSize&&(x=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);let S=new Float32Array(b*x*4*d),A=new ar(S,b,x,d);A.type=Yt,A.needsUpdate=!0;let v=w*4;for(let R=0;R0&&y[0].isRenderPass===!0;let x=o.width,S=o.height;y.length>0&&a===null&&(a=new Be(x,S,{type:An,depthBuffer:!1,stencilBuffer:!1}),l=new Be(x,S,{type:An,depthBuffer:!1,stencilBuffer:!1}));for(let A=0;A0)return i;let s=t*e,r=Vd[s];if(r===void 0&&(r=new Float32Array(s),Vd[s]=r),t!==0){n.toArray(r,0);for(let o=1,a=0;o!==t;++o)a+=e,i[o].toArray(r,a)}return r}function He(i,t){if(i.length!==t.length)return!1;for(let e=0,n=i.length;e0&&(this.seq=s.concat(r))}setValue(t,e,n,s){let r=this.map[e];r!==void 0&&r.setValue(t,n,s)}setOptional(t,e,n){let s=e[n];s!==void 0&&this.setValue(t,n,s)}static upload(t,e,n,s){for(let r=0,o=e.length;r!==o;++r){let a=e[r],l=n[a.id];l.needsUpdate!==!1&&a.setValue(t,l.value,s)}}static seqWithValue(t,e){let n=[];for(let s=0,r=t.length;s!==r;++s){let o=t[s];o.id in e&&n.push(o)}return n}};function $d(i,t,e){let n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}var hv=37297,uv=0;function dv(i,t){let e=i.split(` -`),n=[],s=Math.max(t-6,0),r=Math.min(t+6,e.length);for(let o=s;o":" "} ${a}: ${e[o]}`)}return n.join(` -`)}var Zd=new Jt;function fv(i){se._getMatrix(Zd,se.workingColorSpace,i);let t=`mat3( ${Zd.elements.map(e=>e.toFixed(4))} )`;switch(se.getTransfer(i)){case sr:return[t,"LinearTransferOETF"];case fe:return[t,"sRGBTransferOETF"];default:return Wt("WebGLProgram: Unsupported color space: ",i),[t,"LinearTransferOETF"]}}function Kd(i,t,e){let n=i.getShaderParameter(t,i.COMPILE_STATUS),r=(i.getShaderInfoLog(t)||"").trim();if(n&&r==="")return"";let o=/ERROR: 0:(\d+)/.exec(r);if(o){let a=parseInt(o[1]);return e.toUpperCase()+` + }`,depthTest:!1,depthWrite:!1}),d=new gt(c,h),u=new Xn(-1,1,1,-1,0,1),f=null,m=null,_=!1,g,p=null,y=[],w=!1;this.setSize=function(b,x){o.setSize(b,x),a!==null&&a.setSize(b,x),l!==null&&l.setSize(b,x);for(let S=0;S0&&y[0].isRenderPass===!0;let x=o.width,S=o.height;y.length>0&&a===null&&(a=new Bt(x,S,{type:Rn,depthBuffer:!1,stencilBuffer:!1}),l=new Bt(x,S,{type:Rn,depthBuffer:!1,stencilBuffer:!1}));for(let A=0;A0)return i;let s=e*t,r=Xd[s];if(r===void 0&&(r=new Float32Array(s),Xd[s]=r),e!==0){n.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(r,a)}return r}function Ht(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t0&&(this.seq=s.concat(r))}setValue(e,t,n,s){let r=this.map[t];r!==void 0&&r.setValue(e,n,s)}setOptional(e,t,n){let s=t[n];s!==void 0&&this.setValue(e,n,s)}static upload(e,t,n,s){for(let r=0,o=t.length;r!==o;++r){let a=t[r],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,s)}}static seqWithValue(e,t){let n=[];for(let s=0,r=e.length;s!==r;++s){let o=e[s];o.id in t&&n.push(o)}return n}};function Jd(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var Sv=37297,wv=0;function Ev(i,e){let t=i.split(` +`),n=[],s=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let o=s;o":" "} ${a}: ${t[o]}`)}return n.join(` +`)}var jd=new Je;function Tv(i){st._getMatrix(jd,st.workingColorSpace,i);let e=`mat3( ${jd.elements.map(t=>t.toFixed(4))} )`;switch(st.getTransfer(i)){case rr:return[e,"LinearTransferOETF"];case ft:return[e,"sRGBTransferOETF"];default:return We("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function Qd(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),r=(i.getShaderInfoLog(e)||"").trim();if(n&&r==="")return"";let o=/ERROR: 0:(\d+)/.exec(r);if(o){let a=parseInt(o[1]);return t.toUpperCase()+` `+r+` -`+dv(i.getShaderSource(t),a)}else return r}function pv(i,t){let e=fv(t);return[`vec4 ${i}( vec4 value ) {`,` return ${e[1]}( vec4( value.rgb * ${e[0]}, value.a ) );`,"}"].join(` -`)}var mv={[Ac]:"Linear",[Rc]:"Reinhard",[Cc]:"Cineon",[Ic]:"ACESFilmic",[Lc]:"AgX",[Dc]:"Neutral",[Pc]:"Custom"};function gv(i,t){let e=mv[t];return e===void 0?(Wt("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}var Qa=new C;function _v(){se.getLuminanceCoefficients(Qa);let i=Qa.x.toFixed(4),t=Qa.y.toFixed(4),e=Qa.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${t}, ${e} );`," return dot( weights, rgb );","}"].join(` -`)}function xv(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Nr).join(` -`)}function vv(i){let t=[];for(let e in i){let n=i[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(` -`)}function yv(i,t){let e={},n=i.getProgramParameter(t,i.ACTIVE_ATTRIBUTES);for(let s=0;s/gm;function dh(i){return i.replace(Mv,Sv)}var bv=new Map;function Sv(i,t){let e=te[t];if(e===void 0){let n=bv.get(t);if(n!==void 0)e=te[n],Wt('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+t+">")}return dh(e)}var wv=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Qd(i){return i.replace(wv,Ev)}function Ev(i,t,e,n){let s="";for(let r=parseInt(t);r/gm;function fh(i){return i.replace(Nv,Fv)}var Uv=new Map;function Fv(i,e){let t=et[e];if(t===void 0){let n=Uv.get(e);if(n!==void 0)t=et[n],We('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return fh(t)}var Bv=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function nf(i){return i.replace(Bv,Ov)}function Ov(i,e,t,n){let s="";for(let r=parseInt(e);r0&&(g+=` -`),p=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m].filter(Nr).join(` +`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Ur).join(` `),p.length>0&&(p+=` -`)):(g=[tf(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+h:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexNormals?"#define HAS_NORMAL":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(Nr).join(` -`),p=[tf(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+c:"",e.envMap?"#define "+h:"",e.envMap?"#define "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.retroreflection?"#define USE_RETROREFLECTION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor?"#define USE_COLOR":"",e.vertexAlphas||e.batchingColor?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==En?"#define TONE_MAPPING":"",e.toneMapping!==En?te.tonemapping_pars_fragment:"",e.toneMapping!==En?gv("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",te.colorspace_pars_fragment,pv("linearToOutputTexel",e.outputColorSpace),_v(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",` -`].filter(Nr).join(` -`)),o=dh(o),o=Jd(o,e),o=jd(o,e),a=dh(a),a=Jd(a,e),a=jd(a,e),o=Qd(o),a=Qd(a),e.isRawShaderMaterial!==!0&&(y=`#version 300 es +`)):(g=[sf(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Ur).join(` +`),p=[sf(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.retroreflection?"#define USE_RETROREFLECTION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Tn?"#define TONE_MAPPING":"",t.toneMapping!==Tn?et.tonemapping_pars_fragment:"",t.toneMapping!==Tn?Cv("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",et.colorspace_pars_fragment,Av("linearToOutputTexel",t.outputColorSpace),Iv(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Ur).join(` +`)),o=fh(o),o=ef(o,t),o=tf(o,t),a=fh(a),a=ef(a,t),a=tf(a,t),o=nf(o),a=nf(a),t.isRawShaderMaterial!==!0&&(y=`#version 300 es `,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+g,p=["#define varying in",e.glslVersion===Xc?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===Xc?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`+g,p=["#define varying in",t.glslVersion===qc?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===qc?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` -`+p);let w=y+g+o,M=y+p+a,x=$d(s,s.VERTEX_SHADER,w),S=$d(s,s.FRAGMENT_SHADER,M);s.attachShader(_,x),s.attachShader(_,S),e.index0AttributeName!==void 0?s.bindAttribLocation(_,0,e.index0AttributeName):e.hasPositionAttribute===!0&&s.bindAttribLocation(_,0,"position"),s.linkProgram(_);function A(L){if(i.debug.checkShaderErrors){let N=s.getProgramInfoLog(_)||"",B=s.getShaderInfoLog(x)||"",D=s.getShaderInfoLog(S)||"",F=N.trim(),H=B.trim(),V=D.trim(),z=!0,U=!0;if(s.getProgramParameter(_,s.LINK_STATUS)===!1)if(z=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,_,x,S);else{let k=Kd(s,x,"vertex"),Y=Kd(s,S,"fragment");$t("WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(_,s.VALIDATE_STATUS)+` +`+p);let w=y+g+o,b=y+p+a,x=Jd(s,s.VERTEX_SHADER,w),S=Jd(s,s.FRAGMENT_SHADER,b);s.attachShader(_,x),s.attachShader(_,S),t.index0AttributeName!==void 0?s.bindAttribLocation(_,0,t.index0AttributeName):t.hasPositionAttribute===!0&&s.bindAttribLocation(_,0,"position"),s.linkProgram(_);function A(L){if(i.debug.checkShaderErrors){let N=s.getProgramInfoLog(_)||"",B=s.getShaderInfoLog(x)||"",D=s.getShaderInfoLog(S)||"",F=N.trim(),H=B.trim(),V=D.trim(),z=!0,U=!0;if(s.getProgramParameter(_,s.LINK_STATUS)===!1)if(z=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,_,x,S);else{let k=Qd(s,x,"vertex"),Y=Qd(s,S,"fragment");$e("WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(_,s.VALIDATE_STATUS)+` Material Name: `+L.name+` Material Type: `+L.type+` Program Info Log: `+F+` `+k+` -`+Y)}else F!==""?Wt("WebGLProgram: Program Info Log:",F):(H===""||V==="")&&(U=!1);U&&(L.diagnostics={runnable:z,programLog:F,vertexShader:{log:H,prefix:g},fragmentShader:{log:V,prefix:p}})}s.deleteShader(x),s.deleteShader(S),v=new Os(s,_),E=yv(s,_)}let v;this.getUniforms=function(){return v===void 0&&A(this),v};let E;this.getAttributes=function(){return E===void 0&&A(this),E};let R=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return R===!1&&(R=s.getProgramParameter(_,hv)),R},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=uv++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=x,this.fragmentShader=S,this}var Fv=0,fh=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t,e,n){let s=this._getShaderCacheForMaterial(t);return s.has(e)===!1&&(s.add(e),e.usedTimes++),s.has(n)===!1&&(s.add(n),n.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderStage(t){return this._getShaderStage(t.vertexShader)}getFragmentShaderStage(t){return this._getShaderStage(t.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){let e=this.shaderCache,n=e.get(t);return n===void 0&&(n=new ph(t),e.set(t,n)),n}},ph=class{constructor(t){this.id=Fv++,this.code=t,this.usedTimes=0}};function Bv(i){return i===Ei||i===Rr||i===Cr}function Ov(i,t,e,n,s,r){let o=new ws,a=new fh,l=new Set,c=[],h=new Map,d=n.logarithmicDepthBuffer,u=n.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(v){return l.add(v),v===0?"uv":`uv${v}`}function _(v,E,R,L,N,B){let D=L.fog,F=N.geometry,H=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?L.environment:null,V=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,z=t.get(v.envMap||H,V),U=z&&z.mapping===br?z.image.height:null,k=f[v.type];v.precision!==null&&(u=n.getMaxPrecision(v.precision),u!==v.precision&&Wt("WebGLProgram.getParameters:",v.precision,"not supported, using",u,"instead."));let Y=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,G=Y!==void 0?Y.length:0,J=0;F.morphAttributes.position!==void 0&&(J=1),F.morphAttributes.normal!==void 0&&(J=2),F.morphAttributes.color!==void 0&&(J=3);let it,nt,at,O;if(k){let be=Kn[k];it=be.vertexShader,nt=be.fragmentShader}else{it=v.vertexShader,nt=v.fragmentShader;let be=a.getVertexShaderStage(v),ue=a.getFragmentShaderStage(v);a.update(v,be,ue),at=be.id,O=ue.id}let $=i.getRenderTarget(),rt=i.state.buffers.depth.getReversed(),mt=N.isInstancedMesh===!0,ht=N.isBatchedMesh===!0,Et=!!v.map,Zt=!!v.matcap,Ct=!!z,Yt=!!v.aoMap,Ht=!!v.lightMap,dt=!!v.bumpMap&&v.wireframe===!1,Nt=!!v.normalMap,Gt=!!v.displacementMap,ne=!!v.emissiveMap,pt=!!v.metalnessMap,Ut=!!v.roughnessMap,P=v.anisotropy>0,ft=v.clearcoat>0,Tt=v.dispersion>0,I=v.retroreflectivity>0,b=v.iridescence>0,Z=v.sheen>0,tt=v.transmission>0,st=P&&!!v.anisotropyMap,gt=ft&&!!v.clearcoatMap,_t=ft&&!!v.clearcoatNormalMap,ot=ft&&!!v.clearcoatRoughnessMap,ct=b&&!!v.iridescenceMap,xt=b&&!!v.iridescenceThicknessMap,Ot=Z&&!!v.sheenColorMap,bt=Z&&!!v.sheenRoughnessMap,vt=!!v.specularMap,zt=!!v.specularColorMap,Xt=!!v.specularIntensityMap,jt=tt&&!!v.transmissionMap,X=tt&&!!v.thicknessMap,yt=!!v.gradientMap,lt=!!v.alphaMap,Mt=v.alphaTest>0,Rt=!!v.alphaHash,ut=!!v.extensions,kt=En;v.toneMapped&&($===null||$.isXRRenderTarget===!0)&&(kt=i.toneMapping);let Ft={shaderID:k,shaderType:v.type,shaderName:v.name,vertexShader:it,fragmentShader:nt,defines:v.defines,customVertexShaderID:at,customFragmentShaderID:O,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:u,batching:ht,batchingColor:ht&&N._colorsTexture!==null,instancing:mt,instancingColor:mt&&N.instanceColor!==null,instancingMorph:mt&&N.morphTexture!==null,outputColorSpace:$===null?i.outputColorSpace:$.isXRRenderTarget===!0?$.texture.colorSpace:se.workingColorSpace,alphaToCoverage:!!v.alphaToCoverage,map:Et,matcap:Zt,envMap:Ct,envMapMode:Ct&&z.mapping,envMapCubeUVHeight:U,aoMap:Yt,lightMap:Ht,bumpMap:dt,normalMap:Nt,displacementMap:Gt,emissiveMap:ne,normalMapObjectSpace:Nt&&v.normalMapType===bd,normalMapTangentSpace:Nt&&v.normalMapType===Ir,packedNormalMap:Nt&&v.normalMapType===Ir&&Bv(v.normalMap.format),metalnessMap:pt,roughnessMap:Ut,anisotropy:P,anisotropyMap:st,clearcoat:ft,clearcoatMap:gt,clearcoatNormalMap:_t,clearcoatRoughnessMap:ot,dispersion:Tt,retroreflection:I,iridescence:b,iridescenceMap:ct,iridescenceThicknessMap:xt,sheen:Z,sheenColorMap:Ot,sheenRoughnessMap:bt,specularMap:vt,specularColorMap:zt,specularIntensityMap:Xt,transmission:tt,transmissionMap:jt,thicknessMap:X,gradientMap:yt,opaque:v.transparent===!1&&v.blending===Ls&&v.alphaToCoverage===!1,alphaMap:lt,alphaTest:Mt,alphaHash:Rt,combine:v.combine,mapUv:Et&&m(v.map.channel),aoMapUv:Yt&&m(v.aoMap.channel),lightMapUv:Ht&&m(v.lightMap.channel),bumpMapUv:dt&&m(v.bumpMap.channel),normalMapUv:Nt&&m(v.normalMap.channel),displacementMapUv:Gt&&m(v.displacementMap.channel),emissiveMapUv:ne&&m(v.emissiveMap.channel),metalnessMapUv:pt&&m(v.metalnessMap.channel),roughnessMapUv:Ut&&m(v.roughnessMap.channel),anisotropyMapUv:st&&m(v.anisotropyMap.channel),clearcoatMapUv:gt&&m(v.clearcoatMap.channel),clearcoatNormalMapUv:_t&&m(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ot&&m(v.clearcoatRoughnessMap.channel),iridescenceMapUv:ct&&m(v.iridescenceMap.channel),iridescenceThicknessMapUv:xt&&m(v.iridescenceThicknessMap.channel),sheenColorMapUv:Ot&&m(v.sheenColorMap.channel),sheenRoughnessMapUv:bt&&m(v.sheenRoughnessMap.channel),specularMapUv:vt&&m(v.specularMap.channel),specularColorMapUv:zt&&m(v.specularColorMap.channel),specularIntensityMapUv:Xt&&m(v.specularIntensityMap.channel),transmissionMapUv:jt&&m(v.transmissionMap.channel),thicknessMapUv:X&&m(v.thicknessMap.channel),alphaMapUv:lt&&m(v.alphaMap.channel),vertexTangents:!!F.attributes.tangent&&(Nt||P),vertexNormals:!!F.attributes.normal,vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!F.attributes.color&&F.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!F.attributes.uv&&(Et||lt),fog:!!D,useFog:v.fog===!0,fogExp2:!!D&&D.isFogExp2,flatShading:v.wireframe===!1&&(v.flatShading===!0||F.attributes.normal===void 0&&Nt===!1&&(v.isMeshLambertMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isMeshPhysicalMaterial)),sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:rt,skinning:N.isSkinnedMesh===!0,hasPositionAttribute:F.attributes.position!==void 0,morphTargets:F.morphAttributes.position!==void 0,morphNormals:F.morphAttributes.normal!==void 0,morphColors:F.morphAttributes.color!==void 0,morphTargetsCount:G,morphTextureStride:J,numSunLights:E.sun.length,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numSunLightShadows:E.sunShadowMap.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numLightProbeGrids:B.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:v.dithering,shadowMapEnabled:i.shadowMap.enabled&&R.length>0,shadowMapType:i.shadowMap.type,toneMapping:kt,decodeVideoTexture:Et&&v.map.isVideoTexture===!0&&se.getTransfer(v.map.colorSpace)===fe,decodeVideoTextureEmissive:ne&&v.emissiveMap.isVideoTexture===!0&&se.getTransfer(v.emissiveMap.colorSpace)===fe,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===ke,flipSided:v.side===ze,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionClipCullDistance:ut&&v.extensions.clipCullDistance===!0&&e.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ut&&v.extensions.multiDraw===!0||ht)&&e.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:e.has("KHR_parallel_shader_compile"),customProgramCacheKey:v.customProgramCacheKey()};return Ft.vertexUv1s=l.has(1),Ft.vertexUv2s=l.has(2),Ft.vertexUv3s=l.has(3),l.clear(),Ft}function g(v){let E=[];if(v.shaderID?E.push(v.shaderID):(E.push(v.customVertexShaderID),E.push(v.customFragmentShaderID)),v.defines!==void 0)for(let R in v.defines)E.push(R),E.push(v.defines[R]);return v.isRawShaderMaterial===!1&&(p(E,v),y(E,v),E.push(i.outputColorSpace)),E.push(v.customProgramCacheKey),E.join()}function p(v,E){v.push(E.precision),v.push(E.outputColorSpace),v.push(E.envMapMode),v.push(E.envMapCubeUVHeight),v.push(E.mapUv),v.push(E.alphaMapUv),v.push(E.lightMapUv),v.push(E.aoMapUv),v.push(E.bumpMapUv),v.push(E.normalMapUv),v.push(E.displacementMapUv),v.push(E.emissiveMapUv),v.push(E.metalnessMapUv),v.push(E.roughnessMapUv),v.push(E.anisotropyMapUv),v.push(E.clearcoatMapUv),v.push(E.clearcoatNormalMapUv),v.push(E.clearcoatRoughnessMapUv),v.push(E.iridescenceMapUv),v.push(E.iridescenceThicknessMapUv),v.push(E.sheenColorMapUv),v.push(E.sheenRoughnessMapUv),v.push(E.specularMapUv),v.push(E.specularColorMapUv),v.push(E.specularIntensityMapUv),v.push(E.transmissionMapUv),v.push(E.thicknessMapUv),v.push(E.combine),v.push(E.fogExp2),v.push(E.sizeAttenuation),v.push(E.morphTargetsCount),v.push(E.morphAttributeCount),v.push(E.numSunLights),v.push(E.numDirLights),v.push(E.numPointLights),v.push(E.numSpotLights),v.push(E.numSpotLightMaps),v.push(E.numHemiLights),v.push(E.numRectAreaLights),v.push(E.numSunLightShadows),v.push(E.numDirLightShadows),v.push(E.numPointLightShadows),v.push(E.numSpotLightShadows),v.push(E.numSpotLightShadowsWithMaps),v.push(E.numLightProbes),v.push(E.shadowMapType),v.push(E.toneMapping),v.push(E.numClippingPlanes),v.push(E.numClipIntersection),v.push(E.depthPacking)}function y(v,E){o.disableAll(),E.instancing&&o.enable(0),E.instancingColor&&o.enable(1),E.instancingMorph&&o.enable(2),E.matcap&&o.enable(3),E.envMap&&o.enable(4),E.normalMapObjectSpace&&o.enable(5),E.normalMapTangentSpace&&o.enable(6),E.clearcoat&&o.enable(7),E.iridescence&&o.enable(8),E.alphaTest&&o.enable(9),E.vertexColors&&o.enable(10),E.vertexAlphas&&o.enable(11),E.vertexUv1s&&o.enable(12),E.vertexUv2s&&o.enable(13),E.vertexUv3s&&o.enable(14),E.vertexTangents&&o.enable(15),E.anisotropy&&o.enable(16),E.alphaHash&&o.enable(17),E.batching&&o.enable(18),E.dispersion&&o.enable(19),E.retroreflection&&o.enable(24),E.batchingColor&&o.enable(20),E.gradientMap&&o.enable(21),E.packedNormalMap&&o.enable(22),E.vertexNormals&&o.enable(23),v.push(o.mask),o.disableAll(),E.fog&&o.enable(0),E.useFog&&o.enable(1),E.flatShading&&o.enable(2),E.logarithmicDepthBuffer&&o.enable(3),E.reversedDepthBuffer&&o.enable(4),E.skinning&&o.enable(5),E.morphTargets&&o.enable(6),E.morphNormals&&o.enable(7),E.morphColors&&o.enable(8),E.premultipliedAlpha&&o.enable(9),E.shadowMapEnabled&&o.enable(10),E.doubleSided&&o.enable(11),E.flipSided&&o.enable(12),E.useDepthPacking&&o.enable(13),E.dithering&&o.enable(14),E.transmission&&o.enable(15),E.sheen&&o.enable(16),E.opaque&&o.enable(17),E.pointsUvs&&o.enable(18),E.decodeVideoTexture&&o.enable(19),E.decodeVideoTextureEmissive&&o.enable(20),E.alphaToCoverage&&o.enable(21),E.numLightProbeGrids>0&&o.enable(22),E.hasPositionAttribute&&o.enable(23),v.push(o.mask)}function w(v){let E=f[v.type],R;if(E){let L=Kn[E];R=Ud.clone(L.uniforms)}else R=v.uniforms;return R}function M(v,E){let R=h.get(E);return R!==void 0?++R.usedTimes:(R=new Uv(i,E,v,s),c.push(R),h.set(E,R)),R}function x(v){if(--v.usedTimes===0){let E=c.indexOf(v);c[E]=c[c.length-1],c.pop(),h.delete(v.cacheKey),v.destroy()}}function S(v){a.remove(v)}function A(){a.dispose()}return{getParameters:_,getProgramCacheKey:g,getUniforms:w,acquireProgram:M,releaseProgram:x,releaseShaderCache:S,programs:c,dispose:A}}function zv(){let i=new WeakMap;function t(o){return i.has(o)}function e(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function s(o,a,l){i.get(o)[a]=l}function r(){i=new WeakMap}return{has:t,get:e,remove:n,update:s,dispose:r}}function kv(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.material.id!==t.material.id?i.material.id-t.material.id:i.materialVariant!==t.materialVariant?i.materialVariant-t.materialVariant:i.z!==t.z?i.z-t.z:i.id-t.id}function ef(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.z!==t.z?t.z-i.z:i.id-t.id}function nf(){let i=[],t=0,e=[],n=[],s=[];function r(){t=0,e.length=0,n.length=0,s.length=0}function o(u){let f=0;return u.isInstancedMesh&&(f+=2),u.isSkinnedMesh&&(f+=1),f}function a(u,f,m,_,g,p){let y=i[t];return y===void 0?(y={id:u.id,object:u,geometry:f,material:m,materialVariant:o(u),groupOrder:_,renderOrder:u.renderOrder,z:g,group:p},i[t]=y):(y.id=u.id,y.object=u,y.geometry=f,y.material=m,y.materialVariant=o(u),y.groupOrder=_,y.renderOrder=u.renderOrder,y.z=g,y.group=p),t++,y}function l(u,f,m,_,g,p,y){y.reversedDepth===!0&&(g=-g);let w=a(u,f,m,_,g,p);m.transmission>0?n.push(w):m.transparent===!0?s.push(w):e.push(w)}function c(u,f,m,_,g,p){let y=a(u,f,m,_,g,p);m.transmission>0?n.unshift(y):m.transparent===!0?s.unshift(y):e.unshift(y)}function h(u,f){e.length>1&&e.sort(u||kv),n.length>1&&n.sort(f||ef),s.length>1&&s.sort(f||ef)}function d(){for(let u=t,f=i.length;u=r.length?(o=new nf,r.push(o)):o=r[s],o}function e(){i=new WeakMap}return{get:t,dispose:e}}function Vv(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"SunLight":case"DirectionalLight":e={direction:new C,color:new Vt};break;case"SpotLight":e={position:new C,direction:new C,color:new Vt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new C,color:new Vt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new C,skyColor:new Vt,groundColor:new Vt};break;case"RectAreaLight":e={color:new Vt,position:new C,halfWidth:new C,halfHeight:new C};break}return i[t.id]=e,e}}}function Gv(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"SunLight":case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new qt};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new qt};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new qt,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}var Wv=0;function Xv(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function qv(i){let t=new Vv,e=Gv(),n={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new C);let s=new C,r=new Kt,o=new Kt;function a(c){let h=0,d=0,u=0;for(let N=0;N<9;N++)n.probe[N].set(0,0,0);let f=0,m=0,_=0,g=0,p=0,y=0,w=0,M=0,x=0,S=0,A=0,v=0,E=0,R=0;c.sort(Xv);for(let N=0,B=c.length;N0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=St.LTC_FLOAT_1,n.rectAreaLTC2=St.LTC_FLOAT_2):(n.rectAreaLTC1=St.LTC_HALF_1,n.rectAreaLTC2=St.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=d,n.ambient[2]=u;let L=n.hash;(L.sunLength!==f||L.directionalLength!==g||L.pointLength!==p||L.spotLength!==y||L.rectAreaLength!==w||L.hemiLength!==M||L.numSunShadows!==m||L.numDirectionalShadows!==x||L.numPointShadows!==S||L.numSpotShadows!==A||L.numSpotMaps!==v||L.numLightProbes!==R)&&(n.sun.length=f,n.directional.length=g,n.spot.length=y,n.rectArea.length=w,n.point.length=p,n.hemi.length=M,n.sunShadow.length=m,n.sunShadowMap.length=m,n.sunShadowMatrix.length=_,n.sunShadowCascade.length=_,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.directionalShadowMatrix.length=x,n.pointShadow.length=S,n.pointShadowMap.length=S,n.pointShadowMatrix.length=S,n.spotShadow.length=A,n.spotShadowMap.length=A,n.spotLightMatrix.length=A+v-E,n.spotLightMap.length=v,n.numSpotLightShadowsWithMaps=E,n.numLightProbes=R,L.sunLength=f,L.directionalLength=g,L.pointLength=p,L.spotLength=y,L.rectAreaLength=w,L.hemiLength=M,L.numSunShadows=m,L.numDirectionalShadows=x,L.numPointShadows=S,L.numSpotShadows=A,L.numSpotMaps=v,L.numLightProbes=R,n.version=Wv++)}function l(c,h){let d=0,u=0,f=0,m=0,_=0,g=0,p=h.matrixWorldInverse;for(let y=0,w=c.length;y=o.length?(a=new sf(i),o.push(a)):a=o[r],a}function n(){t=new WeakMap}return{get:e,dispose:n}}var $v=`void main() { +`+Y)}else F!==""?We("WebGLProgram: Program Info Log:",F):(H===""||V==="")&&(U=!1);U&&(L.diagnostics={runnable:z,programLog:F,vertexShader:{log:H,prefix:g},fragmentShader:{log:V,prefix:p}})}s.deleteShader(x),s.deleteShader(S),v=new Os(s,_),E=Dv(s,_)}let v;this.getUniforms=function(){return v===void 0&&A(this),v};let E;this.getAttributes=function(){return E===void 0&&A(this),E};let R=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return R===!1&&(R=s.getProgramParameter(_,Sv)),R},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=wv++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=x,this.fragmentShader=S,this}var Zv=0,ph=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let s=this._getShaderCacheForMaterial(e);return s.has(t)===!1&&(s.add(t),t.usedTimes++),s.has(n)===!1&&(s.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new mh(e),t.set(e,n)),n}},mh=class{constructor(e){this.id=Zv++,this.code=e,this.usedTimes=0}};function Kv(i){return i===Ei||i===Cr||i===Ir}function Jv(i,e,t,n,s,r){let o=new ws,a=new ph,l=new Set,c=[],h=new Map,d=n.logarithmicDepthBuffer,u=n.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(v){return l.add(v),v===0?"uv":`uv${v}`}function _(v,E,R,L,N,B){let D=L.fog,F=N.geometry,H=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?L.environment:null,V=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,z=e.get(v.envMap||H,V),U=z&&z.mapping===Sr?z.image.height:null,k=f[v.type];v.precision!==null&&(u=n.getMaxPrecision(v.precision),u!==v.precision&&We("WebGLProgram.getParameters:",v.precision,"not supported, using",u,"instead."));let Y=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,G=Y!==void 0?Y.length:0,J=0;F.morphAttributes.position!==void 0&&(J=1),F.morphAttributes.normal!==void 0&&(J=2),F.morphAttributes.color!==void 0&&(J=3);let ie,ne,ae,O;if(k){let Mt=Kn[k];ie=Mt.vertexShader,ne=Mt.fragmentShader}else{ie=v.vertexShader,ne=v.fragmentShader;let Mt=a.getVertexShaderStage(v),ut=a.getFragmentShaderStage(v);a.update(v,Mt,ut),ae=Mt.id,O=ut.id}let $=i.getRenderTarget(),re=i.state.buffers.depth.getReversed(),me=N.isInstancedMesh===!0,he=N.isBatchedMesh===!0,Ee=!!v.map,Ze=!!v.matcap,Ce=!!z,Ye=!!v.aoMap,He=!!v.lightMap,de=!!v.bumpMap&&v.wireframe===!1,Ne=!!v.normalMap,Ge=!!v.displacementMap,nt=!!v.emissiveMap,pe=!!v.metalnessMap,Ue=!!v.roughnessMap,P=v.anisotropy>0,fe=v.clearcoat>0,Te=v.dispersion>0,I=v.retroreflectivity>0,M=v.iridescence>0,Z=v.sheen>0,ee=v.transmission>0,se=P&&!!v.anisotropyMap,ge=fe&&!!v.clearcoatMap,_e=fe&&!!v.clearcoatNormalMap,oe=fe&&!!v.clearcoatRoughnessMap,ce=M&&!!v.iridescenceMap,xe=M&&!!v.iridescenceThicknessMap,Oe=Z&&!!v.sheenColorMap,Me=Z&&!!v.sheenRoughnessMap,ve=!!v.specularMap,ze=!!v.specularColorMap,Xe=!!v.specularIntensityMap,je=ee&&!!v.transmissionMap,q=ee&&!!v.thicknessMap,ye=!!v.gradientMap,le=!!v.alphaMap,be=v.alphaTest>0,Re=!!v.alphaHash,ue=!!v.extensions,ke=Tn;v.toneMapped&&($===null||$.isXRRenderTarget===!0)&&(ke=i.toneMapping);let Fe={shaderID:k,shaderType:v.type,shaderName:v.name,vertexShader:ie,fragmentShader:ne,defines:v.defines,customVertexShaderID:ae,customFragmentShaderID:O,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:u,batching:he,batchingColor:he&&N._colorsTexture!==null,instancing:me,instancingColor:me&&N.instanceColor!==null,instancingMorph:me&&N.morphTexture!==null,outputColorSpace:$===null?i.outputColorSpace:$.isXRRenderTarget===!0?$.texture.colorSpace:st.workingColorSpace,alphaToCoverage:!!v.alphaToCoverage,map:Ee,matcap:Ze,envMap:Ce,envMapMode:Ce&&z.mapping,envMapCubeUVHeight:U,aoMap:Ye,lightMap:He,bumpMap:de,normalMap:Ne,displacementMap:Ge,emissiveMap:nt,normalMapObjectSpace:Ne&&v.normalMapType===Ed,normalMapTangentSpace:Ne&&v.normalMapType===Pr,packedNormalMap:Ne&&v.normalMapType===Pr&&Kv(v.normalMap.format),metalnessMap:pe,roughnessMap:Ue,anisotropy:P,anisotropyMap:se,clearcoat:fe,clearcoatMap:ge,clearcoatNormalMap:_e,clearcoatRoughnessMap:oe,dispersion:Te,retroreflection:I,iridescence:M,iridescenceMap:ce,iridescenceThicknessMap:xe,sheen:Z,sheenColorMap:Oe,sheenRoughnessMap:Me,specularMap:ve,specularColorMap:ze,specularIntensityMap:Xe,transmission:ee,transmissionMap:je,thicknessMap:q,gradientMap:ye,opaque:v.transparent===!1&&v.blending===Ls&&v.alphaToCoverage===!1,alphaMap:le,alphaTest:be,alphaHash:Re,combine:v.combine,mapUv:Ee&&m(v.map.channel),aoMapUv:Ye&&m(v.aoMap.channel),lightMapUv:He&&m(v.lightMap.channel),bumpMapUv:de&&m(v.bumpMap.channel),normalMapUv:Ne&&m(v.normalMap.channel),displacementMapUv:Ge&&m(v.displacementMap.channel),emissiveMapUv:nt&&m(v.emissiveMap.channel),metalnessMapUv:pe&&m(v.metalnessMap.channel),roughnessMapUv:Ue&&m(v.roughnessMap.channel),anisotropyMapUv:se&&m(v.anisotropyMap.channel),clearcoatMapUv:ge&&m(v.clearcoatMap.channel),clearcoatNormalMapUv:_e&&m(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:oe&&m(v.clearcoatRoughnessMap.channel),iridescenceMapUv:ce&&m(v.iridescenceMap.channel),iridescenceThicknessMapUv:xe&&m(v.iridescenceThicknessMap.channel),sheenColorMapUv:Oe&&m(v.sheenColorMap.channel),sheenRoughnessMapUv:Me&&m(v.sheenRoughnessMap.channel),specularMapUv:ve&&m(v.specularMap.channel),specularColorMapUv:ze&&m(v.specularColorMap.channel),specularIntensityMapUv:Xe&&m(v.specularIntensityMap.channel),transmissionMapUv:je&&m(v.transmissionMap.channel),thicknessMapUv:q&&m(v.thicknessMap.channel),alphaMapUv:le&&m(v.alphaMap.channel),vertexTangents:!!F.attributes.tangent&&(Ne||P),vertexNormals:!!F.attributes.normal,vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!F.attributes.color&&F.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!F.attributes.uv&&(Ee||le),fog:!!D,useFog:v.fog===!0,fogExp2:!!D&&D.isFogExp2,flatShading:v.wireframe===!1&&(v.flatShading===!0||F.attributes.normal===void 0&&Ne===!1&&(v.isMeshLambertMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isMeshPhysicalMaterial)),sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:re,skinning:N.isSkinnedMesh===!0,hasPositionAttribute:F.attributes.position!==void 0,morphTargets:F.morphAttributes.position!==void 0,morphNormals:F.morphAttributes.normal!==void 0,morphColors:F.morphAttributes.color!==void 0,morphTargetsCount:G,morphTextureStride:J,numSunLights:E.sun.length,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numSunLightShadows:E.sunShadowMap.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numLightProbeGrids:B.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:v.dithering,shadowMapEnabled:i.shadowMap.enabled&&R.length>0,shadowMapType:i.shadowMap.type,toneMapping:ke,decodeVideoTexture:Ee&&v.map.isVideoTexture===!0&&st.getTransfer(v.map.colorSpace)===ft,decodeVideoTextureEmissive:nt&&v.emissiveMap.isVideoTexture===!0&&st.getTransfer(v.emissiveMap.colorSpace)===ft,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===kt,flipSided:v.side===zt,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionClipCullDistance:ue&&v.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ue&&v.extensions.multiDraw===!0||he)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:v.customProgramCacheKey()};return Fe.vertexUv1s=l.has(1),Fe.vertexUv2s=l.has(2),Fe.vertexUv3s=l.has(3),l.clear(),Fe}function g(v){let E=[];if(v.shaderID?E.push(v.shaderID):(E.push(v.customVertexShaderID),E.push(v.customFragmentShaderID)),v.defines!==void 0)for(let R in v.defines)E.push(R),E.push(v.defines[R]);return v.isRawShaderMaterial===!1&&(p(E,v),y(E,v),E.push(i.outputColorSpace)),E.push(v.customProgramCacheKey),E.join()}function p(v,E){v.push(E.precision),v.push(E.outputColorSpace),v.push(E.envMapMode),v.push(E.envMapCubeUVHeight),v.push(E.mapUv),v.push(E.alphaMapUv),v.push(E.lightMapUv),v.push(E.aoMapUv),v.push(E.bumpMapUv),v.push(E.normalMapUv),v.push(E.displacementMapUv),v.push(E.emissiveMapUv),v.push(E.metalnessMapUv),v.push(E.roughnessMapUv),v.push(E.anisotropyMapUv),v.push(E.clearcoatMapUv),v.push(E.clearcoatNormalMapUv),v.push(E.clearcoatRoughnessMapUv),v.push(E.iridescenceMapUv),v.push(E.iridescenceThicknessMapUv),v.push(E.sheenColorMapUv),v.push(E.sheenRoughnessMapUv),v.push(E.specularMapUv),v.push(E.specularColorMapUv),v.push(E.specularIntensityMapUv),v.push(E.transmissionMapUv),v.push(E.thicknessMapUv),v.push(E.combine),v.push(E.fogExp2),v.push(E.sizeAttenuation),v.push(E.morphTargetsCount),v.push(E.morphAttributeCount),v.push(E.numSunLights),v.push(E.numDirLights),v.push(E.numPointLights),v.push(E.numSpotLights),v.push(E.numSpotLightMaps),v.push(E.numHemiLights),v.push(E.numRectAreaLights),v.push(E.numSunLightShadows),v.push(E.numDirLightShadows),v.push(E.numPointLightShadows),v.push(E.numSpotLightShadows),v.push(E.numSpotLightShadowsWithMaps),v.push(E.numLightProbes),v.push(E.shadowMapType),v.push(E.toneMapping),v.push(E.numClippingPlanes),v.push(E.numClipIntersection),v.push(E.depthPacking)}function y(v,E){o.disableAll(),E.instancing&&o.enable(0),E.instancingColor&&o.enable(1),E.instancingMorph&&o.enable(2),E.matcap&&o.enable(3),E.envMap&&o.enable(4),E.normalMapObjectSpace&&o.enable(5),E.normalMapTangentSpace&&o.enable(6),E.clearcoat&&o.enable(7),E.iridescence&&o.enable(8),E.alphaTest&&o.enable(9),E.vertexColors&&o.enable(10),E.vertexAlphas&&o.enable(11),E.vertexUv1s&&o.enable(12),E.vertexUv2s&&o.enable(13),E.vertexUv3s&&o.enable(14),E.vertexTangents&&o.enable(15),E.anisotropy&&o.enable(16),E.alphaHash&&o.enable(17),E.batching&&o.enable(18),E.dispersion&&o.enable(19),E.retroreflection&&o.enable(24),E.batchingColor&&o.enable(20),E.gradientMap&&o.enable(21),E.packedNormalMap&&o.enable(22),E.vertexNormals&&o.enable(23),v.push(o.mask),o.disableAll(),E.fog&&o.enable(0),E.useFog&&o.enable(1),E.flatShading&&o.enable(2),E.logarithmicDepthBuffer&&o.enable(3),E.reversedDepthBuffer&&o.enable(4),E.skinning&&o.enable(5),E.morphTargets&&o.enable(6),E.morphNormals&&o.enable(7),E.morphColors&&o.enable(8),E.premultipliedAlpha&&o.enable(9),E.shadowMapEnabled&&o.enable(10),E.doubleSided&&o.enable(11),E.flipSided&&o.enable(12),E.useDepthPacking&&o.enable(13),E.dithering&&o.enable(14),E.transmission&&o.enable(15),E.sheen&&o.enable(16),E.opaque&&o.enable(17),E.pointsUvs&&o.enable(18),E.decodeVideoTexture&&o.enable(19),E.decodeVideoTextureEmissive&&o.enable(20),E.alphaToCoverage&&o.enable(21),E.numLightProbeGrids>0&&o.enable(22),E.hasPositionAttribute&&o.enable(23),v.push(o.mask)}function w(v){let E=f[v.type],R;if(E){let L=Kn[E];R=Od.clone(L.uniforms)}else R=v.uniforms;return R}function b(v,E){let R=h.get(E);return R!==void 0?++R.usedTimes:(R=new $v(i,E,v,s),c.push(R),h.set(E,R)),R}function x(v){if(--v.usedTimes===0){let E=c.indexOf(v);c[E]=c[c.length-1],c.pop(),h.delete(v.cacheKey),v.destroy()}}function S(v){a.remove(v)}function A(){a.dispose()}return{getParameters:_,getProgramCacheKey:g,getUniforms:w,acquireProgram:b,releaseProgram:x,releaseShaderCache:S,programs:c,dispose:A}}function jv(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function s(o,a,l){i.get(o)[a]=l}function r(){i=new WeakMap}return{has:e,get:t,remove:n,update:s,dispose:r}}function Qv(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function rf(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function of(){let i=[],e=0,t=[],n=[],s=[];function r(){e=0,t.length=0,n.length=0,s.length=0}function o(u){let f=0;return u.isInstancedMesh&&(f+=2),u.isSkinnedMesh&&(f+=1),f}function a(u,f,m,_,g,p){let y=i[e];return y===void 0?(y={id:u.id,object:u,geometry:f,material:m,materialVariant:o(u),groupOrder:_,renderOrder:u.renderOrder,z:g,group:p},i[e]=y):(y.id=u.id,y.object=u,y.geometry=f,y.material=m,y.materialVariant=o(u),y.groupOrder=_,y.renderOrder=u.renderOrder,y.z=g,y.group=p),e++,y}function l(u,f,m,_,g,p,y){y.reversedDepth===!0&&(g=-g);let w=a(u,f,m,_,g,p);m.transmission>0?n.push(w):m.transparent===!0?s.push(w):t.push(w)}function c(u,f,m,_,g,p){let y=a(u,f,m,_,g,p);m.transmission>0?n.unshift(y):m.transparent===!0?s.unshift(y):t.unshift(y)}function h(u,f){t.length>1&&t.sort(u||Qv),n.length>1&&n.sort(f||rf),s.length>1&&s.sort(f||rf)}function d(){for(let u=e,f=i.length;u=r.length?(o=new of,r.push(o)):o=r[s],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function ty(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"SunLight":case"DirectionalLight":t={direction:new C,color:new Ve};break;case"SpotLight":t={position:new C,direction:new C,color:new Ve,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new C,color:new Ve,distance:0,decay:0};break;case"HemisphereLight":t={direction:new C,skyColor:new Ve,groundColor:new Ve};break;case"RectAreaLight":t={color:new Ve,position:new C,halfWidth:new C,halfHeight:new C};break}return i[e.id]=t,t}}}function ny(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"SunLight":case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new qe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new qe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new qe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var iy=0;function sy(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function ry(i){let e=new ty,t=ny(),n={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new C);let s=new C,r=new Ke,o=new Ke;function a(c){let h=0,d=0,u=0;for(let N=0;N<9;N++)n.probe[N].set(0,0,0);let f=0,m=0,_=0,g=0,p=0,y=0,w=0,b=0,x=0,S=0,A=0,v=0,E=0,R=0;c.sort(sy);for(let N=0,B=c.length;N0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Se.LTC_FLOAT_1,n.rectAreaLTC2=Se.LTC_FLOAT_2):(n.rectAreaLTC1=Se.LTC_HALF_1,n.rectAreaLTC2=Se.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=d,n.ambient[2]=u;let L=n.hash;(L.sunLength!==f||L.directionalLength!==g||L.pointLength!==p||L.spotLength!==y||L.rectAreaLength!==w||L.hemiLength!==b||L.numSunShadows!==m||L.numDirectionalShadows!==x||L.numPointShadows!==S||L.numSpotShadows!==A||L.numSpotMaps!==v||L.numLightProbes!==R)&&(n.sun.length=f,n.directional.length=g,n.spot.length=y,n.rectArea.length=w,n.point.length=p,n.hemi.length=b,n.sunShadow.length=m,n.sunShadowMap.length=m,n.sunShadowMatrix.length=_,n.sunShadowCascade.length=_,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.directionalShadowMatrix.length=x,n.pointShadow.length=S,n.pointShadowMap.length=S,n.pointShadowMatrix.length=S,n.spotShadow.length=A,n.spotShadowMap.length=A,n.spotLightMatrix.length=A+v-E,n.spotLightMap.length=v,n.numSpotLightShadowsWithMaps=E,n.numLightProbes=R,L.sunLength=f,L.directionalLength=g,L.pointLength=p,L.spotLength=y,L.rectAreaLength=w,L.hemiLength=b,L.numSunShadows=m,L.numDirectionalShadows=x,L.numPointShadows=S,L.numSpotShadows=A,L.numSpotMaps=v,L.numLightProbes=R,n.version=iy++)}function l(c,h){let d=0,u=0,f=0,m=0,_=0,g=0,p=h.matrixWorldInverse;for(let y=0,w=c.length;y=o.length?(a=new af(i),o.push(a)):a=o[r],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var ay=`void main() { gl_Position = vec4( position, 1.0 ); -}`,Zv=`uniform sampler2D shadow_pass; +}`,ly=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; void main() { @@ -4193,12 +4193,12 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); -}`,Kv=[new C(1,0,0),new C(-1,0,0),new C(0,1,0),new C(0,-1,0),new C(0,0,1),new C(0,0,-1)],Jv=[new C(0,-1,0),new C(0,-1,0),new C(0,0,1),new C(0,0,-1),new C(0,-1,0),new C(0,-1,0)],rf=new Kt,Dr=new C,ah=new C;function jv(i,t,e){let n=new Hn,s=new qt,r=new qt,o=new ve,a=new Zo,l=new Ko,c={},h=e.maxTextureSize,d={[Yn]:ze,[ze]:Yn,[ke]:ke},u=new Ie({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new qt},radius:{value:4}},vertexShader:$v,fragmentShader:Zv}),f=u.clone();f.defines.HORIZONTAL_PASS=1;let m=new he;m.setAttribute("position",new xe(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let _=new ge(m,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=yr;let p=this.type;this.render=function(S,A,v){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||S.length===0)return;this.type===Qu&&(Wt("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=yr);let E=i.getRenderTarget(),R=i.getActiveCubeFace(),L=i.getActiveMipmapLevel(),N=i.state;N.setBlending($n),N.buffers.depth.getReversed()===!0?N.buffers.color.setClear(0,0,0,0):N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);let B=p!==this.type;B&&A.traverse(function(D){D.material&&(Array.isArray(D.material)?D.material.forEach(F=>F.needsUpdate=!0):D.material.needsUpdate=!0)});for(let D=0,F=S.length;Dh||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/z.x),s.x=r.x*z.x,V.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/z.y),s.y=r.y*z.y,V.mapSize.y=r.y));let U=i.state.buffers.depth.getReversed();if(V.camera._reversedDepth=U,V.map===null||B===!0){if(V.map!==null&&(V.map.depthTexture!==null&&(V.map.depthTexture.dispose(),V.map.depthTexture=null),V.map.dispose()),this.type===Ps){if(H.isPointLight){Wt("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}V.map=new Be(s.x,s.y,{format:Ei,type:An,minFilter:qe,magFilter:qe,generateMipmaps:!1}),V.map.texture.name=H.name+".shadowMap",V.map.depthTexture=new Gn(s.x,s.y,Ye),V.map.depthTexture.name=H.name+".shadowMapDepth",V.map.depthTexture.format=On,V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=Le,V.map.depthTexture.magFilter=Le}else H.isPointLight?(V.map=new el(s.x),V.map.depthTexture=new Yo(s.x,Tn)):(V.map=new Be(s.x,s.y),V.map.depthTexture=new Gn(s.x,s.y,Tn)),V.map.depthTexture.name=H.name+".shadowMap",V.map.depthTexture.format=On,this.type===yr?(V.map.depthTexture.compareFunction=U?Ja:Ka,V.map.depthTexture.minFilter=qe,V.map.depthTexture.magFilter=qe):(V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=Le,V.map.depthTexture.magFilter=Le);V.camera.updateProjectionMatrix()}V.map.isWebGLCubeRenderTarget!==!0&&(V.map.width!==s.x||V.map.height!==s.y)&&V.map.setSize(s.x,s.y);let k=V.map.isWebGLCubeRenderTarget?6:V.getViewportCount();H.isPointLight!==!0&&V.updateMatrices(H,v);for(let Y=0;Y0||A.map&&A.alphaTest>0||A.alphaToCoverage===!0){let N=R.uuid,B=A.uuid,D=c[N];D===void 0&&(D={},c[N]=D);let F=D[B];F===void 0&&(F=R.clone(),D[B]=F,A.addEventListener("dispose",x)),R=F}if(R.visible=A.visible,R.wireframe=A.wireframe,E===Ps?R.side=A.shadowSide!==null?A.shadowSide:A.side:R.side=A.shadowSide!==null?A.shadowSide:d[A.side],R.alphaMap=A.alphaMap,R.alphaTest=A.alphaToCoverage===!0?.5:A.alphaTest,R.map=A.map,R.clipShadows=A.clipShadows,R.clippingPlanes=A.clippingPlanes,R.clipIntersection=A.clipIntersection,R.displacementMap=A.displacementMap,R.displacementScale=A.displacementScale,R.displacementBias=A.displacementBias,R.wireframeLinewidth=A.wireframeLinewidth,R.linewidth=A.linewidth,v.isPointLight===!0&&R.isMeshDistanceMaterial===!0){let N=i.properties.get(R);N.light=v}return R}function M(S,A,v,E,R){if(S.visible===!1)return;if(S.layers.test(A.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&R===Ps)&&(!S.frustumCulled||S.intersectsFrustum(n))){S.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,S.matrixWorld);let B=t.update(S),D=S.material;if(Array.isArray(D)){let F=B.groups;for(let H=0,V=F.length;H=1):U.indexOf("OpenGL ES")!==-1&&(z=parseFloat(/^OpenGL ES (\d)/.exec(U)[1]),V=z>=2);let k=null,Y={},G=i.getParameter(i.SCISSOR_BOX),J=i.getParameter(i.VIEWPORT),it=new ve().fromArray(G),nt=new ve().fromArray(J);function at(X,yt,lt,Mt){let Rt=new Uint8Array(4),ut=i.createTexture();i.bindTexture(X,ut),i.texParameteri(X,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(X,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let kt=0;kt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new qt,h=new WeakMap,d=new Set,u,f=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(I,b){return m?new OffscreenCanvas(I,b):ys("canvas")}function g(I,b,Z){let tt=1,st=Tt(I);if((st.width>Z||st.height>Z)&&(tt=Z/Math.max(st.width,st.height)),tt<1)if(typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&I instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&I instanceof ImageBitmap||typeof VideoFrame<"u"&&I instanceof VideoFrame){let gt=Math.floor(tt*st.width),_t=Math.floor(tt*st.height);u===void 0&&(u=_(gt,_t));let ot=b?_(gt,_t):u;return ot.width=gt,ot.height=_t,ot.getContext("2d").drawImage(I,0,0,gt,_t),Wt("WebGLRenderer: Texture has been resized from ("+st.width+"x"+st.height+") to ("+gt+"x"+_t+")."),ot}else return"data"in I&&Wt("WebGLRenderer: Image in DataTexture is too big ("+st.width+"x"+st.height+")."),I;return I}function p(I){return I.generateMipmaps}function y(I){i.generateMipmap(I)}function w(I){return I.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:I.isWebGL3DRenderTarget?i.TEXTURE_3D:I.isWebGLArrayRenderTarget||I.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function M(I,b,Z,tt,st,gt=!1){if(I!==null){if(i[I]!==void 0)return i[I];Wt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+I+"'")}let _t;tt&&(_t=t.get("EXT_texture_norm16"),_t||Wt("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let ot=b;if(b===i.RED&&(Z===i.FLOAT&&(ot=i.R32F),Z===i.HALF_FLOAT&&(ot=i.R16F),Z===i.UNSIGNED_BYTE&&(ot=i.R8),Z===i.UNSIGNED_SHORT&&_t&&(ot=_t.R16_EXT),Z===i.SHORT&&_t&&(ot=_t.R16_SNORM_EXT)),b===i.RED_INTEGER&&(Z===i.UNSIGNED_BYTE&&(ot=i.R8UI),Z===i.UNSIGNED_SHORT&&(ot=i.R16UI),Z===i.UNSIGNED_INT&&(ot=i.R32UI),Z===i.BYTE&&(ot=i.R8I),Z===i.SHORT&&(ot=i.R16I),Z===i.INT&&(ot=i.R32I)),b===i.RG&&(Z===i.FLOAT&&(ot=i.RG32F),Z===i.HALF_FLOAT&&(ot=i.RG16F),Z===i.UNSIGNED_BYTE&&(ot=i.RG8),Z===i.UNSIGNED_SHORT&&_t&&(ot=_t.RG16_EXT),Z===i.SHORT&&_t&&(ot=_t.RG16_SNORM_EXT)),b===i.RG_INTEGER&&(Z===i.UNSIGNED_BYTE&&(ot=i.RG8UI),Z===i.UNSIGNED_SHORT&&(ot=i.RG16UI),Z===i.UNSIGNED_INT&&(ot=i.RG32UI),Z===i.BYTE&&(ot=i.RG8I),Z===i.SHORT&&(ot=i.RG16I),Z===i.INT&&(ot=i.RG32I)),b===i.RGB_INTEGER&&(Z===i.UNSIGNED_BYTE&&(ot=i.RGB8UI),Z===i.UNSIGNED_SHORT&&(ot=i.RGB16UI),Z===i.UNSIGNED_INT&&(ot=i.RGB32UI),Z===i.BYTE&&(ot=i.RGB8I),Z===i.SHORT&&(ot=i.RGB16I),Z===i.INT&&(ot=i.RGB32I)),b===i.RGBA_INTEGER&&(Z===i.UNSIGNED_BYTE&&(ot=i.RGBA8UI),Z===i.UNSIGNED_SHORT&&(ot=i.RGBA16UI),Z===i.UNSIGNED_INT&&(ot=i.RGBA32UI),Z===i.BYTE&&(ot=i.RGBA8I),Z===i.SHORT&&(ot=i.RGBA16I),Z===i.INT&&(ot=i.RGBA32I)),b===i.RGB&&(Z===i.UNSIGNED_SHORT&&_t&&(ot=_t.RGB16_EXT),Z===i.SHORT&&_t&&(ot=_t.RGB16_SNORM_EXT),Z===i.UNSIGNED_INT_5_9_9_9_REV&&(ot=i.RGB9_E5),Z===i.UNSIGNED_INT_10F_11F_11F_REV&&(ot=i.R11F_G11F_B10F)),b===i.RGBA){let ct=gt?sr:se.getTransfer(st);Z===i.FLOAT&&(ot=i.RGBA32F),Z===i.HALF_FLOAT&&(ot=i.RGBA16F),Z===i.UNSIGNED_BYTE&&(ot=ct===fe?i.SRGB8_ALPHA8:i.RGBA8),Z===i.UNSIGNED_SHORT&&_t&&(ot=_t.RGBA16_EXT),Z===i.SHORT&&_t&&(ot=_t.RGBA16_SNORM_EXT),Z===i.UNSIGNED_SHORT_4_4_4_4&&(ot=i.RGBA4),Z===i.UNSIGNED_SHORT_5_5_5_1&&(ot=i.RGB5_A1)}return(ot===i.R16F||ot===i.R32F||ot===i.RG16F||ot===i.RG32F||ot===i.RGBA16F||ot===i.RGBA32F)&&t.get("EXT_color_buffer_float"),ot}function x(I,b){let Z;return I?b===null||b===Tn||b===Ns?Z=i.DEPTH24_STENCIL8:b===Ye?Z=i.DEPTH32F_STENCIL8:b===Ds&&(Z=i.DEPTH24_STENCIL8,Wt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):b===null||b===Tn||b===Ns?Z=i.DEPTH_COMPONENT24:b===Ye?Z=i.DEPTH_COMPONENT32F:b===Ds&&(Z=i.DEPTH_COMPONENT16),Z}function S(I,b){return p(I)===!0||I.isFramebufferTexture&&I.minFilter!==Le&&I.minFilter!==qe?Math.log2(Math.max(b.width,b.height))+1:I.mipmaps!==void 0&&I.mipmaps.length>0?I.mipmaps.length:I.isCompressedTexture&&Array.isArray(I.image)?b.mipmaps.length:1}function A(I){let b=I.target;b.removeEventListener("dispose",A),E(b),b.isVideoTexture&&h.delete(b),b.isHTMLTexture&&d.delete(b)}function v(I){let b=I.target;b.removeEventListener("dispose",v),L(b)}function E(I){let b=n.get(I);if(b.__webglInit===void 0)return;let Z=I.source,tt=f.get(Z);if(tt){let st=tt[b.__cacheKey];st.usedTimes--,st.usedTimes===0&&R(I),Object.keys(tt).length===0&&f.delete(Z)}n.remove(I)}function R(I){let b=n.get(I);i.deleteTexture(b.__webglTexture);let Z=I.source,tt=f.get(Z);delete tt[b.__cacheKey],o.memory.textures--}function L(I){let b=n.get(I);if(I.depthTexture&&(I.depthTexture.dispose(),n.remove(I.depthTexture)),I.isWebGLCubeRenderTarget)for(let tt=0;tt<6;tt++){if(Array.isArray(b.__webglFramebuffer[tt]))for(let st=0;st=s.maxTextures&&Wt("WebGLTextures: Trying to use "+(I+1)+" texture units while this GPU supports only "+s.maxTextures),N+=1,I}function V(I){let b=[];return b.push(I.wrapS),b.push(I.wrapT),b.push(I.wrapR||0),b.push(I.magFilter),b.push(I.minFilter),b.push(I.anisotropy),b.push(I.internalFormat),b.push(I.format),b.push(I.type),b.push(I.generateMipmaps),b.push(I.premultiplyAlpha),b.push(I.flipY),b.push(I.unpackAlignment),b.push(I.colorSpace),b.join()}function z(I,b){let Z=n.get(I);if(I.isVideoTexture&&P(I),I.isRenderTargetTexture===!1&&I.isExternalTexture!==!0&&I.version>0&&Z.__version!==I.version){let tt=I.image;if(tt===null)Wt("WebGLRenderer: Texture marked for update but no image data found.");else if(tt.complete===!1)Wt("WebGLRenderer: Texture marked for update but image is incomplete");else{rt(Z,I,b);return}}else I.isExternalTexture&&(Z.__webglTexture=I.sourceTexture?I.sourceTexture:null);e.bindTexture(i.TEXTURE_2D,Z.__webglTexture,i.TEXTURE0+b)}function U(I,b){let Z=n.get(I);if(I.isRenderTargetTexture===!1&&I.version>0&&Z.__version!==I.version){rt(Z,I,b);return}else I.isExternalTexture&&(Z.__webglTexture=I.sourceTexture?I.sourceTexture:null);e.bindTexture(i.TEXTURE_2D_ARRAY,Z.__webglTexture,i.TEXTURE0+b)}function k(I,b){let Z=n.get(I);if(I.isRenderTargetTexture===!1&&I.version>0&&Z.__version!==I.version){rt(Z,I,b);return}e.bindTexture(i.TEXTURE_3D,Z.__webglTexture,i.TEXTURE0+b)}function Y(I,b){let Z=n.get(I);if(I.isCubeDepthTexture!==!0&&I.version>0&&Z.__version!==I.version){mt(Z,I,b);return}e.bindTexture(i.TEXTURE_CUBE_MAP,Z.__webglTexture,i.TEXTURE0+b)}let G={[xs]:i.REPEAT,[Bn]:i.CLAMP_TO_EDGE,[zo]:i.MIRRORED_REPEAT},J={[Le]:i.NEAREST,[yd]:i.NEAREST_MIPMAP_NEAREST,[Sr]:i.NEAREST_MIPMAP_LINEAR,[qe]:i.LINEAR,[fa]:i.LINEAR_MIPMAP_NEAREST,[Si]:i.LINEAR_MIPMAP_LINEAR},it={[wd]:i.NEVER,[Cd]:i.ALWAYS,[Ed]:i.LESS,[Ka]:i.LEQUAL,[Td]:i.EQUAL,[Ja]:i.GEQUAL,[Ad]:i.GREATER,[Rd]:i.NOTEQUAL};function nt(I,b){if(b.type===Ye&&t.has("OES_texture_float_linear")===!1&&(b.magFilter===qe||b.magFilter===fa||b.magFilter===Sr||b.magFilter===Si||b.minFilter===qe||b.minFilter===fa||b.minFilter===Sr||b.minFilter===Si)&&Wt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(I,i.TEXTURE_WRAP_S,G[b.wrapS]),i.texParameteri(I,i.TEXTURE_WRAP_T,G[b.wrapT]),(I===i.TEXTURE_3D||I===i.TEXTURE_2D_ARRAY)&&i.texParameteri(I,i.TEXTURE_WRAP_R,G[b.wrapR]),i.texParameteri(I,i.TEXTURE_MAG_FILTER,J[b.magFilter]),i.texParameteri(I,i.TEXTURE_MIN_FILTER,J[b.minFilter]),b.compareFunction&&(i.texParameteri(I,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(I,i.TEXTURE_COMPARE_FUNC,it[b.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(b.magFilter===Le||b.minFilter!==Sr&&b.minFilter!==Si||b.type===Ye&&t.has("OES_texture_float_linear")===!1)return;if(b.anisotropy>1||n.get(b).__currentAnisotropy){let Z=t.get("EXT_texture_filter_anisotropic");i.texParameterf(I,Z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,s.getMaxAnisotropy())),n.get(b).__currentAnisotropy=b.anisotropy}}}function at(I,b){let Z=!1;I.__webglInit===void 0&&(I.__webglInit=!0,b.addEventListener("dispose",A));let tt=b.source,st=f.get(tt);st===void 0&&(st={},f.set(tt,st));let gt=V(b);if(gt!==I.__cacheKey){st[gt]===void 0&&(st[gt]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Z=!0),st[gt].usedTimes++;let _t=st[I.__cacheKey];_t!==void 0&&(st[I.__cacheKey].usedTimes--,_t.usedTimes===0&&R(b)),I.__cacheKey=gt,I.__webglTexture=st[gt].texture}return Z}function O(I,b,Z){return Math.floor(Math.floor(I/Z)/b)}function $(I,b,Z,tt){let gt=I.updateRanges;if(gt.length===0)e.texSubImage2D(i.TEXTURE_2D,0,0,0,b.width,b.height,Z,tt,b.data);else{gt.sort((Ot,bt)=>Ot.start-bt.start);let _t=0;for(let Ot=1;Ot0){Xt&&jt&&e.texStorage2D(i.TEXTURE_2D,yt,bt,zt[0].width,zt[0].height);for(let lt=0,Mt=zt.length;lt0){let Rt=Kc(vt.width,vt.height,b.format,b.type);for(let ut of b.layerUpdates){let kt=vt.data.subarray(ut*Rt/vt.data.BYTES_PER_ELEMENT,(ut+1)*Rt/vt.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,lt,0,0,ut,vt.width,vt.height,1,xt,kt)}}else e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,lt,0,0,0,vt.width,vt.height,ct.depth,xt,vt.data)}else e.compressedTexImage3D(i.TEXTURE_2D_ARRAY,lt,bt,vt.width,vt.height,ct.depth,0,vt.data,0,0);else Wt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Xt?X&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,lt,0,0,0,vt.width,vt.height,ct.depth,xt,Ot,vt.data):e.texImage3D(i.TEXTURE_2D_ARRAY,lt,bt,vt.width,vt.height,ct.depth,0,xt,Ot,vt.data);b.layerUpdates.size>0&&b.clearLayerUpdates()}else{Xt&&jt&&e.texStorage2D(i.TEXTURE_2D,yt,bt,zt[0].width,zt[0].height);for(let lt=0,Mt=zt.length;lt0){let lt=Kc(ct.width,ct.height,b.format,b.type);for(let Mt of b.layerUpdates){let Rt=ct.data.subarray(Mt*lt/ct.data.BYTES_PER_ELEMENT,(Mt+1)*lt/ct.data.BYTES_PER_ELEMENT);e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,Mt,ct.width,ct.height,1,xt,Ot,Rt)}b.clearLayerUpdates()}else e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ct.width,ct.height,ct.depth,xt,Ot,ct.data)}else e.texImage3D(i.TEXTURE_2D_ARRAY,0,bt,ct.width,ct.height,ct.depth,0,xt,Ot,ct.data);else if(b.isData3DTexture)Xt?(jt&&e.texStorage3D(i.TEXTURE_3D,yt,bt,ct.width,ct.height,ct.depth),X&&e.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ct.width,ct.height,ct.depth,xt,Ot,ct.data)):e.texImage3D(i.TEXTURE_3D,0,bt,ct.width,ct.height,ct.depth,0,xt,Ot,ct.data);else if(b.isFramebufferTexture){if(jt)if(Xt)e.texStorage2D(i.TEXTURE_2D,yt,bt,ct.width,ct.height);else{let lt=ct.width,Mt=ct.height;for(let Rt=0;Rt>=1,Mt>>=1}}else if(b.isHTMLTexture){if("texElementImage2D"in i){let lt=i.canvas;if(lt.hasAttribute("layoutsubtree")||lt.setAttribute("layoutsubtree","true"),ct.parentNode!==lt){lt.appendChild(ct),d.add(b),lt.onpaint=Mt=>{let Rt=Mt.changedElements;for(let ut of d)Rt.includes(ut.image)&&(ut.needsUpdate=!0)},lt.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,ct);else{let Rt=i.RGBA,ut=i.RGBA,kt=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Rt,ut,kt,ct)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(zt.length>0){if(Xt&&jt){let lt=Tt(zt[0]);e.texStorage2D(i.TEXTURE_2D,yt,bt,lt.width,lt.height)}for(let lt=0,Mt=zt.length;lt0&&Mt++;let ut=Tt(bt[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,Mt,jt,ut.width,ut.height)}for(let ut=0;ut<6;ut++)if(Ot){X?lt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,bt[ut].width,bt[ut].height,zt,Xt,bt[ut].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,jt,bt[ut].width,bt[ut].height,0,zt,Xt,bt[ut].data);for(let kt=0;kt>gt),vt=Math.max(1,b.height>>gt);st===i.TEXTURE_3D||st===i.TEXTURE_2D_ARRAY?e.texImage3D(st,gt,ct,bt,vt,b.depth,0,_t,ot,null):e.texImage2D(st,gt,ct,bt,vt,0,_t,ot,null)}e.bindFramebuffer(i.FRAMEBUFFER,I),Ut(b)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,tt,st,Ot.__webglTexture,0,pt(b)):(st===i.TEXTURE_2D||st>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&st<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,tt,st,Ot.__webglTexture,gt),e.bindFramebuffer(i.FRAMEBUFFER,null)}function Et(I,b,Z){if(i.bindRenderbuffer(i.RENDERBUFFER,I),b.depthBuffer){let tt=b.depthTexture,st=tt&&tt.isDepthTexture?tt.type:null,gt=x(b.stencilBuffer,st),_t=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;Ut(b)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,pt(b),gt,b.width,b.height):Z?i.renderbufferStorageMultisample(i.RENDERBUFFER,pt(b),gt,b.width,b.height):i.renderbufferStorage(i.RENDERBUFFER,gt,b.width,b.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,_t,i.RENDERBUFFER,I)}else{let tt=b.textures;for(let st=0;st{delete b.__boundDepthTexture,delete b.__depthDisposeCallback,tt.removeEventListener("dispose",st)};tt.addEventListener("dispose",st),b.__depthDisposeCallback=st}b.__boundDepthTexture=tt}if(I.depthTexture&&!b.__autoAllocateDepthBuffer)if(Z)for(let tt=0;tt<6;tt++)Zt(b.__webglFramebuffer[tt],I,tt);else{let tt=I.texture.mipmaps;tt&&tt.length>0?Zt(b.__webglFramebuffer[0],I,0):Zt(b.__webglFramebuffer,I,0)}else if(Z){b.__webglDepthbuffer=[];for(let tt=0;tt<6;tt++)if(e.bindFramebuffer(i.FRAMEBUFFER,b.__webglFramebuffer[tt]),b.__webglDepthbuffer[tt]===void 0)b.__webglDepthbuffer[tt]=i.createRenderbuffer(),Et(b.__webglDepthbuffer[tt],I,!1);else{let st=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,gt=b.__webglDepthbuffer[tt];i.bindRenderbuffer(i.RENDERBUFFER,gt),i.framebufferRenderbuffer(i.FRAMEBUFFER,st,i.RENDERBUFFER,gt)}}else{let tt=I.texture.mipmaps;if(tt&&tt.length>0?e.bindFramebuffer(i.FRAMEBUFFER,b.__webglFramebuffer[0]):e.bindFramebuffer(i.FRAMEBUFFER,b.__webglFramebuffer),b.__webglDepthbuffer===void 0)b.__webglDepthbuffer=i.createRenderbuffer(),Et(b.__webglDepthbuffer,I,!1);else{let st=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,gt=b.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,gt),i.framebufferRenderbuffer(i.FRAMEBUFFER,st,i.RENDERBUFFER,gt)}}e.bindFramebuffer(i.FRAMEBUFFER,null)}function Yt(I,b,Z){let tt=n.get(I);b!==void 0&&ht(tt.__webglFramebuffer,I,I.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Z!==void 0&&Ct(I)}function Ht(I){let b=I.texture,Z=n.get(I),tt=n.get(b);I.addEventListener("dispose",v);let st=I.textures,gt=I.isWebGLCubeRenderTarget===!0,_t=st.length>1;if(_t||(tt.__webglTexture===void 0&&(tt.__webglTexture=i.createTexture()),tt.__version=b.version,o.memory.textures++),gt){Z.__webglFramebuffer=[];for(let ot=0;ot<6;ot++)if(b.mipmaps&&b.mipmaps.length>0){Z.__webglFramebuffer[ot]=[];for(let ct=0;ct0){Z.__webglFramebuffer=[];for(let ot=0;ot0&&Ut(I)===!1){Z.__webglMultisampledFramebuffer=i.createFramebuffer(),Z.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,Z.__webglMultisampledFramebuffer);for(let ot=0;ot0)for(let ct=0;ct0)for(let ct=0;ct0){if(Ut(I)===!1){let b=I.textures,Z=I.width,tt=I.height,st=i.COLOR_BUFFER_BIT,gt=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,_t=n.get(I),ot=b.length>1;if(ot)for(let xt=0;xt0?e.bindFramebuffer(i.DRAW_FRAMEBUFFER,_t.__webglFramebuffer[0]):e.bindFramebuffer(i.DRAW_FRAMEBUFFER,_t.__webglFramebuffer);for(let xt=0;xt0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&b.__useRenderToTexture!==!1}function P(I){let b=o.render.frame;h.get(I)!==b&&(h.set(I,b),I.update())}function ft(I,b){let Z=I.colorSpace,tt=I.format,st=I.type;return I.isCompressedTexture===!0||I.isVideoTexture===!0||Z!==ir&&Z!==ai&&(se.getTransfer(Z)===fe?(tt!==je||st!==rn)&&Wt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):$t("WebGLTextures: Unsupported texture color space:",Z)),b}function Tt(I){return typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement?(c.width=I.naturalWidth||I.width,c.height=I.naturalHeight||I.height):typeof VideoFrame<"u"&&I instanceof VideoFrame?(c.width=I.displayWidth,c.height=I.displayHeight):(c.width=I.width,c.height=I.height),c}this.allocateTextureUnit=H,this.resetTextureUnits=B,this.getTextureUnits=D,this.setTextureUnits=F,this.setTexture2D=z,this.setTexture2DArray=U,this.setTexture3D=k,this.setTextureCube=Y,this.rebindTextures=Yt,this.setupRenderTarget=Ht,this.updateRenderTargetMipmap=dt,this.updateMultisampleRenderTarget=ne,this.setupDepthRenderbuffer=Ct,this.setupFrameBufferTexture=ht,this.useMultisampledRTT=Ut,this.isReversedDepthBuffer=function(){return e.buffers.depth.getReversed()}}function ey(i,t){function e(n,s=ai){let r,o=se.getTransfer(s);if(n===rn)return i.UNSIGNED_BYTE;if(n===ma)return i.UNSIGNED_SHORT_4_4_4_4;if(n===ga)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Bc)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Oc)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Uc)return i.BYTE;if(n===Fc)return i.SHORT;if(n===Ds)return i.UNSIGNED_SHORT;if(n===pa)return i.INT;if(n===Tn)return i.UNSIGNED_INT;if(n===Ye)return i.FLOAT;if(n===An)return i.HALF_FLOAT;if(n===zc)return i.ALPHA;if(n===kc)return i.RGB;if(n===je)return i.RGBA;if(n===On)return i.DEPTH_COMPONENT;if(n===wi)return i.DEPTH_STENCIL;if(n===Us)return i.RED;if(n===_a)return i.RED_INTEGER;if(n===Ei)return i.RG;if(n===xa)return i.RG_INTEGER;if(n===va)return i.RGBA_INTEGER;if(n===wr||n===Er||n===Tr||n===Ar)if(o===fe)if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===wr)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Er)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Tr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ar)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===wr)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Er)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Tr)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ar)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ya||n===Ma||n===ba||n===Sa)if(r=t.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===ya)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ma)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ba)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Sa)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===wa||n===Ea||n===Ta||n===Aa||n===Ra||n===Rr||n===Ca)if(r=t.get("WEBGL_compressed_texture_etc"),r!==null){if(n===wa||n===Ea)return o===fe?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Ta)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===Aa)return r.COMPRESSED_R11_EAC;if(n===Ra)return r.COMPRESSED_SIGNED_R11_EAC;if(n===Rr)return r.COMPRESSED_RG11_EAC;if(n===Ca)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Ia||n===Pa||n===La||n===Da||n===Na||n===Ua||n===Fa||n===Ba||n===Oa||n===za||n===ka||n===Ha||n===Va||n===Ga)if(r=t.get("WEBGL_compressed_texture_astc"),r!==null){if(n===Ia)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Pa)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===La)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Da)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Na)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ua)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Fa)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ba)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oa)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===za)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===ka)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ha)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Va)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ga)return o===fe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Wa||n===Xa||n===qa)if(r=t.get("EXT_texture_compression_bptc"),r!==null){if(n===Wa)return o===fe?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Xa)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===qa)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ya||n===$a||n===Cr||n===Za)if(r=t.get("EXT_texture_compression_rgtc"),r!==null){if(n===Ya)return r.COMPRESSED_RED_RGTC1_EXT;if(n===$a)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Cr)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Za)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ns?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:e}}var ny=` +}`,cy=[new C(1,0,0),new C(-1,0,0),new C(0,1,0),new C(0,-1,0),new C(0,0,1),new C(0,0,-1)],hy=[new C(0,-1,0),new C(0,-1,0),new C(0,0,1),new C(0,0,-1),new C(0,-1,0),new C(0,-1,0)],lf=new Ke,Nr=new C,lh=new C;function uy(i,e,t){let n=new Hn,s=new qe,r=new qe,o=new vt,a=new Ko,l=new Jo,c={},h=t.maxTextureSize,d={[Yn]:zt,[zt]:Yn,[kt]:kt},u=new It({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new qe},radius:{value:4}},vertexShader:ay,fragmentShader:ly}),f=u.clone();f.defines.HORIZONTAL_PASS=1;let m=new ht;m.setAttribute("position",new xt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let _=new gt(m,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=br;let p=this.type;this.render=function(S,A,v){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||S.length===0)return;this.type===nd&&(We("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=br);let E=i.getRenderTarget(),R=i.getActiveCubeFace(),L=i.getActiveMipmapLevel(),N=i.state;N.setBlending($n),N.buffers.depth.getReversed()===!0?N.buffers.color.setClear(0,0,0,0):N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);let B=p!==this.type;B&&A.traverse(function(D){D.material&&(Array.isArray(D.material)?D.material.forEach(F=>F.needsUpdate=!0):D.material.needsUpdate=!0)});for(let D=0,F=S.length;Dh||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/z.x),s.x=r.x*z.x,V.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/z.y),s.y=r.y*z.y,V.mapSize.y=r.y));let U=i.state.buffers.depth.getReversed();if(V.camera._reversedDepth=U,V.map===null||B===!0){if(V.map!==null&&(V.map.depthTexture!==null&&(V.map.depthTexture.dispose(),V.map.depthTexture=null),V.map.dispose()),this.type===Ps){if(H.isPointLight){We("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}V.map=new Bt(s.x,s.y,{format:Ei,type:Rn,minFilter:qt,magFilter:qt,generateMipmaps:!1}),V.map.texture.name=H.name+".shadowMap",V.map.depthTexture=new Gn(s.x,s.y,Yt),V.map.depthTexture.name=H.name+".shadowMapDepth",V.map.depthTexture.format=On,V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=Lt,V.map.depthTexture.magFilter=Lt}else H.isPointLight?(V.map=new nl(s.x),V.map.depthTexture=new $o(s.x,An)):(V.map=new Bt(s.x,s.y),V.map.depthTexture=new Gn(s.x,s.y,An)),V.map.depthTexture.name=H.name+".shadowMap",V.map.depthTexture.format=On,this.type===br?(V.map.depthTexture.compareFunction=U?ja:Ja,V.map.depthTexture.minFilter=qt,V.map.depthTexture.magFilter=qt):(V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=Lt,V.map.depthTexture.magFilter=Lt);V.camera.updateProjectionMatrix()}V.map.isWebGLCubeRenderTarget!==!0&&(V.map.width!==s.x||V.map.height!==s.y)&&V.map.setSize(s.x,s.y);let k=V.map.isWebGLCubeRenderTarget?6:V.getViewportCount();H.isPointLight!==!0&&V.updateMatrices(H,v);for(let Y=0;Y0||A.map&&A.alphaTest>0||A.alphaToCoverage===!0){let N=R.uuid,B=A.uuid,D=c[N];D===void 0&&(D={},c[N]=D);let F=D[B];F===void 0&&(F=R.clone(),D[B]=F,A.addEventListener("dispose",x)),R=F}if(R.visible=A.visible,R.wireframe=A.wireframe,E===Ps?R.side=A.shadowSide!==null?A.shadowSide:A.side:R.side=A.shadowSide!==null?A.shadowSide:d[A.side],R.alphaMap=A.alphaMap,R.alphaTest=A.alphaToCoverage===!0?.5:A.alphaTest,R.map=A.map,R.clipShadows=A.clipShadows,R.clippingPlanes=A.clippingPlanes,R.clipIntersection=A.clipIntersection,R.displacementMap=A.displacementMap,R.displacementScale=A.displacementScale,R.displacementBias=A.displacementBias,R.wireframeLinewidth=A.wireframeLinewidth,R.linewidth=A.linewidth,v.isPointLight===!0&&R.isMeshDistanceMaterial===!0){let N=i.properties.get(R);N.light=v}return R}function b(S,A,v,E,R){if(S.visible===!1)return;if(S.layers.test(A.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&R===Ps)&&(!S.frustumCulled||S.intersectsFrustum(n))){S.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,S.matrixWorld);let B=e.update(S),D=S.material;if(Array.isArray(D)){let F=B.groups;for(let H=0,V=F.length;H=1):U.indexOf("OpenGL ES")!==-1&&(z=parseFloat(/^OpenGL ES (\d)/.exec(U)[1]),V=z>=2);let k=null,Y={},G=i.getParameter(i.SCISSOR_BOX),J=i.getParameter(i.VIEWPORT),ie=new vt().fromArray(G),ne=new vt().fromArray(J);function ae(q,ye,le,be){let Re=new Uint8Array(4),ue=i.createTexture();i.bindTexture(q,ue),i.texParameteri(q,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(q,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let ke=0;ke"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new qe,h=new WeakMap,d=new Set,u,f=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(I,M){return m?new OffscreenCanvas(I,M):ys("canvas")}function g(I,M,Z){let ee=1,se=Te(I);if((se.width>Z||se.height>Z)&&(ee=Z/Math.max(se.width,se.height)),ee<1)if(typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&I instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&I instanceof ImageBitmap||typeof VideoFrame<"u"&&I instanceof VideoFrame){let ge=Math.floor(ee*se.width),_e=Math.floor(ee*se.height);u===void 0&&(u=_(ge,_e));let oe=M?_(ge,_e):u;return oe.width=ge,oe.height=_e,oe.getContext("2d").drawImage(I,0,0,ge,_e),We("WebGLRenderer: Texture has been resized from ("+se.width+"x"+se.height+") to ("+ge+"x"+_e+")."),oe}else return"data"in I&&We("WebGLRenderer: Image in DataTexture is too big ("+se.width+"x"+se.height+")."),I;return I}function p(I){return I.generateMipmaps}function y(I){i.generateMipmap(I)}function w(I){return I.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:I.isWebGL3DRenderTarget?i.TEXTURE_3D:I.isWebGLArrayRenderTarget||I.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function b(I,M,Z,ee,se,ge=!1){if(I!==null){if(i[I]!==void 0)return i[I];We("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+I+"'")}let _e;ee&&(_e=e.get("EXT_texture_norm16"),_e||We("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let oe=M;if(M===i.RED&&(Z===i.FLOAT&&(oe=i.R32F),Z===i.HALF_FLOAT&&(oe=i.R16F),Z===i.UNSIGNED_BYTE&&(oe=i.R8),Z===i.UNSIGNED_SHORT&&_e&&(oe=_e.R16_EXT),Z===i.SHORT&&_e&&(oe=_e.R16_SNORM_EXT)),M===i.RED_INTEGER&&(Z===i.UNSIGNED_BYTE&&(oe=i.R8UI),Z===i.UNSIGNED_SHORT&&(oe=i.R16UI),Z===i.UNSIGNED_INT&&(oe=i.R32UI),Z===i.BYTE&&(oe=i.R8I),Z===i.SHORT&&(oe=i.R16I),Z===i.INT&&(oe=i.R32I)),M===i.RG&&(Z===i.FLOAT&&(oe=i.RG32F),Z===i.HALF_FLOAT&&(oe=i.RG16F),Z===i.UNSIGNED_BYTE&&(oe=i.RG8),Z===i.UNSIGNED_SHORT&&_e&&(oe=_e.RG16_EXT),Z===i.SHORT&&_e&&(oe=_e.RG16_SNORM_EXT)),M===i.RG_INTEGER&&(Z===i.UNSIGNED_BYTE&&(oe=i.RG8UI),Z===i.UNSIGNED_SHORT&&(oe=i.RG16UI),Z===i.UNSIGNED_INT&&(oe=i.RG32UI),Z===i.BYTE&&(oe=i.RG8I),Z===i.SHORT&&(oe=i.RG16I),Z===i.INT&&(oe=i.RG32I)),M===i.RGB_INTEGER&&(Z===i.UNSIGNED_BYTE&&(oe=i.RGB8UI),Z===i.UNSIGNED_SHORT&&(oe=i.RGB16UI),Z===i.UNSIGNED_INT&&(oe=i.RGB32UI),Z===i.BYTE&&(oe=i.RGB8I),Z===i.SHORT&&(oe=i.RGB16I),Z===i.INT&&(oe=i.RGB32I)),M===i.RGBA_INTEGER&&(Z===i.UNSIGNED_BYTE&&(oe=i.RGBA8UI),Z===i.UNSIGNED_SHORT&&(oe=i.RGBA16UI),Z===i.UNSIGNED_INT&&(oe=i.RGBA32UI),Z===i.BYTE&&(oe=i.RGBA8I),Z===i.SHORT&&(oe=i.RGBA16I),Z===i.INT&&(oe=i.RGBA32I)),M===i.RGB&&(Z===i.UNSIGNED_SHORT&&_e&&(oe=_e.RGB16_EXT),Z===i.SHORT&&_e&&(oe=_e.RGB16_SNORM_EXT),Z===i.UNSIGNED_INT_5_9_9_9_REV&&(oe=i.RGB9_E5),Z===i.UNSIGNED_INT_10F_11F_11F_REV&&(oe=i.R11F_G11F_B10F)),M===i.RGBA){let ce=ge?rr:st.getTransfer(se);Z===i.FLOAT&&(oe=i.RGBA32F),Z===i.HALF_FLOAT&&(oe=i.RGBA16F),Z===i.UNSIGNED_BYTE&&(oe=ce===ft?i.SRGB8_ALPHA8:i.RGBA8),Z===i.UNSIGNED_SHORT&&_e&&(oe=_e.RGBA16_EXT),Z===i.SHORT&&_e&&(oe=_e.RGBA16_SNORM_EXT),Z===i.UNSIGNED_SHORT_4_4_4_4&&(oe=i.RGBA4),Z===i.UNSIGNED_SHORT_5_5_5_1&&(oe=i.RGB5_A1)}return(oe===i.R16F||oe===i.R32F||oe===i.RG16F||oe===i.RG32F||oe===i.RGBA16F||oe===i.RGBA32F)&&e.get("EXT_color_buffer_float"),oe}function x(I,M){let Z;return I?M===null||M===An||M===Ns?Z=i.DEPTH24_STENCIL8:M===Yt?Z=i.DEPTH32F_STENCIL8:M===Ds&&(Z=i.DEPTH24_STENCIL8,We("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):M===null||M===An||M===Ns?Z=i.DEPTH_COMPONENT24:M===Yt?Z=i.DEPTH_COMPONENT32F:M===Ds&&(Z=i.DEPTH_COMPONENT16),Z}function S(I,M){return p(I)===!0||I.isFramebufferTexture&&I.minFilter!==Lt&&I.minFilter!==qt?Math.log2(Math.max(M.width,M.height))+1:I.mipmaps!==void 0&&I.mipmaps.length>0?I.mipmaps.length:I.isCompressedTexture&&Array.isArray(I.image)?M.mipmaps.length:1}function A(I){let M=I.target;M.removeEventListener("dispose",A),E(M),M.isVideoTexture&&h.delete(M),M.isHTMLTexture&&d.delete(M)}function v(I){let M=I.target;M.removeEventListener("dispose",v),L(M)}function E(I){let M=n.get(I);if(M.__webglInit===void 0)return;let Z=I.source,ee=f.get(Z);if(ee){let se=ee[M.__cacheKey];se.usedTimes--,se.usedTimes===0&&R(I),Object.keys(ee).length===0&&f.delete(Z)}n.remove(I)}function R(I){let M=n.get(I);i.deleteTexture(M.__webglTexture);let Z=I.source,ee=f.get(Z);delete ee[M.__cacheKey],o.memory.textures--}function L(I){let M=n.get(I);if(I.depthTexture&&(I.depthTexture.dispose(),n.remove(I.depthTexture)),I.isWebGLCubeRenderTarget)for(let ee=0;ee<6;ee++){if(Array.isArray(M.__webglFramebuffer[ee]))for(let se=0;se=s.maxTextures&&We("WebGLTextures: Trying to use "+(I+1)+" texture units while this GPU supports only "+s.maxTextures),N+=1,I}function V(I){let M=[];return M.push(I.wrapS),M.push(I.wrapT),M.push(I.wrapR||0),M.push(I.magFilter),M.push(I.minFilter),M.push(I.anisotropy),M.push(I.internalFormat),M.push(I.format),M.push(I.type),M.push(I.generateMipmaps),M.push(I.premultiplyAlpha),M.push(I.flipY),M.push(I.unpackAlignment),M.push(I.colorSpace),M.join()}function z(I,M){let Z=n.get(I);if(I.isVideoTexture&&P(I),I.isRenderTargetTexture===!1&&I.isExternalTexture!==!0&&I.version>0&&Z.__version!==I.version){let ee=I.image;if(ee===null)We("WebGLRenderer: Texture marked for update but no image data found.");else if(ee.complete===!1)We("WebGLRenderer: Texture marked for update but image is incomplete");else{re(Z,I,M);return}}else I.isExternalTexture&&(Z.__webglTexture=I.sourceTexture?I.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,Z.__webglTexture,i.TEXTURE0+M)}function U(I,M){let Z=n.get(I);if(I.isRenderTargetTexture===!1&&I.version>0&&Z.__version!==I.version){re(Z,I,M);return}else I.isExternalTexture&&(Z.__webglTexture=I.sourceTexture?I.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,Z.__webglTexture,i.TEXTURE0+M)}function k(I,M){let Z=n.get(I);if(I.isRenderTargetTexture===!1&&I.version>0&&Z.__version!==I.version){re(Z,I,M);return}t.bindTexture(i.TEXTURE_3D,Z.__webglTexture,i.TEXTURE0+M)}function Y(I,M){let Z=n.get(I);if(I.isCubeDepthTexture!==!0&&I.version>0&&Z.__version!==I.version){me(Z,I,M);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Z.__webglTexture,i.TEXTURE0+M)}let G={[xs]:i.REPEAT,[Bn]:i.CLAMP_TO_EDGE,[ko]:i.MIRRORED_REPEAT},J={[Lt]:i.NEAREST,[Sd]:i.NEAREST_MIPMAP_NEAREST,[wr]:i.NEAREST_MIPMAP_LINEAR,[qt]:i.LINEAR,[pa]:i.LINEAR_MIPMAP_NEAREST,[Si]:i.LINEAR_MIPMAP_LINEAR},ie={[Ad]:i.NEVER,[Ld]:i.ALWAYS,[Rd]:i.LESS,[Ja]:i.LEQUAL,[Cd]:i.EQUAL,[ja]:i.GEQUAL,[Id]:i.GREATER,[Pd]:i.NOTEQUAL};function ne(I,M){if(M.type===Yt&&e.has("OES_texture_float_linear")===!1&&(M.magFilter===qt||M.magFilter===pa||M.magFilter===wr||M.magFilter===Si||M.minFilter===qt||M.minFilter===pa||M.minFilter===wr||M.minFilter===Si)&&We("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(I,i.TEXTURE_WRAP_S,G[M.wrapS]),i.texParameteri(I,i.TEXTURE_WRAP_T,G[M.wrapT]),(I===i.TEXTURE_3D||I===i.TEXTURE_2D_ARRAY)&&i.texParameteri(I,i.TEXTURE_WRAP_R,G[M.wrapR]),i.texParameteri(I,i.TEXTURE_MAG_FILTER,J[M.magFilter]),i.texParameteri(I,i.TEXTURE_MIN_FILTER,J[M.minFilter]),M.compareFunction&&(i.texParameteri(I,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(I,i.TEXTURE_COMPARE_FUNC,ie[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(M.magFilter===Lt||M.minFilter!==wr&&M.minFilter!==Si||M.type===Yt&&e.has("OES_texture_float_linear")===!1)return;if(M.anisotropy>1||n.get(M).__currentAnisotropy){let Z=e.get("EXT_texture_filter_anisotropic");i.texParameterf(I,Z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,s.getMaxAnisotropy())),n.get(M).__currentAnisotropy=M.anisotropy}}}function ae(I,M){let Z=!1;I.__webglInit===void 0&&(I.__webglInit=!0,M.addEventListener("dispose",A));let ee=M.source,se=f.get(ee);se===void 0&&(se={},f.set(ee,se));let ge=V(M);if(ge!==I.__cacheKey){se[ge]===void 0&&(se[ge]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Z=!0),se[ge].usedTimes++;let _e=se[I.__cacheKey];_e!==void 0&&(se[I.__cacheKey].usedTimes--,_e.usedTimes===0&&R(M)),I.__cacheKey=ge,I.__webglTexture=se[ge].texture}return Z}function O(I,M,Z){return Math.floor(Math.floor(I/Z)/M)}function $(I,M,Z,ee){let ge=I.updateRanges;if(ge.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,M.width,M.height,Z,ee,M.data);else{ge.sort((Oe,Me)=>Oe.start-Me.start);let _e=0;for(let Oe=1;Oe0){Xe&&je&&t.texStorage2D(i.TEXTURE_2D,ye,Me,ze[0].width,ze[0].height);for(let le=0,be=ze.length;le0){let Re=Jc(ve.width,ve.height,M.format,M.type);for(let ue of M.layerUpdates){let ke=ve.data.subarray(ue*Re/ve.data.BYTES_PER_ELEMENT,(ue+1)*Re/ve.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,le,0,0,ue,ve.width,ve.height,1,xe,ke)}}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,le,0,0,0,ve.width,ve.height,ce.depth,xe,ve.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,le,Me,ve.width,ve.height,ce.depth,0,ve.data,0,0);else We("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Xe?q&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,le,0,0,0,ve.width,ve.height,ce.depth,xe,Oe,ve.data):t.texImage3D(i.TEXTURE_2D_ARRAY,le,Me,ve.width,ve.height,ce.depth,0,xe,Oe,ve.data);M.layerUpdates.size>0&&M.clearLayerUpdates()}else{Xe&&je&&t.texStorage2D(i.TEXTURE_2D,ye,Me,ze[0].width,ze[0].height);for(let le=0,be=ze.length;le0){let le=Jc(ce.width,ce.height,M.format,M.type);for(let be of M.layerUpdates){let Re=ce.data.subarray(be*le/ce.data.BYTES_PER_ELEMENT,(be+1)*le/ce.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,be,ce.width,ce.height,1,xe,Oe,Re)}M.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ce.width,ce.height,ce.depth,xe,Oe,ce.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Me,ce.width,ce.height,ce.depth,0,xe,Oe,ce.data);else if(M.isData3DTexture)Xe?(je&&t.texStorage3D(i.TEXTURE_3D,ye,Me,ce.width,ce.height,ce.depth),q&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ce.width,ce.height,ce.depth,xe,Oe,ce.data)):t.texImage3D(i.TEXTURE_3D,0,Me,ce.width,ce.height,ce.depth,0,xe,Oe,ce.data);else if(M.isFramebufferTexture){if(je)if(Xe)t.texStorage2D(i.TEXTURE_2D,ye,Me,ce.width,ce.height);else{let le=ce.width,be=ce.height;for(let Re=0;Re>=1,be>>=1}}else if(M.isHTMLTexture){if("texElementImage2D"in i){let le=i.canvas;if(le.hasAttribute("layoutsubtree")||le.setAttribute("layoutsubtree","true"),ce.parentNode!==le){le.appendChild(ce),d.add(M),le.onpaint=be=>{let Re=be.changedElements;for(let ue of d)Re.includes(ue.image)&&(ue.needsUpdate=!0)},le.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,ce);else{let Re=i.RGBA,ue=i.RGBA,ke=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Re,ue,ke,ce)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(ze.length>0){if(Xe&&je){let le=Te(ze[0]);t.texStorage2D(i.TEXTURE_2D,ye,Me,le.width,le.height)}for(let le=0,be=ze.length;le0&&be++;let ue=Te(Me[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,be,je,ue.width,ue.height)}for(let ue=0;ue<6;ue++)if(Oe){q?le&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ue,0,0,0,Me[ue].width,Me[ue].height,ze,Xe,Me[ue].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ue,0,je,Me[ue].width,Me[ue].height,0,ze,Xe,Me[ue].data);for(let ke=0;ke>ge),ve=Math.max(1,M.height>>ge);se===i.TEXTURE_3D||se===i.TEXTURE_2D_ARRAY?t.texImage3D(se,ge,ce,Me,ve,M.depth,0,_e,oe,null):t.texImage2D(se,ge,ce,Me,ve,0,_e,oe,null)}t.bindFramebuffer(i.FRAMEBUFFER,I),Ue(M)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,ee,se,Oe.__webglTexture,0,pe(M)):(se===i.TEXTURE_2D||se>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&se<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,ee,se,Oe.__webglTexture,ge),t.bindFramebuffer(i.FRAMEBUFFER,null)}function Ee(I,M,Z){if(i.bindRenderbuffer(i.RENDERBUFFER,I),M.depthBuffer){let ee=M.depthTexture,se=ee&&ee.isDepthTexture?ee.type:null,ge=x(M.stencilBuffer,se),_e=M.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;Ue(M)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,pe(M),ge,M.width,M.height):Z?i.renderbufferStorageMultisample(i.RENDERBUFFER,pe(M),ge,M.width,M.height):i.renderbufferStorage(i.RENDERBUFFER,ge,M.width,M.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,_e,i.RENDERBUFFER,I)}else{let ee=M.textures;for(let se=0;se{delete M.__boundDepthTexture,delete M.__depthDisposeCallback,ee.removeEventListener("dispose",se)};ee.addEventListener("dispose",se),M.__depthDisposeCallback=se}M.__boundDepthTexture=ee}if(I.depthTexture&&!M.__autoAllocateDepthBuffer)if(Z)for(let ee=0;ee<6;ee++)Ze(M.__webglFramebuffer[ee],I,ee);else{let ee=I.texture.mipmaps;ee&&ee.length>0?Ze(M.__webglFramebuffer[0],I,0):Ze(M.__webglFramebuffer,I,0)}else if(Z){M.__webglDepthbuffer=[];for(let ee=0;ee<6;ee++)if(t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer[ee]),M.__webglDepthbuffer[ee]===void 0)M.__webglDepthbuffer[ee]=i.createRenderbuffer(),Ee(M.__webglDepthbuffer[ee],I,!1);else{let se=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ge=M.__webglDepthbuffer[ee];i.bindRenderbuffer(i.RENDERBUFFER,ge),i.framebufferRenderbuffer(i.FRAMEBUFFER,se,i.RENDERBUFFER,ge)}}else{let ee=I.texture.mipmaps;if(ee&&ee.length>0?t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer===void 0)M.__webglDepthbuffer=i.createRenderbuffer(),Ee(M.__webglDepthbuffer,I,!1);else{let se=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ge=M.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,ge),i.framebufferRenderbuffer(i.FRAMEBUFFER,se,i.RENDERBUFFER,ge)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Ye(I,M,Z){let ee=n.get(I);M!==void 0&&he(ee.__webglFramebuffer,I,I.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Z!==void 0&&Ce(I)}function He(I){let M=I.texture,Z=n.get(I),ee=n.get(M);I.addEventListener("dispose",v);let se=I.textures,ge=I.isWebGLCubeRenderTarget===!0,_e=se.length>1;if(_e||(ee.__webglTexture===void 0&&(ee.__webglTexture=i.createTexture()),ee.__version=M.version,o.memory.textures++),ge){Z.__webglFramebuffer=[];for(let oe=0;oe<6;oe++)if(M.mipmaps&&M.mipmaps.length>0){Z.__webglFramebuffer[oe]=[];for(let ce=0;ce0){Z.__webglFramebuffer=[];for(let oe=0;oe0&&Ue(I)===!1){Z.__webglMultisampledFramebuffer=i.createFramebuffer(),Z.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglMultisampledFramebuffer);for(let oe=0;oe0)for(let ce=0;ce0)for(let ce=0;ce0){if(Ue(I)===!1){let M=I.textures,Z=I.width,ee=I.height,se=i.COLOR_BUFFER_BIT,ge=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,_e=n.get(I),oe=M.length>1;if(oe)for(let xe=0;xe0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,_e.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,_e.__webglFramebuffer);for(let xe=0;xe0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function P(I){let M=o.render.frame;h.get(I)!==M&&(h.set(I,M),I.update())}function fe(I,M){let Z=I.colorSpace,ee=I.format,se=I.type;return I.isCompressedTexture===!0||I.isVideoTexture===!0||Z!==sr&&Z!==ai&&(st.getTransfer(Z)===ft?(ee!==jt||se!==rn)&&We("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):$e("WebGLTextures: Unsupported texture color space:",Z)),M}function Te(I){return typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement?(c.width=I.naturalWidth||I.width,c.height=I.naturalHeight||I.height):typeof VideoFrame<"u"&&I instanceof VideoFrame?(c.width=I.displayWidth,c.height=I.displayHeight):(c.width=I.width,c.height=I.height),c}this.allocateTextureUnit=H,this.resetTextureUnits=B,this.getTextureUnits=D,this.setTextureUnits=F,this.setTexture2D=z,this.setTexture2DArray=U,this.setTexture3D=k,this.setTextureCube=Y,this.rebindTextures=Ye,this.setupRenderTarget=He,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=nt,this.setupDepthRenderbuffer=Ce,this.setupFrameBufferTexture=he,this.useMultisampledRTT=Ue,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function py(i,e){function t(n,s=ai){let r,o=st.getTransfer(s);if(n===rn)return i.UNSIGNED_BYTE;if(n===ga)return i.UNSIGNED_SHORT_4_4_4_4;if(n===_a)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Oc)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===zc)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Fc)return i.BYTE;if(n===Bc)return i.SHORT;if(n===Ds)return i.UNSIGNED_SHORT;if(n===ma)return i.INT;if(n===An)return i.UNSIGNED_INT;if(n===Yt)return i.FLOAT;if(n===Rn)return i.HALF_FLOAT;if(n===kc)return i.ALPHA;if(n===Hc)return i.RGB;if(n===jt)return i.RGBA;if(n===On)return i.DEPTH_COMPONENT;if(n===wi)return i.DEPTH_STENCIL;if(n===Us)return i.RED;if(n===xa)return i.RED_INTEGER;if(n===Ei)return i.RG;if(n===va)return i.RG_INTEGER;if(n===ya)return i.RGBA_INTEGER;if(n===Er||n===Tr||n===Ar||n===Rr)if(o===ft)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Er)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Tr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ar)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Rr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===Er)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Tr)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ar)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Rr)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ba||n===Ma||n===Sa||n===wa)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===ba)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ma)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Sa)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===wa)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Ea||n===Ta||n===Aa||n===Ra||n===Ca||n===Cr||n===Ia)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===Ea||n===Ta)return o===ft?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Aa)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===Ra)return r.COMPRESSED_R11_EAC;if(n===Ca)return r.COMPRESSED_SIGNED_R11_EAC;if(n===Cr)return r.COMPRESSED_RG11_EAC;if(n===Ia)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Pa||n===La||n===Da||n===Na||n===Ua||n===Fa||n===Ba||n===Oa||n===za||n===ka||n===Ha||n===Va||n===Ga||n===Wa)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===Pa)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===La)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Da)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Na)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ua)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Fa)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ba)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Oa)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===za)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ka)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ha)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Va)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ga)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Wa)return o===ft?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Xa||n===qa||n===Ya)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===Xa)return o===ft?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===qa)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ya)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===$a||n===Za||n===Ir||n===Ka)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===$a)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Za)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ir)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ka)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ns?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var my=` void main() { gl_Position = vec4( position, 1.0 ); -}`,iy=` +}`,gy=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; @@ -4217,7 +4217,7 @@ void main() { } -}`,mh=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){let n=new ur(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(t){if(this.texture!==null&&this.mesh===null){let e=t.cameras[0].viewport,n=new Ie({vertexShader:ny,fragmentShader:iy,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new ge(new cn(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},gh=class extends zn{constructor(t,e){super();let n=this,s=null,r=1,o=null,a="local-floor",l=1,c=null,h=null,d=null,u=null,f=null,m=null,_=typeof XRWebGLBinding<"u",g=new mh,p={},y=e.getContextAttributes(),w=null,M=null,x=[],S=[],A=new qt,v=null,E=null,R=new Ue;R.viewport=new ve;let L=new Ue;L.viewport=new ve;let N=[R,L],B=new ca,D=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let $=x[O];return $===void 0&&($=new Es,x[O]=$),$.getTargetRaySpace()},this.getControllerGrip=function(O){let $=x[O];return $===void 0&&($=new Es,x[O]=$),$.getGripSpace()},this.getHand=function(O){let $=x[O];return $===void 0&&($=new Es,x[O]=$),$.getHandSpace()};function H(O){let $=S.indexOf(O.inputSource);if($===-1)return;let rt=x[$];rt!==void 0&&(rt.update(O.inputSource,O.frame,c||o),rt.dispatchEvent({type:O.type,data:O.inputSource}))}function V(){s.removeEventListener("select",H),s.removeEventListener("selectstart",H),s.removeEventListener("selectend",H),s.removeEventListener("squeeze",H),s.removeEventListener("squeezestart",H),s.removeEventListener("squeezeend",H),s.removeEventListener("end",V),s.removeEventListener("inputsourceschange",z);for(let O=0;O=0&&(S[mt]=null,x[mt].disconnect(rt))}for(let $=0;$=S.length){S.push(rt),mt=Et;break}else if(S[Et]===null){S[Et]=rt,mt=Et;break}if(mt===-1)break}let ht=x[mt];ht&&ht.connect(rt)}}let U=new C,k=new C;function Y(O,$,rt){U.setFromMatrixPosition($.matrixWorld),k.setFromMatrixPosition(rt.matrixWorld);let mt=U.distanceTo(k),ht=$.projectionMatrix.elements,Et=rt.projectionMatrix.elements,Zt=ht[14]/(ht[10]-1),Ct=ht[14]/(ht[10]+1),Yt=(ht[9]+1)/ht[5],Ht=(ht[9]-1)/ht[5],dt=(ht[8]-1)/ht[0],Nt=(Et[8]+1)/Et[0],Gt=Zt*dt,ne=Zt*Nt,pt=mt/(-dt+Nt),Ut=pt*-dt;if($.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(Ut),O.translateZ(pt),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert(),ht[10]===-1)O.projectionMatrix.copy($.projectionMatrix),O.projectionMatrixInverse.copy($.projectionMatrixInverse);else{let P=Zt+pt,ft=Ct+pt,Tt=Gt-Ut,I=ne+(mt-Ut),b=Yt*Ct/ft*P,Z=Ht*Ct/ft*P;O.projectionMatrix.makePerspective(Tt,I,b,Z,P,ft),O.projectionMatrixInverse.copy(O.projectionMatrix).invert()}}function G(O,$){$===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices($.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(s===null)return;let $=O.near,rt=O.far;g.texture!==null&&(g.depthNear>0&&($=g.depthNear),g.depthFar>0&&(rt=g.depthFar)),B.near=L.near=R.near=$,B.far=L.far=R.far=rt,(D!==B.near||F!==B.far)&&(s.updateRenderState({depthNear:B.near,depthFar:B.far}),D=B.near,F=B.far),B.layers.mask=O.layers.mask|6,R.layers.mask=B.layers.mask&-5,L.layers.mask=B.layers.mask&-3;let mt=O.parent,ht=B.cameras;G(B,mt);for(let Et=0;Et0&&(g.alphaTest.value=p.alphaTest);let y=t.get(p),w=y.envMap,M=y.envMapRotation;w&&(g.envMap.value=w,g.envMapRotation.value.setFromMatrix4(sy.makeRotationFromEuler(M)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(df),g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,e(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,e(p.aoMap,g.aoMapTransform))}function o(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform))}function a(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,y,w){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*y,g.scale.value=w*.5,p.map&&(g.map.value=p.map,e(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function h(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function d(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function u(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,e(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,e(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,y){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,e(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,e(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,e(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,e(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,e(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===ze&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.retroreflectivity>0&&(g.retroreflectivity.value=p.retroreflectivity),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,e(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,e(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,e(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,e(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,e(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,e(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,e(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){let y=t.get(p).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function oy(i,t,e,n){let s={},r={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,x){let S=x.program;n.uniformBlockBinding(M,S)}function c(M,x){let S=s[M.id];S===void 0&&(g(M),S=h(M),s[M.id]=S,M.addEventListener("dispose",y));let A=x.program;n.updateUBOMapping(M,A);let v=t.render.frame;r[M.id]!==v&&(u(M),r[M.id]=v)}function h(M){let x=d();M.__bindingPointIndex=x;let S=i.createBuffer(),A=M.__size,v=M.usage;return i.bindBuffer(i.UNIFORM_BUFFER,S),i.bufferData(i.UNIFORM_BUFFER,A,v),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,x,S),S}function d(){for(let M=0;M0&&(S+=A-v),M.__size=S,M.__cache={},this}function p(M){let x={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(x.boundary=4,x.storage=4):M.isVector2?(x.boundary=8,x.storage=8):M.isVector3||M.isColor?(x.boundary=16,x.storage=12):M.isVector4?(x.boundary=16,x.storage=16):M.isMatrix3?(x.boundary=48,x.storage=48):M.isMatrix4?(x.boundary=64,x.storage=64):M.isTexture?Wt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(M)?(x.boundary=16,x.storage=M.byteLength):Wt("WebGLRenderer: Unsupported uniform value type.",M),x}function y(M){let x=M.target;x.removeEventListener("dispose",y);let S=o.indexOf(x.__bindingPointIndex);o.splice(S,1),i.deleteBuffer(s[x.id]),delete s[x.id],delete r[x.id]}function w(){for(let M in s)i.deleteBuffer(s[M]);o=[],s={},r={}}return{bind:l,update:c,dispose:w}}var ay=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Zn=null;function ly(){return Zn===null&&(Zn=new mn(ay,16,16,Ei,An),Zn.name="DFG_LUT",Zn.minFilter=qe,Zn.magFilter=qe,Zn.wrapS=Bn,Zn.wrapT=Bn,Zn.generateMipmaps=!1,Zn.needsUpdate=!0),Zn}var Ti=class{constructor(t={}){let{canvas:e=Id(),context:n=null,depth:s=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:u=!1,outputBufferType:f=rn}=t;this.isWebGLRenderer=!0;let m;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=n.getContextAttributes().alpha}else m=o;let _=f,g=new Set([va,xa,_a]),p=new Set([rn,Tn,Ds,Ns,ma,ga]),y=new Uint32Array(4),w=new Int32Array(4),M=new C,x=null,S=null,A=[],v=[],E=null;this.domElement=e,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=En,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let R=this,L=!1,N=null,B=null,D=null,F=null;this._outputColorSpace=me;let H=0,V=0,z=null,U=-1,k=null,Y=new ve,G=new ve,J=null,it=new Vt(0),nt=0,at=e.width,O=e.height,$=1,rt=null,mt=null,ht=new ve(0,0,at,O),Et=new ve(0,0,at,O),Zt=!1,Ct=new Hn,Yt=!1,Ht=!1,dt=new Kt,Nt=new C,Gt=new ve,ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},pt=!1;function Ut(){return z===null?$:1}let P=n;function ft(T,W){return e.getContext(T,W)}let Tt,I,b,Z,tt,st,gt,_t,ot,ct,xt,Ot,bt,vt,zt,Xt,jt,X,yt,lt,Mt,Rt,ut;try{let T={alpha:!0,depth:s,stencil:r,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"186"}`),e.addEventListener("webglcontextlost",be,!1),e.addEventListener("webglcontextrestored",ue,!1),e.addEventListener("webglcontextcreationerror",_n,!1),P===null){let W="webgl2";if(P=ft(W,T),P===null)throw ft(W)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}kt()}catch(T){throw e.removeEventListener("webglcontextlost",be,!1),e.removeEventListener("webglcontextrestored",ue,!1),e.removeEventListener("webglcontextcreationerror",_n,!1),$t("WebGLRenderer: "+T.message),T}function kt(){Tt=new mx(P),Tt.init(),Mt=new ey(P,Tt),I=new rx(P,Tt,t,Mt),b=new Qv(P,Tt),I.reversedDepthBuffer&&u&&b.buffers.depth.setReversed(!0),B=P.createFramebuffer(),D=P.createFramebuffer(),F=P.createFramebuffer(),Z=new xx(P),tt=new zv,st=new ty(P,Tt,b,tt,I,Mt,Z),gt=new px(R),_t=new yg(P),Rt=new ix(P,_t),ot=new gx(P,_t,Z,Rt),ct=new yx(P,ot,_t,Rt,Z),X=new vx(P,I,st),zt=new ox(tt),xt=new Ov(R,gt,Tt,I,Rt,zt),Ot=new ry(R,tt),bt=new Hv,vt=new Yv(Tt),jt=new nx(R,gt,b,ct,m,l),Xt=new jv(R,ct,I),ut=new oy(P,Z,I,b),yt=new sx(P,Tt,Z),lt=new _x(P,Tt,Z),Z.programs=xt.programs,R.capabilities=I,R.extensions=Tt,R.properties=tt,R.renderLists=bt,R.shadowMap=Xt,R.state=b,R.info=Z}_!==rn&&(E=new bx(_,e.width,e.height,a,s,r));let Ft=new gh(R,P);this.xr=Ft,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){let T=Tt.get("WEBGL_lose_context");T&&T.loseContext()},this.forceContextRestore=function(){let T=Tt.get("WEBGL_lose_context");T&&T.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(T){T!==void 0&&($=T,this.setSize(at,O,!1))},this.getSize=function(T){return T.set(at,O)},this.setSize=function(T,W,et=!0){if(Ft.isPresenting){Wt("WebGLRenderer: Can't change size while VR device is presenting.");return}at=T,O=W,e.width=Math.floor(T*$),e.height=Math.floor(W*$),et===!0&&(e.style.width=T+"px",e.style.height=W+"px"),E!==null&&E.setSize(e.width,e.height),this.setViewport(0,0,T,W)},this.getDrawingBufferSize=function(T){return T.set(at*$,O*$).floor()},this.setDrawingBufferSize=function(T,W,et){at=T,O=W,$=et,e.width=Math.floor(T*et),e.height=Math.floor(W*et),this.setViewport(0,0,T,W)},this.setEffects=function(T){if(_===rn){$t("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(T){for(let W=0;W{function At(){if(j.forEach(function(Pt){let Lt=tt.get(Pt).currentProgram;(Lt===void 0||Lt.isReady())&&j.delete(Pt)}),j.size===0){Q(T);return}setTimeout(At,10)}Tt.get("KHR_parallel_shader_compile")!==null?At():setTimeout(At,10)})};let zl=null;function _m(T){zl&&zl(T)}function au(){Li.stop()}function lu(){Li.start()}let Li=new of;Li.setAnimationLoop(_m),typeof self<"u"&&Li.setContext(self),this.setAnimationLoop=function(T){zl=T,Ft.setAnimationLoop(T),T===null?Li.stop():Li.start()},Ft.addEventListener("sessionstart",au),Ft.addEventListener("sessionend",lu),this.render=function(T,W){if(W!==void 0&&W.isCamera!==!0){$t("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;N!==null&&N.renderStart(T,W);let et=Ft.enabled===!0&&Ft.isPresenting===!0,j=E!==null&&(z===null||et)&&E.begin(R,z);if(T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),W.parent===null&&W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),Ft.enabled===!0&&Ft.isPresenting===!0&&(E===null||E.isCompositing()===!1)&&(Ft.cameraAutoUpdate===!0&&Ft.updateCamera(W),W=Ft.getCamera()),T.isScene===!0&&T.onBeforeRender(R,T,W,z),S=vt.get(T,v.length),S.init(W),S.state.textureUnits=st.getTextureUnits(),v.push(S),dt.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),Ct.setFromProjectionMatrix(dt,bn,W.reversedDepth),Ht=this.localClippingEnabled,Yt=zt.init(this.clippingPlanes,Ht),x=bt.get(T,A.length),x.init(),A.push(x),Ft.enabled===!0&&Ft.isPresenting===!0){let Pt=R.xr.getDepthSensingMesh();Pt!==null&&kl(Pt,W,-1/0,R.sortObjects)}kl(T,W,0,R.sortObjects),x.finish(),N!==null&&N.updateLights(S.state.lightsArray),R.sortObjects===!0&&x.sort(rt,mt),pt=Ft.enabled===!1||Ft.isPresenting===!1||Ft.hasDepthSensing()===!1,pt&&jt.addToRenderList(x,T),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Yt===!0&&zt.beginShadows();let Q=S.state.shadowsArray;if(Xt.render(Q,T,W),Yt===!0&&zt.endShadows(),(j&&E.hasRenderPass())===!1){let Pt=x.opaque,wt=x.transmissive;if(S.setupLights(),W.isArrayCamera){let Lt=W.cameras;if(wt.length>0)for(let Bt=0,Qt=Lt.length;Bt0&&hu(Pt,wt,T,W),pt&&jt.render(T),cu(x,T,W)}z!==null&&V===0&&(st.updateMultisampleRenderTarget(z),st.updateRenderTargetMipmap(z)),j&&E.end(R),T.isScene===!0&&T.onAfterRender(R,T,W),Rt.resetDefaultState(),U=-1,k=null,v.pop(),v.length>0?(S=v[v.length-1],st.setTextureUnits(S.state.textureUnits),Yt===!0&&zt.setGlobalState(R.clippingPlanes,S.state.camera)):S=null,A.pop(),A.length>0?x=A[A.length-1]:x=null,N!==null&&N.renderEnd()};function kl(T,W,et,j){if(T.visible===!1)return;if(T.layers.test(W.layers)){if(T.isGroup)et=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(W);else if(T.isLightProbeGrid)S.pushLightProbeGrid(T);else if(T.isLight)S.pushLight(T),T.castShadow&&S.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||T.intersectsFrustum(Ct)){j&&Gt.setFromMatrixPosition(T.matrixWorld).applyMatrix4(dt);let Pt=ct.update(T),wt=T.material;wt.visible&&x.push(T,Pt,wt,et,Gt.z,null,W)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||T.intersectsFrustum(Ct))){let Pt=ct.update(T),wt=T.material;if(j&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),Gt.copy(T.boundingSphere.center)):(Pt.boundingSphere===null&&Pt.computeBoundingSphere(),Gt.copy(Pt.boundingSphere.center)),Gt.applyMatrix4(T.matrixWorld).applyMatrix4(dt)),Array.isArray(wt)){let Lt=Pt.groups;for(let Bt=0,Qt=Lt.length;Bt0&&jr(Q,W,et),At.length>0&&jr(At,W,et),Pt.length>0&&jr(Pt,W,et),b.buffers.depth.setTest(!0),b.buffers.depth.setMask(!0),b.buffers.color.setMask(!0),b.setPolygonOffset(!1)}function hu(T,W,et,j){if((et.isScene===!0?et.overrideMaterial:null)!==null)return;if(S.state.transmissionRenderTarget[j.id]===void 0){let Dt=Tt.has("EXT_color_buffer_half_float")||Tt.has("EXT_color_buffer_float");S.state.transmissionRenderTarget[j.id]=new Be(1,1,{generateMipmaps:!0,type:Dt?An:rn,minFilter:Si,samples:Math.max(4,I.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:se.workingColorSpace})}let At=S.state.transmissionRenderTarget[j.id],Pt=j.viewport||Y;At.setSize(Pt.z*R.transmissionResolutionScale,Pt.w*R.transmissionResolutionScale);let wt=R.getRenderTarget(),Lt=R.getActiveCubeFace(),Bt=R.getActiveMipmapLevel();R.setRenderTarget(At),R.getClearColor(it),nt=R.getClearAlpha(),nt<1&&R.setClearColor(16777215,.5),R.clear(),pt&&jt.render(et);let Qt=R.toneMapping;R.toneMapping=En;let ie=j.viewport;if(j.viewport!==void 0&&(j.viewport=void 0),S.setupLightsView(j),Yt===!0&&zt.setGlobalState(R.clippingPlanes,j),jr(T,et,j),st.updateMultisampleRenderTarget(At),st.updateRenderTargetMipmap(At),Tt.has("WEBGL_multisampled_render_to_texture")===!1){let Dt=!1;for(let de=0,De=W.length;de0,j.currentProgram=ie,j.uniformsList=null,ie}function du(T){if(T.uniformsList===null){let W=T.currentProgram.getUniforms();T.uniformsList=Os.seqWithValue(W.seq,T.uniforms)}return T.uniformsList}function fu(T,W){let et=tt.get(T);et.outputColorSpace=W.outputColorSpace,et.batching=W.batching,et.batchingColor=W.batchingColor,et.instancing=W.instancing,et.instancingColor=W.instancingColor,et.instancingMorph=W.instancingMorph,et.skinning=W.skinning,et.morphTargets=W.morphTargets,et.morphNormals=W.morphNormals,et.morphColors=W.morphColors,et.morphTargetsCount=W.morphTargetsCount,et.numClippingPlanes=W.numClippingPlanes,et.numIntersection=W.numClipIntersection,et.vertexAlphas=W.vertexAlphas,et.vertexTangents=W.vertexTangents,et.toneMapping=W.toneMapping}function xm(T,W){if(T.length===0)return null;if(T.length===1)return T[0].texture!==null?T[0]:null;M.setFromMatrixPosition(W.matrixWorld);for(let et=0,j=T.length;et0),Dt=!!et.morphAttributes.position,de=!!et.morphAttributes.normal,De=!!et.morphAttributes.color,Ee=En;j.toneMapped&&(z===null||z.isXRRenderTarget===!0)&&(Ee=R.toneMapping);let Me=et.morphAttributes.position||et.morphAttributes.normal||et.morphAttributes.color,$e=Me!==void 0?Me.length:0,It=tt.get(j),en=S.state.lights;if(Yt===!0&&(Ht===!0||T!==k)){let Se=T===k&&j.id===U;zt.setState(j,T,Se)}let ce=!1;j.version===It.__version?(It.needsLights&&It.lightsStateVersion!==en.state.version||It.outputColorSpace!==wt||Q.isBatchedMesh&&It.batching===!1||!Q.isBatchedMesh&&It.batching===!0||Q.isBatchedMesh&&It.batchingColor===!0&&Q._colorsTexture===null||Q.isBatchedMesh&&It.batchingColor===!1&&Q._colorsTexture!==null||Q.isInstancedMesh&&It.instancing===!1||!Q.isInstancedMesh&&It.instancing===!0||Q.isSkinnedMesh&&It.skinning===!1||!Q.isSkinnedMesh&&It.skinning===!0||Q.isInstancedMesh&&It.instancingColor===!0&&Q.instanceColor===null||Q.isInstancedMesh&&It.instancingColor===!1&&Q.instanceColor!==null||Q.isInstancedMesh&&It.instancingMorph===!0&&Q.morphTexture===null||Q.isInstancedMesh&&It.instancingMorph===!1&&Q.morphTexture!==null||It.envMap!==Bt||j.fog===!0&&It.fog!==At||It.numClippingPlanes!==void 0&&(It.numClippingPlanes!==zt.numPlanes||It.numIntersection!==zt.numIntersection)||It.vertexAlphas!==Qt||It.vertexTangents!==ie||It.morphTargets!==Dt||It.morphNormals!==de||It.morphColors!==De||It.toneMapping!==Ee||It.morphTargetsCount!==$e||!!It.lightProbeGrid!=S.state.lightProbeGridArray.length>0)&&(ce=!0):(ce=!0,It.__version=j.version);let dn=It.currentProgram;ce===!0&&(dn=Qr(j,W,Q),N&&j.isNodeMaterial&&N.onUpdateProgram(j,dn,It));let Un=!1,ci=!1,ji=!1,_e=dn.getUniforms(),Pe=It.uniforms;if(b.useProgram(dn.program)&&(Un=!0,ci=!0,ji=!0),j.id!==U&&(U=j.id,ci=!0),It.needsLights){let Se=xm(S.state.lightProbeGridArray,Q);It.lightProbeGrid!==Se&&(It.lightProbeGrid=Se,ci=!0)}if(Un||k!==T){b.buffers.depth.getReversed()&&T.reversedDepth!==!0&&(T._reversedDepth=!0,T.updateProjectionMatrix()),_e.setValue(P,"projectionMatrix",T.projectionMatrix),_e.setValue(P,"viewMatrix",T.matrixWorldInverse);let ui=_e.map.cameraPosition;ui!==void 0&&ui.setValue(P,Nt.setFromMatrixPosition(T.matrixWorld)),I.logarithmicDepthBuffer&&_e.setValue(P,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),(j.isMeshPhongMaterial||j.isMeshToonMaterial||j.isMeshLambertMaterial||j.isMeshBasicMaterial||j.isMeshStandardMaterial||j.isShaderMaterial)&&_e.setValue(P,"isOrthographic",T.isOrthographicCamera===!0),k!==T&&(k=T,ci=!0,ji=!0)}if(It.needsLights&&(en.state.sunShadowMap.length>0&&_e.setValue(P,"sunShadowMap",en.state.sunShadowMap,st),en.state.directionalShadowMap.length>0&&_e.setValue(P,"directionalShadowMap",en.state.directionalShadowMap,st),en.state.spotShadowMap.length>0&&_e.setValue(P,"spotShadowMap",en.state.spotShadowMap,st),en.state.pointShadowMap.length>0&&_e.setValue(P,"pointShadowMap",en.state.pointShadowMap,st)),Q.isSkinnedMesh){_e.setOptional(P,Q,"bindMatrix"),_e.setOptional(P,Q,"bindMatrixInverse");let Se=Q.skeleton;Se&&(Se.boneTexture===null&&Se.computeBoneTexture(),_e.setValue(P,"boneTexture",Se.boneTexture,st))}Q.isBatchedMesh&&(_e.setOptional(P,Q,"batchingTexture"),_e.setValue(P,"batchingTexture",Q._matricesTexture,st),_e.setOptional(P,Q,"batchingIdTexture"),_e.setValue(P,"batchingIdTexture",Q._indirectTexture,st),_e.setOptional(P,Q,"batchingColorTexture"),Q._colorsTexture!==null&&_e.setValue(P,"batchingColorTexture",Q._colorsTexture,st));let hi=et.morphAttributes;if((hi.position!==void 0||hi.normal!==void 0||hi.color!==void 0)&&X.update(Q,et,dn),(ci||It.receiveShadow!==Q.receiveShadow)&&(It.receiveShadow=Q.receiveShadow,_e.setValue(P,"receiveShadow",Q.receiveShadow)),(j.isMeshStandardMaterial||j.isMeshLambertMaterial||j.isMeshPhongMaterial)&&j.envMap===null&&W.environment!==null&&(Pe.envMapIntensity.value=W.environmentIntensity),Pe.dfgLUT!==void 0&&(Pe.dfgLUT.value=ly()),ci){if(_e.setValue(P,"toneMappingExposure",R.toneMappingExposure),It.needsLights&&ym(Pe,ji),At&&j.fog===!0&&Ot.refreshFogUniforms(Pe,At),Ot.refreshMaterialUniforms(Pe,j,$,O,S.state.transmissionRenderTarget[T.id]),It.needsLights&&It.lightProbeGrid){let Se=It.lightProbeGrid;Pe.probesSH.value=Se.texture,Pe.probesMin.value.copy(Se.boundingBox.min),Pe.probesMax.value.copy(Se.boundingBox.max),Pe.probesResolution.value.copy(Se.resolution)}Os.upload(P,du(It),Pe,st)}if(j.isShaderMaterial&&j.uniformsNeedUpdate===!0&&(Os.upload(P,du(It),Pe,st),j.uniformsNeedUpdate=!1),j.isSpriteMaterial&&_e.setValue(P,"center",Q.center),_e.setValue(P,"modelViewMatrix",Q.modelViewMatrix),_e.setValue(P,"normalMatrix",Q.normalMatrix),_e.setValue(P,"modelMatrix",Q.matrixWorld),j.uniformsGroups!==void 0){let Se=j.uniformsGroups;for(let ui=0,Qi=Se.length;ui0&&st.useMultisampledRTT(T)===!1?j=tt.get(T).__webglMultisampledFramebuffer:Array.isArray(Bt)?j=Bt[et]:j=Bt,Y.copy(T.viewport),G.copy(T.scissor),J=T.scissorTest}else Y.copy(ht).multiplyScalar($).floor(),G.copy(Et).multiplyScalar($).floor(),J=Zt;if(et!==0&&(j=B),b.bindFramebuffer(P.FRAMEBUFFER,j)&&b.drawBuffers(T,j),b.viewport(Y),b.scissor(G),b.setScissorTest(J),Q){let wt=tt.get(T.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+W,wt.__webglTexture,et)}else if(At){let wt=W;for(let Lt=0;Lt1&&P.readBuffer(P.COLOR_ATTACHMENT0+wt);let Dt=pu(Bt);if(Dt.__formatReadable===!1){$t("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(Dt.__typeReadable===!1){$t("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}W>=0&&W<=T.width-j&&et>=0&&et<=T.height-Q&&P.readPixels(W,et,j,Q,Mt.convert(Qt),Mt.convert(ie),At)}finally{let Bt=z!==null?tt.get(z).__webglFramebuffer:null;b.bindFramebuffer(P.FRAMEBUFFER,Bt)}}},this.readRenderTargetPixelsAsync=async function(T,W,et,j,Q,At,Pt,wt=0){if(!(T&&T.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Lt=tt.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&Pt!==void 0&&(Lt=Lt[Pt]),Lt)if(W>=0&&W<=T.width-j&&et>=0&&et<=T.height-Q){b.bindFramebuffer(P.FRAMEBUFFER,Lt);let Bt=T.textures[wt],Qt=Bt.format,ie=Bt.type;T.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+wt);let Dt=pu(Bt);if(Dt.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(Dt.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let de=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,de),P.bufferData(P.PIXEL_PACK_BUFFER,At.byteLength,P.STREAM_READ),P.readPixels(W,et,j,Q,Mt.convert(Qt),Mt.convert(ie),0),P.bindBuffer(P.PIXEL_PACK_BUFFER,null);let De=z!==null?tt.get(z).__webglFramebuffer:null;b.bindFramebuffer(P.FRAMEBUFFER,De);let Ee=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await Ld(P,Ee,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,de),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,At),P.bindBuffer(P.PIXEL_PACK_BUFFER,null),P.deleteBuffer(de),P.deleteSync(Ee),At}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(T,W=null,et=0){let j=Math.pow(2,-et),Q=Math.floor(T.image.width*j),At=Math.floor(T.image.height*j),Pt=W!==null?W.x:0,wt=W!==null?W.y:0;st.setTexture2D(T,0),P.copyTexSubImage2D(P.TEXTURE_2D,et,0,0,Pt,wt,Q,At),b.unbindTexture()},this.copyTextureToTexture=function(T,W,et=null,j=null,Q=0,At=0){let Pt,wt,Lt,Bt,Qt,ie,Dt,de,De,Ee=T.isCompressedTexture?T.mipmaps[At]:T.image;if(et!==null)Pt=et.max.x-et.min.x,wt=et.max.y-et.min.y,Lt=et.isBox3?et.max.z-et.min.z:1,Bt=et.min.x,Qt=et.min.y,ie=et.isBox3?et.min.z:0;else{let Pe=Math.pow(2,-Q);Pt=Math.floor(Ee.width*Pe),wt=Math.floor(Ee.height*Pe),T.isDataArrayTexture?Lt=Ee.depth:T.isData3DTexture?Lt=Math.floor(Ee.depth*Pe):Lt=1,Bt=0,Qt=0,ie=0}j!==null?(Dt=j.x,de=j.y,De=j.z):(Dt=0,de=0,De=0);let Me=Mt.convert(W.format),$e=Mt.convert(W.type),It;W.isData3DTexture?(st.setTexture3D(W,0),It=P.TEXTURE_3D):W.isDataArrayTexture||W.isCompressedArrayTexture?(st.setTexture2DArray(W,0),It=P.TEXTURE_2D_ARRAY):(st.setTexture2D(W,0),It=P.TEXTURE_2D),b.activeTexture(P.TEXTURE0),b.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,W.flipY),b.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),b.pixelStorei(P.UNPACK_ALIGNMENT,W.unpackAlignment);let en=b.getParameter(P.UNPACK_ROW_LENGTH),ce=b.getParameter(P.UNPACK_IMAGE_HEIGHT),dn=b.getParameter(P.UNPACK_SKIP_PIXELS),Un=b.getParameter(P.UNPACK_SKIP_ROWS),ci=b.getParameter(P.UNPACK_SKIP_IMAGES);b.pixelStorei(P.UNPACK_ROW_LENGTH,Ee.width),b.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Ee.height),b.pixelStorei(P.UNPACK_SKIP_PIXELS,Bt),b.pixelStorei(P.UNPACK_SKIP_ROWS,Qt),b.pixelStorei(P.UNPACK_SKIP_IMAGES,ie);let ji=T.isDataArrayTexture||T.isData3DTexture,_e=W.isDataArrayTexture||W.isData3DTexture;if(T.isDepthTexture){let Pe=tt.get(T),hi=tt.get(W),Se=tt.get(Pe.__renderTarget),ui=tt.get(hi.__renderTarget);b.bindFramebuffer(P.READ_FRAMEBUFFER,Se.__webglFramebuffer),b.bindFramebuffer(P.DRAW_FRAMEBUFFER,ui.__webglFramebuffer);for(let Qi=0;Qi=c.length){s-=c.length;continue}let h=Math.min(o,c.length-s);if(a.push(c.substringData(s,h)),o-=h,s=0,!o)break}let l=new Uint8Array(Math.ceil((r+e)/3)*3);if(_h(l,0,a.join(""))i!==null&&typeof i=="object"&&!Array.isArray(i),Rn=i=>Array.isArray(i)&&i.every($i),Ai=i=>Array.isArray(i)&&i.length===3&&i.every(t=>typeof t=="number"),xf=i=>$i(i)&&Ai(i.min)&&Ai(i.max),mf=i=>i==null||$i(i)&&Rn(i.planes)&&i.planes.every(t=>Ai(t.normal)&&t.normal.every(Number.isFinite)&&t.normal.some(e=>e!==0)&&Number.isFinite(t.offset))&&(i.box==null||xf(i.box)&&i.box.max.every(Number.isFinite)&&i.box.min.every((t,e)=>Number.isFinite(t)&&t<=i.box.max[e]));function uy(i){if(!$i(i)||!Rn(i.elements)||!Rn(i.geometries)||!Rn(i.materials)||!$i(i.instances))throw new ee("META must describe elements, geometries, materials and instances.");if(i.title!=null&&typeof i.title!="string")throw new ee("Invalid META title.");let{instances:t}=i;if(!Number.isSafeInteger(t.count)||t.count<0)throw new ee("Invalid META instance count.");for(let[n,s,r]of[["geometry","u32",t.count],["material","u32",t.count],["element","i32",t.count],["matrix","f32",t.count*12]])if(t[n]?.t!==s||t[n].n!==r)throw new ee(`Invalid META instance ${n} view.`);for(let n of i.geometries){let s=n.q;if(!xf(n.bbox)||!["u16","u32"].includes(n.indices?.t)||n.positions?.t!==(s?"u16":"f32")||s&&(!Ai(s.o)||typeof s.s!="number")||n.normals!=null&&!["f32","i16"].includes(n.normals.t)||n.uvs!=null&&n.uvs.t!=="f32"||n.kind!=null&&n.kind!=="points"&&n.kind!=="lines"||n.colors!=null&&(n.kind!=="points"||n.colors.t!=="u8"||n.colors.n!==n.positions.n)||n.intensities!=null&&(n.kind!=="points"||n.intensities.t!=="u8"||3*n.intensities.n!==n.positions.n))throw new ee("Invalid META geometry.")}for(let n of["points","lines"])if(i[n]!=null){let s=i[n];if(!$i(s)||!Number.isSafeInteger(s.count)||s.count<0)throw new ee(`Invalid META ${n} count.`);for(let[r,o,a]of[["geometry","u32",s.count],["material","u32",s.count],["element","i32",s.count],["matrix","f32",s.count*12]])if(s[r]?.t!==o||s[r].n!==a)throw new ee(`Invalid META ${n} ${r} view.`)}if(i.annotations!=null&&!Rn(i.annotations))throw new ee("Invalid META annotations.");if(i.sheets!=null&&!Rn(i.sheets))throw new ee("Invalid META sheets.");if(i.panoramas!=null&&(!Rn(i.panoramas)||i.panoramas.some(n=>!Number.isInteger(n.element)||n.element<0||n.element>=i.elements.length||n.name!=null&&typeof n.name!="string"||!Ai(n.position)||!n.position.every(Number.isFinite)||!Number.isFinite(n.yaw)||!e(n.image)||n.intensity!=null&&!e(n.intensity))))throw new ee("Invalid META panorama.");function e(n){return n?.t==="u8"&&Number.isSafeInteger(n.n)&&n.n>=4&&n.n<=16*1024*1024}dy(i);for(let n of i.materials){let s=n.texture;if(!Ai(n.color)||typeof n.opacity!="number"||s!=null&&(!Number.isInteger(s)||s<0||s>=(i.textures?.length??0)))throw new ee("Invalid META material.")}}function dy(i){if(!$i(i)||!Rn(i.elements)||i.title!=null&&typeof i.title!="string")throw new ee("Invalid review metadata.");for(let l of["textures","grids","viewpoints","bcfTopics","clashTests","linkedFiles","models"])if(i[l]!=null&&!Rn(i[l]))throw new ee(`Invalid META ${l} list.`);if(i.models?.some(({id:l,name:c})=>!Number.isSafeInteger(l)||typeof c!="string")||i.elements.some(({modelId:l,levelId:c})=>l!=null&&!Number.isSafeInteger(l)||c!=null&&!Number.isSafeInteger(c)))throw new ee("Invalid META model or level identity.");let t=l=>l==null||Array.isArray(l)&&l.every(c=>Number.isInteger(c)&&c>=0&&cAi(l)&&l.every(Number.isFinite),n=l=>l==null||typeof l=="string",s=l=>e(l.camera?.position)&&e(l.camera?.target)&&mf(l.sections)&&t(l.hiddenElements)&&t(l.visibleElements)&&t(l.selectedElements)&&(l.hiddenElements==null||l.visibleElements==null)&&(l.hiddenModelKeys==null||Array.isArray(l.hiddenModelKeys)&&l.hiddenModelKeys.every(c=>typeof c=="string")),r=l=>Number.isSafeInteger(l)&&l>=0,o=l=>s(l)&&e(l.camera.up)&&l.camera.up.some(c=>c!==0)&&(l.camera.projection==="orthographic"?Number.isFinite(l.camera.orthographicHeight)&&l.camera.orthographicHeight>0:l.camera.projection==="perspective"&&Number.isFinite(l.camera.fov)&&l.camera.fov>0&&l.camera.fov<180)&&r(l.missingComponents)&&r(l.ambiguousComponents),a=l=>{let c=Ur(l);return Array.isArray(c)&&c.length>=2&&c.every(e)};if(i.grids?.some(l=>!a(l))||i.viewpoints?.some(l=>!s(l))||i.clashTests?.some(l=>!Rn(l.clashes)||l.clashes.some(c=>!Ai(c.point))))throw new ee("Invalid META grids, viewpoints or clashes.");if(i.bcfTopics?.some(l=>typeof l.title!="string"||!n(l.description)||!n(l.status)||!Rn(l.viewpoints)||l.viewpoints.some(c=>!o(c))))throw new ee("Invalid META BCF topics.");if(i.linkedFiles?.some(l=>!t(l.members)))throw new ee("Invalid META linked file members.");if(!mf(i.sections))throw new ee("Invalid META sections.")}function fy(i){let t;try{t=JSON.parse(i)}catch(e){throw new ee(e.message,{cause:e})}return uy(t),t}function xh(i=document,t){t?.("metadataStart");let e;try{e=_f(i,"ioviewer-meta")}catch(s){throw s instanceof ee?s:new ee(s.message,{cause:s})}let n=fy(e);return t?.("metadataEnd"),n}function gf(i,t){let e=cy[i?.t];if(!e)throw new ee(`Unknown view type '${i?.t}'.`);let n=e.BYTES_PER_ELEMENT;if(!(Number.isSafeInteger(i.o)&&Number.isSafeInteger(i.n)&&i.o>=0&&i.n>=0&&i.o%n===0&&i.o+i.n*n<=t))throw new ee(`View ${JSON.stringify(i)} is outside the ${t} bytes of binary data.`);return e}function vf(i=document,t,e=xh(i,t)){let n,s,r,o;try{if(t?.("binaryStart"),s=i.getElementById("ioviewer-bin"),!s)throw new Error("Data block 'ioviewer-bin' is missing.");({bytes:n,canonical:r}=pf(s)),t?.("binaryEnd")}catch(c){throw new ee(c.message,{cause:c})}let a=n.length,l=null;return{meta:e,view(c){if(!n)throw new Error("The binary data has been released.");let h=gf(c,a);return new h(n.buffer,c.o,c.n)},readView(c){let h=gf(c,a);if(!c.n)return new h(0);!n&&!r&&(o??(o=pf(s).bytes));let d=n??o;return d?new h(d.buffer,c.o,c.n):new h(hy(s,c.o,c.n*h.BYTES_PER_ELEMENT))},releaseBinary(){n=null,o=null},props(c){return l??(l=JSON.parse(_f(i,"ioviewer-props"))),l[c]??null}}}var yf=new Kt,Mf=new Hn,vh=32;function yh(i,t=new Float64Array(24)){return yf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Mf.setFromProjectionMatrix(yf,i.coordinateSystem,i.reversedDepth),Mf.planes.forEach(({normal:e,constant:n},s)=>t.set([e.x,e.y,e.z,n],s*4)),t}function Mh(i,t,e,n,s){for(let r=0;r<24;r+=4)if(i[r]*t+i[r+1]*e+i[r+2]*n+i[r+3]<-s)return!0;return!1}function bf(i,t,e,n,s){for(let r=0;r<24;r+=4)if(i[r]*t+i[r+1]*e+i[r+2]*n+i[r+3]=0;r--)if(i[r]!==0){if(n+=i[r],n>e)return s?r===0?0:2**(r/2-4):2**((r+1)/2-4);s=!1}return 0}var Cn=.0009765625,Sh=32767,Fr=i=>i<0?-1:1;function wf(i){let t=Math.min(Math.max(i,-1),1)*Sh;return Fr(t)*Math.round(Math.abs(t))}function Br(i,t,e,n,s){let r=Math.abs(e)+Math.abs(n)+Math.abs(s);if(!(r>0)){i[t]=i[t+1]=0;return}let o=e/r,a=n/r;s<0&&([o,a]=[(1-Math.abs(a))*Fr(o),(1-Math.abs(o))*Fr(a)]),i[t]=wf(o),i[t+1]=wf(a)}function Ef(i,t,e,n){let s=Math.max(e/Sh,-1),r=Math.max(n/Sh,-1),o=1-Math.abs(s)-Math.abs(r);o<0&&([s,r]=[(1-Math.abs(r))*Fr(s),(1-Math.abs(s))*Fr(r)]);let a=Math.sqrt(s*s+r*r+o*o);i[t]=s/a,i[t+1]=r/a,i[t+2]=o/a}function Or(i,t){let e=i.view(t.positions);if(!t.q){if(!(e instanceof Float32Array))throw new Error(`Geometry positions of type '${t.positions.t}' need a "q" origin and step.`);return e}if(!(e instanceof Uint16Array))throw new Error(`Quantized geometry positions must be u16, got '${t.positions.t}'.`);return e}function Hs(i,t){let e=Or(i,t);if(!t.q)return e;let[n,s,r]=t.q.o,o=t.q.s,a=new Float32Array(e.length);for(let l=0;ls[d]&&(s[d]=u))}let r=0;for(let h=1;h<3;h++)s[h]-n[h]>s[r]-n[r]&&(r=h);let o=s[r]-n[r],a=2**20-1,l=new Float64Array(i.length);for(let h=0;h0&&Number.isFinite(u)?Math.round((u-n[r])/o*a):0;l[h]=f*2**32+d}let c=0;e<0?l.sort():c=my(l,e);for(let h=0;hr)return i.subarray(e,n+1).sort(),a+l*Math.ceil(Math.log2(l));a+=l,s=Math.imul(s,1664525)+1013904223>>>0;let c=i[e+s%(n-e+1)],h=e,d=n;for(;h<=d;){for(;i[h]c;)d--;if(h<=d){let u=i[h];i[h++]=i[d],i[d--]=u}}if(t<=d)n=d;else if(t>=h)e=h;else return a}return a}function Lf(i,t,e,n=1/0){let s=[];s.scanned=0;let r=[Uint32Array.from(t)];for(;r.length;){let o=r.pop(),a=Math.ceil(o.length/e);if(o.length<=1||a<=1&&gy(o,i)<=n){o.length&&s.push(o);continue}let l=a>1?Math.ceil(o.length*Math.floor(a/2)/a):Math.ceil(o.length/2);s.scanned+=Pf(o,i,l),r.push(o.subarray(l),o.subarray(0,l))}return s}function gy(i,t){let e=1/0,n=1/0,s=1/0,r=-1/0,o=-1/0,a=-1/0;for(let l of i){let c=t[l*3],h=t[l*3+1],d=t[l*3+2];cr&&(r=c),ho&&(o=h),da&&(a=d)}return Math.hypot(r-e,o-n,a-s)/2}function Df(i,t){let e=new Float64Array(6).fill(-1/0),n=new Float64Array(6).fill(-1/0),s=new Int32Array(6);for(let o=0;oe[a]?(n[a]=e[a],e[a]=c,s[a]=o):c>n[a]&&(n[a]=c)}if(e[0]===-1/0)return 0;let r=Math.hypot(e[0]+e[3],e[1]+e[4],e[2]+e[5]);if(n[0]===-1/0)return r;for(let o of s){let a=c=>s[c]===o?n[c]:e[c],l=Math.hypot(a(0)+a(3),a(1)+a(4),a(2)+a(5));r=Math.min(r,2*l)}return r}var Eh=384*2**20;function Nf(i,{cap:t=Eh,minRepeats:e=16,perCell:n=1024,maxDraws:s=1024}={}){let r=new Uint8Array(i.length),o=0;for(let h of i)o+=h.k*h.bytes;if(o<=t)return r;let a=h=>(i[h].k-1)*i[h].bytes,l=[...i.keys()].filter(h=>i[h].k>=e);l.sort((h,d)=>a(d)-a(h)||i[d].k-i[h].k||h-d);let c=0;for(let h of l){let d=i[h].cells??Math.ceil(i[h].k/n);c+d>s||(r[h]=1,c+=d)}return r}function sl(i,t){return i>65535?new Uint32Array(t):new Uint16Array(t)}function Th(i,t){return i.sort((e,n)=>t[n]-t[e]||e-n)}function Uf(i,t,e,n){for(;t>>1;i[s]>=n?t=s+1:e=s}return t}function Ff(i,t,e){let n=i[t];return[n,e>t?i[e]-n:0]}function Bf(i,t,e,n){let s=i.subarray(t*12,t*12+12);if(s[0]===1&&s[1]===0&&s[2]===0&&s[3]===0&&s[4]===1&&s[5]===0&&s[6]===0&&s[7]===0&&s[8]===1&&e.q&&e.q.s===Cn){for(let a=0;a<3;a++)n[a]=s[9+a]+e.q.o[a];return Rf}let o=!0;for(let a=0;a<3;a++){let l=s[9+a],c=s[9+a];for(let h=0;h<3;h++){let d=s[h*3+a]*e.min[h],u=s[h*3+a]*e.max[h];l+=Math.min(d,u),c+=Math.max(d,u)}n[a]=Math.floor(l/Cn)*Cn,Math.ceil((c-n[a])/Cn)<=Cf||(o=!1)}return o||n.fill(0),o?py:Vs}function Of(i,t){let e=i.length,n=0,s=0;for(let g of i){let p=t.source(t.geometryOf[g]);n+=p.vertices,s+=p.indices.length}let r=t.kind[i[0]]===Vs,o=r?new Float32Array(n*4):new Uint16Array(n*4),a=new Int16Array(n*2),l=t.textured?new Float32Array(n*2):null,c=sl(n,s),h=new Uint32Array(e+1),d=new Float32Array(e*3),u=new Float32Array(e),f=new Float64Array(3),m=0,_=0;for(let g=0;gMath.min(Math.max(Math.round(i/Cn),0),Cf);function zf(i,t,e,n,s){let r=i.length/3,o=[1/0,1/0,1/0],a=[-1/0,-1/0,-1/0];for(let c=0;ca[h]&&(a[h]=d)}let l=e instanceof Int16Array?e:null;return{positions:i,q:t,oct:l,normals:l?null:e,indices:n,uvs:s,vertices:r,min:o,max:a}}function rl(i){if(!i.normals&&i.oct){i.normals=new Float32Array(i.vertices*3);for(let t=0;t=0&&(S[me]=null,x[me].disconnect(re))}for(let $=0;$=S.length){S.push(re),me=Ee;break}else if(S[Ee]===null){S[Ee]=re,me=Ee;break}if(me===-1)break}let he=x[me];he&&he.connect(re)}}let U=new C,k=new C;function Y(O,$,re){U.setFromMatrixPosition($.matrixWorld),k.setFromMatrixPosition(re.matrixWorld);let me=U.distanceTo(k),he=$.projectionMatrix.elements,Ee=re.projectionMatrix.elements,Ze=he[14]/(he[10]-1),Ce=he[14]/(he[10]+1),Ye=(he[9]+1)/he[5],He=(he[9]-1)/he[5],de=(he[8]-1)/he[0],Ne=(Ee[8]+1)/Ee[0],Ge=Ze*de,nt=Ze*Ne,pe=me/(-de+Ne),Ue=pe*-de;if($.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(Ue),O.translateZ(pe),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert(),he[10]===-1)O.projectionMatrix.copy($.projectionMatrix),O.projectionMatrixInverse.copy($.projectionMatrixInverse);else{let P=Ze+pe,fe=Ce+pe,Te=Ge-Ue,I=nt+(me-Ue),M=Ye*Ce/fe*P,Z=He*Ce/fe*P;O.projectionMatrix.makePerspective(Te,I,M,Z,P,fe),O.projectionMatrixInverse.copy(O.projectionMatrix).invert()}}function G(O,$){$===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices($.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(s===null)return;let $=O.near,re=O.far;g.texture!==null&&(g.depthNear>0&&($=g.depthNear),g.depthFar>0&&(re=g.depthFar)),B.near=L.near=R.near=$,B.far=L.far=R.far=re,(D!==B.near||F!==B.far)&&(s.updateRenderState({depthNear:B.near,depthFar:B.far}),D=B.near,F=B.far),B.layers.mask=O.layers.mask|6,R.layers.mask=B.layers.mask&-5,L.layers.mask=B.layers.mask&-3;let me=O.parent,he=B.cameras;G(B,me);for(let Ee=0;Ee0&&(g.alphaTest.value=p.alphaTest);let y=e.get(p),w=y.envMap,b=y.envMapRotation;w&&(g.envMap.value=w,g.envMapRotation.value.setFromMatrix4(_y.makeRotationFromEuler(b)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(mf),g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,g.aoMapTransform))}function o(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform))}function a(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,y,w){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*y,g.scale.value=w*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function h(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function d(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function u(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,y){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===zt&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.retroreflectivity>0&&(g.retroreflectivity.value=p.retroreflectivity),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){let y=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function vy(i,e,t,n){let s={},r={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,x){let S=x.program;n.uniformBlockBinding(b,S)}function c(b,x){let S=s[b.id];S===void 0&&(g(b),S=h(b),s[b.id]=S,b.addEventListener("dispose",y));let A=x.program;n.updateUBOMapping(b,A);let v=e.render.frame;r[b.id]!==v&&(u(b),r[b.id]=v)}function h(b){let x=d();b.__bindingPointIndex=x;let S=i.createBuffer(),A=b.__size,v=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,S),i.bufferData(i.UNIFORM_BUFFER,A,v),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,x,S),S}function d(){for(let b=0;b0&&(S+=A-v),b.__size=S,b.__cache={},this}function p(b){let x={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(x.boundary=4,x.storage=4):b.isVector2?(x.boundary=8,x.storage=8):b.isVector3||b.isColor?(x.boundary=16,x.storage=12):b.isVector4?(x.boundary=16,x.storage=16):b.isMatrix3?(x.boundary=48,x.storage=48):b.isMatrix4?(x.boundary=64,x.storage=64):b.isTexture?We("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(b)?(x.boundary=16,x.storage=b.byteLength):We("WebGLRenderer: Unsupported uniform value type.",b),x}function y(b){let x=b.target;x.removeEventListener("dispose",y);let S=o.indexOf(x.__bindingPointIndex);o.splice(S,1),i.deleteBuffer(s[x.id]),delete s[x.id],delete r[x.id]}function w(){for(let b in s)i.deleteBuffer(s[b]);o=[],s={},r={}}return{bind:l,update:c,dispose:w}}var yy=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Zn=null;function by(){return Zn===null&&(Zn=new gn(yy,16,16,Ei,Rn),Zn.name="DFG_LUT",Zn.minFilter=qt,Zn.magFilter=qt,Zn.wrapS=Bn,Zn.wrapT=Bn,Zn.generateMipmaps=!1,Zn.needsUpdate=!0),Zn}var Ti=class{constructor(e={}){let{canvas:t=Dd(),context:n=null,depth:s=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:u=!1,outputBufferType:f=rn}=e;this.isWebGLRenderer=!0;let m;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=n.getContextAttributes().alpha}else m=o;let _=f,g=new Set([ya,va,xa]),p=new Set([rn,An,Ds,Ns,ga,_a]),y=new Uint32Array(4),w=new Int32Array(4),b=new C,x=null,S=null,A=[],v=[],E=null;this.domElement=t,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Tn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let R=this,L=!1,N=null,B=null,D=null,F=null;this._outputColorSpace=mt;let H=0,V=0,z=null,U=-1,k=null,Y=new vt,G=new vt,J=null,ie=new Ve(0),ne=0,ae=t.width,O=t.height,$=1,re=null,me=null,he=new vt(0,0,ae,O),Ee=new vt(0,0,ae,O),Ze=!1,Ce=new Hn,Ye=!1,He=!1,de=new Ke,Ne=new C,Ge=new vt,nt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},pe=!1;function Ue(){return z===null?$:1}let P=n;function fe(T,W){return t.getContext(T,W)}let Te,I,M,Z,ee,se,ge,_e,oe,ce,xe,Oe,Me,ve,ze,Xe,je,q,ye,le,be,Re,ue;try{let T={alpha:!0,depth:s,stencil:r,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"186"}`),t.addEventListener("webglcontextlost",Mt,!1),t.addEventListener("webglcontextrestored",ut,!1),t.addEventListener("webglcontextcreationerror",xn,!1),P===null){let W="webgl2";if(P=fe(W,T),P===null)throw fe(W)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}ke()}catch(T){throw t.removeEventListener("webglcontextlost",Mt,!1),t.removeEventListener("webglcontextrestored",ut,!1),t.removeEventListener("webglcontextcreationerror",xn,!1),$e("WebGLRenderer: "+T.message),T}function ke(){Te=new Rx(P),Te.init(),be=new py(P,Te),I=new xx(P,Te,e,be),M=new dy(P,Te),I.reversedDepthBuffer&&u&&M.buffers.depth.setReversed(!0),B=P.createFramebuffer(),D=P.createFramebuffer(),F=P.createFramebuffer(),Z=new Px(P),ee=new jv,se=new fy(P,Te,M,ee,I,be,Z),ge=new Ax(R),_e=new Dg(P),Re=new gx(P,_e),oe=new Cx(P,_e,Z,Re),ce=new Dx(P,oe,_e,Re,Z),q=new Lx(P,I,se),ze=new vx(ee),xe=new Jv(R,ge,Te,I,Re,ze),Oe=new xy(R,ee),Me=new ey,ve=new oy(Te),je=new mx(R,ge,M,ce,m,l),Xe=new uy(R,ce,I),ue=new vy(P,Z,I,M),ye=new _x(P,Te,Z),le=new Ix(P,Te,Z),Z.programs=xe.programs,R.capabilities=I,R.extensions=Te,R.properties=ee,R.renderLists=Me,R.shadowMap=Xe,R.state=M,R.info=Z}_!==rn&&(E=new Ux(_,t.width,t.height,a,s,r));let Fe=new _h(R,P);this.xr=Fe,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){let T=Te.get("WEBGL_lose_context");T&&T.loseContext()},this.forceContextRestore=function(){let T=Te.get("WEBGL_lose_context");T&&T.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(T){T!==void 0&&($=T,this.setSize(ae,O,!1))},this.getSize=function(T){return T.set(ae,O)},this.setSize=function(T,W,te=!0){if(Fe.isPresenting){We("WebGLRenderer: Can't change size while VR device is presenting.");return}ae=T,O=W,t.width=Math.floor(T*$),t.height=Math.floor(W*$),te===!0&&(t.style.width=T+"px",t.style.height=W+"px"),E!==null&&E.setSize(t.width,t.height),this.setViewport(0,0,T,W)},this.getDrawingBufferSize=function(T){return T.set(ae*$,O*$).floor()},this.setDrawingBufferSize=function(T,W,te){ae=T,O=W,$=te,t.width=Math.floor(T*te),t.height=Math.floor(W*te),this.setViewport(0,0,T,W)},this.setEffects=function(T){if(_===rn){$e("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(T){for(let W=0;W{function Ae(){if(j.forEach(function(Pe){let Le=ee.get(Pe).currentProgram;(Le===void 0||Le.isReady())&&j.delete(Pe)}),j.size===0){Q(T);return}setTimeout(Ae,10)}Te.get("KHR_parallel_shader_compile")!==null?Ae():setTimeout(Ae,10)})};let kl=null;function Im(T){kl&&kl(T)}function hu(){Li.stop()}function uu(){Li.start()}let Li=new cf;Li.setAnimationLoop(Im),typeof self<"u"&&Li.setContext(self),this.setAnimationLoop=function(T){kl=T,Fe.setAnimationLoop(T),T===null?Li.stop():Li.start()},Fe.addEventListener("sessionstart",hu),Fe.addEventListener("sessionend",uu),this.render=function(T,W){if(W!==void 0&&W.isCamera!==!0){$e("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;N!==null&&N.renderStart(T,W);let te=Fe.enabled===!0&&Fe.isPresenting===!0,j=E!==null&&(z===null||te)&&E.begin(R,z);if(T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),W.parent===null&&W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),Fe.enabled===!0&&Fe.isPresenting===!0&&(E===null||E.isCompositing()===!1)&&(Fe.cameraAutoUpdate===!0&&Fe.updateCamera(W),W=Fe.getCamera()),T.isScene===!0&&T.onBeforeRender(R,T,W,z),S=ve.get(T,v.length),S.init(W),S.state.textureUnits=se.getTextureUnits(),v.push(S),de.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),Ce.setFromProjectionMatrix(de,Sn,W.reversedDepth),He=this.localClippingEnabled,Ye=ze.init(this.clippingPlanes,He),x=Me.get(T,A.length),x.init(),A.push(x),Fe.enabled===!0&&Fe.isPresenting===!0){let Pe=R.xr.getDepthSensingMesh();Pe!==null&&Hl(Pe,W,-1/0,R.sortObjects)}Hl(T,W,0,R.sortObjects),x.finish(),N!==null&&N.updateLights(S.state.lightsArray),R.sortObjects===!0&&x.sort(re,me),pe=Fe.enabled===!1||Fe.isPresenting===!1||Fe.hasDepthSensing()===!1,pe&&je.addToRenderList(x,T),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Ye===!0&&ze.beginShadows();let Q=S.state.shadowsArray;if(Xe.render(Q,T,W),Ye===!0&&ze.endShadows(),(j&&E.hasRenderPass())===!1){let Pe=x.opaque,we=x.transmissive;if(S.setupLights(),W.isArrayCamera){let Le=W.cameras;if(we.length>0)for(let Be=0,Qe=Le.length;Be0&&fu(Pe,we,T,W),pe&&je.render(T),du(x,T,W)}z!==null&&V===0&&(se.updateMultisampleRenderTarget(z),se.updateRenderTargetMipmap(z)),j&&E.end(R),T.isScene===!0&&T.onAfterRender(R,T,W),Re.resetDefaultState(),U=-1,k=null,v.pop(),v.length>0?(S=v[v.length-1],se.setTextureUnits(S.state.textureUnits),Ye===!0&&ze.setGlobalState(R.clippingPlanes,S.state.camera)):S=null,A.pop(),A.length>0?x=A[A.length-1]:x=null,N!==null&&N.renderEnd()};function Hl(T,W,te,j){if(T.visible===!1)return;if(T.layers.test(W.layers)){if(T.isGroup)te=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(W);else if(T.isLightProbeGrid)S.pushLightProbeGrid(T);else if(T.isLight)S.pushLight(T),T.castShadow&&S.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||T.intersectsFrustum(Ce)){j&&Ge.setFromMatrixPosition(T.matrixWorld).applyMatrix4(de);let Pe=ce.update(T),we=T.material;we.visible&&x.push(T,Pe,we,te,Ge.z,null,W)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||T.intersectsFrustum(Ce))){let Pe=ce.update(T),we=T.material;if(j&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),Ge.copy(T.boundingSphere.center)):(Pe.boundingSphere===null&&Pe.computeBoundingSphere(),Ge.copy(Pe.boundingSphere.center)),Ge.applyMatrix4(T.matrixWorld).applyMatrix4(de)),Array.isArray(we)){let Le=Pe.groups;for(let Be=0,Qe=Le.length;Be0&&Qr(Q,W,te),Ae.length>0&&Qr(Ae,W,te),Pe.length>0&&Qr(Pe,W,te),M.buffers.depth.setTest(!0),M.buffers.depth.setMask(!0),M.buffers.color.setMask(!0),M.setPolygonOffset(!1)}function fu(T,W,te,j){if((te.isScene===!0?te.overrideMaterial:null)!==null)return;if(S.state.transmissionRenderTarget[j.id]===void 0){let De=Te.has("EXT_color_buffer_half_float")||Te.has("EXT_color_buffer_float");S.state.transmissionRenderTarget[j.id]=new Bt(1,1,{generateMipmaps:!0,type:De?Rn:rn,minFilter:Si,samples:Math.max(4,I.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:st.workingColorSpace})}let Ae=S.state.transmissionRenderTarget[j.id],Pe=j.viewport||Y;Ae.setSize(Pe.z*R.transmissionResolutionScale,Pe.w*R.transmissionResolutionScale);let we=R.getRenderTarget(),Le=R.getActiveCubeFace(),Be=R.getActiveMipmapLevel();R.setRenderTarget(Ae),R.getClearColor(ie),ne=R.getClearAlpha(),ne<1&&R.setClearColor(16777215,.5),R.clear(),pe&&je.render(te);let Qe=R.toneMapping;R.toneMapping=Tn;let it=j.viewport;if(j.viewport!==void 0&&(j.viewport=void 0),S.setupLightsView(j),Ye===!0&&ze.setGlobalState(R.clippingPlanes,j),Qr(T,te,j),se.updateMultisampleRenderTarget(Ae),se.updateRenderTargetMipmap(Ae),Te.has("WEBGL_multisampled_render_to_texture")===!1){let De=!1;for(let dt=0,Dt=W.length;dt0,j.currentProgram=it,j.uniformsList=null,it}function mu(T){if(T.uniformsList===null){let W=T.currentProgram.getUniforms();T.uniformsList=Os.seqWithValue(W.seq,T.uniforms)}return T.uniformsList}function gu(T,W){let te=ee.get(T);te.outputColorSpace=W.outputColorSpace,te.batching=W.batching,te.batchingColor=W.batchingColor,te.instancing=W.instancing,te.instancingColor=W.instancingColor,te.instancingMorph=W.instancingMorph,te.skinning=W.skinning,te.morphTargets=W.morphTargets,te.morphNormals=W.morphNormals,te.morphColors=W.morphColors,te.morphTargetsCount=W.morphTargetsCount,te.numClippingPlanes=W.numClippingPlanes,te.numIntersection=W.numClipIntersection,te.vertexAlphas=W.vertexAlphas,te.vertexTangents=W.vertexTangents,te.toneMapping=W.toneMapping}function Pm(T,W){if(T.length===0)return null;if(T.length===1)return T[0].texture!==null?T[0]:null;b.setFromMatrixPosition(W.matrixWorld);for(let te=0,j=T.length;te0),De=!!te.morphAttributes.position,dt=!!te.morphAttributes.normal,Dt=!!te.morphAttributes.color,Et=Tn;j.toneMapped&&(z===null||z.isXRRenderTarget===!0)&&(Et=R.toneMapping);let bt=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,$t=bt!==void 0?bt.length:0,Ie=ee.get(j),tn=S.state.lights;if(Ye===!0&&(He===!0||T!==k)){let St=T===k&&j.id===U;ze.setState(j,T,St)}let ct=!1;j.version===Ie.__version?(Ie.needsLights&&Ie.lightsStateVersion!==tn.state.version||Ie.outputColorSpace!==we||Q.isBatchedMesh&&Ie.batching===!1||!Q.isBatchedMesh&&Ie.batching===!0||Q.isBatchedMesh&&Ie.batchingColor===!0&&Q._colorsTexture===null||Q.isBatchedMesh&&Ie.batchingColor===!1&&Q._colorsTexture!==null||Q.isInstancedMesh&&Ie.instancing===!1||!Q.isInstancedMesh&&Ie.instancing===!0||Q.isSkinnedMesh&&Ie.skinning===!1||!Q.isSkinnedMesh&&Ie.skinning===!0||Q.isInstancedMesh&&Ie.instancingColor===!0&&Q.instanceColor===null||Q.isInstancedMesh&&Ie.instancingColor===!1&&Q.instanceColor!==null||Q.isInstancedMesh&&Ie.instancingMorph===!0&&Q.morphTexture===null||Q.isInstancedMesh&&Ie.instancingMorph===!1&&Q.morphTexture!==null||Ie.envMap!==Be||j.fog===!0&&Ie.fog!==Ae||Ie.numClippingPlanes!==void 0&&(Ie.numClippingPlanes!==ze.numPlanes||Ie.numIntersection!==ze.numIntersection)||Ie.vertexAlphas!==Qe||Ie.vertexTangents!==it||Ie.morphTargets!==De||Ie.morphNormals!==dt||Ie.morphColors!==Dt||Ie.toneMapping!==Et||Ie.morphTargetsCount!==$t||!!Ie.lightProbeGrid!=S.state.lightProbeGridArray.length>0)&&(ct=!0):(ct=!0,Ie.__version=j.version);let fn=Ie.currentProgram;ct===!0&&(fn=eo(j,W,Q),N&&j.isNodeMaterial&&N.onUpdateProgram(j,fn,Ie));let Un=!1,ci=!1,ji=!1,_t=fn.getUniforms(),Pt=Ie.uniforms;if(M.useProgram(fn.program)&&(Un=!0,ci=!0,ji=!0),j.id!==U&&(U=j.id,ci=!0),Ie.needsLights){let St=Pm(S.state.lightProbeGridArray,Q);Ie.lightProbeGrid!==St&&(Ie.lightProbeGrid=St,ci=!0)}if(Un||k!==T){M.buffers.depth.getReversed()&&T.reversedDepth!==!0&&(T._reversedDepth=!0,T.updateProjectionMatrix()),_t.setValue(P,"projectionMatrix",T.projectionMatrix),_t.setValue(P,"viewMatrix",T.matrixWorldInverse);let ui=_t.map.cameraPosition;ui!==void 0&&ui.setValue(P,Ne.setFromMatrixPosition(T.matrixWorld)),I.logarithmicDepthBuffer&&_t.setValue(P,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),(j.isMeshPhongMaterial||j.isMeshToonMaterial||j.isMeshLambertMaterial||j.isMeshBasicMaterial||j.isMeshStandardMaterial||j.isShaderMaterial)&&_t.setValue(P,"isOrthographic",T.isOrthographicCamera===!0),k!==T&&(k=T,ci=!0,ji=!0)}if(Ie.needsLights&&(tn.state.sunShadowMap.length>0&&_t.setValue(P,"sunShadowMap",tn.state.sunShadowMap,se),tn.state.directionalShadowMap.length>0&&_t.setValue(P,"directionalShadowMap",tn.state.directionalShadowMap,se),tn.state.spotShadowMap.length>0&&_t.setValue(P,"spotShadowMap",tn.state.spotShadowMap,se),tn.state.pointShadowMap.length>0&&_t.setValue(P,"pointShadowMap",tn.state.pointShadowMap,se)),Q.isSkinnedMesh){_t.setOptional(P,Q,"bindMatrix"),_t.setOptional(P,Q,"bindMatrixInverse");let St=Q.skeleton;St&&(St.boneTexture===null&&St.computeBoneTexture(),_t.setValue(P,"boneTexture",St.boneTexture,se))}Q.isBatchedMesh&&(_t.setOptional(P,Q,"batchingTexture"),_t.setValue(P,"batchingTexture",Q._matricesTexture,se),_t.setOptional(P,Q,"batchingIdTexture"),_t.setValue(P,"batchingIdTexture",Q._indirectTexture,se),_t.setOptional(P,Q,"batchingColorTexture"),Q._colorsTexture!==null&&_t.setValue(P,"batchingColorTexture",Q._colorsTexture,se));let hi=te.morphAttributes;if((hi.position!==void 0||hi.normal!==void 0||hi.color!==void 0)&&q.update(Q,te,fn),(ci||Ie.receiveShadow!==Q.receiveShadow)&&(Ie.receiveShadow=Q.receiveShadow,_t.setValue(P,"receiveShadow",Q.receiveShadow)),(j.isMeshStandardMaterial||j.isMeshLambertMaterial||j.isMeshPhongMaterial)&&j.envMap===null&&W.environment!==null&&(Pt.envMapIntensity.value=W.environmentIntensity),Pt.dfgLUT!==void 0&&(Pt.dfgLUT.value=by()),ci){if(_t.setValue(P,"toneMappingExposure",R.toneMappingExposure),Ie.needsLights&&Dm(Pt,ji),Ae&&j.fog===!0&&Oe.refreshFogUniforms(Pt,Ae),Oe.refreshMaterialUniforms(Pt,j,$,O,S.state.transmissionRenderTarget[T.id]),Ie.needsLights&&Ie.lightProbeGrid){let St=Ie.lightProbeGrid;Pt.probesSH.value=St.texture,Pt.probesMin.value.copy(St.boundingBox.min),Pt.probesMax.value.copy(St.boundingBox.max),Pt.probesResolution.value.copy(St.resolution)}Os.upload(P,mu(Ie),Pt,se)}if(j.isShaderMaterial&&j.uniformsNeedUpdate===!0&&(Os.upload(P,mu(Ie),Pt,se),j.uniformsNeedUpdate=!1),j.isSpriteMaterial&&_t.setValue(P,"center",Q.center),_t.setValue(P,"modelViewMatrix",Q.modelViewMatrix),_t.setValue(P,"normalMatrix",Q.normalMatrix),_t.setValue(P,"modelMatrix",Q.matrixWorld),j.uniformsGroups!==void 0){let St=j.uniformsGroups;for(let ui=0,Qi=St.length;ui0&&se.useMultisampledRTT(T)===!1?j=ee.get(T).__webglMultisampledFramebuffer:Array.isArray(Be)?j=Be[te]:j=Be,Y.copy(T.viewport),G.copy(T.scissor),J=T.scissorTest}else Y.copy(he).multiplyScalar($).floor(),G.copy(Ee).multiplyScalar($).floor(),J=Ze;if(te!==0&&(j=B),M.bindFramebuffer(P.FRAMEBUFFER,j)&&M.drawBuffers(T,j),M.viewport(Y),M.scissor(G),M.setScissorTest(J),Q){let we=ee.get(T.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+W,we.__webglTexture,te)}else if(Ae){let we=W;for(let Le=0;Le1&&P.readBuffer(P.COLOR_ATTACHMENT0+we);let De=_u(Be);if(De.__formatReadable===!1){$e("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(De.__typeReadable===!1){$e("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}W>=0&&W<=T.width-j&&te>=0&&te<=T.height-Q&&P.readPixels(W,te,j,Q,be.convert(Qe),be.convert(it),Ae)}finally{let Be=z!==null?ee.get(z).__webglFramebuffer:null;M.bindFramebuffer(P.FRAMEBUFFER,Be)}}},this.readRenderTargetPixelsAsync=async function(T,W,te,j,Q,Ae,Pe,we=0){if(!(T&&T.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Le=ee.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&Pe!==void 0&&(Le=Le[Pe]),Le)if(W>=0&&W<=T.width-j&&te>=0&&te<=T.height-Q){M.bindFramebuffer(P.FRAMEBUFFER,Le);let Be=T.textures[we],Qe=Be.format,it=Be.type;T.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+we);let De=_u(Be);if(De.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(De.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let dt=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,dt),P.bufferData(P.PIXEL_PACK_BUFFER,Ae.byteLength,P.STREAM_READ),P.readPixels(W,te,j,Q,be.convert(Qe),be.convert(it),0),P.bindBuffer(P.PIXEL_PACK_BUFFER,null);let Dt=z!==null?ee.get(z).__webglFramebuffer:null;M.bindFramebuffer(P.FRAMEBUFFER,Dt);let Et=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await Ud(P,Et,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,dt),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,Ae),P.bindBuffer(P.PIXEL_PACK_BUFFER,null),P.deleteBuffer(dt),P.deleteSync(Et),Ae}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(T,W=null,te=0){let j=Math.pow(2,-te),Q=Math.floor(T.image.width*j),Ae=Math.floor(T.image.height*j),Pe=W!==null?W.x:0,we=W!==null?W.y:0;se.setTexture2D(T,0),P.copyTexSubImage2D(P.TEXTURE_2D,te,0,0,Pe,we,Q,Ae),M.unbindTexture()},this.copyTextureToTexture=function(T,W,te=null,j=null,Q=0,Ae=0){let Pe,we,Le,Be,Qe,it,De,dt,Dt,Et=T.isCompressedTexture?T.mipmaps[Ae]:T.image;if(te!==null)Pe=te.max.x-te.min.x,we=te.max.y-te.min.y,Le=te.isBox3?te.max.z-te.min.z:1,Be=te.min.x,Qe=te.min.y,it=te.isBox3?te.min.z:0;else{let Pt=Math.pow(2,-Q);Pe=Math.floor(Et.width*Pt),we=Math.floor(Et.height*Pt),T.isDataArrayTexture?Le=Et.depth:T.isData3DTexture?Le=Math.floor(Et.depth*Pt):Le=1,Be=0,Qe=0,it=0}j!==null?(De=j.x,dt=j.y,Dt=j.z):(De=0,dt=0,Dt=0);let bt=be.convert(W.format),$t=be.convert(W.type),Ie;W.isData3DTexture?(se.setTexture3D(W,0),Ie=P.TEXTURE_3D):W.isDataArrayTexture||W.isCompressedArrayTexture?(se.setTexture2DArray(W,0),Ie=P.TEXTURE_2D_ARRAY):(se.setTexture2D(W,0),Ie=P.TEXTURE_2D),M.activeTexture(P.TEXTURE0),M.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,W.flipY),M.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),M.pixelStorei(P.UNPACK_ALIGNMENT,W.unpackAlignment);let tn=M.getParameter(P.UNPACK_ROW_LENGTH),ct=M.getParameter(P.UNPACK_IMAGE_HEIGHT),fn=M.getParameter(P.UNPACK_SKIP_PIXELS),Un=M.getParameter(P.UNPACK_SKIP_ROWS),ci=M.getParameter(P.UNPACK_SKIP_IMAGES);M.pixelStorei(P.UNPACK_ROW_LENGTH,Et.width),M.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Et.height),M.pixelStorei(P.UNPACK_SKIP_PIXELS,Be),M.pixelStorei(P.UNPACK_SKIP_ROWS,Qe),M.pixelStorei(P.UNPACK_SKIP_IMAGES,it);let ji=T.isDataArrayTexture||T.isData3DTexture,_t=W.isDataArrayTexture||W.isData3DTexture;if(T.isDepthTexture){let Pt=ee.get(T),hi=ee.get(W),St=ee.get(Pt.__renderTarget),ui=ee.get(hi.__renderTarget);M.bindFramebuffer(P.READ_FRAMEBUFFER,St.__webglFramebuffer),M.bindFramebuffer(P.DRAW_FRAMEBUFFER,ui.__webglFramebuffer);for(let Qi=0;Qi=c.length){s-=c.length;continue}let h=Math.min(o,c.length-s);if(a.push(c.substringData(s,h)),o-=h,s=0,!o)break}let l=new Uint8Array(Math.ceil((r+t)/3)*3);if(xh(l,0,a.join(""))i!==null&&typeof i=="object"&&!Array.isArray(i),Cn=i=>Array.isArray(i)&&i.every($i),Ai=i=>Array.isArray(i)&&i.length===3&&i.every(e=>typeof e=="number"),bf=i=>$i(i)&&Ai(i.min)&&Ai(i.max),xf=i=>i==null||$i(i)&&Cn(i.planes)&&i.planes.every(e=>Ai(e.normal)&&e.normal.every(Number.isFinite)&&e.normal.some(t=>t!==0)&&Number.isFinite(e.offset))&&(i.box==null||bf(i.box)&&i.box.max.every(Number.isFinite)&&i.box.min.every((e,t)=>Number.isFinite(e)&&e<=i.box.max[t]));function wy(i){if(!$i(i)||!Cn(i.elements)||!Cn(i.geometries)||!Cn(i.materials)||!$i(i.instances))throw new tt("META must describe elements, geometries, materials and instances.");if(i.title!=null&&typeof i.title!="string")throw new tt("Invalid META title.");let{instances:e}=i;if(!Number.isSafeInteger(e.count)||e.count<0)throw new tt("Invalid META instance count.");for(let[n,s,r]of[["geometry","u32",e.count],["material","u32",e.count],["element","i32",e.count],["matrix","f32",e.count*12]])if(e[n]?.t!==s||e[n].n!==r)throw new tt(`Invalid META instance ${n} view.`);for(let n of i.geometries){let s=n.q;if(!bf(n.bbox)||!["u16","u32"].includes(n.indices?.t)||n.positions?.t!==(s?"u16":"f32")||s&&(!Ai(s.o)||typeof s.s!="number")||n.normals!=null&&!["f32","i16"].includes(n.normals.t)||n.uvs!=null&&n.uvs.t!=="f32"||n.kind!=null&&n.kind!=="points"&&n.kind!=="lines"||n.colors!=null&&(n.kind!=="points"||n.colors.t!=="u8"||n.colors.n!==n.positions.n)||n.intensities!=null&&(n.kind!=="points"||n.intensities.t!=="u8"||3*n.intensities.n!==n.positions.n))throw new tt("Invalid META geometry.")}for(let n of["points","lines"])if(i[n]!=null){let s=i[n];if(!$i(s)||!Number.isSafeInteger(s.count)||s.count<0)throw new tt(`Invalid META ${n} count.`);for(let[r,o,a]of[["geometry","u32",s.count],["material","u32",s.count],["element","i32",s.count],["matrix","f32",s.count*12]])if(s[r]?.t!==o||s[r].n!==a)throw new tt(`Invalid META ${n} ${r} view.`)}if(i.annotations!=null&&!Cn(i.annotations))throw new tt("Invalid META annotations.");if(i.sheets!=null&&!Cn(i.sheets))throw new tt("Invalid META sheets.");if(i.panoramas!=null&&(!Cn(i.panoramas)||i.panoramas.some(n=>!Number.isInteger(n.element)||n.element<0||n.element>=i.elements.length||n.name!=null&&typeof n.name!="string"||!Ai(n.position)||!n.position.every(Number.isFinite)||!Number.isFinite(n.yaw)||!t(n.image)||n.intensity!=null&&!t(n.intensity))))throw new tt("Invalid META panorama.");function t(n){return n?.t==="u8"&&Number.isSafeInteger(n.n)&&n.n>=4&&n.n<=16*1024*1024}Ey(i);for(let n of i.materials){let s=n.texture;if(!Ai(n.color)||typeof n.opacity!="number"||s!=null&&(!Number.isInteger(s)||s<0||s>=(i.textures?.length??0)))throw new tt("Invalid META material.")}}function Ey(i){if(!$i(i)||!Cn(i.elements)||i.title!=null&&typeof i.title!="string")throw new tt("Invalid review metadata.");for(let l of["textures","grids","viewpoints","bcfTopics","clashTests","linkedFiles","models"])if(i[l]!=null&&!Cn(i[l]))throw new tt(`Invalid META ${l} list.`);if(i.models?.some(({id:l,name:c})=>!Number.isSafeInteger(l)||typeof c!="string")||i.elements.some(({modelId:l,levelId:c})=>l!=null&&!Number.isSafeInteger(l)||c!=null&&!Number.isSafeInteger(c)))throw new tt("Invalid META model or level identity.");let e=l=>l==null||Array.isArray(l)&&l.every(c=>Number.isInteger(c)&&c>=0&&cAi(l)&&l.every(Number.isFinite),n=l=>l==null||typeof l=="string",s=l=>t(l.camera?.position)&&t(l.camera?.target)&&xf(l.sections)&&e(l.hiddenElements)&&e(l.visibleElements)&&e(l.selectedElements)&&(l.hiddenElements==null||l.visibleElements==null)&&(l.hiddenModelKeys==null||Array.isArray(l.hiddenModelKeys)&&l.hiddenModelKeys.every(c=>typeof c=="string")),r=l=>Number.isSafeInteger(l)&&l>=0,o=l=>s(l)&&t(l.camera.up)&&l.camera.up.some(c=>c!==0)&&(l.camera.projection==="orthographic"?Number.isFinite(l.camera.orthographicHeight)&&l.camera.orthographicHeight>0:l.camera.projection==="perspective"&&Number.isFinite(l.camera.fov)&&l.camera.fov>0&&l.camera.fov<180)&&r(l.missingComponents)&&r(l.ambiguousComponents),a=l=>{let c=Fr(l);return Array.isArray(c)&&c.length>=2&&c.every(t)};if(i.grids?.some(l=>!a(l))||i.viewpoints?.some(l=>!s(l))||i.clashTests?.some(l=>!Cn(l.clashes)||l.clashes.some(c=>!Ai(c.point))))throw new tt("Invalid META grids, viewpoints or clashes.");if(i.bcfTopics?.some(l=>typeof l.title!="string"||!n(l.description)||!n(l.status)||!Cn(l.viewpoints)||l.viewpoints.some(c=>!o(c))))throw new tt("Invalid META BCF topics.");if(i.linkedFiles?.some(l=>!e(l.members)))throw new tt("Invalid META linked file members.");if(!xf(i.sections))throw new tt("Invalid META sections.")}function Ty(i){let e;try{e=JSON.parse(i)}catch(t){throw new tt(t.message,{cause:t})}return wy(e),e}function vh(i=document,e){e?.("metadataStart");let t;try{t=yf(i,"ioviewer-meta")}catch(s){throw s instanceof tt?s:new tt(s.message,{cause:s})}let n=Ty(t);return e?.("metadataEnd"),n}function vf(i,e){let t=My[i?.t];if(!t)throw new tt(`Unknown view type '${i?.t}'.`);let n=t.BYTES_PER_ELEMENT;if(!(Number.isSafeInteger(i.o)&&Number.isSafeInteger(i.n)&&i.o>=0&&i.n>=0&&i.o%n===0&&i.o+i.n*n<=e))throw new tt(`View ${JSON.stringify(i)} is outside the ${e} bytes of binary data.`);return t}function Mf(i=document,e,t=vh(i,e)){let n,s,r,o;try{if(e?.("binaryStart"),s=i.getElementById("ioviewer-bin"),!s)throw new Error("Data block 'ioviewer-bin' is missing.");({bytes:n,canonical:r}=_f(s)),e?.("binaryEnd")}catch(c){throw new tt(c.message,{cause:c})}let a=n.length,l=null;return{meta:t,view(c){if(!n)throw new Error("The binary data has been released.");let h=vf(c,a);return new h(n.buffer,c.o,c.n)},readView(c){let h=vf(c,a);if(!c.n)return new h(0);!n&&!r&&(o??(o=_f(s).bytes));let d=n??o;return d?new h(d.buffer,c.o,c.n):new h(Sy(s,c.o,c.n*h.BYTES_PER_ELEMENT))},releaseBinary(){n=null,o=null},props(c){return l??(l=JSON.parse(yf(i,"ioviewer-props"))),l[c]??null}}}var Sf=new Ke,wf=new Hn,yh=32;function bh(i,e=new Float64Array(24)){return Sf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),wf.setFromProjectionMatrix(Sf,i.coordinateSystem,i.reversedDepth),wf.planes.forEach(({normal:t,constant:n},s)=>e.set([t.x,t.y,t.z,n],s*4)),e}function Mh(i,e,t,n,s){for(let r=0;r<24;r+=4)if(i[r]*e+i[r+1]*t+i[r+2]*n+i[r+3]<-s)return!0;return!1}function Ef(i,e,t,n,s){for(let r=0;r<24;r+=4)if(i[r]*e+i[r+1]*t+i[r+2]*n+i[r+3]=0;r--)if(i[r]!==0){if(n+=i[r],n>t)return s?r===0?0:2**(r/2-4):2**((r+1)/2-4);s=!1}return 0}var In=.0009765625,wh=32767,Br=i=>i<0?-1:1;function Af(i){let e=Math.min(Math.max(i,-1),1)*wh;return Br(e)*Math.round(Math.abs(e))}function Or(i,e,t,n,s){let r=Math.abs(t)+Math.abs(n)+Math.abs(s);if(!(r>0)){i[e]=i[e+1]=0;return}let o=t/r,a=n/r;s<0&&([o,a]=[(1-Math.abs(a))*Br(o),(1-Math.abs(o))*Br(a)]),i[e]=Af(o),i[e+1]=Af(a)}function Rf(i,e,t,n){let s=Math.max(t/wh,-1),r=Math.max(n/wh,-1),o=1-Math.abs(s)-Math.abs(r);o<0&&([s,r]=[(1-Math.abs(r))*Br(s),(1-Math.abs(s))*Br(r)]);let a=Math.sqrt(s*s+r*r+o*o);i[e]=s/a,i[e+1]=r/a,i[e+2]=o/a}function zr(i,e){let t=i.view(e.positions);if(!e.q){if(!(t instanceof Float32Array))throw new Error(`Geometry positions of type '${e.positions.t}' need a "q" origin and step.`);return t}if(!(t instanceof Uint16Array))throw new Error(`Quantized geometry positions must be u16, got '${e.positions.t}'.`);return t}function Hs(i,e){let t=zr(i,e);if(!e.q)return t;let[n,s,r]=e.q.o,o=e.q.s,a=new Float32Array(t.length);for(let l=0;ls[d]&&(s[d]=u))}let r=0;for(let h=1;h<3;h++)s[h]-n[h]>s[r]-n[r]&&(r=h);let o=s[r]-n[r],a=2**20-1,l=new Float64Array(i.length);for(let h=0;h0&&Number.isFinite(u)?Math.round((u-n[r])/o*a):0;l[h]=f*2**32+d}let c=0;t<0?l.sort():c=Ry(l,t);for(let h=0;hr)return i.subarray(t,n+1).sort(),a+l*Math.ceil(Math.log2(l));a+=l,s=Math.imul(s,1664525)+1013904223>>>0;let c=i[t+s%(n-t+1)],h=t,d=n;for(;h<=d;){for(;i[h]c;)d--;if(h<=d){let u=i[h];i[h++]=i[d],i[d--]=u}}if(e<=d)n=d;else if(e>=h)t=h;else return a}return a}function Uf(i,e,t,n=1/0){let s=[];s.scanned=0;let r=[Uint32Array.from(e)];for(;r.length;){let o=r.pop(),a=Math.ceil(o.length/t);if(o.length<=1||a<=1&&Cy(o,i)<=n){o.length&&s.push(o);continue}let l=a>1?Math.ceil(o.length*Math.floor(a/2)/a):Math.ceil(o.length/2);s.scanned+=Nf(o,i,l),r.push(o.subarray(l),o.subarray(0,l))}return s}function Cy(i,e){let t=1/0,n=1/0,s=1/0,r=-1/0,o=-1/0,a=-1/0;for(let l of i){let c=e[l*3],h=e[l*3+1],d=e[l*3+2];cr&&(r=c),ho&&(o=h),da&&(a=d)}return Math.hypot(r-t,o-n,a-s)/2}function Ff(i,e){let t=new Float64Array(6).fill(-1/0),n=new Float64Array(6).fill(-1/0),s=new Int32Array(6);for(let o=0;ot[a]?(n[a]=t[a],t[a]=c,s[a]=o):c>n[a]&&(n[a]=c)}if(t[0]===-1/0)return 0;let r=Math.hypot(t[0]+t[3],t[1]+t[4],t[2]+t[5]);if(n[0]===-1/0)return r;for(let o of s){let a=c=>s[c]===o?n[c]:t[c],l=Math.hypot(a(0)+a(3),a(1)+a(4),a(2)+a(5));r=Math.min(r,2*l)}return r}var Th=384*2**20;function Bf(i,{cap:e=Th,minRepeats:t=16,perCell:n=1024,maxDraws:s=1024}={}){let r=new Uint8Array(i.length),o=0;for(let h of i)o+=h.k*h.bytes;if(o<=e)return r;let a=h=>(i[h].k-1)*i[h].bytes,l=[...i.keys()].filter(h=>i[h].k>=t);l.sort((h,d)=>a(d)-a(h)||i[d].k-i[h].k||h-d);let c=0;for(let h of l){let d=i[h].cells??Math.ceil(i[h].k/n);c+d>s||(r[h]=1,c+=d)}return r}function rl(i,e){return i>65535?new Uint32Array(e):new Uint16Array(e)}function Ah(i,e){return i.sort((t,n)=>e[n]-e[t]||t-n)}function Of(i,e,t,n){for(;e>>1;i[s]>=n?e=s+1:t=s}return e}function zf(i,e,t){let n=i[e];return[n,t>e?i[t]-n:0]}function kf(i,e,t,n){let s=i.subarray(e*12,e*12+12);if(s[0]===1&&s[1]===0&&s[2]===0&&s[3]===0&&s[4]===1&&s[5]===0&&s[6]===0&&s[7]===0&&s[8]===1&&t.q&&t.q.s===In){for(let a=0;a<3;a++)n[a]=s[9+a]+t.q.o[a];return Pf}let o=!0;for(let a=0;a<3;a++){let l=s[9+a],c=s[9+a];for(let h=0;h<3;h++){let d=s[h*3+a]*t.min[h],u=s[h*3+a]*t.max[h];l+=Math.min(d,u),c+=Math.max(d,u)}n[a]=Math.floor(l/In)*In,Math.ceil((c-n[a])/In)<=Lf||(o=!1)}return o||n.fill(0),o?Ay:Vs}function Hf(i,e){let t=i.length,n=0,s=0;for(let g of i){let p=e.source(e.geometryOf[g]);n+=p.vertices,s+=p.indices.length}let r=e.kind[i[0]]===Vs,o=r?new Float32Array(n*4):new Uint16Array(n*4),a=new Int16Array(n*2),l=e.textured?new Float32Array(n*2):null,c=rl(n,s),h=new Uint32Array(t+1),d=new Float32Array(t*3),u=new Float32Array(t),f=new Float64Array(3),m=0,_=0;for(let g=0;gMath.min(Math.max(Math.round(i/In),0),Lf);function Vf(i,e,t,n,s){let r=i.length/3,o=[1/0,1/0,1/0],a=[-1/0,-1/0,-1/0];for(let c=0;ca[h]&&(a[h]=d)}let l=t instanceof Int16Array?t:null;return{positions:i,q:e,oct:l,normals:l?null:t,indices:n,uvs:s,vertices:r,min:o,max:a}}function ol(i){if(!i.normals&&i.oct){i.normals=new Float32Array(i.vertices*3);for(let e=0;e= 0.0 ? - t : t, n.y >= 0.0 ? - t : t ); return n; -}`,kr=` +}`,Hr=` int slot = int( slotBase ) + int( q.w ); ivec2 st = ivec2( slot & 2047, slot >> 11 ); vec4 info = texelFetch( slotInfo, st, 0 ); vec4 state = texelFetch( slotState, st, 0 ); -vec3 slotPosition = info.xyz + q.xyz * info.w;`,Ah=` +vec3 slotPosition = info.xyz + q.xyz * info.w;`,Rh=` #ifndef IO_NO_HIDE_BRANCH if ( state.a < 0.5 ) gl_Position = vec4( 0.0, 0.0, 2.0, 1.0 ); -#endif`,yy=` +#endif`,Dy=` vec3 transformedNormal = objectNormal; #ifdef USE_INSTANCING mat3 im = mat3( instanceMatrix ); @@ -4248,11 +4248,11 @@ transformedNormal = mat3( cross( im[ 1 ], im[ 2 ] ), cross( im[ 2 ], im[ 0 ] ), transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; -#endif`;function Ri(i,t,e){let n=i.indexOf(t);if(n<0||i.indexOf(t,n+1)>=0)throw new Error(`The shader must contain '${t}' exactly once.`);return i.slice(0,n)+e+i.slice(n+t.length)}function My(i){Object.assign(i.uniforms,this.userData.slotUniforms);let t=Ri(i.vertexShader,"#include ",`#include -${zr}`);t=Ri(t,"#include ",`${kr} -vTint = state.rgb;`),t=Ri(t,"#include ","vec3 objectNormal = ioOct( normal.xy );"),t=Ri(t,"#include ",yy),t=Ri(t,"#include ","vec3 transformed = slotPosition;"),t=Ri(t,"#include ",`#include -${Ah}`),i.vertexShader=t;let e=Ri(i.fragmentShader,"#include ",`#include -varying vec3 vTint;`);e=Ri(e,"#include ","diffuseColor.rgb *= vTint;"),i.fragmentShader=e}function Rh(i,t,e=!1){return i.userData.slotUniforms=t,i.onBeforeCompile=My,i.index0AttributeName="q",e&&(i.defines={IO_NO_HIDE_BRANCH:""}),i}var Dh=["materials","textures","white","wireframe"],by=[245,158,11],Sy=[235,235,237],Hr=4294967295,Zi=2048,Ch=256,wy=16,Ih=1024,Ey=.1,Ty=8192,Ay=1.4,al=2**-20,ol=17;function Ry(i,t){let[e,n,s,r,o,a,l,c,h]=i.subarray(t*12,t*12+9);return e*(o*h-a*c)-r*(n*h-s*c)+l*(n*a-s*o)<0}function Cy(){this.array=null}function In(i,t,e=!1,n=xe){return new n(i,t,e).onUpload(Cy)}var Vr=class extends RangeError{constructor(t,e){super(`${t} drawable instances exceed the limit of ${e}.`),this.name="ModelTooLargeError",this.count=t,this.limit=e}},kf=(i,t)=>{for(let e=t*6;e=0?3:0)]+o*t[e+(o>=0?4:1)]+a*t[e+(a>=0?5:2)]+l<-(n+al*Math.abs(l)))return!0}return!1}function Ph(i,t,{min:e,max:n},s){let r=t*12,o=t*6;if(e[0]>n[0]||e[1]>n[1]||e[2]>n[2]){s.set(e,o),s.set(n,o+3);return}for(let a=0;a<3;a++){let l=i[r+a],c=i[r+a+3],h=i[r+a+6],d=i[r+a+9],u=l*e[0],f=l*n[0],m=c*e[1],_=c*n[1],g=h*e[2],p=h*n[2];s[o+a]=Math.min(u,f)+Math.min(m,_)+Math.min(g,p)+d,s[o+a+3]=Math.max(u,f)+Math.max(m,_)+Math.max(g,p)+d}}var Py=i=>{let t=i.getHex(me);return[t>>16&255,t>>8&255,t&255]},Gr=class{constructor(t,e={}){let{meta:n}=t,s=n.instances,r=s.count,o=t.view(s.geometry),a=t.view(s.material),l=t.view(s.matrix),c=n.points,h=c?.count??0,d=n.lines,u=d?.count??0,f=n.annotations??[],m=e.annotationLayouts??[],_=r+h+u+m.length;this.root=new Re,this.elementCount=n.elements.length,this.pointOffset=r,this.lineOffset=r+h,this.annotationOffset=r+h+u,this._annotations=f,this._annotationLayouts=m,this._annotationSheet=null,this._elements=n.elements,this._meta=n,this._mode="materials",this._opacity=1,this._picking=!1,this._pickBounds=!0,this._instanceDetail=!0,this._pickFrustum=null,this._textures=new Map,this._elementOf=new Int32Array(_),this._elementOf.set(t.view(s.element)),this._bucketOf=new Uint32Array(r),this._visible=new Uint8Array(_).fill(1),this._layers=new Map,this._layerHides=new Uint8Array(_),this._highlight=new Uint8Array(_),this._highlighted=[],this._tint=new Map,this._boxes=new Float32Array(this.annotationOffset*6),this._minPixels=0,this._viewHeight=1,this.visibleCost=0;let g=!!e.noHideBranch;if(this.slotUniforms={slotInfo:{value:null},slotState:{value:null}},this._buckets=this._createBuckets(n,a,g),h){this._elementOf.set(t.view(c.element),r),this._pointMaterials=t.view(c.material).slice();let y=t.view(c.geometry),w=t.view(c.matrix),M=this._boxes.subarray(r*6);for(let x=0;xthis.isInstanceVisible(e)?1:0)}instancesOf(t){return this._checkElement(t),this._elementInstances.subarray(this._elementStart[t],this._elementStart[t+1])}isVisible(t){this._checkElement(t);for(let e=this._elementStart[t];ethis._chunkCount){this._pickFrustum=yh(n,this._planes);let{x:r,y:o,z:a}=n.position;this._pickViewPadding=al*(Math.abs(r)+Math.abs(o)+Math.abs(a))}for(let r of this._units)r.mesh.material=t,s?(r.mesh.visible=(r.mesh.visible||!!r.lines?.visible)&&r.bucket.material.opacity>0,r.lines&&(r.lines.visible=!1)):this._showUnit(r);if(!s)for(let r of this._compactCells)this._cellAttributes(r,!1);try{return e()}finally{this._picking=!1,this._pickFrustum=null;for(let r of this._units)r.mesh.material=r.bucket.material,this._showUnit(r);for(let r of this._cut)r.mesh.visible=!1,r.lines&&(r.lines.visible=!1);if(!s)for(let r of this._compactCells)this._cellAttributes(r,!0)}}elementBox(t,e=new ae){this._checkElement(t),e.makeEmpty();for(let n=this._elementStart[t];n=0&&t<=1))throw new RangeError(`Opacity must be within 0..1, got ${t}.`);this._opacity=t;for(let e of this._buckets)this._applyOpacity(e);this._changed("appearance")}get opacity(){return this._opacity}setDetail(t,e=1){this._minPixels=t,this._viewHeight=e;for(let s of this._cut)this._showUnit(s);this._cut.length=0;for(let s of this._detailCells)s.detailCount=null;this._detailCells.length=0;for(let s of this._compactCells)this._cellAttributes(s,!1);this._compactCells.length=0;let n=this._unitScale;this._unitScale=null,!(!(t>0)||!n)&&(this._cutInView=0,this._cutFrame=null,this._units.forEach((s,r)=>{if(!(!(n[r]>=0)||s.shown===0)){if(s.dirty&&this._span(s),s.cell&&this._detailUsesInstances){if(s.detailHigh>=t&&this._detailCell(s,t))return}else if(this._slotRadius[s.slotBase+s.first]*n[r]>=t)return;s.mesh.visible=!1,s.lines&&(s.lines.visible=!1),this._cut.push(s),this._cutInView+=Lh(s,s.first,s.last+1)}}))}_detailCell(t,e){if(t.detailLow>=e)return t.detailCount=Math.min(t.detailEnd,t.last+1),this._detailCells.push(t),!0;let{slotBase:n,last:s}=t,r=this._detailIndices,o=0,a=!1,l=!1;for(let u=0;u<=s;u++){let f=this._pixels[n+u];f<0||(fc.count;for(let u=0;u0?o[6]/g:1/0:o[6];d[f]=p;let y=m.cell&&this._detailUsesInstances,w=y&&!bf(r,_[0],_[1],_[2],_[3]+m.pickPadding),M=m.slotBase+m.n,x=-1;if(y){let R=this._slotRadius[m.slotBase],L=this._slotRadius[M-1],N=g+_[3],B=Math.abs(o[3])*_[4]+Math.abs(o[4])*_[5]+Math.abs(o[5])*_[6],D=N-B-R,F=N+B-L,H=Math.fround(o[7]?D>0?R*o[6]/D:1/0:R*p),V=Math.fround(o[7]?F>0?L*o[6]/F:1/0:L*p);ks(V)===ks(H)&&(x=H)}if(x>=0&&!w){m.detailLow=m.detailHigh=x,m.detailEnd=m.n;let R=this._slotCost[m.slotBase]*m.shown;l[ks(x)]+=R,u+=R;continue}let S=0,A=1/0,v=-1,E=0;for(let R=m.slotBase;R=0){S++;continue}let U=(H-o[0])*o[3]+(V-o[1])*o[4]+(z-o[2])*o[5]-L;N=o[7]?U>0?o[6]/U:1/0:o[6]}let B=N===1/0?1/0:Math.fround(L*N);y&&(a[R]=B,A=Math.min(A,B),v=Math.max(v,B));let D=this._slotCost[R];l[ks(B)]+=D,u+=D}if(y){if(S){A=v=x;let R=S*this._slotCost[m.slotBase];l[ks(x)]+=R,u+=R}m.detailLow=A,m.detailHigh=v,m.detailEnd=E}}return this.visibleCost=u,Sf(l,u,n)}drawStats(){let t=-1/0;for(let r of this._units)t=Math.max(t,r.lastFrame);let e=0,n=this._cutFrame===t?this._cutInView:0,s=0;for(let r of this._units)r.lastFrame===t&&(n+=Lh(r,r.first,Math.max(r.last+1,r.first)),e+=Lh(r,r.first,Math.max(r.end,r.first)),s++);return{drawn:e,inView:n,draws:s}}drawnInstances(t){t.updateMatrixWorld();let e=new Hn().setFromProjectionMatrix(new Kt().multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse)),n={info:{render:{frame:-1}}},s=new Oe,r=[];for(let o of this._units){let a=this._mode==="wireframe"&&!this._picking?o.lines:o.mesh;if(!(!a?.visible||!e.intersectsSphere(s.set(s.center.fromArray(o.sphere),o.sphere[3])))){a.onBeforeRender(n,null,t,a.geometry,a.material,null);for(let l=o.first;lo-a)}memory(){let t=this._units[this._chunkCount]?.slotBase??this._slotInstance.length;return{gpuBytes:this._mergedBytes+this._instancedBytes+this._lineBytes+this._stateBytes+this._detailBytes,mergedBytes:this._mergedBytes,instancedBytes:this._instancedBytes,stateBytes:this._stateBytes,lineBytes:this._lineBytes,detailBytes:this._detailBytes,detailSourceBytes:(this._slotInstance.length-t)*48,chunks:this._chunkCount,cells:this._units.length-this._chunkCount,mergedInstances:t,instancedInstances:this._slotInstance.length-t,triangles:this._triangles}}setClipping(t,e){for(let n of this._buckets)for(let s of[n.material,n.wire])s.clippingPlanes=t.length>0?t:null,s.clipIntersection=e,s.needsUpdate=!0;this._changed("clipping")}_build(t,e,n,s,r){let o=e.length,a=this._meta,l=new Map,c=z=>{let U=l.get(z);if(!U){let k=a.geometries[z],Y=t.view(k.indices),G=k.uvs?t.view(k.uvs):null;U=zf(Or(t,k),k.q??null,Tf(t,k),Y,G),U.drawable=U.indices.length>=3&&U.min.every(Number.isFinite)&&U.max.every(Number.isFinite),l.set(z,U)}return U},h=new Uint8Array(o),d=new Float64Array(o*3),u=new Float32Array(o*3),f=new Uint32Array(o),m=new Float32Array(o),_=new Uint8Array(o),g=new Map,p=this._boxes;for(let z=0;zz-U).map(z=>{let U=g.get(z),k=c(e[U[0]]),Y=this._buckets[this._bucketOf[U[0]]].texture!==null,G=[0,1,2].every(it=>(k.max[it]-k.min[it])/Cn<=65535),J=k.vertices*((G?12:20)+(Y?8:0))+k.indices.length*(k.vertices>65535?4:2);return{k:U.length,bytes:J,members:U,textured:Y}}),M=s.mergedCap??Eh,x=s.minRepeats??wy;if(w.reduce((z,U)=>z+U.k*U.bytes,0)>M){let z=s.cellExtent==null?Df(p,f)*Ey:this.visibleBox().getSize(new C).length()*s.cellExtent;for(let U of w)U.k{if(S[U]){for(let k of z.leaves)E.push({shape:z,members:Th(k,m)});return}for(let k of z.members){v[e[k]]++;let Y=this._bucketOf[k]*2+(h[k]===Vs?1:0),G=A.get(Y);G||A.set(Y,G=[]),G.push(k)}});let R=[];for(let z of[...A.keys()].sort((U,k)=>U-k))for(let U of If(u,f,A.get(z),s.chunkVertices??Af))R.push(Th(U,m));let L=[...R,...E.map(z=>z.members)].reduce((z,U)=>z+U.length,0);if(L>r)throw new Vr(L,r);let N=Math.max(1,Math.ceil(L/Zi)),B=new Float32Array(Zi*N*4);this._state=new mn(new Uint8Array(Zi*N*4),Zi,N),this._state.colorSpace=me,this._state.onUpdate=()=>{this._fullPending=!1,this._pendingRanges=0},this._fullPending=!0,this._pendingRanges=0,this._dirty=new Uint32Array(Ch),this._dirtyCount=0;let D=new mn(B,Zi,N,je,Ye);D.needsUpdate=!0,D.onUpdate=()=>D.image.data=null,this.slotUniforms.slotInfo.value=D,this.slotUniforms.slotState.value=this._state,this._stateBytes=Zi*N*20,this._slotOf=new Uint32Array(this._visible.length).fill(Hr),this._slotInstance=new Uint32Array(L),this._slotUnit=new Uint32Array(L),this._slotRadius=new Float32Array(L),this._slotCost=new Float32Array(L),this._pixels=new Float32Array(L),this._planes=new Float64Array(24),this._detailView=new Float64Array(8),this._frameView=new Float64Array(8),this._frameViewAt=NaN,this._units=[],this._cut=[],this._detailCells=[],this._compactCells=[],this._detailIndices=new Uint16Array(Ih),this._detailBins=new Float64Array(vh),this._detailBytes=0,this._unitScale=null,this._cutInView=0,this._cutFrame=-1,this._mergedBytes=0,this._instancedBytes=0,this._lineBytes=0;let F={matrices:n,geometryOf:e,mirrored:_,kind:h,origins:d,source:c,textured:!1};this._lineSources=new Map;let H=0;for(let z of R){let U=this._buckets[this._bucketOf[z[0]]];F.textured=U.texture!==null;let k=Of(z,F);for(let Y=0;Yz+U,0);let V=new Map;for(let{shape:z,members:U}of E){let k=U[0],Y=c(e[k]),G=V.get(z);if(!G){let J=a.geometries[e[k]].bbox;G=this._shape(Y,_[k]===1,z.textured);let it=at=>Math.max(...at.map(Math.abs)),nt=Math.max(it(Y.min),it(Y.max));G.pickExtent=nt,G.pickPadding=Math.max(0,...Y.min.map((at,O)=>J.min[O]-at),...Y.max.map((at,O)=>at-J.max[O]))+(Y.q?al*(it(Y.q.o)+65535*Math.abs(Y.q.s)):0),V.set(z,G)}for(let J=0;Jz+U,0)}_shape(t,e,n){let s=t.vertices,r=t.q?new Uint16Array(s*4):new Float32Array(s*4);for(let h=0;hn+p),1,!1,oi);a.setAttribute("slotBase",l),a.setIndex(s.index);let c=Vf(this._boxes,e),h=new Oe(new C(c[0],c[1],c[2]),c[3]);a.boundingSphere=h;let d=new xi(a,t.material,0),u=new Float32Array(o*16),f=new Float32Array(o*12),m=0;for(let g=0;gthis._range(_,g,y,d),d.visible=!1,this.root.add(d),_}_chunk(t,e,n,s,r,o){let a=new Is;a.instanceCount=1,a.setAttribute("q",In(s.q,4)),a.setAttribute("normal",In(s.o,2,!0)),s.uv&&a.setAttribute("uv",In(s.uv,2)),a.setAttribute("slotBase",In(new Float32Array([n]),1,!1,oi)),a.setIndex(In(s.index,1));let l=Vf(this._boxes,e);a.boundingSphere=new Oe(new C(l[0],l[1],l[2]),l[3]),this._mergedBytes+=s.q.byteLength+s.o.byteLength+(s.uv?.byteLength??0)+s.index.byteLength;let c=new ge(a,t.material),h={bucket:t,mesh:c,lines:null,slotBase:n,n:e.length,sphere:l,shown:0,first:0,last:-1,end:0,dirty:!1,cell:!1,starts:s.indexStart,vertices:s.q.length/4,f32:s.q instanceof Float32Array,members:e.slice(),lastFrame:-1/0};return c.onBeforeRender=(d,u,f)=>this._range(h,d,f,c),c.visible=!1,this.root.add(c),h}_buildLines(){if(!this._lineSources)return;let{mirrored:t,geometryOf:e}=this._lineMembers;for(let n of this._units){if(n.cell){let h=n.mesh.geometry.index;n.lines=new xi(n.mesh.geometry,n.bucket.wire,0),n.lines.instanceMatrix=n.mesh.instanceMatrix,n.lines.boundingSphere=n.mesh.boundingSphere,n.lines.onBeforeRender=(d,u,f)=>this._range(n,d,f,n.lines),this._lineBytes+=h.count*2*h.array.BYTES_PER_ELEMENT,this.root.add(n.lines);continue}let s=n.starts[n.n],r=sl(n.vertices,s*2),o=0,a=0;for(let h of n.members){let d=this._lineSources.get(e[h]),u=t[h]===1;for(let f=0;fthis._range(n,h,u,n.lines),this.root.add(n.lines),n.members=null}this._lineSources=null,this._lineMembers=null}_range(t,e,n,s){t.dirty&&this._span(t);let r=t.last+1;if(this._picking){if(t.cell&&this._pickFrustum){let o=this._state.image.data,a=t.pickPadding+this._pickViewPadding;for(;r>0;){let l=t.slotBase+r-1;if(o[l*4+3]&&!Iy(this._pickFrustum,this._boxes,this._slotInstance[l]*6,a))break;r--}}}else if(t.cell&&t.detailCount!==null)r=t.detailCount;else if(this._minPixels>0&&r>t.first){let o=e.info.render.frame;o!==this._frameViewAt&&(bh(n,this._viewHeight,this._frameView),this._frameViewAt=o);let a=this._frameView,l=Hf(a,t.sphere),c=a[7]?l>0?this._minPixels*l/a[6]:0:this._minPixels/a[6];r=Math.min(r,Uf(this._slotRadius,t.slotBase+t.first,t.slotBase+r,c)-t.slotBase)}if(t.cell)s.count=Math.max(r,0);else{let o=s.isLineSegments?2:1,[a,l]=Ff(t.starts,t.first,r);s.geometry.setDrawRange(a*o,l*o)}this._picking||(t.end=r,t.lastFrame=e.info.render.frame,this._cutFrame===null&&this._minPixels>0&&(this._cutFrame=t.lastFrame))}_span(t){let e=this._state.image.data,n=0;for(;n=n&&e[(t.slotBase+s)*4+3]===0;)s--;t.first=n0&&!e,t.lines&&(t.lines.visible=t.shown>0&&e)}_createBuckets(t,e,n){let s=new Map,r=[];for(let o=0;oMath.round(h*255)),opacity:c.opacity,texture:c.texture??null,material:Rh(new Rs({side:ke}),this.slotUniforms,n),wire:Rh(new Rs({side:ke,wireframe:!0}),this.slotUniforms,n)},this._applyOpacity(l),s.set(a,l),r.push(l)}this._bucketOf[o]=l.index}return r}_indexElements(){let t=new Uint32Array(this.elementCount+1);for(let s of this._elementOf)s>=0&&t[s+1]++;for(let s=0;s{s>=0&&(e[n[s]++]=r)}),this._elementStart=t,this._elementInstances=e}_texture(t){let e=this._textures.get(t);if(!e){let n=this._meta.textures[t],s=new Image;e=new We(s),e.colorSpace=me,e.wrapS=e.wrapT=xs,e.repeat.set(1/n.sx,1/n.sy),s.onload=()=>{e.needsUpdate=!0,this._changed("appearance")},s.src=`data:${n.mime};base64,${n.data}`,this._textures.set(t,e)}return e}_applyOpacity(t){let e=t.opacity*this._opacity,n=e<1;for(let s of[t.material,t.wire])s.transparent!==n&&(s.needsUpdate=!0),s.opacity=e,s.transparent=n,s.depthWrite=!n}_colorOverride(t){return this._highlight[t]?by:this._tint.get(t)??(this._mode==="white"?Sy:null)}_colorOf(t){let e=this._colorOverride(t);if(e)return e;if(t>=this._bucketOf.length){let n=this._pointMaterials[t-this._bucketOf.length];return this._meta.materials[n].color.map(s=>Math.round(s*255))}return this._buckets[this._bucketOf[t]].bytes}_applyColor(t){let e=this._slotOf[t];e!==Hr&&(this._state.image.data.set(this._colorOf(t),e*4),this._markDirty(e))}_setInstanceVisible(t,e){this._visible[t]=e?1:0,this._draw(t)}_setLayerFlag(t,e,n){t[e]!==(n?1:0)&&(t[e]=n?1:0,this._layerHides[e]+=n?1:-1,this._draw(e))}_shown(t){return this._visible[t]===1&&this._layerHides[t]===0}_draw(t){let e=this._slotOf[t];if(e===Hr)return;let n=this._shown(t)?255:0,s=this._state.image.data;if(s[e*4+3]===n)return;s[e*4+3]=n,this._markDirty(e);let r=this._units[this._slotUnit[e]];r.shown+=n?1:-1,r.dirty=!0,this._showUnit(r)}_markDirty(t){this._dirtyCountCh)e.clearUpdateRanges(),this._fullPending=!0;else{for(let n=0;n=this.elementCount)throw new RangeError(`Element index ${t} is out of range 0..${this.elementCount-1}.`)}_expandBox(t,e){if(e>=this.annotationOffset){t.union(this._annotationLayouts[e-this.annotationOffset].box);return}if(!kf(this._boxes,e))return;let n=this._boxes,s=e*6;t.min.set(Math.min(t.min.x,n[s]),Math.min(t.min.y,n[s+1]),Math.min(t.min.z,n[s+2])),t.max.set(Math.max(t.max.x,n[s+3]),Math.max(t.max.y,n[s+4]),Math.max(t.max.z,n[s+5]))}_changed(t){this._flush(),this.root.dispatchEvent({type:"change",detail:{kind:t}})}};function Lh(i,t,e){return e<=t?0:i.cell?(e-t)*i.triangles:(i.starts[e]-i.starts[t])/3}function Hf(i,t){return(t[0]-i[0])*i[3]+(t[1]-i[1])*i[4]+(t[2]-i[2])*i[5]-t[3]}function Vf(i,t){let e=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(let a of t)for(let l=0;l<3;l++)e[l]=Math.min(e[l],i[a*6+l]),n[l]=Math.max(n[l],i[a*6+3+l]);let s=(n[0]-e[0])/2,r=(n[1]-e[1])/2,o=(n[2]-e[2])/2;return Float64Array.of((e[0]+n[0])/2,(e[1]+n[1])/2,(e[2]+n[2])/2,Math.hypot(s,r,o),s,r,o)}var ll=class{constructor(t){this.root=new Re,this._materials=[];let e=t.meta.points;if(this.count=e?.count??0,!this.count)return;let n=t.view(e.geometry),s=t.view(e.material),r=t.view(e.matrix);for(let o=0;o{y!==u&&(y.uniforms.pointIndex.value=o,y.uniforms.pointSize.value=u.opacity>0?u.size:0,y.uniformsNeedUpdate=!0)},f.matrixAutoUpdate=!1,f.matrix.fromArray(Ly(r,o)),f.matrixWorldNeedsUpdate=!0,f.frustumCulled=!0,c.computeBoundingSphere(),this.root.add(f),this._materials.push({material:u,color:u.color.clone(),opacity:h?.opacity??1,vertexColors:d})}}syncVisibility(t){let e=t.pointOffset??t.instanceCount-this.count;for(let[n,s]of this.root.children.entries())s.visible=t.isInstanceVisible(e+n)}syncAppearance(t){let e=t.pointOffset??t.instanceCount-this.count;for(let[n,s]of this._materials.entries()){let{material:r}=s,o=t.instanceColorOverride(e+n,r.color);o||r.color.copy(s.color);let a=s.vertexColors&&!o,l=t.opacity*s.opacity,c=l<1;(r.vertexColors!==a||r.transparent!==c)&&(r.needsUpdate=!0),r.vertexColors=a,r.opacity=l,r.transparent=c,r.depthWrite=!c}}setClipping(t,e=!1){this.clippingPlanes=t.length>0?t:null,this.clipIntersection=e;for(let{material:n}of this._materials)n.clippingPlanes=this.clippingPlanes,n.clipIntersection=e}withPickMaterial(t,e){t.clippingPlanes=this.clippingPlanes,t.clipIntersection=this.clipIntersection;for(let n of this.root.children)n.material=t;try{e()}finally{for(let[n,s]of this.root.children.entries())s.material=this._materials[n].material}}position(t,e,n){let s=this.root.children[t];return n.fromBufferAttribute(s.geometry.attributes.position,e).applyMatrix4(s.matrixWorld)}};function Ly(i,t){let e=t*12;return[i[e],i[e+1],i[e+2],0,i[e+3],i[e+4],i[e+5],0,i[e+6],i[e+7],i[e+8],0,i[e+9],i[e+10],i[e+11],1]}var Nh=2048,Dy=524288,Uh=[245,158,11],Fh=[235,235,237],Ny=` +#endif`;function Ri(i,e,t){let n=i.indexOf(e);if(n<0||i.indexOf(e,n+1)>=0)throw new Error(`The shader must contain '${e}' exactly once.`);return i.slice(0,n)+t+i.slice(n+e.length)}function Ny(i){Object.assign(i.uniforms,this.userData.slotUniforms);let e=Ri(i.vertexShader,"#include ",`#include +${kr}`);e=Ri(e,"#include ",`${Hr} +vTint = state.rgb;`),e=Ri(e,"#include ","vec3 objectNormal = ioOct( normal.xy );"),e=Ri(e,"#include ",Dy),e=Ri(e,"#include ","vec3 transformed = slotPosition;"),e=Ri(e,"#include ",`#include +${Rh}`),i.vertexShader=e;let t=Ri(i.fragmentShader,"#include ",`#include +varying vec3 vTint;`);t=Ri(t,"#include ","diffuseColor.rgb *= vTint;"),i.fragmentShader=t}function Ch(i,e,t=!1){return i.userData.slotUniforms=e,i.onBeforeCompile=Ny,i.index0AttributeName="q",t&&(i.defines={IO_NO_HIDE_BRANCH:""}),i}var Nh=["materials","textures","white","wireframe"],Uy=[245,158,11],Fy=[235,235,237],Vr=4294967295,Zi=2048,Ih=256,By=16,Ph=1024,Oy=.1,zy=8192,ky=1.4,ll=2**-20,al=17;function Hy(i,e){let[t,n,s,r,o,a,l,c,h]=i.subarray(e*12,e*12+9);return t*(o*h-a*c)-r*(n*h-s*c)+l*(n*a-s*o)<0}function Vy(){this.array=null}function Pn(i,e,t=!1,n=xt){return new n(i,e,t).onUpload(Vy)}var Gr=class extends RangeError{constructor(e,t){super(`${e} drawable instances exceed the limit of ${t}.`),this.name="ModelTooLargeError",this.count=e,this.limit=t}},Gf=(i,e)=>{for(let t=e*6;t=0?3:0)]+o*e[t+(o>=0?4:1)]+a*e[t+(a>=0?5:2)]+l<-(n+ll*Math.abs(l)))return!0}return!1}function Lh(i,e,{min:t,max:n},s){let r=e*12,o=e*6;if(t[0]>n[0]||t[1]>n[1]||t[2]>n[2]){s.set(t,o),s.set(n,o+3);return}for(let a=0;a<3;a++){let l=i[r+a],c=i[r+a+3],h=i[r+a+6],d=i[r+a+9],u=l*t[0],f=l*n[0],m=c*t[1],_=c*n[1],g=h*t[2],p=h*n[2];s[o+a]=Math.min(u,f)+Math.min(m,_)+Math.min(g,p)+d,s[o+a+3]=Math.max(u,f)+Math.max(m,_)+Math.max(g,p)+d}}var Wy=i=>{let e=i.getHex(mt);return[e>>16&255,e>>8&255,e&255]},Wr=class{constructor(e,t={}){let{meta:n}=e,s=n.instances,r=s.count,o=e.view(s.geometry),a=e.view(s.material),l=e.view(s.matrix),c=n.points,h=c?.count??0,d=n.lines,u=d?.count??0,f=n.annotations??[],m=t.annotationLayouts??[],_=r+h+u+m.length;this.root=new Rt,this.elementCount=n.elements.length,this.pointOffset=r,this.lineOffset=r+h,this.annotationOffset=r+h+u,this._annotations=f,this._annotationLayouts=m,this._annotationSheet=null,this._elements=n.elements,this._meta=n,this._mode="materials",this._opacity=1,this._picking=!1,this._pickBounds=!0,this._instanceDetail=!0,this._pickFrustum=null,this._textures=new Map,this._elementOf=new Int32Array(_),this._elementOf.set(e.view(s.element)),this._bucketOf=new Uint32Array(r),this._visible=new Uint8Array(_).fill(1),this._layers=new Map,this._layerHides=new Uint8Array(_),this._highlight=new Uint8Array(_),this._highlighted=[],this._tint=new Map,this._boxes=new Float32Array(this.annotationOffset*6),this._minPixels=0,this._viewHeight=1,this.visibleCost=0;let g=!!t.noHideBranch;if(this.slotUniforms={slotInfo:{value:null},slotState:{value:null}},this._buckets=this._createBuckets(n,a,g),h){this._elementOf.set(e.view(c.element),r),this._pointMaterials=e.view(c.material).slice();let y=e.view(c.geometry),w=e.view(c.matrix),b=this._boxes.subarray(r*6);for(let x=0;xthis.isInstanceVisible(t)?1:0)}instancesOf(e){return this._checkElement(e),this._elementInstances.subarray(this._elementStart[e],this._elementStart[e+1])}isVisible(e){this._checkElement(e);for(let t=this._elementStart[e];tthis._chunkCount){this._pickFrustum=bh(n,this._planes);let{x:r,y:o,z:a}=n.position;this._pickViewPadding=ll*(Math.abs(r)+Math.abs(o)+Math.abs(a))}for(let r of this._units)r.mesh.material=e,s?(r.mesh.visible=(r.mesh.visible||!!r.lines?.visible)&&r.bucket.material.opacity>0,r.lines&&(r.lines.visible=!1)):this._showUnit(r);if(!s)for(let r of this._compactCells)this._cellAttributes(r,!1);try{return t()}finally{this._picking=!1,this._pickFrustum=null;for(let r of this._units)r.mesh.material=r.bucket.material,this._showUnit(r);for(let r of this._cut)r.mesh.visible=!1,r.lines&&(r.lines.visible=!1);if(!s)for(let r of this._compactCells)this._cellAttributes(r,!0)}}elementBox(e,t=new at){this._checkElement(e),t.makeEmpty();for(let n=this._elementStart[e];n=0&&e<=1))throw new RangeError(`Opacity must be within 0..1, got ${e}.`);this._opacity=e;for(let t of this._buckets)this._applyOpacity(t);this._changed("appearance")}get opacity(){return this._opacity}setDetail(e,t=1){this._minPixels=e,this._viewHeight=t;for(let s of this._cut)this._showUnit(s);this._cut.length=0;for(let s of this._detailCells)s.detailCount=null;this._detailCells.length=0;for(let s of this._compactCells)this._cellAttributes(s,!1);this._compactCells.length=0;let n=this._unitScale;this._unitScale=null,!(!(e>0)||!n)&&(this._cutInView=0,this._cutFrame=null,this._units.forEach((s,r)=>{if(!(!(n[r]>=0)||s.shown===0)){if(s.dirty&&this._span(s),s.cell&&this._detailUsesInstances){if(s.detailHigh>=e&&this._detailCell(s,e))return}else if(this._slotRadius[s.slotBase+s.first]*n[r]>=e)return;s.mesh.visible=!1,s.lines&&(s.lines.visible=!1),this._cut.push(s),this._cutInView+=Dh(s,s.first,s.last+1)}}))}_detailCell(e,t){if(e.detailLow>=t)return e.detailCount=Math.min(e.detailEnd,e.last+1),this._detailCells.push(e),!0;let{slotBase:n,last:s}=e,r=this._detailIndices,o=0,a=!1,l=!1;for(let u=0;u<=s;u++){let f=this._pixels[n+u];f<0||(fc.count;for(let u=0;u0?o[6]/g:1/0:o[6];d[f]=p;let y=m.cell&&this._detailUsesInstances,w=y&&!Ef(r,_[0],_[1],_[2],_[3]+m.pickPadding),b=m.slotBase+m.n,x=-1;if(y){let R=this._slotRadius[m.slotBase],L=this._slotRadius[b-1],N=g+_[3],B=Math.abs(o[3])*_[4]+Math.abs(o[4])*_[5]+Math.abs(o[5])*_[6],D=N-B-R,F=N+B-L,H=Math.fround(o[7]?D>0?R*o[6]/D:1/0:R*p),V=Math.fround(o[7]?F>0?L*o[6]/F:1/0:L*p);ks(V)===ks(H)&&(x=H)}if(x>=0&&!w){m.detailLow=m.detailHigh=x,m.detailEnd=m.n;let R=this._slotCost[m.slotBase]*m.shown;l[ks(x)]+=R,u+=R;continue}let S=0,A=1/0,v=-1,E=0;for(let R=m.slotBase;R=0){S++;continue}let U=(H-o[0])*o[3]+(V-o[1])*o[4]+(z-o[2])*o[5]-L;N=o[7]?U>0?o[6]/U:1/0:o[6]}let B=N===1/0?1/0:Math.fround(L*N);y&&(a[R]=B,A=Math.min(A,B),v=Math.max(v,B));let D=this._slotCost[R];l[ks(B)]+=D,u+=D}if(y){if(S){A=v=x;let R=S*this._slotCost[m.slotBase];l[ks(x)]+=R,u+=R}m.detailLow=A,m.detailHigh=v,m.detailEnd=E}}return this.visibleCost=u,Tf(l,u,n)}drawStats(){let e=-1/0;for(let r of this._units)e=Math.max(e,r.lastFrame);let t=0,n=this._cutFrame===e?this._cutInView:0,s=0;for(let r of this._units)r.lastFrame===e&&(n+=Dh(r,r.first,Math.max(r.last+1,r.first)),t+=Dh(r,r.first,Math.max(r.end,r.first)),s++);return{drawn:t,inView:n,draws:s}}drawnInstances(e){e.updateMatrixWorld();let t=new Hn().setFromProjectionMatrix(new Ke().multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse)),n={info:{render:{frame:-1}}},s=new Ot,r=[];for(let o of this._units){let a=this._mode==="wireframe"&&!this._picking?o.lines:o.mesh;if(!(!a?.visible||!t.intersectsSphere(s.set(s.center.fromArray(o.sphere),o.sphere[3])))){a.onBeforeRender(n,null,e,a.geometry,a.material,null);for(let l=o.first;lo-a)}memory(){let e=this._units[this._chunkCount]?.slotBase??this._slotInstance.length;return{gpuBytes:this._mergedBytes+this._instancedBytes+this._lineBytes+this._stateBytes+this._detailBytes,mergedBytes:this._mergedBytes,instancedBytes:this._instancedBytes,stateBytes:this._stateBytes,lineBytes:this._lineBytes,detailBytes:this._detailBytes,detailSourceBytes:(this._slotInstance.length-e)*48,chunks:this._chunkCount,cells:this._units.length-this._chunkCount,mergedInstances:e,instancedInstances:this._slotInstance.length-e,triangles:this._triangles}}setClipping(e,t){for(let n of this._buckets)for(let s of[n.material,n.wire])s.clippingPlanes=e.length>0?e:null,s.clipIntersection=t,s.needsUpdate=!0;this._changed("clipping")}_build(e,t,n,s,r){let o=t.length,a=this._meta,l=new Map,c=z=>{let U=l.get(z);if(!U){let k=a.geometries[z],Y=e.view(k.indices),G=k.uvs?e.view(k.uvs):null;U=Vf(zr(e,k),k.q??null,Cf(e,k),Y,G),U.drawable=U.indices.length>=3&&U.min.every(Number.isFinite)&&U.max.every(Number.isFinite),l.set(z,U)}return U},h=new Uint8Array(o),d=new Float64Array(o*3),u=new Float32Array(o*3),f=new Uint32Array(o),m=new Float32Array(o),_=new Uint8Array(o),g=new Map,p=this._boxes;for(let z=0;zz-U).map(z=>{let U=g.get(z),k=c(t[U[0]]),Y=this._buckets[this._bucketOf[U[0]]].texture!==null,G=[0,1,2].every(ie=>(k.max[ie]-k.min[ie])/In<=65535),J=k.vertices*((G?12:20)+(Y?8:0))+k.indices.length*(k.vertices>65535?4:2);return{k:U.length,bytes:J,members:U,textured:Y}}),b=s.mergedCap??Th,x=s.minRepeats??By;if(w.reduce((z,U)=>z+U.k*U.bytes,0)>b){let z=s.cellExtent==null?Ff(p,f)*Oy:this.visibleBox().getSize(new C).length()*s.cellExtent;for(let U of w)U.k{if(S[U]){for(let k of z.leaves)E.push({shape:z,members:Ah(k,m)});return}for(let k of z.members){v[t[k]]++;let Y=this._bucketOf[k]*2+(h[k]===Vs?1:0),G=A.get(Y);G||A.set(Y,G=[]),G.push(k)}});let R=[];for(let z of[...A.keys()].sort((U,k)=>U-k))for(let U of Df(u,f,A.get(z),s.chunkVertices??If))R.push(Ah(U,m));let L=[...R,...E.map(z=>z.members)].reduce((z,U)=>z+U.length,0);if(L>r)throw new Gr(L,r);let N=Math.max(1,Math.ceil(L/Zi)),B=new Float32Array(Zi*N*4);this._state=new gn(new Uint8Array(Zi*N*4),Zi,N),this._state.colorSpace=mt,this._state.onUpdate=()=>{this._fullPending=!1,this._pendingRanges=0},this._fullPending=!0,this._pendingRanges=0,this._dirty=new Uint32Array(Ih),this._dirtyCount=0;let D=new gn(B,Zi,N,jt,Yt);D.needsUpdate=!0,D.onUpdate=()=>D.image.data=null,this.slotUniforms.slotInfo.value=D,this.slotUniforms.slotState.value=this._state,this._stateBytes=Zi*N*20,this._slotOf=new Uint32Array(this._visible.length).fill(Vr),this._slotInstance=new Uint32Array(L),this._slotUnit=new Uint32Array(L),this._slotRadius=new Float32Array(L),this._slotCost=new Float32Array(L),this._pixels=new Float32Array(L),this._planes=new Float64Array(24),this._detailView=new Float64Array(8),this._frameView=new Float64Array(8),this._frameViewAt=NaN,this._units=[],this._cut=[],this._detailCells=[],this._compactCells=[],this._detailIndices=new Uint16Array(Ph),this._detailBins=new Float64Array(yh),this._detailBytes=0,this._unitScale=null,this._cutInView=0,this._cutFrame=-1,this._mergedBytes=0,this._instancedBytes=0,this._lineBytes=0;let F={matrices:n,geometryOf:t,mirrored:_,kind:h,origins:d,source:c,textured:!1};this._lineSources=new Map;let H=0;for(let z of R){let U=this._buckets[this._bucketOf[z[0]]];F.textured=U.texture!==null;let k=Hf(z,F);for(let Y=0;Yz+U,0);let V=new Map;for(let{shape:z,members:U}of E){let k=U[0],Y=c(t[k]),G=V.get(z);if(!G){let J=a.geometries[t[k]].bbox;G=this._shape(Y,_[k]===1,z.textured);let ie=ae=>Math.max(...ae.map(Math.abs)),ne=Math.max(ie(Y.min),ie(Y.max));G.pickExtent=ne,G.pickPadding=Math.max(0,...Y.min.map((ae,O)=>J.min[O]-ae),...Y.max.map((ae,O)=>ae-J.max[O]))+(Y.q?ll*(ie(Y.q.o)+65535*Math.abs(Y.q.s)):0),V.set(z,G)}for(let J=0;Jz+U,0)}_shape(e,t,n){let s=e.vertices,r=e.q?new Uint16Array(s*4):new Float32Array(s*4);for(let h=0;hn+p),1,!1,oi);a.setAttribute("slotBase",l),a.setIndex(s.index);let c=Xf(this._boxes,t),h=new Ot(new C(c[0],c[1],c[2]),c[3]);a.boundingSphere=h;let d=new xi(a,e.material,0),u=new Float32Array(o*16),f=new Float32Array(o*12),m=0;for(let g=0;gthis._range(_,g,y,d),d.visible=!1,this.root.add(d),_}_chunk(e,t,n,s,r,o){let a=new Is;a.instanceCount=1,a.setAttribute("q",Pn(s.q,4)),a.setAttribute("normal",Pn(s.o,2,!0)),s.uv&&a.setAttribute("uv",Pn(s.uv,2)),a.setAttribute("slotBase",Pn(new Float32Array([n]),1,!1,oi)),a.setIndex(Pn(s.index,1));let l=Xf(this._boxes,t);a.boundingSphere=new Ot(new C(l[0],l[1],l[2]),l[3]),this._mergedBytes+=s.q.byteLength+s.o.byteLength+(s.uv?.byteLength??0)+s.index.byteLength;let c=new gt(a,e.material),h={bucket:e,mesh:c,lines:null,slotBase:n,n:t.length,sphere:l,shown:0,first:0,last:-1,end:0,dirty:!1,cell:!1,starts:s.indexStart,vertices:s.q.length/4,f32:s.q instanceof Float32Array,members:t.slice(),lastFrame:-1/0};return c.onBeforeRender=(d,u,f)=>this._range(h,d,f,c),c.visible=!1,this.root.add(c),h}_buildLines(){if(!this._lineSources)return;let{mirrored:e,geometryOf:t}=this._lineMembers;for(let n of this._units){if(n.cell){let h=n.mesh.geometry.index;n.lines=new xi(n.mesh.geometry,n.bucket.wire,0),n.lines.instanceMatrix=n.mesh.instanceMatrix,n.lines.boundingSphere=n.mesh.boundingSphere,n.lines.onBeforeRender=(d,u,f)=>this._range(n,d,f,n.lines),this._lineBytes+=h.count*2*h.array.BYTES_PER_ELEMENT,this.root.add(n.lines);continue}let s=n.starts[n.n],r=rl(n.vertices,s*2),o=0,a=0;for(let h of n.members){let d=this._lineSources.get(t[h]),u=e[h]===1;for(let f=0;fthis._range(n,h,u,n.lines),this.root.add(n.lines),n.members=null}this._lineSources=null,this._lineMembers=null}_range(e,t,n,s){e.dirty&&this._span(e);let r=e.last+1;if(this._picking){if(e.cell&&this._pickFrustum){let o=this._state.image.data,a=e.pickPadding+this._pickViewPadding;for(;r>0;){let l=e.slotBase+r-1;if(o[l*4+3]&&!Gy(this._pickFrustum,this._boxes,this._slotInstance[l]*6,a))break;r--}}}else if(e.cell&&e.detailCount!==null)r=e.detailCount;else if(this._minPixels>0&&r>e.first){let o=t.info.render.frame;o!==this._frameViewAt&&(Sh(n,this._viewHeight,this._frameView),this._frameViewAt=o);let a=this._frameView,l=Wf(a,e.sphere),c=a[7]?l>0?this._minPixels*l/a[6]:0:this._minPixels/a[6];r=Math.min(r,Of(this._slotRadius,e.slotBase+e.first,e.slotBase+r,c)-e.slotBase)}if(e.cell)s.count=Math.max(r,0);else{let o=s.isLineSegments?2:1,[a,l]=zf(e.starts,e.first,r);s.geometry.setDrawRange(a*o,l*o)}this._picking||(e.end=r,e.lastFrame=t.info.render.frame,this._cutFrame===null&&this._minPixels>0&&(this._cutFrame=e.lastFrame))}_span(e){let t=this._state.image.data,n=0;for(;n=n&&t[(e.slotBase+s)*4+3]===0;)s--;e.first=n0&&!t,e.lines&&(e.lines.visible=e.shown>0&&t)}_createBuckets(e,t,n){let s=new Map,r=[];for(let o=0;oMath.round(h*255)),opacity:c.opacity,texture:c.texture??null,material:Ch(new Rs({side:kt}),this.slotUniforms,n),wire:Ch(new Rs({side:kt,wireframe:!0}),this.slotUniforms,n)},this._applyOpacity(l),s.set(a,l),r.push(l)}this._bucketOf[o]=l.index}return r}_indexElements(){let e=new Uint32Array(this.elementCount+1);for(let s of this._elementOf)s>=0&&e[s+1]++;for(let s=0;s{s>=0&&(t[n[s]++]=r)}),this._elementStart=e,this._elementInstances=t}_texture(e){let t=this._textures.get(e);if(!t){let n=this._meta.textures[e],s=new Image;t=new Wt(s),t.colorSpace=mt,t.wrapS=t.wrapT=xs,t.repeat.set(1/n.sx,1/n.sy),s.onload=()=>{t.needsUpdate=!0,this._changed("appearance")},s.src=`data:${n.mime};base64,${n.data}`,this._textures.set(e,t)}return t}_applyOpacity(e){let t=e.opacity*this._opacity,n=t<1;for(let s of[e.material,e.wire])s.transparent!==n&&(s.needsUpdate=!0),s.opacity=t,s.transparent=n,s.depthWrite=!n}_colorOverride(e){return this._highlight[e]?Uy:this._tint.get(e)??(this._mode==="white"?Fy:null)}_colorOf(e){let t=this._colorOverride(e);if(t)return t;if(e>=this._bucketOf.length){let n=this._pointMaterials[e-this._bucketOf.length];return this._meta.materials[n].color.map(s=>Math.round(s*255))}return this._buckets[this._bucketOf[e]].bytes}_applyColor(e){let t=this._slotOf[e];t!==Vr&&(this._state.image.data.set(this._colorOf(e),t*4),this._markDirty(t))}_setInstanceVisible(e,t){this._visible[e]=t?1:0,this._draw(e)}_setLayerFlag(e,t,n){e[t]!==(n?1:0)&&(e[t]=n?1:0,this._layerHides[t]+=n?1:-1,this._draw(t))}_shown(e){return this._visible[e]===1&&this._layerHides[e]===0}_draw(e){let t=this._slotOf[e];if(t===Vr)return;let n=this._shown(e)?255:0,s=this._state.image.data;if(s[t*4+3]===n)return;s[t*4+3]=n,this._markDirty(t);let r=this._units[this._slotUnit[t]];r.shown+=n?1:-1,r.dirty=!0,this._showUnit(r)}_markDirty(e){this._dirtyCountIh)t.clearUpdateRanges(),this._fullPending=!0;else{for(let n=0;n=this.elementCount)throw new RangeError(`Element index ${e} is out of range 0..${this.elementCount-1}.`)}_expandBox(e,t){if(t>=this.annotationOffset){e.union(this._annotationLayouts[t-this.annotationOffset].box);return}if(!Gf(this._boxes,t))return;let n=this._boxes,s=t*6;e.min.set(Math.min(e.min.x,n[s]),Math.min(e.min.y,n[s+1]),Math.min(e.min.z,n[s+2])),e.max.set(Math.max(e.max.x,n[s+3]),Math.max(e.max.y,n[s+4]),Math.max(e.max.z,n[s+5]))}_changed(e){this._flush(),this.root.dispatchEvent({type:"change",detail:{kind:e}})}};function Dh(i,e,t){return t<=e?0:i.cell?(t-e)*i.triangles:(i.starts[t]-i.starts[e])/3}function Wf(i,e){return(e[0]-i[0])*i[3]+(e[1]-i[1])*i[4]+(e[2]-i[2])*i[5]-e[3]}function Xf(i,e){let t=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(let a of e)for(let l=0;l<3;l++)t[l]=Math.min(t[l],i[a*6+l]),n[l]=Math.max(n[l],i[a*6+3+l]);let s=(n[0]-t[0])/2,r=(n[1]-t[1])/2,o=(n[2]-t[2])/2;return Float64Array.of((t[0]+n[0])/2,(t[1]+n[1])/2,(t[2]+n[2])/2,Math.hypot(s,r,o),s,r,o)}var cl=class{constructor(e){this.root=new Rt,this._materials=[];let t=e.meta.points;if(this.count=t?.count??0,!this.count)return;let n=e.view(t.geometry),s=e.view(t.material),r=e.view(t.matrix);for(let o=0;o{y!==u&&(y.uniforms.pointIndex.value=o,y.uniforms.pointSize.value=u.opacity>0?u.size:0,y.uniformsNeedUpdate=!0)},f.matrixAutoUpdate=!1,f.matrix.fromArray(Xy(r,o)),f.matrixWorldNeedsUpdate=!0,f.frustumCulled=!0,c.computeBoundingSphere(),this.root.add(f),this._materials.push({material:u,color:u.color.clone(),opacity:h?.opacity??1,vertexColors:d})}}syncVisibility(e){let t=e.pointOffset??e.instanceCount-this.count;for(let[n,s]of this.root.children.entries())s.visible=e.isInstanceVisible(t+n)}syncAppearance(e){let t=e.pointOffset??e.instanceCount-this.count;for(let[n,s]of this._materials.entries()){let{material:r}=s,o=e.instanceColorOverride(t+n,r.color);o||r.color.copy(s.color);let a=s.vertexColors&&!o,l=e.opacity*s.opacity,c=l<1;(r.vertexColors!==a||r.transparent!==c)&&(r.needsUpdate=!0),r.vertexColors=a,r.opacity=l,r.transparent=c,r.depthWrite=!c}}setClipping(e,t=!1){this.clippingPlanes=e.length>0?e:null,this.clipIntersection=t;for(let{material:n}of this._materials)n.clippingPlanes=this.clippingPlanes,n.clipIntersection=t}withPickMaterial(e,t){e.clippingPlanes=this.clippingPlanes,e.clipIntersection=this.clipIntersection;for(let n of this.root.children)n.material=e;try{t()}finally{for(let[n,s]of this.root.children.entries())s.material=this._materials[n].material}}position(e,t,n){let s=this.root.children[e];return n.fromBufferAttribute(s.geometry.attributes.position,t).applyMatrix4(s.matrixWorld)}};function Xy(i,e){let t=e*12;return[i[t],i[t+1],i[t+2],0,i[t+3],i[t+4],i[t+5],0,i[t+6],i[t+7],i[t+8],0,i[t+9],i[t+10],i[t+11],1]}var Uh=2048,qy=524288,Fh=[245,158,11],Bh=[235,235,237],Yy=` #include attribute float lineSlot; uniform sampler2D lineState; @@ -4268,7 +4268,7 @@ void main() { #include #include if (state.a < 0.5) gl_Position = vec4(0.0, 0.0, 2.0, 1.0); -}`,Uy=` +}`,$y=` #include #include #include @@ -4286,7 +4286,7 @@ void main() { c = vec3(0.95, 0.96, 0.98); } gl_FragColor = vec4(c, opacity); -}`,cl=class{constructor(t){this.root=new Re;let e=t.meta.lines;if(this.count=e?.count??0,this.clippingPlanes=null,this.clipIntersection=!1,this._lightBg=!1,!this.count)return;let n=t.view(e.geometry),s=t.view(e.material),r=t.view(e.matrix),o=Math.ceil(this.count/Nh);this._stateData=new Uint8Array(Nh*o*4),this._state=new mn(this._stateData,Nh,o,je),this._state.colorSpace=me,this._state.minFilter=Le,this._state.magFilter=Le,this._state.generateMipmaps=!1,this._baseColors=new Array(this.count);for(let f=0;f{if(!a.has(f)){let m=t.meta.geometries[f];if(!m||m.kind!=="lines")throw new ee(`Line instance references a geometry (${f}) that is not lines.`);a.set(f,Hs(t,m)),l.set(f,t.view(m.indices))}return{positions:a.get(f),indices:l.get(f)}},h=[],d=[],u=()=>{if(h.length===0)return;let f=new he;f.setAttribute("position",new xe(new Float32Array(h),3)),f.setAttribute("lineSlot",new xe(new Float32Array(d),1)),f.computeBoundingSphere();let m=new ln(f,this._material);m.frustumCulled=!1,this.root.add(m),h=[],d=[]};for(let f=0;fDy&&d.length>0&&u();for(let D=0;D>16&255,this._stateData[l+1]=h>>8&255,this._stateData[l+2]=h&255}else if(n)this._stateData[l]=Fh[0],this._stateData[l+1]=Fh[1],this._stateData[l+2]=Fh[2];else{let h=this._baseColors[a];this._stateData[l]=h[0],this._stateData[l+1]=h[1],this._stateData[l+2]=h[2]}}this._state.needsUpdate=!0;let r=t._opacity??1;this._uniforms.opacity.value=r;let o=r<1;this._material.transparent!==o&&(this._material.transparent=o,this._material.needsUpdate=!0)}setClipping(t,e=!1){this.clippingPlanes=t.length>0?t:null,this.clipIntersection=e,this._material&&(this._material.clippingPlanes=this.clippingPlanes,this._material.clipIntersection=e)}withPickMaterial(t,e){t.clippingPlanes=this.clippingPlanes,t.clipIntersection=this.clipIntersection,t.uniforms?.lineState&&(t.uniforms.lineState.value=this._state);for(let n of this.root.children)n.material=t;try{e()}finally{for(let n of this.root.children)n.material=this._material}}};var Fy={ru:{elements:"\u042D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432",noGeometry:"\u041D\u0435\u0442 \u0433\u0435\u043E\u043C\u0435\u0442\u0440\u0438\u0438",contextLost:"\u0412\u0438\u0434\u0435\u043E\u043A\u0430\u0440\u0442\u0430 \u0441\u0431\u0440\u043E\u0448\u0435\u043D\u0430 \u2014 \u043F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443",noWebGL:"\u041D\u0443\u0436\u0435\u043D \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0441 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u043E\u0439 WebGL 2",badData:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u043C\u043E\u0434\u0435\u043B\u0438",tooLarge:"\u041C\u043E\u0434\u0435\u043B\u044C \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u0430\u044F \u0434\u043B\u044F \u044D\u0442\u043E\u0433\u043E \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0449\u0438\u043A\u0430: \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432 \u0441 \u0433\u0435\u043E\u043C\u0435\u0442\u0440\u0438\u0435\u0439 \u2014 {count}, \u043F\u0440\u0435\u0434\u0435\u043B \u2014 {limit}",selected:"\u0412\u044B\u0431\u0440\u0430\u043D\u043E",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C","scanMap.title":"\u041C\u0438\u043D\u0438\u043A\u0430\u0440\u0442\u0430","scanMap.plan":"\u041F\u043B\u0430\u043D \u043E\u0431\u043B\u0430\u043A\u0430 \u0442\u043E\u0447\u0435\u043A","scanMap.metres":"\u043C","scanMap.choosePhoto":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0444\u043E\u0442\u043E\u043F\u0430\u043D\u043E\u0440\u0430\u043C\u0443\u2026","scanMap.spheres":"\u0421\u0444\u0435\u0440\u044B \u043F\u0430\u043D\u043E\u0440\u0430\u043C \u0432 3D","scanMap.photo":"\u0424\u043E\u0442\u043E\u043F\u0430\u043D\u043E\u0440\u0430\u043C\u0430","scanMap.intensity":"\u0418\u043D\u0442\u0435\u043D\u0441\u0438\u0432\u043D\u043E\u0441\u0442\u044C","scanMap.goToStation":"\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u043A \u0441\u0442\u0430\u043D\u0446\u0438\u0438 {name}","scanMap.photoControls":"\u0424\u043E\u0442\u043E\u043F\u0430\u043D\u043E\u0440\u0430\u043C\u0430. \u0421\u0442\u0440\u0435\u043B\u043A\u0438 \u043F\u043E\u0432\u043E\u0440\u0430\u0447\u0438\u0432\u0430\u044E\u0442 \u043A\u0430\u043C\u0435\u0440\u0443, \u043A\u043E\u043B\u0435\u0441\u043E \u043C\u0435\u043D\u044F\u0435\u0442 \u043C\u0430\u0441\u0448\u0442\u0430\u0431.","scanMap.loading":"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0444\u043E\u0442\u043E\u0433\u0440\u0430\u0444\u0438\u0438\u2026","scanMap.photoError":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0441\u0444\u0435\u0440\u0438\u0447\u0435\u0441\u043A\u0443\u044E \u0444\u043E\u0442\u043E\u0433\u0440\u0430\u0444\u0438\u044E.","scanMap.enlargePhoto":"\u0423\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C","scanMap.shrinkPhoto":"\u0423\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C","scanMap.size":"\u0420\u0430\u0437\u043C\u0435\u0440 \u043C\u0438\u043D\u0438\u043A\u0430\u0440\u0442\u044B","scanMap.small":"\u041C\u0430\u043B\u0430\u044F","scanMap.medium":"\u0421\u0440\u0435\u0434\u043D\u044F\u044F","scanMap.large":"\u0411\u043E\u043B\u044C\u0448\u0430\u044F","scanMap.zoomIn":"\u041F\u0440\u0438\u0431\u043B\u0438\u0437\u0438\u0442\u044C \u043C\u0438\u043D\u0438\u043A\u0430\u0440\u0442\u0443","scanMap.zoomOut":"\u041E\u0442\u0434\u0430\u043B\u0438\u0442\u044C \u043C\u0438\u043D\u0438\u043A\u0430\u0440\u0442\u0443","scanMap.reset":"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0432\u0435\u0441\u044C \u043F\u043B\u0430\u043D","scanMap.levels":"\u0423\u0440\u043E\u0432\u043D\u0438 \u043C\u0438\u043D\u0438\u043A\u0430\u0440\u0442\u044B","scanMap.allLevels":"\u0412\u0441\u0435 \u0432\u044B\u0441\u043E\u0442\u044B","scanMap.level":"\u0423\u0440\u043E\u0432\u0435\u043D\u044C {n}","scanMap.addLevel":"\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0443\u0440\u043E\u0432\u0435\u043D\u044C \u043F\u043E \u043F\u0430\u043D\u043E\u0440\u0430\u043C\u0435","scanMap.removeLevel":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0439 \u0443\u0440\u043E\u0432\u0435\u043D\u044C","scanMap.autoButton":"\u0410\u0432\u0442\u043E","scanMap.autoLevels":"\u041E\u043F\u0440\u0435\u0434\u0435\u043B\u0438\u0442\u044C \u0443\u0440\u043E\u0432\u043D\u0438 \u043F\u043E \u0432\u044B\u0441\u043E\u0442\u0430\u043C \u0441\u0442\u0430\u043D\u0446\u0438\u0439","scanMap.noLevels":"\u041D\u0435\u0442 \u044F\u0432\u043D\u043E \u0440\u0430\u0437\u0434\u0435\u043B\u0451\u043D\u043D\u044B\u0445 \u0433\u0440\u0443\u043F\u043F \u0441\u0442\u0430\u043D\u0446\u0438\u0439 \u043F\u043E \u0432\u044B\u0441\u043E\u0442\u0435.","scanMap.levelsAdded":"\u0423\u0440\u043E\u0432\u043D\u0438 \u043F\u043E \u0432\u044B\u0441\u043E\u0442\u0430\u043C \u0441\u0442\u0430\u043D\u0446\u0438\u0439 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u044B.","scanMap.levelsExist":"\u042D\u0442\u0438 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D\u044B \u0443\u0436\u0435 \u043E\u0445\u0432\u0430\u0447\u0435\u043D\u044B \u0443\u0440\u043E\u0432\u043D\u044F\u043C\u0438.","scanMap.levelAdded":"\u0423\u0440\u043E\u0432\u0435\u043D\u044C \u0441\u043E\u0437\u0434\u0430\u043D.","scanMap.levelTemporary":"\u0423\u0440\u043E\u0432\u043D\u0438 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B \u0434\u043E \u0437\u0430\u043A\u0440\u044B\u0442\u0438\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B.","scanMap.cancel":"\u041E\u0442\u043C\u0435\u043D\u0430","scanMap.pickLower":"\u0429\u0451\u043B\u043A\u043D\u0438\u0442\u0435 \u043F\u043E \u043D\u0438\u0436\u043D\u0435\u0439 \u043E\u0442\u043C\u0435\u0442\u043A\u0435 \u0443\u0440\u043E\u0432\u043D\u044F.","scanMap.pickUpper":"\u041D\u0438\u0437 {z}. \u0422\u0435\u043F\u0435\u0440\u044C \u0449\u0451\u043B\u043A\u043D\u0438\u0442\u0435 \u043F\u043E \u0432\u0435\u0440\u0445\u043D\u0435\u0439 \u043E\u0442\u043C\u0435\u0442\u043A\u0435.","scanMap.noLowerHit":"\u041D\u0430 \u043B\u0443\u0447\u0435 \u043D\u0435\u0442 \u0442\u043E\u0447\u0435\u043A \u043E\u0431\u043B\u0430\u043A\u0430. \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0438\u0436\u043D\u044E\u044E \u043E\u0442\u043C\u0435\u0442\u043A\u0443 \u0440\u044F\u0434\u043E\u043C.","scanMap.noUpperHit":"\u041D\u0430 \u043B\u0443\u0447\u0435 \u043D\u0435\u0442 \u0442\u043E\u0447\u0435\u043A \u043E\u0431\u043B\u0430\u043A\u0430. \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0435\u0440\u0445\u043D\u044E\u044E \u043E\u0442\u043C\u0435\u0442\u043A\u0443 \u0440\u044F\u0434\u043E\u043C.","scanMap.upperAboveLower":"\u0412\u0435\u0440\u0445\u043D\u044F\u044F \u043E\u0442\u043C\u0435\u0442\u043A\u0430 \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u0432\u044B\u0448\u0435 {z}.",elementGroup:"\u042D\u043B\u0435\u043C\u0435\u043D\u0442",id:"Id",category:"\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F",type:"\u0422\u0438\u043F",level:"\u0423\u0440\u043E\u0432\u0435\u043D\u044C",sourceId:"ID \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u0430",link:"\u0421\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0439 \u0444\u0430\u0439\u043B",panels:"\u041F\u0430\u043D\u0435\u043B\u0438","panel.model":"\u041C\u043E\u0434\u0435\u043B\u044C","panel.elements":"\u0422\u0430\u0431\u043B\u0438\u0446\u0430 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432","csv.open":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C CSV \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432","csv.download":"\u0421\u043A\u0430\u0447\u0430\u0442\u044C CSV","csv.choose":"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 CSV, \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0432\u043C\u0435\u0441\u0442\u0435 \u0441 \u044D\u0442\u043E\u0439 \u043C\u043E\u0434\u0435\u043B\u044C\u044E.","csv.loading":"\u0427\u0442\u0435\u043D\u0438\u0435 CSV\u2026","csv.loaded":"{file} \xB7 \u0421\u0432\u044F\u0437\u0430\u043D\u043E \u0441 3D: {matched} \u0438\u0437 {total}","csv.noMatch":"{file} \xB7 \u041D\u0435\u0442 \u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u0439. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435, \u0447\u0442\u043E CSV \u043E\u0442\u043D\u043E\u0441\u0438\u0442\u0441\u044F \u043A \u044D\u0442\u043E\u0439 \u043C\u043E\u0434\u0435\u043B\u0438.","csv.conflicts":"\u0418\u0441\u043A\u043B\u044E\u0447\u0435\u043D\u043E \u0441\u0442\u0440\u043E\u043A \u0438\u0437-\u0437\u0430 \u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442\u0430 uniqueId: {count}. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435, \u0447\u0442\u043E \u0444\u0430\u0439\u043B\u044B \u043E\u0442\u043D\u043E\u0441\u044F\u0442\u0441\u044F \u043A \u043E\u0434\u043D\u043E\u0439 \u043C\u043E\u0434\u0435\u043B\u0438.","csv.invalid":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C CSV. \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0430\u0431\u043B\u0438\u0446\u0443 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 RvtIO \u0441 \u0443\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u043C elementId.","csv.noGeometry":"\u0423 \u044D\u0442\u043E\u0433\u043E \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430 \u043D\u0435\u0442 \u0433\u0435\u043E\u043C\u0435\u0442\u0440\u0438\u0438 \u0432 \u043C\u043E\u0434\u0435\u043B\u0438.","csv.search":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E ID \u0438 \u0438\u043C\u0435\u043D\u0438","csv.searchPlaceholder":"ID \u0438\u043B\u0438 \u0438\u043C\u044F","csv.allCategories":"\u0412\u0441\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438","csv.groupByCategory":"\u0413\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u043E \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F\u043C","csv.categoryTotals":"\u0418\u0442\u043E\u0433\u0438 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438","csv.totals":"\u0418\u0442\u043E\u0433\u0438 \u0432\u044B\u0431\u043E\u0440\u043A\u0438","csv.quantity.length_m":"\u0414\u043B\u0438\u043D\u0430","csv.quantity.area_m2":"\u041F\u043B\u043E\u0449\u0430\u0434\u044C","csv.quantity.volume_m3":"\u041E\u0431\u044A\u0451\u043C","csv.unit.length_m":"\u043C","csv.unit.area_m2":"\u043C\xB2","csv.unit.volume_m3":"\u043C\xB3","csv.outsideFilters":"\u0412\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0439 \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u0432\u043D\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u0430.","csv.noResults":"\u041F\u043E\u0434\u0445\u043E\u0434\u044F\u0449\u0438\u0445 \u0441\u0442\u0440\u043E\u043A \u043D\u0435\u0442.","csv.previous":"\u041D\u0430\u0437\u0430\u0434","csv.next":"\u0414\u0430\u043B\u0435\u0435","csv.range":"{first}\u2013{last} \u0438\u0437 {total}","panel.views":"\u0412\u0438\u0434\u044B","panel.sections":"\u0421\u0435\u0447\u0435\u043D\u0438\u044F","panel.clashes":"\u041A\u043E\u043B\u043B\u0438\u0437\u0438\u0438","panel.bcf":"\u0422\u0435\u043C\u044B BCF","bcf.noView":"\u041D\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E\u0433\u043E \u0432\u0438\u0434\u0430","bcf.viewpoint":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0432\u0438\u0434 {index}","bcf.components":"\u041D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u043E\u0432 \u2014 {missing}, \u043D\u0435\u043E\u0434\u043D\u043E\u0437\u043D\u0430\u0447\u043D\u044B\u0445 \u2014 {ambiguous}","panel.timeliner":"4D-\u0433\u0440\u0430\u0444\u0438\u043A","panel.links":"\u0421\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0435 \u0444\u0430\u0439\u043B\u044B","group.navigation":"\u041D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044F","group.sections":"\u0421\u0435\u0447\u0435\u043D\u0438\u044F","group.measure":"\u0418\u0437\u043C\u0435\u0440\u0435\u043D\u0438\u044F","group.display":"\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435","group.view":"\u0412\u0438\u0434","tool.orbit":"\u0412\u0440\u0430\u0449\u0435\u043D\u0438\u0435","tool.pan":"\u041F\u0430\u043D\u043E\u0440\u0430\u043C\u0430","tool.fit":"\u0412\u043F\u0438\u0441\u0430\u0442\u044C \u0432\u0441\u0451","tool.projection":"\u041F\u0435\u0440\u0441\u043F\u0435\u043A\u0442\u0438\u0432\u0430 / \u043E\u0440\u0442\u043E\u0433\u0440\u0430\u0444\u0438\u044F","tool.mode2d":"\u0420\u0435\u0436\u0438\u043C 2D / 3D","sheets.label":"\u041B\u0438\u0441\u0442\u044B \u0438 \u043F\u0440\u043E\u0441\u0442\u0440\u0430\u043D\u0441\u0442\u0432\u043E \u043C\u043E\u0434\u0435\u043B\u0438","tool.plane":"\u041F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u044C \u0441\u0435\u0447\u0435\u043D\u0438\u044F","tool.box":"\u0411\u043E\u043A\u0441 \u0441\u0435\u0447\u0435\u043D\u0438\u044F","tool.resetSections":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0441\u0435\u0447\u0435\u043D\u0438\u044F","tool.distance":"\u0420\u0430\u0441\u0441\u0442\u043E\u044F\u043D\u0438\u0435","tool.displayMode":"\u0420\u0435\u0436\u0438\u043C \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F","tool.grids":"\u041E\u0441\u0438","tool.opacity":"\u041F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u043E\u0441\u0442\u044C","tool.fullscreen":"\u041F\u043E\u043B\u043D\u044B\u0439 \u044D\u043A\u0440\u0430\u043D",contextMenu:"\u041A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u043D\u043E\u0435 \u043C\u0435\u043D\u044E","menu.properties":"\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u0430","menu.hide":"\u0421\u043A\u0440\u044B\u0442\u044C","menu.isolate":"\u0418\u0437\u043E\u043B\u0438\u0440\u043E\u0432\u0430\u0442\u044C","menu.showAll":"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0432\u0441\u0451","menu.zoomTo":"\u041F\u0440\u0438\u0431\u043B\u0438\u0437\u0438\u0442\u044C \u043A \u043E\u0431\u044A\u0435\u043A\u0442\u0443","menu.sectionBox":"\u0411\u043E\u043A\u0441 \u0441\u0435\u0447\u0435\u043D\u0438\u044F \u043F\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u0443","menu.copyId":"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C Id","menu.fitAll":"\u0412\u043F\u0438\u0441\u0430\u0442\u044C \u0432\u0441\u0451","menu.resetSections":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0441\u0435\u0447\u0435\u043D\u0438\u044F","menu.unavailable":"\u041D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u0434\u043B\u044F \u044D\u0442\u043E\u0439 \u043C\u043E\u0434\u0435\u043B\u0438",searchPlaceholder:"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0438\u043C\u0435\u043D\u0438, \u0442\u0438\u043F\u0443, Id\u2026",noCategory:"\u0411\u0435\u0437 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438",noMatches:"\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E","filters.title":"\u0424\u0438\u043B\u044C\u0442\u0440\u044B","filters.model":"\u041C\u043E\u0434\u0435\u043B\u044C-\u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A","filters.noLevel":"\u0411\u0435\u0437 \u0443\u0440\u043E\u0432\u043D\u044F","filters.all":"\u0412\u0441\u0435","filters.clear":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C","filters.isolate":"\u0418\u0437\u043E\u043B\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u044F",idCopied:"Id \u0441\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D",copyFailed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C Id",fullscreenUnavailable:"\u041F\u043E\u043B\u043D\u043E\u044D\u043A\u0440\u0430\u043D\u043D\u044B\u0439 \u0440\u0435\u0436\u0438\u043C \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D","face.front":"\u0421\u043F\u0435\u0440\u0435\u0434\u0438","face.back":"\u0421\u0437\u0430\u0434\u0438","face.left":"\u0421\u043B\u0435\u0432\u0430","face.right":"\u0421\u043F\u0440\u0430\u0432\u0430","face.top":"\u0421\u0432\u0435\u0440\u0445\u0443","face.bottom":"\u0421\u043D\u0438\u0437\u0443","cube.title":"\u041A\u0443\u0431 \u0432\u0438\u0434\u0430","cube.up":"\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u0432\u0435\u0440\u0445","cube.down":"\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u043D\u0438\u0437","cube.left":"\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u043B\u0435\u0432\u043E","cube.right":"\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u043F\u0440\u0430\u0432\u043E","cube.home":"\u0418\u0441\u0445\u043E\u0434\u043D\u044B\u0439 \u0432\u0438\u0434","sections.mode":"\u0420\u0435\u0436\u0438\u043C \u0441\u0435\u0447\u0435\u043D\u0438\u044F","sections.planes":"\u041F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u0438","sections.box":"\u0411\u043E\u043A\u0441","sections.off":"\u0412\u044B\u043A\u043B","sections.axis":"\u041E\u0441\u044C","sections.addPlane":"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u044C","sections.noPlanes":"\u041F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u0435\u0439 \u043D\u0435\u0442","sections.rotated":"\u043F\u043E\u0432\u0451\u0440\u043D\u0443\u0442\u0430","sections.custom":"\u041F\u0440\u043E\u0438\u0437\u0432\u043E\u043B\u044C\u043D\u0430\u044F","sections.position":"\u041F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u043F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u0438","sections.flip":"\u0421\u043C\u0435\u043D\u0438\u0442\u044C \u0441\u0442\u043E\u0440\u043E\u043D\u0443","sections.enabled":"\u0412\u043A\u043B","sections.delete":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u044C","sections.keepInside":"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0432\u043D\u0443\u0442\u0440\u0438","sections.cutInside":"\u0412\u044B\u0440\u0435\u0437\u0430\u0442\u044C \u0432\u043D\u0443\u0442\u0440\u0438","sections.fitSelection":"\u041F\u043E \u0432\u044B\u0434\u0435\u043B\u0435\u043D\u043D\u043E\u043C\u0443","sections.showGizmo":"\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u043C\u0430\u043D\u0438\u043F\u0443\u043B\u044F\u0442\u043E\u0440","sections.boxYaw":"\u041F\u043E\u0432\u043E\u0440\u043E\u0442 \u0432\u043E\u043A\u0440\u0443\u0433 Z","sections.fill":"\u0417\u0430\u043B\u0438\u0432\u043A\u0430 \u0441\u0440\u0435\u0437\u043E\u0432","sections.fillUnavailable":"\u0417\u0430\u043B\u0438\u0432\u043A\u0430 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0431\u0435\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u0442\u0440\u0430\u0444\u0430\u0440\u0435\u0442\u0430 WebGL","sections.fillNeedsMeshes":"\u0414\u043B\u044F \u0437\u0430\u043B\u0438\u0432\u043A\u0438 \u0441\u0435\u0447\u0435\u043D\u0438\u0439 \u043D\u0443\u0436\u043D\u0430 \u0437\u0430\u043C\u043A\u043D\u0443\u0442\u0430\u044F \u043F\u043E\u043B\u0438\u0433\u043E\u043D\u0430\u043B\u044C\u043D\u0430\u044F \u0433\u0435\u043E\u043C\u0435\u0442\u0440\u0438\u044F","sections.maxPlanes":"\u041D\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 6 \u043F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u0435\u0439","unit.m":"\u043C","display.materials":"\u041C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u044B","display.textures":"\u0422\u0435\u043A\u0441\u0442\u0443\u0440\u044B","display.white":"\u0411\u0435\u043B\u044B\u0439","display.wireframe":"\u041A\u0430\u0440\u043A\u0430\u0441","display.background":"\u0426\u0432\u0435\u0442 \u0444\u043E\u043D\u0430","display.backgroundReset":"\u0424\u043E\u043D \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E","display.bgCadDark":"CAD \u0442\u0451\u043C\u043D\u044B\u0439","display.bgPaper":"\u041B\u0438\u0441\u0442 \u0431\u0435\u043B\u044B\u0439","opacity.label":"\u041D\u0435\u043F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u043E\u0441\u0442\u044C","opacity.value":"{value} %","views.tour":"\u0422\u0443\u0440 \u043F\u043E \u0432\u0438\u0434\u0430\u043C","views.stop":"\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0442\u0443\u0440","clash.New":"\u041D\u043E\u0432\u0430\u044F","clash.Active":"\u0410\u043A\u0442\u0438\u0432\u043D\u0430\u044F","clash.Reviewed":"\u041F\u0440\u043E\u0432\u0435\u0440\u0435\u043D\u0430","clash.Approved":"\u0423\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0430","clash.Resolved":"\u0423\u0441\u0442\u0440\u0430\u043D\u0435\u043D\u0430","task.construct":"\u0421\u0442\u0440\u043E\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u043E","task.demolish":"\u0421\u043D\u043E\u0441","task.temporary":"\u0412\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0435","player.title":"4D-\u043F\u0440\u043E\u0438\u0433\u0440\u044B\u0432\u0430\u0442\u0435\u043B\u044C","player.play":"\u0412\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0441\u0442\u0438","player.pause":"\u041F\u0430\u0443\u0437\u0430","player.date":"\u0414\u0430\u0442\u0430 \u0433\u0440\u0430\u0444\u0438\u043A\u0430","player.speed":"\u0421\u043A\u043E\u0440\u043E\u0441\u0442\u044C",truncated:"\u041F\u043E\u043A\u0430\u0437\u0430\u043D\u043E {meshes} \u0438\u0437 {total} \u043C\u0435\u0448\u0435\u0439: \u043C\u043E\u0434\u0435\u043B\u044C \u043E\u0431\u0440\u0435\u0437\u0430\u043D\u0430 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u043E\u0439 MaxMeshVertices"},en:{elements:"Elements",noGeometry:"No geometry",contextLost:"The graphics context was lost \u2014 reload the page",noWebGL:"This page needs a browser with WebGL 2",badData:"The model data could not be read",tooLarge:"The model is too large for this viewer: {count} objects with geometry, the limit is {limit}",selected:"Selected",close:"Close","scanMap.title":"Minimap","scanMap.plan":"Point cloud floor plan","scanMap.metres":"m","scanMap.choosePhoto":"Open photo panorama\u2026","scanMap.spheres":"Panorama spheres in 3D","scanMap.photo":"Photo panorama","scanMap.intensity":"Intensity","scanMap.goToStation":"Move to station {name}","scanMap.photoControls":"Photo panorama. Arrow keys turn the camera, the wheel zooms.","scanMap.loading":"Loading photograph\u2026","scanMap.photoError":"Could not open the spherical photograph.","scanMap.enlargePhoto":"Enlarge","scanMap.shrinkPhoto":"Restore size","scanMap.size":"Minimap size","scanMap.small":"Small","scanMap.medium":"Medium","scanMap.large":"Large","scanMap.zoomIn":"Zoom in on minimap","scanMap.zoomOut":"Zoom out on minimap","scanMap.reset":"Fit the whole plan","scanMap.levels":"Minimap levels","scanMap.allLevels":"All heights","scanMap.level":"Level {n}","scanMap.addLevel":"Create level from panorama","scanMap.removeLevel":"Remove selected level","scanMap.autoButton":"Auto","scanMap.autoLevels":"Detect levels by station height","scanMap.noLevels":"Station heights have no clear groups.","scanMap.levelsAdded":"Levels added from station heights.","scanMap.levelsExist":"Existing levels already cover these height ranges.","scanMap.levelAdded":"Level created.","scanMap.levelTemporary":"Levels will stay available until you close this page.","scanMap.cancel":"Cancel","scanMap.pickLower":"Click the lower level elevation.","scanMap.pickUpper":"Lower elevation {z}. Now click the upper elevation.","scanMap.noLowerHit":"No scan points along that ray. Choose a nearby lower elevation.","scanMap.noUpperHit":"No scan points along that ray. Choose a nearby upper elevation.","scanMap.upperAboveLower":"The upper elevation must be above {z}.",elementGroup:"Element",id:"Id",category:"Category",type:"Type",level:"Level",sourceId:"Source ID",link:"Link",panels:"Panels","panel.model":"Model","panel.elements":"Element table","csv.open":"Open element CSV","csv.download":"Download CSV","csv.choose":"Choose the CSV exported with this model.","csv.loading":"Reading CSV\u2026","csv.loaded":"{file} \xB7 Linked to 3D: {matched} of {total}","csv.noMatch":"{file} \xB7 No matches. Check that the CSV belongs to this model.","csv.conflicts":"Rows excluded due to conflicting uniqueId values: {count}. Check that the files belong to the same model.","csv.invalid":"Could not read the CSV. Choose an RvtIO element table with unique elementId values.","csv.noGeometry":"This element has no geometry in the model.","csv.search":"Search by ID and name","csv.searchPlaceholder":"ID or name","csv.allCategories":"All categories","csv.groupByCategory":"Group by category","csv.categoryTotals":"Category totals","csv.totals":"Filtered totals","csv.quantity.length_m":"Length","csv.quantity.area_m2":"Area","csv.quantity.volume_m3":"Volume","csv.unit.length_m":"m","csv.unit.area_m2":"m\xB2","csv.unit.volume_m3":"m\xB3","csv.outsideFilters":"The selected element is outside the filter.","csv.noResults":"No matching rows.","csv.previous":"Previous","csv.next":"Next","csv.range":"{first}\u2013{last} of {total}","panel.views":"Views","panel.sections":"Sections","panel.clashes":"Clashes","panel.bcf":"BCF topics","bcf.noView":"No view available","bcf.viewpoint":"Open viewpoint {index}","bcf.components":"Components missing \u2014 {missing}, ambiguous \u2014 {ambiguous}","panel.timeliner":"4D schedule","panel.links":"Linked files","group.navigation":"Navigation","group.sections":"Sections","group.measure":"Measure","group.display":"Display","group.view":"View","tool.orbit":"Orbit","tool.pan":"Pan","tool.fit":"Fit all","tool.projection":"Perspective / orthographic","tool.mode2d":"2D / 3D mode","sheets.label":"Sheets and Model Space","tool.plane":"Section plane","tool.box":"Section box","tool.resetSections":"Reset sections","tool.distance":"Distance","tool.displayMode":"Display mode","tool.grids":"Grids","tool.opacity":"Transparency","tool.fullscreen":"Full screen",contextMenu:"Context menu","menu.properties":"Properties","menu.hide":"Hide","menu.isolate":"Isolate","menu.showAll":"Show all","menu.zoomTo":"Zoom to object","menu.sectionBox":"Section box around object","menu.copyId":"Copy Id","menu.fitAll":"Fit all","menu.resetSections":"Reset sections","menu.unavailable":"Unavailable for this model",searchPlaceholder:"Search by name, type, Id\u2026",noCategory:"No category",noMatches:"No matches","filters.title":"Filters","filters.model":"Source model","filters.noLevel":"No level","filters.all":"All","filters.clear":"Clear","filters.isolate":"Isolate matches",idCopied:"Id copied",copyFailed:"Could not copy Id",fullscreenUnavailable:"Fullscreen is not available","face.front":"Front","face.back":"Back","face.left":"Left","face.right":"Right","face.top":"Top","face.bottom":"Bottom","cube.title":"View cube","cube.up":"Rotate up","cube.down":"Rotate down","cube.left":"Rotate left","cube.right":"Rotate right","cube.home":"Home view","sections.mode":"Section mode","sections.planes":"Planes","sections.box":"Box","sections.off":"Off","sections.axis":"Axis","sections.addPlane":"Add plane","sections.noPlanes":"No planes","sections.rotated":"rotated","sections.custom":"Custom","sections.position":"Plane position","sections.flip":"Flip side","sections.enabled":"On","sections.delete":"Delete plane","sections.keepInside":"Show inside","sections.cutInside":"Cut inside","sections.fitSelection":"Fit to selection","sections.showGizmo":"Show gizmo","sections.boxYaw":"Rotation around Z","sections.fill":"Fill cut faces","sections.fillUnavailable":"Section fill requires a WebGL stencil buffer","sections.fillNeedsMeshes":"Section fill requires closed mesh geometry","sections.maxPlanes":"At most 6 planes","unit.m":"m","display.materials":"Materials","display.textures":"Textures","display.white":"White","display.wireframe":"Wireframe","display.background":"Background color","display.backgroundReset":"Reset background","display.bgCadDark":"CAD dark","display.bgPaper":"Paper white","opacity.label":"Opacity","opacity.value":"{value}%","views.tour":"Play tour","views.stop":"Stop tour","clash.New":"New","clash.Active":"Active","clash.Reviewed":"Reviewed","clash.Approved":"Approved","clash.Resolved":"Resolved","task.construct":"Construct","task.demolish":"Demolish","task.temporary":"Temporary","player.title":"4D player","player.play":"Play","player.pause":"Pause","player.date":"Schedule date","player.speed":"Speed",truncated:"Showing {meshes} of {total} meshes: the model was truncated by the MaxMeshVertices setting"}},Pn=(globalThis.navigator?.language??"").toLowerCase().startsWith("ru")?"ru":"en",Ci=new Intl.NumberFormat(Pn).format;function q(i,t=Pn){let e=Fy[t][i];if(e===void 0)throw new Error(`Missing UI string '${i}'.`);return e}var Gf=new C(0,0,1),hl=Math.PI/2-.01;function Xf(i,t,e=4){return Math.hypot(t.x-i.x,t.y-i.y)<=e}function qf(i,t,e,n,s,r){let o=i.clone().sub(e),a=t.clone().sub(e),l=d=>(o.applyQuaternion(d),a.applyQuaternion(d));l(new Fe().setFromAxisAngle(Gf,-n*r));let c=a.clone().sub(o).normalize(),h=c.clone().cross(Gf);if(h.lengthSq()>1e-12){let d=Math.asin(le.clamp(c.z,-1,1)),u=le.clamp(s*r,d-hl,d+hl);l(new Fe().setFromAxisAngle(h.normalize(),-u))}return{position:o.add(e),target:a.add(e)}}function Yf(i,t,e,n){let s=r=>r.clone().sub(e).multiplyScalar(n).add(e);return{position:s(i),target:s(t)}}var By=.85,Oy=100/3;function $f(i,t,e){let n=i*(t===1?Oy:t===2?e:1);return le.clamp(By**(-n/100),.5,2)}var Bh=(i,t)=>t>=i?"window":"crossing";function Zf(i,t,e){let n=Wf(i.position,i.target),s=Wf(t.position,t.target),r=n.azimuth??s.azimuth??0,o=s.azimuth??r,a=le.euclideanModulo(o-r+Math.PI,2*Math.PI)-Math.PI,l=(_,g)=>_+(g-_)*e,c=r+a*e,h=le.clamp(l(n.elevation,s.elevation),-hl,hl),d=l(n.distance,s.distance),u=i.target.clone().lerp(t.target,e),f=Math.cos(h)*d;return{position:u.clone().add(new C(f*Math.cos(c),f*Math.sin(c),Math.sin(h)*d)),target:u}}function Kf(i,t,e,n){let s=i.position.clone().sub(i.target),r=t.position.clone().sub(t.target),o=s.length(),a=r.length();s.normalize(),r.normalize();let l=new Fe().setFromUnitVectors(s,r),c=e.clone().applyQuaternion(l),h=new C().setFromMatrixColumn(new Kt().lookAt(t.position,t.target,n),1),d=r.dot(new C().crossVectors(c,h)),u=Math.atan2(Math.abs(d)<1e-9?0:d,c.dot(h)),f=new Fe;return m=>{f.identity().slerp(l,m);let _=s.clone().applyQuaternion(f),g=i.target.clone().lerp(t.target,m),p=_.clone().multiplyScalar(le.lerp(o,a,m)).add(g),y=e.clone().applyQuaternion(f).applyAxisAngle(_,u*m);return{position:p,target:g,up:y}}}function Wf(i,t){let e=i.clone().sub(t),n=e.length(),s=Math.hypot(e.x,e.y);return{distance:n,elevation:n>1e-12?Math.asin(le.clamp(e.z/n,-1,1)):0,azimuth:s>1e-9*Math.max(n,1e-12)?Math.atan2(e.y,e.x):null}}var zy=.005,Jf=new C(1,-1,.8).normalize(),Oh=.01,jf=1e-6,ky=64,Qf=1.05,Hy=5e3,ul=(i,t)=>new CustomEvent(i,{detail:t});function tp({bbox:i,grids:t}){let e=r=>Array.isArray(r)&&r.length===3&&r.every(Number.isFinite);if(!e(i?.min)||!e(i?.max))return!0;let n=new ae(new C(...i.min),new C(...i.max));if(n.isEmpty())return!0;let s=new C;for(let r of t??[])for(let o of Ur(r)){if(!e(o))return!0;n.expandByPoint(s.fromArray(o))}return n.getSize(s).length()*Qf>Oh*Hy}var dl=class extends EventTarget{constructor(t,e,{pick:n=()=>null,visibleBox:s=()=>new ae}={}){super(),this.dom=e,this.pick=n,this.visibleBox=s,this.target=new C,this.leftButtonMode="orbit",this.is2D=!1,this._saved3D=null,this._perspective=t,this._defaultFov=t.fov,this._orthographic=new Xn(-1,1,1,-1),this.camera=t,this._drag=null,this._wheelPick=null,this._animation=0,this._overlay=null,this._bounds=null,this._extraBounds=new Map,e.style.touchAction="none",e.addEventListener("pointerdown",r=>this._down(r)),e.addEventListener("pointermove",r=>this._move(r)),e.addEventListener("pointerup",r=>this._up(r)),e.addEventListener("pointercancel",()=>this._end()),e.addEventListener("lostpointercapture",r=>this._lostCapture(r)),window.addEventListener("blur",()=>this._end()),e.addEventListener("wheel",r=>this._wheel(r),{passive:!1}),e.addEventListener("contextmenu",r=>r.preventDefault())}setLeftButtonMode(t){if(t!=="orbit"&&t!=="pan")throw new RangeError(`Unknown left button mode: ${t}`);this.leftButtonMode=t}setProjection(t){if(t!=="perspective"&&t!=="orthographic")throw new RangeError(`Unknown projection: ${t}`);let e=t==="perspective"?this._perspective:this._orthographic,n=this.camera;if(e!==n){this._stopAnimation(),e.position.copy(n.position),n.isOrthographicCamera&&e.position.sub(this.target).divideScalar(n.zoom).add(this.target),e.zoom=1,e.quaternion.copy(n.quaternion),e.up.copy(n.up),n.parent?.add(e),n.parent?.remove(n);for(let s of[...n.children])e.add(s);this.camera=e,this.resize()}}resize(){let t=this.camera,e=this.dom.clientWidth/Math.max(this.dom.clientHeight,1),n=Math.max(t.position.distanceTo(this.target),1e-6);if(t.isPerspectiveCamera)t.aspect=e;else{let r=n*Math.tan(le.degToRad(this._perspective.fov/2));Object.assign(t,{top:r,bottom:-r,left:-r*e,right:r*e})}let s=this._rangeSphere();if(s){let r=s.center.clone().sub(t.position),o=new C(0,0,-1).applyQuaternion(t.quaternion);t.far=Math.max(1e-6,(r.length()+s.radius)*Qf);let a=r.dot(o)-s.radius;t.near=Math.max(a*.95,Math.min(Oh,t.far/2))}t.updateProjectionMatrix(),this.dispatchEvent(new Event("change"))}setExtraBounds(t,e){e&&!e.isEmpty()?this._extraBounds.set(t,e.clone()):this._extraBounds.delete(t),this.resize()}_rangeSphere(){let t=this._visibleBounds()?.sphere??null;if(this._extraBounds.size===0)return t;let e=t?this._bounds.box.clone():new ae;for(let n of this._extraBounds.values())e.union(n);return e.getBoundingSphere(new Oe)}invalidateBounds(){this._bounds=null}_visibleBounds(){if(!this._bounds){let t=this.visibleBox();this._bounds={box:t,sphere:t.isEmpty()?null:t.getBoundingSphere(new Oe)}}return this._bounds.sphere&&this._bounds}fitBox(t,e=!0){if(t.isEmpty())return;let n=t.getBoundingSphere(new Oe);if(this.is2D){this.setProjection("orthographic"),this.camera.up.set(0,1,0);let h=t.getSize(new C),d=Math.max(h.x,h.y,n.radius*2,.01),u=t.getCenter(new C),f=new C(u.x,u.y,t.max.z+d*2);this._set(f,u);let m=Math.max(this.dom.clientWidth/Math.max(this.dom.clientHeight,1),.001),_=Math.max(this.camera.top,1e-6),g=Math.max(h.y/2,h.x/(2*m),1e-4)*1.06;this.camera.zoom=_/g,this.resize();return}let s=Math.max(n.radius,.001),r=le.degToRad(this._perspective.fov/2),o=this.dom.clientWidth/Math.max(this.dom.clientHeight,1),a=s/Math.sin(Math.min(r,Math.atan(Math.tan(r)*o))),l=this.camera.position.clone().sub(this.target);l.lengthSq()<1e-12&&l.copy(Jf);let c=l.normalize().multiplyScalar(a).add(n.center);e?this.animateTo({position:c,target:n.center}):(this.camera.zoom=1,this._set(c,n.center))}set2DMode(t,e=null,n=!1){let s=!!t;if(s===this.is2D){s&&e&&!e.isEmpty()&&this.fitBox(e,n);return}if(this._stopAnimation(),s){this._saved3D={projection:this.camera.isOrthographicCamera?"orthographic":"perspective",position:this.camera.position.clone(),target:this.target.clone(),zoom:this.camera.zoom,leftButtonMode:this.leftButtonMode},this.is2D=!0,this.setProjection("orthographic"),this.leftButtonMode="pan";let r=e&&!e.isEmpty()?e:this.visibleBox();this.fitBox(r,!1)}else{this.is2D=!1,this.camera.up.set(0,0,1);let r=this._saved3D;if(this._saved3D=null,r)this.setProjection(r.projection),this.leftButtonMode=r.leftButtonMode,this.camera.zoom=r.zoom,this._set(r.position,r.target);else{this.setProjection("perspective"),this.leftButtonMode="orbit";let o=e&&!e.isEmpty()?e:this.visibleBox();if(!o.isEmpty()){let a=o.getCenter(new C),l=Math.max(o.getBoundingSphere(new Oe).radius,1);this._set(a.clone().addScaledVector(Jf,l*2.5),a),this.fitBox(o,!1)}}}this.dispatchEvent(ul("mode2d",{enabled:this.is2D}))}zoomToBox(t){this.fitBox(t,!0)}resetCameraStyle(){this._perspective.fov=this._defaultFov,this.camera.up.set(0,0,1)}restoreViewCamera({position:t,target:e,up:n,fov:s,orthographicHeight:r}){let o=new C(...t),a=new C(...e);if(this.resetCameraStyle(),!n){this.animateTo({position:o,target:a});return}this._stopAnimation(),this.camera.up.fromArray(n),this._perspective.fov=s??this._defaultFov;let l=Math.max(o.distanceTo(a),1e-6);this.camera.zoom=r==null?1:2*l*Math.tan(le.degToRad(this._perspective.fov/2))/r,this._set(o,a)}animateTo({position:t,target:e,zoom:n=1,overPole:s=!1},r=400){this._stopAnimation();let o={position:this.camera.position.clone(),target:this.target.clone()},a={position:t??o.position,target:e??o.target},l=this.camera.zoom,c=s?Kf(o,a,new C(0,1,0).applyQuaternion(this.camera.quaternion),this.camera.up):u=>Zf(o,a,u),h=performance.now(),d=u=>{let f=Math.min((u-h)/r,1),m=f*f*(3-2*f),_=c(m);this.camera.isOrthographicCamera&&(this.camera.zoom=le.lerp(l,n,m)),this._set(_.position,_.target,_.up),this._animation=f<1?requestAnimationFrame(d):0};this._animation=requestAnimationFrame(d)}get animating(){return this._animation!==0}_stopAnimation(){cancelAnimationFrame(this._animation),this._animation=0}_set(t,e,n){if(this.camera.position.copy(t),this.target.copy(e),n){let s=this.camera.up.clone();this.camera.up.copy(n),this.camera.lookAt(e),this.camera.up.copy(s)}else this.camera.lookAt(e);this.resize()}_down(t){this._end(),this._stopAnimation(),this.dom.setPointerCapture(t.pointerId),t.preventDefault();let e=t.button===0&&t.shiftKey?"box":t.button===0&&!this.is2D&&this.leftButtonMode==="orbit"?"orbit":"pan",n={x:t.clientX,y:t.clientY},s=null;e==="orbit"&&(s=this.pick(n.x,n.y),s||(s=this._visibleBounds()?.sphere.center.clone()??this.target.clone())),this._drag={id:t.pointerId,button:t.button,mode:e,pivot:s,down:n,last:n,moved:!1}}_anchor(t,e){let n=this.pick(t,e);if(n)return n;let s=this.dom.getBoundingClientRect(),r=s.left+s.width/2,o=s.top+s.height/2;return t===r&&e===o?null:this.pick(r,o)}_gestureDepth(t,e){let n=this.camera,s=t?t.clone().sub(n.position).dot(e):0;return Math.max(jf,n.position.distanceTo(this.target),s)}_move(t){let e=this._drag;if(!e||t.pointerId!==e.id)return;if(t.buttons===0)return this._end();let n={x:t.clientX,y:t.clientY};if(!e.moved&&Xf(e.down,n))return;e.moved=!0;let s=n.x-e.last.x,r=n.y-e.last.y;if(e.last=n,e.mode==="box")this._drawRect(e.down,n);else if(e.mode==="orbit"){let o=qf(this.camera.position,this.target,e.pivot,s,r,zy);this._set(o.position,o.target)}else this._pan(s,r)}_pan(t,e){let n=this.camera,s=Math.max(this.dom.clientHeight,1);if(n.isPerspectiveCamera&&this._drag.depth===void 0){let{x:c,y:h}=this._drag.down;this._drag.depth=this._gestureDepth(this._anchor(c,h),n.getWorldDirection(new C))}let r=n.isPerspectiveCamera?2*this._drag.depth*Math.tan(le.degToRad(n.fov/2))/(s*n.zoom):(n.top-n.bottom)/n.zoom/s,o=new C(1,0,0).applyQuaternion(n.quaternion),a=new C(0,1,0).applyQuaternion(n.quaternion),l=o.multiplyScalar(-t*r).addScaledVector(a,e*r);this._set(n.position.clone().add(l),this.target.clone().add(l))}_up(t){let e=this._drag;if(!e||t.pointerId!==e.id||t.button!==e.button)return;let n={x:t.clientX,y:t.clientY};if(this._end(),e.mode==="box"&&e.moved){let s={x:Math.min(e.down.x,n.x),y:Math.min(e.down.y,n.y),width:Math.abs(n.x-e.down.x),height:Math.abs(n.y-e.down.y)},r=Bh(e.down.x,n.x);this.dispatchEvent(ul("boxselect",{rect:s,mode:r,ctrl:t.ctrlKey,shift:t.shiftKey}))}else!e.moved&&e.button===0?this.dispatchEvent(ul("click",{x:n.x,y:n.y,button:0,ctrl:t.ctrlKey,shift:t.shiftKey})):!e.moved&&e.button===2&&this.dispatchEvent(ul("contextmenu",{x:n.x,y:n.y}))}_lostCapture(t){this._drag&&t.buttons?this.dom.setPointerCapture(this._drag.id):this._end()}_end(){this._drag=null,this._overlay?.remove(),this._overlay=null}_drawRect(t,e){this._overlay||(this._overlay=document.createElement("div"),Object.assign(this._overlay.style,{position:"fixed",pointerEvents:"none",border:"1px solid #2563eb",background:"rgba(37,99,235,0.12)"}),(this.dom.parentElement??document.body).appendChild(this._overlay)),Object.assign(this._overlay.style,{borderStyle:Bh(t.x,e.x)==="window"?"solid":"dashed",left:`${Math.min(t.x,e.x)}px`,top:`${Math.min(t.y,e.y)}px`,width:`${Math.abs(e.x-t.x)}px`,height:`${Math.abs(e.y-t.y)}px`})}_wheel(t){if(t.preventDefault(),t.deltaY===0)return;this._stopAnimation();let e=$f(t.deltaY,t.deltaMode,this.dom.clientHeight),n=this.camera,s=n.position.distanceTo(this.target),r=this._visibleBounds()?.sphere.radius??0,o=ky*Math.max(r,.001);if(n.isOrthographicCamera){let{left:_,top:g,width:p,height:y}=this.dom.getBoundingClientRect();if(!p||!y)return;let w=le.clamp(n.zoom/e,Math.max(1e-6,Math.min(n.zoom,s/o)),1e6);if(w===n.zoom)return;let M=new C((2*(t.clientX-_)/p-1)*n.right,(1-2*(t.clientY-g)/y)*n.top,0).multiplyScalar(1/n.zoom-1/w).applyQuaternion(n.quaternion);n.zoom=w,this._set(n.position.clone().add(M),this.target.clone().add(M));return}this._wheelPick||(this._wheelPick={point:this._anchor(t.clientX,t.clientY)},requestAnimationFrame(()=>this._wheelPick=null));let a=n.getWorldDirection(new C),l=this._gestureDepth(this._wheelPick.point,a);if(!Number.isFinite(l))return;let c=Math.min(Oh,Math.max(jf,r)),h=le.clamp(l*e,c,Math.max(l,o))/l;if(h===1)return;let d=n.position.clone().addScaledVector(a,l),u=this._wheelPick.point,f=u&&u.clone().sub(n.position).dot(a)>=c?u:d,m=Yf(n.position,d,f,h);this._set(m.position,m.target)}};function K(i,t,e){let n=document.createElement(i);return t&&(n.className=t),e!==void 0&&(n.textContent=e),n}function tn(i,t,e){let n=K("button",i);return n.type="button",n.innerHTML=t,n.title=e,n.setAttribute("aria-label",e),n}function Gs(i){i.preventDefault(),i.stopPropagation()}function fl(i){Gs(i);let t=i.button===2,e=()=>{window.removeEventListener("pointerup",n,!0),setTimeout(()=>{window.removeEventListener("click",Gs,!0),t&&window.removeEventListener("contextmenu",Gs,!0)})},n=s=>{Gs(s),e()};window.addEventListener("pointerup",n,!0),window.addEventListener("click",Gs,!0),t&&window.addEventListener("contextmenu",Gs,!0)}function Wr(i,t,e,n){let s=t.clone().applyMatrix4(e.matrixWorldInverse).z<0,r=t.clone().project(e);i.hidden=!(s&&Math.abs(r.x)<=1&&Math.abs(r.y)<=1),!i.hidden&&(i.style.left=`${n.left+(r.x+1)/2*n.width}px`,i.style.top=`${n.top+(1-r.y)/2*n.height}px`)}var ye=i=>``,ep='',oe={model:ye(''),elements:ye(''),views:ye(''),sections:ye(''),clashes:ye(''),bcf:ye(''),timeliner:ye(''),links:ye(''),orbit:ye(''),pan:ye(''),fit:ye(''),projection:ye(ep),mode2d:ye(''),plane:ye(''),box:ye(`${ep}`),resetSections:ye(''),distance:ye(''),displayMode:ye(''),grids:ye(''),opacity:ye(''),fullscreen:ye(''),close:ye(''),chevron:ye(''),flip:ye(''),remove:ye(''),play:ye(''),pause:ye(''),home:ye('')};var Xr=new C(0,0,1),un={right:new C(1,0,0),left:new C(-1,0,0),back:new C(0,1,0),front:new C(0,-1,0),top:new C(0,0,1),bottom:new C(0,0,-1)},Vy={right:Xr,left:Xr,back:Xr,front:Xr,top:un.back,bottom:un.front},Ki=.7,Gy=le.degToRad(1),np=.01,ip=96,pl=1.75;function sp(i){let t=i.split("-"),e=new C;for(let n of t){if(!Object.hasOwn(un,n))throw new RangeError(`Unknown view cube region: ${i}`);e.add(un[n])}if(new Set(t).size!==t.length||e.lengthSq()!==t.length)throw new RangeError(`Unknown view cube region: ${i}`);return e.normalize()}function Wy(i){let t=[];return Math.abs(i.z)>=Ki&&t.push(i.z>0?"top":"bottom"),Math.abs(i.y)>=Ki&&t.push(i.y>0?"back":"front"),Math.abs(i.x)>=Ki&&t.push(i.x>0?"right":"left"),t.join("-")}function zh(i,t=Gy){let e=i.clone().normalize(),n=Math.cos(t);return Object.keys(un).find(s=>e.dot(un[s])>=n)??null}function rp(i){let t=new C(i.x,i.y,0);if(t.lengthSq()<1e-24)return"front";t.normalize();let e=["front","right","back","left"],n=Math.max(...e.map(s=>t.dot(un[s])));return e.find(s=>t.dot(un[s])>=n-1e-9)}function kh(i,t){return un[rp(t)].clone().multiplyScalar(Math.sin(np)).addScaledVector(un[i],Math.cos(np))}function Xy(i,t){let e=zh(i);if(!e)return null;let n=e==="top"||e==="bottom";if(t==="left"||t==="right")return(n?kh(e,i):sp(e)).applyAxisAngle(Xr,t==="right"?Math.PI/2:-Math.PI/2);if(t!=="up"&&t!=="down")throw new RangeError(`Unknown arrow: ${t}`);if(!n)return kh(t==="up"?"top":"bottom",i);let s=un[rp(i)];return t==="up"==(e==="top")?s.clone().negate():s.clone()}function qy(i,t){let e=document.createElement("canvas");e.width=e.height=128;let n=e.getContext("2d");n.fillStyle="#2a2f38",n.fillRect(0,0,128,128),n.fillStyle="#cbd5e1",n.textAlign="center",n.textBaseline="middle",n.font=`600 26px ${t}`;let s=n.measureText(i).width;s>112&&(n.font=`600 ${Math.floor(2912/s)}px ${t}`),n.fillText(i,64,64);let r=new hr(e);return r.colorSpace=me,r}var ml=class{constructor(t,e,n){this.controls=n,this.home={position:e.position.clone(),target:n.target.clone()},this.element=K("div","ioviewer-viewcube"),this.canvas=K("canvas","ioviewer-viewcube-canvas"),this.canvas.title=q("cube.title"),this.canvas.setAttribute("aria-label",q("cube.title")),this.element.append(this.canvas),this.error=null,this.renderer=this._createRenderer(),this.scene=new pn,this.camera=new Xn(-pl,pl,pl,-pl,.1,10),this.faces=new Re;let s=getComputedStyle(t).fontFamily;for(let[l,c]of Object.entries(un)){let h=q(`face.${l}`),d=new ge(new cn(2,2),new Je({map:qy(h,s)})),u=Vy[l];d.quaternion.setFromRotationMatrix(new Kt().makeBasis(u.clone().cross(c),u,c)),d.position.copy(c),d.name=l,d.userData.label=h,this.faces.add(d)}let r=new ln(new Vi(new gn(2,2,2)),new sn({color:"#5b6575"}));this.highlight=new ge(new gn(1,1,1),new Je({color:"#2563eb",transparent:!0,opacity:.6})),this.highlight.visible=!1,this.scene.add(this.faces,r,this.highlight),this._raycaster=new qn,this.hovered=null,this._pointer=null,this.element.addEventListener("contextmenu",l=>l.preventDefault());let o=l=>{this._pointer=[l.clientX,l.clientY],this._hover(this.regionAtClient(...this._pointer))&&this._render()};this.canvas.addEventListener("pointerenter",o),this.canvas.addEventListener("pointermove",o),this.canvas.addEventListener("pointerleave",()=>{this._pointer=null,this._hover(null)&&this._render()}),this.canvas.addEventListener("click",l=>{let c=this.regionAtClient(l.clientX,l.clientY);if(!c)return;let h=c==="top"||c==="bottom";this._look(h?kh(c,n.camera.position.clone().sub(n.target)):sp(c))}),this.arrows=["up","down","left","right"].map(l=>{let c=tn("ioviewer-viewcube-arrow",oe.chevron,q(`cube.${l}`));return c.dataset.arrow=l,c.addEventListener("click",h=>{h.detail&&c.blur(),this._arrow(l)}),c});let a=tn("ioviewer-viewcube-home",oe.home,q("cube.home"));a.addEventListener("click",l=>{l.detail&&a.blur(),n.resetCameraStyle(),n.animateTo({position:this.home.position.clone(),target:this.home.target.clone()})}),this.element.append(...this.arrows,a),t.append(this.element),this.update()}_createRenderer(){this.canvas.addEventListener("webglcontextlost",e=>{e.stopImmediatePropagation(),this._fail(new Error("The view cube lost its WebGL context."))});let t=this.canvas.getContext("webgl2",{alpha:!0,antialias:!0});if(!t)return this._fail(new Error("WebGL 2 is not available for the view cube."));try{let e=new Ti({canvas:this.canvas,context:t,alpha:!0,antialias:!0});return e.setPixelRatio(window.devicePixelRatio),e.setSize(ip,ip),e}catch(e){return this._fail(e)}}_fail(t){return this.error=t,this.renderer=null,this.element.hidden=!0,null}_render(){if(this.renderer)try{this.renderer.render(this.scene,this.camera)}catch(t){this._fail(t)}}set2D(t){this.element.classList.toggle("ioviewer-viewcube-2d",!!t)}update(){if(!this.renderer)return;let t=this.controls.camera,e=!this.camera.quaternion.equals(t.quaternion);this.camera.quaternion.copy(t.quaternion),this.camera.position.set(0,0,5).applyQuaternion(t.quaternion),this.camera.updateMatrixWorld();let n=zh(t.position.clone().sub(this.controls.target))!==null;for(let s of this.arrows)s.hidden=!n;e&&this._pointer&&this._hover(this.regionAtClient(...this._pointer)),this._render()}regionAtClient(t,e){let n=this.canvas.getBoundingClientRect(),s=new qt((t-n.left)/n.width*2-1,1-(e-n.top)/n.height*2);this._raycaster.setFromCamera(s,this.camera);let r=this._raycaster.intersectObjects(this.faces.children)[0];return r?Wy(r.point):null}_hover(t){if(t===this.hovered)return!1;if(this.hovered=t,this.highlight.visible=!!t,t){let e=t.split("-").reduce((a,l)=>a.add(un[l]),new C),n=a=>a===0?[-Ki,Ki]:a>0?[Ki,1.02]:[-1.02,-Ki],[s,r,o]=e.toArray().map(n);this.highlight.scale.set(s[1]-s[0],r[1]-r[0],o[1]-o[0]),this.highlight.position.set((s[0]+s[1])/2,(r[0]+r[1])/2,(o[0]+o[1])/2)}return!0}_arrow(t){let n=this.controls.camera.position.clone().sub(this.controls.target),s=Xy(n,t);if(!s)return;let r=zh(n),o=r==="top"&&t==="up"||r==="bottom"&&t==="down";this._look(s,o)}_look(t,e=!1){let{controls:n}=this,s=n.camera.position.distanceTo(n.target);n.animateTo({position:t.clone().multiplyScalar(s).add(n.target),target:n.target.clone(),zoom:n.camera.zoom,overPole:e})}};var Yy=` +}`,hl=class{constructor(e){this.root=new Rt;let t=e.meta.lines;if(this.count=t?.count??0,this.clippingPlanes=null,this.clipIntersection=!1,this._lightBg=!1,!this.count)return;let n=e.view(t.geometry),s=e.view(t.material),r=e.view(t.matrix),o=Math.ceil(this.count/Uh);this._stateData=new Uint8Array(Uh*o*4),this._state=new gn(this._stateData,Uh,o,jt),this._state.colorSpace=mt,this._state.minFilter=Lt,this._state.magFilter=Lt,this._state.generateMipmaps=!1,this._baseColors=new Array(this.count);for(let f=0;f{if(!a.has(f)){let m=e.meta.geometries[f];if(!m||m.kind!=="lines")throw new tt(`Line instance references a geometry (${f}) that is not lines.`);a.set(f,Hs(e,m)),l.set(f,e.view(m.indices))}return{positions:a.get(f),indices:l.get(f)}},h=[],d=[],u=()=>{if(h.length===0)return;let f=new ht;f.setAttribute("position",new xt(new Float32Array(h),3)),f.setAttribute("lineSlot",new xt(new Float32Array(d),1)),f.computeBoundingSphere();let m=new ln(f,this._material);m.frustumCulled=!1,this.root.add(m),h=[],d=[]};for(let f=0;fqy&&d.length>0&&u();for(let D=0;D>16&255,this._stateData[l+1]=h>>8&255,this._stateData[l+2]=h&255}else if(n)this._stateData[l]=Bh[0],this._stateData[l+1]=Bh[1],this._stateData[l+2]=Bh[2];else{let h=this._baseColors[a];this._stateData[l]=h[0],this._stateData[l+1]=h[1],this._stateData[l+2]=h[2]}}this._state.needsUpdate=!0;let r=e._opacity??1;this._uniforms.opacity.value=r;let o=r<1;this._material.transparent!==o&&(this._material.transparent=o,this._material.needsUpdate=!0)}setClipping(e,t=!1){this.clippingPlanes=e.length>0?e:null,this.clipIntersection=t,this._material&&(this._material.clippingPlanes=this.clippingPlanes,this._material.clipIntersection=t)}withPickMaterial(e,t){e.clippingPlanes=this.clippingPlanes,e.clipIntersection=this.clipIntersection,e.uniforms?.lineState&&(e.uniforms.lineState.value=this._state);for(let n of this.root.children)n.material=e;try{t()}finally{for(let n of this.root.children)n.material=this._material}}};var Oh=["en","ru","es","de","fr","pt","it","ja","ko","zh-Hans","zh-Hant"];function Gs(i){if(!(typeof i!="string"||!i))try{let e=new Intl.Locale(i),t=e.language==="zh"?`zh-${e.maximize().script}`:e.language;return Oh.includes(t)?t:void 0}catch(e){if(!(e instanceof RangeError))throw e;return}}function qf(i=[]){return i.map(Gs).find(Boolean)??"en"}function Yf(i){let e=new Intl.DisplayNames(i,{type:"language"}).of(i),t=new Option(e,i);return t.lang=i,t}function $f(i){try{return globalThis.localStorage?.getItem(i)}catch(e){if(e.name!=="SecurityError")throw e;return null}}function Zf(i,e){try{globalThis.localStorage?.setItem(i,e)}catch(t){if(!["SecurityError","QuotaExceededError"].includes(t.name))throw t}}var Kf={es:{elements:"Elementos",noGeometry:"Sin geometr\xEDa",contextLost:"Se perdi\xF3 el contexto gr\xE1fico. Recarga la p\xE1gina.",noWebGL:"Se requiere un navegador compatible con WebGL 2",badData:"No se pudieron leer los datos del modelo",tooLarge:"El modelo es demasiado grande: {count} objetos con geometr\xEDa, l\xEDmite de {limit}",selected:"Seleccionados",close:"Cerrar",elementGroup:"Elemento",id:"ID",category:"Categor\xEDa",type:"Tipo",level:"Nivel",sourceId:"ID de origen",link:"V\xEDnculo",panels:"Paneles","panel.model":"Modelo","panel.views":"Vistas","panel.sections":"Secciones","panel.clashes":"Interferencias","panel.bcf":"Temas BCF","bcf.noView":"No hay vistas disponibles","bcf.viewpoint":"Abrir vista {index}","bcf.components":"Componentes sin encontrar: {missing}; ambiguos: {ambiguous}","panel.timeliner":"Cronograma 4D","panel.links":"Archivos vinculados","group.navigation":"Navegaci\xF3n","group.sections":"Secciones","group.measure":"Medici\xF3n","group.display":"Visualizaci\xF3n","group.view":"Vista","tool.orbit":"Girar","tool.pan":"Desplazar","tool.fit":"Encuadrar todo","tool.projection":"Perspectiva / ortogr\xE1fica","tool.plane":"Plano de secci\xF3n","tool.box":"Caja de secci\xF3n","tool.resetSections":"Restablecer secciones","tool.distance":"Distancia","tool.displayMode":"Modo de visualizaci\xF3n","tool.grids":"Ejes de rejilla","tool.opacity":"Transparencia","tool.fullscreen":"Pantalla completa",contextMenu:"Men\xFA contextual","menu.properties":"Propiedades","menu.hide":"Ocultar","menu.isolate":"Aislar","menu.showAll":"Mostrar todo","menu.zoomTo":"Acercar al objeto","menu.sectionBox":"Caja de secci\xF3n alrededor del objeto","menu.copyId":"Copiar ID","menu.fitAll":"Encuadrar todo","menu.resetSections":"Restablecer secciones","menu.unavailable":"No disponible para este modelo",searchPlaceholder:"Buscar por nombre, tipo o ID\u2026",noCategory:"Sin categor\xEDa",noMatches:"Sin coincidencias","filters.title":"Filtros","filters.model":"Modelo de origen","filters.noLevel":"Sin nivel","filters.all":"Todos","filters.clear":"Borrar","filters.isolate":"Aislar coincidencias",idCopied:"ID copiado",copyFailed:"No se pudo copiar el ID",fullscreenUnavailable:"La pantalla completa no est\xE1 disponible","face.front":"Frontal","face.back":"Posterior","face.left":"Izquierda","face.right":"Derecha","face.top":"Superior","face.bottom":"Inferior","cube.title":"Cubo de vistas","cube.up":"Girar hacia arriba","cube.down":"Girar hacia abajo","cube.left":"Girar a la izquierda","cube.right":"Girar a la derecha","cube.home":"Vista inicial","sections.mode":"Modo de secci\xF3n","sections.planes":"Planos","sections.box":"Caja","sections.off":"Desactivado","sections.axis":"Eje","sections.addPlane":"A\xF1adir plano","sections.noPlanes":"Sin planos","sections.rotated":"girado","sections.custom":"Personalizado","sections.position":"Posici\xF3n del plano","sections.flip":"Invertir lado","sections.enabled":"Activado","sections.delete":"Eliminar plano","sections.keepInside":"Mostrar el interior","sections.cutInside":"Recortar el interior","sections.fitSelection":"Ajustar a la selecci\xF3n","sections.showGizmo":"Mostrar manipulador","sections.boxYaw":"Rotaci\xF3n alrededor de Z","sections.fill":"Rellenar caras cortadas","sections.fillUnavailable":"El relleno requiere un b\xFAfer de est\xE9ncil de WebGL","sections.maxPlanes":"M\xE1ximo 6 planos","unit.m":"m","display.materials":"Materiales","display.textures":"Texturas","display.white":"Blanco","display.wireframe":"Estructura al\xE1mbrica","display.background":"Color de fondo","display.backgroundReset":"Restablecer fondo","opacity.label":"Opacidad","opacity.value":"{value} %","views.tour":"Iniciar recorrido","views.stop":"Detener recorrido","clash.New":"Nueva","clash.Active":"Activa","clash.Reviewed":"Revisada","clash.Approved":"Aprobada","clash.Resolved":"Resuelta","task.construct":"Construcci\xF3n","task.demolish":"Demolici\xF3n","task.temporary":"Temporal","player.title":"Reproductor 4D","player.play":"Reproducir","player.pause":"Pausar","player.date":"Fecha del cronograma","player.speed":"Velocidad",truncated:"Se muestran {meshes} de {total} mallas. MaxMeshVertices ha recortado el modelo.",language:"Idioma",auto:"Autom\xE1tico",model3d:"Modelo 3D",retry:"Reintentar descargas",finding:"Buscando el elemento\u2026",streamLod:"{size} MiB \xB7 detalle completo {shown}/{total}",streamMesh:"{size} MiB \xB7 Grupos {visible} \xB7 Refinando {fallback}",streamTiles:"\xC1reas {areas} \xB7 Detalle {shown}/{total} \xB7 {size}/{limit} MiB"},de:{elements:"Elemente",noGeometry:"Keine Geometrie",contextLost:"Der Grafikkontext wurde verloren. Seite neu laden.",noWebGL:"Ein Browser mit WebGL 2 ist erforderlich",badData:"Die Modelldaten konnten nicht gelesen werden",tooLarge:"Das Modell ist zu gro\xDF: {count} Objekte mit Geometrie, maximal {limit}",selected:"Ausgew\xE4hlt",close:"Schlie\xDFen",elementGroup:"Element",id:"ID",category:"Kategorie",type:"Typ",level:"Ebene",sourceId:"Quell-ID",link:"Verkn\xFCpfung",panels:"Bedienfelder","panel.model":"Modell","panel.views":"Ansichten","panel.sections":"Schnitte","panel.clashes":"Kollisionen","panel.bcf":"BCF-Themen","bcf.noView":"Keine Ansicht verf\xFCgbar","bcf.viewpoint":"Ansicht {index} \xF6ffnen","bcf.components":"Fehlende Komponenten: {missing}, mehrdeutige: {ambiguous}","panel.timeliner":"4D-Terminplan","panel.links":"Verkn\xFCpfte Dateien","group.navigation":"Navigation","group.sections":"Schnitte","group.measure":"Messung","group.display":"Darstellung","group.view":"Ansicht","tool.orbit":"Drehen","tool.pan":"Verschieben","tool.fit":"Alles einpassen","tool.projection":"Perspektive / Orthogonal","tool.plane":"Schnittebene","tool.box":"Schnittbox","tool.resetSections":"Schnitte zur\xFCcksetzen","tool.distance":"Abstand","tool.displayMode":"Darstellungsmodus","tool.grids":"Rasterachsen","tool.opacity":"Transparenz","tool.fullscreen":"Vollbild",contextMenu:"Kontextmen\xFC","menu.properties":"Eigenschaften","menu.hide":"Ausblenden","menu.isolate":"Isolieren","menu.showAll":"Alles anzeigen","menu.zoomTo":"Auf Objekt zoomen","menu.sectionBox":"Schnittbox um das Objekt","menu.copyId":"ID kopieren","menu.fitAll":"Alles einpassen","menu.resetSections":"Schnitte zur\xFCcksetzen","menu.unavailable":"F\xFCr dieses Modell nicht verf\xFCgbar",searchPlaceholder:"Nach Name, Typ oder ID suchen\u2026",noCategory:"Ohne Kategorie",noMatches:"Keine Treffer","filters.title":"Filter","filters.model":"Quellmodell","filters.noLevel":"Ohne Ebene","filters.all":"Alle","filters.clear":"Zur\xFCcksetzen","filters.isolate":"Treffer isolieren",idCopied:"ID kopiert",copyFailed:"ID konnte nicht kopiert werden",fullscreenUnavailable:"Vollbild ist nicht verf\xFCgbar","face.front":"Vorne","face.back":"Hinten","face.left":"Links","face.right":"Rechts","face.top":"Oben","face.bottom":"Unten","cube.title":"Ansichtsw\xFCrfel","cube.up":"Nach oben drehen","cube.down":"Nach unten drehen","cube.left":"Nach links drehen","cube.right":"Nach rechts drehen","cube.home":"Ausgangsansicht","sections.mode":"Schnittmodus","sections.planes":"Ebenen","sections.box":"Box","sections.off":"Aus","sections.axis":"Achse","sections.addPlane":"Ebene hinzuf\xFCgen","sections.noPlanes":"Keine Schnittebenen","sections.rotated":"gedreht","sections.custom":"Benutzerdefiniert","sections.position":"Ebenenposition","sections.flip":"Seite wechseln","sections.enabled":"Ein","sections.delete":"Ebene l\xF6schen","sections.keepInside":"Innen anzeigen","sections.cutInside":"Innen ausschneiden","sections.fitSelection":"An Auswahl anpassen","sections.showGizmo":"Manipulator anzeigen","sections.boxYaw":"Drehung um Z","sections.fill":"Schnittfl\xE4chen f\xFCllen","sections.fillUnavailable":"Schnittf\xFCllung erfordert einen WebGL-Stencilpuffer","sections.maxPlanes":"Maximal 6 Ebenen","unit.m":"m","display.materials":"Materialien","display.textures":"Texturen","display.white":"Wei\xDF","display.wireframe":"Drahtmodell","display.background":"Hintergrundfarbe","display.backgroundReset":"Hintergrund zur\xFCcksetzen","opacity.label":"Deckkraft","opacity.value":"{value} %","views.tour":"Rundgang starten","views.stop":"Rundgang stoppen","clash.New":"Neu","clash.Active":"Aktiv","clash.Reviewed":"Gepr\xFCft","clash.Approved":"Genehmigt","clash.Resolved":"Behoben","task.construct":"Bau","task.demolish":"Abbruch","task.temporary":"Tempor\xE4r","player.title":"4D-Wiedergabe","player.play":"Abspielen","player.pause":"Pausieren","player.date":"Terminplandatum","player.speed":"Geschwindigkeit",truncated:"{meshes} von {total} Netzen werden angezeigt. MaxMeshVertices hat das Modell gek\xFCrzt.",language:"Sprache",auto:"Automatisch",model3d:"3D-Modell",retry:"Downloads wiederholen",finding:"Element wird gesucht\u2026",streamLod:"{size} MiB \xB7 volles Detail {shown}/{total}",streamMesh:"{size} MiB \xB7 Cluster {visible} \xB7 Verfeinerung {fallback}",streamTiles:"Bereiche {areas} \xB7 Detail {shown}/{total} \xB7 {size}/{limit} MiB"},fr:{elements:"\xC9l\xE9ments",noGeometry:"Aucune g\xE9om\xE9trie",contextLost:"Le contexte graphique a \xE9t\xE9 perdu. Rechargez la page.",noWebGL:"Un navigateur compatible avec WebGL 2 est n\xE9cessaire",badData:"Impossible de lire les donn\xE9es du mod\xE8le",tooLarge:"Le mod\xE8le est trop volumineux : {count} objets avec g\xE9om\xE9trie, limite de {limit}",selected:"S\xE9lectionn\xE9s",close:"Fermer",elementGroup:"\xC9l\xE9ment",id:"ID",category:"Cat\xE9gorie",type:"Type",level:"Niveau",sourceId:"ID source",link:"Lien",panels:"Panneaux","panel.model":"Mod\xE8le","panel.views":"Vues","panel.sections":"Coupes","panel.clashes":"Conflits","panel.bcf":"Sujets BCF","bcf.noView":"Aucune vue disponible","bcf.viewpoint":"Ouvrir le point de vue {index}","bcf.components":"Composants manquants : {missing}, ambigus : {ambiguous}","panel.timeliner":"Planning 4D","panel.links":"Fichiers li\xE9s","group.navigation":"Navigation","group.sections":"Coupes","group.measure":"Mesure","group.display":"Affichage","group.view":"Vue","tool.orbit":"Orbite","tool.pan":"Panoramique","tool.fit":"Cadrer tout","tool.projection":"Perspective / orthographique","tool.plane":"Plan de coupe","tool.box":"Zone de coupe","tool.resetSections":"R\xE9initialiser les coupes","tool.distance":"Distance","tool.displayMode":"Mode d\u2019affichage","tool.grids":"Axes de quadrillage","tool.opacity":"Transparence","tool.fullscreen":"Plein \xE9cran",contextMenu:"Menu contextuel","menu.properties":"Propri\xE9t\xE9s","menu.hide":"Masquer","menu.isolate":"Isoler","menu.showAll":"Tout afficher","menu.zoomTo":"Zoom sur l\u2019objet","menu.sectionBox":"Zone de coupe autour de l\u2019objet","menu.copyId":"Copier l\u2019ID","menu.fitAll":"Cadrer tout","menu.resetSections":"R\xE9initialiser les coupes","menu.unavailable":"Indisponible pour ce mod\xE8le",searchPlaceholder:"Rechercher par nom, type ou ID\u2026",noCategory:"Sans cat\xE9gorie",noMatches:"Aucun r\xE9sultat","filters.title":"Filtres","filters.model":"Mod\xE8le source","filters.noLevel":"Sans niveau","filters.all":"Tous","filters.clear":"Effacer","filters.isolate":"Isoler les r\xE9sultats",idCopied:"ID copi\xE9",copyFailed:"Impossible de copier l\u2019ID",fullscreenUnavailable:"Le plein \xE9cran est indisponible","face.front":"Avant","face.back":"Arri\xE8re","face.left":"Gauche","face.right":"Droite","face.top":"Dessus","face.bottom":"Dessous","cube.title":"Cube de navigation","cube.up":"Pivoter vers le haut","cube.down":"Pivoter vers le bas","cube.left":"Pivoter \xE0 gauche","cube.right":"Pivoter \xE0 droite","cube.home":"Vue initiale","sections.mode":"Mode de coupe","sections.planes":"Plans","sections.box":"Zone","sections.off":"D\xE9sactiv\xE9","sections.axis":"Axe","sections.addPlane":"Ajouter un plan","sections.noPlanes":"Aucun plan","sections.rotated":"pivot\xE9","sections.custom":"Personnalis\xE9","sections.position":"Position du plan","sections.flip":"Inverser le c\xF4t\xE9","sections.enabled":"Activ\xE9","sections.delete":"Supprimer le plan","sections.keepInside":"Afficher l\u2019int\xE9rieur","sections.cutInside":"D\xE9couper l\u2019int\xE9rieur","sections.fitSelection":"Ajuster \xE0 la s\xE9lection","sections.showGizmo":"Afficher le manipulateur","sections.boxYaw":"Rotation autour de Z","sections.fill":"Remplir les faces coup\xE9es","sections.fillUnavailable":"Le remplissage n\xE9cessite un tampon de stencil WebGL","sections.maxPlanes":"6 plans maximum","unit.m":"m","display.materials":"Mat\xE9riaux","display.textures":"Textures","display.white":"Blanc","display.wireframe":"Filaire","display.background":"Couleur de fond","display.backgroundReset":"R\xE9initialiser le fond","opacity.label":"Opacit\xE9","opacity.value":"{value} %","views.tour":"D\xE9marrer la visite","views.stop":"Arr\xEAter la visite","clash.New":"Nouveau","clash.Active":"Actif","clash.Reviewed":"Examin\xE9","clash.Approved":"Approuv\xE9","clash.Resolved":"R\xE9solu","task.construct":"Construction","task.demolish":"D\xE9molition","task.temporary":"Temporaire","player.title":"Lecteur 4D","player.play":"Lire","player.pause":"Mettre en pause","player.date":"Date du planning","player.speed":"Vitesse",truncated:"{meshes} maillages sur {total} sont affich\xE9s. MaxMeshVertices a tronqu\xE9 le mod\xE8le.",language:"Langue",auto:"Automatique",model3d:"Mod\xE8le 3D",retry:"Relancer les t\xE9l\xE9chargements",finding:"Recherche de l\u2019\xE9l\xE9ment\u2026",streamLod:"{size} Mio \xB7 d\xE9tail complet {shown}/{total}",streamMesh:"{size} Mio \xB7 Groupes {visible} \xB7 Affinage {fallback}",streamTiles:"Zones {areas} \xB7 D\xE9tail {shown}/{total} \xB7 {size}/{limit} Mio"},pt:{elements:"Elementos",noGeometry:"Sem geometria",contextLost:"O contexto gr\xE1fico foi perdido. Recarregue a p\xE1gina.",noWebGL:"\xC9 necess\xE1rio um navegador com WebGL 2",badData:"N\xE3o foi poss\xEDvel ler os dados do modelo",tooLarge:"O modelo \xE9 grande demais: {count} objetos com geometria, limite de {limit}",selected:"Selecionados",close:"Fechar",elementGroup:"Elemento",id:"ID",category:"Categoria",type:"Tipo",level:"N\xEDvel",sourceId:"ID de origem",link:"V\xEDnculo",panels:"Pain\xE9is","panel.model":"Modelo","panel.views":"Vistas","panel.sections":"Cortes","panel.clashes":"Interfer\xEAncias","panel.bcf":"T\xF3picos BCF","bcf.noView":"Nenhuma vista dispon\xEDvel","bcf.viewpoint":"Abrir vista {index}","bcf.components":"Componentes ausentes: {missing}, amb\xEDguos: {ambiguous}","panel.timeliner":"Cronograma 4D","panel.links":"Arquivos vinculados","group.navigation":"Navega\xE7\xE3o","group.sections":"Cortes","group.measure":"Medi\xE7\xE3o","group.display":"Exibi\xE7\xE3o","group.view":"Vista","tool.orbit":"Girar","tool.pan":"Deslocar","tool.fit":"Enquadrar tudo","tool.projection":"Perspectiva / ortogr\xE1fica","tool.plane":"Plano de corte","tool.box":"Caixa de corte","tool.resetSections":"Redefinir cortes","tool.distance":"Dist\xE2ncia","tool.displayMode":"Modo de exibi\xE7\xE3o","tool.grids":"Eixos","tool.opacity":"Transpar\xEAncia","tool.fullscreen":"Tela cheia",contextMenu:"Menu de contexto","menu.properties":"Propriedades","menu.hide":"Ocultar","menu.isolate":"Isolar","menu.showAll":"Mostrar tudo","menu.zoomTo":"Aproximar do objeto","menu.sectionBox":"Caixa de corte ao redor do objeto","menu.copyId":"Copiar ID","menu.fitAll":"Enquadrar tudo","menu.resetSections":"Redefinir cortes","menu.unavailable":"Indispon\xEDvel para este modelo",searchPlaceholder:"Buscar por nome, tipo ou ID\u2026",noCategory:"Sem categoria",noMatches:"Nenhum resultado","filters.title":"Filtros","filters.model":"Modelo de origem","filters.noLevel":"Sem n\xEDvel","filters.all":"Todos","filters.clear":"Limpar","filters.isolate":"Isolar resultados",idCopied:"ID copiado",copyFailed:"N\xE3o foi poss\xEDvel copiar o ID",fullscreenUnavailable:"A tela cheia est\xE1 indispon\xEDvel","face.front":"Frente","face.back":"Tr\xE1s","face.left":"Esquerda","face.right":"Direita","face.top":"Topo","face.bottom":"Base","cube.title":"Cubo de vistas","cube.up":"Girar para cima","cube.down":"Girar para baixo","cube.left":"Girar para a esquerda","cube.right":"Girar para a direita","cube.home":"Vista inicial","sections.mode":"Modo de corte","sections.planes":"Planos","sections.box":"Caixa","sections.off":"Desativado","sections.axis":"Eixo","sections.addPlane":"Adicionar plano","sections.noPlanes":"Sem planos","sections.rotated":"girado","sections.custom":"Personalizado","sections.position":"Posi\xE7\xE3o do plano","sections.flip":"Inverter lado","sections.enabled":"Ativado","sections.delete":"Excluir plano","sections.keepInside":"Mostrar interior","sections.cutInside":"Recortar interior","sections.fitSelection":"Ajustar \xE0 sele\xE7\xE3o","sections.showGizmo":"Mostrar manipulador","sections.boxYaw":"Rota\xE7\xE3o em torno de Z","sections.fill":"Preencher faces de corte","sections.fillUnavailable":"O preenchimento requer um buffer de stencil WebGL","sections.maxPlanes":"At\xE9 6 planos","unit.m":"m","display.materials":"Materiais","display.textures":"Texturas","display.white":"Branco","display.wireframe":"Aramado","display.background":"Cor de fundo","display.backgroundReset":"Redefinir fundo","opacity.label":"Opacidade","opacity.value":"{value}%","views.tour":"Iniciar percurso","views.stop":"Parar percurso","clash.New":"Nova","clash.Active":"Ativa","clash.Reviewed":"Revisada","clash.Approved":"Aprovada","clash.Resolved":"Resolvida","task.construct":"Constru\xE7\xE3o","task.demolish":"Demoli\xE7\xE3o","task.temporary":"Tempor\xE1ria","player.title":"Reprodutor 4D","player.play":"Reproduzir","player.pause":"Pausar","player.date":"Data do cronograma","player.speed":"Velocidade",truncated:"Exibindo {meshes} de {total} malhas. MaxMeshVertices limitou o modelo.",language:"Idioma",auto:"Autom\xE1tico",model3d:"Modelo 3D",retry:"Tentar baixar novamente",finding:"Buscando o elemento\u2026",streamLod:"{size} MiB \xB7 detalhe completo {shown}/{total}",streamMesh:"{size} MiB \xB7 Grupos {visible} \xB7 Refinando {fallback}",streamTiles:"\xC1reas {areas} \xB7 Detalhe {shown}/{total} \xB7 {size}/{limit} MiB"},it:{elements:"Elementi",noGeometry:"Nessuna geometria",contextLost:"Il contesto grafico \xE8 stato perso. Ricarica la pagina.",noWebGL:"\xC8 necessario un browser con WebGL 2",badData:"Impossibile leggere i dati del modello",tooLarge:"Il modello \xE8 troppo grande: {count} oggetti con geometria, limite di {limit}",selected:"Selezionati",close:"Chiudi",elementGroup:"Elemento",id:"ID",category:"Categoria",type:"Tipo",level:"Livello",sourceId:"ID origine",link:"Collegamento",panels:"Pannelli","panel.model":"Modello","panel.views":"Viste","panel.sections":"Sezioni","panel.clashes":"Interferenze","panel.bcf":"Argomenti BCF","bcf.noView":"Nessuna vista disponibile","bcf.viewpoint":"Apri punto di vista {index}","bcf.components":"Componenti mancanti: {missing}, ambigui: {ambiguous}","panel.timeliner":"Cronoprogramma 4D","panel.links":"File collegati","group.navigation":"Navigazione","group.sections":"Sezioni","group.measure":"Misura","group.display":"Visualizzazione","group.view":"Vista","tool.orbit":"Orbita","tool.pan":"Sposta vista","tool.fit":"Inquadra tutto","tool.projection":"Prospettiva / ortogonale","tool.plane":"Piano di sezione","tool.box":"Riquadro di sezione","tool.resetSections":"Ripristina sezioni","tool.distance":"Distanza","tool.displayMode":"Modalit\xE0 di visualizzazione","tool.grids":"Assi di griglia","tool.opacity":"Trasparenza","tool.fullscreen":"Schermo intero",contextMenu:"Menu contestuale","menu.properties":"Propriet\xE0","menu.hide":"Nascondi","menu.isolate":"Isola","menu.showAll":"Mostra tutto","menu.zoomTo":"Zoom sull\u2019oggetto","menu.sectionBox":"Riquadro di sezione attorno all\u2019oggetto","menu.copyId":"Copia ID","menu.fitAll":"Inquadra tutto","menu.resetSections":"Ripristina sezioni","menu.unavailable":"Non disponibile per questo modello",searchPlaceholder:"Cerca per nome, tipo o ID\u2026",noCategory:"Senza categoria",noMatches:"Nessun risultato","filters.title":"Filtri","filters.model":"Modello di origine","filters.noLevel":"Senza livello","filters.all":"Tutti","filters.clear":"Cancella","filters.isolate":"Isola risultati",idCopied:"ID copiato",copyFailed:"Impossibile copiare l\u2019ID",fullscreenUnavailable:"Lo schermo intero non \xE8 disponibile","face.front":"Fronte","face.back":"Retro","face.left":"Sinistra","face.right":"Destra","face.top":"Alto","face.bottom":"Basso","cube.title":"Cubo di navigazione","cube.up":"Ruota verso l\u2019alto","cube.down":"Ruota verso il basso","cube.left":"Ruota a sinistra","cube.right":"Ruota a destra","cube.home":"Vista iniziale","sections.mode":"Modalit\xE0 di sezione","sections.planes":"Piani","sections.box":"Riquadro","sections.off":"Disattivato","sections.axis":"Asse","sections.addPlane":"Aggiungi piano","sections.noPlanes":"Nessun piano","sections.rotated":"ruotato","sections.custom":"Personalizzato","sections.position":"Posizione del piano","sections.flip":"Inverti lato","sections.enabled":"Attivato","sections.delete":"Elimina piano","sections.keepInside":"Mostra interno","sections.cutInside":"Taglia interno","sections.fitSelection":"Adatta alla selezione","sections.showGizmo":"Mostra manipolatore","sections.boxYaw":"Rotazione attorno a Z","sections.fill":"Riempi facce tagliate","sections.fillUnavailable":"Il riempimento richiede uno stencil buffer WebGL","sections.maxPlanes":"Al massimo 6 piani","unit.m":"m","display.materials":"Materiali","display.textures":"Texture","display.white":"Bianco","display.wireframe":"Fil di ferro","display.background":"Colore di sfondo","display.backgroundReset":"Ripristina sfondo","opacity.label":"Opacit\xE0","opacity.value":"{value}%","views.tour":"Avvia percorso","views.stop":"Interrompi percorso","clash.New":"Nuova","clash.Active":"Attiva","clash.Reviewed":"Revisionata","clash.Approved":"Approvata","clash.Resolved":"Risolta","task.construct":"Costruzione","task.demolish":"Demolizione","task.temporary":"Temporanea","player.title":"Riproduttore 4D","player.play":"Riproduci","player.pause":"Pausa","player.date":"Data pianificata","player.speed":"Velocit\xE0",truncated:"Sono mostrate {meshes} mesh su {total}. MaxMeshVertices ha troncato il modello.",language:"Lingua",auto:"Automatico",model3d:"Modello 3D",retry:"Riprova download",finding:"Ricerca dell\u2019elemento\u2026",streamLod:"{size} MiB \xB7 dettaglio completo {shown}/{total}",streamMesh:"{size} MiB \xB7 Gruppi {visible} \xB7 In affinamento {fallback}",streamTiles:"Aree {areas} \xB7 Dettaglio {shown}/{total} \xB7 {size}/{limit} MiB"},ja:{elements:"\u8981\u7D20",noGeometry:"\u30B8\u30AA\u30E1\u30C8\u30EA\u304C\u3042\u308A\u307E\u305B\u3093",contextLost:"\u30B0\u30E9\u30D5\u30A3\u30C3\u30AF\u30B9\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u304C\u5931\u308F\u308C\u307E\u3057\u305F\u3002\u30DA\u30FC\u30B8\u3092\u518D\u8AAD\u307F\u8FBC\u307F\u3057\u3066\u304F\u3060\u3055\u3044\u3002",noWebGL:"WebGL 2 \u5BFE\u5FDC\u30D6\u30E9\u30A6\u30B6\u30FC\u304C\u5FC5\u8981\u3067\u3059",badData:"\u30E2\u30C7\u30EB\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F",tooLarge:"\u30E2\u30C7\u30EB\u304C\u5927\u304D\u3059\u304E\u307E\u3059\u3002\u30B8\u30AA\u30E1\u30C8\u30EA\u3092\u6301\u3064\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306F {count} \u500B\u3067\u3001\u4E0A\u9650\u306F {limit} \u500B\u3067\u3059",selected:"\u9078\u629E\u6E08\u307F",close:"\u9589\u3058\u308B",elementGroup:"\u8981\u7D20",id:"ID",category:"\u30AB\u30C6\u30B4\u30EA",type:"\u30BF\u30A4\u30D7",level:"\u30EC\u30D9\u30EB",sourceId:"\u30BD\u30FC\u30B9 ID",link:"\u30EA\u30F3\u30AF",panels:"\u30D1\u30CD\u30EB","panel.model":"\u30E2\u30C7\u30EB","panel.views":"\u30D3\u30E5\u30FC","panel.sections":"\u65AD\u9762","panel.clashes":"\u5E72\u6E09","panel.bcf":"BCF \u30C8\u30D4\u30C3\u30AF","bcf.noView":"\u5229\u7528\u53EF\u80FD\u306A\u30D3\u30E5\u30FC\u304C\u3042\u308A\u307E\u305B\u3093","bcf.viewpoint":"\u8996\u70B9 {index} \u3092\u958B\u304F","bcf.components":"\u672A\u691C\u51FA\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8: {missing}\u3001\u7279\u5B9A\u3067\u304D\u306A\u3044\u3082\u306E: {ambiguous}","panel.timeliner":"4D \u5DE5\u7A0B\u8868","panel.links":"\u30EA\u30F3\u30AF\u30D5\u30A1\u30A4\u30EB","group.navigation":"\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3","group.sections":"\u65AD\u9762","group.measure":"\u8A08\u6E2C","group.display":"\u8868\u793A","group.view":"\u30D3\u30E5\u30FC","tool.orbit":"\u30AA\u30FC\u30D3\u30C3\u30C8","tool.pan":"\u753B\u9762\u79FB\u52D5","tool.fit":"\u5168\u4F53\u8868\u793A","tool.projection":"\u900F\u8996\u6295\u5F71 / \u5E73\u884C\u6295\u5F71","tool.plane":"\u65AD\u9762\u5E73\u9762","tool.box":"\u65AD\u9762\u30DC\u30C3\u30AF\u30B9","tool.resetSections":"\u65AD\u9762\u3092\u30EA\u30BB\u30C3\u30C8","tool.distance":"\u8DDD\u96E2","tool.displayMode":"\u8868\u793A\u30E2\u30FC\u30C9","tool.grids":"\u901A\u308A\u82AF","tool.opacity":"\u900F\u660E\u5EA6","tool.fullscreen":"\u5168\u753B\u9762\u8868\u793A",contextMenu:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u30E1\u30CB\u30E5\u30FC","menu.properties":"\u30D7\u30ED\u30D1\u30C6\u30A3","menu.hide":"\u975E\u8868\u793A","menu.isolate":"\u5206\u96E2\u8868\u793A","menu.showAll":"\u3059\u3079\u3066\u8868\u793A","menu.zoomTo":"\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B\u30BA\u30FC\u30E0","menu.sectionBox":"\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u56F2\u3080\u65AD\u9762\u30DC\u30C3\u30AF\u30B9","menu.copyId":"ID \u3092\u30B3\u30D4\u30FC","menu.fitAll":"\u5168\u4F53\u8868\u793A","menu.resetSections":"\u65AD\u9762\u3092\u30EA\u30BB\u30C3\u30C8","menu.unavailable":"\u3053\u306E\u30E2\u30C7\u30EB\u3067\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093",searchPlaceholder:"\u540D\u524D\u3001\u30BF\u30A4\u30D7\u3001ID \u3067\u691C\u7D22\u2026",noCategory:"\u30AB\u30C6\u30B4\u30EA\u306A\u3057",noMatches:"\u4E00\u81F4\u3059\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093","filters.title":"\u30D5\u30A3\u30EB\u30BF\u30FC","filters.model":"\u30BD\u30FC\u30B9\u30E2\u30C7\u30EB","filters.noLevel":"\u30EC\u30D9\u30EB\u306A\u3057","filters.all":"\u3059\u3079\u3066","filters.clear":"\u30AF\u30EA\u30A2","filters.isolate":"\u4E00\u81F4\u3057\u305F\u9805\u76EE\u3092\u5206\u96E2\u8868\u793A",idCopied:"ID \u3092\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"ID \u3092\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F",fullscreenUnavailable:"\u5168\u753B\u9762\u8868\u793A\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093","face.front":"\u6B63\u9762","face.back":"\u80CC\u9762","face.left":"\u5DE6","face.right":"\u53F3","face.top":"\u4E0A","face.bottom":"\u4E0B","cube.title":"\u30D3\u30E5\u30FC\u30AD\u30E5\u30FC\u30D6","cube.up":"\u4E0A\u306B\u56DE\u8EE2","cube.down":"\u4E0B\u306B\u56DE\u8EE2","cube.left":"\u5DE6\u306B\u56DE\u8EE2","cube.right":"\u53F3\u306B\u56DE\u8EE2","cube.home":"\u521D\u671F\u30D3\u30E5\u30FC","sections.mode":"\u65AD\u9762\u30E2\u30FC\u30C9","sections.planes":"\u5E73\u9762","sections.box":"\u30DC\u30C3\u30AF\u30B9","sections.off":"\u30AA\u30D5","sections.axis":"\u8EF8","sections.addPlane":"\u5E73\u9762\u3092\u8FFD\u52A0","sections.noPlanes":"\u5E73\u9762\u306A\u3057","sections.rotated":"\u56DE\u8EE2\u6E08\u307F","sections.custom":"\u30AB\u30B9\u30BF\u30E0","sections.position":"\u5E73\u9762\u306E\u4F4D\u7F6E","sections.flip":"\u53CD\u5BFE\u5074\u306B\u5207\u308A\u66FF\u3048","sections.enabled":"\u30AA\u30F3","sections.delete":"\u5E73\u9762\u3092\u524A\u9664","sections.keepInside":"\u5185\u5074\u3092\u8868\u793A","sections.cutInside":"\u5185\u5074\u3092\u5207\u308A\u53D6\u308B","sections.fitSelection":"\u9078\u629E\u7BC4\u56F2\u306B\u5408\u308F\u305B\u308B","sections.showGizmo":"\u64CD\u4F5C\u30CF\u30F3\u30C9\u30EB\u3092\u8868\u793A","sections.boxYaw":"Z \u8EF8\u307E\u308F\u308A\u306E\u56DE\u8EE2","sections.fill":"\u5207\u65AD\u9762\u3092\u5857\u308A\u3064\u3076\u3059","sections.fillUnavailable":"\u5857\u308A\u3064\u3076\u3057\u306B\u306F WebGL \u306E\u30B9\u30C6\u30F3\u30B7\u30EB\u30D0\u30C3\u30D5\u30A1\u30FC\u304C\u5FC5\u8981\u3067\u3059","sections.maxPlanes":"\u6700\u5927 6 \u5E73\u9762","unit.m":"m","display.materials":"\u30DE\u30C6\u30EA\u30A2\u30EB","display.textures":"\u30C6\u30AF\u30B9\u30C1\u30E3","display.white":"\u767D","display.wireframe":"\u30EF\u30A4\u30E4\u30FC\u30D5\u30EC\u30FC\u30E0","display.background":"\u80CC\u666F\u8272","display.backgroundReset":"\u80CC\u666F\u3092\u30EA\u30BB\u30C3\u30C8","opacity.label":"\u4E0D\u900F\u660E\u5EA6","opacity.value":"{value}%","views.tour":"\u30D3\u30E5\u30FC\u5DE1\u56DE\u3092\u518D\u751F","views.stop":"\u30D3\u30E5\u30FC\u5DE1\u56DE\u3092\u505C\u6B62","clash.New":"\u65B0\u898F","clash.Active":"\u30A2\u30AF\u30C6\u30A3\u30D6","clash.Reviewed":"\u78BA\u8A8D\u6E08\u307F","clash.Approved":"\u627F\u8A8D\u6E08\u307F","clash.Resolved":"\u89E3\u6C7A\u6E08\u307F","task.construct":"\u5EFA\u8A2D","task.demolish":"\u89E3\u4F53","task.temporary":"\u4EEE\u8A2D","player.title":"4D \u30D7\u30EC\u30FC\u30E4\u30FC","player.play":"\u518D\u751F","player.pause":"\u4E00\u6642\u505C\u6B62","player.date":"\u5DE5\u7A0B\u65E5","player.speed":"\u901F\u5EA6",truncated:"{total} \u500B\u4E2D {meshes} \u500B\u306E\u30E1\u30C3\u30B7\u30E5\u3092\u8868\u793A\u3002MaxMeshVertices \u306E\u8A2D\u5B9A\u3067\u30E2\u30C7\u30EB\u304C\u7701\u7565\u3055\u308C\u3066\u3044\u307E\u3059\u3002",language:"\u8A00\u8A9E",auto:"\u81EA\u52D5",model3d:"3D \u30E2\u30C7\u30EB",retry:"\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3092\u518D\u8A66\u884C",finding:"\u8981\u7D20\u3092\u691C\u7D22\u4E2D\u2026",streamLod:"{size} MiB \xB7 \u8A73\u7D30\u8868\u793A {shown}/{total}",streamMesh:"{size} MiB \xB7 \u30AF\u30E9\u30B9\u30BF\u30FC {visible} \xB7 \u8A73\u7D30\u5316\u4E2D {fallback}",streamTiles:"\u9818\u57DF {areas} \xB7 \u8A73\u7D30\u8868\u793A {shown}/{total} \xB7 {size}/{limit} MiB"},ko:{elements:"\uC694\uC18C",noGeometry:"\uD615\uC0C1\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",contextLost:"\uADF8\uB798\uD53D \uCEE8\uD14D\uC2A4\uD2B8\uAC00 \uC190\uC2E4\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD398\uC774\uC9C0\uB97C \uC0C8\uB85C \uACE0\uCE58\uC138\uC694.",noWebGL:"WebGL 2\uB97C \uC9C0\uC6D0\uD558\uB294 \uBE0C\uB77C\uC6B0\uC800\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4",badData:"\uBAA8\uB378 \uB370\uC774\uD130\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",tooLarge:"\uBAA8\uB378\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4. \uD615\uC0C1\uC774 \uC788\uB294 \uAC1D\uCCB4 {count}\uAC1C, \uCD5C\uB300 {limit}\uAC1C",selected:"\uC120\uD0DD\uB428",close:"\uB2EB\uAE30",elementGroup:"\uC694\uC18C",id:"ID",category:"\uCE74\uD14C\uACE0\uB9AC",type:"\uC720\uD615",level:"\uB808\uBCA8",sourceId:"\uC6D0\uBCF8 ID",link:"\uB9C1\uD06C",panels:"\uD328\uB110","panel.model":"\uBAA8\uB378","panel.views":"\uBDF0","panel.sections":"\uB2E8\uBA74","panel.clashes":"\uAC04\uC12D","panel.bcf":"BCF \uC8FC\uC81C","bcf.noView":"\uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uBDF0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4","bcf.viewpoint":"\uAD00\uCE21\uC810 {index} \uC5F4\uAE30","bcf.components":"\uB204\uB77D\uB41C \uAD6C\uC131\uC694\uC18C: {missing}, \uBAA8\uD638\uD55C \uAD6C\uC131\uC694\uC18C: {ambiguous}","panel.timeliner":"4D \uC77C\uC815","panel.links":"\uB9C1\uD06C\uB41C \uD30C\uC77C","group.navigation":"\uD0D0\uC0C9","group.sections":"\uB2E8\uBA74","group.measure":"\uCE21\uC815","group.display":"\uD45C\uC2DC","group.view":"\uBDF0","tool.orbit":"\uADA4\uB3C4 \uD68C\uC804","tool.pan":"\uD654\uBA74 \uC774\uB3D9","tool.fit":"\uC804\uCCB4 \uB9DE\uCDA4","tool.projection":"\uC6D0\uADFC / \uC9C1\uAD50 \uD22C\uC601","tool.plane":"\uB2E8\uBA74 \uD3C9\uBA74","tool.box":"\uB2E8\uBA74 \uC0C1\uC790","tool.resetSections":"\uB2E8\uBA74 \uC7AC\uC124\uC815","tool.distance":"\uAC70\uB9AC","tool.displayMode":"\uD45C\uC2DC \uBAA8\uB4DC","tool.grids":"\uADF8\uB9AC\uB4DC","tool.opacity":"\uD22C\uBA85\uB3C4","tool.fullscreen":"\uC804\uCCB4 \uD654\uBA74",contextMenu:"\uC0C1\uD669\uC5D0 \uB9DE\uB294 \uBA54\uB274","menu.properties":"\uC18D\uC131","menu.hide":"\uC228\uAE30\uAE30","menu.isolate":"\uBD84\uB9AC","menu.showAll":"\uBAA8\uB450 \uD45C\uC2DC","menu.zoomTo":"\uAC1D\uCCB4\uB85C \uD655\uB300","menu.sectionBox":"\uAC1D\uCCB4\uB97C \uB458\uB7EC\uC2FC \uB2E8\uBA74 \uC0C1\uC790","menu.copyId":"ID \uBCF5\uC0AC","menu.fitAll":"\uC804\uCCB4 \uB9DE\uCDA4","menu.resetSections":"\uB2E8\uBA74 \uC7AC\uC124\uC815","menu.unavailable":"\uC774 \uBAA8\uB378\uC5D0\uC11C\uB294 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",searchPlaceholder:"\uC774\uB984, \uC720\uD615, ID\uB85C \uAC80\uC0C9\u2026",noCategory:"\uCE74\uD14C\uACE0\uB9AC \uC5C6\uC74C",noMatches:"\uC77C\uCE58\uD558\uB294 \uD56D\uBAA9 \uC5C6\uC74C","filters.title":"\uD544\uD130","filters.model":"\uC6D0\uBCF8 \uBAA8\uB378","filters.noLevel":"\uB808\uBCA8 \uC5C6\uC74C","filters.all":"\uBAA8\uB450","filters.clear":"\uC9C0\uC6B0\uAE30","filters.isolate":"\uC77C\uCE58 \uD56D\uBAA9 \uBD84\uB9AC",idCopied:"ID\uB97C \uBCF5\uC0AC\uD588\uC2B5\uB2C8\uB2E4",copyFailed:"ID\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",fullscreenUnavailable:"\uC804\uCCB4 \uD654\uBA74\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4","face.front":"\uC55E","face.back":"\uB4A4","face.left":"\uC67C\uCABD","face.right":"\uC624\uB978\uCABD","face.top":"\uC704","face.bottom":"\uC544\uB798","cube.title":"\uBDF0 \uD050\uBE0C","cube.up":"\uC704\uB85C \uD68C\uC804","cube.down":"\uC544\uB798\uB85C \uD68C\uC804","cube.left":"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804","cube.right":"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804","cube.home":"\uD648 \uBDF0","sections.mode":"\uB2E8\uBA74 \uBAA8\uB4DC","sections.planes":"\uD3C9\uBA74","sections.box":"\uC0C1\uC790","sections.off":"\uB054","sections.axis":"\uCD95","sections.addPlane":"\uD3C9\uBA74 \uCD94\uAC00","sections.noPlanes":"\uD3C9\uBA74 \uC5C6\uC74C","sections.rotated":"\uD68C\uC804\uB428","sections.custom":"\uC0AC\uC6A9\uC790 \uC9C0\uC815","sections.position":"\uD3C9\uBA74 \uC704\uCE58","sections.flip":"\uBC18\uB300\uCABD\uC73C\uB85C \uC804\uD658","sections.enabled":"\uCF2C","sections.delete":"\uD3C9\uBA74 \uC0AD\uC81C","sections.keepInside":"\uB0B4\uBD80 \uD45C\uC2DC","sections.cutInside":"\uB0B4\uBD80 \uC798\uB77C\uB0B4\uAE30","sections.fitSelection":"\uC120\uD0DD \uC601\uC5ED\uC5D0 \uB9DE\uCDA4","sections.showGizmo":"\uC870\uC791 \uD578\uB4E4 \uD45C\uC2DC","sections.boxYaw":"Z\uCD95 \uAE30\uC900 \uD68C\uC804","sections.fill":"\uC808\uB2E8\uBA74 \uCC44\uC6B0\uAE30","sections.fillUnavailable":"\uCC44\uC6B0\uB824\uBA74 WebGL \uC2A4\uD150\uC2E4 \uBC84\uD37C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4","sections.maxPlanes":"\uCD5C\uB300 \uD3C9\uBA74 6\uAC1C","unit.m":"m","display.materials":"\uC7AC\uC9C8","display.textures":"\uD14D\uC2A4\uCC98","display.white":"\uD770\uC0C9","display.wireframe":"\uC640\uC774\uC5B4\uD504\uB808\uC784","display.background":"\uBC30\uACBD\uC0C9","display.backgroundReset":"\uBC30\uACBD \uC7AC\uC124\uC815","opacity.label":"\uBD88\uD22C\uBA85\uB3C4","opacity.value":"{value}%","views.tour":"\uB458\uB7EC\uBCF4\uAE30 \uC7AC\uC0DD","views.stop":"\uB458\uB7EC\uBCF4\uAE30 \uC911\uC9C0","clash.New":"\uC0C8\uB85C \uCD94\uAC00\uB428","clash.Active":"\uD65C\uC131","clash.Reviewed":"\uAC80\uD1A0\uB428","clash.Approved":"\uC2B9\uC778\uB428","clash.Resolved":"\uD574\uACB0\uB428","task.construct":"\uC2DC\uACF5","task.demolish":"\uCCA0\uAC70","task.temporary":"\uC784\uC2DC","player.title":"4D \uD50C\uB808\uC774\uC5B4","player.play":"\uC7AC\uC0DD","player.pause":"\uC77C\uC2DC \uC815\uC9C0","player.date":"\uC77C\uC815 \uB0A0\uC9DC","player.speed":"\uC18D\uB3C4",truncated:"\uCD1D {total}\uAC1C \uC911 \uBA54\uC2DC {meshes}\uAC1C \uD45C\uC2DC. MaxMeshVertices \uC124\uC815\uC73C\uB85C \uBAA8\uB378\uC774 \uC798\uB838\uC2B5\uB2C8\uB2E4.",language:"\uC5B8\uC5B4",auto:"\uC790\uB3D9",model3d:"3D \uBAA8\uB378",retry:"\uB2E4\uC6B4\uB85C\uB4DC \uB2E4\uC2DC \uC2DC\uB3C4",finding:"\uC694\uC18C\uB97C \uCC3E\uB294 \uC911\u2026",streamLod:"{size} MiB \xB7 \uC804\uCCB4 \uC0C1\uC138 {shown}/{total}",streamMesh:"{size} MiB \xB7 \uD074\uB7EC\uC2A4\uD130 {visible} \xB7 \uC815\uBC00\uD654 \uC911 {fallback}",streamTiles:"\uC601\uC5ED {areas} \xB7 \uC0C1\uC138 {shown}/{total} \xB7 {size}/{limit} MiB"},"zh-Hans":{elements:"\u56FE\u5143",noGeometry:"\u6CA1\u6709\u51E0\u4F55\u56FE\u5F62",contextLost:"\u56FE\u5F62\u4E0A\u4E0B\u6587\u5DF2\u4E22\u5931\uFF0C\u8BF7\u91CD\u65B0\u52A0\u8F7D\u9875\u9762\u3002",noWebGL:"\u9700\u8981\u652F\u6301 WebGL 2 \u7684\u6D4F\u89C8\u5668",badData:"\u65E0\u6CD5\u8BFB\u53D6\u6A21\u578B\u6570\u636E",tooLarge:"\u6A21\u578B\u8FC7\u5927\uFF1A\u5171\u6709 {count} \u4E2A\u5E26\u51E0\u4F55\u56FE\u5F62\u7684\u5BF9\u8C61\uFF0C\u4E0A\u9650\u4E3A {limit}",selected:"\u5DF2\u9009",close:"\u5173\u95ED",elementGroup:"\u56FE\u5143",id:"ID",category:"\u7C7B\u522B",type:"\u7C7B\u578B",level:"\u6807\u9AD8",sourceId:"\u6E90 ID",link:"\u94FE\u63A5",panels:"\u9762\u677F","panel.model":"\u6A21\u578B","panel.views":"\u89C6\u56FE","panel.sections":"\u5256\u9762","panel.clashes":"\u78B0\u649E","panel.bcf":"BCF \u8BAE\u9898","bcf.noView":"\u6CA1\u6709\u53EF\u7528\u89C6\u56FE","bcf.viewpoint":"\u6253\u5F00\u89C6\u70B9 {index}","bcf.components":"\u7F3A\u5931\u6784\u4EF6\uFF1A{missing}\uFF0C\u5339\u914D\u4E0D\u660E\u786E\uFF1A{ambiguous}","panel.timeliner":"4D \u8FDB\u5EA6\u8BA1\u5212","panel.links":"\u94FE\u63A5\u6587\u4EF6","group.navigation":"\u5BFC\u822A","group.sections":"\u5256\u9762","group.measure":"\u6D4B\u91CF","group.display":"\u663E\u793A","group.view":"\u89C6\u56FE","tool.orbit":"\u73AF\u7ED5","tool.pan":"\u5E73\u79FB","tool.fit":"\u7F29\u653E\u81F3\u5168\u56FE","tool.projection":"\u900F\u89C6 / \u6B63\u4EA4","tool.plane":"\u5256\u5207\u5E73\u9762","tool.box":"\u5256\u9762\u6846","tool.resetSections":"\u91CD\u7F6E\u5256\u9762","tool.distance":"\u8DDD\u79BB","tool.displayMode":"\u663E\u793A\u6A21\u5F0F","tool.grids":"\u8F74\u7F51","tool.opacity":"\u900F\u660E\u5EA6","tool.fullscreen":"\u5168\u5C4F",contextMenu:"\u4E0A\u4E0B\u6587\u83DC\u5355","menu.properties":"\u5C5E\u6027","menu.hide":"\u9690\u85CF","menu.isolate":"\u9694\u79BB","menu.showAll":"\u663E\u793A\u5168\u90E8","menu.zoomTo":"\u7F29\u653E\u81F3\u5BF9\u8C61","menu.sectionBox":"\u56F4\u7ED5\u5BF9\u8C61\u521B\u5EFA\u5256\u9762\u6846","menu.copyId":"\u590D\u5236 ID","menu.fitAll":"\u7F29\u653E\u81F3\u5168\u56FE","menu.resetSections":"\u91CD\u7F6E\u5256\u9762","menu.unavailable":"\u6B64\u6A21\u578B\u4E0D\u652F\u6301\u6B64\u529F\u80FD",searchPlaceholder:"\u6309\u540D\u79F0\u3001\u7C7B\u578B\u6216 ID \u641C\u7D22\u2026",noCategory:"\u65E0\u7C7B\u522B",noMatches:"\u6CA1\u6709\u5339\u914D\u9879","filters.title":"\u7B5B\u9009\u5668","filters.model":"\u6E90\u6A21\u578B","filters.noLevel":"\u65E0\u6807\u9AD8","filters.all":"\u5168\u90E8","filters.clear":"\u6E05\u9664","filters.isolate":"\u9694\u79BB\u5339\u914D\u9879",idCopied:"\u5DF2\u590D\u5236 ID",copyFailed:"\u65E0\u6CD5\u590D\u5236 ID",fullscreenUnavailable:"\u65E0\u6CD5\u8FDB\u5165\u5168\u5C4F","face.front":"\u524D","face.back":"\u540E","face.left":"\u5DE6","face.right":"\u53F3","face.top":"\u4E0A","face.bottom":"\u4E0B","cube.title":"\u89C6\u56FE\u7ACB\u65B9\u4F53","cube.up":"\u5411\u4E0A\u65CB\u8F6C","cube.down":"\u5411\u4E0B\u65CB\u8F6C","cube.left":"\u5411\u5DE6\u65CB\u8F6C","cube.right":"\u5411\u53F3\u65CB\u8F6C","cube.home":"\u521D\u59CB\u89C6\u56FE","sections.mode":"\u5256\u9762\u6A21\u5F0F","sections.planes":"\u5E73\u9762","sections.box":"\u6846","sections.off":"\u5173","sections.axis":"\u8F74","sections.addPlane":"\u6DFB\u52A0\u5E73\u9762","sections.noPlanes":"\u65E0\u5E73\u9762","sections.rotated":"\u5DF2\u65CB\u8F6C","sections.custom":"\u81EA\u5B9A\u4E49","sections.position":"\u5E73\u9762\u4F4D\u7F6E","sections.flip":"\u53CD\u8F6C\u65B9\u5411","sections.enabled":"\u5F00","sections.delete":"\u5220\u9664\u5E73\u9762","sections.keepInside":"\u663E\u793A\u5185\u90E8","sections.cutInside":"\u88C1\u5207\u5185\u90E8","sections.fitSelection":"\u9002\u5E94\u9009\u533A","sections.showGizmo":"\u663E\u793A\u64CD\u7EB5\u5668","sections.boxYaw":"\u7ED5 Z \u8F74\u65CB\u8F6C","sections.fill":"\u586B\u5145\u5256\u5207\u9762","sections.fillUnavailable":"\u5256\u5207\u9762\u586B\u5145\u9700\u8981 WebGL \u6A21\u677F\u7F13\u51B2\u533A","sections.maxPlanes":"\u6700\u591A 6 \u4E2A\u5E73\u9762","unit.m":"\u7C73","display.materials":"\u6750\u8D28","display.textures":"\u7EB9\u7406","display.white":"\u767D\u8272","display.wireframe":"\u7EBF\u6846","display.background":"\u80CC\u666F\u989C\u8272","display.backgroundReset":"\u91CD\u7F6E\u80CC\u666F","opacity.label":"\u4E0D\u900F\u660E\u5EA6","opacity.value":"{value}%","views.tour":"\u64AD\u653E\u6F2B\u6E38","views.stop":"\u505C\u6B62\u6F2B\u6E38","clash.New":"\u65B0\u5EFA","clash.Active":"\u6D3B\u52A8","clash.Reviewed":"\u5DF2\u5BA1\u67E5","clash.Approved":"\u5DF2\u6279\u51C6","clash.Resolved":"\u5DF2\u89E3\u51B3","task.construct":"\u65BD\u5DE5","task.demolish":"\u62C6\u9664","task.temporary":"\u4E34\u65F6","player.title":"4D \u64AD\u653E\u5668","player.play":"\u64AD\u653E","player.pause":"\u6682\u505C","player.date":"\u8BA1\u5212\u65E5\u671F","player.speed":"\u901F\u5EA6",truncated:"\u663E\u793A {meshes}/{total} \u4E2A\u7F51\u683C\uFF0C\u6A21\u578B\u53D7 MaxMeshVertices \u8BBE\u7F6E\u9650\u5236\u3002",language:"\u8BED\u8A00",auto:"\u81EA\u52A8",model3d:"3D \u6A21\u578B",retry:"\u91CD\u8BD5\u4E0B\u8F7D",finding:"\u6B63\u5728\u67E5\u627E\u56FE\u5143\u2026",streamLod:"{size} MiB \xB7 \u5B8C\u6574\u7EC6\u8282 {shown}/{total}",streamMesh:"{size} MiB \xB7 \u7C07 {visible} \xB7 \u6B63\u5728\u7EC6\u5316 {fallback}",streamTiles:"\u533A\u57DF {areas} \xB7 \u7EC6\u8282 {shown}/{total} \xB7 {size}/{limit} MiB"},"zh-Hant":{elements:"\u5716\u5143",noGeometry:"\u6C92\u6709\u5E7E\u4F55\u5716\u5F62",contextLost:"\u5716\u5F62\u74B0\u5883\u5DF2\u907A\u5931\uFF0C\u8ACB\u91CD\u65B0\u8F09\u5165\u9801\u9762\u3002",noWebGL:"\u9700\u8981\u652F\u63F4 WebGL 2 \u7684\u700F\u89BD\u5668",badData:"\u7121\u6CD5\u8B80\u53D6\u6A21\u578B\u8CC7\u6599",tooLarge:"\u6A21\u578B\u904E\u5927\uFF1A\u5171\u6709 {count} \u500B\u5E36\u5E7E\u4F55\u5716\u5F62\u7684\u7269\u4EF6\uFF0C\u4E0A\u9650\u70BA {limit}",selected:"\u5DF2\u9078\u53D6",close:"\u95DC\u9589",elementGroup:"\u5716\u5143",id:"ID",category:"\u985E\u5225",type:"\u985E\u578B",level:"\u6A13\u5C64",sourceId:"\u4F86\u6E90 ID",link:"\u9023\u7D50",panels:"\u9762\u677F","panel.model":"\u6A21\u578B","panel.views":"\u8996\u5716","panel.sections":"\u5256\u9762","panel.clashes":"\u78B0\u649E","panel.bcf":"BCF \u8B70\u984C","bcf.noView":"\u6C92\u6709\u53EF\u7528\u8996\u5716","bcf.viewpoint":"\u958B\u555F\u8996\u9EDE {index}","bcf.components":"\u7F3A\u5C11\u5143\u4EF6\uFF1A{missing}\uFF0C\u7121\u6CD5\u78BA\u5B9A\uFF1A{ambiguous}","panel.timeliner":"4D \u6392\u7A0B","panel.links":"\u9023\u7D50\u6A94\u6848","group.navigation":"\u5C0E\u89BD","group.sections":"\u5256\u9762","group.measure":"\u6E2C\u91CF","group.display":"\u986F\u793A","group.view":"\u8996\u5716","tool.orbit":"\u74B0\u7E5E","tool.pan":"\u5E73\u79FB","tool.fit":"\u7E2E\u653E\u81F3\u5168\u5716","tool.projection":"\u900F\u8996 / \u6B63\u4EA4","tool.plane":"\u5256\u5207\u5E73\u9762","tool.box":"\u5256\u9762\u6846","tool.resetSections":"\u91CD\u8A2D\u5256\u9762","tool.distance":"\u8DDD\u96E2","tool.displayMode":"\u986F\u793A\u6A21\u5F0F","tool.grids":"\u8EF8\u7DB2","tool.opacity":"\u900F\u660E\u5EA6","tool.fullscreen":"\u5168\u87A2\u5E55",contextMenu:"\u5167\u5BB9\u9078\u55AE","menu.properties":"\u5C6C\u6027","menu.hide":"\u96B1\u85CF","menu.isolate":"\u9694\u96E2","menu.showAll":"\u986F\u793A\u5168\u90E8","menu.zoomTo":"\u7E2E\u653E\u81F3\u7269\u4EF6","menu.sectionBox":"\u74B0\u7E5E\u7269\u4EF6\u5EFA\u7ACB\u5256\u9762\u6846","menu.copyId":"\u8907\u88FD ID","menu.fitAll":"\u7E2E\u653E\u81F3\u5168\u5716","menu.resetSections":"\u91CD\u8A2D\u5256\u9762","menu.unavailable":"\u6B64\u6A21\u578B\u4E0D\u652F\u63F4\u6B64\u529F\u80FD",searchPlaceholder:"\u4F9D\u540D\u7A31\u3001\u985E\u578B\u6216 ID \u641C\u5C0B\u2026",noCategory:"\u7121\u985E\u5225",noMatches:"\u6C92\u6709\u7B26\u5408\u9805\u76EE","filters.title":"\u7BE9\u9078\u5668","filters.model":"\u4F86\u6E90\u6A21\u578B","filters.noLevel":"\u7121\u6A13\u5C64","filters.all":"\u5168\u90E8","filters.clear":"\u6E05\u9664","filters.isolate":"\u9694\u96E2\u7B26\u5408\u9805\u76EE",idCopied:"\u5DF2\u8907\u88FD ID",copyFailed:"\u7121\u6CD5\u8907\u88FD ID",fullscreenUnavailable:"\u7121\u6CD5\u9032\u5165\u5168\u87A2\u5E55","face.front":"\u524D","face.back":"\u5F8C","face.left":"\u5DE6","face.right":"\u53F3","face.top":"\u4E0A","face.bottom":"\u4E0B","cube.title":"\u8996\u5716\u7ACB\u65B9\u9AD4","cube.up":"\u5411\u4E0A\u65CB\u8F49","cube.down":"\u5411\u4E0B\u65CB\u8F49","cube.left":"\u5411\u5DE6\u65CB\u8F49","cube.right":"\u5411\u53F3\u65CB\u8F49","cube.home":"\u521D\u59CB\u8996\u5716","sections.mode":"\u5256\u9762\u6A21\u5F0F","sections.planes":"\u5E73\u9762","sections.box":"\u6846","sections.off":"\u95DC","sections.axis":"\u8EF8","sections.addPlane":"\u65B0\u589E\u5E73\u9762","sections.noPlanes":"\u7121\u5E73\u9762","sections.rotated":"\u5DF2\u65CB\u8F49","sections.custom":"\u81EA\u8A02","sections.position":"\u5E73\u9762\u4F4D\u7F6E","sections.flip":"\u53CD\u8F49\u65B9\u5411","sections.enabled":"\u958B","sections.delete":"\u522A\u9664\u5E73\u9762","sections.keepInside":"\u986F\u793A\u5167\u90E8","sections.cutInside":"\u88C1\u5207\u5167\u90E8","sections.fitSelection":"\u914D\u5408\u9078\u53D6\u7BC4\u570D","sections.showGizmo":"\u986F\u793A\u64CD\u63A7\u5668","sections.boxYaw":"\u7E5E Z \u8EF8\u65CB\u8F49","sections.fill":"\u586B\u6EFF\u5256\u5207\u9762","sections.fillUnavailable":"\u5256\u5207\u9762\u586B\u6EFF\u9700\u8981 WebGL \u6A21\u677F\u7DE9\u885D\u5340","sections.maxPlanes":"\u6700\u591A 6 \u500B\u5E73\u9762","unit.m":"\u516C\u5C3A","display.materials":"\u6750\u8CEA","display.textures":"\u7D0B\u7406","display.white":"\u767D\u8272","display.wireframe":"\u7DDA\u6846","display.background":"\u80CC\u666F\u8272\u5F69","display.backgroundReset":"\u91CD\u8A2D\u80CC\u666F","opacity.label":"\u4E0D\u900F\u660E\u5EA6","opacity.value":"{value}%","views.tour":"\u64AD\u653E\u6F2B\u904A","views.stop":"\u505C\u6B62\u6F2B\u904A","clash.New":"\u65B0\u589E","clash.Active":"\u555F\u7528","clash.Reviewed":"\u5DF2\u5BE9\u67E5","clash.Approved":"\u5DF2\u6838\u51C6","clash.Resolved":"\u5DF2\u89E3\u6C7A","task.construct":"\u65BD\u5DE5","task.demolish":"\u62C6\u9664","task.temporary":"\u81E8\u6642","player.title":"4D \u64AD\u653E\u5668","player.play":"\u64AD\u653E","player.pause":"\u66AB\u505C","player.date":"\u6392\u7A0B\u65E5\u671F","player.speed":"\u901F\u5EA6",truncated:"\u986F\u793A {total} \u500B\u7DB2\u683C\u4E2D\u7684 {meshes} \u500B\u3002\u6A21\u578B\u53D7 MaxMeshVertices \u8A2D\u5B9A\u9650\u5236\u3002",language:"\u8A9E\u8A00",auto:"\u81EA\u52D5",model3d:"3D \u6A21\u578B",retry:"\u91CD\u8A66\u4E0B\u8F09",finding:"\u6B63\u5728\u5C0B\u627E\u5716\u5143\u2026",streamLod:"{size} MiB \xB7 \u5B8C\u6574\u7D30\u7BC0 {shown}/{total}",streamMesh:"{size} MiB \xB7 \u53E2\u96C6 {visible} \xB7 \u6B63\u5728\u7D30\u5316 {fallback}",streamTiles:"\u5340\u57DF {areas} \xB7 \u7D30\u7BC0 {shown}/{total} \xB7 {size}/{limit} MiB"}};var Jf={...Kf,ru:{elements:"\u042D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432",noGeometry:"\u041D\u0435\u0442 \u0433\u0435\u043E\u043C\u0435\u0442\u0440\u0438\u0438",contextLost:"\u0412\u0438\u0434\u0435\u043E\u043A\u0430\u0440\u0442\u0430 \u0441\u0431\u0440\u043E\u0448\u0435\u043D\u0430 \u2014 \u043F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443",noWebGL:"\u041D\u0443\u0436\u0435\u043D \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0441 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u043E\u0439 WebGL 2",badData:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u043C\u043E\u0434\u0435\u043B\u0438",tooLarge:"\u041C\u043E\u0434\u0435\u043B\u044C \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u0430\u044F \u0434\u043B\u044F \u044D\u0442\u043E\u0433\u043E \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0449\u0438\u043A\u0430: \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432 \u0441 \u0433\u0435\u043E\u043C\u0435\u0442\u0440\u0438\u0435\u0439 \u2014 {count}, \u043F\u0440\u0435\u0434\u0435\u043B \u2014 {limit}",selected:"\u0412\u044B\u0431\u0440\u0430\u043D\u043E",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C","scanMap.title":"\u041C\u0438\u043D\u0438\u043A\u0430\u0440\u0442\u0430","scanMap.plan":"\u041F\u043B\u0430\u043D \u043E\u0431\u043B\u0430\u043A\u0430 \u0442\u043E\u0447\u0435\u043A","scanMap.metres":"\u043C","scanMap.choosePhoto":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0444\u043E\u0442\u043E\u043F\u0430\u043D\u043E\u0440\u0430\u043C\u0443\u2026","scanMap.spheres":"\u0421\u0444\u0435\u0440\u044B \u043F\u0430\u043D\u043E\u0440\u0430\u043C \u0432 3D","scanMap.photo":"\u0424\u043E\u0442\u043E\u043F\u0430\u043D\u043E\u0440\u0430\u043C\u0430","scanMap.intensity":"\u0418\u043D\u0442\u0435\u043D\u0441\u0438\u0432\u043D\u043E\u0441\u0442\u044C","scanMap.goToStation":"\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u043A \u0441\u0442\u0430\u043D\u0446\u0438\u0438 {name}","scanMap.photoControls":"\u0424\u043E\u0442\u043E\u043F\u0430\u043D\u043E\u0440\u0430\u043C\u0430. \u0421\u0442\u0440\u0435\u043B\u043A\u0438 \u043F\u043E\u0432\u043E\u0440\u0430\u0447\u0438\u0432\u0430\u044E\u0442 \u043A\u0430\u043C\u0435\u0440\u0443, \u043A\u043E\u043B\u0435\u0441\u043E \u043C\u0435\u043D\u044F\u0435\u0442 \u043C\u0430\u0441\u0448\u0442\u0430\u0431.","scanMap.loading":"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0444\u043E\u0442\u043E\u0433\u0440\u0430\u0444\u0438\u0438\u2026","scanMap.photoError":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0441\u0444\u0435\u0440\u0438\u0447\u0435\u0441\u043A\u0443\u044E \u0444\u043E\u0442\u043E\u0433\u0440\u0430\u0444\u0438\u044E.","scanMap.enlargePhoto":"\u0423\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C","scanMap.shrinkPhoto":"\u0423\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C","scanMap.size":"\u0420\u0430\u0437\u043C\u0435\u0440 \u043C\u0438\u043D\u0438\u043A\u0430\u0440\u0442\u044B","scanMap.small":"\u041C\u0430\u043B\u0430\u044F","scanMap.medium":"\u0421\u0440\u0435\u0434\u043D\u044F\u044F","scanMap.large":"\u0411\u043E\u043B\u044C\u0448\u0430\u044F","scanMap.zoomIn":"\u041F\u0440\u0438\u0431\u043B\u0438\u0437\u0438\u0442\u044C \u043C\u0438\u043D\u0438\u043A\u0430\u0440\u0442\u0443","scanMap.zoomOut":"\u041E\u0442\u0434\u0430\u043B\u0438\u0442\u044C \u043C\u0438\u043D\u0438\u043A\u0430\u0440\u0442\u0443","scanMap.reset":"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0432\u0435\u0441\u044C \u043F\u043B\u0430\u043D","scanMap.levels":"\u0423\u0440\u043E\u0432\u043D\u0438 \u043C\u0438\u043D\u0438\u043A\u0430\u0440\u0442\u044B","scanMap.allLevels":"\u0412\u0441\u0435 \u0432\u044B\u0441\u043E\u0442\u044B","scanMap.level":"\u0423\u0440\u043E\u0432\u0435\u043D\u044C {n}","scanMap.addLevel":"\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0443\u0440\u043E\u0432\u0435\u043D\u044C \u043F\u043E \u043F\u0430\u043D\u043E\u0440\u0430\u043C\u0435","scanMap.removeLevel":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0439 \u0443\u0440\u043E\u0432\u0435\u043D\u044C","scanMap.autoButton":"\u0410\u0432\u0442\u043E","scanMap.autoLevels":"\u041E\u043F\u0440\u0435\u0434\u0435\u043B\u0438\u0442\u044C \u0443\u0440\u043E\u0432\u043D\u0438 \u043F\u043E \u0432\u044B\u0441\u043E\u0442\u0430\u043C \u0441\u0442\u0430\u043D\u0446\u0438\u0439","scanMap.noLevels":"\u041D\u0435\u0442 \u044F\u0432\u043D\u043E \u0440\u0430\u0437\u0434\u0435\u043B\u0451\u043D\u043D\u044B\u0445 \u0433\u0440\u0443\u043F\u043F \u0441\u0442\u0430\u043D\u0446\u0438\u0439 \u043F\u043E \u0432\u044B\u0441\u043E\u0442\u0435.","scanMap.levelsAdded":"\u0423\u0440\u043E\u0432\u043D\u0438 \u043F\u043E \u0432\u044B\u0441\u043E\u0442\u0430\u043C \u0441\u0442\u0430\u043D\u0446\u0438\u0439 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u044B.","scanMap.levelsExist":"\u042D\u0442\u0438 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D\u044B \u0443\u0436\u0435 \u043E\u0445\u0432\u0430\u0447\u0435\u043D\u044B \u0443\u0440\u043E\u0432\u043D\u044F\u043C\u0438.","scanMap.levelAdded":"\u0423\u0440\u043E\u0432\u0435\u043D\u044C \u0441\u043E\u0437\u0434\u0430\u043D.","scanMap.levelTemporary":"\u0423\u0440\u043E\u0432\u043D\u0438 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B \u0434\u043E \u0437\u0430\u043A\u0440\u044B\u0442\u0438\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B.","scanMap.cancel":"\u041E\u0442\u043C\u0435\u043D\u0430","scanMap.pickLower":"\u0429\u0451\u043B\u043A\u043D\u0438\u0442\u0435 \u043F\u043E \u043D\u0438\u0436\u043D\u0435\u0439 \u043E\u0442\u043C\u0435\u0442\u043A\u0435 \u0443\u0440\u043E\u0432\u043D\u044F.","scanMap.pickUpper":"\u041D\u0438\u0437 {z}. \u0422\u0435\u043F\u0435\u0440\u044C \u0449\u0451\u043B\u043A\u043D\u0438\u0442\u0435 \u043F\u043E \u0432\u0435\u0440\u0445\u043D\u0435\u0439 \u043E\u0442\u043C\u0435\u0442\u043A\u0435.","scanMap.noLowerHit":"\u041D\u0430 \u043B\u0443\u0447\u0435 \u043D\u0435\u0442 \u0442\u043E\u0447\u0435\u043A \u043E\u0431\u043B\u0430\u043A\u0430. \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0438\u0436\u043D\u044E\u044E \u043E\u0442\u043C\u0435\u0442\u043A\u0443 \u0440\u044F\u0434\u043E\u043C.","scanMap.noUpperHit":"\u041D\u0430 \u043B\u0443\u0447\u0435 \u043D\u0435\u0442 \u0442\u043E\u0447\u0435\u043A \u043E\u0431\u043B\u0430\u043A\u0430. \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0435\u0440\u0445\u043D\u044E\u044E \u043E\u0442\u043C\u0435\u0442\u043A\u0443 \u0440\u044F\u0434\u043E\u043C.","scanMap.upperAboveLower":"\u0412\u0435\u0440\u0445\u043D\u044F\u044F \u043E\u0442\u043C\u0435\u0442\u043A\u0430 \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u0432\u044B\u0448\u0435 {z}.",elementGroup:"\u042D\u043B\u0435\u043C\u0435\u043D\u0442",id:"Id",category:"\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F",type:"\u0422\u0438\u043F",level:"\u0423\u0440\u043E\u0432\u0435\u043D\u044C",sourceId:"ID \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u0430",link:"\u0421\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0439 \u0444\u0430\u0439\u043B",panels:"\u041F\u0430\u043D\u0435\u043B\u0438","panel.model":"\u041C\u043E\u0434\u0435\u043B\u044C","panel.elements":"\u0422\u0430\u0431\u043B\u0438\u0446\u0430 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432","csv.open":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C CSV \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432","csv.download":"\u0421\u043A\u0430\u0447\u0430\u0442\u044C CSV","csv.choose":"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 CSV, \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0432\u043C\u0435\u0441\u0442\u0435 \u0441 \u044D\u0442\u043E\u0439 \u043C\u043E\u0434\u0435\u043B\u044C\u044E.","csv.loading":"\u0427\u0442\u0435\u043D\u0438\u0435 CSV\u2026","csv.loaded":"{file} \xB7 \u0421\u0432\u044F\u0437\u0430\u043D\u043E \u0441 3D: {matched} \u0438\u0437 {total}","csv.noMatch":"{file} \xB7 \u041D\u0435\u0442 \u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u0439. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435, \u0447\u0442\u043E CSV \u043E\u0442\u043D\u043E\u0441\u0438\u0442\u0441\u044F \u043A \u044D\u0442\u043E\u0439 \u043C\u043E\u0434\u0435\u043B\u0438.","csv.conflicts":"\u0418\u0441\u043A\u043B\u044E\u0447\u0435\u043D\u043E \u0441\u0442\u0440\u043E\u043A \u0438\u0437-\u0437\u0430 \u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442\u0430 uniqueId: {count}. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435, \u0447\u0442\u043E \u0444\u0430\u0439\u043B\u044B \u043E\u0442\u043D\u043E\u0441\u044F\u0442\u0441\u044F \u043A \u043E\u0434\u043D\u043E\u0439 \u043C\u043E\u0434\u0435\u043B\u0438.","csv.invalid":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C CSV. \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0430\u0431\u043B\u0438\u0446\u0443 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 RvtIO \u0441 \u0443\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u043C elementId.","csv.noGeometry":"\u0423 \u044D\u0442\u043E\u0433\u043E \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430 \u043D\u0435\u0442 \u0433\u0435\u043E\u043C\u0435\u0442\u0440\u0438\u0438 \u0432 \u043C\u043E\u0434\u0435\u043B\u0438.","csv.search":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E ID \u0438 \u0438\u043C\u0435\u043D\u0438","csv.searchPlaceholder":"ID \u0438\u043B\u0438 \u0438\u043C\u044F","csv.allCategories":"\u0412\u0441\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438","csv.groupByCategory":"\u0413\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u043E \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F\u043C","csv.categoryTotals":"\u0418\u0442\u043E\u0433\u0438 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438","csv.totals":"\u0418\u0442\u043E\u0433\u0438 \u0432\u044B\u0431\u043E\u0440\u043A\u0438","csv.quantity.length_m":"\u0414\u043B\u0438\u043D\u0430","csv.quantity.area_m2":"\u041F\u043B\u043E\u0449\u0430\u0434\u044C","csv.quantity.volume_m3":"\u041E\u0431\u044A\u0451\u043C","csv.unit.length_m":"\u043C","csv.unit.area_m2":"\u043C\xB2","csv.unit.volume_m3":"\u043C\xB3","csv.outsideFilters":"\u0412\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0439 \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u0432\u043D\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u0430.","csv.noResults":"\u041F\u043E\u0434\u0445\u043E\u0434\u044F\u0449\u0438\u0445 \u0441\u0442\u0440\u043E\u043A \u043D\u0435\u0442.","csv.previous":"\u041D\u0430\u0437\u0430\u0434","csv.next":"\u0414\u0430\u043B\u0435\u0435","csv.range":"{first}\u2013{last} \u0438\u0437 {total}","panel.views":"\u0412\u0438\u0434\u044B","panel.sections":"\u0421\u0435\u0447\u0435\u043D\u0438\u044F","panel.clashes":"\u041A\u043E\u043B\u043B\u0438\u0437\u0438\u0438","panel.bcf":"\u0422\u0435\u043C\u044B BCF","bcf.noView":"\u041D\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E\u0433\u043E \u0432\u0438\u0434\u0430","bcf.viewpoint":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0432\u0438\u0434 {index}","bcf.components":"\u041D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u043E\u0432 \u2014 {missing}, \u043D\u0435\u043E\u0434\u043D\u043E\u0437\u043D\u0430\u0447\u043D\u044B\u0445 \u2014 {ambiguous}","panel.timeliner":"4D-\u0433\u0440\u0430\u0444\u0438\u043A","panel.links":"\u0421\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0435 \u0444\u0430\u0439\u043B\u044B","group.navigation":"\u041D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044F","group.sections":"\u0421\u0435\u0447\u0435\u043D\u0438\u044F","group.measure":"\u0418\u0437\u043C\u0435\u0440\u0435\u043D\u0438\u044F","group.display":"\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435","group.view":"\u0412\u0438\u0434","tool.orbit":"\u0412\u0440\u0430\u0449\u0435\u043D\u0438\u0435","tool.pan":"\u041F\u0430\u043D\u043E\u0440\u0430\u043C\u0430","tool.fit":"\u0412\u043F\u0438\u0441\u0430\u0442\u044C \u0432\u0441\u0451","tool.projection":"\u041F\u0435\u0440\u0441\u043F\u0435\u043A\u0442\u0438\u0432\u0430 / \u043E\u0440\u0442\u043E\u0433\u0440\u0430\u0444\u0438\u044F","tool.mode2d":"\u0420\u0435\u0436\u0438\u043C 2D / 3D","sheets.label":"\u041B\u0438\u0441\u0442\u044B \u0438 \u043F\u0440\u043E\u0441\u0442\u0440\u0430\u043D\u0441\u0442\u0432\u043E \u043C\u043E\u0434\u0435\u043B\u0438","tool.plane":"\u041F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u044C \u0441\u0435\u0447\u0435\u043D\u0438\u044F","tool.box":"\u0411\u043E\u043A\u0441 \u0441\u0435\u0447\u0435\u043D\u0438\u044F","tool.resetSections":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0441\u0435\u0447\u0435\u043D\u0438\u044F","tool.distance":"\u0420\u0430\u0441\u0441\u0442\u043E\u044F\u043D\u0438\u0435","tool.displayMode":"\u0420\u0435\u0436\u0438\u043C \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F","tool.grids":"\u041E\u0441\u0438","tool.opacity":"\u041F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u043E\u0441\u0442\u044C","tool.fullscreen":"\u041F\u043E\u043B\u043D\u044B\u0439 \u044D\u043A\u0440\u0430\u043D",contextMenu:"\u041A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u043D\u043E\u0435 \u043C\u0435\u043D\u044E","menu.properties":"\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u0430","menu.hide":"\u0421\u043A\u0440\u044B\u0442\u044C","menu.isolate":"\u0418\u0437\u043E\u043B\u0438\u0440\u043E\u0432\u0430\u0442\u044C","menu.showAll":"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0432\u0441\u0451","menu.zoomTo":"\u041F\u0440\u0438\u0431\u043B\u0438\u0437\u0438\u0442\u044C \u043A \u043E\u0431\u044A\u0435\u043A\u0442\u0443","menu.sectionBox":"\u0411\u043E\u043A\u0441 \u0441\u0435\u0447\u0435\u043D\u0438\u044F \u043F\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u0443","menu.copyId":"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C Id","menu.fitAll":"\u0412\u043F\u0438\u0441\u0430\u0442\u044C \u0432\u0441\u0451","menu.resetSections":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0441\u0435\u0447\u0435\u043D\u0438\u044F","menu.unavailable":"\u041D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u0434\u043B\u044F \u044D\u0442\u043E\u0439 \u043C\u043E\u0434\u0435\u043B\u0438",searchPlaceholder:"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0438\u043C\u0435\u043D\u0438, \u0442\u0438\u043F\u0443, Id\u2026",noCategory:"\u0411\u0435\u0437 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438",noMatches:"\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E","filters.title":"\u0424\u0438\u043B\u044C\u0442\u0440\u044B","filters.model":"\u041C\u043E\u0434\u0435\u043B\u044C-\u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A","filters.noLevel":"\u0411\u0435\u0437 \u0443\u0440\u043E\u0432\u043D\u044F","filters.all":"\u0412\u0441\u0435","filters.clear":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C","filters.isolate":"\u0418\u0437\u043E\u043B\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u044F",idCopied:"Id \u0441\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D",copyFailed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C Id",fullscreenUnavailable:"\u041F\u043E\u043B\u043D\u043E\u044D\u043A\u0440\u0430\u043D\u043D\u044B\u0439 \u0440\u0435\u0436\u0438\u043C \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D","face.front":"\u0421\u043F\u0435\u0440\u0435\u0434\u0438","face.back":"\u0421\u0437\u0430\u0434\u0438","face.left":"\u0421\u043B\u0435\u0432\u0430","face.right":"\u0421\u043F\u0440\u0430\u0432\u0430","face.top":"\u0421\u0432\u0435\u0440\u0445\u0443","face.bottom":"\u0421\u043D\u0438\u0437\u0443","cube.title":"\u041A\u0443\u0431 \u0432\u0438\u0434\u0430","cube.up":"\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u0432\u0435\u0440\u0445","cube.down":"\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u043D\u0438\u0437","cube.left":"\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u043B\u0435\u0432\u043E","cube.right":"\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u043F\u0440\u0430\u0432\u043E","cube.home":"\u0418\u0441\u0445\u043E\u0434\u043D\u044B\u0439 \u0432\u0438\u0434","sections.mode":"\u0420\u0435\u0436\u0438\u043C \u0441\u0435\u0447\u0435\u043D\u0438\u044F","sections.planes":"\u041F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u0438","sections.box":"\u0411\u043E\u043A\u0441","sections.off":"\u0412\u044B\u043A\u043B","sections.axis":"\u041E\u0441\u044C","sections.addPlane":"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u044C","sections.noPlanes":"\u041F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u0435\u0439 \u043D\u0435\u0442","sections.rotated":"\u043F\u043E\u0432\u0451\u0440\u043D\u0443\u0442\u0430","sections.custom":"\u041F\u0440\u043E\u0438\u0437\u0432\u043E\u043B\u044C\u043D\u0430\u044F","sections.position":"\u041F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u043F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u0438","sections.flip":"\u0421\u043C\u0435\u043D\u0438\u0442\u044C \u0441\u0442\u043E\u0440\u043E\u043D\u0443","sections.enabled":"\u0412\u043A\u043B","sections.delete":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u044C","sections.keepInside":"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0432\u043D\u0443\u0442\u0440\u0438","sections.cutInside":"\u0412\u044B\u0440\u0435\u0437\u0430\u0442\u044C \u0432\u043D\u0443\u0442\u0440\u0438","sections.fitSelection":"\u041F\u043E \u0432\u044B\u0434\u0435\u043B\u0435\u043D\u043D\u043E\u043C\u0443","sections.showGizmo":"\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u043C\u0430\u043D\u0438\u043F\u0443\u043B\u044F\u0442\u043E\u0440","sections.boxYaw":"\u041F\u043E\u0432\u043E\u0440\u043E\u0442 \u0432\u043E\u043A\u0440\u0443\u0433 Z","sections.fill":"\u0417\u0430\u043B\u0438\u0432\u043A\u0430 \u0441\u0440\u0435\u0437\u043E\u0432","sections.fillUnavailable":"\u0417\u0430\u043B\u0438\u0432\u043A\u0430 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0431\u0435\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u0442\u0440\u0430\u0444\u0430\u0440\u0435\u0442\u0430 WebGL","sections.fillNeedsMeshes":"\u0414\u043B\u044F \u0437\u0430\u043B\u0438\u0432\u043A\u0438 \u0441\u0435\u0447\u0435\u043D\u0438\u0439 \u043D\u0443\u0436\u043D\u0430 \u0437\u0430\u043C\u043A\u043D\u0443\u0442\u0430\u044F \u043F\u043E\u043B\u0438\u0433\u043E\u043D\u0430\u043B\u044C\u043D\u0430\u044F \u0433\u0435\u043E\u043C\u0435\u0442\u0440\u0438\u044F","sections.maxPlanes":"\u041D\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 6 \u043F\u043B\u043E\u0441\u043A\u043E\u0441\u0442\u0435\u0439","unit.m":"\u043C","display.materials":"\u041C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u044B","display.textures":"\u0422\u0435\u043A\u0441\u0442\u0443\u0440\u044B","display.white":"\u0411\u0435\u043B\u044B\u0439","display.wireframe":"\u041A\u0430\u0440\u043A\u0430\u0441","display.background":"\u0426\u0432\u0435\u0442 \u0444\u043E\u043D\u0430","display.backgroundReset":"\u0424\u043E\u043D \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E","display.bgCadDark":"CAD \u0442\u0451\u043C\u043D\u044B\u0439","display.bgPaper":"\u041B\u0438\u0441\u0442 \u0431\u0435\u043B\u044B\u0439","opacity.label":"\u041D\u0435\u043F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u043E\u0441\u0442\u044C","opacity.value":"{value} %","views.tour":"\u0422\u0443\u0440 \u043F\u043E \u0432\u0438\u0434\u0430\u043C","views.stop":"\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0442\u0443\u0440","clash.New":"\u041D\u043E\u0432\u0430\u044F","clash.Active":"\u0410\u043A\u0442\u0438\u0432\u043D\u0430\u044F","clash.Reviewed":"\u041F\u0440\u043E\u0432\u0435\u0440\u0435\u043D\u0430","clash.Approved":"\u0423\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0430","clash.Resolved":"\u0423\u0441\u0442\u0440\u0430\u043D\u0435\u043D\u0430","task.construct":"\u0421\u0442\u0440\u043E\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u043E","task.demolish":"\u0421\u043D\u043E\u0441","task.temporary":"\u0412\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0435","player.title":"4D-\u043F\u0440\u043E\u0438\u0433\u0440\u044B\u0432\u0430\u0442\u0435\u043B\u044C","player.play":"\u0412\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0441\u0442\u0438","player.pause":"\u041F\u0430\u0443\u0437\u0430","player.date":"\u0414\u0430\u0442\u0430 \u0433\u0440\u0430\u0444\u0438\u043A\u0430","player.speed":"\u0421\u043A\u043E\u0440\u043E\u0441\u0442\u044C",truncated:"\u041F\u043E\u043A\u0430\u0437\u0430\u043D\u043E {meshes} \u0438\u0437 {total} \u043C\u0435\u0448\u0435\u0439: \u043C\u043E\u0434\u0435\u043B\u044C \u043E\u0431\u0440\u0435\u0437\u0430\u043D\u0430 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u043E\u0439 MaxMeshVertices",language:"\u042F\u0437\u044B\u043A",auto:"\u0410\u0432\u0442\u043E",model3d:"3D-\u043C\u043E\u0434\u0435\u043B\u044C",retry:"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443",finding:"\u041F\u043E\u0438\u0441\u043A \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u2026",streamLod:"{size} \u041C\u0438\u0411 \xB7 \u0442\u043E\u0447\u043D\u0430\u044F \u0433\u0435\u043E\u043C\u0435\u0442\u0440\u0438\u044F {shown}/{total}",streamMesh:"{size} \u041C\u0438\u0411 \xB7 \u041A\u043B\u0430\u0441\u0442\u0435\u0440\u043E\u0432 {visible} \xB7 \u0423\u0442\u043E\u0447\u043D\u044F\u0435\u0442\u0441\u044F {fallback}",streamTiles:"\u0423\u0447\u0430\u0441\u0442\u043A\u043E\u0432 {areas} \xB7 \u0414\u0435\u0442\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F {shown}/{total} \xB7 {size}/{limit} \u041C\u0438\u0411"},en:{elements:"Elements",noGeometry:"No geometry",contextLost:"The graphics context was lost \u2014 reload the page",noWebGL:"This page needs a browser with WebGL 2",badData:"The model data could not be read",tooLarge:"The model is too large for this viewer: {count} objects with geometry, the limit is {limit}",selected:"Selected",close:"Close","scanMap.title":"Minimap","scanMap.plan":"Point cloud floor plan","scanMap.metres":"m","scanMap.choosePhoto":"Open photo panorama\u2026","scanMap.spheres":"Panorama spheres in 3D","scanMap.photo":"Photo panorama","scanMap.intensity":"Intensity","scanMap.goToStation":"Move to station {name}","scanMap.photoControls":"Photo panorama. Arrow keys turn the camera, the wheel zooms.","scanMap.loading":"Loading photograph\u2026","scanMap.photoError":"Could not open the spherical photograph.","scanMap.enlargePhoto":"Enlarge","scanMap.shrinkPhoto":"Restore size","scanMap.size":"Minimap size","scanMap.small":"Small","scanMap.medium":"Medium","scanMap.large":"Large","scanMap.zoomIn":"Zoom in on minimap","scanMap.zoomOut":"Zoom out on minimap","scanMap.reset":"Fit the whole plan","scanMap.levels":"Minimap levels","scanMap.allLevels":"All heights","scanMap.level":"Level {n}","scanMap.addLevel":"Create level from panorama","scanMap.removeLevel":"Remove selected level","scanMap.autoButton":"Auto","scanMap.autoLevels":"Detect levels by station height","scanMap.noLevels":"Station heights have no clear groups.","scanMap.levelsAdded":"Levels added from station heights.","scanMap.levelsExist":"Existing levels already cover these height ranges.","scanMap.levelAdded":"Level created.","scanMap.levelTemporary":"Levels will stay available until you close this page.","scanMap.cancel":"Cancel","scanMap.pickLower":"Click the lower level elevation.","scanMap.pickUpper":"Lower elevation {z}. Now click the upper elevation.","scanMap.noLowerHit":"No scan points along that ray. Choose a nearby lower elevation.","scanMap.noUpperHit":"No scan points along that ray. Choose a nearby upper elevation.","scanMap.upperAboveLower":"The upper elevation must be above {z}.",elementGroup:"Element",id:"Id",category:"Category",type:"Type",level:"Level",sourceId:"Source ID",link:"Link",panels:"Panels","panel.model":"Model","panel.elements":"Element table","csv.open":"Open element CSV","csv.download":"Download CSV","csv.choose":"Choose the CSV exported with this model.","csv.loading":"Reading CSV\u2026","csv.loaded":"{file} \xB7 Linked to 3D: {matched} of {total}","csv.noMatch":"{file} \xB7 No matches. Check that the CSV belongs to this model.","csv.conflicts":"Rows excluded due to conflicting uniqueId values: {count}. Check that the files belong to the same model.","csv.invalid":"Could not read the CSV. Choose an RvtIO element table with unique elementId values.","csv.noGeometry":"This element has no geometry in the model.","csv.search":"Search by ID and name","csv.searchPlaceholder":"ID or name","csv.allCategories":"All categories","csv.groupByCategory":"Group by category","csv.categoryTotals":"Category totals","csv.totals":"Filtered totals","csv.quantity.length_m":"Length","csv.quantity.area_m2":"Area","csv.quantity.volume_m3":"Volume","csv.unit.length_m":"m","csv.unit.area_m2":"m\xB2","csv.unit.volume_m3":"m\xB3","csv.outsideFilters":"The selected element is outside the filter.","csv.noResults":"No matching rows.","csv.previous":"Previous","csv.next":"Next","csv.range":"{first}\u2013{last} of {total}","panel.views":"Views","panel.sections":"Sections","panel.clashes":"Clashes","panel.bcf":"BCF topics","bcf.noView":"No view available","bcf.viewpoint":"Open viewpoint {index}","bcf.components":"Components missing \u2014 {missing}, ambiguous \u2014 {ambiguous}","panel.timeliner":"4D schedule","panel.links":"Linked files","group.navigation":"Navigation","group.sections":"Sections","group.measure":"Measure","group.display":"Display","group.view":"View","tool.orbit":"Orbit","tool.pan":"Pan","tool.fit":"Fit all","tool.projection":"Perspective / orthographic","tool.mode2d":"2D / 3D mode","sheets.label":"Sheets and Model Space","tool.plane":"Section plane","tool.box":"Section box","tool.resetSections":"Reset sections","tool.distance":"Distance","tool.displayMode":"Display mode","tool.grids":"Grids","tool.opacity":"Transparency","tool.fullscreen":"Full screen",contextMenu:"Context menu","menu.properties":"Properties","menu.hide":"Hide","menu.isolate":"Isolate","menu.showAll":"Show all","menu.zoomTo":"Zoom to object","menu.sectionBox":"Section box around object","menu.copyId":"Copy Id","menu.fitAll":"Fit all","menu.resetSections":"Reset sections","menu.unavailable":"Unavailable for this model",searchPlaceholder:"Search by name, type, Id\u2026",noCategory:"No category",noMatches:"No matches","filters.title":"Filters","filters.model":"Source model","filters.noLevel":"No level","filters.all":"All","filters.clear":"Clear","filters.isolate":"Isolate matches",idCopied:"Id copied",copyFailed:"Could not copy Id",fullscreenUnavailable:"Fullscreen is not available","face.front":"Front","face.back":"Back","face.left":"Left","face.right":"Right","face.top":"Top","face.bottom":"Bottom","cube.title":"View cube","cube.up":"Rotate up","cube.down":"Rotate down","cube.left":"Rotate left","cube.right":"Rotate right","cube.home":"Home view","sections.mode":"Section mode","sections.planes":"Planes","sections.box":"Box","sections.off":"Off","sections.axis":"Axis","sections.addPlane":"Add plane","sections.noPlanes":"No planes","sections.rotated":"rotated","sections.custom":"Custom","sections.position":"Plane position","sections.flip":"Flip side","sections.enabled":"On","sections.delete":"Delete plane","sections.keepInside":"Show inside","sections.cutInside":"Cut inside","sections.fitSelection":"Fit to selection","sections.showGizmo":"Show gizmo","sections.boxYaw":"Rotation around Z","sections.fill":"Fill cut faces","sections.fillUnavailable":"Section fill requires a WebGL stencil buffer","sections.fillNeedsMeshes":"Section fill requires closed mesh geometry","sections.maxPlanes":"At most 6 planes","unit.m":"m","display.materials":"Materials","display.textures":"Textures","display.white":"White","display.wireframe":"Wireframe","display.background":"Background color","display.backgroundReset":"Reset background","display.bgCadDark":"CAD dark","display.bgPaper":"Paper white","opacity.label":"Opacity","opacity.value":"{value}%","views.tour":"Play tour","views.stop":"Stop tour","clash.New":"New","clash.Active":"Active","clash.Reviewed":"Reviewed","clash.Approved":"Approved","clash.Resolved":"Resolved","task.construct":"Construct","task.demolish":"Demolish","task.temporary":"Temporary","player.title":"4D player","player.play":"Play","player.pause":"Pause","player.date":"Schedule date","player.speed":"Speed",truncated:"Showing {meshes} of {total} meshes: the model was truncated by the MaxMeshVertices setting",language:"Language",auto:"Auto",model3d:"3D model",retry:"Retry downloads",finding:"Finding element\u2026",streamLod:"{size} MiB \xB7 full detail {shown}/{total}",streamMesh:"{size} MiB \xB7 Clusters {visible} \xB7 Refining {fallback}",streamTiles:"{areas} areas \xB7 Detail {shown}/{total} \xB7 {size}/{limit} MiB"}},jf="ioviewer-language",Qf=globalThis.parent&&globalThis.parent!==globalThis&&Gs(new URLSearchParams(location.hash.slice(1)).get("ioextendLang")),zh=new URLSearchParams(globalThis.location?.search).get("lang"),ep=zh==="auto"?zh:Gs(zh)??$f(jf),un=Qf||Gs(ep)||qf(globalThis.navigator?.languages?.length?navigator.languages:[globalThis.navigator?.language]),Ci=new Intl.NumberFormat(un).format;function X(i,e=un,t){let n=Jf[e]?.[i]??Jf.en[i];if(n===void 0)throw new Error(`Missing UI string '${i}'.`);return t?n.replace(/\{(\w+)\}/g,(s,r)=>t[r]):n}function tp(){if(document.documentElement.lang=un,document.querySelector("canvas").setAttribute("aria-label",X("model3d")),Qf)return;let i=document.createElement("select");i.id="ioviewer-language",i.className="ioviewer-floating",i.setAttribute("aria-label",X("language")),i.append(new Option(X("auto"),"auto"),...Oh.map(Yf)),i.value=Gs(ep)??"auto",i.addEventListener("change",()=>{Zf(jf,i.value);let e=new URL(location.href);e.searchParams.set("lang",i.value),location.replace(e)}),document.querySelector("#ioviewer-ui").append(i)}var np=new C(0,0,1),ul=Math.PI/2-.01;function sp(i,e,t=4){return Math.hypot(e.x-i.x,e.y-i.y)<=t}function rp(i,e,t,n,s,r){let o=i.clone().sub(t),a=e.clone().sub(t),l=d=>(o.applyQuaternion(d),a.applyQuaternion(d));l(new Ft().setFromAxisAngle(np,-n*r));let c=a.clone().sub(o).normalize(),h=c.clone().cross(np);if(h.lengthSq()>1e-12){let d=Math.asin(lt.clamp(c.z,-1,1)),u=lt.clamp(s*r,d-ul,d+ul);l(new Ft().setFromAxisAngle(h.normalize(),-u))}return{position:o.add(t),target:a.add(t)}}function op(i,e,t,n){let s=r=>r.clone().sub(t).multiplyScalar(n).add(t);return{position:s(i),target:s(e)}}var Zy=.85,Ky=100/3;function ap(i,e,t){let n=i*(e===1?Ky:e===2?t:1);return lt.clamp(Zy**(-n/100),.5,2)}var kh=(i,e)=>e>=i?"window":"crossing";function lp(i,e,t){let n=ip(i.position,i.target),s=ip(e.position,e.target),r=n.azimuth??s.azimuth??0,o=s.azimuth??r,a=lt.euclideanModulo(o-r+Math.PI,2*Math.PI)-Math.PI,l=(_,g)=>_+(g-_)*t,c=r+a*t,h=lt.clamp(l(n.elevation,s.elevation),-ul,ul),d=l(n.distance,s.distance),u=i.target.clone().lerp(e.target,t),f=Math.cos(h)*d;return{position:u.clone().add(new C(f*Math.cos(c),f*Math.sin(c),Math.sin(h)*d)),target:u}}function cp(i,e,t,n){let s=i.position.clone().sub(i.target),r=e.position.clone().sub(e.target),o=s.length(),a=r.length();s.normalize(),r.normalize();let l=new Ft().setFromUnitVectors(s,r),c=t.clone().applyQuaternion(l),h=new C().setFromMatrixColumn(new Ke().lookAt(e.position,e.target,n),1),d=r.dot(new C().crossVectors(c,h)),u=Math.atan2(Math.abs(d)<1e-9?0:d,c.dot(h)),f=new Ft;return m=>{f.identity().slerp(l,m);let _=s.clone().applyQuaternion(f),g=i.target.clone().lerp(e.target,m),p=_.clone().multiplyScalar(lt.lerp(o,a,m)).add(g),y=t.clone().applyQuaternion(f).applyAxisAngle(_,u*m);return{position:p,target:g,up:y}}}function ip(i,e){let t=i.clone().sub(e),n=t.length(),s=Math.hypot(t.x,t.y);return{distance:n,elevation:n>1e-12?Math.asin(lt.clamp(t.z/n,-1,1)):0,azimuth:s>1e-9*Math.max(n,1e-12)?Math.atan2(t.y,t.x):null}}var Jy=.005,hp=new C(1,-1,.8).normalize(),Hh=.01,up=1e-6,jy=64,dp=1.05,Qy=5e3,dl=(i,e)=>new CustomEvent(i,{detail:e});function fp({bbox:i,grids:e}){let t=r=>Array.isArray(r)&&r.length===3&&r.every(Number.isFinite);if(!t(i?.min)||!t(i?.max))return!0;let n=new at(new C(...i.min),new C(...i.max));if(n.isEmpty())return!0;let s=new C;for(let r of e??[])for(let o of Fr(r)){if(!t(o))return!0;n.expandByPoint(s.fromArray(o))}return n.getSize(s).length()*dp>Hh*Qy}var fl=class extends EventTarget{constructor(e,t,{pick:n=()=>null,visibleBox:s=()=>new at}={}){super(),this.dom=t,this.pick=n,this.visibleBox=s,this.target=new C,this.leftButtonMode="orbit",this.is2D=!1,this._saved3D=null,this._perspective=e,this._defaultFov=e.fov,this._orthographic=new Xn(-1,1,1,-1),this.camera=e,this._drag=null,this._wheelPick=null,this._animation=0,this._overlay=null,this._bounds=null,this._extraBounds=new Map,t.style.touchAction="none",t.addEventListener("pointerdown",r=>this._down(r)),t.addEventListener("pointermove",r=>this._move(r)),t.addEventListener("pointerup",r=>this._up(r)),t.addEventListener("pointercancel",()=>this._end()),t.addEventListener("lostpointercapture",r=>this._lostCapture(r)),window.addEventListener("blur",()=>this._end()),t.addEventListener("wheel",r=>this._wheel(r),{passive:!1}),t.addEventListener("contextmenu",r=>r.preventDefault())}setLeftButtonMode(e){if(e!=="orbit"&&e!=="pan")throw new RangeError(`Unknown left button mode: ${e}`);this.leftButtonMode=e}setProjection(e){if(e!=="perspective"&&e!=="orthographic")throw new RangeError(`Unknown projection: ${e}`);let t=e==="perspective"?this._perspective:this._orthographic,n=this.camera;if(t!==n){this._stopAnimation(),t.position.copy(n.position),n.isOrthographicCamera&&t.position.sub(this.target).divideScalar(n.zoom).add(this.target),t.zoom=1,t.quaternion.copy(n.quaternion),t.up.copy(n.up),n.parent?.add(t),n.parent?.remove(n);for(let s of[...n.children])t.add(s);this.camera=t,this.resize()}}resize(){let e=this.camera,t=this.dom.clientWidth/Math.max(this.dom.clientHeight,1),n=Math.max(e.position.distanceTo(this.target),1e-6);if(e.isPerspectiveCamera)e.aspect=t;else{let r=n*Math.tan(lt.degToRad(this._perspective.fov/2));Object.assign(e,{top:r,bottom:-r,left:-r*t,right:r*t})}let s=this._rangeSphere();if(s){let r=s.center.clone().sub(e.position),o=new C(0,0,-1).applyQuaternion(e.quaternion);e.far=Math.max(1e-6,(r.length()+s.radius)*dp);let a=r.dot(o)-s.radius;e.near=Math.max(a*.95,Math.min(Hh,e.far/2))}e.updateProjectionMatrix(),this.dispatchEvent(new Event("change"))}setExtraBounds(e,t){t&&!t.isEmpty()?this._extraBounds.set(e,t.clone()):this._extraBounds.delete(e),this.resize()}_rangeSphere(){let e=this._visibleBounds()?.sphere??null;if(this._extraBounds.size===0)return e;let t=e?this._bounds.box.clone():new at;for(let n of this._extraBounds.values())t.union(n);return t.getBoundingSphere(new Ot)}invalidateBounds(){this._bounds=null}_visibleBounds(){if(!this._bounds){let e=this.visibleBox();this._bounds={box:e,sphere:e.isEmpty()?null:e.getBoundingSphere(new Ot)}}return this._bounds.sphere&&this._bounds}fitBox(e,t=!0){if(e.isEmpty())return;let n=e.getBoundingSphere(new Ot);if(this.is2D){this.setProjection("orthographic"),this.camera.up.set(0,1,0);let h=e.getSize(new C),d=Math.max(h.x,h.y,n.radius*2,.01),u=e.getCenter(new C),f=new C(u.x,u.y,e.max.z+d*2);this._set(f,u);let m=Math.max(this.dom.clientWidth/Math.max(this.dom.clientHeight,1),.001),_=Math.max(this.camera.top,1e-6),g=Math.max(h.y/2,h.x/(2*m),1e-4)*1.06;this.camera.zoom=_/g,this.resize();return}let s=Math.max(n.radius,.001),r=lt.degToRad(this._perspective.fov/2),o=this.dom.clientWidth/Math.max(this.dom.clientHeight,1),a=s/Math.sin(Math.min(r,Math.atan(Math.tan(r)*o))),l=this.camera.position.clone().sub(this.target);l.lengthSq()<1e-12&&l.copy(hp);let c=l.normalize().multiplyScalar(a).add(n.center);t?this.animateTo({position:c,target:n.center}):(this.camera.zoom=1,this._set(c,n.center))}set2DMode(e,t=null,n=!1){let s=!!e;if(s===this.is2D){s&&t&&!t.isEmpty()&&this.fitBox(t,n);return}if(this._stopAnimation(),s){this._saved3D={projection:this.camera.isOrthographicCamera?"orthographic":"perspective",position:this.camera.position.clone(),target:this.target.clone(),zoom:this.camera.zoom,leftButtonMode:this.leftButtonMode},this.is2D=!0,this.setProjection("orthographic"),this.leftButtonMode="pan";let r=t&&!t.isEmpty()?t:this.visibleBox();this.fitBox(r,!1)}else{this.is2D=!1,this.camera.up.set(0,0,1);let r=this._saved3D;if(this._saved3D=null,r)this.setProjection(r.projection),this.leftButtonMode=r.leftButtonMode,this.camera.zoom=r.zoom,this._set(r.position,r.target);else{this.setProjection("perspective"),this.leftButtonMode="orbit";let o=t&&!t.isEmpty()?t:this.visibleBox();if(!o.isEmpty()){let a=o.getCenter(new C),l=Math.max(o.getBoundingSphere(new Ot).radius,1);this._set(a.clone().addScaledVector(hp,l*2.5),a),this.fitBox(o,!1)}}}this.dispatchEvent(dl("mode2d",{enabled:this.is2D}))}zoomToBox(e){this.fitBox(e,!0)}resetCameraStyle(){this._perspective.fov=this._defaultFov,this.camera.up.set(0,0,1)}restoreViewCamera({position:e,target:t,up:n,fov:s,orthographicHeight:r}){let o=new C(...e),a=new C(...t);if(this.resetCameraStyle(),!n){this.animateTo({position:o,target:a});return}this._stopAnimation(),this.camera.up.fromArray(n),this._perspective.fov=s??this._defaultFov;let l=Math.max(o.distanceTo(a),1e-6);this.camera.zoom=r==null?1:2*l*Math.tan(lt.degToRad(this._perspective.fov/2))/r,this._set(o,a)}animateTo({position:e,target:t,zoom:n=1,overPole:s=!1},r=400){this._stopAnimation();let o={position:this.camera.position.clone(),target:this.target.clone()},a={position:e??o.position,target:t??o.target},l=this.camera.zoom,c=s?cp(o,a,new C(0,1,0).applyQuaternion(this.camera.quaternion),this.camera.up):u=>lp(o,a,u),h=performance.now(),d=u=>{let f=Math.min((u-h)/r,1),m=f*f*(3-2*f),_=c(m);this.camera.isOrthographicCamera&&(this.camera.zoom=lt.lerp(l,n,m)),this._set(_.position,_.target,_.up),this._animation=f<1?requestAnimationFrame(d):0};this._animation=requestAnimationFrame(d)}get animating(){return this._animation!==0}_stopAnimation(){cancelAnimationFrame(this._animation),this._animation=0}_set(e,t,n){if(this.camera.position.copy(e),this.target.copy(t),n){let s=this.camera.up.clone();this.camera.up.copy(n),this.camera.lookAt(t),this.camera.up.copy(s)}else this.camera.lookAt(t);this.resize()}_down(e){this._end(),this._stopAnimation(),this.dom.setPointerCapture(e.pointerId),e.preventDefault();let t=e.button===0&&e.shiftKey?"box":e.button===0&&!this.is2D&&this.leftButtonMode==="orbit"?"orbit":"pan",n={x:e.clientX,y:e.clientY},s=null;t==="orbit"&&(s=this.pick(n.x,n.y),s||(s=this._visibleBounds()?.sphere.center.clone()??this.target.clone())),this._drag={id:e.pointerId,button:e.button,mode:t,pivot:s,down:n,last:n,moved:!1}}_anchor(e,t){let n=this.pick(e,t);if(n)return n;let s=this.dom.getBoundingClientRect(),r=s.left+s.width/2,o=s.top+s.height/2;return e===r&&t===o?null:this.pick(r,o)}_gestureDepth(e,t){let n=this.camera,s=e?e.clone().sub(n.position).dot(t):0;return Math.max(up,n.position.distanceTo(this.target),s)}_move(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;if(e.buttons===0)return this._end();let n={x:e.clientX,y:e.clientY};if(!t.moved&&sp(t.down,n))return;t.moved=!0;let s=n.x-t.last.x,r=n.y-t.last.y;if(t.last=n,t.mode==="box")this._drawRect(t.down,n);else if(t.mode==="orbit"){let o=rp(this.camera.position,this.target,t.pivot,s,r,Jy);this._set(o.position,o.target)}else this._pan(s,r)}_pan(e,t){let n=this.camera,s=Math.max(this.dom.clientHeight,1);if(n.isPerspectiveCamera&&this._drag.depth===void 0){let{x:c,y:h}=this._drag.down;this._drag.depth=this._gestureDepth(this._anchor(c,h),n.getWorldDirection(new C))}let r=n.isPerspectiveCamera?2*this._drag.depth*Math.tan(lt.degToRad(n.fov/2))/(s*n.zoom):(n.top-n.bottom)/n.zoom/s,o=new C(1,0,0).applyQuaternion(n.quaternion),a=new C(0,1,0).applyQuaternion(n.quaternion),l=o.multiplyScalar(-e*r).addScaledVector(a,t*r);this._set(n.position.clone().add(l),this.target.clone().add(l))}_up(e){let t=this._drag;if(!t||e.pointerId!==t.id||e.button!==t.button)return;let n={x:e.clientX,y:e.clientY};if(this._end(),t.mode==="box"&&t.moved){let s={x:Math.min(t.down.x,n.x),y:Math.min(t.down.y,n.y),width:Math.abs(n.x-t.down.x),height:Math.abs(n.y-t.down.y)},r=kh(t.down.x,n.x);this.dispatchEvent(dl("boxselect",{rect:s,mode:r,ctrl:e.ctrlKey,shift:e.shiftKey}))}else!t.moved&&t.button===0?this.dispatchEvent(dl("click",{x:n.x,y:n.y,button:0,ctrl:e.ctrlKey,shift:e.shiftKey})):!t.moved&&t.button===2&&this.dispatchEvent(dl("contextmenu",{x:n.x,y:n.y}))}_lostCapture(e){this._drag&&e.buttons?this.dom.setPointerCapture(this._drag.id):this._end()}_end(){this._drag=null,this._overlay?.remove(),this._overlay=null}_drawRect(e,t){this._overlay||(this._overlay=document.createElement("div"),Object.assign(this._overlay.style,{position:"fixed",pointerEvents:"none",border:"1px solid #2563eb",background:"rgba(37,99,235,0.12)"}),(this.dom.parentElement??document.body).appendChild(this._overlay)),Object.assign(this._overlay.style,{borderStyle:kh(e.x,t.x)==="window"?"solid":"dashed",left:`${Math.min(e.x,t.x)}px`,top:`${Math.min(e.y,t.y)}px`,width:`${Math.abs(t.x-e.x)}px`,height:`${Math.abs(t.y-e.y)}px`})}_wheel(e){if(e.preventDefault(),e.deltaY===0)return;this._stopAnimation();let t=ap(e.deltaY,e.deltaMode,this.dom.clientHeight),n=this.camera,s=n.position.distanceTo(this.target),r=this._visibleBounds()?.sphere.radius??0,o=jy*Math.max(r,.001);if(n.isOrthographicCamera){let{left:_,top:g,width:p,height:y}=this.dom.getBoundingClientRect();if(!p||!y)return;let w=lt.clamp(n.zoom/t,Math.max(1e-6,Math.min(n.zoom,s/o)),1e6);if(w===n.zoom)return;let b=new C((2*(e.clientX-_)/p-1)*n.right,(1-2*(e.clientY-g)/y)*n.top,0).multiplyScalar(1/n.zoom-1/w).applyQuaternion(n.quaternion);n.zoom=w,this._set(n.position.clone().add(b),this.target.clone().add(b));return}this._wheelPick||(this._wheelPick={point:this._anchor(e.clientX,e.clientY)},requestAnimationFrame(()=>this._wheelPick=null));let a=n.getWorldDirection(new C),l=this._gestureDepth(this._wheelPick.point,a);if(!Number.isFinite(l))return;let c=Math.min(Hh,Math.max(up,r)),h=lt.clamp(l*t,c,Math.max(l,o))/l;if(h===1)return;let d=n.position.clone().addScaledVector(a,l),u=this._wheelPick.point,f=u&&u.clone().sub(n.position).dot(a)>=c?u:d,m=op(n.position,d,f,h);this._set(m.position,m.target)}};function K(i,e,t){let n=document.createElement(i);return e&&(n.className=e),t!==void 0&&(n.textContent=t),n}function en(i,e,t){let n=K("button",i);return n.type="button",n.innerHTML=e,n.title=t,n.setAttribute("aria-label",t),n}function Ws(i){i.preventDefault(),i.stopPropagation()}function pl(i){Ws(i);let e=i.button===2,t=()=>{window.removeEventListener("pointerup",n,!0),setTimeout(()=>{window.removeEventListener("click",Ws,!0),e&&window.removeEventListener("contextmenu",Ws,!0)})},n=s=>{Ws(s),t()};window.addEventListener("pointerup",n,!0),window.addEventListener("click",Ws,!0),e&&window.addEventListener("contextmenu",Ws,!0)}function Xr(i,e,t,n){let s=e.clone().applyMatrix4(t.matrixWorldInverse).z<0,r=e.clone().project(t);i.hidden=!(s&&Math.abs(r.x)<=1&&Math.abs(r.y)<=1),!i.hidden&&(i.style.left=`${n.left+(r.x+1)/2*n.width}px`,i.style.top=`${n.top+(1-r.y)/2*n.height}px`)}var yt=i=>``,pp='',ot={model:yt(''),elements:yt(''),views:yt(''),sections:yt(''),clashes:yt(''),bcf:yt(''),timeliner:yt(''),links:yt(''),orbit:yt(''),pan:yt(''),fit:yt(''),projection:yt(pp),mode2d:yt(''),plane:yt(''),box:yt(`${pp}`),resetSections:yt(''),distance:yt(''),displayMode:yt(''),grids:yt(''),opacity:yt(''),fullscreen:yt(''),close:yt(''),chevron:yt(''),flip:yt(''),remove:yt(''),play:yt(''),pause:yt(''),home:yt('')};var qr=new C(0,0,1),dn={right:new C(1,0,0),left:new C(-1,0,0),back:new C(0,1,0),front:new C(0,-1,0),top:new C(0,0,1),bottom:new C(0,0,-1)},eb={right:qr,left:qr,back:qr,front:qr,top:dn.back,bottom:dn.front},Ki=.7,tb=lt.degToRad(1),mp=.01,gp=96,ml=1.75;function _p(i){let e=i.split("-"),t=new C;for(let n of e){if(!Object.hasOwn(dn,n))throw new RangeError(`Unknown view cube region: ${i}`);t.add(dn[n])}if(new Set(e).size!==e.length||t.lengthSq()!==e.length)throw new RangeError(`Unknown view cube region: ${i}`);return t.normalize()}function nb(i){let e=[];return Math.abs(i.z)>=Ki&&e.push(i.z>0?"top":"bottom"),Math.abs(i.y)>=Ki&&e.push(i.y>0?"back":"front"),Math.abs(i.x)>=Ki&&e.push(i.x>0?"right":"left"),e.join("-")}function Vh(i,e=tb){let t=i.clone().normalize(),n=Math.cos(e);return Object.keys(dn).find(s=>t.dot(dn[s])>=n)??null}function xp(i){let e=new C(i.x,i.y,0);if(e.lengthSq()<1e-24)return"front";e.normalize();let t=["front","right","back","left"],n=Math.max(...t.map(s=>e.dot(dn[s])));return t.find(s=>e.dot(dn[s])>=n-1e-9)}function Gh(i,e){return dn[xp(e)].clone().multiplyScalar(Math.sin(mp)).addScaledVector(dn[i],Math.cos(mp))}function ib(i,e){let t=Vh(i);if(!t)return null;let n=t==="top"||t==="bottom";if(e==="left"||e==="right")return(n?Gh(t,i):_p(t)).applyAxisAngle(qr,e==="right"?Math.PI/2:-Math.PI/2);if(e!=="up"&&e!=="down")throw new RangeError(`Unknown arrow: ${e}`);if(!n)return Gh(e==="up"?"top":"bottom",i);let s=dn[xp(i)];return e==="up"==(t==="top")?s.clone().negate():s.clone()}function sb(i,e){let t=document.createElement("canvas");t.width=t.height=128;let n=t.getContext("2d");n.fillStyle="#2a2f38",n.fillRect(0,0,128,128),n.fillStyle="#cbd5e1",n.textAlign="center",n.textBaseline="middle",n.font=`600 26px ${e}`;let s=n.measureText(i).width;s>112&&(n.font=`600 ${Math.floor(2912/s)}px ${e}`),n.fillText(i,64,64);let r=new ur(t);return r.colorSpace=mt,r}var gl=class{constructor(e,t,n){this.controls=n,this.home={position:t.position.clone(),target:n.target.clone()},this.element=K("div","ioviewer-viewcube"),this.canvas=K("canvas","ioviewer-viewcube-canvas"),this.canvas.title=X("cube.title"),this.canvas.setAttribute("aria-label",X("cube.title")),this.element.append(this.canvas),this.error=null,this.renderer=this._createRenderer(),this.scene=new mn,this.camera=new Xn(-ml,ml,ml,-ml,.1,10),this.faces=new Rt;let s=getComputedStyle(e).fontFamily;for(let[l,c]of Object.entries(dn)){let h=X(`face.${l}`),d=new gt(new cn(2,2),new Jt({map:sb(h,s)})),u=eb[l];d.quaternion.setFromRotationMatrix(new Ke().makeBasis(u.clone().cross(c),u,c)),d.position.copy(c),d.name=l,d.userData.label=h,this.faces.add(d)}let r=new ln(new Vi(new _n(2,2,2)),new sn({color:"#5b6575"}));this.highlight=new gt(new _n(1,1,1),new Jt({color:"#2563eb",transparent:!0,opacity:.6})),this.highlight.visible=!1,this.scene.add(this.faces,r,this.highlight),this._raycaster=new qn,this.hovered=null,this._pointer=null,this.element.addEventListener("contextmenu",l=>l.preventDefault());let o=l=>{this._pointer=[l.clientX,l.clientY],this._hover(this.regionAtClient(...this._pointer))&&this._render()};this.canvas.addEventListener("pointerenter",o),this.canvas.addEventListener("pointermove",o),this.canvas.addEventListener("pointerleave",()=>{this._pointer=null,this._hover(null)&&this._render()}),this.canvas.addEventListener("click",l=>{let c=this.regionAtClient(l.clientX,l.clientY);if(!c)return;let h=c==="top"||c==="bottom";this._look(h?Gh(c,n.camera.position.clone().sub(n.target)):_p(c))}),this.arrows=["up","down","left","right"].map(l=>{let c=en("ioviewer-viewcube-arrow",ot.chevron,X(`cube.${l}`));return c.dataset.arrow=l,c.addEventListener("click",h=>{h.detail&&c.blur(),this._arrow(l)}),c});let a=en("ioviewer-viewcube-home",ot.home,X("cube.home"));a.addEventListener("click",l=>{l.detail&&a.blur(),n.resetCameraStyle(),n.animateTo({position:this.home.position.clone(),target:this.home.target.clone()})}),this.element.append(...this.arrows,a),e.append(this.element),this.update()}_createRenderer(){this.canvas.addEventListener("webglcontextlost",t=>{t.stopImmediatePropagation(),this._fail(new Error("The view cube lost its WebGL context."))});let e=this.canvas.getContext("webgl2",{alpha:!0,antialias:!0});if(!e)return this._fail(new Error("WebGL 2 is not available for the view cube."));try{let t=new Ti({canvas:this.canvas,context:e,alpha:!0,antialias:!0});return t.setPixelRatio(window.devicePixelRatio),t.setSize(gp,gp),t}catch(t){return this._fail(t)}}_fail(e){return this.error=e,this.renderer=null,this.element.hidden=!0,null}_render(){if(this.renderer)try{this.renderer.render(this.scene,this.camera)}catch(e){this._fail(e)}}set2D(e){this.element.classList.toggle("ioviewer-viewcube-2d",!!e)}update(){if(!this.renderer)return;let e=this.controls.camera,t=!this.camera.quaternion.equals(e.quaternion);this.camera.quaternion.copy(e.quaternion),this.camera.position.set(0,0,5).applyQuaternion(e.quaternion),this.camera.updateMatrixWorld();let n=Vh(e.position.clone().sub(this.controls.target))!==null;for(let s of this.arrows)s.hidden=!n;t&&this._pointer&&this._hover(this.regionAtClient(...this._pointer)),this._render()}regionAtClient(e,t){let n=this.canvas.getBoundingClientRect(),s=new qe((e-n.left)/n.width*2-1,1-(t-n.top)/n.height*2);this._raycaster.setFromCamera(s,this.camera);let r=this._raycaster.intersectObjects(this.faces.children)[0];return r?nb(r.point):null}_hover(e){if(e===this.hovered)return!1;if(this.hovered=e,this.highlight.visible=!!e,e){let t=e.split("-").reduce((a,l)=>a.add(dn[l]),new C),n=a=>a===0?[-Ki,Ki]:a>0?[Ki,1.02]:[-1.02,-Ki],[s,r,o]=t.toArray().map(n);this.highlight.scale.set(s[1]-s[0],r[1]-r[0],o[1]-o[0]),this.highlight.position.set((s[0]+s[1])/2,(r[0]+r[1])/2,(o[0]+o[1])/2)}return!0}_arrow(e){let n=this.controls.camera.position.clone().sub(this.controls.target),s=ib(n,e);if(!s)return;let r=Vh(n),o=r==="top"&&e==="up"||r==="bottom"&&e==="down";this._look(s,o)}_look(e,t=!1){let{controls:n}=this,s=n.camera.position.distanceTo(n.target);n.animateTo({position:e.clone().multiplyScalar(s).add(n.target),target:n.target.clone(),zoom:n.camera.zoom,overPole:t})}};var rb=` #include #ifdef IO_PICK_POINTS uniform uint pointIndex; @@ -4298,7 +4298,7 @@ attribute float lineSlot; uniform sampler2D lineState; varying float vLine; #else -${zr} +${kr} varying vec2 vSlot; #endif #include @@ -4319,7 +4319,7 @@ void main() { vec3 transformed = position; vLine = float( lSlot ); #else - ${kr} + ${Hr} vec3 transformed = slotPosition; #endif #include @@ -4341,7 +4341,7 @@ void main() { vSlot = vec2( float( slot >> 12 ), float( slot & 4095 ) ); if ( state.a < 0.5 ) gl_Position = vec4( 0.0, 0.0, 2.0, 1.0 ); #endif -}`,$y=` +}`,ob=` #include #include #include @@ -4390,36 +4390,36 @@ void main() { uvec4 bytes = ( uvec4( bits ) >> uvec4( 0u, 8u, 16u, 24u ) ) & 255u; gl_FragColor = vec4( bytes ) / 255.0; #endif -}`,op=i=>i&&{element:i.element,point:i.point.clone()};function li(i,t,e=null){let n=new Ie({vertexShader:Yy,fragmentShader:$y,uniforms:i,defines:t?{[t]:""}:{},side:ke,clipping:!0});return e==="points"?n.defines.IO_PICK_POINTS="":e==="lines"?n.defines.IO_PICK_LINES="":n.index0AttributeName="q",n}var gl=class{constructor(t,e,n,s={}){this.renderer=t,this.scene=e,this.points=s.points?.count?s.points:null,this.lines=s.lines?.count?s.lines:null,this.camera=n,this._lost=!1,t.domElement.addEventListener("webglcontextlost",()=>this._lost=!0),this._last=null,this._lastTile=null,this._key=new Float64Array(36),e.root.addEventListener("change",c=>{c.detail.kind!=="appearance"&&(this._last=this._lastTile=null)});let r=e.slotUniforms,o={pointIndex:{value:0},pointSize:{value:0}},a={lineState:{value:null},pointCount:{value:this.points?.count??0}};this._float=s.pickFloat!==!1&&t.extensions.has("EXT_color_buffer_float");let l=this.lines?5:this.points?3:1;this._float?(this._material=li(r,null),this._target=new Be(l,l,{type:Ye}),this._pixel=new Float32Array(l*l*4),this.points&&(this._pointMaterial=li(o,null,"points")),this.lines&&(this._lineMaterial=li(a,null,"lines"))):(this._material=li(r,"IO_PICK_RGBA8"),this._depthMaterial=li(r,"IO_PICK_DEPTH"),this._target=new Be(l,l),this._pixel=new Uint8Array(l*l*4),this.points&&(this._pointMaterial=li(o,"IO_PICK_RGBA8","points"),this._pointDepthMaterial=li(o,"IO_PICK_DEPTH","points")),this.lines&&(this._lineMaterial=li(a,"IO_PICK_RGBA8","lines"),this._lineDepthMaterial=li(a,"IO_PICK_DEPTH","lines")))}pick(t,e){let n=this.renderer.domElement.getBoundingClientRect(),s=Math.floor(t-n.left),r=Math.floor(e-n.top);if(this._lost||!(s>=0&&r>=0&&sh===o[d]))return op(l.hit);let c=this._pick(s,r,n);return this._last={camera:a,key:o.slice(),hit:c},op(c)}_sampleKey(t,e,n){this.camera.updateMatrixWorld();let s=this._key;return s.set([t,e,n.width,n.height]),s.set(this.camera.matrixWorld.elements,4),s.set(this.camera.projectionMatrix.elements,20),s}measureTile(t,e,n){let s=this.renderer.domElement.getBoundingClientRect(),r=Math.floor(t-s.left),o=Math.floor(e-s.top);if(this._lost||!(r>=0&&o>=0&&rv===a[E]))return c.tile;let h=n*2+1;(!this._measure||this._measure.target.width!==h)&&(this._measure?.target.dispose(),this._measure={target:new Be(h,h,this._float?{type:Ye}:{}),ids:this._float?new Float32Array(h*h*4):new Uint8Array(h*h*4),depths:this._float?null:new Uint8Array(h*h*4)});let{target:d,ids:u,depths:f}=this._measure,m=r-n,_=o-n;this._render(this._material,m,_,s,d,u);let g=(v,E)=>{let R=Math.floor(v)-m,L=Math.floor(E)-_;return R>=0&&R=0&&Lthis._slotAt(p,v),w=g(r,o),M=y(w),x=w;if(M<0&&(this.points||this.lines)){let v=(n+1)**2;for(let E=0;Ev||(v=L,x=E)}}let S=null,A=y(x);if(A>=0){f&&this._render(this._depthMaterial,m,_,s,d,f);let v=f&&new DataView(f.buffer),E=l.matrixWorldInverse.elements.slice(),R=new C,L=U=>{let k=this._vertexAt(y(U),u,v,U,R);return k?-(E[2]*k.x+E[6]*k.y+E[10]*k.z+E[14]):v.getFloat32(U*4,!0)},N=this._vertexAt(A,u,v,x)??this._depthPoint(r,o,s,L(x)),B=this._isPoint(A),D=this._isLine(A)?A-this.scene.slotCount-(this.points?.count??0):-1,F=new Set,H=this._elementAt(A),V=new Set(B||D>=0?[]:[A]);if(D>=0&&F.add(D),!B)for(let U=0;U=0&&!this._isPoint(k)&&(this._isLine(k)?F.add(k-this.scene.slotCount-(this.points?.count??0)):H>=0&&!V.has(k)&&this.scene.slotElement(k)===H&&V.add(k))}let z=l.isPerspectiveCamera;S={rect:s,point:N,element:H,slots:V,lineInstances:F,pointSample:B,depthAt(U,k,Y){let G=g(U,k),J=G<0?-1:y(G);if(J<0)return 1/0;if(J!==Y)return L(G);let it=$=>z?1/L($):L($),nt=it(G);function at($,rt,mt){let ht=Math.sign(mt),Et=g(U+ht*$,k+ht*rt);if(Et>=0&&y(Et)===J)return(it(Et)-nt)*Math.abs(mt);let Zt=g(U-ht*$,k-ht*rt);return Zt>=0&&y(Zt)===J?(nt-it(Zt))*Math.abs(mt):0}let O=nt+at(1,0,U-Math.floor(U)-.5)+at(0,1,k-Math.floor(k)-.5);return O>0?z?1/O:O:L(G)}}}return this._lastTile={camera:l,key:a.slice(),radius:n,tile:S},this._last={camera:l,key:this._lastTile.key,hit:M>=0?S:null},S}_pick(t,e,n){let s=this._target.width,r=(s-1)/2,o=(s**2-1)/2,a=this._render(this._material,t-r,e-r,n),l=this._float?a:new Uint32Array(a.buffer),c=o,h=this._slotAt(l,o);if(h<0&&s>1){let p=1/0;for(let y=0;y=this.scene.slotCount&&t=this.scene.slotCount+(this.points?.count??0)}_elementAt(t){if(this._isPoint(t)){let e=this.scene.pointOffset??this.scene.instanceCount-this.points.count-(this.lines?.count??0);return this.scene.instance(e+t-this.scene.slotCount).element}if(this._isLine(t)){let e=this.scene.lineOffset??this.scene.instanceCount-this.lines.count;return this.scene.instance(e+t-this.scene.slotCount-(this.points?.count??0)).element}return this.scene.slotElement(t)}_vertexAt(t,e,n,s,r=new C){return this._float?r.fromArray(e,s*4):this._isPoint(t)?this.points.position(t-this.scene.slotCount,n.getUint32(s*4,!0),r):null}_depthPoint(t,e,n,s){let r=this.camera,o=new C((t+.5)/n.width*2-1,1-(e+.5)/n.height*2,-1).applyMatrix4(r.projectionMatrixInverse);return r.isPerspectiveCamera?o.multiplyScalar(-s/o.z):o.z=-s,o.applyMatrix4(r.matrixWorld)}_render(t,e,n,s,r=this._target,o=this._pixel){let{renderer:a,camera:l}=this,c={target:a.getRenderTarget(),color:a.getClearColor(new Vt),alpha:a.getClearAlpha(),autoClear:a.autoClear},h=this.scene._buckets[0]?.material;t.clippingPlanes=h?.clippingPlanes??null,t.clipIntersection=h?.clipIntersection??!1,l.updateMatrixWorld(),l.setViewOffset(s.width,s.height,e,n,r.width,r.height);try{if(a.setRenderTarget(r),a.setClearColor(0,0),this.scene.withMaterial(t,()=>a.render(this.scene.root,l),{pickCamera:l}),this.points){a.autoClear=!1;let d=t===this._depthMaterial?this._pointDepthMaterial:this._pointMaterial;this.points.withPickMaterial(d,()=>a.render(this.points.root,l))}if(this.lines){a.autoClear=!1;let d=t===this._depthMaterial?this._lineDepthMaterial:this._lineMaterial;this.lines.withPickMaterial(d,()=>a.render(this.lines.root,l))}a.readRenderTargetPixels(r,0,0,r.width,r.height,o)}finally{a.setRenderTarget(c.target),a.setClearColor(c.color,c.alpha),a.autoClear=c.autoClear,l.clearViewOffset()}return o}};var _l=33.333333333333336,Zy=200,ap=1e6,Ky=20,xl=class{constructor(t,e,n=1e7){this.scene=t,this.budget=n,this.minPixels=0,this._requestRender=e,this._last=new Float64Array(32),this._seen=!1,this._requestedAt=null,this._frame=null,this._cost=0,this._fastFrames=0,this._refine=!1,this._settle=0}requested(t){this._requestedAt??(this._requestedAt=t)}begin(t,e,n){t.updateMatrixWorld();let s=this._requestedAt===null?0:Math.max(n-this._requestedAt,0);this._requestedAt=null;let r=this._moved(t);this._frame=r?{start:n,waited:s}:null,this.minPixels=r?this.scene.detailThreshold(t,e,this.budget,this._refine):0,r||(this._fastFrames=0),this.scene.setDetail(this.minPixels,e),r&&(clearTimeout(this._settle),this.minPixels>0&&(this._settle=setTimeout(this._requestRender,Zy)))}end(t){this.scene.setDetail(0),this._frame&&this._adapt(this._frame.waited+(t-this._frame.start)),this._frame=null}_adapt(t){this._cost=this._cost?this._cost*.8+t*.2:t,t>_l*1.1?(this._refine=!1,this._fastFrames=0):this._refine||(this._fastFrames=this.minPixels>0&&t<_l*.7?this._fastFrames+1:0,this._refine=this._fastFrames>=Ky),this._cost>_l*1.1?this.budget=Math.max(this.budget*.9,ap):this._cost<_l*.7&&this.minPixels>0&&(this.budget=Math.max(Math.min(this.budget*1.05,this.scene.visibleCost),ap))}_moved(t){let e=this._last,n=[...t.matrixWorld.elements,...t.projectionMatrix.elements],s=(o,a)=>a!==26&&a!==30&&Math.abs(o-e[a])>1e-9*Math.max(1,Math.abs(o)),r=this._seen&&n.some(s);return this._seen=!0,e.set(n),r}};var Ln,Ws,vl,yl=class extends EventTarget{constructor(){super(...arguments);Vl(this,Ws);Vl(this,Ln,new Set)}get size(){return di(this,Ln).size}has(e){return di(this,Ln).has(e)}values(){return di(this,Ln).values()}set(e){_u(this,Ln,new Set(e)),to(this,Ws,vl).call(this)}toggle(e){di(this,Ln).delete(e)||di(this,Ln).add(e),to(this,Ws,vl).call(this)}clear(){di(this,Ln).size!==0&&(di(this,Ln).clear(),to(this,Ws,vl).call(this))}};Ln=new WeakMap,Ws=new WeakSet,vl=function(){this.dispatchEvent(new Event("change"))};function lp(i,t,e){if(t!=="window"&&t!=="crossing")throw new RangeError(`Unknown box select mode: ${t}`);let n=i.x+i.width,s=i.y+i.height,r=t==="window"?o=>o.minX>=i.x&&o.maxX<=n&&o.minY>=i.y&&o.maxY<=s:o=>o.maxX>=i.x&&o.minX<=n&&o.maxY>=i.y&&o.minY<=s;return e.filter(r).map(o=>o.index)}function cp(i,t,e){let n=new Kt().multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse).elements,{left:s,top:r,width:o,height:a}=e,l=new ae,c=[];for(let h=0;hn===l?r(l):o(l));let g=[...t.children].find(x=>hp.indexOf(x.dataset.panel)>m);t.insertBefore(_,g??null);let p=K("section","ioviewer-side-panel ioviewer-floating");p.dataset.panel=l,p.hidden=!0,p.setAttribute("aria-label",h);let y=tn("ioviewer-panel-close",oe.close,q("close"));y.addEventListener("click",()=>r(l));let w=K("header","ioviewer-panel-header");w.append(K("h2","",h),y);let M=K("div","ioviewer-panel-body");p.append(w,M),i.append(p),e.set(l,{button:_,panel:p,onClose:f}),d(M)}return{rail:t,openPanel:o,closePanel:r,registerPanel:a}}var dp=[{id:"navigation",items:["orbit","pan","fit","projection","mode2d"]},{id:"sections",items:["plane","box","resetSections"]},{id:"measure",items:["distance"]},{id:"display",items:["displayMode","grids","opacity"]},{id:"view",items:["fullscreen"]}];function fp(i,t){let e=K("div","ioviewer-toolbar ioviewer-floating");e.setAttribute("role","toolbar");let n=new Map;for(let a of t){let l=K("div","ioviewer-toolbar-group");l.setAttribute("role","group"),l.setAttribute("aria-label",q(`group.${a.id}`));let c=K("div","ioviewer-toolbar-row");for(let h of a.items){let d=tn("ioviewer-tool",oe[h],q(`tool.${h}`));d.dataset.tool=h,d.setAttribute("aria-disabled","true");let u={button:d,handler:null};d.addEventListener("click",()=>{d.getAttribute("aria-disabled")!=="true"&&u.handler?.()}),n.set(h,u),c.append(d)}l.append(c,K("div","ioviewer-toolbar-label",q(`group.${a.id}`))),e.append(l)}i.append(e),new ResizeObserver(()=>i.style.setProperty("--toolbar-height",`${e.offsetHeight}px`)).observe(e);function r(a){let l=n.get(a);if(!l)throw new RangeError(`Unknown tool: ${a}`);return l}function o(a,l){r(a).button.setAttribute("aria-disabled",String(!l))}return{element:e,setHandler(a,l){r(a).handler=l,o(a,!0)},setEnabled:o,setActive(a,l){let{button:c}=r(a);c.classList.toggle("active",l),c.setAttribute("aria-pressed",String(l))}}}var Jy="input, textarea, select, [contenteditable]";function Hh(i){return i.key==="ContextMenu"||i.code==="ContextMenu"||i.shiftKey&&(i.key==="F10"||i.code==="F10")}function pp(i){if(i.ctrlKey||i.altKey||i.metaKey||i.repeat||i.target?.closest?.(Jy))return null;if(Hh(i))return"contextMenu";switch(i.code){case"KeyH":return i.shiftKey?"showAll":"hide";case"KeyI":return i.shiftKey?null:"isolate";case"KeyF":return i.shiftKey?null:"zoomTo";case"Escape":return"escape";default:return null}}function mp(i,t,e,n,s){let r=K("details","ioviewer-tree-filters");r.hidden=i.length===0;let o=K("summary","",q("filters.title")),a=K("div","ioviewer-filter-fields"),l=new Map(t.map(({id:x,name:S})=>[x,S||`#${x}`])),c=x=>x.modelId??t[0]?.id??null,h=x=>x.levelId??(x.level||null),d=x=>x.category??"",u=[{name:q("filters.model"),key:c,labels:new Map},{name:q("level"),key:h,labels:new Map},{name:q("category"),key:d,labels:new Map}],[f,m,_]=u,g=K("div","ioviewer-filter-actions"),p=K("button","ioviewer-text-button",q("filters.clear"));p.type="button",p.addEventListener("click",()=>{for(let x of u)x.select&&(x.select.selectedIndex=0);e.value="",n(),e.focus()});let y=K("button","ioviewer-text-button",q("filters.isolate"));y.type="button",y.addEventListener("click",s),g.append(p,y),r.append(o,a,g);function w(){if(r.open){r.removeEventListener("toggle",w);for(let x of i){let S=c(x),A=l.get(S)??(S==null?"":`#${S}`);S!=null&&f.labels.set(S,A);let v=h(x);if(!m.labels.has(v)){let R=x.level||(v==null?q("filters.noLevel"):`#${v}`);m.labels.set(v,v!=null&&t.length>1&&A?`${R} \xB7 ${A}`:R)}let E=d(x);_.labels.set(E,E||q("noCategory"))}for(let x of u){if(!x.labels.size)continue;let S=new Map;for(let R of x.labels.values())S.set(R,(S.get(R)??0)+1);let A=[...x.labels].map(([R,L])=>[R,S.get(L)>1?`${L} (#${R})`:L]);A.sort((R,L)=>R[1].localeCompare(L[1])),x.keys=A.map(([R])=>R);let v=x.select=K("select");v.append(new Option(q("filters.all"),""));for(let[R,[,L]]of A.entries())v.append(new Option(L,String(R+1)));v.addEventListener("change",n);let E=K("label","ioviewer-filter-field");E.append(K("span","",x.name),v),a.append(E)}}}r.addEventListener("toggle",w);function M(){return u.filter(x=>x.select?.selectedIndex>0)}return{element:r,predicate(){let x=M().map(({select:S,keys:A,key:v})=>({key:v,value:A[S.selectedIndex-1]}));return x.length?S=>x.every(({key:A,value:v})=>A(S)===v):null},update(x,S){let A=M().length;o.textContent=A?`${q("filters.title")} (${A})`:q("filters.title"),p.disabled=!A&&!x,y.disabled=!S}}}var Ii=24,jy=8;function Vh(i,t,e,n,s){let r=Math.min(n,Math.max(0,Math.floor(i/t)-s)),o=Math.min(n,Math.ceil((i+e)/t)+s);return{start:r,end:Math.max(r,o)}}function Qy(i){let t=null;return e=>{let n=e.trim().toLowerCase();t??(t=i.map(r=>`${r.name??""} +}`,vp=i=>i&&{element:i.element,point:i.point.clone()};function li(i,e,t=null){let n=new It({vertexShader:rb,fragmentShader:ob,uniforms:i,defines:e?{[e]:""}:{},side:kt,clipping:!0});return t==="points"?n.defines.IO_PICK_POINTS="":t==="lines"?n.defines.IO_PICK_LINES="":n.index0AttributeName="q",n}var _l=class{constructor(e,t,n,s={}){this.renderer=e,this.scene=t,this.points=s.points?.count?s.points:null,this.lines=s.lines?.count?s.lines:null,this.camera=n,this._lost=!1,e.domElement.addEventListener("webglcontextlost",()=>this._lost=!0),this._last=null,this._lastTile=null,this._key=new Float64Array(36),t.root.addEventListener("change",c=>{c.detail.kind!=="appearance"&&(this._last=this._lastTile=null)});let r=t.slotUniforms,o={pointIndex:{value:0},pointSize:{value:0}},a={lineState:{value:null},pointCount:{value:this.points?.count??0}};this._float=s.pickFloat!==!1&&e.extensions.has("EXT_color_buffer_float");let l=this.lines?5:this.points?3:1;this._float?(this._material=li(r,null),this._target=new Bt(l,l,{type:Yt}),this._pixel=new Float32Array(l*l*4),this.points&&(this._pointMaterial=li(o,null,"points")),this.lines&&(this._lineMaterial=li(a,null,"lines"))):(this._material=li(r,"IO_PICK_RGBA8"),this._depthMaterial=li(r,"IO_PICK_DEPTH"),this._target=new Bt(l,l),this._pixel=new Uint8Array(l*l*4),this.points&&(this._pointMaterial=li(o,"IO_PICK_RGBA8","points"),this._pointDepthMaterial=li(o,"IO_PICK_DEPTH","points")),this.lines&&(this._lineMaterial=li(a,"IO_PICK_RGBA8","lines"),this._lineDepthMaterial=li(a,"IO_PICK_DEPTH","lines")))}pick(e,t){let n=this.renderer.domElement.getBoundingClientRect(),s=Math.floor(e-n.left),r=Math.floor(t-n.top);if(this._lost||!(s>=0&&r>=0&&sh===o[d]))return vp(l.hit);let c=this._pick(s,r,n);return this._last={camera:a,key:o.slice(),hit:c},vp(c)}_sampleKey(e,t,n){this.camera.updateMatrixWorld();let s=this._key;return s.set([e,t,n.width,n.height]),s.set(this.camera.matrixWorld.elements,4),s.set(this.camera.projectionMatrix.elements,20),s}measureTile(e,t,n){let s=this.renderer.domElement.getBoundingClientRect(),r=Math.floor(e-s.left),o=Math.floor(t-s.top);if(this._lost||!(r>=0&&o>=0&&rv===a[E]))return c.tile;let h=n*2+1;(!this._measure||this._measure.target.width!==h)&&(this._measure?.target.dispose(),this._measure={target:new Bt(h,h,this._float?{type:Yt}:{}),ids:this._float?new Float32Array(h*h*4):new Uint8Array(h*h*4),depths:this._float?null:new Uint8Array(h*h*4)});let{target:d,ids:u,depths:f}=this._measure,m=r-n,_=o-n;this._render(this._material,m,_,s,d,u);let g=(v,E)=>{let R=Math.floor(v)-m,L=Math.floor(E)-_;return R>=0&&R=0&&Lthis._slotAt(p,v),w=g(r,o),b=y(w),x=w;if(b<0&&(this.points||this.lines)){let v=(n+1)**2;for(let E=0;Ev||(v=L,x=E)}}let S=null,A=y(x);if(A>=0){f&&this._render(this._depthMaterial,m,_,s,d,f);let v=f&&new DataView(f.buffer),E=l.matrixWorldInverse.elements.slice(),R=new C,L=U=>{let k=this._vertexAt(y(U),u,v,U,R);return k?-(E[2]*k.x+E[6]*k.y+E[10]*k.z+E[14]):v.getFloat32(U*4,!0)},N=this._vertexAt(A,u,v,x)??this._depthPoint(r,o,s,L(x)),B=this._isPoint(A),D=this._isLine(A)?A-this.scene.slotCount-(this.points?.count??0):-1,F=new Set,H=this._elementAt(A),V=new Set(B||D>=0?[]:[A]);if(D>=0&&F.add(D),!B)for(let U=0;U=0&&!this._isPoint(k)&&(this._isLine(k)?F.add(k-this.scene.slotCount-(this.points?.count??0)):H>=0&&!V.has(k)&&this.scene.slotElement(k)===H&&V.add(k))}let z=l.isPerspectiveCamera;S={rect:s,point:N,element:H,slots:V,lineInstances:F,pointSample:B,depthAt(U,k,Y){let G=g(U,k),J=G<0?-1:y(G);if(J<0)return 1/0;if(J!==Y)return L(G);let ie=$=>z?1/L($):L($),ne=ie(G);function ae($,re,me){let he=Math.sign(me),Ee=g(U+he*$,k+he*re);if(Ee>=0&&y(Ee)===J)return(ie(Ee)-ne)*Math.abs(me);let Ze=g(U-he*$,k-he*re);return Ze>=0&&y(Ze)===J?(ne-ie(Ze))*Math.abs(me):0}let O=ne+ae(1,0,U-Math.floor(U)-.5)+ae(0,1,k-Math.floor(k)-.5);return O>0?z?1/O:O:L(G)}}}return this._lastTile={camera:l,key:a.slice(),radius:n,tile:S},this._last={camera:l,key:this._lastTile.key,hit:b>=0?S:null},S}_pick(e,t,n){let s=this._target.width,r=(s-1)/2,o=(s**2-1)/2,a=this._render(this._material,e-r,t-r,n),l=this._float?a:new Uint32Array(a.buffer),c=o,h=this._slotAt(l,o);if(h<0&&s>1){let p=1/0;for(let y=0;y=this.scene.slotCount&&e=this.scene.slotCount+(this.points?.count??0)}_elementAt(e){if(this._isPoint(e)){let t=this.scene.pointOffset??this.scene.instanceCount-this.points.count-(this.lines?.count??0);return this.scene.instance(t+e-this.scene.slotCount).element}if(this._isLine(e)){let t=this.scene.lineOffset??this.scene.instanceCount-this.lines.count;return this.scene.instance(t+e-this.scene.slotCount-(this.points?.count??0)).element}return this.scene.slotElement(e)}_vertexAt(e,t,n,s,r=new C){return this._float?r.fromArray(t,s*4):this._isPoint(e)?this.points.position(e-this.scene.slotCount,n.getUint32(s*4,!0),r):null}_depthPoint(e,t,n,s){let r=this.camera,o=new C((e+.5)/n.width*2-1,1-(t+.5)/n.height*2,-1).applyMatrix4(r.projectionMatrixInverse);return r.isPerspectiveCamera?o.multiplyScalar(-s/o.z):o.z=-s,o.applyMatrix4(r.matrixWorld)}_render(e,t,n,s,r=this._target,o=this._pixel){let{renderer:a,camera:l}=this,c={target:a.getRenderTarget(),color:a.getClearColor(new Ve),alpha:a.getClearAlpha(),autoClear:a.autoClear},h=this.scene._buckets[0]?.material;e.clippingPlanes=h?.clippingPlanes??null,e.clipIntersection=h?.clipIntersection??!1,l.updateMatrixWorld(),l.setViewOffset(s.width,s.height,t,n,r.width,r.height);try{if(a.setRenderTarget(r),a.setClearColor(0,0),this.scene.withMaterial(e,()=>a.render(this.scene.root,l),{pickCamera:l}),this.points){a.autoClear=!1;let d=e===this._depthMaterial?this._pointDepthMaterial:this._pointMaterial;this.points.withPickMaterial(d,()=>a.render(this.points.root,l))}if(this.lines){a.autoClear=!1;let d=e===this._depthMaterial?this._lineDepthMaterial:this._lineMaterial;this.lines.withPickMaterial(d,()=>a.render(this.lines.root,l))}a.readRenderTargetPixels(r,0,0,r.width,r.height,o)}finally{a.setRenderTarget(c.target),a.setClearColor(c.color,c.alpha),a.autoClear=c.autoClear,l.clearViewOffset()}return o}};var xl=33.333333333333336,ab=200,yp=1e6,lb=20,vl=class{constructor(e,t,n=1e7){this.scene=e,this.budget=n,this.minPixels=0,this._requestRender=t,this._last=new Float64Array(32),this._seen=!1,this._requestedAt=null,this._frame=null,this._cost=0,this._fastFrames=0,this._refine=!1,this._settle=0}requested(e){this._requestedAt??(this._requestedAt=e)}begin(e,t,n){e.updateMatrixWorld();let s=this._requestedAt===null?0:Math.max(n-this._requestedAt,0);this._requestedAt=null;let r=this._moved(e);this._frame=r?{start:n,waited:s}:null,this.minPixels=r?this.scene.detailThreshold(e,t,this.budget,this._refine):0,r||(this._fastFrames=0),this.scene.setDetail(this.minPixels,t),r&&(clearTimeout(this._settle),this.minPixels>0&&(this._settle=setTimeout(this._requestRender,ab)))}end(e){this.scene.setDetail(0),this._frame&&this._adapt(this._frame.waited+(e-this._frame.start)),this._frame=null}_adapt(e){this._cost=this._cost?this._cost*.8+e*.2:e,e>xl*1.1?(this._refine=!1,this._fastFrames=0):this._refine||(this._fastFrames=this.minPixels>0&&e=lb),this._cost>xl*1.1?this.budget=Math.max(this.budget*.9,yp):this._cost0&&(this.budget=Math.max(Math.min(this.budget*1.05,this.scene.visibleCost),yp))}_moved(e){let t=this._last,n=[...e.matrixWorld.elements,...e.projectionMatrix.elements],s=(o,a)=>a!==26&&a!==30&&Math.abs(o-t[a])>1e-9*Math.max(1,Math.abs(o)),r=this._seen&&n.some(s);return this._seen=!0,t.set(n),r}};var Ln,Xs,yl,bl=class extends EventTarget{constructor(){super(...arguments);Gl(this,Xs);Gl(this,Ln,new Set)}get size(){return di(this,Ln).size}has(t){return di(this,Ln).has(t)}values(){return di(this,Ln).values()}set(t){yu(this,Ln,new Set(t)),to(this,Xs,yl).call(this)}toggle(t){di(this,Ln).delete(t)||di(this,Ln).add(t),to(this,Xs,yl).call(this)}clear(){di(this,Ln).size!==0&&(di(this,Ln).clear(),to(this,Xs,yl).call(this))}};Ln=new WeakMap,Xs=new WeakSet,yl=function(){this.dispatchEvent(new Event("change"))};function bp(i,e,t){if(e!=="window"&&e!=="crossing")throw new RangeError(`Unknown box select mode: ${e}`);let n=i.x+i.width,s=i.y+i.height,r=e==="window"?o=>o.minX>=i.x&&o.maxX<=n&&o.minY>=i.y&&o.maxY<=s:o=>o.maxX>=i.x&&o.minX<=n&&o.maxY>=i.y&&o.minY<=s;return t.filter(r).map(o=>o.index)}function Mp(i,e,t){let n=new Ke().multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse).elements,{left:s,top:r,width:o,height:a}=t,l=new at,c=[];for(let h=0;hn===l?r(l):o(l));let g=[...e.children].find(x=>Sp.indexOf(x.dataset.panel)>m);e.insertBefore(_,g??null);let p=K("section","ioviewer-side-panel ioviewer-floating");p.dataset.panel=l,p.hidden=!0,p.setAttribute("aria-label",h);let y=en("ioviewer-panel-close",ot.close,X("close"));y.addEventListener("click",()=>r(l));let w=K("header","ioviewer-panel-header");w.append(K("h2","",h),y);let b=K("div","ioviewer-panel-body");p.append(w,b),i.append(p),t.set(l,{button:_,panel:p,onClose:f}),d(b)}return{rail:e,openPanel:o,closePanel:r,registerPanel:a}}var Ep=[{id:"navigation",items:["orbit","pan","fit","projection","mode2d"]},{id:"sections",items:["plane","box","resetSections"]},{id:"measure",items:["distance"]},{id:"display",items:["displayMode","grids","opacity"]},{id:"view",items:["fullscreen"]}];function Tp(i,e){let t=K("div","ioviewer-toolbar ioviewer-floating");t.setAttribute("role","toolbar");let n=new Map;for(let a of e){let l=K("div","ioviewer-toolbar-group");l.setAttribute("role","group"),l.setAttribute("aria-label",X(`group.${a.id}`));let c=K("div","ioviewer-toolbar-row");for(let h of a.items){let d=en("ioviewer-tool",ot[h],X(`tool.${h}`));d.dataset.tool=h,d.setAttribute("aria-disabled","true");let u={button:d,handler:null};d.addEventListener("click",()=>{d.getAttribute("aria-disabled")!=="true"&&u.handler?.()}),n.set(h,u),c.append(d)}l.append(c,K("div","ioviewer-toolbar-label",X(`group.${a.id}`))),t.append(l)}i.append(t),new ResizeObserver(()=>i.style.setProperty("--toolbar-height",`${t.offsetHeight}px`)).observe(t);function r(a){let l=n.get(a);if(!l)throw new RangeError(`Unknown tool: ${a}`);return l}function o(a,l){r(a).button.setAttribute("aria-disabled",String(!l))}return{element:t,setHandler(a,l){r(a).handler=l,o(a,!0)},setEnabled:o,setActive(a,l){let{button:c}=r(a);c.classList.toggle("active",l),c.setAttribute("aria-pressed",String(l))}}}var cb="input, textarea, select, [contenteditable]";function Wh(i){return i.key==="ContextMenu"||i.code==="ContextMenu"||i.shiftKey&&(i.key==="F10"||i.code==="F10")}function Ap(i){if(i.ctrlKey||i.altKey||i.metaKey||i.repeat||i.target?.closest?.(cb))return null;if(Wh(i))return"contextMenu";switch(i.code){case"KeyH":return i.shiftKey?"showAll":"hide";case"KeyI":return i.shiftKey?null:"isolate";case"KeyF":return i.shiftKey?null:"zoomTo";case"Escape":return"escape";default:return null}}function Rp(i,e,t,n,s){let r=K("details","ioviewer-tree-filters");r.hidden=i.length===0;let o=K("summary","",X("filters.title")),a=K("div","ioviewer-filter-fields"),l=new Map(e.map(({id:x,name:S})=>[x,S||`#${x}`])),c=x=>x.modelId??e[0]?.id??null,h=x=>x.levelId??(x.level||null),d=x=>x.category??"",u=[{name:X("filters.model"),key:c,labels:new Map},{name:X("level"),key:h,labels:new Map},{name:X("category"),key:d,labels:new Map}],[f,m,_]=u,g=K("div","ioviewer-filter-actions"),p=K("button","ioviewer-text-button",X("filters.clear"));p.type="button",p.addEventListener("click",()=>{for(let x of u)x.select&&(x.select.selectedIndex=0);t.value="",n(),t.focus()});let y=K("button","ioviewer-text-button",X("filters.isolate"));y.type="button",y.addEventListener("click",s),g.append(p,y),r.append(o,a,g);function w(){if(r.open){r.removeEventListener("toggle",w);for(let x of i){let S=c(x),A=l.get(S)??(S==null?"":`#${S}`);S!=null&&f.labels.set(S,A);let v=h(x);if(!m.labels.has(v)){let R=x.level||(v==null?X("filters.noLevel"):`#${v}`);m.labels.set(v,v!=null&&e.length>1&&A?`${R} \xB7 ${A}`:R)}let E=d(x);_.labels.set(E,E||X("noCategory"))}for(let x of u){if(!x.labels.size)continue;let S=new Map;for(let R of x.labels.values())S.set(R,(S.get(R)??0)+1);let A=[...x.labels].map(([R,L])=>[R,S.get(L)>1?`${L} (#${R})`:L]);A.sort((R,L)=>R[1].localeCompare(L[1])),x.keys=A.map(([R])=>R);let v=x.select=K("select");v.append(new Option(X("filters.all"),""));for(let[R,[,L]]of A.entries())v.append(new Option(L,String(R+1)));v.addEventListener("change",n);let E=K("label","ioviewer-filter-field");E.append(K("span","",x.name),v),a.append(E)}}}r.addEventListener("toggle",w);function b(){return u.filter(x=>x.select?.selectedIndex>0)}return{element:r,predicate(){let x=b().map(({select:S,keys:A,key:v})=>({key:v,value:A[S.selectedIndex-1]}));return x.length?S=>x.every(({key:A,value:v})=>A(S)===v):null},update(x,S){let A=b().length;o.textContent=A?`${X("filters.title")} (${A})`:X("filters.title"),p.disabled=!A&&!x,y.disabled=!S}}}var Ii=24,hb=8;function Xh(i,e,t,n,s){let r=Math.min(n,Math.max(0,Math.floor(i/e)-s)),o=Math.min(n,Math.ceil((i+t)/e)+s);return{start:r,end:Math.max(r,o)}}function ub(i){let e=null;return t=>{let n=t.trim().toLowerCase();e??(e=i.map(r=>`${r.name??""} ${r.type??""} ${r.id} -${r.sourceId??""}`.toLowerCase()));let s=[];for(let r=0;r{let s=e.category??"";t.has(s)||t.set(s,[]),t.get(s).push(n)}),[...t].map(([e,n])=>({name:e,indices:n})).sort((e,n)=>e.name.localeCompare(n.name))}function gp(i,{elements:t,models:e,selection:n,scene:s,zoomToElement:r,openContextMenu:o}){let a=tM(t),l=new Int32Array(t.length);a.forEach((G,J)=>G.indices.forEach(it=>l[it]=J));let c=new Uint8Array(a.length),h=new Int32Array(a.length),d=new Uint32Array(a.length),u=Qy(t),f="",m=!1,_=new Int32Array(0),g=0,p=-1,y=null,w=!1,M=K("input","ioviewer-tree-search");M.type="search",M.placeholder=q("searchPlaceholder"),M.setAttribute("aria-label",q("searchPlaceholder"));let x=K("div","ioviewer-tree");x.setAttribute("role","tree"),x.setAttribute("aria-label",q("panel.model")),x.setAttribute("aria-multiselectable","true"),x.tabIndex=-1;let S=K("div","ioviewer-tree-spacer");S.setAttribute("role","presentation"),x.append(S);let A=K("div","ioviewer-tree-empty",q("noMatches")),v=mp(t,e,M,U,()=>s.isolate(_));i.append(v.element,M,x,A);function E(){let G=_[g],J=v.predicate();if(m=!!(f||J),m){let nt=f?u(f):t.keys();if(J){let at=[];for(let O of nt)J(t[O])&&at.push(O);_=Int32Array.from(at)}else _=Int32Array.from(nt)}else{let nt=a.length;a.forEach((O,$)=>c[$]&&(nt+=O.indices.length)),_=new Int32Array(nt);let at=0;a.forEach((O,$)=>{if(h[$]=at,_[at++]=-($+1),c[$])for(let rt of O.indices)_[at++]=rt})}let it=_.indexOf(G);g=it>=0?it:0,S.style.height=`${_.length*Ii}px`,A.hidden=_.length>0||!m,v.update(f,!!s.isolate&&m&&_.some(nt=>s.instancesOf(nt).length>0)),R()}function R(G=x.contains(document.activeElement)){let J=x.clientHeight;if(J===0||_.length===0){S.replaceChildren();return}let it=x.scrollTop,{start:nt,end:at}=Vh(it,Ii,J,_.length,jy);!G&&(g=at)&&(g=Math.min(_.length-1,Math.floor(it/Ii)));let O=[];g=at&&O.push(L(g)),S.replaceChildren(...O),G&&S.querySelector('[tabindex="0"]')?.focus({preventScroll:!0})}function L(G){let J=_[G],it=J<0?-J-1:l[J],nt=J<0?d[it]===a[it].indices.length:n.has(J),at=K("div","tree-row");if(at.style.top=`${G*Ii}px`,at.style.height=`${Ii}px`,at.dataset.row=G,at.tabIndex=G===g?0:-1,at.setAttribute("role","treeitem"),at.classList.toggle("selected",nt),at.setAttribute("aria-selected",String(nt)),J<0){at.classList.add("tree-category"),at.setAttribute("aria-level","1"),at.setAttribute("aria-posinset",String(it+1)),at.setAttribute("aria-setsize",String(a.length)),at.setAttribute("aria-expanded",String(!!c[it]));let O=K("span","tree-chevron");O.innerHTML=oe.chevron;let{name:$,indices:rt}=a[it];at.append(O,K("span","tree-name",$||q("noCategory")),K("span","tree-count",Ci(rt.length)))}else{let O=t[J];at.classList.add("tree-element"),at.setAttribute("aria-level",m?"1":"2"),at.setAttribute("aria-posinset",String(m?G+1:G-h[it])),at.setAttribute("aria-setsize",String(m?_.length:a[it].indices.length)),at.classList.toggle("tree-child",!m),at.classList.toggle("tree-hidden",s.isVisible?.(J)===!1),at.append(K("span","tree-name",O.name||`#${O.id}`),K("span","tree-type",O.type??""))}return at}function N(G){let J=x.clientHeight;if(J===0){p=G;return}let it=G*Ii;itx.scrollTop+J&&(x.scrollTop=it+Ii-J)}function B(G){g=G,N(G),R(!0)}function D(G){let J=l[G];!m&&!c[J]&&(c[J]=1,E());let it=_.indexOf(G);it>=0&&(x.contains(document.activeElement)||(g=it),N(it)),R()}function F(G){w=!0;try{n.set(G)}finally{w=!1}}function H(G,J){let it=_.indexOf(y);it<0&&(it=G,y=_[G]);let nt=_.subarray(Math.min(it,G),Math.max(it,G)+1).filter(at=>at>=0);nt.length>0&&F(J?[...n.values(),...nt]:nt)}function V(G){y=G;let J=-G-1,it=G<0?a[J].indices:[G],nt=G<0?d[J]===it.length:n.has(G),at=new Set(n.values());for(let O of it)nt?at.delete(O):at.add(O);F(at)}function z(G,J,it){G>=0&&!n.has(G)&&(y=G,F([G]));let nt=G>=0?G:n.values().next().value??null;o(J,it,nt,()=>{let at=_.indexOf(G);at>=0?B(at):M.focus()})}M.addEventListener("focus",()=>{S.firstElementChild||Y()});function U(){f=M.value.trim(),x.scrollTop=0,p=-1,g=-1,E()}M.addEventListener("input",U),x.addEventListener("scroll",()=>R()),x.addEventListener("focusin",G=>{let J=G.target.closest(".tree-row");!J||J.tabIndex===0||(S.querySelector('[tabindex="0"]')?.setAttribute("tabindex","-1"),g=Number(J.dataset.row),J.tabIndex=0)}),x.addEventListener("keydown",G=>{let J=G.target.closest(".tree-row");if(!J||G.ctrlKey||G.altKey||G.metaKey)return;let it=Number(J.dataset.row),nt=_[it];if(Hh(G)){if(G.preventDefault(),!G.repeat){let{left:O,bottom:$}=J.getBoundingClientRect();z(nt,O,$)}return}if(G.key===" "){G.preventDefault(),G.repeat||(G.shiftKey?H(it,!1):V(nt));return}if(G.shiftKey)return;let at=it;switch(G.key){case"ArrowUp":at=Math.max(0,it-1);break;case"ArrowDown":at=Math.min(_.length-1,it+1);break;case"Home":at=0;break;case"End":at=_.length-1;break;case"ArrowRight":nt<0&&(c[-nt-1]?at=it+1:(c[-nt-1]=1,E()));break;case"ArrowLeft":nt>=0&&!m?at=h[l[nt]]:nt<0&&c[-nt-1]&&(c[-nt-1]=0,E());break;case"Enter":G.repeat||k(nt);break;default:return}G.preventDefault(),at!==it&&B(at)});function k(G){if(G>=0){y=G,F([G]),r(G);return}c[-G-1]^=1,E()}x.addEventListener("click",G=>{let J=G.target.closest(".tree-row");if(!J)return;let it=Number(J.dataset.row),nt=G.ctrlKey||G.metaKey;G.shiftKey?H(it,nt):nt?V(_[it]):k(_[it])}),x.addEventListener("contextmenu",G=>{let J=G.target.closest(".tree-row");J&&(G.preventDefault(),z(_[Number(J.dataset.row)],G.clientX,G.clientY))});function Y(){p>=0&&x.clientHeight>0&&(N(p),p=-1),R()}new ResizeObserver(Y).observe(x),n.addEventListener("change",()=>{let G=-1;d.fill(0);for(let J of n.values())d[l[J]]++,G=J;if(w){R();return}y=null,G>=0?D(G):R()}),s.root?.addEventListener("change",G=>G.detail.kind==="visibility"&&R()),E()}var _p={element:["properties","hide","isolate","showAll","-","zoomTo","sectionBox","-","copyId"],empty:["showAll","fitAll","resetSections"]},eM={hide:"H",isolate:"I",showAll:"Shift+H",zoomTo:"F"},Ml=4;function xp(i){let t=K("div","ioviewer-context-menu");t.setAttribute("role","menu"),t.setAttribute("aria-label",q("contextMenu")),t.hidden=!0,i.append(t);let e=new Map(Object.values(_p).flat().filter(c=>c!=="-").map(c=>[c,{enabled:!1,handler:null}])),n=null;function s(){if(t.hidden)return;let c=t.contains(document.activeElement)?n:null;n=null,t.hidden=!0,t.replaceChildren(),window.removeEventListener("pointerdown",o,!0),window.removeEventListener("wheel",s,!0),window.removeEventListener("scroll",r,!0),window.removeEventListener("resize",s),c?.()}function r(c){i.contains(c.target)||s()}function o(c){t.contains(c.target)||(s(),fl(c))}function a(c,h,d,u,f=null){let m=_p[c];if(!m)throw new RangeError(`Unknown menu: ${c}`);s(),n=f;for(let p of m){if(p==="-"){let M=K("div","ioviewer-menu-separator");M.setAttribute("role","separator"),t.append(M);continue}let y=e.get(p),w=K("button","ioviewer-menu-item");w.type="button",w.tabIndex=-1,w.dataset.item=p,w.setAttribute("role","menuitem"),w.setAttribute("aria-disabled",String(!y.enabled)),y.enabled||(w.title=q("menu.unavailable")),w.append(K("span","",q(`menu.${p}`)),K("kbd","",eM[p]??"")),w.addEventListener("click",()=>{y.enabled&&(s(),y.handler(u))}),t.append(w)}t.hidden=!1;let{width:_,height:g}=t.getBoundingClientRect();t.style.left=`${Math.max(Ml,Math.min(h,innerWidth-_-Ml))}px`,t.style.top=`${Math.max(Ml,Math.min(d,innerHeight-g-Ml))}px`,window.addEventListener("pointerdown",o,!0),window.addEventListener("wheel",s,!0),window.addEventListener("scroll",r,!0),window.addEventListener("resize",s),f&&t.querySelector("button")?.focus({preventScroll:!0})}t.addEventListener("keydown",c=>{if(c.key==="Tab"){s();return}if(c.key==="Escape"){c.preventDefault(),s();return}let h=[...t.querySelectorAll("button")],d=h.indexOf(document.activeElement),u;switch(c.key){case"ArrowDown":u=(d+1)%h.length;break;case"ArrowUp":u=(d+h.length-1)%h.length;break;case"Home":u=0;break;case"End":u=h.length-1;break;default:return}c.preventDefault(),h[u]?.focus({preventScroll:!0})});function l(c,{enabled:h=!0,handler:d}){let u=e.get(c);if(!u)throw new RangeError(`Unknown menu item: ${c}`);d&&(u.handler=d),u.enabled=h&&!!u.handler}return{element:t,open:a,close:s,setItem:l,get isOpen(){return!t.hidden}}}var nM=1600;function vp(i,t,e){let n=()=>i.textContent=`${q("selected")}: ${Ci(t.size)} \xB7 ${q("elements")}: ${Ci(e)}`;t.addEventListener("change",n),n()}function yp(i,t){if(!t)return;let e=K("div","ioviewer-banner ioviewer-floating");e.setAttribute("role","status");let n=q("truncated").replace("{meshes}",t.meshes).replace("{total}",t.totalMeshes),s=tn("ioviewer-panel-close",oe.close,q("close")),r=new ResizeObserver(()=>i.style.setProperty("--banner-height",`${e.offsetHeight}px`));s.addEventListener("click",()=>{r.disconnect(),i.style.removeProperty("--banner-height"),e.remove()}),e.append(K("span","",n),s),i.append(e),r.observe(e)}function Xs(i,t){let e=K("div","ioviewer-toast",t);e.setAttribute("role","status"),i.append(e),setTimeout(()=>e.remove(),nM)}function Mp(i,t){let e=K("table");for(let[s,r]of t)e.insertRow().append(K("th","",s),K("td","",String(r??"")));let n=K("section");return n.append(K("h3","",i),e),n}function bp(i,t,e){let n=K("h2","ioviewer-properties-title"),s=K("button","ioviewer-properties-close","\xD7");s.type="button",s.title=q("close"),s.setAttribute("aria-label",q("close")),s.addEventListener("click",()=>t.clear());let r=K("header");r.append(n,s);let o=K("div","ioviewer-properties-body");i.replaceChildren(r,o),i.hidden=!0;let a=h=>{let d=[[q("id"),h.id],[q("category"),h.category],[q("type"),h.type],[q("level"),h.level]];return h.sourceId&&d.push([q("sourceId"),h.sourceId]),h.link&&d.push([q("link"),h.link]),Mp(q("elementGroup"),d)},l=h=>{for(let[d,u]of Object.entries(h??{}))o.append(Mp(d,Object.entries(u)))},c;t.addEventListener("change",()=>{if(c?.abort(),c=void 0,o.removeAttribute("aria-busy"),i.hidden=t.size===0,o.replaceChildren(),t.size!==1){n.textContent=`${q("selected")}: ${t.size}`;return}let[h]=t.values(),d=e.meta.elements[h];if(n.textContent=d.name||`#${d.id}`,o.append(a(d)),!e.loadProperties){l(e.props(d.id));return}let u=new AbortController;c=u,o.setAttribute("aria-busy","true"),e.loadProperties(h,u.signal).then(f=>{u.signal.aborted||!f||(n.textContent=f.name||d.name||`#${d.id}`,o.replaceChildren(a({...d,...f})),l(f.properties))}).catch(()=>{u.signal.aborted||o.append(K("p","",q("badData")))}).finally(()=>{c===u&&o.removeAttribute("aria-busy")})})}var Ji=["length_m","area_m2","volume_m3"],iM=new Set(["elementId","categoryId","typeId",...Ji]),Sp=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,wp=new Intl.Collator(void 0,{sensitivity:"base"}),Ep="TOTAL",Tp="SUBTOTAL",bl="element_count";function sM(i){let t=[],e=[],n="",s=!1,r=!1;for(let o=0;oh!==e.length-1&&!(o&&c[n]===Tp&&c.length===t.length)):e,l=new Map;for(let c=0;c{let o=t[r[i.idColumn]],a=r[e];return o!==null&&(o===void 0||!a?.trim()||o===a)}),s=i.rows.length-n.length;return{csv:s?{...i,...Wh(i,n)}:i,conflicts:s}}function Cp(i,t,e){let n=t.trim().toLowerCase();if(!n&&e===null)return i;let s=i.columns.indexOf("name"),r=i.columns.indexOf("category"),o=[],a=new Map;for(let l of i.rows){let c=l[i.idColumn];e!==null&&l[r]!==e||n&&!c.includes(n)&&!l[s]?.toLowerCase().includes(n)||(a.set(c,o.length),o.push(l))}return{rows:o,rowById:a}}function Ip(i,t,e,n){return Wh(i,Pp(t.rows,e,i.columns[e],n))}function Pp(i,t,e,n){let s=iM.has(e),r=i.map(o=>{let a=o[t].trim(),l=s?Dp(a):a;return{row:o,key:l,missing:s?!Number.isFinite(l):!a}});return r.sort((o,a)=>{if(o.missing||a.missing)return Number(o.missing)-Number(a.missing);let l=s?o.key-a.key:wp.compare(o.key,a.key);return n?l:-l}),r.map(({row:o})=>o)}function Wh(i,t){let e=new Map;return t.forEach((n,s)=>e.set(n[i.idColumn],s)),{rows:t,rowById:e}}function Lp(i,t,e=-1,n=!0){let s=i.columns.indexOf("category");if(s<0)return t;let r=new Map;for(let l of t.rows){let c=l[s];r.has(c)||r.set(c,[]),r.get(c).push(l)}let o=[...r].sort(([l],[c])=>{if(!l||!c)return+!l-+!c;let h=wp.compare(l,c);return e===s&&!n?-h:h}).map(([l,c])=>{let h=Xh(i,c);return e>=0&&e!==s&&(c=Pp(c,e,i.columns[e],n)),{category:l,rows:c,totals:h}}),a=0;for(let l of o)l.start=a,a+=l.rows.length;return{...Wh(i,o.flatMap(l=>l.rows)),groups:o}}function Xh(i,t){return Ji.map(e=>{let n=i.columns.indexOf(e);if(n<0)return null;let s=0,r=!1;for(let o of t){let a=Dp(o[n].trim());Number.isFinite(a)&&(s+=a,r=!0)}return r&&Number.isFinite(s)?s:null})}function Dp(i){return Sp.test(i)?Number(i):NaN}function Np(i,t,e=null,n=null){let s=e!==null&&!i.includes(bl),r=s?[...i,bl]:i,o=[r.map(Gh).join(",")],a=c=>{for(let h of c)o.push(h.map(Gh).join(",")+(s?",":""))},l=(c,h,d,u="")=>{let f=r.map(m=>{if(m==="elementId")return c;if(m===bl)return String(h);if(m==="category")return u;let _=d[Ji.indexOf(m)];return _==null?"":String(_)});o.push(f.map(Gh).join(","))};if(n)for(let c of n)a(c.rows),l(Tp,c.rows.length,c.totals,c.category);else a(t);return e!==null&&l(Ep,t.length,e),"\uFEFF"+o.join(`\r +${r.sourceId??""}`.toLowerCase()));let s=[];for(let r=0;r{let s=t.category??"";e.has(s)||e.set(s,[]),e.get(s).push(n)}),[...e].map(([t,n])=>({name:t,indices:n})).sort((t,n)=>t.name.localeCompare(n.name))}function Cp(i,{elements:e,models:t,selection:n,scene:s,zoomToElement:r,openContextMenu:o}){let a=db(e),l=new Int32Array(e.length);a.forEach((G,J)=>G.indices.forEach(ie=>l[ie]=J));let c=new Uint8Array(a.length),h=new Int32Array(a.length),d=new Uint32Array(a.length),u=ub(e),f="",m=!1,_=new Int32Array(0),g=0,p=-1,y=null,w=!1,b=K("input","ioviewer-tree-search");b.type="search",b.placeholder=X("searchPlaceholder"),b.setAttribute("aria-label",X("searchPlaceholder"));let x=K("div","ioviewer-tree");x.setAttribute("role","tree"),x.setAttribute("aria-label",X("panel.model")),x.setAttribute("aria-multiselectable","true"),x.tabIndex=-1;let S=K("div","ioviewer-tree-spacer");S.setAttribute("role","presentation"),x.append(S);let A=K("div","ioviewer-tree-empty",X("noMatches")),v=Rp(e,t,b,U,()=>s.isolate(_));i.append(v.element,b,x,A);function E(){let G=_[g],J=v.predicate();if(m=!!(f||J),m){let ne=f?u(f):e.keys();if(J){let ae=[];for(let O of ne)J(e[O])&&ae.push(O);_=Int32Array.from(ae)}else _=Int32Array.from(ne)}else{let ne=a.length;a.forEach((O,$)=>c[$]&&(ne+=O.indices.length)),_=new Int32Array(ne);let ae=0;a.forEach((O,$)=>{if(h[$]=ae,_[ae++]=-($+1),c[$])for(let re of O.indices)_[ae++]=re})}let ie=_.indexOf(G);g=ie>=0?ie:0,S.style.height=`${_.length*Ii}px`,A.hidden=_.length>0||!m,v.update(f,!!s.isolate&&m&&_.some(ne=>s.instancesOf(ne).length>0)),R()}function R(G=x.contains(document.activeElement)){let J=x.clientHeight;if(J===0||_.length===0){S.replaceChildren();return}let ie=x.scrollTop,{start:ne,end:ae}=Xh(ie,Ii,J,_.length,hb);!G&&(g=ae)&&(g=Math.min(_.length-1,Math.floor(ie/Ii)));let O=[];g=ae&&O.push(L(g)),S.replaceChildren(...O),G&&S.querySelector('[tabindex="0"]')?.focus({preventScroll:!0})}function L(G){let J=_[G],ie=J<0?-J-1:l[J],ne=J<0?d[ie]===a[ie].indices.length:n.has(J),ae=K("div","tree-row");if(ae.style.top=`${G*Ii}px`,ae.style.height=`${Ii}px`,ae.dataset.row=G,ae.tabIndex=G===g?0:-1,ae.setAttribute("role","treeitem"),ae.classList.toggle("selected",ne),ae.setAttribute("aria-selected",String(ne)),J<0){ae.classList.add("tree-category"),ae.setAttribute("aria-level","1"),ae.setAttribute("aria-posinset",String(ie+1)),ae.setAttribute("aria-setsize",String(a.length)),ae.setAttribute("aria-expanded",String(!!c[ie]));let O=K("span","tree-chevron");O.innerHTML=ot.chevron;let{name:$,indices:re}=a[ie];ae.append(O,K("span","tree-name",$||X("noCategory")),K("span","tree-count",Ci(re.length)))}else{let O=e[J];ae.classList.add("tree-element"),ae.setAttribute("aria-level",m?"1":"2"),ae.setAttribute("aria-posinset",String(m?G+1:G-h[ie])),ae.setAttribute("aria-setsize",String(m?_.length:a[ie].indices.length)),ae.classList.toggle("tree-child",!m),ae.classList.toggle("tree-hidden",s.isVisible?.(J)===!1),ae.append(K("span","tree-name",O.name||`#${O.id}`),K("span","tree-type",O.type??""))}return ae}function N(G){let J=x.clientHeight;if(J===0){p=G;return}let ie=G*Ii;iex.scrollTop+J&&(x.scrollTop=ie+Ii-J)}function B(G){g=G,N(G),R(!0)}function D(G){let J=l[G];!m&&!c[J]&&(c[J]=1,E());let ie=_.indexOf(G);ie>=0&&(x.contains(document.activeElement)||(g=ie),N(ie)),R()}function F(G){w=!0;try{n.set(G)}finally{w=!1}}function H(G,J){let ie=_.indexOf(y);ie<0&&(ie=G,y=_[G]);let ne=_.subarray(Math.min(ie,G),Math.max(ie,G)+1).filter(ae=>ae>=0);ne.length>0&&F(J?[...n.values(),...ne]:ne)}function V(G){y=G;let J=-G-1,ie=G<0?a[J].indices:[G],ne=G<0?d[J]===ie.length:n.has(G),ae=new Set(n.values());for(let O of ie)ne?ae.delete(O):ae.add(O);F(ae)}function z(G,J,ie){G>=0&&!n.has(G)&&(y=G,F([G]));let ne=G>=0?G:n.values().next().value??null;o(J,ie,ne,()=>{let ae=_.indexOf(G);ae>=0?B(ae):b.focus()})}b.addEventListener("focus",()=>{S.firstElementChild||Y()});function U(){f=b.value.trim(),x.scrollTop=0,p=-1,g=-1,E()}b.addEventListener("input",U),x.addEventListener("scroll",()=>R()),x.addEventListener("focusin",G=>{let J=G.target.closest(".tree-row");!J||J.tabIndex===0||(S.querySelector('[tabindex="0"]')?.setAttribute("tabindex","-1"),g=Number(J.dataset.row),J.tabIndex=0)}),x.addEventListener("keydown",G=>{let J=G.target.closest(".tree-row");if(!J||G.ctrlKey||G.altKey||G.metaKey)return;let ie=Number(J.dataset.row),ne=_[ie];if(Wh(G)){if(G.preventDefault(),!G.repeat){let{left:O,bottom:$}=J.getBoundingClientRect();z(ne,O,$)}return}if(G.key===" "){G.preventDefault(),G.repeat||(G.shiftKey?H(ie,!1):V(ne));return}if(G.shiftKey)return;let ae=ie;switch(G.key){case"ArrowUp":ae=Math.max(0,ie-1);break;case"ArrowDown":ae=Math.min(_.length-1,ie+1);break;case"Home":ae=0;break;case"End":ae=_.length-1;break;case"ArrowRight":ne<0&&(c[-ne-1]?ae=ie+1:(c[-ne-1]=1,E()));break;case"ArrowLeft":ne>=0&&!m?ae=h[l[ne]]:ne<0&&c[-ne-1]&&(c[-ne-1]=0,E());break;case"Enter":G.repeat||k(ne);break;default:return}G.preventDefault(),ae!==ie&&B(ae)});function k(G){if(G>=0){y=G,F([G]),r(G);return}c[-G-1]^=1,E()}x.addEventListener("click",G=>{let J=G.target.closest(".tree-row");if(!J)return;let ie=Number(J.dataset.row),ne=G.ctrlKey||G.metaKey;G.shiftKey?H(ie,ne):ne?V(_[ie]):k(_[ie])}),x.addEventListener("contextmenu",G=>{let J=G.target.closest(".tree-row");J&&(G.preventDefault(),z(_[Number(J.dataset.row)],G.clientX,G.clientY))});function Y(){p>=0&&x.clientHeight>0&&(N(p),p=-1),R()}new ResizeObserver(Y).observe(x),n.addEventListener("change",()=>{let G=-1;d.fill(0);for(let J of n.values())d[l[J]]++,G=J;if(w){R();return}y=null,G>=0?D(G):R()}),s.root?.addEventListener("change",G=>G.detail.kind==="visibility"&&R()),E()}var Ip={element:["properties","hide","isolate","showAll","-","zoomTo","sectionBox","-","copyId"],empty:["showAll","fitAll","resetSections"]},fb={hide:"H",isolate:"I",showAll:"Shift+H",zoomTo:"F"},Ml=4;function Pp(i){let e=K("div","ioviewer-context-menu");e.setAttribute("role","menu"),e.setAttribute("aria-label",X("contextMenu")),e.hidden=!0,i.append(e);let t=new Map(Object.values(Ip).flat().filter(c=>c!=="-").map(c=>[c,{enabled:!1,handler:null}])),n=null;function s(){if(e.hidden)return;let c=e.contains(document.activeElement)?n:null;n=null,e.hidden=!0,e.replaceChildren(),window.removeEventListener("pointerdown",o,!0),window.removeEventListener("wheel",s,!0),window.removeEventListener("scroll",r,!0),window.removeEventListener("resize",s),c?.()}function r(c){i.contains(c.target)||s()}function o(c){e.contains(c.target)||(s(),pl(c))}function a(c,h,d,u,f=null){let m=Ip[c];if(!m)throw new RangeError(`Unknown menu: ${c}`);s(),n=f;for(let p of m){if(p==="-"){let b=K("div","ioviewer-menu-separator");b.setAttribute("role","separator"),e.append(b);continue}let y=t.get(p),w=K("button","ioviewer-menu-item");w.type="button",w.tabIndex=-1,w.dataset.item=p,w.setAttribute("role","menuitem"),w.setAttribute("aria-disabled",String(!y.enabled)),y.enabled||(w.title=X("menu.unavailable")),w.append(K("span","",X(`menu.${p}`)),K("kbd","",fb[p]??"")),w.addEventListener("click",()=>{y.enabled&&(s(),y.handler(u))}),e.append(w)}e.hidden=!1;let{width:_,height:g}=e.getBoundingClientRect();e.style.left=`${Math.max(Ml,Math.min(h,innerWidth-_-Ml))}px`,e.style.top=`${Math.max(Ml,Math.min(d,innerHeight-g-Ml))}px`,window.addEventListener("pointerdown",o,!0),window.addEventListener("wheel",s,!0),window.addEventListener("scroll",r,!0),window.addEventListener("resize",s),f&&e.querySelector("button")?.focus({preventScroll:!0})}e.addEventListener("keydown",c=>{if(c.key==="Tab"){s();return}if(c.key==="Escape"){c.preventDefault(),s();return}let h=[...e.querySelectorAll("button")],d=h.indexOf(document.activeElement),u;switch(c.key){case"ArrowDown":u=(d+1)%h.length;break;case"ArrowUp":u=(d+h.length-1)%h.length;break;case"Home":u=0;break;case"End":u=h.length-1;break;default:return}c.preventDefault(),h[u]?.focus({preventScroll:!0})});function l(c,{enabled:h=!0,handler:d}){let u=t.get(c);if(!u)throw new RangeError(`Unknown menu item: ${c}`);d&&(u.handler=d),u.enabled=h&&!!u.handler}return{element:e,open:a,close:s,setItem:l,get isOpen(){return!e.hidden}}}var pb=1600;function Lp(i,e,t){let n=()=>i.textContent=`${X("selected")}: ${Ci(e.size)} \xB7 ${X("elements")}: ${Ci(t)}`;e.addEventListener("change",n),n()}function Dp(i,e){if(!e)return;let t=K("div","ioviewer-banner ioviewer-floating");t.setAttribute("role","status");let n=X("truncated").replace("{meshes}",e.meshes).replace("{total}",e.totalMeshes),s=en("ioviewer-panel-close",ot.close,X("close")),r=new ResizeObserver(()=>i.style.setProperty("--banner-height",`${t.offsetHeight}px`));s.addEventListener("click",()=>{r.disconnect(),i.style.removeProperty("--banner-height"),t.remove()}),t.append(K("span","",n),s),i.append(t),r.observe(t)}function qs(i,e){let t=K("div","ioviewer-toast",e);t.setAttribute("role","status"),i.append(t),setTimeout(()=>t.remove(),pb)}function Np(i,e){let t=K("table");for(let[s,r]of e)t.insertRow().append(K("th","",s),K("td","",String(r??"")));let n=K("section");return n.append(K("h3","",i),t),n}function Up(i,e,t){let n=K("h2","ioviewer-properties-title"),s=K("button","ioviewer-properties-close","\xD7");s.type="button",s.title=X("close"),s.setAttribute("aria-label",X("close")),s.addEventListener("click",()=>e.clear());let r=K("header");r.append(n,s);let o=K("div","ioviewer-properties-body");i.replaceChildren(r,o),i.hidden=!0;let a=h=>{let d=[[X("id"),h.id],[X("category"),h.category],[X("type"),h.type],[X("level"),h.level]];return h.sourceId&&d.push([X("sourceId"),h.sourceId]),h.link&&d.push([X("link"),h.link]),Np(X("elementGroup"),d)},l=h=>{for(let[d,u]of Object.entries(h??{}))o.append(Np(d,Object.entries(u)))},c;e.addEventListener("change",()=>{if(c?.abort(),c=void 0,o.removeAttribute("aria-busy"),i.hidden=e.size===0,o.replaceChildren(),e.size!==1){n.textContent=`${X("selected")}: ${e.size}`;return}let[h]=e.values(),d=t.meta.elements[h];if(n.textContent=d.name||`#${d.id}`,o.append(a(d)),!t.loadProperties){l(t.props(d.id));return}let u=new AbortController;c=u,o.setAttribute("aria-busy","true"),t.loadProperties(h,u.signal).then(f=>{u.signal.aborted||!f||(n.textContent=f.name||d.name||`#${d.id}`,o.replaceChildren(a({...d,...f})),l(f.properties))}).catch(()=>{u.signal.aborted||o.append(K("p","",X("badData")))}).finally(()=>{c===u&&o.removeAttribute("aria-busy")})})}var Ji=["length_m","area_m2","volume_m3"],mb=new Set(["elementId","categoryId","typeId",...Ji]),Fp=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,Bp=new Intl.Collator(void 0,{sensitivity:"base"}),Op="TOTAL",zp="SUBTOTAL",Sl="element_count";function gb(i){let e=[],t=[],n="",s=!1,r=!1;for(let o=0;oh!==t.length-1&&!(o&&c[n]===zp&&c.length===e.length)):t,l=new Map;for(let c=0;c{let o=e[r[i.idColumn]],a=r[t];return o!==null&&(o===void 0||!a?.trim()||o===a)}),s=i.rows.length-n.length;return{csv:s?{...i,...Yh(i,n)}:i,conflicts:s}}function Vp(i,e,t){let n=e.trim().toLowerCase();if(!n&&t===null)return i;let s=i.columns.indexOf("name"),r=i.columns.indexOf("category"),o=[],a=new Map;for(let l of i.rows){let c=l[i.idColumn];t!==null&&l[r]!==t||n&&!c.includes(n)&&!l[s]?.toLowerCase().includes(n)||(a.set(c,o.length),o.push(l))}return{rows:o,rowById:a}}function Gp(i,e,t,n){return Yh(i,Wp(e.rows,t,i.columns[t],n))}function Wp(i,e,t,n){let s=mb.has(t),r=i.map(o=>{let a=o[e].trim(),l=s?qp(a):a;return{row:o,key:l,missing:s?!Number.isFinite(l):!a}});return r.sort((o,a)=>{if(o.missing||a.missing)return Number(o.missing)-Number(a.missing);let l=s?o.key-a.key:Bp.compare(o.key,a.key);return n?l:-l}),r.map(({row:o})=>o)}function Yh(i,e){let t=new Map;return e.forEach((n,s)=>t.set(n[i.idColumn],s)),{rows:e,rowById:t}}function Xp(i,e,t=-1,n=!0){let s=i.columns.indexOf("category");if(s<0)return e;let r=new Map;for(let l of e.rows){let c=l[s];r.has(c)||r.set(c,[]),r.get(c).push(l)}let o=[...r].sort(([l],[c])=>{if(!l||!c)return+!l-+!c;let h=Bp.compare(l,c);return t===s&&!n?-h:h}).map(([l,c])=>{let h=$h(i,c);return t>=0&&t!==s&&(c=Wp(c,t,i.columns[t],n)),{category:l,rows:c,totals:h}}),a=0;for(let l of o)l.start=a,a+=l.rows.length;return{...Yh(i,o.flatMap(l=>l.rows)),groups:o}}function $h(i,e){return Ji.map(t=>{let n=i.columns.indexOf(t);if(n<0)return null;let s=0,r=!1;for(let o of e){let a=qp(o[n].trim());Number.isFinite(a)&&(s+=a,r=!0)}return r&&Number.isFinite(s)?s:null})}function qp(i){return Fp.test(i)?Number(i):NaN}function Yp(i,e,t=null,n=null){let s=t!==null&&!i.includes(Sl),r=s?[...i,Sl]:i,o=[r.map(qh).join(",")],a=c=>{for(let h of c)o.push(h.map(qh).join(",")+(s?",":""))},l=(c,h,d,u="")=>{let f=r.map(m=>{if(m==="elementId")return c;if(m===Sl)return String(h);if(m==="category")return u;let _=d[Ji.indexOf(m)];return _==null?"":String(_)});o.push(f.map(qh).join(","))};if(n)for(let c of n)a(c.rows),l(zp,c.rows.length,c.totals,c.category);else a(e);return t!==null&&l(Op,e.length,t),"\uFEFF"+o.join(`\r `)+`\r -`}function Gh(i){let t=i.trimStart(),e=/^[+-]/.test(t)&&Sp.test(t.trimEnd());return(/^[\t\r\n]/.test(i)||!e&&/^[=+@-]/.test(t))&&(i="'"+i),/[",\r\n]/.test(i)?'"'+i.replace(/"/g,'""')+'"':i}var Sl=100,Up=["elementId","name","category",...Ji],rM=new Intl.NumberFormat(Pn,{maximumSignificantDigits:6}).format,qh=(i,t)=>q(i).replace(/\{(\w+)\}/g,(e,n)=>t[n]);function Fp(i){let t=K("dl","ioviewer-csv-totals");t.setAttribute("aria-label",i);let e=["elements",...Ji.map(n=>`csv.quantity.${n}`)].map(n=>{let s=K("dd"),r=K("div");return r.append(K("dt","",q(n)),s),t.append(r),s});return{element:t,update(n,s){e[0].textContent=Ci(n),s.forEach((r,o)=>{e[o+1].textContent=r===null?"\u2014":`${rM(r)} ${q(`csv.unit.${Ji[o]}`)}`})}}}function Bp(i,t,e,n){let s=new Map;t.forEach((O,$)=>{O.sourceId!=null&&s.set(O.sourceId,$)});let r=K("input");r.type="file",r.accept=".csv,text/csv",r.hidden=!0,r.setAttribute("aria-label",q("csv.open"));let o=K("div","ioviewer-csv-actions"),a=K("button","ioviewer-text-button",q("csv.open")),l=K("button","ioviewer-text-button",q("csv.download"));a.type=l.type="button",l.disabled=!0,a.addEventListener("click",()=>r.click()),o.append(a,l);let c=K("p","ioviewer-csv-status",q("csv.choose"));c.setAttribute("role","status");let h=K("div","ioviewer-csv-filters"),d=K("input");d.type="search",d.placeholder=q("csv.searchPlaceholder"),d.setAttribute("aria-label",q("csv.search"));let u=K("select");u.setAttribute("aria-label",q("category"));let f=K("label","ioviewer-csv-group-toggle"),m=K("input");m.type="checkbox",f.append(m,K("span","",q("csv.groupByCategory"))),h.append(d,u,f);let _=Fp(q("csv.totals"));_.element.setAttribute("aria-live","polite"),_.element.setAttribute("aria-atomic","true");let g=K("p","ioviewer-csv-feedback",q("csv.outsideFilters"));g.setAttribute("aria-live","polite");let p=K("p","ioviewer-csv-feedback",q("csv.noResults")),y=K("div","ioviewer-csv-scroll"),w=K("table");w.setAttribute("aria-label",q("panel.elements"));let M=w.createTHead(),x=w.createTBody();y.append(w);let S=K("div","ioviewer-csv-pagination"),A=K("button","ioviewer-text-button",q("csv.previous")),v=K("button","ioviewer-text-button",q("csv.next"));A.type=v.type="button";let E=K("span");S.append(A,E,v),h.hidden=_.element.hidden=g.hidden=p.hidden=y.hidden=S.hidden=!0,i.append(o,r,c,h,_.element,g,y,p,S);let R,L,N,B,D,F=-1,H=!0,V=0,z=0,U=new Map,k=[],Y;function G(){let O=Y?[...U.values(),Y]:U.values();for(let{index:$,row:rt,button:mt}of O){let ht=String(e.has($));rt.dataset.selected=ht,mt.setAttribute("aria-pressed",ht)}}function J(O,$){let rt=$[R.idColumn],mt=s.get(rt),ht=O.insertRow(),Et;for(let Zt of D){let Ct=ht.insertCell();Zt===R.idColumn&&mt!==void 0?(Et=K("button","ioviewer-csv-element",rt),Et.type="button",Ct.append(Et)):(Ct.textContent=$[Zt],Ct.title=$[Zt])}return mt===void 0?ht.title=q("csv.noGeometry"):(ht.dataset.linked="true",ht.addEventListener("click",()=>e.set([mt]))),{id:rt,index:mt,row:ht,button:Et}}function it(){for(let mt of k)mt.remove();k=[],U=new Map;let O=V*Sl,$=Math.min(O+Sl,N.rows.length);function rt(mt,ht,Et){for(let Zt=ht;Zt=Et)continue;let Zt=w.createTBody();k.push(Zt);let Ct=K("th","ioviewer-csv-group-heading");Ct.scope="rowgroup",Ct.colSpan=D.length;let Yt=K("div","ioviewer-csv-group-summary"),Ht=Fp(q("csv.categoryTotals"));Ht.update(mt.rows.length,mt.totals),Yt.append(K("strong","",mt.category||q("noCategory")),Ht.element),Ct.append(Yt),Zt.insertRow().append(Ct),rt(Zt,ht,Et)}else{let mt=w.createTBody();k.push(mt),rt(mt,O,$)}G(),p.hidden=N.rows.length!==0,S.hidden=N.rows.length<=Sl,E.textContent=qh("csv.range",{first:O+1,last:$,total:N.rows.length}),A.disabled=V===0,v.disabled=$===N.rows.length}function nt(){if(!R)return;let O,$;for(let rt of e.values()){let mt=t[rt]?.sourceId;if(!R.rowById.has(mt))continue;let ht=N.rowById.get(mt);if(ht===void 0){$=mt;break}let Et=Math.floor(ht/Sl);Et!==V&&(V=Et,it()),O=U.get(rt)?.row;break}$!==Y?.id&&(x.replaceChildren(),Y=$===void 0?void 0:J(x,R.rows[R.rowById.get($)])),g.hidden=!Y,y.hidden=!Y&&N.rows.length===0,G(),(Y?.row??O)?.scrollIntoView({block:"nearest",inline:"nearest"})}function at(){N=Cp(R,d.value,u.selectedIndex>0?u.value:null),B=Xh(R,N.rows),_.update(N.rows.length,B),_.element.hidden=!1,m.checked?N=Lp(R,N,F,H):F!==-1&&(N=Ip(R,N,F,H)),V=0,it(),y.scrollTop=0,nt()}l.addEventListener("click",()=>{let O=new Blob([Np(R.columns,N.rows,B,N.groups)],{type:"text/csv;charset=utf-8"}),$=URL.createObjectURL(O),rt=K("a");rt.href=$,rt.download=L,rt.hidden=!0,document.body.append(rt);try{rt.click()}finally{rt.remove(),setTimeout(()=>URL.revokeObjectURL($),1e3)}}),A.addEventListener("click",()=>{V--,it(),y.scrollTop=0}),v.addEventListener("click",()=>{V++,it(),y.scrollTop=0}),d.addEventListener("input",at),u.addEventListener("change",at),m.addEventListener("change",at),e.addEventListener("change",nt),r.addEventListener("change",async()=>{let O=r.files[0];if(!O)return;let $=++z;r.value="",l.disabled=!0,c.textContent=q("csv.loading");try{let rt=await O.text();if($!==z)return;let mt=Ap(rt),{csv:ht,conflicts:Et}=Rp(mt,n);R=ht,L=O.name.replace(/\.csv$/i,"")+"-filtered.csv",F=-1,H=!0,D=[...Up.filter(Ht=>R.columns.includes(Ht)),...R.columns.filter(Ht=>!Up.includes(Ht))].map(Ht=>R.columns.indexOf(Ht)),M.replaceChildren();let Zt=M.insertRow();for(let Ht of D){let dt=K("th");dt.scope="col";let Nt=R.columns[Ht],Gt=K("button","ioviewer-csv-sort");Gt.type="button",Gt.title=Nt;let ne=K("span","ioviewer-csv-sort-indicator");ne.setAttribute("aria-hidden","true"),Gt.append(K("span","ioviewer-csv-sort-label",Nt),ne),Gt.addEventListener("click",()=>{H=F!==Ht||!H,F=Ht,Zt.querySelector("[aria-sort]")?.removeAttribute("aria-sort"),dt.setAttribute("aria-sort",H?"ascending":"descending"),at()}),dt.append(Gt),Zt.append(dt)}let Ct=0;for(let Ht of s.keys())R.rowById.has(Ht)&&Ct++;c.textContent=qh(Ct||Et?"csv.loaded":"csv.noMatch",{file:O.name,matched:Ct,total:mt.rows.length}),Et&&c.append(" \xB7 ",qh("csv.conflicts",{count:Ci(Et)}));let Yt=R.columns.indexOf("category");if(u.hidden=Yt<0,f.hidden=u.hidden,m.checked=!1,u.replaceChildren(new Option(q("csv.allCategories"),"")),Yt>=0){let Ht=[...new Set(R.rows.map(dt=>dt[Yt]))];Ht.sort((dt,Nt)=>dt.localeCompare(Nt));for(let dt of Ht)u.add(new Option(dt||q("noCategory"),dt))}h.hidden=R.rows.length===0,d.value="",x.replaceChildren(),Y=void 0,at(),l.disabled=!1}catch{$===z&&(c.textContent=q("csv.invalid"),l.disabled=!R)}})}async function oM(i){if(await navigator.clipboard?.writeText(i).then(()=>!0,()=>!1))return!0;let t=document.createElement("textarea");t.value=i,t.setAttribute("readonly",""),t.className="ioviewer-offscreen",document.body.append(t),t.select();try{return document.execCommand("copy")}finally{t.remove()}}function Op({root:i,data:t,scene:e,controls:n,picker:s,selection:r,measure:o}){let{meta:a}=t,l=()=>n.fitBox(e.visibleBox()),c={hide:e.setVisible&&(()=>r.size&&e.setVisible([...r.values()],!1)),isolate:e.isolate&&(()=>r.size&&e.isolate([...r.values()])),showAll:e.showAll&&(()=>e.showAll()),zoomTo:()=>{if(!r.size)return l();let[w,...M]=r.values(),x=e.elementBox(w);for(let S of M)x.union(e.elementBox(S));n.zoomToBox(x)},fitAll:l},h=up(i);h.registerPanel("model",{icon:oe.model,title:q("panel.model"),visible:a.elements.length>0||!!e.setVisible,render:w=>gp(w,{elements:a.elements,models:a.models??[],selection:r,scene:e,openContextMenu:g,zoomToElement:M=>n.zoomToBox(e.elementBox(M))})}),a.elementCsv&&h.registerPanel("elements",{icon:oe.elements,title:q("panel.elements"),render:w=>Bp(w,a.elements,r,a.glbUniqueIds)});let d=document.createElement("aside");d.id="ioviewer-properties",d.className="ioviewer-floating",i.append(d),bp(d,r,t);let u=fp(i,dp),f=w=>{n.is2D&&w==="orbit"||(n.setLeftButtonMode(w),u.setActive("orbit",w==="orbit"),u.setActive("pan",w==="pan"))};u.setHandler("orbit",()=>f("orbit")),u.setHandler("pan",()=>f("pan")),f(n.leftButtonMode),u.setHandler("fit",l),u.setHandler("projection",()=>{if(n.is2D)return;let w=!n.camera.isOrthographicCamera;n.setProjection(w?"orthographic":"perspective"),u.setActive("projection",w)}),u.setActive("projection",!1);let m=()=>{let w=!!n.is2D;u.setActive("mode2d",w),u.setEnabled("orbit",!w),u.setEnabled("projection",!w),u.setActive("projection",w||n.camera.isOrthographicCamera),u.setActive("orbit",!w&&n.leftButtonMode==="orbit"),u.setActive("pan",w||n.leftButtonMode==="pan")};u.setHandler("mode2d",()=>{n.set2DMode(!n.is2D,e.visibleBox(),!1),m()}),m(),document.fullscreenEnabled&&(u.setHandler("fullscreen",()=>{(document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()).catch(()=>{u.setActive("fullscreen",!!document.fullscreenElement),Xs(i,q("fullscreenUnavailable"))})}),document.addEventListener("fullscreenchange",()=>u.setActive("fullscreen",!!document.fullscreenElement)));let _=xp(i);function g(w,M,x,S){_.open(x===null?"empty":"element",w,M,x,S)}function p(w){if(_.isOpen)return;let M=w===document.body,x=(M?n.dom:w).getBoundingClientRect(),S=M?x.left+x.width/2:x.left,A=M?x.top+x.height/2:x.bottom;g(S,A,r.values().next().value??null,()=>w.focus({preventScroll:!0}))}_.setItem("properties",{handler:w=>r.set([w])});for(let w of["hide","isolate","showAll","zoomTo","fitAll"])_.setItem(w,{handler:c[w]});_.setItem("copyId",{handler:w=>oM(String(a.elements[w].id)).then(M=>Xs(i,q(M?"idCopied":"copyFailed")),()=>Xs(i,q("copyFailed")))}),n.addEventListener("contextmenu",async w=>{let{x:M,y:x}=w.detail;if(o?.active)return g(M,x,r.values().next().value??null);let S=s.pick(M,x),A=S?.then?await S:S;if(A!==void 0){if(!A||A.element<0)return g(M,x,null);r.has(A.element)||r.set([A.element]),g(M,x,A.element)}});let y=[];return window.addEventListener("keydown",w=>{if(w.defaultPrevented)return;let M=pp(w);if(M){if(w.preventDefault(),M==="contextMenu")return p(document.activeElement??document.body);if(M==="escape"&&!_.isOpen){y.some(x=>x())||r.clear();return}_.close(),M!=="escape"&&c[M]?.()}}),vp(document.getElementById("ioviewer-status"),r,e.elementCount),yp(i,a.truncated),{shell:h,toolbar:u,contextMenu:_,sync2DState:m,onEscape:w=>y.push(w)}}var Yh={x:new C(1,0,0),y:new C(0,1,0),z:new C(0,0,1)};function $h(i){let t=Yh[i];if(!t)throw new RangeError(`Unknown axis: ${i}`);return t.clone()}function wl(i,t,e){if(t.length===0)return!1;let n=s=>s.distanceToPoint(i)<0;return e?t.every(n):t.some(n)}function zp(i,t,e,n){let s=i.clone().normalize(),r=s.dot(t)+e;return n?new Ae(s,-r):new Ae(s.negate(),r)}function kp(i,t,e=0){if(t!=="keepInside"&&t!=="cutInside")throw new RangeError(`Unknown box mode: ${t}`);let{min:n,max:s}=i,r=[new Ae(new C(1,0,0),-n.x),new Ae(new C(-1,0,0),s.x),new Ae(new C(0,1,0),-n.y),new Ae(new C(0,-1,0),s.y),new Ae(new C(0,0,1),-n.z),new Ae(new C(0,0,-1),s.z)];if(e!==0){let o=i.getCenter(new C);for(let a of r){let l=a.distanceToPoint(o);a.normal.applyAxisAngle(Yh.z,e),a.constant=l-a.normal.dot(o)}}return t==="keepInside"?{planes:r,intersection:!1}:{planes:r.map(o=>o.negate()),intersection:!0}}function Hp(i,t,e,n,s,r){let o=i.clone();if(n>0?o.max[e]=Math.max(i.max[e]+s,i.min[e]+r):o.min[e]=Math.min(i.min[e]-s,i.max[e]-r),t!==0){let a=o.getCenter(new C).sub(i.getCenter(new C));o.translate(a.clone().applyAxisAngle(Yh.z,t).sub(a))}return o}function Vp(i){let{min:t,max:e}=i;return Array.from({length:8},(n,s)=>new C(s&1?e.x:t.x,s&2?e.y:t.y,s&4?e.z:t.z))}function Gp(i,t,e){if(t.length===0||i.isEmpty())return!1;let n=Vp(i),s=r=>n.every(o=>r.distanceToPoint(o)<0);return e?t.every(s):t.some(s)}function El(i,t){let e=i.getSize(new C).multiplyScalar(.5);return Math.abs(t.x)*e.x+Math.abs(t.y)*e.y+Math.abs(t.z)*e.z}function qr(i,t,e){let n=t.clone().sub(i.origin),s=e.dot(i.direction),r=1-s*s;return r<.03?null:(s*i.direction.dot(n)-e.dot(n))/r}function Tl(i,t,e){let n=new C(1,0,0).applyQuaternion(t),s=new C(0,1,0).applyQuaternion(t),[r,o,a,l]=[1/0,-1/0,1/0,-1/0];for(let h of Vp(i)){h.sub(e);let d=h.dot(n),u=h.dot(s);[r,o,a,l]=[Math.min(r,d),Math.max(o,d),Math.min(a,u),Math.max(l,u)]}return{center:e.clone().addScaledVector(n,(r+o)/2).addScaledVector(s,(a+l)/2),width:(o-r)*1.1,height:(l-a)*1.1}}var Yr=6,aM=["off","planes","box"],lM=.05,Zh=new C(0,0,1),Al=class extends EventTarget{constructor(t,e,n){super(),this.scene=t,this.modelBox=e.clone(),this.center=e.getCenter(new C),this.planes=[],this.active=-1,this.box=null,this.boxYaw=0,this.boxMode="keepInside",this.fill=!1,this.gizmoVisible=!0,this._mode="off",n&&this.restore(n)}restore({planes:t,box:e,cutInside:n}){this.modelBox.isEmpty()||(this.planes=t.map(({axis:s,normal:r,offset:o,flipped:a})=>{let l=new C().fromArray(r),c=new Fe().setFromUnitVectors(Zh,l);return{axis:s,quaternion:c,offset:o-l.dot(this.center),flipped:a,enabled:!0,rotated:!1}}),this.active=this.planes.length?0:-1,this.box=e?new ae(new C().fromArray(e.min),new C().fromArray(e.max)):null,this.boxYaw=0,this.boxMode=n?"cutInside":"keepInside",this.gizmoVisible=!1,this.setMode(this.box?"box":this.planes.length?"planes":"off"))}get mode(){return this._mode}setMode(t){if(!aM.includes(t))throw new RangeError(`Unknown section mode: ${t}`);t==="box"&&!this.box&&this.fitBoxToShown()||(this._mode=t,this._changed(!0))}addPlane(t){let e=$h(t);if(this.planes.length>=Yr||this.modelBox.isEmpty())return null;let n=new Fe().setFromUnitVectors(Zh,e);return this.planes.push({axis:t,quaternion:n,offset:0,flipped:!1,enabled:!0,rotated:!1}),this.active=this.planes.length-1,this._mode="planes",this._changed(!0),this.active}removePlane(t){this._plane(t),this.planes.splice(t,1),(this.active>=this.planes.length||this.active>t)&&this.active--,this._changed(!0)}updatePlane(t,{offset:e,flipped:n,enabled:s,quaternion:r}){let o=this._plane(t);if(e!==void 0){if(!Number.isFinite(e))throw new RangeError(`Offset must be a finite number, got ${e}.`);o.offset=e}n!==void 0&&(o.flipped=!!n),s!==void 0&&(o.enabled=!!s),r&&(o.quaternion.copy(r).normalize(),o.rotated=o.axis!=="custom"&&this.normal(t).angleTo($h(o.axis))>1e-6),this._changed(!0)}setActivePlane(t){this._plane(t),this.active=t,this._changed(!1)}normal(t){return Zh.clone().applyQuaternion(this._plane(t).quaternion)}extent(t){return El(this.modelBox,this.normal(t))}origin(t){return this.center.clone().addScaledVector(this.normal(t),this._plane(t).offset)}clipPlane(t){let e=this._plane(t);return zp(this.normal(t),this.center,e.offset,e.flipped)}setBox(t,e=0){if(t.isEmpty())throw new RangeError("The section box is empty.");e=Wp(e),this.box=t.clone(),this.boxYaw=e,this._mode="box",this._changed(!0)}setBoxYaw(t){this.box&&(this.boxYaw=Wp(t),this._changed(this.mode==="box"))}setBoxMode(t){if(t!=="keepInside"&&t!=="cutInside")throw new RangeError(`Unknown box mode: ${t}`);this.boxMode=t,this._changed(!0)}fitBoxToElements(t){let e=new ae;for(let s of t)e.union(this.scene.elementBox(s));if(e.isEmpty())return!1;let n=e.getSize(new C);return this.setBox(e.expandByScalar(lM*Math.max(n.x,n.y,n.z))),!0}fitBoxToShown(){let t=this.scene.visibleBox();if(t.isEmpty())return!1;let e=t.getSize(new C);return this.setBox(t.expandByScalar(.001*Math.max(e.x,e.y,e.z))),!0}setGizmoVisible(t){this.gizmoVisible=!!t,this._changed(!1)}setFill(t){this.fill=!!t,this._changed(!1)}reset(){this.planes=[],this.active=-1,this.box=null,this.boxYaw=0,this._mode="off",this._changed(!0)}clipping(){if(this._mode==="planes")return{planes:this.planes.flatMap((e,n)=>e.enabled?[this.clipPlane(n)]:[]),intersection:!1};if(this._mode==="box"&&this.box){let t=kp(this.box,this.boxMode,this.boxYaw);if(!t.intersection&&this.boxYaw!==0){let e=this.box.getCenter(new C),n=this.box.getSize(new C).multiplyScalar(.5),s=Math.abs(Math.cos(this.boxYaw)),r=Math.abs(Math.sin(this.boxYaw));n.set(s*n.x+r*n.y,r*n.x+s*n.y,n.z),t.bounds=new ae(e.clone().sub(n),e.add(n))}return t}return{planes:[],intersection:!1}}isCut(t,{planes:e,intersection:n,bounds:s}=this.clipping()){return s&&!t.isEmpty()&&!s.intersectsBox(t)||Gp(t,e,n)}_plane(t){let e=this.planes[t];if(!Number.isInteger(t)||!e)throw new RangeError(`Plane index ${t} is out of range 0..${this.planes.length-1}.`);return e}_changed(t){if(t){let{planes:e,intersection:n}=this.clipping();this.scene.setClipping(e,n)}this.dispatchEvent(new Event("change"))}};function Wp(i){if(!Number.isFinite(i))throw new RangeError("The section box angle must be finite.");return i>=-Math.PI&&i<=Math.PI?i:le.euclideanModulo(i+Math.PI,2*Math.PI)-Math.PI}var Kh=80,cM=8,Qh=.8,hM=Math.sin(le.degToRad(12)),Pi={x:"#ef4444",y:"#22c55e",z:"#3b82f6",centre:"#e2e8f0",hover:"#facc15",frame:"#93c5fd",fill:"#60a5fa"},Jh=["x","y","z"],uM=Math.cos(le.degToRad(12)),Rl=new C(0,0,1),dM=i=>new Je({color:i,depthTest:!1,depthWrite:!1,transparent:!0,opacity:.9}),fM=new Je({visible:!1});function Cl(i,t,e,n){let s=new Re,r=dM(t);for(let a of e)s.add(new ge(a,r));let o=new ge(n,fM);return o.userData.handle=s,s.add(o),s.userData={kind:i,color:t,material:r,proxy:o},s.traverse(a=>a.renderOrder=1e3),s}function jh(i,t,e=n=>n){let n=Cl("rotate",Pi[t],[e(new As(Qh,.018,8,64))],e(new As(Qh,.09,8,48)));return n.name=i,n.userData.axis=t,n}var Il=class extends EventTarget{constructor(t,e){super(),this.sections=t,this.dom=e,this.camera=null,this.group=new Re,this.group.name="sections",this._raycaster=new qn,this._drag=null,this._hovered=null,this._buildPlanes(),this._buildPlaneGizmo(),this._buildBox(),t.addEventListener("change",()=>this._sync()),(e.parentElement??e).addEventListener("pointerdown",n=>this._down(n),!0),e.addEventListener("pointermove",n=>this._move(n)),e.addEventListener("pointerup",n=>this._up(n)),e.addEventListener("pointercancel",()=>this._end()),e.addEventListener("lostpointercapture",()=>this._end()),this._sync()}get dragging(){return this._drag!==null}update(t){this.camera=t;let e=this.planeGizmo;e.visible&&(e.scale.setScalar(this._worldPerPixel(e.position)*Kh),this.arrow.visible=this._across(Rl.clone().applyQuaternion(e.quaternion),e.position));for(let s of this.boxHandles){let{shown:r,normal:o}=s.userData;s.visible=r&&(!o||this._across(o,s.position)),s.visible&&s.scale.setScalar(this._worldPerPixel(s.position)*cM)}let n=this.boxRing;n.visible&&n.scale.setScalar(this._worldPerPixel(n.position)*Kh)}_across(t,e){let n=this.camera,s=n.isOrthographicCamera?n.getWorldDirection(new C):e.clone().sub(n.position).normalize();return Math.abs(t.dot(s))new C(r/2,o/2,0))),n=new Je({color:Pi.fill,transparent:!0,opacity:.12,side:ke,depthWrite:!1}),s=new sn({color:Pi.frame});this.planeVisuals=Array.from({length:Yr},()=>{let r=new Re;return r.add(new ge(t,n),new ki(e,s)),this.group.add(r),r})}_buildPlaneGizmo(){let t=(n,s)=>n.rotateX(Math.PI/2).translate(0,0,s),e=Cl("move",Pi.z,[t(new Hi(.025,.025,1),.5),t(new dr(.08,.25),1.125)],t(new Hi(.12,.12,1.25),.625));e.name="arrow",this.arrow=e,this.planeGizmo=new Re,this.planeGizmo.add(e,jh("ringX","x",n=>n.rotateY(Math.PI/2)),jh("ringY","y",n=>n.rotateX(Math.PI/2))),this.group.add(this.planeGizmo)}_buildBox(){this.boxWire=new ln(new Vi(new gn(1,1,1)),new sn({color:Pi.frame})),this.group.add(this.boxWire);let t=new Wn(1,16,12),e=new Wn(1.6,8,6);this.boxHandles=[];for(let s of Jh)for(let r of[-1,1]){let o=Cl("face",Pi[s],[t],e);o.name=`face${r>0?"+":"-"}${s}`,Object.assign(o.userData,{axis:s,sign:r,normal:new C}),this.boxHandles.push(o)}let n=Cl("centre",Pi.centre,[new gn(1.4,1.4,1.4)],e);n.name="centre",this.boxHandles.push(n),this.boxRing=jh("boxRing","z"),this.group.add(...this.boxHandles,this.boxRing)}_sync(){let t=this.sections,e=t.mode==="planes";this.planeVisuals.forEach((r,o)=>{let a=t.planes[o];if(r.visible=e&&!!a?.enabled,!r.visible)return;r.children[0].visible=!t.fill;let l=Tl(t.modelBox,a.quaternion,t.origin(o));r.position.copy(l.center),r.quaternion.copy(a.quaternion),r.scale.set(l.width,l.height,1)});let n=t.planes[t.active];this.planeGizmo.visible=e&&t.gizmoVisible&&!!n?.enabled,this.planeGizmo.visible&&(this.planeGizmo.position.copy(t.origin(t.active)),this.planeGizmo.quaternion.copy(n.quaternion));let s=t.mode==="box"?t.box:null;this.boxWire.visible=!!s,this.boxRing.visible=!!s&&t.gizmoVisible;for(let r of this.boxHandles)r.visible=r.userData.shown=!!s&&t.gizmoVisible;if(s){let r=s.getCenter(new C),o=s.getSize(new C);this.boxWire.position.copy(r),this.boxWire.scale.copy(o).max(new C(1e-6,1e-6,1e-6)),this.boxWire.rotation.z=t.boxYaw,this.boxRing.position.copy(r);for(let a of this.boxHandles){let{axis:l,sign:c,normal:h}=a.userData;h?(h.set(0,0,0).setComponent(Jh.indexOf(l),c).applyAxisAngle(Rl,t.boxYaw),a.position.copy(r).addScaledVector(h,o[l]/2)):a.position.copy(r)}}}_worldPerPixel(t){let e=this.camera,n=Math.max(this.dom.clientHeight,1);if(e.isOrthographicCamera)return(e.top-e.bottom)/e.zoom/n;let s=t.clone().sub(e.position).dot(e.getWorldDirection(new C));return 2*Math.max(s,e.near)*Math.tan(le.degToRad(e.fov/2))/n}_ray(t){let e=this.dom.getBoundingClientRect(),n=new qt((t.clientX-e.left)/e.width*2-1,1-(t.clientY-e.top)/e.height*2);return this.camera.updateMatrixWorld(),this._raycaster.setFromCamera(n,this.camera),this._raycaster.ray.clone()}_hit(t){if(!this.camera)return null;this.update(this.camera),this.group.updateMatrixWorld(!0);let e=r=>{for(;r&&r!==this.group;r=r.parent)if(!r.visible)return!1;return!0},n=[];this.group.traverse(r=>r.userData.handle&&e(r)&&n.push(r)),this._ray(t);let s=this._raycaster.intersectObjects(n,!1);return(this.sections.mode==="box"?s.find(r=>r.object.userData.handle!==this.boxRing):null)??s[0]??null}_down(t){if(t.target!==this.dom||t.button!==0)return;let e=this._hit(t);if(!e)return;let n=e.object.userData.handle,s=this._start(n,this._raycaster.ray,e.point,t);s&&(t.stopPropagation(),t.preventDefault(),this.dom.setPointerCapture(t.pointerId),this._drag={id:t.pointerId,handle:n,...s},this._highlight(n))}_start(t,e,n,s){let r=this.sections,{kind:o}=t.userData;if(o==="move"){let u=r.active,f=r.origin(u),m=r.normal(u),_=qr(e,f,m);return _===null?null:{index:u,origin:f,normal:m,offset:r.planes[u].offset,s0:_}}if(o==="rotate"){let u=r.active,f=t===this.boxRing,m=f?t.position.clone():r.origin(u),_=f?null:r.planes[u].quaternion.clone(),g=f?Rl:new C().setComponent(Jh.indexOf(t.userData.axis),1).applyQuaternion(_),p={index:u,origin:m,quaternion:_,axis:g,yaw:f?r.boxYaw:null};if(Math.abs(g.dot(e.direction))0&&r===0}function _M(i,t){let{instances:e,geometries:n}=t.meta,s=t.readView(e.geometry),{width:r,height:o}=i.slotUniforms.slotState.value.image,a=new Uint8Array(r*o),l=new Map;for(let h=0;hX(i).replace(/\{(\w+)\}/g,(t,n)=>e[n]);function Zp(i){let e=K("dl","ioviewer-csv-totals");e.setAttribute("aria-label",i);let t=["elements",...Ji.map(n=>`csv.quantity.${n}`)].map(n=>{let s=K("dd"),r=K("div");return r.append(K("dt","",X(n)),s),e.append(r),s});return{element:e,update(n,s){t[0].textContent=Ci(n),s.forEach((r,o)=>{t[o+1].textContent=r===null?"\u2014":`${_b(r)} ${X(`csv.unit.${Ji[o]}`)}`})}}}function Kp(i,e,t,n){let s=new Map;e.forEach((O,$)=>{O.sourceId!=null&&s.set(O.sourceId,$)});let r=K("input");r.type="file",r.accept=".csv,text/csv",r.hidden=!0,r.setAttribute("aria-label",X("csv.open"));let o=K("div","ioviewer-csv-actions"),a=K("button","ioviewer-text-button",X("csv.open")),l=K("button","ioviewer-text-button",X("csv.download"));a.type=l.type="button",l.disabled=!0,a.addEventListener("click",()=>r.click()),o.append(a,l);let c=K("p","ioviewer-csv-status",X("csv.choose"));c.setAttribute("role","status");let h=K("div","ioviewer-csv-filters"),d=K("input");d.type="search",d.placeholder=X("csv.searchPlaceholder"),d.setAttribute("aria-label",X("csv.search"));let u=K("select");u.setAttribute("aria-label",X("category"));let f=K("label","ioviewer-csv-group-toggle"),m=K("input");m.type="checkbox",f.append(m,K("span","",X("csv.groupByCategory"))),h.append(d,u,f);let _=Zp(X("csv.totals"));_.element.setAttribute("aria-live","polite"),_.element.setAttribute("aria-atomic","true");let g=K("p","ioviewer-csv-feedback",X("csv.outsideFilters"));g.setAttribute("aria-live","polite");let p=K("p","ioviewer-csv-feedback",X("csv.noResults")),y=K("div","ioviewer-csv-scroll"),w=K("table");w.setAttribute("aria-label",X("panel.elements"));let b=w.createTHead(),x=w.createTBody();y.append(w);let S=K("div","ioviewer-csv-pagination"),A=K("button","ioviewer-text-button",X("csv.previous")),v=K("button","ioviewer-text-button",X("csv.next"));A.type=v.type="button";let E=K("span");S.append(A,E,v),h.hidden=_.element.hidden=g.hidden=p.hidden=y.hidden=S.hidden=!0,i.append(o,r,c,h,_.element,g,y,p,S);let R,L,N,B,D,F=-1,H=!0,V=0,z=0,U=new Map,k=[],Y;function G(){let O=Y?[...U.values(),Y]:U.values();for(let{index:$,row:re,button:me}of O){let he=String(t.has($));re.dataset.selected=he,me.setAttribute("aria-pressed",he)}}function J(O,$){let re=$[R.idColumn],me=s.get(re),he=O.insertRow(),Ee;for(let Ze of D){let Ce=he.insertCell();Ze===R.idColumn&&me!==void 0?(Ee=K("button","ioviewer-csv-element",re),Ee.type="button",Ce.append(Ee)):(Ce.textContent=$[Ze],Ce.title=$[Ze])}return me===void 0?he.title=X("csv.noGeometry"):(he.dataset.linked="true",he.addEventListener("click",()=>t.set([me]))),{id:re,index:me,row:he,button:Ee}}function ie(){for(let me of k)me.remove();k=[],U=new Map;let O=V*wl,$=Math.min(O+wl,N.rows.length);function re(me,he,Ee){for(let Ze=he;Ze=Ee)continue;let Ze=w.createTBody();k.push(Ze);let Ce=K("th","ioviewer-csv-group-heading");Ce.scope="rowgroup",Ce.colSpan=D.length;let Ye=K("div","ioviewer-csv-group-summary"),He=Zp(X("csv.categoryTotals"));He.update(me.rows.length,me.totals),Ye.append(K("strong","",me.category||X("noCategory")),He.element),Ce.append(Ye),Ze.insertRow().append(Ce),re(Ze,he,Ee)}else{let me=w.createTBody();k.push(me),re(me,O,$)}G(),p.hidden=N.rows.length!==0,S.hidden=N.rows.length<=wl,E.textContent=Zh("csv.range",{first:O+1,last:$,total:N.rows.length}),A.disabled=V===0,v.disabled=$===N.rows.length}function ne(){if(!R)return;let O,$;for(let re of t.values()){let me=e[re]?.sourceId;if(!R.rowById.has(me))continue;let he=N.rowById.get(me);if(he===void 0){$=me;break}let Ee=Math.floor(he/wl);Ee!==V&&(V=Ee,ie()),O=U.get(re)?.row;break}$!==Y?.id&&(x.replaceChildren(),Y=$===void 0?void 0:J(x,R.rows[R.rowById.get($)])),g.hidden=!Y,y.hidden=!Y&&N.rows.length===0,G(),(Y?.row??O)?.scrollIntoView({block:"nearest",inline:"nearest"})}function ae(){N=Vp(R,d.value,u.selectedIndex>0?u.value:null),B=$h(R,N.rows),_.update(N.rows.length,B),_.element.hidden=!1,m.checked?N=Xp(R,N,F,H):F!==-1&&(N=Gp(R,N,F,H)),V=0,ie(),y.scrollTop=0,ne()}l.addEventListener("click",()=>{let O=new Blob([Yp(R.columns,N.rows,B,N.groups)],{type:"text/csv;charset=utf-8"}),$=URL.createObjectURL(O),re=K("a");re.href=$,re.download=L,re.hidden=!0,document.body.append(re);try{re.click()}finally{re.remove(),setTimeout(()=>URL.revokeObjectURL($),1e3)}}),A.addEventListener("click",()=>{V--,ie(),y.scrollTop=0}),v.addEventListener("click",()=>{V++,ie(),y.scrollTop=0}),d.addEventListener("input",ae),u.addEventListener("change",ae),m.addEventListener("change",ae),t.addEventListener("change",ne),r.addEventListener("change",async()=>{let O=r.files[0];if(!O)return;let $=++z;r.value="",l.disabled=!0,c.textContent=X("csv.loading");try{let re=await O.text();if($!==z)return;let me=kp(re),{csv:he,conflicts:Ee}=Hp(me,n);R=he,L=O.name.replace(/\.csv$/i,"")+"-filtered.csv",F=-1,H=!0,D=[...$p.filter(He=>R.columns.includes(He)),...R.columns.filter(He=>!$p.includes(He))].map(He=>R.columns.indexOf(He)),b.replaceChildren();let Ze=b.insertRow();for(let He of D){let de=K("th");de.scope="col";let Ne=R.columns[He],Ge=K("button","ioviewer-csv-sort");Ge.type="button",Ge.title=Ne;let nt=K("span","ioviewer-csv-sort-indicator");nt.setAttribute("aria-hidden","true"),Ge.append(K("span","ioviewer-csv-sort-label",Ne),nt),Ge.addEventListener("click",()=>{H=F!==He||!H,F=He,Ze.querySelector("[aria-sort]")?.removeAttribute("aria-sort"),de.setAttribute("aria-sort",H?"ascending":"descending"),ae()}),de.append(Ge),Ze.append(de)}let Ce=0;for(let He of s.keys())R.rowById.has(He)&&Ce++;c.textContent=Zh(Ce||Ee?"csv.loaded":"csv.noMatch",{file:O.name,matched:Ce,total:me.rows.length}),Ee&&c.append(" \xB7 ",Zh("csv.conflicts",{count:Ci(Ee)}));let Ye=R.columns.indexOf("category");if(u.hidden=Ye<0,f.hidden=u.hidden,m.checked=!1,u.replaceChildren(new Option(X("csv.allCategories"),"")),Ye>=0){let He=[...new Set(R.rows.map(de=>de[Ye]))];He.sort((de,Ne)=>de.localeCompare(Ne));for(let de of He)u.add(new Option(de||X("noCategory"),de))}h.hidden=R.rows.length===0,d.value="",x.replaceChildren(),Y=void 0,ae(),l.disabled=!1}catch{$===z&&(c.textContent=X("csv.invalid"),l.disabled=!R)}})}async function xb(i){if(await navigator.clipboard?.writeText(i).then(()=>!0,()=>!1))return!0;let e=document.createElement("textarea");e.value=i,e.setAttribute("readonly",""),e.className="ioviewer-offscreen",document.body.append(e),e.select();try{return document.execCommand("copy")}finally{e.remove()}}function Jp({root:i,data:e,scene:t,controls:n,picker:s,selection:r,measure:o}){let{meta:a}=e,l=()=>n.fitBox(t.visibleBox()),c={hide:t.setVisible&&(()=>r.size&&t.setVisible([...r.values()],!1)),isolate:t.isolate&&(()=>r.size&&t.isolate([...r.values()])),showAll:t.showAll&&(()=>t.showAll()),zoomTo:()=>{if(!r.size)return l();let[w,...b]=r.values(),x=t.elementBox(w);for(let S of b)x.union(t.elementBox(S));n.zoomToBox(x)},fitAll:l},h=wp(i);h.registerPanel("model",{icon:ot.model,title:X("panel.model"),visible:a.elements.length>0||!!t.setVisible,render:w=>Cp(w,{elements:a.elements,models:a.models??[],selection:r,scene:t,openContextMenu:g,zoomToElement:b=>n.zoomToBox(t.elementBox(b))})}),a.elementCsv&&h.registerPanel("elements",{icon:ot.elements,title:X("panel.elements"),render:w=>Kp(w,a.elements,r,a.glbUniqueIds)});let d=document.createElement("aside");d.id="ioviewer-properties",d.className="ioviewer-floating",i.append(d),Up(d,r,e);let u=Tp(i,Ep),f=w=>{n.is2D&&w==="orbit"||(n.setLeftButtonMode(w),u.setActive("orbit",w==="orbit"),u.setActive("pan",w==="pan"))};u.setHandler("orbit",()=>f("orbit")),u.setHandler("pan",()=>f("pan")),f(n.leftButtonMode),u.setHandler("fit",l),u.setHandler("projection",()=>{if(n.is2D)return;let w=!n.camera.isOrthographicCamera;n.setProjection(w?"orthographic":"perspective"),u.setActive("projection",w)}),u.setActive("projection",!1);let m=()=>{let w=!!n.is2D;u.setActive("mode2d",w),u.setEnabled("orbit",!w),u.setEnabled("projection",!w),u.setActive("projection",w||n.camera.isOrthographicCamera),u.setActive("orbit",!w&&n.leftButtonMode==="orbit"),u.setActive("pan",w||n.leftButtonMode==="pan")};u.setHandler("mode2d",()=>{n.set2DMode(!n.is2D,t.visibleBox(),!1),m()}),m(),document.fullscreenEnabled&&(u.setHandler("fullscreen",()=>{(document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()).catch(()=>{u.setActive("fullscreen",!!document.fullscreenElement),qs(i,X("fullscreenUnavailable"))})}),document.addEventListener("fullscreenchange",()=>u.setActive("fullscreen",!!document.fullscreenElement)));let _=Pp(i);function g(w,b,x,S){_.open(x===null?"empty":"element",w,b,x,S)}function p(w){if(_.isOpen)return;let b=w===document.body,x=(b?n.dom:w).getBoundingClientRect(),S=b?x.left+x.width/2:x.left,A=b?x.top+x.height/2:x.bottom;g(S,A,r.values().next().value??null,()=>w.focus({preventScroll:!0}))}_.setItem("properties",{handler:w=>r.set([w])});for(let w of["hide","isolate","showAll","zoomTo","fitAll"])_.setItem(w,{handler:c[w]});_.setItem("copyId",{handler:w=>xb(String(a.elements[w].id)).then(b=>qs(i,X(b?"idCopied":"copyFailed")),()=>qs(i,X("copyFailed")))}),n.addEventListener("contextmenu",async w=>{let{x:b,y:x}=w.detail;if(o?.active)return g(b,x,r.values().next().value??null);let S=s.pick(b,x),A=S?.then?await S:S;if(A!==void 0){if(!A||A.element<0)return g(b,x,null);r.has(A.element)||r.set([A.element]),g(b,x,A.element)}});let y=[];return window.addEventListener("keydown",w=>{if(w.defaultPrevented)return;let b=Ap(w);if(b){if(w.preventDefault(),b==="contextMenu")return p(document.activeElement??document.body);if(b==="escape"&&!_.isOpen){y.some(x=>x())||r.clear();return}_.close(),b!=="escape"&&c[b]?.()}}),Lp(document.getElementById("ioviewer-status"),r,t.elementCount),Dp(i,a.truncated),{shell:h,toolbar:u,contextMenu:_,sync2DState:m,onEscape:w=>y.push(w)}}var Kh={x:new C(1,0,0),y:new C(0,1,0),z:new C(0,0,1)};function Jh(i){let e=Kh[i];if(!e)throw new RangeError(`Unknown axis: ${i}`);return e.clone()}function El(i,e,t){if(e.length===0)return!1;let n=s=>s.distanceToPoint(i)<0;return t?e.every(n):e.some(n)}function jp(i,e,t,n){let s=i.clone().normalize(),r=s.dot(e)+t;return n?new At(s,-r):new At(s.negate(),r)}function Qp(i,e,t=0){if(e!=="keepInside"&&e!=="cutInside")throw new RangeError(`Unknown box mode: ${e}`);let{min:n,max:s}=i,r=[new At(new C(1,0,0),-n.x),new At(new C(-1,0,0),s.x),new At(new C(0,1,0),-n.y),new At(new C(0,-1,0),s.y),new At(new C(0,0,1),-n.z),new At(new C(0,0,-1),s.z)];if(t!==0){let o=i.getCenter(new C);for(let a of r){let l=a.distanceToPoint(o);a.normal.applyAxisAngle(Kh.z,t),a.constant=l-a.normal.dot(o)}}return e==="keepInside"?{planes:r,intersection:!1}:{planes:r.map(o=>o.negate()),intersection:!0}}function em(i,e,t,n,s,r){let o=i.clone();if(n>0?o.max[t]=Math.max(i.max[t]+s,i.min[t]+r):o.min[t]=Math.min(i.min[t]-s,i.max[t]-r),e!==0){let a=o.getCenter(new C).sub(i.getCenter(new C));o.translate(a.clone().applyAxisAngle(Kh.z,e).sub(a))}return o}function tm(i){let{min:e,max:t}=i;return Array.from({length:8},(n,s)=>new C(s&1?t.x:e.x,s&2?t.y:e.y,s&4?t.z:e.z))}function nm(i,e,t){if(e.length===0||i.isEmpty())return!1;let n=tm(i),s=r=>n.every(o=>r.distanceToPoint(o)<0);return t?e.every(s):e.some(s)}function Tl(i,e){let t=i.getSize(new C).multiplyScalar(.5);return Math.abs(e.x)*t.x+Math.abs(e.y)*t.y+Math.abs(e.z)*t.z}function Yr(i,e,t){let n=e.clone().sub(i.origin),s=t.dot(i.direction),r=1-s*s;return r<.03?null:(s*i.direction.dot(n)-t.dot(n))/r}function Al(i,e,t){let n=new C(1,0,0).applyQuaternion(e),s=new C(0,1,0).applyQuaternion(e),[r,o,a,l]=[1/0,-1/0,1/0,-1/0];for(let h of tm(i)){h.sub(t);let d=h.dot(n),u=h.dot(s);[r,o,a,l]=[Math.min(r,d),Math.max(o,d),Math.min(a,u),Math.max(l,u)]}return{center:t.clone().addScaledVector(n,(r+o)/2).addScaledVector(s,(a+l)/2),width:(o-r)*1.1,height:(l-a)*1.1}}var $r=6,vb=["off","planes","box"],yb=.05,jh=new C(0,0,1),Rl=class extends EventTarget{constructor(e,t,n){super(),this.scene=e,this.modelBox=t.clone(),this.center=t.getCenter(new C),this.planes=[],this.active=-1,this.box=null,this.boxYaw=0,this.boxMode="keepInside",this.fill=!1,this.gizmoVisible=!0,this._mode="off",n&&this.restore(n)}restore({planes:e,box:t,cutInside:n}){this.modelBox.isEmpty()||(this.planes=e.map(({axis:s,normal:r,offset:o,flipped:a})=>{let l=new C().fromArray(r),c=new Ft().setFromUnitVectors(jh,l);return{axis:s,quaternion:c,offset:o-l.dot(this.center),flipped:a,enabled:!0,rotated:!1}}),this.active=this.planes.length?0:-1,this.box=t?new at(new C().fromArray(t.min),new C().fromArray(t.max)):null,this.boxYaw=0,this.boxMode=n?"cutInside":"keepInside",this.gizmoVisible=!1,this.setMode(this.box?"box":this.planes.length?"planes":"off"))}get mode(){return this._mode}setMode(e){if(!vb.includes(e))throw new RangeError(`Unknown section mode: ${e}`);e==="box"&&!this.box&&this.fitBoxToShown()||(this._mode=e,this._changed(!0))}addPlane(e){let t=Jh(e);if(this.planes.length>=$r||this.modelBox.isEmpty())return null;let n=new Ft().setFromUnitVectors(jh,t);return this.planes.push({axis:e,quaternion:n,offset:0,flipped:!1,enabled:!0,rotated:!1}),this.active=this.planes.length-1,this._mode="planes",this._changed(!0),this.active}removePlane(e){this._plane(e),this.planes.splice(e,1),(this.active>=this.planes.length||this.active>e)&&this.active--,this._changed(!0)}updatePlane(e,{offset:t,flipped:n,enabled:s,quaternion:r}){let o=this._plane(e);if(t!==void 0){if(!Number.isFinite(t))throw new RangeError(`Offset must be a finite number, got ${t}.`);o.offset=t}n!==void 0&&(o.flipped=!!n),s!==void 0&&(o.enabled=!!s),r&&(o.quaternion.copy(r).normalize(),o.rotated=o.axis!=="custom"&&this.normal(e).angleTo(Jh(o.axis))>1e-6),this._changed(!0)}setActivePlane(e){this._plane(e),this.active=e,this._changed(!1)}normal(e){return jh.clone().applyQuaternion(this._plane(e).quaternion)}extent(e){return Tl(this.modelBox,this.normal(e))}origin(e){return this.center.clone().addScaledVector(this.normal(e),this._plane(e).offset)}clipPlane(e){let t=this._plane(e);return jp(this.normal(e),this.center,t.offset,t.flipped)}setBox(e,t=0){if(e.isEmpty())throw new RangeError("The section box is empty.");t=im(t),this.box=e.clone(),this.boxYaw=t,this._mode="box",this._changed(!0)}setBoxYaw(e){this.box&&(this.boxYaw=im(e),this._changed(this.mode==="box"))}setBoxMode(e){if(e!=="keepInside"&&e!=="cutInside")throw new RangeError(`Unknown box mode: ${e}`);this.boxMode=e,this._changed(!0)}fitBoxToElements(e){let t=new at;for(let s of e)t.union(this.scene.elementBox(s));if(t.isEmpty())return!1;let n=t.getSize(new C);return this.setBox(t.expandByScalar(yb*Math.max(n.x,n.y,n.z))),!0}fitBoxToShown(){let e=this.scene.visibleBox();if(e.isEmpty())return!1;let t=e.getSize(new C);return this.setBox(e.expandByScalar(.001*Math.max(t.x,t.y,t.z))),!0}setGizmoVisible(e){this.gizmoVisible=!!e,this._changed(!1)}setFill(e){this.fill=!!e,this._changed(!1)}reset(){this.planes=[],this.active=-1,this.box=null,this.boxYaw=0,this._mode="off",this._changed(!0)}clipping(){if(this._mode==="planes")return{planes:this.planes.flatMap((t,n)=>t.enabled?[this.clipPlane(n)]:[]),intersection:!1};if(this._mode==="box"&&this.box){let e=Qp(this.box,this.boxMode,this.boxYaw);if(!e.intersection&&this.boxYaw!==0){let t=this.box.getCenter(new C),n=this.box.getSize(new C).multiplyScalar(.5),s=Math.abs(Math.cos(this.boxYaw)),r=Math.abs(Math.sin(this.boxYaw));n.set(s*n.x+r*n.y,r*n.x+s*n.y,n.z),e.bounds=new at(t.clone().sub(n),t.add(n))}return e}return{planes:[],intersection:!1}}isCut(e,{planes:t,intersection:n,bounds:s}=this.clipping()){return s&&!e.isEmpty()&&!s.intersectsBox(e)||nm(e,t,n)}_plane(e){let t=this.planes[e];if(!Number.isInteger(e)||!t)throw new RangeError(`Plane index ${e} is out of range 0..${this.planes.length-1}.`);return t}_changed(e){if(e){let{planes:t,intersection:n}=this.clipping();this.scene.setClipping(t,n)}this.dispatchEvent(new Event("change"))}};function im(i){if(!Number.isFinite(i))throw new RangeError("The section box angle must be finite.");return i>=-Math.PI&&i<=Math.PI?i:lt.euclideanModulo(i+Math.PI,2*Math.PI)-Math.PI}var Qh=80,bb=8,nu=.8,Mb=Math.sin(lt.degToRad(12)),Pi={x:"#ef4444",y:"#22c55e",z:"#3b82f6",centre:"#e2e8f0",hover:"#facc15",frame:"#93c5fd",fill:"#60a5fa"},eu=["x","y","z"],Sb=Math.cos(lt.degToRad(12)),Cl=new C(0,0,1),wb=i=>new Jt({color:i,depthTest:!1,depthWrite:!1,transparent:!0,opacity:.9}),Eb=new Jt({visible:!1});function Il(i,e,t,n){let s=new Rt,r=wb(e);for(let a of t)s.add(new gt(a,r));let o=new gt(n,Eb);return o.userData.handle=s,s.add(o),s.userData={kind:i,color:e,material:r,proxy:o},s.traverse(a=>a.renderOrder=1e3),s}function tu(i,e,t=n=>n){let n=Il("rotate",Pi[e],[t(new As(nu,.018,8,64))],t(new As(nu,.09,8,48)));return n.name=i,n.userData.axis=e,n}var Pl=class extends EventTarget{constructor(e,t){super(),this.sections=e,this.dom=t,this.camera=null,this.group=new Rt,this.group.name="sections",this._raycaster=new qn,this._drag=null,this._hovered=null,this._buildPlanes(),this._buildPlaneGizmo(),this._buildBox(),e.addEventListener("change",()=>this._sync()),(t.parentElement??t).addEventListener("pointerdown",n=>this._down(n),!0),t.addEventListener("pointermove",n=>this._move(n)),t.addEventListener("pointerup",n=>this._up(n)),t.addEventListener("pointercancel",()=>this._end()),t.addEventListener("lostpointercapture",()=>this._end()),this._sync()}get dragging(){return this._drag!==null}update(e){this.camera=e;let t=this.planeGizmo;t.visible&&(t.scale.setScalar(this._worldPerPixel(t.position)*Qh),this.arrow.visible=this._across(Cl.clone().applyQuaternion(t.quaternion),t.position));for(let s of this.boxHandles){let{shown:r,normal:o}=s.userData;s.visible=r&&(!o||this._across(o,s.position)),s.visible&&s.scale.setScalar(this._worldPerPixel(s.position)*bb)}let n=this.boxRing;n.visible&&n.scale.setScalar(this._worldPerPixel(n.position)*Qh)}_across(e,t){let n=this.camera,s=n.isOrthographicCamera?n.getWorldDirection(new C):t.clone().sub(n.position).normalize();return Math.abs(e.dot(s))new C(r/2,o/2,0))),n=new Jt({color:Pi.fill,transparent:!0,opacity:.12,side:kt,depthWrite:!1}),s=new sn({color:Pi.frame});this.planeVisuals=Array.from({length:$r},()=>{let r=new Rt;return r.add(new gt(e,n),new ki(t,s)),this.group.add(r),r})}_buildPlaneGizmo(){let e=(n,s)=>n.rotateX(Math.PI/2).translate(0,0,s),t=Il("move",Pi.z,[e(new Hi(.025,.025,1),.5),e(new fr(.08,.25),1.125)],e(new Hi(.12,.12,1.25),.625));t.name="arrow",this.arrow=t,this.planeGizmo=new Rt,this.planeGizmo.add(t,tu("ringX","x",n=>n.rotateY(Math.PI/2)),tu("ringY","y",n=>n.rotateX(Math.PI/2))),this.group.add(this.planeGizmo)}_buildBox(){this.boxWire=new ln(new Vi(new _n(1,1,1)),new sn({color:Pi.frame})),this.group.add(this.boxWire);let e=new Wn(1,16,12),t=new Wn(1.6,8,6);this.boxHandles=[];for(let s of eu)for(let r of[-1,1]){let o=Il("face",Pi[s],[e],t);o.name=`face${r>0?"+":"-"}${s}`,Object.assign(o.userData,{axis:s,sign:r,normal:new C}),this.boxHandles.push(o)}let n=Il("centre",Pi.centre,[new _n(1.4,1.4,1.4)],t);n.name="centre",this.boxHandles.push(n),this.boxRing=tu("boxRing","z"),this.group.add(...this.boxHandles,this.boxRing)}_sync(){let e=this.sections,t=e.mode==="planes";this.planeVisuals.forEach((r,o)=>{let a=e.planes[o];if(r.visible=t&&!!a?.enabled,!r.visible)return;r.children[0].visible=!e.fill;let l=Al(e.modelBox,a.quaternion,e.origin(o));r.position.copy(l.center),r.quaternion.copy(a.quaternion),r.scale.set(l.width,l.height,1)});let n=e.planes[e.active];this.planeGizmo.visible=t&&e.gizmoVisible&&!!n?.enabled,this.planeGizmo.visible&&(this.planeGizmo.position.copy(e.origin(e.active)),this.planeGizmo.quaternion.copy(n.quaternion));let s=e.mode==="box"?e.box:null;this.boxWire.visible=!!s,this.boxRing.visible=!!s&&e.gizmoVisible;for(let r of this.boxHandles)r.visible=r.userData.shown=!!s&&e.gizmoVisible;if(s){let r=s.getCenter(new C),o=s.getSize(new C);this.boxWire.position.copy(r),this.boxWire.scale.copy(o).max(new C(1e-6,1e-6,1e-6)),this.boxWire.rotation.z=e.boxYaw,this.boxRing.position.copy(r);for(let a of this.boxHandles){let{axis:l,sign:c,normal:h}=a.userData;h?(h.set(0,0,0).setComponent(eu.indexOf(l),c).applyAxisAngle(Cl,e.boxYaw),a.position.copy(r).addScaledVector(h,o[l]/2)):a.position.copy(r)}}}_worldPerPixel(e){let t=this.camera,n=Math.max(this.dom.clientHeight,1);if(t.isOrthographicCamera)return(t.top-t.bottom)/t.zoom/n;let s=e.clone().sub(t.position).dot(t.getWorldDirection(new C));return 2*Math.max(s,t.near)*Math.tan(lt.degToRad(t.fov/2))/n}_ray(e){let t=this.dom.getBoundingClientRect(),n=new qe((e.clientX-t.left)/t.width*2-1,1-(e.clientY-t.top)/t.height*2);return this.camera.updateMatrixWorld(),this._raycaster.setFromCamera(n,this.camera),this._raycaster.ray.clone()}_hit(e){if(!this.camera)return null;this.update(this.camera),this.group.updateMatrixWorld(!0);let t=r=>{for(;r&&r!==this.group;r=r.parent)if(!r.visible)return!1;return!0},n=[];this.group.traverse(r=>r.userData.handle&&t(r)&&n.push(r)),this._ray(e);let s=this._raycaster.intersectObjects(n,!1);return(this.sections.mode==="box"?s.find(r=>r.object.userData.handle!==this.boxRing):null)??s[0]??null}_down(e){if(e.target!==this.dom||e.button!==0)return;let t=this._hit(e);if(!t)return;let n=t.object.userData.handle,s=this._start(n,this._raycaster.ray,t.point,e);s&&(e.stopPropagation(),e.preventDefault(),this.dom.setPointerCapture(e.pointerId),this._drag={id:e.pointerId,handle:n,...s},this._highlight(n))}_start(e,t,n,s){let r=this.sections,{kind:o}=e.userData;if(o==="move"){let u=r.active,f=r.origin(u),m=r.normal(u),_=Yr(t,f,m);return _===null?null:{index:u,origin:f,normal:m,offset:r.planes[u].offset,s0:_}}if(o==="rotate"){let u=r.active,f=e===this.boxRing,m=f?e.position.clone():r.origin(u),_=f?null:r.planes[u].quaternion.clone(),g=f?Cl:new C().setComponent(eu.indexOf(e.userData.axis),1).applyQuaternion(_),p={index:u,origin:m,quaternion:_,axis:g,yaw:f?r.boxYaw:null};if(Math.abs(g.dot(t.direction))0&&r===0}function Cb(i,e){let{instances:t,geometries:n}=e.meta,s=e.readView(t.geometry),{width:r,height:o}=i.slotUniforms.slotState.value.image,a=new Uint8Array(r*o),l=new Map;for(let h=0;h -${zr} +${kr} #include uniform highp sampler2D closedSlots; void main() { - ${kr} + ${Hr} vec3 transformed = slotPosition; #include #include - ${Ah} + ${Rh} if ( texelFetch( closedSlots, st, 0 ).r < 0.5 ) gl_Position = vec4( 0.0, 0.0, 2.0, 1.0 ); }`,fragmentShader:` #include void main() { #include gl_FragColor = vec4( 0.0 ); -}`,side:e,stencilZPass:n,stencilWrite:!0,clipping:!0,clippingPlanes:[t],colorWrite:!1,depthTest:!1,depthWrite:!1});return s.index0AttributeName="q",s}var Pl=class{constructor(t,e,n,s){this.model=t,this.sections=e,this.data=n,this.drawStencils=s,this._farSide=new Ae,this._surface=new ge(new cn(1,1),new Je({color:mM,side:ke,forceSinglePass:!0,stencilWrite:!0,stencilFunc:Gc,stencilWriteMask:0}))}render(t,e,n){let{sections:s,model:r}=this,{planes:o,intersection:a}=s.clipping(),l=a?o.map(u=>u.clone().negate()):o,c=u=>Math.abs(u.distanceToPoint(s.center)){if(!c(f))return;let _=u?-f.normal.dot(u):f.distanceToPoint(n.position);if(_===0)return;if(this._farSide.copy(f),_>0&&this._farSide.negate(),t.clearStencil(),this.drawStencils)this.drawStencils(t,n,this._farSide);else for(let p of this._stencils)r.withMaterial(p,()=>t.render(r.root,n),{section:!0});this._surface.quaternion.setFromUnitVectors(pM,f.normal);let g=Tl(s.modelBox,this._surface.quaternion,f.coplanarPoint(new C));this._surface.position.copy(g.center),this._surface.scale.set(g.width,g.height,1),h.clippingPlanes=l.filter((p,y)=>y!==m),t.render(this._surface,n)}),t.render(e,n)}finally{t.autoClear=d}}};function $r(i,t,e){let n=K("div","ioviewer-segmented");n.setAttribute("role","group"),n.setAttribute("aria-label",i);let s=t.map(([o,a])=>{let l=K("button","",a);return l.type="button",l.dataset.value=o,l.addEventListener("click",()=>e(o)),n.append(l),l});return{element:n,update:o=>s.forEach(a=>a.setAttribute("aria-pressed",String(a.dataset.value===o)))}}function tu(i,t){let e=K("label","ioviewer-check"),n=K("input");return n.type="checkbox",n.addEventListener("change",()=>t(n.checked)),e.append(n,K("span","",i)),{element:e,input:n}}function xM(i,t){let e=K("li","ioviewer-section-plane");e.addEventListener("pointerdown",()=>i.active!==t&&i.setActivePlane(t));let n=K("span","ioviewer-section-name"),s=tn("ioviewer-icon-button",oe.flip,q("sections.flip"));s.addEventListener("click",()=>i.updatePlane(t,{flipped:!i.planes[t].flipped}));let r=tu(q("sections.enabled"),h=>i.updatePlane(t,{enabled:h})),o=tn("ioviewer-icon-button",oe.remove,q("sections.delete"));o.addEventListener("click",()=>i.removePlane(t));let a=K("input","ioviewer-section-slider");a.type="range",a.step="any",a.setAttribute("aria-label",q("sections.position")),a.addEventListener("input",()=>i.updatePlane(t,{offset:Number(a.value)}));let l=K("div","ioviewer-section-head");return l.append(n,s,r.element,o),e.append(l,a),{element:e,update:()=>{let h=i.planes[t],d=h.rotated?` (${q("sections.rotated")})`:"",u=h.axis==="custom"?q("sections.custom"):h.axis.toUpperCase();n.textContent=`${t+1}. ${u}${d}`,e.classList.toggle("active",i.active===t),s.setAttribute("aria-pressed",String(h.flipped)),r.input.checked=h.enabled;let f=i.extent(t);a.min=String(Math.min(-f,h.offset)),a.max=String(Math.max(f,h.offset)),a.value=String(h.offset)}}}function qp({root:i,shell:t,toolbar:e,contextMenu:n,sections:s,selection:r,canFill:o,hasMeshes:a=!0}){let l="z",c=()=>{s.addPlane(l)===null&&(s.setMode("planes"),Xs(i,q("sections.maxPlanes")))},h=()=>[...r.values()],d=()=>s.fitBoxToElements(h()),u=$r(q("sections.mode"),[["planes",q("sections.planes")],["box",q("sections.box")],["off",q("sections.off")]],F=>s.setMode(F)),f=$r(q("sections.axis"),["x","y","z"].map(F=>[F,F.toUpperCase()]),F=>f.update(l=F));f.update(l);let m=K("button","ioviewer-text-button",q("sections.addPlane"));m.type="button",m.addEventListener("click",c);let _=K("ul","ioviewer-section-list"),g=K("div","ioviewer-section-empty",q("sections.noPlanes")),p=K("div","ioviewer-section-block"),y=K("div","ioviewer-section-row");y.append(K("span","",q("sections.axis")),f.element,m),p.append(y,_,g);let w=$r(q("sections.box"),[["keepInside",q("sections.keepInside")],["cutInside",q("sections.cutInside")]],F=>s.setBoxMode(F)),M=K("button","ioviewer-text-button",q("sections.fitSelection"));M.type="button",M.addEventListener("click",d);let x=K("input","ioviewer-section-slider");Object.assign(x,{type:"range",min:"-180",max:"180",step:"1"}),x.addEventListener("input",()=>s.setBoxYaw(Number(x.value)*Math.PI/180));let S=K("span");S.setAttribute("aria-hidden","true");let A=K("label","ioviewer-section-row");A.append(K("span","",q("sections.boxYaw")),x,S);let v=K("div","ioviewer-section-block");v.append(w.element,A,M);let E=tu(q("sections.showGizmo"),F=>s.setGizmoVisible(F)),R=tu(q("sections.fill"),F=>s.setFill(F));o||(R.element.title=q(a?"sections.fillUnavailable":"sections.fillNeedsMeshes"));let L=[],N=()=>{u.update(s.mode),p.hidden=s.mode!=="planes",v.hidden=s.mode!=="box",m.disabled=s.planes.length>=Yr,L.length!==s.planes.length&&(L=s.planes.map((H,V)=>xM(s,V)),_.replaceChildren(...L.map(H=>H.element))),L.forEach(H=>H.update()),g.hidden=L.length>0,w.update(s.boxMode),x.value=String(Math.round(s.boxYaw*180/Math.PI)),S.textContent=`${x.value}\xB0`,x.setAttribute("aria-valuetext",S.textContent),E.input.checked=s.gizmoVisible,R.input.checked=s.fill;let F=s.mode==="box"||s.mode==="planes"&&s.planes.some(H=>H.enabled);R.input.disabled=!o||!F,e.setActive("plane",s.mode==="planes"),e.setActive("box",s.mode==="box")},B=()=>M.disabled=r.size===0;if(t.registerPanel("sections",{icon:oe.sections,title:q("panel.sections"),visible:!s.modelBox.isEmpty(),render:F=>F.append(u.element,p,v,R.element,E.element)}),s.addEventListener("change",N),r.addEventListener("change",B),N(),B(),s.modelBox.isEmpty())return;let D=()=>t.openPanel("sections");e.setHandler("plane",()=>{c(),D()}),e.setHandler("box",()=>{(s.mode==="box"||r.size&&d()||s.fitBoxToShown())&&D()}),e.setHandler("resetSections",()=>s.reset()),n.setItem("sectionBox",{handler:F=>{s.fitBoxToElements(r.has(F)?h():[F]),D()}}),n.setItem("resetSections",{handler:()=>s.reset()})}var vM="#facc15",yM=9;function eu(i,t=Pn){return`${new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!1}).format(i)} ${q("unit.m",t)}`}var Ll=class extends EventTarget{constructor(t){super(),this.active=!1,this.points=[],this.preview=null,this.group=new Re,this.group.name="measure";let e=new he;e.setAttribute("position",new xe(new Float32Array(6),3));let n={color:vM,depthTest:!1,depthWrite:!1,transparent:!0};this._line=new zi(e,new sn(n)),this._markers=new wn(e,new Vn({...n,size:yM,sizeAttenuation:!1}));for(let s of[this._line,this._markers])s.frustumCulled=!1,s.renderOrder=1001,this.group.add(s);this.label=K("div","ioviewer-measure-label"),this.label.hidden=!0,this._previewMarker=K("div","ioviewer-measure-preview"),this._previewMarker.hidden=!0,this._previewMarker.setAttribute("aria-hidden","true"),t.prepend(this.label,this._previewMarker),this._sync()}get distance(){return this.points.length===2?this.points[0].distanceTo(this.points[1]):null}get box(){return new ae().setFromPoints(this.points)}setActive(t){this.active=!!t,this.active||(this.points=[],this.setPreview(null)),this._sync()}add(t){this.active&&(this.points=this.points.length===1?[this.points[0],t.clone()]:[t.clone()],this._sync())}clear(){return this.points.length===0?!1:(this.points=[],this._sync(),!0)}setPreview(t){!this.preview&&!t||(this.preview=t,this._previewMarker.hidden=!t,t&&(this._previewMarker.dataset.kind=t.kind),this.dispatchEvent(new Event("previewchange")))}update(t,e){this.preview&&Wr(this._previewMarker,this.preview.point,t,e),this.distance!==null&&Wr(this.label,this.points[0].clone().lerp(this.points[1],.5),t,e)}_sync(){let t=this._line.geometry.attributes.position;this.points.forEach((e,n)=>t.setXYZ(n,e.x,e.y,e.z)),t.needsUpdate=!0,this._line.geometry.setDrawRange(0,this.points.length),this._line.visible=this.points.length===2,this._markers.visible=this.points.length>0,this.label.hidden=this.distance===null,this.distance!==null&&(this.label.textContent=eu(this.distance)),this.dispatchEvent(new Event("change"))}};var Zr=8,MM=1-1e-6,bM=8,Yp={vertex:0,midpoint:1,edge:2},SM=2e4;function wM(i,t){let e=new Map,n=new Uint32Array(i.length/3);for(let d=0;d0&&(_.normalize(),l(u,f,_),l(f,m,_),l(m,u,_))}let c=[],h=new Set;for(let{lo:d,hi:u,count:f,crease:m}of s.values())f!==1&&!m||(c.push(d,u),h.add(d),h.add(u));return{edges:c,vertices:h}}function Dl(i,t,e){return t<0&&e<0?!1:(t<0&&(i[0]=Math.max(i[0],t/(t-e))),e<0&&(i[1]=Math.min(i[1],t/(t-e))),i[0]<=i[1])}function $p(i,t,e,n,s,r){let o=[0,1];if(!Dl(o,e.w+e.z,n.w+n.z)||!Dl(o,e.w-e.z,n.w-n.z))return[];if(!r||!s.length)return s.every(c=>Dl(o,c.distanceToPoint(i),c.distanceToPoint(t)))?[o]:[];let a=o.slice();if(!s.every(c=>{let h=c.distanceToPoint(i),d=c.distanceToPoint(t);return(h<0||d<0)&&Dl(a,-h,-d)}))return[o];let l=[];return o[0]0))return null;let g=le.clamp(((r-c)*f+(o-h)*m)/_,0,1);return e+(n-e)*(g*a.w/((1-g)*l.w+g*a.w))}var Nl=class{constructor(t,e,n){this.picker=t,this.sections=e,this.data=n,this.cache=new Map}release(){this.data.releaseBinary(),this.cache.clear()}_geometry(t){let e=this.cache.get(t);if(e)this.cache.delete(t);else{let n=this.data.meta.geometries[t],s=Hs({view:this.data.readView},n),r=this.data.readView(n.indices);if(n.kind==="lines"){let o=[],a=new Set,l=r.length-r.length%2;for(let c=0;cbM&&this.cache.delete(this.cache.keys().next().value),e}target(t,e){let n=this.picker.measureTile(t,e,Zr+1);if(!n)return null;if(n.pointSample)return{kind:"vertex",point:n.point.clone()};let{rect:s}=n,r=t-s.left,o=e-s.top,{camera:a,scene:l}=this.picker,{planes:c,intersection:h}=this.sections.clipping(),d=new Kt().multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),u=a.matrixWorldInverse.elements,f=null;function m(x,S,A,v){if(f&&Yp[x]>Yp[f.kind]||A.w<=0||A.z<-A.w||A.z>A.w)return;let[E,R]=qs(A,s);if(!(E>=0&&R>=0&&EZr**2||f?.kind===x&&L>=f.distance||x!=="edge"&&wl(S,c,h))return;let N=-(u[2]*S.x+u[6]*S.y+u[10]*S.z+u[14]);N-n.depthAt(E,R,v)>2*Cn+Math.abs(N)*2**-21||(f={kind:x,distance:L,point:S.clone()})}let _=SM*3,g=new Kt,p=new C,y=new ve,{geometry:w,matrix:M}=this.data.meta.instances;for(let x of n.slots){let S=l.slotInstance(x),[A]=this.data.readView({t:"u32",o:w.o+S*4,n:1}),v=this.data.meta.geometries[A],E=Math.max(v.indices.n,v.positions.n/3);if(E>_)continue;_-=E;let{positions:R,vertices:L,edges:N}=this._geometry(A),B=this.data.readView({t:"f32",o:M.o+S*48,n:12});g.set(B[0],B[3],B[6],B[9],B[1],B[4],B[7],B[10],B[2],B[5],B[8],B[11],0,0,0,1);let D=new Map;for(let F of L){let H=new C().fromArray(R,F*3).applyMatrix4(g),V=new ve(H.x,H.y,H.z,1).applyMatrix4(d);D.set(F,[H,V]),m("vertex",H,V,x)}if(f?.kind!=="vertex")for(let F=0;F_)continue;_-=R;let{positions:L,vertices:N,edges:B}=this._geometry(v),D=this.data.readView({t:"f32",o:S.o+A*48,n:12});g.set(D[0],D[3],D[6],D[9],D[1],D[4],D[7],D[10],D[2],D[5],D[8],D[11],0,0,0,1);let F=new Map;for(let H of N){let V=new C().fromArray(L,H*3).applyMatrix4(g),z=new ve(V.x,V.y,V.z,1).applyMatrix4(d);if(F.set(H,[V,z]),z.w>0&&z.z>=-z.w&&z.z<=z.w){let[U,k]=qs(z,s),Y=(U-r)**2+(k-o)**2;Y<=Zr**2&&(!f||f.kind!=="vertex"||Y0&&G.z>=-G.w&&G.z<=G.w){let[J,it]=qs(G,s),nt=(J-r)**2+(it-o)**2;nt<=Zr**2&&(!f||f.kind!=="midpoint"||ntr.element)),t.prepend(s),this._layer=s,this.setVisible(this.count>0)}get visible(){return this.group.visible}setVisible(t){this.group.visible=!!t,this._layer.hidden=!t,this.dispatchEvent(new Event("change"))}update(t,e){if(this.visible)for(let{element:n,point:s}of this._labels)Wr(n,s,t,e)}};var EM=8,Kp=4;function nu(i,t,e,n="dialog"){let s=K("div","ioviewer-popover ioviewer-floating");s.setAttribute("role",n),s.setAttribute("aria-label",e),s.hidden=!0,t.setAttribute("aria-haspopup",n),t.setAttribute("aria-expanded","false"),i.append(s);function r(l){s.contains(l.target)||(a(),fl(l))}s.addEventListener("keydown",l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),a(),t.focus())});function o(){s.hidden=!1,t.setAttribute("aria-expanded","true");let l=t.getBoundingClientRect(),{width:c}=s.getBoundingClientRect();s.style.left=`${Math.max(Kp,Math.min(l.left+l.width/2-c/2,innerWidth-c-Kp))}px`,s.style.bottom=`${innerHeight-l.top+EM}px`,window.addEventListener("pointerdown",r,!0),window.addEventListener("resize",a)}function a(){return s.hidden?!1:(s.hidden=!0,t.setAttribute("aria-expanded","false"),window.removeEventListener("pointerdown",r,!0),window.removeEventListener("resize",a),!0)}return{element:s,close:a,toggle:()=>s.hidden?o():a(),get isOpen(){return!s.hidden}}}function TM(i){return i?.initialWireframe?"wireframe":i?.initialWhiteMode?"white":"materials"}function Jp({root:i,toolbar:t,scene:e,meta:n,grids:s,initialBackground:r,setBackground:o,hasMeshes:a=!0}){let l=L=>t.element.querySelector(`[data-tool="${L}"]`),c=l("displayMode"),h=nu(i,c,q("group.display"));h.element.classList.add("ioviewer-display-modes");let d=K("div");d.setAttribute("role","menu"),d.setAttribute("aria-label",q("tool.displayMode")),h.element.append(d);let u=(n.textures??[]).length>0,f=Dh.map(L=>{let N=K("button","ioviewer-menu-item",q(`display.${L}`));return N.type="button",N.dataset.mode=L,N.setAttribute("role","menuitemradio"),N.disabled=L==="textures"&&!u||L==="wireframe"&&!a,N.addEventListener("click",()=>{m(L),h.close(),c.focus()}),d.append(N),N}),m=L=>{e.setDisplayMode(L);for(let N of f)N.setAttribute("aria-checked",String(N.dataset.mode===L))},_=TM(n.options);m(_==="wireframe"&&!a?"materials":_),t.setHandler("displayMode",()=>{h.toggle(),h.isOpen&&d.querySelector('[aria-checked="true"]')?.focus()});let g=K("div","ioviewer-background-setting"),p=K("label","",q("display.background")),y=K("input");Object.assign(y,{type:"color",value:r}),p.append(y);let w=K("button","ioviewer-text-button",q("display.backgroundReset"));w.type="button",w.disabled=!0;let M=()=>{o(y.value),w.disabled=y.value===r};y.addEventListener("input",M),w.addEventListener("click",()=>{y.value=r,y.focus(),M()});let x=K("div","ioviewer-bg-presets");for(let[L,N]of[["#14171c","display.bgCadDark"],["#ffffff","display.bgPaper"]]){let B=K("button","ioviewer-text-button",q(N));B.type="button",B.addEventListener("click",()=>{y.value=L,M()}),x.append(B)}g.append(p,x,w),h.element.append(g),t.setActive("grids",s.visible),s.count>0&&t.setHandler("grids",()=>{s.setVisible(!s.visible),t.setActive("grids",s.visible)});let S=nu(i,l("opacity"),q("tool.opacity"));S.element.classList.add("ioviewer-opacity");let A=K("input","ioviewer-opacity-slider");Object.assign(A,{type:"range",min:"10",max:"100",step:"1",value:"100"}),A.setAttribute("aria-label",q("opacity.label"));let v=K("output","ioviewer-opacity-value"),E=()=>v.textContent=q("opacity.value").replace("{value}",A.value);A.addEventListener("input",()=>{e.setOpacity(Number(A.value)/100),E()}),E();let R=K("div","ioviewer-opacity-head");return R.append(K("span","",q("opacity.label")),v),S.element.append(R,A),t.setHandler("opacity",S.toggle),[h,S]}var AM=3e3;function Fl(i,t){let e=K("button",i);return e.type="button",e.setAttribute("title",t),e.append(K("span","ioviewer-row-name",t)),e}function jp({shell:i,toolbar:t,controls:e,scene:n,sections:s,selection:r,restoreLinkedModels:o,views:a,bcfTopics:l}){let c=null,h=K("button","ioviewer-text-button ioviewer-tour");h.type="button";function d(w){w.sections!=null&&s.restore(w.sections),w.hiddenElements!=null&&n.setHiddenElements(w.hiddenElements),w.visibleElements!=null&&n.isolate(w.visibleElements),w.hiddenModelKeys!=null&&o(w.hiddenModelKeys),w.selectedElements!=null&&r.set(w.selectedElements);let M=w.camera.projection==="orthographic";e.setProjection(M?"orthographic":"perspective"),t.setActive("projection",M),e.restoreViewCamera(w.camera)}function u(){d(a[c.next]),c.next=(c.next+1)%a.length;let w=()=>{e.animating?c.frame=requestAnimationFrame(w):c.timer=setTimeout(u,AM)};c.frame=requestAnimationFrame(w)}let f=w=>h.contains(w.target),m=w=>!f(w)&&g(),_=w=>{f(w)&&(w.key==="Enter"||w.key===" ")||(w.key==="Escape"&&(w.preventDefault(),w.stopPropagation()),g())};function g(){c&&(cancelAnimationFrame(c.frame),clearTimeout(c.timer),c=null,window.removeEventListener("pointerdown",m,!0),window.removeEventListener("wheel",g,!0),window.removeEventListener("keydown",_,!0),y())}function p(){c={next:0,frame:0,timer:0},window.addEventListener("pointerdown",m,!0),window.addEventListener("wheel",g,!0),window.addEventListener("keydown",_,!0),y(),u()}function y(){let w=q(c?"views.stop":"views.tour");h.replaceChildren(),h.insertAdjacentHTML("afterbegin",c?oe.pause:oe.play),h.append(K("span","",w)),h.setAttribute("aria-pressed",String(!!c))}h.addEventListener("click",()=>c?g():p()),y(),i.registerPanel("views",{icon:oe.views,title:q("panel.views"),visible:a.length>0,render:w=>{let M=K("div","ioviewer-row-list");for(let x of a){let S=Fl("ioviewer-row ioviewer-view",String(x.name??""));S.addEventListener("click",()=>d(x)),M.append(S)}w.append(h,M)}}),i.registerPanel("bcf",{icon:oe.bcf,title:q("panel.bcf"),visible:l.length>0,render:w=>{let M=K("div","ioviewer-row-list");for(let x of l){let S=K("details","ioviewer-bcf-topic");S.append(K("summary","",x.title)),x.status&&S.append(K("p","ioviewer-bcf-status",x.status)),x.description&&S.append(K("p","ioviewer-bcf-description",x.description)),x.viewpoints.length||S.append(K("p","ioviewer-bcf-status",q("bcf.noView"))),x.viewpoints.forEach((A,v)=>{let E=q("bcf.viewpoint").replace("{index}",String(v+1)),R=Fl("ioviewer-row ioviewer-view",E);if(R.addEventListener("click",()=>d(A)),S.append(R),A.missingComponents||A.ambiguousComponents){let L=q("bcf.components").replace("{missing}",String(A.missingComponents)).replace("{ambiguous}",String(A.ambiguousComponents));S.append(K("p","ioviewer-bcf-status",L))}}),M.append(S)}w.append(M)}})}function Qp(i,t){let e=[];for(let[n,s]of[[i.element1Id,i.element1Name],[i.element2Id,i.element2Name]]){let r=n!=null?t.findIndex(o=>o.id!=null&&String(o.id)===String(n)&&!o.mesh):RM(t,s);r>=0&&!e.includes(r)&&e.push(r)}return e}function RM(i,t){if(t==null)return-1;let e=i.findIndex(n=>n.name===t);return e>=0&&i.findIndex((n,s)=>s>e&&n.name===t)<0?e:-1}var CM=["New","Active","Reviewed","Approved","Resolved"],iu=27,IM=8,PM=14,LM=2,DM=new C(1,-1,.8).normalize();function tm({shell:i,tests:t,elements:e,scene:n,controls:s,selection:r}){let o=new Re;o.name="clash-marker";let a=new he;a.setAttribute("position",new xe(new Float32Array(3),3));let l={color:"#ef4444",depthTest:!1,depthWrite:!1,transparent:!0},c=new wn(a,new Vn({...l,size:PM,sizeAttenuation:!1}));c.frustumCulled=!1,c.renderOrder=1002,o.add(c),o.visible=!1;let h=null,d=null;function u(){o.visible=!1,h?.removeAttribute("aria-current"),h=null,d=null,s.setExtraBounds("clash",null)}function f(y,w){let M=Qp(y,e);M.length?r.set(M):r.clear();let x=new C(...y.point),S=0;for(let E of M){let R=n.elementBox(E);R.isEmpty()||(S=Math.max(S,...R.getSize(new C).toArray()))}let A=s.camera.position.clone().sub(s.target);A.lengthSq()<1e-12&&A.copy(DM);let v=Math.max(3*S,LM);s.animateTo({position:A.normalize().multiplyScalar(v).add(x),target:x}),a.attributes.position.setXYZ(0,x.x,x.y,x.z),a.attributes.position.needsUpdate=!0,o.visible=!0,h?.removeAttribute("aria-current"),h=w,d=y,w.setAttribute("aria-current","true"),s.setExtraBounds("clash",new ae(x.clone(),x.clone()))}function m(y){let w=Fl("ioviewer-row ioviewer-clash",String(y.name??""));w.setAttribute("title",`${y.name??""}: ${y.element1Name??""} \u2014 ${y.element2Name??""}`);let M=CM.includes(y.status),x=K("span","ioviewer-clash-status",M?q(`clash.${y.status}`):String(y.status??""));M&&(x.dataset.status=y.status);let S=typeof y.distance=="number"?eu(y.distance):"";return w.append(x,K("span","ioviewer-clash-distance",S)),y===d&&(h=w,w.setAttribute("aria-current","true")),w.addEventListener("click",()=>f(y,w)),w}function _(y,w){let M=K("div","ioviewer-clash-test"),x=K("button","ioviewer-row ioviewer-clash-header");x.type="button",x.setAttribute("aria-expanded","true");let S=`${y.name??""} (${y.clashes.length})`;x.setAttribute("title",S),x.insertAdjacentHTML("afterbegin",oe.chevron),x.append(K("span","ioviewer-row-name",S));let A=K("div","ioviewer-clash-list");return A.style.height=`${Math.max(0,y.clashes.length*iu-1)}px`,x.addEventListener("click",()=>{A.hidden=!A.hidden,x.setAttribute("aria-expanded",String(!A.hidden)),w()}),M.append(x,A),{box:M,list:A,clashes:y.clashes,rows:new Map}}function g({list:y,clashes:w,rows:M},{start:x,end:S}){for(let[v,E]of M)(v=S)&&(E.remove(),M.delete(v));let A=null;for(let v=S-1;v>=x;v--){let E=M.get(v);E||(E=m(w[v]),E.style.top=`${v*iu}px`,y.insertBefore(E,A),M.set(v,E)),A=E}}function p(y){if(!t.length)return;y.classList.add("ioviewer-clashes-body");let w=t.map(x=>_(x,M));for(let x of w)y.append(x.box);function M(){let x=y.scrollTop,S=y.clientHeight,A=w.map(({list:v,clashes:E})=>S&&!v.hidden?Vh(x-v.offsetTop,iu,S,E.length,IM):{start:0,end:0});w.forEach((v,E)=>g(v,A[E]))}y.addEventListener("scroll",M),y.addEventListener("focusin",M),new ResizeObserver(M).observe(y)}return i.registerPanel("clashes",{icon:oe.clashes,title:q("panel.clashes"),visible:t.length>0,render:p,onClose:()=>o.visible&&u()}),{group:o}}var NM=["construct","demolish","temporary"],UM=Date.parse("0002-01-01T00:00:00Z");function em(i){let t=typeof i=="string"?Date.parse(i):NaN;return t>=UM?t:NaN}function nm(i,t){let e=new Map(t.flatMap((o,a)=>o.mesh||o.id==null?[]:[[String(o.id),a]])),n=[];for(let o of Array.isArray(i?.tasks)?i.tasks:[]){let a=em(o?.start),l=em(o?.end);if(!(a<=l))continue;let c=NM.includes(o.type)?o.type:"construct",h=Array.isArray(o.attachedElements)?o.attachedElements:[];n.push({name:o.name,type:c,start:a,end:l,elements:h.map(d=>e.get(String(d))).filter(d=>d!==void 0)})}let s=n.reduce((o,a)=>Math.min(o,a.start),1/0),r=n.reduce((o,a)=>Math.max(o,a.end),-1/0);return{start:s,end:r,tasks:n}}function im(i,t){let e=new Set,n=new Map;for(let s of i){let r=ts.end,a=s.type==="construct"?r:s.type==="demolish"?o:r||o;for(let l of s.elements)a?e.add(l):!r&&!o&&n.set(l,s.type)}for(let s of e)n.delete(s);return{hidden:e,active:n}}var FM=864e5,BM=["1","5","15"],OM={construct:"#22c55e",demolish:"#ef4444",temporary:"#a855f7"};function sm({root:i,shell:t,timeliner:e,elements:n,scene:s}){let r=nm(e,n);if(r.tasks.length===0)return t.registerPanel("timeliner",{icon:oe.timeliner,title:q("panel.timeliner"),visible:!1,render:()=>{}}),null;let o=new Intl.DateTimeFormat(void 0,{dateStyle:"short",timeZone:"UTC"}),a=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeZone:"UTC"}),l=r.start,c=1,h=0,d=0,u=!1,f=new Set,m=new Map,_=K("div","ioviewer-player ioviewer-floating");_.setAttribute("role","group"),_.setAttribute("aria-label",q("player.title")),_.hidden=!0;let g=tn("ioviewer-icon-button ioviewer-player-play",oe.play,q("player.play"));g.addEventListener("click",()=>h?N():L());let p=K("output","ioviewer-player-date"),y=K("input","ioviewer-player-slider");Object.assign(y,{type:"range",min:String(r.start),max:String(r.end),step:"any"}),y.setAttribute("aria-label",q("player.date")),y.addEventListener("input",()=>A(Number(y.value)));let w=$r(q("player.speed"),BM.map(D=>[D,`${D}\xD7`]),D=>{c=Number(D),w.update(D)});w.update(String(c));let M=tn("ioviewer-panel-close",oe.close,q("close"));M.addEventListener("click",E),_.append(g,p,y,w.element,M),i.append(_),new ResizeObserver(()=>{let D=_.hidden?0:_.offsetHeight+8;i.style.setProperty("--player-space",`${D}px`)}).observe(_);function S(){let D=im(r.tasks,l),F=[...f].filter(U=>!D.hidden.has(U)),H=[...D.hidden].filter(U=>!f.has(U));f=D.hidden;let V=[...m.keys()].filter(U=>D.active.get(U)!==m.get(U)),z=new Map;for(let[U,k]of D.active)m.get(U)!==k&&(z.has(k)||z.set(k,[]),z.get(k).push(U));m=D.active,F.length&&s.setLayerHidden("schedule",F,!1),H.length&&s.setLayerHidden("schedule",H,!0),V.length&&s.setTint(V,null);for(let[U,k]of z)s.setTint(k,OM[U])}function A(D){l=Math.min(Math.max(D,r.start),r.end),y.value=String(l),p.textContent=a.format(l),u&&S()}function v(){u||(u=!0,_.hidden=!1,A(r.start))}function E(){u&&(N(),u=!1,s.setTint([...m.keys()],null),m=new Map,f=new Set,s.clearLayer("schedule"),_.hidden=!0)}function R(D){A(l+Math.max(D-d,0)/1e3*c*FM),d=D,l>=r.end?N():h=requestAnimationFrame(R)}function L(){v(),!h&&(l>=r.end&&A(r.start),d=performance.now(),h=requestAnimationFrame(R),B())}function N(){cancelAnimationFrame(h),h=0,B()}function B(){let D=q(h?"player.pause":"player.play");g.innerHTML=h?oe.pause:oe.play,g.title=D,g.setAttribute("aria-label",D)}return t.registerPanel("timeliner",{icon:oe.timeliner,title:q("panel.timeliner"),render:D=>{let F=K("button","ioviewer-text-button ioviewer-player-open");F.type="button",F.insertAdjacentHTML("afterbegin",oe.play),F.append(K("span","",q("player.play"))),F.addEventListener("click",L);let H=K("div","ioviewer-row-list");for(let V of r.tasks){let z=String(V.name??""),U=K("div","ioviewer-row ioviewer-task");U.dataset.type=V.type,U.setAttribute("title",`${z} \xB7 ${q(`task.${V.type}`)}`);let k=`${o.format(V.start)} \u2013 ${o.format(V.end)}`;U.append(K("span","ioviewer-row-name",z),K("span","ioviewer-task-dates",k)),H.append(U)}D.append(F,H)}}),{open:v,close:E,play:L,pause:N,setDate:A,get date(){return l},get isOpen(){return u}}}function rm({shell:i,files:t,elements:e,scene:n}){let s=t.map(o=>({file:o,members:o.members??e.flatMap((a,l)=>a.link!=null&&(a.link===o.name||a.link===o.path)?[l]:[]),input:K("input")})),r=()=>n.replaceLayerHidden("links",s.flatMap(({input:o,members:a})=>o.checked?[]:a));return i.registerPanel("links",{icon:oe.links,title:q("panel.links"),visible:s.length>0,render:o=>{let a=K("div","ioviewer-row-list");for(let l of s){let c=String(l.file.name??""),h=K("label","ioviewer-row ioviewer-check ioviewer-link");h.setAttribute("title",`${c} (${l.file.path??""})`);let{input:d}=l;d.type="checkbox",d.checked=l.members.length===0||l.file.visible!==!1,d.disabled=l.members.length===0,d.addEventListener("change",r),h.append(d,K("span","ioviewer-row-name",c),K("span","ioviewer-row-count",String(l.members.length))),a.append(h)}o.append(a),r()}}),o=>{let a=new Set(o);for(let{file:l,input:c}of s)c.checked=c.disabled||!a.has(l.key);r()}}function om(i,t,e){let n=i.filter(Number.isFinite).sort((a,l)=>a-l),s=[];for(let a of n){let l=s.at(-1);!l||a-l.at(-1)>2/2?s.push([a]):l.push(a)}let r=[];for(let a of s){if(a.length<2)continue;let l=r.at(-1);l&&a[Math.floor(a.length/2)]-l[Math.floor(l.length/2)]<2?l.push(...a):r.push(a)}if(r.length<2)return[];let o=[Math.min(t,n[0])];for(let a=1;a({min:o[l],max:a}))}function am(i,t){return!i||t>=i.min&&t<=i.max}function lm(i,t,e,n){let s=Math.min(16,Math.max(.5,i.zoom*t)),r=1/i.zoom-1/s;return{...i,zoom:s,x:i.x+e*i.side*r,y:i.y-n*i.side*r}}function cm(){let i=new pn,t=new Ue(72,1,.15,20);t.up.set(0,0,1);let e=new C,n=new Ie({uniforms:{size:{value:1}},vertexShader:["attribute float intensity;","varying float signal;","uniform float size;","void main() {"," signal = intensity;"," gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);"," gl_PointSize = size;","}"].join(` +}`,side:t,stencilZPass:n,stencilWrite:!0,clipping:!0,clippingPlanes:[e],colorWrite:!1,depthTest:!1,depthWrite:!1});return s.index0AttributeName="q",s}var Ll=class{constructor(e,t,n,s){this.model=e,this.sections=t,this.data=n,this.drawStencils=s,this._farSide=new At,this._surface=new gt(new cn(1,1),new Jt({color:Ab,side:kt,forceSinglePass:!0,stencilWrite:!0,stencilFunc:Wc,stencilWriteMask:0}))}render(e,t,n){let{sections:s,model:r}=this,{planes:o,intersection:a}=s.clipping(),l=a?o.map(u=>u.clone().negate()):o,c=u=>Math.abs(u.distanceToPoint(s.center)){if(!c(f))return;let _=u?-f.normal.dot(u):f.distanceToPoint(n.position);if(_===0)return;if(this._farSide.copy(f),_>0&&this._farSide.negate(),e.clearStencil(),this.drawStencils)this.drawStencils(e,n,this._farSide);else for(let p of this._stencils)r.withMaterial(p,()=>e.render(r.root,n),{section:!0});this._surface.quaternion.setFromUnitVectors(Tb,f.normal);let g=Al(s.modelBox,this._surface.quaternion,f.coplanarPoint(new C));this._surface.position.copy(g.center),this._surface.scale.set(g.width,g.height,1),h.clippingPlanes=l.filter((p,y)=>y!==m),e.render(this._surface,n)}),e.render(t,n)}finally{e.autoClear=d}}};function Zr(i,e,t){let n=K("div","ioviewer-segmented");n.setAttribute("role","group"),n.setAttribute("aria-label",i);let s=e.map(([o,a])=>{let l=K("button","",a);return l.type="button",l.dataset.value=o,l.addEventListener("click",()=>t(o)),n.append(l),l});return{element:n,update:o=>s.forEach(a=>a.setAttribute("aria-pressed",String(a.dataset.value===o)))}}function iu(i,e){let t=K("label","ioviewer-check"),n=K("input");return n.type="checkbox",n.addEventListener("change",()=>e(n.checked)),t.append(n,K("span","",i)),{element:t,input:n}}function Ib(i,e){let t=K("li","ioviewer-section-plane");t.addEventListener("pointerdown",()=>i.active!==e&&i.setActivePlane(e));let n=K("span","ioviewer-section-name"),s=en("ioviewer-icon-button",ot.flip,X("sections.flip"));s.addEventListener("click",()=>i.updatePlane(e,{flipped:!i.planes[e].flipped}));let r=iu(X("sections.enabled"),h=>i.updatePlane(e,{enabled:h})),o=en("ioviewer-icon-button",ot.remove,X("sections.delete"));o.addEventListener("click",()=>i.removePlane(e));let a=K("input","ioviewer-section-slider");a.type="range",a.step="any",a.setAttribute("aria-label",X("sections.position")),a.addEventListener("input",()=>i.updatePlane(e,{offset:Number(a.value)}));let l=K("div","ioviewer-section-head");return l.append(n,s,r.element,o),t.append(l,a),{element:t,update:()=>{let h=i.planes[e],d=h.rotated?` (${X("sections.rotated")})`:"",u=h.axis==="custom"?X("sections.custom"):h.axis.toUpperCase();n.textContent=`${e+1}. ${u}${d}`,t.classList.toggle("active",i.active===e),s.setAttribute("aria-pressed",String(h.flipped)),r.input.checked=h.enabled;let f=i.extent(e);a.min=String(Math.min(-f,h.offset)),a.max=String(Math.max(f,h.offset)),a.value=String(h.offset)}}}function rm({root:i,shell:e,toolbar:t,contextMenu:n,sections:s,selection:r,canFill:o,hasMeshes:a=!0}){let l="z",c=()=>{s.addPlane(l)===null&&(s.setMode("planes"),qs(i,X("sections.maxPlanes")))},h=()=>[...r.values()],d=()=>s.fitBoxToElements(h()),u=Zr(X("sections.mode"),[["planes",X("sections.planes")],["box",X("sections.box")],["off",X("sections.off")]],F=>s.setMode(F)),f=Zr(X("sections.axis"),["x","y","z"].map(F=>[F,F.toUpperCase()]),F=>f.update(l=F));f.update(l);let m=K("button","ioviewer-text-button",X("sections.addPlane"));m.type="button",m.addEventListener("click",c);let _=K("ul","ioviewer-section-list"),g=K("div","ioviewer-section-empty",X("sections.noPlanes")),p=K("div","ioviewer-section-block"),y=K("div","ioviewer-section-row");y.append(K("span","",X("sections.axis")),f.element,m),p.append(y,_,g);let w=Zr(X("sections.box"),[["keepInside",X("sections.keepInside")],["cutInside",X("sections.cutInside")]],F=>s.setBoxMode(F)),b=K("button","ioviewer-text-button",X("sections.fitSelection"));b.type="button",b.addEventListener("click",d);let x=K("input","ioviewer-section-slider");Object.assign(x,{type:"range",min:"-180",max:"180",step:"1"}),x.addEventListener("input",()=>s.setBoxYaw(Number(x.value)*Math.PI/180));let S=K("span");S.setAttribute("aria-hidden","true");let A=K("label","ioviewer-section-row");A.append(K("span","",X("sections.boxYaw")),x,S);let v=K("div","ioviewer-section-block");v.append(w.element,A,b);let E=iu(X("sections.showGizmo"),F=>s.setGizmoVisible(F)),R=iu(X("sections.fill"),F=>s.setFill(F));o||(R.element.title=X(a?"sections.fillUnavailable":"sections.fillNeedsMeshes"));let L=[],N=()=>{u.update(s.mode),p.hidden=s.mode!=="planes",v.hidden=s.mode!=="box",m.disabled=s.planes.length>=$r,L.length!==s.planes.length&&(L=s.planes.map((H,V)=>Ib(s,V)),_.replaceChildren(...L.map(H=>H.element))),L.forEach(H=>H.update()),g.hidden=L.length>0,w.update(s.boxMode),x.value=String(Math.round(s.boxYaw*180/Math.PI)),S.textContent=`${x.value}\xB0`,x.setAttribute("aria-valuetext",S.textContent),E.input.checked=s.gizmoVisible,R.input.checked=s.fill;let F=s.mode==="box"||s.mode==="planes"&&s.planes.some(H=>H.enabled);R.input.disabled=!o||!F,t.setActive("plane",s.mode==="planes"),t.setActive("box",s.mode==="box")},B=()=>b.disabled=r.size===0;if(e.registerPanel("sections",{icon:ot.sections,title:X("panel.sections"),visible:!s.modelBox.isEmpty(),render:F=>F.append(u.element,p,v,R.element,E.element)}),s.addEventListener("change",N),r.addEventListener("change",B),N(),B(),s.modelBox.isEmpty())return;let D=()=>e.openPanel("sections");t.setHandler("plane",()=>{c(),D()}),t.setHandler("box",()=>{(s.mode==="box"||r.size&&d()||s.fitBoxToShown())&&D()}),t.setHandler("resetSections",()=>s.reset()),n.setItem("sectionBox",{handler:F=>{s.fitBoxToElements(r.has(F)?h():[F]),D()}}),n.setItem("resetSections",{handler:()=>s.reset()})}var Pb="#facc15",Lb=9;function su(i,e=un){return`${new Intl.NumberFormat(e,{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!1}).format(i)} ${X("unit.m",e)}`}var Dl=class extends EventTarget{constructor(e){super(),this.active=!1,this.points=[],this.preview=null,this.group=new Rt,this.group.name="measure";let t=new ht;t.setAttribute("position",new xt(new Float32Array(6),3));let n={color:Pb,depthTest:!1,depthWrite:!1,transparent:!0};this._line=new zi(t,new sn(n)),this._markers=new En(t,new Vn({...n,size:Lb,sizeAttenuation:!1}));for(let s of[this._line,this._markers])s.frustumCulled=!1,s.renderOrder=1001,this.group.add(s);this.label=K("div","ioviewer-measure-label"),this.label.hidden=!0,this._previewMarker=K("div","ioviewer-measure-preview"),this._previewMarker.hidden=!0,this._previewMarker.setAttribute("aria-hidden","true"),e.prepend(this.label,this._previewMarker),this._sync()}get distance(){return this.points.length===2?this.points[0].distanceTo(this.points[1]):null}get box(){return new at().setFromPoints(this.points)}setActive(e){this.active=!!e,this.active||(this.points=[],this.setPreview(null)),this._sync()}add(e){this.active&&(this.points=this.points.length===1?[this.points[0],e.clone()]:[e.clone()],this._sync())}clear(){return this.points.length===0?!1:(this.points=[],this._sync(),!0)}setPreview(e){!this.preview&&!e||(this.preview=e,this._previewMarker.hidden=!e,e&&(this._previewMarker.dataset.kind=e.kind),this.dispatchEvent(new Event("previewchange")))}update(e,t){this.preview&&Xr(this._previewMarker,this.preview.point,e,t),this.distance!==null&&Xr(this.label,this.points[0].clone().lerp(this.points[1],.5),e,t)}_sync(){let e=this._line.geometry.attributes.position;this.points.forEach((t,n)=>e.setXYZ(n,t.x,t.y,t.z)),e.needsUpdate=!0,this._line.geometry.setDrawRange(0,this.points.length),this._line.visible=this.points.length===2,this._markers.visible=this.points.length>0,this.label.hidden=this.distance===null,this.distance!==null&&(this.label.textContent=su(this.distance)),this.dispatchEvent(new Event("change"))}};var Kr=8,Db=1-1e-6,Nb=8,om={vertex:0,midpoint:1,edge:2},Ub=2e4;function Fb(i,e){let t=new Map,n=new Uint32Array(i.length/3);for(let d=0;d0&&(_.normalize(),l(u,f,_),l(f,m,_),l(m,u,_))}let c=[],h=new Set;for(let{lo:d,hi:u,count:f,crease:m}of s.values())f!==1&&!m||(c.push(d,u),h.add(d),h.add(u));return{edges:c,vertices:h}}function Nl(i,e,t){return e<0&&t<0?!1:(e<0&&(i[0]=Math.max(i[0],e/(e-t))),t<0&&(i[1]=Math.min(i[1],e/(e-t))),i[0]<=i[1])}function am(i,e,t,n,s,r){let o=[0,1];if(!Nl(o,t.w+t.z,n.w+n.z)||!Nl(o,t.w-t.z,n.w-n.z))return[];if(!r||!s.length)return s.every(c=>Nl(o,c.distanceToPoint(i),c.distanceToPoint(e)))?[o]:[];let a=o.slice();if(!s.every(c=>{let h=c.distanceToPoint(i),d=c.distanceToPoint(e);return(h<0||d<0)&&Nl(a,-h,-d)}))return[o];let l=[];return o[0]0))return null;let g=lt.clamp(((r-c)*f+(o-h)*m)/_,0,1);return t+(n-t)*(g*a.w/((1-g)*l.w+g*a.w))}var Ul=class{constructor(e,t,n){this.picker=e,this.sections=t,this.data=n,this.cache=new Map}release(){this.data.releaseBinary(),this.cache.clear()}_geometry(e){let t=this.cache.get(e);if(t)this.cache.delete(e);else{let n=this.data.meta.geometries[e],s=Hs({view:this.data.readView},n),r=this.data.readView(n.indices);if(n.kind==="lines"){let o=[],a=new Set,l=r.length-r.length%2;for(let c=0;cNb&&this.cache.delete(this.cache.keys().next().value),t}target(e,t){let n=this.picker.measureTile(e,t,Kr+1);if(!n)return null;if(n.pointSample)return{kind:"vertex",point:n.point.clone()};let{rect:s}=n,r=e-s.left,o=t-s.top,{camera:a,scene:l}=this.picker,{planes:c,intersection:h}=this.sections.clipping(),d=new Ke().multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),u=a.matrixWorldInverse.elements,f=null;function m(x,S,A,v){if(f&&om[x]>om[f.kind]||A.w<=0||A.z<-A.w||A.z>A.w)return;let[E,R]=Ys(A,s);if(!(E>=0&&R>=0&&EKr**2||f?.kind===x&&L>=f.distance||x!=="edge"&&El(S,c,h))return;let N=-(u[2]*S.x+u[6]*S.y+u[10]*S.z+u[14]);N-n.depthAt(E,R,v)>2*In+Math.abs(N)*2**-21||(f={kind:x,distance:L,point:S.clone()})}let _=Ub*3,g=new Ke,p=new C,y=new vt,{geometry:w,matrix:b}=this.data.meta.instances;for(let x of n.slots){let S=l.slotInstance(x),[A]=this.data.readView({t:"u32",o:w.o+S*4,n:1}),v=this.data.meta.geometries[A],E=Math.max(v.indices.n,v.positions.n/3);if(E>_)continue;_-=E;let{positions:R,vertices:L,edges:N}=this._geometry(A),B=this.data.readView({t:"f32",o:b.o+S*48,n:12});g.set(B[0],B[3],B[6],B[9],B[1],B[4],B[7],B[10],B[2],B[5],B[8],B[11],0,0,0,1);let D=new Map;for(let F of L){let H=new C().fromArray(R,F*3).applyMatrix4(g),V=new vt(H.x,H.y,H.z,1).applyMatrix4(d);D.set(F,[H,V]),m("vertex",H,V,x)}if(f?.kind!=="vertex")for(let F=0;F_)continue;_-=R;let{positions:L,vertices:N,edges:B}=this._geometry(v),D=this.data.readView({t:"f32",o:S.o+A*48,n:12});g.set(D[0],D[3],D[6],D[9],D[1],D[4],D[7],D[10],D[2],D[5],D[8],D[11],0,0,0,1);let F=new Map;for(let H of N){let V=new C().fromArray(L,H*3).applyMatrix4(g),z=new vt(V.x,V.y,V.z,1).applyMatrix4(d);if(F.set(H,[V,z]),z.w>0&&z.z>=-z.w&&z.z<=z.w){let[U,k]=Ys(z,s),Y=(U-r)**2+(k-o)**2;Y<=Kr**2&&(!f||f.kind!=="vertex"||Y0&&G.z>=-G.w&&G.z<=G.w){let[J,ie]=Ys(G,s),ne=(J-r)**2+(ie-o)**2;ne<=Kr**2&&(!f||f.kind!=="midpoint"||ner.element)),e.prepend(s),this._layer=s,this.setVisible(this.count>0)}get visible(){return this.group.visible}setVisible(e){this.group.visible=!!e,this._layer.hidden=!e,this.dispatchEvent(new Event("change"))}update(e,t){if(this.visible)for(let{element:n,point:s}of this._labels)Xr(n,s,e,t)}};var Bb=8,cm=4;function ru(i,e,t,n="dialog"){let s=K("div","ioviewer-popover ioviewer-floating");s.setAttribute("role",n),s.setAttribute("aria-label",t),s.hidden=!0,e.setAttribute("aria-haspopup",n),e.setAttribute("aria-expanded","false"),i.append(s);function r(l){s.contains(l.target)||(a(),pl(l))}s.addEventListener("keydown",l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),a(),e.focus())});function o(){s.hidden=!1,e.setAttribute("aria-expanded","true");let l=e.getBoundingClientRect(),{width:c}=s.getBoundingClientRect();s.style.left=`${Math.max(cm,Math.min(l.left+l.width/2-c/2,innerWidth-c-cm))}px`,s.style.bottom=`${innerHeight-l.top+Bb}px`,window.addEventListener("pointerdown",r,!0),window.addEventListener("resize",a)}function a(){return s.hidden?!1:(s.hidden=!0,e.setAttribute("aria-expanded","false"),window.removeEventListener("pointerdown",r,!0),window.removeEventListener("resize",a),!0)}return{element:s,close:a,toggle:()=>s.hidden?o():a(),get isOpen(){return!s.hidden}}}function Ob(i){return i?.initialWireframe?"wireframe":i?.initialWhiteMode?"white":"materials"}function hm({root:i,toolbar:e,scene:t,meta:n,grids:s,initialBackground:r,setBackground:o,hasMeshes:a=!0}){let l=L=>e.element.querySelector(`[data-tool="${L}"]`),c=l("displayMode"),h=ru(i,c,X("group.display"));h.element.classList.add("ioviewer-display-modes");let d=K("div");d.setAttribute("role","menu"),d.setAttribute("aria-label",X("tool.displayMode")),h.element.append(d);let u=(n.textures??[]).length>0,f=Nh.map(L=>{let N=K("button","ioviewer-menu-item",X(`display.${L}`));return N.type="button",N.dataset.mode=L,N.setAttribute("role","menuitemradio"),N.disabled=L==="textures"&&!u||L==="wireframe"&&!a,N.addEventListener("click",()=>{m(L),h.close(),c.focus()}),d.append(N),N}),m=L=>{t.setDisplayMode(L);for(let N of f)N.setAttribute("aria-checked",String(N.dataset.mode===L))},_=Ob(n.options);m(_==="wireframe"&&!a?"materials":_),e.setHandler("displayMode",()=>{h.toggle(),h.isOpen&&d.querySelector('[aria-checked="true"]')?.focus()});let g=K("div","ioviewer-background-setting"),p=K("label","",X("display.background")),y=K("input");Object.assign(y,{type:"color",value:r}),p.append(y);let w=K("button","ioviewer-text-button",X("display.backgroundReset"));w.type="button",w.disabled=!0;let b=()=>{o(y.value),w.disabled=y.value===r};y.addEventListener("input",b),w.addEventListener("click",()=>{y.value=r,y.focus(),b()});let x=K("div","ioviewer-bg-presets");for(let[L,N]of[["#14171c","display.bgCadDark"],["#ffffff","display.bgPaper"]]){let B=K("button","ioviewer-text-button",X(N));B.type="button",B.addEventListener("click",()=>{y.value=L,b()}),x.append(B)}g.append(p,x,w),h.element.append(g),e.setActive("grids",s.visible),s.count>0&&e.setHandler("grids",()=>{s.setVisible(!s.visible),e.setActive("grids",s.visible)});let S=ru(i,l("opacity"),X("tool.opacity"));S.element.classList.add("ioviewer-opacity");let A=K("input","ioviewer-opacity-slider");Object.assign(A,{type:"range",min:"10",max:"100",step:"1",value:"100"}),A.setAttribute("aria-label",X("opacity.label"));let v=K("output","ioviewer-opacity-value"),E=()=>v.textContent=X("opacity.value").replace("{value}",A.value);A.addEventListener("input",()=>{t.setOpacity(Number(A.value)/100),E()}),E();let R=K("div","ioviewer-opacity-head");return R.append(K("span","",X("opacity.label")),v),S.element.append(R,A),e.setHandler("opacity",S.toggle),[h,S]}var zb=3e3;function Bl(i,e){let t=K("button",i);return t.type="button",t.setAttribute("title",e),t.append(K("span","ioviewer-row-name",e)),t}function um({shell:i,toolbar:e,controls:t,scene:n,sections:s,selection:r,restoreLinkedModels:o,views:a,bcfTopics:l}){let c=null,h=K("button","ioviewer-text-button ioviewer-tour");h.type="button";function d(w){w.sections!=null&&s.restore(w.sections),w.hiddenElements!=null&&n.setHiddenElements(w.hiddenElements),w.visibleElements!=null&&n.isolate(w.visibleElements),w.hiddenModelKeys!=null&&o(w.hiddenModelKeys),w.selectedElements!=null&&r.set(w.selectedElements);let b=w.camera.projection==="orthographic";t.setProjection(b?"orthographic":"perspective"),e.setActive("projection",b),t.restoreViewCamera(w.camera)}function u(){d(a[c.next]),c.next=(c.next+1)%a.length;let w=()=>{t.animating?c.frame=requestAnimationFrame(w):c.timer=setTimeout(u,zb)};c.frame=requestAnimationFrame(w)}let f=w=>h.contains(w.target),m=w=>!f(w)&&g(),_=w=>{f(w)&&(w.key==="Enter"||w.key===" ")||(w.key==="Escape"&&(w.preventDefault(),w.stopPropagation()),g())};function g(){c&&(cancelAnimationFrame(c.frame),clearTimeout(c.timer),c=null,window.removeEventListener("pointerdown",m,!0),window.removeEventListener("wheel",g,!0),window.removeEventListener("keydown",_,!0),y())}function p(){c={next:0,frame:0,timer:0},window.addEventListener("pointerdown",m,!0),window.addEventListener("wheel",g,!0),window.addEventListener("keydown",_,!0),y(),u()}function y(){let w=X(c?"views.stop":"views.tour");h.replaceChildren(),h.insertAdjacentHTML("afterbegin",c?ot.pause:ot.play),h.append(K("span","",w)),h.setAttribute("aria-pressed",String(!!c))}h.addEventListener("click",()=>c?g():p()),y(),i.registerPanel("views",{icon:ot.views,title:X("panel.views"),visible:a.length>0,render:w=>{let b=K("div","ioviewer-row-list");for(let x of a){let S=Bl("ioviewer-row ioviewer-view",String(x.name??""));S.addEventListener("click",()=>d(x)),b.append(S)}w.append(h,b)}}),i.registerPanel("bcf",{icon:ot.bcf,title:X("panel.bcf"),visible:l.length>0,render:w=>{let b=K("div","ioviewer-row-list");for(let x of l){let S=K("details","ioviewer-bcf-topic");S.append(K("summary","",x.title)),x.status&&S.append(K("p","ioviewer-bcf-status",x.status)),x.description&&S.append(K("p","ioviewer-bcf-description",x.description)),x.viewpoints.length||S.append(K("p","ioviewer-bcf-status",X("bcf.noView"))),x.viewpoints.forEach((A,v)=>{let E=X("bcf.viewpoint").replace("{index}",String(v+1)),R=Bl("ioviewer-row ioviewer-view",E);if(R.addEventListener("click",()=>d(A)),S.append(R),A.missingComponents||A.ambiguousComponents){let L=X("bcf.components").replace("{missing}",String(A.missingComponents)).replace("{ambiguous}",String(A.ambiguousComponents));S.append(K("p","ioviewer-bcf-status",L))}}),b.append(S)}w.append(b)}})}function dm(i,e){let t=[];for(let[n,s]of[[i.element1Id,i.element1Name],[i.element2Id,i.element2Name]]){let r=n!=null?e.findIndex(o=>o.id!=null&&String(o.id)===String(n)&&!o.mesh):kb(e,s);r>=0&&!t.includes(r)&&t.push(r)}return t}function kb(i,e){if(e==null)return-1;let t=i.findIndex(n=>n.name===e);return t>=0&&i.findIndex((n,s)=>s>t&&n.name===e)<0?t:-1}var Hb=["New","Active","Reviewed","Approved","Resolved"],ou=27,Vb=8,Gb=14,Wb=2,Xb=new C(1,-1,.8).normalize();function fm({shell:i,tests:e,elements:t,scene:n,controls:s,selection:r}){let o=new Rt;o.name="clash-marker";let a=new ht;a.setAttribute("position",new xt(new Float32Array(3),3));let l={color:"#ef4444",depthTest:!1,depthWrite:!1,transparent:!0},c=new En(a,new Vn({...l,size:Gb,sizeAttenuation:!1}));c.frustumCulled=!1,c.renderOrder=1002,o.add(c),o.visible=!1;let h=null,d=null;function u(){o.visible=!1,h?.removeAttribute("aria-current"),h=null,d=null,s.setExtraBounds("clash",null)}function f(y,w){let b=dm(y,t);b.length?r.set(b):r.clear();let x=new C(...y.point),S=0;for(let E of b){let R=n.elementBox(E);R.isEmpty()||(S=Math.max(S,...R.getSize(new C).toArray()))}let A=s.camera.position.clone().sub(s.target);A.lengthSq()<1e-12&&A.copy(Xb);let v=Math.max(3*S,Wb);s.animateTo({position:A.normalize().multiplyScalar(v).add(x),target:x}),a.attributes.position.setXYZ(0,x.x,x.y,x.z),a.attributes.position.needsUpdate=!0,o.visible=!0,h?.removeAttribute("aria-current"),h=w,d=y,w.setAttribute("aria-current","true"),s.setExtraBounds("clash",new at(x.clone(),x.clone()))}function m(y){let w=Bl("ioviewer-row ioviewer-clash",String(y.name??""));w.setAttribute("title",`${y.name??""}: ${y.element1Name??""} \u2014 ${y.element2Name??""}`);let b=Hb.includes(y.status),x=K("span","ioviewer-clash-status",b?X(`clash.${y.status}`):String(y.status??""));b&&(x.dataset.status=y.status);let S=typeof y.distance=="number"?su(y.distance):"";return w.append(x,K("span","ioviewer-clash-distance",S)),y===d&&(h=w,w.setAttribute("aria-current","true")),w.addEventListener("click",()=>f(y,w)),w}function _(y,w){let b=K("div","ioviewer-clash-test"),x=K("button","ioviewer-row ioviewer-clash-header");x.type="button",x.setAttribute("aria-expanded","true");let S=`${y.name??""} (${y.clashes.length})`;x.setAttribute("title",S),x.insertAdjacentHTML("afterbegin",ot.chevron),x.append(K("span","ioviewer-row-name",S));let A=K("div","ioviewer-clash-list");return A.style.height=`${Math.max(0,y.clashes.length*ou-1)}px`,x.addEventListener("click",()=>{A.hidden=!A.hidden,x.setAttribute("aria-expanded",String(!A.hidden)),w()}),b.append(x,A),{box:b,list:A,clashes:y.clashes,rows:new Map}}function g({list:y,clashes:w,rows:b},{start:x,end:S}){for(let[v,E]of b)(v=S)&&(E.remove(),b.delete(v));let A=null;for(let v=S-1;v>=x;v--){let E=b.get(v);E||(E=m(w[v]),E.style.top=`${v*ou}px`,y.insertBefore(E,A),b.set(v,E)),A=E}}function p(y){if(!e.length)return;y.classList.add("ioviewer-clashes-body");let w=e.map(x=>_(x,b));for(let x of w)y.append(x.box);function b(){let x=y.scrollTop,S=y.clientHeight,A=w.map(({list:v,clashes:E})=>S&&!v.hidden?Xh(x-v.offsetTop,ou,S,E.length,Vb):{start:0,end:0});w.forEach((v,E)=>g(v,A[E]))}y.addEventListener("scroll",b),y.addEventListener("focusin",b),new ResizeObserver(b).observe(y)}return i.registerPanel("clashes",{icon:ot.clashes,title:X("panel.clashes"),visible:e.length>0,render:p,onClose:()=>o.visible&&u()}),{group:o}}var qb=["construct","demolish","temporary"],Yb=Date.parse("0002-01-01T00:00:00Z");function pm(i){let e=typeof i=="string"?Date.parse(i):NaN;return e>=Yb?e:NaN}function mm(i,e){let t=new Map(e.flatMap((o,a)=>o.mesh||o.id==null?[]:[[String(o.id),a]])),n=[];for(let o of Array.isArray(i?.tasks)?i.tasks:[]){let a=pm(o?.start),l=pm(o?.end);if(!(a<=l))continue;let c=qb.includes(o.type)?o.type:"construct",h=Array.isArray(o.attachedElements)?o.attachedElements:[];n.push({name:o.name,type:c,start:a,end:l,elements:h.map(d=>t.get(String(d))).filter(d=>d!==void 0)})}let s=n.reduce((o,a)=>Math.min(o,a.start),1/0),r=n.reduce((o,a)=>Math.max(o,a.end),-1/0);return{start:s,end:r,tasks:n}}function gm(i,e){let t=new Set,n=new Map;for(let s of i){let r=es.end,a=s.type==="construct"?r:s.type==="demolish"?o:r||o;for(let l of s.elements)a?t.add(l):!r&&!o&&n.set(l,s.type)}for(let s of t)n.delete(s);return{hidden:t,active:n}}var $b=864e5,Zb=["1","5","15"],Kb={construct:"#22c55e",demolish:"#ef4444",temporary:"#a855f7"};function _m({root:i,shell:e,timeliner:t,elements:n,scene:s}){let r=mm(t,n);if(r.tasks.length===0)return e.registerPanel("timeliner",{icon:ot.timeliner,title:X("panel.timeliner"),visible:!1,render:()=>{}}),null;let o=new Intl.DateTimeFormat(un,{dateStyle:"short",timeZone:"UTC"}),a=new Intl.DateTimeFormat(un,{dateStyle:"medium",timeZone:"UTC"}),l=r.start,c=1,h=0,d=0,u=!1,f=new Set,m=new Map,_=K("div","ioviewer-player ioviewer-floating");_.setAttribute("role","group"),_.setAttribute("aria-label",X("player.title")),_.hidden=!0;let g=en("ioviewer-icon-button ioviewer-player-play",ot.play,X("player.play"));g.addEventListener("click",()=>h?N():L());let p=K("output","ioviewer-player-date"),y=K("input","ioviewer-player-slider");Object.assign(y,{type:"range",min:String(r.start),max:String(r.end),step:"any"}),y.setAttribute("aria-label",X("player.date")),y.addEventListener("input",()=>A(Number(y.value)));let w=Zr(X("player.speed"),Zb.map(D=>[D,`${D}\xD7`]),D=>{c=Number(D),w.update(D)});w.update(String(c));let b=en("ioviewer-panel-close",ot.close,X("close"));b.addEventListener("click",E),_.append(g,p,y,w.element,b),i.append(_),new ResizeObserver(()=>{let D=_.hidden?0:_.offsetHeight+8;i.style.setProperty("--player-space",`${D}px`)}).observe(_);function S(){let D=gm(r.tasks,l),F=[...f].filter(U=>!D.hidden.has(U)),H=[...D.hidden].filter(U=>!f.has(U));f=D.hidden;let V=[...m.keys()].filter(U=>D.active.get(U)!==m.get(U)),z=new Map;for(let[U,k]of D.active)m.get(U)!==k&&(z.has(k)||z.set(k,[]),z.get(k).push(U));m=D.active,F.length&&s.setLayerHidden("schedule",F,!1),H.length&&s.setLayerHidden("schedule",H,!0),V.length&&s.setTint(V,null);for(let[U,k]of z)s.setTint(k,Kb[U])}function A(D){l=Math.min(Math.max(D,r.start),r.end),y.value=String(l),p.textContent=a.format(l),u&&S()}function v(){u||(u=!0,_.hidden=!1,A(r.start))}function E(){u&&(N(),u=!1,s.setTint([...m.keys()],null),m=new Map,f=new Set,s.clearLayer("schedule"),_.hidden=!0)}function R(D){A(l+Math.max(D-d,0)/1e3*c*$b),d=D,l>=r.end?N():h=requestAnimationFrame(R)}function L(){v(),!h&&(l>=r.end&&A(r.start),d=performance.now(),h=requestAnimationFrame(R),B())}function N(){cancelAnimationFrame(h),h=0,B()}function B(){let D=X(h?"player.pause":"player.play");g.innerHTML=h?ot.pause:ot.play,g.title=D,g.setAttribute("aria-label",D)}return e.registerPanel("timeliner",{icon:ot.timeliner,title:X("panel.timeliner"),render:D=>{let F=K("button","ioviewer-text-button ioviewer-player-open");F.type="button",F.insertAdjacentHTML("afterbegin",ot.play),F.append(K("span","",X("player.play"))),F.addEventListener("click",L);let H=K("div","ioviewer-row-list");for(let V of r.tasks){let z=String(V.name??""),U=K("div","ioviewer-row ioviewer-task");U.dataset.type=V.type,U.setAttribute("title",`${z} \xB7 ${X(`task.${V.type}`)}`);let k=`${o.format(V.start)} \u2013 ${o.format(V.end)}`;U.append(K("span","ioviewer-row-name",z),K("span","ioviewer-task-dates",k)),H.append(U)}D.append(F,H)}}),{open:v,close:E,play:L,pause:N,setDate:A,get date(){return l},get isOpen(){return u}}}function xm({shell:i,files:e,elements:t,scene:n}){let s=e.map(o=>({file:o,members:o.members??t.flatMap((a,l)=>a.link!=null&&(a.link===o.name||a.link===o.path)?[l]:[]),input:K("input")})),r=()=>n.replaceLayerHidden("links",s.flatMap(({input:o,members:a})=>o.checked?[]:a));return i.registerPanel("links",{icon:ot.links,title:X("panel.links"),visible:s.length>0,render:o=>{let a=K("div","ioviewer-row-list");for(let l of s){let c=String(l.file.name??""),h=K("label","ioviewer-row ioviewer-check ioviewer-link");h.setAttribute("title",`${c} (${l.file.path??""})`);let{input:d}=l;d.type="checkbox",d.checked=l.members.length===0||l.file.visible!==!1,d.disabled=l.members.length===0,d.addEventListener("change",r),h.append(d,K("span","ioviewer-row-name",c),K("span","ioviewer-row-count",String(l.members.length))),a.append(h)}o.append(a),r()}}),o=>{let a=new Set(o);for(let{file:l,input:c}of s)c.checked=c.disabled||!a.has(l.key);r()}}function vm(i,e,t){let n=i.filter(Number.isFinite).sort((a,l)=>a-l),s=[];for(let a of n){let l=s.at(-1);!l||a-l.at(-1)>2/2?s.push([a]):l.push(a)}let r=[];for(let a of s){if(a.length<2)continue;let l=r.at(-1);l&&a[Math.floor(a.length/2)]-l[Math.floor(l.length/2)]<2?l.push(...a):r.push(a)}if(r.length<2)return[];let o=[Math.min(e,n[0])];for(let a=1;a({min:o[l],max:a}))}function ym(i,e){return!i||e>=i.min&&e<=i.max}function bm(i,e,t,n){let s=Math.min(16,Math.max(.5,i.zoom*e)),r=1/i.zoom-1/s;return{...i,zoom:s,x:i.x+t*i.side*r,y:i.y-n*i.side*r}}function Mm(){let i=new mn,e=new Ut(72,1,.15,20);e.up.set(0,0,1);let t=new C,n=new It({uniforms:{size:{value:1}},vertexShader:["attribute float intensity;","varying float signal;","uniform float size;","void main() {"," signal = intensity;"," gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);"," gl_PointSize = size;","}"].join(` `),fragmentShader:["varying float signal;","void main() {"," vec2 offset = gl_PointCoord - 0.5;"," if (signal == 0.0 || dot(offset, offset) > 0.25) discard;"," gl_FragColor = vec4(vec3(0.12 + 0.88 * signal), 1.0);","}"].join(` -`)}),s=new Be(1,1,{depthTexture:new Gn(1,1)}),r=new qt,o=new pn,a=new Gi,l=new Ie({depthTest:!1,depthWrite:!1,uniforms:{levels:{value:s.texture},depth:{value:s.depthTexture},sampleStep:{value:new qt},range:{value:new qt}},vertexShader:["varying vec2 uvScreen;","void main() { uvScreen = uv; gl_Position = vec4(position, 1.0); }"].join(` +`)}),s=new Bt(1,1,{depthTexture:new Gn(1,1)}),r=new qe,o=new mn,a=new Gi,l=new It({depthTest:!1,depthWrite:!1,uniforms:{levels:{value:s.texture},depth:{value:s.depthTexture},sampleStep:{value:new qe},range:{value:new qe}},vertexShader:["varying vec2 uvScreen;","void main() { uvScreen = uv; gl_Position = vec4(position, 1.0); }"].join(` `),fragmentShader:["uniform sampler2D levels, depth;","uniform vec2 sampleStep, range;","varying vec2 uvScreen;","float distanceAt(float z) { return range.x * range.y / mix(range.y, range.x, z); }","void main() {"," float center = texture2D(depth, uvScreen).r;"," float anchor = center;"," if (center >= 1.0) {"," for (int y = -1; y <= 1; y++) for (int x = -1; x <= 1; x++)"," anchor = min(anchor, texture2D(depth, uvScreen + vec2(float(x), float(y)) * sampleStep).r);"," }"," float total = 0.0, weight = 0.0;"," if (anchor < 1.0) {"," float d = distanceAt(anchor);"," for (int y = -1; y <= 1; y++) for (int x = -1; x <= 1; x++) {"," vec2 p = uvScreen + vec2(float(x), float(y)) * sampleStep;"," float z = texture2D(depth, p).r;"," if (z >= 1.0 || abs(distanceAt(z) - d) > max(0.08, d * 0.015)) continue;"," float w = 1.0 / (1.0 + float(x * x + y * y));"," total += texture2D(levels, p).r * w;"," weight += w;"," }"," }"," gl_FragColor = vec4(weight > 0.0 ? vec3(total / weight) : vec3(0.063, 0.075, 0.094), 1.0);","}"].join(` -`)}),c=new ge(new cn(2,2),l);return c.frustumCulled=!1,o.add(c),{setScan(h,d){i.clear();for(let m of h){if(!m.geometry.getAttribute("intensity"))continue;let _=new wn(m.geometry,n);_.matrixAutoUpdate=!1,_.matrix.copy(m.matrixWorld),i.add(_)}t.position.copy(d);let u=new ae().setFromObject(i),f=u.getSize(e).length();t.far=Math.max(20,f+d.distanceTo(u.getCenter(e)))},draw(h,d,u){t.aspect=d.aspect,t.fov=d.fov,t.updateProjectionMatrix(),t.lookAt(e.copy(t.position).add(u));let f=h.getPixelRatio();n.uniforms.size.value=5.5*f,h.getDrawingBufferSize(r),s.setSize(r.x,r.y),l.uniforms.sampleStep.value.set(2*f/r.x,2*f/r.y),l.uniforms.range.value.set(t.near,t.far),h.setRenderTarget(s),h.render(i,t),h.setRenderTarget(null),h.render(o,a)}}}var zM=new Intl.NumberFormat(Pn,{maximumFractionDigits:2,minimumFractionDigits:2}),Bl=i=>`${zM.format(i)} ${q("scanMap.metres")}`;function Jn(i,t,e){let n=document.createElement("button");return n.type="button",n.textContent=t,n.title=i,n.setAttribute("aria-label",i),n.addEventListener("click",e),n}function kM(i,t){return[i*.005,t*.005]}function HM(i,t,e){return i.set(Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t),Math.sin(e))}function VM(i,t,e,n,s,r,o){let a=new qn;a.setFromCamera(new qt(n,s),i),a.ray.origin.copy(t),a.near=.05,a.params.Points.threshold=.12;let l=new C,c=new C;for(let h of a.intersectObjects(e,!1))if(l.fromBufferAttribute(h.object.geometry.attributes.position,h.index).applyMatrix4(h.object.matrixWorld),c.copy(l).sub(t).project(i),Math.hypot((c.x-n)*r/2,(c.y-s)*o/2)<=14)return l.z}function hm(i,t,e,n,s,r){if(!e.count)return;let o=new ae().setFromObject(e.root);if(o.isEmpty())return;let a=o.getSize(new C),l=o.getCenter(new C),c={x:l.x,y:l.y,side:Math.max(a.x,a.y,.01)*1.12,zoom:1},h={...c},d=P=>50+100*(P-h.x)*h.zoom/h.side,u=P=>50-100*(P-h.y)*h.zoom/h.side,f=P=>Math.min(96,Math.max(4,P)),m=(P,ft,Tt=!1)=>{let I=d(ft.x),b=u(ft.y);return P.style.left=`${Tt?f(I):I}%`,P.style.top=`${Tt?f(b):b}%`,I>=0&&I<=100&&b>=0&&b<=100},_=t.meta.rtcOffset?.[2]??0,g=t.meta.panoramas??[],p=g.map(P=>new C(...P.position)),y=`ioviewer.scan-levels.v1:${location.pathname}`,w=()=>om(p.map(P=>P.z+_),o.min.z+_,o.max.z+_),M=null;try{let P=JSON.parse(localStorage.getItem(y));Array.isArray(P)&&(M=P.filter(ft=>Number.isFinite(ft?.min)&&Number.isFinite(ft.max)&&ft.max>ft.min))}catch{M=null}let x=M??w(),S=-1,A=!0,v=P=>am(x[S],P+_),E=document.createElement("details");E.className="ioviewer-floating ioviewer-scan-map",E.open=!matchMedia("(max-width: 600px)").matches;let R=document.createElement("summary");R.textContent=q("scanMap.title");let L=document.createElement("div");L.className="scan-map-plot";let N=document.createElement("canvas");N.width=N.height=300,N.setAttribute("role","img"),N.setAttribute("aria-label",q("scanMap.plan")),N.tabIndex=0;let B=document.createElement("span");B.className="scan-map-camera",B.setAttribute("aria-hidden","true");let D=document.createElement("span");D.className="scan-map-axes",D.textContent="Y \u2191";let F=document.createElement("span");F.className="scan-map-scale",L.append(N,B,D,F),E.append(R,L),i.append(E);let H=e.root.children.reduce((P,ft)=>P+ft.geometry.attributes.position.count,0),V=Math.max(1,Math.ceil(H/6e4)),z=e.root.children.map(P=>{let ft=P.geometry.attributes.position,Tt=new Float32Array(Math.ceil(ft.count/V)*3),I=new C;for(let b=0,Z=0;b{if(U=0,!E.open)return;let P=N.getContext("2d");if(!P)return;P.clearRect(0,0,300,300),P.fillStyle="rgba(160, 185, 201, .33)";for(let[I,b]of z.entries())if(e.root.children[I].visible)for(let Z=0;Z{U||(U=requestAnimationFrame(k))},G=new C,J=null,it=()=>{if(J){B.hidden=!v(J.position.z),m(B,J.position,!0),B.style.rotate=`${Math.PI/2-J.yaw}rad`;return}B.hidden=!1,m(B,s.camera.position,!0),s.camera.getWorldDirection(G),B.style.rotate=`${Math.atan2(G.x,G.y)}rad`};E.addEventListener("toggle",Y),n.root.addEventListener("change",P=>{P.detail.kind==="visibility"&&Y()}),s.addEventListener("change",it);let nt=document.createElement("div");nt.className="scan-map-controls";let at=document.createElement("select");at.setAttribute("aria-label",q("scanMap.size"));for(let P of["small","medium","large"])at.add(new Option(q(`scanMap.${P}`),P));at.value=matchMedia("(max-width: 600px)").matches?"small":"medium",i.dataset.scanMapSize=at.value,at.addEventListener("change",()=>{i.dataset.scanMapSize=at.value});let O=(P,ft=0,Tt=0)=>{h=lm(h,P,ft,Tt),Y()},$=()=>{h={...c},Y()};nt.append(at,Jn(q("scanMap.zoomOut"),"\u2212",()=>O(.8)),Jn(q("scanMap.zoomIn"),"+",()=>O(1.25)),Jn(q("scanMap.reset"),"\u21BA",$)),E.insertBefore(nt,L),N.addEventListener("wheel",P=>{P.preventDefault();let ft=N.getBoundingClientRect();O(P.deltaY<0?1.15:1/1.15,(P.clientX-ft.left)/ft.width-.5,(P.clientY-ft.top)/ft.height-.5)},{passive:!1});let rt;N.addEventListener("pointerdown",P=>{P.button!==0||rt||(N.setPointerCapture(P.pointerId),rt={id:P.pointerId,x:P.clientX,y:P.clientY})}),N.addEventListener("pointermove",P=>{if(rt?.id!==P.pointerId)return;let ft=h.side/(h.zoom*Math.max(1,N.clientWidth));h.x-=(P.clientX-rt.x)*ft,h.y+=(P.clientY-rt.y)*ft,rt.x=P.clientX,rt.y=P.clientY,Y()}),N.addEventListener("lostpointercapture",P=>{P.pointerId===rt?.id&&(rt=void 0)}),N.addEventListener("keydown",P=>{let ft={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,1],ArrowDown:[0,-1]}[P.key];if(ft){let Tt=h.side/h.zoom/10;h.x+=ft[0]*Tt,h.y+=ft[1]*Tt,Y()}else if(P.key==="+"||P.key==="="||P.key==="-")O(P.key==="-"?.8:1.25);else if(P.key==="0")$();else return;P.preventDefault(),P.stopPropagation()});let mt=document.createElement("div");mt.className="scan-map-controls";let ht=document.createElement("select");ht.setAttribute("aria-label",q("scanMap.levels"));let Et=document.createElement("p");Et.className="scan-map-feedback",Et.setAttribute("role","status");function Zt(){try{localStorage.setItem(y,JSON.stringify(x))}catch{Et.textContent=q("scanMap.levelTemporary")}}function Ct(){ht.replaceChildren(new Option(q("scanMap.allLevels"),"-1")),x.forEach((P,ft)=>ht.add(new Option(`${q("scanMap.level").replace("{n}",ft+1)} \xB7 ${Bl(P.min)} \u2013 ${Bl(P.max)}`,String(ft)))),ht.value=String(S),dt.disabled=S<0;for(let[P,ft]of p.entries())Gt.options[P+1].hidden=!v(ft.z);Y(),r()}ht.addEventListener("change",()=>{S=Number(ht.value),Et.textContent="",Ct()});let Yt=Jn(q("scanMap.addLevel"),"+",()=>{if(Nt.isClosed()){let P=p.findIndex(ft=>v(ft.z));Ut(Math.max(0,P))}Nt.pickLevel()});Yt.disabled=!g.length;let Ht=Jn(q("scanMap.autoLevels"),q("scanMap.autoButton"),()=>{let P=w(),ft=P.filter(Tt=>!x.some(I=>I.min{S<0||(x.splice(S,1),S=-1,Et.textContent="",Zt(),Ct())});if(mt.append(ht,Yt,Ht,dt),g.length){let P=Jn(q("scanMap.spheres"),"\u25C9",()=>{A=!A,P.setAttribute("aria-pressed",String(A)),r()});P.setAttribute("aria-pressed","true"),mt.append(P)}E.append(mt,Et);let Nt=g.length?GM(i,t,e,Ut,P=>{J=P,P||pt.forEach(ft=>ft.classList.remove("current")),it()},P=>{S=x.push(P)-1,Et.textContent=q("scanMap.levelAdded"),Zt(),Ct()}):null,Gt=document.createElement("select");Gt.setAttribute("aria-label",q("scanMap.choosePhoto"));let ne=new Option(q("scanMap.choosePhoto"),"");ne.disabled=!0,Gt.add(ne);let pt=[];for(let[P,ft]of g.entries()){let Tt=ft.name||t.meta.elements[ft.element].name||String(P+1);Gt.add(new Option(Tt,String(P)));let I=document.createElement("button");I.type="button",I.className="scan-map-station",I.title=Tt,I.setAttribute("aria-label",`${q("scanMap.photo")} \xB7 ${Tt}`),I.addEventListener("click",()=>Ut(P)),pt.push(I),L.append(I)}Gt.value="",Gt.addEventListener("change",()=>Ut(Number(Gt.value))),Gt.hidden=!g.length,E.append(Gt),Ct(),!M&&x.length&&Zt();function Ut(P,ft=!1){E.open=!0,Gt.value=String(P),pt.forEach((Tt,I)=>Tt.classList.toggle("current",P===I)),Nt.open(P,ft),Gt.value=""}return{open:Ut,showSphere:(P,ft)=>A&&v(ft)&&n.isVisible(P)}}function GM(i,t,e,n,s,r){let o=document.createElement("section");o.className="ioviewer-floating scan-photo",o.setAttribute("aria-label",q("scanMap.photo")),o.hidden=!0;let a=document.createElement("header"),l=document.createElement("span"),c=document.createElement("div");c.className="scan-photo-actions";let h=Jn(q("scanMap.enlargePhoto"),q("scanMap.enlargePhoto"),()=>{let pt=o.classList.toggle("is-expanded"),Ut=q(pt?"scanMap.shrinkPhoto":"scanMap.enlargePhoto");h.textContent=h.title=Ut,h.setAttribute("aria-label",Ut),h.setAttribute("aria-pressed",String(pt))});h.setAttribute("aria-pressed","false");let d=document.createElement("button");d.type="button",d.textContent=q("close"),d.addEventListener("click",Ct);let u=!1,f=Jn(q("scanMap.intensity"),q("scanMap.intensity"),()=>{u=!u,ne(!1)});f.className="scan-photo-intensity",f.hidden=!0,c.append(f,h,d),a.append(l,c);let m=document.createElement("canvas");m.tabIndex=0,m.setAttribute("aria-label",q("scanMap.photoControls"));let _=document.createElement("p");_.setAttribute("role","status");let g=document.createElement("div");g.className="scan-photo-view";let p=document.createElement("span");p.className="scan-photo-crosshair",p.setAttribute("aria-hidden","true");let y=document.createElement("div");y.className="scan-photo-level",y.hidden=!0;let w=document.createElement("span");w.setAttribute("role","status"),y.append(w,Jn(q("scanMap.cancel"),q("scanMap.cancel"),Ht)),g.append(m,p,_),o.append(a,y,g),i.append(o);let M=t.meta.panoramas.map((pt,Ut)=>{let P=pt.name||t.meta.elements[pt.element].name||String(Ut+1),ft=document.createElement("button");return ft.className="scan-photo-link",ft.type="button",ft.title=P,ft.setAttribute("aria-label",q("scanMap.goToStation").replace("{name}",P)),ft.hidden=!0,ft.addEventListener("click",()=>n(Ut,!0)),g.append(ft),{photo:pt,name:P,button:ft,position:new C(...pt.position)}}),x=t.readView(t.meta.points.element),S=new qn;S.params.Points.threshold=.12,S.near=.25;let A=new C,v=new C,E=new C,R=[],L=[],N=!1,B,D=t.meta.rtcOffset?.[2]??0,F,H,V,z=0,U=!1,k=!1,Y=0,G=0,J=null,it,nt,at=new pn,O=new Ue(72,1,.1,20);O.up.set(0,0,1);let $=new Wn(10,56,28);$.rotateX(Math.PI/2);let rt=new Je({side:ze}),mt=new ge($,rt);at.add(mt);let ht=()=>{if(!(o.hidden||!H&&!k)){F.setSize(m.clientWidth,m.clientHeight,!1),O.aspect=m.clientWidth/Math.max(1,m.clientHeight),O.updateProjectionMatrix(),O.lookAt(HM(A,Y,G)),k?V.draw(F,O,A):F.render(at,O),O.getWorldDirection(A);for(let pt of R){if(N){pt.button.hidden=!0;continue}E.copy(pt.position).sub(it.position).normalize(),v.copy(E).project(O);let Ut=E.dot(A)>0&&Math.abs(v.x)<.92&&Math.abs(v.y)<.88;pt.button.hidden=!Ut,Ut&&(pt.button.style.left=`${(1+v.x)*50}%`,pt.button.style.top=`${(1-v.y)*50}%`)}s({position:it.position,yaw:Y})}},Et=(pt,Ut)=>{Y+=pt,G=le.clamp(G+Ut,-1.55,1.55),ht()};new ResizeObserver(ht).observe(m),m.addEventListener("pointerdown",pt=>{pt.button!==0||J||(m.setPointerCapture(pt.pointerId),J={id:pt.pointerId,x:pt.clientX,y:pt.clientY,moved:!1})}),m.addEventListener("pointermove",pt=>{J?.id===pt.pointerId&&(N&&!J.moved&&Math.hypot(pt.clientX-J.x,pt.clientY-J.y)<5||(J.moved=!0,Et(...kM(pt.clientX-J.x,pt.clientY-J.y)),J.x=pt.clientX,J.y=pt.clientY))}),m.addEventListener("pointerup",pt=>{if(J?.id!==pt.pointerId||J.moved||!N)return;let Ut=m.getBoundingClientRect();Nt((pt.clientX-Ut.left)*2/Ut.width-1,1-(pt.clientY-Ut.top)*2/Ut.height)}),m.addEventListener("lostpointercapture",pt=>{J?.id===pt.pointerId&&(J=null)}),m.addEventListener("keydown",pt=>{if(N&&pt.key==="Enter"){pt.preventDefault(),Nt(0,0);return}let Ut={ArrowLeft:[.12,0],ArrowRight:[-.12,0],ArrowUp:[0,.12],ArrowDown:[0,-.12]}[pt.key];Ut&&(pt.preventDefault(),pt.stopPropagation(),Et(...Ut))}),m.addEventListener("wheel",pt=>{pt.preventDefault(),O.fov=le.clamp(O.fov+Math.sign(pt.deltaY)*5,32,95),ht()},{passive:!1}),o.addEventListener("keydown",pt=>{pt.key==="Escape"&&(N?Ht():Ct()),pt.stopPropagation()});function Ct(){o.hidden=!0,Ht(),z++,J=null,Yt(),s(null),nt?.focus()}function Yt(){k=!1,H?.dispose(),H=void 0,rt.map=null;for(let pt of R)pt.button.hidden=!0;R=[]}function Ht(){N=!1,B=void 0,o.classList.remove("is-picking"),y.hidden=!0,ht()}function dt(){N=!0,B=void 0,o.classList.add("is-picking"),w.textContent=q("scanMap.pickLower"),y.hidden=!1,ht(),(H||k)&&m.focus()}function Nt(pt,Ut){if(!H&&!k)return;let P=VM(O,it.position,L,pt,Ut,m.clientWidth,m.clientHeight);if(P===void 0){w.textContent=q(B===void 0?"scanMap.noLowerHit":"scanMap.noUpperHit");return}let ft=P+D;B===void 0?(B=ft,w.textContent=q("scanMap.pickUpper").replace("{z}",Bl(ft))):ft<=B?w.textContent=q("scanMap.upperAboveLower").replace("{z}",Bl(B)):(r({min:B,max:ft}),Ht())}function Gt(pt,Ut){let P=o.hidden;if(P&&(nt=document.activeElement),Yt(),it=M[pt],o.hidden=!1,l.textContent=it.name,mt.rotation.z=le.degToRad(it.photo.yaw),L=e.root.children.filter((ft,Tt)=>x[Tt]===it.photo.element),U=L.some(ft=>ft.geometry.getAttribute("intensity")),f.hidden=!U&&!it.photo.intensity,R=M.filter(ft=>{if(ft===it)return!1;let Tt=E.copy(ft.position).sub(it.position).length();return Tt<=.25?!1:(S.set(it.position,E.multiplyScalar(1/Tt)),S.far=Tt-.25,!S.intersectObjects(L,!1).length)}),P||!Ut){let ft=R.reduce((Tt,I)=>!Tt||I.position.distanceToSquared(it.position){Ut===z&&(_.textContent=q("scanMap.photoError"))},Tt;try{if(F??(F=new Ti({canvas:m,antialias:!0})),F.setPixelRatio(Math.min(devicePixelRatio,2)),P&&U){V??(V=cm()),V.setScan(L,it.position),k=!0,_.textContent="",m.style.visibility="visible",ht(),pt&&m.focus();return}let I=P?it.photo.intensity:it.photo.image;Tt=URL.createObjectURL(new Blob([t.readView(I)],{type:"image/jpeg"}))}catch{ft();return}new mr().load(Tt,I=>{if(URL.revokeObjectURL(Tt),Ut!==z||I.image.width!==2*I.image.height){I.dispose(),ft();return}H?.dispose(),H=I,H.colorSpace=me,rt.map=H,rt.needsUpdate=!0,_.textContent="",m.style.visibility="visible",ht(),pt&&m.focus()},void 0,()=>{URL.revokeObjectURL(Tt),ft()})}return{open:Gt,pickLevel:dt,isClosed:()=>o.hidden}}var Ys=7;function um(i){if(!i?.length)return null;let t=i.map(({position:l})=>new C(...l)),e=new fr({color:"#72bfff",depthTest:!1,depthWrite:!1}),n=new xi(new Wn(1,12,8),e,i.length);n.count=0,n.frustumCulled=!1,n.renderOrder=10,n.instanceMatrix.setUsage(Pr);let s=[],r=new Kt,o=new C,a=new qt;return{mesh:n,update(l,c,h){if(n.count=0,s.length=0,!(c.width<=0||c.height<=0)){for(let[d,u]of t.entries()){if(!h(i[d].element,u.z))continue;let f=-o.copy(u).applyMatrix4(l.matrixWorldInverse).z;if(f<=l.near||f>=l.far||(o.copy(u).project(l),!Number.isFinite(o.x)||!Number.isFinite(o.y)))continue;let m=(o.x+1)*c.width/2,_=(1-o.y)*c.height/2;if(m<-Ys||m>c.width+Ys||_<-Ys||_>c.height+Ys)continue;let g=l.isOrthographicCamera?(l.top-l.bottom)/l.zoom:l.getViewSize(f,a).y,p=Ys*g/c.height;n.setMatrixAt(n.count++,r.makeScale(p,p,p).setPosition(u)),s.push({index:d,depth:f,x:m+c.left,y:_+c.top})}n.instanceMatrix.needsUpdate=n.count>0}},pick(l,c){let h;for(let d of s)(!h||d.depth0))return n;let s=[];for(let r of n){let o="";for(let a of r.match(/\s*\S+|\s+$/gu)??[]){let l=o+a;if(e.measureText(l).width<=t){o=l;continue}if(o&&(s.push(o),a=a.trimStart()),o=a,!(e.measureText(a).width<=t)){o="";for(let c of a)o&&e.measureText(o+c).width>t&&(s.push(o),o=""),o+=c}}s.push(o)}return s}function YM(i,t){let e=i.width/i.height*su,n=qM(i.text,e,t),s=le.clamp(Math.trunc(i.attachment||1),1,9)-1,r=s%3,o=Math.floor(s/3),a=0;for(let _ of n)a=Math.max(a,t.measureText(_).width/su*i.height);let l=n.length*fm*i.height,c=-a*r/2,h=l*o/2,d=new ae,u=new C,f=Math.cos(i.rotation),m=Math.sin(i.rotation);for(let _ of[c,c+a])for(let g of[h-l,h])u.set(i.position[0]+_*f-g*m,i.position[1]+_*m+g*f,i.position[2]),d.expandByPoint(u);return{lines:n,box:d,hAlign:r,vAlign:o}}var Ol=class{constructor(t,e){this.annotations=e.meta.annotations??[],this.lightBackground=!1,this.canvas=document.createElement("canvas"),this.canvas.className="ioviewer-annotations",this.canvas.setAttribute("aria-hidden","true"),this.annotations.length===0&&(this.canvas.hidden=!0),t.append(this.canvas),this._ctx=this.canvas.getContext("2d"),this._ctx&&(this._ctx.font=`${su}px ${dm}`),this.layouts=this._ctx?this.annotations.map(n=>YM(n,this._ctx)):[],this._p=new C,this._x=new C}setLightBackground(t){this.lightBackground=!!t}update(t,e,n){if(!this.annotations.length||!this._ctx||e.width<1||e.height<1)return;let s=window.devicePixelRatio||1,r=Math.round(e.width*s),o=Math.round(e.height*s);(this.canvas.width!==r||this.canvas.height!==o)&&(this.canvas.width=r,this.canvas.height=o);let a=this._ctx;a.setTransform(s,0,0,s,0,0),a.clearRect(0,0,e.width,e.height);let l=new Kt().multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),c=t.matrixWorldInverse,h=t.isOrthographicCamera?e.height*t.zoom/Math.max(t.top-t.bottom,1e-9):0,d=t.isPerspectiveCamera?Math.tan(le.degToRad(t.fov/2)):0;for(let u=0;u=-t.near)continue;let y=h||e.height/(2*Math.max(-p.z,1e-6)*d),w=f.height*y;if(!Number.isFinite(w)||w<1.5)continue;let M=this._p.clone().applyMatrix4(l);if(M.z<-1||M.z>1)continue;let x=(M.x*.5+.5)*e.width,S=(-M.y*.5+.5)*e.height;if(x<-400||x>e.width+400||S<-400||S>e.height+400)continue;this._x.set(f.position[0]+Math.cos(f.rotation),f.position[1]+Math.sin(f.rotation),f.position[2]).applyMatrix4(l);let A=(this._x.x*.5+.5)*e.width,v=(-this._x.y*.5+.5)*e.height,E=Math.atan2(v-S,A-x),[R,L,N]=f.color?[Math.round(f.color[0]*255),Math.round(f.color[1]*255),Math.round(f.color[2]*255)]:this.lightBackground?[17,24,39]:[229,231,235];this.lightBackground&&R>230&&L>230&&N>230?[R,L,N]=[17,24,39]:!this.lightBackground&&R<20&&L<20&&N<20&&([R,L,N]=[241,245,249]),a.save(),a.translate(x,S),Math.abs(E)>1e-4&&a.rotate(E),a.font=`${w.toFixed(2)}px ${dm}`,a.fillStyle=`rgb(${R},${L},${N})`,a.textAlign=WM[_],a.textBaseline=XM[g];let B=w*fm,D=-(m.length-1)*B*g/2;for(let F=0;F{}};let l=new Set(a.flatMap(_=>_.elements)),c=K("div","ioviewer-sheets ioviewer-floating");c.setAttribute("role","tablist"),c.setAttribute("aria-label",q("sheets.label"));let h=new ki(new he,new sn({color:"#94a3b8",transparent:!0,opacity:.55}));h.visible=!1,t.add(h);let d=null,u=new Map;function f(_,g=!1){let p=a.find(x=>x.key===_)??a[0];if(!p)return;d=p;for(let[x,S]of u){let A=x===p.key;S.classList.toggle("active",A),S.setAttribute("aria-selected",String(A))}let y=new Set(p.elements),w=[];for(let x of l)y.has(x)||w.push(x);if(n.setAnnotationSheet(p.key),n.replaceLayerHidden("sheet",w),!p.isModel&&p.paperBounds){let{min:x,max:S}=p.paperBounds,A=x[2];h.geometry.setFromPoints([new C(x[0],x[1],A),new C(S[0],x[1],A),new C(S[0],S[1],A),new C(x[0],S[1],A)]),h.visible=!0}else h.visible=!1;p.background&&r(p.background,!g);let M=n.visibleBox();!p.isModel&&p.paperBounds&&(M.expandByPoint(new C(...p.paperBounds.min)),M.expandByPoint(new C(...p.paperBounds.max))),s(!!p.is2D,M,!1),o()}for(let _ of a){let g=K("button","ioviewer-sheet-tab",_.name);g.type="button",g.setAttribute("role","tab"),g.dataset.sheet=_.key,g.addEventListener("click",()=>f(_.key,!1)),u.set(_.key,g),c.append(g)}a.length>1&&i.append(c);let m=e.options?.initialSheet??a[0].key;return f(m,!0),{get active(){return d},setSheet:_=>f(_,!1)}}document.documentElement.lang=Pn;var Dn=document.getElementById("ioviewer-canvas"),ru=window.IOVIEWER_TEST??{},Kr=ru.startup;function Jr(i){let t=document.getElementById("ioviewer-message");t.textContent=i,t.hidden=!1}try{let i=xh(document,Kr);i.title&&(document.title=i.title);let t=Dn.getContext("webgl2",{antialias:!0,stencil:!0});t?$M(vf(document,Kr,i),t):Jr(q("noWebGL"))}catch(i){if(!(i instanceof ee))throw i;Jr(q("badData"))}function $M(i,t){let e=new Ti({canvas:Dn,context:t,antialias:!0,stencil:!0,logarithmicDepthBuffer:tp(i.meta)});e.setPixelRatio(window.devicePixelRatio),e.autoClearStencil=!1,e.localClippingEnabled=!0;let n=new pn,s=i.meta.options?.initialBackground||"#1f2228",r=new Vt(s);e.setClearColor(r,1);let o=new _r("#ffffff","#8a8f99",1.6);o.position.set(0,0,1),n.add(o);let a=new Ue(45,1,.1,1e3);a.up.set(0,0,1),a.position.set(1,-1,.8);let l=new xr("#ffffff",1.4);l.position.set(.3,.6,0),a.add(l,l.target),l.target.position.set(0,0,-1),n.add(a);let c=!1,h=document.getElementById("ioviewer-ui"),d=new Ol(h,i),u=d.layouts;Kr?.("sceneStart");let f=L(),m=new ll(i),_=new cl(i);Kr?.("sceneEnd"),i.releaseBinary(),!c&&f.totalCost===0&&m.count===0&&_.count===0&&!u.length&&Jr(q("noGeometry"));let g=new xl(f,V,Math.min(f.totalCost,2e7));n.add(f.root),n.add(m.root),n.add(_.root);let p=m.count?um(i.meta.panoramas):null;p&&n.add(p.mesh);let y=()=>f.visibleBox(),w=new Al(f,y(),i.meta.sections);m.syncVisibility(f),m.syncAppearance(f),_.syncVisibility(f),_.syncAppearance(f);let M=()=>{let{planes:dt,intersection:Nt}=w.clipping();m.setClipping(dt,Nt),_.setClipping(dt,Nt)};M();let x=f.slotCount>0,S=x&&t.getContextAttributes()?.stencil===!0,A,v=new Il(w,Dn);n.add(v.group);let E=new Ll(h),R=new Ul(h,i.meta.grids??[]);n.add(E.group,R.group);function L(){try{return new Gr(i,{...ru,maxTextureSize:e.capabilities.maxTextureSize,annotationLayouts:u})}catch(dt){if(!(dt instanceof Vr))throw dt;c=!0,Jr(q("tooLarge").replace("{count}",dt.count).replace("{limit}",dt.limit));let Nt=ne=>({o:0,n:0,t:ne}),Gt={count:0,geometry:Nt("u32"),material:Nt("u32"),element:Nt("i32"),matrix:Nt("f32")};return new Gr({...i,meta:{...i.meta,instances:Gt}},{annotationLayouts:u})}}let N=!1;Dn.addEventListener("webglcontextlost",()=>{N=!0,Jr(q("contextLost"))});let B,D=new Promise(dt=>B=dt),F=Kr,H=!1;function V(){H||N||(H=!0,g.requested(performance.now()),requestAnimationFrame(()=>{if(H=!1,N)return;let dt=Dn.getBoundingClientRect();nt.camera.updateMatrixWorld(),Yt&&p?.update(nt.camera,dt,Yt.showSphere),v.update(nt.camera),E.update(nt.camera,dt),R.update(nt.camera,dt),d.update(nt.camera,dt,f),g.begin(nt.camera,dt.height,performance.now()),F?.("renderStart"),w.fill&&S?(A??(A=new Pl(f,w,i)),A.render(e,n,nt.camera)):e.render(n,nt.camera),F&&(F("renderEnd"),F=void 0),g.end(performance.now()),at.update(),B()}))}f.root.addEventListener("change",V),w.addEventListener("change",()=>{M(),V()}),v.addEventListener("change",V),E.addEventListener("change",V),E.addEventListener("previewchange",V),R.addEventListener("change",V);let z=new gl(e,f,a,{points:m,lines:_,pickFloat:ru.pickFloat}),U=new Nl(z,w,i),k=0,Y=null;function G(){cancelAnimationFrame(k),k=0,Y=null,E.setPreview(null)}function J(){k=0,Y&&E.setPreview(U.target(...Y))}function it(){Y&&(E.setPreview(null),cancelAnimationFrame(k),k=requestAnimationFrame(()=>{k=requestAnimationFrame(J)}))}Dn.addEventListener("pointermove",dt=>{if(!E.active||dt.buttons)return G();Y=[dt.clientX,dt.clientY],k||(k=requestAnimationFrame(J))});for(let dt of["pointerdown","pointerleave","pointercancel","webglcontextlost"])Dn.addEventListener(dt,G);f.root.addEventListener("change",dt=>{dt.detail.kind!=="appearance"&&it()});let nt=new dl(a,Dn,{pick:(dt,Nt)=>z.pick(dt,Nt)?.point??null,visibleBox:y});nt.addEventListener("change",()=>{z.camera=nt.camera,it(),V()}),f.root.addEventListener("change",dt=>{dt.detail.kind==="appearance"&&(m.syncAppearance(f),_.syncAppearance(f)),(dt.detail.kind==="appearance"||dt.detail.kind==="visibility")&&d.update(nt.camera,Dn.getBoundingClientRect(),f),dt.detail.kind==="visibility"&&(m.syncVisibility(f),_.syncVisibility(f),nt.invalidateBounds(),nt.resize())});let at,O=new yl;O.addEventListener("change",()=>f.setHighlighted([...O.values()]));let $=Op({root:h,data:i,scene:f,controls:nt,picker:z,selection:O,measure:E});nt.addEventListener("mode2d",()=>{$.sync2DState(),at?.set2D(nt.is2D)}),qp({root:h,...$,sections:w,selection:O,canFill:S,hasMeshes:x});let{meta:rt}=i,mt=rm({...$,files:rt.linkedFiles??[],elements:rt.elements,scene:f});jp({...$,controls:nt,scene:f,sections:w,selection:O,restoreLinkedModels:mt,views:rt.viewpoints??[],bcfTopics:rt.bcfTopics??[]});let ht=tm({...$,tests:rt.clashTests??[],elements:rt.elements,scene:f,controls:nt,selection:O});n.add(ht.group);let Et=sm({root:h,...$,timeliner:rt.timeliner,elements:rt.elements,scene:f}),Zt=dt=>{e.setClearColor(r.set(dt),1);let{r:Nt,g:Gt,b:ne}=r,Ut=.2126*Nt+.7152*Gt+.0722*ne>Math.sqrt(.0525)-.05,P=Ut?"#000":"#fff";h.style.setProperty("--viewport-text",dt===s?"":P),_.setLightBackground(Ut),d.setLightBackground(Ut),V()};{let{r:dt,g:Nt,b:Gt}=r,ne=.2126*dt+.7152*Nt+.0722*Gt>Math.sqrt(.0525)-.05;_.setLightBackground(ne),d.setLightBackground(ne),ne&&h.style.setProperty("--viewport-text","#000")}for(let dt of Jp({root:h,toolbar:$.toolbar,scene:f,meta:rt,grids:R,initialBackground:s,setBackground:Zt,hasMeshes:x}))$.onEscape(dt.close);$.toolbar.setHandler("distance",()=>{G(),E.setActive(!E.active),E.active||U.release(),$.toolbar.setActive("distance",E.active)}),$.toolbar.setActive("distance",!1),$.onEscape(()=>(G(),E.clear()));let Ct=()=>{nt.setExtraBounds("grids",R.visible?R.box:null),nt.setExtraBounds("measure",E.box)};R.addEventListener("change",Ct),E.addEventListener("change",Ct),Ct(),nt.addEventListener("click",dt=>{let{x:Nt,y:Gt,ctrl:ne,shift:pt}=dt.detail;if(E.active){let Tt=U.target(Nt,Gt);Tt&&E.add(Tt.point);return}let Ut=!ne&&!pt?p?.pick(Nt,Gt):void 0;if(Ut!==void 0){Yt.open(Ut);return}let ft=z.pick(Nt,Gt)?.element??-1;ne?ft>=0&&O.toggle(ft):ft>=0?O.set([ft]):pt||O.clear()}),nt.addEventListener("boxselect",dt=>{if(E.active)return;let{rect:Nt,mode:Gt,ctrl:ne,shift:pt}=dt.detail;if(Nt.width<4||Nt.height<4){!ne&&!pt&&O.clear();return}let Ut=new ae,P=lp(Nt,Gt,cp(f,nt.camera,Dn.getBoundingClientRect())),ft=w.clipping(),Tt=P.filter(I=>!w.isCut(f.elementBox(I,Ut),ft));O.set(ne?[...O.values(),...Tt]:Tt)}),window.addEventListener("resize",()=>{e.setSize(window.innerWidth,window.innerHeight,!1),nt.resize()}),e.setSize(window.innerWidth,window.innerHeight,!1),nt.resize(),nt.fitBox(y(),!1);let Yt=hm(h,i,m,f,nt,V);at=new ml(document.getElementById("ioviewer-ui"),a,nt);let Ht=pm({root:h,world:n,meta:rt,scene:f,apply2DMode:(dt,Nt,Gt)=>{nt.set2DMode(dt,Nt,Gt),dt||nt.fitBox(Nt,Gt),$.sync2DState(),at.set2D(nt.is2D)},setBackground:Zt,requestRender:V});!rt.sheets?.length&&rt.options?.initial2DMode&&(nt.set2DMode(!0,y(),!1),$.sync2DState(),at.set2D(!0)),window.addEventListener("pointerdown",dt=>{(dt.target===Dn||at.element.contains(dt.target))&&document.activeElement?.blur()},!0),window.__ioviewer={scene:f,points:m,lines:_,annotationsOverlay:d,sheetsBar:Ht,motionDetail:g,controls:nt,picker:z,selection:O,ui:$,viewCube:at,sections:w,sectionGizmo:v,measure:E,measureSnap:U,grids:R,clashes:ht,timeliner:Et,ready:D,get camera(){return nt.camera}}}})(); +`)}),c=new gt(new cn(2,2),l);return c.frustumCulled=!1,o.add(c),{setScan(h,d){i.clear();for(let m of h){if(!m.geometry.getAttribute("intensity"))continue;let _=new En(m.geometry,n);_.matrixAutoUpdate=!1,_.matrix.copy(m.matrixWorld),i.add(_)}e.position.copy(d);let u=new at().setFromObject(i),f=u.getSize(t).length();e.far=Math.max(20,f+d.distanceTo(u.getCenter(t)))},draw(h,d,u){e.aspect=d.aspect,e.fov=d.fov,e.updateProjectionMatrix(),e.lookAt(t.copy(e.position).add(u));let f=h.getPixelRatio();n.uniforms.size.value=5.5*f,h.getDrawingBufferSize(r),s.setSize(r.x,r.y),l.uniforms.sampleStep.value.set(2*f/r.x,2*f/r.y),l.uniforms.range.value.set(e.near,e.far),h.setRenderTarget(s),h.render(i,e),h.setRenderTarget(null),h.render(o,a)}}}var Jb=new Intl.NumberFormat(un,{maximumFractionDigits:2,minimumFractionDigits:2}),Ol=i=>`${Jb.format(i)} ${X("scanMap.metres")}`;function Jn(i,e,t){let n=document.createElement("button");return n.type="button",n.textContent=e,n.title=i,n.setAttribute("aria-label",i),n.addEventListener("click",t),n}function jb(i,e){return[i*.005,e*.005]}function Qb(i,e,t){return i.set(Math.cos(t)*Math.cos(e),Math.cos(t)*Math.sin(e),Math.sin(t))}function eM(i,e,t,n,s,r,o){let a=new qn;a.setFromCamera(new qe(n,s),i),a.ray.origin.copy(e),a.near=.05,a.params.Points.threshold=.12;let l=new C,c=new C;for(let h of a.intersectObjects(t,!1))if(l.fromBufferAttribute(h.object.geometry.attributes.position,h.index).applyMatrix4(h.object.matrixWorld),c.copy(l).sub(e).project(i),Math.hypot((c.x-n)*r/2,(c.y-s)*o/2)<=14)return l.z}function Sm(i,e,t,n,s,r){if(!t.count)return;let o=new at().setFromObject(t.root);if(o.isEmpty())return;let a=o.getSize(new C),l=o.getCenter(new C),c={x:l.x,y:l.y,side:Math.max(a.x,a.y,.01)*1.12,zoom:1},h={...c},d=P=>50+100*(P-h.x)*h.zoom/h.side,u=P=>50-100*(P-h.y)*h.zoom/h.side,f=P=>Math.min(96,Math.max(4,P)),m=(P,fe,Te=!1)=>{let I=d(fe.x),M=u(fe.y);return P.style.left=`${Te?f(I):I}%`,P.style.top=`${Te?f(M):M}%`,I>=0&&I<=100&&M>=0&&M<=100},_=e.meta.rtcOffset?.[2]??0,g=e.meta.panoramas??[],p=g.map(P=>new C(...P.position)),y=`ioviewer.scan-levels.v1:${location.pathname}`,w=()=>vm(p.map(P=>P.z+_),o.min.z+_,o.max.z+_),b=null;try{let P=JSON.parse(localStorage.getItem(y));Array.isArray(P)&&(b=P.filter(fe=>Number.isFinite(fe?.min)&&Number.isFinite(fe.max)&&fe.max>fe.min))}catch{b=null}let x=b??w(),S=-1,A=!0,v=P=>ym(x[S],P+_),E=document.createElement("details");E.className="ioviewer-floating ioviewer-scan-map",E.open=!matchMedia("(max-width: 600px)").matches;let R=document.createElement("summary");R.textContent=X("scanMap.title");let L=document.createElement("div");L.className="scan-map-plot";let N=document.createElement("canvas");N.width=N.height=300,N.setAttribute("role","img"),N.setAttribute("aria-label",X("scanMap.plan")),N.tabIndex=0;let B=document.createElement("span");B.className="scan-map-camera",B.setAttribute("aria-hidden","true");let D=document.createElement("span");D.className="scan-map-axes",D.textContent="Y \u2191";let F=document.createElement("span");F.className="scan-map-scale",L.append(N,B,D,F),E.append(R,L),i.append(E);let H=t.root.children.reduce((P,fe)=>P+fe.geometry.attributes.position.count,0),V=Math.max(1,Math.ceil(H/6e4)),z=t.root.children.map(P=>{let fe=P.geometry.attributes.position,Te=new Float32Array(Math.ceil(fe.count/V)*3),I=new C;for(let M=0,Z=0;M{if(U=0,!E.open)return;let P=N.getContext("2d");if(!P)return;P.clearRect(0,0,300,300),P.fillStyle="rgba(160, 185, 201, .33)";for(let[I,M]of z.entries())if(t.root.children[I].visible)for(let Z=0;Z{U||(U=requestAnimationFrame(k))},G=new C,J=null,ie=()=>{if(J){B.hidden=!v(J.position.z),m(B,J.position,!0),B.style.rotate=`${Math.PI/2-J.yaw}rad`;return}B.hidden=!1,m(B,s.camera.position,!0),s.camera.getWorldDirection(G),B.style.rotate=`${Math.atan2(G.x,G.y)}rad`};E.addEventListener("toggle",Y),n.root.addEventListener("change",P=>{P.detail.kind==="visibility"&&Y()}),s.addEventListener("change",ie);let ne=document.createElement("div");ne.className="scan-map-controls";let ae=document.createElement("select");ae.setAttribute("aria-label",X("scanMap.size"));for(let P of["small","medium","large"])ae.add(new Option(X(`scanMap.${P}`),P));ae.value=matchMedia("(max-width: 600px)").matches?"small":"medium",i.dataset.scanMapSize=ae.value,ae.addEventListener("change",()=>{i.dataset.scanMapSize=ae.value});let O=(P,fe=0,Te=0)=>{h=bm(h,P,fe,Te),Y()},$=()=>{h={...c},Y()};ne.append(ae,Jn(X("scanMap.zoomOut"),"\u2212",()=>O(.8)),Jn(X("scanMap.zoomIn"),"+",()=>O(1.25)),Jn(X("scanMap.reset"),"\u21BA",$)),E.insertBefore(ne,L),N.addEventListener("wheel",P=>{P.preventDefault();let fe=N.getBoundingClientRect();O(P.deltaY<0?1.15:1/1.15,(P.clientX-fe.left)/fe.width-.5,(P.clientY-fe.top)/fe.height-.5)},{passive:!1});let re;N.addEventListener("pointerdown",P=>{P.button!==0||re||(N.setPointerCapture(P.pointerId),re={id:P.pointerId,x:P.clientX,y:P.clientY})}),N.addEventListener("pointermove",P=>{if(re?.id!==P.pointerId)return;let fe=h.side/(h.zoom*Math.max(1,N.clientWidth));h.x-=(P.clientX-re.x)*fe,h.y+=(P.clientY-re.y)*fe,re.x=P.clientX,re.y=P.clientY,Y()}),N.addEventListener("lostpointercapture",P=>{P.pointerId===re?.id&&(re=void 0)}),N.addEventListener("keydown",P=>{let fe={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,1],ArrowDown:[0,-1]}[P.key];if(fe){let Te=h.side/h.zoom/10;h.x+=fe[0]*Te,h.y+=fe[1]*Te,Y()}else if(P.key==="+"||P.key==="="||P.key==="-")O(P.key==="-"?.8:1.25);else if(P.key==="0")$();else return;P.preventDefault(),P.stopPropagation()});let me=document.createElement("div");me.className="scan-map-controls";let he=document.createElement("select");he.setAttribute("aria-label",X("scanMap.levels"));let Ee=document.createElement("p");Ee.className="scan-map-feedback",Ee.setAttribute("role","status");function Ze(){try{localStorage.setItem(y,JSON.stringify(x))}catch{Ee.textContent=X("scanMap.levelTemporary")}}function Ce(){he.replaceChildren(new Option(X("scanMap.allLevels"),"-1")),x.forEach((P,fe)=>he.add(new Option(`${X("scanMap.level").replace("{n}",fe+1)} \xB7 ${Ol(P.min)} \u2013 ${Ol(P.max)}`,String(fe)))),he.value=String(S),de.disabled=S<0;for(let[P,fe]of p.entries())Ge.options[P+1].hidden=!v(fe.z);Y(),r()}he.addEventListener("change",()=>{S=Number(he.value),Ee.textContent="",Ce()});let Ye=Jn(X("scanMap.addLevel"),"+",()=>{if(Ne.isClosed()){let P=p.findIndex(fe=>v(fe.z));Ue(Math.max(0,P))}Ne.pickLevel()});Ye.disabled=!g.length;let He=Jn(X("scanMap.autoLevels"),X("scanMap.autoButton"),()=>{let P=w(),fe=P.filter(Te=>!x.some(I=>I.min{S<0||(x.splice(S,1),S=-1,Ee.textContent="",Ze(),Ce())});if(me.append(he,Ye,He,de),g.length){let P=Jn(X("scanMap.spheres"),"\u25C9",()=>{A=!A,P.setAttribute("aria-pressed",String(A)),r()});P.setAttribute("aria-pressed","true"),me.append(P)}E.append(me,Ee);let Ne=g.length?tM(i,e,t,Ue,P=>{J=P,P||pe.forEach(fe=>fe.classList.remove("current")),ie()},P=>{S=x.push(P)-1,Ee.textContent=X("scanMap.levelAdded"),Ze(),Ce()}):null,Ge=document.createElement("select");Ge.setAttribute("aria-label",X("scanMap.choosePhoto"));let nt=new Option(X("scanMap.choosePhoto"),"");nt.disabled=!0,Ge.add(nt);let pe=[];for(let[P,fe]of g.entries()){let Te=fe.name||e.meta.elements[fe.element].name||String(P+1);Ge.add(new Option(Te,String(P)));let I=document.createElement("button");I.type="button",I.className="scan-map-station",I.title=Te,I.setAttribute("aria-label",`${X("scanMap.photo")} \xB7 ${Te}`),I.addEventListener("click",()=>Ue(P)),pe.push(I),L.append(I)}Ge.value="",Ge.addEventListener("change",()=>Ue(Number(Ge.value))),Ge.hidden=!g.length,E.append(Ge),Ce(),!b&&x.length&&Ze();function Ue(P,fe=!1){E.open=!0,Ge.value=String(P),pe.forEach((Te,I)=>Te.classList.toggle("current",P===I)),Ne.open(P,fe),Ge.value=""}return{open:Ue,showSphere:(P,fe)=>A&&v(fe)&&n.isVisible(P)}}function tM(i,e,t,n,s,r){let o=document.createElement("section");o.className="ioviewer-floating scan-photo",o.setAttribute("aria-label",X("scanMap.photo")),o.hidden=!0;let a=document.createElement("header"),l=document.createElement("span"),c=document.createElement("div");c.className="scan-photo-actions";let h=Jn(X("scanMap.enlargePhoto"),X("scanMap.enlargePhoto"),()=>{let pe=o.classList.toggle("is-expanded"),Ue=X(pe?"scanMap.shrinkPhoto":"scanMap.enlargePhoto");h.textContent=h.title=Ue,h.setAttribute("aria-label",Ue),h.setAttribute("aria-pressed",String(pe))});h.setAttribute("aria-pressed","false");let d=document.createElement("button");d.type="button",d.textContent=X("close"),d.addEventListener("click",Ce);let u=!1,f=Jn(X("scanMap.intensity"),X("scanMap.intensity"),()=>{u=!u,nt(!1)});f.className="scan-photo-intensity",f.hidden=!0,c.append(f,h,d),a.append(l,c);let m=document.createElement("canvas");m.tabIndex=0,m.setAttribute("aria-label",X("scanMap.photoControls"));let _=document.createElement("p");_.setAttribute("role","status");let g=document.createElement("div");g.className="scan-photo-view";let p=document.createElement("span");p.className="scan-photo-crosshair",p.setAttribute("aria-hidden","true");let y=document.createElement("div");y.className="scan-photo-level",y.hidden=!0;let w=document.createElement("span");w.setAttribute("role","status"),y.append(w,Jn(X("scanMap.cancel"),X("scanMap.cancel"),He)),g.append(m,p,_),o.append(a,y,g),i.append(o);let b=e.meta.panoramas.map((pe,Ue)=>{let P=pe.name||e.meta.elements[pe.element].name||String(Ue+1),fe=document.createElement("button");return fe.className="scan-photo-link",fe.type="button",fe.title=P,fe.setAttribute("aria-label",X("scanMap.goToStation").replace("{name}",P)),fe.hidden=!0,fe.addEventListener("click",()=>n(Ue,!0)),g.append(fe),{photo:pe,name:P,button:fe,position:new C(...pe.position)}}),x=e.readView(e.meta.points.element),S=new qn;S.params.Points.threshold=.12,S.near=.25;let A=new C,v=new C,E=new C,R=[],L=[],N=!1,B,D=e.meta.rtcOffset?.[2]??0,F,H,V,z=0,U=!1,k=!1,Y=0,G=0,J=null,ie,ne,ae=new mn,O=new Ut(72,1,.1,20);O.up.set(0,0,1);let $=new Wn(10,56,28);$.rotateX(Math.PI/2);let re=new Jt({side:zt}),me=new gt($,re);ae.add(me);let he=()=>{if(!(o.hidden||!H&&!k)){F.setSize(m.clientWidth,m.clientHeight,!1),O.aspect=m.clientWidth/Math.max(1,m.clientHeight),O.updateProjectionMatrix(),O.lookAt(Qb(A,Y,G)),k?V.draw(F,O,A):F.render(ae,O),O.getWorldDirection(A);for(let pe of R){if(N){pe.button.hidden=!0;continue}E.copy(pe.position).sub(ie.position).normalize(),v.copy(E).project(O);let Ue=E.dot(A)>0&&Math.abs(v.x)<.92&&Math.abs(v.y)<.88;pe.button.hidden=!Ue,Ue&&(pe.button.style.left=`${(1+v.x)*50}%`,pe.button.style.top=`${(1-v.y)*50}%`)}s({position:ie.position,yaw:Y})}},Ee=(pe,Ue)=>{Y+=pe,G=lt.clamp(G+Ue,-1.55,1.55),he()};new ResizeObserver(he).observe(m),m.addEventListener("pointerdown",pe=>{pe.button!==0||J||(m.setPointerCapture(pe.pointerId),J={id:pe.pointerId,x:pe.clientX,y:pe.clientY,moved:!1})}),m.addEventListener("pointermove",pe=>{J?.id===pe.pointerId&&(N&&!J.moved&&Math.hypot(pe.clientX-J.x,pe.clientY-J.y)<5||(J.moved=!0,Ee(...jb(pe.clientX-J.x,pe.clientY-J.y)),J.x=pe.clientX,J.y=pe.clientY))}),m.addEventListener("pointerup",pe=>{if(J?.id!==pe.pointerId||J.moved||!N)return;let Ue=m.getBoundingClientRect();Ne((pe.clientX-Ue.left)*2/Ue.width-1,1-(pe.clientY-Ue.top)*2/Ue.height)}),m.addEventListener("lostpointercapture",pe=>{J?.id===pe.pointerId&&(J=null)}),m.addEventListener("keydown",pe=>{if(N&&pe.key==="Enter"){pe.preventDefault(),Ne(0,0);return}let Ue={ArrowLeft:[.12,0],ArrowRight:[-.12,0],ArrowUp:[0,.12],ArrowDown:[0,-.12]}[pe.key];Ue&&(pe.preventDefault(),pe.stopPropagation(),Ee(...Ue))}),m.addEventListener("wheel",pe=>{pe.preventDefault(),O.fov=lt.clamp(O.fov+Math.sign(pe.deltaY)*5,32,95),he()},{passive:!1}),o.addEventListener("keydown",pe=>{pe.key==="Escape"&&(N?He():Ce()),pe.stopPropagation()});function Ce(){o.hidden=!0,He(),z++,J=null,Ye(),s(null),ne?.focus()}function Ye(){k=!1,H?.dispose(),H=void 0,re.map=null;for(let pe of R)pe.button.hidden=!0;R=[]}function He(){N=!1,B=void 0,o.classList.remove("is-picking"),y.hidden=!0,he()}function de(){N=!0,B=void 0,o.classList.add("is-picking"),w.textContent=X("scanMap.pickLower"),y.hidden=!1,he(),(H||k)&&m.focus()}function Ne(pe,Ue){if(!H&&!k)return;let P=eM(O,ie.position,L,pe,Ue,m.clientWidth,m.clientHeight);if(P===void 0){w.textContent=X(B===void 0?"scanMap.noLowerHit":"scanMap.noUpperHit");return}let fe=P+D;B===void 0?(B=fe,w.textContent=X("scanMap.pickUpper").replace("{z}",Ol(fe))):fe<=B?w.textContent=X("scanMap.upperAboveLower").replace("{z}",Ol(B)):(r({min:B,max:fe}),He())}function Ge(pe,Ue){let P=o.hidden;if(P&&(ne=document.activeElement),Ye(),ie=b[pe],o.hidden=!1,l.textContent=ie.name,me.rotation.z=lt.degToRad(ie.photo.yaw),L=t.root.children.filter((fe,Te)=>x[Te]===ie.photo.element),U=L.some(fe=>fe.geometry.getAttribute("intensity")),f.hidden=!U&&!ie.photo.intensity,R=b.filter(fe=>{if(fe===ie)return!1;let Te=E.copy(fe.position).sub(ie.position).length();return Te<=.25?!1:(S.set(ie.position,E.multiplyScalar(1/Te)),S.far=Te-.25,!S.intersectObjects(L,!1).length)}),P||!Ue){let fe=R.reduce((Te,I)=>!Te||I.position.distanceToSquared(ie.position){Ue===z&&(_.textContent=X("scanMap.photoError"))},Te;try{if(F??(F=new Ti({canvas:m,antialias:!0})),F.setPixelRatio(Math.min(devicePixelRatio,2)),P&&U){V??(V=Mm()),V.setScan(L,ie.position),k=!0,_.textContent="",m.style.visibility="visible",he(),pe&&m.focus();return}let I=P?ie.photo.intensity:ie.photo.image;Te=URL.createObjectURL(new Blob([e.readView(I)],{type:"image/jpeg"}))}catch{fe();return}new gr().load(Te,I=>{if(URL.revokeObjectURL(Te),Ue!==z||I.image.width!==2*I.image.height){I.dispose(),fe();return}H?.dispose(),H=I,H.colorSpace=mt,re.map=H,re.needsUpdate=!0,_.textContent="",m.style.visibility="visible",he(),pe&&m.focus()},void 0,()=>{URL.revokeObjectURL(Te),fe()})}return{open:Ge,pickLevel:de,isClosed:()=>o.hidden}}var $s=7;function wm(i){if(!i?.length)return null;let e=i.map(({position:l})=>new C(...l)),t=new pr({color:"#72bfff",depthTest:!1,depthWrite:!1}),n=new xi(new Wn(1,12,8),t,i.length);n.count=0,n.frustumCulled=!1,n.renderOrder=10,n.instanceMatrix.setUsage(Lr);let s=[],r=new Ke,o=new C,a=new qe;return{mesh:n,update(l,c,h){if(n.count=0,s.length=0,!(c.width<=0||c.height<=0)){for(let[d,u]of e.entries()){if(!h(i[d].element,u.z))continue;let f=-o.copy(u).applyMatrix4(l.matrixWorldInverse).z;if(f<=l.near||f>=l.far||(o.copy(u).project(l),!Number.isFinite(o.x)||!Number.isFinite(o.y)))continue;let m=(o.x+1)*c.width/2,_=(1-o.y)*c.height/2;if(m<-$s||m>c.width+$s||_<-$s||_>c.height+$s)continue;let g=l.isOrthographicCamera?(l.top-l.bottom)/l.zoom:l.getViewSize(f,a).y,p=$s*g/c.height;n.setMatrixAt(n.count++,r.makeScale(p,p,p).setPosition(u)),s.push({index:d,depth:f,x:m+c.left,y:_+c.top})}n.instanceMatrix.needsUpdate=n.count>0}},pick(l,c){let h;for(let d of s)(!h||d.depth0))return n;let s=[];for(let r of n){let o="";for(let a of r.match(/\s*\S+|\s+$/gu)??[]){let l=o+a;if(t.measureText(l).width<=e){o=l;continue}if(o&&(s.push(o),a=a.trimStart()),o=a,!(t.measureText(a).width<=e)){o="";for(let c of a)o&&t.measureText(o+c).width>e&&(s.push(o),o=""),o+=c}}s.push(o)}return s}function rM(i,e){let t=i.width/i.height*au,n=sM(i.text,t,e),s=lt.clamp(Math.trunc(i.attachment||1),1,9)-1,r=s%3,o=Math.floor(s/3),a=0;for(let _ of n)a=Math.max(a,e.measureText(_).width/au*i.height);let l=n.length*Tm*i.height,c=-a*r/2,h=l*o/2,d=new at,u=new C,f=Math.cos(i.rotation),m=Math.sin(i.rotation);for(let _ of[c,c+a])for(let g of[h-l,h])u.set(i.position[0]+_*f-g*m,i.position[1]+_*m+g*f,i.position[2]),d.expandByPoint(u);return{lines:n,box:d,hAlign:r,vAlign:o}}var zl=class{constructor(e,t){this.annotations=t.meta.annotations??[],this.lightBackground=!1,this.canvas=document.createElement("canvas"),this.canvas.className="ioviewer-annotations",this.canvas.setAttribute("aria-hidden","true"),this.annotations.length===0&&(this.canvas.hidden=!0),e.append(this.canvas),this._ctx=this.canvas.getContext("2d"),this._ctx&&(this._ctx.font=`${au}px ${Em}`),this.layouts=this._ctx?this.annotations.map(n=>rM(n,this._ctx)):[],this._p=new C,this._x=new C}setLightBackground(e){this.lightBackground=!!e}update(e,t,n){if(!this.annotations.length||!this._ctx||t.width<1||t.height<1)return;let s=window.devicePixelRatio||1,r=Math.round(t.width*s),o=Math.round(t.height*s);(this.canvas.width!==r||this.canvas.height!==o)&&(this.canvas.width=r,this.canvas.height=o);let a=this._ctx;a.setTransform(s,0,0,s,0,0),a.clearRect(0,0,t.width,t.height);let l=new Ke().multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),c=e.matrixWorldInverse,h=e.isOrthographicCamera?t.height*e.zoom/Math.max(e.top-e.bottom,1e-9):0,d=e.isPerspectiveCamera?Math.tan(lt.degToRad(e.fov/2)):0;for(let u=0;u=-e.near)continue;let y=h||t.height/(2*Math.max(-p.z,1e-6)*d),w=f.height*y;if(!Number.isFinite(w)||w<1.5)continue;let b=this._p.clone().applyMatrix4(l);if(b.z<-1||b.z>1)continue;let x=(b.x*.5+.5)*t.width,S=(-b.y*.5+.5)*t.height;if(x<-400||x>t.width+400||S<-400||S>t.height+400)continue;this._x.set(f.position[0]+Math.cos(f.rotation),f.position[1]+Math.sin(f.rotation),f.position[2]).applyMatrix4(l);let A=(this._x.x*.5+.5)*t.width,v=(-this._x.y*.5+.5)*t.height,E=Math.atan2(v-S,A-x),[R,L,N]=f.color?[Math.round(f.color[0]*255),Math.round(f.color[1]*255),Math.round(f.color[2]*255)]:this.lightBackground?[17,24,39]:[229,231,235];this.lightBackground&&R>230&&L>230&&N>230?[R,L,N]=[17,24,39]:!this.lightBackground&&R<20&&L<20&&N<20&&([R,L,N]=[241,245,249]),a.save(),a.translate(x,S),Math.abs(E)>1e-4&&a.rotate(E),a.font=`${w.toFixed(2)}px ${Em}`,a.fillStyle=`rgb(${R},${L},${N})`,a.textAlign=nM[_],a.textBaseline=iM[g];let B=w*Tm,D=-(m.length-1)*B*g/2;for(let F=0;F{}};let l=new Set(a.flatMap(_=>_.elements)),c=K("div","ioviewer-sheets ioviewer-floating");c.setAttribute("role","tablist"),c.setAttribute("aria-label",X("sheets.label"));let h=new ki(new ht,new sn({color:"#94a3b8",transparent:!0,opacity:.55}));h.visible=!1,e.add(h);let d=null,u=new Map;function f(_,g=!1){let p=a.find(x=>x.key===_)??a[0];if(!p)return;d=p;for(let[x,S]of u){let A=x===p.key;S.classList.toggle("active",A),S.setAttribute("aria-selected",String(A))}let y=new Set(p.elements),w=[];for(let x of l)y.has(x)||w.push(x);if(n.setAnnotationSheet(p.key),n.replaceLayerHidden("sheet",w),!p.isModel&&p.paperBounds){let{min:x,max:S}=p.paperBounds,A=x[2];h.geometry.setFromPoints([new C(x[0],x[1],A),new C(S[0],x[1],A),new C(S[0],S[1],A),new C(x[0],S[1],A)]),h.visible=!0}else h.visible=!1;p.background&&r(p.background,!g);let b=n.visibleBox();!p.isModel&&p.paperBounds&&(b.expandByPoint(new C(...p.paperBounds.min)),b.expandByPoint(new C(...p.paperBounds.max))),s(!!p.is2D,b,!1),o()}for(let _ of a){let g=K("button","ioviewer-sheet-tab",_.name);g.type="button",g.setAttribute("role","tab"),g.dataset.sheet=_.key,g.addEventListener("click",()=>f(_.key,!1)),u.set(_.key,g),c.append(g)}a.length>1&&i.append(c);let m=t.options?.initialSheet??a[0].key;return f(m,!0),{get active(){return d},setSheet:_=>f(_,!1)}}tp();var Dn=document.getElementById("ioviewer-canvas"),lu=window.IOVIEWER_TEST??{},Jr=lu.startup;function jr(i){let e=document.getElementById("ioviewer-message");e.textContent=i,e.hidden=!1}try{let i=vh(document,Jr);i.title&&(document.title=i.title);let e=Dn.getContext("webgl2",{antialias:!0,stencil:!0});e?oM(Mf(document,Jr,i),e):jr(X("noWebGL"))}catch(i){if(!(i instanceof tt))throw i;jr(X("badData"))}function oM(i,e){let t=new Ti({canvas:Dn,context:e,antialias:!0,stencil:!0,logarithmicDepthBuffer:fp(i.meta)});t.setPixelRatio(window.devicePixelRatio),t.autoClearStencil=!1,t.localClippingEnabled=!0;let n=new mn,s=i.meta.options?.initialBackground||"#1f2228",r=new Ve(s);t.setClearColor(r,1);let o=new xr("#ffffff","#8a8f99",1.6);o.position.set(0,0,1),n.add(o);let a=new Ut(45,1,.1,1e3);a.up.set(0,0,1),a.position.set(1,-1,.8);let l=new vr("#ffffff",1.4);l.position.set(.3,.6,0),a.add(l,l.target),l.target.position.set(0,0,-1),n.add(a);let c=!1,h=document.getElementById("ioviewer-ui"),d=new zl(h,i),u=d.layouts;Jr?.("sceneStart");let f=L(),m=new cl(i),_=new hl(i);Jr?.("sceneEnd"),i.releaseBinary(),!c&&f.totalCost===0&&m.count===0&&_.count===0&&!u.length&&jr(X("noGeometry"));let g=new vl(f,V,Math.min(f.totalCost,2e7));n.add(f.root),n.add(m.root),n.add(_.root);let p=m.count?wm(i.meta.panoramas):null;p&&n.add(p.mesh);let y=()=>f.visibleBox(),w=new Rl(f,y(),i.meta.sections);m.syncVisibility(f),m.syncAppearance(f),_.syncVisibility(f),_.syncAppearance(f);let b=()=>{let{planes:de,intersection:Ne}=w.clipping();m.setClipping(de,Ne),_.setClipping(de,Ne)};b();let x=f.slotCount>0,S=x&&e.getContextAttributes()?.stencil===!0,A,v=new Pl(w,Dn);n.add(v.group);let E=new Dl(h),R=new Fl(h,i.meta.grids??[]);n.add(E.group,R.group);function L(){try{return new Wr(i,{...lu,maxTextureSize:t.capabilities.maxTextureSize,annotationLayouts:u})}catch(de){if(!(de instanceof Gr))throw de;c=!0,jr(X("tooLarge").replace("{count}",de.count).replace("{limit}",de.limit));let Ne=nt=>({o:0,n:0,t:nt}),Ge={count:0,geometry:Ne("u32"),material:Ne("u32"),element:Ne("i32"),matrix:Ne("f32")};return new Wr({...i,meta:{...i.meta,instances:Ge}},{annotationLayouts:u})}}let N=!1;Dn.addEventListener("webglcontextlost",()=>{N=!0,jr(X("contextLost"))});let B,D=new Promise(de=>B=de),F=Jr,H=!1;function V(){H||N||(H=!0,g.requested(performance.now()),requestAnimationFrame(()=>{if(H=!1,N)return;let de=Dn.getBoundingClientRect();ne.camera.updateMatrixWorld(),Ye&&p?.update(ne.camera,de,Ye.showSphere),v.update(ne.camera),E.update(ne.camera,de),R.update(ne.camera,de),d.update(ne.camera,de,f),g.begin(ne.camera,de.height,performance.now()),F?.("renderStart"),w.fill&&S?(A??(A=new Ll(f,w,i)),A.render(t,n,ne.camera)):t.render(n,ne.camera),F&&(F("renderEnd"),F=void 0),g.end(performance.now()),ae.update(),B()}))}f.root.addEventListener("change",V),w.addEventListener("change",()=>{b(),V()}),v.addEventListener("change",V),E.addEventListener("change",V),E.addEventListener("previewchange",V),R.addEventListener("change",V);let z=new _l(t,f,a,{points:m,lines:_,pickFloat:lu.pickFloat}),U=new Ul(z,w,i),k=0,Y=null;function G(){cancelAnimationFrame(k),k=0,Y=null,E.setPreview(null)}function J(){k=0,Y&&E.setPreview(U.target(...Y))}function ie(){Y&&(E.setPreview(null),cancelAnimationFrame(k),k=requestAnimationFrame(()=>{k=requestAnimationFrame(J)}))}Dn.addEventListener("pointermove",de=>{if(!E.active||de.buttons)return G();Y=[de.clientX,de.clientY],k||(k=requestAnimationFrame(J))});for(let de of["pointerdown","pointerleave","pointercancel","webglcontextlost"])Dn.addEventListener(de,G);f.root.addEventListener("change",de=>{de.detail.kind!=="appearance"&&ie()});let ne=new fl(a,Dn,{pick:(de,Ne)=>z.pick(de,Ne)?.point??null,visibleBox:y});ne.addEventListener("change",()=>{z.camera=ne.camera,ie(),V()}),f.root.addEventListener("change",de=>{de.detail.kind==="appearance"&&(m.syncAppearance(f),_.syncAppearance(f)),(de.detail.kind==="appearance"||de.detail.kind==="visibility")&&d.update(ne.camera,Dn.getBoundingClientRect(),f),de.detail.kind==="visibility"&&(m.syncVisibility(f),_.syncVisibility(f),ne.invalidateBounds(),ne.resize())});let ae,O=new bl;O.addEventListener("change",()=>f.setHighlighted([...O.values()]));let $=Jp({root:h,data:i,scene:f,controls:ne,picker:z,selection:O,measure:E});ne.addEventListener("mode2d",()=>{$.sync2DState(),ae?.set2D(ne.is2D)}),rm({root:h,...$,sections:w,selection:O,canFill:S,hasMeshes:x});let{meta:re}=i,me=xm({...$,files:re.linkedFiles??[],elements:re.elements,scene:f});um({...$,controls:ne,scene:f,sections:w,selection:O,restoreLinkedModels:me,views:re.viewpoints??[],bcfTopics:re.bcfTopics??[]});let he=fm({...$,tests:re.clashTests??[],elements:re.elements,scene:f,controls:ne,selection:O});n.add(he.group);let Ee=_m({root:h,...$,timeliner:re.timeliner,elements:re.elements,scene:f}),Ze=de=>{t.setClearColor(r.set(de),1);let{r:Ne,g:Ge,b:nt}=r,Ue=.2126*Ne+.7152*Ge+.0722*nt>Math.sqrt(.0525)-.05,P=Ue?"#000":"#fff";h.style.setProperty("--viewport-text",de===s?"":P),_.setLightBackground(Ue),d.setLightBackground(Ue),V()};{let{r:de,g:Ne,b:Ge}=r,nt=.2126*de+.7152*Ne+.0722*Ge>Math.sqrt(.0525)-.05;_.setLightBackground(nt),d.setLightBackground(nt),nt&&h.style.setProperty("--viewport-text","#000")}for(let de of hm({root:h,toolbar:$.toolbar,scene:f,meta:re,grids:R,initialBackground:s,setBackground:Ze,hasMeshes:x}))$.onEscape(de.close);$.toolbar.setHandler("distance",()=>{G(),E.setActive(!E.active),E.active||U.release(),$.toolbar.setActive("distance",E.active)}),$.toolbar.setActive("distance",!1),$.onEscape(()=>(G(),E.clear()));let Ce=()=>{ne.setExtraBounds("grids",R.visible?R.box:null),ne.setExtraBounds("measure",E.box)};R.addEventListener("change",Ce),E.addEventListener("change",Ce),Ce(),ne.addEventListener("click",de=>{let{x:Ne,y:Ge,ctrl:nt,shift:pe}=de.detail;if(E.active){let Te=U.target(Ne,Ge);Te&&E.add(Te.point);return}let Ue=!nt&&!pe?p?.pick(Ne,Ge):void 0;if(Ue!==void 0){Ye.open(Ue);return}let fe=z.pick(Ne,Ge)?.element??-1;nt?fe>=0&&O.toggle(fe):fe>=0?O.set([fe]):pe||O.clear()}),ne.addEventListener("boxselect",de=>{if(E.active)return;let{rect:Ne,mode:Ge,ctrl:nt,shift:pe}=de.detail;if(Ne.width<4||Ne.height<4){!nt&&!pe&&O.clear();return}let Ue=new at,P=bp(Ne,Ge,Mp(f,ne.camera,Dn.getBoundingClientRect())),fe=w.clipping(),Te=P.filter(I=>!w.isCut(f.elementBox(I,Ue),fe));O.set(nt?[...O.values(),...Te]:Te)}),window.addEventListener("resize",()=>{t.setSize(window.innerWidth,window.innerHeight,!1),ne.resize()}),t.setSize(window.innerWidth,window.innerHeight,!1),ne.resize(),ne.fitBox(y(),!1);let Ye=Sm(h,i,m,f,ne,V);ae=new gl(document.getElementById("ioviewer-ui"),a,ne);let He=Am({root:h,world:n,meta:re,scene:f,apply2DMode:(de,Ne,Ge)=>{ne.set2DMode(de,Ne,Ge),de||ne.fitBox(Ne,Ge),$.sync2DState(),ae.set2D(ne.is2D)},setBackground:Ze,requestRender:V});!re.sheets?.length&&re.options?.initial2DMode&&(ne.set2DMode(!0,y(),!1),$.sync2DState(),ae.set2D(!0)),window.addEventListener("pointerdown",de=>{(de.target===Dn||ae.element.contains(de.target))&&document.activeElement?.blur()},!0),window.__ioviewer={scene:f,points:m,lines:_,annotationsOverlay:d,sheetsBar:He,motionDetail:g,controls:ne,picker:z,selection:O,ui:$,viewCube:ae,sections:w,sectionGizmo:v,measure:E,measureSnap:U,grids:R,clashes:he,timeliner:Ee,ready:D,get camera(){return ne.camera}}}})(); /*! Bundled license information: three/build/three.core.js: diff --git a/src/IOViewer/Viewer/src/i18n.js b/src/IOViewer/Viewer/src/i18n.js index 4dbead5..e4653ac 100644 --- a/src/IOViewer/Viewer/src/i18n.js +++ b/src/IOViewer/Viewer/src/i18n.js @@ -1,4 +1,8 @@ -const dictionaries = { +import { languageOption, locales, matchLocale, preferredLocale, storedLanguage, storeLanguage } from './locale.js'; +import { additionalDictionaries } from './translations.js'; + +export const dictionaries = { + ...additionalDictionaries, ru: { elements: 'Элементов', noGeometry: 'Нет геометрии', @@ -194,6 +198,14 @@ const dictionaries = { 'player.date': 'Дата графика', 'player.speed': 'Скорость', truncated: 'Показано {meshes} из {total} мешей: модель обрезана настройкой MaxMeshVertices', + language: 'Язык', + auto: 'Авто', + model3d: '3D-модель', + retry: 'Повторить загрузку', + finding: 'Поиск элемента…', + streamLod: '{size} МиБ · точная геометрия {shown}/{total}', + streamMesh: '{size} МиБ · Кластеров {visible} · Уточняется {fallback}', + streamTiles: 'Участков {areas} · Детализация {shown}/{total} · {size}/{limit} МиБ', }, en: { elements: 'Elements', @@ -390,15 +402,47 @@ const dictionaries = { 'player.date': 'Schedule date', 'player.speed': 'Speed', truncated: 'Showing {meshes} of {total} meshes: the model was truncated by the MaxMeshVertices setting', + language: 'Language', + auto: 'Auto', + model3d: '3D model', + retry: 'Retry downloads', + finding: 'Finding element…', + streamLod: '{size} MiB · full detail {shown}/{total}', + streamMesh: '{size} MiB · Clusters {visible} · Refining {fallback}', + streamTiles: '{areas} areas · Detail {shown}/{total} · {size}/{limit} MiB', }, }; -export const lang = (globalThis.navigator?.language ?? '').toLowerCase().startsWith('ru') ? 'ru' : 'en'; +const storageKey = 'ioviewer-language'; +const hostLanguage = globalThis.parent && globalThis.parent !== globalThis && + matchLocale(new URLSearchParams(location.hash.slice(1)).get('ioextendLang')); +const selected = new URLSearchParams(globalThis.location?.search).get('lang'); +const saved = selected === 'auto' ? selected : matchLocale(selected) ?? storedLanguage(storageKey); +export const lang = hostLanguage || matchLocale(saved) || + preferredLocale(globalThis.navigator?.languages?.length ? navigator.languages : [globalThis.navigator?.language]); export const formatCount = new Intl.NumberFormat(lang).format; -// `language` is for tests; the UI always uses `lang`. -export function t(key, language = lang) { - const text = dictionaries[language][key]; +export function t(key, language = lang, values) { + const text = dictionaries[language]?.[key] ?? dictionaries.en[key]; if (text === undefined) throw new Error(`Missing UI string '${key}'.`); - return text; + return values ? text.replace(/\{(\w+)\}/g, (_, name) => values[name]) : text; +} + +export function setupLanguage() { + document.documentElement.lang = lang; + document.querySelector('canvas').setAttribute('aria-label', t('model3d')); + if (hostLanguage) return; + const select = document.createElement('select'); + select.id = 'ioviewer-language'; + select.className = 'ioviewer-floating'; + select.setAttribute('aria-label', t('language')); + select.append(new Option(t('auto'), 'auto'), ...locales.map(languageOption)); + select.value = matchLocale(saved) ?? 'auto'; + select.addEventListener('change', () => { + storeLanguage(storageKey, select.value); + const url = new URL(location.href); + url.searchParams.set('lang', select.value); + location.replace(url); + }); + document.querySelector('#ioviewer-ui').append(select); } diff --git a/src/IOViewer/Viewer/src/locale.js b/src/IOViewer/Viewer/src/locale.js new file mode 100644 index 0000000..1ae0551 --- /dev/null +++ b/src/IOViewer/Viewer/src/locale.js @@ -0,0 +1,39 @@ +export const locales = ['en', 'ru', 'es', 'de', 'fr', 'pt', 'it', 'ja', 'ko', 'zh-Hans', 'zh-Hant']; + +export function matchLocale(tag) { + if (typeof tag !== 'string' || !tag) return undefined; + try { + const locale = new Intl.Locale(tag); + const candidate = locale.language === 'zh' ? `zh-${locale.maximize().script}` : locale.language; + return locales.includes(candidate) ? candidate : undefined; + } catch (error) { + if (!(error instanceof RangeError)) throw error; + return undefined; + } +} + +export function preferredLocale(languages = []) { + return languages.map(matchLocale).find(Boolean) ?? 'en'; +} + +export function languageOption(locale) { + const label = new Intl.DisplayNames(locale, { type: 'language' }).of(locale); + const option = new Option(label, locale); + option.lang = locale; + return option; +} + +export function storedLanguage(key) { + try { return globalThis.localStorage?.getItem(key); } + catch (error) { + if (error.name !== 'SecurityError') throw error; + return null; + } +} + +export function storeLanguage(key, value) { + try { globalThis.localStorage?.setItem(key, value); } + catch (error) { + if (!['SecurityError', 'QuotaExceededError'].includes(error.name)) throw error; + } +} diff --git a/src/IOViewer/Viewer/src/main.js b/src/IOViewer/Viewer/src/main.js index cf106f2..e0f365f 100644 --- a/src/IOViewer/Viewer/src/main.js +++ b/src/IOViewer/Viewer/src/main.js @@ -3,7 +3,7 @@ import { loadModelData, ModelDataError, readModelMeta } from './data.js'; import { ModelScene, ModelTooLargeError } from './engine/modelScene.js'; import { PointScene } from './engine/pointScene.js'; import { LineScene } from './engine/lineScene.js'; -import { lang, t } from './i18n.js'; +import { setupLanguage, t } from './i18n.js'; import { NavigationControls, needsLogarithmicDepth } from './nav/controls.js'; import { ViewCube } from './nav/viewCube.js'; import { Picker } from './engine/picking.js'; @@ -28,7 +28,7 @@ import { createPanoramaSpheres } from './ui/panoramaSpheres.js'; import { AnnotationsOverlay } from './ui/annotationsOverlay.js'; import { mountSheetsBar } from './ui/sheetsBar.js'; -document.documentElement.lang = lang; +setupLanguage(); const canvas = document.getElementById('ioviewer-canvas'); const testOptions = window.IOVIEWER_TEST ?? {}; const startup = testOptions.startup; diff --git a/src/IOViewer/Viewer/src/stream/lod.js b/src/IOViewer/Viewer/src/stream/lod.js index 06e2d8d..b920eae 100644 --- a/src/IOViewer/Viewer/src/stream/lod.js +++ b/src/IOViewer/Viewer/src/stream/lod.js @@ -1,5 +1,5 @@ import * as THREE from 'three'; -import { lang, t } from '../i18n.js'; +import { formatCount, setupLanguage, t } from '../i18n.js'; import { NavigationControls } from '../nav/controls.js'; import { MESH_BUDGET, MIB } from './manifest.js'; import { detailInputBytes, detailMeshBytes, FACES, INSTANCE_FLOATS, STEP, VERTICES, validateClusters } from './clusters.js'; @@ -10,10 +10,9 @@ const status = document.querySelector('#ioviewer-status'); const message = document.querySelector('#ioviewer-message'); const fit = document.querySelector('#fit'); const retry = document.querySelector('#retry'); -const ru = lang === 'ru'; -document.documentElement.lang = lang; +setupLanguage(); fit.textContent = t('tool.fit'); -retry.textContent = ru ? 'Повторить загрузку' : 'Retry downloads'; +retry.textContent = t('retry'); function show(text) { message.textContent = text; @@ -259,8 +258,9 @@ function start(manifest, instances, context) { renderer.render(world, camera); resolveReady(performance.now()); if (animating || transferred.length) requestFrame(); - status.textContent = ru ? `${Math.ceil(bytes / MIB)} МиБ · точная геометрия ${shown[3]}/${candidates.length}` - : `${Math.ceil(bytes / MIB)} MiB · full detail ${shown[3]}/${candidates.length}`; + status.textContent = t('streamLod', undefined, { + size: formatCount(Math.ceil(bytes / MIB)), shown: formatCount(shown[3]), total: formatCount(candidates.length), + }); retry.hidden = failed.size === 0; if (failed.size) retry.title = [...failed.values()].join('\n'); } diff --git a/src/IOViewer/Viewer/src/stream/main.js b/src/IOViewer/Viewer/src/stream/main.js index 8a5b7dd..de9a669 100644 --- a/src/IOViewer/Viewer/src/stream/main.js +++ b/src/IOViewer/Viewer/src/stream/main.js @@ -1,5 +1,5 @@ import * as THREE from 'three'; -import { lang, t } from '../i18n.js'; +import { formatCount, setupLanguage, t } from '../i18n.js'; import { NavigationControls } from '../nav/controls.js'; import { MAX_TILE_MESH, MESH_BUDGET, MIB, validateManifest } from './manifest.js'; @@ -8,10 +8,9 @@ const status = document.querySelector('#ioviewer-status'); const message = document.querySelector('#ioviewer-message'); const fit = document.querySelector('#fit'); const retry = document.querySelector('#retry'); -const ru = lang === 'ru'; -document.documentElement.lang = lang; +setupLanguage(); fit.textContent = t('tool.fit'); -retry.textContent = ru ? 'Повторить загрузку' : 'Retry downloads'; +retry.textContent = t('retry'); function show(text) { message.textContent = text; @@ -203,9 +202,10 @@ function start(manifest, context) { } if (uploaded.length) requestFrame(); const shown = wanted.filter((key) => resident.get(key)?.next > 0).length; - status.textContent = ru - ? `Участков ${tiles.length} · Детализация ${shown}/${wanted.length} · ${Math.ceil(bytes / MIB)} МиБ / ${MESH_BUDGET / MIB} МиБ` - : `${tiles.length} areas · Detail ${shown}/${wanted.length} · ${Math.ceil(bytes / MIB)} MiB / ${MESH_BUDGET / MIB} MiB`; + status.textContent = t('streamTiles', undefined, { + areas: formatCount(tiles.length), shown: formatCount(shown), total: formatCount(wanted.length), + size: formatCount(Math.ceil(bytes / MIB)), limit: formatCount(MESH_BUDGET / MIB), + }); retry.hidden = failed.size === 0; if (failed.size) retry.title = [...failed].map(([key, error]) => `${key.tile.file}: ${error}`).join('\n'); } diff --git a/src/IOViewer/Viewer/src/stream/meshLod.js b/src/IOViewer/Viewer/src/stream/meshLod.js index d5c868b..8c6496d 100644 --- a/src/IOViewer/Viewer/src/stream/meshLod.js +++ b/src/IOViewer/Viewer/src/stream/meshLod.js @@ -1,5 +1,5 @@ import * as THREE from 'three'; -import { lang, t } from '../i18n.js'; +import { formatCount, setupLanguage, t } from '../i18n.js'; import { NavigationControls } from '../nav/controls.js'; import { ViewCube } from '../nav/viewCube.js'; import { el } from '../ui/dom.js'; @@ -16,10 +16,9 @@ const retry = document.querySelector('#retry'); const status = el('span'); document.querySelector('#stream-controls').append(status); document.querySelector('#fit').remove(); -const ru = lang === 'ru'; const profile = window.IOVIEWER_MESH_PROFILE; -document.documentElement.lang = lang; -retry.textContent = ru ? 'Повторить загрузку' : 'Retry downloads'; +setupLanguage(); +retry.textContent = t('retry'); function show(text) { message.textContent = text; @@ -211,7 +210,7 @@ async function start(manifest, context) { updateMaterials(); }); const tools = mountMeshTools({ manifest, roots, nodes, bounds, world, controls, canvas, scene, - fetchPage, ru, render: requestFrame, canFill: context.getContextAttributes()?.stencil === true && roots.some((node) => node.hasClosed), + fetchPage, render: requestFrame, canFill: context.getContextAttributes()?.stencil === true && roots.some((node) => node.hasClosed), setBackground: (color) => renderer.setClearColor(color) }); let caps, capWorld, capMaterials; function renderStencils(renderer, camera, plane) { @@ -503,8 +502,9 @@ async function start(manifest, context) { } resolveReady(performance.now()); if (transferred.length || warm.length) requestFrame(); - status.textContent = ru ? `${Math.ceil(bytes / MIB)} МиБ · Кластеров ${visible} · Уточняется ${fallback}` - : `${Math.ceil(bytes / MIB)} MiB · ${visible} clusters · ${fallback} refining`; + status.textContent = t('streamMesh', undefined, { + size: formatCount(Math.ceil(bytes / MIB)), visible: formatCount(visible), fallback: formatCount(fallback), + }); retry.hidden = failed.size === 0; if (failed.size) retry.title = [...failed.values()].join('\n'); } diff --git a/src/IOViewer/Viewer/src/stream/meshTools.js b/src/IOViewer/Viewer/src/stream/meshTools.js index 85292a7..46ea0d8 100644 --- a/src/IOViewer/Viewer/src/stream/meshTools.js +++ b/src/IOViewer/Viewer/src/stream/meshTools.js @@ -82,7 +82,7 @@ export async function pickMeshSurface(ray, roots, nodes, getPage, sections, sign return hit; } -export function mountMeshTools({ manifest, roots, nodes, bounds, world, controls, canvas, scene, fetchPage, setBackground, canFill, render, ru }) { +export function mountMeshTools({ manifest, roots, nodes, bounds, world, controls, canvas, scene, fetchPage, setBackground, canFill, render }) { const selection = new Selection(); const root = document.querySelector('#ioviewer-ui'); const elements = manifest.elements ?? []; @@ -154,7 +154,7 @@ export function mountMeshTools({ manifest, roots, nodes, bounds, world, controls let failed = false; if (!preview) { note.hidden = false; - note.textContent = ru ? 'Поиск элемента…' : 'Finding element…'; + note.textContent = t('finding'); } try { const rect = canvas.getBoundingClientRect(); diff --git a/src/IOViewer/Viewer/src/translations.js b/src/IOViewer/Viewer/src/translations.js new file mode 100644 index 0000000..c5139ad --- /dev/null +++ b/src/IOViewer/Viewer/src/translations.js @@ -0,0 +1,1209 @@ +// Translated viewer strings. Keep the keys and placeholders in sync with i18n.js. +export const additionalDictionaries = { + "es": { + "elements": "Elementos", + "noGeometry": "Sin geometría", + "contextLost": "Se perdió el contexto gráfico. Recarga la página.", + "noWebGL": "Se requiere un navegador compatible con WebGL 2", + "badData": "No se pudieron leer los datos del modelo", + "tooLarge": "El modelo es demasiado grande: {count} objetos con geometría, límite de {limit}", + "selected": "Seleccionados", + "close": "Cerrar", + "elementGroup": "Elemento", + "id": "ID", + "category": "Categoría", + "type": "Tipo", + "level": "Nivel", + "sourceId": "ID de origen", + "link": "Vínculo", + "panels": "Paneles", + "panel.model": "Modelo", + "panel.views": "Vistas", + "panel.sections": "Secciones", + "panel.clashes": "Interferencias", + "panel.bcf": "Temas BCF", + "bcf.noView": "No hay vistas disponibles", + "bcf.viewpoint": "Abrir vista {index}", + "bcf.components": "Componentes sin encontrar: {missing}; ambiguos: {ambiguous}", + "panel.timeliner": "Cronograma 4D", + "panel.links": "Archivos vinculados", + "group.navigation": "Navegación", + "group.sections": "Secciones", + "group.measure": "Medición", + "group.display": "Visualización", + "group.view": "Vista", + "tool.orbit": "Girar", + "tool.pan": "Desplazar", + "tool.fit": "Encuadrar todo", + "tool.projection": "Perspectiva / ortográfica", + "tool.plane": "Plano de sección", + "tool.box": "Caja de sección", + "tool.resetSections": "Restablecer secciones", + "tool.distance": "Distancia", + "tool.displayMode": "Modo de visualización", + "tool.grids": "Ejes de rejilla", + "tool.opacity": "Transparencia", + "tool.fullscreen": "Pantalla completa", + "contextMenu": "Menú contextual", + "menu.properties": "Propiedades", + "menu.hide": "Ocultar", + "menu.isolate": "Aislar", + "menu.showAll": "Mostrar todo", + "menu.zoomTo": "Acercar al objeto", + "menu.sectionBox": "Caja de sección alrededor del objeto", + "menu.copyId": "Copiar ID", + "menu.fitAll": "Encuadrar todo", + "menu.resetSections": "Restablecer secciones", + "menu.unavailable": "No disponible para este modelo", + "searchPlaceholder": "Buscar por nombre, tipo o ID…", + "noCategory": "Sin categoría", + "noMatches": "Sin coincidencias", + "filters.title": "Filtros", + "filters.model": "Modelo de origen", + "filters.noLevel": "Sin nivel", + "filters.all": "Todos", + "filters.clear": "Borrar", + "filters.isolate": "Aislar coincidencias", + "idCopied": "ID copiado", + "copyFailed": "No se pudo copiar el ID", + "fullscreenUnavailable": "La pantalla completa no está disponible", + "face.front": "Frontal", + "face.back": "Posterior", + "face.left": "Izquierda", + "face.right": "Derecha", + "face.top": "Superior", + "face.bottom": "Inferior", + "cube.title": "Cubo de vistas", + "cube.up": "Girar hacia arriba", + "cube.down": "Girar hacia abajo", + "cube.left": "Girar a la izquierda", + "cube.right": "Girar a la derecha", + "cube.home": "Vista inicial", + "sections.mode": "Modo de sección", + "sections.planes": "Planos", + "sections.box": "Caja", + "sections.off": "Desactivado", + "sections.axis": "Eje", + "sections.addPlane": "Añadir plano", + "sections.noPlanes": "Sin planos", + "sections.rotated": "girado", + "sections.custom": "Personalizado", + "sections.position": "Posición del plano", + "sections.flip": "Invertir lado", + "sections.enabled": "Activado", + "sections.delete": "Eliminar plano", + "sections.keepInside": "Mostrar el interior", + "sections.cutInside": "Recortar el interior", + "sections.fitSelection": "Ajustar a la selección", + "sections.showGizmo": "Mostrar manipulador", + "sections.boxYaw": "Rotación alrededor de Z", + "sections.fill": "Rellenar caras cortadas", + "sections.fillUnavailable": "El relleno requiere un búfer de esténcil de WebGL", + "sections.maxPlanes": "Máximo 6 planos", + "unit.m": "m", + "display.materials": "Materiales", + "display.textures": "Texturas", + "display.white": "Blanco", + "display.wireframe": "Estructura alámbrica", + "display.background": "Color de fondo", + "display.backgroundReset": "Restablecer fondo", + "opacity.label": "Opacidad", + "opacity.value": "{value} %", + "views.tour": "Iniciar recorrido", + "views.stop": "Detener recorrido", + "clash.New": "Nueva", + "clash.Active": "Activa", + "clash.Reviewed": "Revisada", + "clash.Approved": "Aprobada", + "clash.Resolved": "Resuelta", + "task.construct": "Construcción", + "task.demolish": "Demolición", + "task.temporary": "Temporal", + "player.title": "Reproductor 4D", + "player.play": "Reproducir", + "player.pause": "Pausar", + "player.date": "Fecha del cronograma", + "player.speed": "Velocidad", + "truncated": "Se muestran {meshes} de {total} mallas. MaxMeshVertices ha recortado el modelo.", + "language": "Idioma", + "auto": "Automático", + "model3d": "Modelo 3D", + "retry": "Reintentar descargas", + "finding": "Buscando el elemento…", + "streamLod": "{size} MiB · detalle completo {shown}/{total}", + "streamMesh": "{size} MiB · Grupos {visible} · Refinando {fallback}", + "streamTiles": "Áreas {areas} · Detalle {shown}/{total} · {size}/{limit} MiB" + }, + "de": { + "elements": "Elemente", + "noGeometry": "Keine Geometrie", + "contextLost": "Der Grafikkontext wurde verloren. Seite neu laden.", + "noWebGL": "Ein Browser mit WebGL 2 ist erforderlich", + "badData": "Die Modelldaten konnten nicht gelesen werden", + "tooLarge": "Das Modell ist zu groß: {count} Objekte mit Geometrie, maximal {limit}", + "selected": "Ausgewählt", + "close": "Schließen", + "elementGroup": "Element", + "id": "ID", + "category": "Kategorie", + "type": "Typ", + "level": "Ebene", + "sourceId": "Quell-ID", + "link": "Verknüpfung", + "panels": "Bedienfelder", + "panel.model": "Modell", + "panel.views": "Ansichten", + "panel.sections": "Schnitte", + "panel.clashes": "Kollisionen", + "panel.bcf": "BCF-Themen", + "bcf.noView": "Keine Ansicht verfügbar", + "bcf.viewpoint": "Ansicht {index} öffnen", + "bcf.components": "Fehlende Komponenten: {missing}, mehrdeutige: {ambiguous}", + "panel.timeliner": "4D-Terminplan", + "panel.links": "Verknüpfte Dateien", + "group.navigation": "Navigation", + "group.sections": "Schnitte", + "group.measure": "Messung", + "group.display": "Darstellung", + "group.view": "Ansicht", + "tool.orbit": "Drehen", + "tool.pan": "Verschieben", + "tool.fit": "Alles einpassen", + "tool.projection": "Perspektive / Orthogonal", + "tool.plane": "Schnittebene", + "tool.box": "Schnittbox", + "tool.resetSections": "Schnitte zurücksetzen", + "tool.distance": "Abstand", + "tool.displayMode": "Darstellungsmodus", + "tool.grids": "Rasterachsen", + "tool.opacity": "Transparenz", + "tool.fullscreen": "Vollbild", + "contextMenu": "Kontextmenü", + "menu.properties": "Eigenschaften", + "menu.hide": "Ausblenden", + "menu.isolate": "Isolieren", + "menu.showAll": "Alles anzeigen", + "menu.zoomTo": "Auf Objekt zoomen", + "menu.sectionBox": "Schnittbox um das Objekt", + "menu.copyId": "ID kopieren", + "menu.fitAll": "Alles einpassen", + "menu.resetSections": "Schnitte zurücksetzen", + "menu.unavailable": "Für dieses Modell nicht verfügbar", + "searchPlaceholder": "Nach Name, Typ oder ID suchen…", + "noCategory": "Ohne Kategorie", + "noMatches": "Keine Treffer", + "filters.title": "Filter", + "filters.model": "Quellmodell", + "filters.noLevel": "Ohne Ebene", + "filters.all": "Alle", + "filters.clear": "Zurücksetzen", + "filters.isolate": "Treffer isolieren", + "idCopied": "ID kopiert", + "copyFailed": "ID konnte nicht kopiert werden", + "fullscreenUnavailable": "Vollbild ist nicht verfügbar", + "face.front": "Vorne", + "face.back": "Hinten", + "face.left": "Links", + "face.right": "Rechts", + "face.top": "Oben", + "face.bottom": "Unten", + "cube.title": "Ansichtswürfel", + "cube.up": "Nach oben drehen", + "cube.down": "Nach unten drehen", + "cube.left": "Nach links drehen", + "cube.right": "Nach rechts drehen", + "cube.home": "Ausgangsansicht", + "sections.mode": "Schnittmodus", + "sections.planes": "Ebenen", + "sections.box": "Box", + "sections.off": "Aus", + "sections.axis": "Achse", + "sections.addPlane": "Ebene hinzufügen", + "sections.noPlanes": "Keine Schnittebenen", + "sections.rotated": "gedreht", + "sections.custom": "Benutzerdefiniert", + "sections.position": "Ebenenposition", + "sections.flip": "Seite wechseln", + "sections.enabled": "Ein", + "sections.delete": "Ebene löschen", + "sections.keepInside": "Innen anzeigen", + "sections.cutInside": "Innen ausschneiden", + "sections.fitSelection": "An Auswahl anpassen", + "sections.showGizmo": "Manipulator anzeigen", + "sections.boxYaw": "Drehung um Z", + "sections.fill": "Schnittflächen füllen", + "sections.fillUnavailable": "Schnittfüllung erfordert einen WebGL-Stencilpuffer", + "sections.maxPlanes": "Maximal 6 Ebenen", + "unit.m": "m", + "display.materials": "Materialien", + "display.textures": "Texturen", + "display.white": "Weiß", + "display.wireframe": "Drahtmodell", + "display.background": "Hintergrundfarbe", + "display.backgroundReset": "Hintergrund zurücksetzen", + "opacity.label": "Deckkraft", + "opacity.value": "{value} %", + "views.tour": "Rundgang starten", + "views.stop": "Rundgang stoppen", + "clash.New": "Neu", + "clash.Active": "Aktiv", + "clash.Reviewed": "Geprüft", + "clash.Approved": "Genehmigt", + "clash.Resolved": "Behoben", + "task.construct": "Bau", + "task.demolish": "Abbruch", + "task.temporary": "Temporär", + "player.title": "4D-Wiedergabe", + "player.play": "Abspielen", + "player.pause": "Pausieren", + "player.date": "Terminplandatum", + "player.speed": "Geschwindigkeit", + "truncated": "{meshes} von {total} Netzen werden angezeigt. MaxMeshVertices hat das Modell gekürzt.", + "language": "Sprache", + "auto": "Automatisch", + "model3d": "3D-Modell", + "retry": "Downloads wiederholen", + "finding": "Element wird gesucht…", + "streamLod": "{size} MiB · volles Detail {shown}/{total}", + "streamMesh": "{size} MiB · Cluster {visible} · Verfeinerung {fallback}", + "streamTiles": "Bereiche {areas} · Detail {shown}/{total} · {size}/{limit} MiB" + }, + "fr": { + "elements": "Éléments", + "noGeometry": "Aucune géométrie", + "contextLost": "Le contexte graphique a été perdu. Rechargez la page.", + "noWebGL": "Un navigateur compatible avec WebGL 2 est nécessaire", + "badData": "Impossible de lire les données du modèle", + "tooLarge": "Le modèle est trop volumineux : {count} objets avec géométrie, limite de {limit}", + "selected": "Sélectionnés", + "close": "Fermer", + "elementGroup": "Élément", + "id": "ID", + "category": "Catégorie", + "type": "Type", + "level": "Niveau", + "sourceId": "ID source", + "link": "Lien", + "panels": "Panneaux", + "panel.model": "Modèle", + "panel.views": "Vues", + "panel.sections": "Coupes", + "panel.clashes": "Conflits", + "panel.bcf": "Sujets BCF", + "bcf.noView": "Aucune vue disponible", + "bcf.viewpoint": "Ouvrir le point de vue {index}", + "bcf.components": "Composants manquants : {missing}, ambigus : {ambiguous}", + "panel.timeliner": "Planning 4D", + "panel.links": "Fichiers liés", + "group.navigation": "Navigation", + "group.sections": "Coupes", + "group.measure": "Mesure", + "group.display": "Affichage", + "group.view": "Vue", + "tool.orbit": "Orbite", + "tool.pan": "Panoramique", + "tool.fit": "Cadrer tout", + "tool.projection": "Perspective / orthographique", + "tool.plane": "Plan de coupe", + "tool.box": "Zone de coupe", + "tool.resetSections": "Réinitialiser les coupes", + "tool.distance": "Distance", + "tool.displayMode": "Mode d’affichage", + "tool.grids": "Axes de quadrillage", + "tool.opacity": "Transparence", + "tool.fullscreen": "Plein écran", + "contextMenu": "Menu contextuel", + "menu.properties": "Propriétés", + "menu.hide": "Masquer", + "menu.isolate": "Isoler", + "menu.showAll": "Tout afficher", + "menu.zoomTo": "Zoom sur l’objet", + "menu.sectionBox": "Zone de coupe autour de l’objet", + "menu.copyId": "Copier l’ID", + "menu.fitAll": "Cadrer tout", + "menu.resetSections": "Réinitialiser les coupes", + "menu.unavailable": "Indisponible pour ce modèle", + "searchPlaceholder": "Rechercher par nom, type ou ID…", + "noCategory": "Sans catégorie", + "noMatches": "Aucun résultat", + "filters.title": "Filtres", + "filters.model": "Modèle source", + "filters.noLevel": "Sans niveau", + "filters.all": "Tous", + "filters.clear": "Effacer", + "filters.isolate": "Isoler les résultats", + "idCopied": "ID copié", + "copyFailed": "Impossible de copier l’ID", + "fullscreenUnavailable": "Le plein écran est indisponible", + "face.front": "Avant", + "face.back": "Arrière", + "face.left": "Gauche", + "face.right": "Droite", + "face.top": "Dessus", + "face.bottom": "Dessous", + "cube.title": "Cube de navigation", + "cube.up": "Pivoter vers le haut", + "cube.down": "Pivoter vers le bas", + "cube.left": "Pivoter à gauche", + "cube.right": "Pivoter à droite", + "cube.home": "Vue initiale", + "sections.mode": "Mode de coupe", + "sections.planes": "Plans", + "sections.box": "Zone", + "sections.off": "Désactivé", + "sections.axis": "Axe", + "sections.addPlane": "Ajouter un plan", + "sections.noPlanes": "Aucun plan", + "sections.rotated": "pivoté", + "sections.custom": "Personnalisé", + "sections.position": "Position du plan", + "sections.flip": "Inverser le côté", + "sections.enabled": "Activé", + "sections.delete": "Supprimer le plan", + "sections.keepInside": "Afficher l’intérieur", + "sections.cutInside": "Découper l’intérieur", + "sections.fitSelection": "Ajuster à la sélection", + "sections.showGizmo": "Afficher le manipulateur", + "sections.boxYaw": "Rotation autour de Z", + "sections.fill": "Remplir les faces coupées", + "sections.fillUnavailable": "Le remplissage nécessite un tampon de stencil WebGL", + "sections.maxPlanes": "6 plans maximum", + "unit.m": "m", + "display.materials": "Matériaux", + "display.textures": "Textures", + "display.white": "Blanc", + "display.wireframe": "Filaire", + "display.background": "Couleur de fond", + "display.backgroundReset": "Réinitialiser le fond", + "opacity.label": "Opacité", + "opacity.value": "{value} %", + "views.tour": "Démarrer la visite", + "views.stop": "Arrêter la visite", + "clash.New": "Nouveau", + "clash.Active": "Actif", + "clash.Reviewed": "Examiné", + "clash.Approved": "Approuvé", + "clash.Resolved": "Résolu", + "task.construct": "Construction", + "task.demolish": "Démolition", + "task.temporary": "Temporaire", + "player.title": "Lecteur 4D", + "player.play": "Lire", + "player.pause": "Mettre en pause", + "player.date": "Date du planning", + "player.speed": "Vitesse", + "truncated": "{meshes} maillages sur {total} sont affichés. MaxMeshVertices a tronqué le modèle.", + "language": "Langue", + "auto": "Automatique", + "model3d": "Modèle 3D", + "retry": "Relancer les téléchargements", + "finding": "Recherche de l’élément…", + "streamLod": "{size} Mio · détail complet {shown}/{total}", + "streamMesh": "{size} Mio · Groupes {visible} · Affinage {fallback}", + "streamTiles": "Zones {areas} · Détail {shown}/{total} · {size}/{limit} Mio" + }, + "pt": { + "elements": "Elementos", + "noGeometry": "Sem geometria", + "contextLost": "O contexto gráfico foi perdido. Recarregue a página.", + "noWebGL": "É necessário um navegador com WebGL 2", + "badData": "Não foi possível ler os dados do modelo", + "tooLarge": "O modelo é grande demais: {count} objetos com geometria, limite de {limit}", + "selected": "Selecionados", + "close": "Fechar", + "elementGroup": "Elemento", + "id": "ID", + "category": "Categoria", + "type": "Tipo", + "level": "Nível", + "sourceId": "ID de origem", + "link": "Vínculo", + "panels": "Painéis", + "panel.model": "Modelo", + "panel.views": "Vistas", + "panel.sections": "Cortes", + "panel.clashes": "Interferências", + "panel.bcf": "Tópicos BCF", + "bcf.noView": "Nenhuma vista disponível", + "bcf.viewpoint": "Abrir vista {index}", + "bcf.components": "Componentes ausentes: {missing}, ambíguos: {ambiguous}", + "panel.timeliner": "Cronograma 4D", + "panel.links": "Arquivos vinculados", + "group.navigation": "Navegação", + "group.sections": "Cortes", + "group.measure": "Medição", + "group.display": "Exibição", + "group.view": "Vista", + "tool.orbit": "Girar", + "tool.pan": "Deslocar", + "tool.fit": "Enquadrar tudo", + "tool.projection": "Perspectiva / ortográfica", + "tool.plane": "Plano de corte", + "tool.box": "Caixa de corte", + "tool.resetSections": "Redefinir cortes", + "tool.distance": "Distância", + "tool.displayMode": "Modo de exibição", + "tool.grids": "Eixos", + "tool.opacity": "Transparência", + "tool.fullscreen": "Tela cheia", + "contextMenu": "Menu de contexto", + "menu.properties": "Propriedades", + "menu.hide": "Ocultar", + "menu.isolate": "Isolar", + "menu.showAll": "Mostrar tudo", + "menu.zoomTo": "Aproximar do objeto", + "menu.sectionBox": "Caixa de corte ao redor do objeto", + "menu.copyId": "Copiar ID", + "menu.fitAll": "Enquadrar tudo", + "menu.resetSections": "Redefinir cortes", + "menu.unavailable": "Indisponível para este modelo", + "searchPlaceholder": "Buscar por nome, tipo ou ID…", + "noCategory": "Sem categoria", + "noMatches": "Nenhum resultado", + "filters.title": "Filtros", + "filters.model": "Modelo de origem", + "filters.noLevel": "Sem nível", + "filters.all": "Todos", + "filters.clear": "Limpar", + "filters.isolate": "Isolar resultados", + "idCopied": "ID copiado", + "copyFailed": "Não foi possível copiar o ID", + "fullscreenUnavailable": "A tela cheia está indisponível", + "face.front": "Frente", + "face.back": "Trás", + "face.left": "Esquerda", + "face.right": "Direita", + "face.top": "Topo", + "face.bottom": "Base", + "cube.title": "Cubo de vistas", + "cube.up": "Girar para cima", + "cube.down": "Girar para baixo", + "cube.left": "Girar para a esquerda", + "cube.right": "Girar para a direita", + "cube.home": "Vista inicial", + "sections.mode": "Modo de corte", + "sections.planes": "Planos", + "sections.box": "Caixa", + "sections.off": "Desativado", + "sections.axis": "Eixo", + "sections.addPlane": "Adicionar plano", + "sections.noPlanes": "Sem planos", + "sections.rotated": "girado", + "sections.custom": "Personalizado", + "sections.position": "Posição do plano", + "sections.flip": "Inverter lado", + "sections.enabled": "Ativado", + "sections.delete": "Excluir plano", + "sections.keepInside": "Mostrar interior", + "sections.cutInside": "Recortar interior", + "sections.fitSelection": "Ajustar à seleção", + "sections.showGizmo": "Mostrar manipulador", + "sections.boxYaw": "Rotação em torno de Z", + "sections.fill": "Preencher faces de corte", + "sections.fillUnavailable": "O preenchimento requer um buffer de stencil WebGL", + "sections.maxPlanes": "Até 6 planos", + "unit.m": "m", + "display.materials": "Materiais", + "display.textures": "Texturas", + "display.white": "Branco", + "display.wireframe": "Aramado", + "display.background": "Cor de fundo", + "display.backgroundReset": "Redefinir fundo", + "opacity.label": "Opacidade", + "opacity.value": "{value}%", + "views.tour": "Iniciar percurso", + "views.stop": "Parar percurso", + "clash.New": "Nova", + "clash.Active": "Ativa", + "clash.Reviewed": "Revisada", + "clash.Approved": "Aprovada", + "clash.Resolved": "Resolvida", + "task.construct": "Construção", + "task.demolish": "Demolição", + "task.temporary": "Temporária", + "player.title": "Reprodutor 4D", + "player.play": "Reproduzir", + "player.pause": "Pausar", + "player.date": "Data do cronograma", + "player.speed": "Velocidade", + "truncated": "Exibindo {meshes} de {total} malhas. MaxMeshVertices limitou o modelo.", + "language": "Idioma", + "auto": "Automático", + "model3d": "Modelo 3D", + "retry": "Tentar baixar novamente", + "finding": "Buscando o elemento…", + "streamLod": "{size} MiB · detalhe completo {shown}/{total}", + "streamMesh": "{size} MiB · Grupos {visible} · Refinando {fallback}", + "streamTiles": "Áreas {areas} · Detalhe {shown}/{total} · {size}/{limit} MiB" + }, + "it": { + "elements": "Elementi", + "noGeometry": "Nessuna geometria", + "contextLost": "Il contesto grafico è stato perso. Ricarica la pagina.", + "noWebGL": "È necessario un browser con WebGL 2", + "badData": "Impossibile leggere i dati del modello", + "tooLarge": "Il modello è troppo grande: {count} oggetti con geometria, limite di {limit}", + "selected": "Selezionati", + "close": "Chiudi", + "elementGroup": "Elemento", + "id": "ID", + "category": "Categoria", + "type": "Tipo", + "level": "Livello", + "sourceId": "ID origine", + "link": "Collegamento", + "panels": "Pannelli", + "panel.model": "Modello", + "panel.views": "Viste", + "panel.sections": "Sezioni", + "panel.clashes": "Interferenze", + "panel.bcf": "Argomenti BCF", + "bcf.noView": "Nessuna vista disponibile", + "bcf.viewpoint": "Apri punto di vista {index}", + "bcf.components": "Componenti mancanti: {missing}, ambigui: {ambiguous}", + "panel.timeliner": "Cronoprogramma 4D", + "panel.links": "File collegati", + "group.navigation": "Navigazione", + "group.sections": "Sezioni", + "group.measure": "Misura", + "group.display": "Visualizzazione", + "group.view": "Vista", + "tool.orbit": "Orbita", + "tool.pan": "Sposta vista", + "tool.fit": "Inquadra tutto", + "tool.projection": "Prospettiva / ortogonale", + "tool.plane": "Piano di sezione", + "tool.box": "Riquadro di sezione", + "tool.resetSections": "Ripristina sezioni", + "tool.distance": "Distanza", + "tool.displayMode": "Modalità di visualizzazione", + "tool.grids": "Assi di griglia", + "tool.opacity": "Trasparenza", + "tool.fullscreen": "Schermo intero", + "contextMenu": "Menu contestuale", + "menu.properties": "Proprietà", + "menu.hide": "Nascondi", + "menu.isolate": "Isola", + "menu.showAll": "Mostra tutto", + "menu.zoomTo": "Zoom sull’oggetto", + "menu.sectionBox": "Riquadro di sezione attorno all’oggetto", + "menu.copyId": "Copia ID", + "menu.fitAll": "Inquadra tutto", + "menu.resetSections": "Ripristina sezioni", + "menu.unavailable": "Non disponibile per questo modello", + "searchPlaceholder": "Cerca per nome, tipo o ID…", + "noCategory": "Senza categoria", + "noMatches": "Nessun risultato", + "filters.title": "Filtri", + "filters.model": "Modello di origine", + "filters.noLevel": "Senza livello", + "filters.all": "Tutti", + "filters.clear": "Cancella", + "filters.isolate": "Isola risultati", + "idCopied": "ID copiato", + "copyFailed": "Impossibile copiare l’ID", + "fullscreenUnavailable": "Lo schermo intero non è disponibile", + "face.front": "Fronte", + "face.back": "Retro", + "face.left": "Sinistra", + "face.right": "Destra", + "face.top": "Alto", + "face.bottom": "Basso", + "cube.title": "Cubo di navigazione", + "cube.up": "Ruota verso l’alto", + "cube.down": "Ruota verso il basso", + "cube.left": "Ruota a sinistra", + "cube.right": "Ruota a destra", + "cube.home": "Vista iniziale", + "sections.mode": "Modalità di sezione", + "sections.planes": "Piani", + "sections.box": "Riquadro", + "sections.off": "Disattivato", + "sections.axis": "Asse", + "sections.addPlane": "Aggiungi piano", + "sections.noPlanes": "Nessun piano", + "sections.rotated": "ruotato", + "sections.custom": "Personalizzato", + "sections.position": "Posizione del piano", + "sections.flip": "Inverti lato", + "sections.enabled": "Attivato", + "sections.delete": "Elimina piano", + "sections.keepInside": "Mostra interno", + "sections.cutInside": "Taglia interno", + "sections.fitSelection": "Adatta alla selezione", + "sections.showGizmo": "Mostra manipolatore", + "sections.boxYaw": "Rotazione attorno a Z", + "sections.fill": "Riempi facce tagliate", + "sections.fillUnavailable": "Il riempimento richiede uno stencil buffer WebGL", + "sections.maxPlanes": "Al massimo 6 piani", + "unit.m": "m", + "display.materials": "Materiali", + "display.textures": "Texture", + "display.white": "Bianco", + "display.wireframe": "Fil di ferro", + "display.background": "Colore di sfondo", + "display.backgroundReset": "Ripristina sfondo", + "opacity.label": "Opacità", + "opacity.value": "{value}%", + "views.tour": "Avvia percorso", + "views.stop": "Interrompi percorso", + "clash.New": "Nuova", + "clash.Active": "Attiva", + "clash.Reviewed": "Revisionata", + "clash.Approved": "Approvata", + "clash.Resolved": "Risolta", + "task.construct": "Costruzione", + "task.demolish": "Demolizione", + "task.temporary": "Temporanea", + "player.title": "Riproduttore 4D", + "player.play": "Riproduci", + "player.pause": "Pausa", + "player.date": "Data pianificata", + "player.speed": "Velocità", + "truncated": "Sono mostrate {meshes} mesh su {total}. MaxMeshVertices ha troncato il modello.", + "language": "Lingua", + "auto": "Automatico", + "model3d": "Modello 3D", + "retry": "Riprova download", + "finding": "Ricerca dell’elemento…", + "streamLod": "{size} MiB · dettaglio completo {shown}/{total}", + "streamMesh": "{size} MiB · Gruppi {visible} · In affinamento {fallback}", + "streamTiles": "Aree {areas} · Dettaglio {shown}/{total} · {size}/{limit} MiB" + }, + "ja": { + "elements": "要素", + "noGeometry": "ジオメトリがありません", + "contextLost": "グラフィックスコンテキストが失われました。ページを再読み込みしてください。", + "noWebGL": "WebGL 2 対応ブラウザーが必要です", + "badData": "モデルデータを読み取れませんでした", + "tooLarge": "モデルが大きすぎます。ジオメトリを持つオブジェクトは {count} 個で、上限は {limit} 個です", + "selected": "選択済み", + "close": "閉じる", + "elementGroup": "要素", + "id": "ID", + "category": "カテゴリ", + "type": "タイプ", + "level": "レベル", + "sourceId": "ソース ID", + "link": "リンク", + "panels": "パネル", + "panel.model": "モデル", + "panel.views": "ビュー", + "panel.sections": "断面", + "panel.clashes": "干渉", + "panel.bcf": "BCF トピック", + "bcf.noView": "利用可能なビューがありません", + "bcf.viewpoint": "視点 {index} を開く", + "bcf.components": "未検出のコンポーネント: {missing}、特定できないもの: {ambiguous}", + "panel.timeliner": "4D 工程表", + "panel.links": "リンクファイル", + "group.navigation": "ナビゲーション", + "group.sections": "断面", + "group.measure": "計測", + "group.display": "表示", + "group.view": "ビュー", + "tool.orbit": "オービット", + "tool.pan": "画面移動", + "tool.fit": "全体表示", + "tool.projection": "透視投影 / 平行投影", + "tool.plane": "断面平面", + "tool.box": "断面ボックス", + "tool.resetSections": "断面をリセット", + "tool.distance": "距離", + "tool.displayMode": "表示モード", + "tool.grids": "通り芯", + "tool.opacity": "透明度", + "tool.fullscreen": "全画面表示", + "contextMenu": "コンテキストメニュー", + "menu.properties": "プロパティ", + "menu.hide": "非表示", + "menu.isolate": "分離表示", + "menu.showAll": "すべて表示", + "menu.zoomTo": "オブジェクトにズーム", + "menu.sectionBox": "オブジェクトを囲む断面ボックス", + "menu.copyId": "ID をコピー", + "menu.fitAll": "全体表示", + "menu.resetSections": "断面をリセット", + "menu.unavailable": "このモデルでは使用できません", + "searchPlaceholder": "名前、タイプ、ID で検索…", + "noCategory": "カテゴリなし", + "noMatches": "一致する項目がありません", + "filters.title": "フィルター", + "filters.model": "ソースモデル", + "filters.noLevel": "レベルなし", + "filters.all": "すべて", + "filters.clear": "クリア", + "filters.isolate": "一致した項目を分離表示", + "idCopied": "ID をコピーしました", + "copyFailed": "ID をコピーできませんでした", + "fullscreenUnavailable": "全画面表示は使用できません", + "face.front": "正面", + "face.back": "背面", + "face.left": "左", + "face.right": "右", + "face.top": "上", + "face.bottom": "下", + "cube.title": "ビューキューブ", + "cube.up": "上に回転", + "cube.down": "下に回転", + "cube.left": "左に回転", + "cube.right": "右に回転", + "cube.home": "初期ビュー", + "sections.mode": "断面モード", + "sections.planes": "平面", + "sections.box": "ボックス", + "sections.off": "オフ", + "sections.axis": "軸", + "sections.addPlane": "平面を追加", + "sections.noPlanes": "平面なし", + "sections.rotated": "回転済み", + "sections.custom": "カスタム", + "sections.position": "平面の位置", + "sections.flip": "反対側に切り替え", + "sections.enabled": "オン", + "sections.delete": "平面を削除", + "sections.keepInside": "内側を表示", + "sections.cutInside": "内側を切り取る", + "sections.fitSelection": "選択範囲に合わせる", + "sections.showGizmo": "操作ハンドルを表示", + "sections.boxYaw": "Z 軸まわりの回転", + "sections.fill": "切断面を塗りつぶす", + "sections.fillUnavailable": "塗りつぶしには WebGL のステンシルバッファーが必要です", + "sections.maxPlanes": "最大 6 平面", + "unit.m": "m", + "display.materials": "マテリアル", + "display.textures": "テクスチャ", + "display.white": "白", + "display.wireframe": "ワイヤーフレーム", + "display.background": "背景色", + "display.backgroundReset": "背景をリセット", + "opacity.label": "不透明度", + "opacity.value": "{value}%", + "views.tour": "ビュー巡回を再生", + "views.stop": "ビュー巡回を停止", + "clash.New": "新規", + "clash.Active": "アクティブ", + "clash.Reviewed": "確認済み", + "clash.Approved": "承認済み", + "clash.Resolved": "解決済み", + "task.construct": "建設", + "task.demolish": "解体", + "task.temporary": "仮設", + "player.title": "4D プレーヤー", + "player.play": "再生", + "player.pause": "一時停止", + "player.date": "工程日", + "player.speed": "速度", + "truncated": "{total} 個中 {meshes} 個のメッシュを表示。MaxMeshVertices の設定でモデルが省略されています。", + "language": "言語", + "auto": "自動", + "model3d": "3D モデル", + "retry": "ダウンロードを再試行", + "finding": "要素を検索中…", + "streamLod": "{size} MiB · 詳細表示 {shown}/{total}", + "streamMesh": "{size} MiB · クラスター {visible} · 詳細化中 {fallback}", + "streamTiles": "領域 {areas} · 詳細表示 {shown}/{total} · {size}/{limit} MiB" + }, + "ko": { + "elements": "요소", + "noGeometry": "형상이 없습니다", + "contextLost": "그래픽 컨텍스트가 손실되었습니다. 페이지를 새로 고치세요.", + "noWebGL": "WebGL 2를 지원하는 브라우저가 필요합니다", + "badData": "모델 데이터를 읽을 수 없습니다", + "tooLarge": "모델이 너무 큽니다. 형상이 있는 객체 {count}개, 최대 {limit}개", + "selected": "선택됨", + "close": "닫기", + "elementGroup": "요소", + "id": "ID", + "category": "카테고리", + "type": "유형", + "level": "레벨", + "sourceId": "원본 ID", + "link": "링크", + "panels": "패널", + "panel.model": "모델", + "panel.views": "뷰", + "panel.sections": "단면", + "panel.clashes": "간섭", + "panel.bcf": "BCF 주제", + "bcf.noView": "사용 가능한 뷰가 없습니다", + "bcf.viewpoint": "관측점 {index} 열기", + "bcf.components": "누락된 구성요소: {missing}, 모호한 구성요소: {ambiguous}", + "panel.timeliner": "4D 일정", + "panel.links": "링크된 파일", + "group.navigation": "탐색", + "group.sections": "단면", + "group.measure": "측정", + "group.display": "표시", + "group.view": "뷰", + "tool.orbit": "궤도 회전", + "tool.pan": "화면 이동", + "tool.fit": "전체 맞춤", + "tool.projection": "원근 / 직교 투영", + "tool.plane": "단면 평면", + "tool.box": "단면 상자", + "tool.resetSections": "단면 재설정", + "tool.distance": "거리", + "tool.displayMode": "표시 모드", + "tool.grids": "그리드", + "tool.opacity": "투명도", + "tool.fullscreen": "전체 화면", + "contextMenu": "상황에 맞는 메뉴", + "menu.properties": "속성", + "menu.hide": "숨기기", + "menu.isolate": "분리", + "menu.showAll": "모두 표시", + "menu.zoomTo": "객체로 확대", + "menu.sectionBox": "객체를 둘러싼 단면 상자", + "menu.copyId": "ID 복사", + "menu.fitAll": "전체 맞춤", + "menu.resetSections": "단면 재설정", + "menu.unavailable": "이 모델에서는 사용할 수 없습니다", + "searchPlaceholder": "이름, 유형, ID로 검색…", + "noCategory": "카테고리 없음", + "noMatches": "일치하는 항목 없음", + "filters.title": "필터", + "filters.model": "원본 모델", + "filters.noLevel": "레벨 없음", + "filters.all": "모두", + "filters.clear": "지우기", + "filters.isolate": "일치 항목 분리", + "idCopied": "ID를 복사했습니다", + "copyFailed": "ID를 복사할 수 없습니다", + "fullscreenUnavailable": "전체 화면을 사용할 수 없습니다", + "face.front": "앞", + "face.back": "뒤", + "face.left": "왼쪽", + "face.right": "오른쪽", + "face.top": "위", + "face.bottom": "아래", + "cube.title": "뷰 큐브", + "cube.up": "위로 회전", + "cube.down": "아래로 회전", + "cube.left": "왼쪽으로 회전", + "cube.right": "오른쪽으로 회전", + "cube.home": "홈 뷰", + "sections.mode": "단면 모드", + "sections.planes": "평면", + "sections.box": "상자", + "sections.off": "끔", + "sections.axis": "축", + "sections.addPlane": "평면 추가", + "sections.noPlanes": "평면 없음", + "sections.rotated": "회전됨", + "sections.custom": "사용자 지정", + "sections.position": "평면 위치", + "sections.flip": "반대쪽으로 전환", + "sections.enabled": "켬", + "sections.delete": "평면 삭제", + "sections.keepInside": "내부 표시", + "sections.cutInside": "내부 잘라내기", + "sections.fitSelection": "선택 영역에 맞춤", + "sections.showGizmo": "조작 핸들 표시", + "sections.boxYaw": "Z축 기준 회전", + "sections.fill": "절단면 채우기", + "sections.fillUnavailable": "채우려면 WebGL 스텐실 버퍼가 필요합니다", + "sections.maxPlanes": "최대 평면 6개", + "unit.m": "m", + "display.materials": "재질", + "display.textures": "텍스처", + "display.white": "흰색", + "display.wireframe": "와이어프레임", + "display.background": "배경색", + "display.backgroundReset": "배경 재설정", + "opacity.label": "불투명도", + "opacity.value": "{value}%", + "views.tour": "둘러보기 재생", + "views.stop": "둘러보기 중지", + "clash.New": "새로 추가됨", + "clash.Active": "활성", + "clash.Reviewed": "검토됨", + "clash.Approved": "승인됨", + "clash.Resolved": "해결됨", + "task.construct": "시공", + "task.demolish": "철거", + "task.temporary": "임시", + "player.title": "4D 플레이어", + "player.play": "재생", + "player.pause": "일시 정지", + "player.date": "일정 날짜", + "player.speed": "속도", + "truncated": "총 {total}개 중 메시 {meshes}개 표시. MaxMeshVertices 설정으로 모델이 잘렸습니다.", + "language": "언어", + "auto": "자동", + "model3d": "3D 모델", + "retry": "다운로드 다시 시도", + "finding": "요소를 찾는 중…", + "streamLod": "{size} MiB · 전체 상세 {shown}/{total}", + "streamMesh": "{size} MiB · 클러스터 {visible} · 정밀화 중 {fallback}", + "streamTiles": "영역 {areas} · 상세 {shown}/{total} · {size}/{limit} MiB" + }, + "zh-Hans": { + "elements": "图元", + "noGeometry": "没有几何图形", + "contextLost": "图形上下文已丢失,请重新加载页面。", + "noWebGL": "需要支持 WebGL 2 的浏览器", + "badData": "无法读取模型数据", + "tooLarge": "模型过大:共有 {count} 个带几何图形的对象,上限为 {limit}", + "selected": "已选", + "close": "关闭", + "elementGroup": "图元", + "id": "ID", + "category": "类别", + "type": "类型", + "level": "标高", + "sourceId": "源 ID", + "link": "链接", + "panels": "面板", + "panel.model": "模型", + "panel.views": "视图", + "panel.sections": "剖面", + "panel.clashes": "碰撞", + "panel.bcf": "BCF 议题", + "bcf.noView": "没有可用视图", + "bcf.viewpoint": "打开视点 {index}", + "bcf.components": "缺失构件:{missing},匹配不明确:{ambiguous}", + "panel.timeliner": "4D 进度计划", + "panel.links": "链接文件", + "group.navigation": "导航", + "group.sections": "剖面", + "group.measure": "测量", + "group.display": "显示", + "group.view": "视图", + "tool.orbit": "环绕", + "tool.pan": "平移", + "tool.fit": "缩放至全图", + "tool.projection": "透视 / 正交", + "tool.plane": "剖切平面", + "tool.box": "剖面框", + "tool.resetSections": "重置剖面", + "tool.distance": "距离", + "tool.displayMode": "显示模式", + "tool.grids": "轴网", + "tool.opacity": "透明度", + "tool.fullscreen": "全屏", + "contextMenu": "上下文菜单", + "menu.properties": "属性", + "menu.hide": "隐藏", + "menu.isolate": "隔离", + "menu.showAll": "显示全部", + "menu.zoomTo": "缩放至对象", + "menu.sectionBox": "围绕对象创建剖面框", + "menu.copyId": "复制 ID", + "menu.fitAll": "缩放至全图", + "menu.resetSections": "重置剖面", + "menu.unavailable": "此模型不支持此功能", + "searchPlaceholder": "按名称、类型或 ID 搜索…", + "noCategory": "无类别", + "noMatches": "没有匹配项", + "filters.title": "筛选器", + "filters.model": "源模型", + "filters.noLevel": "无标高", + "filters.all": "全部", + "filters.clear": "清除", + "filters.isolate": "隔离匹配项", + "idCopied": "已复制 ID", + "copyFailed": "无法复制 ID", + "fullscreenUnavailable": "无法进入全屏", + "face.front": "前", + "face.back": "后", + "face.left": "左", + "face.right": "右", + "face.top": "上", + "face.bottom": "下", + "cube.title": "视图立方体", + "cube.up": "向上旋转", + "cube.down": "向下旋转", + "cube.left": "向左旋转", + "cube.right": "向右旋转", + "cube.home": "初始视图", + "sections.mode": "剖面模式", + "sections.planes": "平面", + "sections.box": "框", + "sections.off": "关", + "sections.axis": "轴", + "sections.addPlane": "添加平面", + "sections.noPlanes": "无平面", + "sections.rotated": "已旋转", + "sections.custom": "自定义", + "sections.position": "平面位置", + "sections.flip": "反转方向", + "sections.enabled": "开", + "sections.delete": "删除平面", + "sections.keepInside": "显示内部", + "sections.cutInside": "裁切内部", + "sections.fitSelection": "适应选区", + "sections.showGizmo": "显示操纵器", + "sections.boxYaw": "绕 Z 轴旋转", + "sections.fill": "填充剖切面", + "sections.fillUnavailable": "剖切面填充需要 WebGL 模板缓冲区", + "sections.maxPlanes": "最多 6 个平面", + "unit.m": "米", + "display.materials": "材质", + "display.textures": "纹理", + "display.white": "白色", + "display.wireframe": "线框", + "display.background": "背景颜色", + "display.backgroundReset": "重置背景", + "opacity.label": "不透明度", + "opacity.value": "{value}%", + "views.tour": "播放漫游", + "views.stop": "停止漫游", + "clash.New": "新建", + "clash.Active": "活动", + "clash.Reviewed": "已审查", + "clash.Approved": "已批准", + "clash.Resolved": "已解决", + "task.construct": "施工", + "task.demolish": "拆除", + "task.temporary": "临时", + "player.title": "4D 播放器", + "player.play": "播放", + "player.pause": "暂停", + "player.date": "计划日期", + "player.speed": "速度", + "truncated": "显示 {meshes}/{total} 个网格,模型受 MaxMeshVertices 设置限制。", + "language": "语言", + "auto": "自动", + "model3d": "3D 模型", + "retry": "重试下载", + "finding": "正在查找图元…", + "streamLod": "{size} MiB · 完整细节 {shown}/{total}", + "streamMesh": "{size} MiB · 簇 {visible} · 正在细化 {fallback}", + "streamTiles": "区域 {areas} · 细节 {shown}/{total} · {size}/{limit} MiB" + }, + "zh-Hant": { + "elements": "圖元", + "noGeometry": "沒有幾何圖形", + "contextLost": "圖形環境已遺失,請重新載入頁面。", + "noWebGL": "需要支援 WebGL 2 的瀏覽器", + "badData": "無法讀取模型資料", + "tooLarge": "模型過大:共有 {count} 個帶幾何圖形的物件,上限為 {limit}", + "selected": "已選取", + "close": "關閉", + "elementGroup": "圖元", + "id": "ID", + "category": "類別", + "type": "類型", + "level": "樓層", + "sourceId": "來源 ID", + "link": "連結", + "panels": "面板", + "panel.model": "模型", + "panel.views": "視圖", + "panel.sections": "剖面", + "panel.clashes": "碰撞", + "panel.bcf": "BCF 議題", + "bcf.noView": "沒有可用視圖", + "bcf.viewpoint": "開啟視點 {index}", + "bcf.components": "缺少元件:{missing},無法確定:{ambiguous}", + "panel.timeliner": "4D 排程", + "panel.links": "連結檔案", + "group.navigation": "導覽", + "group.sections": "剖面", + "group.measure": "測量", + "group.display": "顯示", + "group.view": "視圖", + "tool.orbit": "環繞", + "tool.pan": "平移", + "tool.fit": "縮放至全圖", + "tool.projection": "透視 / 正交", + "tool.plane": "剖切平面", + "tool.box": "剖面框", + "tool.resetSections": "重設剖面", + "tool.distance": "距離", + "tool.displayMode": "顯示模式", + "tool.grids": "軸網", + "tool.opacity": "透明度", + "tool.fullscreen": "全螢幕", + "contextMenu": "內容選單", + "menu.properties": "屬性", + "menu.hide": "隱藏", + "menu.isolate": "隔離", + "menu.showAll": "顯示全部", + "menu.zoomTo": "縮放至物件", + "menu.sectionBox": "環繞物件建立剖面框", + "menu.copyId": "複製 ID", + "menu.fitAll": "縮放至全圖", + "menu.resetSections": "重設剖面", + "menu.unavailable": "此模型不支援此功能", + "searchPlaceholder": "依名稱、類型或 ID 搜尋…", + "noCategory": "無類別", + "noMatches": "沒有符合項目", + "filters.title": "篩選器", + "filters.model": "來源模型", + "filters.noLevel": "無樓層", + "filters.all": "全部", + "filters.clear": "清除", + "filters.isolate": "隔離符合項目", + "idCopied": "已複製 ID", + "copyFailed": "無法複製 ID", + "fullscreenUnavailable": "無法進入全螢幕", + "face.front": "前", + "face.back": "後", + "face.left": "左", + "face.right": "右", + "face.top": "上", + "face.bottom": "下", + "cube.title": "視圖立方體", + "cube.up": "向上旋轉", + "cube.down": "向下旋轉", + "cube.left": "向左旋轉", + "cube.right": "向右旋轉", + "cube.home": "初始視圖", + "sections.mode": "剖面模式", + "sections.planes": "平面", + "sections.box": "框", + "sections.off": "關", + "sections.axis": "軸", + "sections.addPlane": "新增平面", + "sections.noPlanes": "無平面", + "sections.rotated": "已旋轉", + "sections.custom": "自訂", + "sections.position": "平面位置", + "sections.flip": "反轉方向", + "sections.enabled": "開", + "sections.delete": "刪除平面", + "sections.keepInside": "顯示內部", + "sections.cutInside": "裁切內部", + "sections.fitSelection": "配合選取範圍", + "sections.showGizmo": "顯示操控器", + "sections.boxYaw": "繞 Z 軸旋轉", + "sections.fill": "填滿剖切面", + "sections.fillUnavailable": "剖切面填滿需要 WebGL 模板緩衝區", + "sections.maxPlanes": "最多 6 個平面", + "unit.m": "公尺", + "display.materials": "材質", + "display.textures": "紋理", + "display.white": "白色", + "display.wireframe": "線框", + "display.background": "背景色彩", + "display.backgroundReset": "重設背景", + "opacity.label": "不透明度", + "opacity.value": "{value}%", + "views.tour": "播放漫遊", + "views.stop": "停止漫遊", + "clash.New": "新增", + "clash.Active": "啟用", + "clash.Reviewed": "已審查", + "clash.Approved": "已核准", + "clash.Resolved": "已解決", + "task.construct": "施工", + "task.demolish": "拆除", + "task.temporary": "臨時", + "player.title": "4D 播放器", + "player.play": "播放", + "player.pause": "暫停", + "player.date": "排程日期", + "player.speed": "速度", + "truncated": "顯示 {total} 個網格中的 {meshes} 個。模型受 MaxMeshVertices 設定限制。", + "language": "語言", + "auto": "自動", + "model3d": "3D 模型", + "retry": "重試下載", + "finding": "正在尋找圖元…", + "streamLod": "{size} MiB · 完整細節 {shown}/{total}", + "streamMesh": "{size} MiB · 叢集 {visible} · 正在細化 {fallback}", + "streamTiles": "區域 {areas} · 細節 {shown}/{total} · {size}/{limit} MiB" + } +}; diff --git a/src/IOViewer/Viewer/src/ui/timeliner.js b/src/IOViewer/Viewer/src/ui/timeliner.js index 890fadc..f0908bc 100644 --- a/src/IOViewer/Viewer/src/ui/timeliner.js +++ b/src/IOViewer/Viewer/src/ui/timeliner.js @@ -1,4 +1,4 @@ -import { t } from '../i18n.js'; +import { lang, t } from '../i18n.js'; import { prepareSchedule, scheduleState } from '../model/schedule.js'; import { icons } from './icons.js'; import { el, iconButton } from './dom.js'; @@ -25,8 +25,8 @@ export function mountTimeliner({ root, shell, timeliner, elements, scene }) { shell.registerPanel('timeliner', { icon: icons.timeliner, title: t('panel.timeliner'), visible: false, render: () => {} }); return null; } - const dayFormat = new Intl.DateTimeFormat(undefined, { dateStyle: 'short', timeZone: 'UTC' }); - const dateFormat = new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeZone: 'UTC' }); + const dayFormat = new Intl.DateTimeFormat(lang, { dateStyle: 'short', timeZone: 'UTC' }); + const dateFormat = new Intl.DateTimeFormat(lang, { dateStyle: 'medium', timeZone: 'UTC' }); let date = schedule.start; let speed = 1; let frame = 0; // requestAnimationFrame id while playing diff --git a/src/IOViewer/Viewer/styles/viewer.css b/src/IOViewer/Viewer/styles/viewer.css index d41e7e5..ce61695 100644 --- a/src/IOViewer/Viewer/styles/viewer.css +++ b/src/IOViewer/Viewer/styles/viewer.css @@ -53,7 +53,8 @@ button { } button:focus-visible, -input:focus-visible { +input:focus-visible, +select:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; } @@ -68,6 +69,18 @@ input:focus-visible { pointer-events: auto; } +#ioviewer-language { + inset: 12px 12px auto auto; + z-index: 2; + min-height: 36px; + max-width: 9.5rem; + padding-inline: 8px; + color: var(--text); + font: inherit; +} + +#ioviewer-ui:has(#ioviewer-language) { --language-space: 44px; } + #ioviewer-message { position: absolute; inset: 0; @@ -940,7 +953,7 @@ input:focus-visible { and the buttons take pointer events. */ .ioviewer-viewcube { position: absolute; - top: 12px; + top: calc(12px + var(--language-space, 0px)); right: 12px; width: 132px; height: 132px; @@ -1023,8 +1036,10 @@ input:focus-visible { @media (max-width: 500px) { .ioviewer-side-panel { + top: calc(12px + var(--language-space, 0px)); z-index: 1; max-width: calc(100% - 100px); + max-height: calc(100% - 12px - var(--toolbar-space) - var(--language-space, 0px)); } .ioviewer-side-panel[data-panel="elements"] { top: auto; @@ -1061,10 +1076,10 @@ input:focus-visible { /* Properties of the selection, right, below the view cube. */ #ioviewer-properties { right: 12px; - top: 152px; + top: calc(152px + var(--language-space, 0px)); width: 300px; max-width: calc(100% - 24px); - max-height: calc(100% - 152px - var(--toolbar-space)); + max-height: calc(100% - 152px - var(--toolbar-space) - var(--language-space, 0px)); overflow: auto; padding: 8px 12px 12px; } diff --git a/src/IOViewer/Viewer/test/e2e/smoke.spec.js b/src/IOViewer/Viewer/test/e2e/smoke.spec.js index 125a700..af63d43 100644 --- a/src/IOViewer/Viewer/test/e2e/smoke.spec.js +++ b/src/IOViewer/Viewer/test/e2e/smoke.spec.js @@ -160,6 +160,8 @@ test('adaptive orbit compacts a cell on the GPU and full detail and picking stil for (const [locale, message, status] of [ ['ru-RU', 'Нет геометрии', 'Выбрано: 0 · Элементов: 0'], ['en-US', 'No geometry', 'Selected: 0 · Elements: 0'], + ['ja-JP', 'ジオメトリがありません', '選択済み: 0 · 要素: 0'], + ['zh-TW', '沒有幾何圖形', '已選取: 0 · 圖元: 0'], ]) { test.describe(locale, () => { test.use({ locale }); @@ -173,6 +175,24 @@ for (const [locale, message, status] of [ }); } +test('standalone HTML switches languages offline and remembers the choice on reload', async ({ page, context }) => { + await context.setOffline(true); + const { errors, requests } = await open(page, 'building'); + const picker = page.locator('#ioviewer-language'); + await expect(picker.locator('option')).toHaveCount(12); + await picker.selectOption('de'); + await expect(page.locator('html')).toHaveAttribute('lang', 'de'); + await expect(page.getByRole('button', { name: 'Modell', exact: true })).toBeVisible(); + await expect(page.locator('[data-tool="mode2d"]')).toHaveAttribute('aria-label', '2D / 3D mode'); + await page.reload(); + await expect(picker).toHaveValue('de'); + await picker.selectOption('auto'); + await expect(page.locator('html')).toHaveAttribute('lang', 'ru'); + await expect(page.getByRole('button', { name: 'Модель', exact: true })).toBeVisible(); + expect(errors).toEqual([]); + expect(requests).toEqual([]); +}); + test('startup profiling samples load and first render once', async ({ page }) => { await page.addInitScript(() => { window.startupSamples = []; diff --git a/src/IOViewer/Viewer/test/e2e/ui.spec.js b/src/IOViewer/Viewer/test/e2e/ui.spec.js index 2dec448..9411ce2 100644 --- a/src/IOViewer/Viewer/test/e2e/ui.spec.js +++ b/src/IOViewer/Viewer/test/e2e/ui.spec.js @@ -372,10 +372,13 @@ test('status bar counts the selection; the truncation banner shows and closes', toolbarFits: bar.left >= 0 && bar.right <= innerWidth && bar.bottom < rect('#ioviewer-status').top, panelFits: panel.bottom < bar.top && panel.top > warning.bottom, panelCloseReachable: reachable('.ioviewer-side-panel .ioviewer-panel-close'), + languageReachable: reachable('#ioviewer-language'), homeReachable: reachable('.ioviewer-viewcube-home'), }; }); - expect(layout).toEqual({ toolbarFits: true, panelFits: true, panelCloseReachable: true, homeReachable: true }); + expect(layout).toEqual({ + toolbarFits: true, panelFits: true, panelCloseReachable: true, languageReachable: true, homeReachable: true, + }); } await banner.getByRole('button').click(); await expect(banner).toHaveCount(0); diff --git a/src/IOViewer/Viewer/test/unit/i18n.test.js b/src/IOViewer/Viewer/test/unit/i18n.test.js new file mode 100644 index 0000000..45a2748 --- /dev/null +++ b/src/IOViewer/Viewer/test/unit/i18n.test.js @@ -0,0 +1,29 @@ +import assert from 'node:assert/strict'; +import { test } from 'node:test'; +import { dictionaries, t } from '../../src/i18n.js'; +import { locales, matchLocale, preferredLocale } from '../../src/locale.js'; + +test('chooses a supported preference, including the Chinese writing system', () => { + assert.equal(preferredLocale(['nl-NL', 'fr-CA', 'en-GB']), 'fr'); + assert.equal(preferredLocale(['invalid_tag', 'ru-RU']), 'ru'); + assert.equal(preferredLocale(['nl-NL']), 'en'); + assert.equal(matchLocale('zh-CN'), 'zh-Hans'); + assert.equal(matchLocale('zh-TW'), 'zh-Hant'); + assert.equal(matchLocale('zh-Hant-CN'), 'zh-Hant'); + assert.equal(matchLocale('es-419'), 'es'); +}); + +test('every viewer string resolves in each language and keeps its placeholders', () => { + const keys = Object.keys(dictionaries.en).sort(); + const placeholders = value => [...value.matchAll(/\{\w+\}/g)].map(([token]) => token).sort(); + assert.deepEqual(Object.keys(dictionaries.ru).sort(), keys); + for (const locale of locales) { + for (const key of Object.keys(dictionaries[locale])) assert(Object.hasOwn(dictionaries.en, key), `${locale} ${key}`); + for (const key of keys) { + const text = t(key, locale); + assert(text.trim(), `${locale} ${key}`); + assert.deepEqual(placeholders(text), placeholders(dictionaries.en[key]), `${locale} ${key}`); + } + } + assert.throws(() => t('unknown.viewer.string', 'de'), /Missing UI string/); +});