From b12b27a5708b0b08c2a241311ac2254cac31a984 Mon Sep 17 00:00:00 2001 From: mahach666 <79989386+mahach666@users.noreply.github.com> Date: Wed, 25 Nov 2026 04:37:34 +0300 Subject: [PATCH] Add offline language selection to IOViewer --- README.md | 3 +- src/IOViewer/Viewer/dist/viewer.js | 386 +++--- src/IOViewer/Viewer/src/i18n.js | 56 +- src/IOViewer/Viewer/src/locale.js | 39 + src/IOViewer/Viewer/src/main.js | 4 +- src/IOViewer/Viewer/src/stream/lod.js | 12 +- src/IOViewer/Viewer/src/stream/main.js | 14 +- src/IOViewer/Viewer/src/stream/meshLod.js | 14 +- src/IOViewer/Viewer/src/stream/meshTools.js | 4 +- src/IOViewer/Viewer/src/translations.js | 1209 +++++++++++++++++++ src/IOViewer/Viewer/src/ui/timeliner.js | 6 +- src/IOViewer/Viewer/styles/viewer.css | 21 +- src/IOViewer/Viewer/test/e2e/smoke.spec.js | 19 + src/IOViewer/Viewer/test/unit/i18n.test.js | 26 + 14 files changed, 1582 insertions(+), 231 deletions(-) create mode 100644 src/IOViewer/Viewer/src/locale.js create mode 100644 src/IOViewer/Viewer/src/translations.js create mode 100644 src/IOViewer/Viewer/test/unit/i18n.test.js diff --git a/README.md b/README.md index 61ac46f..0aad6f4 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 interface in English, Russian, Spanish, German, French, Portuguese, Italian, Japanese, Korean, and simplified and traditional Chinese. 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 421fd3d..3d4fa5c 100644 --- a/src/IOViewer/Viewer/dist/viewer.js +++ b/src/IOViewer/Viewer/dist/viewer.js @@ -1,10 +1,10 @@ -(()=>{var Wh=i=>{throw TypeError(i)};var yl=(i,t,e)=>t.has(i)||Wh("Cannot "+e);var ni=(i,t,e)=>(yl(i,t,"read from private field"),e?e.call(i):t.get(i)),bl=(i,t,e)=>t.has(i)?Wh("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),Xh=(i,t,e,n)=>(yl(i,t,"write to private field"),n?n.call(i,e):t.set(i,e),e),kr=(i,t,e)=>(yl(i,t,"access private method"),e);var wu=0,tc=1,Eu=2;var cr=1,Tu=2,vs=3,Bn=0,Ve=1,Ie=2,On=0,ys=1,ec=2,nc=3,ic=4,Au=5;var Ni=100,Ru=101,Cu=102,Iu=103,Pu=104,Lu=200,Du=201,Nu=202,Uu=203,sc=204,rc=205,Fu=206,Bu=207,Ou=208,zu=209,ku=210,Hu=211,Vu=212,Gu=213,Wu=214,_o=0,xo=1,vo=2,rs=3,yo=4,bo=5,Mo=6,So=7,Jo=0,Xu=1,qu=2,bn=0,oc=1,ac=2,lc=3,cc=4,hc=5,uc=6,dc=7;var fc=300,fi=301,Ui=302,Ko=303,jo=304,hr=306,os=1e3,In=1001,wo=1002,Ue=1003,Yu=1004;var ur=1005;var ze=1006,Qo=1007;var pi=1008;var nn=1009,pc=1010,mc=1011,bs=1012,ta=1013,Mn=1014,Ge=1015,Sn=1016,ea=1017,na=1018,Ms=1020,gc=35902,_c=35899,xc=1021,vc=1022,sn=1023,Pn=1026,mi=1027,Ss=1028,ia=1029,gi=1030,sa=1031;var ra=1033,dr=33776,fr=33777,pr=33778,mr=33779,oa=35840,aa=35841,la=35842,ca=35843,ha=36196,ua=37492,da=37496,fa=37488,pa=37489,gr=37490,ma=37491,ga=37808,_a=37809,xa=37810,va=37811,ya=37812,ba=37813,Ma=37814,Sa=37815,wa=37816,Ea=37817,Ta=37818,Aa=37819,Ra=37820,Ca=37821,Ia=36492,Pa=36494,La=36495,Da=36283,Na=36284,_r=36285,Ua=36286;var Ws=2300,Eo=2301,mo=2302,Xl=2303,ql=2400,Yl=2401,$l=2402;var $u=3200;var Fa=0,Zu=1,jn="",Ae="srgb",Xs="srgb-linear",qs="linear",te="srgb";var go=7680;var yc=34055,bc=34056;var Mc=517;var Ju=519,Ku=512,ju=513,Qu=514,Ba=515,td=516,ed=517,Oa=518,nd=519,Sc=35044,wc=35048;var Ec="300 es",xn=2e3,as=2001;function Ep(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}function Tp(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 qh={},ls=null;function $s(...i){let t="THREE."+i.shift();ls?ls("log",t,...i):console.log(t,...i)}function sd(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 Dt(...i){i=sd(i);let t="THREE."+i.shift();if(ls)ls("warn",t,...i);else{let e=i[0];e&&e.isStackTrace?console.warn(e.getError(t)):console.warn(t,...i)}}function Ut(...i){i=sd(i);let t="THREE."+i.shift();if(ls)ls("error",t,...i);else{let e=i[0];e&&e.isStackTrace?console.error(e.getError(t)):console.error(t,...i)}}function Ti(...i){let t=i.join(" ");t in qh||(qh[t]=!0,Dt(...i))}function rd(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 od={[_o]:xo,[vo]:Mo,[yo]:So,[rs]:bo,[xo]:_o,[Mo]:vo,[So]:yo,[bo]:rs},Ln=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]+qe[i>>16&255]+qe[i>>24&255]+"-"+qe[t&255]+qe[t>>8&255]+"-"+qe[t>>16&15|64]+qe[t>>24&255]+"-"+qe[e&63|128]+qe[e>>8&255]+"-"+qe[e>>16&255]+qe[e>>24&255]+qe[n&255]+qe[n>>8&255]+qe[n>>16&255]+qe[n>>24&255]).toLowerCase()}function $t(i,t,e){return Math.max(t,Math.min(e,i))}function Tc(i,t){return(i%t+t)%t}function Ap(i,t,e,n,s){return n+(i-t)*(s-n)/(e-t)}function Rp(i,t,e){return i!==t?(e-i)/(t-i):0}function Gs(i,t,e){return(1-e)*i+e*t}function Cp(i,t,e,n){return Gs(i,t,1-Math.exp(-e*n))}function Ip(i,t=1){return t-Math.abs(Tc(i,t*2)-t)}function Pp(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function Lp(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function Dp(i,t){return i+Math.floor(Math.random()*(t-i+1))}function Np(i,t){return i+Math.random()*(t-i)}function Up(i){return i*(.5-Math.random())}function Fp(i){i!==void 0&&(Yh=i);let t=Yh+=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 Bp(i){return i*is}function Op(i){return i*cs}function zp(i){return i>0&&Number.isInteger(i)&&2**Math.round(Math.log2(i))===i}function kp(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Hp(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Vp(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),p=r((n-t)/2),g=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*g,l*p,a*c);break;case"YXY":i.set(l*p,a*h,l*g,a*c);break;case"ZYZ":i.set(l*g,l*p,a*h,a*c);break;default:Dt("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function _n(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 ne(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 ce={DEG2RAD:is,RAD2DEG:cs,generateUUID:$n,clamp:$t,euclideanModulo:Tc,mapLinear:Ap,inverseLerp:Rp,lerp:Gs,damp:Cp,pingpong:Ip,smoothstep:Pp,smootherstep:Lp,randInt:Dp,randFloat:Np,randFloatSpread:Up,seededRandom:Fp,degToRad:Bp,radToDeg:Op,isPowerOfTwo:zp,ceilPowerOfTwo:kp,floorPowerOfTwo:Hp,setQuaternionFromProperEuler:Vp,normalize:ne,denormalize:_n},Pc=class Pc{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=$t(this.x,t.x,e.x),this.y=$t(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=$t(this.x,t,e),this.y=$t(this.y,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar($t(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($t(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}};Pc.prototype.isVector2=!0;var Ht=Pc,Ce=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],p=r[o+1],g=r[o+2],_=r[o+3];if(d!==_||l!==u||c!==p||h!==g){let m=l*u+c*p+h*g+d*_;m<0&&(u=-u,p=-p,g=-g,_=-_,m=-m);let f=1-a;if(m<.9995){let M=Math.acos(m),E=Math.sin(M);f=Math.sin(f*M)/E,a=Math.sin(a*M)/E,l=l*f+u*a,c=c*f+p*a,h=h*f+g*a,d=d*f+_*a}else{l=l*f+u*a,c=c*f+p*a,h=h*f+g*a,d=d*f+_*a;let M=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=M,c*=M,h*=M,d*=M}}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],p=r[o+2],g=r[o+3];return t[e]=a*g+h*d+l*p-c*u,t[e+1]=l*g+h*u+c*d-a*p,t[e+2]=c*g+h*p+a*u-l*d,t[e+3]=h*g-a*d-l*u-c*p,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),p=l(s/2),g=l(r/2);switch(o){case"XYZ":this._x=u*h*d+c*p*g,this._y=c*p*d-u*h*g,this._z=c*h*g+u*p*d,this._w=c*h*d-u*p*g;break;case"YXZ":this._x=u*h*d+c*p*g,this._y=c*p*d-u*h*g,this._z=c*h*g-u*p*d,this._w=c*h*d+u*p*g;break;case"ZXY":this._x=u*h*d-c*p*g,this._y=c*p*d+u*h*g,this._z=c*h*g+u*p*d,this._w=c*h*d-u*p*g;break;case"ZYX":this._x=u*h*d-c*p*g,this._y=c*p*d+u*h*g,this._z=c*h*g-u*p*d,this._w=c*h*d+u*p*g;break;case"YZX":this._x=u*h*d+c*p*g,this._y=c*p*d+u*h*g,this._z=c*h*g-u*p*d,this._w=c*h*d-u*p*g;break;case"XZY":this._x=u*h*d-c*p*g,this._y=c*p*d-u*h*g,this._z=c*h*g+u*p*d,this._w=c*h*d+u*p*g;break;default:Dt("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 p=.5/Math.sqrt(u+1);this._w=.25/p,this._x=(h-l)*p,this._y=(r-c)*p,this._z=(o-s)*p}else if(n>a&&n>d){let p=2*Math.sqrt(1+n-a-d);this._w=(h-l)/p,this._x=.25*p,this._y=(s+o)/p,this._z=(r+c)/p}else if(a>d){let p=2*Math.sqrt(1+a-n-d);this._w=(r-c)/p,this._x=(s+o)/p,this._y=.25*p,this._z=(l+h)/p}else{let p=2*Math.sqrt(1+d-n-a);this._w=(o-s)/p,this._x=(r+c)/p,this._y=(l+h)/p,this._z=.25*p}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($t(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}},Lc=class Lc{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($h.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion($h.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=$t(this.x,t.x,e.x),this.y=$t(this.y,t.y,e.y),this.z=$t(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=$t(this.x,t,e),this.y=$t(this.y,t,e),this.z=$t(this.z,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar($t(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 Ml.copy(this).projectOnVector(t),this.sub(Ml)}reflect(t){return this.sub(Ml.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($t(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}};Lc.prototype.isVector3=!0;var I=Lc,Ml=new I,$h=new Ce,Dc=class Dc{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],p=n[5],g=n[8],_=s[0],m=s[3],f=s[6],M=s[1],E=s[4],b=s[7],v=s[2],S=s[5],A=s[8];return r[0]=o*_+a*M+l*v,r[3]=o*m+a*E+l*S,r[6]=o*f+a*b+l*A,r[1]=c*_+h*M+d*v,r[4]=c*m+h*E+d*S,r[7]=c*f+h*b+d*A,r[2]=u*_+p*M+g*v,r[5]=u*m+p*E+g*S,r[8]=u*f+p*b+g*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,p=c*r-o*l,g=e*d+n*u+s*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let _=1/g;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]=p*_,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 Ti("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Sl.makeScale(t,e)),this}rotate(t){return Ti("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Sl.makeRotation(-t)),this}translate(t,e){return Ti("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Sl.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)}};Dc.prototype.isMatrix3=!0;var Ot=Dc,Sl=new Ot,Zh=new Ot().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Jh=new Ot().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Gp(){let i={enabled:!0,workingColorSpace:Xs,spaces:{},convert:function(s,r,o){return this.enabled===!1||r===o||!r||!o||(this.spaces[r].transfer===te&&(s.r=Zn(s.r),s.g=Zn(s.g),s.b=Zn(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===te&&(s.r=ss(s.r),s.g=ss(s.g),s.b=ss(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===jn?qs: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 Ti("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return Ti("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({[Xs]:{primaries:t,whitePoint:n,transfer:qs,toXYZ:Zh,fromXYZ:Jh,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:Ae},outputColorSpaceConfig:{drawingBufferColorSpace:Ae}},[Ae]:{primaries:t,whitePoint:n,transfer:te,toXYZ:Zh,fromXYZ:Jh,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:Ae}}}),i}var Yt=Gp();function Zn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ss(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Gi,To=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{Gi===void 0&&(Gi=Ys("canvas")),Gi.width=t.width,Gi.height=t.height;let s=Gi.getContext("2d");t instanceof ImageData?s.putImageData(t,0,0):s.drawImage(t,0,0,t.width,t.height),n=Gi}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(El).x}get height(){return this.source.getSize(El).y}get depth(){return this.source.getSize(El).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){Dt(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){Dt(`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!==fc)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case os:t.x=t.x-Math.floor(t.x);break;case In:t.x=t.x<0?0:1;break;case wo: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 os:t.y=t.y-Math.floor(t.y);break;case In:t.y=t.y<0?0:1;break;case wo: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++}};ke.DEFAULT_IMAGE=null;ke.DEFAULT_MAPPING=fc;ke.DEFAULT_ANISOTROPY=1;var Nc=class Nc{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],p=l[5],g=l[9],_=l[2],m=l[6],f=l[10];if(Math.abs(h-u)<.01&&Math.abs(d-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+u)<.1&&Math.abs(d+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let E=(c+1)/2,b=(p+1)/2,v=(f+1)/2,S=(h+u)/4,A=(d+_)/4,x=(g+m)/4;return E>b&&E>v?E<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(E),s=S/n,r=A/n):b>v?b<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(b),n=S/s,r=x/s):v<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(v),n=A/r,s=x/r),this.set(n,s,r,e),this}let M=Math.sqrt((m-g)*(m-g)+(d-_)*(d-_)+(u-h)*(u-h));return Math.abs(M)<.001&&(M=1),this.x=(m-g)/M,this.y=(d-_)/M,this.z=(u-h)/M,this.w=Math.acos((c+p+f-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=$t(this.x,t.x,e.x),this.y=$t(this.y,t.y,e.y),this.z=$t(this.z,t.z,e.z),this.w=$t(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=$t(this.x,t,e),this.y=$t(this.y,t,e),this.z=$t(this.z,t,e),this.w=$t(this.w,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar($t(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}};Nc.prototype.isVector4=!0;var ae=Nc,Ao=class extends Ln{constructor(t=1,e=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ze,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 ae(0,0,t,e),this.scissorTest=!1,this.viewport=new ae(0,0,t,e),this.textures=[];let s={width:t,height:e,depth:n.depth},r=new ke(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),p.length>0&&(n.animations=p),g.length>0&&(n.nodes=g)}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;np+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&u<=p-g&&(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(jp)))}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]}},ad={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},si={h:0,s:0,l:0},Gr={h:0,s:0,l:0};function Al(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 Ft=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=Ae){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Yt.colorSpaceToWorking(this,e),this}setRGB(t,e,n,s=Yt.workingColorSpace){return this.r=t,this.g=e,this.b=n,Yt.colorSpaceToWorking(this,s),this}setHSL(t,e,n,s=Yt.workingColorSpace){if(t=Tc(t,1),e=$t(e,0,1),n=$t(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=Al(o,r,t+1/3),this.g=Al(o,r,t),this.b=Al(o,r,t-1/3)}return Yt.colorSpaceToWorking(this,s),this}setStyle(t,e=Ae){function n(r){r!==void 0&&parseFloat(r)<1&&Dt("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:Dt("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);Dt("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Ae){let n=ad[t.toLowerCase()];return n!==void 0?this.setHex(n,e):Dt("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=Zn(t.r),this.g=Zn(t.g),this.b=Zn(t.b),this}copyLinearToSRGB(t){return this.r=ss(t.r),this.g=ss(t.g),this.b=ss(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ae){return Yt.workingToColorSpace(Ye.copy(this),t),Math.round($t(Ye.r*255,0,255))*65536+Math.round($t(Ye.g*255,0,255))*256+Math.round($t(Ye.b*255,0,255))}getHexString(t=Ae){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Yt.workingColorSpace){Yt.workingToColorSpace(Ye.copy(this),e);let n=Ye.r,s=Ye.g,r=Ye.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){mn.subVectors(s,e),Gn.subVectors(n,e),Rl.subVectors(t,e);let o=mn.dot(mn),a=mn.dot(Gn),l=mn.dot(Rl),c=Gn.dot(Gn),h=Gn.dot(Rl),d=o*c-a*a;if(d===0)return r.set(0,0,0),null;let u=1/d,p=(c*l-a*h)*u,g=(o*h-a*l)*u;return r.set(1-p-g,g,p)}static containsPoint(t,e,n,s){return this.getBarycoord(t,e,n,s,Wn)===null?!1:Wn.x>=0&&Wn.y>=0&&Wn.x+Wn.y<=1}static getInterpolation(t,e,n,s,r,o,a,l){return this.getBarycoord(t,e,n,s,Wn)===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,Wn.x),l.addScaledVector(o,Wn.y),l.addScaledVector(a,Wn.z),l)}static getInterpolatedAttribute(t,e,n,s,r,o){return Ll.setScalar(0),Dl.setScalar(0),Nl.setScalar(0),Ll.fromBufferAttribute(t,e),Dl.fromBufferAttribute(t,n),Nl.fromBufferAttribute(t,s),o.setScalar(0),o.addScaledVector(Ll,r.x),o.addScaledVector(Dl,r.y),o.addScaledVector(Nl,r.z),o}static isFrontFacing(t,e,n,s){return mn.subVectors(n,e),Gn.subVectors(t,e),mn.cross(Gn).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 mn.subVectors(this.c,this.b),Gn.subVectors(this.a,this.b),mn.cross(Gn).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;Yi.subVectors(s,n),$i.subVectors(r,n),Cl.subVectors(t,n);let l=Yi.dot(Cl),c=$i.dot(Cl);if(l<=0&&c<=0)return e.copy(n);Il.subVectors(t,s);let h=Yi.dot(Il),d=$i.dot(Il);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(Yi,o);Pl.subVectors(t,r);let p=Yi.dot(Pl),g=$i.dot(Pl);if(g>=0&&p<=g)return e.copy(r);let _=p*c-l*g;if(_<=0&&c>=0&&g<=0)return a=c/(c-g),e.copy(n).addScaledVector($i,a);let m=h*g-p*d;if(m<=0&&d-h>=0&&p-g>=0)return su.subVectors(r,s),a=(d-h)/(d-h+(p-g)),e.copy(s).addScaledVector(su,a);let f=1/(m+_+u);return o=_*f,a=u*f,e.copy(n).addScaledVector(Yi,o).addScaledVector($i,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},ie=class{constructor(t=new I(1/0,1/0,1/0),e=new I(-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,gn),gn.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(Bs),Xr.subVectors(this.max,Bs),Zi.subVectors(t.a,Bs),Ji.subVectors(t.b,Bs),Ki.subVectors(t.c,Bs),ri.subVectors(Ji,Zi),oi.subVectors(Ki,Ji),Mi.subVectors(Zi,Ki);let e=[0,-ri.z,ri.y,0,-oi.z,oi.y,0,-Mi.z,Mi.y,ri.z,0,-ri.x,oi.z,0,-oi.x,Mi.z,0,-Mi.x,-ri.y,ri.x,0,-oi.y,oi.x,0,-Mi.y,Mi.x,0];return!Ul(e,Zi,Ji,Ki,Xr)||(e=[1,0,0,0,1,0,0,0,1],!Ul(e,Zi,Ji,Ki,Xr))?!1:(qr.crossVectors(ri,oi),e=[qr.x,qr.y,qr.z],Ul(e,Zi,Ji,Ki,Xr))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,gn).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(gn).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:(Xn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Xn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Xn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Xn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Xn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Xn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Xn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Xn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Xn),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}},Xn=[new I,new I,new I,new I,new I,new I,new I,new I],gn=new I,Wr=new ie,Zi=new I,Ji=new I,Ki=new I,ri=new I,oi=new I,Mi=new I,Bs=new I,Xr=new I,qr=new I,Si=new I;function Ul(i,t,e,n,s){for(let r=0,o=i.length-3;r<=o;r+=3){Si.fromArray(i,r);let a=s.x*Math.abs(Si.x)+s.y*Math.abs(Si.y)+s.z*Math.abs(Si.z),l=t.dot(Si),c=e.dot(Si),h=n.dot(Si);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}var Te=new I,Yr=new Ht,Qp=0,Se=class extends Ln{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:Qp++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=Sc,this.updateRanges=[],this.gpuType=Ge,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;Os.subVectors(t,this.center);let e=Os.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),s=(n-this.radius)*.5;this.center.addScaledVector(Os,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):(Fl.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Os.copy(t.center).add(Fl)),this.expandByPoint(Os.copy(t.center).sub(Fl))),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}},em=0,un=new kt,Bl=new Be,ji=new I,on=new ie,zs=new ie,Ne=new I,le=class i extends Ln{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:em++}),this.uuid=$n(),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(Ep(t)?Ks:Js)(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 Ot().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 un.makeRotationFromQuaternion(t),this.applyMatrix4(un),this}rotateX(t){return un.makeRotationX(t),this.applyMatrix4(un),this}rotateY(t){return un.makeRotationY(t),this.applyMatrix4(un),this}rotateZ(t){return un.makeRotationZ(t),this.applyMatrix4(un),this}translate(t,e,n){return un.makeTranslation(t,e,n),this.applyMatrix4(un),this}scale(t,e,n){return un.makeScale(t,e,n),this.applyMatrix4(un),this}lookAt(t){return Bl.lookAt(t),Bl.updateMatrix(),this.applyMatrix4(Bl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ji).negate(),this.translate(ji.x,ji.y,ji.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let n=[];for(let s=0,r=t.length;se.count&&Dt("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 ie);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Ut("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(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,p=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||im.getNormalMatrix(t),s=this.coplanarPoint(Ol).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}},sm=0,Dn=class extends Ln{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:sm++}),this.uuid=$n(),this.name="",this.type="Material",this.blending=ys,this.side=Bn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=sc,this.blendDst=rc,this.blendEquation=Ni,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ft(0,0,0),this.blendAlpha=0,this.depthFunc=rs,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ju,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=go,this.stencilZFail=go,this.stencilZPass=go,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){Dt(`Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){Dt(`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 Ft().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 _e().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 Ht().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 Ht().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 qn=new I,zl=new I,$r=new I,Zr=new I,Ri=class{constructor(t=new I,e=new I(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,qn)),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=qn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(qn.copy(this.origin).addScaledVector(this.direction,e),qn.distanceToSquared(t))}distanceSqToSegment(t,e,n,s){zl.copy(t).add(e).multiplyScalar(.5),$r.copy(e).sub(t).normalize(),Zr.copy(this.origin).sub(zl);let r=t.distanceTo(e)*.5,o=-this.direction.dot($r),a=Zr.dot(this.direction),l=-Zr.dot($r),c=Zr.lengthSq(),h=Math.abs(1-o*o),d,u,p,g;if(h>0)if(d=o*l-a,u=o*a-l,g=r*h,d>=0)if(u>=-g)if(u<=g){let _=1/h;d*=_,u*=_,p=d*(d+o*u+2*a)+u*(o*d+u+2*l)+c}else u=r,d=Math.max(0,-(o*u+a)),p=-d*d+u*(u+2*l)+c;else u=-r,d=Math.max(0,-(o*u+a)),p=-d*d+u*(u+2*l)+c;else u<=-g?(d=Math.max(0,-(-o*r+a)),u=d>0?-r:Math.min(Math.max(-r,-l),r),p=-d*d+u*(u+2*l)+c):u<=g?(d=0,u=Math.min(Math.max(-r,-l),r),p=u*(u+2*l)+c):(d=Math.max(0,-(o*r+a)),u=d>0?r:Math.min(Math.max(-r,-l),r),p=-d*d+u*(u+2*l)+c);else u=o>0?-r:r,d=Math.max(0,-(o*u+a)),p=-d*d+u*(u+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),s&&s.copy(zl).addScaledVector($r,u),p}intersectSphere(t,e){if(t.radius<0)return null;qn.subVectors(t.center,this.origin);let n=qn.dot(this.direction),s=qn.dot(qn)-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,qn)!==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,p=t.z-o.z,g=e.x-o.x,_=e.y-o.y,m=e.z-o.z,f=n.x-o.x,M=n.y-o.y,E=n.z-o.z,b=Math.abs(l),v=Math.abs(c),S=Math.abs(h),A,x,T,R,L,N,U,C,B,z,W,F;if(b>=v&&b>=S?(T=l,N=d,B=g,F=f,l>=0?(A=c,x=h,R=u,L=p,U=_,C=m,z=M,W=E):(A=h,x=c,R=p,L=u,U=m,C=_,z=E,W=M)):v>=S?(T=c,N=u,B=_,F=M,c>=0?(A=h,x=l,R=p,L=d,U=m,C=g,z=E,W=f):(A=l,x=h,R=d,L=p,U=g,C=m,z=f,W=E)):(T=h,N=p,B=m,F=E,h>=0?(A=l,x=c,R=d,L=u,U=g,C=_,z=f,W=M):(A=c,x=l,R=u,L=d,U=_,C=g,z=M,W=f)),T===0)return null;let D=A/T,X=x/T,Z=1/T,G=R-D*N,Q=L-X*N,lt=U-D*B,ct=C-X*B,et=z-D*F,V=W-X*F,j=et*ct-V*lt,ut=G*V-Q*et,Lt=lt*Q-ct*G;if(s){if(j<0||ut<0||Lt<0)return null}else if((j<0||ut<0||Lt<0)&&(j>0||ut>0||Lt>0))return null;let bt=j+ut+Lt;if(bt===0)return null;let Bt=Z*(j*N+ut*B+Lt*F);return(bt>0?Bt<0:Bt>0)?null:this.at(Bt/bt,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)}},en=class extends Dn{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ft(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 Jn,this.combine=Jo,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}},ru=new kt,wi=new Ri,Jr=new Oe,ou=new I,Kr=new I,jr=new I,Qr=new I,kl=new I,to=new I,au=new I,eo=new I,xe=class extends Be{constructor(t=new le,e=new en){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))&&(ru.copy(r).invert(),wi.copy(t.ray).applyMatrix4(ru),!(n.boundingBox!==null&&wi.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,wi)))}_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,p=r.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,_=u.length;g<_;g++){let m=u[g],f=o[m.materialIndex],M=Math.max(m.start,p.start),E=Math.min(a.count,Math.min(m.start+m.count,p.start+p.count));for(let b=M,v=E;be.far?null:{distance:c,point:eo.clone(),object:i}}function no(i,t,e,n,s,r,o,a,l,c){i.getVertexPosition(a,Kr),i.getVertexPosition(l,jr),i.getVertexPosition(c,Qr);let h=rm(i,t,e,n,Kr,jr,Qr,au);if(h){let d=new I;Yn.getBarycoord(au,Kr,jr,Qr,d),s&&(h.uv=Yn.getInterpolatedAttribute(s,a,l,c,d,new Ht)),r&&(h.uv1=Yn.getInterpolatedAttribute(r,a,l,c,d,new Ht)),o&&(h.normal=Yn.getInterpolatedAttribute(o,a,l,c,d,new I),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let u={a,b:l,c,normal:new I,materialIndex:0};Yn.getNormal(Kr,jr,Qr,u.normal),h.face=u,h.barycoord=d}return h}var Nn=class extends ke{constructor(t=null,e=1,n=1,s,r,o,a,l,c=Ue,h=Ue,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 Kn=class extends Se{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}},Qi=new kt,lu=new kt,io=[],cu=new ie,om=new kt,ks=new xe,Hs=new Oe,ps=class extends xe{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Kn(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,so.y=s.normal.y>0?t.max.y:t.min.y,so.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(so)<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 an=class extends Dn{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ft(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}},Io=new I,Po=new I,hu=new kt,Vs=new Ri,ro=new Oe,Hl=new I,uu=new I,Ci=class extends Be{constructor(t=new le,e=new an){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;Hl.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(Hl);if(!(ct.far))return{distance:c,point:uu.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var du=new I,fu=new I,vn=class extends Ci{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 Qs=class extends ke{constructor(t=[],e=fi,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}},tr=class extends ke{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 ci=class extends ke{constructor(t,e,n=Mn,s,r,o,a=Ue,l=Ue,c,h=Pn,d=1){if(h!==Pn&&h!==mi)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 hs(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return e.compareFunction=this.compareFunction,e}},Lo=class extends ci{constructor(t,e=Mn,n=fi,s,r,o=Ue,a=Ue,l,c=Pn){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}},er=class extends ke{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}},dn=class i extends le{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,p=0;g("z","y","x",-1,-1,n,e,t,o,r,0),g("z","y","x",1,-1,n,e,-t,o,r,1),g("x","z","y",1,1,t,n,e,s,o,2),g("x","z","y",1,-1,t,n,-e,s,o,3),g("x","y","z",1,-1,t,e,n,s,r,4),g("x","y","z",-1,-1,t,e,-n,s,r,5),this.setIndex(l),this.setAttribute("position",new fe(c,3)),this.setAttribute("normal",new fe(h,3)),this.setAttribute("uv",new fe(d,2));function g(_,m,f,M,E,b,v,S,A,x,T){let R=b/A,L=v/x,N=b/2,U=v/2,C=S/2,B=A+1,z=x+1,W=0,F=0,D=new I;for(let X=0;X0?1:-1,h.push(D.x,D.y,D.z),d.push(G/A),d.push(1-X/x),W+=1}}for(let X=0;X0&&E(!0),e>0&&E(!1)),this.setIndex(h),this.setAttribute("position",new fe(d,3)),this.setAttribute("normal",new fe(u,3)),this.setAttribute("uv",new fe(p,2));function M(){let b=new I,v=new I,S=0,A=(e-t)/n;for(let x=0;x<=r;x++){let T=[],R=x/r,L=R*(e-t)+t;for(let N=0;N<=s;N++){let U=N/s,C=U*l+a,B=Math.sin(C),z=Math.cos(C);v.x=L*B,v.y=-R*n+m,v.z=L*z,d.push(v.x,v.y,v.z),b.set(B,A,z).normalize(),u.push(b.x,b.y,b.z),p.push(U,1-R),T.push(g++)}_.push(T)}for(let x=0;x0||T!==0)&&(h.push(R,L,U),S+=3),(e>0||T!==r-1)&&(h.push(L,N,U),S+=3)}c.addGroup(f,S,0),f+=S}function E(b){let v=g,S=new Ht,A=new I,x=0,T=b===!0?t:e,R=b===!0?1:-1;for(let N=1;N<=s;N++)d.push(0,m*R,0),u.push(0,R,0),p.push(.5,.5),g++;let L=g;for(let N=0;N<=s;N++){let C=N/s*l+a,B=Math.cos(C),z=Math.sin(C);A.x=T*z,A.y=m*R,A.z=T*B,d.push(A.x,A.y,A.z),u.push(0,R,0),S.x=B*.5+.5,S.y=z*.5*R+.5,p.push(S.x,S.y),g++}for(let N=0;N0)&&p.push(E,b,S),(f!==n-1||l{var Yh=i=>{throw TypeError(i)};var bl=(i,e,t)=>e.has(i)||Yh("Cannot "+t);var ni=(i,e,t)=>(bl(i,e,"read from private field"),t?t.call(i):e.get(i)),Ml=(i,e,t)=>e.has(i)?Yh("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),$h=(i,e,t,n)=>(bl(i,e,"write to private field"),n?n.call(i,t):e.set(i,t),t),Vr=(i,e,t)=>(bl(i,e,"access private method"),t);var Au=0,tc=1,Ru=2;var hr=1,Cu=2,ys=3,Bn=0,Ht=1,It=2,On=0,bs=1,nc=2,ic=3,sc=4,Iu=5;var Ui=100,Pu=101,Lu=102,Du=103,Nu=104,Uu=200,Fu=201,Bu=202,Ou=203,rc=204,oc=205,zu=206,ku=207,Vu=208,Hu=209,Gu=210,Wu=211,Xu=212,qu=213,Yu=214,xo=0,vo=1,yo=2,os=3,bo=4,Mo=5,So=6,wo=7,Ko=0,$u=1,Zu=2,bn=0,ac=1,lc=2,cc=3,hc=4,uc=5,dc=6,fc=7;var pc=300,fi=301,Fi=302,jo=303,Qo=304,ur=306,as=1e3,In=1001,Eo=1002,Ut=1003,Ju=1004;var dr=1005;var zt=1006,ea=1007;var pi=1008;var nn=1009,mc=1010,gc=1011,Ms=1012,ta=1013,Mn=1014,Gt=1015,Sn=1016,na=1017,ia=1018,Ss=1020,_c=35902,xc=35899,vc=1021,yc=1022,sn=1023,Pn=1026,mi=1027,ws=1028,sa=1029,gi=1030,ra=1031;var oa=1033,fr=33776,pr=33777,mr=33778,gr=33779,aa=35840,la=35841,ca=35842,ha=35843,ua=36196,da=37492,fa=37496,pa=37488,ma=37489,_r=37490,ga=37491,_a=37808,xa=37809,va=37810,ya=37811,ba=37812,Ma=37813,Sa=37814,wa=37815,Ea=37816,Ta=37817,Aa=37818,Ra=37819,Ca=37820,Ia=37821,Pa=36492,La=36494,Da=36495,Na=36283,Ua=36284,xr=36285,Fa=36286;var Xs=2300,To=2301,go=2302,ql=2303,Yl=2400,$l=2401,Zl=2402;var Ku=3200;var Ba=0,ju=1,jn="",At="srgb",qs="srgb-linear",Ys="linear",et="srgb";var _o=7680;var bc=34055,Mc=34056;var Sc=517;var Qu=519,ed=512,td=513,nd=514,Oa=515,id=516,sd=517,za=518,rd=519,wc=35044,Ec=35048;var Tc="300 es",xn=2e3,ls=2001;function Bp(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Op(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function $s(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function od(){let i=$s("canvas");return i.style.display="block",i}var Zh={},cs=null;function Zs(...i){let e="THREE."+i.shift();cs?cs("log",e,...i):console.log(e,...i)}function ad(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 De(...i){i=ad(i);let e="THREE."+i.shift();if(cs)cs("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ue(...i){i=ad(i);let e="THREE."+i.shift();if(cs)cs("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Ai(...i){let e=i.join(" ");e in Zh||(Zh[e]=!0,De(...i))}function ld(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 cd={[xo]:vo,[yo]:So,[bo]:wo,[os]:Mo,[vo]:xo,[So]:yo,[wo]:bo,[Mo]:os},Ln=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]+qt[i>>16&255]+qt[i>>24&255]+"-"+qt[e&255]+qt[e>>8&255]+"-"+qt[e>>16&15|64]+qt[e>>24&255]+"-"+qt[t&63|128]+qt[t>>8&255]+"-"+qt[t>>16&255]+qt[t>>24&255]+qt[n&255]+qt[n>>8&255]+qt[n>>16&255]+qt[n>>24&255]).toLowerCase()}function $e(i,e,t){return Math.max(e,Math.min(t,i))}function Ac(i,e){return(i%e+e)%e}function zp(i,e,t,n,s){return n+(i-e)*(s-n)/(t-e)}function kp(i,e,t){return i!==e?(t-i)/(e-i):0}function Ws(i,e,t){return(1-t)*i+t*e}function Vp(i,e,t,n){return Ws(i,e,1-Math.exp(-t*n))}function Hp(i,e=1){return e-Math.abs(Ac(i,e*2)-e)}function Gp(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Wp(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Xp(i,e){return i+Math.floor(Math.random()*(e-i+1))}function qp(i,e){return i+Math.random()*(e-i)}function Yp(i){return i*(.5-Math.random())}function $p(i){i!==void 0&&(Jh=i);let e=Jh+=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 Zp(i){return i*ss}function Jp(i){return i*hs}function Kp(i){return i>0&&Number.isInteger(i)&&2**Math.round(Math.log2(i))===i}function jp(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Qp(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function em(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),p=r((n-e)/2),g=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*g,l*p,a*c);break;case"YXY":i.set(l*p,a*h,l*g,a*c);break;case"ZYZ":i.set(l*g,l*p,a*h,a*c);break;default:De("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function _n(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 nt(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 ct={DEG2RAD:ss,RAD2DEG:hs,generateUUID:$n,clamp:$e,euclideanModulo:Ac,mapLinear:zp,inverseLerp:kp,lerp:Ws,damp:Vp,pingpong:Hp,smoothstep:Gp,smootherstep:Wp,randInt:Xp,randFloat:qp,randFloatSpread:Yp,seededRandom:$p,degToRad:Zp,radToDeg:Jp,isPowerOfTwo:Kp,ceilPowerOfTwo:jp,floorPowerOfTwo:Qp,setQuaternionFromProperEuler:em,normalize:nt,denormalize:_n},Lc=class Lc{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=$e(this.x,e.x,t.x),this.y=$e(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=$e(this.x,e,t),this.y=$e(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar($e(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($e(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}};Lc.prototype.isVector2=!0;var Ve=Lc,Ct=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],p=r[o+1],g=r[o+2],_=r[o+3];if(d!==_||l!==u||c!==p||h!==g){let m=l*u+c*p+h*g+d*_;m<0&&(u=-u,p=-p,g=-g,_=-_,m=-m);let f=1-a;if(m<.9995){let M=Math.acos(m),E=Math.sin(M);f=Math.sin(f*M)/E,a=Math.sin(a*M)/E,l=l*f+u*a,c=c*f+p*a,h=h*f+g*a,d=d*f+_*a}else{l=l*f+u*a,c=c*f+p*a,h=h*f+g*a,d=d*f+_*a;let M=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=M,c*=M,h*=M,d*=M}}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],p=r[o+2],g=r[o+3];return e[t]=a*g+h*d+l*p-c*u,e[t+1]=l*g+h*u+c*d-a*p,e[t+2]=c*g+h*p+a*u-l*d,e[t+3]=h*g-a*d-l*u-c*p,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),p=l(s/2),g=l(r/2);switch(o){case"XYZ":this._x=u*h*d+c*p*g,this._y=c*p*d-u*h*g,this._z=c*h*g+u*p*d,this._w=c*h*d-u*p*g;break;case"YXZ":this._x=u*h*d+c*p*g,this._y=c*p*d-u*h*g,this._z=c*h*g-u*p*d,this._w=c*h*d+u*p*g;break;case"ZXY":this._x=u*h*d-c*p*g,this._y=c*p*d+u*h*g,this._z=c*h*g+u*p*d,this._w=c*h*d-u*p*g;break;case"ZYX":this._x=u*h*d-c*p*g,this._y=c*p*d+u*h*g,this._z=c*h*g-u*p*d,this._w=c*h*d+u*p*g;break;case"YZX":this._x=u*h*d+c*p*g,this._y=c*p*d+u*h*g,this._z=c*h*g-u*p*d,this._w=c*h*d-u*p*g;break;case"XZY":this._x=u*h*d-c*p*g,this._y=c*p*d-u*h*g,this._z=c*h*g+u*p*d,this._w=c*h*d+u*p*g;break;default:De("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 p=.5/Math.sqrt(u+1);this._w=.25/p,this._x=(h-l)*p,this._y=(r-c)*p,this._z=(o-s)*p}else if(n>a&&n>d){let p=2*Math.sqrt(1+n-a-d);this._w=(h-l)/p,this._x=.25*p,this._y=(s+o)/p,this._z=(r+c)/p}else if(a>d){let p=2*Math.sqrt(1+a-n-d);this._w=(r-c)/p,this._x=(s+o)/p,this._y=.25*p,this._z=(l+h)/p}else{let p=2*Math.sqrt(1+d-n-a);this._w=(o-s)/p,this._x=(r+c)/p,this._y=(l+h)/p,this._z=.25*p}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($e(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}},Dc=class Dc{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(Kh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Kh.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=$e(this.x,e.x,t.x),this.y=$e(this.y,e.y,t.y),this.z=$e(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=$e(this.x,e,t),this.y=$e(this.y,e,t),this.z=$e(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar($e(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 Sl.copy(this).projectOnVector(e),this.sub(Sl)}reflect(e){return this.sub(Sl.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($e(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}};Dc.prototype.isVector3=!0;var I=Dc,Sl=new I,Kh=new Ct,Nc=class Nc{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],p=n[5],g=n[8],_=s[0],m=s[3],f=s[6],M=s[1],E=s[4],b=s[7],v=s[2],S=s[5],A=s[8];return r[0]=o*_+a*M+l*v,r[3]=o*m+a*E+l*S,r[6]=o*f+a*b+l*A,r[1]=c*_+h*M+d*v,r[4]=c*m+h*E+d*S,r[7]=c*f+h*b+d*A,r[2]=u*_+p*M+g*v,r[5]=u*m+p*E+g*S,r[8]=u*f+p*b+g*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,p=c*r-o*l,g=t*d+n*u+s*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let _=1/g;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]=p*_,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 Ai("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(wl.makeScale(e,t)),this}rotate(e){return Ai("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(wl.makeRotation(-e)),this}translate(e,t){return Ai("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(wl.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)}};Nc.prototype.isMatrix3=!0;var Oe=Nc,wl=new Oe,jh=new Oe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Qh=new Oe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function tm(){let i={enabled:!0,workingColorSpace:qs,spaces:{},convert:function(s,r,o){return this.enabled===!1||r===o||!r||!o||(this.spaces[r].transfer===et&&(s.r=Zn(s.r),s.g=Zn(s.g),s.b=Zn(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===et&&(s.r=rs(s.r),s.g=rs(s.g),s.b=rs(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===jn?Ys: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 Ai("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return Ai("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({[qs]:{primaries:e,whitePoint:n,transfer:Ys,toXYZ:jh,fromXYZ:Qh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:At},outputColorSpaceConfig:{drawingBufferColorSpace:At}},[At]:{primaries:e,whitePoint:n,transfer:et,toXYZ:jh,fromXYZ:Qh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:At}}}),i}var Ye=tm();function Zn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function rs(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Wi,Ao=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{Wi===void 0&&(Wi=$s("canvas")),Wi.width=e.width,Wi.height=e.height;let s=Wi.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),n=Wi}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=$s("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(Tl).x}get height(){return this.source.getSize(Tl).y}get depth(){return this.source.getSize(Tl).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){De(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let s=this[t];if(s===void 0){De(`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!==pc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case as:e.x=e.x-Math.floor(e.x);break;case In:e.x=e.x<0?0:1;break;case Eo: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 as:e.y=e.y-Math.floor(e.y);break;case In:e.y=e.y<0?0:1;break;case Eo: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++}};kt.DEFAULT_IMAGE=null;kt.DEFAULT_MAPPING=pc;kt.DEFAULT_ANISOTROPY=1;var Uc=class Uc{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],p=l[5],g=l[9],_=l[2],m=l[6],f=l[10];if(Math.abs(h-u)<.01&&Math.abs(d-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+u)<.1&&Math.abs(d+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let E=(c+1)/2,b=(p+1)/2,v=(f+1)/2,S=(h+u)/4,A=(d+_)/4,x=(g+m)/4;return E>b&&E>v?E<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(E),s=S/n,r=A/n):b>v?b<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(b),n=S/s,r=x/s):v<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(v),n=A/r,s=x/r),this.set(n,s,r,t),this}let M=Math.sqrt((m-g)*(m-g)+(d-_)*(d-_)+(u-h)*(u-h));return Math.abs(M)<.001&&(M=1),this.x=(m-g)/M,this.y=(d-_)/M,this.z=(u-h)/M,this.w=Math.acos((c+p+f-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=$e(this.x,e.x,t.x),this.y=$e(this.y,e.y,t.y),this.z=$e(this.z,e.z,t.z),this.w=$e(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=$e(this.x,e,t),this.y=$e(this.y,e,t),this.z=$e(this.z,e,t),this.w=$e(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar($e(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}};Uc.prototype.isVector4=!0;var at=Uc,Ro=class extends Ln{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:zt,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 at(0,0,e,t),this.scissorTest=!1,this.viewport=new at(0,0,e,t),this.textures=[];let s={width:e,height:t,depth:n.depth},r=new kt(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),p.length>0&&(n.animations=p),g.length>0&&(n.nodes=g)}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;np+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&u<=p-g&&(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(hm)))}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]}},hd={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},si={h:0,s:0,l:0},Wr={h:0,s:0,l:0};function Rl(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 Fe=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=At){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ye.colorSpaceToWorking(this,t),this}setRGB(e,t,n,s=Ye.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ye.colorSpaceToWorking(this,s),this}setHSL(e,t,n,s=Ye.workingColorSpace){if(e=Ac(e,1),t=$e(t,0,1),n=$e(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=Rl(o,r,e+1/3),this.g=Rl(o,r,e),this.b=Rl(o,r,e-1/3)}return Ye.colorSpaceToWorking(this,s),this}setStyle(e,t=At){function n(r){r!==void 0&&parseFloat(r)<1&&De("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:De("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);De("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=At){let n=hd[e.toLowerCase()];return n!==void 0?this.setHex(n,t):De("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=Zn(e.r),this.g=Zn(e.g),this.b=Zn(e.b),this}copyLinearToSRGB(e){return this.r=rs(e.r),this.g=rs(e.g),this.b=rs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=At){return Ye.workingToColorSpace(Yt.copy(this),e),Math.round($e(Yt.r*255,0,255))*65536+Math.round($e(Yt.g*255,0,255))*256+Math.round($e(Yt.b*255,0,255))}getHexString(e=At){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ye.workingColorSpace){Ye.workingToColorSpace(Yt.copy(this),t);let n=Yt.r,s=Yt.g,r=Yt.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){mn.subVectors(s,t),Gn.subVectors(n,t),Cl.subVectors(e,t);let o=mn.dot(mn),a=mn.dot(Gn),l=mn.dot(Cl),c=Gn.dot(Gn),h=Gn.dot(Cl),d=o*c-a*a;if(d===0)return r.set(0,0,0),null;let u=1/d,p=(c*l-a*h)*u,g=(o*h-a*l)*u;return r.set(1-p-g,g,p)}static containsPoint(e,t,n,s){return this.getBarycoord(e,t,n,s,Wn)===null?!1:Wn.x>=0&&Wn.y>=0&&Wn.x+Wn.y<=1}static getInterpolation(e,t,n,s,r,o,a,l){return this.getBarycoord(e,t,n,s,Wn)===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,Wn.x),l.addScaledVector(o,Wn.y),l.addScaledVector(a,Wn.z),l)}static getInterpolatedAttribute(e,t,n,s,r,o){return Dl.setScalar(0),Nl.setScalar(0),Ul.setScalar(0),Dl.fromBufferAttribute(e,t),Nl.fromBufferAttribute(e,n),Ul.fromBufferAttribute(e,s),o.setScalar(0),o.addScaledVector(Dl,r.x),o.addScaledVector(Nl,r.y),o.addScaledVector(Ul,r.z),o}static isFrontFacing(e,t,n,s){return mn.subVectors(n,t),Gn.subVectors(e,t),mn.cross(Gn).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 mn.subVectors(this.c,this.b),Gn.subVectors(this.a,this.b),mn.cross(Gn).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;$i.subVectors(s,n),Zi.subVectors(r,n),Il.subVectors(e,n);let l=$i.dot(Il),c=Zi.dot(Il);if(l<=0&&c<=0)return t.copy(n);Pl.subVectors(e,s);let h=$i.dot(Pl),d=Zi.dot(Pl);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($i,o);Ll.subVectors(e,r);let p=$i.dot(Ll),g=Zi.dot(Ll);if(g>=0&&p<=g)return t.copy(r);let _=p*c-l*g;if(_<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(n).addScaledVector(Zi,a);let m=h*g-p*d;if(m<=0&&d-h>=0&&p-g>=0)return au.subVectors(r,s),a=(d-h)/(d-h+(p-g)),t.copy(s).addScaledVector(au,a);let f=1/(m+_+u);return o=_*f,a=u*f,t.copy(n).addScaledVector($i,o).addScaledVector(Zi,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},it=class{constructor(e=new I(1/0,1/0,1/0),t=new I(-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,gn),gn.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(Os),qr.subVectors(this.max,Os),Ji.subVectors(e.a,Os),Ki.subVectors(e.b,Os),ji.subVectors(e.c,Os),ri.subVectors(Ki,Ji),oi.subVectors(ji,Ki),Si.subVectors(Ji,ji);let t=[0,-ri.z,ri.y,0,-oi.z,oi.y,0,-Si.z,Si.y,ri.z,0,-ri.x,oi.z,0,-oi.x,Si.z,0,-Si.x,-ri.y,ri.x,0,-oi.y,oi.x,0,-Si.y,Si.x,0];return!Fl(t,Ji,Ki,ji,qr)||(t=[1,0,0,0,1,0,0,0,1],!Fl(t,Ji,Ki,ji,qr))?!1:(Yr.crossVectors(ri,oi),t=[Yr.x,Yr.y,Yr.z],Fl(t,Ji,Ki,ji,qr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,gn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(gn).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:(Xn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Xn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Xn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Xn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Xn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Xn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Xn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Xn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Xn),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}},Xn=[new I,new I,new I,new I,new I,new I,new I,new I],gn=new I,Xr=new it,Ji=new I,Ki=new I,ji=new I,ri=new I,oi=new I,Si=new I,Os=new I,qr=new I,Yr=new I,wi=new I;function Fl(i,e,t,n,s){for(let r=0,o=i.length-3;r<=o;r+=3){wi.fromArray(i,r);let a=s.x*Math.abs(wi.x)+s.y*Math.abs(wi.y)+s.z*Math.abs(wi.z),l=e.dot(wi),c=t.dot(wi),h=n.dot(wi);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}var Tt=new I,$r=new Ve,um=0,St=class extends Ln{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:um++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=wc,this.updateRanges=[],this.gpuType=Gt,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;zs.subVectors(e,this.center);let t=zs.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),s=(n-this.radius)*.5;this.center.addScaledVector(zs,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):(Bl.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(zs.copy(e.center).add(Bl)),this.expandByPoint(zs.copy(e.center).sub(Bl))),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}},fm=0,un=new ke,Ol=new Bt,Qi=new I,on=new it,ks=new it,Nt=new I,lt=class i extends Ln{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:fm++}),this.uuid=$n(),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(Bp(e)?js:Ks)(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 Oe().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 un.makeRotationFromQuaternion(e),this.applyMatrix4(un),this}rotateX(e){return un.makeRotationX(e),this.applyMatrix4(un),this}rotateY(e){return un.makeRotationY(e),this.applyMatrix4(un),this}rotateZ(e){return un.makeRotationZ(e),this.applyMatrix4(un),this}translate(e,t,n){return un.makeTranslation(e,t,n),this.applyMatrix4(un),this}scale(e,t,n){return un.makeScale(e,t,n),this.applyMatrix4(un),this}lookAt(e){return Ol.lookAt(e),Ol.updateMatrix(),this.applyMatrix4(Ol.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Qi).negate(),this.translate(Qi.x,Qi.y,Qi.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let s=0,r=e.length;st.count&&De("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 it);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ue("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(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,p=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||mm.getNormalMatrix(e),s=this.coplanarPoint(zl).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}},gm=0,Dn=class extends Ln{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:gm++}),this.uuid=$n(),this.name="",this.type="Material",this.blending=bs,this.side=Bn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=rc,this.blendDst=oc,this.blendEquation=Ui,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Fe(0,0,0),this.blendAlpha=0,this.depthFunc=os,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Qu,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=_o,this.stencilZFail=_o,this.stencilZPass=_o,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){De(`Material: parameter '${t}' has value of undefined.`);continue}let s=this[t];if(s===void 0){De(`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 Fe().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 _t().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 Ve().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 Ve().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 qn=new I,kl=new I,Zr=new I,Jr=new I,Ci=class{constructor(e=new I,t=new I(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,qn)),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=qn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(qn.copy(this.origin).addScaledVector(this.direction,t),qn.distanceToSquared(e))}distanceSqToSegment(e,t,n,s){kl.copy(e).add(t).multiplyScalar(.5),Zr.copy(t).sub(e).normalize(),Jr.copy(this.origin).sub(kl);let r=e.distanceTo(t)*.5,o=-this.direction.dot(Zr),a=Jr.dot(this.direction),l=-Jr.dot(Zr),c=Jr.lengthSq(),h=Math.abs(1-o*o),d,u,p,g;if(h>0)if(d=o*l-a,u=o*a-l,g=r*h,d>=0)if(u>=-g)if(u<=g){let _=1/h;d*=_,u*=_,p=d*(d+o*u+2*a)+u*(o*d+u+2*l)+c}else u=r,d=Math.max(0,-(o*u+a)),p=-d*d+u*(u+2*l)+c;else u=-r,d=Math.max(0,-(o*u+a)),p=-d*d+u*(u+2*l)+c;else u<=-g?(d=Math.max(0,-(-o*r+a)),u=d>0?-r:Math.min(Math.max(-r,-l),r),p=-d*d+u*(u+2*l)+c):u<=g?(d=0,u=Math.min(Math.max(-r,-l),r),p=u*(u+2*l)+c):(d=Math.max(0,-(o*r+a)),u=d>0?r:Math.min(Math.max(-r,-l),r),p=-d*d+u*(u+2*l)+c);else u=o>0?-r:r,d=Math.max(0,-(o*u+a)),p=-d*d+u*(u+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),s&&s.copy(kl).addScaledVector(Zr,u),p}intersectSphere(e,t){if(e.radius<0)return null;qn.subVectors(e.center,this.origin);let n=qn.dot(this.direction),s=qn.dot(qn)-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,qn)!==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,p=e.z-o.z,g=t.x-o.x,_=t.y-o.y,m=t.z-o.z,f=n.x-o.x,M=n.y-o.y,E=n.z-o.z,b=Math.abs(l),v=Math.abs(c),S=Math.abs(h),A,x,T,R,L,N,U,C,B,z,W,F;if(b>=v&&b>=S?(T=l,N=d,B=g,F=f,l>=0?(A=c,x=h,R=u,L=p,U=_,C=m,z=M,W=E):(A=h,x=c,R=p,L=u,U=m,C=_,z=E,W=M)):v>=S?(T=c,N=u,B=_,F=M,c>=0?(A=h,x=l,R=p,L=d,U=m,C=g,z=E,W=f):(A=l,x=h,R=d,L=p,U=g,C=m,z=f,W=E)):(T=h,N=p,B=m,F=E,h>=0?(A=l,x=c,R=d,L=u,U=g,C=_,z=f,W=M):(A=c,x=l,R=u,L=d,U=_,C=g,z=M,W=f)),T===0)return null;let D=A/T,X=x/T,Z=1/T,G=R-D*N,Q=L-X*N,le=U-D*B,ce=C-X*B,te=z-D*F,H=W-X*F,j=te*ce-H*le,ue=G*H-Q*te,Le=le*Q-ce*G;if(s){if(j<0||ue<0||Le<0)return null}else if((j<0||ue<0||Le<0)&&(j>0||ue>0||Le>0))return null;let be=j+ue+Le;if(be===0)return null;let Be=Z*(j*N+ue*B+Le*F);return(be>0?Be<0:Be>0)?null:this.at(Be/be,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)}},tn=class extends Dn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Fe(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 Jn,this.combine=Ko,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}},lu=new ke,Ei=new Ci,Kr=new Ot,cu=new I,jr=new I,Qr=new I,eo=new I,Vl=new I,to=new I,hu=new I,no=new I,xt=class extends Bt{constructor(e=new lt,t=new tn){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))&&(lu.copy(r).invert(),Ei.copy(e.ray).applyMatrix4(lu),!(n.boundingBox!==null&&Ei.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ei)))}_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,p=r.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,_=u.length;g<_;g++){let m=u[g],f=o[m.materialIndex],M=Math.max(m.start,p.start),E=Math.min(a.count,Math.min(m.start+m.count,p.start+p.count));for(let b=M,v=E;bt.far?null:{distance:c,point:no.clone(),object:i}}function io(i,e,t,n,s,r,o,a,l,c){i.getVertexPosition(a,jr),i.getVertexPosition(l,Qr),i.getVertexPosition(c,eo);let h=_m(i,e,t,n,jr,Qr,eo,hu);if(h){let d=new I;Yn.getBarycoord(hu,jr,Qr,eo,d),s&&(h.uv=Yn.getInterpolatedAttribute(s,a,l,c,d,new Ve)),r&&(h.uv1=Yn.getInterpolatedAttribute(r,a,l,c,d,new Ve)),o&&(h.normal=Yn.getInterpolatedAttribute(o,a,l,c,d,new I),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let u={a,b:l,c,normal:new I,materialIndex:0};Yn.getNormal(jr,Qr,eo,u.normal),h.face=u,h.barycoord=d}return h}var Nn=class extends kt{constructor(e=null,t=1,n=1,s,r,o,a,l,c=Ut,h=Ut,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 Kn=class extends St{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}},es=new ke,uu=new ke,so=[],du=new it,xm=new ke,Vs=new xt,Hs=new Ot,ms=class extends xt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Kn(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,ro.y=s.normal.y>0?e.max.y:e.min.y,ro.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(ro)<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 an=class extends Dn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Fe(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}},Po=new I,Lo=new I,fu=new ke,Gs=new Ci,oo=new Ot,Hl=new I,pu=new I,Ii=class extends Bt{constructor(e=new lt,t=new an){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;Hl.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(Hl);if(!(ce.far))return{distance:c,point:pu.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var mu=new I,gu=new I,vn=class extends Ii{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 er=class extends kt{constructor(e=[],t=fi,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}},tr=class extends kt{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 ci=class extends kt{constructor(e,t,n=Mn,s,r,o,a=Ut,l=Ut,c,h=Pn,d=1){if(h!==Pn&&h!==mi)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 us(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}},Do=class extends ci{constructor(e,t=Mn,n=fi,s,r,o=Ut,a=Ut,l,c=Pn){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}},nr=class extends kt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},dn=class i extends lt{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,p=0;g("z","y","x",-1,-1,n,t,e,o,r,0),g("z","y","x",1,-1,n,t,-e,o,r,1),g("x","z","y",1,1,e,n,t,s,o,2),g("x","z","y",1,-1,e,n,-t,s,o,3),g("x","y","z",1,-1,e,t,n,s,r,4),g("x","y","z",-1,-1,e,t,-n,s,r,5),this.setIndex(l),this.setAttribute("position",new ft(c,3)),this.setAttribute("normal",new ft(h,3)),this.setAttribute("uv",new ft(d,2));function g(_,m,f,M,E,b,v,S,A,x,T){let R=b/A,L=v/x,N=b/2,U=v/2,C=S/2,B=A+1,z=x+1,W=0,F=0,D=new I;for(let X=0;X0?1:-1,h.push(D.x,D.y,D.z),d.push(G/A),d.push(1-X/x),W+=1}}for(let X=0;X0&&E(!0),t>0&&E(!1)),this.setIndex(h),this.setAttribute("position",new ft(d,3)),this.setAttribute("normal",new ft(u,3)),this.setAttribute("uv",new ft(p,2));function M(){let b=new I,v=new I,S=0,A=(t-e)/n;for(let x=0;x<=r;x++){let T=[],R=x/r,L=R*(t-e)+e;for(let N=0;N<=s;N++){let U=N/s,C=U*l+a,B=Math.sin(C),z=Math.cos(C);v.x=L*B,v.y=-R*n+m,v.z=L*z,d.push(v.x,v.y,v.z),b.set(B,A,z).normalize(),u.push(b.x,b.y,b.z),p.push(U,1-R),T.push(g++)}_.push(T)}for(let x=0;x0||T!==0)&&(h.push(R,L,U),S+=3),(t>0||T!==r-1)&&(h.push(L,N,U),S+=3)}c.addGroup(f,S,0),f+=S}function E(b){let v=g,S=new Ve,A=new I,x=0,T=b===!0?e:t,R=b===!0?1:-1;for(let N=1;N<=s;N++)d.push(0,m*R,0),u.push(0,R,0),p.push(.5,.5),g++;let L=g;for(let N=0;N<=s;N++){let C=N/s*l+a,B=Math.cos(C),z=Math.sin(C);A.x=T*z,A.y=m*R,A.z=T*B,d.push(A.x,A.y,A.z),u.push(0,R,0),S.x=B*.5+.5,S.y=z*.5*R+.5,p.push(S.x,S.y),g++}for(let N=0;N0)&&p.push(E,b,S),(f!==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 Ft().setHex(s.value);break;case"v2":this.uniforms[n].value=new Ht().fromArray(s.value);break;case"v3":this.uniforms[n].value=new I().fromArray(s.value);break;case"v4":this.uniforms[n].value=new ae().fromArray(s.value);break;case"m3":this.uniforms[n].value=new Ot().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}},Do=class extends He{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};var _s=class extends Dn{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ft(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ft(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Fa,this.normalScale=new Ht(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jn,this.combine=Jo,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}},No=class extends Dn{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=$u,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}},Uo=class extends Dn{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 ts(i,t){return!i||i.constructor===t?i:typeof t.BYTES_PER_ELEMENT=="number"?new t(i):Array.prototype.slice.call(i)}function Gl(i){return i!==void 0&&i.inTangents!==void 0&&i.outTangents!==void 0}var hi=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&&(Ut("KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,s=this.values,r=n.length;r===0&&(Ut("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)){Ut("KeyframeTrack: Time is not a valid number.",this,a,l),t=!1;break}if(o!==null&&o>l){Ut("KeyframeTrack: Out of order keys.",this,a,l,o),t=!1;break}o=l}if(s!==void 0&&Tp(s))for(let a=0,l=s.length;a!==l;++a){let c=s[a];if(isNaN(c)){Ut("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()===mo,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,Gl(this.settings)&&(s.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),s}};function _u(i,t){for(let e=0,n=i.length;e!==n;e+=2)i[e]*=t}ln.prototype.ValueTypeName="";ln.prototype.TimeBufferType=Float32Array;ln.prototype.ValueBufferType=Float32Array;ln.prototype.DefaultInterpolation=Eo;var ui=class extends ln{constructor(t,e,n){super(t,e,n)}};ui.prototype.ValueTypeName="bool";ui.prototype.ValueBufferType=Array;ui.prototype.DefaultInterpolation=Ws;ui.prototype.InterpolantFactoryMethodLinear=void 0;ui.prototype.InterpolantFactoryMethodSmooth=void 0;var ko=class extends ln{constructor(t,e,n,s){super(t,e,n,s)}};ko.prototype.ValueTypeName="color";var Ho=class extends ln{constructor(t,e,n,s){super(t,e,n,s)}};Ho.prototype.ValueTypeName="number";var Vo=class extends hi{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)Ce.slerpFlat(r,0,o,c-a,o,c,l);return r}},ir=class extends ln{constructor(t,e,n,s){super(t,e,n,s)}InterpolantFactoryMethodLinear(t){return new Vo(this.times,this.values,this.getValueSize(),t)}};ir.prototype.ValueTypeName="quaternion";ir.prototype.InterpolantFactoryMethodSmooth=void 0;var di=class extends ln{constructor(t,e,n){super(t,e,n)}};di.prototype.ValueTypeName="string";di.prototype.ValueBufferType=Array;di.prototype.DefaultInterpolation=Ws;di.prototype.InterpolantFactoryMethodLinear=void 0;di.prototype.InterpolantFactoryMethodSmooth=void 0;var Go=class extends ln{constructor(t,e,n,s){super(t,e,n,s)}};Go.prototype.ValueTypeName="vector";var Wo=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;dp.start-g.start);let u=0;for(let p=1;p0&&(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 Fe().setHex(s.value);break;case"v2":this.uniforms[n].value=new Ve().fromArray(s.value);break;case"v3":this.uniforms[n].value=new I().fromArray(s.value);break;case"v4":this.uniforms[n].value=new at().fromArray(s.value);break;case"m3":this.uniforms[n].value=new Oe().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}},No=class extends Vt{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};var xs=class extends Dn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Fe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ba,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jn,this.combine=Ko,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}},Uo=class extends Dn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ku,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}},Fo=class extends Dn{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 ts(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function Wl(i){return i!==void 0&&i.inTangents!==void 0&&i.outTangents!==void 0}var hi=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&&(Ue("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,s=this.values,r=n.length;r===0&&(Ue("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)){Ue("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){Ue("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(s!==void 0&&Op(s))for(let a=0,l=s.length;a!==l;++a){let c=s[a];if(isNaN(c)){Ue("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()===go,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,Wl(this.settings)&&(s.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),s}};function yu(i,e){for(let t=0,n=i.length;t!==n;t+=2)i[t]*=e}ln.prototype.ValueTypeName="";ln.prototype.TimeBufferType=Float32Array;ln.prototype.ValueBufferType=Float32Array;ln.prototype.DefaultInterpolation=To;var ui=class extends ln{constructor(e,t,n){super(e,t,n)}};ui.prototype.ValueTypeName="bool";ui.prototype.ValueBufferType=Array;ui.prototype.DefaultInterpolation=Xs;ui.prototype.InterpolantFactoryMethodLinear=void 0;ui.prototype.InterpolantFactoryMethodSmooth=void 0;var Vo=class extends ln{constructor(e,t,n,s){super(e,t,n,s)}};Vo.prototype.ValueTypeName="color";var Ho=class extends ln{constructor(e,t,n,s){super(e,t,n,s)}};Ho.prototype.ValueTypeName="number";var Go=class extends hi{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)Ct.slerpFlat(r,0,o,c-a,o,c,l);return r}},sr=class extends ln{constructor(e,t,n,s){super(e,t,n,s)}InterpolantFactoryMethodLinear(e){return new Go(this.times,this.values,this.getValueSize(),e)}};sr.prototype.ValueTypeName="quaternion";sr.prototype.InterpolantFactoryMethodSmooth=void 0;var di=class extends ln{constructor(e,t,n){super(e,t,n)}};di.prototype.ValueTypeName="string";di.prototype.ValueBufferType=Array;di.prototype.DefaultInterpolation=Xs;di.prototype.InterpolantFactoryMethodLinear=void 0;di.prototype.InterpolantFactoryMethodSmooth=void 0;var Wo=class extends ln{constructor(e,t,n,s){super(e,t,n,s)}};Wo.prototype.ValueTypeName="vector";var Xo=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;dp.start-g.start);let u=0;for(let p=1;p 0 +#endif`,Km=`#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`,km=`#if NUM_CLIPPING_PLANES > 0 +#endif`,jm=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,Hm=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Qm=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,Vm=`#if NUM_CLIPPING_PLANES > 0 +#endif`,eg=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,Gm=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) +#endif`,tg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; -#endif`,Wm=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) +#endif`,ng=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) varying vec4 vColor; -#endif`,Xm=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) +#endif`,ig=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec4 vColor; -#endif`,qm=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) +#endif`,sg=`#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`,Ym=`#define PI 3.141592653589793 +#endif`,rg=`#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`,$m=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,og=`#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`,Zm=`vec3 transformedNormal = objectNormal; +#endif`,ag=`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`,Jm=`#ifdef USE_DISPLACEMENTMAP +#endif`,lg=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,Km=`#ifdef USE_DISPLACEMENTMAP +#endif`,cg=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,jm=`#ifdef USE_EMISSIVEMAP +#endif`,hg=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE emissiveColor = sRGBTransferEOTF( emissiveColor ); #endif totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,Qm=`#ifdef USE_EMISSIVEMAP +#endif`,ug=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,tg="gl_FragColor = linearToOutputTexel( gl_FragColor );",eg=`vec4 LinearTransferOETF( in vec4 value ) { +#endif`,dg="gl_FragColor = linearToOutputTexel( gl_FragColor );",fg=`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 ); -}`,ng=`#ifdef USE_ENVMAP +}`,pg=`#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`,ig=`#ifdef USE_ENVMAP +#endif`,mg=`#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`,sg=`#ifdef USE_ENVMAP +#endif`,gg=`#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`,rg=`#ifdef USE_ENVMAP +#endif`,_g=`#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`,og=`#ifdef USE_ENVMAP +#endif`,xg=`#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`,ag=`#ifdef USE_FOG +#endif`,vg=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,lg=`#ifdef USE_FOG +#endif`,yg=`#ifdef USE_FOG varying float vFogDepth; -#endif`,cg=`#ifdef USE_FOG +#endif`,bg=`#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`,hg=`#ifdef USE_FOG +#endif`,Mg=`#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`,ug=`#ifdef USE_GRADIENTMAP +#endif`,Sg=`#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 -}`,dg=`#ifdef USE_LIGHTMAP +}`,wg=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,fg=`LambertMaterial material; +#endif`,Eg=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,pg=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Tg=`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`,mg=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Ag=`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 `,gg=`#ifdef USE_ENVMAP +#include `,Rg=`#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`,_g=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,xg=`varying vec3 vViewPosition; +#endif`,Cg=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,Ig=`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`,vg=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Pg=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,yg=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Lg=`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`,bg=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Dg=`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`,Mg=`uniform sampler2D dfgLUT; +#endif`,Ng=`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 ); -}`,Sg=` +}`,Ug=` 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`,wg=`#if defined( RE_IndirectDiffuse ) +#endif`,Fg=`#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`,Eg=`#if defined( RE_IndirectDiffuse ) +#endif`,Bg=`#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`,Tg=`#ifdef USE_LIGHT_PROBES_GRID +#endif`,Og=`#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`,Ag=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) +#endif`,zg=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,Rg=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) +#endif`,kg=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,Cg=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER +#endif`,Vg=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER varying float vFragDepth; varying float vIsPerspective; -#endif`,Ig=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER +#endif`,Hg=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,Pg=`#ifdef USE_MAP +#endif`,Gg=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,Lg=`#ifdef USE_MAP +#endif`,Wg=`#ifdef USE_MAP uniform sampler2D map; -#endif`,Dg=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,Xg=`#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`,Ng=`#if defined( USE_POINTS_UV ) +#endif`,qg=`#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`,Ug=`float metalnessFactor = metalness; +#endif`,Yg=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,Fg=`#ifdef USE_METALNESSMAP +#endif`,$g=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,Bg=`#ifdef USE_INSTANCING_MORPH +#endif`,Zg=`#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`,Og=`#if defined( USE_MORPHCOLORS ) +#endif`,Jg=`#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`,zg=`#ifdef USE_MORPHNORMALS +#endif`,Kg=`#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`,kg=`#ifdef USE_MORPHTARGETS +#endif`,jg=`#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`,Hg=`#ifdef USE_MORPHTARGETS +#endif`,Qg=`#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`,Vg=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,e_=`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;`,Gg=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,t_=`#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;`,Gg=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,Wg=`#ifndef FLAT_SHADED +#endif`,n_=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,Xg=`#ifndef FLAT_SHADED +#endif`,i_=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,qg=`#ifndef FLAT_SHADED +#endif`,s_=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); @@ -1697,7 +1697,7 @@ vec3 nonPerturbedNormal = normal;`,Gg=`#ifdef USE_NORMALMAP_OBJECTSPACE vBitangent = - vBitangent; #endif #endif -#endif`,Yg=`#ifdef USE_NORMALMAP +#endif`,r_=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1719,13 +1719,13 @@ vec3 nonPerturbedNormal = normal;`,Gg=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,$g=`#ifdef USE_CLEARCOAT +#endif`,o_=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,Zg=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,a_=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,Jg=`#ifdef USE_CLEARCOATMAP +#endif`,l_=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1734,18 +1734,18 @@ vec3 nonPerturbedNormal = normal;`,Gg=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,Kg=`#ifdef USE_IRIDESCENCEMAP +#endif`,c_=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,jg=`#ifdef OPAQUE +#endif`,h_=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Qg=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,u_=`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 -}`,t_=`#ifdef PREMULTIPLIED_ALPHA +}`,d_=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,e_=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,f_=`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;`,n_=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,p_=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,i_=`#ifdef DITHERING +#endif`,m_=`#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`,s_=`float roughnessFactor = roughness; +#endif`,g_=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,r_=`#ifdef USE_ROUGHNESSMAP +#endif`,__=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,o_=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,x_=`#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;`,n_=`#ifdef DITHERING } #endif #endif -#endif`,a_=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,v_=`#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;`,n_=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,l_=`#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`,y_=`#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;`,n_=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,c_=`float getShadowMask() { +#endif`,b_=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_SUN_LIGHT_SHADOWS > 0 @@ -2226,12 +2226,12 @@ gl_Position = projectionMatrix * mvPosition;`,n_=`#ifdef DITHERING #endif #endif return shadow; -}`,h_=`#ifdef USE_SKINNING +}`,M_=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,u_=`#ifdef USE_SKINNING +#endif`,S_=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2246,7 +2246,7 @@ gl_Position = projectionMatrix * mvPosition;`,n_=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,d_=`#ifdef USE_SKINNING +#endif`,w_=`#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;`,n_=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,f_=`#ifdef USE_SKINNING +#endif`,E_=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2265,17 +2265,17 @@ gl_Position = projectionMatrix * mvPosition;`,n_=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,p_=`float specularStrength; +#endif`,T_=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,m_=`#ifdef USE_SPECULARMAP +#endif`,A_=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,g_=`#if defined( TONE_MAPPING ) +#endif`,R_=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,__=`#ifndef saturate +#endif`,C_=`#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; }`,x_=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,I_=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2393,7 +2393,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,x_=`#ifdef USE_TRANSMISS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,v_=`#ifdef USE_TRANSMISSION +#endif`,P_=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2519,7 +2519,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,x_=`#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`,y_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,L_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2589,7 +2589,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,x_=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,b_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,D_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2683,7 +2683,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,x_=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,M_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,N_=`#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; }`,x_=`#ifdef USE_TRANSMISS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,S_=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,U_=`#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; }`,x_=`#ifdef USE_TRANSMISS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`,w_=`varying vec2 vUv; +#endif`,F_=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,E_=`uniform sampler2D t2D; +}`,B_=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2780,14 +2780,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,T_=`varying vec3 vWorldDirection; +}`,O_=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,A_=`#ifdef ENVMAP_TYPE_CUBE +}`,z_=`#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 -}`,R_=`varying vec3 vWorldDirection; +}`,k_=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,C_=`uniform samplerCube tCube; +}`,V_=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2826,7 +2826,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,I_=`#include +}`,H_=`#include #include #include #include @@ -2853,7 +2853,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,P_=`#if DEPTH_PACKING == 3200 +}`,G_=`#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 -}`,L_=`#define DISTANCE +}`,W_=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2918,7 +2918,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,D_=`#define DISTANCE +}`,X_=`#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 ); -}`,N_=`varying vec3 vWorldDirection; +}`,q_=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,U_=`uniform sampler2D tEquirect; +}`,Y_=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2956,7 +2956,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,F_=`uniform float scale; +}`,$_=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2978,7 +2978,7 @@ void main() { #include #include #include -}`,B_=`uniform vec3 diffuse; +}`,Z_=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -3006,7 +3006,7 @@ void main() { #include #include #include -}`,O_=`#include +}`,J_=`#include #include #include #include @@ -3038,7 +3038,7 @@ void main() { #include #include #include -}`,z_=`uniform vec3 diffuse; +}`,K_=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -3086,7 +3086,7 @@ void main() { #include #include #include -}`,k_=`#define LAMBERT +}`,j_=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -3125,7 +3125,7 @@ void main() { #include #include #include -}`,H_=`#define LAMBERT +}`,Q_=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3183,7 +3183,7 @@ void main() { #include #include #include -}`,V_=`#define MATCAP +}`,e0=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -3217,7 +3217,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,G_=`#define MATCAP +}`,t0=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3263,7 +3263,7 @@ void main() { #include #include #include -}`,W_=`#define NORMAL +}`,n0=`#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 -}`,X_=`#define NORMAL +}`,i0=`#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 -}`,q_=`#define PHONG +}`,s0=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3356,7 +3356,7 @@ void main() { #include #include #include -}`,Y_=`#define PHONG +}`,r0=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3416,7 +3416,7 @@ void main() { #include #include #include -}`,$_=`#define STANDARD +}`,o0=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3459,7 +3459,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,Z_=`#define STANDARD +}`,a0=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3587,7 +3587,7 @@ void main() { #include #include #include -}`,J_=`#define TOON +}`,l0=`#define TOON varying vec3 vViewPosition; #include #include @@ -3624,7 +3624,7 @@ void main() { #include #include #include -}`,K_=`#define TOON +}`,c0=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3676,7 +3676,7 @@ void main() { #include #include #include -}`,j_=`uniform float size; +}`,h0=`uniform float size; uniform float scale; #include #include @@ -3707,7 +3707,7 @@ void main() { #include #include #include -}`,Q_=`uniform vec3 diffuse; +}`,u0=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3732,7 +3732,7 @@ void main() { #include #include #include -}`,t0=`#include +}`,d0=`#include #include #include #include @@ -3755,7 +3755,7 @@ void main() { #include #include #include -}`,e0=`uniform vec3 color; +}`,f0=`uniform vec3 color; uniform float opacity; #include #include @@ -3771,7 +3771,7 @@ void main() { #include #include #include -}`,n0=`uniform float rotation; +}`,p0=`uniform float rotation; uniform vec2 center; #include #include @@ -3795,7 +3795,7 @@ void main() { #include #include #include -}`,i0=`uniform vec3 diffuse; +}`,m0=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3820,7 +3820,7 @@ void main() { #include #include #include -}`,Wt={alphahash_fragment:wm,alphahash_pars_fragment:Em,alphamap_fragment:Tm,alphamap_pars_fragment:Am,alphatest_fragment:Rm,alphatest_pars_fragment:Cm,aomap_fragment:Im,aomap_pars_fragment:Pm,batching_pars_vertex:Lm,batching_vertex:Dm,begin_vertex:Nm,beginnormal_vertex:Um,bsdfs:Fm,iridescence_fragment:Bm,bumpmap_pars_fragment:Om,clipping_planes_fragment:zm,clipping_planes_pars_fragment:km,clipping_planes_pars_vertex:Hm,clipping_planes_vertex:Vm,color_fragment:Gm,color_pars_fragment:Wm,color_pars_vertex:Xm,color_vertex:qm,common:Ym,cube_uv_reflection_fragment:$m,defaultnormal_vertex:Zm,displacementmap_pars_vertex:Jm,displacementmap_vertex:Km,emissivemap_fragment:jm,emissivemap_pars_fragment:Qm,colorspace_fragment:tg,colorspace_pars_fragment:eg,envmap_fragment:ng,envmap_common_pars_fragment:ig,envmap_pars_fragment:sg,envmap_pars_vertex:rg,envmap_physical_pars_fragment:gg,envmap_vertex:og,fog_vertex:ag,fog_pars_vertex:lg,fog_fragment:cg,fog_pars_fragment:hg,gradientmap_pars_fragment:ug,lightmap_pars_fragment:dg,lights_lambert_fragment:fg,lights_lambert_pars_fragment:pg,lights_pars_begin:mg,lights_toon_fragment:_g,lights_toon_pars_fragment:xg,lights_phong_fragment:vg,lights_phong_pars_fragment:yg,lights_physical_fragment:bg,lights_physical_pars_fragment:Mg,lights_fragment_begin:Sg,lights_fragment_maps:wg,lights_fragment_end:Eg,lightprobes_pars_fragment:Tg,logdepthbuf_fragment:Ag,logdepthbuf_pars_fragment:Rg,logdepthbuf_pars_vertex:Cg,logdepthbuf_vertex:Ig,map_fragment:Pg,map_pars_fragment:Lg,map_particle_fragment:Dg,map_particle_pars_fragment:Ng,metalnessmap_fragment:Ug,metalnessmap_pars_fragment:Fg,morphinstance_vertex:Bg,morphcolor_vertex:Og,morphnormal_vertex:zg,morphtarget_pars_vertex:kg,morphtarget_vertex:Hg,normal_fragment_begin:Vg,normal_fragment_maps:Gg,normal_pars_fragment:Wg,normal_pars_vertex:Xg,normal_vertex:qg,normalmap_pars_fragment:Yg,clearcoat_normal_fragment_begin:$g,clearcoat_normal_fragment_maps:Zg,clearcoat_pars_fragment:Jg,iridescence_pars_fragment:Kg,opaque_fragment:jg,packing:Qg,premultiplied_alpha_fragment:t_,project_vertex:e_,dithering_fragment:n_,dithering_pars_fragment:i_,roughnessmap_fragment:s_,roughnessmap_pars_fragment:r_,shadowmap_pars_fragment:o_,shadowmap_pars_vertex:a_,shadowmap_vertex:l_,shadowmask_pars_fragment:c_,skinbase_vertex:h_,skinning_pars_vertex:u_,skinning_vertex:d_,skinnormal_vertex:f_,specularmap_fragment:p_,specularmap_pars_fragment:m_,tonemapping_fragment:g_,tonemapping_pars_fragment:__,transmission_fragment:x_,transmission_pars_fragment:v_,uv_pars_fragment:y_,uv_pars_vertex:b_,uv_vertex:M_,worldpos_vertex:S_,background_vert:w_,background_frag:E_,backgroundCube_vert:T_,backgroundCube_frag:A_,cube_vert:R_,cube_frag:C_,depth_vert:I_,depth_frag:P_,distance_vert:L_,distance_frag:D_,equirect_vert:N_,equirect_frag:U_,linedashed_vert:F_,linedashed_frag:B_,meshbasic_vert:O_,meshbasic_frag:z_,meshlambert_vert:k_,meshlambert_frag:H_,meshmatcap_vert:V_,meshmatcap_frag:G_,meshnormal_vert:W_,meshnormal_frag:X_,meshphong_vert:q_,meshphong_frag:Y_,meshphysical_vert:$_,meshphysical_frag:Z_,meshtoon_vert:J_,meshtoon_frag:K_,points_vert:j_,points_frag:Q_,shadow_vert:t0,shadow_frag:e0,sprite_vert:n0,sprite_frag:i0},xt={common:{diffuse:{value:new Ft(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ot},alphaMap:{value:null},alphaMapTransform:{value:new Ot},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ot}},envmap:{envMap:{value:null},envMapRotation:{value:new Ot},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ot}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ot}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ot},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ot},normalScale:{value:new Ht(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ot},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ot}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ot}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ot}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ft(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 I},probesMax:{value:new I},probesResolution:{value:new I}},points:{diffuse:{value:new Ft(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ot},alphaTest:{value:0},uvTransform:{value:new Ot}},sprite:{diffuse:{value:new Ft(16777215)},opacity:{value:1},center:{value:new Ht(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ot},alphaMap:{value:null},alphaMapTransform:{value:new Ot},alphaTest:{value:0}}},kn={basic:{uniforms:Ze([xt.common,xt.specularmap,xt.envmap,xt.aomap,xt.lightmap,xt.fog]),vertexShader:Wt.meshbasic_vert,fragmentShader:Wt.meshbasic_frag},lambert:{uniforms:Ze([xt.common,xt.specularmap,xt.envmap,xt.aomap,xt.lightmap,xt.emissivemap,xt.bumpmap,xt.normalmap,xt.displacementmap,xt.fog,xt.lights,{emissive:{value:new Ft(0)},envMapIntensity:{value:1}}]),vertexShader:Wt.meshlambert_vert,fragmentShader:Wt.meshlambert_frag},phong:{uniforms:Ze([xt.common,xt.specularmap,xt.envmap,xt.aomap,xt.lightmap,xt.emissivemap,xt.bumpmap,xt.normalmap,xt.displacementmap,xt.fog,xt.lights,{emissive:{value:new Ft(0)},specular:{value:new Ft(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Wt.meshphong_vert,fragmentShader:Wt.meshphong_frag},standard:{uniforms:Ze([xt.common,xt.envmap,xt.aomap,xt.lightmap,xt.emissivemap,xt.bumpmap,xt.normalmap,xt.displacementmap,xt.roughnessmap,xt.metalnessmap,xt.fog,xt.lights,{emissive:{value:new Ft(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Wt.meshphysical_vert,fragmentShader:Wt.meshphysical_frag},toon:{uniforms:Ze([xt.common,xt.aomap,xt.lightmap,xt.emissivemap,xt.bumpmap,xt.normalmap,xt.displacementmap,xt.gradientmap,xt.fog,xt.lights,{emissive:{value:new Ft(0)}}]),vertexShader:Wt.meshtoon_vert,fragmentShader:Wt.meshtoon_frag},matcap:{uniforms:Ze([xt.common,xt.bumpmap,xt.normalmap,xt.displacementmap,xt.fog,{matcap:{value:null}}]),vertexShader:Wt.meshmatcap_vert,fragmentShader:Wt.meshmatcap_frag},points:{uniforms:Ze([xt.points,xt.fog]),vertexShader:Wt.points_vert,fragmentShader:Wt.points_frag},dashed:{uniforms:Ze([xt.common,xt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Wt.linedashed_vert,fragmentShader:Wt.linedashed_frag},depth:{uniforms:Ze([xt.common,xt.displacementmap]),vertexShader:Wt.depth_vert,fragmentShader:Wt.depth_frag},normal:{uniforms:Ze([xt.common,xt.bumpmap,xt.normalmap,xt.displacementmap,{opacity:{value:1}}]),vertexShader:Wt.meshnormal_vert,fragmentShader:Wt.meshnormal_frag},sprite:{uniforms:Ze([xt.sprite,xt.fog]),vertexShader:Wt.sprite_vert,fragmentShader:Wt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ot},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Wt.background_vert,fragmentShader:Wt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ot}},vertexShader:Wt.backgroundCube_vert,fragmentShader:Wt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Wt.cube_vert,fragmentShader:Wt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Wt.equirect_vert,fragmentShader:Wt.equirect_frag},distance:{uniforms:Ze([xt.common,xt.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Wt.distance_vert,fragmentShader:Wt.distance_frag},shadow:{uniforms:Ze([xt.lights,xt.fog,{color:{value:new Ft(0)},opacity:{value:1}}]),vertexShader:Wt.shadow_vert,fragmentShader:Wt.shadow_frag}};kn.physical={uniforms:Ze([kn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ot},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ot},clearcoatNormalScale:{value:new Ht(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ot},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ot},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ot},sheen:{value:0},sheenColor:{value:new Ft(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ot},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ot},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ot},transmissionSamplerSize:{value:new Ht},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ot},attenuationDistance:{value:0},attenuationColor:{value:new Ft(0)},specularColor:{value:new Ft(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ot},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ot},anisotropyVector:{value:new Ht},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ot}}]),vertexShader:Wt.meshphysical_vert,fragmentShader:Wt.meshphysical_frag};var za={r:0,b:0,g:0},s0=new kt,Dd=new Ot;Dd.set(-1,0,0,0,1,0,0,0,1);function r0(i,t,e,n,s,r){let o=new Ft(0),a=s===!0?0:1,l,c,h=null,d=0,u=null;function p(M){let E=M.isScene===!0?M.background:null;if(E&&E.isTexture){let b=M.backgroundBlurriness>0;E=t.get(E,b)}return E}function g(M){let E=!1,b=p(M);b===null?m(o,a):b&&b.isColor&&(m(b,1),E=!0);let v=i.xr.getEnvironmentBlendMode();v==="additive"?e.buffers.color.setClear(0,0,0,1,r):v==="alpha-blend"&&e.buffers.color.setClear(0,0,0,0,r),(i.autoClear||E)&&(e.buffers.depth.setTest(!0),e.buffers.depth.setMask(!0),e.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function _(M,E){let b=p(E);b&&(b.isCubeTexture||b.mapping===hr)?(c===void 0&&(c=new xe(new dn(1,1,1),new He({name:"BackgroundCubeMaterial",uniforms:Fi(kn.backgroundCube.uniforms),vertexShader:kn.backgroundCube.vertexShader,fragmentShader:kn.backgroundCube.fragmentShader,side:Ve,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(v,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=E.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(s0.makeRotationFromEuler(E.backgroundRotation)).transpose(),b.isCubeTexture&&b.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(Dd),c.material.toneMapped=Yt.getTransfer(b.colorSpace)!==te,(h!==b||d!==b.version||u!==i.toneMapping)&&(c.material.needsUpdate=!0,h=b,d=b.version,u=i.toneMapping),c.layers.enableAll(),M.unshift(c,c.geometry,c.material,0,0,null)):b&&b.isTexture&&(l===void 0&&(l=new xe(new yn(2,2),new He({name:"BackgroundMaterial",uniforms:Fi(kn.background.uniforms),vertexShader:kn.background.vertexShader,fragmentShader:kn.background.fragmentShader,side:Bn,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=E.backgroundIntensity,l.material.toneMapped=Yt.getTransfer(b.colorSpace)!==te,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(),M.unshift(l,l.geometry,l.material,0,0,null))}function m(M,E){M.getRGB(za,Ac(i)),e.buffers.color.setClear(za.r,za.g,za.b,E,r)}function f(){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(M,E=1){o.set(M),a=E,m(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(M){a=M,m(o,a)},render:g,addToRenderList:_,dispose:f}}function o0(i,t){let e=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=u(null),r=s,o=!1;function a(L,N,U,C,B){let z=!1,W=d(L,C,U,N);r!==W&&(r=W,c(r.object)),z=p(L,C,U,B),z&&g(L,C,U,B),B!==null&&t.update(B,i.ELEMENT_ARRAY_BUFFER),(z||o)&&(o=!1,b(L,N,U,C),B!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(B).buffer))}function l(){return i.createVertexArray()}function c(L){return i.bindVertexArray(L)}function h(L){return i.deleteVertexArray(L)}function d(L,N,U,C){let B=C.wireframe===!0,z=n[N.id];z===void 0&&(z={},n[N.id]=z);let W=L.isInstancedMesh===!0?L.id:0,F=z[W];F===void 0&&(F={},z[W]=F);let D=F[U.id];D===void 0&&(D={},F[U.id]=D);let X=D[B];return X===void 0&&(X=u(l()),D[B]=X),X}function u(L){let N=[],U=[],C=[];for(let B=0;B=0){let Z=B[D],G=z[D];if(G===void 0&&(D==="instanceMatrix"&&L.instanceMatrix&&(G=L.instanceMatrix),D==="instanceColor"&&L.instanceColor&&(G=L.instanceColor)),Z===void 0||Z.attribute!==G||G&&Z.data!==G.data)return!0;W++}return r.attributesNum!==W||r.index!==C}function g(L,N,U,C){let B={},z=N.attributes,W=0,F=U.getAttributes();for(let D in F)if(F[D].location>=0){let Z=z[D];Z===void 0&&(D==="instanceMatrix"&&L.instanceMatrix&&(Z=L.instanceMatrix),D==="instanceColor"&&L.instanceColor&&(Z=L.instanceColor));let G={};G.attribute=Z,Z&&Z.data&&(G.data=Z.data),B[D]=G,W++}r.attributes=B,r.attributesNum=W,r.index=C}function _(){let L=r.newAttributes;for(let N=0,U=L.length;N=0){let X=B[F];if(X===void 0&&(F==="instanceMatrix"&&L.instanceMatrix&&(X=L.instanceMatrix),F==="instanceColor"&&L.instanceColor&&(X=L.instanceColor)),X!==void 0){let Z=X.normalized,G=X.itemSize,Q=t.get(X);if(Q===void 0)continue;let lt=Q.buffer,ct=Q.type,et=Q.bytesPerElement,V=ct===i.INT||ct===i.UNSIGNED_INT||X.gpuType===ta;if(X.isInterleavedBufferAttribute){let j=X.data,ut=j.stride,Lt=X.offset;if(j.isInstancedInterleavedBuffer){for(let bt=0;bt0&&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&&(Dt("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&&Dt("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let p=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),M=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),E=i.getParameter(i.MAX_VARYING_VECTORS),b=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),v=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:p,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:f,maxVertexUniforms:M,maxVaryings:E,maxFragmentUniforms:b,maxSamples:v,samples:S}}function c0(i){let t=this,e=null,n=0,s=!1,r=!1,o=new _e,a=new Ot,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){let p=d.length!==0||u||n!==0||s;return s=u,n=d.length,p},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,p){let g=d.clippingPlanes,_=d.clipIntersection,m=d.clipShadows,f=i.get(d);if(!s||g===null||g.length===0||r&&!m)r?h(null):c();else{let M=r?0:n,E=M*4,b=f.clippingState||null;l.value=b,b=h(g,u,E,p);for(let v=0;v!==E;++v)b[v]=e[v];f.clippingState=b,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=M}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(d,u,p,g){let _=d!==null?d.length:0,m=null;if(_!==0){if(m=l.value,g!==!0||m===null){let f=p+_*4,M=u.matrixWorldInverse;a.getNormalMatrix(M),(m===null||m.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=pd(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fd(),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?v:0,v,v),d.setRenderTarget(s),f&&d.render(_,l),d.render(t,l)}d.toneMapping=p,d.autoClear=u,t.background=M}_textureToCubeUV(t,e){let n=this._renderer,s=t.mapping===fi||t.mapping===Ui;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=pd()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fd());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;ws(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(o,xr)}_applyPMREM(t){let e=this._renderer,n=e.autoClear;e.autoClear=!1;let s=this._lodMeshes.length;for(let r=1;rg-Es?n-g+Es:0),f=4*(this._cubeSize-_);l.envMap.value=t.texture,l.roughness.value=p,l.mipInt.value=g-e,ws(r,m,f,3*_,2*_),s.setRenderTarget(r),s.render(a,xr),l.envMap.value=r.texture,l.roughness.value=0,l.mipInt.value=g-n,ws(t,m,f,3*_,2*_),s.setRenderTarget(t),s.render(a,xr)}_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-Es?s-this._lodMax+Es:0),u=4*(this._cubeSize-h);ws(e,d,u,3*h,2*h),o.setRenderTarget(e),o.render(l,xr)}};function p0(i){let t=[],e=[],n=i,s=i-Es+1+h0;for(let r=0;r2?0:-1,b=[M,E,0,M+2/3,E,0,M+2/3,E+1,0,M,E,0,M+2/3,E+1,0,M,E+1,0];g.set(b,p*u*f);for(let v=0;vEs&&n--}return{lodMeshes:e,sizeLods:t}}function dd(i,t,e){let n=new Fe(i,t,e);return n.texture.mapping=hr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ws(i,t,e,n,s){i.viewport.set(t,e,n,s),i.scissor.set(t,e,n,s)}function m0(i,t,e){return new He({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:d0,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:Ga(),fragmentShader:` +}`,We={alphahash_fragment:Fm,alphahash_pars_fragment:Bm,alphamap_fragment:Om,alphamap_pars_fragment:zm,alphatest_fragment:km,alphatest_pars_fragment:Vm,aomap_fragment:Hm,aomap_pars_fragment:Gm,batching_pars_vertex:Wm,batching_vertex:Xm,begin_vertex:qm,beginnormal_vertex:Ym,bsdfs:$m,iridescence_fragment:Zm,bumpmap_pars_fragment:Jm,clipping_planes_fragment:Km,clipping_planes_pars_fragment:jm,clipping_planes_pars_vertex:Qm,clipping_planes_vertex:eg,color_fragment:tg,color_pars_fragment:ng,color_pars_vertex:ig,color_vertex:sg,common:rg,cube_uv_reflection_fragment:og,defaultnormal_vertex:ag,displacementmap_pars_vertex:lg,displacementmap_vertex:cg,emissivemap_fragment:hg,emissivemap_pars_fragment:ug,colorspace_fragment:dg,colorspace_pars_fragment:fg,envmap_fragment:pg,envmap_common_pars_fragment:mg,envmap_pars_fragment:gg,envmap_pars_vertex:_g,envmap_physical_pars_fragment:Rg,envmap_vertex:xg,fog_vertex:vg,fog_pars_vertex:yg,fog_fragment:bg,fog_pars_fragment:Mg,gradientmap_pars_fragment:Sg,lightmap_pars_fragment:wg,lights_lambert_fragment:Eg,lights_lambert_pars_fragment:Tg,lights_pars_begin:Ag,lights_toon_fragment:Cg,lights_toon_pars_fragment:Ig,lights_phong_fragment:Pg,lights_phong_pars_fragment:Lg,lights_physical_fragment:Dg,lights_physical_pars_fragment:Ng,lights_fragment_begin:Ug,lights_fragment_maps:Fg,lights_fragment_end:Bg,lightprobes_pars_fragment:Og,logdepthbuf_fragment:zg,logdepthbuf_pars_fragment:kg,logdepthbuf_pars_vertex:Vg,logdepthbuf_vertex:Hg,map_fragment:Gg,map_pars_fragment:Wg,map_particle_fragment:Xg,map_particle_pars_fragment:qg,metalnessmap_fragment:Yg,metalnessmap_pars_fragment:$g,morphinstance_vertex:Zg,morphcolor_vertex:Jg,morphnormal_vertex:Kg,morphtarget_pars_vertex:jg,morphtarget_vertex:Qg,normal_fragment_begin:e_,normal_fragment_maps:t_,normal_pars_fragment:n_,normal_pars_vertex:i_,normal_vertex:s_,normalmap_pars_fragment:r_,clearcoat_normal_fragment_begin:o_,clearcoat_normal_fragment_maps:a_,clearcoat_pars_fragment:l_,iridescence_pars_fragment:c_,opaque_fragment:h_,packing:u_,premultiplied_alpha_fragment:d_,project_vertex:f_,dithering_fragment:p_,dithering_pars_fragment:m_,roughnessmap_fragment:g_,roughnessmap_pars_fragment:__,shadowmap_pars_fragment:x_,shadowmap_pars_vertex:v_,shadowmap_vertex:y_,shadowmask_pars_fragment:b_,skinbase_vertex:M_,skinning_pars_vertex:S_,skinning_vertex:w_,skinnormal_vertex:E_,specularmap_fragment:T_,specularmap_pars_fragment:A_,tonemapping_fragment:R_,tonemapping_pars_fragment:C_,transmission_fragment:I_,transmission_pars_fragment:P_,uv_pars_fragment:L_,uv_pars_vertex:D_,uv_vertex:N_,worldpos_vertex:U_,background_vert:F_,background_frag:B_,backgroundCube_vert:O_,backgroundCube_frag:z_,cube_vert:k_,cube_frag:V_,depth_vert:H_,depth_frag:G_,distance_vert:W_,distance_frag:X_,equirect_vert:q_,equirect_frag:Y_,linedashed_vert:$_,linedashed_frag:Z_,meshbasic_vert:J_,meshbasic_frag:K_,meshlambert_vert:j_,meshlambert_frag:Q_,meshmatcap_vert:e0,meshmatcap_frag:t0,meshnormal_vert:n0,meshnormal_frag:i0,meshphong_vert:s0,meshphong_frag:r0,meshphysical_vert:o0,meshphysical_frag:a0,meshtoon_vert:l0,meshtoon_frag:c0,points_vert:h0,points_frag:u0,shadow_vert:d0,shadow_frag:f0,sprite_vert:p0,sprite_frag:m0},xe={common:{diffuse:{value:new Fe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Oe},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Oe}},envmap:{envMap:{value:null},envMapRotation:{value:new Oe},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Oe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Oe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Oe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Oe},normalScale:{value:new Ve(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Oe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Oe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Oe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Oe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Fe(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 I},probesMax:{value:new I},probesResolution:{value:new I}},points:{diffuse:{value:new Fe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0},uvTransform:{value:new Oe}},sprite:{diffuse:{value:new Fe(16777215)},opacity:{value:1},center:{value:new Ve(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Oe},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0}}},kn={basic:{uniforms:Zt([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.fog]),vertexShader:We.meshbasic_vert,fragmentShader:We.meshbasic_frag},lambert:{uniforms:Zt([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new Fe(0)},envMapIntensity:{value:1}}]),vertexShader:We.meshlambert_vert,fragmentShader:We.meshlambert_frag},phong:{uniforms:Zt([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new Fe(0)},specular:{value:new Fe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:We.meshphong_vert,fragmentShader:We.meshphong_frag},standard:{uniforms:Zt([xe.common,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.roughnessmap,xe.metalnessmap,xe.fog,xe.lights,{emissive:{value:new Fe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:We.meshphysical_vert,fragmentShader:We.meshphysical_frag},toon:{uniforms:Zt([xe.common,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.gradientmap,xe.fog,xe.lights,{emissive:{value:new Fe(0)}}]),vertexShader:We.meshtoon_vert,fragmentShader:We.meshtoon_frag},matcap:{uniforms:Zt([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,{matcap:{value:null}}]),vertexShader:We.meshmatcap_vert,fragmentShader:We.meshmatcap_frag},points:{uniforms:Zt([xe.points,xe.fog]),vertexShader:We.points_vert,fragmentShader:We.points_frag},dashed:{uniforms:Zt([xe.common,xe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:We.linedashed_vert,fragmentShader:We.linedashed_frag},depth:{uniforms:Zt([xe.common,xe.displacementmap]),vertexShader:We.depth_vert,fragmentShader:We.depth_frag},normal:{uniforms:Zt([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,{opacity:{value:1}}]),vertexShader:We.meshnormal_vert,fragmentShader:We.meshnormal_frag},sprite:{uniforms:Zt([xe.sprite,xe.fog]),vertexShader:We.sprite_vert,fragmentShader:We.sprite_frag},background:{uniforms:{uvTransform:{value:new Oe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:We.background_vert,fragmentShader:We.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Oe}},vertexShader:We.backgroundCube_vert,fragmentShader:We.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:We.cube_vert,fragmentShader:We.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:We.equirect_vert,fragmentShader:We.equirect_frag},distance:{uniforms:Zt([xe.common,xe.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:We.distance_vert,fragmentShader:We.distance_frag},shadow:{uniforms:Zt([xe.lights,xe.fog,{color:{value:new Fe(0)},opacity:{value:1}}]),vertexShader:We.shadow_vert,fragmentShader:We.shadow_frag}};kn.physical={uniforms:Zt([kn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Oe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Oe},clearcoatNormalScale:{value:new Ve(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Oe},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Oe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Oe},sheen:{value:0},sheenColor:{value:new Fe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Oe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Oe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Oe},transmissionSamplerSize:{value:new Ve},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Oe},attenuationDistance:{value:0},attenuationColor:{value:new Fe(0)},specularColor:{value:new Fe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Oe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Oe},anisotropyVector:{value:new Ve},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Oe}}]),vertexShader:We.meshphysical_vert,fragmentShader:We.meshphysical_frag};var ka={r:0,b:0,g:0},g0=new ke,Fd=new Oe;Fd.set(-1,0,0,0,1,0,0,0,1);function _0(i,e,t,n,s,r){let o=new Fe(0),a=s===!0?0:1,l,c,h=null,d=0,u=null;function p(M){let E=M.isScene===!0?M.background:null;if(E&&E.isTexture){let b=M.backgroundBlurriness>0;E=e.get(E,b)}return E}function g(M){let E=!1,b=p(M);b===null?m(o,a):b&&b.isColor&&(m(b,1),E=!0);let v=i.xr.getEnvironmentBlendMode();v==="additive"?t.buffers.color.setClear(0,0,0,1,r):v==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(i.autoClear||E)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function _(M,E){let b=p(E);b&&(b.isCubeTexture||b.mapping===ur)?(c===void 0&&(c=new xt(new dn(1,1,1),new Vt({name:"BackgroundCubeMaterial",uniforms:Bi(kn.backgroundCube.uniforms),vertexShader:kn.backgroundCube.vertexShader,fragmentShader:kn.backgroundCube.fragmentShader,side:Ht,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(v,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=E.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(g0.makeRotationFromEuler(E.backgroundRotation)).transpose(),b.isCubeTexture&&b.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(Fd),c.material.toneMapped=Ye.getTransfer(b.colorSpace)!==et,(h!==b||d!==b.version||u!==i.toneMapping)&&(c.material.needsUpdate=!0,h=b,d=b.version,u=i.toneMapping),c.layers.enableAll(),M.unshift(c,c.geometry,c.material,0,0,null)):b&&b.isTexture&&(l===void 0&&(l=new xt(new yn(2,2),new Vt({name:"BackgroundMaterial",uniforms:Bi(kn.background.uniforms),vertexShader:kn.background.vertexShader,fragmentShader:kn.background.fragmentShader,side:Bn,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=E.backgroundIntensity,l.material.toneMapped=Ye.getTransfer(b.colorSpace)!==et,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(),M.unshift(l,l.geometry,l.material,0,0,null))}function m(M,E){M.getRGB(ka,Rc(i)),t.buffers.color.setClear(ka.r,ka.g,ka.b,E,r)}function f(){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(M,E=1){o.set(M),a=E,m(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(M){a=M,m(o,a)},render:g,addToRenderList:_,dispose:f}}function x0(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=u(null),r=s,o=!1;function a(L,N,U,C,B){let z=!1,W=d(L,C,U,N);r!==W&&(r=W,c(r.object)),z=p(L,C,U,B),z&&g(L,C,U,B),B!==null&&e.update(B,i.ELEMENT_ARRAY_BUFFER),(z||o)&&(o=!1,b(L,N,U,C),B!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(B).buffer))}function l(){return i.createVertexArray()}function c(L){return i.bindVertexArray(L)}function h(L){return i.deleteVertexArray(L)}function d(L,N,U,C){let B=C.wireframe===!0,z=n[N.id];z===void 0&&(z={},n[N.id]=z);let W=L.isInstancedMesh===!0?L.id:0,F=z[W];F===void 0&&(F={},z[W]=F);let D=F[U.id];D===void 0&&(D={},F[U.id]=D);let X=D[B];return X===void 0&&(X=u(l()),D[B]=X),X}function u(L){let N=[],U=[],C=[];for(let B=0;B=0){let Z=B[D],G=z[D];if(G===void 0&&(D==="instanceMatrix"&&L.instanceMatrix&&(G=L.instanceMatrix),D==="instanceColor"&&L.instanceColor&&(G=L.instanceColor)),Z===void 0||Z.attribute!==G||G&&Z.data!==G.data)return!0;W++}return r.attributesNum!==W||r.index!==C}function g(L,N,U,C){let B={},z=N.attributes,W=0,F=U.getAttributes();for(let D in F)if(F[D].location>=0){let Z=z[D];Z===void 0&&(D==="instanceMatrix"&&L.instanceMatrix&&(Z=L.instanceMatrix),D==="instanceColor"&&L.instanceColor&&(Z=L.instanceColor));let G={};G.attribute=Z,Z&&Z.data&&(G.data=Z.data),B[D]=G,W++}r.attributes=B,r.attributesNum=W,r.index=C}function _(){let L=r.newAttributes;for(let N=0,U=L.length;N=0){let X=B[F];if(X===void 0&&(F==="instanceMatrix"&&L.instanceMatrix&&(X=L.instanceMatrix),F==="instanceColor"&&L.instanceColor&&(X=L.instanceColor)),X!==void 0){let Z=X.normalized,G=X.itemSize,Q=e.get(X);if(Q===void 0)continue;let le=Q.buffer,ce=Q.type,te=Q.bytesPerElement,H=ce===i.INT||ce===i.UNSIGNED_INT||X.gpuType===ta;if(X.isInterleavedBufferAttribute){let j=X.data,ue=j.stride,Le=X.offset;if(j.isInstancedInterleavedBuffer){for(let be=0;be0&&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&&(De("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&&De("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let p=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),M=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),E=i.getParameter(i.MAX_VARYING_VECTORS),b=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),v=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:p,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:f,maxVertexUniforms:M,maxVaryings:E,maxFragmentUniforms:b,maxSamples:v,samples:S}}function b0(i){let e=this,t=null,n=0,s=!1,r=!1,o=new _t,a=new Oe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){let p=d.length!==0||u||n!==0||s;return s=u,n=d.length,p},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,p){let g=d.clippingPlanes,_=d.clipIntersection,m=d.clipShadows,f=i.get(d);if(!s||g===null||g.length===0||r&&!m)r?h(null):c();else{let M=r?0:n,E=M*4,b=f.clippingState||null;l.value=b,b=h(g,u,E,p);for(let v=0;v!==E;++v)b[v]=t[v];f.clippingState=b,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=M}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(d,u,p,g){let _=d!==null?d.length:0,m=null;if(_!==0){if(m=l.value,g!==!0||m===null){let f=p+_*4,M=u.matrixWorldInverse;a.getNormalMatrix(M),(m===null||m.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=_d(),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?v:0,v,v),d.setRenderTarget(s),f&&d.render(_,l),d.render(e,l)}d.toneMapping=p,d.autoClear=u,e.background=M}_textureToCubeUV(e,t){let n=this._renderer,s=e.mapping===fi||e.mapping===Fi;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=_d()),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;Es(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,vr)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let s=this._lodMeshes.length;for(let r=1;rg-Ts?n-g+Ts:0),f=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=p,l.mipInt.value=g-t,Es(r,m,f,3*_,2*_),s.setRenderTarget(r),s.render(a,vr),l.envMap.value=r.texture,l.roughness.value=0,l.mipInt.value=g-n,Es(e,m,f,3*_,2*_),s.setRenderTarget(e),s.render(a,vr)}_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-Ts?s-this._lodMax+Ts:0),u=4*(this._cubeSize-h);Es(t,d,u,3*h,2*h),o.setRenderTarget(t),o.render(l,vr)}};function T0(i){let e=[],t=[],n=i,s=i-Ts+1+M0;for(let r=0;r2?0:-1,b=[M,E,0,M+2/3,E,0,M+2/3,E+1,0,M,E,0,M+2/3,E+1,0,M,E+1,0];g.set(b,p*u*f);for(let v=0;vTs&&n--}return{lodMeshes:t,sizeLods:e}}function md(i,e,t){let n=new Ft(i,e,t);return n.texture.mapping=ur,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Es(i,e,t,n,s){i.viewport.set(e,t,n,s),i.scissor.set(e,t,n,s)}function A0(i,e,t){return new Vt({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:w0,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:Wa(),fragmentShader:` precision highp float; precision highp int; @@ -3924,7 +3924,7 @@ void main() { gl_FragColor = vec4(prefilteredColor, 1.0); } - `,blending:On,depthTest:!1,depthWrite:!1})}function g0(i,t,e){return new He({name:"SphericalGaussianBlur",defines:{SAMPLES:u0,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:Ga(),fragmentShader:` + `,blending:On,depthTest:!1,depthWrite:!1})}function R0(i,e,t){return new Vt({name:"SphericalGaussianBlur",defines:{SAMPLES:S0,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:Wa(),fragmentShader:` precision highp float; precision highp int; @@ -3984,7 +3984,7 @@ void main() { gl_FragColor = vec4( accumColor / accumWeight, 1.0 ); } - `,blending:On,depthTest:!1,depthWrite:!1})}function fd(){return new He({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ga(),fragmentShader:` + `,blending:On,depthTest:!1,depthWrite:!1})}function gd(){return new Vt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Wa(),fragmentShader:` precision mediump float; precision mediump int; @@ -4003,7 +4003,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:On,depthTest:!1,depthWrite:!1})}function pd(){return new He({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ga(),fragmentShader:` + `,blending:On,depthTest:!1,depthWrite:!1})}function _d(){return new Vt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Wa(),fragmentShader:` precision mediump float; precision mediump int; @@ -4019,7 +4019,7 @@ void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } - `,blending:On,depthTest:!1,depthWrite:!1})}function Ga(){return` + `,blending:On,depthTest:!1,depthWrite:!1})}function Wa(){return` precision mediump float; precision mediump int; @@ -4034,7 +4034,7 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}var Va=class extends Fe{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 Qs(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 Ga=class extends Ft{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 er(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 dn(5,5,5),r=new He({name:"CubemapFromEquirect",uniforms:Fi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ve,blending:On});r.uniforms.tEquirect.value=e;let o=new xe(s,r),a=e.minFilter;return e.minFilter===pi&&(e.minFilter=ze),new Yo(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 _0(i){let t=new WeakMap,e=new WeakMap,n=null;function s(u,p=!1){return u==null?null:p?o(u):r(u)}function r(u){if(u&&u.isTexture){let p=u.mapping;if(p===Ko||p===jo)if(t.has(u)){let g=t.get(u).texture;return a(g,u.mapping)}else{let g=u.image;if(g&&g.height>0){let _=new Va(g.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 p=u.mapping,g=p===Ko||p===jo,_=p===fi||p===Ui;if(g||_){let m=e.get(u),f=m!==void 0?m.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==f)return n===null&&(n=new Ha(i)),m=g?n.fromEquirectangular(u,m):n.fromCubemap(u,m),m.texture.pmremVersion=u.pmremVersion,e.set(u,m),m.texture;if(m!==void 0)return m.texture;{let M=u.image;return g&&M&&M.height>0||_&&M&&l(M)?(n===null&&(n=new Ha(i)),m=g?n.fromEquirectangular(u):n.fromCubemap(u),m.texture.pmremVersion=u.pmremVersion,e.set(u,m),u.addEventListener("dispose",h),m.texture):null}}}return u}function a(u,p){return p===Ko?u.mapping=fi:p===jo&&(u.mapping=Ui),u}function l(u){let p=0,g=6;for(let _=0;_=65535?Ks:Js)(u,1);m.version=_;let f=r.get(d);f&&t.remove(f),r.set(d,m)}function h(d){let u=r.get(d);if(u){let p=d.index;p!==null&&u.versiont.maxTextureSize&&(v=Math.ceil(b/t.maxTextureSize),b=t.maxTextureSize);let S=new Float32Array(b*v*4*d),A=new Zs(S,b,v,d);A.type=Ge,A.needsUpdate=!0;let x=E*4;for(let R=0;R0){let _=new Ga(g.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 p=u.mapping,g=p===jo||p===Qo,_=p===fi||p===Fi;if(g||_){let m=t.get(u),f=m!==void 0?m.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==f)return n===null&&(n=new Ha(i)),m=g?n.fromEquirectangular(u,m):n.fromCubemap(u,m),m.texture.pmremVersion=u.pmremVersion,t.set(u,m),m.texture;if(m!==void 0)return m.texture;{let M=u.image;return g&&M&&M.height>0||_&&M&&l(M)?(n===null&&(n=new Ha(i)),m=g?n.fromEquirectangular(u):n.fromCubemap(u),m.texture.pmremVersion=u.pmremVersion,t.set(u,m),u.addEventListener("dispose",h),m.texture):null}}}return u}function a(u,p){return p===jo?u.mapping=fi:p===Qo&&(u.mapping=Fi),u}function l(u){let p=0,g=6;for(let _=0;_=65535?js:Ks)(u,1);m.version=_;let f=r.get(d);f&&e.remove(f),r.set(d,m)}function h(d){let u=r.get(d);if(u){let p=d.index;p!==null&&u.versione.maxTextureSize&&(v=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);let S=new Float32Array(b*v*4*d),A=new Js(S,b,v,d);A.type=Gt,A.needsUpdate=!0;let x=E*4;for(let R=0;R0&&M[0].isRenderPass===!0;let v=o.width,S=o.height;M.length>0&&a===null&&(a=new Fe(v,S,{type:Sn,depthBuffer:!1,stencilBuffer:!1}),l=new Fe(v,S,{type:Sn,depthBuffer:!1,stencilBuffer:!1}));for(let A=0;A0)return i;let s=t*e,r=md[s];if(r===void 0&&(r=new Float32Array(s),md[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 Pe(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 bd(i,t,e){let n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}var fx=37297,px=0;function mx(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 Md=new Ot;function gx(i){Yt._getMatrix(Md,Yt.workingColorSpace,i);let t=`mat3( ${Md.elements.map(e=>e.toFixed(4))} )`;switch(Yt.getTransfer(i)){case qs:return[t,"LinearTransferOETF"];case te:return[t,"sRGBTransferOETF"];default:return Dt("WebGLProgram: Unsupported color space: ",i),[t,"LinearTransferOETF"]}}function Sd(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 xt(c,h),u=new Fn(-1,1,1,-1,0,1),p=null,g=null,_=!1,m,f=null,M=[],E=!1;this.setSize=function(b,v){o.setSize(b,v),a!==null&&a.setSize(b,v),l!==null&&l.setSize(b,v);for(let S=0;S0&&M[0].isRenderPass===!0;let v=o.width,S=o.height;M.length>0&&a===null&&(a=new Ft(v,S,{type:Sn,depthBuffer:!1,stencilBuffer:!1}),l=new Ft(v,S,{type:Sn,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 Pt(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 wd(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var Ex=37297,Tx=0;function Ax(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 Ed=new Oe;function Rx(i){Ye._getMatrix(Ed,Ye.workingColorSpace,i);let e=`mat3( ${Ed.elements.map(t=>t.toFixed(4))} )`;switch(Ye.getTransfer(i)){case Ys:return[e,"LinearTransferOETF"];case et:return[e,"sRGBTransferOETF"];default:return De("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function Td(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+` -`+mx(i.getShaderSource(t),a)}else return r}function _x(i,t){let e=gx(t);return[`vec4 ${i}( vec4 value ) {`,` return ${e[1]}( vec4( value.rgb * ${e[0]}, value.a ) );`,"}"].join(` -`)}var xx={[oc]:"Linear",[ac]:"Reinhard",[lc]:"Cineon",[cc]:"ACESFilmic",[uc]:"AgX",[dc]:"Neutral",[hc]:"Custom"};function vx(i,t){let e=xx[t];return e===void 0?(Dt("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}var ka=new I;function yx(){Yt.getLuminanceCoefficients(ka);let i=ka.x.toFixed(4),t=ka.y.toFixed(4),e=ka.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${t}, ${e} );`," return dot( weights, rgb );","}"].join(` -`)}function bx(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(yr).join(` -`)}function Mx(i){let t=[];for(let e in i){let n=i[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(` -`)}function Sx(i,t){let e={},n=i.getProgramParameter(t,i.ACTIVE_ATTRIBUTES);for(let s=0;s/gm;function qc(i){return i.replace(wx,Tx)}var Ex=new Map;function Tx(i,t){let e=Wt[t];if(e===void 0){let n=Ex.get(t);if(n!==void 0)e=Wt[n],Dt('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+t+">")}return qc(e)}var Ax=/#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 Td(i){return i.replace(Ax,Rx)}function Rx(i,t,e,n){let s="";for(let r=parseInt(t);r/gm;function Yc(i){return i.replace(Fx,Ox)}var Bx=new Map;function Ox(i,e){let t=We[e];if(t===void 0){let n=Bx.get(e);if(n!==void 0)t=We[n],De('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return Yc(t)}var zx=/#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 Cd(i){return i.replace(zx,kx)}function kx(i,e,t,n){let s="";for(let r=parseInt(e);r0&&(m+=` -`),f=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(yr).join(` +`),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(br).join(` `),f.length>0&&(f+=` -`)):(m=[Ad(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,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(yr).join(` -`),f=[Ad(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,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!==bn?"#define TONE_MAPPING":"",e.toneMapping!==bn?Wt.tonemapping_pars_fragment:"",e.toneMapping!==bn?vx("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",Wt.colorspace_pars_fragment,_x("linearToOutputTexel",e.outputColorSpace),yx(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",` -`].filter(yr).join(` -`)),o=qc(o),o=wd(o,e),o=Ed(o,e),a=qc(a),a=wd(a,e),a=Ed(a,e),o=Td(o),a=Td(a),e.isRawShaderMaterial!==!0&&(M=`#version 300 es +`)):(m=[Id(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,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(br).join(` +`),f=[Id(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,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!==bn?"#define TONE_MAPPING":"",t.toneMapping!==bn?We.tonemapping_pars_fragment:"",t.toneMapping!==bn?Px("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",We.colorspace_pars_fragment,Cx("linearToOutputTexel",t.outputColorSpace),Lx(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(br).join(` +`)),o=Yc(o),o=Ad(o,t),o=Rd(o,t),a=Yc(a),a=Ad(a,t),a=Rd(a,t),o=Cd(o),a=Cd(a),t.isRawShaderMaterial!==!0&&(M=`#version 300 es `,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+m,f=["#define varying in",e.glslVersion===Ec?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===Ec?"":"#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(` +`+m,f=["#define varying in",t.glslVersion===Tc?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Tc?"":"#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(` `)+` -`+f);let E=M+m+o,b=M+f+a,v=bd(s,s.VERTEX_SHADER,E),S=bd(s,s.FRAGMENT_SHADER,b);s.attachShader(_,v),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(_)||"",U=s.getShaderInfoLog(v)||"",C=s.getShaderInfoLog(S)||"",B=N.trim(),z=U.trim(),W=C.trim(),F=!0,D=!0;if(s.getProgramParameter(_,s.LINK_STATUS)===!1)if(F=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,_,v,S);else{let X=Sd(s,v,"vertex"),Z=Sd(s,S,"fragment");Ut("WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(_,s.VALIDATE_STATUS)+` +`+f);let E=M+m+o,b=M+f+a,v=wd(s,s.VERTEX_SHADER,E),S=wd(s,s.FRAGMENT_SHADER,b);s.attachShader(_,v),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(_)||"",U=s.getShaderInfoLog(v)||"",C=s.getShaderInfoLog(S)||"",B=N.trim(),z=U.trim(),W=C.trim(),F=!0,D=!0;if(s.getProgramParameter(_,s.LINK_STATUS)===!1)if(F=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,_,v,S);else{let X=Td(s,v,"vertex"),Z=Td(s,S,"fragment");Ue("WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(_,s.VALIDATE_STATUS)+` Material Name: `+L.name+` Material Type: `+L.type+` Program Info Log: `+B+` `+X+` -`+Z)}else B!==""?Dt("WebGLProgram: Program Info Log:",B):(z===""||W==="")&&(D=!1);D&&(L.diagnostics={runnable:F,programLog:B,vertexShader:{log:z,prefix:m},fragmentShader:{log:W,prefix:f}})}s.deleteShader(v),s.deleteShader(S),x=new Ts(s,_),T=Sx(s,_)}let x;this.getUniforms=function(){return x===void 0&&A(this),x};let T;this.getAttributes=function(){return T===void 0&&A(this),T};let R=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return R===!1&&(R=s.getProgramParameter(_,fx)),R},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=px++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=v,this.fragmentShader=S,this}var zx=0,Yc=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 $c(t),e.set(t,n)),n}},$c=class{constructor(t){this.id=zx++,this.code=t,this.usedTimes=0}};function kx(i){return i===gi||i===gr||i===_r}function Hx(i,t,e,n,s,r){let o=new us,a=new Yc,l=new Set,c=[],h=new Map,d=n.logarithmicDepthBuffer,u=n.precision,p={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 g(x){return l.add(x),x===0?"uv":`uv${x}`}function _(x,T,R,L,N,U){let C=L.fog,B=N.geometry,z=x.isMeshStandardMaterial||x.isMeshLambertMaterial||x.isMeshPhongMaterial?L.environment:null,W=x.isMeshStandardMaterial||x.isMeshLambertMaterial&&!x.envMap||x.isMeshPhongMaterial&&!x.envMap,F=t.get(x.envMap||z,W),D=F&&F.mapping===hr?F.image.height:null,X=p[x.type];x.precision!==null&&(u=n.getMaxPrecision(x.precision),u!==x.precision&&Dt("WebGLProgram.getParameters:",x.precision,"not supported, using",u,"instead."));let Z=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,G=Z!==void 0?Z.length:0,Q=0;B.morphAttributes.position!==void 0&&(Q=1),B.morphAttributes.normal!==void 0&&(Q=2),B.morphAttributes.color!==void 0&&(Q=3);let lt,ct,et,V;if(X){let ue=kn[X];lt=ue.vertexShader,ct=ue.fragmentShader}else{lt=x.vertexShader,ct=x.fragmentShader;let ue=a.getVertexShaderStage(x),jt=a.getFragmentShaderStage(x);a.update(x,ue,jt),et=ue.id,V=jt.id}let j=i.getRenderTarget(),ut=i.state.buffers.depth.getReversed(),Lt=N.isInstancedMesh===!0,bt=N.isBatchedMesh===!0,Bt=!!x.map,ve=!!x.matcap,Vt=!!F,Jt=!!x.aoMap,he=!!x.lightMap,qt=!!x.bumpMap&&x.wireframe===!1,ye=!!x.normalMap,De=!!x.displacementMap,tn=!!x.emissiveMap,be=!!x.metalnessMap,we=!!x.roughnessMap,H=x.anisotropy>0,We=x.clearcoat>0,ee=x.dispersion>0,P=x.retroreflectivity>0,y=x.iridescence>0,q=x.sheen>0,J=x.transmission>0,nt=H&&!!x.anisotropyMap,ht=We&&!!x.clearcoatMap,dt=We&&!!x.clearcoatNormalMap,it=We&&!!x.clearcoatRoughnessMap,ot=y&&!!x.iridescenceMap,ft=y&&!!x.iridescenceThicknessMap,Ct=q&&!!x.sheenColorMap,_t=q&&!!x.sheenRoughnessMap,pt=!!x.specularMap,It=!!x.specularColorMap,Nt=!!x.specularIntensityMap,zt=J&&!!x.transmissionMap,k=J&&!!x.thicknessMap,mt=!!x.gradientMap,rt=!!x.alphaMap,gt=x.alphaTest>0,Mt=!!x.alphaHash,at=!!x.extensions,Pt=bn;x.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(Pt=i.toneMapping);let At={shaderID:X,shaderType:x.type,shaderName:x.name,vertexShader:lt,fragmentShader:ct,defines:x.defines,customVertexShaderID:et,customFragmentShaderID:V,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:u,batching:bt,batchingColor:bt&&N._colorsTexture!==null,instancing:Lt,instancingColor:Lt&&N.instanceColor!==null,instancingMorph:Lt&&N.morphTexture!==null,outputColorSpace:j===null?i.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:Yt.workingColorSpace,alphaToCoverage:!!x.alphaToCoverage,map:Bt,matcap:ve,envMap:Vt,envMapMode:Vt&&F.mapping,envMapCubeUVHeight:D,aoMap:Jt,lightMap:he,bumpMap:qt,normalMap:ye,displacementMap:De,emissiveMap:tn,normalMapObjectSpace:ye&&x.normalMapType===Zu,normalMapTangentSpace:ye&&x.normalMapType===Fa,packedNormalMap:ye&&x.normalMapType===Fa&&kx(x.normalMap.format),metalnessMap:be,roughnessMap:we,anisotropy:H,anisotropyMap:nt,clearcoat:We,clearcoatMap:ht,clearcoatNormalMap:dt,clearcoatRoughnessMap:it,dispersion:ee,retroreflection:P,iridescence:y,iridescenceMap:ot,iridescenceThicknessMap:ft,sheen:q,sheenColorMap:Ct,sheenRoughnessMap:_t,specularMap:pt,specularColorMap:It,specularIntensityMap:Nt,transmission:J,transmissionMap:zt,thicknessMap:k,gradientMap:mt,opaque:x.transparent===!1&&x.blending===ys&&x.alphaToCoverage===!1,alphaMap:rt,alphaTest:gt,alphaHash:Mt,combine:x.combine,mapUv:Bt&&g(x.map.channel),aoMapUv:Jt&&g(x.aoMap.channel),lightMapUv:he&&g(x.lightMap.channel),bumpMapUv:qt&&g(x.bumpMap.channel),normalMapUv:ye&&g(x.normalMap.channel),displacementMapUv:De&&g(x.displacementMap.channel),emissiveMapUv:tn&&g(x.emissiveMap.channel),metalnessMapUv:be&&g(x.metalnessMap.channel),roughnessMapUv:we&&g(x.roughnessMap.channel),anisotropyMapUv:nt&&g(x.anisotropyMap.channel),clearcoatMapUv:ht&&g(x.clearcoatMap.channel),clearcoatNormalMapUv:dt&&g(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:it&&g(x.clearcoatRoughnessMap.channel),iridescenceMapUv:ot&&g(x.iridescenceMap.channel),iridescenceThicknessMapUv:ft&&g(x.iridescenceThicknessMap.channel),sheenColorMapUv:Ct&&g(x.sheenColorMap.channel),sheenRoughnessMapUv:_t&&g(x.sheenRoughnessMap.channel),specularMapUv:pt&&g(x.specularMap.channel),specularColorMapUv:It&&g(x.specularColorMap.channel),specularIntensityMapUv:Nt&&g(x.specularIntensityMap.channel),transmissionMapUv:zt&&g(x.transmissionMap.channel),thicknessMapUv:k&&g(x.thicknessMap.channel),alphaMapUv:rt&&g(x.alphaMap.channel),vertexTangents:!!B.attributes.tangent&&(ye||H),vertexNormals:!!B.attributes.normal,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!B.attributes.uv&&(Bt||rt),fog:!!C,useFog:x.fog===!0,fogExp2:!!C&&C.isFogExp2,flatShading:x.wireframe===!1&&(x.flatShading===!0||B.attributes.normal===void 0&&ye===!1&&(x.isMeshLambertMaterial||x.isMeshPhongMaterial||x.isMeshStandardMaterial||x.isMeshPhysicalMaterial)),sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:ut,skinning:N.isSkinnedMesh===!0,hasPositionAttribute:B.attributes.position!==void 0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:G,morphTextureStride:Q,numSunLights:T.sun.length,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numSunLightShadows:T.sunShadowMap.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numLightProbeGrids:U.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:x.dithering,shadowMapEnabled:i.shadowMap.enabled&&R.length>0,shadowMapType:i.shadowMap.type,toneMapping:Pt,decodeVideoTexture:Bt&&x.map.isVideoTexture===!0&&Yt.getTransfer(x.map.colorSpace)===te,decodeVideoTextureEmissive:tn&&x.emissiveMap.isVideoTexture===!0&&Yt.getTransfer(x.emissiveMap.colorSpace)===te,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===Ie,flipSided:x.side===Ve,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionClipCullDistance:at&&x.extensions.clipCullDistance===!0&&e.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(at&&x.extensions.multiDraw===!0||bt)&&e.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:e.has("KHR_parallel_shader_compile"),customProgramCacheKey:x.customProgramCacheKey()};return At.vertexUv1s=l.has(1),At.vertexUv2s=l.has(2),At.vertexUv3s=l.has(3),l.clear(),At}function m(x){let T=[];if(x.shaderID?T.push(x.shaderID):(T.push(x.customVertexShaderID),T.push(x.customFragmentShaderID)),x.defines!==void 0)for(let R in x.defines)T.push(R),T.push(x.defines[R]);return x.isRawShaderMaterial===!1&&(f(T,x),M(T,x),T.push(i.outputColorSpace)),T.push(x.customProgramCacheKey),T.join()}function f(x,T){x.push(T.precision),x.push(T.outputColorSpace),x.push(T.envMapMode),x.push(T.envMapCubeUVHeight),x.push(T.mapUv),x.push(T.alphaMapUv),x.push(T.lightMapUv),x.push(T.aoMapUv),x.push(T.bumpMapUv),x.push(T.normalMapUv),x.push(T.displacementMapUv),x.push(T.emissiveMapUv),x.push(T.metalnessMapUv),x.push(T.roughnessMapUv),x.push(T.anisotropyMapUv),x.push(T.clearcoatMapUv),x.push(T.clearcoatNormalMapUv),x.push(T.clearcoatRoughnessMapUv),x.push(T.iridescenceMapUv),x.push(T.iridescenceThicknessMapUv),x.push(T.sheenColorMapUv),x.push(T.sheenRoughnessMapUv),x.push(T.specularMapUv),x.push(T.specularColorMapUv),x.push(T.specularIntensityMapUv),x.push(T.transmissionMapUv),x.push(T.thicknessMapUv),x.push(T.combine),x.push(T.fogExp2),x.push(T.sizeAttenuation),x.push(T.morphTargetsCount),x.push(T.morphAttributeCount),x.push(T.numSunLights),x.push(T.numDirLights),x.push(T.numPointLights),x.push(T.numSpotLights),x.push(T.numSpotLightMaps),x.push(T.numHemiLights),x.push(T.numRectAreaLights),x.push(T.numSunLightShadows),x.push(T.numDirLightShadows),x.push(T.numPointLightShadows),x.push(T.numSpotLightShadows),x.push(T.numSpotLightShadowsWithMaps),x.push(T.numLightProbes),x.push(T.shadowMapType),x.push(T.toneMapping),x.push(T.numClippingPlanes),x.push(T.numClipIntersection),x.push(T.depthPacking)}function M(x,T){o.disableAll(),T.instancing&&o.enable(0),T.instancingColor&&o.enable(1),T.instancingMorph&&o.enable(2),T.matcap&&o.enable(3),T.envMap&&o.enable(4),T.normalMapObjectSpace&&o.enable(5),T.normalMapTangentSpace&&o.enable(6),T.clearcoat&&o.enable(7),T.iridescence&&o.enable(8),T.alphaTest&&o.enable(9),T.vertexColors&&o.enable(10),T.vertexAlphas&&o.enable(11),T.vertexUv1s&&o.enable(12),T.vertexUv2s&&o.enable(13),T.vertexUv3s&&o.enable(14),T.vertexTangents&&o.enable(15),T.anisotropy&&o.enable(16),T.alphaHash&&o.enable(17),T.batching&&o.enable(18),T.dispersion&&o.enable(19),T.retroreflection&&o.enable(24),T.batchingColor&&o.enable(20),T.gradientMap&&o.enable(21),T.packedNormalMap&&o.enable(22),T.vertexNormals&&o.enable(23),x.push(o.mask),o.disableAll(),T.fog&&o.enable(0),T.useFog&&o.enable(1),T.flatShading&&o.enable(2),T.logarithmicDepthBuffer&&o.enable(3),T.reversedDepthBuffer&&o.enable(4),T.skinning&&o.enable(5),T.morphTargets&&o.enable(6),T.morphNormals&&o.enable(7),T.morphColors&&o.enable(8),T.premultipliedAlpha&&o.enable(9),T.shadowMapEnabled&&o.enable(10),T.doubleSided&&o.enable(11),T.flipSided&&o.enable(12),T.useDepthPacking&&o.enable(13),T.dithering&&o.enable(14),T.transmission&&o.enable(15),T.sheen&&o.enable(16),T.opaque&&o.enable(17),T.pointsUvs&&o.enable(18),T.decodeVideoTexture&&o.enable(19),T.decodeVideoTextureEmissive&&o.enable(20),T.alphaToCoverage&&o.enable(21),T.numLightProbeGrids>0&&o.enable(22),T.hasPositionAttribute&&o.enable(23),x.push(o.mask)}function E(x){let T=p[x.type],R;if(T){let L=kn[T];R=ld.clone(L.uniforms)}else R=x.uniforms;return R}function b(x,T){let R=h.get(T);return R!==void 0?++R.usedTimes:(R=new Ox(i,T,x,s),c.push(R),h.set(T,R)),R}function v(x){if(--x.usedTimes===0){let T=c.indexOf(x);c[T]=c[c.length-1],c.pop(),h.delete(x.cacheKey),x.destroy()}}function S(x){a.remove(x)}function A(){a.dispose()}return{getParameters:_,getProgramCacheKey:m,getUniforms:E,acquireProgram:b,releaseProgram:v,releaseShaderCache:S,programs:c,dispose:A}}function Vx(){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 Gx(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 Rd(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 Cd(){let i=[],t=0,e=[],n=[],s=[];function r(){t=0,e.length=0,n.length=0,s.length=0}function o(u){let p=0;return u.isInstancedMesh&&(p+=2),u.isSkinnedMesh&&(p+=1),p}function a(u,p,g,_,m,f){let M=i[t];return M===void 0?(M={id:u.id,object:u,geometry:p,material:g,materialVariant:o(u),groupOrder:_,renderOrder:u.renderOrder,z:m,group:f},i[t]=M):(M.id=u.id,M.object=u,M.geometry=p,M.material=g,M.materialVariant=o(u),M.groupOrder=_,M.renderOrder=u.renderOrder,M.z=m,M.group=f),t++,M}function l(u,p,g,_,m,f,M){M.reversedDepth===!0&&(m=-m);let E=a(u,p,g,_,m,f);g.transmission>0?n.push(E):g.transparent===!0?s.push(E):e.push(E)}function c(u,p,g,_,m,f){let M=a(u,p,g,_,m,f);g.transmission>0?n.unshift(M):g.transparent===!0?s.unshift(M):e.unshift(M)}function h(u,p){e.length>1&&e.sort(u||Gx),n.length>1&&n.sort(p||Rd),s.length>1&&s.sort(p||Rd)}function d(){for(let u=t,p=i.length;u=r.length?(o=new Cd,r.push(o)):o=r[s],o}function e(){i=new WeakMap}return{get:t,dispose:e}}function Xx(){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 I,color:new Ft};break;case"SpotLight":e={position:new I,direction:new I,color:new Ft,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new I,color:new Ft,distance:0,decay:0};break;case"HemisphereLight":e={direction:new I,skyColor:new Ft,groundColor:new Ft};break;case"RectAreaLight":e={color:new Ft,position:new I,halfWidth:new I,halfHeight:new I};break}return i[t.id]=e,e}}}function qx(){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 Ht};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ht};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ht,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}var Yx=0;function $x(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function Zx(i){let t=new Xx,e=qx(),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 I);let s=new I,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 p=0,g=0,_=0,m=0,f=0,M=0,E=0,b=0,v=0,S=0,A=0,x=0,T=0,R=0;c.sort($x);for(let N=0,U=c.length;N0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=xt.LTC_FLOAT_1,n.rectAreaLTC2=xt.LTC_FLOAT_2):(n.rectAreaLTC1=xt.LTC_HALF_1,n.rectAreaLTC2=xt.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=d,n.ambient[2]=u;let L=n.hash;(L.sunLength!==p||L.directionalLength!==m||L.pointLength!==f||L.spotLength!==M||L.rectAreaLength!==E||L.hemiLength!==b||L.numSunShadows!==g||L.numDirectionalShadows!==v||L.numPointShadows!==S||L.numSpotShadows!==A||L.numSpotMaps!==x||L.numLightProbes!==R)&&(n.sun.length=p,n.directional.length=m,n.spot.length=M,n.rectArea.length=E,n.point.length=f,n.hemi.length=b,n.sunShadow.length=g,n.sunShadowMap.length=g,n.sunShadowMatrix.length=_,n.sunShadowCascade.length=_,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.directionalShadowMatrix.length=v,n.pointShadow.length=S,n.pointShadowMap.length=S,n.pointShadowMatrix.length=S,n.spotShadow.length=A,n.spotShadowMap.length=A,n.spotLightMatrix.length=A+x-T,n.spotLightMap.length=x,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=R,L.sunLength=p,L.directionalLength=m,L.pointLength=f,L.spotLength=M,L.rectAreaLength=E,L.hemiLength=b,L.numSunShadows=g,L.numDirectionalShadows=v,L.numPointShadows=S,L.numSpotShadows=A,L.numSpotMaps=x,L.numLightProbes=R,n.version=Yx++)}function l(c,h){let d=0,u=0,p=0,g=0,_=0,m=0,f=h.matrixWorldInverse;for(let M=0,E=c.length;M=o.length?(a=new Id(i),o.push(a)):a=o[r],a}function n(){t=new WeakMap}return{get:e,dispose:n}}var Kx=`void main() { +`+Z)}else B!==""?De("WebGLProgram: Program Info Log:",B):(z===""||W==="")&&(D=!1);D&&(L.diagnostics={runnable:F,programLog:B,vertexShader:{log:z,prefix:m},fragmentShader:{log:W,prefix:f}})}s.deleteShader(v),s.deleteShader(S),x=new As(s,_),T=Ux(s,_)}let x;this.getUniforms=function(){return x===void 0&&A(this),x};let T;this.getAttributes=function(){return T===void 0&&A(this),T};let R=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return R===!1&&(R=s.getProgramParameter(_,Ex)),R},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Tx++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=v,this.fragmentShader=S,this}var Kx=0,$c=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 Zc(e),t.set(e,n)),n}},Zc=class{constructor(e){this.id=Kx++,this.code=e,this.usedTimes=0}};function jx(i){return i===gi||i===_r||i===xr}function Qx(i,e,t,n,s,r){let o=new ds,a=new $c,l=new Set,c=[],h=new Map,d=n.logarithmicDepthBuffer,u=n.precision,p={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 g(x){return l.add(x),x===0?"uv":`uv${x}`}function _(x,T,R,L,N,U){let C=L.fog,B=N.geometry,z=x.isMeshStandardMaterial||x.isMeshLambertMaterial||x.isMeshPhongMaterial?L.environment:null,W=x.isMeshStandardMaterial||x.isMeshLambertMaterial&&!x.envMap||x.isMeshPhongMaterial&&!x.envMap,F=e.get(x.envMap||z,W),D=F&&F.mapping===ur?F.image.height:null,X=p[x.type];x.precision!==null&&(u=n.getMaxPrecision(x.precision),u!==x.precision&&De("WebGLProgram.getParameters:",x.precision,"not supported, using",u,"instead."));let Z=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,G=Z!==void 0?Z.length:0,Q=0;B.morphAttributes.position!==void 0&&(Q=1),B.morphAttributes.normal!==void 0&&(Q=2),B.morphAttributes.color!==void 0&&(Q=3);let le,ce,te,H;if(X){let ut=kn[X];le=ut.vertexShader,ce=ut.fragmentShader}else{le=x.vertexShader,ce=x.fragmentShader;let ut=a.getVertexShaderStage(x),je=a.getFragmentShaderStage(x);a.update(x,ut,je),te=ut.id,H=je.id}let j=i.getRenderTarget(),ue=i.state.buffers.depth.getReversed(),Le=N.isInstancedMesh===!0,be=N.isBatchedMesh===!0,Be=!!x.map,vt=!!x.matcap,He=!!F,Je=!!x.aoMap,ht=!!x.lightMap,qe=!!x.bumpMap&&x.wireframe===!1,yt=!!x.normalMap,Dt=!!x.displacementMap,en=!!x.emissiveMap,bt=!!x.metalnessMap,wt=!!x.roughnessMap,V=x.anisotropy>0,Wt=x.clearcoat>0,tt=x.dispersion>0,P=x.retroreflectivity>0,y=x.iridescence>0,q=x.sheen>0,J=x.transmission>0,ne=V&&!!x.anisotropyMap,he=Wt&&!!x.clearcoatMap,de=Wt&&!!x.clearcoatNormalMap,ie=Wt&&!!x.clearcoatRoughnessMap,oe=y&&!!x.iridescenceMap,fe=y&&!!x.iridescenceThicknessMap,Ce=q&&!!x.sheenColorMap,_e=q&&!!x.sheenRoughnessMap,pe=!!x.specularMap,Ie=!!x.specularColorMap,Ne=!!x.specularIntensityMap,ze=J&&!!x.transmissionMap,k=J&&!!x.thicknessMap,me=!!x.gradientMap,re=!!x.alphaMap,ge=x.alphaTest>0,Me=!!x.alphaHash,ae=!!x.extensions,Pe=bn;x.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(Pe=i.toneMapping);let Ae={shaderID:X,shaderType:x.type,shaderName:x.name,vertexShader:le,fragmentShader:ce,defines:x.defines,customVertexShaderID:te,customFragmentShaderID:H,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:u,batching:be,batchingColor:be&&N._colorsTexture!==null,instancing:Le,instancingColor:Le&&N.instanceColor!==null,instancingMorph:Le&&N.morphTexture!==null,outputColorSpace:j===null?i.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:Ye.workingColorSpace,alphaToCoverage:!!x.alphaToCoverage,map:Be,matcap:vt,envMap:He,envMapMode:He&&F.mapping,envMapCubeUVHeight:D,aoMap:Je,lightMap:ht,bumpMap:qe,normalMap:yt,displacementMap:Dt,emissiveMap:en,normalMapObjectSpace:yt&&x.normalMapType===ju,normalMapTangentSpace:yt&&x.normalMapType===Ba,packedNormalMap:yt&&x.normalMapType===Ba&&jx(x.normalMap.format),metalnessMap:bt,roughnessMap:wt,anisotropy:V,anisotropyMap:ne,clearcoat:Wt,clearcoatMap:he,clearcoatNormalMap:de,clearcoatRoughnessMap:ie,dispersion:tt,retroreflection:P,iridescence:y,iridescenceMap:oe,iridescenceThicknessMap:fe,sheen:q,sheenColorMap:Ce,sheenRoughnessMap:_e,specularMap:pe,specularColorMap:Ie,specularIntensityMap:Ne,transmission:J,transmissionMap:ze,thicknessMap:k,gradientMap:me,opaque:x.transparent===!1&&x.blending===bs&&x.alphaToCoverage===!1,alphaMap:re,alphaTest:ge,alphaHash:Me,combine:x.combine,mapUv:Be&&g(x.map.channel),aoMapUv:Je&&g(x.aoMap.channel),lightMapUv:ht&&g(x.lightMap.channel),bumpMapUv:qe&&g(x.bumpMap.channel),normalMapUv:yt&&g(x.normalMap.channel),displacementMapUv:Dt&&g(x.displacementMap.channel),emissiveMapUv:en&&g(x.emissiveMap.channel),metalnessMapUv:bt&&g(x.metalnessMap.channel),roughnessMapUv:wt&&g(x.roughnessMap.channel),anisotropyMapUv:ne&&g(x.anisotropyMap.channel),clearcoatMapUv:he&&g(x.clearcoatMap.channel),clearcoatNormalMapUv:de&&g(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ie&&g(x.clearcoatRoughnessMap.channel),iridescenceMapUv:oe&&g(x.iridescenceMap.channel),iridescenceThicknessMapUv:fe&&g(x.iridescenceThicknessMap.channel),sheenColorMapUv:Ce&&g(x.sheenColorMap.channel),sheenRoughnessMapUv:_e&&g(x.sheenRoughnessMap.channel),specularMapUv:pe&&g(x.specularMap.channel),specularColorMapUv:Ie&&g(x.specularColorMap.channel),specularIntensityMapUv:Ne&&g(x.specularIntensityMap.channel),transmissionMapUv:ze&&g(x.transmissionMap.channel),thicknessMapUv:k&&g(x.thicknessMap.channel),alphaMapUv:re&&g(x.alphaMap.channel),vertexTangents:!!B.attributes.tangent&&(yt||V),vertexNormals:!!B.attributes.normal,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!B.attributes.uv&&(Be||re),fog:!!C,useFog:x.fog===!0,fogExp2:!!C&&C.isFogExp2,flatShading:x.wireframe===!1&&(x.flatShading===!0||B.attributes.normal===void 0&&yt===!1&&(x.isMeshLambertMaterial||x.isMeshPhongMaterial||x.isMeshStandardMaterial||x.isMeshPhysicalMaterial)),sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:ue,skinning:N.isSkinnedMesh===!0,hasPositionAttribute:B.attributes.position!==void 0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:G,morphTextureStride:Q,numSunLights:T.sun.length,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numSunLightShadows:T.sunShadowMap.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numLightProbeGrids:U.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:x.dithering,shadowMapEnabled:i.shadowMap.enabled&&R.length>0,shadowMapType:i.shadowMap.type,toneMapping:Pe,decodeVideoTexture:Be&&x.map.isVideoTexture===!0&&Ye.getTransfer(x.map.colorSpace)===et,decodeVideoTextureEmissive:en&&x.emissiveMap.isVideoTexture===!0&&Ye.getTransfer(x.emissiveMap.colorSpace)===et,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===It,flipSided:x.side===Ht,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionClipCullDistance:ae&&x.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ae&&x.extensions.multiDraw===!0||be)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:x.customProgramCacheKey()};return Ae.vertexUv1s=l.has(1),Ae.vertexUv2s=l.has(2),Ae.vertexUv3s=l.has(3),l.clear(),Ae}function m(x){let T=[];if(x.shaderID?T.push(x.shaderID):(T.push(x.customVertexShaderID),T.push(x.customFragmentShaderID)),x.defines!==void 0)for(let R in x.defines)T.push(R),T.push(x.defines[R]);return x.isRawShaderMaterial===!1&&(f(T,x),M(T,x),T.push(i.outputColorSpace)),T.push(x.customProgramCacheKey),T.join()}function f(x,T){x.push(T.precision),x.push(T.outputColorSpace),x.push(T.envMapMode),x.push(T.envMapCubeUVHeight),x.push(T.mapUv),x.push(T.alphaMapUv),x.push(T.lightMapUv),x.push(T.aoMapUv),x.push(T.bumpMapUv),x.push(T.normalMapUv),x.push(T.displacementMapUv),x.push(T.emissiveMapUv),x.push(T.metalnessMapUv),x.push(T.roughnessMapUv),x.push(T.anisotropyMapUv),x.push(T.clearcoatMapUv),x.push(T.clearcoatNormalMapUv),x.push(T.clearcoatRoughnessMapUv),x.push(T.iridescenceMapUv),x.push(T.iridescenceThicknessMapUv),x.push(T.sheenColorMapUv),x.push(T.sheenRoughnessMapUv),x.push(T.specularMapUv),x.push(T.specularColorMapUv),x.push(T.specularIntensityMapUv),x.push(T.transmissionMapUv),x.push(T.thicknessMapUv),x.push(T.combine),x.push(T.fogExp2),x.push(T.sizeAttenuation),x.push(T.morphTargetsCount),x.push(T.morphAttributeCount),x.push(T.numSunLights),x.push(T.numDirLights),x.push(T.numPointLights),x.push(T.numSpotLights),x.push(T.numSpotLightMaps),x.push(T.numHemiLights),x.push(T.numRectAreaLights),x.push(T.numSunLightShadows),x.push(T.numDirLightShadows),x.push(T.numPointLightShadows),x.push(T.numSpotLightShadows),x.push(T.numSpotLightShadowsWithMaps),x.push(T.numLightProbes),x.push(T.shadowMapType),x.push(T.toneMapping),x.push(T.numClippingPlanes),x.push(T.numClipIntersection),x.push(T.depthPacking)}function M(x,T){o.disableAll(),T.instancing&&o.enable(0),T.instancingColor&&o.enable(1),T.instancingMorph&&o.enable(2),T.matcap&&o.enable(3),T.envMap&&o.enable(4),T.normalMapObjectSpace&&o.enable(5),T.normalMapTangentSpace&&o.enable(6),T.clearcoat&&o.enable(7),T.iridescence&&o.enable(8),T.alphaTest&&o.enable(9),T.vertexColors&&o.enable(10),T.vertexAlphas&&o.enable(11),T.vertexUv1s&&o.enable(12),T.vertexUv2s&&o.enable(13),T.vertexUv3s&&o.enable(14),T.vertexTangents&&o.enable(15),T.anisotropy&&o.enable(16),T.alphaHash&&o.enable(17),T.batching&&o.enable(18),T.dispersion&&o.enable(19),T.retroreflection&&o.enable(24),T.batchingColor&&o.enable(20),T.gradientMap&&o.enable(21),T.packedNormalMap&&o.enable(22),T.vertexNormals&&o.enable(23),x.push(o.mask),o.disableAll(),T.fog&&o.enable(0),T.useFog&&o.enable(1),T.flatShading&&o.enable(2),T.logarithmicDepthBuffer&&o.enable(3),T.reversedDepthBuffer&&o.enable(4),T.skinning&&o.enable(5),T.morphTargets&&o.enable(6),T.morphNormals&&o.enable(7),T.morphColors&&o.enable(8),T.premultipliedAlpha&&o.enable(9),T.shadowMapEnabled&&o.enable(10),T.doubleSided&&o.enable(11),T.flipSided&&o.enable(12),T.useDepthPacking&&o.enable(13),T.dithering&&o.enable(14),T.transmission&&o.enable(15),T.sheen&&o.enable(16),T.opaque&&o.enable(17),T.pointsUvs&&o.enable(18),T.decodeVideoTexture&&o.enable(19),T.decodeVideoTextureEmissive&&o.enable(20),T.alphaToCoverage&&o.enable(21),T.numLightProbeGrids>0&&o.enable(22),T.hasPositionAttribute&&o.enable(23),x.push(o.mask)}function E(x){let T=p[x.type],R;if(T){let L=kn[T];R=ud.clone(L.uniforms)}else R=x.uniforms;return R}function b(x,T){let R=h.get(T);return R!==void 0?++R.usedTimes:(R=new Jx(i,T,x,s),c.push(R),h.set(T,R)),R}function v(x){if(--x.usedTimes===0){let T=c.indexOf(x);c[T]=c[c.length-1],c.pop(),h.delete(x.cacheKey),x.destroy()}}function S(x){a.remove(x)}function A(){a.dispose()}return{getParameters:_,getProgramCacheKey:m,getUniforms:E,acquireProgram:b,releaseProgram:v,releaseShaderCache:S,programs:c,dispose:A}}function ev(){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 tv(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 Pd(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 Ld(){let i=[],e=0,t=[],n=[],s=[];function r(){e=0,t.length=0,n.length=0,s.length=0}function o(u){let p=0;return u.isInstancedMesh&&(p+=2),u.isSkinnedMesh&&(p+=1),p}function a(u,p,g,_,m,f){let M=i[e];return M===void 0?(M={id:u.id,object:u,geometry:p,material:g,materialVariant:o(u),groupOrder:_,renderOrder:u.renderOrder,z:m,group:f},i[e]=M):(M.id=u.id,M.object=u,M.geometry=p,M.material=g,M.materialVariant=o(u),M.groupOrder=_,M.renderOrder=u.renderOrder,M.z=m,M.group=f),e++,M}function l(u,p,g,_,m,f,M){M.reversedDepth===!0&&(m=-m);let E=a(u,p,g,_,m,f);g.transmission>0?n.push(E):g.transparent===!0?s.push(E):t.push(E)}function c(u,p,g,_,m,f){let M=a(u,p,g,_,m,f);g.transmission>0?n.unshift(M):g.transparent===!0?s.unshift(M):t.unshift(M)}function h(u,p){t.length>1&&t.sort(u||tv),n.length>1&&n.sort(p||Pd),s.length>1&&s.sort(p||Pd)}function d(){for(let u=e,p=i.length;u=r.length?(o=new Ld,r.push(o)):o=r[s],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function iv(){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 I,color:new Fe};break;case"SpotLight":t={position:new I,direction:new I,color:new Fe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new I,color:new Fe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new I,skyColor:new Fe,groundColor:new Fe};break;case"RectAreaLight":t={color:new Fe,position:new I,halfWidth:new I,halfHeight:new I};break}return i[e.id]=t,t}}}function sv(){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 Ve};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var rv=0;function ov(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function av(i){let e=new iv,t=sv(),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 I);let s=new I,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 p=0,g=0,_=0,m=0,f=0,M=0,E=0,b=0,v=0,S=0,A=0,x=0,T=0,R=0;c.sort(ov);for(let N=0,U=c.length;N0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=xe.LTC_FLOAT_1,n.rectAreaLTC2=xe.LTC_FLOAT_2):(n.rectAreaLTC1=xe.LTC_HALF_1,n.rectAreaLTC2=xe.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=d,n.ambient[2]=u;let L=n.hash;(L.sunLength!==p||L.directionalLength!==m||L.pointLength!==f||L.spotLength!==M||L.rectAreaLength!==E||L.hemiLength!==b||L.numSunShadows!==g||L.numDirectionalShadows!==v||L.numPointShadows!==S||L.numSpotShadows!==A||L.numSpotMaps!==x||L.numLightProbes!==R)&&(n.sun.length=p,n.directional.length=m,n.spot.length=M,n.rectArea.length=E,n.point.length=f,n.hemi.length=b,n.sunShadow.length=g,n.sunShadowMap.length=g,n.sunShadowMatrix.length=_,n.sunShadowCascade.length=_,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.directionalShadowMatrix.length=v,n.pointShadow.length=S,n.pointShadowMap.length=S,n.pointShadowMatrix.length=S,n.spotShadow.length=A,n.spotShadowMap.length=A,n.spotLightMatrix.length=A+x-T,n.spotLightMap.length=x,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=R,L.sunLength=p,L.directionalLength=m,L.pointLength=f,L.spotLength=M,L.rectAreaLength=E,L.hemiLength=b,L.numSunShadows=g,L.numDirectionalShadows=v,L.numPointShadows=S,L.numSpotShadows=A,L.numSpotMaps=x,L.numLightProbes=R,n.version=rv++)}function l(c,h){let d=0,u=0,p=0,g=0,_=0,m=0,f=h.matrixWorldInverse;for(let M=0,E=c.length;M=o.length?(a=new Dd(i),o.push(a)):a=o[r],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var cv=`void main() { gl_Position = vec4( position, 1.0 ); -}`,jx=`uniform sampler2D shadow_pass; +}`,hv=`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 ); -}`,Qx=[new I(1,0,0),new I(-1,0,0),new I(0,1,0),new I(0,-1,0),new I(0,0,1),new I(0,0,-1)],tv=[new I(0,-1,0),new I(0,-1,0),new I(0,0,1),new I(0,0,-1),new I(0,-1,0),new I(0,-1,0)],Pd=new kt,vr=new I,Hc=new I;function ev(i,t,e){let n=new Un,s=new Ht,r=new Ht,o=new ae,a=new No,l=new Uo,c={},h=e.maxTextureSize,d={[Bn]:Ve,[Ve]:Bn,[Ie]:Ie},u=new He({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ht},radius:{value:4}},vertexShader:Kx,fragmentShader:jx}),p=u.clone();p.defines.HORIZONTAL_PASS=1;let g=new le;g.setAttribute("position",new Se(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let _=new xe(g,u),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=cr;let f=this.type;this.render=function(S,A,x){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||S.length===0)return;this.type===Tu&&(Dt("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=cr);let T=i.getRenderTarget(),R=i.getActiveCubeFace(),L=i.getActiveMipmapLevel(),N=i.state;N.setBlending(On),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 U=f!==this.type;U&&A.traverse(function(C){C.material&&(Array.isArray(C.material)?C.material.forEach(B=>B.needsUpdate=!0):C.material.needsUpdate=!0)});for(let C=0,B=S.length;Ch||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/F.x),s.x=r.x*F.x,W.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/F.y),s.y=r.y*F.y,W.mapSize.y=r.y));let D=i.state.buffers.depth.getReversed();if(W.camera._reversedDepth=D,W.map===null||U===!0){if(W.map!==null&&(W.map.depthTexture!==null&&(W.map.depthTexture.dispose(),W.map.depthTexture=null),W.map.dispose()),this.type===vs){if(z.isPointLight){Dt("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}W.map=new Fe(s.x,s.y,{format:gi,type:Sn,minFilter:ze,magFilter:ze,generateMipmaps:!1}),W.map.texture.name=z.name+".shadowMap",W.map.depthTexture=new ci(s.x,s.y,Ge),W.map.depthTexture.name=z.name+".shadowMapDepth",W.map.depthTexture.format=Pn,W.map.depthTexture.compareFunction=null,W.map.depthTexture.minFilter=Ue,W.map.depthTexture.magFilter=Ue}else z.isPointLight?(W.map=new Va(s.x),W.map.depthTexture=new Lo(s.x,Mn)):(W.map=new Fe(s.x,s.y),W.map.depthTexture=new ci(s.x,s.y,Mn)),W.map.depthTexture.name=z.name+".shadowMap",W.map.depthTexture.format=Pn,this.type===cr?(W.map.depthTexture.compareFunction=D?Oa:Ba,W.map.depthTexture.minFilter=ze,W.map.depthTexture.magFilter=ze):(W.map.depthTexture.compareFunction=null,W.map.depthTexture.minFilter=Ue,W.map.depthTexture.magFilter=Ue);W.camera.updateProjectionMatrix()}W.map.isWebGLCubeRenderTarget!==!0&&(W.map.width!==s.x||W.map.height!==s.y)&&W.map.setSize(s.x,s.y);let X=W.map.isWebGLCubeRenderTarget?6:W.getViewportCount();z.isPointLight!==!0&&W.updateMatrices(z,x);for(let Z=0;Z0||A.map&&A.alphaTest>0||A.alphaToCoverage===!0){let N=R.uuid,U=A.uuid,C=c[N];C===void 0&&(C={},c[N]=C);let B=C[U];B===void 0&&(B=R.clone(),C[U]=B,A.addEventListener("dispose",v)),R=B}if(R.visible=A.visible,R.wireframe=A.wireframe,T===vs?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,x.isPointLight===!0&&R.isMeshDistanceMaterial===!0){let N=i.properties.get(R);N.light=x}return R}function b(S,A,x,T,R){if(S.visible===!1)return;if(S.layers.test(A.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&R===vs)&&(!S.frustumCulled||S.intersectsFrustum(n))){S.modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,S.matrixWorld);let U=t.update(S),C=S.material;if(Array.isArray(C)){let B=U.groups;for(let z=0,W=B.length;z=1):D.indexOf("OpenGL ES")!==-1&&(F=parseFloat(/^OpenGL ES (\d)/.exec(D)[1]),W=F>=2);let X=null,Z={},G=i.getParameter(i.SCISSOR_BOX),Q=i.getParameter(i.VIEWPORT),lt=new ae().fromArray(G),ct=new ae().fromArray(Q);function et(k,mt,rt,gt){let Mt=new Uint8Array(4),at=i.createTexture();i.bindTexture(k,at),i.texParameteri(k,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(k,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Pt=0;Pt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ht,h=new WeakMap,d=new Set,u,p=new WeakMap,g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(P,y){return g?new OffscreenCanvas(P,y):Ys("canvas")}function m(P,y,q){let J=1,nt=ee(P);if((nt.width>q||nt.height>q)&&(J=q/Math.max(nt.width,nt.height)),J<1)if(typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&P instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&P instanceof ImageBitmap||typeof VideoFrame<"u"&&P instanceof VideoFrame){let ht=Math.floor(J*nt.width),dt=Math.floor(J*nt.height);u===void 0&&(u=_(ht,dt));let it=y?_(ht,dt):u;return it.width=ht,it.height=dt,it.getContext("2d").drawImage(P,0,0,ht,dt),Dt("WebGLRenderer: Texture has been resized from ("+nt.width+"x"+nt.height+") to ("+ht+"x"+dt+")."),it}else return"data"in P&&Dt("WebGLRenderer: Image in DataTexture is too big ("+nt.width+"x"+nt.height+")."),P;return P}function f(P){return P.generateMipmaps}function M(P){i.generateMipmap(P)}function E(P){return P.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:P.isWebGL3DRenderTarget?i.TEXTURE_3D:P.isWebGLArrayRenderTarget||P.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function b(P,y,q,J,nt,ht=!1){if(P!==null){if(i[P]!==void 0)return i[P];Dt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let dt;J&&(dt=t.get("EXT_texture_norm16"),dt||Dt("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let it=y;if(y===i.RED&&(q===i.FLOAT&&(it=i.R32F),q===i.HALF_FLOAT&&(it=i.R16F),q===i.UNSIGNED_BYTE&&(it=i.R8),q===i.UNSIGNED_SHORT&&dt&&(it=dt.R16_EXT),q===i.SHORT&&dt&&(it=dt.R16_SNORM_EXT)),y===i.RED_INTEGER&&(q===i.UNSIGNED_BYTE&&(it=i.R8UI),q===i.UNSIGNED_SHORT&&(it=i.R16UI),q===i.UNSIGNED_INT&&(it=i.R32UI),q===i.BYTE&&(it=i.R8I),q===i.SHORT&&(it=i.R16I),q===i.INT&&(it=i.R32I)),y===i.RG&&(q===i.FLOAT&&(it=i.RG32F),q===i.HALF_FLOAT&&(it=i.RG16F),q===i.UNSIGNED_BYTE&&(it=i.RG8),q===i.UNSIGNED_SHORT&&dt&&(it=dt.RG16_EXT),q===i.SHORT&&dt&&(it=dt.RG16_SNORM_EXT)),y===i.RG_INTEGER&&(q===i.UNSIGNED_BYTE&&(it=i.RG8UI),q===i.UNSIGNED_SHORT&&(it=i.RG16UI),q===i.UNSIGNED_INT&&(it=i.RG32UI),q===i.BYTE&&(it=i.RG8I),q===i.SHORT&&(it=i.RG16I),q===i.INT&&(it=i.RG32I)),y===i.RGB_INTEGER&&(q===i.UNSIGNED_BYTE&&(it=i.RGB8UI),q===i.UNSIGNED_SHORT&&(it=i.RGB16UI),q===i.UNSIGNED_INT&&(it=i.RGB32UI),q===i.BYTE&&(it=i.RGB8I),q===i.SHORT&&(it=i.RGB16I),q===i.INT&&(it=i.RGB32I)),y===i.RGBA_INTEGER&&(q===i.UNSIGNED_BYTE&&(it=i.RGBA8UI),q===i.UNSIGNED_SHORT&&(it=i.RGBA16UI),q===i.UNSIGNED_INT&&(it=i.RGBA32UI),q===i.BYTE&&(it=i.RGBA8I),q===i.SHORT&&(it=i.RGBA16I),q===i.INT&&(it=i.RGBA32I)),y===i.RGB&&(q===i.UNSIGNED_SHORT&&dt&&(it=dt.RGB16_EXT),q===i.SHORT&&dt&&(it=dt.RGB16_SNORM_EXT),q===i.UNSIGNED_INT_5_9_9_9_REV&&(it=i.RGB9_E5),q===i.UNSIGNED_INT_10F_11F_11F_REV&&(it=i.R11F_G11F_B10F)),y===i.RGBA){let ot=ht?qs:Yt.getTransfer(nt);q===i.FLOAT&&(it=i.RGBA32F),q===i.HALF_FLOAT&&(it=i.RGBA16F),q===i.UNSIGNED_BYTE&&(it=ot===te?i.SRGB8_ALPHA8:i.RGBA8),q===i.UNSIGNED_SHORT&&dt&&(it=dt.RGBA16_EXT),q===i.SHORT&&dt&&(it=dt.RGBA16_SNORM_EXT),q===i.UNSIGNED_SHORT_4_4_4_4&&(it=i.RGBA4),q===i.UNSIGNED_SHORT_5_5_5_1&&(it=i.RGB5_A1)}return(it===i.R16F||it===i.R32F||it===i.RG16F||it===i.RG32F||it===i.RGBA16F||it===i.RGBA32F)&&t.get("EXT_color_buffer_float"),it}function v(P,y){let q;return P?y===null||y===Mn||y===Ms?q=i.DEPTH24_STENCIL8:y===Ge?q=i.DEPTH32F_STENCIL8:y===bs&&(q=i.DEPTH24_STENCIL8,Dt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):y===null||y===Mn||y===Ms?q=i.DEPTH_COMPONENT24:y===Ge?q=i.DEPTH_COMPONENT32F:y===bs&&(q=i.DEPTH_COMPONENT16),q}function S(P,y){return f(P)===!0||P.isFramebufferTexture&&P.minFilter!==Ue&&P.minFilter!==ze?Math.log2(Math.max(y.width,y.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?y.mipmaps.length:1}function A(P){let y=P.target;y.removeEventListener("dispose",A),T(y),y.isVideoTexture&&h.delete(y),y.isHTMLTexture&&d.delete(y)}function x(P){let y=P.target;y.removeEventListener("dispose",x),L(y)}function T(P){let y=n.get(P);if(y.__webglInit===void 0)return;let q=P.source,J=p.get(q);if(J){let nt=J[y.__cacheKey];nt.usedTimes--,nt.usedTimes===0&&R(P),Object.keys(J).length===0&&p.delete(q)}n.remove(P)}function R(P){let y=n.get(P);i.deleteTexture(y.__webglTexture);let q=P.source,J=p.get(q);delete J[y.__cacheKey],o.memory.textures--}function L(P){let y=n.get(P);if(P.depthTexture&&(P.depthTexture.dispose(),n.remove(P.depthTexture)),P.isWebGLCubeRenderTarget)for(let J=0;J<6;J++){if(Array.isArray(y.__webglFramebuffer[J]))for(let nt=0;nt=s.maxTextures&&Dt("WebGLTextures: Trying to use "+(P+1)+" texture units while this GPU supports only "+s.maxTextures),N+=1,P}function W(P){let y=[];return y.push(P.wrapS),y.push(P.wrapT),y.push(P.wrapR||0),y.push(P.magFilter),y.push(P.minFilter),y.push(P.anisotropy),y.push(P.internalFormat),y.push(P.format),y.push(P.type),y.push(P.generateMipmaps),y.push(P.premultiplyAlpha),y.push(P.flipY),y.push(P.unpackAlignment),y.push(P.colorSpace),y.join()}function F(P,y){let q=n.get(P);if(P.isVideoTexture&&H(P),P.isRenderTargetTexture===!1&&P.isExternalTexture!==!0&&P.version>0&&q.__version!==P.version){let J=P.image;if(J===null)Dt("WebGLRenderer: Texture marked for update but no image data found.");else if(J.complete===!1)Dt("WebGLRenderer: Texture marked for update but image is incomplete");else{ut(q,P,y);return}}else P.isExternalTexture&&(q.__webglTexture=P.sourceTexture?P.sourceTexture:null);e.bindTexture(i.TEXTURE_2D,q.__webglTexture,i.TEXTURE0+y)}function D(P,y){let q=n.get(P);if(P.isRenderTargetTexture===!1&&P.version>0&&q.__version!==P.version){ut(q,P,y);return}else P.isExternalTexture&&(q.__webglTexture=P.sourceTexture?P.sourceTexture:null);e.bindTexture(i.TEXTURE_2D_ARRAY,q.__webglTexture,i.TEXTURE0+y)}function X(P,y){let q=n.get(P);if(P.isRenderTargetTexture===!1&&P.version>0&&q.__version!==P.version){ut(q,P,y);return}e.bindTexture(i.TEXTURE_3D,q.__webglTexture,i.TEXTURE0+y)}function Z(P,y){let q=n.get(P);if(P.isCubeDepthTexture!==!0&&P.version>0&&q.__version!==P.version){Lt(q,P,y);return}e.bindTexture(i.TEXTURE_CUBE_MAP,q.__webglTexture,i.TEXTURE0+y)}let G={[os]:i.REPEAT,[In]:i.CLAMP_TO_EDGE,[wo]:i.MIRRORED_REPEAT},Q={[Ue]:i.NEAREST,[Yu]:i.NEAREST_MIPMAP_NEAREST,[ur]:i.NEAREST_MIPMAP_LINEAR,[ze]:i.LINEAR,[Qo]:i.LINEAR_MIPMAP_NEAREST,[pi]:i.LINEAR_MIPMAP_LINEAR},lt={[Ku]:i.NEVER,[nd]:i.ALWAYS,[ju]:i.LESS,[Ba]:i.LEQUAL,[Qu]:i.EQUAL,[Oa]:i.GEQUAL,[td]:i.GREATER,[ed]:i.NOTEQUAL};function ct(P,y){if(y.type===Ge&&t.has("OES_texture_float_linear")===!1&&(y.magFilter===ze||y.magFilter===Qo||y.magFilter===ur||y.magFilter===pi||y.minFilter===ze||y.minFilter===Qo||y.minFilter===ur||y.minFilter===pi)&&Dt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(P,i.TEXTURE_WRAP_S,G[y.wrapS]),i.texParameteri(P,i.TEXTURE_WRAP_T,G[y.wrapT]),(P===i.TEXTURE_3D||P===i.TEXTURE_2D_ARRAY)&&i.texParameteri(P,i.TEXTURE_WRAP_R,G[y.wrapR]),i.texParameteri(P,i.TEXTURE_MAG_FILTER,Q[y.magFilter]),i.texParameteri(P,i.TEXTURE_MIN_FILTER,Q[y.minFilter]),y.compareFunction&&(i.texParameteri(P,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(P,i.TEXTURE_COMPARE_FUNC,lt[y.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(y.magFilter===Ue||y.minFilter!==ur&&y.minFilter!==pi||y.type===Ge&&t.has("OES_texture_float_linear")===!1)return;if(y.anisotropy>1||n.get(y).__currentAnisotropy){let q=t.get("EXT_texture_filter_anisotropic");i.texParameterf(P,q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(y.anisotropy,s.getMaxAnisotropy())),n.get(y).__currentAnisotropy=y.anisotropy}}}function et(P,y){let q=!1;P.__webglInit===void 0&&(P.__webglInit=!0,y.addEventListener("dispose",A));let J=y.source,nt=p.get(J);nt===void 0&&(nt={},p.set(J,nt));let ht=W(y);if(ht!==P.__cacheKey){nt[ht]===void 0&&(nt[ht]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,q=!0),nt[ht].usedTimes++;let dt=nt[P.__cacheKey];dt!==void 0&&(nt[P.__cacheKey].usedTimes--,dt.usedTimes===0&&R(y)),P.__cacheKey=ht,P.__webglTexture=nt[ht].texture}return q}function V(P,y,q){return Math.floor(Math.floor(P/q)/y)}function j(P,y,q,J){let ht=P.updateRanges;if(ht.length===0)e.texSubImage2D(i.TEXTURE_2D,0,0,0,y.width,y.height,q,J,y.data);else{ht.sort((Ct,_t)=>Ct.start-_t.start);let dt=0;for(let Ct=1;Ct0){Nt&&zt&&e.texStorage2D(i.TEXTURE_2D,mt,_t,It[0].width,It[0].height);for(let rt=0,gt=It.length;rt0){let Mt=Ic(pt.width,pt.height,y.format,y.type);for(let at of y.layerUpdates){let Pt=pt.data.subarray(at*Mt/pt.data.BYTES_PER_ELEMENT,(at+1)*Mt/pt.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,rt,0,0,at,pt.width,pt.height,1,ft,Pt)}}else e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,rt,0,0,0,pt.width,pt.height,ot.depth,ft,pt.data)}else e.compressedTexImage3D(i.TEXTURE_2D_ARRAY,rt,_t,pt.width,pt.height,ot.depth,0,pt.data,0,0);else Dt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Nt?k&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,rt,0,0,0,pt.width,pt.height,ot.depth,ft,Ct,pt.data):e.texImage3D(i.TEXTURE_2D_ARRAY,rt,_t,pt.width,pt.height,ot.depth,0,ft,Ct,pt.data);y.layerUpdates.size>0&&y.clearLayerUpdates()}else{Nt&&zt&&e.texStorage2D(i.TEXTURE_2D,mt,_t,It[0].width,It[0].height);for(let rt=0,gt=It.length;rt0){let rt=Ic(ot.width,ot.height,y.format,y.type);for(let gt of y.layerUpdates){let Mt=ot.data.subarray(gt*rt/ot.data.BYTES_PER_ELEMENT,(gt+1)*rt/ot.data.BYTES_PER_ELEMENT);e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,gt,ot.width,ot.height,1,ft,Ct,Mt)}y.clearLayerUpdates()}else e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ot.width,ot.height,ot.depth,ft,Ct,ot.data)}else e.texImage3D(i.TEXTURE_2D_ARRAY,0,_t,ot.width,ot.height,ot.depth,0,ft,Ct,ot.data);else if(y.isData3DTexture)Nt?(zt&&e.texStorage3D(i.TEXTURE_3D,mt,_t,ot.width,ot.height,ot.depth),k&&e.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ot.width,ot.height,ot.depth,ft,Ct,ot.data)):e.texImage3D(i.TEXTURE_3D,0,_t,ot.width,ot.height,ot.depth,0,ft,Ct,ot.data);else if(y.isFramebufferTexture){if(zt)if(Nt)e.texStorage2D(i.TEXTURE_2D,mt,_t,ot.width,ot.height);else{let rt=ot.width,gt=ot.height;for(let Mt=0;Mt>=1,gt>>=1}}else if(y.isHTMLTexture){if("texElementImage2D"in i){let rt=i.canvas;if(rt.hasAttribute("layoutsubtree")||rt.setAttribute("layoutsubtree","true"),ot.parentNode!==rt){rt.appendChild(ot),d.add(y),rt.onpaint=gt=>{let Mt=gt.changedElements;for(let at of d)Mt.includes(at.image)&&(at.needsUpdate=!0)},rt.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,ot);else{let Mt=i.RGBA,at=i.RGBA,Pt=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Mt,at,Pt,ot)}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(It.length>0){if(Nt&&zt){let rt=ee(It[0]);e.texStorage2D(i.TEXTURE_2D,mt,_t,rt.width,rt.height)}for(let rt=0,gt=It.length;rt0&>++;let at=ee(_t[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,gt,zt,at.width,at.height)}for(let at=0;at<6;at++)if(Ct){k?rt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+at,0,0,0,_t[at].width,_t[at].height,It,Nt,_t[at].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+at,0,zt,_t[at].width,_t[at].height,0,It,Nt,_t[at].data);for(let Pt=0;Pt>ht),pt=Math.max(1,y.height>>ht);nt===i.TEXTURE_3D||nt===i.TEXTURE_2D_ARRAY?e.texImage3D(nt,ht,ot,_t,pt,y.depth,0,dt,it,null):e.texImage2D(nt,ht,ot,_t,pt,0,dt,it,null)}e.bindFramebuffer(i.FRAMEBUFFER,P),we(y)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,J,nt,Ct.__webglTexture,0,be(y)):(nt===i.TEXTURE_2D||nt>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&nt<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,J,nt,Ct.__webglTexture,ht),e.bindFramebuffer(i.FRAMEBUFFER,null)}function Bt(P,y,q){if(i.bindRenderbuffer(i.RENDERBUFFER,P),y.depthBuffer){let J=y.depthTexture,nt=J&&J.isDepthTexture?J.type:null,ht=v(y.stencilBuffer,nt),dt=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;we(y)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,be(y),ht,y.width,y.height):q?i.renderbufferStorageMultisample(i.RENDERBUFFER,be(y),ht,y.width,y.height):i.renderbufferStorage(i.RENDERBUFFER,ht,y.width,y.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,dt,i.RENDERBUFFER,P)}else{let J=y.textures;for(let nt=0;nt{delete y.__boundDepthTexture,delete y.__depthDisposeCallback,J.removeEventListener("dispose",nt)};J.addEventListener("dispose",nt),y.__depthDisposeCallback=nt}y.__boundDepthTexture=J}if(P.depthTexture&&!y.__autoAllocateDepthBuffer)if(q)for(let J=0;J<6;J++)ve(y.__webglFramebuffer[J],P,J);else{let J=P.texture.mipmaps;J&&J.length>0?ve(y.__webglFramebuffer[0],P,0):ve(y.__webglFramebuffer,P,0)}else if(q){y.__webglDepthbuffer=[];for(let J=0;J<6;J++)if(e.bindFramebuffer(i.FRAMEBUFFER,y.__webglFramebuffer[J]),y.__webglDepthbuffer[J]===void 0)y.__webglDepthbuffer[J]=i.createRenderbuffer(),Bt(y.__webglDepthbuffer[J],P,!1);else{let nt=P.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ht=y.__webglDepthbuffer[J];i.bindRenderbuffer(i.RENDERBUFFER,ht),i.framebufferRenderbuffer(i.FRAMEBUFFER,nt,i.RENDERBUFFER,ht)}}else{let J=P.texture.mipmaps;if(J&&J.length>0?e.bindFramebuffer(i.FRAMEBUFFER,y.__webglFramebuffer[0]):e.bindFramebuffer(i.FRAMEBUFFER,y.__webglFramebuffer),y.__webglDepthbuffer===void 0)y.__webglDepthbuffer=i.createRenderbuffer(),Bt(y.__webglDepthbuffer,P,!1);else{let nt=P.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ht=y.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,ht),i.framebufferRenderbuffer(i.FRAMEBUFFER,nt,i.RENDERBUFFER,ht)}}e.bindFramebuffer(i.FRAMEBUFFER,null)}function Jt(P,y,q){let J=n.get(P);y!==void 0&&bt(J.__webglFramebuffer,P,P.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),q!==void 0&&Vt(P)}function he(P){let y=P.texture,q=n.get(P),J=n.get(y);P.addEventListener("dispose",x);let nt=P.textures,ht=P.isWebGLCubeRenderTarget===!0,dt=nt.length>1;if(dt||(J.__webglTexture===void 0&&(J.__webglTexture=i.createTexture()),J.__version=y.version,o.memory.textures++),ht){q.__webglFramebuffer=[];for(let it=0;it<6;it++)if(y.mipmaps&&y.mipmaps.length>0){q.__webglFramebuffer[it]=[];for(let ot=0;ot0){q.__webglFramebuffer=[];for(let it=0;it0&&we(P)===!1){q.__webglMultisampledFramebuffer=i.createFramebuffer(),q.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,q.__webglMultisampledFramebuffer);for(let it=0;it0)for(let ot=0;ot0)for(let ot=0;ot0){if(we(P)===!1){let y=P.textures,q=P.width,J=P.height,nt=i.COLOR_BUFFER_BIT,ht=P.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,dt=n.get(P),it=y.length>1;if(it)for(let ft=0;ft0?e.bindFramebuffer(i.DRAW_FRAMEBUFFER,dt.__webglFramebuffer[0]):e.bindFramebuffer(i.DRAW_FRAMEBUFFER,dt.__webglFramebuffer);for(let ft=0;ft0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&y.__useRenderToTexture!==!1}function H(P){let y=o.render.frame;h.get(P)!==y&&(h.set(P,y),P.update())}function We(P,y){let q=P.colorSpace,J=P.format,nt=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||q!==Xs&&q!==jn&&(Yt.getTransfer(q)===te?(J!==sn||nt!==nn)&&Dt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ut("WebGLTextures: Unsupported texture color space:",q)),y}function ee(P){return typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement?(c.width=P.naturalWidth||P.width,c.height=P.naturalHeight||P.height):typeof VideoFrame<"u"&&P instanceof VideoFrame?(c.width=P.displayWidth,c.height=P.displayHeight):(c.width=P.width,c.height=P.height),c}this.allocateTextureUnit=z,this.resetTextureUnits=U,this.getTextureUnits=C,this.setTextureUnits=B,this.setTexture2D=F,this.setTexture2DArray=D,this.setTexture3D=X,this.setTextureCube=Z,this.rebindTextures=Jt,this.setupRenderTarget=he,this.updateRenderTargetMipmap=qt,this.updateMultisampleRenderTarget=tn,this.setupDepthRenderbuffer=Vt,this.setupFrameBufferTexture=bt,this.useMultisampledRTT=we,this.isReversedDepthBuffer=function(){return e.buffers.depth.getReversed()}}function sv(i,t){function e(n,s=jn){let r,o=Yt.getTransfer(s);if(n===nn)return i.UNSIGNED_BYTE;if(n===ea)return i.UNSIGNED_SHORT_4_4_4_4;if(n===na)return i.UNSIGNED_SHORT_5_5_5_1;if(n===gc)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===_c)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===pc)return i.BYTE;if(n===mc)return i.SHORT;if(n===bs)return i.UNSIGNED_SHORT;if(n===ta)return i.INT;if(n===Mn)return i.UNSIGNED_INT;if(n===Ge)return i.FLOAT;if(n===Sn)return i.HALF_FLOAT;if(n===xc)return i.ALPHA;if(n===vc)return i.RGB;if(n===sn)return i.RGBA;if(n===Pn)return i.DEPTH_COMPONENT;if(n===mi)return i.DEPTH_STENCIL;if(n===Ss)return i.RED;if(n===ia)return i.RED_INTEGER;if(n===gi)return i.RG;if(n===sa)return i.RG_INTEGER;if(n===ra)return i.RGBA_INTEGER;if(n===dr||n===fr||n===pr||n===mr)if(o===te)if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===dr)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===fr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===pr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===mr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===dr)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===fr)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===pr)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===mr)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===oa||n===aa||n===la||n===ca)if(r=t.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===oa)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===aa)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===la)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ca)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===ha||n===ua||n===da||n===fa||n===pa||n===gr||n===ma)if(r=t.get("WEBGL_compressed_texture_etc"),r!==null){if(n===ha||n===ua)return o===te?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===da)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===fa)return r.COMPRESSED_R11_EAC;if(n===pa)return r.COMPRESSED_SIGNED_R11_EAC;if(n===gr)return r.COMPRESSED_RG11_EAC;if(n===ma)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===ga||n===_a||n===xa||n===va||n===ya||n===ba||n===Ma||n===Sa||n===wa||n===Ea||n===Ta||n===Aa||n===Ra||n===Ca)if(r=t.get("WEBGL_compressed_texture_astc"),r!==null){if(n===ga)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===_a)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===xa)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===va)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ya)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ba)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ma)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Sa)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===wa)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ea)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ta)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Aa)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ra)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ca)return o===te?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ia||n===Pa||n===La)if(r=t.get("EXT_texture_compression_bptc"),r!==null){if(n===Ia)return o===te?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Pa)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===La)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Da||n===Na||n===_r||n===Ua)if(r=t.get("EXT_texture_compression_rgtc"),r!==null){if(n===Da)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Na)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===_r)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ua)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ms?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:e}}var rv=` +}`,uv=[new I(1,0,0),new I(-1,0,0),new I(0,1,0),new I(0,-1,0),new I(0,0,1),new I(0,0,-1)],dv=[new I(0,-1,0),new I(0,-1,0),new I(0,0,1),new I(0,0,-1),new I(0,-1,0),new I(0,-1,0)],Nd=new ke,yr=new I,Hc=new I;function fv(i,e,t){let n=new Un,s=new Ve,r=new Ve,o=new at,a=new Uo,l=new Fo,c={},h=t.maxTextureSize,d={[Bn]:Ht,[Ht]:Bn,[It]:It},u=new Vt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ve},radius:{value:4}},vertexShader:cv,fragmentShader:hv}),p=u.clone();p.defines.HORIZONTAL_PASS=1;let g=new lt;g.setAttribute("position",new St(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let _=new xt(g,u),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=hr;let f=this.type;this.render=function(S,A,x){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||S.length===0)return;this.type===Cu&&(De("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=hr);let T=i.getRenderTarget(),R=i.getActiveCubeFace(),L=i.getActiveMipmapLevel(),N=i.state;N.setBlending(On),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 U=f!==this.type;U&&A.traverse(function(C){C.material&&(Array.isArray(C.material)?C.material.forEach(B=>B.needsUpdate=!0):C.material.needsUpdate=!0)});for(let C=0,B=S.length;Ch||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/F.x),s.x=r.x*F.x,W.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/F.y),s.y=r.y*F.y,W.mapSize.y=r.y));let D=i.state.buffers.depth.getReversed();if(W.camera._reversedDepth=D,W.map===null||U===!0){if(W.map!==null&&(W.map.depthTexture!==null&&(W.map.depthTexture.dispose(),W.map.depthTexture=null),W.map.dispose()),this.type===ys){if(z.isPointLight){De("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}W.map=new Ft(s.x,s.y,{format:gi,type:Sn,minFilter:zt,magFilter:zt,generateMipmaps:!1}),W.map.texture.name=z.name+".shadowMap",W.map.depthTexture=new ci(s.x,s.y,Gt),W.map.depthTexture.name=z.name+".shadowMapDepth",W.map.depthTexture.format=Pn,W.map.depthTexture.compareFunction=null,W.map.depthTexture.minFilter=Ut,W.map.depthTexture.magFilter=Ut}else z.isPointLight?(W.map=new Ga(s.x),W.map.depthTexture=new Do(s.x,Mn)):(W.map=new Ft(s.x,s.y),W.map.depthTexture=new ci(s.x,s.y,Mn)),W.map.depthTexture.name=z.name+".shadowMap",W.map.depthTexture.format=Pn,this.type===hr?(W.map.depthTexture.compareFunction=D?za:Oa,W.map.depthTexture.minFilter=zt,W.map.depthTexture.magFilter=zt):(W.map.depthTexture.compareFunction=null,W.map.depthTexture.minFilter=Ut,W.map.depthTexture.magFilter=Ut);W.camera.updateProjectionMatrix()}W.map.isWebGLCubeRenderTarget!==!0&&(W.map.width!==s.x||W.map.height!==s.y)&&W.map.setSize(s.x,s.y);let X=W.map.isWebGLCubeRenderTarget?6:W.getViewportCount();z.isPointLight!==!0&&W.updateMatrices(z,x);for(let Z=0;Z0||A.map&&A.alphaTest>0||A.alphaToCoverage===!0){let N=R.uuid,U=A.uuid,C=c[N];C===void 0&&(C={},c[N]=C);let B=C[U];B===void 0&&(B=R.clone(),C[U]=B,A.addEventListener("dispose",v)),R=B}if(R.visible=A.visible,R.wireframe=A.wireframe,T===ys?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,x.isPointLight===!0&&R.isMeshDistanceMaterial===!0){let N=i.properties.get(R);N.light=x}return R}function b(S,A,x,T,R){if(S.visible===!1)return;if(S.layers.test(A.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&R===ys)&&(!S.frustumCulled||S.intersectsFrustum(n))){S.modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,S.matrixWorld);let U=e.update(S),C=S.material;if(Array.isArray(C)){let B=U.groups;for(let z=0,W=B.length;z=1):D.indexOf("OpenGL ES")!==-1&&(F=parseFloat(/^OpenGL ES (\d)/.exec(D)[1]),W=F>=2);let X=null,Z={},G=i.getParameter(i.SCISSOR_BOX),Q=i.getParameter(i.VIEWPORT),le=new at().fromArray(G),ce=new at().fromArray(Q);function te(k,me,re,ge){let Me=new Uint8Array(4),ae=i.createTexture();i.bindTexture(k,ae),i.texParameteri(k,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(k,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Pe=0;Pe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ve,h=new WeakMap,d=new Set,u,p=new WeakMap,g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(P,y){return g?new OffscreenCanvas(P,y):$s("canvas")}function m(P,y,q){let J=1,ne=tt(P);if((ne.width>q||ne.height>q)&&(J=q/Math.max(ne.width,ne.height)),J<1)if(typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&P instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&P instanceof ImageBitmap||typeof VideoFrame<"u"&&P instanceof VideoFrame){let he=Math.floor(J*ne.width),de=Math.floor(J*ne.height);u===void 0&&(u=_(he,de));let ie=y?_(he,de):u;return ie.width=he,ie.height=de,ie.getContext("2d").drawImage(P,0,0,he,de),De("WebGLRenderer: Texture has been resized from ("+ne.width+"x"+ne.height+") to ("+he+"x"+de+")."),ie}else return"data"in P&&De("WebGLRenderer: Image in DataTexture is too big ("+ne.width+"x"+ne.height+")."),P;return P}function f(P){return P.generateMipmaps}function M(P){i.generateMipmap(P)}function E(P){return P.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:P.isWebGL3DRenderTarget?i.TEXTURE_3D:P.isWebGLArrayRenderTarget||P.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function b(P,y,q,J,ne,he=!1){if(P!==null){if(i[P]!==void 0)return i[P];De("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let de;J&&(de=e.get("EXT_texture_norm16"),de||De("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let ie=y;if(y===i.RED&&(q===i.FLOAT&&(ie=i.R32F),q===i.HALF_FLOAT&&(ie=i.R16F),q===i.UNSIGNED_BYTE&&(ie=i.R8),q===i.UNSIGNED_SHORT&&de&&(ie=de.R16_EXT),q===i.SHORT&&de&&(ie=de.R16_SNORM_EXT)),y===i.RED_INTEGER&&(q===i.UNSIGNED_BYTE&&(ie=i.R8UI),q===i.UNSIGNED_SHORT&&(ie=i.R16UI),q===i.UNSIGNED_INT&&(ie=i.R32UI),q===i.BYTE&&(ie=i.R8I),q===i.SHORT&&(ie=i.R16I),q===i.INT&&(ie=i.R32I)),y===i.RG&&(q===i.FLOAT&&(ie=i.RG32F),q===i.HALF_FLOAT&&(ie=i.RG16F),q===i.UNSIGNED_BYTE&&(ie=i.RG8),q===i.UNSIGNED_SHORT&&de&&(ie=de.RG16_EXT),q===i.SHORT&&de&&(ie=de.RG16_SNORM_EXT)),y===i.RG_INTEGER&&(q===i.UNSIGNED_BYTE&&(ie=i.RG8UI),q===i.UNSIGNED_SHORT&&(ie=i.RG16UI),q===i.UNSIGNED_INT&&(ie=i.RG32UI),q===i.BYTE&&(ie=i.RG8I),q===i.SHORT&&(ie=i.RG16I),q===i.INT&&(ie=i.RG32I)),y===i.RGB_INTEGER&&(q===i.UNSIGNED_BYTE&&(ie=i.RGB8UI),q===i.UNSIGNED_SHORT&&(ie=i.RGB16UI),q===i.UNSIGNED_INT&&(ie=i.RGB32UI),q===i.BYTE&&(ie=i.RGB8I),q===i.SHORT&&(ie=i.RGB16I),q===i.INT&&(ie=i.RGB32I)),y===i.RGBA_INTEGER&&(q===i.UNSIGNED_BYTE&&(ie=i.RGBA8UI),q===i.UNSIGNED_SHORT&&(ie=i.RGBA16UI),q===i.UNSIGNED_INT&&(ie=i.RGBA32UI),q===i.BYTE&&(ie=i.RGBA8I),q===i.SHORT&&(ie=i.RGBA16I),q===i.INT&&(ie=i.RGBA32I)),y===i.RGB&&(q===i.UNSIGNED_SHORT&&de&&(ie=de.RGB16_EXT),q===i.SHORT&&de&&(ie=de.RGB16_SNORM_EXT),q===i.UNSIGNED_INT_5_9_9_9_REV&&(ie=i.RGB9_E5),q===i.UNSIGNED_INT_10F_11F_11F_REV&&(ie=i.R11F_G11F_B10F)),y===i.RGBA){let oe=he?Ys:Ye.getTransfer(ne);q===i.FLOAT&&(ie=i.RGBA32F),q===i.HALF_FLOAT&&(ie=i.RGBA16F),q===i.UNSIGNED_BYTE&&(ie=oe===et?i.SRGB8_ALPHA8:i.RGBA8),q===i.UNSIGNED_SHORT&&de&&(ie=de.RGBA16_EXT),q===i.SHORT&&de&&(ie=de.RGBA16_SNORM_EXT),q===i.UNSIGNED_SHORT_4_4_4_4&&(ie=i.RGBA4),q===i.UNSIGNED_SHORT_5_5_5_1&&(ie=i.RGB5_A1)}return(ie===i.R16F||ie===i.R32F||ie===i.RG16F||ie===i.RG32F||ie===i.RGBA16F||ie===i.RGBA32F)&&e.get("EXT_color_buffer_float"),ie}function v(P,y){let q;return P?y===null||y===Mn||y===Ss?q=i.DEPTH24_STENCIL8:y===Gt?q=i.DEPTH32F_STENCIL8:y===Ms&&(q=i.DEPTH24_STENCIL8,De("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):y===null||y===Mn||y===Ss?q=i.DEPTH_COMPONENT24:y===Gt?q=i.DEPTH_COMPONENT32F:y===Ms&&(q=i.DEPTH_COMPONENT16),q}function S(P,y){return f(P)===!0||P.isFramebufferTexture&&P.minFilter!==Ut&&P.minFilter!==zt?Math.log2(Math.max(y.width,y.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?y.mipmaps.length:1}function A(P){let y=P.target;y.removeEventListener("dispose",A),T(y),y.isVideoTexture&&h.delete(y),y.isHTMLTexture&&d.delete(y)}function x(P){let y=P.target;y.removeEventListener("dispose",x),L(y)}function T(P){let y=n.get(P);if(y.__webglInit===void 0)return;let q=P.source,J=p.get(q);if(J){let ne=J[y.__cacheKey];ne.usedTimes--,ne.usedTimes===0&&R(P),Object.keys(J).length===0&&p.delete(q)}n.remove(P)}function R(P){let y=n.get(P);i.deleteTexture(y.__webglTexture);let q=P.source,J=p.get(q);delete J[y.__cacheKey],o.memory.textures--}function L(P){let y=n.get(P);if(P.depthTexture&&(P.depthTexture.dispose(),n.remove(P.depthTexture)),P.isWebGLCubeRenderTarget)for(let J=0;J<6;J++){if(Array.isArray(y.__webglFramebuffer[J]))for(let ne=0;ne=s.maxTextures&&De("WebGLTextures: Trying to use "+(P+1)+" texture units while this GPU supports only "+s.maxTextures),N+=1,P}function W(P){let y=[];return y.push(P.wrapS),y.push(P.wrapT),y.push(P.wrapR||0),y.push(P.magFilter),y.push(P.minFilter),y.push(P.anisotropy),y.push(P.internalFormat),y.push(P.format),y.push(P.type),y.push(P.generateMipmaps),y.push(P.premultiplyAlpha),y.push(P.flipY),y.push(P.unpackAlignment),y.push(P.colorSpace),y.join()}function F(P,y){let q=n.get(P);if(P.isVideoTexture&&V(P),P.isRenderTargetTexture===!1&&P.isExternalTexture!==!0&&P.version>0&&q.__version!==P.version){let J=P.image;if(J===null)De("WebGLRenderer: Texture marked for update but no image data found.");else if(J.complete===!1)De("WebGLRenderer: Texture marked for update but image is incomplete");else{ue(q,P,y);return}}else P.isExternalTexture&&(q.__webglTexture=P.sourceTexture?P.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,q.__webglTexture,i.TEXTURE0+y)}function D(P,y){let q=n.get(P);if(P.isRenderTargetTexture===!1&&P.version>0&&q.__version!==P.version){ue(q,P,y);return}else P.isExternalTexture&&(q.__webglTexture=P.sourceTexture?P.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,q.__webglTexture,i.TEXTURE0+y)}function X(P,y){let q=n.get(P);if(P.isRenderTargetTexture===!1&&P.version>0&&q.__version!==P.version){ue(q,P,y);return}t.bindTexture(i.TEXTURE_3D,q.__webglTexture,i.TEXTURE0+y)}function Z(P,y){let q=n.get(P);if(P.isCubeDepthTexture!==!0&&P.version>0&&q.__version!==P.version){Le(q,P,y);return}t.bindTexture(i.TEXTURE_CUBE_MAP,q.__webglTexture,i.TEXTURE0+y)}let G={[as]:i.REPEAT,[In]:i.CLAMP_TO_EDGE,[Eo]:i.MIRRORED_REPEAT},Q={[Ut]:i.NEAREST,[Ju]:i.NEAREST_MIPMAP_NEAREST,[dr]:i.NEAREST_MIPMAP_LINEAR,[zt]:i.LINEAR,[ea]:i.LINEAR_MIPMAP_NEAREST,[pi]:i.LINEAR_MIPMAP_LINEAR},le={[ed]:i.NEVER,[rd]:i.ALWAYS,[td]:i.LESS,[Oa]:i.LEQUAL,[nd]:i.EQUAL,[za]:i.GEQUAL,[id]:i.GREATER,[sd]:i.NOTEQUAL};function ce(P,y){if(y.type===Gt&&e.has("OES_texture_float_linear")===!1&&(y.magFilter===zt||y.magFilter===ea||y.magFilter===dr||y.magFilter===pi||y.minFilter===zt||y.minFilter===ea||y.minFilter===dr||y.minFilter===pi)&&De("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(P,i.TEXTURE_WRAP_S,G[y.wrapS]),i.texParameteri(P,i.TEXTURE_WRAP_T,G[y.wrapT]),(P===i.TEXTURE_3D||P===i.TEXTURE_2D_ARRAY)&&i.texParameteri(P,i.TEXTURE_WRAP_R,G[y.wrapR]),i.texParameteri(P,i.TEXTURE_MAG_FILTER,Q[y.magFilter]),i.texParameteri(P,i.TEXTURE_MIN_FILTER,Q[y.minFilter]),y.compareFunction&&(i.texParameteri(P,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(P,i.TEXTURE_COMPARE_FUNC,le[y.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(y.magFilter===Ut||y.minFilter!==dr&&y.minFilter!==pi||y.type===Gt&&e.has("OES_texture_float_linear")===!1)return;if(y.anisotropy>1||n.get(y).__currentAnisotropy){let q=e.get("EXT_texture_filter_anisotropic");i.texParameterf(P,q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(y.anisotropy,s.getMaxAnisotropy())),n.get(y).__currentAnisotropy=y.anisotropy}}}function te(P,y){let q=!1;P.__webglInit===void 0&&(P.__webglInit=!0,y.addEventListener("dispose",A));let J=y.source,ne=p.get(J);ne===void 0&&(ne={},p.set(J,ne));let he=W(y);if(he!==P.__cacheKey){ne[he]===void 0&&(ne[he]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,q=!0),ne[he].usedTimes++;let de=ne[P.__cacheKey];de!==void 0&&(ne[P.__cacheKey].usedTimes--,de.usedTimes===0&&R(y)),P.__cacheKey=he,P.__webglTexture=ne[he].texture}return q}function H(P,y,q){return Math.floor(Math.floor(P/q)/y)}function j(P,y,q,J){let he=P.updateRanges;if(he.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,y.width,y.height,q,J,y.data);else{he.sort((Ce,_e)=>Ce.start-_e.start);let de=0;for(let Ce=1;Ce0){Ne&&ze&&t.texStorage2D(i.TEXTURE_2D,me,_e,Ie[0].width,Ie[0].height);for(let re=0,ge=Ie.length;re0){let Me=Pc(pe.width,pe.height,y.format,y.type);for(let ae of y.layerUpdates){let Pe=pe.data.subarray(ae*Me/pe.data.BYTES_PER_ELEMENT,(ae+1)*Me/pe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,re,0,0,ae,pe.width,pe.height,1,fe,Pe)}}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,re,0,0,0,pe.width,pe.height,oe.depth,fe,pe.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,re,_e,pe.width,pe.height,oe.depth,0,pe.data,0,0);else De("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ne?k&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,re,0,0,0,pe.width,pe.height,oe.depth,fe,Ce,pe.data):t.texImage3D(i.TEXTURE_2D_ARRAY,re,_e,pe.width,pe.height,oe.depth,0,fe,Ce,pe.data);y.layerUpdates.size>0&&y.clearLayerUpdates()}else{Ne&&ze&&t.texStorage2D(i.TEXTURE_2D,me,_e,Ie[0].width,Ie[0].height);for(let re=0,ge=Ie.length;re0){let re=Pc(oe.width,oe.height,y.format,y.type);for(let ge of y.layerUpdates){let Me=oe.data.subarray(ge*re/oe.data.BYTES_PER_ELEMENT,(ge+1)*re/oe.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,ge,oe.width,oe.height,1,fe,Ce,Me)}y.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,oe.width,oe.height,oe.depth,fe,Ce,oe.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,_e,oe.width,oe.height,oe.depth,0,fe,Ce,oe.data);else if(y.isData3DTexture)Ne?(ze&&t.texStorage3D(i.TEXTURE_3D,me,_e,oe.width,oe.height,oe.depth),k&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,oe.width,oe.height,oe.depth,fe,Ce,oe.data)):t.texImage3D(i.TEXTURE_3D,0,_e,oe.width,oe.height,oe.depth,0,fe,Ce,oe.data);else if(y.isFramebufferTexture){if(ze)if(Ne)t.texStorage2D(i.TEXTURE_2D,me,_e,oe.width,oe.height);else{let re=oe.width,ge=oe.height;for(let Me=0;Me>=1,ge>>=1}}else if(y.isHTMLTexture){if("texElementImage2D"in i){let re=i.canvas;if(re.hasAttribute("layoutsubtree")||re.setAttribute("layoutsubtree","true"),oe.parentNode!==re){re.appendChild(oe),d.add(y),re.onpaint=ge=>{let Me=ge.changedElements;for(let ae of d)Me.includes(ae.image)&&(ae.needsUpdate=!0)},re.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,oe);else{let Me=i.RGBA,ae=i.RGBA,Pe=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Me,ae,Pe,oe)}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(Ie.length>0){if(Ne&&ze){let re=tt(Ie[0]);t.texStorage2D(i.TEXTURE_2D,me,_e,re.width,re.height)}for(let re=0,ge=Ie.length;re0&&ge++;let ae=tt(_e[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ge,ze,ae.width,ae.height)}for(let ae=0;ae<6;ae++)if(Ce){k?re&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0,0,0,_e[ae].width,_e[ae].height,Ie,Ne,_e[ae].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0,ze,_e[ae].width,_e[ae].height,0,Ie,Ne,_e[ae].data);for(let Pe=0;Pe>he),pe=Math.max(1,y.height>>he);ne===i.TEXTURE_3D||ne===i.TEXTURE_2D_ARRAY?t.texImage3D(ne,he,oe,_e,pe,y.depth,0,de,ie,null):t.texImage2D(ne,he,oe,_e,pe,0,de,ie,null)}t.bindFramebuffer(i.FRAMEBUFFER,P),wt(y)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,J,ne,Ce.__webglTexture,0,bt(y)):(ne===i.TEXTURE_2D||ne>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&ne<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,J,ne,Ce.__webglTexture,he),t.bindFramebuffer(i.FRAMEBUFFER,null)}function Be(P,y,q){if(i.bindRenderbuffer(i.RENDERBUFFER,P),y.depthBuffer){let J=y.depthTexture,ne=J&&J.isDepthTexture?J.type:null,he=v(y.stencilBuffer,ne),de=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;wt(y)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,bt(y),he,y.width,y.height):q?i.renderbufferStorageMultisample(i.RENDERBUFFER,bt(y),he,y.width,y.height):i.renderbufferStorage(i.RENDERBUFFER,he,y.width,y.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,de,i.RENDERBUFFER,P)}else{let J=y.textures;for(let ne=0;ne{delete y.__boundDepthTexture,delete y.__depthDisposeCallback,J.removeEventListener("dispose",ne)};J.addEventListener("dispose",ne),y.__depthDisposeCallback=ne}y.__boundDepthTexture=J}if(P.depthTexture&&!y.__autoAllocateDepthBuffer)if(q)for(let J=0;J<6;J++)vt(y.__webglFramebuffer[J],P,J);else{let J=P.texture.mipmaps;J&&J.length>0?vt(y.__webglFramebuffer[0],P,0):vt(y.__webglFramebuffer,P,0)}else if(q){y.__webglDepthbuffer=[];for(let J=0;J<6;J++)if(t.bindFramebuffer(i.FRAMEBUFFER,y.__webglFramebuffer[J]),y.__webglDepthbuffer[J]===void 0)y.__webglDepthbuffer[J]=i.createRenderbuffer(),Be(y.__webglDepthbuffer[J],P,!1);else{let ne=P.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,he=y.__webglDepthbuffer[J];i.bindRenderbuffer(i.RENDERBUFFER,he),i.framebufferRenderbuffer(i.FRAMEBUFFER,ne,i.RENDERBUFFER,he)}}else{let J=P.texture.mipmaps;if(J&&J.length>0?t.bindFramebuffer(i.FRAMEBUFFER,y.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,y.__webglFramebuffer),y.__webglDepthbuffer===void 0)y.__webglDepthbuffer=i.createRenderbuffer(),Be(y.__webglDepthbuffer,P,!1);else{let ne=P.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,he=y.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,he),i.framebufferRenderbuffer(i.FRAMEBUFFER,ne,i.RENDERBUFFER,he)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Je(P,y,q){let J=n.get(P);y!==void 0&&be(J.__webglFramebuffer,P,P.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),q!==void 0&&He(P)}function ht(P){let y=P.texture,q=n.get(P),J=n.get(y);P.addEventListener("dispose",x);let ne=P.textures,he=P.isWebGLCubeRenderTarget===!0,de=ne.length>1;if(de||(J.__webglTexture===void 0&&(J.__webglTexture=i.createTexture()),J.__version=y.version,o.memory.textures++),he){q.__webglFramebuffer=[];for(let ie=0;ie<6;ie++)if(y.mipmaps&&y.mipmaps.length>0){q.__webglFramebuffer[ie]=[];for(let oe=0;oe0){q.__webglFramebuffer=[];for(let ie=0;ie0&&wt(P)===!1){q.__webglMultisampledFramebuffer=i.createFramebuffer(),q.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,q.__webglMultisampledFramebuffer);for(let ie=0;ie0)for(let oe=0;oe0)for(let oe=0;oe0){if(wt(P)===!1){let y=P.textures,q=P.width,J=P.height,ne=i.COLOR_BUFFER_BIT,he=P.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,de=n.get(P),ie=y.length>1;if(ie)for(let fe=0;fe0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,de.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,de.__webglFramebuffer);for(let fe=0;fe0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&y.__useRenderToTexture!==!1}function V(P){let y=o.render.frame;h.get(P)!==y&&(h.set(P,y),P.update())}function Wt(P,y){let q=P.colorSpace,J=P.format,ne=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||q!==qs&&q!==jn&&(Ye.getTransfer(q)===et?(J!==sn||ne!==nn)&&De("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ue("WebGLTextures: Unsupported texture color space:",q)),y}function tt(P){return typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement?(c.width=P.naturalWidth||P.width,c.height=P.naturalHeight||P.height):typeof VideoFrame<"u"&&P instanceof VideoFrame?(c.width=P.displayWidth,c.height=P.displayHeight):(c.width=P.width,c.height=P.height),c}this.allocateTextureUnit=z,this.resetTextureUnits=U,this.getTextureUnits=C,this.setTextureUnits=B,this.setTexture2D=F,this.setTexture2DArray=D,this.setTexture3D=X,this.setTextureCube=Z,this.rebindTextures=Je,this.setupRenderTarget=ht,this.updateRenderTargetMipmap=qe,this.updateMultisampleRenderTarget=en,this.setupDepthRenderbuffer=He,this.setupFrameBufferTexture=be,this.useMultisampledRTT=wt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function gv(i,e){function t(n,s=jn){let r,o=Ye.getTransfer(s);if(n===nn)return i.UNSIGNED_BYTE;if(n===na)return i.UNSIGNED_SHORT_4_4_4_4;if(n===ia)return i.UNSIGNED_SHORT_5_5_5_1;if(n===_c)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===xc)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===mc)return i.BYTE;if(n===gc)return i.SHORT;if(n===Ms)return i.UNSIGNED_SHORT;if(n===ta)return i.INT;if(n===Mn)return i.UNSIGNED_INT;if(n===Gt)return i.FLOAT;if(n===Sn)return i.HALF_FLOAT;if(n===vc)return i.ALPHA;if(n===yc)return i.RGB;if(n===sn)return i.RGBA;if(n===Pn)return i.DEPTH_COMPONENT;if(n===mi)return i.DEPTH_STENCIL;if(n===ws)return i.RED;if(n===sa)return i.RED_INTEGER;if(n===gi)return i.RG;if(n===ra)return i.RG_INTEGER;if(n===oa)return i.RGBA_INTEGER;if(n===fr||n===pr||n===mr||n===gr)if(o===et)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===fr)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===pr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===mr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===gr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===fr)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===pr)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===mr)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===gr)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===aa||n===la||n===ca||n===ha)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===aa)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===la)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ca)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ha)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===ua||n===da||n===fa||n===pa||n===ma||n===_r||n===ga)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===ua||n===da)return o===et?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===fa)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===pa)return r.COMPRESSED_R11_EAC;if(n===ma)return r.COMPRESSED_SIGNED_R11_EAC;if(n===_r)return r.COMPRESSED_RG11_EAC;if(n===ga)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===_a||n===xa||n===va||n===ya||n===ba||n===Ma||n===Sa||n===wa||n===Ea||n===Ta||n===Aa||n===Ra||n===Ca||n===Ia)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===_a)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===xa)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===va)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ya)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ba)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ma)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Sa)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===wa)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ea)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ta)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Aa)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ra)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ca)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ia)return o===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Pa||n===La||n===Da)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===Pa)return o===et?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===La)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Da)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Na||n===Ua||n===xr||n===Fa)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===Na)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Ua)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===xr)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Fa)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ss?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var _v=` void main() { gl_Position = vec4( position, 1.0 ); -}`,ov=` +}`,xv=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; @@ -4217,7 +4217,7 @@ void main() { } -}`,Zc=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){let n=new er(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 He({vertexShader:rv,fragmentShader:ov,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new xe(new yn(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Jc=class extends Ln{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,p=null,g=null,_=typeof XRWebGLBinding<"u",m=new Zc,f={},M=e.getContextAttributes(),E=null,b=null,v=[],S=[],A=new Ht,x=null,T=null,R=new $e;R.viewport=new ae;let L=new $e;L.viewport=new ae;let N=[R,L],U=new $o,C=null,B=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let j=v[V];return j===void 0&&(j=new ds,v[V]=j),j.getTargetRaySpace()},this.getControllerGrip=function(V){let j=v[V];return j===void 0&&(j=new ds,v[V]=j),j.getGripSpace()},this.getHand=function(V){let j=v[V];return j===void 0&&(j=new ds,v[V]=j),j.getHandSpace()};function z(V){let j=S.indexOf(V.inputSource);if(j===-1)return;let ut=v[j];ut!==void 0&&(ut.update(V.inputSource,V.frame,c||o),ut.dispatchEvent({type:V.type,data:V.inputSource}))}function W(){s.removeEventListener("select",z),s.removeEventListener("selectstart",z),s.removeEventListener("selectend",z),s.removeEventListener("squeeze",z),s.removeEventListener("squeezestart",z),s.removeEventListener("squeezeend",z),s.removeEventListener("end",W),s.removeEventListener("inputsourceschange",F);for(let V=0;V=0&&(S[Lt]=null,v[Lt].disconnect(ut))}for(let j=0;j=S.length){S.push(ut),Lt=Bt;break}else if(S[Bt]===null){S[Bt]=ut,Lt=Bt;break}if(Lt===-1)break}let bt=v[Lt];bt&&bt.connect(ut)}}let D=new I,X=new I;function Z(V,j,ut){D.setFromMatrixPosition(j.matrixWorld),X.setFromMatrixPosition(ut.matrixWorld);let Lt=D.distanceTo(X),bt=j.projectionMatrix.elements,Bt=ut.projectionMatrix.elements,ve=bt[14]/(bt[10]-1),Vt=bt[14]/(bt[10]+1),Jt=(bt[9]+1)/bt[5],he=(bt[9]-1)/bt[5],qt=(bt[8]-1)/bt[0],ye=(Bt[8]+1)/Bt[0],De=ve*qt,tn=ve*ye,be=Lt/(-qt+ye),we=be*-qt;if(j.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(we),V.translateZ(be),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert(),bt[10]===-1)V.projectionMatrix.copy(j.projectionMatrix),V.projectionMatrixInverse.copy(j.projectionMatrixInverse);else{let H=ve+be,We=Vt+be,ee=De-we,P=tn+(Lt-we),y=Jt*Vt/We*H,q=he*Vt/We*H;V.projectionMatrix.makePerspective(ee,P,y,q,H,We),V.projectionMatrixInverse.copy(V.projectionMatrix).invert()}}function G(V,j){j===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(j.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(s===null)return;let j=V.near,ut=V.far;m.texture!==null&&(m.depthNear>0&&(j=m.depthNear),m.depthFar>0&&(ut=m.depthFar)),U.near=L.near=R.near=j,U.far=L.far=R.far=ut,(C!==U.near||B!==U.far)&&(s.updateRenderState({depthNear:U.near,depthFar:U.far}),C=U.near,B=U.far),U.layers.mask=V.layers.mask|6,R.layers.mask=U.layers.mask&-5,L.layers.mask=U.layers.mask&-3;let Lt=V.parent,bt=U.cameras;G(U,Lt);for(let Bt=0;Bt0&&(m.alphaTest.value=f.alphaTest);let M=t.get(f),E=M.envMap,b=M.envMapRotation;E&&(m.envMap.value=E,m.envMapRotation.value.setFromMatrix4(av.makeRotationFromEuler(b)).transpose(),E.isCubeTexture&&E.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(Od),m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap&&(m.lightMap.value=f.lightMap,m.lightMapIntensity.value=f.lightMapIntensity,e(f.lightMap,m.lightMapTransform)),f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,e(f.aoMap,m.aoMapTransform))}function o(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,e(f.map,m.mapTransform))}function a(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,M,E){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*M,m.scale.value=E*.5,f.map&&(m.map.value=f.map,e(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,e(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function h(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function d(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function u(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,e(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,e(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,M){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,e(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,e(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,e(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,e(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,e(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Ve&&m.clearcoatNormalScale.value.negate())),f.dispersion>0&&(m.dispersion.value=f.dispersion),f.retroreflectivity>0&&(m.retroreflectivity.value=f.retroreflectivity),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,e(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,e(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=M.texture,m.transmissionSamplerSize.value.set(M.width,M.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,e(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,e(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,e(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,e(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,e(f.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,f){f.matcap&&(m.matcap.value=f.matcap)}function _(m,f){let M=t.get(f).light;m.referencePosition.value.setFromMatrixPosition(M.matrixWorld),m.nearDistance.value=M.shadow.camera.near,m.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function cv(i,t,e,n){let s={},r={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,v){let S=v.program;n.uniformBlockBinding(b,S)}function c(b,v){let S=s[b.id];S===void 0&&(m(b),S=h(b),s[b.id]=S,b.addEventListener("dispose",M));let A=v.program;n.updateUBOMapping(b,A);let x=t.render.frame;r[b.id]!==x&&(u(b),r[b.id]=x)}function h(b){let v=d();b.__bindingPointIndex=v;let S=i.createBuffer(),A=b.__size,x=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,S),i.bufferData(i.UNIFORM_BUFFER,A,x),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,v,S),S}function d(){for(let b=0;b0&&(S+=A-x),b.__size=S,b.__cache={},this}function f(b){let v={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(v.boundary=4,v.storage=4):b.isVector2?(v.boundary=8,v.storage=8):b.isVector3||b.isColor?(v.boundary=16,v.storage=12):b.isVector4?(v.boundary=16,v.storage=16):b.isMatrix3?(v.boundary=48,v.storage=48):b.isMatrix4?(v.boundary=64,v.storage=64):b.isTexture?Dt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(b)?(v.boundary=16,v.storage=b.byteLength):Dt("WebGLRenderer: Unsupported uniform value type.",b),v}function M(b){let v=b.target;v.removeEventListener("dispose",M);let S=o.indexOf(v.__bindingPointIndex);o.splice(S,1),i.deleteBuffer(s[v.id]),delete s[v.id],delete r[v.id]}function E(){for(let b in s)i.deleteBuffer(s[b]);o=[],s={},r={}}return{bind:l,update:c,dispose:E}}var hv=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 uv(){return zn===null&&(zn=new Nn(hv,16,16,gi,Sn),zn.name="DFG_LUT",zn.minFilter=ze,zn.magFilter=ze,zn.wrapS=In,zn.wrapT=In,zn.generateMipmaps=!1,zn.needsUpdate=!0),zn}var As=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:p=nn}=t;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=o;let _=p,m=new Set([ra,sa,ia]),f=new Set([nn,Mn,bs,Ms,ea,na]),M=new Uint32Array(4),E=new Int32Array(4),b=new I,v=null,S=null,A=[],x=[],T=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=bn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let R=this,L=!1,N=null,U=null,C=null,B=null;this._outputColorSpace=Ae;let z=0,W=0,F=null,D=-1,X=null,Z=new ae,G=new ae,Q=null,lt=new Ft(0),ct=0,et=e.width,V=e.height,j=1,ut=null,Lt=null,bt=new ae(0,0,et,V),Bt=new ae(0,0,et,V),ve=!1,Vt=new Un,Jt=!1,he=!1,qt=new kt,ye=new I,De=new ae,tn={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},be=!1;function we(){return F===null?j:1}let H=n;function We(w,O){return e.getContext(w,O)}let ee,P,y,q,J,nt,ht,dt,it,ot,ft,Ct,_t,pt,It,Nt,zt,k,mt,rt,gt,Mt,at;try{let w={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",ue,!1),e.addEventListener("webglcontextrestored",jt,!1),e.addEventListener("webglcontextcreationerror",fn,!1),H===null){let O="webgl2";if(H=We(O,w),H===null)throw We(O)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}Pt()}catch(w){throw e.removeEventListener("webglcontextlost",ue,!1),e.removeEventListener("webglcontextrestored",jt,!1),e.removeEventListener("webglcontextcreationerror",fn,!1),Ut("WebGLRenderer: "+w.message),w}function Pt(){ee=new x0(H),ee.init(),gt=new sv(H,ee),P=new l0(H,ee,t,gt),y=new nv(H,ee),P.reversedDepthBuffer&&u&&y.buffers.depth.setReversed(!0),U=H.createFramebuffer(),C=H.createFramebuffer(),B=H.createFramebuffer(),q=new b0(H),J=new Vx,nt=new iv(H,ee,y,J,P,gt,q),ht=new _0(R),dt=new Sm(H),Mt=new o0(H,dt),it=new v0(H,dt,q,Mt),ot=new S0(H,it,dt,Mt,q),k=new M0(H,P,nt),It=new c0(J),ft=new Hx(R,ht,ee,P,Mt,It),Ct=new lv(R,J),_t=new Wx,pt=new Jx(ee),zt=new r0(R,ht,y,ot,g,l),Nt=new ev(R,ot,P),at=new cv(H,q,P,y),mt=new a0(H,ee,q),rt=new y0(H,ee,q),q.programs=ft.programs,R.capabilities=P,R.extensions=ee,R.properties=J,R.renderLists=_t,R.shadowMap=Nt,R.state=y,R.info=q}_!==nn&&(T=new E0(_,e.width,e.height,a,s,r));let At=new Jc(R,H);this.xr=At,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){let w=ee.get("WEBGL_lose_context");w&&w.loseContext()},this.forceContextRestore=function(){let w=ee.get("WEBGL_lose_context");w&&w.restoreContext()},this.getPixelRatio=function(){return j},this.setPixelRatio=function(w){w!==void 0&&(j=w,this.setSize(et,V,!1))},this.getSize=function(w){return w.set(et,V)},this.setSize=function(w,O,K=!0){if(At.isPresenting){Dt("WebGLRenderer: Can't change size while VR device is presenting.");return}et=w,V=O,e.width=Math.floor(w*j),e.height=Math.floor(O*j),K===!0&&(e.style.width=w+"px",e.style.height=O+"px"),T!==null&&T.setSize(e.width,e.height),this.setViewport(0,0,w,O)},this.getDrawingBufferSize=function(w){return w.set(et*j,V*j).floor()},this.setDrawingBufferSize=function(w,O,K){et=w,V=O,j=K,e.width=Math.floor(w*K),e.height=Math.floor(O*K),this.setViewport(0,0,w,O)},this.setEffects=function(w){if(_===nn){Ut("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(w){for(let O=0;O{function yt(){if(Y.forEach(function(wt){let Et=J.get(wt).currentProgram;(Et===void 0||Et.isReady())&&Y.delete(wt)}),Y.size===0){$(w);return}setTimeout(yt,10)}ee.get("KHR_parallel_shader_compile")!==null?yt():setTimeout(yt,10)})};let xl=null;function yp(w){xl&&xl(w)}function Uh(){bi.stop()}function Fh(){bi.start()}let bi=new Ld;bi.setAnimationLoop(yp),typeof self<"u"&&bi.setContext(self),this.setAnimationLoop=function(w){xl=w,At.setAnimationLoop(w),w===null?bi.stop():bi.start()},At.addEventListener("sessionstart",Uh),At.addEventListener("sessionend",Fh),this.render=function(w,O){if(O!==void 0&&O.isCamera!==!0){Ut("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;N!==null&&N.renderStart(w,O);let K=At.enabled===!0&&At.isPresenting===!0,Y=T!==null&&(F===null||K)&&T.begin(R,F);if(w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),O.parent===null&&O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),At.enabled===!0&&At.isPresenting===!0&&(T===null||T.isCompositing()===!1)&&(At.cameraAutoUpdate===!0&&At.updateCamera(O),O=At.getCamera()),w.isScene===!0&&w.onBeforeRender(R,w,O,F),S=pt.get(w,x.length),S.init(O),S.state.textureUnits=nt.getTextureUnits(),x.push(S),qt.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),Vt.setFromProjectionMatrix(qt,xn,O.reversedDepth),he=this.localClippingEnabled,Jt=It.init(this.clippingPlanes,he),v=_t.get(w,A.length),v.init(),A.push(v),At.enabled===!0&&At.isPresenting===!0){let wt=R.xr.getDepthSensingMesh();wt!==null&&vl(wt,O,-1/0,R.sortObjects)}vl(w,O,0,R.sortObjects),v.finish(),N!==null&&N.updateLights(S.state.lightsArray),R.sortObjects===!0&&v.sort(ut,Lt),be=At.enabled===!1||At.isPresenting===!1||At.hasDepthSensing()===!1,be&&zt.addToRenderList(v,w),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Jt===!0&&It.beginShadows();let $=S.state.shadowsArray;if(Nt.render($,w,O),Jt===!0&&It.endShadows(),(Y&&T.hasRenderPass())===!1){let wt=v.opaque,vt=v.transmissive;if(S.setupLights(),O.isArrayCamera){let Et=O.cameras;if(vt.length>0)for(let Rt=0,Gt=Et.length;Rt0&&Oh(wt,vt,w,O),be&&zt.render(w),Bh(v,w,O)}F!==null&&W===0&&(nt.updateMultisampleRenderTarget(F),nt.updateRenderTargetMipmap(F)),Y&&T.end(R),w.isScene===!0&&w.onAfterRender(R,w,O),Mt.resetDefaultState(),D=-1,X=null,x.pop(),x.length>0?(S=x[x.length-1],nt.setTextureUnits(S.state.textureUnits),Jt===!0&&It.setGlobalState(R.clippingPlanes,S.state.camera)):S=null,A.pop(),A.length>0?v=A[A.length-1]:v=null,N!==null&&N.renderEnd()};function vl(w,O,K,Y){if(w.visible===!1)return;if(w.layers.test(O.layers)){if(w.isGroup)K=w.renderOrder;else if(w.isLOD)w.autoUpdate===!0&&w.update(O);else if(w.isLightProbeGrid)S.pushLightProbeGrid(w);else if(w.isLight)S.pushLight(w),w.castShadow&&S.pushShadow(w);else if(w.isSprite){if(!w.frustumCulled||w.intersectsFrustum(Vt)){Y&&De.setFromMatrixPosition(w.matrixWorld).applyMatrix4(qt);let wt=ot.update(w),vt=w.material;vt.visible&&v.push(w,wt,vt,K,De.z,null,O)}}else if((w.isMesh||w.isLine||w.isPoints)&&(!w.frustumCulled||w.intersectsFrustum(Vt))){let wt=ot.update(w),vt=w.material;if(Y&&(w.boundingSphere!==void 0?(w.boundingSphere===null&&w.computeBoundingSphere(),De.copy(w.boundingSphere.center)):(wt.boundingSphere===null&&wt.computeBoundingSphere(),De.copy(wt.boundingSphere.center)),De.applyMatrix4(w.matrixWorld).applyMatrix4(qt)),Array.isArray(vt)){let Et=wt.groups;for(let Rt=0,Gt=Et.length;Rt0&&Or($,O,K),yt.length>0&&Or(yt,O,K),wt.length>0&&Or(wt,O,K),y.buffers.depth.setTest(!0),y.buffers.depth.setMask(!0),y.buffers.color.setMask(!0),y.setPolygonOffset(!1)}function Oh(w,O,K,Y){if((K.isScene===!0?K.overrideMaterial:null)!==null)return;if(S.state.transmissionRenderTarget[Y.id]===void 0){let Tt=ee.has("EXT_color_buffer_half_float")||ee.has("EXT_color_buffer_float");S.state.transmissionRenderTarget[Y.id]=new Fe(1,1,{generateMipmaps:!0,type:Tt?Sn:nn,minFilter:pi,samples:Math.max(4,P.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:Yt.workingColorSpace})}let yt=S.state.transmissionRenderTarget[Y.id],wt=Y.viewport||Z;yt.setSize(wt.z*R.transmissionResolutionScale,wt.w*R.transmissionResolutionScale);let vt=R.getRenderTarget(),Et=R.getActiveCubeFace(),Rt=R.getActiveMipmapLevel();R.setRenderTarget(yt),R.getClearColor(lt),ct=R.getClearAlpha(),ct<1&&R.setClearColor(16777215,.5),R.clear(),be&&zt.render(K);let Gt=R.toneMapping;R.toneMapping=bn;let Xt=Y.viewport;if(Y.viewport!==void 0&&(Y.viewport=void 0),S.setupLightsView(Y),Jt===!0&&It.setGlobalState(R.clippingPlanes,Y),Or(w,K,Y),nt.updateMultisampleRenderTarget(yt),nt.updateRenderTargetMipmap(yt),ee.has("WEBGL_multisampled_render_to_texture")===!1){let Tt=!1;for(let Qt=0,Ee=O.length;Qt0,Y.currentProgram=Xt,Y.uniformsList=null,Xt}function kh(w){if(w.uniformsList===null){let O=w.currentProgram.getUniforms();w.uniformsList=Ts.seqWithValue(O.seq,w.uniforms)}return w.uniformsList}function Hh(w,O){let K=J.get(w);K.outputColorSpace=O.outputColorSpace,K.batching=O.batching,K.batchingColor=O.batchingColor,K.instancing=O.instancing,K.instancingColor=O.instancingColor,K.instancingMorph=O.instancingMorph,K.skinning=O.skinning,K.morphTargets=O.morphTargets,K.morphNormals=O.morphNormals,K.morphColors=O.morphColors,K.morphTargetsCount=O.morphTargetsCount,K.numClippingPlanes=O.numClippingPlanes,K.numIntersection=O.numClipIntersection,K.vertexAlphas=O.vertexAlphas,K.vertexTangents=O.vertexTangents,K.toneMapping=O.toneMapping}function bp(w,O){if(w.length===0)return null;if(w.length===1)return w[0].texture!==null?w[0]:null;b.setFromMatrixPosition(O.matrixWorld);for(let K=0,Y=w.length;K0),Tt=!!K.morphAttributes.position,Qt=!!K.morphAttributes.normal,Ee=!!K.morphAttributes.color,me=bn;Y.toneMapped&&(F===null||F.isXRRenderTarget===!0)&&(me=R.toneMapping);let oe=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,Xe=oe!==void 0?oe.length:0,St=J.get(Y),je=S.state.lights;if(Jt===!0&&(he===!0||w!==X)){let de=w===X&&Y.id===D;It.setState(Y,w,de)}let Kt=!1;Y.version===St.__version?(St.needsLights&&St.lightsStateVersion!==je.state.version||St.outputColorSpace!==vt||$.isBatchedMesh&&St.batching===!1||!$.isBatchedMesh&&St.batching===!0||$.isBatchedMesh&&St.batchingColor===!0&&$._colorsTexture===null||$.isBatchedMesh&&St.batchingColor===!1&&$._colorsTexture!==null||$.isInstancedMesh&&St.instancing===!1||!$.isInstancedMesh&&St.instancing===!0||$.isSkinnedMesh&&St.skinning===!1||!$.isSkinnedMesh&&St.skinning===!0||$.isInstancedMesh&&St.instancingColor===!0&&$.instanceColor===null||$.isInstancedMesh&&St.instancingColor===!1&&$.instanceColor!==null||$.isInstancedMesh&&St.instancingMorph===!0&&$.morphTexture===null||$.isInstancedMesh&&St.instancingMorph===!1&&$.morphTexture!==null||St.envMap!==Rt||Y.fog===!0&&St.fog!==yt||St.numClippingPlanes!==void 0&&(St.numClippingPlanes!==It.numPlanes||St.numIntersection!==It.numIntersection)||St.vertexAlphas!==Gt||St.vertexTangents!==Xt||St.morphTargets!==Tt||St.morphNormals!==Qt||St.morphColors!==Ee||St.toneMapping!==me||St.morphTargetsCount!==Xe||!!St.lightProbeGrid!=S.state.lightProbeGridArray.length>0)&&(Kt=!0):(Kt=!0,St.__version=Y.version);let hn=St.currentProgram;Kt===!0&&(hn=zr(Y,O,$),N&&Y.isNodeMaterial&&N.onUpdateProgram(Y,hn,St));let Rn=!1,Qn=!1,Hi=!1,se=hn.getUniforms(),Me=St.uniforms;if(y.useProgram(hn.program)&&(Rn=!0,Qn=!0,Hi=!0),Y.id!==D&&(D=Y.id,Qn=!0),St.needsLights){let de=bp(S.state.lightProbeGridArray,$);St.lightProbeGrid!==de&&(St.lightProbeGrid=de,Qn=!0)}if(Rn||X!==w){y.buffers.depth.getReversed()&&w.reversedDepth!==!0&&(w._reversedDepth=!0,w.updateProjectionMatrix()),se.setValue(H,"projectionMatrix",w.projectionMatrix),se.setValue(H,"viewMatrix",w.matrixWorldInverse);let ei=se.map.cameraPosition;ei!==void 0&&ei.setValue(H,ye.setFromMatrixPosition(w.matrixWorld)),P.logarithmicDepthBuffer&&se.setValue(H,"logDepthBufFC",2/(Math.log(w.far+1)/Math.LN2)),(Y.isMeshPhongMaterial||Y.isMeshToonMaterial||Y.isMeshLambertMaterial||Y.isMeshBasicMaterial||Y.isMeshStandardMaterial||Y.isShaderMaterial)&&se.setValue(H,"isOrthographic",w.isOrthographicCamera===!0),X!==w&&(X=w,Qn=!0,Hi=!0)}if(St.needsLights&&(je.state.sunShadowMap.length>0&&se.setValue(H,"sunShadowMap",je.state.sunShadowMap,nt),je.state.directionalShadowMap.length>0&&se.setValue(H,"directionalShadowMap",je.state.directionalShadowMap,nt),je.state.spotShadowMap.length>0&&se.setValue(H,"spotShadowMap",je.state.spotShadowMap,nt),je.state.pointShadowMap.length>0&&se.setValue(H,"pointShadowMap",je.state.pointShadowMap,nt)),$.isSkinnedMesh){se.setOptional(H,$,"bindMatrix"),se.setOptional(H,$,"bindMatrixInverse");let de=$.skeleton;de&&(de.boneTexture===null&&de.computeBoneTexture(),se.setValue(H,"boneTexture",de.boneTexture,nt))}$.isBatchedMesh&&(se.setOptional(H,$,"batchingTexture"),se.setValue(H,"batchingTexture",$._matricesTexture,nt),se.setOptional(H,$,"batchingIdTexture"),se.setValue(H,"batchingIdTexture",$._indirectTexture,nt),se.setOptional(H,$,"batchingColorTexture"),$._colorsTexture!==null&&se.setValue(H,"batchingColorTexture",$._colorsTexture,nt));let ti=K.morphAttributes;if((ti.position!==void 0||ti.normal!==void 0||ti.color!==void 0)&&k.update($,K,hn),(Qn||St.receiveShadow!==$.receiveShadow)&&(St.receiveShadow=$.receiveShadow,se.setValue(H,"receiveShadow",$.receiveShadow)),(Y.isMeshStandardMaterial||Y.isMeshLambertMaterial||Y.isMeshPhongMaterial)&&Y.envMap===null&&O.environment!==null&&(Me.envMapIntensity.value=O.environmentIntensity),Me.dfgLUT!==void 0&&(Me.dfgLUT.value=uv()),Qn){if(se.setValue(H,"toneMappingExposure",R.toneMappingExposure),St.needsLights&&Sp(Me,Hi),yt&&Y.fog===!0&&Ct.refreshFogUniforms(Me,yt),Ct.refreshMaterialUniforms(Me,Y,j,V,S.state.transmissionRenderTarget[w.id]),St.needsLights&&St.lightProbeGrid){let de=St.lightProbeGrid;Me.probesSH.value=de.texture,Me.probesMin.value.copy(de.boundingBox.min),Me.probesMax.value.copy(de.boundingBox.max),Me.probesResolution.value.copy(de.resolution)}Ts.upload(H,kh(St),Me,nt)}if(Y.isShaderMaterial&&Y.uniformsNeedUpdate===!0&&(Ts.upload(H,kh(St),Me,nt),Y.uniformsNeedUpdate=!1),Y.isSpriteMaterial&&se.setValue(H,"center",$.center),se.setValue(H,"modelViewMatrix",$.modelViewMatrix),se.setValue(H,"normalMatrix",$.normalMatrix),se.setValue(H,"modelMatrix",$.matrixWorld),Y.uniformsGroups!==void 0){let de=Y.uniformsGroups;for(let ei=0,Vi=de.length;ei0&&nt.useMultisampledRTT(w)===!1?Y=J.get(w).__webglMultisampledFramebuffer:Array.isArray(Rt)?Y=Rt[K]:Y=Rt,Z.copy(w.viewport),G.copy(w.scissor),Q=w.scissorTest}else Z.copy(bt).multiplyScalar(j).floor(),G.copy(Bt).multiplyScalar(j).floor(),Q=ve;if(K!==0&&(Y=U),y.bindFramebuffer(H.FRAMEBUFFER,Y)&&y.drawBuffers(w,Y),y.viewport(Z),y.scissor(G),y.setScissorTest(Q),$){let vt=J.get(w.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+O,vt.__webglTexture,K)}else if(yt){let vt=O;for(let Et=0;Et1&&H.readBuffer(H.COLOR_ATTACHMENT0+vt);let Tt=Vh(Rt);if(Tt.__formatReadable===!1){Ut("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(Tt.__typeReadable===!1){Ut("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}O>=0&&O<=w.width-Y&&K>=0&&K<=w.height-$&&H.readPixels(O,K,Y,$,gt.convert(Gt),gt.convert(Xt),yt)}finally{let Rt=F!==null?J.get(F).__webglFramebuffer:null;y.bindFramebuffer(H.FRAMEBUFFER,Rt)}}},this.readRenderTargetPixelsAsync=async function(w,O,K,Y,$,yt,wt,vt=0){if(!(w&&w.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Et=J.get(w).__webglFramebuffer;if(w.isWebGLCubeRenderTarget&&wt!==void 0&&(Et=Et[wt]),Et)if(O>=0&&O<=w.width-Y&&K>=0&&K<=w.height-$){y.bindFramebuffer(H.FRAMEBUFFER,Et);let Rt=w.textures[vt],Gt=Rt.format,Xt=Rt.type;w.textures.length>1&&H.readBuffer(H.COLOR_ATTACHMENT0+vt);let Tt=Vh(Rt);if(Tt.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(Tt.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Qt=H.createBuffer();H.bindBuffer(H.PIXEL_PACK_BUFFER,Qt),H.bufferData(H.PIXEL_PACK_BUFFER,yt.byteLength,H.STREAM_READ),H.readPixels(O,K,Y,$,gt.convert(Gt),gt.convert(Xt),0),H.bindBuffer(H.PIXEL_PACK_BUFFER,null);let Ee=F!==null?J.get(F).__webglFramebuffer:null;y.bindFramebuffer(H.FRAMEBUFFER,Ee);let me=H.fenceSync(H.SYNC_GPU_COMMANDS_COMPLETE,0);return H.flush(),await rd(H,me,4),H.bindBuffer(H.PIXEL_PACK_BUFFER,Qt),H.getBufferSubData(H.PIXEL_PACK_BUFFER,0,yt),H.bindBuffer(H.PIXEL_PACK_BUFFER,null),H.deleteBuffer(Qt),H.deleteSync(me),yt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(w,O=null,K=0){let Y=Math.pow(2,-K),$=Math.floor(w.image.width*Y),yt=Math.floor(w.image.height*Y),wt=O!==null?O.x:0,vt=O!==null?O.y:0;nt.setTexture2D(w,0),H.copyTexSubImage2D(H.TEXTURE_2D,K,0,0,wt,vt,$,yt),y.unbindTexture()},this.copyTextureToTexture=function(w,O,K=null,Y=null,$=0,yt=0){let wt,vt,Et,Rt,Gt,Xt,Tt,Qt,Ee,me=w.isCompressedTexture?w.mipmaps[yt]:w.image;if(K!==null)wt=K.max.x-K.min.x,vt=K.max.y-K.min.y,Et=K.isBox3?K.max.z-K.min.z:1,Rt=K.min.x,Gt=K.min.y,Xt=K.isBox3?K.min.z:0;else{let Me=Math.pow(2,-$);wt=Math.floor(me.width*Me),vt=Math.floor(me.height*Me),w.isDataArrayTexture?Et=me.depth:w.isData3DTexture?Et=Math.floor(me.depth*Me):Et=1,Rt=0,Gt=0,Xt=0}Y!==null?(Tt=Y.x,Qt=Y.y,Ee=Y.z):(Tt=0,Qt=0,Ee=0);let oe=gt.convert(O.format),Xe=gt.convert(O.type),St;O.isData3DTexture?(nt.setTexture3D(O,0),St=H.TEXTURE_3D):O.isDataArrayTexture||O.isCompressedArrayTexture?(nt.setTexture2DArray(O,0),St=H.TEXTURE_2D_ARRAY):(nt.setTexture2D(O,0),St=H.TEXTURE_2D),y.activeTexture(H.TEXTURE0),y.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,O.flipY),y.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),y.pixelStorei(H.UNPACK_ALIGNMENT,O.unpackAlignment);let je=y.getParameter(H.UNPACK_ROW_LENGTH),Kt=y.getParameter(H.UNPACK_IMAGE_HEIGHT),hn=y.getParameter(H.UNPACK_SKIP_PIXELS),Rn=y.getParameter(H.UNPACK_SKIP_ROWS),Qn=y.getParameter(H.UNPACK_SKIP_IMAGES);y.pixelStorei(H.UNPACK_ROW_LENGTH,me.width),y.pixelStorei(H.UNPACK_IMAGE_HEIGHT,me.height),y.pixelStorei(H.UNPACK_SKIP_PIXELS,Rt),y.pixelStorei(H.UNPACK_SKIP_ROWS,Gt),y.pixelStorei(H.UNPACK_SKIP_IMAGES,Xt);let Hi=w.isDataArrayTexture||w.isData3DTexture,se=O.isDataArrayTexture||O.isData3DTexture;if(w.isDepthTexture){let Me=J.get(w),ti=J.get(O),de=J.get(Me.__renderTarget),ei=J.get(ti.__renderTarget);y.bindFramebuffer(H.READ_FRAMEBUFFER,de.__webglFramebuffer),y.bindFramebuffer(H.DRAW_FRAMEBUFFER,ei.__webglFramebuffer);for(let Vi=0;Vi=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(Kc(l,0,a.join(""))i!==null&&typeof i=="object"&&!Array.isArray(i),_i=i=>Array.isArray(i)&&i.every(Cs),Oi=i=>Array.isArray(i)&&i.length===3&&i.every(t=>typeof t=="number"),Wd=i=>Cs(i)&&Oi(i.min)&&Oi(i.max),Hd=i=>i==null||Cs(i)&&_i(i.planes)&&i.planes.every(t=>Oi(t.normal)&&t.normal.every(Number.isFinite)&&t.normal.some(e=>e!==0)&&Number.isFinite(t.offset))&&(i.box==null||Wd(i.box)&&i.box.max.every(Number.isFinite)&&i.box.min.every((t,e)=>Number.isFinite(t)&&t<=i.box.max[e]));function pv(i){if(!Cs(i)||!_i(i.elements)||!_i(i.geometries)||!_i(i.materials)||!Cs(i.instances))throw new re("META must describe elements, geometries, materials and instances.");if(i.title!=null&&typeof i.title!="string")throw new re("Invalid META title.");let{instances:t}=i;if(!Number.isSafeInteger(t.count)||t.count<0)throw new re("Invalid META instance count.");for(let[e,n,s]of[["geometry","u32",t.count],["material","u32",t.count],["element","i32",t.count],["matrix","f32",t.count*12]])if(t[e]?.t!==n||t[e].n!==s)throw new re(`Invalid META instance ${e} view.`);for(let e of i.geometries){let n=e.q;if(!Wd(e.bbox)||!["u16","u32"].includes(e.indices?.t)||e.positions?.t!==(n?"u16":"f32")||n&&(!Oi(n.o)||typeof n.s!="number")||e.normals!=null&&!["f32","i16"].includes(e.normals.t)||e.uvs!=null&&e.uvs.t!=="f32")throw new re("Invalid META geometry.")}mv(i);for(let e of i.materials){let n=e.texture;if(!Oi(e.color)||typeof e.opacity!="number"||n!=null&&(!Number.isInteger(n)||n<0||n>=(i.textures?.length??0)))throw new re("Invalid META material.")}}function mv(i){if(!Cs(i)||!_i(i.elements)||i.title!=null&&typeof i.title!="string")throw new re("Invalid review metadata.");for(let l of["textures","grids","viewpoints","bcfTopics","clashTests","linkedFiles","models"])if(i[l]!=null&&!_i(i[l]))throw new re(`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 re("Invalid META model or level identity.");let t=l=>l==null||Array.isArray(l)&&l.every(c=>Number.isInteger(c)&&c>=0&&cOi(l)&&l.every(Number.isFinite),n=l=>l==null||typeof l=="string",s=l=>e(l.camera?.position)&&e(l.camera?.target)&&Hd(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=br(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=>!_i(l.clashes)||l.clashes.some(c=>!Oi(c.point))))throw new re("Invalid META grids, viewpoints or clashes.");if(i.bcfTopics?.some(l=>typeof l.title!="string"||!n(l.description)||!n(l.status)||!_i(l.viewpoints)||l.viewpoints.some(c=>!o(c))))throw new re("Invalid META BCF topics.");if(i.linkedFiles?.some(l=>!t(l.members)))throw new re("Invalid META linked file members.");if(!Hd(i.sections))throw new re("Invalid META sections.")}function gv(i){let t;try{t=JSON.parse(i)}catch(e){throw new re(e.message,{cause:e})}return pv(t),t}function jc(i=document,t){t?.("metadataStart");let e;try{e=Gd(i,"ioviewer-meta")}catch(s){throw s instanceof re?s:new re(s.message,{cause:s})}let n=gv(e);return t?.("metadataEnd"),n}function Vd(i,t){let e=dv[i?.t];if(!e)throw new re(`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 re(`View ${JSON.stringify(i)} is outside the ${t} bytes of binary data.`);return e}function Xd(i=document,t,e=jc(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}=kd(s)),t?.("binaryEnd")}catch(c){throw new re(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=Vd(c,a);return new h(n.buffer,c.o,c.n)},readView(c){let h=Vd(c,a);if(!c.n)return new h(0);!n&&!r&&(o??(o=kd(s).bytes));let d=n??o;return d?new h(d.buffer,c.o,c.n):new h(fv(s,c.o,c.n*h.BYTES_PER_ELEMENT))},releaseBinary(){n=null,o=null},props(c){return l??(l=JSON.parse(Gd(i,"ioviewer-props"))),l[c]??null}}}var qd=new kt,Yd=new Un,Qc=32;function th(i,t=new Float64Array(24)){return qd.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Yd.setFromProjectionMatrix(qd,i.coordinateSystem,i.reversedDepth),Yd.planes.forEach(({normal:e,constant:n},s)=>t.set([e.x,e.y,e.z,n],s*4)),t}function eh(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 $d(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 wn=.0009765625,ih=32767,Mr=i=>i<0?-1:1;function Jd(i){let t=Math.min(Math.max(i,-1),1)*ih;return Mr(t)*Math.round(Math.abs(t))}function Sr(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))*Mr(o),(1-Math.abs(o))*Mr(a)]),i[t]=Jd(o),i[t+1]=Jd(a)}function Kd(i,t,e,n){let s=Math.max(e/ih,-1),r=Math.max(n/ih,-1),o=1-Math.abs(s)-Math.abs(r);o<0&&([s,r]=[(1-Math.abs(r))*Mr(s),(1-Math.abs(s))*Mr(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 wr(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 jd(i,t){let e=wr(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]=p*2**32+d}let c=0;e<0?l.sort():c=xv(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 of(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&&vv(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+=rf(o,i,l),r.push(o.subarray(l),o.subarray(0,l))}return s}function vv(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 af(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 rh=384*2**20;function lf(i,{cap:t=rh,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 Xa(i,t){return i>65535?new Uint32Array(t):new Uint16Array(t)}function oh(i,t){return i.sort((e,n)=>t[n]-t[e]||e-n)}function cf(i,t,e,n){for(;t>>1;i[s]>=n?t=s+1:e=s}return t}function hf(i,t,e){let n=i[t];return[n,e>t?i[e]-n:0]}function uf(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===wn){for(let a=0;a<3;a++)n[a]=s[9+a]+e.q.o[a];return ef}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/wn)*wn,Math.ceil((c-n[a])/wn)<=nf||(o=!1)}return o||n.fill(0),o?_v:Ps}function df(i,t){let e=i.length,n=0,s=0;for(let m of i){let f=t.source(t.geometryOf[m]);n+=f.vertices,s+=f.indices.length}let r=t.kind[i[0]]===Ps,o=r?new Float32Array(n*4):new Uint16Array(n*4),a=new Int16Array(n*2),l=t.textured?new Float32Array(n*2):null,c=Xa(n,s),h=new Uint32Array(e+1),d=new Float32Array(e*3),u=new Float32Array(e),p=new Float64Array(3),g=0,_=0;for(let m=0;mMath.min(Math.max(Math.round(i/wn),0),nf);function ff(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 qa(i){if(!i.normals&&i.oct){i.normals=new Float32Array(i.vertices*3);for(let t=0;t=0&&(S[Le]=null,v[Le].disconnect(ue))}for(let j=0;j=S.length){S.push(ue),Le=Be;break}else if(S[Be]===null){S[Be]=ue,Le=Be;break}if(Le===-1)break}let be=v[Le];be&&be.connect(ue)}}let D=new I,X=new I;function Z(H,j,ue){D.setFromMatrixPosition(j.matrixWorld),X.setFromMatrixPosition(ue.matrixWorld);let Le=D.distanceTo(X),be=j.projectionMatrix.elements,Be=ue.projectionMatrix.elements,vt=be[14]/(be[10]-1),He=be[14]/(be[10]+1),Je=(be[9]+1)/be[5],ht=(be[9]-1)/be[5],qe=(be[8]-1)/be[0],yt=(Be[8]+1)/Be[0],Dt=vt*qe,en=vt*yt,bt=Le/(-qe+yt),wt=bt*-qe;if(j.matrixWorld.decompose(H.position,H.quaternion,H.scale),H.translateX(wt),H.translateZ(bt),H.matrixWorld.compose(H.position,H.quaternion,H.scale),H.matrixWorldInverse.copy(H.matrixWorld).invert(),be[10]===-1)H.projectionMatrix.copy(j.projectionMatrix),H.projectionMatrixInverse.copy(j.projectionMatrixInverse);else{let V=vt+bt,Wt=He+bt,tt=Dt-wt,P=en+(Le-wt),y=Je*He/Wt*V,q=ht*He/Wt*V;H.projectionMatrix.makePerspective(tt,P,y,q,V,Wt),H.projectionMatrixInverse.copy(H.projectionMatrix).invert()}}function G(H,j){j===null?H.matrixWorld.copy(H.matrix):H.matrixWorld.multiplyMatrices(j.matrixWorld,H.matrix),H.matrixWorldInverse.copy(H.matrixWorld).invert()}this.updateCamera=function(H){if(s===null)return;let j=H.near,ue=H.far;m.texture!==null&&(m.depthNear>0&&(j=m.depthNear),m.depthFar>0&&(ue=m.depthFar)),U.near=L.near=R.near=j,U.far=L.far=R.far=ue,(C!==U.near||B!==U.far)&&(s.updateRenderState({depthNear:U.near,depthFar:U.far}),C=U.near,B=U.far),U.layers.mask=H.layers.mask|6,R.layers.mask=U.layers.mask&-5,L.layers.mask=U.layers.mask&-3;let Le=H.parent,be=U.cameras;G(U,Le);for(let Be=0;Be0&&(m.alphaTest.value=f.alphaTest);let M=e.get(f),E=M.envMap,b=M.envMapRotation;E&&(m.envMap.value=E,m.envMapRotation.value.setFromMatrix4(vv.makeRotationFromEuler(b)).transpose(),E.isCubeTexture&&E.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(Vd),m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap&&(m.lightMap.value=f.lightMap,m.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,m.lightMapTransform)),f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,m.aoMapTransform))}function o(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform))}function a(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,M,E){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*M,m.scale.value=E*.5,f.map&&(m.map.value=f.map,t(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function h(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function d(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function u(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,M){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Ht&&m.clearcoatNormalScale.value.negate())),f.dispersion>0&&(m.dispersion.value=f.dispersion),f.retroreflectivity>0&&(m.retroreflectivity.value=f.retroreflectivity),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=M.texture,m.transmissionSamplerSize.value.set(M.width,M.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,f){f.matcap&&(m.matcap.value=f.matcap)}function _(m,f){let M=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(M.matrixWorld),m.nearDistance.value=M.shadow.camera.near,m.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function bv(i,e,t,n){let s={},r={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,v){let S=v.program;n.uniformBlockBinding(b,S)}function c(b,v){let S=s[b.id];S===void 0&&(m(b),S=h(b),s[b.id]=S,b.addEventListener("dispose",M));let A=v.program;n.updateUBOMapping(b,A);let x=e.render.frame;r[b.id]!==x&&(u(b),r[b.id]=x)}function h(b){let v=d();b.__bindingPointIndex=v;let S=i.createBuffer(),A=b.__size,x=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,S),i.bufferData(i.UNIFORM_BUFFER,A,x),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,v,S),S}function d(){for(let b=0;b0&&(S+=A-x),b.__size=S,b.__cache={},this}function f(b){let v={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(v.boundary=4,v.storage=4):b.isVector2?(v.boundary=8,v.storage=8):b.isVector3||b.isColor?(v.boundary=16,v.storage=12):b.isVector4?(v.boundary=16,v.storage=16):b.isMatrix3?(v.boundary=48,v.storage=48):b.isMatrix4?(v.boundary=64,v.storage=64):b.isTexture?De("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(b)?(v.boundary=16,v.storage=b.byteLength):De("WebGLRenderer: Unsupported uniform value type.",b),v}function M(b){let v=b.target;v.removeEventListener("dispose",M);let S=o.indexOf(v.__bindingPointIndex);o.splice(S,1),i.deleteBuffer(s[v.id]),delete s[v.id],delete r[v.id]}function E(){for(let b in s)i.deleteBuffer(s[b]);o=[],s={},r={}}return{bind:l,update:c,dispose:E}}var Mv=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 Sv(){return zn===null&&(zn=new Nn(Mv,16,16,gi,Sn),zn.name="DFG_LUT",zn.minFilter=zt,zn.magFilter=zt,zn.wrapS=In,zn.wrapT=In,zn.generateMipmaps=!1,zn.needsUpdate=!0),zn}var Rs=class{constructor(e={}){let{canvas:t=od(),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:p=nn}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=o;let _=p,m=new Set([oa,ra,sa]),f=new Set([nn,Mn,Ms,Ss,na,ia]),M=new Uint32Array(4),E=new Int32Array(4),b=new I,v=null,S=null,A=[],x=[],T=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=bn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let R=this,L=!1,N=null,U=null,C=null,B=null;this._outputColorSpace=At;let z=0,W=0,F=null,D=-1,X=null,Z=new at,G=new at,Q=null,le=new Fe(0),ce=0,te=t.width,H=t.height,j=1,ue=null,Le=null,be=new at(0,0,te,H),Be=new at(0,0,te,H),vt=!1,He=new Un,Je=!1,ht=!1,qe=new ke,yt=new I,Dt=new at,en={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},bt=!1;function wt(){return F===null?j:1}let V=n;function Wt(w,O){return t.getContext(w,O)}let tt,P,y,q,J,ne,he,de,ie,oe,fe,Ce,_e,pe,Ie,Ne,ze,k,me,re,ge,Me,ae;try{let w={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",ut,!1),t.addEventListener("webglcontextrestored",je,!1),t.addEventListener("webglcontextcreationerror",fn,!1),V===null){let O="webgl2";if(V=Wt(O,w),V===null)throw Wt(O)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}Pe()}catch(w){throw t.removeEventListener("webglcontextlost",ut,!1),t.removeEventListener("webglcontextrestored",je,!1),t.removeEventListener("webglcontextcreationerror",fn,!1),Ue("WebGLRenderer: "+w.message),w}function Pe(){tt=new I0(V),tt.init(),ge=new gv(V,tt),P=new y0(V,tt,e,ge),y=new pv(V,tt),P.reversedDepthBuffer&&u&&y.buffers.depth.setReversed(!0),U=V.createFramebuffer(),C=V.createFramebuffer(),B=V.createFramebuffer(),q=new D0(V),J=new ev,ne=new mv(V,tt,y,J,P,ge,q),he=new C0(R),de=new Um(V),Me=new x0(V,de),ie=new P0(V,de,q,Me),oe=new U0(V,ie,de,Me,q),k=new N0(V,P,ne),Ie=new b0(J),fe=new Qx(R,he,tt,P,Me,Ie),Ce=new yv(R,J),_e=new nv,pe=new lv(tt),ze=new _0(R,he,y,oe,g,l),Ne=new fv(R,oe,P),ae=new bv(V,q,P,y),me=new v0(V,tt,q),re=new L0(V,tt,q),q.programs=fe.programs,R.capabilities=P,R.extensions=tt,R.properties=J,R.renderLists=_e,R.shadowMap=Ne,R.state=y,R.info=q}_!==nn&&(T=new B0(_,t.width,t.height,a,s,r));let Ae=new Kc(R,V);this.xr=Ae,this.getContext=function(){return V},this.getContextAttributes=function(){return V.getContextAttributes()},this.forceContextLoss=function(){let w=tt.get("WEBGL_lose_context");w&&w.loseContext()},this.forceContextRestore=function(){let w=tt.get("WEBGL_lose_context");w&&w.restoreContext()},this.getPixelRatio=function(){return j},this.setPixelRatio=function(w){w!==void 0&&(j=w,this.setSize(te,H,!1))},this.getSize=function(w){return w.set(te,H)},this.setSize=function(w,O,K=!0){if(Ae.isPresenting){De("WebGLRenderer: Can't change size while VR device is presenting.");return}te=w,H=O,t.width=Math.floor(w*j),t.height=Math.floor(O*j),K===!0&&(t.style.width=w+"px",t.style.height=O+"px"),T!==null&&T.setSize(t.width,t.height),this.setViewport(0,0,w,O)},this.getDrawingBufferSize=function(w){return w.set(te*j,H*j).floor()},this.setDrawingBufferSize=function(w,O,K){te=w,H=O,j=K,t.width=Math.floor(w*K),t.height=Math.floor(O*K),this.setViewport(0,0,w,O)},this.setEffects=function(w){if(_===nn){Ue("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(w){for(let O=0;O{function ye(){if(Y.forEach(function(we){let Ee=J.get(we).currentProgram;(Ee===void 0||Ee.isReady())&&Y.delete(we)}),Y.size===0){$(w);return}setTimeout(ye,10)}tt.get("KHR_parallel_shader_compile")!==null?ye():setTimeout(ye,10)})};let vl=null;function Lp(w){vl&&vl(w)}function Oh(){Mi.stop()}function zh(){Mi.start()}let Mi=new Ud;Mi.setAnimationLoop(Lp),typeof self<"u"&&Mi.setContext(self),this.setAnimationLoop=function(w){vl=w,Ae.setAnimationLoop(w),w===null?Mi.stop():Mi.start()},Ae.addEventListener("sessionstart",Oh),Ae.addEventListener("sessionend",zh),this.render=function(w,O){if(O!==void 0&&O.isCamera!==!0){Ue("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;N!==null&&N.renderStart(w,O);let K=Ae.enabled===!0&&Ae.isPresenting===!0,Y=T!==null&&(F===null||K)&&T.begin(R,F);if(w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),O.parent===null&&O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),Ae.enabled===!0&&Ae.isPresenting===!0&&(T===null||T.isCompositing()===!1)&&(Ae.cameraAutoUpdate===!0&&Ae.updateCamera(O),O=Ae.getCamera()),w.isScene===!0&&w.onBeforeRender(R,w,O,F),S=pe.get(w,x.length),S.init(O),S.state.textureUnits=ne.getTextureUnits(),x.push(S),qe.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),He.setFromProjectionMatrix(qe,xn,O.reversedDepth),ht=this.localClippingEnabled,Je=Ie.init(this.clippingPlanes,ht),v=_e.get(w,A.length),v.init(),A.push(v),Ae.enabled===!0&&Ae.isPresenting===!0){let we=R.xr.getDepthSensingMesh();we!==null&&yl(we,O,-1/0,R.sortObjects)}yl(w,O,0,R.sortObjects),v.finish(),N!==null&&N.updateLights(S.state.lightsArray),R.sortObjects===!0&&v.sort(ue,Le),bt=Ae.enabled===!1||Ae.isPresenting===!1||Ae.hasDepthSensing()===!1,bt&&ze.addToRenderList(v,w),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Je===!0&&Ie.beginShadows();let $=S.state.shadowsArray;if(Ne.render($,w,O),Je===!0&&Ie.endShadows(),(Y&&T.hasRenderPass())===!1){let we=v.opaque,ve=v.transmissive;if(S.setupLights(),O.isArrayCamera){let Ee=O.cameras;if(ve.length>0)for(let Re=0,Ge=Ee.length;Re0&&Vh(we,ve,w,O),bt&&ze.render(w),kh(v,w,O)}F!==null&&W===0&&(ne.updateMultisampleRenderTarget(F),ne.updateRenderTargetMipmap(F)),Y&&T.end(R),w.isScene===!0&&w.onAfterRender(R,w,O),Me.resetDefaultState(),D=-1,X=null,x.pop(),x.length>0?(S=x[x.length-1],ne.setTextureUnits(S.state.textureUnits),Je===!0&&Ie.setGlobalState(R.clippingPlanes,S.state.camera)):S=null,A.pop(),A.length>0?v=A[A.length-1]:v=null,N!==null&&N.renderEnd()};function yl(w,O,K,Y){if(w.visible===!1)return;if(w.layers.test(O.layers)){if(w.isGroup)K=w.renderOrder;else if(w.isLOD)w.autoUpdate===!0&&w.update(O);else if(w.isLightProbeGrid)S.pushLightProbeGrid(w);else if(w.isLight)S.pushLight(w),w.castShadow&&S.pushShadow(w);else if(w.isSprite){if(!w.frustumCulled||w.intersectsFrustum(He)){Y&&Dt.setFromMatrixPosition(w.matrixWorld).applyMatrix4(qe);let we=oe.update(w),ve=w.material;ve.visible&&v.push(w,we,ve,K,Dt.z,null,O)}}else if((w.isMesh||w.isLine||w.isPoints)&&(!w.frustumCulled||w.intersectsFrustum(He))){let we=oe.update(w),ve=w.material;if(Y&&(w.boundingSphere!==void 0?(w.boundingSphere===null&&w.computeBoundingSphere(),Dt.copy(w.boundingSphere.center)):(we.boundingSphere===null&&we.computeBoundingSphere(),Dt.copy(we.boundingSphere.center)),Dt.applyMatrix4(w.matrixWorld).applyMatrix4(qe)),Array.isArray(ve)){let Ee=we.groups;for(let Re=0,Ge=Ee.length;Re0&&zr($,O,K),ye.length>0&&zr(ye,O,K),we.length>0&&zr(we,O,K),y.buffers.depth.setTest(!0),y.buffers.depth.setMask(!0),y.buffers.color.setMask(!0),y.setPolygonOffset(!1)}function Vh(w,O,K,Y){if((K.isScene===!0?K.overrideMaterial:null)!==null)return;if(S.state.transmissionRenderTarget[Y.id]===void 0){let Te=tt.has("EXT_color_buffer_half_float")||tt.has("EXT_color_buffer_float");S.state.transmissionRenderTarget[Y.id]=new Ft(1,1,{generateMipmaps:!0,type:Te?Sn:nn,minFilter:pi,samples:Math.max(4,P.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:Ye.workingColorSpace})}let ye=S.state.transmissionRenderTarget[Y.id],we=Y.viewport||Z;ye.setSize(we.z*R.transmissionResolutionScale,we.w*R.transmissionResolutionScale);let ve=R.getRenderTarget(),Ee=R.getActiveCubeFace(),Re=R.getActiveMipmapLevel();R.setRenderTarget(ye),R.getClearColor(le),ce=R.getClearAlpha(),ce<1&&R.setClearColor(16777215,.5),R.clear(),bt&&ze.render(K);let Ge=R.toneMapping;R.toneMapping=bn;let Xe=Y.viewport;if(Y.viewport!==void 0&&(Y.viewport=void 0),S.setupLightsView(Y),Je===!0&&Ie.setGlobalState(R.clippingPlanes,Y),zr(w,K,Y),ne.updateMultisampleRenderTarget(ye),ne.updateRenderTargetMipmap(ye),tt.has("WEBGL_multisampled_render_to_texture")===!1){let Te=!1;for(let Qe=0,Et=O.length;Qe0,Y.currentProgram=Xe,Y.uniformsList=null,Xe}function Gh(w){if(w.uniformsList===null){let O=w.currentProgram.getUniforms();w.uniformsList=As.seqWithValue(O.seq,w.uniforms)}return w.uniformsList}function Wh(w,O){let K=J.get(w);K.outputColorSpace=O.outputColorSpace,K.batching=O.batching,K.batchingColor=O.batchingColor,K.instancing=O.instancing,K.instancingColor=O.instancingColor,K.instancingMorph=O.instancingMorph,K.skinning=O.skinning,K.morphTargets=O.morphTargets,K.morphNormals=O.morphNormals,K.morphColors=O.morphColors,K.morphTargetsCount=O.morphTargetsCount,K.numClippingPlanes=O.numClippingPlanes,K.numIntersection=O.numClipIntersection,K.vertexAlphas=O.vertexAlphas,K.vertexTangents=O.vertexTangents,K.toneMapping=O.toneMapping}function Dp(w,O){if(w.length===0)return null;if(w.length===1)return w[0].texture!==null?w[0]:null;b.setFromMatrixPosition(O.matrixWorld);for(let K=0,Y=w.length;K0),Te=!!K.morphAttributes.position,Qe=!!K.morphAttributes.normal,Et=!!K.morphAttributes.color,mt=bn;Y.toneMapped&&(F===null||F.isXRRenderTarget===!0)&&(mt=R.toneMapping);let ot=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,Xt=ot!==void 0?ot.length:0,Se=J.get(Y),jt=S.state.lights;if(Je===!0&&(ht===!0||w!==X)){let dt=w===X&&Y.id===D;Ie.setState(Y,w,dt)}let Ke=!1;Y.version===Se.__version?(Se.needsLights&&Se.lightsStateVersion!==jt.state.version||Se.outputColorSpace!==ve||$.isBatchedMesh&&Se.batching===!1||!$.isBatchedMesh&&Se.batching===!0||$.isBatchedMesh&&Se.batchingColor===!0&&$._colorsTexture===null||$.isBatchedMesh&&Se.batchingColor===!1&&$._colorsTexture!==null||$.isInstancedMesh&&Se.instancing===!1||!$.isInstancedMesh&&Se.instancing===!0||$.isSkinnedMesh&&Se.skinning===!1||!$.isSkinnedMesh&&Se.skinning===!0||$.isInstancedMesh&&Se.instancingColor===!0&&$.instanceColor===null||$.isInstancedMesh&&Se.instancingColor===!1&&$.instanceColor!==null||$.isInstancedMesh&&Se.instancingMorph===!0&&$.morphTexture===null||$.isInstancedMesh&&Se.instancingMorph===!1&&$.morphTexture!==null||Se.envMap!==Re||Y.fog===!0&&Se.fog!==ye||Se.numClippingPlanes!==void 0&&(Se.numClippingPlanes!==Ie.numPlanes||Se.numIntersection!==Ie.numIntersection)||Se.vertexAlphas!==Ge||Se.vertexTangents!==Xe||Se.morphTargets!==Te||Se.morphNormals!==Qe||Se.morphColors!==Et||Se.toneMapping!==mt||Se.morphTargetsCount!==Xt||!!Se.lightProbeGrid!=S.state.lightProbeGridArray.length>0)&&(Ke=!0):(Ke=!0,Se.__version=Y.version);let hn=Se.currentProgram;Ke===!0&&(hn=kr(Y,O,$),N&&Y.isNodeMaterial&&N.onUpdateProgram(Y,hn,Se));let Rn=!1,Qn=!1,Hi=!1,st=hn.getUniforms(),Mt=Se.uniforms;if(y.useProgram(hn.program)&&(Rn=!0,Qn=!0,Hi=!0),Y.id!==D&&(D=Y.id,Qn=!0),Se.needsLights){let dt=Dp(S.state.lightProbeGridArray,$);Se.lightProbeGrid!==dt&&(Se.lightProbeGrid=dt,Qn=!0)}if(Rn||X!==w){y.buffers.depth.getReversed()&&w.reversedDepth!==!0&&(w._reversedDepth=!0,w.updateProjectionMatrix()),st.setValue(V,"projectionMatrix",w.projectionMatrix),st.setValue(V,"viewMatrix",w.matrixWorldInverse);let ti=st.map.cameraPosition;ti!==void 0&&ti.setValue(V,yt.setFromMatrixPosition(w.matrixWorld)),P.logarithmicDepthBuffer&&st.setValue(V,"logDepthBufFC",2/(Math.log(w.far+1)/Math.LN2)),(Y.isMeshPhongMaterial||Y.isMeshToonMaterial||Y.isMeshLambertMaterial||Y.isMeshBasicMaterial||Y.isMeshStandardMaterial||Y.isShaderMaterial)&&st.setValue(V,"isOrthographic",w.isOrthographicCamera===!0),X!==w&&(X=w,Qn=!0,Hi=!0)}if(Se.needsLights&&(jt.state.sunShadowMap.length>0&&st.setValue(V,"sunShadowMap",jt.state.sunShadowMap,ne),jt.state.directionalShadowMap.length>0&&st.setValue(V,"directionalShadowMap",jt.state.directionalShadowMap,ne),jt.state.spotShadowMap.length>0&&st.setValue(V,"spotShadowMap",jt.state.spotShadowMap,ne),jt.state.pointShadowMap.length>0&&st.setValue(V,"pointShadowMap",jt.state.pointShadowMap,ne)),$.isSkinnedMesh){st.setOptional(V,$,"bindMatrix"),st.setOptional(V,$,"bindMatrixInverse");let dt=$.skeleton;dt&&(dt.boneTexture===null&&dt.computeBoneTexture(),st.setValue(V,"boneTexture",dt.boneTexture,ne))}$.isBatchedMesh&&(st.setOptional(V,$,"batchingTexture"),st.setValue(V,"batchingTexture",$._matricesTexture,ne),st.setOptional(V,$,"batchingIdTexture"),st.setValue(V,"batchingIdTexture",$._indirectTexture,ne),st.setOptional(V,$,"batchingColorTexture"),$._colorsTexture!==null&&st.setValue(V,"batchingColorTexture",$._colorsTexture,ne));let ei=K.morphAttributes;if((ei.position!==void 0||ei.normal!==void 0||ei.color!==void 0)&&k.update($,K,hn),(Qn||Se.receiveShadow!==$.receiveShadow)&&(Se.receiveShadow=$.receiveShadow,st.setValue(V,"receiveShadow",$.receiveShadow)),(Y.isMeshStandardMaterial||Y.isMeshLambertMaterial||Y.isMeshPhongMaterial)&&Y.envMap===null&&O.environment!==null&&(Mt.envMapIntensity.value=O.environmentIntensity),Mt.dfgLUT!==void 0&&(Mt.dfgLUT.value=Sv()),Qn){if(st.setValue(V,"toneMappingExposure",R.toneMappingExposure),Se.needsLights&&Up(Mt,Hi),ye&&Y.fog===!0&&Ce.refreshFogUniforms(Mt,ye),Ce.refreshMaterialUniforms(Mt,Y,j,H,S.state.transmissionRenderTarget[w.id]),Se.needsLights&&Se.lightProbeGrid){let dt=Se.lightProbeGrid;Mt.probesSH.value=dt.texture,Mt.probesMin.value.copy(dt.boundingBox.min),Mt.probesMax.value.copy(dt.boundingBox.max),Mt.probesResolution.value.copy(dt.resolution)}As.upload(V,Gh(Se),Mt,ne)}if(Y.isShaderMaterial&&Y.uniformsNeedUpdate===!0&&(As.upload(V,Gh(Se),Mt,ne),Y.uniformsNeedUpdate=!1),Y.isSpriteMaterial&&st.setValue(V,"center",$.center),st.setValue(V,"modelViewMatrix",$.modelViewMatrix),st.setValue(V,"normalMatrix",$.normalMatrix),st.setValue(V,"modelMatrix",$.matrixWorld),Y.uniformsGroups!==void 0){let dt=Y.uniformsGroups;for(let ti=0,Gi=dt.length;ti0&&ne.useMultisampledRTT(w)===!1?Y=J.get(w).__webglMultisampledFramebuffer:Array.isArray(Re)?Y=Re[K]:Y=Re,Z.copy(w.viewport),G.copy(w.scissor),Q=w.scissorTest}else Z.copy(be).multiplyScalar(j).floor(),G.copy(Be).multiplyScalar(j).floor(),Q=vt;if(K!==0&&(Y=U),y.bindFramebuffer(V.FRAMEBUFFER,Y)&&y.drawBuffers(w,Y),y.viewport(Z),y.scissor(G),y.setScissorTest(Q),$){let ve=J.get(w.texture);V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_CUBE_MAP_POSITIVE_X+O,ve.__webglTexture,K)}else if(ye){let ve=O;for(let Ee=0;Ee1&&V.readBuffer(V.COLOR_ATTACHMENT0+ve);let Te=Xh(Re);if(Te.__formatReadable===!1){Ue("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(Te.__typeReadable===!1){Ue("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}O>=0&&O<=w.width-Y&&K>=0&&K<=w.height-$&&V.readPixels(O,K,Y,$,ge.convert(Ge),ge.convert(Xe),ye)}finally{let Re=F!==null?J.get(F).__webglFramebuffer:null;y.bindFramebuffer(V.FRAMEBUFFER,Re)}}},this.readRenderTargetPixelsAsync=async function(w,O,K,Y,$,ye,we,ve=0){if(!(w&&w.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ee=J.get(w).__webglFramebuffer;if(w.isWebGLCubeRenderTarget&&we!==void 0&&(Ee=Ee[we]),Ee)if(O>=0&&O<=w.width-Y&&K>=0&&K<=w.height-$){y.bindFramebuffer(V.FRAMEBUFFER,Ee);let Re=w.textures[ve],Ge=Re.format,Xe=Re.type;w.textures.length>1&&V.readBuffer(V.COLOR_ATTACHMENT0+ve);let Te=Xh(Re);if(Te.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(Te.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Qe=V.createBuffer();V.bindBuffer(V.PIXEL_PACK_BUFFER,Qe),V.bufferData(V.PIXEL_PACK_BUFFER,ye.byteLength,V.STREAM_READ),V.readPixels(O,K,Y,$,ge.convert(Ge),ge.convert(Xe),0),V.bindBuffer(V.PIXEL_PACK_BUFFER,null);let Et=F!==null?J.get(F).__webglFramebuffer:null;y.bindFramebuffer(V.FRAMEBUFFER,Et);let mt=V.fenceSync(V.SYNC_GPU_COMMANDS_COMPLETE,0);return V.flush(),await ld(V,mt,4),V.bindBuffer(V.PIXEL_PACK_BUFFER,Qe),V.getBufferSubData(V.PIXEL_PACK_BUFFER,0,ye),V.bindBuffer(V.PIXEL_PACK_BUFFER,null),V.deleteBuffer(Qe),V.deleteSync(mt),ye}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(w,O=null,K=0){let Y=Math.pow(2,-K),$=Math.floor(w.image.width*Y),ye=Math.floor(w.image.height*Y),we=O!==null?O.x:0,ve=O!==null?O.y:0;ne.setTexture2D(w,0),V.copyTexSubImage2D(V.TEXTURE_2D,K,0,0,we,ve,$,ye),y.unbindTexture()},this.copyTextureToTexture=function(w,O,K=null,Y=null,$=0,ye=0){let we,ve,Ee,Re,Ge,Xe,Te,Qe,Et,mt=w.isCompressedTexture?w.mipmaps[ye]:w.image;if(K!==null)we=K.max.x-K.min.x,ve=K.max.y-K.min.y,Ee=K.isBox3?K.max.z-K.min.z:1,Re=K.min.x,Ge=K.min.y,Xe=K.isBox3?K.min.z:0;else{let Mt=Math.pow(2,-$);we=Math.floor(mt.width*Mt),ve=Math.floor(mt.height*Mt),w.isDataArrayTexture?Ee=mt.depth:w.isData3DTexture?Ee=Math.floor(mt.depth*Mt):Ee=1,Re=0,Ge=0,Xe=0}Y!==null?(Te=Y.x,Qe=Y.y,Et=Y.z):(Te=0,Qe=0,Et=0);let ot=ge.convert(O.format),Xt=ge.convert(O.type),Se;O.isData3DTexture?(ne.setTexture3D(O,0),Se=V.TEXTURE_3D):O.isDataArrayTexture||O.isCompressedArrayTexture?(ne.setTexture2DArray(O,0),Se=V.TEXTURE_2D_ARRAY):(ne.setTexture2D(O,0),Se=V.TEXTURE_2D),y.activeTexture(V.TEXTURE0),y.pixelStorei(V.UNPACK_FLIP_Y_WEBGL,O.flipY),y.pixelStorei(V.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),y.pixelStorei(V.UNPACK_ALIGNMENT,O.unpackAlignment);let jt=y.getParameter(V.UNPACK_ROW_LENGTH),Ke=y.getParameter(V.UNPACK_IMAGE_HEIGHT),hn=y.getParameter(V.UNPACK_SKIP_PIXELS),Rn=y.getParameter(V.UNPACK_SKIP_ROWS),Qn=y.getParameter(V.UNPACK_SKIP_IMAGES);y.pixelStorei(V.UNPACK_ROW_LENGTH,mt.width),y.pixelStorei(V.UNPACK_IMAGE_HEIGHT,mt.height),y.pixelStorei(V.UNPACK_SKIP_PIXELS,Re),y.pixelStorei(V.UNPACK_SKIP_ROWS,Ge),y.pixelStorei(V.UNPACK_SKIP_IMAGES,Xe);let Hi=w.isDataArrayTexture||w.isData3DTexture,st=O.isDataArrayTexture||O.isData3DTexture;if(w.isDepthTexture){let Mt=J.get(w),ei=J.get(O),dt=J.get(Mt.__renderTarget),ti=J.get(ei.__renderTarget);y.bindFramebuffer(V.READ_FRAMEBUFFER,dt.__webglFramebuffer),y.bindFramebuffer(V.DRAW_FRAMEBUFFER,ti.__webglFramebuffer);for(let Gi=0;Gi=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(jc(l,0,a.join(""))i!==null&&typeof i=="object"&&!Array.isArray(i),_i=i=>Array.isArray(i)&&i.every(Is),zi=i=>Array.isArray(i)&&i.length===3&&i.every(e=>typeof e=="number"),Yd=i=>Is(i)&&zi(i.min)&&zi(i.max),Wd=i=>i==null||Is(i)&&_i(i.planes)&&i.planes.every(e=>zi(e.normal)&&e.normal.every(Number.isFinite)&&e.normal.some(t=>t!==0)&&Number.isFinite(e.offset))&&(i.box==null||Yd(i.box)&&i.box.max.every(Number.isFinite)&&i.box.min.every((e,t)=>Number.isFinite(e)&&e<=i.box.max[t]));function Tv(i){if(!Is(i)||!_i(i.elements)||!_i(i.geometries)||!_i(i.materials)||!Is(i.instances))throw new rt("META must describe elements, geometries, materials and instances.");if(i.title!=null&&typeof i.title!="string")throw new rt("Invalid META title.");let{instances:e}=i;if(!Number.isSafeInteger(e.count)||e.count<0)throw new rt("Invalid META instance count.");for(let[t,n,s]of[["geometry","u32",e.count],["material","u32",e.count],["element","i32",e.count],["matrix","f32",e.count*12]])if(e[t]?.t!==n||e[t].n!==s)throw new rt(`Invalid META instance ${t} view.`);for(let t of i.geometries){let n=t.q;if(!Yd(t.bbox)||!["u16","u32"].includes(t.indices?.t)||t.positions?.t!==(n?"u16":"f32")||n&&(!zi(n.o)||typeof n.s!="number")||t.normals!=null&&!["f32","i16"].includes(t.normals.t)||t.uvs!=null&&t.uvs.t!=="f32")throw new rt("Invalid META geometry.")}Av(i);for(let t of i.materials){let n=t.texture;if(!zi(t.color)||typeof t.opacity!="number"||n!=null&&(!Number.isInteger(n)||n<0||n>=(i.textures?.length??0)))throw new rt("Invalid META material.")}}function Av(i){if(!Is(i)||!_i(i.elements)||i.title!=null&&typeof i.title!="string")throw new rt("Invalid review metadata.");for(let l of["textures","grids","viewpoints","bcfTopics","clashTests","linkedFiles","models"])if(i[l]!=null&&!_i(i[l]))throw new rt(`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 rt("Invalid META model or level identity.");let e=l=>l==null||Array.isArray(l)&&l.every(c=>Number.isInteger(c)&&c>=0&&czi(l)&&l.every(Number.isFinite),n=l=>l==null||typeof l=="string",s=l=>t(l.camera?.position)&&t(l.camera?.target)&&Wd(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=Mr(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=>!_i(l.clashes)||l.clashes.some(c=>!zi(c.point))))throw new rt("Invalid META grids, viewpoints or clashes.");if(i.bcfTopics?.some(l=>typeof l.title!="string"||!n(l.description)||!n(l.status)||!_i(l.viewpoints)||l.viewpoints.some(c=>!o(c))))throw new rt("Invalid META BCF topics.");if(i.linkedFiles?.some(l=>!e(l.members)))throw new rt("Invalid META linked file members.");if(!Wd(i.sections))throw new rt("Invalid META sections.")}function Rv(i){let e;try{e=JSON.parse(i)}catch(t){throw new rt(t.message,{cause:t})}return Tv(e),e}function Qc(i=document,e){e?.("metadataStart");let t;try{t=qd(i,"ioviewer-meta")}catch(s){throw s instanceof rt?s:new rt(s.message,{cause:s})}let n=Rv(t);return e?.("metadataEnd"),n}function Xd(i,e){let t=wv[i?.t];if(!t)throw new rt(`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 rt(`View ${JSON.stringify(i)} is outside the ${e} bytes of binary data.`);return t}function $d(i=document,e,t=Qc(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}=Gd(s)),e?.("binaryEnd")}catch(c){throw new rt(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=Xd(c,a);return new h(n.buffer,c.o,c.n)},readView(c){let h=Xd(c,a);if(!c.n)return new h(0);!n&&!r&&(o??(o=Gd(s).bytes));let d=n??o;return d?new h(d.buffer,c.o,c.n):new h(Ev(s,c.o,c.n*h.BYTES_PER_ELEMENT))},releaseBinary(){n=null,o=null},props(c){return l??(l=JSON.parse(qd(i,"ioviewer-props"))),l[c]??null}}}var Zd=new ke,Jd=new Un,eh=32;function th(i,e=new Float64Array(24)){return Zd.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Jd.setFromProjectionMatrix(Zd,i.coordinateSystem,i.reversedDepth),Jd.planes.forEach(({normal:t,constant:n},s)=>e.set([t.x,t.y,t.z,n],s*4)),e}function nh(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 Kd(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 wn=.0009765625,sh=32767,Sr=i=>i<0?-1:1;function Qd(i){let e=Math.min(Math.max(i,-1),1)*sh;return Sr(e)*Math.round(Math.abs(e))}function wr(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))*Sr(o),(1-Math.abs(o))*Sr(a)]),i[e]=Qd(o),i[e+1]=Qd(a)}function ef(i,e,t,n){let s=Math.max(t/sh,-1),r=Math.max(n/sh,-1),o=1-Math.abs(s)-Math.abs(r);o<0&&([s,r]=[(1-Math.abs(r))*Sr(s),(1-Math.abs(s))*Sr(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 Er(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 tf(i,e){let t=Er(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]=p*2**32+d}let c=0;t<0?l.sort():c=Iv(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 cf(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&&Pv(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+=lf(o,i,l),r.push(o.subarray(l),o.subarray(0,l))}return s}function Pv(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 hf(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 oh=384*2**20;function uf(i,{cap:e=oh,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 qa(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 df(i,e,t,n){for(;e>>1;i[s]>=n?e=s+1:t=s}return e}function ff(i,e,t){let n=i[e];return[n,t>e?i[t]-n:0]}function pf(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===wn){for(let a=0;a<3;a++)n[a]=s[9+a]+t.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]*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/wn)*wn,Math.ceil((c-n[a])/wn)<=of||(o=!1)}return o||n.fill(0),o?Cv:Ls}function mf(i,e){let t=i.length,n=0,s=0;for(let m of i){let f=e.source(e.geometryOf[m]);n+=f.vertices,s+=f.indices.length}let r=e.kind[i[0]]===Ls,o=r?new Float32Array(n*4):new Uint16Array(n*4),a=new Int16Array(n*2),l=e.textured?new Float32Array(n*2):null,c=qa(n,s),h=new Uint32Array(t+1),d=new Float32Array(t*3),u=new Float32Array(t),p=new Float64Array(3),g=0,_=0;for(let m=0;mMath.min(Math.max(Math.round(i/wn),0),of);function gf(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 Ya(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; -}`,Tr=` +}`,Ar=` 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;`,lh=` #ifndef IO_NO_HIDE_BRANCH if ( state.a < 0.5 ) gl_Position = vec4( 0.0, 0.0, 2.0, 1.0 ); -#endif`,Sv=` +#endif`,Uv=` vec3 transformedNormal = objectNormal; #ifdef USE_INSTANCING mat3 im = mat3( instanceMatrix ); @@ -4248,13 +4248,13 @@ transformedNormal = mat3( cross( im[ 1 ], im[ 2 ] ), cross( im[ 2 ], im[ 0 ] ), transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; -#endif`;function xi(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 wv(i){Object.assign(i.uniforms,this.userData.slotUniforms);let t=xi(i.vertexShader,"#include ",`#include -${Er}`);t=xi(t,"#include ",`${Tr} -vTint = state.rgb;`),t=xi(t,"#include ","vec3 objectNormal = ioOct( normal.xy );"),t=xi(t,"#include ",Sv),t=xi(t,"#include ","vec3 transformed = slotPosition;"),t=xi(t,"#include ",`#include -${ah}`),i.vertexShader=t;let e=xi(i.fragmentShader,"#include ",`#include -varying vec3 vTint;`);e=xi(e,"#include ","diffuseColor.rgb *= vTint;"),i.fragmentShader=e}function lh(i,t,e=!1){return i.userData.slotUniforms=t,i.onBeforeCompile=wv,i.index0AttributeName="q",e&&(i.defines={IO_NO_HIDE_BRANCH:""}),i}var dh=["materials","textures","white","wireframe"],Ev=[245,158,11],Tv=[235,235,237],Ar=4294967295,zi=2048,ch=256,Av=16,hh=1024,Rv=.1,Cv=8192,Iv=1.4,$a=2**-20,Ya=17;function Pv(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 Lv(){this.array=null}function En(i,t,e=!1,n=Se){return new n(i,t,e).onUpload(Lv)}var Rr=class extends RangeError{constructor(t,e){super(`${t} drawable instances exceed the limit of ${e}.`),this.name="ModelTooLargeError",this.count=t,this.limit=e}},pf=(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+$a*Math.abs(l)))return!0}return!1}function Nv(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],p=l*n[0],g=c*e[1],_=c*n[1],m=h*e[2],f=h*n[2];s[o+a]=Math.min(u,p)+Math.min(g,_)+Math.min(m,f)+d,s[o+a+3]=Math.max(u,p)+Math.max(g,_)+Math.max(m,f)+d}}var Uv=i=>{let t=i.getHex(Ae);return[t>>16&255,t>>8&255,t&255]},Cr=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);this.root=new Re,this.elementCount=n.elements.length,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=t.view(s.element).slice(),this._bucketOf=new Uint32Array(r),this._visible=new Uint8Array(r).fill(1),this._layers=new Map,this._layerHides=new Uint8Array(r),this._highlight=new Uint8Array(r),this._highlighted=[],this._tint=new Map,this._boxes=new Float32Array(r*6),this._minPixels=0,this._viewHeight=1,this.visibleCost=0;let c=!!e.noHideBranch;this.slotUniforms={slotInfo:{value:null},slotState:{value:null}},this._buckets=this._createBuckets(n,a,c),this._indexElements();for(let d=0;dthis._shown(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=th(n,this._planes);let{x:r,y:o,z:a}=n.position;this._pickViewPadding=$a*(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 ie){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+=uh(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 p=this._pixels[n+u];p<0||(pc.count;for(let u=0;u0?o[6]/m:1/0:o[6];d[p]=f;let M=g.cell&&this._detailUsesInstances,E=M&&!$d(r,_[0],_[1],_[2],_[3]+g.pickPadding),b=g.slotBase+g.n,v=-1;if(M){let R=this._slotRadius[g.slotBase],L=this._slotRadius[b-1],N=m+_[3],U=Math.abs(o[3])*_[4]+Math.abs(o[4])*_[5]+Math.abs(o[5])*_[6],C=N-U-R,B=N+U-L,z=Math.fround(o[7]?C>0?R*o[6]/C:1/0:R*f),W=Math.fround(o[7]?B>0?L*o[6]/B:1/0:L*f);Is(W)===Is(z)&&(v=z)}if(v>=0&&!E){g.detailLow=g.detailHigh=v,g.detailEnd=g.n;let R=this._slotCost[g.slotBase]*g.shown;l[Is(v)]+=R,u+=R;continue}let S=0,A=1/0,x=-1,T=0;for(let R=g.slotBase;R=0){S++;continue}let D=(z-o[0])*o[3]+(W-o[1])*o[4]+(F-o[2])*o[5]-L;N=o[7]?D>0?o[6]/D:1/0:o[6]}let U=N===1/0?1/0:Math.fround(L*N);M&&(a[R]=U,A=Math.min(A,U),x=Math.max(x,U));let C=this._slotCost[R];l[Is(U)]+=C,u+=C}if(M){if(S){A=x=v;let R=S*this._slotCost[g.slotBase];l[Is(v)]+=R,u+=R}g.detailLow=A,g.detailHigh=x,g.detailEnd=T}}return this.visibleCost=u,Zd(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+=uh(r,r.first,Math.max(r.last+1,r.first)),e+=uh(r,r.first,Math.max(r.end,r.first)),s++);return{drawn:e,inView:n,draws:s}}drawnInstances(t){t.updateMatrixWorld();let e=new Un().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=F=>{let D=l.get(F);if(!D){let X=a.geometries[F],Z=t.view(X.indices),G=X.uvs?t.view(X.uvs):null;D=ff(wr(t,X),X.q??null,Qd(t,X),Z,G),D.drawable=D.indices.length>=3&&D.min.every(Number.isFinite)&&D.max.every(Number.isFinite),l.set(F,D)}return D},h=new Uint8Array(o),d=new Float64Array(o*3),u=new Float32Array(o*3),p=new Uint32Array(o),g=new Float32Array(o),_=new Uint8Array(o),m=new Map,f=this._boxes;for(let F=0;FF-D).map(F=>{let D=m.get(F),X=c(e[D[0]]),Z=this._buckets[this._bucketOf[D[0]]].texture!==null,G=[0,1,2].every(lt=>(X.max[lt]-X.min[lt])/wn<=65535),Q=X.vertices*((G?12:20)+(Z?8:0))+X.indices.length*(X.vertices>65535?4:2);return{k:D.length,bytes:Q,members:D,textured:Z}}),b=s.mergedCap??rh,v=s.minRepeats??Av;if(E.reduce((F,D)=>F+D.k*D.bytes,0)>b){let F=s.cellExtent==null?af(f,p)*Rv:this.visibleBox().getSize(new I).length()*s.cellExtent;for(let D of E)D.k{if(S[D]){for(let X of F.leaves)T.push({shape:F,members:oh(X,g)});return}for(let X of F.members){x[e[X]]++;let Z=this._bucketOf[X]*2+(h[X]===Ps?1:0),G=A.get(Z);G||A.set(Z,G=[]),G.push(X)}});let R=[];for(let F of[...A.keys()].sort((D,X)=>D-X))for(let D of sf(u,p,A.get(F),s.chunkVertices??tf))R.push(oh(D,g));let L=[...R,...T.map(F=>F.members)].reduce((F,D)=>F+D.length,0);if(L>r)throw new Rr(L,r);let N=Math.max(1,Math.ceil(L/zi)),U=new Float32Array(zi*N*4);this._state=new Nn(new Uint8Array(zi*N*4),zi,N),this._state.colorSpace=Ae,this._state.onUpdate=()=>{this._fullPending=!1,this._pendingRanges=0},this._fullPending=!0,this._pendingRanges=0,this._dirty=new Uint32Array(ch),this._dirtyCount=0;let C=new Nn(U,zi,N,sn,Ge);C.needsUpdate=!0,C.onUpdate=()=>C.image.data=null,this.slotUniforms.slotInfo.value=C,this.slotUniforms.slotState.value=this._state,this._stateBytes=zi*N*20,this._slotOf=new Uint32Array(o).fill(Ar),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(hh),this._detailBins=new Float64Array(Qc),this._detailBytes=0,this._unitScale=null,this._cutInView=0,this._cutFrame=-1,this._mergedBytes=0,this._instancedBytes=0,this._lineBytes=0;let B={matrices:n,geometryOf:e,mirrored:_,kind:h,origins:d,source:c,textured:!1};this._lineSources=new Map;let z=0;for(let F of R){let D=this._buckets[this._bucketOf[F[0]]];B.textured=D.texture!==null;let X=df(F,B);for(let Z=0;ZF+D,0);let W=new Map;for(let{shape:F,members:D}of T){let X=D[0],Z=c(e[X]),G=W.get(F);if(!G){let Q=a.geometries[e[X]].bbox;G=this._shape(Z,_[X]===1,F.textured);let lt=et=>Math.max(...et.map(Math.abs)),ct=Math.max(lt(Z.min),lt(Z.max));G.pickExtent=ct,G.pickPadding=Math.max(0,...Z.min.map((et,V)=>Q.min[V]-et),...Z.max.map((et,V)=>et-Q.max[V]))+(Z.q?$a*(lt(Z.q.o)+65535*Math.abs(Z.q.s)):0),W.set(F,G)}for(let Q=0;QF+D,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+f),1,!1,Kn);a.setAttribute("slotBase",l),a.setIndex(s.index);let c=gf(this._boxes,e),h=new Oe(new I(c[0],c[1],c[2]),c[3]);a.boundingSphere=h;let d=new ps(a,t.material,0),u=new Float32Array(o*16),p=new Float32Array(o*12),g=0;for(let m=0;mthis._range(_,m,M,d),d.visible=!1,this.root.add(d),_}_chunk(t,e,n,s,r,o){let a=new xs;a.instanceCount=1,a.setAttribute("q",En(s.q,4)),a.setAttribute("normal",En(s.o,2,!0)),s.uv&&a.setAttribute("uv",En(s.uv,2)),a.setAttribute("slotBase",En(new Float32Array([n]),1,!1,Kn)),a.setIndex(En(s.index,1));let l=gf(this._boxes,e);a.boundingSphere=new Oe(new I(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 xe(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,p)=>this._range(h,d,p,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 ps(n.mesh.geometry,n.bucket.wire,0),n.lines.instanceMatrix=n.mesh.instanceMatrix,n.lines.boundingSphere=n.mesh.boundingSphere,n.lines.onBeforeRender=(d,u,p)=>this._range(n,d,p,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=Xa(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 p=0;pthis._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]&&!Dv(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&&(nh(n,this._viewHeight,this._frameView),this._frameViewAt=o);let a=this._frameView,l=mf(a,t.sphere),c=a[7]?l>0?this._minPixels*l/a[6]:0:this._minPixels/a[6];r=Math.min(r,cf(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]=hf(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:lh(new _s({side:Ie}),this.slotUniforms,n),wire:lh(new _s({side:Ie,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 ke(s),e.colorSpace=Ae,e.wrapS=e.wrapT=os,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}_colorOf(t){return this._highlight[t]?Ev:this._tint.get(t)??(this._mode==="white"?Tv:this._buckets[this._bucketOf[t]].bytes)}_applyColor(t){let e=this._slotOf[t];e!==Ar&&(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===Ar)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(!pf(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 uh(i,t,e){return e<=t?0:i.cell?(e-t)*i.triangles:(i.starts[e]-i.starts[t])/3}function mf(i,t){return(t[0]-i[0])*i[3]+(t[1]-i[1])*i[4]+(t[2]-i[2])*i[5]-t[3]}function gf(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 Fv={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",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.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.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.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","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",elementGroup:"Element",id:"Id",category:"Category",type:"Type",level:"Level",sourceId:"Source ID",link:"Link",panels:"Panels","panel.model":"Model","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.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.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","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"}},Ls=(globalThis.navigator?.language??"").toLowerCase().startsWith("ru")?"ru":"en",Ir=new Intl.NumberFormat(Ls).format;function st(i,t=Ls){let e=Fv[t][i];if(e===void 0)throw new Error(`Missing UI string '${i}'.`);return e}var _f=new I(0,0,1),Za=Math.PI/2-.01;function vf(i,t,e=4){return Math.hypot(t.x-i.x,t.y-i.y)<=e}function yf(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 Ce().setFromAxisAngle(_f,-n*r));let c=a.clone().sub(o).normalize(),h=c.clone().cross(_f);if(h.lengthSq()>1e-12){let d=Math.asin(ce.clamp(c.z,-1,1)),u=ce.clamp(s*r,d-Za,d+Za);l(new Ce().setFromAxisAngle(h.normalize(),-u))}return{position:o.add(e),target:a.add(e)}}function bf(i,t,e,n){let s=r=>r.clone().sub(e).multiplyScalar(n).add(e);return{position:s(i),target:s(t)}}var Bv=.85,Ov=100/3;function Mf(i,t,e){let n=i*(t===1?Ov:t===2?e:1);return ce.clamp(Bv**(-n/100),.5,2)}var fh=(i,t)=>t>=i?"window":"crossing";function Sf(i,t,e){let n=xf(i.position,i.target),s=xf(t.position,t.target),r=n.azimuth??s.azimuth??0,o=s.azimuth??r,a=ce.euclideanModulo(o-r+Math.PI,2*Math.PI)-Math.PI,l=(_,m)=>_+(m-_)*e,c=r+a*e,h=ce.clamp(l(n.elevation,s.elevation),-Za,Za),d=l(n.distance,s.distance),u=i.target.clone().lerp(t.target,e),p=Math.cos(h)*d;return{position:u.clone().add(new I(p*Math.cos(c),p*Math.sin(c),Math.sin(h)*d)),target:u}}function wf(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 Ce().setFromUnitVectors(s,r),c=e.clone().applyQuaternion(l),h=new I().setFromMatrixColumn(new kt().lookAt(t.position,t.target,n),1),d=r.dot(new I().crossVectors(c,h)),u=Math.atan2(Math.abs(d)<1e-9?0:d,c.dot(h)),p=new Ce;return g=>{p.identity().slerp(l,g);let _=s.clone().applyQuaternion(p),m=i.target.clone().lerp(t.target,g),f=_.clone().multiplyScalar(ce.lerp(o,a,g)).add(m),M=e.clone().applyQuaternion(p).applyAxisAngle(_,u*g);return{position:f,target:m,up:M}}}function xf(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(ce.clamp(e.z/n,-1,1)):0,azimuth:s>1e-9*Math.max(n,1e-12)?Math.atan2(e.y,e.x):null}}var zv=.005,kv=new I(1,-1,.8).normalize(),mh=.01,Ef=1e-6,Hv=64,Tf=1.05,Vv=5e3,ph=(i,t)=>new CustomEvent(i,{detail:t});function Af({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 ie(new I(...i.min),new I(...i.max));if(n.isEmpty())return!0;let s=new I;for(let r of t??[])for(let o of br(r)){if(!e(o))return!0;n.expandByPoint(s.fromArray(o))}return n.getSize(s).length()*Tf>mh*Vv}var Ja=class extends EventTarget{constructor(t,e,{pick:n=()=>null,visibleBox:s=()=>new ie}={}){super(),this.dom=e,this.pick=n,this.visibleBox=s,this.target=new I,this.leftButtonMode="orbit",this._perspective=t,this._defaultFov=t.fov,this._orthographic=new Fn(-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(ce.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 I(0,0,-1).applyQuaternion(t.quaternion);t.far=Math.max(1e-6,(r.length()+s.radius)*Tf);let a=r.dot(o)-s.radius;t.near=Math.max(a*.95,Math.min(mh,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 ie;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),s=Math.max(n.radius,.001),r=ce.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(kv);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))}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 I(...t),a=new I(...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(ce.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?wf(o,a,new I(0,1,0).applyQuaternion(this.camera.quaternion),this.camera.up):u=>Sf(o,a,u),h=performance.now(),d=u=>{let p=Math.min((u-h)/r,1),g=p*p*(3-2*p),_=c(g);this.camera.isOrthographicCamera&&(this.camera.zoom=ce.lerp(l,n,g)),this._set(_.position,_.target,_.up),this._animation=p<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.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(Ef,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&&vf(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=yf(this.camera.position,this.target,e.pivot,s,r,zv);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 I))}let r=n.isPerspectiveCamera?2*this._drag.depth*Math.tan(ce.degToRad(n.fov/2))/(s*n.zoom):(n.top-n.bottom)/n.zoom/s,o=new I(1,0,0).applyQuaternion(n.quaternion),a=new I(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=fh(e.down.x,n.x);this.dispatchEvent(ph("boxselect",{rect:s,mode:r,ctrl:t.ctrlKey,shift:t.shiftKey}))}else!e.moved&&e.button===0?this.dispatchEvent(ph("click",{x:n.x,y:n.y,button:0,ctrl:t.ctrlKey,shift:t.shiftKey})):!e.moved&&e.button===2&&this.dispatchEvent(ph("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:fh(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=Mf(t.deltaY,t.deltaMode,this.dom.clientHeight),n=this.camera,s=n.position.distanceTo(this.target),r=this._visibleBounds()?.sphere.radius??0,o=Hv*Math.max(r,.001);if(n.isOrthographicCamera){let{left:_,top:m,width:f,height:M}=this.dom.getBoundingClientRect();if(!f||!M)return;let E=ce.clamp(n.zoom/e,Math.max(1e-6,Math.min(n.zoom,s/o)),1e6);if(E===n.zoom)return;let b=new I((2*(t.clientX-_)/f-1)*n.right,(1-2*(t.clientY-m)/M)*n.top,0).multiplyScalar(1/n.zoom-1/E).applyQuaternion(n.quaternion);n.zoom=E,this._set(n.position.clone().add(b),this.target.clone().add(b));return}this._wheelPick||(this._wheelPick={point:this._anchor(t.clientX,t.clientY)},requestAnimationFrame(()=>this._wheelPick=null));let a=n.getWorldDirection(new I),l=this._gestureDepth(this._wheelPick.point,a);if(!Number.isFinite(l))return;let c=Math.min(mh,Math.max(Ef,r)),h=ce.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,p=u&&u.clone().sub(n.position).dot(a)>=c?u:d,g=bf(n.position,d,p,h);this._set(g.position,g.target)}};function tt(i,t,e){let n=document.createElement(i);return t&&(n.className=t),e!==void 0&&(n.textContent=e),n}function Ke(i,t,e){let n=tt("button",i);return n.type="button",n.innerHTML=t,n.title=e,n.setAttribute("aria-label",e),n}function Ds(i){i.preventDefault(),i.stopPropagation()}function Ka(i){Ds(i);let t=i.button===2,e=()=>{window.removeEventListener("pointerup",n,!0),setTimeout(()=>{window.removeEventListener("click",Ds,!0),t&&window.removeEventListener("contextmenu",Ds,!0)})},n=s=>{Ds(s),e()};window.addEventListener("pointerup",n,!0),window.addEventListener("click",Ds,!0),t&&window.addEventListener("contextmenu",Ds,!0)}function Pr(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 pe=i=>``,Rf='',Zt={model:pe(''),views:pe(''),sections:pe(''),clashes:pe(''),bcf:pe(''),timeliner:pe(''),links:pe(''),orbit:pe(''),pan:pe(''),fit:pe(''),projection:pe(Rf),plane:pe(''),box:pe(`${Rf}`),resetSections:pe(''),distance:pe(''),displayMode:pe(''),grids:pe(''),opacity:pe(''),fullscreen:pe(''),close:pe(''),chevron:pe(''),flip:pe(''),remove:pe(''),play:pe(''),pause:pe(''),home:pe('')};var Lr=new I(0,0,1),cn={right:new I(1,0,0),left:new I(-1,0,0),back:new I(0,1,0),front:new I(0,-1,0),top:new I(0,0,1),bottom:new I(0,0,-1)},Gv={right:Lr,left:Lr,back:Lr,front:Lr,top:cn.back,bottom:cn.front},ki=.7,Wv=ce.degToRad(1),Cf=.01,If=96,ja=1.75;function Pf(i){let t=i.split("-"),e=new I;for(let n of t){if(!Object.hasOwn(cn,n))throw new RangeError(`Unknown view cube region: ${i}`);e.add(cn[n])}if(new Set(t).size!==t.length||e.lengthSq()!==t.length)throw new RangeError(`Unknown view cube region: ${i}`);return e.normalize()}function Xv(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 gh(i,t=Wv){let e=i.clone().normalize(),n=Math.cos(t);return Object.keys(cn).find(s=>e.dot(cn[s])>=n)??null}function Lf(i){let t=new I(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(cn[s])));return e.find(s=>t.dot(cn[s])>=n-1e-9)}function _h(i,t){return cn[Lf(t)].clone().multiplyScalar(Math.sin(Cf)).addScaledVector(cn[i],Math.cos(Cf))}function qv(i,t){let e=gh(i);if(!e)return null;let n=e==="top"||e==="bottom";if(t==="left"||t==="right")return(n?_h(e,i):Pf(e)).applyAxisAngle(Lr,t==="right"?Math.PI/2:-Math.PI/2);if(t!=="up"&&t!=="down")throw new RangeError(`Unknown arrow: ${t}`);if(!n)return _h(t==="up"?"top":"bottom",i);let s=cn[Lf(i)];return t==="up"==(e==="top")?s.clone().negate():s.clone()}function Yv(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 tr(e);return r.colorSpace=Ae,r}var Qa=class{constructor(t,e,n){this.controls=n,this.home={position:e.position.clone(),target:n.target.clone()},this.element=tt("div","ioviewer-viewcube"),this.canvas=tt("canvas","ioviewer-viewcube-canvas"),this.canvas.title=st("cube.title"),this.canvas.setAttribute("aria-label",st("cube.title")),this.element.append(this.canvas),this.error=null,this.renderer=this._createRenderer(),this.scene=new Ai,this.camera=new Fn(-ja,ja,ja,-ja,.1,10),this.faces=new Re;let s=getComputedStyle(t).fontFamily;for(let[l,c]of Object.entries(cn)){let h=st(`face.${l}`),d=new xe(new yn(2,2),new en({map:Yv(h,s)})),u=Gv[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 vn(new Li(new dn(2,2,2)),new an({color:"#5b6575"}));this.highlight=new xe(new dn(1,1,1),new en({color:"#2563eb",transparent:!0,opacity:.6})),this.highlight.visible=!1,this.scene.add(this.faces,r,this.highlight),this._raycaster=new Di,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?_h(c,n.camera.position.clone().sub(n.target)):Pf(c))}),this.arrows=["up","down","left","right"].map(l=>{let c=Ke("ioviewer-viewcube-arrow",Zt.chevron,st(`cube.${l}`));return c.dataset.arrow=l,c.addEventListener("click",h=>{h.detail&&c.blur(),this._arrow(l)}),c});let a=Ke("ioviewer-viewcube-home",Zt.home,st("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 As({canvas:this.canvas,context:t,alpha:!0,antialias:!0});return e.setPixelRatio(window.devicePixelRatio),e.setSize(If,If),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)}}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=gh(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 Ht((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?Xv(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(cn[l]),new I),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=qv(n,t);if(!s)return;let r=gh(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 $v=` +#endif`;function xi(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 Fv(i){Object.assign(i.uniforms,this.userData.slotUniforms);let e=xi(i.vertexShader,"#include ",`#include +${Tr}`);e=xi(e,"#include ",`${Ar} +vTint = state.rgb;`),e=xi(e,"#include ","vec3 objectNormal = ioOct( normal.xy );"),e=xi(e,"#include ",Uv),e=xi(e,"#include ","vec3 transformed = slotPosition;"),e=xi(e,"#include ",`#include +${lh}`),i.vertexShader=e;let t=xi(i.fragmentShader,"#include ",`#include +varying vec3 vTint;`);t=xi(t,"#include ","diffuseColor.rgb *= vTint;"),i.fragmentShader=t}function ch(i,e,t=!1){return i.userData.slotUniforms=e,i.onBeforeCompile=Fv,i.index0AttributeName="q",t&&(i.defines={IO_NO_HIDE_BRANCH:""}),i}var fh=["materials","textures","white","wireframe"],Bv=[245,158,11],Ov=[235,235,237],Rr=4294967295,ki=2048,hh=256,zv=16,uh=1024,kv=.1,Vv=8192,Hv=1.4,Za=2**-20,$a=17;function Gv(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 Wv(){this.array=null}function En(i,e,t=!1,n=St){return new n(i,e,t).onUpload(Wv)}var Cr=class extends RangeError{constructor(e,t){super(`${e} drawable instances exceed the limit of ${t}.`),this.name="ModelTooLargeError",this.count=e,this.limit=t}},_f=(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+Za*Math.abs(l)))return!0}return!1}function qv(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],p=l*n[0],g=c*t[1],_=c*n[1],m=h*t[2],f=h*n[2];s[o+a]=Math.min(u,p)+Math.min(g,_)+Math.min(m,f)+d,s[o+a+3]=Math.max(u,p)+Math.max(g,_)+Math.max(m,f)+d}}var Yv=i=>{let e=i.getHex(At);return[e>>16&255,e>>8&255,e&255]},Ir=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);this.root=new Rt,this.elementCount=n.elements.length,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=e.view(s.element).slice(),this._bucketOf=new Uint32Array(r),this._visible=new Uint8Array(r).fill(1),this._layers=new Map,this._layerHides=new Uint8Array(r),this._highlight=new Uint8Array(r),this._highlighted=[],this._tint=new Map,this._boxes=new Float32Array(r*6),this._minPixels=0,this._viewHeight=1,this.visibleCost=0;let c=!!t.noHideBranch;this.slotUniforms={slotInfo:{value:null},slotState:{value:null}},this._buckets=this._createBuckets(n,a,c),this._indexElements();for(let d=0;dthis._shown(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=th(n,this._planes);let{x:r,y:o,z:a}=n.position;this._pickViewPadding=Za*(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 it){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 p=this._pixels[n+u];p<0||(pc.count;for(let u=0;u0?o[6]/m:1/0:o[6];d[p]=f;let M=g.cell&&this._detailUsesInstances,E=M&&!Kd(r,_[0],_[1],_[2],_[3]+g.pickPadding),b=g.slotBase+g.n,v=-1;if(M){let R=this._slotRadius[g.slotBase],L=this._slotRadius[b-1],N=m+_[3],U=Math.abs(o[3])*_[4]+Math.abs(o[4])*_[5]+Math.abs(o[5])*_[6],C=N-U-R,B=N+U-L,z=Math.fround(o[7]?C>0?R*o[6]/C:1/0:R*f),W=Math.fround(o[7]?B>0?L*o[6]/B:1/0:L*f);Ps(W)===Ps(z)&&(v=z)}if(v>=0&&!E){g.detailLow=g.detailHigh=v,g.detailEnd=g.n;let R=this._slotCost[g.slotBase]*g.shown;l[Ps(v)]+=R,u+=R;continue}let S=0,A=1/0,x=-1,T=0;for(let R=g.slotBase;R=0){S++;continue}let D=(z-o[0])*o[3]+(W-o[1])*o[4]+(F-o[2])*o[5]-L;N=o[7]?D>0?o[6]/D:1/0:o[6]}let U=N===1/0?1/0:Math.fround(L*N);M&&(a[R]=U,A=Math.min(A,U),x=Math.max(x,U));let C=this._slotCost[R];l[Ps(U)]+=C,u+=C}if(M){if(S){A=x=v;let R=S*this._slotCost[g.slotBase];l[Ps(v)]+=R,u+=R}g.detailLow=A,g.detailHigh=x,g.detailEnd=T}}return this.visibleCost=u,jd(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 Un().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=F=>{let D=l.get(F);if(!D){let X=a.geometries[F],Z=e.view(X.indices),G=X.uvs?e.view(X.uvs):null;D=gf(Er(e,X),X.q??null,nf(e,X),Z,G),D.drawable=D.indices.length>=3&&D.min.every(Number.isFinite)&&D.max.every(Number.isFinite),l.set(F,D)}return D},h=new Uint8Array(o),d=new Float64Array(o*3),u=new Float32Array(o*3),p=new Uint32Array(o),g=new Float32Array(o),_=new Uint8Array(o),m=new Map,f=this._boxes;for(let F=0;FF-D).map(F=>{let D=m.get(F),X=c(t[D[0]]),Z=this._buckets[this._bucketOf[D[0]]].texture!==null,G=[0,1,2].every(le=>(X.max[le]-X.min[le])/wn<=65535),Q=X.vertices*((G?12:20)+(Z?8:0))+X.indices.length*(X.vertices>65535?4:2);return{k:D.length,bytes:Q,members:D,textured:Z}}),b=s.mergedCap??oh,v=s.minRepeats??zv;if(E.reduce((F,D)=>F+D.k*D.bytes,0)>b){let F=s.cellExtent==null?hf(f,p)*kv:this.visibleBox().getSize(new I).length()*s.cellExtent;for(let D of E)D.k{if(S[D]){for(let X of F.leaves)T.push({shape:F,members:ah(X,g)});return}for(let X of F.members){x[t[X]]++;let Z=this._bucketOf[X]*2+(h[X]===Ls?1:0),G=A.get(Z);G||A.set(Z,G=[]),G.push(X)}});let R=[];for(let F of[...A.keys()].sort((D,X)=>D-X))for(let D of af(u,p,A.get(F),s.chunkVertices??sf))R.push(ah(D,g));let L=[...R,...T.map(F=>F.members)].reduce((F,D)=>F+D.length,0);if(L>r)throw new Cr(L,r);let N=Math.max(1,Math.ceil(L/ki)),U=new Float32Array(ki*N*4);this._state=new Nn(new Uint8Array(ki*N*4),ki,N),this._state.colorSpace=At,this._state.onUpdate=()=>{this._fullPending=!1,this._pendingRanges=0},this._fullPending=!0,this._pendingRanges=0,this._dirty=new Uint32Array(hh),this._dirtyCount=0;let C=new Nn(U,ki,N,sn,Gt);C.needsUpdate=!0,C.onUpdate=()=>C.image.data=null,this.slotUniforms.slotInfo.value=C,this.slotUniforms.slotState.value=this._state,this._stateBytes=ki*N*20,this._slotOf=new Uint32Array(o).fill(Rr),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(uh),this._detailBins=new Float64Array(eh),this._detailBytes=0,this._unitScale=null,this._cutInView=0,this._cutFrame=-1,this._mergedBytes=0,this._instancedBytes=0,this._lineBytes=0;let B={matrices:n,geometryOf:t,mirrored:_,kind:h,origins:d,source:c,textured:!1};this._lineSources=new Map;let z=0;for(let F of R){let D=this._buckets[this._bucketOf[F[0]]];B.textured=D.texture!==null;let X=mf(F,B);for(let Z=0;ZF+D,0);let W=new Map;for(let{shape:F,members:D}of T){let X=D[0],Z=c(t[X]),G=W.get(F);if(!G){let Q=a.geometries[t[X]].bbox;G=this._shape(Z,_[X]===1,F.textured);let le=te=>Math.max(...te.map(Math.abs)),ce=Math.max(le(Z.min),le(Z.max));G.pickExtent=ce,G.pickPadding=Math.max(0,...Z.min.map((te,H)=>Q.min[H]-te),...Z.max.map((te,H)=>te-Q.max[H]))+(Z.q?Za*(le(Z.q.o)+65535*Math.abs(Z.q.s)):0),W.set(F,G)}for(let Q=0;QF+D,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+f),1,!1,Kn);a.setAttribute("slotBase",l),a.setIndex(s.index);let c=vf(this._boxes,t),h=new Ot(new I(c[0],c[1],c[2]),c[3]);a.boundingSphere=h;let d=new ms(a,e.material,0),u=new Float32Array(o*16),p=new Float32Array(o*12),g=0;for(let m=0;mthis._range(_,m,M,d),d.visible=!1,this.root.add(d),_}_chunk(e,t,n,s,r,o){let a=new vs;a.instanceCount=1,a.setAttribute("q",En(s.q,4)),a.setAttribute("normal",En(s.o,2,!0)),s.uv&&a.setAttribute("uv",En(s.uv,2)),a.setAttribute("slotBase",En(new Float32Array([n]),1,!1,Kn)),a.setIndex(En(s.index,1));let l=vf(this._boxes,t);a.boundingSphere=new Ot(new I(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 xt(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,p)=>this._range(h,d,p,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 ms(n.mesh.geometry,n.bucket.wire,0),n.lines.instanceMatrix=n.mesh.instanceMatrix,n.lines.boundingSphere=n.mesh.boundingSphere,n.lines.onBeforeRender=(d,u,p)=>this._range(n,d,p,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=qa(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 p=0;pthis._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]&&!Xv(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&&(ih(n,this._viewHeight,this._frameView),this._frameViewAt=o);let a=this._frameView,l=xf(a,e.sphere),c=a[7]?l>0?this._minPixels*l/a[6]:0:this._minPixels/a[6];r=Math.min(r,df(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]=ff(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 xs({side:It}),this.slotUniforms,n),wire:ch(new xs({side:It,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 kt(s),t.colorSpace=At,t.wrapS=t.wrapT=as,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}_colorOf(e){return this._highlight[e]?Bv:this._tint.get(e)??(this._mode==="white"?Ov:this._buckets[this._bucketOf[e]].bytes)}_applyColor(e){let t=this._slotOf[e];t!==Rr&&(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===Rr)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._dirtyCounthh)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(!_f(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 xf(i,e){return(e[0]-i[0])*i[3]+(e[1]-i[1])*i[4]+(e[2]-i[2])*i[5]-e[3]}function vf(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 ph=["en","ru","es","de","fr","pt","it","ja","ko","zh-Hans","zh-Hant"];function Ds(i){if(!(typeof i!="string"||!i))try{let e=new Intl.Locale(i),t=e.language==="zh"?`zh-${e.maximize().script}`:e.language;return ph.includes(t)?t:void 0}catch(e){if(!(e instanceof RangeError))throw e;return}}function yf(i=[]){return i.map(Ds).find(Boolean)??"en"}function bf(i){let e=new Intl.DisplayNames(i,{type:"language"}).of(i),t=new Option(e,i);return t.lang=i,t}function Mf(i){try{return globalThis.localStorage?.getItem(i)}catch(e){if(e.name!=="SecurityError")throw e;return null}}function Sf(i,e){try{globalThis.localStorage?.setItem(i,e)}catch(t){if(!["SecurityError","QuotaExceededError"].includes(t.name))throw t}}var wf={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 $v={...wf,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",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.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.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.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","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",elementGroup:"Element",id:"Id",category:"Category",type:"Type",level:"Level",sourceId:"Source ID",link:"Link",panels:"Panels","panel.model":"Model","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.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.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","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"}},Ef="ioviewer-language",Tf=globalThis.parent&&globalThis.parent!==globalThis&&Ds(new URLSearchParams(location.hash.slice(1)).get("ioextendLang")),mh=new URLSearchParams(globalThis.location?.search).get("lang"),Af=mh==="auto"?mh:Ds(mh)??Mf(Ef),vi=Tf||Ds(Af)||yf(globalThis.navigator?.languages?.length?navigator.languages:[globalThis.navigator?.language]),Pr=new Intl.NumberFormat(vi).format;function se(i,e=vi,t){let n=$v[e]?.[i];if(n===void 0)throw new Error(`Missing UI string '${i}'.`);return t?n.replace(/\{(\w+)\}/g,(s,r)=>t[r]):n}function Rf(){if(document.documentElement.lang=vi,document.querySelector("canvas").setAttribute("aria-label",se("model3d")),Tf)return;let i=document.createElement("select");i.id="ioviewer-language",i.className="ioviewer-floating",i.setAttribute("aria-label",se("language")),i.append(new Option(se("auto"),"auto"),...ph.map(bf)),i.value=Ds(Af)??"auto",i.addEventListener("change",()=>{Sf(Ef,i.value);let e=new URL(location.href);e.searchParams.set("lang",i.value),location.replace(e)}),document.querySelector("#ioviewer-ui").append(i)}var Cf=new I(0,0,1),Ja=Math.PI/2-.01;function Pf(i,e,t=4){return Math.hypot(e.x-i.x,e.y-i.y)<=t}function Lf(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 Ct().setFromAxisAngle(Cf,-n*r));let c=a.clone().sub(o).normalize(),h=c.clone().cross(Cf);if(h.lengthSq()>1e-12){let d=Math.asin(ct.clamp(c.z,-1,1)),u=ct.clamp(s*r,d-Ja,d+Ja);l(new Ct().setFromAxisAngle(h.normalize(),-u))}return{position:o.add(t),target:a.add(t)}}function Df(i,e,t,n){let s=r=>r.clone().sub(t).multiplyScalar(n).add(t);return{position:s(i),target:s(e)}}var Zv=.85,Jv=100/3;function Nf(i,e,t){let n=i*(e===1?Jv:e===2?t:1);return ct.clamp(Zv**(-n/100),.5,2)}var gh=(i,e)=>e>=i?"window":"crossing";function Uf(i,e,t){let n=If(i.position,i.target),s=If(e.position,e.target),r=n.azimuth??s.azimuth??0,o=s.azimuth??r,a=ct.euclideanModulo(o-r+Math.PI,2*Math.PI)-Math.PI,l=(_,m)=>_+(m-_)*t,c=r+a*t,h=ct.clamp(l(n.elevation,s.elevation),-Ja,Ja),d=l(n.distance,s.distance),u=i.target.clone().lerp(e.target,t),p=Math.cos(h)*d;return{position:u.clone().add(new I(p*Math.cos(c),p*Math.sin(c),Math.sin(h)*d)),target:u}}function Ff(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 Ct().setFromUnitVectors(s,r),c=t.clone().applyQuaternion(l),h=new I().setFromMatrixColumn(new ke().lookAt(e.position,e.target,n),1),d=r.dot(new I().crossVectors(c,h)),u=Math.atan2(Math.abs(d)<1e-9?0:d,c.dot(h)),p=new Ct;return g=>{p.identity().slerp(l,g);let _=s.clone().applyQuaternion(p),m=i.target.clone().lerp(e.target,g),f=_.clone().multiplyScalar(ct.lerp(o,a,g)).add(m),M=t.clone().applyQuaternion(p).applyAxisAngle(_,u*g);return{position:f,target:m,up:M}}}function If(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(ct.clamp(t.z/n,-1,1)):0,azimuth:s>1e-9*Math.max(n,1e-12)?Math.atan2(t.y,t.x):null}}var Kv=.005,jv=new I(1,-1,.8).normalize(),xh=.01,Bf=1e-6,Qv=64,Of=1.05,ey=5e3,_h=(i,e)=>new CustomEvent(i,{detail:e});function zf({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 it(new I(...i.min),new I(...i.max));if(n.isEmpty())return!0;let s=new I;for(let r of e??[])for(let o of Mr(r)){if(!t(o))return!0;n.expandByPoint(s.fromArray(o))}return n.getSize(s).length()*Of>xh*ey}var Ka=class extends EventTarget{constructor(e,t,{pick:n=()=>null,visibleBox:s=()=>new it}={}){super(),this.dom=t,this.pick=n,this.visibleBox=s,this.target=new I,this.leftButtonMode="orbit",this._perspective=e,this._defaultFov=e.fov,this._orthographic=new Fn(-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(ct.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 I(0,0,-1).applyQuaternion(e.quaternion);e.far=Math.max(1e-6,(r.length()+s.radius)*Of);let a=r.dot(o)-s.radius;e.near=Math.max(a*.95,Math.min(xh,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 it;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),s=Math.max(n.radius,.001),r=ct.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(jv);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))}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 I(...e),a=new I(...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(ct.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?Ff(o,a,new I(0,1,0).applyQuaternion(this.camera.quaternion),this.camera.up):u=>Uf(o,a,u),h=performance.now(),d=u=>{let p=Math.min((u-h)/r,1),g=p*p*(3-2*p),_=c(g);this.camera.isOrthographicCamera&&(this.camera.zoom=ct.lerp(l,n,g)),this._set(_.position,_.target,_.up),this._animation=p<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.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(Bf,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&&Pf(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=Lf(this.camera.position,this.target,t.pivot,s,r,Kv);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 I))}let r=n.isPerspectiveCamera?2*this._drag.depth*Math.tan(ct.degToRad(n.fov/2))/(s*n.zoom):(n.top-n.bottom)/n.zoom/s,o=new I(1,0,0).applyQuaternion(n.quaternion),a=new I(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=gh(t.down.x,n.x);this.dispatchEvent(_h("boxselect",{rect:s,mode:r,ctrl:e.ctrlKey,shift:e.shiftKey}))}else!t.moved&&t.button===0?this.dispatchEvent(_h("click",{x:n.x,y:n.y,button:0,ctrl:e.ctrlKey,shift:e.shiftKey})):!t.moved&&t.button===2&&this.dispatchEvent(_h("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:gh(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=Nf(e.deltaY,e.deltaMode,this.dom.clientHeight),n=this.camera,s=n.position.distanceTo(this.target),r=this._visibleBounds()?.sphere.radius??0,o=Qv*Math.max(r,.001);if(n.isOrthographicCamera){let{left:_,top:m,width:f,height:M}=this.dom.getBoundingClientRect();if(!f||!M)return;let E=ct.clamp(n.zoom/t,Math.max(1e-6,Math.min(n.zoom,s/o)),1e6);if(E===n.zoom)return;let b=new I((2*(e.clientX-_)/f-1)*n.right,(1-2*(e.clientY-m)/M)*n.top,0).multiplyScalar(1/n.zoom-1/E).applyQuaternion(n.quaternion);n.zoom=E,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 I),l=this._gestureDepth(this._wheelPick.point,a);if(!Number.isFinite(l))return;let c=Math.min(xh,Math.max(Bf,r)),h=ct.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,p=u&&u.clone().sub(n.position).dot(a)>=c?u:d,g=Df(n.position,d,p,h);this._set(g.position,g.target)}};function ee(i,e,t){let n=document.createElement(i);return e&&(n.className=e),t!==void 0&&(n.textContent=t),n}function Kt(i,e,t){let n=ee("button",i);return n.type="button",n.innerHTML=e,n.title=t,n.setAttribute("aria-label",t),n}function Ns(i){i.preventDefault(),i.stopPropagation()}function ja(i){Ns(i);let e=i.button===2,t=()=>{window.removeEventListener("pointerup",n,!0),setTimeout(()=>{window.removeEventListener("click",Ns,!0),e&&window.removeEventListener("contextmenu",Ns,!0)})},n=s=>{Ns(s),t()};window.addEventListener("pointerup",n,!0),window.addEventListener("click",Ns,!0),e&&window.addEventListener("contextmenu",Ns,!0)}function Lr(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 pt=i=>``,kf='',Ze={model:pt(''),views:pt(''),sections:pt(''),clashes:pt(''),bcf:pt(''),timeliner:pt(''),links:pt(''),orbit:pt(''),pan:pt(''),fit:pt(''),projection:pt(kf),plane:pt(''),box:pt(`${kf}`),resetSections:pt(''),distance:pt(''),displayMode:pt(''),grids:pt(''),opacity:pt(''),fullscreen:pt(''),close:pt(''),chevron:pt(''),flip:pt(''),remove:pt(''),play:pt(''),pause:pt(''),home:pt('')};var Dr=new I(0,0,1),cn={right:new I(1,0,0),left:new I(-1,0,0),back:new I(0,1,0),front:new I(0,-1,0),top:new I(0,0,1),bottom:new I(0,0,-1)},ty={right:Dr,left:Dr,back:Dr,front:Dr,top:cn.back,bottom:cn.front},Vi=.7,ny=ct.degToRad(1),Vf=.01,Hf=96,Qa=1.75;function Gf(i){let e=i.split("-"),t=new I;for(let n of e){if(!Object.hasOwn(cn,n))throw new RangeError(`Unknown view cube region: ${i}`);t.add(cn[n])}if(new Set(e).size!==e.length||t.lengthSq()!==e.length)throw new RangeError(`Unknown view cube region: ${i}`);return t.normalize()}function iy(i){let e=[];return Math.abs(i.z)>=Vi&&e.push(i.z>0?"top":"bottom"),Math.abs(i.y)>=Vi&&e.push(i.y>0?"back":"front"),Math.abs(i.x)>=Vi&&e.push(i.x>0?"right":"left"),e.join("-")}function vh(i,e=ny){let t=i.clone().normalize(),n=Math.cos(e);return Object.keys(cn).find(s=>t.dot(cn[s])>=n)??null}function Wf(i){let e=new I(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(cn[s])));return t.find(s=>e.dot(cn[s])>=n-1e-9)}function yh(i,e){return cn[Wf(e)].clone().multiplyScalar(Math.sin(Vf)).addScaledVector(cn[i],Math.cos(Vf))}function sy(i,e){let t=vh(i);if(!t)return null;let n=t==="top"||t==="bottom";if(e==="left"||e==="right")return(n?yh(t,i):Gf(t)).applyAxisAngle(Dr,e==="right"?Math.PI/2:-Math.PI/2);if(e!=="up"&&e!=="down")throw new RangeError(`Unknown arrow: ${e}`);if(!n)return yh(e==="up"?"top":"bottom",i);let s=cn[Wf(i)];return e==="up"==(t==="top")?s.clone().negate():s.clone()}function ry(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 tr(t);return r.colorSpace=At,r}var el=class{constructor(e,t,n){this.controls=n,this.home={position:t.position.clone(),target:n.target.clone()},this.element=ee("div","ioviewer-viewcube"),this.canvas=ee("canvas","ioviewer-viewcube-canvas"),this.canvas.title=se("cube.title"),this.canvas.setAttribute("aria-label",se("cube.title")),this.element.append(this.canvas),this.error=null,this.renderer=this._createRenderer(),this.scene=new Ri,this.camera=new Fn(-Qa,Qa,Qa,-Qa,.1,10),this.faces=new Rt;let s=getComputedStyle(e).fontFamily;for(let[l,c]of Object.entries(cn)){let h=se(`face.${l}`),d=new xt(new yn(2,2),new tn({map:ry(h,s)})),u=ty[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 vn(new Di(new dn(2,2,2)),new an({color:"#5b6575"}));this.highlight=new xt(new dn(1,1,1),new tn({color:"#2563eb",transparent:!0,opacity:.6})),this.highlight.visible=!1,this.scene.add(this.faces,r,this.highlight),this._raycaster=new Ni,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?yh(c,n.camera.position.clone().sub(n.target)):Gf(c))}),this.arrows=["up","down","left","right"].map(l=>{let c=Kt("ioviewer-viewcube-arrow",Ze.chevron,se(`cube.${l}`));return c.dataset.arrow=l,c.addEventListener("click",h=>{h.detail&&c.blur(),this._arrow(l)}),c});let a=Kt("ioviewer-viewcube-home",Ze.home,se("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 Rs({canvas:this.canvas,context:e,alpha:!0,antialias:!0});return t.setPixelRatio(window.devicePixelRatio),t.setSize(Hf,Hf),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)}}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 Ve((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?iy(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(cn[l]),new I),n=a=>a===0?[-Vi,Vi]:a>0?[Vi,1.02]:[-1.02,-Vi],[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=sy(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 oy=` #include -${Er} +${Tr} #include #include varying vec3 vPos; @@ -4263,7 +4263,7 @@ varying vec2 vSlot; varying float vViewDepth; #endif void main() { - ${Tr} + ${Ar} vec3 transformed = slotPosition; #include #include @@ -4278,7 +4278,7 @@ void main() { vPos = ( modelMatrix * wp ).xyz; vSlot = vec2( float( slot >> 12 ), float( slot & 4095 ) ); if ( state.a < 0.5 ) gl_Position = vec4( 0.0, 0.0, 2.0, 1.0 ); -}`,Zv=` +}`,ay=` #include #include #include @@ -4300,27 +4300,27 @@ void main() { #else gl_FragColor = vec4( vPos, id ); #endif -}`,Df=i=>i&&{element:i.element,point:i.point.clone()};function xh(i,t){let e=new He({vertexShader:$v,fragmentShader:Zv,uniforms:i,defines:t?{[t]:""}:{},side:Ie,clipping:!0});return e.index0AttributeName="q",e}var tl=class{constructor(t,e,n,s={}){this.renderer=t,this.scene=e,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",o=>{o.detail.kind!=="appearance"&&(this._last=this._lastTile=null)});let r=e.slotUniforms;this._float=s.pickFloat!==!1&&t.extensions.has("EXT_color_buffer_float"),this._float?(this._material=xh(r,null),this._target=new Fe(1,1,{type:Ge}),this._pixel=new Float32Array(4)):(this._material=xh(r,"IO_PICK_RGBA8"),this._depthMaterial=xh(r,"IO_PICK_DEPTH"),this._target=new Fe(1,1),this._pixel=new Uint8Array(4))}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 Df(l.hit);let c=this._pick(s,r,n);return this._last={camera:a,key:o.slice(),hit:c},Df(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[S]))return c.tile;let h=n*2+1;(!this._measure||this._measure.target.width!==h)&&(this._measure?.target.dispose(),this._measure={target:new Fe(h,h,this._float?{type:Ge}:{}),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:p}=this._measure,g=r-n,_=o-n;this._render(this._material,g,_,s,d,u);let m=(v,S)=>{let A=Math.floor(v)-g,x=Math.floor(S)-_;return A>=0&&A=0&&x(this._float?Math.round(u[v*4+3]):f.getUint32(v*4,!0))-1,E=M(m(r,o)),b=null;if(E>=0){p&&this._render(this._depthMaterial,g,_,s,d,p);let v=p&&new DataView(p.buffer),S=l.matrixWorldInverse.elements.slice(),A=U=>{if(v)return v.getFloat32(U*4,!0);let C=U*4;return-(S[2]*u[C]+S[6]*u[C+1]+S[10]*u[C+2]+S[14])},x=m(r,o),T=this._float?new I().fromArray(u,x*4):this._depthPoint(r,o,s,A(x)),R=new Set([E]),L=this.scene.slotElement(E);if(L>=0)for(let U=0;U=0&&!R.has(C)&&this.scene.slotElement(C)===L&&R.add(C)}let N=l.isPerspectiveCamera;b={rect:s,point:T,element:L,slots:R,depthAt(U,C,B){let z=m(U,C),W=z<0?-1:M(z);if(W<0)return 1/0;if(W!==B)return A(z);let F=G=>N?1/A(G):A(G),D=F(z);function X(G,Q,lt){let ct=Math.sign(lt),et=m(U+ct*G,C+ct*Q);if(et>=0&&M(et)===W)return(F(et)-D)*Math.abs(lt);let V=m(U-ct*G,C-ct*Q);return V>=0&&M(V)===W?(D-F(V))*Math.abs(lt):0}let Z=D+X(1,0,U-Math.floor(U)-.5)+X(0,1,C-Math.floor(C)-.5);return Z>0?N?1/Z:Z:A(z)}}}return this._lastTile={camera:l,key:a.slice(),radius:n,tile:b},this._last={camera:l,key:this._lastTile.key,hit:b},b}_pick(t,e,n){let s=this._render(this._material,t,e,n),r=(this._float?Math.round(s[3]):new Uint32Array(s.buffer)[0])-1;if(r<0)return null;let o=this.scene.slotElement(r);if(this._float)return{element:o,point:new I(s[0],s[1],s[2])};let a=this._render(this._depthMaterial,t,e,n);return{element:o,point:this._depthPoint(t,e,n,new DataView(a.buffer).getFloat32(0,!0))}}_depthPoint(t,e,n,s){let r=this.camera,o=new I((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 Ft),alpha:a.getClearAlpha()},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{a.setRenderTarget(r),a.setClearColor(0,0),this.scene.withMaterial(t,()=>a.render(this.scene.root,l),{pickCamera:l}),a.readRenderTargetPixels(r,0,0,r.width,r.height,o)}finally{a.setRenderTarget(c.target),a.setClearColor(c.color,c.alpha),l.clearViewOffset()}return o}};var el=33.333333333333336,Jv=200,Nf=1e6,Kv=20,nl=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,Jv)))}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>el*1.1?(this._refine=!1,this._fastFrames=0):this._refine||(this._fastFrames=this.minPixels>0&&t=Kv),this._cost>el*1.1?this.budget=Math.max(this.budget*.9,Nf):this._cost0&&(this.budget=Math.max(Math.min(this.budget*1.05,this.scene.visibleCost),Nf))}_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 Tn,Ns,il,sl=class extends EventTarget{constructor(){super(...arguments);bl(this,Ns);bl(this,Tn,new Set)}get size(){return ni(this,Tn).size}has(e){return ni(this,Tn).has(e)}values(){return ni(this,Tn).values()}set(e){Xh(this,Tn,new Set(e)),kr(this,Ns,il).call(this)}toggle(e){ni(this,Tn).delete(e)||ni(this,Tn).add(e),kr(this,Ns,il).call(this)}clear(){ni(this,Tn).size!==0&&(ni(this,Tn).clear(),kr(this,Ns,il).call(this))}};Tn=new WeakMap,Ns=new WeakSet,il=function(){this.dispatchEvent(new Event("change"))};function Uf(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 Ff(i,t,e){let n=new kt().multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse).elements,{left:s,top:r,width:o,height:a}=e,l=new ie,c=[];for(let h=0;hn===l?r(l):o(l));let m=[...t.children].find(v=>Bf.indexOf(v.dataset.panel)>g);t.insertBefore(_,m??null);let f=tt("section","ioviewer-side-panel ioviewer-floating");f.dataset.panel=l,f.hidden=!0,f.setAttribute("aria-label",h);let M=Ke("ioviewer-panel-close",Zt.close,st("close"));M.addEventListener("click",()=>r(l));let E=tt("header","ioviewer-panel-header");E.append(tt("h2","",h),M);let b=tt("div","ioviewer-panel-body");f.append(E,b),i.append(f),e.set(l,{button:_,panel:f,onClose:p}),d(b)}return{rail:t,openPanel:o,closePanel:r,registerPanel:a}}var zf=[{id:"navigation",items:["orbit","pan","fit","projection"]},{id:"sections",items:["plane","box","resetSections"]},{id:"measure",items:["distance"]},{id:"display",items:["displayMode","grids","opacity"]},{id:"view",items:["fullscreen"]}];function kf(i,t){let e=tt("div","ioviewer-toolbar ioviewer-floating");e.setAttribute("role","toolbar");let n=new Map;for(let a of t){let l=tt("div","ioviewer-toolbar-group");l.setAttribute("role","group"),l.setAttribute("aria-label",st(`group.${a.id}`));let c=tt("div","ioviewer-toolbar-row");for(let h of a.items){let d=Ke("ioviewer-tool",Zt[h],st(`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,tt("div","ioviewer-toolbar-label",st(`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 jv="input, textarea, select, [contenteditable]";function vh(i){return i.key==="ContextMenu"||i.code==="ContextMenu"||i.shiftKey&&(i.key==="F10"||i.code==="F10")}function Hf(i){if(i.ctrlKey||i.altKey||i.metaKey||i.repeat||i.target?.closest?.(jv))return null;if(vh(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 Vf(i,t,e,n,s){let r=tt("details","ioviewer-tree-filters");r.hidden=i.length===0;let o=tt("summary","",st("filters.title")),a=tt("div","ioviewer-filter-fields"),l=new Map(t.map(({id:v,name:S})=>[v,S||`#${v}`])),c=v=>v.modelId??t[0]?.id??null,h=v=>v.levelId??(v.level||null),d=v=>v.category??"",u=[{name:st("filters.model"),key:c,labels:new Map},{name:st("level"),key:h,labels:new Map},{name:st("category"),key:d,labels:new Map}],[p,g,_]=u,m=tt("div","ioviewer-filter-actions"),f=tt("button","ioviewer-text-button",st("filters.clear"));f.type="button",f.addEventListener("click",()=>{for(let v of u)v.select&&(v.select.selectedIndex=0);e.value="",n(),e.focus()});let M=tt("button","ioviewer-text-button",st("filters.isolate"));M.type="button",M.addEventListener("click",s),m.append(f,M),r.append(o,a,m);function E(){if(r.open){r.removeEventListener("toggle",E);for(let v of i){let S=c(v),A=l.get(S)??(S==null?"":`#${S}`);S!=null&&p.labels.set(S,A);let x=h(v);if(!g.labels.has(x)){let R=v.level||(x==null?st("filters.noLevel"):`#${x}`);g.labels.set(x,x!=null&&t.length>1&&A?`${R} \xB7 ${A}`:R)}let T=d(v);_.labels.set(T,T||st("noCategory"))}for(let v of u){if(!v.labels.size)continue;let S=new Map;for(let R of v.labels.values())S.set(R,(S.get(R)??0)+1);let A=[...v.labels].map(([R,L])=>[R,S.get(L)>1?`${L} (#${R})`:L]);A.sort((R,L)=>R[1].localeCompare(L[1])),v.keys=A.map(([R])=>R);let x=v.select=tt("select");x.append(new Option(st("filters.all"),""));for(let[R,[,L]]of A.entries())x.append(new Option(L,String(R+1)));x.addEventListener("change",n);let T=tt("label","ioviewer-filter-field");T.append(tt("span","",v.name),x),a.append(T)}}}r.addEventListener("toggle",E);function b(){return u.filter(v=>v.select?.selectedIndex>0)}return{element:r,predicate(){let v=b().map(({select:S,keys:A,key:x})=>({key:x,value:A[S.selectedIndex-1]}));return v.length?S=>v.every(({key:A,value:x})=>A(S)===x):null},update(v,S){let A=b().length;o.textContent=A?`${st("filters.title")} (${A})`:st("filters.title"),f.disabled=!A&&!v,M.disabled=!S}}}var vi=24,Qv=8;function yh(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 ty(i){let t=null;return e=>{let n=e.trim().toLowerCase();t??(t=i.map(r=>`${r.name??""} +}`,Xf=i=>i&&{element:i.element,point:i.point.clone()};function bh(i,e){let t=new Vt({vertexShader:oy,fragmentShader:ay,uniforms:i,defines:e?{[e]:""}:{},side:It,clipping:!0});return t.index0AttributeName="q",t}var tl=class{constructor(e,t,n,s={}){this.renderer=e,this.scene=t,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",o=>{o.detail.kind!=="appearance"&&(this._last=this._lastTile=null)});let r=t.slotUniforms;this._float=s.pickFloat!==!1&&e.extensions.has("EXT_color_buffer_float"),this._float?(this._material=bh(r,null),this._target=new Ft(1,1,{type:Gt}),this._pixel=new Float32Array(4)):(this._material=bh(r,"IO_PICK_RGBA8"),this._depthMaterial=bh(r,"IO_PICK_DEPTH"),this._target=new Ft(1,1),this._pixel=new Uint8Array(4))}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 Xf(l.hit);let c=this._pick(s,r,n);return this._last={camera:a,key:o.slice(),hit:c},Xf(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[S]))return c.tile;let h=n*2+1;(!this._measure||this._measure.target.width!==h)&&(this._measure?.target.dispose(),this._measure={target:new Ft(h,h,this._float?{type:Gt}:{}),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:p}=this._measure,g=r-n,_=o-n;this._render(this._material,g,_,s,d,u);let m=(v,S)=>{let A=Math.floor(v)-g,x=Math.floor(S)-_;return A>=0&&A=0&&x(this._float?Math.round(u[v*4+3]):f.getUint32(v*4,!0))-1,E=M(m(r,o)),b=null;if(E>=0){p&&this._render(this._depthMaterial,g,_,s,d,p);let v=p&&new DataView(p.buffer),S=l.matrixWorldInverse.elements.slice(),A=U=>{if(v)return v.getFloat32(U*4,!0);let C=U*4;return-(S[2]*u[C]+S[6]*u[C+1]+S[10]*u[C+2]+S[14])},x=m(r,o),T=this._float?new I().fromArray(u,x*4):this._depthPoint(r,o,s,A(x)),R=new Set([E]),L=this.scene.slotElement(E);if(L>=0)for(let U=0;U=0&&!R.has(C)&&this.scene.slotElement(C)===L&&R.add(C)}let N=l.isPerspectiveCamera;b={rect:s,point:T,element:L,slots:R,depthAt(U,C,B){let z=m(U,C),W=z<0?-1:M(z);if(W<0)return 1/0;if(W!==B)return A(z);let F=G=>N?1/A(G):A(G),D=F(z);function X(G,Q,le){let ce=Math.sign(le),te=m(U+ce*G,C+ce*Q);if(te>=0&&M(te)===W)return(F(te)-D)*Math.abs(le);let H=m(U-ce*G,C-ce*Q);return H>=0&&M(H)===W?(D-F(H))*Math.abs(le):0}let Z=D+X(1,0,U-Math.floor(U)-.5)+X(0,1,C-Math.floor(C)-.5);return Z>0?N?1/Z:Z:A(z)}}}return this._lastTile={camera:l,key:a.slice(),radius:n,tile:b},this._last={camera:l,key:this._lastTile.key,hit:b},b}_pick(e,t,n){let s=this._render(this._material,e,t,n),r=(this._float?Math.round(s[3]):new Uint32Array(s.buffer)[0])-1;if(r<0)return null;let o=this.scene.slotElement(r);if(this._float)return{element:o,point:new I(s[0],s[1],s[2])};let a=this._render(this._depthMaterial,e,t,n);return{element:o,point:this._depthPoint(e,t,n,new DataView(a.buffer).getFloat32(0,!0))}}_depthPoint(e,t,n,s){let r=this.camera,o=new I((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 Fe),alpha:a.getClearAlpha()},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{a.setRenderTarget(r),a.setClearColor(0,0),this.scene.withMaterial(e,()=>a.render(this.scene.root,l),{pickCamera:l}),a.readRenderTargetPixels(r,0,0,r.width,r.height,o)}finally{a.setRenderTarget(c.target),a.setClearColor(c.color,c.alpha),l.clearViewOffset()}return o}};var nl=33.333333333333336,ly=200,qf=1e6,cy=20,il=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,ly)))}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>nl*1.1?(this._refine=!1,this._fastFrames=0):this._refine||(this._fastFrames=this.minPixels>0&&e=cy),this._cost>nl*1.1?this.budget=Math.max(this.budget*.9,qf):this._cost0&&(this.budget=Math.max(Math.min(this.budget*1.05,this.scene.visibleCost),qf))}_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 Tn,Us,sl,rl=class extends EventTarget{constructor(){super(...arguments);Ml(this,Us);Ml(this,Tn,new Set)}get size(){return ni(this,Tn).size}has(t){return ni(this,Tn).has(t)}values(){return ni(this,Tn).values()}set(t){$h(this,Tn,new Set(t)),Vr(this,Us,sl).call(this)}toggle(t){ni(this,Tn).delete(t)||ni(this,Tn).add(t),Vr(this,Us,sl).call(this)}clear(){ni(this,Tn).size!==0&&(ni(this,Tn).clear(),Vr(this,Us,sl).call(this))}};Tn=new WeakMap,Us=new WeakSet,sl=function(){this.dispatchEvent(new Event("change"))};function Yf(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 $f(i,e,t){let n=new ke().multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse).elements,{left:s,top:r,width:o,height:a}=t,l=new it,c=[];for(let h=0;hn===l?r(l):o(l));let m=[...e.children].find(v=>Zf.indexOf(v.dataset.panel)>g);e.insertBefore(_,m??null);let f=ee("section","ioviewer-side-panel ioviewer-floating");f.dataset.panel=l,f.hidden=!0,f.setAttribute("aria-label",h);let M=Kt("ioviewer-panel-close",Ze.close,se("close"));M.addEventListener("click",()=>r(l));let E=ee("header","ioviewer-panel-header");E.append(ee("h2","",h),M);let b=ee("div","ioviewer-panel-body");f.append(E,b),i.append(f),t.set(l,{button:_,panel:f,onClose:p}),d(b)}return{rail:e,openPanel:o,closePanel:r,registerPanel:a}}var Kf=[{id:"navigation",items:["orbit","pan","fit","projection"]},{id:"sections",items:["plane","box","resetSections"]},{id:"measure",items:["distance"]},{id:"display",items:["displayMode","grids","opacity"]},{id:"view",items:["fullscreen"]}];function jf(i,e){let t=ee("div","ioviewer-toolbar ioviewer-floating");t.setAttribute("role","toolbar");let n=new Map;for(let a of e){let l=ee("div","ioviewer-toolbar-group");l.setAttribute("role","group"),l.setAttribute("aria-label",se(`group.${a.id}`));let c=ee("div","ioviewer-toolbar-row");for(let h of a.items){let d=Kt("ioviewer-tool",Ze[h],se(`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,ee("div","ioviewer-toolbar-label",se(`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 hy="input, textarea, select, [contenteditable]";function Mh(i){return i.key==="ContextMenu"||i.code==="ContextMenu"||i.shiftKey&&(i.key==="F10"||i.code==="F10")}function Qf(i){if(i.ctrlKey||i.altKey||i.metaKey||i.repeat||i.target?.closest?.(hy))return null;if(Mh(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 ep(i,e,t,n,s){let r=ee("details","ioviewer-tree-filters");r.hidden=i.length===0;let o=ee("summary","",se("filters.title")),a=ee("div","ioviewer-filter-fields"),l=new Map(e.map(({id:v,name:S})=>[v,S||`#${v}`])),c=v=>v.modelId??e[0]?.id??null,h=v=>v.levelId??(v.level||null),d=v=>v.category??"",u=[{name:se("filters.model"),key:c,labels:new Map},{name:se("level"),key:h,labels:new Map},{name:se("category"),key:d,labels:new Map}],[p,g,_]=u,m=ee("div","ioviewer-filter-actions"),f=ee("button","ioviewer-text-button",se("filters.clear"));f.type="button",f.addEventListener("click",()=>{for(let v of u)v.select&&(v.select.selectedIndex=0);t.value="",n(),t.focus()});let M=ee("button","ioviewer-text-button",se("filters.isolate"));M.type="button",M.addEventListener("click",s),m.append(f,M),r.append(o,a,m);function E(){if(r.open){r.removeEventListener("toggle",E);for(let v of i){let S=c(v),A=l.get(S)??(S==null?"":`#${S}`);S!=null&&p.labels.set(S,A);let x=h(v);if(!g.labels.has(x)){let R=v.level||(x==null?se("filters.noLevel"):`#${x}`);g.labels.set(x,x!=null&&e.length>1&&A?`${R} \xB7 ${A}`:R)}let T=d(v);_.labels.set(T,T||se("noCategory"))}for(let v of u){if(!v.labels.size)continue;let S=new Map;for(let R of v.labels.values())S.set(R,(S.get(R)??0)+1);let A=[...v.labels].map(([R,L])=>[R,S.get(L)>1?`${L} (#${R})`:L]);A.sort((R,L)=>R[1].localeCompare(L[1])),v.keys=A.map(([R])=>R);let x=v.select=ee("select");x.append(new Option(se("filters.all"),""));for(let[R,[,L]]of A.entries())x.append(new Option(L,String(R+1)));x.addEventListener("change",n);let T=ee("label","ioviewer-filter-field");T.append(ee("span","",v.name),x),a.append(T)}}}r.addEventListener("toggle",E);function b(){return u.filter(v=>v.select?.selectedIndex>0)}return{element:r,predicate(){let v=b().map(({select:S,keys:A,key:x})=>({key:x,value:A[S.selectedIndex-1]}));return v.length?S=>v.every(({key:A,value:x})=>A(S)===x):null},update(v,S){let A=b().length;o.textContent=A?`${se("filters.title")} (${A})`:se("filters.title"),f.disabled=!A&&!v,M.disabled=!S}}}var yi=24,uy=8;function Sh(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 dy(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 Gf(i,{elements:t,models:e,selection:n,scene:s,zoomToElement:r,openContextMenu:o}){let a=ey(t),l=new Int32Array(t.length);a.forEach((G,Q)=>G.indices.forEach(lt=>l[lt]=Q));let c=new Uint8Array(a.length),h=new Int32Array(a.length),d=new Uint32Array(a.length),u=ty(t),p="",g=!1,_=new Int32Array(0),m=0,f=-1,M=null,E=!1,b=tt("input","ioviewer-tree-search");b.type="search",b.placeholder=st("searchPlaceholder"),b.setAttribute("aria-label",st("searchPlaceholder"));let v=tt("div","ioviewer-tree");v.setAttribute("role","tree"),v.setAttribute("aria-label",st("panel.model")),v.setAttribute("aria-multiselectable","true"),v.tabIndex=-1;let S=tt("div","ioviewer-tree-spacer");S.setAttribute("role","presentation"),v.append(S);let A=tt("div","ioviewer-tree-empty",st("noMatches")),x=Vf(t,e,b,D,()=>s.isolate(_));i.append(x.element,b,v,A);function T(){let G=_[m],Q=x.predicate();if(g=!!(p||Q),g){let ct=p?u(p):t.keys();if(Q){let et=[];for(let V of ct)Q(t[V])&&et.push(V);_=Int32Array.from(et)}else _=Int32Array.from(ct)}else{let ct=a.length;a.forEach((V,j)=>c[j]&&(ct+=V.indices.length)),_=new Int32Array(ct);let et=0;a.forEach((V,j)=>{if(h[j]=et,_[et++]=-(j+1),c[j])for(let ut of V.indices)_[et++]=ut})}let lt=_.indexOf(G);m=lt>=0?lt:0,S.style.height=`${_.length*vi}px`,A.hidden=_.length>0||!g,x.update(p,!!s.isolate&&g&&_.some(ct=>s.instancesOf(ct).length>0)),R()}function R(G=v.contains(document.activeElement)){let Q=v.clientHeight;if(Q===0||_.length===0){S.replaceChildren();return}let lt=v.scrollTop,{start:ct,end:et}=yh(lt,vi,Q,_.length,Qv);!G&&(m=et)&&(m=Math.min(_.length-1,Math.floor(lt/vi)));let V=[];m=et&&V.push(L(m)),S.replaceChildren(...V),G&&S.querySelector('[tabindex="0"]')?.focus({preventScroll:!0})}function L(G){let Q=_[G],lt=Q<0?-Q-1:l[Q],ct=Q<0?d[lt]===a[lt].indices.length:n.has(Q),et=tt("div","tree-row");if(et.style.top=`${G*vi}px`,et.style.height=`${vi}px`,et.dataset.row=G,et.tabIndex=G===m?0:-1,et.setAttribute("role","treeitem"),et.classList.toggle("selected",ct),et.setAttribute("aria-selected",String(ct)),Q<0){et.classList.add("tree-category"),et.setAttribute("aria-level","1"),et.setAttribute("aria-posinset",String(lt+1)),et.setAttribute("aria-setsize",String(a.length)),et.setAttribute("aria-expanded",String(!!c[lt]));let V=tt("span","tree-chevron");V.innerHTML=Zt.chevron;let{name:j,indices:ut}=a[lt];et.append(V,tt("span","tree-name",j||st("noCategory")),tt("span","tree-count",Ir(ut.length)))}else{let V=t[Q];et.classList.add("tree-element"),et.setAttribute("aria-level",g?"1":"2"),et.setAttribute("aria-posinset",String(g?G+1:G-h[lt])),et.setAttribute("aria-setsize",String(g?_.length:a[lt].indices.length)),et.classList.toggle("tree-child",!g),et.classList.toggle("tree-hidden",s.isVisible?.(Q)===!1),et.append(tt("span","tree-name",V.name||`#${V.id}`),tt("span","tree-type",V.type??""))}return et}function N(G){let Q=v.clientHeight;if(Q===0){f=G;return}let lt=G*vi;ltv.scrollTop+Q&&(v.scrollTop=lt+vi-Q)}function U(G){m=G,N(G),R(!0)}function C(G){let Q=l[G];!g&&!c[Q]&&(c[Q]=1,T());let lt=_.indexOf(G);lt>=0&&(v.contains(document.activeElement)||(m=lt),N(lt)),R()}function B(G){E=!0;try{n.set(G)}finally{E=!1}}function z(G,Q){let lt=_.indexOf(M);lt<0&&(lt=G,M=_[G]);let ct=_.subarray(Math.min(lt,G),Math.max(lt,G)+1).filter(et=>et>=0);ct.length>0&&B(Q?[...n.values(),...ct]:ct)}function W(G){M=G;let Q=-G-1,lt=G<0?a[Q].indices:[G],ct=G<0?d[Q]===lt.length:n.has(G),et=new Set(n.values());for(let V of lt)ct?et.delete(V):et.add(V);B(et)}function F(G,Q,lt){G>=0&&!n.has(G)&&(M=G,B([G]));let ct=G>=0?G:n.values().next().value??null;o(Q,lt,ct,()=>{let et=_.indexOf(G);et>=0?U(et):b.focus()})}b.addEventListener("focus",()=>{S.firstElementChild||Z()});function D(){p=b.value.trim(),v.scrollTop=0,f=-1,m=-1,T()}b.addEventListener("input",D),v.addEventListener("scroll",()=>R()),v.addEventListener("focusin",G=>{let Q=G.target.closest(".tree-row");!Q||Q.tabIndex===0||(S.querySelector('[tabindex="0"]')?.setAttribute("tabindex","-1"),m=Number(Q.dataset.row),Q.tabIndex=0)}),v.addEventListener("keydown",G=>{let Q=G.target.closest(".tree-row");if(!Q||G.ctrlKey||G.altKey||G.metaKey)return;let lt=Number(Q.dataset.row),ct=_[lt];if(vh(G)){if(G.preventDefault(),!G.repeat){let{left:V,bottom:j}=Q.getBoundingClientRect();F(ct,V,j)}return}if(G.key===" "){G.preventDefault(),G.repeat||(G.shiftKey?z(lt,!1):W(ct));return}if(G.shiftKey)return;let et=lt;switch(G.key){case"ArrowUp":et=Math.max(0,lt-1);break;case"ArrowDown":et=Math.min(_.length-1,lt+1);break;case"Home":et=0;break;case"End":et=_.length-1;break;case"ArrowRight":ct<0&&(c[-ct-1]?et=lt+1:(c[-ct-1]=1,T()));break;case"ArrowLeft":ct>=0&&!g?et=h[l[ct]]:ct<0&&c[-ct-1]&&(c[-ct-1]=0,T());break;case"Enter":G.repeat||X(ct);break;default:return}G.preventDefault(),et!==lt&&U(et)});function X(G){if(G>=0){M=G,B([G]),r(G);return}c[-G-1]^=1,T()}v.addEventListener("click",G=>{let Q=G.target.closest(".tree-row");if(!Q)return;let lt=Number(Q.dataset.row),ct=G.ctrlKey||G.metaKey;G.shiftKey?z(lt,ct):ct?W(_[lt]):X(_[lt])}),v.addEventListener("contextmenu",G=>{let Q=G.target.closest(".tree-row");Q&&(G.preventDefault(),F(_[Number(Q.dataset.row)],G.clientX,G.clientY))});function Z(){f>=0&&v.clientHeight>0&&(N(f),f=-1),R()}new ResizeObserver(Z).observe(v),n.addEventListener("change",()=>{let G=-1;d.fill(0);for(let Q of n.values())d[l[Q]]++,G=Q;if(E){R();return}M=null,G>=0?C(G):R()}),s.root?.addEventListener("change",G=>G.detail.kind==="visibility"&&R()),T()}var Wf={element:["properties","hide","isolate","showAll","-","zoomTo","sectionBox","-","copyId"],empty:["showAll","fitAll","resetSections"]},ny={hide:"H",isolate:"I",showAll:"Shift+H",zoomTo:"F"},rl=4;function Xf(i){let t=tt("div","ioviewer-context-menu");t.setAttribute("role","menu"),t.setAttribute("aria-label",st("contextMenu")),t.hidden=!0,i.append(t);let e=new Map(Object.values(Wf).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(),Ka(c))}function a(c,h,d,u,p=null){let g=Wf[c];if(!g)throw new RangeError(`Unknown menu: ${c}`);s(),n=p;for(let f of g){if(f==="-"){let b=tt("div","ioviewer-menu-separator");b.setAttribute("role","separator"),t.append(b);continue}let M=e.get(f),E=tt("button","ioviewer-menu-item");E.type="button",E.tabIndex=-1,E.dataset.item=f,E.setAttribute("role","menuitem"),E.setAttribute("aria-disabled",String(!M.enabled)),M.enabled||(E.title=st("menu.unavailable")),E.append(tt("span","",st(`menu.${f}`)),tt("kbd","",ny[f]??"")),E.addEventListener("click",()=>{M.enabled&&(s(),M.handler(u))}),t.append(E)}t.hidden=!1;let{width:_,height:m}=t.getBoundingClientRect();t.style.left=`${Math.max(rl,Math.min(h,innerWidth-_-rl))}px`,t.style.top=`${Math.max(rl,Math.min(d,innerHeight-m-rl))}px`,window.addEventListener("pointerdown",o,!0),window.addEventListener("wheel",s,!0),window.addEventListener("scroll",r,!0),window.addEventListener("resize",s),p&&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 iy=1600;function qf(i,t,e){let n=()=>i.textContent=`${st("selected")}: ${Ir(t.size)} \xB7 ${st("elements")}: ${Ir(e)}`;t.addEventListener("change",n),n()}function Yf(i,t){if(!t)return;let e=tt("div","ioviewer-banner ioviewer-floating");e.setAttribute("role","status");let n=st("truncated").replace("{meshes}",t.meshes).replace("{total}",t.totalMeshes),s=Ke("ioviewer-panel-close",Zt.close,st("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(tt("span","",n),s),i.append(e),r.observe(e)}function Us(i,t){let e=tt("div","ioviewer-toast",t);e.setAttribute("role","status"),i.append(e),setTimeout(()=>e.remove(),iy)}function $f(i,t){let e=tt("table");for(let[s,r]of t)e.insertRow().append(tt("th","",s),tt("td","",String(r??"")));let n=tt("section");return n.append(tt("h3","",i),e),n}function Zf(i,t,e){let n=tt("h2","ioviewer-properties-title"),s=tt("button","ioviewer-properties-close","\xD7");s.type="button",s.title=st("close"),s.setAttribute("aria-label",st("close")),s.addEventListener("click",()=>t.clear());let r=tt("header");r.append(n,s);let o=tt("div","ioviewer-properties-body");i.replaceChildren(r,o),i.hidden=!0;let a=h=>{let d=[[st("id"),h.id],[st("category"),h.category],[st("type"),h.type],[st("level"),h.level]];return h.sourceId&&d.push([st("sourceId"),h.sourceId]),h.link&&d.push([st("link"),h.link]),$f(st("elementGroup"),d)},l=h=>{for(let[d,u]of Object.entries(h??{}))o.append($f(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=`${st("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(p=>{u.signal.aborted||!p||(n.textContent=p.name||d.name||`#${d.id}`,o.replaceChildren(a({...d,...p})),l(p.properties))}).catch(()=>{u.signal.aborted||o.append(tt("p","",st("badData")))}).finally(()=>{c===u&&o.removeAttribute("aria-busy")})})}async function sy(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 Jf({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[M,...E]=r.values(),b=e.elementBox(M);for(let v of E)b.union(e.elementBox(v));n.zoomToBox(b)},fitAll:l},h=Of(i);h.registerPanel("model",{icon:Zt.model,title:st("panel.model"),visible:a.elements.length>0||!!e.setVisible,render:M=>Gf(M,{elements:a.elements,models:a.models??[],selection:r,scene:e,openContextMenu:_,zoomToElement:E=>n.zoomToBox(e.elementBox(E))})});let d=document.createElement("aside");d.id="ioviewer-properties",d.className="ioviewer-floating",i.append(d),Zf(d,r,t);let u=kf(i,zf),p=M=>{n.setLeftButtonMode(M),u.setActive("orbit",M==="orbit"),u.setActive("pan",M==="pan")};u.setHandler("orbit",()=>p("orbit")),u.setHandler("pan",()=>p("pan")),p(n.leftButtonMode),u.setHandler("fit",l),u.setHandler("projection",()=>{let M=!n.camera.isOrthographicCamera;n.setProjection(M?"orthographic":"perspective"),u.setActive("projection",M)}),u.setActive("projection",!1),document.fullscreenEnabled&&(u.setHandler("fullscreen",()=>{(document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()).catch(()=>{u.setActive("fullscreen",!!document.fullscreenElement),Us(i,st("fullscreenUnavailable"))})}),document.addEventListener("fullscreenchange",()=>u.setActive("fullscreen",!!document.fullscreenElement)));let g=Xf(i);function _(M,E,b,v){g.open(b===null?"empty":"element",M,E,b,v)}function m(M){if(g.isOpen)return;let E=M===document.body,b=(E?n.dom:M).getBoundingClientRect(),v=E?b.left+b.width/2:b.left,S=E?b.top+b.height/2:b.bottom;_(v,S,r.values().next().value??null,()=>M.focus({preventScroll:!0}))}g.setItem("properties",{handler:M=>r.set([M])});for(let M of["hide","isolate","showAll","zoomTo","fitAll"])g.setItem(M,{handler:c[M]});g.setItem("copyId",{handler:M=>sy(String(a.elements[M].id)).then(E=>Us(i,st(E?"idCopied":"copyFailed")),()=>Us(i,st("copyFailed")))}),n.addEventListener("contextmenu",async M=>{let{x:E,y:b}=M.detail;if(o?.active)return _(E,b,r.values().next().value??null);let v=s.pick(E,b),S=v?.then?await v:v;if(S!==void 0){if(!S||S.element<0)return _(E,b,null);r.has(S.element)||r.set([S.element]),_(E,b,S.element)}});let f=[];return window.addEventListener("keydown",M=>{if(M.defaultPrevented)return;let E=Hf(M);if(E){if(M.preventDefault(),E==="contextMenu")return m(document.activeElement??document.body);if(E==="escape"&&!g.isOpen){f.some(b=>b())||r.clear();return}g.close(),E!=="escape"&&c[E]?.()}}),qf(document.getElementById("ioviewer-status"),r,e.elementCount),Yf(i,a.truncated),{shell:h,toolbar:u,contextMenu:g,onEscape:M=>f.push(M)}}var bh={x:new I(1,0,0),y:new I(0,1,0),z:new I(0,0,1)};function Mh(i){let t=bh[i];if(!t)throw new RangeError(`Unknown axis: ${i}`);return t.clone()}function Kf(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 jf(i,t,e,n){let s=i.clone().normalize(),r=s.dot(t)+e;return n?new _e(s,-r):new _e(s.negate(),r)}function Qf(i,t,e=0){if(t!=="keepInside"&&t!=="cutInside")throw new RangeError(`Unknown box mode: ${t}`);let{min:n,max:s}=i,r=[new _e(new I(1,0,0),-n.x),new _e(new I(-1,0,0),s.x),new _e(new I(0,1,0),-n.y),new _e(new I(0,-1,0),s.y),new _e(new I(0,0,1),-n.z),new _e(new I(0,0,-1),s.z)];if(e!==0){let o=i.getCenter(new I);for(let a of r){let l=a.distanceToPoint(o);a.normal.applyAxisAngle(bh.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 tp(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 I).sub(i.getCenter(new I));o.translate(a.clone().applyAxisAngle(bh.z,t).sub(a))}return o}function ep(i){let{min:t,max:e}=i;return Array.from({length:8},(n,s)=>new I(s&1?e.x:t.x,s&2?e.y:t.y,s&4?e.z:t.z))}function np(i,t,e){if(t.length===0||i.isEmpty())return!1;let n=ep(i),s=r=>n.every(o=>r.distanceToPoint(o)<0);return e?t.every(s):t.some(s)}function ol(i,t){let e=i.getSize(new I).multiplyScalar(.5);return Math.abs(t.x)*e.x+Math.abs(t.y)*e.y+Math.abs(t.z)*e.z}function Dr(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 al(i,t,e){let n=new I(1,0,0).applyQuaternion(t),s=new I(0,1,0).applyQuaternion(t),[r,o,a,l]=[1/0,-1/0,1/0,-1/0];for(let h of ep(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 Nr=6,ry=["off","planes","box"],oy=.05,Sh=new I(0,0,1),ll=class extends EventTarget{constructor(t,e,n){super(),this.scene=t,this.modelBox=e.clone(),this.center=e.getCenter(new I),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 I().fromArray(r),c=new Ce().setFromUnitVectors(Sh,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 ie(new I().fromArray(e.min),new I().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(!ry.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=Mh(t);if(this.planes.length>=Nr||this.modelBox.isEmpty())return null;let n=new Ce().setFromUnitVectors(Sh,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(Mh(o.axis))>1e-6),this._changed(!0)}setActivePlane(t){this._plane(t),this.active=t,this._changed(!1)}normal(t){return Sh.clone().applyQuaternion(this._plane(t).quaternion)}extent(t){return ol(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 jf(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=ip(e),this.box=t.clone(),this.boxYaw=e,this._mode="box",this._changed(!0)}setBoxYaw(t){this.box&&(this.boxYaw=ip(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 ie;for(let s of t)e.union(this.scene.elementBox(s));if(e.isEmpty())return!1;let n=e.getSize(new I);return this.setBox(e.expandByScalar(oy*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 I);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=Qf(this.box,this.boxMode,this.boxYaw);if(!t.intersection&&this.boxYaw!==0){let e=this.box.getCenter(new I),n=this.box.getSize(new I).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 ie(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)||np(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 ip(i){if(!Number.isFinite(i))throw new RangeError("The section box angle must be finite.");return i>=-Math.PI&&i<=Math.PI?i:ce.euclideanModulo(i+Math.PI,2*Math.PI)-Math.PI}var wh=80,ay=8,Ah=.8,ly=Math.sin(ce.degToRad(12)),yi={x:"#ef4444",y:"#22c55e",z:"#3b82f6",centre:"#e2e8f0",hover:"#facc15",frame:"#93c5fd",fill:"#60a5fa"},Eh=["x","y","z"],cy=Math.cos(ce.degToRad(12)),cl=new I(0,0,1),hy=i=>new en({color:i,depthTest:!1,depthWrite:!1,transparent:!0,opacity:.9}),uy=new en({visible:!1});function hl(i,t,e,n){let s=new Re,r=hy(t);for(let a of e)s.add(new xe(a,r));let o=new xe(n,uy);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 Th(i,t,e=n=>n){let n=hl("rotate",yi[t],[e(new gs(Ah,.018,8,64))],e(new gs(Ah,.09,8,48)));return n.name=i,n.userData.axis=t,n}var ul=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 Di,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)*wh),this.arrow.visible=this._across(cl.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)*ay)}let n=this.boxRing;n.visible&&n.scale.setScalar(this._worldPerPixel(n.position)*wh)}_across(t,e){let n=this.camera,s=n.isOrthographicCamera?n.getWorldDirection(new I):e.clone().sub(n.position).normalize();return Math.abs(t.dot(s))new I(r/2,o/2,0))),n=new en({color:yi.fill,transparent:!0,opacity:.12,side:Ie,depthWrite:!1}),s=new an({color:yi.frame});this.planeVisuals=Array.from({length:Nr},()=>{let r=new Re;return r.add(new xe(t,n),new js(e,s)),this.group.add(r),r})}_buildPlaneGizmo(){let t=(n,s)=>n.rotateX(Math.PI/2).translate(0,0,s),e=hl("move",yi.z,[t(new Pi(.025,.025,1),.5),t(new nr(.08,.25),1.125)],t(new Pi(.12,.12,1.25),.625));e.name="arrow",this.arrow=e,this.planeGizmo=new Re,this.planeGizmo.add(e,Th("ringX","x",n=>n.rotateY(Math.PI/2)),Th("ringY","y",n=>n.rotateX(Math.PI/2))),this.group.add(this.planeGizmo)}_buildBox(){this.boxWire=new vn(new Li(new dn(1,1,1)),new an({color:yi.frame})),this.group.add(this.boxWire);let t=new ms(1,16,12),e=new ms(1.6,8,6);this.boxHandles=[];for(let s of Eh)for(let r of[-1,1]){let o=hl("face",yi[s],[t],e);o.name=`face${r>0?"+":"-"}${s}`,Object.assign(o.userData,{axis:s,sign:r,normal:new I}),this.boxHandles.push(o)}let n=hl("centre",yi.centre,[new dn(1.4,1.4,1.4)],e);n.name="centre",this.boxHandles.push(n),this.boxRing=Th("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=al(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 I),o=s.getSize(new I);this.boxWire.position.copy(r),this.boxWire.scale.copy(o).max(new I(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(Eh.indexOf(l),c).applyAxisAngle(cl,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 I));return 2*Math.max(s,e.near)*Math.tan(ce.degToRad(e.fov/2))/n}_ray(t){let e=this.dom.getBoundingClientRect(),n=new Ht((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,p=r.origin(u),g=r.normal(u),_=Dr(e,p,g);return _===null?null:{index:u,origin:p,normal:g,offset:r.planes[u].offset,s0:_}}if(o==="rotate"){let u=r.active,p=t===this.boxRing,g=p?t.position.clone():r.origin(u),_=p?null:r.planes[u].quaternion.clone(),m=p?cl:new I().setComponent(Eh.indexOf(t.userData.axis),1).applyQuaternion(_),f={index:u,origin:g,quaternion:_,axis:m,yaw:p?r.boxYaw:null};if(Math.abs(m.dot(e.direction))0&&r===0}function my(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;h{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 tp(i,{elements:e,models:t,selection:n,scene:s,zoomToElement:r,openContextMenu:o}){let a=fy(e),l=new Int32Array(e.length);a.forEach((G,Q)=>G.indices.forEach(le=>l[le]=Q));let c=new Uint8Array(a.length),h=new Int32Array(a.length),d=new Uint32Array(a.length),u=dy(e),p="",g=!1,_=new Int32Array(0),m=0,f=-1,M=null,E=!1,b=ee("input","ioviewer-tree-search");b.type="search",b.placeholder=se("searchPlaceholder"),b.setAttribute("aria-label",se("searchPlaceholder"));let v=ee("div","ioviewer-tree");v.setAttribute("role","tree"),v.setAttribute("aria-label",se("panel.model")),v.setAttribute("aria-multiselectable","true"),v.tabIndex=-1;let S=ee("div","ioviewer-tree-spacer");S.setAttribute("role","presentation"),v.append(S);let A=ee("div","ioviewer-tree-empty",se("noMatches")),x=ep(e,t,b,D,()=>s.isolate(_));i.append(x.element,b,v,A);function T(){let G=_[m],Q=x.predicate();if(g=!!(p||Q),g){let ce=p?u(p):e.keys();if(Q){let te=[];for(let H of ce)Q(e[H])&&te.push(H);_=Int32Array.from(te)}else _=Int32Array.from(ce)}else{let ce=a.length;a.forEach((H,j)=>c[j]&&(ce+=H.indices.length)),_=new Int32Array(ce);let te=0;a.forEach((H,j)=>{if(h[j]=te,_[te++]=-(j+1),c[j])for(let ue of H.indices)_[te++]=ue})}let le=_.indexOf(G);m=le>=0?le:0,S.style.height=`${_.length*yi}px`,A.hidden=_.length>0||!g,x.update(p,!!s.isolate&&g&&_.some(ce=>s.instancesOf(ce).length>0)),R()}function R(G=v.contains(document.activeElement)){let Q=v.clientHeight;if(Q===0||_.length===0){S.replaceChildren();return}let le=v.scrollTop,{start:ce,end:te}=Sh(le,yi,Q,_.length,uy);!G&&(m=te)&&(m=Math.min(_.length-1,Math.floor(le/yi)));let H=[];m=te&&H.push(L(m)),S.replaceChildren(...H),G&&S.querySelector('[tabindex="0"]')?.focus({preventScroll:!0})}function L(G){let Q=_[G],le=Q<0?-Q-1:l[Q],ce=Q<0?d[le]===a[le].indices.length:n.has(Q),te=ee("div","tree-row");if(te.style.top=`${G*yi}px`,te.style.height=`${yi}px`,te.dataset.row=G,te.tabIndex=G===m?0:-1,te.setAttribute("role","treeitem"),te.classList.toggle("selected",ce),te.setAttribute("aria-selected",String(ce)),Q<0){te.classList.add("tree-category"),te.setAttribute("aria-level","1"),te.setAttribute("aria-posinset",String(le+1)),te.setAttribute("aria-setsize",String(a.length)),te.setAttribute("aria-expanded",String(!!c[le]));let H=ee("span","tree-chevron");H.innerHTML=Ze.chevron;let{name:j,indices:ue}=a[le];te.append(H,ee("span","tree-name",j||se("noCategory")),ee("span","tree-count",Pr(ue.length)))}else{let H=e[Q];te.classList.add("tree-element"),te.setAttribute("aria-level",g?"1":"2"),te.setAttribute("aria-posinset",String(g?G+1:G-h[le])),te.setAttribute("aria-setsize",String(g?_.length:a[le].indices.length)),te.classList.toggle("tree-child",!g),te.classList.toggle("tree-hidden",s.isVisible?.(Q)===!1),te.append(ee("span","tree-name",H.name||`#${H.id}`),ee("span","tree-type",H.type??""))}return te}function N(G){let Q=v.clientHeight;if(Q===0){f=G;return}let le=G*yi;lev.scrollTop+Q&&(v.scrollTop=le+yi-Q)}function U(G){m=G,N(G),R(!0)}function C(G){let Q=l[G];!g&&!c[Q]&&(c[Q]=1,T());let le=_.indexOf(G);le>=0&&(v.contains(document.activeElement)||(m=le),N(le)),R()}function B(G){E=!0;try{n.set(G)}finally{E=!1}}function z(G,Q){let le=_.indexOf(M);le<0&&(le=G,M=_[G]);let ce=_.subarray(Math.min(le,G),Math.max(le,G)+1).filter(te=>te>=0);ce.length>0&&B(Q?[...n.values(),...ce]:ce)}function W(G){M=G;let Q=-G-1,le=G<0?a[Q].indices:[G],ce=G<0?d[Q]===le.length:n.has(G),te=new Set(n.values());for(let H of le)ce?te.delete(H):te.add(H);B(te)}function F(G,Q,le){G>=0&&!n.has(G)&&(M=G,B([G]));let ce=G>=0?G:n.values().next().value??null;o(Q,le,ce,()=>{let te=_.indexOf(G);te>=0?U(te):b.focus()})}b.addEventListener("focus",()=>{S.firstElementChild||Z()});function D(){p=b.value.trim(),v.scrollTop=0,f=-1,m=-1,T()}b.addEventListener("input",D),v.addEventListener("scroll",()=>R()),v.addEventListener("focusin",G=>{let Q=G.target.closest(".tree-row");!Q||Q.tabIndex===0||(S.querySelector('[tabindex="0"]')?.setAttribute("tabindex","-1"),m=Number(Q.dataset.row),Q.tabIndex=0)}),v.addEventListener("keydown",G=>{let Q=G.target.closest(".tree-row");if(!Q||G.ctrlKey||G.altKey||G.metaKey)return;let le=Number(Q.dataset.row),ce=_[le];if(Mh(G)){if(G.preventDefault(),!G.repeat){let{left:H,bottom:j}=Q.getBoundingClientRect();F(ce,H,j)}return}if(G.key===" "){G.preventDefault(),G.repeat||(G.shiftKey?z(le,!1):W(ce));return}if(G.shiftKey)return;let te=le;switch(G.key){case"ArrowUp":te=Math.max(0,le-1);break;case"ArrowDown":te=Math.min(_.length-1,le+1);break;case"Home":te=0;break;case"End":te=_.length-1;break;case"ArrowRight":ce<0&&(c[-ce-1]?te=le+1:(c[-ce-1]=1,T()));break;case"ArrowLeft":ce>=0&&!g?te=h[l[ce]]:ce<0&&c[-ce-1]&&(c[-ce-1]=0,T());break;case"Enter":G.repeat||X(ce);break;default:return}G.preventDefault(),te!==le&&U(te)});function X(G){if(G>=0){M=G,B([G]),r(G);return}c[-G-1]^=1,T()}v.addEventListener("click",G=>{let Q=G.target.closest(".tree-row");if(!Q)return;let le=Number(Q.dataset.row),ce=G.ctrlKey||G.metaKey;G.shiftKey?z(le,ce):ce?W(_[le]):X(_[le])}),v.addEventListener("contextmenu",G=>{let Q=G.target.closest(".tree-row");Q&&(G.preventDefault(),F(_[Number(Q.dataset.row)],G.clientX,G.clientY))});function Z(){f>=0&&v.clientHeight>0&&(N(f),f=-1),R()}new ResizeObserver(Z).observe(v),n.addEventListener("change",()=>{let G=-1;d.fill(0);for(let Q of n.values())d[l[Q]]++,G=Q;if(E){R();return}M=null,G>=0?C(G):R()}),s.root?.addEventListener("change",G=>G.detail.kind==="visibility"&&R()),T()}var np={element:["properties","hide","isolate","showAll","-","zoomTo","sectionBox","-","copyId"],empty:["showAll","fitAll","resetSections"]},py={hide:"H",isolate:"I",showAll:"Shift+H",zoomTo:"F"},ol=4;function ip(i){let e=ee("div","ioviewer-context-menu");e.setAttribute("role","menu"),e.setAttribute("aria-label",se("contextMenu")),e.hidden=!0,i.append(e);let t=new Map(Object.values(np).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(),ja(c))}function a(c,h,d,u,p=null){let g=np[c];if(!g)throw new RangeError(`Unknown menu: ${c}`);s(),n=p;for(let f of g){if(f==="-"){let b=ee("div","ioviewer-menu-separator");b.setAttribute("role","separator"),e.append(b);continue}let M=t.get(f),E=ee("button","ioviewer-menu-item");E.type="button",E.tabIndex=-1,E.dataset.item=f,E.setAttribute("role","menuitem"),E.setAttribute("aria-disabled",String(!M.enabled)),M.enabled||(E.title=se("menu.unavailable")),E.append(ee("span","",se(`menu.${f}`)),ee("kbd","",py[f]??"")),E.addEventListener("click",()=>{M.enabled&&(s(),M.handler(u))}),e.append(E)}e.hidden=!1;let{width:_,height:m}=e.getBoundingClientRect();e.style.left=`${Math.max(ol,Math.min(h,innerWidth-_-ol))}px`,e.style.top=`${Math.max(ol,Math.min(d,innerHeight-m-ol))}px`,window.addEventListener("pointerdown",o,!0),window.addEventListener("wheel",s,!0),window.addEventListener("scroll",r,!0),window.addEventListener("resize",s),p&&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 my=1600;function sp(i,e,t){let n=()=>i.textContent=`${se("selected")}: ${Pr(e.size)} \xB7 ${se("elements")}: ${Pr(t)}`;e.addEventListener("change",n),n()}function rp(i,e){if(!e)return;let t=ee("div","ioviewer-banner ioviewer-floating");t.setAttribute("role","status");let n=se("truncated").replace("{meshes}",e.meshes).replace("{total}",e.totalMeshes),s=Kt("ioviewer-panel-close",Ze.close,se("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(ee("span","",n),s),i.append(t),r.observe(t)}function Fs(i,e){let t=ee("div","ioviewer-toast",e);t.setAttribute("role","status"),i.append(t),setTimeout(()=>t.remove(),my)}function op(i,e){let t=ee("table");for(let[s,r]of e)t.insertRow().append(ee("th","",s),ee("td","",String(r??"")));let n=ee("section");return n.append(ee("h3","",i),t),n}function ap(i,e,t){let n=ee("h2","ioviewer-properties-title"),s=ee("button","ioviewer-properties-close","\xD7");s.type="button",s.title=se("close"),s.setAttribute("aria-label",se("close")),s.addEventListener("click",()=>e.clear());let r=ee("header");r.append(n,s);let o=ee("div","ioviewer-properties-body");i.replaceChildren(r,o),i.hidden=!0;let a=h=>{let d=[[se("id"),h.id],[se("category"),h.category],[se("type"),h.type],[se("level"),h.level]];return h.sourceId&&d.push([se("sourceId"),h.sourceId]),h.link&&d.push([se("link"),h.link]),op(se("elementGroup"),d)},l=h=>{for(let[d,u]of Object.entries(h??{}))o.append(op(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=`${se("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(p=>{u.signal.aborted||!p||(n.textContent=p.name||d.name||`#${d.id}`,o.replaceChildren(a({...d,...p})),l(p.properties))}).catch(()=>{u.signal.aborted||o.append(ee("p","",se("badData")))}).finally(()=>{c===u&&o.removeAttribute("aria-busy")})})}async function gy(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 lp({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[M,...E]=r.values(),b=t.elementBox(M);for(let v of E)b.union(t.elementBox(v));n.zoomToBox(b)},fitAll:l},h=Jf(i);h.registerPanel("model",{icon:Ze.model,title:se("panel.model"),visible:a.elements.length>0||!!t.setVisible,render:M=>tp(M,{elements:a.elements,models:a.models??[],selection:r,scene:t,openContextMenu:_,zoomToElement:E=>n.zoomToBox(t.elementBox(E))})});let d=document.createElement("aside");d.id="ioviewer-properties",d.className="ioviewer-floating",i.append(d),ap(d,r,e);let u=jf(i,Kf),p=M=>{n.setLeftButtonMode(M),u.setActive("orbit",M==="orbit"),u.setActive("pan",M==="pan")};u.setHandler("orbit",()=>p("orbit")),u.setHandler("pan",()=>p("pan")),p(n.leftButtonMode),u.setHandler("fit",l),u.setHandler("projection",()=>{let M=!n.camera.isOrthographicCamera;n.setProjection(M?"orthographic":"perspective"),u.setActive("projection",M)}),u.setActive("projection",!1),document.fullscreenEnabled&&(u.setHandler("fullscreen",()=>{(document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()).catch(()=>{u.setActive("fullscreen",!!document.fullscreenElement),Fs(i,se("fullscreenUnavailable"))})}),document.addEventListener("fullscreenchange",()=>u.setActive("fullscreen",!!document.fullscreenElement)));let g=ip(i);function _(M,E,b,v){g.open(b===null?"empty":"element",M,E,b,v)}function m(M){if(g.isOpen)return;let E=M===document.body,b=(E?n.dom:M).getBoundingClientRect(),v=E?b.left+b.width/2:b.left,S=E?b.top+b.height/2:b.bottom;_(v,S,r.values().next().value??null,()=>M.focus({preventScroll:!0}))}g.setItem("properties",{handler:M=>r.set([M])});for(let M of["hide","isolate","showAll","zoomTo","fitAll"])g.setItem(M,{handler:c[M]});g.setItem("copyId",{handler:M=>gy(String(a.elements[M].id)).then(E=>Fs(i,se(E?"idCopied":"copyFailed")),()=>Fs(i,se("copyFailed")))}),n.addEventListener("contextmenu",async M=>{let{x:E,y:b}=M.detail;if(o?.active)return _(E,b,r.values().next().value??null);let v=s.pick(E,b),S=v?.then?await v:v;if(S!==void 0){if(!S||S.element<0)return _(E,b,null);r.has(S.element)||r.set([S.element]),_(E,b,S.element)}});let f=[];return window.addEventListener("keydown",M=>{if(M.defaultPrevented)return;let E=Qf(M);if(E){if(M.preventDefault(),E==="contextMenu")return m(document.activeElement??document.body);if(E==="escape"&&!g.isOpen){f.some(b=>b())||r.clear();return}g.close(),E!=="escape"&&c[E]?.()}}),sp(document.getElementById("ioviewer-status"),r,t.elementCount),rp(i,a.truncated),{shell:h,toolbar:u,contextMenu:g,onEscape:M=>f.push(M)}}var wh={x:new I(1,0,0),y:new I(0,1,0),z:new I(0,0,1)};function Eh(i){let e=wh[i];if(!e)throw new RangeError(`Unknown axis: ${i}`);return e.clone()}function cp(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 hp(i,e,t,n){let s=i.clone().normalize(),r=s.dot(e)+t;return n?new _t(s,-r):new _t(s.negate(),r)}function up(i,e,t=0){if(e!=="keepInside"&&e!=="cutInside")throw new RangeError(`Unknown box mode: ${e}`);let{min:n,max:s}=i,r=[new _t(new I(1,0,0),-n.x),new _t(new I(-1,0,0),s.x),new _t(new I(0,1,0),-n.y),new _t(new I(0,-1,0),s.y),new _t(new I(0,0,1),-n.z),new _t(new I(0,0,-1),s.z)];if(t!==0){let o=i.getCenter(new I);for(let a of r){let l=a.distanceToPoint(o);a.normal.applyAxisAngle(wh.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 dp(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 I).sub(i.getCenter(new I));o.translate(a.clone().applyAxisAngle(wh.z,e).sub(a))}return o}function fp(i){let{min:e,max:t}=i;return Array.from({length:8},(n,s)=>new I(s&1?t.x:e.x,s&2?t.y:e.y,s&4?t.z:e.z))}function pp(i,e,t){if(e.length===0||i.isEmpty())return!1;let n=fp(i),s=r=>n.every(o=>r.distanceToPoint(o)<0);return t?e.every(s):e.some(s)}function al(i,e){let t=i.getSize(new I).multiplyScalar(.5);return Math.abs(e.x)*t.x+Math.abs(e.y)*t.y+Math.abs(e.z)*t.z}function Nr(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 ll(i,e,t){let n=new I(1,0,0).applyQuaternion(e),s=new I(0,1,0).applyQuaternion(e),[r,o,a,l]=[1/0,-1/0,1/0,-1/0];for(let h of fp(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 Ur=6,_y=["off","planes","box"],xy=.05,Th=new I(0,0,1),cl=class extends EventTarget{constructor(e,t,n){super(),this.scene=e,this.modelBox=t.clone(),this.center=t.getCenter(new I),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 I().fromArray(r),c=new Ct().setFromUnitVectors(Th,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 it(new I().fromArray(t.min),new I().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(!_y.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=Eh(e);if(this.planes.length>=Ur||this.modelBox.isEmpty())return null;let n=new Ct().setFromUnitVectors(Th,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(Eh(o.axis))>1e-6),this._changed(!0)}setActivePlane(e){this._plane(e),this.active=e,this._changed(!1)}normal(e){return Th.clone().applyQuaternion(this._plane(e).quaternion)}extent(e){return al(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 hp(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=mp(t),this.box=e.clone(),this.boxYaw=t,this._mode="box",this._changed(!0)}setBoxYaw(e){this.box&&(this.boxYaw=mp(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 it;for(let s of e)t.union(this.scene.elementBox(s));if(t.isEmpty())return!1;let n=t.getSize(new I);return this.setBox(t.expandByScalar(xy*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 I);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=up(this.box,this.boxMode,this.boxYaw);if(!e.intersection&&this.boxYaw!==0){let t=this.box.getCenter(new I),n=this.box.getSize(new I).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 it(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)||pp(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 mp(i){if(!Number.isFinite(i))throw new RangeError("The section box angle must be finite.");return i>=-Math.PI&&i<=Math.PI?i:ct.euclideanModulo(i+Math.PI,2*Math.PI)-Math.PI}var Ah=80,vy=8,Ih=.8,yy=Math.sin(ct.degToRad(12)),bi={x:"#ef4444",y:"#22c55e",z:"#3b82f6",centre:"#e2e8f0",hover:"#facc15",frame:"#93c5fd",fill:"#60a5fa"},Rh=["x","y","z"],by=Math.cos(ct.degToRad(12)),hl=new I(0,0,1),My=i=>new tn({color:i,depthTest:!1,depthWrite:!1,transparent:!0,opacity:.9}),Sy=new tn({visible:!1});function ul(i,e,t,n){let s=new Rt,r=My(e);for(let a of t)s.add(new xt(a,r));let o=new xt(n,Sy);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 Ch(i,e,t=n=>n){let n=ul("rotate",bi[e],[t(new _s(Ih,.018,8,64))],t(new _s(Ih,.09,8,48)));return n.name=i,n.userData.axis=e,n}var dl=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 Ni,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)*Ah),this.arrow.visible=this._across(hl.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)*vy)}let n=this.boxRing;n.visible&&n.scale.setScalar(this._worldPerPixel(n.position)*Ah)}_across(e,t){let n=this.camera,s=n.isOrthographicCamera?n.getWorldDirection(new I):t.clone().sub(n.position).normalize();return Math.abs(e.dot(s))new I(r/2,o/2,0))),n=new tn({color:bi.fill,transparent:!0,opacity:.12,side:It,depthWrite:!1}),s=new an({color:bi.frame});this.planeVisuals=Array.from({length:Ur},()=>{let r=new Rt;return r.add(new xt(e,n),new Qs(t,s)),this.group.add(r),r})}_buildPlaneGizmo(){let e=(n,s)=>n.rotateX(Math.PI/2).translate(0,0,s),t=ul("move",bi.z,[e(new Li(.025,.025,1),.5),e(new ir(.08,.25),1.125)],e(new Li(.12,.12,1.25),.625));t.name="arrow",this.arrow=t,this.planeGizmo=new Rt,this.planeGizmo.add(t,Ch("ringX","x",n=>n.rotateY(Math.PI/2)),Ch("ringY","y",n=>n.rotateX(Math.PI/2))),this.group.add(this.planeGizmo)}_buildBox(){this.boxWire=new vn(new Di(new dn(1,1,1)),new an({color:bi.frame})),this.group.add(this.boxWire);let e=new gs(1,16,12),t=new gs(1.6,8,6);this.boxHandles=[];for(let s of Rh)for(let r of[-1,1]){let o=ul("face",bi[s],[e],t);o.name=`face${r>0?"+":"-"}${s}`,Object.assign(o.userData,{axis:s,sign:r,normal:new I}),this.boxHandles.push(o)}let n=ul("centre",bi.centre,[new dn(1.4,1.4,1.4)],t);n.name="centre",this.boxHandles.push(n),this.boxRing=Ch("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=ll(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 I),o=s.getSize(new I);this.boxWire.position.copy(r),this.boxWire.scale.copy(o).max(new I(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(Rh.indexOf(l),c).applyAxisAngle(hl,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 I));return 2*Math.max(s,t.near)*Math.tan(ct.degToRad(t.fov/2))/n}_ray(e){let t=this.dom.getBoundingClientRect(),n=new Ve((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,p=r.origin(u),g=r.normal(u),_=Nr(t,p,g);return _===null?null:{index:u,origin:p,normal:g,offset:r.planes[u].offset,s0:_}}if(o==="rotate"){let u=r.active,p=e===this.boxRing,g=p?e.position.clone():r.origin(u),_=p?null:r.planes[u].quaternion.clone(),m=p?hl:new I().setComponent(Rh.indexOf(e.userData.axis),1).applyQuaternion(_),f={index:u,origin:g,quaternion:_,axis:m,yaw:p?r.boxYaw:null};if(Math.abs(m.dot(t.direction))0&&r===0}function Ay(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 -${Er} +${Tr} #include uniform highp sampler2D closedSlots; void main() { - ${Tr} + ${Ar} vec3 transformed = slotPosition; #include #include - ${ah} + ${lh} 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 dl=class{constructor(t,e,n,s){this.model=t,this.sections=e,this.data=n,this.drawStencils=s,this._farSide=new _e,this._surface=new xe(new yn(1,1),new en({color:fy,side:Ie,forceSinglePass:!0,stencilWrite:!0,stencilFunc:Mc,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(p))return;let _=u?-p.normal.dot(u):p.distanceToPoint(n.position);if(_===0)return;if(this._farSide.copy(p),_>0&&this._farSide.negate(),t.clearStencil(),this.drawStencils)this.drawStencils(t,n,this._farSide);else for(let f of this._stencils)r.withMaterial(f,()=>t.render(r.root,n),{section:!0});this._surface.quaternion.setFromUnitVectors(dy,p.normal);let m=al(s.modelBox,this._surface.quaternion,p.coplanarPoint(new I));this._surface.position.copy(m.center),this._surface.scale.set(m.width,m.height,1),h.clippingPlanes=l.filter((f,M)=>M!==g),t.render(this._surface,n)}),t.render(e,n)}finally{t.autoClear=d}}};function Ur(i,t,e){let n=tt("div","ioviewer-segmented");n.setAttribute("role","group"),n.setAttribute("aria-label",i);let s=t.map(([o,a])=>{let l=tt("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 Rh(i,t){let e=tt("label","ioviewer-check"),n=tt("input");return n.type="checkbox",n.addEventListener("change",()=>t(n.checked)),e.append(n,tt("span","",i)),{element:e,input:n}}function gy(i,t){let e=tt("li","ioviewer-section-plane");e.addEventListener("pointerdown",()=>i.active!==t&&i.setActivePlane(t));let n=tt("span","ioviewer-section-name"),s=Ke("ioviewer-icon-button",Zt.flip,st("sections.flip"));s.addEventListener("click",()=>i.updatePlane(t,{flipped:!i.planes[t].flipped}));let r=Rh(st("sections.enabled"),h=>i.updatePlane(t,{enabled:h})),o=Ke("ioviewer-icon-button",Zt.remove,st("sections.delete"));o.addEventListener("click",()=>i.removePlane(t));let a=tt("input","ioviewer-section-slider");a.type="range",a.step="any",a.setAttribute("aria-label",st("sections.position")),a.addEventListener("input",()=>i.updatePlane(t,{offset:Number(a.value)}));let l=tt("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?` (${st("sections.rotated")})`:"",u=h.axis==="custom"?st("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 p=i.extent(t);a.min=String(Math.min(-p,h.offset)),a.max=String(Math.max(p,h.offset)),a.value=String(h.offset)}}}function rp({root:i,shell:t,toolbar:e,contextMenu:n,sections:s,selection:r,canFill:o}){let a="z",l=()=>{s.addPlane(a)===null&&(s.setMode("planes"),Us(i,st("sections.maxPlanes")))},c=()=>[...r.values()],h=()=>s.fitBoxToElements(c()),d=Ur(st("sections.mode"),[["planes",st("sections.planes")],["box",st("sections.box")],["off",st("sections.off")]],C=>s.setMode(C)),u=Ur(st("sections.axis"),["x","y","z"].map(C=>[C,C.toUpperCase()]),C=>u.update(a=C));u.update(a);let p=tt("button","ioviewer-text-button",st("sections.addPlane"));p.type="button",p.addEventListener("click",l);let g=tt("ul","ioviewer-section-list"),_=tt("div","ioviewer-section-empty",st("sections.noPlanes")),m=tt("div","ioviewer-section-block"),f=tt("div","ioviewer-section-row");f.append(tt("span","",st("sections.axis")),u.element,p),m.append(f,g,_);let M=Ur(st("sections.box"),[["keepInside",st("sections.keepInside")],["cutInside",st("sections.cutInside")]],C=>s.setBoxMode(C)),E=tt("button","ioviewer-text-button",st("sections.fitSelection"));E.type="button",E.addEventListener("click",h);let b=tt("input","ioviewer-section-slider");Object.assign(b,{type:"range",min:"-180",max:"180",step:"1"}),b.addEventListener("input",()=>s.setBoxYaw(Number(b.value)*Math.PI/180));let v=tt("span");v.setAttribute("aria-hidden","true");let S=tt("label","ioviewer-section-row");S.append(tt("span","",st("sections.boxYaw")),b,v);let A=tt("div","ioviewer-section-block");A.append(M.element,S,E);let x=Rh(st("sections.showGizmo"),C=>s.setGizmoVisible(C)),T=Rh(st("sections.fill"),C=>s.setFill(C));o||(T.element.title=st("sections.fillUnavailable"));let R=[],L=()=>{d.update(s.mode),m.hidden=s.mode!=="planes",A.hidden=s.mode!=="box",p.disabled=s.planes.length>=Nr,R.length!==s.planes.length&&(R=s.planes.map((B,z)=>gy(s,z)),g.replaceChildren(...R.map(B=>B.element))),R.forEach(B=>B.update()),_.hidden=R.length>0,M.update(s.boxMode),b.value=String(Math.round(s.boxYaw*180/Math.PI)),v.textContent=`${b.value}\xB0`,b.setAttribute("aria-valuetext",v.textContent),x.input.checked=s.gizmoVisible,T.input.checked=s.fill;let C=s.mode==="box"||s.mode==="planes"&&s.planes.some(B=>B.enabled);T.input.disabled=!o||!C,e.setActive("plane",s.mode==="planes"),e.setActive("box",s.mode==="box")},N=()=>E.disabled=r.size===0;if(t.registerPanel("sections",{icon:Zt.sections,title:st("panel.sections"),visible:!s.modelBox.isEmpty(),render:C=>C.append(d.element,m,A,T.element,x.element)}),s.addEventListener("change",L),r.addEventListener("change",N),L(),N(),s.modelBox.isEmpty())return;let U=()=>t.openPanel("sections");e.setHandler("plane",()=>{l(),U()}),e.setHandler("box",()=>{(s.mode==="box"||r.size&&h()||s.fitBoxToShown())&&U()}),e.setHandler("resetSections",()=>s.reset()),n.setItem("sectionBox",{handler:C=>{s.fitBoxToElements(r.has(C)?c():[C]),U()}}),n.setItem("resetSections",{handler:()=>s.reset()})}var _y="#facc15",xy=9;function Ch(i,t=Ls){return`${new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!1}).format(i)} ${st("unit.m",t)}`}var fl=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 le;e.setAttribute("position",new Se(new Float32Array(6),3));let n={color:_y,depthTest:!1,depthWrite:!1,transparent:!0};this._line=new Ci(e,new an(n)),this._markers=new Ii(e,new li({...n,size:xy,sizeAttenuation:!1}));for(let s of[this._line,this._markers])s.frustumCulled=!1,s.renderOrder=1001,this.group.add(s);this.label=tt("div","ioviewer-measure-label"),this.label.hidden=!0,this._previewMarker=tt("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 ie().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&&Pr(this._previewMarker,this.preview.point,t,e),this.distance!==null&&Pr(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=Ch(this.distance)),this.dispatchEvent(new Event("change"))}};var op=8,vy=1-1e-6,yy=8,ap={vertex:0,midpoint:1,edge:2},by=2e4;function My(i,t){let e=new Map,n=new Uint32Array(i.length/3);for(let d=0;d0&&(_.normalize(),l(u,p,_),l(p,g,_),l(g,u,_))}let c=[],h=new Set;for(let{lo:d,hi:u,count:p,crease:g}of s.values())p!==1&&!g||(c.push(d,u),h.add(d),h.add(u));return{edges:c,vertices:h}}function pl(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 Sy(i,t,e,n,s,r){let o=[0,1];if(!pl(o,e.w+e.z,n.w+n.z)||!pl(o,e.w-e.z,n.w-n.z))return[];if(!r||!s.length)return s.every(c=>pl(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)&&pl(a,-h,-d)}))return[o];let l=[];return o[0]0))return null;let m=ce.clamp(((r-c)*p+(o-h)*g)/_,0,1);return e+(n-e)*(m*a.w/((1-m)*l.w+m*a.w))}var ml=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=jd({view:this.data.readView},n);e={positions:s,...My(s,this.data.readView(n.indices))}}return this.cache.set(t,e),this.cache.size>yy&&this.cache.delete(this.cache.keys().next().value),e}target(t,e){let n=this.picker.measureTile(t,e,op+1);if(!n)return null;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,p=null;function g(v,S,A,x){if(p&&ap[v]>ap[p.kind]||A.w<=0||A.z<-A.w||A.z>A.w)return;let[T,R]=Ih(A,s);if(!(T>=0&&R>=0&&Top**2||p?.kind===v&&L>=p.distance||v!=="edge"&&Kf(S,c,h))return;let N=-(u[2]*S.x+u[6]*S.y+u[10]*S.z+u[14]);N-n.depthAt(T,R,x)>2*wn+Math.abs(N)*2**-21||(p={kind:v,distance:L,point:S.clone()})}let _=by*3,m=new kt,f=new I,M=new ae,{geometry:E,matrix:b}=this.data.meta.instances;for(let v of n.slots){let S=l.slotInstance(v),[A]=this.data.readView({t:"u32",o:E.o+S*4,n:1}),x=this.data.meta.geometries[A],T=Math.max(x.indices.n,x.positions.n/3);if(T>_)continue;_-=T;let{positions:R,vertices:L,edges:N}=this._geometry(A),U=this.data.readView({t:"f32",o:b.o+S*48,n:12});m.set(U[0],U[3],U[6],U[9],U[1],U[4],U[7],U[10],U[2],U[5],U[8],U[11],0,0,0,1);let C=new Map;for(let B of L){let z=new I().fromArray(R,B*3).applyMatrix4(m),W=new ae(z.x,z.y,z.z,1).applyMatrix4(d);C.set(B,[z,W]),g("vertex",z,W,v)}if(p?.kind!=="vertex")for(let B=0;Br.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)Pr(n,s,t,e)}};var Ey=8,lp=4;function Ph(i,t,e,n="dialog"){let s=tt("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(),Ka(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(lp,Math.min(l.left+l.width/2-c/2,innerWidth-c-lp))}px`,s.style.bottom=`${innerHeight-l.top+Ey}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 Ty(i){return i?.initialWireframe?"wireframe":i?.initialWhiteMode?"white":"materials"}function cp({root:i,toolbar:t,scene:e,meta:n,grids:s,initialBackground:r,setBackground:o}){let a=x=>t.element.querySelector(`[data-tool="${x}"]`),l=a("displayMode"),c=Ph(i,l,st("group.display"));c.element.classList.add("ioviewer-display-modes");let h=tt("div");h.setAttribute("role","menu"),h.setAttribute("aria-label",st("tool.displayMode")),c.element.append(h);let d=(n.textures??[]).length>0,u=dh.map(x=>{let T=tt("button","ioviewer-menu-item",st(`display.${x}`));return T.type="button",T.dataset.mode=x,T.setAttribute("role","menuitemradio"),T.disabled=x==="textures"&&!d,T.addEventListener("click",()=>{p(x),c.close(),l.focus()}),h.append(T),T}),p=x=>{e.setDisplayMode(x);for(let T of u)T.setAttribute("aria-checked",String(T.dataset.mode===x))};p(Ty(n.options)),t.setHandler("displayMode",()=>{c.toggle(),c.isOpen&&h.querySelector('[aria-checked="true"]')?.focus()});let g=tt("div","ioviewer-background-setting"),_=tt("label","",st("display.background")),m=tt("input");Object.assign(m,{type:"color",value:r}),_.append(m);let f=tt("button","ioviewer-text-button",st("display.backgroundReset"));f.type="button",f.disabled=!0;let M=()=>{o(m.value),f.disabled=m.value===r};m.addEventListener("input",M),f.addEventListener("click",()=>{m.value=r,m.focus(),M()}),g.append(_,f),c.element.append(g),t.setActive("grids",s.visible),s.count>0&&t.setHandler("grids",()=>{s.setVisible(!s.visible),t.setActive("grids",s.visible)});let E=Ph(i,a("opacity"),st("tool.opacity"));E.element.classList.add("ioviewer-opacity");let b=tt("input","ioviewer-opacity-slider");Object.assign(b,{type:"range",min:"10",max:"100",step:"1",value:"100"}),b.setAttribute("aria-label",st("opacity.label"));let v=tt("output","ioviewer-opacity-value"),S=()=>v.textContent=st("opacity.value").replace("{value}",b.value);b.addEventListener("input",()=>{e.setOpacity(Number(b.value)/100),S()}),S();let A=tt("div","ioviewer-opacity-head");return A.append(tt("span","",st("opacity.label")),v),E.element.append(A,b),t.setHandler("opacity",E.toggle),[c,E]}var Ay=3e3;function _l(i,t){let e=tt("button",i);return e.type="button",e.setAttribute("title",t),e.append(tt("span","ioviewer-row-name",t)),e}function hp({shell:i,toolbar:t,controls:e,scene:n,sections:s,selection:r,restoreLinkedModels:o,views:a,bcfTopics:l}){let c=null,h=tt("button","ioviewer-text-button ioviewer-tour");h.type="button";function d(E){E.sections!=null&&s.restore(E.sections),E.hiddenElements!=null&&n.setHiddenElements(E.hiddenElements),E.visibleElements!=null&&n.isolate(E.visibleElements),E.hiddenModelKeys!=null&&o(E.hiddenModelKeys),E.selectedElements!=null&&r.set(E.selectedElements);let b=E.camera.projection==="orthographic";e.setProjection(b?"orthographic":"perspective"),t.setActive("projection",b),e.restoreViewCamera(E.camera)}function u(){d(a[c.next]),c.next=(c.next+1)%a.length;let E=()=>{e.animating?c.frame=requestAnimationFrame(E):c.timer=setTimeout(u,Ay)};c.frame=requestAnimationFrame(E)}let p=E=>h.contains(E.target),g=E=>!p(E)&&m(),_=E=>{p(E)&&(E.key==="Enter"||E.key===" ")||(E.key==="Escape"&&(E.preventDefault(),E.stopPropagation()),m())};function m(){c&&(cancelAnimationFrame(c.frame),clearTimeout(c.timer),c=null,window.removeEventListener("pointerdown",g,!0),window.removeEventListener("wheel",m,!0),window.removeEventListener("keydown",_,!0),M())}function f(){c={next:0,frame:0,timer:0},window.addEventListener("pointerdown",g,!0),window.addEventListener("wheel",m,!0),window.addEventListener("keydown",_,!0),M(),u()}function M(){let E=st(c?"views.stop":"views.tour");h.replaceChildren(),h.insertAdjacentHTML("afterbegin",c?Zt.pause:Zt.play),h.append(tt("span","",E)),h.setAttribute("aria-pressed",String(!!c))}h.addEventListener("click",()=>c?m():f()),M(),i.registerPanel("views",{icon:Zt.views,title:st("panel.views"),visible:a.length>0,render:E=>{let b=tt("div","ioviewer-row-list");for(let v of a){let S=_l("ioviewer-row ioviewer-view",String(v.name??""));S.addEventListener("click",()=>d(v)),b.append(S)}E.append(h,b)}}),i.registerPanel("bcf",{icon:Zt.bcf,title:st("panel.bcf"),visible:l.length>0,render:E=>{let b=tt("div","ioviewer-row-list");for(let v of l){let S=tt("details","ioviewer-bcf-topic");S.append(tt("summary","",v.title)),v.status&&S.append(tt("p","ioviewer-bcf-status",v.status)),v.description&&S.append(tt("p","ioviewer-bcf-description",v.description)),v.viewpoints.length||S.append(tt("p","ioviewer-bcf-status",st("bcf.noView"))),v.viewpoints.forEach((A,x)=>{let T=st("bcf.viewpoint").replace("{index}",String(x+1)),R=_l("ioviewer-row ioviewer-view",T);if(R.addEventListener("click",()=>d(A)),S.append(R),A.missingComponents||A.ambiguousComponents){let L=st("bcf.components").replace("{missing}",String(A.missingComponents)).replace("{ambiguous}",String(A.ambiguousComponents));S.append(tt("p","ioviewer-bcf-status",L))}}),b.append(S)}E.append(b)}})}function up(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):Ry(t,s);r>=0&&!e.includes(r)&&e.push(r)}return e}function Ry(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 Cy=["New","Active","Reviewed","Approved","Resolved"],Lh=27,Iy=8,Py=14,Ly=2,Dy=new I(1,-1,.8).normalize();function dp({shell:i,tests:t,elements:e,scene:n,controls:s,selection:r}){let o=new Re;o.name="clash-marker";let a=new le;a.setAttribute("position",new Se(new Float32Array(3),3));let l={color:"#ef4444",depthTest:!1,depthWrite:!1,transparent:!0},c=new Ii(a,new li({...l,size:Py,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 p(M,E){let b=up(M,e);b.length?r.set(b):r.clear();let v=new I(...M.point),S=0;for(let T of b){let R=n.elementBox(T);R.isEmpty()||(S=Math.max(S,...R.getSize(new I).toArray()))}let A=s.camera.position.clone().sub(s.target);A.lengthSq()<1e-12&&A.copy(Dy);let x=Math.max(3*S,Ly);s.animateTo({position:A.normalize().multiplyScalar(x).add(v),target:v}),a.attributes.position.setXYZ(0,v.x,v.y,v.z),a.attributes.position.needsUpdate=!0,o.visible=!0,h?.removeAttribute("aria-current"),h=E,d=M,E.setAttribute("aria-current","true"),s.setExtraBounds("clash",new ie(v.clone(),v.clone()))}function g(M){let E=_l("ioviewer-row ioviewer-clash",String(M.name??""));E.setAttribute("title",`${M.name??""}: ${M.element1Name??""} \u2014 ${M.element2Name??""}`);let b=Cy.includes(M.status),v=tt("span","ioviewer-clash-status",b?st(`clash.${M.status}`):String(M.status??""));b&&(v.dataset.status=M.status);let S=typeof M.distance=="number"?Ch(M.distance):"";return E.append(v,tt("span","ioviewer-clash-distance",S)),M===d&&(h=E,E.setAttribute("aria-current","true")),E.addEventListener("click",()=>p(M,E)),E}function _(M,E){let b=tt("div","ioviewer-clash-test"),v=tt("button","ioviewer-row ioviewer-clash-header");v.type="button",v.setAttribute("aria-expanded","true");let S=`${M.name??""} (${M.clashes.length})`;v.setAttribute("title",S),v.insertAdjacentHTML("afterbegin",Zt.chevron),v.append(tt("span","ioviewer-row-name",S));let A=tt("div","ioviewer-clash-list");return A.style.height=`${Math.max(0,M.clashes.length*Lh-1)}px`,v.addEventListener("click",()=>{A.hidden=!A.hidden,v.setAttribute("aria-expanded",String(!A.hidden)),E()}),b.append(v,A),{box:b,list:A,clashes:M.clashes,rows:new Map}}function m({list:M,clashes:E,rows:b},{start:v,end:S}){for(let[x,T]of b)(x=S)&&(T.remove(),b.delete(x));let A=null;for(let x=S-1;x>=v;x--){let T=b.get(x);T||(T=g(E[x]),T.style.top=`${x*Lh}px`,M.insertBefore(T,A),b.set(x,T)),A=T}}function f(M){if(!t.length)return;M.classList.add("ioviewer-clashes-body");let E=t.map(v=>_(v,b));for(let v of E)M.append(v.box);function b(){let v=M.scrollTop,S=M.clientHeight,A=E.map(({list:x,clashes:T})=>S&&!x.hidden?yh(v-x.offsetTop,Lh,S,T.length,Iy):{start:0,end:0});E.forEach((x,T)=>m(x,A[T]))}M.addEventListener("scroll",b),M.addEventListener("focusin",b),new ResizeObserver(b).observe(M)}return i.registerPanel("clashes",{icon:Zt.clashes,title:st("panel.clashes"),visible:t.length>0,render:f,onClose:()=>o.visible&&u()}),{group:o}}var Ny=["construct","demolish","temporary"],Uy=Date.parse("0002-01-01T00:00:00Z");function fp(i){let t=typeof i=="string"?Date.parse(i):NaN;return t>=Uy?t:NaN}function pp(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=fp(o?.start),l=fp(o?.end);if(!(a<=l))continue;let c=Ny.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 mp(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 Fy=864e5,By=["1","5","15"],Oy={construct:"#22c55e",demolish:"#ef4444",temporary:"#a855f7"};function gp({root:i,shell:t,timeliner:e,elements:n,scene:s}){let r=pp(e,n);if(r.tasks.length===0)return t.registerPanel("timeliner",{icon:Zt.timeliner,title:st("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,p=new Set,g=new Map,_=tt("div","ioviewer-player ioviewer-floating");_.setAttribute("role","group"),_.setAttribute("aria-label",st("player.title")),_.hidden=!0;let m=Ke("ioviewer-icon-button ioviewer-player-play",Zt.play,st("player.play"));m.addEventListener("click",()=>h?N():L());let f=tt("output","ioviewer-player-date"),M=tt("input","ioviewer-player-slider");Object.assign(M,{type:"range",min:String(r.start),max:String(r.end),step:"any"}),M.setAttribute("aria-label",st("player.date")),M.addEventListener("input",()=>A(Number(M.value)));let E=Ur(st("player.speed"),By.map(C=>[C,`${C}\xD7`]),C=>{c=Number(C),E.update(C)});E.update(String(c));let b=Ke("ioviewer-panel-close",Zt.close,st("close"));b.addEventListener("click",T),_.append(m,f,M,E.element,b),i.append(_),new ResizeObserver(()=>{let C=_.hidden?0:_.offsetHeight+8;i.style.setProperty("--player-space",`${C}px`)}).observe(_);function S(){let C=mp(r.tasks,l),B=[...p].filter(D=>!C.hidden.has(D)),z=[...C.hidden].filter(D=>!p.has(D));p=C.hidden;let W=[...g.keys()].filter(D=>C.active.get(D)!==g.get(D)),F=new Map;for(let[D,X]of C.active)g.get(D)!==X&&(F.has(X)||F.set(X,[]),F.get(X).push(D));g=C.active,B.length&&s.setLayerHidden("schedule",B,!1),z.length&&s.setLayerHidden("schedule",z,!0),W.length&&s.setTint(W,null);for(let[D,X]of F)s.setTint(X,Oy[D])}function A(C){l=Math.min(Math.max(C,r.start),r.end),M.value=String(l),f.textContent=a.format(l),u&&S()}function x(){u||(u=!0,_.hidden=!1,A(r.start))}function T(){u&&(N(),u=!1,s.setTint([...g.keys()],null),g=new Map,p=new Set,s.clearLayer("schedule"),_.hidden=!0)}function R(C){A(l+Math.max(C-d,0)/1e3*c*Fy),d=C,l>=r.end?N():h=requestAnimationFrame(R)}function L(){x(),!h&&(l>=r.end&&A(r.start),d=performance.now(),h=requestAnimationFrame(R),U())}function N(){cancelAnimationFrame(h),h=0,U()}function U(){let C=st(h?"player.pause":"player.play");m.innerHTML=h?Zt.pause:Zt.play,m.title=C,m.setAttribute("aria-label",C)}return t.registerPanel("timeliner",{icon:Zt.timeliner,title:st("panel.timeliner"),render:C=>{let B=tt("button","ioviewer-text-button ioviewer-player-open");B.type="button",B.insertAdjacentHTML("afterbegin",Zt.play),B.append(tt("span","",st("player.play"))),B.addEventListener("click",L);let z=tt("div","ioviewer-row-list");for(let W of r.tasks){let F=String(W.name??""),D=tt("div","ioviewer-row ioviewer-task");D.dataset.type=W.type,D.setAttribute("title",`${F} \xB7 ${st(`task.${W.type}`)}`);let X=`${o.format(W.start)} \u2013 ${o.format(W.end)}`;D.append(tt("span","ioviewer-row-name",F),tt("span","ioviewer-task-dates",X)),z.append(D)}C.append(B,z)}}),{open:x,close:T,play:L,pause:N,setDate:A,get date(){return l},get isOpen(){return u}}}function _p({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:tt("input")})),r=()=>n.replaceLayerHidden("links",s.flatMap(({input:o,members:a})=>o.checked?[]:a));return i.registerPanel("links",{icon:Zt.links,title:st("panel.links"),visible:s.length>0,render:o=>{let a=tt("div","ioviewer-row-list");for(let l of s){let c=String(l.file.name??""),h=tt("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,tt("span","ioviewer-row-name",c),tt("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()}}document.documentElement.lang=Ls;var Hn=document.getElementById("ioviewer-canvas"),Dh=window.IOVIEWER_TEST??{},Fr=Dh.startup;function Br(i){let t=document.getElementById("ioviewer-message");t.textContent=i,t.hidden=!1}try{let i=jc(document,Fr);i.title&&(document.title=i.title);let t=Hn.getContext("webgl2",{antialias:!0,stencil:!0});t?zy(Xd(document,Fr,i),t):Br(st("noWebGL"))}catch(i){if(!(i instanceof re))throw i;Br(st("badData"))}function zy(i,t){let e=new As({canvas:Hn,context:t,antialias:!0,stencil:!0,logarithmicDepthBuffer:Af(i.meta)});e.setPixelRatio(window.devicePixelRatio),e.autoClearStencil=!1,e.localClippingEnabled=!0;let n=new Ai,s="#1f2228",r=new Ft(s);e.setClearColor(r,1);let o=new rr("#ffffff","#8a8f99",1.6);o.position.set(0,0,1),n.add(o);let a=new $e(45,1,.1,1e3);a.up.set(0,0,1),a.position.set(1,-1,.8);let l=new ar("#ffffff",1.4);l.position.set(.3,.6,0),a.add(l,l.target),l.target.position.set(0,0,-1),n.add(a),Fr?.("sceneStart");let c=M();Fr?.("sceneEnd"),i.releaseBinary();let h=new nl(c,x,Math.min(c.totalCost,2e7));n.add(c.root);let d=new ll(c,c.visibleBox(),i.meta.sections),u=t.getContextAttributes()?.stencil===!0,p,g=new ul(d,Hn);n.add(g.group);let _=document.getElementById("ioviewer-ui"),m=new fl(_),f=new gl(_,i.meta.grids??[]);n.add(m.group,f.group);function M(){try{let et=new Cr(i,{...Dh,maxTextureSize:e.capabilities.maxTextureSize});return et.totalCost===0&&Br(st("noGeometry")),et}catch(et){if(!(et instanceof Rr))throw et;Br(st("tooLarge").replace("{count}",et.count).replace("{limit}",et.limit));let V=ut=>({o:0,n:0,t:ut}),j={count:0,geometry:V("u32"),material:V("u32"),element:V("i32"),matrix:V("f32")};return new Cr({...i,meta:{...i.meta,instances:j}})}}let E=!1;Hn.addEventListener("webglcontextlost",()=>{E=!0,Br(st("contextLost"))});let b,v=new Promise(et=>b=et),S=Fr,A=!1;function x(){A||E||(A=!0,h.requested(performance.now()),requestAnimationFrame(()=>{if(A=!1,E)return;let et=Hn.getBoundingClientRect();z.camera.updateMatrixWorld(),g.update(z.camera),m.update(z.camera,et),f.update(z.camera,et),h.begin(z.camera,et.height,performance.now()),S?.("renderStart"),d.fill&&u?(p??(p=new dl(c,d,i)),p.render(e,n,z.camera)):e.render(n,z.camera),S&&(S("renderEnd"),S=void 0),h.end(performance.now()),ct.update(),b()}))}c.root.addEventListener("change",x),d.addEventListener("change",x),g.addEventListener("change",x),m.addEventListener("change",x),m.addEventListener("previewchange",x),f.addEventListener("change",x);let T=new tl(e,c,a,{pickFloat:Dh.pickFloat}),R=new ml(T,d,i),L=0,N=null;function U(){cancelAnimationFrame(L),L=0,N=null,m.setPreview(null)}function C(){L=0,N&&m.setPreview(R.target(...N))}function B(){N&&(m.setPreview(null),cancelAnimationFrame(L),L=requestAnimationFrame(()=>{L=requestAnimationFrame(C)}))}Hn.addEventListener("pointermove",et=>{if(!m.active||et.buttons)return U();N=[et.clientX,et.clientY],L||(L=requestAnimationFrame(C))});for(let et of["pointerdown","pointerleave","pointercancel","webglcontextlost"])Hn.addEventListener(et,U);c.root.addEventListener("change",et=>{et.detail.kind!=="appearance"&&B()});let z=new Ja(a,Hn,{pick:(et,V)=>T.pick(et,V)?.point??null,visibleBox:()=>c.visibleBox()});z.addEventListener("change",()=>{T.camera=z.camera,B(),x()}),c.root.addEventListener("change",et=>{et.detail.kind==="visibility"&&(z.invalidateBounds(),z.resize())});let W=new sl;W.addEventListener("change",()=>c.setHighlighted([...W.values()]));let F=Jf({root:_,data:i,scene:c,controls:z,picker:T,selection:W,measure:m});rp({root:_,...F,sections:d,selection:W,canFill:u});let{meta:D}=i,X=_p({...F,files:D.linkedFiles??[],elements:D.elements,scene:c});hp({...F,controls:z,scene:c,sections:d,selection:W,restoreLinkedModels:X,views:D.viewpoints??[],bcfTopics:D.bcfTopics??[]});let Z=dp({...F,tests:D.clashTests??[],elements:D.elements,scene:c,controls:z,selection:W});n.add(Z.group);let G=gp({root:_,...F,timeliner:D.timeliner,elements:D.elements,scene:c}),Q=et=>{e.setClearColor(r.set(et),1);let{r:V,g:j,b:ut}=r,bt=.2126*V+.7152*j+.0722*ut>Math.sqrt(.0525)-.05?"#000":"#fff";_.style.setProperty("--viewport-text",et===s?"":bt),x()};for(let et of cp({root:_,toolbar:F.toolbar,scene:c,meta:D,grids:f,initialBackground:s,setBackground:Q}))F.onEscape(et.close);F.toolbar.setHandler("distance",()=>{U(),m.setActive(!m.active),m.active||R.release(),F.toolbar.setActive("distance",m.active)}),F.toolbar.setActive("distance",!1),F.onEscape(()=>(U(),m.clear()));let lt=()=>{z.setExtraBounds("grids",f.visible?f.box:null),z.setExtraBounds("measure",m.box)};f.addEventListener("change",lt),m.addEventListener("change",lt),lt(),z.addEventListener("click",et=>{let{x:V,y:j,ctrl:ut,shift:Lt}=et.detail;if(m.active){let ve=R.target(V,j);ve&&m.add(ve.point);return}let Bt=T.pick(V,j)?.element??-1;ut?Bt>=0&&W.toggle(Bt):Bt>=0?W.set([Bt]):Lt||W.clear()}),z.addEventListener("boxselect",et=>{if(m.active)return;let{rect:V,mode:j,ctrl:ut,shift:Lt}=et.detail;if(V.width<4||V.height<4){!ut&&!Lt&&W.clear();return}let bt=new ie,Bt=Uf(V,j,Ff(c,z.camera,Hn.getBoundingClientRect())),ve=d.clipping(),Vt=Bt.filter(Jt=>!d.isCut(c.elementBox(Jt,bt),ve));W.set(ut?[...W.values(),...Vt]:Vt)}),window.addEventListener("resize",()=>{e.setSize(window.innerWidth,window.innerHeight,!1),z.resize()}),e.setSize(window.innerWidth,window.innerHeight,!1),z.resize(),z.fitBox(c.visibleBox(),!1);let ct=new Qa(document.getElementById("ioviewer-ui"),a,z);window.addEventListener("pointerdown",et=>{(et.target===Hn||ct.element.contains(et.target))&&document.activeElement?.blur()},!0),window.__ioviewer={scene:c,motionDetail:h,controls:z,picker:T,selection:W,ui:F,viewCube:ct,sections:d,sectionGizmo:g,measure:m,measureSnap:R,grids:f,clashes:Z,timeliner:G,ready:v,get camera(){return z.camera}}}})(); +}`,side:t,stencilZPass:n,stencilWrite:!0,clipping:!0,clippingPlanes:[e],colorWrite:!1,depthTest:!1,depthWrite:!1});return s.index0AttributeName="q",s}var fl=class{constructor(e,t,n,s){this.model=e,this.sections=t,this.data=n,this.drawStencils=s,this._farSide=new _t,this._surface=new xt(new yn(1,1),new tn({color:Ey,side:It,forceSinglePass:!0,stencilWrite:!0,stencilFunc:Sc,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(p))return;let _=u?-p.normal.dot(u):p.distanceToPoint(n.position);if(_===0)return;if(this._farSide.copy(p),_>0&&this._farSide.negate(),e.clearStencil(),this.drawStencils)this.drawStencils(e,n,this._farSide);else for(let f of this._stencils)r.withMaterial(f,()=>e.render(r.root,n),{section:!0});this._surface.quaternion.setFromUnitVectors(wy,p.normal);let m=ll(s.modelBox,this._surface.quaternion,p.coplanarPoint(new I));this._surface.position.copy(m.center),this._surface.scale.set(m.width,m.height,1),h.clippingPlanes=l.filter((f,M)=>M!==g),e.render(this._surface,n)}),e.render(t,n)}finally{e.autoClear=d}}};function Fr(i,e,t){let n=ee("div","ioviewer-segmented");n.setAttribute("role","group"),n.setAttribute("aria-label",i);let s=e.map(([o,a])=>{let l=ee("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 Ph(i,e){let t=ee("label","ioviewer-check"),n=ee("input");return n.type="checkbox",n.addEventListener("change",()=>e(n.checked)),t.append(n,ee("span","",i)),{element:t,input:n}}function Ry(i,e){let t=ee("li","ioviewer-section-plane");t.addEventListener("pointerdown",()=>i.active!==e&&i.setActivePlane(e));let n=ee("span","ioviewer-section-name"),s=Kt("ioviewer-icon-button",Ze.flip,se("sections.flip"));s.addEventListener("click",()=>i.updatePlane(e,{flipped:!i.planes[e].flipped}));let r=Ph(se("sections.enabled"),h=>i.updatePlane(e,{enabled:h})),o=Kt("ioviewer-icon-button",Ze.remove,se("sections.delete"));o.addEventListener("click",()=>i.removePlane(e));let a=ee("input","ioviewer-section-slider");a.type="range",a.step="any",a.setAttribute("aria-label",se("sections.position")),a.addEventListener("input",()=>i.updatePlane(e,{offset:Number(a.value)}));let l=ee("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?` (${se("sections.rotated")})`:"",u=h.axis==="custom"?se("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 p=i.extent(e);a.min=String(Math.min(-p,h.offset)),a.max=String(Math.max(p,h.offset)),a.value=String(h.offset)}}}function _p({root:i,shell:e,toolbar:t,contextMenu:n,sections:s,selection:r,canFill:o}){let a="z",l=()=>{s.addPlane(a)===null&&(s.setMode("planes"),Fs(i,se("sections.maxPlanes")))},c=()=>[...r.values()],h=()=>s.fitBoxToElements(c()),d=Fr(se("sections.mode"),[["planes",se("sections.planes")],["box",se("sections.box")],["off",se("sections.off")]],C=>s.setMode(C)),u=Fr(se("sections.axis"),["x","y","z"].map(C=>[C,C.toUpperCase()]),C=>u.update(a=C));u.update(a);let p=ee("button","ioviewer-text-button",se("sections.addPlane"));p.type="button",p.addEventListener("click",l);let g=ee("ul","ioviewer-section-list"),_=ee("div","ioviewer-section-empty",se("sections.noPlanes")),m=ee("div","ioviewer-section-block"),f=ee("div","ioviewer-section-row");f.append(ee("span","",se("sections.axis")),u.element,p),m.append(f,g,_);let M=Fr(se("sections.box"),[["keepInside",se("sections.keepInside")],["cutInside",se("sections.cutInside")]],C=>s.setBoxMode(C)),E=ee("button","ioviewer-text-button",se("sections.fitSelection"));E.type="button",E.addEventListener("click",h);let b=ee("input","ioviewer-section-slider");Object.assign(b,{type:"range",min:"-180",max:"180",step:"1"}),b.addEventListener("input",()=>s.setBoxYaw(Number(b.value)*Math.PI/180));let v=ee("span");v.setAttribute("aria-hidden","true");let S=ee("label","ioviewer-section-row");S.append(ee("span","",se("sections.boxYaw")),b,v);let A=ee("div","ioviewer-section-block");A.append(M.element,S,E);let x=Ph(se("sections.showGizmo"),C=>s.setGizmoVisible(C)),T=Ph(se("sections.fill"),C=>s.setFill(C));o||(T.element.title=se("sections.fillUnavailable"));let R=[],L=()=>{d.update(s.mode),m.hidden=s.mode!=="planes",A.hidden=s.mode!=="box",p.disabled=s.planes.length>=Ur,R.length!==s.planes.length&&(R=s.planes.map((B,z)=>Ry(s,z)),g.replaceChildren(...R.map(B=>B.element))),R.forEach(B=>B.update()),_.hidden=R.length>0,M.update(s.boxMode),b.value=String(Math.round(s.boxYaw*180/Math.PI)),v.textContent=`${b.value}\xB0`,b.setAttribute("aria-valuetext",v.textContent),x.input.checked=s.gizmoVisible,T.input.checked=s.fill;let C=s.mode==="box"||s.mode==="planes"&&s.planes.some(B=>B.enabled);T.input.disabled=!o||!C,t.setActive("plane",s.mode==="planes"),t.setActive("box",s.mode==="box")},N=()=>E.disabled=r.size===0;if(e.registerPanel("sections",{icon:Ze.sections,title:se("panel.sections"),visible:!s.modelBox.isEmpty(),render:C=>C.append(d.element,m,A,T.element,x.element)}),s.addEventListener("change",L),r.addEventListener("change",N),L(),N(),s.modelBox.isEmpty())return;let U=()=>e.openPanel("sections");t.setHandler("plane",()=>{l(),U()}),t.setHandler("box",()=>{(s.mode==="box"||r.size&&h()||s.fitBoxToShown())&&U()}),t.setHandler("resetSections",()=>s.reset()),n.setItem("sectionBox",{handler:C=>{s.fitBoxToElements(r.has(C)?c():[C]),U()}}),n.setItem("resetSections",{handler:()=>s.reset()})}var Cy="#facc15",Iy=9;function Lh(i,e=vi){return`${new Intl.NumberFormat(e,{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!1}).format(i)} ${se("unit.m",e)}`}var pl=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 lt;t.setAttribute("position",new St(new Float32Array(6),3));let n={color:Cy,depthTest:!1,depthWrite:!1,transparent:!0};this._line=new Ii(t,new an(n)),this._markers=new Pi(t,new li({...n,size:Iy,sizeAttenuation:!1}));for(let s of[this._line,this._markers])s.frustumCulled=!1,s.renderOrder=1001,this.group.add(s);this.label=ee("div","ioviewer-measure-label"),this.label.hidden=!0,this._previewMarker=ee("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 it().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&&Lr(this._previewMarker,this.preview.point,e,t),this.distance!==null&&Lr(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=Lh(this.distance)),this.dispatchEvent(new Event("change"))}};var xp=8,Py=1-1e-6,Ly=8,vp={vertex:0,midpoint:1,edge:2},Dy=2e4;function Ny(i,e){let t=new Map,n=new Uint32Array(i.length/3);for(let d=0;d0&&(_.normalize(),l(u,p,_),l(p,g,_),l(g,u,_))}let c=[],h=new Set;for(let{lo:d,hi:u,count:p,crease:g}of s.values())p!==1&&!g||(c.push(d,u),h.add(d),h.add(u));return{edges:c,vertices:h}}function ml(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 Uy(i,e,t,n,s,r){let o=[0,1];if(!ml(o,t.w+t.z,n.w+n.z)||!ml(o,t.w-t.z,n.w-n.z))return[];if(!r||!s.length)return s.every(c=>ml(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)&&ml(a,-h,-d)}))return[o];let l=[];return o[0]0))return null;let m=ct.clamp(((r-c)*p+(o-h)*g)/_,0,1);return t+(n-t)*(m*a.w/((1-m)*l.w+m*a.w))}var gl=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=tf({view:this.data.readView},n);t={positions:s,...Ny(s,this.data.readView(n.indices))}}return this.cache.set(e,t),this.cache.size>Ly&&this.cache.delete(this.cache.keys().next().value),t}target(e,t){let n=this.picker.measureTile(e,t,xp+1);if(!n)return null;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,p=null;function g(v,S,A,x){if(p&&vp[v]>vp[p.kind]||A.w<=0||A.z<-A.w||A.z>A.w)return;let[T,R]=Dh(A,s);if(!(T>=0&&R>=0&&Txp**2||p?.kind===v&&L>=p.distance||v!=="edge"&&cp(S,c,h))return;let N=-(u[2]*S.x+u[6]*S.y+u[10]*S.z+u[14]);N-n.depthAt(T,R,x)>2*wn+Math.abs(N)*2**-21||(p={kind:v,distance:L,point:S.clone()})}let _=Dy*3,m=new ke,f=new I,M=new at,{geometry:E,matrix:b}=this.data.meta.instances;for(let v of n.slots){let S=l.slotInstance(v),[A]=this.data.readView({t:"u32",o:E.o+S*4,n:1}),x=this.data.meta.geometries[A],T=Math.max(x.indices.n,x.positions.n/3);if(T>_)continue;_-=T;let{positions:R,vertices:L,edges:N}=this._geometry(A),U=this.data.readView({t:"f32",o:b.o+S*48,n:12});m.set(U[0],U[3],U[6],U[9],U[1],U[4],U[7],U[10],U[2],U[5],U[8],U[11],0,0,0,1);let C=new Map;for(let B of L){let z=new I().fromArray(R,B*3).applyMatrix4(m),W=new at(z.x,z.y,z.z,1).applyMatrix4(d);C.set(B,[z,W]),g("vertex",z,W,v)}if(p?.kind!=="vertex")for(let B=0;Br.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)Lr(n,s,e,t)}};var By=8,yp=4;function Nh(i,e,t,n="dialog"){let s=ee("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(),ja(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(yp,Math.min(l.left+l.width/2-c/2,innerWidth-c-yp))}px`,s.style.bottom=`${innerHeight-l.top+By}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 Oy(i){return i?.initialWireframe?"wireframe":i?.initialWhiteMode?"white":"materials"}function bp({root:i,toolbar:e,scene:t,meta:n,grids:s,initialBackground:r,setBackground:o}){let a=x=>e.element.querySelector(`[data-tool="${x}"]`),l=a("displayMode"),c=Nh(i,l,se("group.display"));c.element.classList.add("ioviewer-display-modes");let h=ee("div");h.setAttribute("role","menu"),h.setAttribute("aria-label",se("tool.displayMode")),c.element.append(h);let d=(n.textures??[]).length>0,u=fh.map(x=>{let T=ee("button","ioviewer-menu-item",se(`display.${x}`));return T.type="button",T.dataset.mode=x,T.setAttribute("role","menuitemradio"),T.disabled=x==="textures"&&!d,T.addEventListener("click",()=>{p(x),c.close(),l.focus()}),h.append(T),T}),p=x=>{t.setDisplayMode(x);for(let T of u)T.setAttribute("aria-checked",String(T.dataset.mode===x))};p(Oy(n.options)),e.setHandler("displayMode",()=>{c.toggle(),c.isOpen&&h.querySelector('[aria-checked="true"]')?.focus()});let g=ee("div","ioviewer-background-setting"),_=ee("label","",se("display.background")),m=ee("input");Object.assign(m,{type:"color",value:r}),_.append(m);let f=ee("button","ioviewer-text-button",se("display.backgroundReset"));f.type="button",f.disabled=!0;let M=()=>{o(m.value),f.disabled=m.value===r};m.addEventListener("input",M),f.addEventListener("click",()=>{m.value=r,m.focus(),M()}),g.append(_,f),c.element.append(g),e.setActive("grids",s.visible),s.count>0&&e.setHandler("grids",()=>{s.setVisible(!s.visible),e.setActive("grids",s.visible)});let E=Nh(i,a("opacity"),se("tool.opacity"));E.element.classList.add("ioviewer-opacity");let b=ee("input","ioviewer-opacity-slider");Object.assign(b,{type:"range",min:"10",max:"100",step:"1",value:"100"}),b.setAttribute("aria-label",se("opacity.label"));let v=ee("output","ioviewer-opacity-value"),S=()=>v.textContent=se("opacity.value").replace("{value}",b.value);b.addEventListener("input",()=>{t.setOpacity(Number(b.value)/100),S()}),S();let A=ee("div","ioviewer-opacity-head");return A.append(ee("span","",se("opacity.label")),v),E.element.append(A,b),e.setHandler("opacity",E.toggle),[c,E]}var zy=3e3;function xl(i,e){let t=ee("button",i);return t.type="button",t.setAttribute("title",e),t.append(ee("span","ioviewer-row-name",e)),t}function Mp({shell:i,toolbar:e,controls:t,scene:n,sections:s,selection:r,restoreLinkedModels:o,views:a,bcfTopics:l}){let c=null,h=ee("button","ioviewer-text-button ioviewer-tour");h.type="button";function d(E){E.sections!=null&&s.restore(E.sections),E.hiddenElements!=null&&n.setHiddenElements(E.hiddenElements),E.visibleElements!=null&&n.isolate(E.visibleElements),E.hiddenModelKeys!=null&&o(E.hiddenModelKeys),E.selectedElements!=null&&r.set(E.selectedElements);let b=E.camera.projection==="orthographic";t.setProjection(b?"orthographic":"perspective"),e.setActive("projection",b),t.restoreViewCamera(E.camera)}function u(){d(a[c.next]),c.next=(c.next+1)%a.length;let E=()=>{t.animating?c.frame=requestAnimationFrame(E):c.timer=setTimeout(u,zy)};c.frame=requestAnimationFrame(E)}let p=E=>h.contains(E.target),g=E=>!p(E)&&m(),_=E=>{p(E)&&(E.key==="Enter"||E.key===" ")||(E.key==="Escape"&&(E.preventDefault(),E.stopPropagation()),m())};function m(){c&&(cancelAnimationFrame(c.frame),clearTimeout(c.timer),c=null,window.removeEventListener("pointerdown",g,!0),window.removeEventListener("wheel",m,!0),window.removeEventListener("keydown",_,!0),M())}function f(){c={next:0,frame:0,timer:0},window.addEventListener("pointerdown",g,!0),window.addEventListener("wheel",m,!0),window.addEventListener("keydown",_,!0),M(),u()}function M(){let E=se(c?"views.stop":"views.tour");h.replaceChildren(),h.insertAdjacentHTML("afterbegin",c?Ze.pause:Ze.play),h.append(ee("span","",E)),h.setAttribute("aria-pressed",String(!!c))}h.addEventListener("click",()=>c?m():f()),M(),i.registerPanel("views",{icon:Ze.views,title:se("panel.views"),visible:a.length>0,render:E=>{let b=ee("div","ioviewer-row-list");for(let v of a){let S=xl("ioviewer-row ioviewer-view",String(v.name??""));S.addEventListener("click",()=>d(v)),b.append(S)}E.append(h,b)}}),i.registerPanel("bcf",{icon:Ze.bcf,title:se("panel.bcf"),visible:l.length>0,render:E=>{let b=ee("div","ioviewer-row-list");for(let v of l){let S=ee("details","ioviewer-bcf-topic");S.append(ee("summary","",v.title)),v.status&&S.append(ee("p","ioviewer-bcf-status",v.status)),v.description&&S.append(ee("p","ioviewer-bcf-description",v.description)),v.viewpoints.length||S.append(ee("p","ioviewer-bcf-status",se("bcf.noView"))),v.viewpoints.forEach((A,x)=>{let T=se("bcf.viewpoint").replace("{index}",String(x+1)),R=xl("ioviewer-row ioviewer-view",T);if(R.addEventListener("click",()=>d(A)),S.append(R),A.missingComponents||A.ambiguousComponents){let L=se("bcf.components").replace("{missing}",String(A.missingComponents)).replace("{ambiguous}",String(A.ambiguousComponents));S.append(ee("p","ioviewer-bcf-status",L))}}),b.append(S)}E.append(b)}})}function Sp(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):ky(e,s);r>=0&&!t.includes(r)&&t.push(r)}return t}function ky(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 Vy=["New","Active","Reviewed","Approved","Resolved"],Uh=27,Hy=8,Gy=14,Wy=2,Xy=new I(1,-1,.8).normalize();function wp({shell:i,tests:e,elements:t,scene:n,controls:s,selection:r}){let o=new Rt;o.name="clash-marker";let a=new lt;a.setAttribute("position",new St(new Float32Array(3),3));let l={color:"#ef4444",depthTest:!1,depthWrite:!1,transparent:!0},c=new Pi(a,new li({...l,size:Gy,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 p(M,E){let b=Sp(M,t);b.length?r.set(b):r.clear();let v=new I(...M.point),S=0;for(let T of b){let R=n.elementBox(T);R.isEmpty()||(S=Math.max(S,...R.getSize(new I).toArray()))}let A=s.camera.position.clone().sub(s.target);A.lengthSq()<1e-12&&A.copy(Xy);let x=Math.max(3*S,Wy);s.animateTo({position:A.normalize().multiplyScalar(x).add(v),target:v}),a.attributes.position.setXYZ(0,v.x,v.y,v.z),a.attributes.position.needsUpdate=!0,o.visible=!0,h?.removeAttribute("aria-current"),h=E,d=M,E.setAttribute("aria-current","true"),s.setExtraBounds("clash",new it(v.clone(),v.clone()))}function g(M){let E=xl("ioviewer-row ioviewer-clash",String(M.name??""));E.setAttribute("title",`${M.name??""}: ${M.element1Name??""} \u2014 ${M.element2Name??""}`);let b=Vy.includes(M.status),v=ee("span","ioviewer-clash-status",b?se(`clash.${M.status}`):String(M.status??""));b&&(v.dataset.status=M.status);let S=typeof M.distance=="number"?Lh(M.distance):"";return E.append(v,ee("span","ioviewer-clash-distance",S)),M===d&&(h=E,E.setAttribute("aria-current","true")),E.addEventListener("click",()=>p(M,E)),E}function _(M,E){let b=ee("div","ioviewer-clash-test"),v=ee("button","ioviewer-row ioviewer-clash-header");v.type="button",v.setAttribute("aria-expanded","true");let S=`${M.name??""} (${M.clashes.length})`;v.setAttribute("title",S),v.insertAdjacentHTML("afterbegin",Ze.chevron),v.append(ee("span","ioviewer-row-name",S));let A=ee("div","ioviewer-clash-list");return A.style.height=`${Math.max(0,M.clashes.length*Uh-1)}px`,v.addEventListener("click",()=>{A.hidden=!A.hidden,v.setAttribute("aria-expanded",String(!A.hidden)),E()}),b.append(v,A),{box:b,list:A,clashes:M.clashes,rows:new Map}}function m({list:M,clashes:E,rows:b},{start:v,end:S}){for(let[x,T]of b)(x=S)&&(T.remove(),b.delete(x));let A=null;for(let x=S-1;x>=v;x--){let T=b.get(x);T||(T=g(E[x]),T.style.top=`${x*Uh}px`,M.insertBefore(T,A),b.set(x,T)),A=T}}function f(M){if(!e.length)return;M.classList.add("ioviewer-clashes-body");let E=e.map(v=>_(v,b));for(let v of E)M.append(v.box);function b(){let v=M.scrollTop,S=M.clientHeight,A=E.map(({list:x,clashes:T})=>S&&!x.hidden?Sh(v-x.offsetTop,Uh,S,T.length,Hy):{start:0,end:0});E.forEach((x,T)=>m(x,A[T]))}M.addEventListener("scroll",b),M.addEventListener("focusin",b),new ResizeObserver(b).observe(M)}return i.registerPanel("clashes",{icon:Ze.clashes,title:se("panel.clashes"),visible:e.length>0,render:f,onClose:()=>o.visible&&u()}),{group:o}}var qy=["construct","demolish","temporary"],Yy=Date.parse("0002-01-01T00:00:00Z");function Ep(i){let e=typeof i=="string"?Date.parse(i):NaN;return e>=Yy?e:NaN}function Tp(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=Ep(o?.start),l=Ep(o?.end);if(!(a<=l))continue;let c=qy.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 Ap(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 $y=864e5,Zy=["1","5","15"],Jy={construct:"#22c55e",demolish:"#ef4444",temporary:"#a855f7"};function Rp({root:i,shell:e,timeliner:t,elements:n,scene:s}){let r=Tp(t,n);if(r.tasks.length===0)return e.registerPanel("timeliner",{icon:Ze.timeliner,title:se("panel.timeliner"),visible:!1,render:()=>{}}),null;let o=new Intl.DateTimeFormat(vi,{dateStyle:"short",timeZone:"UTC"}),a=new Intl.DateTimeFormat(vi,{dateStyle:"medium",timeZone:"UTC"}),l=r.start,c=1,h=0,d=0,u=!1,p=new Set,g=new Map,_=ee("div","ioviewer-player ioviewer-floating");_.setAttribute("role","group"),_.setAttribute("aria-label",se("player.title")),_.hidden=!0;let m=Kt("ioviewer-icon-button ioviewer-player-play",Ze.play,se("player.play"));m.addEventListener("click",()=>h?N():L());let f=ee("output","ioviewer-player-date"),M=ee("input","ioviewer-player-slider");Object.assign(M,{type:"range",min:String(r.start),max:String(r.end),step:"any"}),M.setAttribute("aria-label",se("player.date")),M.addEventListener("input",()=>A(Number(M.value)));let E=Fr(se("player.speed"),Zy.map(C=>[C,`${C}\xD7`]),C=>{c=Number(C),E.update(C)});E.update(String(c));let b=Kt("ioviewer-panel-close",Ze.close,se("close"));b.addEventListener("click",T),_.append(m,f,M,E.element,b),i.append(_),new ResizeObserver(()=>{let C=_.hidden?0:_.offsetHeight+8;i.style.setProperty("--player-space",`${C}px`)}).observe(_);function S(){let C=Ap(r.tasks,l),B=[...p].filter(D=>!C.hidden.has(D)),z=[...C.hidden].filter(D=>!p.has(D));p=C.hidden;let W=[...g.keys()].filter(D=>C.active.get(D)!==g.get(D)),F=new Map;for(let[D,X]of C.active)g.get(D)!==X&&(F.has(X)||F.set(X,[]),F.get(X).push(D));g=C.active,B.length&&s.setLayerHidden("schedule",B,!1),z.length&&s.setLayerHidden("schedule",z,!0),W.length&&s.setTint(W,null);for(let[D,X]of F)s.setTint(X,Jy[D])}function A(C){l=Math.min(Math.max(C,r.start),r.end),M.value=String(l),f.textContent=a.format(l),u&&S()}function x(){u||(u=!0,_.hidden=!1,A(r.start))}function T(){u&&(N(),u=!1,s.setTint([...g.keys()],null),g=new Map,p=new Set,s.clearLayer("schedule"),_.hidden=!0)}function R(C){A(l+Math.max(C-d,0)/1e3*c*$y),d=C,l>=r.end?N():h=requestAnimationFrame(R)}function L(){x(),!h&&(l>=r.end&&A(r.start),d=performance.now(),h=requestAnimationFrame(R),U())}function N(){cancelAnimationFrame(h),h=0,U()}function U(){let C=se(h?"player.pause":"player.play");m.innerHTML=h?Ze.pause:Ze.play,m.title=C,m.setAttribute("aria-label",C)}return e.registerPanel("timeliner",{icon:Ze.timeliner,title:se("panel.timeliner"),render:C=>{let B=ee("button","ioviewer-text-button ioviewer-player-open");B.type="button",B.insertAdjacentHTML("afterbegin",Ze.play),B.append(ee("span","",se("player.play"))),B.addEventListener("click",L);let z=ee("div","ioviewer-row-list");for(let W of r.tasks){let F=String(W.name??""),D=ee("div","ioviewer-row ioviewer-task");D.dataset.type=W.type,D.setAttribute("title",`${F} \xB7 ${se(`task.${W.type}`)}`);let X=`${o.format(W.start)} \u2013 ${o.format(W.end)}`;D.append(ee("span","ioviewer-row-name",F),ee("span","ioviewer-task-dates",X)),z.append(D)}C.append(B,z)}}),{open:x,close:T,play:L,pause:N,setDate:A,get date(){return l},get isOpen(){return u}}}function Cp({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:ee("input")})),r=()=>n.replaceLayerHidden("links",s.flatMap(({input:o,members:a})=>o.checked?[]:a));return i.registerPanel("links",{icon:Ze.links,title:se("panel.links"),visible:s.length>0,render:o=>{let a=ee("div","ioviewer-row-list");for(let l of s){let c=String(l.file.name??""),h=ee("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,ee("span","ioviewer-row-name",c),ee("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()}}Rf();var Vn=document.getElementById("ioviewer-canvas"),Fh=window.IOVIEWER_TEST??{},Br=Fh.startup;function Or(i){let e=document.getElementById("ioviewer-message");e.textContent=i,e.hidden=!1}try{let i=Qc(document,Br);i.title&&(document.title=i.title);let e=Vn.getContext("webgl2",{antialias:!0,stencil:!0});e?Ky($d(document,Br,i),e):Or(se("noWebGL"))}catch(i){if(!(i instanceof rt))throw i;Or(se("badData"))}function Ky(i,e){let t=new Rs({canvas:Vn,context:e,antialias:!0,stencil:!0,logarithmicDepthBuffer:zf(i.meta)});t.setPixelRatio(window.devicePixelRatio),t.autoClearStencil=!1,t.localClippingEnabled=!0;let n=new Ri,s="#1f2228",r=new Fe(s);t.setClearColor(r,1);let o=new or("#ffffff","#8a8f99",1.6);o.position.set(0,0,1),n.add(o);let a=new $t(45,1,.1,1e3);a.up.set(0,0,1),a.position.set(1,-1,.8);let l=new lr("#ffffff",1.4);l.position.set(.3,.6,0),a.add(l,l.target),l.target.position.set(0,0,-1),n.add(a),Br?.("sceneStart");let c=M();Br?.("sceneEnd"),i.releaseBinary();let h=new il(c,x,Math.min(c.totalCost,2e7));n.add(c.root);let d=new cl(c,c.visibleBox(),i.meta.sections),u=e.getContextAttributes()?.stencil===!0,p,g=new dl(d,Vn);n.add(g.group);let _=document.getElementById("ioviewer-ui"),m=new pl(_),f=new _l(_,i.meta.grids??[]);n.add(m.group,f.group);function M(){try{let te=new Ir(i,{...Fh,maxTextureSize:t.capabilities.maxTextureSize});return te.totalCost===0&&Or(se("noGeometry")),te}catch(te){if(!(te instanceof Cr))throw te;Or(se("tooLarge").replace("{count}",te.count).replace("{limit}",te.limit));let H=ue=>({o:0,n:0,t:ue}),j={count:0,geometry:H("u32"),material:H("u32"),element:H("i32"),matrix:H("f32")};return new Ir({...i,meta:{...i.meta,instances:j}})}}let E=!1;Vn.addEventListener("webglcontextlost",()=>{E=!0,Or(se("contextLost"))});let b,v=new Promise(te=>b=te),S=Br,A=!1;function x(){A||E||(A=!0,h.requested(performance.now()),requestAnimationFrame(()=>{if(A=!1,E)return;let te=Vn.getBoundingClientRect();z.camera.updateMatrixWorld(),g.update(z.camera),m.update(z.camera,te),f.update(z.camera,te),h.begin(z.camera,te.height,performance.now()),S?.("renderStart"),d.fill&&u?(p??(p=new fl(c,d,i)),p.render(t,n,z.camera)):t.render(n,z.camera),S&&(S("renderEnd"),S=void 0),h.end(performance.now()),ce.update(),b()}))}c.root.addEventListener("change",x),d.addEventListener("change",x),g.addEventListener("change",x),m.addEventListener("change",x),m.addEventListener("previewchange",x),f.addEventListener("change",x);let T=new tl(t,c,a,{pickFloat:Fh.pickFloat}),R=new gl(T,d,i),L=0,N=null;function U(){cancelAnimationFrame(L),L=0,N=null,m.setPreview(null)}function C(){L=0,N&&m.setPreview(R.target(...N))}function B(){N&&(m.setPreview(null),cancelAnimationFrame(L),L=requestAnimationFrame(()=>{L=requestAnimationFrame(C)}))}Vn.addEventListener("pointermove",te=>{if(!m.active||te.buttons)return U();N=[te.clientX,te.clientY],L||(L=requestAnimationFrame(C))});for(let te of["pointerdown","pointerleave","pointercancel","webglcontextlost"])Vn.addEventListener(te,U);c.root.addEventListener("change",te=>{te.detail.kind!=="appearance"&&B()});let z=new Ka(a,Vn,{pick:(te,H)=>T.pick(te,H)?.point??null,visibleBox:()=>c.visibleBox()});z.addEventListener("change",()=>{T.camera=z.camera,B(),x()}),c.root.addEventListener("change",te=>{te.detail.kind==="visibility"&&(z.invalidateBounds(),z.resize())});let W=new rl;W.addEventListener("change",()=>c.setHighlighted([...W.values()]));let F=lp({root:_,data:i,scene:c,controls:z,picker:T,selection:W,measure:m});_p({root:_,...F,sections:d,selection:W,canFill:u});let{meta:D}=i,X=Cp({...F,files:D.linkedFiles??[],elements:D.elements,scene:c});Mp({...F,controls:z,scene:c,sections:d,selection:W,restoreLinkedModels:X,views:D.viewpoints??[],bcfTopics:D.bcfTopics??[]});let Z=wp({...F,tests:D.clashTests??[],elements:D.elements,scene:c,controls:z,selection:W});n.add(Z.group);let G=Rp({root:_,...F,timeliner:D.timeliner,elements:D.elements,scene:c}),Q=te=>{t.setClearColor(r.set(te),1);let{r:H,g:j,b:ue}=r,be=.2126*H+.7152*j+.0722*ue>Math.sqrt(.0525)-.05?"#000":"#fff";_.style.setProperty("--viewport-text",te===s?"":be),x()};for(let te of bp({root:_,toolbar:F.toolbar,scene:c,meta:D,grids:f,initialBackground:s,setBackground:Q}))F.onEscape(te.close);F.toolbar.setHandler("distance",()=>{U(),m.setActive(!m.active),m.active||R.release(),F.toolbar.setActive("distance",m.active)}),F.toolbar.setActive("distance",!1),F.onEscape(()=>(U(),m.clear()));let le=()=>{z.setExtraBounds("grids",f.visible?f.box:null),z.setExtraBounds("measure",m.box)};f.addEventListener("change",le),m.addEventListener("change",le),le(),z.addEventListener("click",te=>{let{x:H,y:j,ctrl:ue,shift:Le}=te.detail;if(m.active){let vt=R.target(H,j);vt&&m.add(vt.point);return}let Be=T.pick(H,j)?.element??-1;ue?Be>=0&&W.toggle(Be):Be>=0?W.set([Be]):Le||W.clear()}),z.addEventListener("boxselect",te=>{if(m.active)return;let{rect:H,mode:j,ctrl:ue,shift:Le}=te.detail;if(H.width<4||H.height<4){!ue&&!Le&&W.clear();return}let be=new it,Be=Yf(H,j,$f(c,z.camera,Vn.getBoundingClientRect())),vt=d.clipping(),He=Be.filter(Je=>!d.isCut(c.elementBox(Je,be),vt));W.set(ue?[...W.values(),...He]:He)}),window.addEventListener("resize",()=>{t.setSize(window.innerWidth,window.innerHeight,!1),z.resize()}),t.setSize(window.innerWidth,window.innerHeight,!1),z.resize(),z.fitBox(c.visibleBox(),!1);let ce=new el(document.getElementById("ioviewer-ui"),a,z);window.addEventListener("pointerdown",te=>{(te.target===Vn||ce.element.contains(te.target))&&document.activeElement?.blur()},!0),window.__ioviewer={scene:c,motionDetail:h,controls:z,picker:T,selection:W,ui:F,viewCube:ce,sections:d,sectionGizmo:g,measure:m,measureSnap:R,grids:f,clashes:Z,timeliner:G,ready:v,get camera(){return z.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 1580c1d..096c44b 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: 'Нет геометрии', @@ -124,6 +128,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', @@ -250,15 +262,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]; 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 395e984..8a696e4 100644 --- a/src/IOViewer/Viewer/src/main.js +++ b/src/IOViewer/Viewer/src/main.js @@ -1,7 +1,7 @@ import * as THREE from 'three'; import { loadModelData, ModelDataError, readModelMeta } from './data.js'; import { ModelScene, ModelTooLargeError } from './engine/modelScene.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'; @@ -22,7 +22,7 @@ import { mountClashes } from './ui/clashesPanel.js'; import { mountTimeliner } from './ui/timeliner.js'; import { mountLinks } from './ui/linksPanel.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 e84b197..37e02f1 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; @@ -393,7 +406,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; @@ -490,10 +503,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..3717997 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,23 @@ 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 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/unit/i18n.test.js b/src/IOViewer/Viewer/test/unit/i18n.test.js new file mode 100644 index 0000000..383ab53 --- /dev/null +++ b/src/IOViewer/Viewer/test/unit/i18n.test.js @@ -0,0 +1,26 @@ +import assert from 'node:assert/strict'; +import { test } from 'node:test'; +import { dictionaries } 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('each language translates the complete set of viewer strings', () => { + const keys = Object.keys(dictionaries.en).sort(); + const placeholders = value => [...value.matchAll(/\{\w+\}/g)].map(([token]) => token).sort(); + for (const locale of locales) { + assert.deepEqual(Object.keys(dictionaries[locale]).sort(), keys, locale); + for (const key of keys) { + assert(dictionaries[locale][key].trim(), `${locale} ${key}`); + assert.deepEqual(placeholders(dictionaries[locale][key]), placeholders(dictionaries.en[key]), `${locale} ${key}`); + } + } +});