vendor: 4,488 bytes, lines 1-2
1/*! (c) 2026 Parley Labs (parley.live). All rights reserved. Proprietary and confidential: copying, redistribution or reverse engineering is not permitted. */ 2const Hc=globalThis,sf=Hc.ShadowRoot&&(Hc.ShadyCSS===void 0||Hc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,f0=Symbol(),$f=new WeakMap;let e_=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==f0)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(sf&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=$f.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&$f.set(t,e))}return e}toString(){return this.cssText}};const t_=r=>new e_(typeof r=="string"?r:r+"",void 0,f0),n_=(r,e)=>{if(sf)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=Hc.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Yf=sf?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return t_(t)})(r):r;const{is:i_,defineProperty:s_,getOwnPropertyDescriptor:r_,getOwnPropertyNames:a_,getOwnPropertySymbols:o_,getPrototypeOf:c_}=Object,Bl=globalThis,jf=Bl.trustedTypes,l_=jf?jf.emptyScript:"",h_=Bl.reactiveElementPolyfillSupport,io=(r,e)=>r,el={toAttribute(r,e){switch(e){case Boolean:r=r?l_:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},rf=(r,e)=>!i_(r,e),Kf={attribute:!0,type:String,converter:el,reflect:!1,useDefault:!1,hasChanged:rf};Symbol.metadata??=Symbol("metadata"),Bl.litPropertyMetadata??=new WeakMap;let Ps=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Kf){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&s_(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=r_(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);s?.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Kf}static _$Ei(){if(this.hasOwnProperty(io("elementProperties")))return;const e=c_(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(io("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(io("properties"))){const t=this.properties,n=[...a_(t),...o_(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Yf(i))}else e!==void 0&&t.push(Yf(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return n_(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e
vendor: 6,586 bytes, line 2
2=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const s=(n.converter?.toAttribute!==void 0?n.converter:el).toAttribute(t,n.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const s=n.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:el;this._$Em=i;const o=a.fromAttribute(t,s.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(e,t,n,i=!1,s){if(e!==void 0){const a=this.constructor;if(i===!1&&(s=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??rf)(s,t)||n.useDefault&&n.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),s!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,s]of n){const{wrapped:a}=s,o=this[i];a!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,s,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Ps.elementStyles=[],Ps.shadowRootOptions={mode:"open"},Ps[io("elementProperties")]=new Map,Ps[io("finalized")]=new Map,h_?.({ReactiveElement:Ps}),(Bl.reactiveElementVersions??=[]).push("2.1.2");const u_={attribute:!0,type:String,converter:el,reflect:!1,hasChanged:rf},d_=(r=u_,e,t)=>{const{kind:n,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),n==="setter"&&((r=Object.create(r)).wrapped=!0),s.set(t.name,r),n==="accessor"){const{name:a}=t;return{set(o){const c=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,c,r,!0,o)},init(o){return o!==void 0&&this.C(a,void 0,r,o),o}}}if(n==="setter"){const{name:a}=t;return function(o){const c=this[a];e.call(this,o),this.requestUpdate(a,c,r,!0,o)}}throw Error("Unsupported decorator location: "+n)};function De(r){return(e,t)=>typeof t=="object"?d_(r,e,t):((n,i,s)=>{const a=i.hasOwnProperty(s);return i.constructor.createProperty(s,n),a?Object.getOwnPropertyDescriptor(i,s):void 0})(r,e,t)}const Dl="182",f_=0,Jf=1,p_=2,zc=1,A_=2,Xa=3,ti=0,nn=1,Vt=2,Zn=0,Qs=1,nd=2,Zf=3,ep=4,m_=5,Ns=100,g_=101,x_=102,b_=103,__=104,v_=200,E_=201,y_=202,S_=203,id=204,sd=205,C_=206,I_=207,M_=208,w_=209,T_=210,R_=211,B_=212,D_=213,L_=214,rd=0,ad=1,od=2,qr=3,cd=4,ld=5,hd=6,ud=7,p0=0,F_=1,P_=2,Hn=0,af=1,of=2,cf=3,lf=4,A0=5,hf=6,Xr=7,tp="attached",N_="detached",$r=300,us=301,Yr=302,tl=303,dd=304,Ll=306,ni=1e3,Lt=1001,Ws=1002,yt=1003,la=1004,rs=1005,We=1006,Gs=1007,gn=1008,np=1008,Le=1009,uf=1010,df=1011,fo=1012,Fl=1013,ii=1014,Nt=1015,It=1016,ff=1017,pf=1018,po=1020,Pl=35902,Nl=35899,m0=1021,Ao=1022,Tt=1023,Vi=1026,Os=1027,as=1028,Af=1029,Jn=1030,mf=1031,gf=1033,Or=33776,Hs=33777,kr=33778,so=33779,nl=35840,fd=35841,jr=35842,mo=35843,il=36196,go=37492,xo=37496,sl=37488,rl=37489,al=37490,ol=37491,zs=37808,pd=37809,Ad=37810,md=37811,Qr=37812,gd=37813,xd=37814,bd=37815,_d=37816,vd=37817,Ed=37818,yd=37819,Sd=37820,Cd=37821,Kr=36492,Id=36494,cl=36495,ll=36283,hl=36284,ul=36285,dl=36286,bo=2200,Gr=2201,fl=2202,Jr=2300,Zr=2301,Kl=2302,Lr=2400,Fr=2401,pl=2402,xf=2500,U_=2501,O_=0,g0=1,Md=2,k_=3200,x0=0,Q_=1,kn="",bt="srgb",St="srgb-linear",Al="linear",ft="srgb",er=7680,ip=519,G_=512,H_=513,z_=514,bf=515,V_=516,W_=517,_f=518,q_=519,wd=35044,sp="300 es",Ai=2e3,ml=2001;function b0(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function X_(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function _o(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function $_(){const r=_o("canvas");return r.style.display="block",r}const rp={};function gl(...r){const e="THREE."+r.shift();console.log(e,...r)}function we(...r){const e="THREE."+r.shift();console.warn(e,...r)}function Fe(...r){const e="THREE."+r.shift();console.error(e,...r)}function vo(...r){const e=r.join(" ");e in rp||(rp[e]=!0,we(...r))}function Y_(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}class ri{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}const rn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","5
25","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let ap=1234567;const ro=Math.PI/180,ea=180/Math.PI;function zn(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(rn[r&255]+rn[r>>8&255]+rn[r>>16&255]+rn[r>>24&255]+"-"+rn[e&255]+rn[e>>8&255]+"-"+rn[e>>16&15|64]+rn[e>>24&255]+"-"+rn[t&63|128]+rn[t>>8&255]+"-"+rn[t>>16&255]+rn[t>>24&255]+rn[n&255]+rn[n>>8&255]+rn[n>>16&255]+rn[n>>24&255]).toLowerCase()}function Ve(r,e,t){return Math.max(e,Math.min(t,r))}function vf(r,e){return(r%e+e)%e}function j_(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function K_(r,e,t){return r!==e?(t-r)/(e-r):0}function ao(r,e,t){return(1-t)*r+t*e}function J_(r,e,t,n){return ao(r,e,1-Math.exp(-t*n))}function Z_(r,e=1){return e-Math.abs(vf(r,e*2)-e)}function ev(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function tv(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function nv(r,e){return r+Math.floor(Math.random()*(e-r+1))}function iv(r,e){return r+Math.random()*(e-r)}function sv(r){return r*(.5-Math.random())}function rv(r){r!==void 0&&(ap=r);let e=ap+=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 av(r){return r*ro}function ov(r){return r*ea}function cv(r){return(r&r-1)===0&&r!==0}function lv(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function hv(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function uv(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),c=a(t/2),l=s((e+n)/2),u=a((e+n)/2),h=s((e-n)/2),d=a((e-n)/2),f=s((n-e)/2),p=a((n-e)/2);switch(i){case"XYX":r.set(o*u,c*h,c*d,o*l);break;case"YZY":r.set(c*d,o*u,c*h,o*l);break;case"ZXZ":r.set(c*h,c*d,o*u,o*l);break;case"XZX":r.set(o*u,c*p,c*f,o*l);break;case"YXY":r.set(c*f,o*u,c*p,o*l);break;case"ZYZ":r.set(c*p,c*f,o*u,o*l);break;default:we("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function jn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function pt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const xl={DEG2RAD:ro,RAD2DEG:ea,generateUUID:zn,clamp:Ve,euclideanModulo:vf,mapLinear:j_,inverseLerp:K_,lerp:ao,damp:J_,pingpong:Z_,smoothstep:ev,smootherstep:tv,randInt:nv,randFloat:iv,randFloatSpread:sv,seededRandom:rv,degToRad:av,radToDeg:ov,isPowerOfTwo:cv,ceilPowerOfTwo:lv,floorPowerOfTwo:hv,setQuaternionFromProperEuler:uv,normalize:pt,denormalize:jn};class pe{constructor(e=0,t=0){pe.prototype.isVector2=!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("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("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}
vendor: 72,371 bytes, line 2
2sub(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){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ve(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const 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){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class xn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,o){let c=n[i+0],l=n[i+1],u=n[i+2],h=n[i+3],d=s[a+0],f=s[a+1],p=s[a+2],g=s[a+3];if(o<=0){e[t+0]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h;return}if(o>=1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=g;return}if(h!==g||c!==d||l!==f||u!==p){let m=c*d+l*f+u*p+h*g;m<0&&(d=-d,f=-f,p=-p,g=-g,m=-m);let A=1-o;if(m<.9995){const x=Math.acos(m),_=Math.sin(x);A=Math.sin(A*x)/_,o=Math.sin(o*x)/_,c=c*A+d*o,l=l*A+f*o,u=u*A+p*o,h=h*A+g*o}else{c=c*A+d*o,l=l*A+f*o,u=u*A+p*o,h=h*A+g*o;const x=1/Math.sqrt(c*c+l*l+u*u+h*h);c*=x,l*=x,u*=x,h*=x}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],c=n[i+1],l=n[i+2],u=n[i+3],h=s[a],d=s[a+1],f=s[a+2],p=s[a+3];return e[t]=o*p+u*h+c*f-l*d,e[t+1]=c*p+u*d+l*h-o*f,e[t+2]=l*p+u*f+o*d-c*h,e[t+3]=u*p-o*h-c*d-l*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,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){const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),u=o(i/2),h=o(s/2),d=c(n/2),f=c(i/2),p=c(s/2);switch(a){case"XYZ":this._x=d*u*h+l*f*p,this._y=l*f*h-d*u*p,this._z=l*u*p+d*f*h,this._w=l*u*h-d*f*p;break;case"YXZ":this._x=d*u*h+l*f*p,this._y=l*f*h-d*u*p,this._z=l*u*p-d*f*h,this._w=l*u*h+d*f*p;break;case"ZXY":this._x=d*u*h-l*f*p,this._y=l*f*h+d*u*p,this._z=l*u*p+d*f*h,this._w=l*u*h-d*f*p;break;case"ZYX":this._x=d*u*h-l*f*p,this._y=l*f*h+d*u*p,this._z=l*u*p-d*f*h,this._w=l*u*h+d*f*p;break;case"YZX":this._x=d*u*h+l*f*p,this._y=l*f*h+d*u*p,this._z=l*u*p-d*f*h,this._w=l*u*h-d*f*p;break;case"XZY":this._x=d*u*h-l*f*p,this._y=l*f*h-d*u*p,this._z=l*u*p+d*f*h,this._w=l*u*h+d*f*p;break;default:we("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],c=t[9],l=t[2],u=t[6],h=t[10],d=n+o+h;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-c)*f,this._y=(s-l)*f,this._z=(a-i)*f}else if(n>o&&n>h){const f=2*Math.sqrt(1+n-o-h);this._w=(u-c)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(s+l)/f}else if(o>h){const f=2*Math.sqrt(1+o-n-h);this._w=(s-l)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(c+u)/f}else{const f=2*Math.sqrt(1+h-n-o);this._w=(a-i)/f,this._x=(s+l)/f,this._y=(c+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ve(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),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){const n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,c=t._y,l=t._z,u=t._w;return this._x=n*u+a*o+i*l-s*c,this._y=i*u+a*c+s*o-n*l,this._z=s*u+a*l+n*c-i*o,this._w=a*u-n*o-i*c-s*l,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,i=-i,s=-s,a=-a,o=-o);let c=1-t;if(o<.9995){const l=Math.acos(o),u=Math.sin(l);c=Math.sin(c*l)/u,t=Math.sin(t*l)/u,this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*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}}class B{constructor(e=0,t=0,n=0){B.prototype.isVector3=!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("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("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(op.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(op.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*i-o*n),u=2*(o*t-s*i),h=2*(s*n-a*t);return this.x=t+c*l+a*h-o*u,this.y=n+c*u+o*l-s*h,this.z=i+c*h+s*u-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,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=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this.z=Ve(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this.z=Ve(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(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){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,c=t.z;return this.x=i*c-s*o,this.y=s*a-n*c,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Jl.copy(this).projectOnVector(e),this.sub(Jl)}reflect(e){return this.sub(Jl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ve(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}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){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*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){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,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(){const 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}}const Jl=new B,op=new xn;class Qe{constructor(e,t,n,i,s,a,o,c,l){Qe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,c,l)}set(e,t,n,i,s,a,o,c,l){const u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=t,u[4]=s,u[5]=c,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const 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){const 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){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],u=n[4],h=n[7],d=n[2],f=n[5],p=n[8],g=i[0],m=i[3],A=i[6],x=i[1],_=i[4],b=i[7],v=i[2],C=i[5],M=i[8];return s[0]=a*g+o*x+c*v,s[3]=a*m+o*_+c*C,s[6]=a*A+o*b+c*M,s[1]=l*g+u*x+h*v,s[4]=l*m+u*_+h*C,s[7]=l*A+u*b+h*M,s[2]=d*g+f*x+p*v,s[5]=d*m+f*_+p*C,s[8]=d*A+f*b+p*M,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],u=e[8];return t*a*u-t*o*l-n*s*u+n*o*c+i*s*l-i*a*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],u=e[8],h=u*a-o*l,d=o*c-u*s,f=l*s-a*c,p=t*h+n*d+i*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/p;return e[0]=h*g,e[1]=(i*l-u*n)*g,e[2]=(o*n-i*a)*g,e[3]=d*g,e[4]=(u*t-i*c)*g,e[5]=(i*s-o*t)*g,e[6]=f*g,e[7]=(n*c-l*t)*g,e[8]=(a*t-n*s)*g,this}transpose(){let e;const 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){const 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,i,s,a,o){const c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-i*l,i*c,-i*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Zl.makeScale(e,t)),this}rotate(e){return this.premultiply(Zl.makeRotation(-e)),this}translate(e,t){return this.premultiply(Zl.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){const 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){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])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){const 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)}}const Zl=new Qe,cp=new Qe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),lp=new Qe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function dv(){const r={enabled:!0,workingColorSpace:St,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===ft&&(i.r=Hi(i.r),i.g=Hi(i.g),i.b=Hi(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===ft&&(i.r=Hr(i.r),i.g=Hr(i.g),i.b=Hr(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===kn?Al:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return vo("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return vo("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[St]:{primaries:e,whitePoint:n,transfer:Al,toXYZ:cp,fromXYZ:lp,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:bt},outputColorSpaceConfig:{drawingBufferColorSpace:bt}},[bt]:{primaries:e,whitePoint:n,transfer:ft,toXYZ:cp,fromXYZ:lp,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:bt}}}),r}const Ze=dv();function Hi(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Hr(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let tr;class _0{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{tr===void 0&&(tr=_o("canvas")),tr.width=e.width,tr.height=e.height;const i=tr.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=tr}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){const t=_o("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=Hi(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Hi(t[n]/255)*255):t[n]=Hi(t[n]);return{data:t,width:e.width,height:e.height}}else return we("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let fv=0;class Ul{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:fv++}),this.uuid=zn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(eh(i[a].image)):s.push(eh(i[a]))}else s=eh(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function eh(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?_0.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(we("Texture: Unable to serialize Texture."),{})}let pv=0;const th=new B;let Rt=class Vc extends ri{constructor(e=Vc.DEFAULT_IMAGE,t=Vc.DEFAULT_MAPPING,n=Lt,i=Lt,s=We,a=gn,o=Tt,c=Le,l=Vc.DEFAULT_ANISOTROPY,u=kn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:pv++}),this.uuid=zn(),this.name="",this.source=new Ul(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new pe(0,0),this.repeat=new pe(1,1),this.center=new pe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Qe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(th).x}get height(){return this.source.getSize(th).y}get depth(){return this.source.getSize(th).z}get image(){return this.source.data}set image(e=null){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.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(const t in e){const n=e[t];if(n===void 0){we(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){we(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const 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,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!==$r)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ni:e.x=e.x-Math.floor(e.x);break;case Lt:e.x=e.x<0?0:1;break;case Ws: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 ni:e.y=e.y-Math.floor(e.y);break;case Lt:e.y=e.y<0?0:1;break;case Ws: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++}};Rt.DEFAULT_IMAGE=null;Rt.DEFAULT_MAPPING=$r;Rt.DEFAULT_ANISOTROPY=1;class Mt{constructor(e=0,t=0,n=0,i=1){Mt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}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,i){return this.x=e,this.y=t,this.z=n,this.w=i,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("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("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){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,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);const 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,i,s;const c=e.elements,l=c[0],u=c[4],h=c[8],d=c[1],f=c[5],p=c[9],g=c[2],m=c[6],A=c[10];if(Math.abs(u-d)<.01&&Math.abs(h-g)<.01&&Math.abs(p-m)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+g)<.1&&Math.abs(p+m)<.1&&Math.abs(l+f+A-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(l+1)/2,b=(f+1)/2,v=(A+1)/2,C=(u+d)/4,M=(h+g)/4,w=(p+m)/4;return _>b&&_>v?_<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(_),i=C/n,s=M/n):b>v?b<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(b),n=C/i,s=w/i):v<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(v),n=M/s,i=w/s),this.set(n,i,s,t),this}let x=Math.sqrt((m-p)*(m-p)+(h-g)*(h-g)+(d-u)*(d-u));return Math.abs(x)<.001&&(x=1),this.x=(m-p)/x,this.y=(h-g)/x,this.z=(d-u)/x,this.w=Math.acos((l+f+A-1)/2),this}setFromMatrixPosition(e){const 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=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this.z=Ve(this.z,e.z,t.z),this.w=Ve(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this.z=Ve(this.z,e,t),this.w=Ve(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(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}}class Av extends ri{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:We,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Mt(0,0,e,t),this.scissorTest=!1,this.viewport=new Mt(0,0,e,t);const i={width:e,height:t,depth:n.depth},s=new Rt(i);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:We,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);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<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new Ul(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class bn extends Av{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class v0 extends Rt{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=yt,this.minFilter=yt,this.wrapR=Lt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class E0 extends Rt{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=yt,this.minFilter=yt,this.wrapR=Lt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class cn{constructor(e=new B(1/0,1/0,1/0),t=new B(-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<n;t+=3)this.expandByPoint(qn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(qn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=qn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,qn):qn.fromBufferAttribute(s,a),qn.applyMatrix4(e.matrixWorld),this.expandByPoint(qn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Oo.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Oo.copy(n.boundingBox)),Oo.applyMatrix4(e.matrixWorld),this.union(Oo)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=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,qn),qn.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(ma),ko.subVectors(this.max,ma),nr.subVectors(e.a,ma),ir.subVectors(e.b,ma),sr.subVectors(e.c,ma),qi.subVectors(ir,nr),Xi.subVectors(sr,ir),As.subVectors(nr,sr);let t=[0,-qi.z,qi.y,0,-Xi.z,Xi.y,0,-As.z,As.y,qi.z,0,-qi.x,Xi.z,0,-Xi.x,As.z,0,-As.x,-qi.y,qi.x,0,-Xi.y,Xi.x,0,-As.y,As.x,0];return!nh(t,nr,ir,sr,ko)||(t=[1,0,0,0,1,0,0,0,1],!nh(t,nr,ir,sr,ko))?!1:(Qo.crossVectors(qi,Xi),t=[Qo.x,Qo.y,Qo.z],nh(t,nr,ir,sr,ko))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qn).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:(yi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),yi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),yi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),yi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),yi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),yi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),yi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),yi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(yi),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}}const yi=[new B,new B,new B,new B,new B,new B,new B,new B],qn=new B,Oo=new cn,nr=new B,ir=new B,sr=new B,qi=new B,Xi=new B,As=new B,ma=new B,ko=new B,Qo=new B,ms=new B;function nh(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){ms.fromArray(r,s);const o=i.x*Math.abs(ms.x)+i.y*Math.abs(ms.y)+i.z*Math.abs(ms.z),c=e.dot(ms),l=t.dot(ms),u=n.dot(ms);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>o)return!1}return!0}const mv=new cn,ga=new B,ih=new B;class Wn{constructor(e=new B,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):mv.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.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;ga.subVectors(e,this.center);const t=ga.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ga,i/n),this.radius+=i}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):(ih.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ga.copy(e.center).add(ih)),this.expandByPoint(ga.copy(e.center).sub(ih))),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}}const Si=new B,sh=new B,Go=new B,$i=new B,rh=new B,Ho=new B,ah=new B;class Bo{constructor(e=new B,t=new B(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,Si)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const 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){const t=Si.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Si.copy(this.origin).addScaledVector(this.direction,t),Si.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){sh.copy(e).add(t).multiplyScalar(.5),Go.copy(t).sub(e).normalize(),$i.copy(this.origin).sub(sh);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Go),o=$i.dot(this.direction),c=-$i.dot(Go),l=$i.lengthSq(),u=Math.abs(1-a*a);let h,d,f,p;if(u>0)if(h=a*c-o,d=a*o-c,p=s*u,h>=0)if(d>=-p)if(d<=p){const g=1/u;h*=g,d*=g,f=h*(h+a*d+2*o)+d*(a*h+d+2*c)+l}else d=s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*c)+l;else d=-s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*c)+l;else d<=-p?(h=Math.max(0,-(-a*s+o)),d=h>0?-s:Math.min(Math.max(-s,-c),s),f=-h*h+d*(d+2*c)+l):d<=p?(h=0,d=Math.min(Math.max(-s,-c),s),f=d*(d+2*c)+l):(h=Math.max(0,-(a*s+o)),d=h>0?s:Math.min(Math.max(-s,-c),s),f=-h*h+d*(d+2*c)+l);else d=a>0?-s:s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(sh).addScaledVector(Go,d),f}intersectSphere(e,t){Si.subVectors(e.center,this.origin);const n=Si.dot(this.direction),i=Si.dot(Si)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,o,c;const l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),u>=0?(s=(e.min.y-d.y)*u,a=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,a=(e.min.y-d.y)*u),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),h>=0?(o=(e.min.z-d.z)*h,c=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,c=(e.min.z-d.z)*h),n>c||o>i)||((o>n||n!==n)&&(n=o),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Si)!==null}intersectTriangle(e,t,n,i,s){rh.subVectors(t,e),Ho.subVectors(n,e),ah.crossVectors(rh,Ho);let a=this.direction.dot(ah),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;$i.subVectors(this.origin,e);const c=o*this.direction.dot(Ho.crossVectors($i,Ho));if(c<0)return null;const l=o*this.direction.dot(rh.cross($i));if(l<0||c+l>a)return null;const u=-o*$i.dot(ah);return u<0?null:this.at(u/a,s)}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)}}class Ue{constructor(e,t,n,i,s,a,o,c,l,u,h,d,f,p,g,m){Ue.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,c,l,u,h,d,f,p,g,m)}set(e,t,n,i,s,a,o,c,l,u,h,d,f,p,g,m){const A=this.elements;return A[0]=e,A[4]=t,A[8]=n,A[12]=i,A[1]=s,A[5]=a,A[9]=o,A[13]=c,A[2]=l,A[6]=u,A[10]=h,A[14]=d,A[3]=f,A[7]=p,A[11]=g,A[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ue().fromArray(this.elements)}copy(e){const 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],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,i=1/rr.setFromMatrixColumn(e,0).length(),s=1/rr.setFromMatrixColumn(e,1).length(),a=1/rr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(i),l=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=a*u,f=a*h,p=o*u,g=o*h;t[0]=c*u,t[4]=-c*h,t[8]=l,t[1]=f+p*l,t[5]=d-g*l,t[9]=-o*c,t[2]=g-d*l,t[6]=p+f*l,t[10]=a*c}else if(e.order==="YXZ"){const d=c*u,f=c*h,p=l*u,g=l*h;t[0]=d+g*o,t[4]=p*o-f,t[8]=a*l,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=f*o-p,t[6]=g+d*o,t[10]=a*c}else if(e.order==="ZXY"){const d=c*u,f=c*h,p=l*u,g=l*h;t[0]=d-g*o,t[4]=-a*h,t[8]=p+f*o,t[1]=f+p*o,t[5]=a*u,t[9]=g-d*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const d=a*u,f=a*h,p=o*u,g=o*h;t[0]=c*u,t[4]=p*l-f,t[8]=d*l+g,t[1]=c*h,t[5]=g*l+d,t[9]=f*l-p,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const d=a*c,f=a*l,p=o*c,g=o*l;t[0]=c*u,t[4]=g-d*h,t[8]=p*h+f,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-l*u,t[6]=f*h+p,t[10]=d-g*h}else if(e.order==="XZY"){const d=a*c,f=a*l,p=o*c,g=o*l;t[0]=c*u,t[4]=-h,t[8]=l*u,t[1]=d*h+g,t[5]=a*u,t[9]=f*h-p,t[2]=p*h-f,t[6]=o*u,t[10]=g*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(gv,e,xv)}lookAt(e,t,n){const i=this.elements;return Mn.subVectors(e,t),Mn.lengthSq()===0&&(Mn.z=1),Mn.normalize(),Yi.crossVectors(n,Mn),Yi.lengthSq()===0&&(Math.abs(n.z)===1?Mn.x+=1e-4:Mn.z+=1e-4,Mn.normalize(),Yi.crossVectors(n,Mn)),Yi.normalize(),zo.crossVectors(Mn,Yi),i[0]=Yi.x,i[4]=zo.x,i[8]=Mn.x,i[1]=Yi.y,i[5]=zo.y,i[9]=Mn.y,i[2]=Yi.z,i[6]=zo.z,i[10]=Mn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],u=n[1],h=n[5],d=n[9],f=n[13],p=n[2],g=n[6],m=n[10],A=n[14],x=n[3],_=n[7],b=n[11],v=n[15],C=i[0],M=i[4],w=i[8],E=i[12],S=i[1],R=i[5],N=i[9],F=i[13],P=i[2],Q=i[6],U=i[10],G=i[14],q=i[3],J=i[7],Z=i[11],Y=i[15];return s[0]=a*C+o*S+c*P+l*q,s[4]=a*M+o*R+c*Q+l*J,s[8]=a*w+o*N+c*U+l*Z,s[12]=a*E+o*F+c*G+l*Y,s[1]=u*C+h*S+d*P+f*q,s[5]=u*M+h*R+d*Q+f*J,s[9]=u*w+h*N+d*U+f*Z,s[13]=u*E+h*F+d*G+f*Y,s[2]=p*C+g*S+m*P+A*q,s[6]=p*M+g*R+m*Q+A*J,s[10]=p*w+g*N+m*U+A*Z,s[14]=p*E+g*F+m*G+A*Y,s[3]=x*C+_*S+b*P+v*q,s[7]=x*M+_*R+b*Q+v*J,s[11]=x*w+_*N+b*U+v*Z,s[15]=x*E+_*F+b*G+v*Y,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],c=e[9],l=e[13],u=e[2],h=e[6],d=e[10],f=e[14],p=e[3],g=e[7],m=e[11],A=e[15],x=c*f-l*d,_=o*f-l*h,b=o*d-c*h,v=a*f-l*u,C=a*d-c*u,M=a*h-o*u;return t*(g*x-m*_+A*b)-n*(p*x-m*v+A*C)+i*(p*_-g*v+A*M)-s*(p*b-g*C+m*M)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],A=e[15],x=h*m*l-g*d*l+g*c*f-o*m*f-h*c*A+o*d*A,_=p*d*l-u*m*l-p*c*f+a*m*f+u*c*A-a*d*A,b=u*g*l-p*h*l+p*o*f-a*g*f-u*o*A+a*h*A,v=p*h*c-u*g*c-p*o*d+a*g*d+u*o*m-a*h*m,C=t*x+n*_+i*b+s*v;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/C;return e[0]=x*M,e[1]=(g*d*s-h*m*s-g*i*f+n*m*f+h*i*A-n*d*A)*M,e[2]=(o*m*s-g*c*s+g*i*l-n*m*l-o*i*A+n*c*A)*M,e[3]=(h*c*s-o*d*s-h*i*l+n*d*l+o*i*f-n*c*f)*M,e[4]=_*M,e[5]=(u*m*s-p*d*s+p*i*f-t*m*f-u*i*A+t*d*A)*M,e[6]=(p*c*s-a*m*s-p*i*l+t*m*l+a*i*A-t*c*A)*M,e[7]=(a*d*s-u*c*s+u*i*l-t*d*l-a*i*f+t*c*f)*M,e[8]=b*M,e[9]=(p*h*s-u*g*s-p*n*f+t*g*f+u*n*A-t*h*A)*M,e[10]=(a*g*s-p*o*s+p*n*l-t*g*l-a*n*A+t*o*A)*M,e[11]=(u*o*s-a*h*s-u*n*l+t*h*l+a*n*f-t*o*f)*M,e[12]=v*M,e[13]=(u*g*i-p*h*i+p*n*d-t*g*d-u*n*m+t*h*m)*M,e[14]=(p*o*i-a*g*i-p*n*c+t*g*c+a*n*m-t*o*m)*M,e[15]=(a*h*i-u*o*i+u*n*c-t*h*c-a*n*d+t*o*d)*M,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,c=e.z,l=s*a,u=s*o;return this.set(l*a+n,l*o-i*c,l*c+i*o,0,l*o+i*c,u*o+n,u*c-i*a,0,l*c-i*o,u*c+i*a,s*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,c=t._w,l=s+s,u=a+a,h=o+o,d=s*l,f=s*u,p=s*h,g=a*u,m=a*h,A=o*h,x=c*l,_=c*u,b=c*h,v=n.x,C=n.y,M=n.z;return i[0]=(1-(g+A))*v,i[1]=(f+b)*v,i[2]=(p-_)*v,i[3]=0,i[4]=(f-b)*C,i[5]=(1-(d+A))*C,i[6]=(m+x)*C,i[7]=0,i[8]=(p+_)*M,i[9]=(m-x)*M,i[10]=(1-(d+g))*M,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],this.determinant()===0)return n.set(1,1,1),t.identity(),this;let s=rr.set(i[0],i[1],i[2]).length();const a=rr.set(i[4],i[5],i[6]).length(),o=rr.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),Xn.copy(this);const l=1/s,u=1/a,h=1/o;return Xn.elements[0]*=l,Xn.elements[1]*=l,Xn.elements[2]*=l,Xn.elements[4]*=u,Xn.elements[5]*=u,Xn.elements[6]*=u,Xn.elements[8]*=h,Xn.elements[9]*=h,Xn.elements[10]*=h,t.setFromRotationMatrix(Xn),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,a,o=Ai,c=!1){const l=this.elements,u=2*s/(t-e),h=2*s/(n-i),d=(t+e)/(t-e),f=(n+i)/(n-i);let p,g;if(c)p=s/(a-s),g=a*s/(a-s);else if(o===Ai)p=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===ml)p=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,a,o=Ai,c=!1){const l=this.elements,u=2/(t-e),h=2/(n-i),d=-(t+e)/(t-e),f=-(n+i)/(n-i);let p,g;if(c)p=1/(a-s),g=a/(a-s);else if(o===Ai)p=-2/(a-s),g=-(a+s)/(a-s);else if(o===ml)p=-1/(a-s),g=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=0,l[12]=d,l[1]=0,l[5]=h,l[9]=0,l[13]=f,l[2]=0,l[6]=0,l[10]=p,l[14]=g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const 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[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const rr=new B,Xn=new Ue,gv=new B(0,0,0),xv=new B(1,1,1),Yi=new B,zo=new B,Mn=new B,hp=new Ue,up=new xn;class Vn{constructor(e=0,t=0,n=0,i=Vn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}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 order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],c=i[1],l=i[5],u=i[9],h=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(Ve(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Ve(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ve(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Ve(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Ve(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-Ve(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:we("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return hp.makeRotationFromQuaternion(e),this.setFromRotationMatrix(hp,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return up.setFromEuler(this),this.setFromQuaternion(up,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[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._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Vn.DEFAULT_ORDER="XYZ";class Ef{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let bv=0;const dp=new B,ar=new xn,Ci=new Ue,Vo=new B,xa=new B,_v=new B,vv=new xn,fp=new B(1,0,0),pp=new B(0,1,0),Ap=new B(0,0,1),mp={type:"added"},Ev={type:"removed"},or={type:"childadded",child:null},oh={type:"childremoved",child:null};class mt extends ri{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:bv++}),this.uuid=zn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=mt.DEFAULT_UP.clone();const e=new B,t=new Vn,n=new xn,i=new B(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ue},normalMatrix:{value:new Qe}}),this.matrix=new Ue,this.matrixWorld=new Ue,this.matrixAutoUpdate=mt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=mt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ef,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ar.setFromAxisAngle(e,t),this.quaternion.multiply(ar),this}rotateOnWorldAxis(e,t){return ar.setFromAxisAngle(e,t),this.quaternion.premultiply(ar),this}rotateX(e){return this.rotateOnAxis(fp,e)}rotateY(e){return this.rotateOnAxis(pp,e)}rotateZ(e){return this.rotateOnAxis(Ap,e)}translateOnAxis(e,t){return dp.copy(e).applyQuaternion(this.quaternion),this.position.add(dp.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(fp,e)}translateY(e){return this.translateOnAxis(pp,e)}translateZ(e){return this.translateOnAxis(Ap,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ci.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Vo.copy(e):Vo.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),xa.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ci.lookAt(xa,Vo,this.up):Ci.lookAt(Vo,xa,this.up),this.quaternion.setFromRotationMatrix(Ci),i&&(Ci.extractRotation(i.matrixWorld),ar.setFromRotationMatrix(Ci),this.quaternion.premultiply(ar.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Fe("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(mp),or.child=e,this.dispatchEvent(or),or.child=null):Fe("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ev),oh.child=e,this.dispatchEvent(oh),oh.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ci.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ci.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ci),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(mp),or.child=e,this.dispatchEvent(or),or.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xa,e,_v),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xa,vv,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l<u;l++){const h=c[l];s(e.shapes,h)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(s(e.materials,this.material[c]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const c=this.animations[o];i.animations.push(s(e.animations,c))}}if(t){const o=a(e.geometries),c=a(e.materials),l=a(e.textures),u=a(e.images),h=a(e.shapes),d=a(e.skeletons),f=a(e.animations),p=a(e.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),p.length>0&&(n.nodes=p)}return n.object=i,n;function a(o){const c=[];for(const l in o){const u=o[l];delete u.metadata,c.push(u)}return c}}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.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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}mt.DEFAULT_UP=new B(0,1,0);mt.DEFAULT_MATRIX_AUTO_UPDATE=!0;mt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const $n=new B,Ii=new B,ch=new B,Mi=new B,cr=new B,lr=new B,gp=new B,lh=new B,hh=new B,uh=new B,dh=new Mt,fh=new Mt,ph=new Mt;class Rn{constructor(e=new B,t=new B,n=new B){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),$n.subVectors(e,t),i.cross($n);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){$n.subVectors(i,t),Ii.subVectors(n,t),ch.subVectors(e,t);const a=$n.dot($n),o=$n.dot(Ii),c=$n.dot(ch),l=Ii.dot(Ii),u=Ii.dot(ch),h=a*l-o*o;if(h===0)return s.set(0,0,0),null;const d=1/h,f=(l*c-o*u)*d,p=(a*u-o*c)*d;return s.set(1-f-p,p,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Mi)===null?!1:Mi.x>=0&&Mi.y>=0&&Mi.x+Mi.y<=1}static getInterpolation(e,t,n,i,s,a,o,c){return this.getBarycoord(e,t,n,i,Mi)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,Mi.x),c.addScaledVector(a,Mi.y),c.addScaledVector(o,Mi.z),c)}static getInterpolatedAttribute(e,t,n,i,s,a){return dh.setScalar(0),fh.setScalar(0),ph.setScalar(0),dh.fromBufferAttribute(e,t),fh.fromBufferAttribute(e,n),ph.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(dh,s.x),a.addScaledVector(fh,s.y),a.addScaledVector(ph,s.z),a}static isFrontFacing(e,t,n,i){return $n.subVectors(n,t),Ii.subVectors(e,t),$n.cross(Ii).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 $n.subVectors(this.c,this.b),Ii.subVectors(this.a,this.b),$n.cross(Ii).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Rn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Rn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return Rn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Rn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Rn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;cr.subVectors(i,n),lr.subVectors(s,n),lh.subVectors(e,n);const c=cr.dot(lh),l=lr.dot(lh);if(c<=0&&l<=0)return t.copy(n);hh.subVectors(e,i);const u=cr.dot(hh),h=lr.dot(hh);if(u>=0&&h<=u)return t.copy(i);const d=c*h-u*l;
vendor: 4,082 bytes, line 2
2if(d<=0&&c>=0&&u<=0)return a=c/(c-u),t.copy(n).addScaledVector(cr,a);uh.subVectors(e,s);const f=cr.dot(uh),p=lr.dot(uh);if(p>=0&&f<=p)return t.copy(s);const g=f*l-c*p;if(g<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(lr,o);const m=u*p-f*h;if(m<=0&&h-u>=0&&f-p>=0)return gp.subVectors(s,i),o=(h-u)/(h-u+(f-p)),t.copy(i).addScaledVector(gp,o);const A=1/(m+g+d);return a=g*A,o=d*A,t.copy(n).addScaledVector(cr,a).addScaledVector(lr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const y0={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},ji={h:0,s:0,l:0},Wo={h:0,s:0,l:0};function Ah(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Ie{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){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=bt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ze.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Ze.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ze.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Ze.workingColorSpace){if(e=vf(e,1),t=Ve(t,0,1),n=Ve(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;
vendor: 5,966 bytes, line 2
2this.r=Ah(a,s,e+1/3),this.g=Ah(a,s,e),this.b=Ah(a,s,e-1/3)}return Ze.colorSpaceToWorking(this,i),this}setStyle(e,t=bt){function n(s){s!==void 0&&parseFloat(s)<1&&we("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:we("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);we("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=bt){const n=y0[e.toLowerCase()];return n!==void 0?this.setHex(n,t):we("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Hi(e.r),this.g=Hi(e.g),this.b=Hi(e.b),this}copyLinearToSRGB(e){return this.r=Hr(e.r),this.g=Hr(e.g),this.b=Hr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=bt){return Ze.workingToColorSpace(an.copy(this),e),Math.round(Ve(an.r*255,0,255))*65536+Math.round(Ve(an.g*255,0,255))*256+Math.round(Ve(an.b*255,0,255))}getHexString(e=bt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ze.workingColorSpace){Ze.workingToColorSpace(an.copy(this),t);const n=an.r,i=an.g,s=an.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let c,l;const u=(o+a)/2;if(o===a)c=0,l=0;else{const h=a-o;switch(l=u<=.5?h/(a+o):h/(2-a-o),a){case n:c=(i-s)/h+(i<s?6:0);break;case i:c=(s-n)/h+2;break;case s:c=(n-i)/h+4;break}c/=6}return e.h=c,e.s=l,e.l=u,e}getRGB(e,t=Ze.workingColorSpace){return Ze.workingToColorSpace(an.copy(this),t),e.r=an.r,e.g=an.g,e.b=an.b,e}getStyle(e=bt){Ze.workingToColorSpace(an.copy(this),e);const t=an.r,n=an.g,i=an.b;return e!==bt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(ji),this.setHSL(ji.h+e,ji.s+t,ji.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(ji),e.getHSL(Wo);const n=ao(ji.h,Wo.h,t),i=ao(ji.s,Wo.s,t),s=ao(ji.l,Wo.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const an=new Ie;Ie.NAMES=y0;let yv=0,ei=class extends ri{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:yv++}),this.uuid=zn(),this.name="",this.type="Material",this.blending=Qs,this.side=ti,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=id,this.blendDst=sd,this.blendEquation=Ns,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ie(0,0,0),this.blendAlpha=0,this.depthFunc=qr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ip,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=er,this.stencilZFail=er,this.stencilZPass=er,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(const t in e){const n=e[t];if(n===void 0){we(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){we(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 9,098 bytes, line 2
2n.uuid=this.uuid,n.type=this.type,this.name!==""&&(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&&this.emissiveIntensity!==1&&(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.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&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Qs&&(n.blending=this.blending),this.side!==ti&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==id&&(n.blendSrc=this.blendSrc),this.blendDst!==sd&&(n.blendDst=this.blendDst),this.blendEquation!==Ns&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==qr&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ip&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==er&&(n.stencilFail=this.stencilFail),this.stencilZFail!==er&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==er&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),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.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const c=s[o];delete c.metadata,a.push(c)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}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;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 31,189 bytes, lines 2-6
2adows,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++}};class ln extends ei{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ie(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 Vn,this.combine=p0,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}}const Ui=Sv();function Sv(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let c=0;c<256;++c){const l=c-127;l<-27?(n[c]=0,n[c|256]=32768,i[c]=24,i[c|256]=24):l<-14?(n[c]=1024>>-l-14,n[c|256]=1024>>-l-14|32768,i[c]=-l-1,i[c|256]=-l-1):l<=15?(n[c]=l+15<<10,n[c|256]=l+15<<10|32768,i[c]=13,i[c|256]=13):l<128?(n[c]=31744,n[c|256]=64512,i[c]=24,i[c|256]=24):(n[c]=31744,n[c|256]=64512,i[c]=13,i[c|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let c=1;c<1024;++c){let l=c<<13,u=0;for(;(l&8388608)===0;)l<<=1,u-=8388608;l&=-8388609,u+=947912704,s[c]=l|u}for(let c=1024;c<2048;++c)s[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)a[c]=c<<23;a[31]=1199570944,a[32]=2147483648;for(let c=33;c<63;++c)a[c]=2147483648+(c-32<<23);a[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(o[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function Cv(r){Math.abs(r)>65504&&we("DataUtils.toHalfFloat(): Value out of range."),r=Ve(r,-65504,65504),Ui.floatView[0]=r;const e=Ui.uint32View[0],t=e>>23&511;return Ui.baseTable[t]+((e&8388607)>>Ui.shiftTable[t])}function Iv(r){const e=r>>10;return Ui.uint32View[0]=Ui.mantissaTable[Ui.offsetTable[e]+(r&1023)]+Ui.exponentTable[e],Ui.floatView[0]}class qo{static toHalfFloat(e){return Cv(e)}static fromHalfFloat(e){return Iv(e)}}const Ht=new B,Xo=new pe;let Mv=0;class Bt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Mv++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=wd,this.updateRanges=[],this.gpuType=Nt,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 i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Xo.fromBufferAttribute(this,t),Xo.applyMatrix3(e),this.setXY(t,Xo.x,Xo.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Ht.fromBufferAttribute(this,t),Ht.applyMatrix3(e),this.setXYZ(t,Ht.x,Ht.y,Ht.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Ht.fromBufferAttribute(this,t),Ht.applyMatrix4(e),this.setXYZ(t,Ht.x,Ht.y,Ht.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ht.fromBufferAttribute(this,t),Ht.applyNormalMatrix(e),this.setXYZ(t,Ht.x,Ht.y,Ht.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ht.fromBufferAttribute(this,t),Ht.transformDirection(e),this.setXYZ(t,Ht.x,Ht.y,Ht.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=jn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=pt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=jn(t,this.array)),t}setX(e,t){return this.normalized&&(t=pt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=jn(t,this.array)),t}setY(e,t){return this.normalized&&(t=pt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=jn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=pt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=jn(t,this.array)),t}setW(e,t){return this.normalized&&(t=pt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array),i=pt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array),i=pt(i,this.array),s=pt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==wd&&(e.usage=this.usage),e}}class S0 extends Bt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class C0 extends Bt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Jt extends Bt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let wv=0;const Pn=new Ue,mh=new mt,hr=new B,wn=new cn,ba=new cn,Xt=new B;class sn extends ri{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:wv++}),this.uuid=zn(),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={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(b0(e)?C0:S0)(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){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Qe().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Pn.makeRotationFromQuaternion(e),this.applyMatrix4(Pn),this}rotateX(e){return Pn.makeRotationX(e),this.applyMatrix4(Pn),this}rotateY(e){return Pn.makeRotationY(e),this.applyMatrix4(Pn),this}rotateZ(e){return Pn.makeRotationZ(e),this.applyMatrix4(Pn),this}translate(e,t,n){return Pn.makeTranslation(e,t,n),this.applyMatrix4(Pn),this}scale(e,t,n){return Pn.makeScale(e,t,n),this.applyMatrix4(Pn),this}lookAt(e){return mh.lookAt(e),mh.updateMatrix(),this.applyMatrix4(mh.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(hr).negate(),this.translate(hr.x,hr.y,hr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Jt(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&we("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new cn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Fe("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new B(-1/0,-1/0,-1/0),new B(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];wn.setFromBufferAttribute(s),this.morphTargetsRelative?(Xt.addVectors(this.boundingBox.min,wn.min),this.boundingBox.expandByPoint(Xt),Xt.addVectors(this.boundingBox.max,wn.max),this.boundingBox.expandByPoint(Xt)):(this.boundingBox.expandByPoint(wn.min),this.boundingBox.expandByPoint(wn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Fe('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Wn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Fe("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new B,1/0);return}if(e){const n=this.boundingSphere.center;if(wn.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];ba.setFromBufferAttribute(o),this.morphTargetsRelative?(Xt.addVectors(wn.min,ba.min),wn.expandByPoint(Xt),Xt.addVectors(wn.max,ba.max),wn.expandByPoint(Xt)):(wn.expandByPoint(ba.min),wn.expandByPoint(ba.max))}wn.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)Xt.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Xt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],c=this.morphTargetsRelative;for(let l=0,u=o.count;l<u;l++)Xt.fromBufferAttribute(o,l),c&&(hr.fromBufferAttribute(e,l),Xt.add(hr)),i=Math.max(i,n.distanceToSquared(Xt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Fe('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Fe("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Bt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],c=[];for(let w=0;w<n.count;w++)o[w]=new B,c[w]=new B;const l=new B,u=new B,h=new B,d=new pe,f=new pe,p=new pe,g=new B,m=new B;function A(w,E,S){l.fromBufferAttribute(n,w),u.fromBufferAttribute(n,E),h.fromBufferAttribute(n,S),d.fromBufferAttribute(s,w),f.fromBufferAttribute(s,E),p.fromBufferAttribute(s,S),u.sub(l),h.sub(l),f.sub(d),p.sub(d);const R=1/(f.x*p.y-p.x*f.y);isFinite(R)&&(g.copy(u).multiplyScalar(p.y).addScaledVector(h,-f.y).multiplyScalar(R),m.copy(h).multiplyScalar(f.x).addScaledVector(u,-p.x).multiplyScalar(R),o[w].add(g),o[E].add(g),o[S].add(g),c[w].add(m),c[E].add(m),c[S].add(m))}let x=this.groups;x.length===0&&(x=[{start:0,count:e.count}]);for(let w=0,E=x.length;w<E;++w){const S=x[w],R=S.start,N=S.count;for(let F=R,P=R+N;F<P;F+=3)A(e.getX(F+0),e.getX(F+1),e.getX(F+2))}const _=new B,b=new B,v=new B,C=new B;function M(w){v.fromBufferAttribute(i,w),C.copy(v);const E=o[w];_.copy(E),_.sub(v.multiplyScalar(v.dot(E))).normalize(),b.crossVectors(C,E);const R=b.dot(c[w])<0?-1:1;a.setXYZW(w,_.x,_.y,_.z,R)}for(let w=0,E=x.length;w<E;++w){const S=x[w],R=S.start,N=S.count;for(let F=R,P=R+N;F<P;F+=3)M(e.getX(F+0)),M(e.getX(F+1)),M(e.getX(F+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Bt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);const i=new B,s=new B,a=new B,o=new B,c=new B,l=new B,u=new B,h=new B;if(e)for(let d=0,f=e.count;d<f;d+=3){const p=e.getX(d+0),g=e.getX(d+1),m=e.getX(d+2);i.fromBufferAttribute(t,p),s.fromBufferAttribute(t,g),a.fromBufferAttribute(t,m),u.subVectors(a,s),h.subVectors(i,s),u.cross(h),o.fromBufferAttribute(n,p),c.fromBufferAttribute(n,g),l.fromBufferAttribute(n,m),o.add(u),c.add(u),l.add(u),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(g,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,f=t.count;d<f;d+=3)i.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),u.subVectors(a,s),h.subVectors(i,s),u.cross(h),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Xt.fromBufferAttribute(e,t),Xt.normalize(),e.setXYZ(t,Xt.x,Xt.y,Xt.z)}toNonIndexed(){function e(o,c){const l=o.array,u=o.itemSize,h=o.normalized,d=new l.constructor(c.length*u);let f=0,p=0;for(let g=0,m=c.length;g<m;g++){o.isInterleavedBufferAttribute?f=c[g]*o.data.stride+o.offset:f=c[g]*u;for(let A=0;A<u;A++)d[p++]=l[f++]}return new Bt(d,u,h)}if(this.index===null)return we("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new sn,n=this.index.array,i=this.attributes;for(const o in i){const c=i[o],l=e(c,n);t.setAttribute(o,l)}const s=this.morphAttributes;for(const o in s){const c=[],l=s[o];for(let u=0,h=l.length;u<h;u++){const d=l[u],f=e(d,n);c.push(f)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const i={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],u=[];for(let h=0,d=l.length;h<d;h++){const f=l[h];u.push(f.toJSON(e.data))}u.length>0&&(i[c]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.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;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const l in i){const u=i[l];this.setAttribute(l,u.clone(t))}const s=e.morphAttributes;for(const l in s){const u=[],h=s[l];for(let d=0,f=h.length;d<f;d++)u.push(h[d].clone(t));this.morphAttributes[l]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,u=a.length;l<u;l++){const h=a[l];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const xp=new Ue,gs=new Bo,$o=new Wn,bp=new B,Yo=new B,jo=new B,Ko=new B,gh=new B,Jo=new B,_p=new B,Zo=new B;class ot extends mt{constructor(e=new sn,t=new ln){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(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){Jo.set(0,0,0);for(let c=0,l=s.length;c<l;c++){const u=o[c],h=s[c];u!==0&&(gh.fromBufferAttribute(h,e),a?Jo.addScaledVector(gh,u):Jo.addScaledVector(gh.sub(t),u))}t.add(Jo)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),$o.copy(n.boundingSphere),$o.applyMatrix4(s),gs.copy(e.ray).recast(e.near),!($o.containsPoint(gs.origin)===!1&&(gs.intersectSphere($o,bp)===null||gs.origin.distanceToSquared(bp)>(e.far-e.near)**2))&&(xp.copy(s).invert(),gs.copy(e.ray).applyMatrix4(xp),!(n.boundingBox!==null&&gs.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,gs)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,o=s.index,c=s.attributes.position,l=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let p=0,g=d.length;p<g;p++){const m=d[p],A=a[m.materialIndex],x=Math.max(m.start,f.start),_=Math.min(o.count,Math.min(m.start+m.count,f.start+f.count));for(let b=x,v=_;b<v;b+=3){const C=o.getX(b),M=o.getX(b+1),w=o.getX(b+2);i=ec(this,A,e,n,l,u,h,C,M,w),i&&(i.faceIndex=Math.floor(b/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const p=Math.max(0,f.start),g=Math.min(o.count,f.start+f.count);for(let m=p,A=g;m<A;m+=3){const x=o.getX(m),_=o.getX(m+1),b=o.getX(m+2);i=ec(this,a,e,n,l,u,h,x,_,b),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(a))for(let p=0,g=d.length;p<g;p++){const m=d[p],A=a[m.materialIndex],x=Math.max(m.start,f.start),_=Math.min(c.count,Math.min(m.start+m.count,f.start+f.count));for(let b=x,v=_;b<v;b+=3){const C=b,M=b+1,w=b+2;i=ec(this,A,e,n,l,u,h,C,M,w),i&&(i.faceIndex=Math.floor(b/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const p=Math.max(0,f.start),g=Math.min(c.count,f.start+f.count);for(let m=p,A=g;m<A;m+=3){const x=m,_=m+1,b=m+2;i=ec(this,a,e,n,l,u,h,x,_,b),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}}function Tv(r,e,t,n,i,s,a,o){let c;if(e.side===nn?c=n.intersectTriangle(a,s,i,!0,o):c=n.intersectTriangle(i,s,a,e.side===ti,o),c===null)return null;Zo.copy(o),Zo.applyMatrix4(r.matrixWorld);const l=t.ray.origin.distanceTo(Zo);return l<t.near||l>t.far?null:{distance:l,point:Zo.clone(),object:r}}function ec(r,e,t,n,i,s,a,o,c,l){r.getVertexPosition(o,Yo),r.getVertexPosition(c,jo),r.getVertexPosition(l,Ko);const u=Tv(r,e,t,n,Yo,jo,Ko,_p);if(u){const h=new B;Rn.getBarycoord(_p,Yo,jo,Ko,h),i&&(u.uv=Rn.getInterpolatedAttribute(i,o,c,l,h,new pe)),s&&(u.uv1=Rn.getInterpolatedAttribute(s,o,c,l,h,new pe)),a&&(u.normal=Rn.getInterpolatedAttribute(a,o,c,l,h,new B),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const d={a:o,b:c,c:l,normal:new B,materialIndex:0};Rn.getNormal(Yo,jo,Ko,d.normal),u.face=d,u.barycoord=h}return u}class Wi extends sn{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const c=[],l=[],u=[],h=[];let d=0,f=0;p("z","y","x",-1,-1,n,t,e,a,s,0),p("z","y","x",1,-1,n,t,-e,a,s,1),p("x","z","y",1,1,e,n,t,i,a,2),p("x","z","y",1,-1,e,n,-t,i,a,3),p("x","y","z",1,-1,e,t,n,i,s,4),p("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(c),this.setAttribute("position",new Jt(l,3)),this.setAttribute("normal",new Jt(u,3)),this.setAttribute("uv",new Jt(h,2));function p(g,m,A,x,_,b,v,C,M,w,E){const S=b/M,R=v/w,N=b/2,F=v/2,P=C/2,Q=M+1,U=w+1;let G=0,q=0;const J=new B;for(let Z=0;Z<U;Z++){const Y=Z*R-F;for(let re=0;re<Q;re++){const Ae=re*S-N;J[g]=Ae*x,J[m]=Y*_,J[A]=P,l.push(J.x,J.y,J.z),J[g]=0,J[m]=0,J[A]=C>0?1:-1,u.push(J.x,J.y,J.z),h.push(re/M),h.push(1-Z/w),G+=1}}for(let Z=0;Z<w;Z++)for(let Y=0;Y<M;Y++){const re=d+Y+Q*Z,Ae=d+Y+Q*(Z+1),He=d+(Y+1)+Q*(Z+1),ze=d+(Y+1)+Q*Z;c.push(re,Ae,ze),c.push(Ae,He,ze),q+=6}o.addGroup(f,q,E),f+=q,d+=G}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ta(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(we("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function An(r){const e={};for(let t=0;t<r.length;t++){const n=ta(r[t]);for(const i in n)e[i]=n[i]}return e}function Rv(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function I0(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ze.workingColorSpace}const Bv={clone:ta,merge:An};var Dv=`void main() { 3 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4}`,Lv=`void main() { 5 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 6}`;class _n extends ei{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Dv,this.fragmentShader=Lv,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ta(e.uniforms),this.uniformsGroups=Rv(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class M0 extends mt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ue,this.projectionMatrix=new Ue,this.projectionMatrixInverse=new Ue,this.coordinateSystem=Ai,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Ki=new B,vp=new pe,Ep=new pe;class tn extends M0{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ea*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ro*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ea*2*Math.atan(Math.tan(ro*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Ki.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ki.x,Ki.y).multiplyScalar(-e/Ki.z),Ki.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ki.x,Ki.y).multiplyScalar(-e/Ki.z)}getViewSize(e,t){return this.getViewBounds(e,vp,Ep),t.subVectors(Ep,vp)}setViewOffset(e,t,n,i,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ro*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,l=a.fullHeight;s+=a.offsetX*i/c,t-=a.offsetY*n/l,i*=a.width/c,n*=a.height/l}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ur=-90,dr=1;class Td extends mt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new tn(ur,dr,e,t);i.layers=this.layers,this.add(i);const s=new tn(ur,dr,e,t);s.layers=this.layers,this.add(s);const a=new tn(ur,dr,e,t);a.layers=this.layers,this.add(a);const o=new tn(ur,dr,e,t);o.layers=this.layers,this.add(o);const c=new tn(ur,dr,e,t);c.layers=this.layers,this.add(c);const l=new tn(ur,dr,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,a,o,c]=t;for(const l of t)this.remove(l);if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===ml)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,c,l,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const g=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,c),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=g,e.setRenderTarget(n,5,i),e.render(t,u),e.setRenderTarget(h,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class w0 extends Rt{constructor(e=[],t=us,n,i,s,a,o,c,l,u){super(e,t,n,i,s,a,o,c,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Ol extends bn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new w0(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 13,650 bytes, lines 6-41
6=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 7 8 varying vec3 vWorldDirection; 9 10 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 11 12 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 13 14 } 15 16 void main() { 17 18 vWorldDirection = transformDirection( position, modelMatrix ); 19 20 #include <begin_vertex> 21 #include <project_vertex> 22 23 } 24 `,fragmentShader:` 25 26 uniform sampler2D tEquirect; 27 28 varying vec3 vWorldDirection; 29 30 #include <common> 31 32 void main() { 33 34 vec3 direction = normalize( vWorldDirection ); 35 36 vec2 sampleUV = equirectUv( direction ); 37 38 gl_FragColor = texture2D( tEquirect, sampleUV ); 39 40 } 41 `},i=new Wi(5,5,5),s=new _n({name:"CubemapFromEquirect",uniforms:ta(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:nn,blending:Zn});s.uniforms.tEquirect.value=t;const a=new ot(i,s),o=t.minFilter;return t.minFilter===gn&&(t.minFilter=We),new Td(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}class os extends mt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Fv={type:"move"};class xh{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new os,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new os,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new B,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new B),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new os,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new B,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new B),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const g of e.hand.values()){const m=t.getJointPose(g,n),A=this._getHandJoint(l,g);m!==null&&(A.matrix.fromArray(m.transform.matrix),A.matrix.decompose(A.position,A.rotation,A.scale),A.matrixWorldNeedsUpdate=!0,A.jointRadius=m.radius),A.visible=m!==null}const u=l.joints["index-finger-tip"],h=l.joints["thumb-tip"],d=u.position.distanceTo(h.position),f=.02,p=.005;l.inputState.pinching&&d>f+p?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-p&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Fv)))}return o!==null&&(o.visible=i!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new os;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class qs extends mt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Vn,this.environmentIntensity=1,this.environmentRotation=new Vn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class T0{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=wd,this.updateRanges=[],this.version=0,this.uuid=zn()}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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=zn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=zn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const fn=new B;class kl{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)fn.fromBufferAttribute(this,t),fn.applyMatrix4(e),this.setXYZ(t,fn.x,fn.y,fn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)fn.fromBufferAttribute(this,t),fn.applyNormalMatrix(e),this.setXYZ(t,fn.x,fn.y,fn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)fn.fromBufferAttribute(this,t),fn.transformDirection(e),this.setXYZ(t,fn.x,fn.y,fn.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=jn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=pt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=pt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=pt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=pt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=pt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=jn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=jn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=jn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=jn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array),i=pt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array),i=pt(i,this.array),s=pt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){gl("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new Bt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new kl(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){gl("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const yp=new B,Sp=new Mt,Cp=new Mt,Pv=new B,Ip=new Ue,tc=new B,bh=new Wn,Mp=new Ue,_h=new Bo;class Nv extends ot{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=tp,this.bindMatrix=new Ue,this.bindMatrixInverse=new Ue,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new cn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,tc),this.boundingBox.expandByPoint(tc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Wn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,tc),this.boundingSphere.expandByPoint(tc)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),bh.copy(this.boundingSphere),bh.applyMatrix4(i),e.ray.intersectsSphere(bh)!==!1&&(Mp.copy(i).invert(),_h.copy(e.ray).applyMatrix4(Mp),!(this.boundingBox!==null&&_h.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,_h)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Mt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===tp?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===N_?this.bindMatrixInverse.copy(this.bindMatrix).invert():we("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}
vendor: 20,633 bytes, line 41
41applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Sp.fromBufferAttribute(i.attributes.skinIndex,e),Cp.fromBufferAttribute(i.attributes.skinWeight,e),yp.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=Cp.getComponent(s);if(a!==0){const o=Sp.getComponent(s);Ip.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Pv.copy(yp).applyMatrix4(Ip),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class R0 extends mt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ha extends Rt{constructor(e=null,t=1,n=1,i,s,a,o,c,l=yt,u=yt,h,d){super(null,a,o,c,l,u,i,s,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const wp=new Ue,Uv=new Ue;class yf{constructor(e=[],t=[]){this.uuid=zn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){we("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Ue)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Ue;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:Uv;wp.multiplyMatrices(o,t[s]),wp.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new yf(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new ha(t,e,e,Tt,Nt);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let a=t[s];a===void 0&&(we("Skeleton: No bone found with UUID:",s),a=new R0),this.bones.push(a),this.boneInverses.push(new Ue().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const a=t[i];e.bones.push(a.uuid);const o=n[i];e.boneInverses.push(o.toArray())}return e}}class Rd extends Bt{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const fr=new Ue,Tp=new Ue,nc=[],Rp=new cn,Ov=new Ue,_a=new ot,va=new Wn;class kv extends ot{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Rd(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,Ov)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new cn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,fr),Rp.copy(e.boundingBox).applyMatrix4(fr),this.boundingBox.union(Rp)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Wn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,fr),va.copy(e.boundingSphere).applyMatrix4(fr),this.boundingSphere.union(va)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,a=e*s+1;for(let o=0;o<n.length;o++)n[o]=i[a+o]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(_a.geometry=this.geometry,_a.material=this.material,_a.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),va.copy(this.boundingSphere),va.applyMatrix4(n),e.ray.intersectsSphere(va)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,fr),Tp.multiplyMatrices(n,fr),_a.matrixWorld=Tp,_a.raycast(e,nc);for(let a=0,o=nc.length;a<o;a++){const c=nc[a];c.instanceId=s,c.object=this,t.push(c)}nc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Rd(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new ha(new Float32Array(i*this.count),i,this.count,as,Nt));const s=this.morphTexture.source.data.data;let a=0;for(let l=0;l<n.length;l++)a+=n[l];const o=this.geometry.morphTargetsRelative?1:1-a,c=i*e;s[c]=o,s.set(n,c+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const vh=new B,Qv=new B,Gv=new Qe;class Ts{constructor(e=new B(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=vh.subVectors(n,t).cross(Qv.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(vh),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const 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){const n=t||Gv.getNormalMatrix(e),i=this.coplanarPoint(vh).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),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)}}const xs=new Wn,Hv=new pe(.5,.5),ic=new B;class Sf{constructor(e=new Ts,t=new Ts,n=new Ts,i=new Ts,s=new Ts,a=new Ts){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,s=e.elements,a=s[0],o=s[1],c=s[2],l=s[3],u=s[4],h=s[5],d=s[6],f=s[7],p=s[8],g=s[9],m=s[10],A=s[11],x=s[12],_=s[13],b=s[14],v=s[15];if(i[0].setComponents(l-a,f-u,A-p,v-x).normalize(),i[1].setComponents(l+a,f+u,A+p,v+x).normalize(),i[2].setComponents(l+o,f+h,A+g,v+_).normalize(),i[3].setComponents(l-o,f-h,A-g,v-_).normalize(),n)i[4].setComponents(c,d,m,b).normalize(),i[5].setComponents(l-c,f-d,A-m,v-b).normalize();else if(i[4].setComponents(l-c,f-d,A-m,v-b).normalize(),t===Ai)i[5].setComponents(l+c,f+d,A+m,v+b).normalize();else if(t===ml)i[5].setComponents(c,d,m,b).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),xs.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),xs.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(xs)}intersectsSprite(e){xs.center.set(0,0,0);const t=Hv.distanceTo(e.center);return xs.radius=.7071067811865476+t,xs.applyMatrix4(e.matrixWorld),this.intersectsSphere(xs)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(ic.x=i.normal.x>0?e.max.x:e.min.x,ic.y=i.normal.y>0?e.max.y:e.min.y,ic.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(ic)<0)return!1}return!0}containsPoint(e){const 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)}}class B0 extends ei{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ie(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}}const bl=new B,_l=new B,Bp=new Ue,Ea=new Bo,sc=new Wn,Eh=new B,Dp=new B;class Eo extends mt{constructor(e=new sn,t=new B0){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(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)bl.fromBufferAttribute(t,i-1),_l.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=bl.distanceTo(_l);e.setAttribute("lineDistance",new Jt(n,1))}else we("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),sc.copy(n.boundingSphere),sc.applyMatrix4(i),sc.radius+=s,e.ray.intersectsSphere(sc)===!1)return;Bp.copy(i).invert(),Ea.copy(e.ray).applyMatrix4(Bp);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){const f=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);for(let g=f,m=p-1;g<m;g+=l){const A=u.getX(g),x=u.getX(g+1),_=rc(this,e,Ea,c,A,x,g);_&&t.push(_)}if(this.isLineLoop){const g=u.getX(p-1),m=u.getX(f),A=rc(this,e,Ea,c,g,m,p-1);A&&t.push(A)}}else{const f=Math.max(0,a.start),p=Math.min(d.count,a.start+a.count);for(let g=f,m=p-1;g<m;g+=l){const A=rc(this,e,Ea,c,g,g+1,g);A&&t.push(A)}if(this.isLineLoop){const g=rc(this,e,Ea,c,p-1,f,p-1);g&&t.push(g)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function rc(r,e,t,n,i,s,a){const o=r.geometry.attributes.position;if(bl.fromBufferAttribute(o,i),_l.fromBufferAttribute(o,s),t.distanceSqToSegment(bl,_l,Eh,Dp)>n)return;Eh.applyMatrix4(r.matrixWorld);const l=e.ray.origin.distanceTo(Eh);if(!(l<e.near||l>e.far))return{distance:l,point:Dp.clone().applyMatrix4(r.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:r}}const Lp=new B,Fp=new B;class zv extends Eo{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Lp.fromBufferAttribute(t,i),Fp.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Lp.distanceTo(Fp);e.setAttribute("lineDistance",new Jt(n,1))}else we("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Vv extends Eo{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class D0 extends ei{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ie(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Pp=new Ue,Bd=new Bo,ac=new Wn,oc=new B;class Wv extends mt{constructor(e=new sn,t=new D0){super(),this.isPoints=!0,this.type="Points",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}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ac.copy(n.boundingSphere),ac.applyMatrix4(i),ac.radius+=s,e.ray.intersectsSphere(ac)===!1)return;Pp.copy(i).invert(),Bd.copy(e.ray).applyMatrix4(Pp);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=n.index,h=n.attributes.position;if(l!==null){const d=Math.max(0,a.start),f=Math.min(l.count,a.start+a.count);for(let p=d,g=f;p<g;p++){const m=l.getX(p);oc.fromBufferAttribute(h,m),Np(oc,m,c,i,e,t,this)}}else{const d=Math.max(0,a.start),f=Math.min(h.count,a.start+a.count);for(let p=d,g=f;p<g;p++)oc.fromBufferAttribute(h,p),Np(oc,p,c,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Np(r,e,t,n,i,s,a){const o=Bd.distanceSqToPoint(r);if(o<t){const c=new B;Bd.closestPointToPoint(r,c),c.applyMatrix4(n);const l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class qv extends Rt{constructor(e,t,n,i,s=We,a=We,o,c,l){super(e,t,n,i,s,a,o,c,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const u=this;function h(){u.needsUpdate=!0,u._requestVideoFrameCallbackId=e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(h))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class Vs extends Rt{constructor(e,t,n,i,s,a,o,c,l,u,h,d){super(null,a,o,c,l,u,i,s,h,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Xv extends Vs{constructor(e,t,n,i,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Lt,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class $v extends Vs{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,us),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Dd extends Rt{constructor(e,t,n,i,s,a,o,c,l){super(e,t,n,i,s,a,o,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class yo extends Rt{constructor(e,t,n=ii,i,s,a,o=yt,c=yt,l,u=Vi,h=1){if(u!==Vi&&u!==Os)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:e,height:t,depth:h};super(d,i,s,a,o,c,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Ul(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Yv extends yo{constructor(e,t=ii,n=us,i,s,a=yt,o=yt,c,l=Vi){const u={width:e,height:e,depth:1},h=[u,u,u,u,u,u];super(e,e,t,n,i,s,a,o,c,l),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class L0 extends Rt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class bi{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){we("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,c=s-1,l;for(;o<=c;)if(i=Math.floor(o+(c-o)/2),l=n[i]-a,l<0)o=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===a)return i/(s-1);const u=n[i],d=n[i+1]-u,f=(a-u)/d;return(i+f)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),c=t||(a.isVector2?new pe:new B);return c.copy(o).sub(a).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new B,i=[],s=[],a=[],o=new B,c=new Ue;for(let f=0;f<=e;f++){const p=f/e;i[f]=this.getTangentAt(p,new B)}s[0]=new B,a[0]=new B;let l=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),d<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();const p=Math.acos(Ve(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(c.makeRotationAxis(o,p))}a[f].crossVectors(i[f],s[f])}if(t===!0){let f=Math.acos(Ve(s[0].dot(s[e]),-1,1));f/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(f=-f);for(let p=1;p<=e;p++)s[p].applyMatrix4(c.makeRotationAxis(i[p],f*p)),a[p].crossVectors(i[p],s[p])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.t
vendor: 6,024 bytes, line 41
41ype,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Cf extends bi{constructor(e=0,t=0,n=1,i=1,s=0,a=Math.PI*2,o=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=c}getPoint(e,t=new pe){const n=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const o=this.aStartAngle+e*s;let c=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=c-this.aX,f=l-this.aY;c=d*u-f*h+this.aX,l=d*h+f*u+this.aY}return n.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class jv extends Cf{constructor(e,t,n,i,s,a){super(e,t,n,n,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function If(){let r=0,e=0,t=0,n=0;function i(s,a,o,c){r=s,e=o,t=-3*s+3*a-2*o-c,n=2*s-2*a+o+c}return{initCatmullRom:function(s,a,o,c,l){i(a,o,l*(o-s),l*(c-a))},initNonuniformCatmullRom:function(s,a,o,c,l,u,h){let d=(a-s)/l-(o-s)/(l+u)+(o-a)/u,f=(o-a)/u-(c-a)/(u+h)+(c-o)/h;d*=u,f*=u,i(a,o,d,f)},calc:function(s){const a=s*s,o=a*s;return r+e*s+t*a+n*o}}}const cc=new B,yh=new If,Sh=new If,Ch=new If;class Kv extends bi{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new B){const n=t,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),c=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:c===0&&o===s-1&&(o=s-2,c=1);let l,u;this.closed||o>0?l=i[(o-1)%s]:(cc.subVectors(i[0],i[1]).add(i[0]),l=cc);const h=i[o%s],d=i[(o+1)%s];if(this.closed||o+2<s?u=i[(o+2)%s]:(cc.subVectors(i[s-1],i[s-2]).add(i[s-1]),u=cc),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let p=Math.pow(l.distanceToSquared(h),f),g=Math.pow(h.distanceToSquared(d),f),m=Math.pow(d.distanceToSquared(u),f);g<1e-4&&(g=1),p<1e-4&&(p=g),m<1e-4&&(m=g),yh.initNonuniformCatmullRom(l.x,h.x,d.x,u.x,p,g,m),Sh.initNonuniformCatmullRom(l.y,h.y,d.y,u.y,p,g,m),Ch.initNonuniformCatmullRom(l.z,h.z,d.z,u.z,p,g,m)}else this.curveType==="catmullrom"&&(yh.initCatmullRom(l.x,h.x,d.x,u.x,this.tension),Sh.initCatmullRom(l.y,h.y,d.y,u.y,this.tension),Ch.initCatmullRom(l.z,h.z,d.z,u.z,this.tension));return n.set(yh.calc(c),Sh.calc(c),Ch.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new B().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Up(r,e,t,n,i){const s=(n-e)*.5,a=(i-t)*.5,o=r*r,c=r*o;return(2*t-2*n+s+a)*c+(-3*t+3*n-2*s-a)*o+s*r+t}function Jv(r,e){const t=1-r;return t*t*e}function Zv(r,e){return 2*(1-r)*r*e}function eE(r,e){return r*r*e}function oo(r,e,t,n){return Jv(r,e)+Zv(r,t)+eE(r,n)}function tE(r,e){const t=1-r;return t*t*t*e}function nE(r,e){const t=1-r;return 3*t*t*r*e}function iE(r,e){return 3*(1-r)*r*r*e}function sE(r,e){return r*r*r*e}function co(r,e,t,n,i){return tE(r,e)+nE(r,t)+iE(r,n)+sE(r,i)}class F0 extends bi{constructor(e=new pe,t=new pe,n=new pe,i=new pe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new pe){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(co(e,i.x,s.x,a.x,o.x),co(e,i.y,s.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class rE extends bi{constructor(e=new B,t=new B,n=new B,i=new B){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new B){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(co(e,i.x,s.x,a.x,o.x),co(e,i.y,s.y,a.y,o.y),co(e,i.z,s.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class P0 extends bi{constructor(e=new pe,t=new pe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new pe){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}
vendor: 46,735 bytes, line 41
41getTangent(e,t=new pe){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class aE extends bi{constructor(e=new B,t=new B){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new B){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new B){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class N0 extends bi{constructor(e=new pe,t=new pe,n=new pe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new pe){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(oo(e,i.x,s.x,a.x),oo(e,i.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class oE extends bi{constructor(e=new B,t=new B,n=new B){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new B){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(oo(e,i.x,s.x,a.x),oo(e,i.y,s.y,a.y),oo(e,i.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class U0 extends bi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new pe){const n=t,i=this.points,s=(i.length-1)*e,a=Math.floor(s),o=s-a,c=i[a===0?a:a-1],l=i[a],u=i[a>i.length-2?i.length-1:a+1],h=i[a>i.length-3?i.length-1:a+2];return n.set(Up(o,c.x,l.x,u.x,h.x),Up(o,c.y,l.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new pe().fromArray(i))}return this}}var Op=Object.freeze({__proto__:null,ArcCurve:jv,CatmullRomCurve3:Kv,CubicBezierCurve:F0,CubicBezierCurve3:rE,EllipseCurve:Cf,LineCurve:P0,LineCurve3:aE,QuadraticBezierCurve:N0,QuadraticBezierCurve3:oE,SplineCurve:U0});class cE extends bi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Op[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,o=this.curves[s],c=o.getLength(),l=c===0?0:1-a/c;return o.getPointAt(l,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,c=a.getPoints(o);for(let l=0;l<c.length;l++){const u=c[l];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new Op[i.type]().fromJSON(i))}return this}}class kp extends cE{constructor(e){super(),this.type="Path",this.currentPoint=new pe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new P0(this.currentPoint.clone(),new pe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new N0(this.currentPoint.clone(),new pe(e,t),new pe(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,a){const o=new F0(this.currentPoint.clone(),new pe(e,t),new pe(n,i),new pe(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new U0(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,a){const o=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+o,t+c,n,i,s,a),this}absarc(e,t,n,i,s,a){return this.absellipse(e,t,n,n,i,s,a),this}ellipse(e,t,n,i,s,a,o,c){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,i,s,a,o,c),this}absellipse(e,t,n,i,s,a,o,c){const l=new Cf(e,t,n,i,s,a,o,c);if(this.curves.length>0){const h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);const u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class O0 extends kp{constructor(e){super(e),this.uuid=zn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new kp().fromJSON(i))}return this}}function lE(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=k0(r,0,i,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,c,l;if(n&&(s=pE(r,e,s,t)),r.length>80*t){o=r[0],c=r[1];let u=o,h=c;for(let d=t;d<i;d+=t){const f=r[d],p=r[d+1];f<o&&(o=f),p<c&&(c=p),f>u&&(u=f),p>h&&(h=p)}l=Math.max(u-o,h-c),l=l!==0?32767/l:0}return So(s,a,t,o,c,l,0),a}function k0(r,e,t,n,i){let s;if(i===CE(r,e,t,n)>0)for(let a=e;a<t;a+=n)s=Qp(a/n|0,r[a],r[a+1],s);else for(let a=t-n;a>=e;a-=n)s=Qp(a/n|0,r[a],r[a+1],s);return s&&na(s,s.next)&&(Io(s),s=s.next),s}function Xs(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(na(t,t.next)||Pt(t.prev,t,t.next)===0)){if(Io(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function So(r,e,t,n,i,s,a){if(!r)return;!a&&s&&bE(r,n,i,s);let o=r;for(;r.prev!==r.next;){const c=r.prev,l=r.next;if(s?uE(r,n,i,s):hE(r)){e.push(c.i,r.i,l.i),Io(r),r=l.next,o=l.next;continue}if(r=l,r===o){a?a===1?(r=dE(Xs(r),e),So(r,e,t,n,i,s,2)):a===2&&fE(r,e,t,n,i,s):So(Xs(r),e,t,n,i,s,1);break}}}function hE(r){const e=r.prev,t=r,n=r.next;if(Pt(e,t,n)>=0)return!1;const i=e.x,s=t.x,a=n.x,o=e.y,c=t.y,l=n.y,u=Math.min(i,s,a),h=Math.min(o,c,l),d=Math.max(i,s,a),f=Math.max(o,c,l);let p=n.next;for(;p!==e;){if(p.x>=u&&p.x<=d&&p.y>=h&&p.y<=f&&$a(i,o,s,c,a,l,p.x,p.y)&&Pt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function uE(r,e,t,n){const i=r.prev,s=r,a=r.next;if(Pt(i,s,a)>=0)return!1;const o=i.x,c=s.x,l=a.x,u=i.y,h=s.y,d=a.y,f=Math.min(o,c,l),p=Math.min(u,h,d),g=Math.max(o,c,l),m=Math.max(u,h,d),A=Ld(f,p,e,t,n),x=Ld(g,m,e,t,n);let _=r.prevZ,b=r.nextZ;for(;_&&_.z>=A&&b&&b.z<=x;){if(_.x>=f&&_.x<=g&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&$a(o,u,c,h,l,d,_.x,_.y)&&Pt(_.prev,_,_.next)>=0||(_=_.prevZ,b.x>=f&&b.x<=g&&b.y>=p&&b.y<=m&&b!==i&&b!==a&&$a(o,u,c,h,l,d,b.x,b.y)&&Pt(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;_&&_.z>=A;){if(_.x>=f&&_.x<=g&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&$a(o,u,c,h,l,d,_.x,_.y)&&Pt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=g&&b.y>=p&&b.y<=m&&b!==i&&b!==a&&$a(o,u,c,h,l,d,b.x,b.y)&&Pt(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function dE(r,e){let t=r;do{const n=t.prev,i=t.next.next;!na(n,i)&&G0(n,t,t.next,i)&&Co(n,i)&&Co(i,n)&&(e.push(n.i,t.i,i.i),Io(t),Io(t.next),t=r=i),t=t.next}while(t!==r);return Xs(t)}function fE(r,e,t,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&EE(a,o)){let c=H0(a,o);a=Xs(a,a.next),c=Xs(c,c.next),So(a,e,t,n,i,s,0),So(c,e,t,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function pE(r,e,t,n){const i=[];for(let s=0,a=e.length;s<a;s++){const o=e[s]*n,c=s<a-1?e[s+1]*n:r.length,l=k0(r,o,c,n,!1);l===l.next&&(l.steiner=!0),i.push(vE(l))}i.sort(AE);for(let s=0;s<i.length;s++)t=mE(i[s],t);return t}function AE(r,e){let t=r.x-e.x;if(t===0&&(t=r.y-e.y,t===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function mE(r,e){const t=gE(r,e);if(!t)return e;const n=H0(t,r);return Xs(n,n.next),Xs(t,t.next)}function gE(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,a;if(na(r,t))return t;do{if(na(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const h=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(h<=n&&h>s&&(s=h,a=t.x<t.next.x?t:t.next,h===n))return a}t=t.next}while(t!==e);if(!a)return null;const o=a,c=a.x,l=a.y;let u=1/0;t=a;do{if(n>=t.x&&t.x>=c&&n!==t.x&&Q0(i<l?n:s,i,c,l,i<l?s:n,i,t.x,t.y)){const h=Math.abs(i-t.y)/(n-t.x);Co(t,r)&&(h<u||h===u&&(t.x>a.x||t.x===a.x&&xE(a,t)))&&(a=t,u=h)}t=t.next}while(t!==o);return a}function xE(r,e){return Pt(r.prev,r,e.prev)<0&&Pt(e.next,r,r.next)<0}function bE(r,e,t,n){let i=r;do i.z===0&&(i.z=Ld(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,_E(i)}function _E(r){let e,t=1;do{let n=r,i;r=null;let s=null;for(e=0;n;){e++;let a=n,o=0;for(let l=0;l<t&&(o++,a=a.nextZ,!!a);l++);let c=t;for(;o>0||c>0&&a;)o!==0&&(c===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,o--):(i=a,a=a.nextZ,c--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;n=a}s.nextZ=null,t*=2}while(e>1);return r}function Ld(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function vE(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Q0(r,e,t,n,i,s,a,o){return(i-a)*(e-o)>=(r-a)*(s-o)&&(r-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(i-a)*(n-o)}function $a(r,e,t,n,i,s,a,o){return!(r===a&&e===o)&&Q0(r,e,t,n,i,s,a,o)}function EE(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!yE(r,e)&&(Co(r,e)&&Co(e,r)&&SE(r,e)&&(Pt(r.prev,r,e.prev)||Pt(r,e.prev,e))||na(r,e)&&Pt(r.prev,r,r.next)>0&&Pt(e.prev,e,e.next)>0)}function Pt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function na(r,e){return r.x===e.x&&r.y===e.y}function G0(r,e,t,n){const i=hc(Pt(r,e,t)),s=hc(Pt(r,e,n)),a=hc(Pt(t,n,r)),o=hc(Pt(t,n,e));return!!(i!==s&&a!==o||i===0&&lc(r,t,e)||s===0&&lc(r,n,e)||a===0&&lc(t,r,n)||o===0&&lc(t,e,n))}function lc(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function hc(r){return r>0?1:r<0?-1:0}function yE(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&G0(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Co(r,e){return Pt(r.prev,r,r.next)<0?Pt(r,e,r.next)>=0&&Pt(r,r.prev,e)>=0:Pt(r,e,r.prev)<0||Pt(r,r.next,e)<0}function SE(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function H0(r,e){const t=Fd(r.i,r.x,r.y),n=Fd(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function Qp(r,e,t,n){const i=Fd(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Io(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Fd(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function CE(r,e,t,n){let i=0;for(let s=e,a=t-n;s<t;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class IE{static triangulate(e,t,n=2){return lE(e,t,n)}}class lo{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return lo.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];Gp(e),Hp(n,e);let a=e.length;t.forEach(Gp);for(let c=0;c<t.length;c++)i.push(a),a+=t[c].length,Hp(n,t[c]);const o=IE.triangulate(n,i);for(let c=0;c<o.length;c+=3)s.push(o.slice(c,c+3));return s}}function Gp(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function Hp(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class si extends sn{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,o=Math.floor(n),c=Math.floor(i),l=o+1,u=c+1,h=e/o,d=t/c,f=[],p=[],g=[],m=[];for(let A=0;A<u;A++){const x=A*d-a;for(let _=0;_<l;_++){const b=_*h-s;p.push(b,-x,0),g.push(0,0,1),m.push(_/o),m.push(1-A/c)}}for(let A=0;A<c;A++)for(let x=0;x<o;x++){const _=x+l*A,b=x+l*(A+1),v=x+1+l*(A+1),C=x+1+l*A;f.push(_,b,C),f.push(b,v,C)}this.setIndex(f),this.setAttribute("position",new Jt(p,3)),this.setAttribute("normal",new Jt(g,3)),this.setAttribute("uv",new Jt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new si(e.width,e.height,e.widthSegments,e.heightSegments)}}class Mf extends sn{constructor(e=new O0([new pe(0,.5),new pe(-.5,-.5),new pe(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],a=[];let o=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let u=0;u<e.length;u++)l(e[u]),this.addGroup(o,c,u),o+=c,c=0;this.setIndex(n),this.setAttribute("position",new Jt(i,3)),this.setAttribute("normal",new Jt(s,3)),this.setAttribute("uv",new Jt(a,2));function l(u){const h=i.length/3,d=u.extractPoints(t);let f=d.shape;const p=d.holes;lo.isClockWise(f)===!1&&(f=f.reverse());for(let m=0,A=p.length;m<A;m++){const x=p[m];lo.isClockWise(x)===!0&&(p[m]=x.reverse())}const g=lo.triangulateShape(f,p);for(let m=0,A=p.length;m<A;m++){const x=p[m];f=f.concat(x)}for(let m=0,A=f.length;m<A;m++){const x=f[m];i.push(x.x,x.y,0),s.push(0,0,1),a.push(x.x,x.y)}for(let m=0,A=g.length;m<A;m++){const x=g[m],_=x[0]+h,b=x[1]+h,v=x[2]+h;n.push(_,b,v),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return ME(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=t[e.shapes[i]];n.push(a)}return new Mf(n,e.curveSegments)}}function ME(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class wf extends sn{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const c=Math.min(a+o,Math.PI);let l=0;const u=[],h=new B,d=new B,f=[],p=[],g=[],m=[];for(let A=0;A<=n;A++){const x=[],_=A/n;let b=0;A===0&&a===0?b=.5/t:A===n&&c===Math.PI&&(b=-.5/t);for(let v=0;v<=t;v++){const C=v/t;h.x=-e*Math.cos(i+C*s)*Math.sin(a+_*o),h.y=e*Math.cos(a+_*o),h.z=e*Math.sin(i+C*s)*Math.sin(a+_*o),p.push(h.x,h.y,h.z),d.copy(h).normalize(),g.push(d.x,d.y,d.z),m.push(C+b,1-_),x.push(l++)}u.push(x)}for(let A=0;A<n;A++)for(let x=0;x<t;x++){const _=u[A][x+1],b=u[A][x],v=u[A+1][x],C=u[A+1][x+1];(A!==0||a>0)&&f.push(_,b,C),(A!==n-1||c<Math.PI)&&f.push(b,v,C)}this.setIndex(f),this.setAttribute("position",new Jt(p,3)),this.setAttribute("normal",new Jt(g,3)),this.setAttribute("uv",new Jt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wf(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class wE extends _n{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Mo extends ei{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ie(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ie(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=x0,this.normalScale=new pe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Vn,this.envMapIntensity=1,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.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,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.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,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}}class _i extends Mo{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new pe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ve(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ie(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ie(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ie(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class z0 extends ei{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=k_,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}}class TE extends ei{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 uc(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function RE(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function zp(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let c=0;c!==e;++c)i[a++]=r[o+c]}return i}function V0(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push(...a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}class Do{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let c=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=s,s=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class BE extends Do{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Lr,endingEnd:Lr}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,o=i[s],c=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Fr:s=e,o=2*t-n;break;case pl:s=i.length-2,o=t+i[s]-i[s+1];break;default:s=e,o=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Fr:a=e,c=2*n-t;break;case pl:a=1,c=n+i[1]-i[0];break;default:a=e-1,c=t}const l=(n-t)*.5,u=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(c-n),this._offsetPrev=s*u,this._offsetNext=a*u}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(i-t),g=p*p,m=g*p,A=-d*m+2*d*g-d*p,x=(1+d)*m+(-1.5-2*d)*g+(-.5+d)*p+1,_=(-1-f)*m+(1.5+f)*g+.5*p,b=f*m-f*g;for(let v=0;v!==o;++v)s[v]=A*a[u+v]+x*a[l+v]+_*a[c+v]+b*a[h+v];return s}}class W0 extends Do{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,u=(n-t)/(i-t),h=1-u;for(let d=0;d!==o;++d)s[d]=a[l+d]*h+a[c+d]*u;return s}}class DE extends Do{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class ai{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=uc(t,this.TimeBufferType),this.values=uc(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:uc(e.times,Array),values:uc(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new DE(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new W0(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new BE(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Jr:t=this.InterpolantFactoryMethodDiscrete;break;case Zr:t=this.InterpolantFactoryMethodLinear;break;case Kl:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return we("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Jr;case this.InterpolantFactoryMethodLinear:return Zr;case this.InterpolantFactoryMethodSmooth:return Kl}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(Fe("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(Fe("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const c=n[o];if(typeof c=="number"&&isNaN(c)){Fe("KeyframeTrack: Time is not a valid number.",this,o,c),e=!1;break}if(a!==null&&a>c){Fe("KeyframeTrack: Out of order keys.",this,o,c,a),e=!1;break}a=c}if(i!==void 0&&X_(i))for(let o=0,c=i.length;o!==c;++o){const l=i[o];if(isNaN(l)){Fe("KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Kl,s=e.length-1;let a=1;for(let o=1;o<s;++o){let c=!1;const l=e[o],u=e[o+1];if(l!==u&&(o!==1||l!==e[0]))if(i)c=!0;else{const h=o*n,d=h-n,f=h+n;for(let p=0;p!==n;++p){const g=t[h+p];if(g!==t[d+p]||g!==t[f+p]){c=!0;break}}}if(c){if(o!==a){e[a]=e[o];const h=o*n,d=a*n;for(let f=0;f!==n;++f)t[d+f]=t[h+f]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,c=a*n,l=0;l!==n;++l)t[c+l]=t[o+l];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}ai.prototype.ValueTypeName="";ai.prototype.TimeBufferType=Float32Array;ai.prototype.ValueBufferType=Float32Array;ai.prototype.DefaultInterpolation=Zr;class ua extends ai{constructor(e,t,n){super(e,t,n)}}ua.prototype.ValueTypeName="bool";ua.prototype.ValueBufferType=Array;ua.prototype.DefaultInterpolation=Jr;ua.prototype.InterpolantFactoryMethodLinear=void 0;ua.prototype.InterpolantFactoryMethodSmooth=void 0;class q0 extends ai{constructor(e,t,n,i){super(e,t,n,i)}}q0.prototype.ValueTypeName="color";class ia extends ai{constructor(e,t,n,i){super(e,t,n,i)}}ia.prototype.ValueTypeName="number";class LE extends Do{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-t)/(i-t);let l=e*o;for(let u=l+o;l!==u;l+=4)xn.slerpFlat(s,0,a,l-o,a,l,c);return s}}class sa extends ai{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new LE(this.times,this.values,this.getValueSize(),e)}}sa.prototype.ValueTypeName="quaternion";sa.prototype.InterpolantFactoryMethodSmooth=void 0;class da extends ai{constructor(e,t,n){super(e,t,n)}}da.prototype.ValueTypeName="string";da.prototype.ValueBufferType=Array;da.prototype.DefaultInterpolation=Jr;da.prototype.InterpolantFactoryMethodLinear=void 0;da.prototype.InterpolantFactoryMethodSmooth=void 0;class ra extends ai{constructor(e,t,n,i){super(e,t,n,i)}}ra.prototype.ValueTypeName="vector";class Pd{constructor(e="",t=-1,n=[],i=xf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=zn(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(PE(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,a=n.length;s!==a;++s)t.push(ai.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let o=0;o<s;o++){let c=[],l=[];c.push((o+s-1)%s,o,(o+1)%s),l.push(0,1,0);const u=RE(c);c=zp(c,1,u),l=zp(l,1,u),!i&&c[0]===0&&(c.push(s),l.push(l[0])),a.push(new ia(".morphTargetInfluences["+t[o].name+"]",c,l).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,c=e.length;o<c;o++){const l=e[o],u=l.name.match(s);if(u&&u.length>1){const h=u[1];let d=i[h];d||(i[h]=d=[]),d.push(l)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(we("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Fe("AnimationClip: No animation in JSONLoader data."),null;const n=function(h,d,f,p,g){if(f.length!==0){const m=[],A=[];V0(f,m,A,p),m.length!==0&&g.push(new h(d,m,A))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let h=0;h<l.length;h++){const d=l[h].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let p;for(p=0;p<d.length;p++)if(d[p].morphTargets)for(let g=0;g<d[p].morphTargets.length;g++)f[d[p].morphTargets[g]]=-1;for(const g in f){const m=[],A=[];for(let x=0;x!==d[p].morphTargets.length;++x){const _=d[p];m.push(_.time),A.push(_.morphTarget===g?1:0)}i.push(new ia(".morphTargetInfluence["+g+"]",m,A))}c=f.length*a}else{const f=".bones["+t[h].name+"]";n(ra,f+".position",d,"pos",i),n(sa,f+".quaternion",d,"rot",i),n(ra,f+".scale",d,"scl",i)}}return i.length===0?null:new this(s,c,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function FE(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ia;case"vector":case"vector2":case"vector3":case"vector4":return ra;case"color":return q0;case"quaternion":return sa;case"bool":case"boolean":return ua;case"string":return da}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function PE(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=FE(r.type);if(r.times===void 0){const t=[],n=[];V0(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const Qi={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class X0{constructor(e,t,n){const i=this;let s=!1,a=0,o=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){o++,s===!1&&i.onStart!==void 0&&i.onStart(u,a,o),s=!0},this.itemEnd=function(u){a++,i.onProgress!==void 0&&i.onProgress(u,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,h){return l.push(u,h),this},this.removeHandler=function(u){const h=l.indexOf(u);return h!==-1&&l.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=l.length;h<d;h+=2){const f=l[h],p=l[h+1];if(f.global&&(f.lastIndex=0),f.test(u))return p}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const NE=new X0;class vi{constructor(e){this.manager=e!==void 0?e:NE,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}vi.DEFAULT_MATERIAL_NAME="__DEFAULT";const wi={};class UE extends Error{constructor(e,t){super(e),this.response=t}}class zi extends vi{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Qi.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(wi[e]!==void 0){wi[e].push({onLoad:t,onProgress:n,onError:i});return}wi[e]=[],wi[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,c=this.responseType;fetch(a).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&we("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const u=wi[e],h=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),f=d?parseInt(d):0,p=f!==0;let g=0;const m=new ReadableStream({start(A){x();function x(){h.read().then(({done:_,value:b})=>{if(_)A.close();else{g+=b.byteLength;const v=new ProgressEvent("progress",{lengthComputable:p,loaded:g,total:f});for(let C=0,M=u.length;C<M;C++){const w=u[C];w.onProgress&&w.onProgress(v)}A.enqueue(b),x()}},_=>{A.error(_)})}}});return new Response(m)}else throw new UE(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,o));case"json":return l.json();default:if(o==="")return l.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),d=h&&h[1]?h[1].toLowerCase():void 0,f=new TextDecoder(d);return l.arrayBuffer().then(p=>f.decode(p))}}}).then(l=>{Qi.add(`file:${e}`,l);const u=wi[e];delete wi[e];for(let h=0,d=u.length;h<d;h++){const f=u[h];f.onLoad&&f.onLoad(l)}}).catch(l=>{const u=wi[e];if(u===void 0)throw this.manager.itemError(e),l;delete wi[e];for(let h=0,d=u.length;h<d;h++){const f=u[h];f.onError&&f.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const pr=new WeakMap;class OE extends vi{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Qi.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0);else{let h=pr.get(a);h===void 0&&(h=[],pr.set(a,h)),h.push({onLoad:t,onError:i})}return a}const o=_o("img");function c(){u(),t&&t(this);const h=pr.get(this)||[];for(let d=0;d<h.length;d++){const f=h[d];f.onLoad&&f.onLoad(this)}pr.delete(this),s.manager.itemEnd(e)}function l(h){u(),i&&i(h),Qi.remove(`image:${e}`);const d=pr.get(this)||[];for(let f=0;f<d.length;f++){const p=d[f];p.onError&&p.onError(h)}pr.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){o.removeEventListener("load",c,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",c,!1),o.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),Qi.add(`image:${e}`,o),s.manager.itemStart(e),o.src=e,o}}class kE extends vi{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new ha,o=new zi(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(c){let l;try{l=s.parse(c)}catch(u){if(i!==void 0)i(u);else{u(u);return}}l.image!==void 0?a.image=l.image:l.data!==void 0&&(a.image.width=l.width,a.image.height=l.height,a.image.data=l.data),a.wrapS=l.wrapS!==void 0?l.wrapS:Lt,a.wrapT=l.wrapT!==void 0?l.wrapT:Lt,a.magFilter=l.magFilter!==void 0?l.magFilter:We,a.minFilter=l.minFilter!==void 0?l.minFilter:We,a.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(a.colorSpace=l.colorSpace),l.flipY!==void 0&&(a.flipY=l.flipY),l.format!==void 0&&(a.format=l.format),l.type!==void 0&&(a.type=l.type),l.mipmaps!==void 0&&(a.mipmaps=l.mipmaps,a.minFilter=gn),l.mipmapCount===1&&(a.minFilter=We),l.generateMipmaps!==void 0&&(a.generateMipmaps=l.generateMipmaps),a.needsUpdate=!0,t&&t(a,l)},n,i),a}}class $0 extends vi{constructor(e){super(e)}load(e,t,n,i){const s=new Rt,a=new OE(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class Ql extends mt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ie(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}const Ih=new Ue,Vp=new B,Wp=new B;class Tf{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new pe(512,512),this.mapType=Le,this.map=null,this.mapPass=null,this.matrix=new Ue,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Sf,this._frameExtents=new pe(1,1),this._viewportCount=1,this._viewports=[new Mt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Vp.setFromMatrixPosition(e.matrixWorld),t.position.copy(Vp),Wp.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Wp),t.updateMatrixWorld(),Ih.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ih,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Ih)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class QE extends Tf{constructor(){super(new tn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=ea*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class GE extends Ql{constructor(e,t,n=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(mt.DEFAULT_UP),this.updateMatrix(),this.target=new mt,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new QE}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class HE extends Tf{constructor(){super(new tn(90,1,.5,500)),this.isPointLightShadow=!0}}class Y0 extends Ql{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new HE}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class Js extends M0{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
41phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,c=i-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,o-=u*this.view.offsetY,c=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class zE extends Tf{constructor(){super(new Js(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class j0 extends Ql{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(mt.DEFAULT_UP),this.updateMatrix(),this.target=new mt,this.shadow=new zE}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class VE{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new B)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class WE extends Ql{constructor(e=new VE,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class ho{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}const Mh=new WeakMap;class qE extends vi{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&we("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&we("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Qi.get(`image-bitmap:${e}`);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(l=>{if(Mh.has(a)===!0)i&&i(Mh.get(a)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(l),s.manager.itemEnd(e),l});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const c=fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){return Qi.add(`image-bitmap:${e}`,l),t&&t(l),s.manager.itemEnd(e),l}).catch(function(l){i&&i(l),Mh.set(c,l),Qi.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});Qi.add(`image-bitmap:${e}`,c),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class XE extends tn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class $E{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[s+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;
vendor: 4,508 bytes, line 41
41for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){xn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;xn.multiplyQuaternionsFlat(e,a,e,t,e,n),xn.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const c=t+o;e[c]=e[c]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[n+a]*i}}}const Rf="\\[\\]\\.:\\/",YE=new RegExp("["+Rf+"]","g"),Bf="[^"+Rf+"]",jE="[^"+Rf.replace("\\.","")+"]",KE=/((?:WC+[\/:])*)/.source.replace("WC",Bf),JE=/(WCOD+)?/.source.replace("WCOD",jE),ZE=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Bf),ey=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Bf),ty=new RegExp("^"+KE+JE+ZE+ey+"$"),ny=["material","materials","bones","map"];class iy{constructor(e,t,n){const i=n||nt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class nt{constructor(e,t,n){this.path=t,this.parsedPath=n||nt.parseTrackName(t),this.node=nt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new nt.Composite(e,t,n):new nt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(YE,"")}static parseTrackName(e){const t=ty.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);ny.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const c=n(o.children);if(c)return c}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}
vendor: 15,718 bytes, line 41
41_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=nt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){we("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){Fe("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Fe("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Fe("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===l){l=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Fe("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Fe("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Fe("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){Fe("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const a=e[i];if(a===void 0){const l=t.nodeName;Fe("PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Fe("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Fe("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}c=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(c=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}nt.Composite=iy;nt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};nt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};nt.prototype.GetterByBindingType=[nt.prototype._getValue_direct,nt.prototype._getValue_array,nt.prototype._getValue_arrayElement,nt.prototype._getValue_toArray];nt.prototype.SetterByBindingTypeAndVersioning=[[nt.prototype._setValue_direct,nt.prototype._setValue_direct_setNeedsUpdate,nt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[nt.prototype._setValue_array,nt.prototype._setValue_array_setNeedsUpdate,nt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[nt.prototype._setValue_arrayElement,nt.prototype._setValue_arrayElement_setNeedsUpdate,nt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[nt.prototype._setValue_fromArray,nt.prototype._setValue_fromArray_setNeedsUpdate,nt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class sy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,a=s.length,o=new Array(a),c={endingStart:Lr,endingEnd:Lr};for(let l=0;l!==a;++l){const u=s[l].createInterpolant(null);o[l]=u,u.settings=c}this._interpolantSettings=c,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Gr,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,s=e._clip.duration,a=s/i,o=i/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const c=o.parameterPositions,l=o.sampleValues;return c[0]=s,c[1]=s+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const c=(e-s)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case U_:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(a),l[u].accumulateAdditive(o);break;case xf:default:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(a),l[u].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===fl;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===bo){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const o=Math.floor(i/t);i-=t*o,s+=Math.abs(o);const c=this.repetitions-s;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Fr,i.endingEnd=Fr):(e?i.endingStart=this.zeroSlopeAtStart?Fr:Lr:i.endingStart=pl,t?i.endingEnd=this.zeroSlopeAtEnd?Fr:Lr:i.endingEnd=pl)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,c=a.sampleValues;return o[0]=s,c[0]=t,o[1]=s+e,c[1]=n,this}}const ry=new Float32Array(1);class ay extends ri{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let u=l[c];u===void 0&&(u={},l[c]=u);for(let h=0;h!==s;++h){const d=i[h],f=d.name;let p=u[f];if(p!==void 0)++p.referenceCount,a[h]=p;else{if(p=a[h],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,c,f));continue}const g=t&&t._propertyBindings[h].binding.parsedPath;p=new $E(nt.create(n,f,g),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,c,f),a[h]=p}o[h].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],c=o.knownActions,l=c[c.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,c[u]=l,c.pop(),e._byClipCacheIndex=null;const h=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete h[d],c.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,o=a[i],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete o[s],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new W0(new Float32Array(2),new Float32Array(2),1,ry),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let a=typeof e=="string"?Pd.findByName(i,e):e;const o=a!==null?a.uuid:e,c=this._actionsByClip[o];let l=null;if(n===void 0&&(a!==null?n=a.blendMode:n=xf),c!==void 0){const h=c.actionByRoot[s];if(h!==void 0&&h.blendMode===n)return h;l=c.knownActions[0],a===null&&(a=l._clip)}if(a===null)return null;const u=new sy(this,a,t,n);return this._bindAction(u,l),this._addInactiveAction(u,o,s),u}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?Pd.findByName(n,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,s,a);const o=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)o[l].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const a=s.knownActions;for(let o=0,c=a.length;o!==c;++o){const l=a[o];this._deactivateAction(l);const u=l._cacheIndex,h=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,c=o[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}const qp=new Ue;class oy{constructor(e,t,n=0,i=1/0){this.ray=new Bo(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Ef,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Fe("Raycaster:
41Unsupported camera type: "+t.type)}setFromXRController(e){return qp.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(qp),this}intersectObject(e,t=!0,n=[]){return Nd(e,this,n,t),n.sort(Xp),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)Nd(e[i],this,n,t);return n.sort(Xp),n}}function Xp(r,e){return r.distance-e.distance}function Nd(r,e,t,n){let i=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let a=0,o=s.length;a<o;a++)Nd(s[a],e,t,!0)}}class Wc{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Ve(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Ve(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}function $p(r,e,t,n){const i=cy(n);switch(t){case m0:return r*e;case as:return r*e/i.components*i.byteLength;case Af:return r*e/i.components*i.byteLength;case Jn:return r*e*2/i.components*i.byteLength;case mf:return r*e*2/i.components*i.byteLength;case Ao:return r*e*3/i.components*i.byteLength;case Tt:return r*e*4/i.components*i.byteLength;case gf:return r*e*4/i.components*i.byteLength;case Or:case Hs:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case kr:case so:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case fd:case mo:return Math.max(r,16)*Math.max(e,8)/4;case nl:case jr:return Math.max(r,8)*Math.max(e,8)/2;case il:case go:case sl:case rl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case xo:case al:case ol:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case zs:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case pd:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ad:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case md:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Qr:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case gd:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case xd:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case bd:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case _d:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case vd:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case Ed:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case yd:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Sd:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Cd:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Kr:case Id:case cl:return Math.ceil(r/4)*Math.ceil(e/4)*16;case ll:case hl:return Math.ceil(r/4)*Math.ceil(e/4)*8;case ul:case dl:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function cy(r){switch(r){case Le:case uf:return{byteLength:1,components:1};case fo:case df:case It:return{byteLength:2,components:1};case ff:case pf:return{byteLength:2,components:4};case ii:case Fl:case Nt:return{byteLength:4,components:1};case Pl:case Nl:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Dl}}));typeof window<"u"&&(window.__THREE__?we("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Dl);function K0(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function ly(r){const e=new WeakMap;function t(o,c){const l=o.array,u=o.usage,h=l.byteLength,d=r.createBuffer();r.bindBuffer(c,d),r.bufferData(c,l,u),o.onUploadCallback();let f;if(l instanceof Float32Array)f=r.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)f=r.HALF_FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?f=r.HALF_FLOAT:f=r.UNSIGNED_SHORT;else if(l instanceof Int16Array)f=r.SHORT;else if(l instanceof Uint32Array)f=r.UNSIGNED_INT;else if(l instanceof Int32Array)f=r.INT;else if(l instanceof Int8Array)f=r.BYTE;else if(l instanceof Uint8Array)f=r.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)f=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:d,type:f,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:h}}function n(o,c,l){const u=c.array,h=c.updateRanges;if(r.bindBuffer(l,o),h.length===0)r.bufferSubData(l,0,u);else{h.sort((f,p)=>f.start-p.start);let d=0;for(let f=1;f<h.length;f++){const p=h[d],g=h[f];g.start<=p.start+p.count+1?p.count=Math.max(p.count,g.start+g.count-p.start):(++d,h[d]=g)}h.length=d+1;for(let f=0,p=h.length;f<p;f++){const g=h[f];r.bufferSubData(l,g.start*u.BYTES_PER_ELEMENT,u,g.start,g.count)}c.clearUpdateRanges()}c.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);c&&(r.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const u=e.get(o);(!u||u.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const l=e.get(o);if(l===void 0)e.set(o,t(o,c));else if(l.version<o.version){if(l.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(l.buffer,o,c),l.version=o.version}}return{get:i,remove:s,update:a}}var hy=`#ifdef USE_ALPHAHASH 42 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 43#endif`,uy=`#ifdef USE_ALPHAHASH 44 const float ALPHA_HASH_SCALE = 0.05; 45 float hash2D( vec2 value ) { 46 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 47 } 48 float hash3D( vec3 value ) { 49 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 50 } 51 float getAlphaHashThreshold( vec3 position ) { 52 float maxDeriv = max( 53 length( dFdx( position.xyz ) ), 54 length( dFdy( position.xyz ) ) 55 ); 56 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 57 vec2 pixScales = vec2( 58 exp2( floor( log2( pixScale ) ) ), 59 exp2( ceil( log2( pixScale ) ) ) 60 ); 61 vec2 alpha = vec2( 62 hash3D( floor( pixScales.x * position.xyz ) ), 63 hash3D( floor( pixScales.y * position.xyz ) ) 64 ); 65 float lerpFactor = fract( log2( pixScale ) ); 66 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 67 float a = min( lerpFactor, 1.0 - lerpFactor ); 68 vec3 cases = vec3( 69 x * x / ( 2.0 * a * ( 1.0 - a ) ), 70 ( x - 0.5 * a ) / ( 1.0 - a ), 71 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 72 ); 73 float threshold = ( x < ( 1.0 - a ) ) 74 ? ( ( x < a ) ? cases.x : cases.y ) 75 : cases.z; 76 return clamp( threshold , 1.0e-6, 1.0 ); 77 } 78#endif`,dy=`#ifdef USE_ALPHAMAP 79 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 80#endif`,fy=`#ifdef USE_ALPHAMAP 81 uniform sampler2D alphaMap; 82#endif`,py=`#ifdef USE_ALPHATEST 83 #ifdef ALPHA_TO_COVERAGE 84 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 85 if ( diffuseColor.a == 0.0 ) discard; 86 #else 87 if ( diffuseColor.a < alphaTest ) discard; 88 #endif 89#endif`,Ay=`#ifdef USE_ALPHATEST 90 uniform float alphaTest; 91#endif`,my=`#ifdef USE_AOMAP 92 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 93 reflectedLight.indirectDiffuse *= ambientOcclusion; 94 #if defined( USE_CLEARCOAT ) 95 clearcoatSpecularIndirect *= ambientOcclusion; 96 #endif 97 #if defined( USE_SHEEN ) 98 sheenSpecularIndirect *= ambientOcclusion; 99 #endif 100 #if defined( USE_ENVMAP ) && defined( STANDARD )
101 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 102 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 103 #endif 104#endif`,gy=`#ifdef USE_AOMAP 105 uniform sampler2D aoMap; 106 uniform float aoMapIntensity; 107#endif`,xy=`#ifdef USE_BATCHING 108 #if ! defined( GL_ANGLE_multi_draw ) 109 #define gl_DrawID _gl_DrawID 110 uniform int _gl_DrawID; 111 #endif 112 uniform highp sampler2D batchingTexture; 113 uniform highp usampler2D batchingIdTexture; 114 mat4 getBatchingMatrix( const in float i ) { 115 int size = textureSize( batchingTexture, 0 ).x; 116 int j = int( i ) * 4; 117 int x = j % size; 118 int y = j / size; 119 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 120 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 121 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 122 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 123 return mat4( v1, v2, v3, v4 ); 124 } 125 float getIndirectIndex( const in int i ) { 126 int size = textureSize( batchingIdTexture, 0 ).x; 127 int x = i % size; 128 int y = i / size; 129 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 130 } 131#endif 132#ifdef USE_BATCHING_COLOR 133 uniform sampler2D batchingColorTexture; 134 vec3 getBatchingColor( const in float i ) { 135 int size = textureSize( batchingColorTexture, 0 ).x; 136 int j = int( i ); 137 int x = j % size; 138 int y = j / size; 139 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 140 } 141#endif`,by=`#ifdef USE_BATCHING 142 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 143#endif`,_y=`vec3 transformed = vec3( position ); 144#ifdef USE_ALPHAHASH 145 vPosition = vec3( position ); 146#endif`,vy=`vec3 objectNormal = vec3( normal ); 147#ifdef USE_TANGENT 148 vec3 objectTangent = vec3( tangent.xyz ); 149#endif`,Ey=`float G_BlinnPhong_Implicit( ) { 150 return 0.25; 151} 152float D_BlinnPhong( const in float shininess, const in float dotNH ) { 153 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 154} 155vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 156 vec3 halfDir = normalize( lightDir + viewDir ); 157 float dotNH = saturate( dot( normal, halfDir ) ); 158 float dotVH = saturate( dot( viewDir, halfDir ) ); 159 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 160 float G = G_BlinnPhong_Implicit( ); 161 float D = D_BlinnPhong( shininess, dotNH ); 162 return F * ( G * D ); 163} // validated`,yy=`#ifdef USE_IRIDESCENCE 164 const mat3 XYZ_TO_REC709 = mat3( 165 3.2404542, -0.9692660, 0.0556434, 166 -1.5371385, 1.8760108, -0.2040259, 167 -0.4985314, 0.0415560, 1.0572252 168 ); 169 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 170 vec3 sqrtF0 = sqrt( fresnel0 ); 171 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 172 } 173 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 174 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 175 } 176 float IorToFresnel0( float transmittedIor, float incidentIor ) { 177 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 178 } 179 vec3 evalSensitivity( float OPD, vec3 shift ) { 180 float phase = 2.0 * PI * OPD * 1.0e-9; 181 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 182 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 183 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 184 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 185 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 186 xyz /= 1.0685e-7; 187 vec3 rgb = XYZ_TO_REC709 * xyz; 188 return rgb; 189 } 190 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 191 vec3 I; 192 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 193 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 194 float cosTheta2Sq = 1.0 - sinTheta2Sq; 195 if ( cosTheta2Sq < 0.0 ) { 196 return vec3( 1.0 ); 197 } 198 float cosTheta2 = sqrt( cosTheta2Sq ); 199 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
200 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 201 float T121 = 1.0 - R12; 202 float phi12 = 0.0; 203 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 204 float phi21 = PI - phi12; 205 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 206 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 207 vec3 phi23 = vec3( 0.0 ); 208 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 209 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 210 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 211 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 212 vec3 phi = vec3( phi21 ) + phi23; 213 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 214 vec3 r123 = sqrt( R123 ); 215 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 216 vec3 C0 = R12 + Rs; 217 I = C0; 218 vec3 Cm = Rs - T121; 219 for ( int m = 1; m <= 2; ++ m ) { 220 Cm *= r123; 221 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 222 I += Cm * Sm; 223 } 224 return max( I, vec3( 0.0 ) ); 225 } 226#endif`,Sy=`#ifdef USE_BUMPMAP 227 uniform sampler2D bumpMap; 228 uniform float bumpScale; 229 vec2 dHdxy_fwd() { 230 vec2 dSTdx = dFdx( vBumpMapUv ); 231 vec2 dSTdy = dFdy( vBumpMapUv ); 232 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 233 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 234 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 235 return vec2( dBx, dBy ); 236 } 237 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 238 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 239 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 240 vec3 vN = surf_norm; 241 vec3 R1 = cross( vSigmaY, vN ); 242 vec3 R2 = cross( vN, vSigmaX ); 243 float fDet = dot( vSigmaX, R1 ) * faceDirection; 244 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 245 return normalize( abs( fDet ) * surf_norm - vGrad ); 246 } 247#endif`,Cy=`#if NUM_CLIPPING_PLANES > 0 248 vec4 plane; 249 #ifdef ALPHA_TO_COVERAGE 250 float distanceToPlane, distanceGradient; 251 float clipOpacity = 1.0; 252 #pragma unroll_loop_start 253 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 254 plane = clippingPlanes[ i ]; 255 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 256 distanceGradient = fwidth( distanceToPlane ) / 2.0; 257 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 258 if ( clipOpacity == 0.0 ) discard; 259 } 260 #pragma unroll_loop_end 261 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 262 float unionClipOpacity = 1.0; 263 #pragma unroll_loop_start 264 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 265 plane = clippingPlanes[ i ]; 266 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 267 distanceGradient = fwidth( distanceToPlane ) / 2.0; 268 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 269 } 270 #pragma unroll_loop_end 271 clipOpacity *= 1.0 - unionClipOpacity; 272 #endif 273 diffuseColor.a *= clipOpacity; 274 if ( diffuseColor.a == 0.0 ) discard; 275 #else 276 #pragma unroll_loop_start 277 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 278 plane = clippingPlanes[ i ]; 279 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 280 } 281 #pragma unroll_loop_end 282 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 283 bool clipped = true; 284 #pragma unroll_loop_start 285 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 286 plane = clippingPlanes[ i ]; 287 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 288 } 289 #pragma unroll_loop_end 290 if ( clipped ) discard; 291 #endif 292 #endif 293#endif`,Iy=`#if NUM_CLIPPING_PLANES > 0 294 varying vec3 vClipPosition; 295 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 296#endif`,My=`#if NUM_CLIPPING_PLANES > 0 297 varying vec3 vClipPosition; 298#endif`,wy=`#if NUM_CLIPPING_PLANES > 0 299 vClipPosition = - mvPosition.xyz; 300#endif`,Ty=`#if defined( USE_COLOR_ALPHA ) 301 diffuseColor *= vColor; 302#elif defined( USE_COLOR ) 303 diffuseColor.rgb *= vColor; 304#endif`,Ry=`#if defined( USE_COLOR_ALPHA ) 305 varying vec4 vColor; 306#elif defined( USE_COLOR ) 307 varying vec3 vColor; 308#endif`,By=`#if defined( USE_COLOR_ALPHA ) 309 varying vec4 vColor; 310#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 311 varying vec3 vColor; 312#endif`,Dy=`#if defined( USE_COLOR_ALPHA ) 313 vColor = vec4( 1.0 ); 314#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 315 vColor = vec3( 1.0 ); 316#endif 317#ifdef USE_COLOR 318 vColor *= color; 319#endif 320#ifdef USE_INSTANCING_COLOR 321 vColor.xyz *= instanceColor.xyz; 322#endif 323#ifdef USE_BATCHING_COLOR 324 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 325 vColor.xyz *= batchingColor.xyz; 326#endif`,Ly=`#define PI 3.141592653589793 327#define PI2 6.283185307179586 328#define PI_HALF 1.5707963267948966 329#define RECIPROCAL_PI 0.3183098861837907 330#define RECIPROCAL_PI2 0.15915494309189535 331#define EPSILON 1e-6 332#ifndef saturate 333#define saturate( a ) clamp( a, 0.0, 1.0 ) 334#endif 335#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 336float pow2( const in float x ) { return x*x; } 337vec3 pow2( const in vec3 x ) { return x*x; } 338float pow3( const in float x ) { return x*x*x; } 339float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 340float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 341float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 342highp float rand( const in vec2 uv ) { 343 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 344 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 345 return fract( sin( sn ) * c ); 346} 347#ifdef HIGH_PRECISION 348 float precisionSafeLength( vec3 v ) { return length( v ); } 349#else 350 float precisionSafeLength( vec3 v ) { 351 float maxComponent = max3( abs( v ) ); 352 return length( v / maxComponent ) * maxComponent; 353 } 354#endif 355struct IncidentLight { 356 vec3 color; 357 vec3 direction; 358 bool visible; 359}; 360struct ReflectedLight { 361 vec3 directDiffuse; 362 vec3 directSpecular; 363 vec3 indirectDiffuse; 364 vec3 indirectSpecular; 365}; 366#ifdef USE_ALPHAHASH 367 varying vec3 vPosition; 368#endif 369vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 370 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 371} 372vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 373 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 374} 375bool isPerspectiveMatrix( mat4 m ) { 376 return m[ 2 ][ 3 ] == - 1.0; 377} 378vec2 equirectUv( in vec3 dir ) { 379 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 380 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 381 return vec2( u, v ); 382}
383vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 384 return RECIPROCAL_PI * diffuseColor; 385} 386vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 387 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 388 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 389} 390float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 391 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 392 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 393} // validated`,Fy=`#ifdef ENVMAP_TYPE_CUBE_UV 394 #define cubeUV_minMipLevel 4.0 395 #define cubeUV_minTileSize 16.0 396 float getFace( vec3 direction ) { 397 vec3 absDirection = abs( direction ); 398 float face = - 1.0; 399 if ( absDirection.x > absDirection.z ) { 400 if ( absDirection.x > absDirection.y ) 401 face = direction.x > 0.0 ? 0.0 : 3.0; 402 else 403 face = direction.y > 0.0 ? 1.0 : 4.0; 404 } else { 405 if ( absDirection.z > absDirection.y ) 406 face = direction.z > 0.0 ? 2.0 : 5.0; 407 else 408 face = direction.y > 0.0 ? 1.0 : 4.0; 409 } 410 return face; 411 } 412 vec2 getUV( vec3 direction, float face ) { 413 vec2 uv; 414 if ( face == 0.0 ) { 415 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 416 } else if ( face == 1.0 ) { 417 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 418 } else if ( face == 2.0 ) { 419 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 420 } else if ( face == 3.0 ) { 421 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 422 } else if ( face == 4.0 ) { 423 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 424 } else { 425 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 426 } 427 return 0.5 * ( uv + 1.0 ); 428 } 429 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 430 float face = getFace( direction ); 431 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 432 mipInt = max( mipInt, cubeUV_minMipLevel ); 433 float faceSize = exp2( mipInt ); 434 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 435 if ( face > 2.0 ) { 436 uv.y += faceSize; 437 face -= 3.0; 438 } 439 uv.x += face * faceSize; 440 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 441 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 442 uv.x *= CUBEUV_TEXEL_WIDTH; 443 uv.y *= CUBEUV_TEXEL_HEIGHT; 444 #ifdef texture2DGradEXT 445 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 446 #else 447 return texture2D( envMap, uv ).rgb; 448 #endif 449 } 450 #define cubeUV_r0 1.0 451 #define cubeUV_m0 - 2.0 452 #define cubeUV_r1 0.8 453 #define cubeUV_m1 - 1.0 454 #define cubeUV_r4 0.4 455 #define cubeUV_m4 2.0 456 #define cubeUV_r5 0.305 457 #define cubeUV_m5 3.0 458 #define cubeUV_r6 0.21 459 #define cubeUV_m6 4.0 460 float roughnessToMip( float roughness ) { 461 float mip = 0.0; 462 if ( roughness >= cubeUV_r1 ) { 463 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 464 } else if ( roughness >= cubeUV_r4 ) { 465 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 466 } else if ( roughness >= cubeUV_r5 ) { 467 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 468 } else if ( roughness >= cubeUV_r6 ) { 469 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 470 } else { 471 mip = - 2.0 * log2( 1.16 * roughness ); } 472 return mip; 473 } 474 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 475 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 476 float mipF = fract( mip ); 477 float mipInt = floor( mip ); 478 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 479 if ( mipF == 0.0 ) { 480 return vec4( color0, 1.0 ); 481 } else { 482 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 483 return vec4( mix( color0, color1, mipF ), 1.0 ); 484 } 485 } 486#endif`,Py=`vec3 transformedNormal = objectNormal; 487#ifdef USE_TANGENT 488 vec3 transformedTangent = objectTangent; 489#endif 490#ifdef USE_BATCHING 491 mat3 bm = mat3( batchingMatrix ); 492 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 493 transformedNormal = bm * transformedNormal; 494 #ifdef USE_TANGENT 495 transformedTangent = bm * transformedTangent; 496 #endif 497#endif 498#ifdef USE_INSTANCING 499 mat3 im = mat3( instanceMatrix ); 500 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 501 transformedNormal = im * transformedNormal; 502 #ifdef USE_TANGENT 503 transformedTangent = im * transformedTangent; 504 #endif 505#endif 506transformedNormal = normalMatrix * transformedNormal; 507#ifdef FLIP_SIDED 508 transformedNormal = - transformedNormal; 509#endif 510#ifdef USE_TANGENT 511 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 512 #ifdef FLIP_SIDED 513 transformedTangent = - transformedTangent; 514 #endif 515#endif`,Ny=`#ifdef USE_DISPLACEMENTMAP 516 uniform sampler2D displacementMap; 517 uniform float displacementScale; 518 uniform float displacementBias; 519#endif`,Uy=`#ifdef USE_DISPLACEMENTMAP 520 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
520placementBias ); 521#endif`,Oy=`#ifdef USE_EMISSIVEMAP 522 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 523 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 524 emissiveColor = sRGBTransferEOTF( emissiveColor ); 525 #endif 526 totalEmissiveRadiance *= emissiveColor.rgb; 527#endif`,ky=`#ifdef USE_EMISSIVEMAP 528 uniform sampler2D emissiveMap; 529#endif`,Qy="gl_FragColor = linearToOutputTexel( gl_FragColor );",Gy=`vec4 LinearTransferOETF( in vec4 value ) { 530 return value; 531} 532vec4 sRGBTransferEOTF( in vec4 value ) { 533 return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); 534} 535vec4 sRGBTransferOETF( in vec4 value ) { 536 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 ); 537}`,Hy=`#ifdef USE_ENVMAP 538 #ifdef ENV_WORLDPOS 539 vec3 cameraToFrag; 540 if ( isOrthographic ) { 541 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 542 } else { 543 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 544 } 545 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 546 #ifdef ENVMAP_MODE_REFLECTION 547 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 548 #else 549 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 550 #endif 551 #else 552 vec3 reflectVec = vReflect; 553 #endif 554 #ifdef ENVMAP_TYPE_CUBE 555 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 556 #else 557 vec4 envColor = vec4( 0.0 ); 558 #endif 559 #ifdef ENVMAP_BLENDING_MULTIPLY 560 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 561 #elif defined( ENVMAP_BLENDING_MIX ) 562 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 563 #elif defined( ENVMAP_BLENDING_ADD ) 564 outgoingLight += envColor.xyz * specularStrength * reflectivity; 565 #endif 566#endif`,zy=`#ifdef USE_ENVMAP 567 uniform float envMapIntensity; 568 uniform float flipEnvMap; 569 uniform mat3 envMapRotation; 570 #ifdef ENVMAP_TYPE_CUBE 571 uniform samplerCube envMap; 572 #else 573 uniform sampler2D envMap; 574 #endif 575#endif`,Vy=`#ifdef USE_ENVMAP 576 uniform float reflectivity; 577 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 578 #define ENV_WORLDPOS 579 #endif 580 #ifdef ENV_WORLDPOS 581 varying vec3 vWorldPosition; 582 uniform float refractionRatio; 583 #else 584 varying vec3 vReflect; 585 #endif 586#endif`,Wy=`#ifdef USE_ENVMAP 587 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 588 #define ENV_WORLDPOS 589 #endif 590 #ifdef ENV_WORLDPOS 591 592 varying vec3 vWorldPosition; 593 #else 594 varying vec3 vReflect; 595 uniform float refractionRatio; 596 #endif 597#endif`,qy=`#ifdef USE_ENVMAP 598 #ifdef ENV_WORLDPOS 599 vWorldPosition = worldPosition.xyz; 600 #else 601 vec3 cameraToVertex; 602 if ( isOrthographic ) { 603 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 604 } else {
605 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 606 } 607 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 608 #ifdef ENVMAP_MODE_REFLECTION 609 vReflect = reflect( cameraToVertex, worldNormal ); 610 #else 611 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 612 #endif 613 #endif 614#endif`,Xy=`#ifdef USE_FOG 615 vFogDepth = - mvPosition.z; 616#endif`,$y=`#ifdef USE_FOG 617 varying float vFogDepth; 618#endif`,Yy=`#ifdef USE_FOG 619 #ifdef FOG_EXP2 620 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 621 #else 622 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 623 #endif 624 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 625#endif`,jy=`#ifdef USE_FOG 626 uniform vec3 fogColor; 627 varying float vFogDepth; 628 #ifdef FOG_EXP2 629 uniform float fogDensity; 630 #else 631 uniform float fogNear; 632 uniform float fogFar; 633 #endif 634#endif`,Ky=`#ifdef USE_GRADIENTMAP 635 uniform sampler2D gradientMap; 636#endif 637vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 638 float dotNL = dot( normal, lightDirection ); 639 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 640 #ifdef USE_GRADIENTMAP 641 return vec3( texture2D( gradientMap, coord ).r ); 642 #else 643 vec2 fw = fwidth( coord ) * 0.5; 644 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 645 #endif 646}`,Jy=`#ifdef USE_LIGHTMAP 647 uniform sampler2D lightMap; 648 uniform float lightMapIntensity; 649#endif`,Zy=`LambertMaterial material; 650material.diffuseColor = diffuseColor.rgb; 651material.specularStrength = specularStrength;`,eS=`varying vec3 vViewPosition; 652struct LambertMaterial { 653 vec3 diffuseColor; 654 float specularStrength; 655}; 656void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 657 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 658 vec3 irradiance = dotNL * directLight.color; 659 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 660} 661void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 662 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 663} 664#define RE_Direct RE_Direct_Lambert 665#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,tS=`uniform bool receiveShadow; 666uniform vec3 ambientLightColor; 667#if defined( USE_LIGHT_PROBES ) 668 uniform vec3 lightProbe[ 9 ]; 669#endif 670vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 671 float x = normal.x, y = normal.y, z = normal.z; 672 vec3 result = shCoefficients[ 0 ] * 0.886227; 673 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 674 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 675 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 676 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 677 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 678 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 679 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 680 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 681 return result; 682} 683vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 684 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 685 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 686 return irradiance; 687} 688vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 689 vec3 irradiance = ambientLightColor; 690 return irradiance; 691} 692float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 693 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 694 if ( cutoffDistance > 0.0 ) { 695 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 696 } 697 return distanceFalloff; 698} 699float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 700 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 701} 702#if NUM_DIR_LIGHTS > 0 703 struct DirectionalLight { 704 vec3 direction; 705 vec3 color; 706 }; 707 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 708 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 709 light.color = directionalLight.color; 710 light.direction = directionalLight.direction; 711 light.visible = true; 712 } 713#endif 714#if NUM_POINT_LIGHTS > 0 715 struct PointLight { 716 vec3 position; 717 vec3 color; 718 float distance; 719 float decay; 720 }; 721 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 722 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 723 vec3 lVector = pointLight.position - geometryPosition; 724 light.direction = normalize( lVector ); 725 float lightDistance = length( lVector ); 726 light.color = pointLight.color; 727 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 728 light.visible = ( light.color != vec3( 0.0 ) ); 729 } 730#endif
731#if NUM_SPOT_LIGHTS > 0 732 struct SpotLight { 733 vec3 position; 734 vec3 direction; 735 vec3 color; 736 float distance; 737 float decay; 738 float coneCos; 739 float penumbraCos; 740 }; 741 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 742 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 743 vec3 lVector = spotLight.position - geometryPosition; 744 light.direction = normalize( lVector ); 745 float angleCos = dot( light.direction, spotLight.direction ); 746 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 747 if ( spotAttenuation > 0.0 ) { 748 float lightDistance = length( lVector ); 749 light.color = spotLight.color * spotAttenuation; 750 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 751 light.visible = ( light.color != vec3( 0.0 ) ); 752 } else { 753 light.color = vec3( 0.0 ); 754 light.visible = false; 755 } 756 } 757#endif 758#if NUM_RECT_AREA_LIGHTS > 0 759 struct RectAreaLight { 760 vec3 color; 761 vec3 position; 762 vec3 halfWidth; 763 vec3 halfHeight; 764 }; 765 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 766 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 767#endif 768#if NUM_HEMI_LIGHTS > 0 769 struct HemisphereLight { 770 vec3 direction; 771 vec3 skyColor; 772 vec3 groundColor; 773 }; 774 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 775 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 776 float dotNL = dot( normal, hemiLight.direction ); 777 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 778 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 779 return irradiance; 780 } 781#endif`,nS=`#ifdef USE_ENVMAP 782 vec3 getIBLIrradiance( const in vec3 normal ) { 783 #ifdef ENVMAP_TYPE_CUBE_UV 784 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 785 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 786 return PI * envMapColor.rgb * envMapIntensity; 787 #else 788 return vec3( 0.0 ); 789 #endif 790 } 791 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 792 #ifdef ENVMAP_TYPE_CUBE_UV 793 vec3 reflectVec = reflect( - viewDir, normal ); 794 reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); 795 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 796 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 797 return envMapColor.rgb * envMapIntensity; 798 #else 799 return vec3( 0.0 ); 800 #endif 801 } 802 #ifdef USE_ANISOTROPY 803 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 804 #ifdef ENVMAP_TYPE_CUBE_UV 805 vec3 bentNormal = cross( bitangent, viewDir ); 806 bentNormal = normalize( cross( bentNormal, bitangent ) ); 807 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 808 return getIBLRadiance( viewDir, bentNormal, roughness ); 809 #else 810 return vec3( 0.0 ); 811 #endif 812 } 813 #endif 814#endif`,iS=`ToonMaterial material; 815material.diffuseColor = diffuseColor.rgb;`,sS=`varying vec3 vViewPosition; 816struct ToonMaterial { 817 vec3 diffuseColor; 818}; 819void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 820 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 821 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 822} 823void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 824 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 825} 826#define RE_Direct RE_Direct_Toon 827#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,rS=`BlinnPhongMaterial material; 828material.diffuseColor = diffuseColor.rgb; 829material.specularColor = specular; 830material.specularShininess = shininess; 831material.specularStrength = specularStrength;`,aS=`varying vec3 vViewPosition; 832struct BlinnPhongMaterial { 833 vec3 diffuseColor; 834 vec3 specularColor; 835 float specularShininess; 836 float specularStrength; 837}; 838void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
839 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 840 vec3 irradiance = dotNL * directLight.color; 841 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 842 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 843} 844void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 845 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 846} 847#define RE_Direct RE_Direct_BlinnPhong 848#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,oS=`PhysicalMaterial material; 849material.diffuseColor = diffuseColor.rgb; 850material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 851material.metalness = metalnessFactor; 852vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 853float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 854material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 855material.roughness = min( material.roughness, 1.0 ); 856#ifdef IOR 857 material.ior = ior; 858 #ifdef USE_SPECULAR 859 float specularIntensityFactor = specularIntensity; 860 vec3 specularColorFactor = specularColor; 861 #ifdef USE_SPECULAR_COLORMAP 862 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 863 #endif 864 #ifdef USE_SPECULAR_INTENSITYMAP 865 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 866 #endif 867 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 868 #else 869 float specularIntensityFactor = 1.0; 870 vec3 specularColorFactor = vec3( 1.0 ); 871 material.specularF90 = 1.0; 872 #endif 873 material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; 874 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 875#else 876 material.specularColor = vec3( 0.04 ); 877 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 878 material.specularF90 = 1.0; 879#endif 880#ifdef USE_CLEARCOAT 881 material.clearcoat = clearcoat; 882 material.clearcoatRoughness = clearcoatRoughness; 883 material.clearcoatF0 = vec3( 0.04 ); 884 material.clearcoatF90 = 1.0; 885 #ifdef USE_CLEARCOATMAP 886 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 887 #endif 888 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 889 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 890 #endif 891 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 892 material.clearcoatRoughness += geometryRoughness; 893 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 894#endif 895#ifdef USE_DISPERSION 896 material.dispersion = dispersion; 897#endif 898#ifdef USE_IRIDESCENCE 899 material.iridescence = iridescence; 900 material.iridescenceIOR = iridescenceIOR; 901 #ifdef USE_IRIDESCENCEMAP 902 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 903 #endif 904 #ifdef USE_IRIDESCENCE_THICKNESSMAP 905 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 906 #else 907 material.iridescenceThickness = iridescenceThicknessMaximum; 908 #endif 909#endif 910#ifdef USE_SHEEN 911 material.sheenColor = sheenColor; 912 #ifdef USE_SHEEN_COLORMAP 913 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 914 #endif 915 material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); 916 #ifdef USE_SHEEN_ROUGHNESSMAP 917 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 918 #endif 919#endif 920#ifdef USE_ANISOTROPY 921 #ifdef USE_ANISOTROPYMAP 922 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 923 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 924 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 925 #else 926 vec2 anisotropyV = anisotropyVector; 927 #endif 928 material.anisotropy = length( anisotropyV ); 929 if( material.anisotropy == 0.0 ) { 930 anisotropyV = vec2( 1.0, 0.0 ); 931 } else { 932 anisotropyV /= material.anisotropy; 933 material.anisotropy = saturate( material.anisotropy ); 934 } 935 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
936 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 937 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 938#endif`,cS
vendor: 17,312 bytes, lines 938-1286
938=`uniform sampler2D dfgLUT; 939struct PhysicalMaterial { 940 vec3 diffuseColor; 941 vec3 diffuseContribution; 942 vec3 specularColor; 943 vec3 specularColorBlended; 944 float roughness; 945 float metalness; 946 float specularF90; 947 float dispersion; 948 #ifdef USE_CLEARCOAT 949 float clearcoat; 950 float clearcoatRoughness; 951 vec3 clearcoatF0; 952 float clearcoatF90; 953 #endif 954 #ifdef USE_IRIDESCENCE 955 float iridescence; 956 float iridescenceIOR; 957 float iridescenceThickness; 958 vec3 iridescenceFresnel; 959 vec3 iridescenceF0; 960 vec3 iridescenceFresnelDielectric; 961 vec3 iridescenceFresnelMetallic; 962 #endif 963 #ifdef USE_SHEEN 964 vec3 sheenColor; 965 float sheenRoughness; 966 #endif 967 #ifdef IOR 968 float ior; 969 #endif 970 #ifdef USE_TRANSMISSION 971 float transmission; 972 float transmissionAlpha; 973 float thickness; 974 float attenuationDistance; 975 vec3 attenuationColor; 976 #endif 977 #ifdef USE_ANISOTROPY 978 float anisotropy; 979 float alphaT; 980 vec3 anisotropyT; 981 vec3 anisotropyB; 982 #endif 983}; 984vec3 clearcoatSpecularDirect = vec3( 0.0 ); 985vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 986vec3 sheenSpecularDirect = vec3( 0.0 ); 987vec3 sheenSpecularIndirect = vec3(0.0 ); 988vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 989 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 990 float x2 = x * x; 991 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 992 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 993} 994float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 995 float a2 = pow2( alpha ); 996 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 997 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 998 return 0.5 / max( gv + gl, EPSILON ); 999} 1000float D_GGX( const in float alpha, const in float dotNH ) { 1001 float a2 = pow2( alpha ); 1002 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1003 return RECIPROCAL_PI * a2 / pow2( denom ); 1004} 1005#ifdef USE_ANISOTROPY 1006 float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { 1007 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1008 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1009 float v = 0.5 / ( gv + gl ); 1010 return v; 1011 } 1012 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1013 float a2 = alphaT * alphaB; 1014 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1015 highp float v2 = dot( v, v ); 1016 float w2 = a2 / v2; 1017 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1018 } 1019#endif 1020#ifdef USE_CLEARCOAT 1021 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1022 vec3 f0 = material.clearcoatF0; 1023 float f90 = material.clearcoatF90; 1024 float roughness = material.clearcoatRoughness; 1025 float alpha = pow2( roughness ); 1026 vec3 halfDir = normalize( lightDir + viewDir ); 1027 float dotNL = saturate( dot( normal, lightDir ) ); 1028 float dotNV = saturate( dot( normal, viewDir ) ); 1029 float dotNH = saturate( dot( normal, halfDir ) ); 1030 float dotVH = saturate( dot( viewDir, halfDir ) ); 1031 vec3 F = F_Schlick( f0, f90, dotVH ); 1032 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1033 float D = D_GGX( alpha, dotNH ); 1034 return F * ( V * D ); 1035 } 1036#endif 1037vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1038 vec3 f0 = material.specularColorBlended; 1039 float f90 = material.specularF90; 1040 float roughness = material.roughness; 1041 float alpha = pow2( roughness ); 1042 vec3 halfDir = normalize( lightDir + viewDir ); 1043 float dotNL = saturate( dot( normal, lightDir ) ); 1044 float dotNV = saturate( dot( normal, viewDir ) ); 1045 float dotNH = saturate( dot( normal, halfDir ) ); 1046 float dotVH = saturate( dot( viewDir, halfDir ) ); 1047 vec3 F = F_Schlick( f0, f90, dotVH ); 1048 #ifdef USE_IRIDESCENCE 1049 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1050 #endif 1051 #ifdef USE_ANISOTROPY 1052 float dotTL = dot( material.anisotropyT, lightDir ); 1053 float dotTV = dot( material.anisotropyT, viewDir ); 1054 float dotTH = dot( material.anisotropyT, halfDir ); 1055 float dotBL = dot( material.anisotropyB, lightDir ); 1056 float dotBV = dot( material.anisotropyB, viewDir ); 1057 float dotBH = dot( material.anisotropyB, halfDir ); 1058 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1059 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1060 #else 1061 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1062 float D = D_GGX( alpha, dotNH ); 1063 #endif 1064 return F * ( V * D ); 1065} 1066vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1067 const float LUT_SIZE = 64.0; 1068 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1069 const float LUT_BIAS = 0.5 / LUT_SIZE; 1070 float dotNV = saturate( dot( N, V ) ); 1071 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1072 uv = uv * LUT_SCALE + LUT_BIAS; 1073 return uv; 1074} 1075float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1076 float l = length( f ); 1077 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1078} 1079vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1080 float x = dot( v1, v2 ); 1081 float y = abs( x ); 1082 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1083 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1084 float v = a / b; 1085 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1086 return cross( v1, v2 ) * theta_sintheta; 1087} 1088vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1089 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1090 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1091 vec3 lightNormal = cross( v1, v2 ); 1092 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1093 vec3 T1, T2; 1094 T1 = normalize( V - N * dot( V, N ) ); 1095 T2 = - cross( N, T1 ); 1096 mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); 1097 vec3 coords[ 4 ]; 1098 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1099 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1100 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1101 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1102 coords[ 0 ] = normalize( coords[ 0 ] ); 1103 coords[ 1 ] = normalize( coords[ 1 ] ); 1104 coords[ 2 ] = normalize( coords[ 2 ] ); 1105 coords[ 3 ] = normalize( coords[ 3 ] ); 1106 vec3 vectorFormFactor = vec3( 0.0 ); 1107 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1108 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1109 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1110 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1111 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1112 return vec3( result ); 1113} 1114#if defined( USE_SHEEN ) 1115float D_Charlie( float roughness, float dotNH ) { 1116 float alpha = pow2( roughness ); 1117 float invAlpha = 1.0 / alpha; 1118 float cos2h = dotNH * dotNH; 1119 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1120 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1121} 1122float V_Neubelt( float dotNV, float dotNL ) { 1123 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1124} 1125vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1126 vec3 halfDir = normalize( lightDir + viewDir ); 1127 float dotNL = saturate( dot( normal, lightDir ) ); 1128 float dotNV = saturate( dot( normal, viewDir ) ); 1129 float dotNH = saturate( dot( normal, halfDir ) ); 1130 float D = D_Charlie( sheenRoughness, dotNH ); 1131 float V = V_Neubelt( dotNV, dotNL ); 1132 return sheenColor * ( D * V ); 1133} 1134#endif 1135float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1136 float dotNV = saturate( dot( normal, viewDir ) ); 1137 float r2 = roughness * roughness; 1138 float rInv = 1.0 / ( roughness + 0.1 ); 1139 float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; 1140 float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; 1141 float DG = exp( a * dotNV + b ); 1142 return saturate( DG ); 1143} 1144vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1145 float dotNV = saturate( dot( normal, viewDir ) ); 1146 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1147 return specularColor * fab.x + specularF90 * fab.y; 1148} 1149#ifdef USE_IRIDESCENCE 1150void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1151#else 1152void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1153#endif 1154 float dotNV = saturate( dot( normal, viewDir ) ); 1155 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1156 #ifdef USE_IRIDESCENCE 1157 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1158 #else 1159 vec3 Fr = specularColor; 1160 #endif 1161 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1162 float Ess = fab.x + fab.y; 1163 float Ems = 1.0 - Ess; 1164 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1165 singleScatter += FssEss; 1166 multiScatter += Fms * Ems; 1167} 1168vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1169 vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); 1170 float dotNL = saturate( dot( normal, lightDir ) ); 1171 float dotNV = saturate( dot( normal, viewDir ) ); 1172 vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; 1173 vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; 1174 vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; 1175 vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; 1176 float Ess_V = dfgV.x + dfgV.y; 1177 float Ess_L = dfgL.x + dfgL.y; 1178 float Ems_V = 1.0 - Ess_V; 1179 float Ems_L = 1.0 - Ess_L; 1180 vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; 1181 vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); 1182 float compensationFactor = Ems_V * Ems_L; 1183 vec3 multiScatter = Fms * compensationFactor; 1184 return singleScatter + multiScatter; 1185} 1186#if NUM_RECT_AREA_LIGHTS > 0 1187 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1188 vec3 normal = geometryNormal; 1189 vec3 viewDir = geometryViewDir; 1190 vec3 position = geometryPosition; 1191 vec3 lightPos = rectAreaLight.position; 1192 vec3 halfWidth = rectAreaLight.halfWidth; 1193 vec3 halfHeight = rectAreaLight.halfHeight; 1194 vec3 lightColor = rectAreaLight.color; 1195 float roughness = material.roughness; 1196 vec3 rectCoords[ 4 ]; 1197 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1198 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1199 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1200 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1201 vec4 t1 = texture2D( ltc_1, uv ); 1202 vec4 t2 = texture2D( ltc_2, uv ); 1203 mat3 mInv = mat3( 1204 vec3( t1.x, 0, t1.y ), 1205 vec3( 0, 1, 0 ), 1206 vec3( t1.z, 0, t1.w ) 1207 ); 1208 vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y ); 1209 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1210 reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1211 } 1212#endif 1213void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1214 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1215 vec3 irradiance = dotNL * directLight.color; 1216 #ifdef USE_CLEARCOAT 1217 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1218 vec3 ccIrradiance = dotNLcc * directLight.color; 1219 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1220 #endif 1221 #ifdef USE_SHEEN 1222 1223 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1224 1225 float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1226 float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); 1227 1228 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); 1229 1230 irradiance *= sheenEnergyComp; 1231 1232 #endif 1233 reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); 1234 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); 1235} 1236void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1237 vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); 1238 #ifdef USE_SHEEN 1239 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1240 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1241 diffuse *= sheenEnergyComp; 1242 #endif 1243 reflectedLight.indirectDiffuse += diffuse; 1244} 1245void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1246 #ifdef USE_CLEARCOAT 1247 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1248 #endif 1249 #ifdef USE_SHEEN 1250 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; 1251 #endif 1252 vec3 singleScatteringDielectric = vec3( 0.0 ); 1253 vec3 multiScatteringDielectric = vec3( 0.0 ); 1254 vec3 singleScatteringMetallic = vec3( 0.0 ); 1255 vec3 multiScatteringMetallic = vec3( 0.0 ); 1256 #ifdef USE_IRIDESCENCE 1257 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1258 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1259 #else 1260 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1261 computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1262 #endif 1263 vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); 1264 vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); 1265 vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; 1266 vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); 1267 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1268 vec3 indirectSpecular = radiance * singleScattering; 1269 indirectSpecular += multiScattering * cosineWeightedIrradiance; 1270 vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; 1271 #ifdef USE_SHEEN 1272 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1273 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1274 indirectSpecular *= sheenEnergyComp; 1275 indirectDiffuse *= sheenEnergyComp; 1276 #endif 1277 reflectedLight.indirectSpecular += indirectSpecular; 1278 reflectedLight.indirectDiffuse += indirectDiffuse; 1279} 1280#define RE_Direct RE_Direct_Physical 1281#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1282#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1283#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1284float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1285 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1286}`,
1286lS=` 1287vec3 geometryPosition = - vViewPosition; 1288vec3 geometryNormal = normal; 1289vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1290vec3 geometryClearcoatNormal = vec3( 0.0 ); 1291#ifdef USE_CLEARCOAT 1292 geometryClearcoatNormal = clearcoatNormal; 1293#endif 1294#ifdef USE_IRIDESCENCE 1295 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1296 if ( material.iridescenceThickness == 0.0 ) { 1297 material.iridescence = 0.0; 1298 } else { 1299 material.iridescence = saturate( material.iridescence ); 1300 } 1301 if ( material.iridescence > 0.0 ) { 1302 material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1303 material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); 1304 material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); 1305 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1306 } 1307#endif 1308IncidentLight directLight; 1309#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1310 PointLight pointLight; 1311 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1312 PointLightShadow pointLightShadow; 1313 #endif 1314 #pragma unroll_loop_start 1315 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1316 pointLight = pointLights[ i ]; 1317 getPointLightInfo( pointLight, geometryPosition, directLight ); 1318 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 1319 pointLightShadow = pointLightShadows[ i ]; 1320 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1321 #endif 1322 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1323 } 1324 #pragma unroll_loop_end 1325#endif 1326#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1327 SpotLight spotLight; 1328 vec4 spotColor; 1329 vec3 spotLightCoord; 1330 bool inSpotLightMap; 1331 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1332 SpotLightShadow spotLightShadow; 1333 #endif 1334 #pragma unroll_loop_start 1335 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1336 spotLight = spotLights[ i ]; 1337 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1338 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1339 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1340 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1341 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1342 #else 1343 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1344 #endif 1345 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1346 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1347 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1348 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1349 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1350 #endif 1351 #undef SPOT_LIGHT_MAP_INDEX 1352 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1353 spotLightShadow = spotLightShadows[ i ]; 1354 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1355 #endif 1356 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1357 } 1358 #pragma unroll_loop_end 1359#endif 1360#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1361 DirectionalLight directionalLight; 1362 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1363 DirectionalLightShadow directionalLightShadow; 1364 #endif 1365 #pragma unroll_loop_start 1366 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1367 directionalLight = directionalLights[ i ]; 1368 getDirectionalLightInfo( directionalLight, directLight ); 1369 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1370 directionalLightShadow = directionalLightShadows[ i ]; 1371 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1372 #endif 1373 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1374 } 1375 #pragma unroll_loop_end 1376#endif 1377#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1378 RectAreaLight rectAreaLight; 1379 #pragma unroll_loop_start 1380 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1381 rectAreaLight = rectAreaLights[ i ]; 1382 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1383 } 1384 #pragma unroll_loop_end 1385#endif 1386#if defined( RE_IndirectDiffuse ) 1387 vec3 iblIrradiance = vec3( 0.0 ); 1388 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1389 #if defined( USE_LIGHT_PROBES ) 1390 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1391 #endif 1392 #if ( NUM_HEMI_LIGHTS > 0 ) 1393 #pragma unroll_loop_start 1394 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1395 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1396 } 1397 #pragma unroll_loop_end 1398 #endif 1399#endif 1400#if defined( RE_IndirectSpecular ) 1401 vec3 radiance = vec3( 0.0 ); 1402 vec3 clearcoatRadiance = vec3( 0.0 ); 1403#endif`,hS=`#if defined( RE_IndirectDiffuse ) 1404 #ifdef USE_LIGHTMAP 1405 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1406 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1407 irradiance += lightMapIrradiance; 1408 #endif 1409 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1410 iblIrradiance += getIBLIrradiance( geometryNormal ); 1411 #endif 1412#endif 1413#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1414 #ifdef USE_ANISOTROPY 1415 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1416 #else 1417 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1418 #endif 1419 #ifdef USE_CLEARCOAT 1420 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1421 #endif 1422#endif`,uS=`#if defined( RE_IndirectDiffuse ) 1423 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1424#endif 1425#if defined( RE_IndirectSpecular ) 1426 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1427#endif`,dS=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1428 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1429#endif`,fS=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1430 uniform float logDepthBufFC; 1431 varying float vFragDepth; 1432 varying float vIsPerspective; 1433#endif`,pS=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1434 varying float vFragDepth; 1435 varying float vIsPerspective; 1436#endif`,AS=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1437 vFragDepth = 1.0 + gl_Position.w; 1438 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1439#endif`,mS=`#ifdef USE_MAP 1440 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1441 #ifdef DECODE_VIDEO_TEXTURE 1442 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1443 #endif 1444 diffuseColor *= sampledDiffuseColor; 1445#endif`,gS=`#ifdef USE_MAP 1446 uniform sampler2D map; 1447#endif`,xS=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1448 #if defined( USE_POINTS_UV ) 1449 vec2 uv = vUv; 1450 #else 1451 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1452 #endif 1453#endif 1454#ifdef USE_MAP 1455 diffuseColor *= texture2D( map, uv ); 1456#endif 1457#ifdef USE_ALPHAMAP 1458 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1459#endif`,bS=`#if defined( USE_POINTS_UV ) 1460 varying vec2 vUv; 1461#else 1462 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1463 uniform mat3 uvTransform; 1464 #endif 1465#endif 1466#ifdef USE_MAP 1467 uniform sampler2D map; 1468#endif 1469#ifdef USE_ALPHAMAP 1470 uniform sampler2D alphaMap; 1471#endif`,_S=`float metalnessFactor = metalness; 1472#ifdef USE_METALNESSMAP 1473 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1474 metalnessFactor *= texelMetalness.b; 1475#endif`,vS=`#ifdef USE_METALNESSMAP 1476 uniform sampler2D metalnessMap; 1477#endif`,ES=`#ifdef USE_INSTANCING_MORPH 1478 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1479 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1480 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1481 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1482 } 1483#endif`,yS=`#if defined( USE_MORPHCOLORS ) 1484 vColor *= morphTargetBaseInfluence; 1485 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1486 #if defined( USE_COLOR_ALPHA ) 1487 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1488 #elif defined( USE_COLOR ) 1489 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1490 #endif 1491 } 1492#endif`,SS=`#ifdef USE_MORPHNORMALS 1493 objectNormal *= morphTargetBaseInfluence; 1494 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1495 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1496 } 1497#endif`,CS=`#ifdef USE_MORPHTARGETS 1498 #ifndef USE_INSTANCING_MORPH 1499 uniform float morphTargetBaseInfluence; 1500 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1501 #endif 1502 uniform sampler2DArray morphTargetsTexture; 1503 uniform ivec2 morphTargetsTextureSize; 1504 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1505 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1506 int y = texelIndex / morphTargetsTextureSize.x; 1507 int x = texelIndex - y * morphTargetsTextureSize.x; 1508 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1509 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1510 } 1511#endif`,IS=`#ifdef USE_MORPHTARGETS 1512 transformed *= morphTargetBaseInfluence; 1513 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1514 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1515 } 1516#endif`,MS=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1517#ifdef FLAT_SHADED 1518 vec3 fdx = dFdx( vViewPosition ); 1519 vec3 fdy = dFdy( vViewPosition ); 1520 vec3 normal = normalize( cross( fdx, fdy ) ); 1521#else 1522 vec3 normal = normalize( vNormal ); 1523 #ifdef DOUBLE_SIDED 1524 normal *= faceDirection; 1525 #endif 1526#endif 1527#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1528 #ifdef USE_TANGENT 1529 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1530 #else 1531 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1532 #if defined( USE_NORMALMAP ) 1533 vNormalMapUv 1534 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1535 vClearcoatNormalMapUv 1536 #else 1537 vUv 1538 #endif 1539 ); 1540 #endif 1541 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1542 tbn[0] *= faceDirection; 1543 tbn[1] *= faceDirection; 1544 #endif 1545#endif 1546#ifdef USE_CLEARCOAT_NORMALMAP 1547 #ifdef USE_TANGENT 1548 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1549 #else 1550 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1551 #endif 1552 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1553 tbn2[0] *= faceDirection; 1554 tbn2[1] *= faceDirection; 1555 #endif 1556#endif 1557vec3 nonPerturbedNormal = normal;`,wS=`#ifdef USE_NORMALMAP_OBJECTSPACE 1558 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1559 #ifdef FLIP_SIDED 1560 normal = - normal; 1561 #endif 1562 #ifdef DOUBLE_SIDED 1563 normal = normal * faceDirection; 1564 #endif 1565 normal = normalize( normalMatrix * normal ); 1566#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1567 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1568 mapN.xy *= normalScale; 1569 normal = normalize( tbn * mapN ); 1570#elif defined( USE_BUMPMAP )
1571 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1572#endif`,TS=`#ifndef FLAT_SHADED 1573 varying vec3 vNormal; 1574 #ifdef USE_TANGENT 1575 varying vec3 vTangent; 1576 varying vec3 vBitangent; 1577 #endif 1578#endif`,RS=`#ifndef FLAT_SHADED 1579 varying vec3 vNormal; 1580 #ifdef USE_TANGENT 1581 varying vec3 vTangent; 1582 varying vec3 vBitangent; 1583 #endif 1584#endif`,BS=`#ifndef FLAT_SHADED 1585 vNormal = normalize( transformedNormal ); 1586 #ifdef USE_TANGENT 1587 vTangent = normalize( transformedTangent ); 1588 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1589 #endif 1590#endif`,DS=`#ifdef USE_NORMALMAP 1591 uniform sampler2D normalMap; 1592 uniform vec2 normalScale; 1593#endif 1594#ifdef USE_NORMALMAP_OBJECTSPACE 1595 uniform mat3 normalMatrix; 1596#endif 1597#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1598 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1599 vec3 q0 = dFdx( eye_pos.xyz ); 1600 vec3 q1 = dFdy( eye_pos.xyz ); 1601 vec2 st0 = dFdx( uv.st ); 1602 vec2 st1 = dFdy( uv.st ); 1603 vec3 N = surf_norm; 1604 vec3 q1perp = cross( q1, N ); 1605 vec3 q0perp = cross( N, q0 ); 1606 vec3 T = q1perp * st0.x + q0perp * st1.x; 1607 vec3 B = q1perp * st0.y + q0perp * st1.y; 1608 float det = max( dot( T, T ), dot( B, B ) ); 1609 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1610 return mat3( T * scale, B * scale, N ); 1611 } 1612#endif`,LS=`#ifdef USE_CLEARCOAT 1613 vec3 clearcoatNormal = nonPerturbedNormal; 1614#endif`,FS=`#ifdef USE_CLEARCOAT_NORMALMAP 1615 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1616 clearcoatMapN.xy *= clearcoatNormalScale; 1617 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1618#endif`,PS=`#ifdef USE_CLEARCOATMAP 1619 uniform sampler2D clearcoatMap; 1620#endif 1621#ifdef USE_CLEARCOAT_NORMALMAP 1622 uniform sampler2D clearcoatNormalMap; 1623 uniform vec2 clearcoatNormalScale; 1624#endif 1625#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1626 uniform sampler2D clearcoatRoughnessMap; 1627#endif`,NS=`#ifdef USE_IRIDESCENCEMAP 1628 uniform sampler2D iridescenceMap; 1629#endif 1630#ifdef USE_IRIDESCENCE_THICKNESSMAP 1631 uniform sampler2D iridescenceThicknessMap; 1632#endif`,US=`#ifdef OPAQUE 1633diffuseColor.a = 1.0; 1634#endif 1635#ifdef USE_TRANSMISSION 1636diffuseColor.a *= material.transmissionAlpha; 1637#endif 1638gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,OS=`vec3 packNormalToRGB( const in vec3 normal ) { 1639 return normalize( normal ) * 0.5 + 0.5; 1640} 1641vec3 unpackRGBToNormal( const in vec3 rgb ) { 1642 return 2.0 * rgb.xyz - 1.0; 1643} 1644const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1645const float Inv255 = 1. / 255.; 1646const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1647const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1648const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1649const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1650vec4 packDepthToRGBA( const in float v ) { 1651 if( v <= 0.0 ) 1652 return vec4( 0., 0., 0., 0. ); 1653 if( v >= 1.0 ) 1654 return vec4( 1., 1., 1., 1. ); 1655 float vuf; 1656 float af = modf( v * PackFactors.a, vuf ); 1657 float bf = modf( vuf * ShiftRight8, vuf ); 1658 float gf = modf( vuf * ShiftRight8, vuf ); 1659 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1660} 1661vec3 packDepthToRGB( const in float v ) { 1662 if( v <= 0.0 ) 1663 return vec3( 0., 0., 0. ); 1664 if( v >= 1.0 ) 1665 return vec3( 1., 1., 1. ); 1666 float vuf; 1667 float bf = modf( v * PackFactors.b, vuf ); 1668 float gf = modf( vuf * ShiftRight8, vuf ); 1669 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1670} 1671vec2 packDepthToRG( const in float v ) { 1672 if( v <= 0.0 ) 1673 return vec2( 0., 0. ); 1674 if( v >= 1.0 ) 1675 return vec2( 1., 1. ); 1676 float vuf; 1677 float gf = modf( v * 256., vuf ); 1678 return vec2( vuf * Inv255, gf ); 1679} 1680float unpackRGBAToDepth( const in vec4 v ) { 1681 return dot( v, UnpackFactors4 ); 1682} 1683float unpackRGBToDepth( const in vec3 v ) { 1684 return dot( v, UnpackFactors3 ); 1685} 1686float unpackRGToDepth( const in vec2 v ) { 1687 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1688} 1689vec4 pack2HalfToRGBA( const in vec2 v ) {
1690 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1691 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1692} 1693vec2 unpackRGBATo2Half( const in vec4 v ) { 1694 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1695} 1696float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1697 return ( viewZ + near ) / ( near - far ); 1698} 1699float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1700 return depth * ( near - far ) - near; 1701} 1702float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1703 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1704} 1705float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1706 return ( near * far ) / ( ( far - near ) * depth - far ); 1707}`,kS=`#ifdef PREMULTIPLIED_ALPHA 1708 gl_FragColor.rgb *= gl_FragColor.a; 1709#endif`,QS=`vec4 mvPosition = vec4( transformed, 1.0 ); 1710#ifdef USE_BATCHING 1711 mvPosition = batchingMatrix * mvPosition; 1712#endif 1713#ifdef USE_INSTANCING 1714 mvPosition = instanceMatrix * mvPosition; 1715#endif 1716mvPosition = modelViewMatrix * mvPosition; 1717gl_Position = projectionMatrix * mvPosition;`,GS=`#ifdef DITHERING 1718 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1719#endif`,HS=`#ifdef DITHERING 1720 vec3 dithering( vec3 color ) { 1721 float grid_position = rand( gl_FragCoord.xy ); 1722 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1723 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1724 return color + dither_shift_RGB; 1725 } 1726#endif`,zS=`float roughnessFactor = roughness; 1727#ifdef USE_ROUGHNESSMAP 1728 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1729 roughnessFactor *= texelRoughness.g; 1730#endif`,VS=`#ifdef USE_ROUGHNESSMAP 1731 uniform sampler2D roughnessMap; 1732#endif`,WS=`#if NUM_SPOT_LIGHT_COORDS > 0 1733 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1734#endif 1735#if NUM_SPOT_LIGHT_MAPS > 0 1736 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1737#endif 1738#ifdef USE_SHADOWMAP 1739 #if NUM_DIR_LIGHT_SHADOWS > 0 1740 #if defined( SHADOWMAP_TYPE_PCF ) 1741 uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1742 #else 1743 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1744 #endif 1745 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1746 struct DirectionalLightShadow { 1747 float shadowIntensity; 1748 float shadowBias; 1749 float shadowNormalBias; 1750 float shadowRadius; 1751 vec2 shadowMapSize; 1752 }; 1753 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1754 #endif 1755 #if NUM_SPOT_LIGHT_SHADOWS > 0 1756 #if defined( SHADOWMAP_TYPE_PCF ) 1757 uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1758 #else 1759 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1760 #endif 1761 struct SpotLightShadow { 1762 float shadowIntensity; 1763 float shadowBias; 1764 float shadowNormalBias; 1765 float shadowRadius; 1766 vec2 shadowMapSize; 1767 }; 1768 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1769 #endif 1770 #if NUM_POINT_LIGHT_SHADOWS > 0 1771 #if defined( SHADOWMAP_TYPE_PCF ) 1772 uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1773 #elif defined( SHADOWMAP_TYPE_BASIC ) 1774 uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1775 #endif 1776 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1777 struct PointLightShadow { 1778 float shadowIntensity; 1779 float shadowBias; 1780 float shadowNormalBias; 1781 float shadowRadius; 1782 vec2 shadowMapSize; 1783 float shadowCameraNear; 1784 float shadowCameraFar; 1785 }; 1786 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1787 #endif 1788 #if defined( SHADOWMAP_TYPE_PCF ) 1789 float interleavedGradientNoise( vec2 position ) { 1790 return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); 1791 } 1792 vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { 1793 const float goldenAngle = 2.399963229728653; 1794 float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); 1795 float theta = float( sampleIndex ) * goldenAngle + phi; 1796 return vec2( cos( theta ), sin( theta ) ) * r; 1797 } 1798 #endif 1799 #if defined( SHADOWMAP_TYPE_PCF ) 1800 float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1801 float shadow = 1.0; 1802 shadowCoord.xyz /= shadowCoord.w; 1803 shadowCoord.z += shadowBias; 1804 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1805 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1806 if ( frustumTest ) { 1807 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1808 float radius = shadowRadius * texelSize.x; 1809 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718; 1810 shadow = ( 1811 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + 1812 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + 1813 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + 1814 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + 1815 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) 1816 ) * 0.2; 1817 } 1818 return mix( 1.0, shadow, shadowIntensity ); 1819 } 1820 #elif defined( SHADOWMAP_TYPE_VSM ) 1821 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1822 float shadow = 1.0; 1823 shadowCoord.xyz /= shadowCoord.w; 1824 shadowCoord.z += shadowBias; 1825 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1826 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1827 if ( frustumTest ) { 1828 vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; 1829 float mean = distribution.x; 1830 float variance = distribution.y * distribution.y; 1831 #ifdef USE_REVERSED_DEPTH_BUFFER 1832 float hard_shadow = step( mean, shadowCoord.z ); 1833 #else 1834 float hard_shadow = step( shadowCoord.z, mean ); 1835 #endif 1836 if ( hard_shadow == 1.0 ) { 1837 shadow = 1.0; 1838 } else { 1839 variance = max( variance, 0.0000001 ); 1840 float d = shadowCoord.z - mean; 1841 float p_max = variance / ( variance + d * d ); 1842 p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); 1843 shadow = max( hard_shadow, p_max ); 1844 } 1845 } 1846 return mix( 1.0, shadow, shadowIntensity ); 1847 } 1848 #else 1849 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1850 float shadow = 1.0; 1851 shadowCoord.xyz /= shadowCoord.w; 1852 shadowCoord.z += shadowBias; 1853 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1854 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1855 if ( frustumTest ) { 1856 float depth = texture2D( shadowMap, shadowCoord.xy ).r; 1857 #ifdef USE_REVERSED_DEPTH_BUFFER 1858 shadow = step( depth, shadowCoord.z ); 1859 #else 1860 shadow = step( shadowCoord.z, depth ); 1861 #endif 1862 } 1863 return mix( 1.0, shadow, shadowIntensity ); 1864 } 1865 #endif 1866 #if NUM_POINT_LIGHT_SHADOWS > 0 1867 #if defined( SHADOWMAP_TYPE_PCF ) 1868 float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1869 float shadow = 1.0; 1870 vec3 lightToPosition = shadowCoord.xyz; 1871 vec3 bd3D = normalize( lightToPosition ); 1872 vec3 absVec = abs( lightToPosition ); 1873 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1874 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1875 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1876 dp += shadowBias; 1877 float texelSize = shadowRadius / shadowMapSize.x; 1878 vec3 absDir = abs( bd3D ); 1879 vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); 1880 tangent = normalize( cross( bd3D, tangent ) ); 1881 vec3 bitangent = cross( bd3D, tangent ); 1882 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718; 1883 shadow = ( 1884 texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) + 1885 texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) + 1886 texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) + 1887 texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) + 1888 texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) ) 1889 ) * 0.2; 1890 } 1891 return mix( 1.0, shadow, shadowIntensity ); 1892 } 1893 #elif defined( SHADOWMAP_TYPE_BASIC ) 1894 float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1895 float shadow = 1.0; 1896 vec3 lightToPosition = shadowCoord.xyz; 1897 vec3 bd3D = normalize( lightToPosition ); 1898 vec3 absVec = abs( lightToPosition ); 1899 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1900 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1901 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1902 dp += shadowBias; 1903 float depth = textureCube( shadowMap, bd3D ).r; 1904 #ifdef USE_REVERSED_DEPTH_BUFFER 1905 shadow = step( depth, dp ); 1906 #else 1907 shadow = step( dp, depth ); 1908 #endif 1909 } 1910 return mix( 1.0, shadow, shadowIntensity ); 1911 } 1912 #endif 1913 #endif
1914#endif`,qS=`#if NUM_SPOT_LIGHT_COORDS > 0 1915 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1916 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1917#endif 1918#ifdef USE_SHADOWMAP 1919 #if NUM_DIR_LIGHT_SHADOWS > 0 1920 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1921 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1922 struct DirectionalLightShadow { 1923 float shadowIntensity; 1924 float shadowBias; 1925 float shadowNormalBias; 1926 float shadowRadius; 1927 vec2 shadowMapSize; 1928 }; 1929 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1930 #endif 1931 #if NUM_SPOT_LIGHT_SHADOWS > 0 1932 struct SpotLightShadow { 1933 float shadowIntensity; 1934 float shadowBias; 1935 float shadowNormalBias; 1936 float shadowRadius; 1937 vec2 shadowMapSize; 1938 }; 1939 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1940 #endif 1941 #if NUM_POINT_LIGHT_SHADOWS > 0 1942 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1943 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1944 struct PointLightShadow { 1945 float shadowIntensity; 1946 float shadowBias; 1947 float shadowNormalBias; 1948 float shadowRadius; 1949 vec2 shadowMapSize; 1950 float shadowCameraNear; 1951 float shadowCameraFar; 1952 }; 1953 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1954 #endif 1955#endif`,XS=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1956 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1957 vec4 shadowWorldPosition; 1958#endif 1959#if defined( USE_SHADOWMAP ) 1960 #if NUM_DIR_LIGHT_SHADOWS > 0 1961 #pragma unroll_loop_start 1962 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1963 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1964 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1965 } 1966 #pragma unroll_loop_end 1967 #endif 1968 #if NUM_POINT_LIGHT_SHADOWS > 0 1969 #pragma unroll_loop_start 1970 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1971 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1972 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1973 } 1974 #pragma unroll_loop_end 1975 #endif 1976#endif 1977#if NUM_SPOT_LIGHT_COORDS > 0 1978 #pragma unroll_loop_start 1979 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1980 shadowWorldPosition = worldPosition; 1981 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1982 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1983 #endif 1984 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1985 } 1986 #pragma unroll_loop_end 1987#endif`,$S=`float getShadowMask() { 1988 float shadow = 1.0; 1989 #ifdef USE_SHADOWMAP 1990 #if NUM_DIR_LIGHT_SHADOWS > 0 1991 DirectionalLightShadow directionalLight; 1992 #pragma unroll_loop_start 1993 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1994 directionalLight = directionalLightShadows[ i ]; 1995 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1996 } 1997 #pragma unroll_loop_end 1998 #endif 1999 #if NUM_SPOT_LIGHT_SHADOWS > 0 2000 SpotLightShadow spotLight; 2001 #pragma unroll_loop_start 2002 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 2003 spotLight = spotLightShadows[ i ]; 2004 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 2005 } 2006 #pragma unroll_loop_end 2007 #endif 2008 #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 2009 PointLightShadow pointLight; 2010 #pragma unroll_loop_start 2011 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2012 pointLight = pointLightShadows[ i ]; 2013 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 2014 } 2015 #pragma unroll_loop_end 2016 #endif 2017 #endif 2018 return shadow; 2019}`,YS=`#ifdef USE_SKINNING 2020 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 2021 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 2022 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 2023 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 2024#endif`,jS=`#ifdef USE_SKINNING 2025 uniform mat4 bindMatrix; 2026 uniform mat4 bindMatrixInverse; 2027 uniform highp sampler2D boneTexture; 2028 mat4 getBoneMatrix( const in float i ) { 2029 int size = textureSize( boneTexture, 0 ).x; 2030 int j = int( i ) * 4; 2031 int x = j % size; 2032 int y = j / size; 2033 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2034 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2035 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2036 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2037 return mat4( v1, v2, v3, v4 ); 2038 } 2039#endif`,KS=`#ifdef USE_SKINNING 2040 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2041 vec4 skinned = vec4( 0.0 ); 2042 skinned += boneMatX * skinVertex * skinWeight.x; 2043 skinned += boneMatY * skinVertex * skinWeight.y; 2044 skinned += boneMatZ * skinVertex * skinWeight.z; 2045 skinned += boneMatW * skinVertex * skinWeight.w; 2046 transformed = ( bindMatrixInverse * skinned ).xyz; 2047#endif`,JS=`#ifdef USE_SKINNING 2048 mat4 skinMatrix = mat4( 0.0 ); 2049 skinMatrix += skinWeight.x * boneMatX; 2050 skinMatrix += skinWeight.y * boneMatY; 2051 skinMatrix += skinWeight.z * boneMatZ; 2052 skinMatrix += skinWeight.w * boneMatW; 2053 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2054 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2055 #ifdef USE_TANGENT 2056 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2057 #endif 2058#endif`,ZS=`float specularStrength; 2059#ifdef USE_SPECULARMAP 2060 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2061 specularStrength = texelSpecular.r; 2062#else 2063 specularStrength = 1.0; 2064#endif`,eC=`#ifdef USE_SPECULARMAP 2065 uniform sampler2D specularMap; 2066#endif`,tC=`#if defined( TONE_MAPPING ) 2067 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2068#endif`,nC=`#ifndef saturate 2069#define saturate( a ) clamp( a, 0.0, 1.0 ) 2070#endif 2071uniform float toneMappingExposure; 2072vec3 LinearToneMapping( vec3 color ) { 2073 return saturate( toneMappingExposure * color ); 2074} 2075vec3 ReinhardToneMapping( vec3 color ) { 2076 color *= toneMappingExposure; 2077 return saturate( color / ( vec3( 1.0 ) + color ) ); 2078} 2079vec3 CineonToneMapping( vec3 color ) { 2080 color *= toneMappingExposure; 2081 color = max( vec3( 0.0 ), color - 0.004 ); 2082 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2083} 2084vec3 RRTAndODTFit( vec3 v ) { 2085 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2086 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2087 return a / b; 2088} 2089vec3 ACESFilmicToneMapping( vec3 color ) { 2090 const mat3 ACESInputMat = mat3( 2091 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2092 vec3( 0.04823, 0.01566, 0.83777 ) 2093 ); 2094 const mat3 ACESOutputMat = mat3( 2095 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2096 vec3( -0.07367, -0.00605, 1.07602 ) 2097 ); 2098 color *= toneMappingExposure / 0.6; 2099 color = ACESInputMat * color; 2100 color = RRTAndODTFit( color ); 2101 color = ACESOutputMat * color; 2102 return saturate( color ); 2103} 2104const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2105 vec3( 1.6605, - 0.1246, - 0.0182 ), 2106 vec3( - 0.5876, 1.1329, - 0.1006 ), 2107 vec3( - 0.0728, - 0.0083, 1.1187 ) 2108); 2109const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2110 vec3( 0.6274, 0.0691, 0.0164 ), 2111 vec3( 0.3293, 0.9195, 0.0880 ), 2112 vec3( 0.0433, 0.0113, 0.8956 ) 2113); 2114vec3 agxDefaultContrastApprox( vec3 x ) { 2115 vec3 x2 = x * x; 2116 vec3 x4 = x2 * x2; 2117 return + 15.5 * x4 * x2 2118 - 40.14 * x4 * x 2119 + 31.96 * x4 2120 - 6.868 * x2 * x 2121 + 0.4298 * x2 2122 + 0.1191 * x 2123 - 0.00232; 2124} 2125vec3 AgXToneMapping( vec3 color ) { 2126 const mat3 AgXInsetMatrix = mat3( 2127 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2128 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2129 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2130 );
2131 const mat3 AgXOutsetMatrix = mat3( 2132 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2133 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2134 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2135 ); 2136 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2137 color *= toneMappingExposure; 2138 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2139 color = AgXInsetMatrix * color; 2140 color = max( color, 1e-10 ); color = log2( color ); 2141 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2142 color = clamp( color, 0.0, 1.0 ); 2143 color = agxDefaultContrastApprox( color ); 2144 color = AgXOutsetMatrix * color; 2145 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2146 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2147 color = clamp( color, 0.0, 1.0 ); 2148 return color; 2149} 2150vec3 NeutralToneMapping( vec3 color ) { 2151 const float StartCompression = 0.8 - 0.04; 2152 const float Desaturation = 0.15; 2153 color *= toneMappingExposure; 2154 float x = min( color.r, min( color.g, color.b ) ); 2155 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2156 color -= offset; 2157 float peak = max( color.r, max( color.g, color.b ) ); 2158 if ( peak < StartCompression ) return color; 2159 float d = 1. - StartCompression; 2160 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2161 color *= newPeak / peak; 2162 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2163 return mix( color, vec3( newPeak ), g ); 2164} 2165vec3 CustomToneMapping( vec3 color ) { return color; }`,iC=`#ifdef USE_TRANSMISSION 2166 material.transmission = transmission; 2167 material.transmissionAlpha = 1.0; 2168 material.thickness = thickness; 2169 material.attenuationDistance = attenuationDistance; 2170 material.attenuationColor = attenuationColor; 2171 #ifdef USE_TRANSMISSIONMAP 2172 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2173 #endif 2174 #ifdef USE_THICKNESSMAP 2175 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2176 #endif 2177 vec3 pos = vWorldPosition; 2178 vec3 v = normalize( cameraPosition - pos ); 2179 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2180 vec4 transmitted = getIBLVolumeRefraction( 2181 n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, 2182 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2183 material.attenuationColor, material.attenuationDistance ); 2184 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2185 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2186#endif`,sC=`#ifdef USE_TRANSMISSION 2187 uniform float transmission; 2188 uniform float thickness; 2189 uniform float attenuationDistance; 2190 uniform vec3 attenuationColor; 2191 #ifdef USE_TRANSMISSIONMAP 2192 uniform sampler2D transmissionMap; 2193 #endif 2194 #ifdef USE_THICKNESSMAP 2195 uniform sampler2D thicknessMap; 2196 #endif 2197 uniform vec2 transmissionSamplerSize; 2198 uniform sampler2D transmissionSamplerMap; 2199 uniform mat4 modelMatrix; 2200 uniform mat4 projectionMatrix; 2201 varying vec3 vWorldPosition; 2202 float w0( float a ) { 2203 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2204 } 2205 float w1( float a ) { 2206 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2207 } 2208 float w2( float a ){ 2209 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2210 } 2211 float w3( float a ) { 2212 return ( 1.0 / 6.0 ) * ( a * a * a ); 2213 } 2214 float g0( float a ) { 2215 return w0( a ) + w1( a ); 2216 } 2217 float g1( float a ) { 2218 return w2( a ) + w3( a ); 2219 } 2220 float h0( float a ) { 2221 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2222 } 2223 float h1( float a ) { 2224 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2225 } 2226 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2227 uv = uv * texelSize.zw + 0.5; 2228 vec2 iuv = floor( uv ); 2229 vec2 fuv = fract( uv ); 2230 float g0x = g0( fuv.x ); 2231 float g1x = g1( fuv.x ); 2232 float h0x = h0( fuv.x ); 2233 float h1x = h1( fuv.x ); 2234 float h0y = h0( fuv.y ); 2235 float h1y = h1( fuv.y ); 2236 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2237 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2238 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2239 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2240 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2241 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2242 } 2243 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2244 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2245 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2246 vec2 fLodSizeInv = 1.0 / fLodSize; 2247 vec2 cLodSizeInv = 1.0 / cLodSize; 2248 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2249 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2250 return mix( fSample, cSample, fract( lod ) ); 2251 } 2252 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2253 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2254 vec3 modelScale; 2255 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2256 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2257 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2258 return normalize( refractionVector ) * thickness * modelScale; 2259 } 2260 float applyIorToRoughness( const in float roughness, const in float ior ) { 2261 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2262 } 2263 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2264 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2265 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2266 } 2267 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2268 if ( isinf( attenuationDistance ) ) { 2269 return vec3( 1.0 ); 2270 } else { 2271 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2272 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2273 } 2274 } 2275 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2276 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2277 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2278 const in vec3 attenuationColor, const in float attenuationDistance ) { 2279 vec4 transmittedLight; 2280 vec3 transmittance; 2281 #ifdef USE_DISPERSION 2282 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2283 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2284 for ( int i = 0; i < 3; i ++ ) { 2285 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2286 vec3 refractedRayExit = position + transmissionRay; 2287 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2288 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2289 refractionCoords += 1.0; 2290 refractionCoords /= 2.0; 2291 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2292 transmittedLight[ i ] = transmissionSample[ i ]; 2293 transmittedLight.a += transmissionSample.a; 2294 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2295 } 2296 transmittedLight.a /= 3.0; 2297 #else 2298 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2299 vec3 refractedRayExit = position + transmissionRay; 2300 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2301 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2302 refractionCoords += 1.0; 2303 refractionCoords /= 2.0; 2304 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2305 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2306 #endif 2307 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2308 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2309 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2310 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2311 } 2312#endif`,rC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2313 varying vec2 vUv; 2314#endif 2315#ifdef USE_MAP 2316 varying vec2 vMapUv; 2317#endif 2318#ifdef USE_ALPHAMAP
2319 varying vec2 vAlphaMapUv; 2320#endif 2321#ifdef USE_LIGHTMAP 2322 varying vec2 vLightMapUv; 2323#endif 2324#ifdef USE_AOMAP 2325 varying vec2 vAoMapUv; 2326#endif 2327#ifdef USE_BUMPMAP 2328 varying vec2 vBumpMapUv; 2329#endif 2330#ifdef USE_NORMALMAP 2331 varying vec2 vNormalMapUv; 2332#endif 2333#ifdef USE_EMISSIVEMAP 2334 varying vec2 vEmissiveMapUv; 2335#endif 2336#ifdef USE_METALNESSMAP 2337 varying vec2 vMetalnessMapUv; 2338#endif 2339#ifdef USE_ROUGHNESSMAP 2340 varying vec2 vRoughnessMapUv; 2341#endif 2342#ifdef USE_ANISOTROPYMAP 2343 varying vec2 vAnisotropyMapUv; 2344#endif 2345#ifdef USE_CLEARCOATMAP 2346 varying vec2 vClearcoatMapUv; 2347#endif 2348#ifdef USE_CLEARCOAT_NORMALMAP 2349 varying vec2 vClearcoatNormalMapUv; 2350#endif 2351#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2352 varying vec2 vClearcoatRoughnessMapUv; 2353#endif 2354#ifdef USE_IRIDESCENCEMAP 2355 varying vec2 vIridescenceMapUv; 2356#endif 2357#ifdef USE_IRIDESCENCE_THICKNESSMAP 2358 varying vec2 vIridescenceThicknessMapUv; 2359#endif 2360#ifdef USE_SHEEN_COLORMAP 2361 varying vec2 vSheenColorMapUv; 2362#endif 2363#ifdef USE_SHEEN_ROUGHNESSMAP 2364 varying vec2 vSheenRoughnessMapUv; 2365#endif 2366#ifdef USE_SPECULARMAP 2367 varying vec2 vSpecularMapUv; 2368#endif 2369#ifdef USE_SPECULAR_COLORMAP 2370 varying vec2 vSpecularColorMapUv; 2371#endif 2372#ifdef USE_SPECULAR_INTENSITYMAP 2373 varying vec2 vSpecularIntensityMapUv; 2374#endif 2375#ifdef USE_TRANSMISSIONMAP 2376 uniform mat3 transmissionMapTransform; 2377 varying vec2 vTransmissionMapUv; 2378#endif 2379#ifdef USE_THICKNESSMAP 2380 uniform mat3 thicknessMapTransform; 2381 varying vec2 vThicknessMapUv; 2382#endif`,aC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2383 varying vec2 vUv; 2384#endif 2385#ifdef USE_MAP 2386 uniform mat3 mapTransform; 2387 varying vec2 vMapUv; 2388#endif 2389#ifdef USE_ALPHAMAP 2390 uniform mat3 alphaMapTransform; 2391 varying vec2 vAlphaMapUv; 2392#endif 2393#ifdef USE_LIGHTMAP 2394 uniform mat3 lightMapTransform; 2395 varying vec2 vLightMapUv; 2396#endif 2397#ifdef USE_AOMAP 2398 uniform mat3 aoMapTransform; 2399 varying vec2 vAoMapUv; 2400#endif 2401#ifdef USE_BUMPMAP 2402 uniform mat3 bumpMapTransform; 2403 varying vec2 vBumpMapUv; 2404#endif 2405#ifdef USE_NORMALMAP 2406 uniform mat3 normalMapTransform; 2407 varying vec2 vNormalMapUv; 2408#endif 2409#ifdef USE_DISPLACEMENTMAP 2410 uniform mat3 displacementMapTransform; 2411 varying vec2 vDisplacementMapUv; 2412#endif 2413#ifdef USE_EMISSIVEMAP 2414 uniform mat3 emissiveMapTransform; 2415 varying vec2 vEmissiveMapUv; 2416#endif 2417#ifdef USE_METALNESSMAP 2418 uniform mat3 metalnessMapTransform; 2419 varying vec2 vMetalnessMapUv; 2420#endif 2421#ifdef USE_ROUGHNESSMAP 2422 uniform mat3 roughnessMapTransform; 2423 varying vec2 vRoughnessMapUv; 2424#endif 2425#ifdef USE_ANISOTROPYMAP 2426 uniform mat3 anisotropyMapTransform; 2427 varying vec2 vAnisotropyMapUv; 2428#endif 2429#ifdef USE_CLEARCOATMAP 2430 uniform mat3 clearcoatMapTransform; 2431 varying vec2 vClearcoatMapUv; 2432#endif 2433#ifdef USE_CLEARCOAT_NORMALMAP 2434 uniform mat3 clearcoatNormalMapTransform; 2435 varying vec2 vClearcoatNormalMapUv; 2436#endif 2437#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2438 uniform mat3 clearcoatRoughnessMapTransform; 2439 varying vec2 vClearcoatRoughnessMapUv; 2440#endif 2441#ifdef USE_SHEEN_COLORMAP 2442 uniform mat3 sheenColorMapTransform; 2443 varying vec2 vSheenColorMapUv; 2444#endif 2445#ifdef USE_SHEEN_ROUGHNESSMAP 2446 uniform mat3 sheenRoughnessMapTransform; 2447 varying vec2 vSheenRoughnessMapUv; 2448#endif 2449#ifdef USE_IRIDESCENCEMAP 2450 uniform mat3 iridescenceMapTransform; 2451 varying vec2 vIridescenceMapUv; 2452#endif 2453#ifdef USE_IRIDESCENCE_THICKNESSMAP 2454 uniform mat3 iridescenceThicknessMapTransform; 2455 varying vec2 vIridescenceThicknessMapUv; 2456#endif 2457#ifdef USE_SPECULARMAP 2458 uniform mat3 specularMapTransform; 2459 varying vec2 vSpecularMapUv; 2460#endif 2461#ifdef USE_SPECULAR_COLORMAP 2462 uniform mat3 specularColorMapTransform; 2463 varying vec2 vSpecularColorMapUv; 2464#endif 2465#ifdef USE_SPECULAR_INTENSITYMAP 2466 uniform mat3 specularIntensityMapTransform; 2467 varying vec2 vSpecularIntensityMapUv; 2468#endif 2469#ifdef USE_TRANSMISSIONMAP 2470 uniform mat3 transmissionMapTransform; 2471 varying vec2 vTransmissionMapUv; 2472#endif 2473#ifdef USE_THICKNESSMAP 2474 uniform mat3 thicknessMapTransform; 2475 varying vec2 vThicknessMapUv; 2476#endif`,oC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2477 vUv = vec3( uv, 1 ).xy; 2478#endif 2479#ifdef USE_MAP 2480 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2481#endif 2482#ifdef USE_ALPHAMAP 2483 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2484#endif 2485#ifdef USE_LIGHTMAP 2486 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2487#endif 2488#ifdef USE_AOMAP 2489 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2490#endif 2491#ifdef USE_BUMPMAP 2492 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2493#endif 2494#ifdef USE_NORMALMAP 2495 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2496#endif 2497#ifdef USE_DISPLACEMENTMAP 2498 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2499#endif 2500#ifdef USE_EMISSIVEMAP 2501 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2502#endif 2503#ifdef USE_METALNESSMAP 2504 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2505#endif 2506#ifdef USE_ROUGHNESSMAP 2507 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2508#endif 2509#ifdef USE_ANISOTROPYMAP 2510 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2511#endif 2512#ifdef USE_CLEARCOATMAP 2513 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2514#endif 2515#ifdef USE_CLEARCOAT_NORMALMAP 2516 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2517#endif 2518#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2519 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2520#endif
2521#ifdef USE_IRIDESCENCEMAP 2522 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2523#endif 2524#ifdef USE_IRIDESCENCE_THICKNESSMAP 2525 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2526#endif 2527#ifdef USE_SHEEN_COLORMAP 2528 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2529#endif 2530#ifdef USE_SHEEN_ROUGHNESSMAP 2531 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2532#endif 2533#ifdef USE_SPECULARMAP 2534 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2535#endif 2536#ifdef USE_SPECULAR_COLORMAP 2537 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2538#endif 2539#ifdef USE_SPECULAR_INTENSITYMAP 2540 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2541#endif 2542#ifdef USE_TRANSMISSIONMAP 2543 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2544#endif 2545#ifdef USE_THICKNESSMAP 2546 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2547#endif`,cC=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2548 vec4 worldPosition = vec4( transformed, 1.0 ); 2549 #ifdef USE_BATCHING 2550 worldPosition = batchingMatrix * worldPosition; 2551 #endif 2552 #ifdef USE_INSTANCING 2553 worldPosition = instanceMatrix * worldPosition; 2554 #endif 2555 worldPosition = modelMatrix * worldPosition; 2556#endif`;const lC=`varying vec2 vUv; 2557uniform mat3 uvTransform; 2558void main() { 2559 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2560 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2561}`,hC=`uniform sampler2D t2D; 2562uniform float backgroundIntensity; 2563varying vec2 vUv; 2564void main() { 2565 vec4 texColor = texture2D( t2D, vUv ); 2566 #ifdef DECODE_VIDEO_TEXTURE 2567 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 2568 #endif 2569 texColor.rgb *= backgroundIntensity; 2570 gl_FragColor = texColor; 2571 #include <tonemapping_fragment> 2572 #include <colorspace_fragment> 2573}`,uC=`varying vec3 vWorldDirection; 2574#include <common> 2575void main() { 2576 vWorldDirection = transformDirection( position, modelMatrix ); 2577 #include <begin_vertex> 2578 #include <project_vertex> 2579 gl_Position.z = gl_Position.w; 2580}`,dC=`#ifdef ENVMAP_TYPE_CUBE 2581 uniform samplerCube envMap; 2582#elif defined( ENVMAP_TYPE_CUBE_UV ) 2583 uniform sampler2D envMap; 2584#endif 2585uniform float flipEnvMap; 2586uniform float backgroundBlurriness; 2587uniform float backgroundIntensity; 2588uniform mat3 backgroundRotation; 2589varying vec3 vWorldDirection; 2590#include <cube_uv_reflection_fragment> 2591void main() { 2592 #ifdef ENVMAP_TYPE_CUBE 2593 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2594 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2595 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2596 #else 2597 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2598 #endif 2599 texColor.rgb *= backgroundIntensity; 2600 gl_FragColor = texColor; 2601 #include <tonemapping_fragment> 2602 #include <colorspace_fragment> 2603}`,fC=`varying vec3 vWorldDirection; 2604#include <common> 2605void main() { 2606 vWorldDirection = transformDirection( position, modelMatrix ); 2607 #include <begin_vertex> 2608 #include <project_vertex> 2609 gl_Position.z = gl_Position.w; 2610}`,pC=`uniform samplerCube tCube; 2611uniform float tFlip; 2612uniform float opacity; 2613varying vec3 vWorldDirection; 2614void main() { 2615 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2616 gl_FragColor = texColor; 2617 gl_FragColor.a *= opacity; 2618 #include <tonemapping_fragment> 2619 #include <colorspace_fragment> 2620}`,AC=`#include <common> 2621#include <batching_pars_vertex> 2622#include <uv_pars_vertex> 2623#include <displacementmap_pars_vertex> 2624#include <morphtarget_pars_vertex> 2625#include <skinning_pars_vertex> 2626#include <logdepthbuf_pars_vertex> 2627#include <clipping_planes_pars_vertex> 2628varying vec2 vHighPrecisionZW; 2629void main() { 2630 #include <uv_vertex> 2631 #include <batching_vertex> 2632 #include <skinbase_vertex> 2633 #include <morphinstance_vertex> 2634 #ifdef USE_DISPLACEMENTMAP 2635 #include <beginnormal_vertex> 2636 #include <morphnormal_vertex> 2637 #include <skinnormal_vertex> 2638 #endif 2639 #include <begin_vertex> 2640 #include <morphtarget_vertex> 2641 #include <skinning_vertex> 2642 #include <displacementmap_vertex> 2643 #include <project_vertex> 2644 #include <logdepthbuf_vertex> 2645 #include <clipping_planes_vertex> 2646 vHighPrecisionZW = gl_Position.zw; 2647}`,mC=`#if DEPTH_PACKING == 3200 2648 uniform float opacity; 2649#endif 2650#include <common> 2651#include <packing> 2652#include <uv_pars_fragment> 2653#include <map_pars_fragment> 2654#include <alphamap_pars_fragment> 2655#include <alphatest_pars_fragment> 2656#include <alphahash_pars_fragment> 2657#include <logdepthbuf_pars_fragment> 2658#include <clipping_planes_pars_fragment> 2659varying vec2 vHighPrecisionZW; 2660void main() { 2661 vec4 diffuseColor = vec4( 1.0 ); 2662 #include <clipping_planes_fragment> 2663 #if DEPTH_PACKING == 3200 2664 diffuseColor.a = opacity; 2665 #endif 2666 #include <map_fragment> 2667 #include <alphamap_fragment> 2668 #include <alphatest_fragment> 2669 #include <alphahash_fragment> 2670 #include <logdepthbuf_fragment> 2671 #ifdef USE_REVERSED_DEPTH_BUFFER 2672 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 2673 #else 2674 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 2675 #endif 2676 #if DEPTH_PACKING == 3200 2677 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2678 #elif DEPTH_PACKING == 3201 2679 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2680 #elif DEPTH_PACKING == 3202 2681 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2682 #elif DEPTH_PACKING == 3203 2683 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2684 #endif 2685}`,gC=`#define DISTANCE 2686varying vec3 vWorldPosition; 2687#include <common> 2688#include <batching_pars_vertex> 2689#include <uv_pars_vertex> 2690#include <displacementmap_pars_vertex> 2691#include <morphtarget_pars_vertex> 2692#include <skinning_pars_vertex> 2693#include <clipping_planes_pars_vertex> 2694void main() { 2695 #include <uv_vertex> 2696 #include <batching_vertex> 2697 #include <skinbase_vertex> 2698 #include <morphinstance_vertex> 2699 #ifdef USE_DISPLACEMENTMAP 2700 #include <beginnormal_vertex> 2701 #include <morphnormal_vertex> 2702 #include <skinnormal_vertex> 2703 #endif 2704 #include <begin_vertex> 2705 #include <morphtarget_vertex> 2706 #include <skinning_vertex> 2707 #include <displacementmap_vertex> 2708 #include <project_vertex> 2709 #include <worldpos_vertex> 2710 #include <clipping_planes_vertex> 2711 vWorldPosition = worldPosition.xyz; 2712}`,xC=`#define DISTANCE 2713uniform vec3 referencePosition; 2714uniform float nearDistance; 2715uniform float farDistance; 2716varying vec3 vWorldPosition; 2717#include <common> 2718#include <uv_pars_fragment> 2719#include <map_pars_fragment> 2720#include <alphamap_pars_fragment> 2721#include <alphatest_pars_fragment> 2722#include <alphahash_pars_fragment> 2723#include <clipping_planes_pars_fragment> 2724void main () { 2725 vec4 diffuseColor = vec4( 1.0 ); 2726 #include <clipping_planes_fragment> 2727 #include <map_fragment> 2728 #include <alphamap_fragment> 2729 #include <alphatest_fragment> 2730 #include <alphahash_fragment> 2731 float dist = length( vWorldPosition - referencePosition ); 2732 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2733 dist = saturate( dist ); 2734 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); 2735}`,bC=`varying vec3 vWorldDirection; 2736#include <common> 2737void main() { 2738 vWorldDirection = transformDirection( position, modelMatrix ); 2739 #include <begin_vertex> 2740 #include <project_vertex> 2741}`,_C=`uniform sampler2D tEquirect; 2742varying vec3 vWorldDirection; 2743#include <common> 2744void main() { 2745 vec3 direction = normalize( vWorldDirection ); 2746 vec2 sampleUV = equirectUv( direction ); 2747 gl_FragColor = texture2D( tEquirect, sampleUV ); 2748 #include <tonemapping_fragment> 2749 #include <colorspace_fragment> 2750}`,vC=`uniform float scale; 2751attribute float lineDistance; 2752varying float vLineDistance; 2753#include <common> 2754#include <uv_pars_vertex> 2755#include <color_pars_vertex> 2756#include <fog_pars_vertex> 2757#include <morphtarget_pars_vertex> 2758#include <logdepthbuf_pars_vertex> 2759#include <clipping_planes_pars_vertex> 2760void main() { 2761 vLineDistance = scale * lineDistance; 2762 #include <uv_vertex> 2763 #include <color_vertex> 2764 #include <morphinstance_vertex> 2765 #include <morphcolor_vertex> 2766 #include <begin_vertex> 2767 #include <morphtarget_vertex> 2768 #include <project_vertex> 2769 #include <logdepthbuf_vertex> 2770 #include <clipping_planes_vertex> 2771 #include <fog_vertex> 2772}`,EC=`uniform vec3 diffuse; 2773uniform float opacity; 2774uniform float dashSize; 2775uniform float totalSize; 2776varying float vLineDistance; 2777#include <common> 2778#include <color_pars_fragment> 2779#include <uv_pars_fragment> 2780#include <map_pars_fragment> 2781#include <fog_pars_fragment> 2782#include <logdepthbuf_pars_fragment> 2783#include <clipping_planes_pars_fragment> 2784void main() { 2785 vec4 diffuseColor = vec4( diffuse, opacity ); 2786 #include <clipping_planes_fragment> 2787 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2788 discard; 2789 } 2790 vec3 outgoingLight = vec3( 0.0 ); 2791 #include <logdepthbuf_fragment> 2792 #include <map_fragment> 2793 #include <color_fragment> 2794 outgoingLight = diffuseColor.rgb; 2795 #include <opaque_fragment> 2796 #include <tonemapping_fragment> 2797 #include <colorspace_fragment> 2798 #include <fog_fragment> 2799 #include <premultiplied_alpha_fragment> 2800}`,yC=`#include <common> 2801#include <batching_pars_vertex> 2802#include <uv_pars_vertex> 2803#include <envmap_pars_vertex> 2804#include <color_pars_vertex> 2805#include <fog_pars_vertex> 2806#include <morphtarget_pars_vertex> 2807#include <skinning_pars_vertex> 2808#include <logdepthbuf_pars_vertex> 2809#include <clipping_planes_pars_vertex> 2810void main() { 2811 #include <uv_vertex> 2812 #include <color_vertex> 2813 #include <morphinstance_vertex> 2814 #include <morphcolor_vertex> 2815 #include <batching_vertex> 2816 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2817 #include <beginnormal_vertex> 2818 #include <morphnormal_vertex> 2819 #include <skinbase_vertex> 2820 #include <skinnormal_vertex> 2821 #include <defaultnormal_vertex> 2822 #endif 2823 #include <begin_vertex> 2824 #include <morphtarget_vertex> 2825 #include <skinning_vertex> 2826 #include <project_vertex> 2827 #include <logdepthbuf_vertex> 2828 #include <clipping_planes_vertex> 2829 #include <worldpos_vertex> 2830 #include <envmap_vertex> 2831 #include <fog_vertex> 2832}`,SC=`uniform vec3 diffuse; 2833uniform float opacity; 2834#ifndef FLAT_SHADED 2835 varying vec3 vNormal; 2836#endif 2837#include <common> 2838#include <dithering_pars_fragment> 2839#include <color_pars_fragment> 2840#include <uv_pars_fragment> 2841#include <map_pars_fragment> 2842#include <alphamap_pars_fragment> 2843#include <alphatest_pars_fragment> 2844#include <alphahash_pars_fragment> 2845#include <aomap_pars_fragment> 2846#include <lightmap_pars_fragment> 2847#include <envmap_common_pars_fragment> 2848#include <envmap_pars_fragment> 2849#include <fog_pars_fragment> 2850#include <specularmap_pars_fragment> 2851#include <logdepthbuf_pars_fragment> 2852#include <clipping_planes_pars_fragment> 2853void main() { 2854 vec4 diffuseColor = vec4( diffuse, opacity ); 2855 #include <clipping_planes_fragment> 2856 #include <logdepthbuf_fragment> 2857 #include <map_fragment> 2858 #include <color_fragment> 2859 #include <alphamap_fragment> 2860 #include <alphatest_fragment> 2861 #include <alphahash_fragment> 2862 #include <specularmap_fragment> 2863 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2864 #ifdef USE_LIGHTMAP 2865 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2866 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2867 #else 2868 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2869 #endif 2870 #include <aomap_fragment> 2871 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2872 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2873 #include <envmap_fragment> 2874 #include <opaque_fragment> 2875 #include <tonemapping_fragment> 2876 #include <colorspace_fragment> 2877 #include <fog_fragment> 2878 #include <premultiplied_alpha_fragment> 2879 #include <dithering_fragment> 2880}`,CC=`#define LAMBERT 2881varying vec3 vViewPosition; 2882#include <common> 2883#include <batching_pars_vertex> 2884#include <uv_pars_vertex> 2885#include <displacementmap_pars_vertex> 2886#include <envmap_pars_vertex> 2887#include <color_pars_vertex> 2888#include <fog_pars_vertex> 2889#include <normal_pars_vertex> 2890#include <morphtarget_pars_vertex> 2891#include <skinning_pars_vertex> 2892#include <shadowmap_pars_vertex> 2893#include <logdepthbuf_pars_vertex> 2894#include <clipping_planes_pars_vertex> 2895void main() { 2896 #include <uv_vertex> 2897 #include <color_vertex> 2898 #include <morphinstance_vertex> 2899 #include <morphcolor_vertex> 2900 #include <batching_vertex> 2901 #include <beginnormal_vertex> 2902 #include <morphnormal_vertex> 2903 #include <skinbase_vertex> 2904 #include <skinnormal_vertex> 2905 #include <defaultnormal_vertex> 2906 #include <normal_vertex> 2907 #include <begin_vertex> 2908 #include <morphtarget_vertex> 2909 #include <skinning_vertex> 2910 #include <displacementmap_vertex> 2911 #include <project_vertex> 2912 #include <logdepthbuf_vertex> 2913 #include <clipping_planes_vertex> 2914 vViewPosition = - mvPosition.xyz; 2915 #include <worldpos_vertex> 2916 #include <envmap_vertex> 2917 #include <shadowmap_vertex> 2918 #include <fog_vertex> 2919}`,IC=`#define LAMBERT 2920uniform vec3 diffuse; 2921uniform vec3 emissive; 2922uniform float opacity; 2923#include <common> 2924#include <dithering_pars_fragment> 2925#include <color_pars_fragment> 2926#include <uv_pars_fragment> 2927#include <map_pars_fragment> 2928#include <alphamap_pars_fragment> 2929#include <alphatest_pars_fragment> 2930#include <alphahash_pars_fragment> 2931#include <aomap_pars_fragment> 2932#include <lightmap_pars_fragment> 2933#include <emissivemap_pars_fragment> 2934#include <envmap_common_pars_fragment> 2935#include <envmap_pars_fragment> 2936#include <fog_pars_fragment> 2937#include <bsdfs> 2938#include <lights_pars_begin> 2939#include <normal_pars_fragment> 2940#include <lights_lambert_pars_fragment> 2941#include <shadowmap_pars_fragment> 2942#include <bumpmap_pars_fragment> 2943#include <normalmap_pars_fragment> 2944#include <specularmap_pars_fragment> 2945#include <logdepthbuf_pars_fragment> 2946#include <clipping_planes_pars_fragment> 2947void main() { 2948 vec4 diffuseColor = vec4( diffuse, opacity ); 2949 #include <clipping_planes_fragment> 2950 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2951 vec3 totalEmissiveRadiance = emissive; 2952 #include <logdepthbuf_fragment> 2953 #include <map_fragment> 2954 #include <color_fragment> 2955 #include <alphamap_fragment> 2956 #include <alphatest_fragment> 2957 #include <alphahash_fragment> 2958 #include <specularmap_fragment> 2959 #include <normal_fragment_begin> 2960 #include <normal_fragment_maps> 2961 #include <emissivemap_fragment> 2962 #include <lights_lambert_fragment> 2963 #include <lights_fragment_begin> 2964 #include <lights_fragment_maps> 2965 #include <lights_fragment_end> 2966 #include <aomap_fragment> 2967 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2968 #include <envmap_fragment> 2969 #include <opaque_fragment> 2970 #include <tonemapping_fragment> 2971 #include <colorspace_fragment> 2972 #include <fog_fragment> 2973 #include <premultiplied_alpha_fragment> 2974 #include <dithering_fragment> 2975}`,MC=`#define MATCAP 2976varying vec3 vViewPosition; 2977#include <common> 2978#include <batching_pars_vertex> 2979#include <uv_pars_vertex> 2980#include <color_pars_vertex> 2981#include <displacementmap_pars_vertex> 2982#include <fog_pars_vertex> 2983#include <normal_pars_vertex> 2984#include <morphtarget_pars_vertex> 2985#include <skinning_pars_vertex> 2986#include <logdepthbuf_pars_vertex> 2987#include <clipping_planes_pars_vertex> 2988void main() { 2989 #include <uv_vertex> 2990 #include <color_vertex> 2991 #include <morphinstance_vertex> 2992 #include <morphcolor_vertex> 2993 #include <batching_vertex> 2994 #include <beginnormal_vertex> 2995 #include <morphnormal_vertex> 2996 #include <skinbase_vertex> 2997 #include <skinnormal_vertex> 2998 #include <defaultnormal_vertex> 2999 #include <normal_vertex> 3000 #include <begin_vertex> 3001 #include <morphtarget_vertex> 3002 #include <skinning_vertex> 3003 #include <displacementmap_vertex> 3004 #include <project_vertex> 3005 #include <logdepthbuf_vertex> 3006 #include <clipping_planes_vertex> 3007 #include <fog_vertex> 3008 vViewPosition = - mvPosition.xyz; 3009}`,wC=`#define MATCAP 3010uniform vec3 diffuse; 3011uniform float opacity; 3012uniform sampler2D matcap; 3013varying vec3 vViewPosition; 3014#include <common> 3015#include <dithering_pars_fragment> 3016#include <color_pars_fragment> 3017#include <uv_pars_fragment> 3018#include <map_pars_fragment> 3019#include <alphamap_pars_fragment> 3020#include <alphatest_pars_fragment> 3021#include <alphahash_pars_fragment> 3022#include <fog_pars_fragment> 3023#include <normal_pars_fragment> 3024#include <bumpmap_pars_fragment> 3025#include <normalmap_pars_fragment> 3026#includ
3026e <logdepthbuf_pars_fragment> 3027#include <clipping_planes_pars_fragment> 3028void main() { 3029 vec4 diffuseColor = vec4( diffuse, opacity ); 3030 #include <clipping_planes_fragment> 3031 #include <logdepthbuf_fragment> 3032 #include <map_fragment> 3033 #include <color_fragment> 3034 #include <alphamap_fragment> 3035 #include <alphatest_fragment> 3036 #include <alphahash_fragment> 3037 #include <normal_fragment_begin> 3038 #include <normal_fragment_maps> 3039 vec3 viewDir = normalize( vViewPosition ); 3040 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3041 vec3 y = cross( viewDir, x ); 3042 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3043 #ifdef USE_MATCAP 3044 vec4 matcapColor = texture2D( matcap, uv ); 3045 #else 3046 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3047 #endif 3048 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3049 #include <opaque_fragment> 3050 #include <tonemapping_fragment> 3051 #include <colorspace_fragment> 3052 #include <fog_fragment> 3053 #include <premultiplied_alpha_fragment> 3054 #include <dithering_fragment> 3055}`,TC=`#define NORMAL 3056#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3057 varying vec3 vViewPosition; 3058#endif 3059#include <common> 3060#include <batching_pars_vertex> 3061#include <uv_pars_vertex> 3062#include <displacementmap_pars_vertex> 3063#include <normal_pars_vertex> 3064#include <morphtarget_pars_vertex> 3065#include <skinning_pars_vertex> 3066#include <logdepthbuf_pars_vertex> 3067#include <clipping_planes_pars_vertex> 3068void main() { 3069 #include <uv_vertex> 3070 #include <batching_vertex> 3071 #include <beginnormal_vertex> 3072 #include <morphinstance_vertex> 3073 #include <morphnormal_vertex> 3074 #include <skinbase_vertex> 3075 #include <skinnormal_vertex> 3076 #include <defaultnormal_vertex> 3077 #include <normal_vertex> 3078 #include <begin_vertex> 3079 #include <morphtarget_vertex> 3080 #include <skinning_vertex> 3081 #include <displacementmap_vertex> 3082 #include <project_vertex> 3083 #include <logdepthbuf_vertex> 3084 #include <clipping_planes_vertex> 3085#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3086 vViewPosition = - mvPosition.xyz; 3087#endif 3088}`,RC=`#define NORMAL 3089uniform float opacity; 3090#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3091 varying vec3 vViewPosition; 3092#endif 3093#include <uv_pars_fragment> 3094#include <normal_pars_fragment> 3095#include <bumpmap_pars_fragment> 3096#include <normalmap_pars_fragment> 3097#include <logdepthbuf_pars_fragment> 3098#include <clipping_planes_pars_fragment> 3099void main() { 3100 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3101 #include <clipping_planes_fragment> 3102 #include <logdepthbuf_fragment> 3103 #include <normal_fragment_begin> 3104 #include <normal_fragment_maps> 3105 gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); 3106 #ifdef OPAQUE 3107 gl_FragColor.a = 1.0; 3108 #endif 3109}`,BC=`#define PHONG 3110varying vec3 vViewPosition; 3111#include <common> 3112#include <batching_pars_vertex> 3113#include <uv_pars_vertex> 3114#include <displacementmap_pars_vertex> 3115#include <envmap_pars_vertex> 3116#include <color_pars_vertex> 3117#include <fog_pars_vertex> 3118#include <normal_pars_vertex> 3119#include <morphtarget_pars_vertex> 3120#include <skinning_pars_vertex> 3121#include <shadowmap_pars_vertex> 3122#include <logdepthbuf_pars_vertex> 3123#include <clipping_planes_pars_vertex> 3124void main() { 3125 #include <uv_vertex> 3126 #include <color_vertex> 3127 #include <morphcolor_vertex> 3128 #include <batching_vertex> 3129 #include <beginnormal_vertex> 3130 #include <morphinstance_vertex> 3131 #include <morphnormal_vertex> 3132 #include <skinbase_vertex> 3133 #include <skinnormal_vertex> 3134 #include <defaultnormal_vertex> 3135 #include <normal_vertex> 3136 #include <begin_vertex> 3137 #include <morphtarget_vertex> 3138 #include <skinning_vertex> 3139 #include <displacementmap_vertex> 3140 #include <project_vertex> 3141 #include <logdepthbuf_vertex> 3142 #include <clipping_planes_vertex> 3143 vViewPosition = - mvPosition.xyz; 3144 #include <worldpos_vertex> 3145 #include <envmap_vertex> 3146 #include <shadowmap_vertex> 3147 #include <fog_vertex> 3148}`,DC=`#define PHONG 3149uniform vec3 diffuse; 3150uniform vec3 emissive; 3151uniform vec3 specular; 3152uniform float shininess; 3153uniform float opacity; 3154#include <common> 3155#include <dithering_pars_fragment> 3156#include <color_pars_fragment> 3157#include <uv_pars_fragment> 3158#include <map_pars_fragment> 3159#include <alphamap_pars_fragment> 3160#include <alphatest_pars_fragment> 3161#include <alphahash_pars_fragment> 3162#include <aomap_pars_fragment> 3163#include <lightmap_pars_fragment> 3164#include <emissivemap_pars_fragment> 3165#include <envmap_common_pars_fragment> 3166#include <envmap_pars_fragment> 3167#include <fog_pars_fragment> 3168#include <bsdfs> 3169#include <lights_pars_begin> 3170#include <normal_pars_fragment> 3171#include <lights_phong_pars_fragment> 3172#include <shadowmap_pars_fragment> 3173#include <bumpmap_pars_fragment> 3174#include <normalmap_pars_fragment> 3175#include <specularmap_pars_fragment> 3176#include <logdepthbuf_pars_fragment> 3177#include <clipping_planes_pars_fragment> 3178void main() { 3179 vec4 diffuseColor = vec4( diffuse, opacity ); 3180 #include <clipping_planes_fragment> 3181 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3182 vec3 totalEmissiveRadiance = emissive; 3183 #include <logdepthbuf_fragment> 3184 #include <map_fragment> 3185 #include <color_fragment> 3186 #include <alphamap_fragment> 3187 #include <alphatest_fragment> 3188 #include <alphahash_fragment> 3189 #include <specularmap_fragment> 3190 #include <normal_fragment_begin> 3191 #include <normal_fragment_maps> 3192 #include <emissivemap_fragment> 3193 #include <lights_phong_fragment> 3194 #include <lights_fragment_begin> 3195 #include <lights_fragment_maps> 3196 #include <lights_fragment_end> 3197 #include <aomap_fragment> 3198 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3199 #include <envmap_fragment> 3200 #include <opaque_fragment> 3201 #include <tonemapping_fragment> 3202 #include <colorspace_fragment> 3203 #include <fog_fragment> 3204 #include <premultiplied_alpha_fragment> 3205 #include <dithering_fragment> 3206}`,LC=`#define STANDARD 3207varying vec3 vViewPosition; 3208#ifdef USE_TRANSMISSION 3209 varying vec3 vWorldPosition; 3210#endif 3211#include <common> 3212#include <batching_pars_vertex> 3213#include <uv_pars_vertex> 3214#include <displacementmap_pars_vertex> 3215#include <color_pars_vertex> 3216#include <fog_pars_vertex> 3217#include <normal_pars_vertex> 3218#include <morphtarget_pars_vertex> 3219#include <skinning_pars_vertex> 3220#include <shadowmap_pars_vertex> 3221#include <logdepthbuf_pars_vertex> 3222#include <clipping_planes_pars_vertex> 3223void main() { 3224 #include <uv_vertex> 3225 #include <color_vertex> 3226 #include <morphinstance_vertex> 3227 #include <morphcolor_vertex> 3228 #include <batching_vertex> 3229 #include <beginnormal_vertex> 3230 #include <morphnormal_vertex> 3231 #include <skinbase_vertex> 3232 #include <skinnormal_vertex> 3233 #include <defaultnormal_vertex> 3234 #include <normal_vertex> 3235 #include <begin_vertex> 3236 #include <morphtarget_vertex> 3237 #include <skinning_vertex> 3238 #include <displacementmap_vertex> 3239 #include <project_vertex> 3240 #include <logdepthbuf_vertex> 3241 #include <clipping_planes_vertex> 3242 vViewPosition = - mvPosition.xyz; 3243 #include <worldpos_vertex> 3244 #include <shadowmap_vertex> 3245 #include <fog_vertex> 3246#ifdef USE_TRANSMISSION 3247 vWorldPosition = worldPosition.xyz; 3248#endif 3249}`,FC=`#define STANDARD 3250#ifdef PHYSICAL 3251 #define IOR 3252 #define USE_SPECULAR 3253#endif 3254uniform vec3 diffuse; 3255uniform vec3 emissive; 3256uniform float roughness; 3257uniform float metalness; 3258uniform float opacity; 3259#ifdef IOR 3260 uniform float ior; 3261#endif 3262#ifdef USE_SPECULAR 3263 uniform float specularIntensity; 3264 uniform vec3 specularColor; 3265 #ifdef USE_SPECULAR_COLORMAP 3266 uniform sampler2D specularColorMap; 3267 #endif 3268 #ifdef USE_SPECULAR_INTENSITYMAP 3269 uniform sampler2D specularIntensityMap; 3270 #endif 3271#endif 3272#ifdef USE_CLEARCOAT 3273 uniform float clearcoat; 3274 uniform float clearcoatRoughness; 3275#endif 3276#ifdef USE_DISPERSION 3277 uniform float dispersion; 3278#endif
3279#ifdef USE_IRIDESCENCE 3280 uniform float iridescence; 3281 uniform float iridescenceIOR; 3282 uniform float iridescenceThicknessMinimum; 3283 uniform float iridescenceThicknessMaximum; 3284#endif 3285#ifdef USE_SHEEN 3286 uniform vec3 sheenColor; 3287 uniform float sheenRoughness; 3288 #ifdef USE_SHEEN_COLORMAP 3289 uniform sampler2D sheenColorMap; 3290 #endif 3291 #ifdef USE_SHEEN_ROUGHNESSMAP 3292 uniform sampler2D sheenRoughnessMap; 3293 #endif 3294#endif 3295#ifdef USE_ANISOTROPY 3296 uniform vec2 anisotropyVector; 3297 #ifdef USE_ANISOTROPYMAP 3298 uniform sampler2D anisotropyMap; 3299 #endif 3300#endif 3301varying vec3 vViewPosition; 3302#include <common> 3303#include <dithering_pars_fragment> 3304#include <color_pars_fragment> 3305#include <uv_pars_fragment> 3306#include <map_pars_fragment> 3307#include <alphamap_pars_fragment> 3308#include <alphatest_pars_fragment> 3309#include <alphahash_pars_fragment> 3310#include <aomap_pars_fragment> 3311#include <lightmap_pars_fragment> 3312#include <emissivemap_pars_fragment> 3313#include <iridescence_fragment> 3314#include <cube_uv_reflection_fragment> 3315#include <envmap_common_pars_fragment> 3316#include <envmap_physical_pars_fragment> 3317#include <fog_pars_fragment> 3318#include <lights_pars_begin> 3319#include <normal_pars_fragment> 3320#include <lights_physical_pars_fragment> 3321#include <transmission_pars_fragment> 3322#include <shadowmap_pars_fragment> 3323#include <bumpmap_pars_fragment> 3324#include <normalmap_pars_fragment> 3325#include <clearcoat_pars_fragment> 3326#include <iridescence_pars_fragment> 3327#include <roughnessmap_pars_fragment> 3328#include <metalnessmap_pars_fragment> 3329#include <logdepthbuf_pars_fragment> 3330#include <clipping_planes_pars_fragment> 3331void main() { 3332 vec4 diffuseColor = vec4( diffuse, opacity ); 3333 #include <clipping_planes_fragment> 3334 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3335 vec3 totalEmissiveRadiance = emissive; 3336 #include <logdepthbuf_fragment> 3337 #include <map_fragment> 3338 #include <color_fragment> 3339 #include <alphamap_fragment> 3340 #include <alphatest_fragment> 3341 #include <alphahash_fragment> 3342 #include <roughnessmap_fragment> 3343 #include <metalnessmap_fragment> 3344 #include <normal_fragment_begin> 3345 #include <normal_fragment_maps> 3346 #include <clearcoat_normal_fragment_begin> 3347 #include <clearcoat_normal_fragment_maps> 3348 #include <emissivemap_fragment> 3349 #include <lights_physical_fragment> 3350 #include <lights_fragment_begin> 3351 #include <lights_fragment_maps> 3352 #include <lights_fragment_end> 3353 #include <aomap_fragment> 3354 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3355 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3356 #include <transmission_fragment> 3357 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3358 #ifdef USE_SHEEN 3359 3360 outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; 3361 3362 #endif 3363 #ifdef USE_CLEARCOAT 3364 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3365 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3366 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3367 #endif 3368 #include <opaque_fragment> 3369 #include <tonemapping_fragment> 3370 #include <colorspace_fragment> 3371 #include <fog_fragment> 3372 #include <premultiplied_alpha_fragment> 3373 #include <dithering_fragment> 3374}`,PC=`#define TOON 3375varying vec3 vViewPosition; 3376#include <common> 3377#include <batching_pars_vertex> 3378#include <uv_pars_vertex> 3379#include <displacementmap_pars_vertex> 3380#include <color_pars_vertex> 3381#include <fog_pars_vertex> 3382#include <normal_pars_vertex> 3383#include <morphtarget_pars_vertex> 3384#include <skinning_pars_vertex> 3385#include <shadowmap_pars_vertex> 3386#include <logdepthbuf_pars_vertex> 3387#include <clipping_planes_pars_vertex> 3388void main() { 3389 #include <uv_vertex> 3390 #include <color_vertex> 3391 #include <morphinstance_vertex> 3392 #include <morphcolor_vertex> 3393 #include <batching_vertex> 3394 #include <beginnormal_vertex> 3395 #include <morphnormal_vertex> 3396 #include <skinbase_vertex> 3397 #include <skinnormal_vertex> 3398 #include <defaultnormal_vertex> 3399 #include <normal_vertex> 3400 #include <begin_vertex> 3401 #include <morphtarget_vertex> 3402 #include <skinning_vertex> 3403 #include <displacementmap_vertex> 3404 #include <project_vertex> 3405 #include <logdepthbuf_vertex> 3406 #include <clipping_planes_vertex> 3407 vViewPosition = - mvPosition.xyz; 3408 #include <worldpos_vertex> 3409 #include <shadowmap_vertex> 3410 #include <fog_vertex> 3411}`,NC=`#define TOON 3412uniform vec3 diffuse; 3413uniform vec3 emissive; 3414uniform float opacity; 3415#include <common> 3416#include <dithering_pars_fragment> 3417#include <color_pars_fragment> 3418#include <uv_pars_fragment> 3419#include <map_pars_fragment> 3420#include <alphamap_pars_fragment> 3421#include <alphatest_pars_fragment> 3422#include <alphahash_pars_fragment> 3423#include <aomap_pars_fragment> 3424#include <lightmap_pars_fragment> 3425#include <emissivemap_pars_fragment> 3426#include <gradientmap_pars_fragment> 3427#include <fog_pars_fragment> 3428#include <bsdfs> 3429#include <lights_pars_begin> 3430#include <normal_pars_fragment> 3431#include <lights_toon_pars_fragment> 3432#include <shadowmap_pars_fragment> 3433#include <bumpmap_pars_fragment> 3434#include <normalmap_pars_fragment> 3435#include <logdepthbuf_pars_fragment> 3436#include <clipping_planes_pars_fragment> 3437void main() { 3438 vec4 diffuseColor = vec4( diffuse, opacity ); 3439 #include <clipping_planes_fragment> 3440 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3441 vec3 totalEmissiveRadiance = emissive; 3442 #include <logdepthbuf_fragment> 3443 #include <map_fragment> 3444 #include <color_fragment> 3445 #include <alphamap_fragment> 3446 #include <alphatest_fragment> 3447 #include <alphahash_fragment> 3448 #include <normal_fragment_begin> 3449 #include <normal_fragment_maps> 3450 #include <emissivemap_fragment> 3451 #include <lights_toon_fragment> 3452 #include <lights_fragment_begin> 3453 #include <lights_fragment_maps> 3454 #include <lights_fragment_end> 3455 #include <aomap_fragment> 3456 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3457 #include <opaque_fragment> 3458 #include <tonemapping_fragment> 3459 #include <colorspace_fragment> 3460 #include <fog_fragment> 3461 #include <premultiplied_alpha_fragment> 3462 #include <dithering_fragment> 3463}`,UC=`uniform float size; 3464uniform float scale; 3465#include <common> 3466#include <color_pars_vertex> 3467#include <fog_pars_vertex> 3468#include <morphtarget_pars_vertex> 3469#include <logdepthbuf_pars_vertex> 3470#include <clipping_planes_pars_vertex> 3471#ifdef USE_POINTS_UV 3472 varying vec2 vUv; 3473 uniform mat3 uvTransform; 3474#endif 3475void main() { 3476 #ifdef USE_POINTS_UV 3477 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3478 #endif 3479 #include <color_vertex> 3480 #include <morphinstance_vertex> 3481 #include <morphcolor_vertex> 3482 #include <begin_vertex> 3483 #include <morphtarget_vertex> 3484 #include <project_vertex> 3485 gl_PointSize = size; 3486 #ifdef USE_SIZEATTENUATION 3487 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3488 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3489 #endif 3490 #include <logdepthbuf_vertex> 3491 #include <clipping_planes_vertex> 3492 #include <worldpos_vertex> 3493 #include <fog_vertex> 3494}`,OC=`uniform vec3 diffuse; 3495uniform float opacity; 3496#include <common> 3497#include <color_pars_fragment> 3498#include <map_particle_pars_fragment> 3499#include <alphatest_pars_fragment> 3500#include <alphahash_pars_fragment> 3501#include <fog_pars_fragment> 3502#include <logdepthbuf_pars_fragment> 3503#include <clipping_planes_pars_fragment> 3504void main() { 3505 vec4 diffuseColor = vec4( diffuse, opacity ); 3506 #include <clipping_planes_fragment> 3507 vec3 outgoingLight = vec3( 0.0 ); 3508 #include <logdepthbuf_fragment> 3509 #include <map_particle_fragment> 3510 #include <color_fragment> 3511 #include <alphatest_fragment> 3512 #include <alphahash_fragment> 3513 outgoingLight = diffuseColor.rgb; 3514 #include <opaque_fragment> 3515 #include <tonemapping_fragment> 3516 #include <colorspace_fragment> 3517 #include <fog_fragment> 3518 #include <premultiplied_alpha_fragment> 3519}`,kC=`#include <common> 3520#include <batching_pars_vertex> 3521#include <fog_pars_vertex> 3522#include <morphtarget_pars_vertex> 3523#include <skinning_pars_vertex> 3524#include <logdepthbuf_pars_vertex> 3525#include <shadowmap_pars_vertex> 3526void main() { 3527 #include <batching_vertex> 3528 #include <beginnormal_vertex> 3529 #include <morphinstance_vertex> 3530 #include <morphnormal_vertex> 3531 #include <skinbase_vertex> 3532 #include <skinnormal_vertex> 3533 #include <defaultnormal_vertex> 3534 #include <begin_vertex> 3535 #include <morphtarget_vertex> 3536 #include <skinning_vertex> 3537 #include <project_vertex> 3538 #include <logdepthbuf_vertex> 3539 #include <worldpos_vertex> 3540 #include <shadowmap_vertex> 3541 #include <fog_vertex> 3542}`,QC=`uniform vec3 color; 3543uniform float opacity; 3544#include <common> 3545#include <fog_pars_fragment> 3546#include <bsdfs> 3547#include <lights_pars_begin> 3548#include <logdepthbuf_pars_fragment> 3549#include <shadowmap_pars_fragment> 3550#include <shadowmask_pars_fragment> 3551void main() { 3552 #include <logdepthbuf_fragment> 3553 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3554 #include <tonemapping_fragment> 3555 #include <colorspace_fragment> 3556 #include <fog_fragment> 3557}`,GC=`uniform float rotation; 3558uniform vec2 center; 3559#include <common> 3560#include <uv_pars_vertex> 3561#include <fog_pars_vertex> 3562#include <logdepthbuf_pars_vertex> 3563#include <clipping_planes_pars_vertex> 3564void main() { 3565 #include <uv_vertex> 3566 vec4 mvPosition = modelViewMatrix[ 3 ]; 3567 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3568 #ifndef USE_SIZEATTENUATION 3569 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3570 if ( isPerspective ) scale *= - mvPosition.z; 3571 #endif 3572 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3573 vec2 rotatedPosition; 3574 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3575 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3576 mvPosition.xy += rotatedPosition; 3577 gl_Position = projectionMatrix * mvPosition; 3578 #include <logdepthbuf_vertex> 3579 #include <clipping_planes_vertex> 3580 #include <fog_vertex> 3581}`,HC=`uniform vec3 diffuse; 3582uniform float opacity; 3583#include <common> 3584#include <uv_pars_fragment> 3585#include <map_pars_fragment> 3586#include <alphamap_pars_fragment> 3587#include <alphatest_pars_fragment> 3588#include <alphahash_pars_fragment> 3589#include <fog_pars_fragment> 3590#include <logdepthbuf_pars_fragment> 3591#include <clipping_planes_pars_fragment> 3592void main() { 3593 vec4 diffuseColor = vec4( diffuse, opacity ); 3594 #include <clipping_planes_fragment> 3595 vec3 outgoingLight = vec3( 0.0 ); 3596 #include <logdepthbuf_fragment> 3597 #include <map_fragment> 3598 #include <alphamap_fragment> 3599 #include <alphatest_fragment> 3600 #include <alphahash_fragment> 3601 outgoingLight = diffuseColor.rgb; 3602 #include <opaque_fragment> 3603 #include <tonemapping_fragment> 3604 #include <colorspace_fragment> 3605 #include <fog_fragment> 3606}`,qe={alphahash_fragment:hy,alphahash_pars_fragment:uy,alphamap_fragment:dy,alphamap_pars_fragment:fy,alph
vendor: 7,311 bytes, line 3606
3606atest_fragment:py,alphatest_pars_fragment:Ay,aomap_fragment:my,aomap_pars_fragment:gy,batching_pars_vertex:xy,batching_vertex:by,begin_vertex:_y,beginnormal_vertex:vy,bsdfs:Ey,iridescence_fragment:yy,bumpmap_pars_fragment:Sy,clipping_planes_fragment:Cy,clipping_planes_pars_fragment:Iy,clipping_planes_pars_vertex:My,clipping_planes_vertex:wy,color_fragment:Ty,color_pars_fragment:Ry,color_pars_vertex:By,color_vertex:Dy,common:Ly,cube_uv_reflection_fragment:Fy,defaultnormal_vertex:Py,displacementmap_pars_vertex:Ny,displacementmap_vertex:Uy,emissivemap_fragment:Oy,emissivemap_pars_fragment:ky,colorspace_fragment:Qy,colorspace_pars_fragment:Gy,envmap_fragment:Hy,envmap_common_pars_fragment:zy,envmap_pars_fragment:Vy,envmap_pars_vertex:Wy,envmap_physical_pars_fragment:nS,envmap_vertex:qy,fog_vertex:Xy,fog_pars_vertex:$y,fog_fragment:Yy,fog_pars_fragment:jy,gradientmap_pars_fragment:Ky,lightmap_pars_fragment:Jy,lights_lambert_fragment:Zy,lights_lambert_pars_fragment:eS,lights_pars_begin:tS,lights_toon_fragment:iS,lights_toon_pars_fragment:sS,lights_phong_fragment:rS,lights_phong_pars_fragment:aS,lights_physical_fragment:oS,lights_physical_pars_fragment:cS,lights_fragment_begin:lS,lights_fragment_maps:hS,lights_fragment_end:uS,logdepthbuf_fragment:dS,logdepthbuf_pars_fragment:fS,logdepthbuf_pars_vertex:pS,logdepthbuf_vertex:AS,map_fragment:mS,map_pars_fragment:gS,map_particle_fragment:xS,map_particle_pars_fragment:bS,metalnessmap_fragment:_S,metalnessmap_pars_fragment:vS,morphinstance_vertex:ES,morphcolor_vertex:yS,morphnormal_vertex:SS,morphtarget_pars_vertex:CS,morphtarget_vertex:IS,normal_fragment_begin:MS,normal_fragment_maps:wS,normal_pars_fragment:TS,normal_pars_vertex:RS,normal_vertex:BS,normalmap_pars_fragment:DS,clearcoat_normal_fragment_begin:LS,clearcoat_normal_fragment_maps:FS,clearcoat_pars_fragment:PS,iridescence_pars_fragment:NS,opaque_fragment:US,packing:OS,premultiplied_alpha_fragment:kS,project_vertex:QS,dithering_fragment:GS,dithering_pars_fragment:HS,roughnessmap_fragment:zS,roughnessmap_pars_fragment:VS,shadowmap_pars_fragment:WS,shadowmap_pars_vertex:qS,shadowmap_vertex:XS,shadowmask_pars_fragment:$S,skinbase_vertex:YS,skinning_pars_vertex:jS,skinning_vertex:KS,skinnormal_vertex:JS,specularmap_fragment:ZS,specularmap_pars_fragment:eC,tonemapping_fragment:tC,tonemapping_pars_fragment:nC,transmission_fragment:iC,transmission_pars_fragment:sC,uv_pars_fragment:rC,uv_pars_vertex:aC,uv_vertex:oC,worldpos_vertex:cC,background_vert:lC,background_frag:hC,backgroundCube_vert:uC,backgroundCube_frag:dC,cube_vert:fC,cube_frag:pC,depth_vert:AC,depth_frag:mC,distance_vert:gC,distance_frag:xC,equirect_vert:bC,equirect_frag:_C,linedashed_vert:vC,linedashed_frag:EC,meshbasic_vert:yC,meshbasic_frag:SC,meshlambert_vert:CC,meshlambert_frag:IC,meshmatcap_vert:MC,meshmatcap_frag:wC,meshnormal_vert:TC,meshnormal_frag:RC,meshphong_vert:BC,meshphong_frag:DC,meshphysical_vert:LC,meshphysical_frag:FC,meshtoon_vert:PC,meshtoon_frag:NC,points_vert:UC,points_frag:OC,shadow_vert:kC,shadow_frag:QC,sprite_vert:GC,sprite_frag:HC},ue={common:{diffuse:{value:new Ie(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Qe},alphaMap:{value:null},alphaMapTransform:{value:new Qe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Qe}},envmap:{envMap:{value:null},envMapRotation:{value:new Qe},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Qe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Qe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Qe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Qe},normalScale:{value:new pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Qe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Qe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Qe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Qe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ie(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ie(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Qe},alphaTest:{value:0},uvTransform:{value:new Qe}},sprite:{diffuse:{value:new Ie(16777215)},opacity:{value:1},center:{value:new pe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Qe},alphaMap:{value:null},alphaMapTransform:{value:new Qe},alphaTest:{value:0}}},fi={basic:{uniforms:An([ue.common,ue.specularmap,ue.envmap,ue.aomap,ue.lightmap,ue.fog]),vertexShader:qe.meshbasic_vert,fragmentShader:qe.meshbasic_frag},lambert:{uniforms:An([ue.common,ue.specularmap,ue.envmap,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.fog,ue.lights,{emissive:{value:new Ie(0)}}]),vertexShader:qe.meshlambert_vert,fragmentShader:qe.meshlambert_frag},phong:{uniforms:An([ue.common,ue.specularmap,ue.envmap,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.fog,ue.lights,{emissive:{value:new Ie(0)},specular:{value:new Ie(1118481)},shininess:{value:30}}]),vertexShader:qe.meshphong_vert,fragmentShader:qe.meshphong_frag},standard:{uniforms:An([ue.common,ue.envmap,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.roughnessmap,ue.metalnessmap,ue.fog,ue.lights,{emissive:{value:new Ie(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:qe.meshphysical_vert,fragmentShader:qe.meshphysical_frag},toon:{uniforms:An([ue.common,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.gradientmap,ue.fog,ue.lights,{emissive:{value:new Ie(0)}}]),vertexShader:qe.meshtoon_vert,fragmentShader:qe.meshtoon_frag},matcap:{uniforms:An([ue.common,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.fog,{matc
vendor: 5,268 bytes, line 3606
3606ap:{value:null}}]),vertexShader:qe.meshmatcap_vert,fragmentShader:qe.meshmatcap_frag},points:{uniforms:An([ue.points,ue.fog]),vertexShader:qe.points_vert,fragmentShader:qe.points_frag},dashed:{uniforms:An([ue.common,ue.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:qe.linedashed_vert,fragmentShader:qe.linedashed_frag},depth:{uniforms:An([ue.common,ue.displacementmap]),vertexShader:qe.depth_vert,fragmentShader:qe.depth_frag},normal:{uniforms:An([ue.common,ue.bumpmap,ue.normalmap,ue.displacementmap,{opacity:{value:1}}]),vertexShader:qe.meshnormal_vert,fragmentShader:qe.meshnormal_frag},sprite:{uniforms:An([ue.sprite,ue.fog]),vertexShader:qe.sprite_vert,fragmentShader:qe.sprite_frag},background:{uniforms:{uvTransform:{value:new Qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:qe.background_vert,fragmentShader:qe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Qe}},vertexShader:qe.backgroundCube_vert,fragmentShader:qe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:qe.cube_vert,fragmentShader:qe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:qe.equirect_vert,fragmentShader:qe.equirect_frag},distance:{uniforms:An([ue.common,ue.displacementmap,{referencePosition:{value:new B},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:qe.distance_vert,fragmentShader:qe.distance_frag},shadow:{uniforms:An([ue.lights,ue.fog,{color:{value:new Ie(0)},opacity:{value:1}}]),vertexShader:qe.shadow_vert,fragmentShader:qe.shadow_frag}};fi.physical={uniforms:An([fi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Qe},clearcoatNormalScale:{value:new pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Qe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Qe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Qe},sheen:{value:0},sheenColor:{value:new Ie(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Qe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Qe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Qe},transmissionSamplerSize:{value:new pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Qe},attenuationDistance:{value:0},attenuationColor:{value:new Ie(0)},specularColor:{value:new Ie(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Qe},anisotropyVector:{value:new pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Qe}}]),vertexShader:qe.meshphysical_vert,fragmentShader:qe.meshphysical_frag};const dc={r:0,b:0,g:0},bs=new Vn,zC=new Ue;function VC(r,e,t,n,i,s,a){const o=new Ie(0);let c=s===!0?0:1,l,u,h=null,d=0,f=null;function p(_){let b=_.isScene===!0?_.background:null;return b&&b.isTexture&&(b=(_.backgroundBlurriness>0?t:e).get(b)),b}function g(_){let b=!1;const v=p(_);v===null?A(o,c):v&&v.isColor&&(A(v,1),b=!0);const C=r.xr.getEnvironmentBlendMode();C==="additive"?n.buffers.color.setClear(0,0,0,1,a):C==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||b)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function m(_,b){const v=p(b);v&&(v.isCubeTexture||v.mapping===Ll)?(u===void 0&&(u=new ot(new Wi(1,1,1),new _n({name:"BackgroundCubeMaterial",uniforms:ta(fi.backgroundCube.uniforms),vertexShader:fi.backgroundCube.vertexShader,fragmentShader:fi.backgroundCube.fragmentShader,side:nn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(C,M,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),bs.copy(b.backgroundRotation),bs.x*=-1,bs.y*=-1,bs.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(bs.y*=-1,bs.z*=-1),u.material.uniforms.envMap.value=v,u.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=b.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(zC.makeRotationFromEuler(bs)),u.material.toneMapped=Ze.getTransfer(v.colorSpace)!==ft,(h!==v||d!==v.version||f!==r.toneMapping)&&(u.material.needsUpdate=!0,h=v,d=v.version,f=r.toneMapping),u.layers.enableAll(),_.unshift(u,u.geometry,u.material,0,0,null)):v&&v.isTexture&&(l===void 0&&(l=new ot(new si(2,2),new _n({name:"Backgroun
3606dMaterial",uniforms:ta(fi.background.uniforms),vertexShader:fi.background.vertexShader,fragmentShader:fi.background.fragmentShader,side:ti,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=v,l.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,l.material.toneMapped=Ze.getTransfer(v.colorSpace)!==ft,v.matrixAutoUpdate===!0&&v.updateMatrix(),l.material.uniforms.uvTransform.value.copy(v.matrix),(h!==v||d!==v.version||f!==r.toneMapping)&&(l.material.needsUpdate=!0,h=v,d=v.version,f=r.toneMapping),l.layers.enableAll(),_.unshift(l,l.geometry,l.material,0,0,null))}function A(_,b){_.getRGB(dc,I0(r)),n.buffers.color.setClear(dc.r,dc.g,dc.b,b,a)}function x(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(_,b=1){o.set(_),c=b,A(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(_){c=_,A(o,c)},render:g,addToRenderList:m,dispose:x}}function WC(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=d(null);let s=i,a=!1;function o(S,R,N,F,P){let Q=!1;const U=h(F,N,R);s!==U&&(s=U,l(s.object)),Q=f(S,F,N,P),Q&&p(S,F,N,P),P!==null&&e.update(P,r.ELEMENT_ARRAY_BUFFER),(Q||a)&&(a=!1,b(S,R,N,F),P!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(P).buffer))}function c(){return r.createVertexArray()}function l(S){return r.bindVertexArray(S)}function u(S){return r.deleteVertexArray(S)}function h(S,R,N){const F=N.wireframe===!0;let P=n[S.id];P===void 0&&(P={},n[S.id]=P);let Q=P[R.id];Q===void 0&&(Q={},P[R.id]=Q);let U=Q[F];return U===void 0&&(U=d(c()),Q[F]=U),U}function d(S){const R=[],N=[],F=[];for(let P=0;P<t;P++)R[P]=0,N[P]=0,F[P]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:R,enabledAttributes:N,attributeDivisors:F,object:S,attributes:{},index:null}}function f(S,R,N,F){const P=s.attributes,Q=R.attributes;let U=0;const G=N.getAttributes();for(const q in G)if(G[q].location>=0){const Z=P[q];let Y=Q[q];if(Y===void 0&&(q==="instanceMatrix"&&S.instanceMatrix&&(Y=S.instanceMatrix),q==="instanceColor"&&S.instanceColor&&(Y=S.instanceColor)),Z===void 0||Z.attribute!==Y||Y&&Z.data!==Y.data)return!0;U++}return s.attributesNum!==U||s.index!==F}function p(S,R,N,F){const P={},Q=R.attributes;let U=0;const G=N.getAttributes();for(const q in G)if(G[q].location>=0){let Z=Q[q];Z===void 0&&(q==="instanceMatrix"&&S.instanceMatrix&&(Z=S.instanceMatrix),q==="instanceColor"&&S.instanceColor&&(Z=S.instanceColor));const Y={};Y.attribute=Z,Z&&Z.data&&(Y.data=Z.data),P[q]=Y,U++}s.attributes=P,s.attributesNum=U,s.index=F}function g(){const S=s.newAttributes;for(let R=0,N=S.length;R<N;R++)S[R]=0}function m(S){A(S,0)}function A(S,R){const N=s.newAttributes,F=s.enabledAttributes,P=s.attributeDivisors;N[S]=1,F[S]===0&&(r.enableVertexAttribArray(S),F[S]=1),P[S]!==R&&(r.vertexAttribDivisor(S,R),P[S]=R)}function x(){const S=s.newAttributes,R=s.enabledAttributes;for(let N=0,F=R.length;N<F;N++)R[N]!==S[N]&&(r.disableVertexAttribArray(N),R[N]=0)}function _(S,R,N,F,P,Q,U){U===!0?r.vertexAttribIPointer(S,R,N,P,Q):r.vertexAttribPointer(S,R,N,F,P,Q)}function b(S,R,N,F){g();const P=F.attributes,Q=N.getAttributes(),U=R.defaultAttributeValues;for(const G in Q){const q=Q[G];if(q.location>=0){let J=P[G];if(J===void 0&&(G==="instanceMatrix"&&S.instanceMatrix&&(J=S.instanceMatrix),G==="instanceColor"&&S.instanceColor&&(J=S.instanceColor)),J!==void 0){const Z=J.normalized,Y=J.itemSize,re=e.get(J);if(re===void 0)continue;const Ae=re.buffer,He=re.type,ze=re.bytesPerElement,X=He===r.INT||He===r.UNSIGNED_INT||J.gpuType===Fl;if(J.isInterleavedBufferAttribute){const ee=J.data,ge=ee.stride,Ge=J.offset;if(ee.isInstancedInterleavedBuffer){for(let _e=0;_e<q.locationSize;_e++)A(q.location+_e,ee.meshPerAttribute);S.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let _e=0;_e<q.locationSize;_e++)m(q.location+_e);r.bindBuffer(r.ARRAY_BUFFER,Ae);for(let _e=0;_e<q.locationSize;_e++)_(q.location+_e,Y/q.locationSize,He,Z,ge*ze,(Ge+Y/q.locationSize*_e)*ze,X)}else{if(J.isInstancedBufferAttribute){for(let ee=0;ee<q.locationSize;ee++)A(q.location+ee,J.meshPerAttribute);S.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let ee=0;ee<q.locationSize;ee++)m(q.location+ee);r.bindBuffer(r.ARRAY_BUFFER,Ae);for(let ee=0;ee<q.locationSize;ee++)_(q.location+ee,Y/q.locationSize,He,Z,Y*ze,Y/q.locationSize*ee*ze,X)}}else if(U!==void 0){const Z=U[G];if(Z!==void 0)switch(Z.length){case 2:r.vertexAttrib2fv(q.location,Z);break;case 3:r.vertexAttrib3fv(q.location,Z);break;case 4:r.vertexAttrib4fv(q.location,Z);break;default:r.vertexAttrib1fv(q.location,Z)}}}}x()}function v(){w();for(const S in n){const R=n[S];for(const N in R){const F=R[N];for(const P in F)u(F[P].object),delete F[P];delete R[N]}delete n[S]}}function C(S){if(n[S.id]===void 0)return;const R=n[S.id];for(const N in R){const F=R[N];for(const P in F)u(F[P].object),delete F[P];delete R[N]}delete n[S.id]}function M(S){for(const R in n){const N=n[R];if(N[S.id]===void 0)continue;const F=N[S.id];for(const P in F)u(F[P].object),delete F[P];delete N[S.id]}}function w(){E(),a=!0,s!==i&&(s=i,l(s.object))}
vendor: 7,916 bytes, line 3606
3606function E(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:w,resetDefaultState:E,dispose:v,releaseStatesOfGeometry:C,releaseStatesOfProgram:M,initAttributes:g,enableAttribute:m,disableUnusedAttributes:x}}function qC(r,e,t){let n;function i(l){n=l}function s(l,u){r.drawArrays(n,l,u),t.update(u,n,1)}function a(l,u,h){h!==0&&(r.drawArraysInstanced(n,l,u,h),t.update(u,n,h))}function o(l,u,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,u,0,h);let f=0;for(let p=0;p<h;p++)f+=u[p];t.update(f,n,1)}function c(l,u,h,d){if(h===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let p=0;p<l.length;p++)a(l[p],u[p],d[p]);else{f.multiDrawArraysInstancedWEBGL(n,l,0,u,0,d,0,h);let p=0;for(let g=0;g<h;g++)p+=u[g]*d[g];t.update(p,n,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=c}function XC(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const M=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(M.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(M){return!(M!==Tt&&n.convert(M)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(M){const w=M===It&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(M!==Le&&n.convert(M)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&M!==Nt&&!w)}function c(M){if(M==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";M="mediump"}return M==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const u=c(l);u!==l&&(we("WebGLRenderer:",l,"not supported, using",u,"instead."),l=u);const h=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),p=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=r.getParameter(r.MAX_TEXTURE_SIZE),m=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),A=r.getParameter(r.MAX_VERTEX_ATTRIBS),x=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),_=r.getParameter(r.MAX_VARYING_VECTORS),b=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),v=r.getParameter(r.MAX_SAMPLES),C=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:h,reversedDepthBuffer:d,maxTextures:f,maxVertexTextures:p,maxTextureSize:g,maxCubemapSize:m,maxAttributes:A,maxVertexUniforms:x,maxVaryings:_,maxFragmentUniforms:b,maxSamples:v,samples:C}}function $C(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new Ts,o=new Qe,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const f=h.length!==0||d||n!==0||i;return i=d,n=h.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,f){const p=h.clippingPlanes,g=h.clipIntersection,m=h.clipShadows,A=r.get(h);if(!i||p===null||p.length===0||s&&!m)s?u(null):l();else{const x=s?0:n,_=x*4;let b=A.clippingState||null;c.value=b,b=u(p,d,_,f);for(let v=0;v!==_;++v)b[v]=t[v];A.clippingState=b,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=x}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,d,f,p){const g=h!==null?h.length:0;let m=null;if(g!==0){if(m=c.value,p!==!0||m===null){const A=f+g*4,x=d.matrixWorldInverse;o.getNormalMatrix(x),(m===null||m.length<A)&&(m=new Float32Array(A));for(let _=0,b=f;_!==g;++_,b+=4)a.copy(h[_]).applyMatrix4(x,o),a.normal.toArray(m,b),m[b+3]=a.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,m}}function YC(r){let e=new WeakMap;function t(a,o){return o===tl?a.mapping=us:o===dd&&(a.mapping=Yr),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===tl||o===dd)if(e.has(a)){const c=e.get(a).texture;return t(c,a.mapping)}else{const c=a.image;if(c&&c.height>0){const l=new Ol(c.height);return l.fromEquirectangularTexture(r,a),e.set(a,l),a.addEventListener("dispose",i),t(l.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const cs=4,Yp=[.125,.215,.35,.446,.526,.582],Us=20,jC=256,ya=new Js,jp=new Ie;let wh=null,Th=0,Rh=0,Bh=!1;const KC=new B;class Kp{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,s={}){const{size:a=256,position:o=KC}=s;wh=this._renderer.getRenderTarget(),Th=this._renderer.getActiveCubeFace(),Rh=this._renderer.getActiveMipmapLevel(),Bh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,i,c,o),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=eA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Zp(),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;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(wh,Th,Rh),this._renderer.xr.enabled=Bh,e.scissorTest=!1,Ar(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===us||e.mapping===Yr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),wh=this._renderer.getRenderTarget(),Th=this._renderer.getActiveCubeFace(),Rh=this._renderer.getActiveMipmapLevel(),Bh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:We,minFilter:We,generateMipmaps:!1,type:It,format:Tt,colorSpace:St,depthBuffer:!1},i=Jp(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Jp(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=JC(s)),this._blurMaterial=eI(s,e,t),this._ggxMaterial=ZC(s,e,t)}return i}_compileMaterial(e){const t=new ot(new sn,e);this._renderer.compile(t,ya)}_sceneToCubeUV(e,t,n,i,s){const c=new tn(90,1,t,n),l=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,f=h.toneMapping;h.getClearColor(jp),h.toneMapping=Hn,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(i),h.clearDepth(),h.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new ot(new Wi,new ln({name:"PMREM.Backgroun
3606d",side:nn,depthWrite:!1,depthTest:!1})));const g=this._backgroundBox,m=g.material;let A=!1;const x=e.background;x?x.isColor&&(m.color.copy(x),e.background=null,A=!0):(m.color.copy(jp),A=!0);for(let _=0;_<6;_++){const b=_%3;b===0?(c.up.set(0,l[_],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x+u[_],s.y,s.z)):b===1?(c.up.set(0,0,l[_]),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y+u[_],s.z)):(c.up.set(0,l[_],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y,s.z+u[_]));const v=this._cubeSize;Ar(i,b*v,_>2?v:0,v,v),h.setRenderTarget(i),A&&h.render(g,c),h.render(e,c)}h.toneMapping=f,h.autoClear=d,e.background=x}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===us||e.mapping===Yr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=eA()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Zp());const s=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const c=this._cubeSize;Ar(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,ya)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let s=1;s<i;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const c=a.uniforms,l=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),h=Math.sqrt(l*l-u*u),d=0+l*1.25,f=h*d,{_lodMax:p}=this,g=this._sizeLods[n],m=3*g*(n>p-cs?n-p+cs:0),A=4*(this._cubeSize-g);c.envMap.value=e.texture,c.roughness.value=f,c.mipInt.value=p-t,Ar(s,m,A,3*g,2*g),i.setRenderTarget(s),i.render(o,ya),c.envMap.value=s.texture,c.roughness.value=0,c.mipInt.value=p-n,Ar(e,m,A,3*g,2*g),i.setRenderTarget(e),i.render(o,ya)}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,o){const c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Fe("blur direction must be either latitudinal or longitudinal!");const u=3,h=this._lodMeshes[i];h.material=l;const d=l.uniforms,f=this._sizeLods[n]-1,p=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*Us-1),g=s/p,m=isFinite(s)?1+Math.floor(u*g):Us;m>Us&&we(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Us}`);const A=[];let x=0;for(let M=0;M<Us;++M){const w=M/g,E=Math.exp(-w*w/2);A.push(E),M===0?x+=E:M<m&&(x+=2*E)}for(let M=0;M<A.length;M++)A[M]=A[M]/x;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=A,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:_}=this;d.dTheta.value=p,d.mipInt.value=_-n;const b=this._sizeLods[i],v=3*b*(i>_-cs?i-_+cs:0),C=4*(this._cubeSize-b);Ar(t,v,C,3*b,2*b),c.setRenderTarget(t),c.render(h,ya)}}function JC(r){const e=[],t=[],n=[];let i=r;const s=r-cs+1+Yp.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);e.push(o);let c=1/o;a>r-cs?c=Yp[a-r+cs-1]:a===0&&(c=0),t.push(c);const l=1/(o-2),u=-l,h=1+l,d=[u,u,h,u,h,h,u,u,h,h,u,h],f=6,p=6,g=3,m=2,A=1,x=new Float32Array(g*p*f),_=new Float32Array(m*p*f),b=new Float32Array(A*p*f);for(let C=0;C<f;C++){const M=C%3*2/3-1,w=C>2?0:-1,E=[M,w,0,M+2/3,w,0,M+2/3,w+1,0,M,w,0,M+2/3,w+1,0,M,w+1,0];x.set(E,g*p*C),_.set(d,m*p*C);const S=[C,C,C,C,C,C];b.set(S,A*p*C)}const v=new sn;v.setAttribute("position",new Bt(x,g)),v.setAttribute("uv",new Bt(_,m)),v.setAttribute("faceIndex",new Bt(b,A)),n.push(new ot(v,null)),i>cs&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Jp(r,e,t){const n=new bn(r,e,t);return n.texture.mapping=Ll,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ar(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function ZC(r,e,t){return new _n({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:jC,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Gl(),fragmentShader:` 3607 3608 precision highp float; 3609 precision highp int; 3610 3611 varying vec3 vOutputDirection; 3612 3613 uniform sampler2D envMap; 3614 uniform float roughness; 3615 uniform float mipInt; 3616 3617 #define ENVMAP_TYPE_CUBE_UV 3618 #include <cube_uv_reflection_fragment> 3619 3620 #define PI 3.14159265359 3621 3622 // Van der Corput radical inverse 3623 float radicalInverse_VdC(uint bits) { 3624 bits = (bits << 16u) | (bits >> 16u); 3625 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); 3626 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); 3627 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); 3628 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); 3629 return float(bits) * 2.3283064365386963e-10; // / 0x100000000 3630 } 3631 3632 // Hammersley sequence 3633 vec2 hammersley(uint i, uint N) { 3634 return vec2(float(i) / float(N), radicalInverse_VdC(i)); 3635 } 3636 3637 // GGX VNDF importance sampling (Eric Heitz 2018) 3638 // "Sampling the GGX Distribution of Visible Normals" 3639 // https://jcgt.org/published/0007/04/01/ 3640 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { 3641 float alpha = roughness * roughness; 3642 3643 // Section 3.2: Transform view direction to hemisphere configuration 3644 vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z)); 3645 3646 // Section 4.1: Orthonormal basis 3647 float lensq = Vh.x * Vh.x + Vh.y * Vh.y; 3648 vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0); 3649 vec3 T2 = cross(Vh, T1); 3650 3651 // Section 4.2: Parameterization of projected area 3652 float r = sqrt(Xi.x); 3653 float phi = 2.0 * PI * Xi.y; 3654 float t1 = r * cos(phi); 3655 float t2 = r * sin(phi); 3656 float s = 0.5 * (1.0 + Vh.z); 3657 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; 3658 3659 // Section 4.3: Reprojection onto hemisphere 3660 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh; 3661 3662 // Section 3.4: Transform back to ellipsoid configuration 3663 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); 3664 } 3665 3666 void main() { 3667 vec3 N = normalize(vOutputDirection); 3668 vec3 V = N; // Assume view direction equals normal for pre-filtering 3669 3670 vec3 prefilteredColor = vec3(0.0); 3671 float totalWeight = 0.0; 3672 3673 // For very low roughness, just sample the environment directly 3674 if (roughness < 0.001) { 3675 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); 3676 return; 3677 } 3678 3679 // Tangent space basis for VNDF sampling 3680 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); 3681 vec3 tangent = normalize(cross(up, N)); 3682 vec3 bitangent = cross(N, tangent); 3683
3684 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { 3685 vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); 3686 3687 // For PMREM, V = N, so in tangent space V is always (0, 0, 1) 3688 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); 3689 3690 // Transform H back to world space 3691 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); 3692 vec3 L = normalize(2.0 * dot(V, H) * H - V); 3693 3694 float NdotL = max(dot(N, L), 0.0); 3695 3696 if(NdotL > 0.0) { 3697 // Sample environment at fixed mip level 3698 // VNDF importance sampling handles the distribution filtering 3699 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); 3700 3701 // Weight by NdotL for the split-sum approximation 3702 // VNDF PDF naturally accounts for the visible microfacet distribution 3703 prefilteredColor += sampleColor * NdotL; 3704 totalWeight += NdotL; 3705 } 3706 } 3707 3708 if (totalWeight > 0.0) { 3709 prefilteredColor = prefilteredColor / totalWeight; 3710 } 3711 3712 gl_FragColor = vec4(prefilteredColor, 1.0); 3713 } 3714 `,blending:Zn,depthTest:!1,depthWrite:!1})}function eI(r,e,t){const n=new Float32Array(Us),i=new B(0,1,0);return new _n({name:"SphericalGaussianBlur",defines:{n:Us,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Gl(),fragmentShader:` 3715 3716 precision mediump float; 3717 precision mediump int; 3718 3719 varying vec3 vOutputDirection; 3720 3721 uniform sampler2D envMap; 3722 uniform int samples; 3723 uniform float weights[ n ]; 3724 uniform bool latitudinal; 3725 uniform float dTheta; 3726 uniform float mipInt; 3727 uniform vec3 poleAxis; 3728 3729 #define ENVMAP_TYPE_CUBE_UV 3730 #include <cube_uv_reflection_fragment> 3731 3732 vec3 getSample( float theta, vec3 axis ) { 3733 3734 float cosTheta = cos( theta ); 3735 // Rodrigues' axis-angle rotation 3736 vec3 sampleDirection = vOutputDirection * cosTheta 3737 + cross( axis, vOutputDirection ) * sin( theta ) 3738 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3739 3740 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3741 3742 } 3743 3744 void main() { 3745 3746 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3747 3748 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3749 3750 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3751 3752 } 3753 3754 axis = normalize( axis ); 3755 3756 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3757 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3758 3759 for ( int i = 1; i < n; i++ ) { 3760 3761 if ( i >= samples ) { 3762 3763 break; 3764 3765 } 3766 3767 float theta = dTheta * float( i ); 3768 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3769 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3770 3771 } 3772 3773 } 3774 `,blending:Zn,depthTest:!1,depthWrite:!1})}function Zp(){return new _n({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Gl(),fragmentShader:` 3775 3776 precision mediump float; 3777 precision mediump int; 3778 3779 varying vec3 vOutputDirection; 3780 3781 uniform sampler2D envMap; 3782 3783 #include <common> 3784 3785 void main() { 3786 3787 vec3 outputDirection = normalize( vOutputDirection ); 3788 vec2 uv = equirectUv( outputDirection ); 3789 3790 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3791 3792 } 3793 `,blending:Zn,depthTest:!1,depthWrite:!1})}function eA(){return new _n({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Gl(),fragmentShader:` 3794 3795 precision mediump float; 3796 precision mediump int; 3797 3798 uniform float flipEnvMap; 3799 3800 varying vec3 vOutputDirection; 3801 3802 uniform samplerCube envMap; 3803 3804 void main() { 3805 3806 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3807 3808 } 3809 `,blending:Zn,depthTest:!1,depthWrite:!1})}function Gl(){return` 3810 3811 precision mediump float; 3812 precision mediump int; 3813 3814 attribute float faceIndex; 3815 3816 varying vec3 vOutputDirection; 3817 3818 // RH coordinate system; PMREM face-indexing convention 3819 vec3 getDirection( vec2 uv, float face ) { 3820 3821 uv = 2.0 * uv - 1.0; 3822 3823 vec3 direction = vec3( uv, 1.0 ); 3824 3825 if ( face == 0.0 ) { 3826 3827 direction = direction.zyx; // ( 1, v, u ) pos x 3828 3829 } else if ( face == 1.0 ) { 3830 3831 direction = direction.xzy; 3832 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3833 3834 } else if ( face == 2.0 ) { 3835 3836 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3837 3838 } else if ( face == 3.0 ) { 3839 3840 direction = direction.zyx; 3841 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3842 3843 } else if ( face == 4.0 ) { 3844 3845 direction = direction.xzy; 3846 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3847 3848 } else if ( face == 5.0 ) { 3849 3850 direction.z *= -1.0; // ( u, v, -1 ) neg z 3851 3852 } 3853 3854 return direction; 3855 3856 } 3857 3858 void main() { 3859 3860 vOutputDirection = getDirection( uv, faceIndex ); 3861 gl_Position = vec4( position, 1.0 ); 3862 3863 } 3864 `}function tI(r){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const c=o.mapping,l=c===tl||c===dd,u=c===us||c===Yr;if(l||u){let h=e.get(o);const d=h!==void 0?h.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new Kp(r)),h=l?t.fromEquirectangular(o,h):t.fromCubemap(o,h),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),h.texture;if(h!==void 0)return h.texture;{const f=o.image;return l&&f&&f.height>0||u&&f&&i(f)?(t===null&&(t=new Kp(r)),h=l?t.fromEquirectangular(o):t.fromCubemap(o),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),o.addEventListener("dispose",s),h.texture):null}}}return o}function i(o){let c=0;const l=6;for(let u=0;u<l;u++)o[u]!==void 0&&c++;return c===l}function s(o){const c=o.target;c.removeEventListener("dispose",s);const l=e.get(c);l!==void 0&&(e.delete(c),l.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function nI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&vo("WebGLRenderer: "+n+" extension not supported."),i}}}function iI(r,e,t,n){const i={},s=new WeakMap;function a(h){const d=h.target;d.index!==null&&e.remove(d.index);for(const p in d.attributes)e.remove(d.attributes[p]);d.removeEventListener("dispose",a),delete i[d.id];const f=s.get(d);
vendor: 22,129 bytes, lines 3864-3945
3864f&&(e.remove(f),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(h,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,t.memory.geometries++),d}function c(h){const d=h.attributes;for(const f in d)e.update(d[f],r.ARRAY_BUFFER)}function l(h){const d=[],f=h.index,p=h.attributes.position;let g=0;if(f!==null){const x=f.array;g=f.version;for(let _=0,b=x.length;_<b;_+=3){const v=x[_+0],C=x[_+1],M=x[_+2];d.push(v,C,C,M,M,v)}}else if(p!==void 0){const x=p.array;g=p.version;for(let _=0,b=x.length/3-1;_<b;_+=3){const v=_+0,C=_+1,M=_+2;d.push(v,C,C,M,M,v)}}else return;const m=new(b0(d)?C0:S0)(d,1);m.version=g;const A=s.get(h);A&&e.remove(A),s.set(h,m)}function u(h){const d=s.get(h);if(d){const f=h.index;f!==null&&d.version<f.version&&l(h)}else l(h);return s.get(h)}return{get:o,update:c,getWireframeAttribute:u}}function sI(r,e,t){let n;function i(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function c(d,f){r.drawElements(n,f,s,d*a),t.update(f,n,1)}function l(d,f,p){p!==0&&(r.drawElementsInstanced(n,f,s,d*a,p),t.update(f,n,p))}function u(d,f,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,s,d,0,p);let m=0;for(let A=0;A<p;A++)m+=f[A];t.update(m,n,1)}function h(d,f,p,g){if(p===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let A=0;A<d.length;A++)l(d[A]/a,f[A],g[A]);else{m.multiDrawElementsInstancedWEBGL(n,f,0,s,d,0,g,0,p);let A=0;for(let x=0;x<p;x++)A+=f[x]*g[x];t.update(A,n,1)}}this.setMode=i,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=u,this.renderMultiDrawInstances=h}function rI(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=o*(s/3);break;case r.LINES:t.lines+=o*(s/2);break;case r.LINE_STRIP:t.lines+=o*(s-1);break;case r.LINE_LOOP:t.lines+=o*s;break;case r.POINTS:t.points+=o*s;break;default:Fe("WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function aI(r,e,t){const n=new WeakMap,i=new Mt;function s(a,o,c){const l=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=u!==void 0?u.length:0;let d=n.get(o);if(d===void 0||d.count!==h){let E=function(){M.dispose(),n.delete(o),o.removeEventListener("dispose",E)};d!==void 0&&d.texture.dispose();const f=o.morphAttributes.position!==void 0,p=o.morphAttributes.normal!==void 0,g=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],A=o.morphAttributes.normal||[],x=o.morphAttributes.color||[];let _=0;f===!0&&(_=1),p===!0&&(_=2),g===!0&&(_=3);let b=o.attributes.position.count*_,v=1;b>e.maxTextureSize&&(v=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);const C=new Float32Array(b*v*4*h),M=new v0(C,b,v,h);M.type=Nt,M.needsUpdate=!0;const w=_*4;for(let S=0;S<h;S++){const R=m[S],N=A[S],F=x[S],P=b*v*4*S;for(let Q=0;Q<R.count;Q++){const U=Q*w;f===!0&&(i.fromBufferAttribute(R,Q),C[P+U+0]=i.x,C[P+U+1]=i.y,C[P+U+2]=i.z,C[P+U+3]=0),p===!0&&(i.fromBufferAttribute(N,Q),C[P+U+4]=i.x,C[P+U+5]=i.y,C[P+U+6]=i.z,C[P+U+7]=0),g===!0&&(i.fromBufferAttribute(F,Q),C[P+U+8]=i.x,C[P+U+9]=i.y,C[P+U+10]=i.z,C[P+U+11]=F.itemSize===4?i.w:1)}}d={count:h,texture:M,size:new pe(b,v)},n.set(o,d),o.addEventListener("dispose",E)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(r,"morphTexture",a.morphTexture,t);else{let f=0;for(let g=0;g<l.length;g++)f+=l[g];const p=o.morphTargetsRelative?1:1-f;c.getUniforms().setValue(r,"morphTargetBaseInfluence",p),c.getUniforms().setValue(r,"morphTargetInfluences",l)}c.getUniforms().setValue(r,"morphTargetsTexture",d.texture,t),c.getUniforms().setValue(r,"morphTargetsTextureSize",d.size)}return{update:s}}function oI(r,e,t,n){let i=new WeakMap;function s(c){const l=n.render.frame,u=c.geometry,h=e.get(c,u);if(i.get(h)!==l&&(e.update(h),i.set(h,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",o)===!1&&c.addEventListener("dispose",o),i.get(c)!==l&&(t.update(c.instanceMatrix,r.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,r.ARRAY_BUFFER),i.set(c,l))),c.isSkinnedMesh){const d=c.skeleton;i.get(d)!==l&&(d.update(),i.set(d,l))}return h}function a(){i=new WeakMap}function o(c){const l=c.target;l.removeEventListener("dispose",o),t.remove(l.instanceMatrix),l.instanceColor!==null&&t.remove(l.instanceColor)}return{update:s,dispose:a}}const cI={[af]:"LINEAR_TONE_MAPPING",[of]:"REINHARD_TONE_MAPPING",[cf]:"CINEON_TONE_MAPPING",[lf]:"ACES_FILMIC_TONE_MAPPING",[hf]:"AGX_TONE_MAPPING",[Xr]:"NEUTRAL_TONE_MAPPING",[A0]:"CUSTOM_TONE_MAPPING"};function lI(r,e,t,n,i){const s=new bn(e,t,{type:r,depthBuffer:n,stencilBuffer:i}),a=new bn(e,t,{type:It,depthBuffer:!1,stencilBuffer:!1}),o=new sn;o.setAttribute("position",new Jt([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new Jt([0,2,0,0,2,0],2));const c=new wE({uniforms:{tDiffuse:{value:null}},vertexShader:` 3865 precision highp float; 3866 3867 uniform mat4 modelViewMatrix; 3868 uniform mat4 projectionMatrix; 3869 3870 attribute vec3 position; 3871 attribute vec2 uv; 3872 3873 varying vec2 vUv; 3874 3875 void main() { 3876 vUv = uv; 3877 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3878 }`,fragmentShader:` 3879 precision highp float; 3880 3881 uniform sampler2D tDiffuse; 3882 3883 varying vec2 vUv; 3884 3885 #include <tonemapping_pars_fragment> 3886 #include <colorspace_pars_fragment> 3887 3888 void main() { 3889 gl_FragColor = texture2D( tDiffuse, vUv ); 3890 3891 #ifdef LINEAR_TONE_MAPPING 3892 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 3893 #elif defined( REINHARD_TONE_MAPPING ) 3894 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 3895 #elif defined( CINEON_TONE_MAPPING ) 3896 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 3897 #elif defined( ACES_FILMIC_TONE_MAPPING ) 3898 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 3899 #elif defined( AGX_TONE_MAPPING ) 3900 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 3901 #elif defined( NEUTRAL_TONE_MAPPING ) 3902 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 3903 #elif defined( CUSTOM_TONE_MAPPING ) 3904 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); 3905 #endif 3906 3907 #ifdef SRGB_TRANSFER 3908 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 3909 #endif 3910 }`,depthTest:!1,depthWrite:!1}),l=new ot(o,c),u=new Js(-1,1,1,-1,0,1);let h=null,d=null,f=!1,p,g=null,m=[],A=!1;this.setSize=function(x,_){s.setSize(x,_),a.setSize(x,_);for(let b=0;b<m.length;b++){const v=m[b];v.setSize&&v.setSize(x,_)}},this.setEffects=function(x){m=x,A=m.length>0&&m[0].isRenderPass===!0;const _=s.width,b=s.height;for(let v=0;v<m.length;v++){const C=m[v];C.setSize&&C.setSize(_,b)}},this.begin=function(x,_){if(f||x.toneMapping===Hn&&m.length===0)return!1;if(g=_,_!==null){const b=_.width,v=_.height;(s.width!==b||s.height!==v)&&this.setSize(b,v)}return A===!1&&x.setRenderTarget(s),p=x.toneMapping,x.toneMapping=Hn,!0},this.hasRenderPass=function(){return A},this.end=function(x,_){x.toneMapping=p,f=!0;let b=s,v=a;for(let C=0;C<m.length;C++){const M=m[C];if(M.enabled!==!1&&(M.render(x,v,b,_),M.needsSwap!==!1)){const w=b;b=v,v=w}}if(h!==x.outputColorSpace||d!==x.toneMapping){h=x.outputColorSpace,d=x.toneMapping,c.defines={},Ze.getTransfer(h)===ft&&(c.defines.SRGB_TRANSFER="");const C=cI[d];C&&(c.defines[C]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=b.texture,x.setRenderTarget(g),x.render(l,u),g=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){s.dispose(),a.dispose(),o.dispose(),c.dispose()}}const J0=new Rt,Ud=new yo(1,1),Z0=new v0,ex=new E0,tx=new w0,tA=[],nA=[],iA=new Float32Array(16),sA=new Float32Array(9),rA=new Float32Array(4);function fa(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=tA[i];if(s===void 0&&(s=new Float32Array(i),tA[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function Wt(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function qt(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Hl(r,e){let t=nA[e];t===void 0&&(t=new Int32Array(e),nA[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function hI(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function uI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Wt(t,e))return;r.uniform2fv(this.addr,e),qt(t,e)}}function dI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Wt(t,e))return;r.uniform3fv(this.addr,e),qt(t,e)}}function fI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Wt(t,e))return;r.uniform4fv(this.addr,e),qt(t,e)}}function pI(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Wt(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),qt(t,e)}else{if(Wt(t,n))return;rA.set(n),r.uniformMatrix2fv(this.addr,!1,rA),qt(t,n)}}function AI(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Wt(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),qt(t,e)}else{if(Wt(t,n))return;sA.set(n),r.uniformMatrix3fv(this.addr,!1,sA),qt(t,n)}}function mI(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Wt(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),qt(t,e)}else{if(Wt(t,n))return;iA.set(n),r.uniformMatrix4fv(this.addr,!1,iA),qt(t,n)}}function gI(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function xI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Wt(t,e))return;r.uniform2iv(this.addr,e),qt(t,e)}}function bI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Wt(t,e))return;r.uniform3iv(this.addr,e),qt(t,e)}}function _I(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Wt(t,e))return;r.uniform4iv(this.addr,e),qt(t,e)}}function vI(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function EI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Wt(t,e))return;r.uniform2uiv(this.addr,e),qt(t,e)}}function yI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Wt(t,e))return;r.uniform3uiv(this.addr,e),qt(t,e)}}function SI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Wt(t,e))return;r.uniform4uiv(this.addr,e),qt(t,e)}}function CI(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(Ud.compareFunction=t.isReversedDepthBuffer()?_f:bf,s=Ud):s=J0,t.setTexture2D(e||s,i)}function II(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||ex,i)}function MI(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||tx,i)}function wI(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Z0,i)}function TI(r){switch(r){case 5126:return hI;case 35664:return uI;case 35665:return dI;case 35666:return fI;case 35674:return pI;case 35675:return AI;case 35676:return mI;case 5124:case 35670:return gI;case 35667:case 35671:return xI;case 35668:case 35672:return bI;case 35669:case 35673:return _I;case 5125:return vI;case 36294:return EI;case 36295:return yI;case 36296:return SI;case 35678:case 36198:case 36298:case 36306:case 35682:return CI;case 35679:case 36299:case 36307:return II;case 35680:case 36300:case 36308:case 36293:return MI;case 36289:case 36303:case 36311:case 36292:return wI}}function RI(r,e){r.uniform1fv(this.addr,e)}function BI(r,e){const t=fa(e,this.size,2);r.uniform2fv(this.addr,t)}function DI(r,e){const t=fa(e,this.size,3);r.uniform3fv(this.addr,t)}function LI(r,e){const t=fa(e,this.size,4);r.uniform4fv(this.addr,t)}function FI(r,e){const t=fa(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function PI(r,e){const t=fa(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function NI(r,e){const t=fa(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function UI(r,e){r.uniform1iv(this.addr,e)}function OI(r,e){r.uniform2iv(this.addr,e)}function kI(r,e){r.uniform3iv(this.addr,e)}function QI(r,e){r.uniform4iv(this.addr,e)}function GI(r,e){r.uniform1uiv(this.addr,e)}function HI(r,e){r.uniform2uiv(this.addr,e)}function zI(r,e){r.uniform3uiv(this.addr,e)}function VI(r,e){r.uniform4uiv(this.addr,e)}function WI(r,e,t){const n=this.cache,i=e.length,s=Hl(t,i);Wt(n,s)||(r.uniform1iv(this.addr,s),qt(n,s));let a;this.type===r.SAMPLER_2D_SHADOW?a=Ud:a=J0;for(let o=0;o!==i;++o)t.setTexture2D(e[o]||a,s[o])}function qI(r,e,t){const n=this.cache,i=e.length,s=Hl(t,i);Wt(n,s)||(r.uniform1iv(this.addr,s),qt(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||ex,s[a])}function XI(r,e,t){const n=this.cache,i=e.length,s=Hl(t,i);Wt(n,s)||(r.uniform1iv(this.addr,s),qt(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||tx,s[a])}function $I(r,e,t){const n=this.cache,i=e.length,s=Hl(t,i);Wt(n,s)||(r.uniform1iv(this.addr,s),qt(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Z0,s[a])}function YI(r){switch(r){case 5126:return RI;case 35664:return BI;case 35665:return DI;case 35666:return LI;case 35674:return FI;case 35675:return PI;case 35676:return NI;case 5124:case 35670:return UI;case 35667:case 35671:return OI;case 35668:case 35672:return kI;case 35669:case 35673:return QI;case 5125:return GI;case 36294:return HI;case 36295:return zI;case 36296:return VI;case 35678:case 36198:case 36298:case 36306:case 35682:return WI;case 35679:case 36299:case 36307:return qI;case 35680:case 36300:case 36308:case 36293:return XI;case 36289:case 36303:case 36311:case 36292:return $I}}class jI{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=TI(t.type)}}class KI{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=YI(t.type)}}class JI{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,t[o.id],n)}}}const Dh=/(\w+)(\])?(\[|\.)?/g;function aA(r,e){r.seq.push(e),r.map[e.id]=e}function ZI(r,e,t){const n=r.name,i=n.length;for(Dh.lastIndex=0;;){const s=Dh.exec(n),a=Dh.lastIndex;let o=s[1];const c=s[2]==="]",l=s[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===i){aA(t,l===void 0?new jI(o,r,e):new KI(o,r,e));break}else{let h=t.map[o];h===void 0&&(h=new JI(o),aA(t,h)),t=h}}}class qc{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),c=e.getUniformLocation(t,o.name);ZI(o,c,this)}const i=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(a):s.push(a);i.length>0&&(this.seq=i.concat(s))}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const o=t[s],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function oA(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const eM=37297;let tM=0;function nM(r,e){const t=r.split(` 3911`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=i;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(` 3912`)}const cA=new Qe;function iM(r){Ze._getMatrix(cA,Ze.workingColorSpace,r);const e=`mat3( ${cA.elements.map(t=>t.toFixed(4))} )`;switch(Ze.getTransfer(r)){case Al:return[e,"LinearTransferOETF"];case ft:return[e,"sRGBTransferOETF"];default:return we("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function lA(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),s=(r.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+` 3913 3914`+s+` 3915 3916`+nM(r.getShaderSource(e),o)}else return s}function sM(r,e){const t=iM(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 3917`)}const rM={[af]:"Linear",[of]:"Reinhard",[cf]:"Cineon",[lf]:"ACESFilmic",[hf]:"AgX",[Xr]:"Neutral",[A0]:"Custom"};function aM(r,e){const t=rM[e];return t===void 0?(we("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const fc=new B;function oM(){Ze.getLuminanceCoefficients(fc);const r=fc.x.toFixed(4),e=fc.y.toFixed(4),t=fc.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 3918`)}function cM(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ya).join(` 3919`)}function lM(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3920`)}function hM(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),a=s.name;let o=1;s.type===r.FLOAT_MAT2&&(o=2),s.type===r.FLOAT_MAT3&&(o=3),s.type===r.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:o}}return t}function Ya(r){return r!==""}function hA(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function uA(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const uM=/^[ \t]*#include +<([\w\d./]+)>/gm;function Od(r){return r.replace(uM,fM)}const dM=new Map;function fM(r,e){let t=qe[e];if(t===void 0){const n=dM.get(e);if(n!==void 0)t=qe[n],we('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Od(t)}const pM=/#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 dA(r){return r.replace(pM,AM)}function AM(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function fA(r){let e=`precision ${r.precision} float; 3921 precision ${r.precision} int; 3922 precision ${r.precision} sampler2D; 3923 precision ${r.precision} samplerCube; 3924 precision ${r.precision} sampler3D; 3925 precision ${r.precision} sampler2DArray; 3926 precision ${r.precision} sampler2DShadow; 3927 precision ${r.precision} samplerCubeShadow; 3928 precision ${r.precision} sampler2DArrayShadow; 3929 precision ${r.precision} isampler2D; 3930 precision ${r.precision} isampler3D; 3931 precision ${r.precision} isamplerCube; 3932 precision ${r.precision} isampler2DArray; 3933 precision ${r.precision} usampler2D; 3934 precision ${r.precision} usampler3D; 3935 precision ${r.precision} usamplerCube; 3936 precision ${r.precision} usampler2DArray; 3937 `;return r.precision==="highp"?e+=` 3938#define HIGH_PRECISION`:r.precision==="mediump"?e+=` 3939#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=` 3940#define LOW_PRECISION`),e}const mM={[zc]:"SHADOWMAP_TYPE_PCF",[Xa]:"SHADOWMAP_TYPE_VSM"};function gM(r){return mM[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const xM={[us]:"ENVMAP_TYPE_CUBE",[Yr]:"ENVMAP_TYPE_CUBE",[Ll]:"ENVMAP_TYPE_CUBE_UV"};function bM(r){return r.envMap===!1?"ENVMAP_TYPE_CUBE":xM[r.envMapMode]||"ENVMAP_TYPE_CUBE"}const _M={[Yr]:"ENVMAP_MODE_REFRACTION"};function vM(r){return r.envMap===!1?"ENVMAP_MODE_REFLECTION":_M[r.envMapMode]||"ENVMAP_MODE_REFLECTION"}const EM={[p0]:"ENVMAP_BLENDING_MULTIPLY",[F_]:"ENVMAP_BLENDING_MIX",[P_]:"ENVMAP_BLENDING_ADD"};function yM(r){return r.envMap===!1?"ENVMAP_BLENDING_NONE":EM[r.combine]||"ENVMAP_BLENDING_NONE"}function SM(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function CM(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=gM(t),l=bM(t),u=vM(t),h=yM(t),d=SM(t),f=cM(t),p=lM(s),g=i.createProgram();let m,A,x=t.glslVersion?"#version "+t.glslVersion+` 3941`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(Ya).join(` 3942`),m.length>0&&(m+=` 3943`),A=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(Ya).join(` 3944`),A.length>0&&(A+=` 3945`)):(m=[fA(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.extensionCl
vendor: 6,474 bytes, lines 3945-3947
3945ipCullDistance?"#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 "+u:"",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.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 "+c:"",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",` 3946`].filter(Ya).join(` 3947`),A=[fA(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,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 "+l:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.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.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.iridescence?"#define USE_IR
3947IDESCENCE":"",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||t.batchingColor?"#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.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 "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",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!==Hn?"#define TONE_MAPPING":"",t.toneMapping!==Hn?qe.tonemapping_pars_fragment:"",t.toneMapping!==Hn?aM("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",qe.colorspace_pars_fragment,sM("linearToOutputTexel",t.outputColorSpace),oM(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3948`].filter(Ya).join(` 3949`)),a=Od(a),a=hA(a,t),a=uA(a,t),o=Od(o),o=hA(o,t),o=uA(o,t),a=dA(a),o=dA(o),t.isRawShaderMaterial!==!0&&(x=`#version 300 es 3950`,m=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3951`)+` 3952`+m,A=["#define varying in",t.glslVersion===sp?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===sp?"":"#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(` 3953`)+` 3954`+A);const _=x+m+a,b=x+A+o,v=oA(i,i.VERTEX_SHADER,_),C=oA(i,i.FRAGMENT_SHADER,b);i.attachShader(g,v),i.attachShader(g,C),t.index0AttributeName!==void 0?i.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(g,0,"position"),i.linkProgram(g);function M(R){if(r.debug.checkShaderErrors){const N=i.getProgramInfoLog(g)||"",F=i.getShaderInfoLog(v)||"",P=i.getShaderInfoLog(C)||"",Q=N.trim(),U=F.trim(),G=P.trim();let q=!0,J=!0;if(i.getProgramParameter(g,i.LINK_STATUS)===!1)if(q=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,g,v,C);else{const Z=lA(i,v,"vertex"),Y=lA(i,C,"fragment");Fe("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(g,i.VALIDATE_STATUS)+` 3955 3956Material Name: `+R.name+` 3957Material Type: `+R.type+` 3958 3959Program Info Log: `+Q+` 3960`+Z+` 3961`+Y)}else Q!==""?we("WebGLProgram: Program Info Log:",Q):(U===""||G==="")&&(J=!1);J&&(R.diagnostics={runnable:q,programLog:Q,vertexShader:{log:U,prefix:m},fragmentShader:{log:G,prefix:A}})}i.deleteShader(v),i.deleteShader(C),w=new qc(i,g),E=hM(i,g)}let w;this.getUniforms=function(){return w===void 0&&M(this),w};let E;this.getAttributes=function(){return E===void 0&&M(this),E};let S=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=i.getProgramParameter(g,eM)),S},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(g),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=tM++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=v,this.fragmentShader=C,this}let IM=0;class MM{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new wM(e),t.set(e,n)),n}}class wM{constructor(e){this.id=IM++,this.code=e,this.usedTimes=0}}function TM(r,e,t,n,i,s,a){const o=new Ef,c=new MM,l=new Set,u=[],h=new Map,d=i.logarithmicDepthBuffer;let f=i.precision;const 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(E){return l.add(E),E===0?"uv":`uv${E}`}function m(E,S,R,N,F){const P=N.fog,Q=F.geometry,U=E.isMeshStandardMaterial?N.environment:null,G=(E.isMeshStandardMaterial?t:e).get(E.envMap||U),q=G&&G.mapping===Ll?G.image.height:null,J=p[E.type];E.precision!==null&&(f=i.getMaxPrecision(E.precision),f!==E.precision&&we("WebGLProgram.getParameters:",E.precision,"not supported, using",f,"instead."));const Z=Q.morphAttributes.position||Q.morphAttributes.normal||Q.morphAttributes.color,Y=Z!==void 0?Z.length:0;let re=0;Q.morphAttributes.position!==void 0&&(re=1),Q.morphAttributes.normal!==void 0&&(re=2),Q.morphAttributes.color!==void 0&&(re=3);let Ae,He,ze,X;if(J){const ht=fi[J];Ae=ht.vertexShader,He=ht.fragmentShader}else Ae=E.vertexShader,He=E.fragmentShader,c.update(E),ze=c.getVertexShaderID(E),X=c.getFragmentShaderID(E);const ee=r.getRenderTarget(),ge=r.state.buffers.depth.getReversed(),Ge=F.isInstancedMesh===!0,_e=F.isBatchedMesh===!0,tt=!!E.map,kt=!!E.matcap,Ke=!!G,it=!!E.aoMap,gt=!!E.lightMap,$e=!!E.bumpMap,Qt=!!E.normalMap,D=!!E.displacementMap,Gt=!!E.emissiveMap,ct=!!E.metalnessMap,_t=!!E.roughnessMap,Se=E.anisotropy>0,T=E.clearcoat>0,y=E.dispersion>0,O=E.iridescence>0,$=E.sheen>0,K=E.transmission>0,W=Se&&!!E.anisotropyMap,Me=T&&!!E.clearcoatMap,oe=T&&!!E.clearcoatNormalMap,ye=T&&!!E.clearcoatRoughnessMap,Oe=O&&!!E.iridescenceMap,ie=O&&!!E.iridescenceThicknessMap,le=$&&!!E.sheenColorMap,Ee=$&&!!E.sheenRoughnessMap,Ce=!!E.specularMap,ce=!!E.specularColorMap,Ye=!!E.specularIntensityMap,L=K&&!!E.transmissionMap,fe=K&&!!E.thicknessMap,se=!!E.gradientMap,me=!!E.alphaMap,ne=E.alphaTest>0,j=!!E.alphaHash,ae=!!E.extensions;let ke=Hn;E.toneMapped&&(ee===null||ee.isXRRenderTarget===!0)&&(ke=r.toneMapping);const vt={shaderID:J,shaderType:E.type,shaderName:E.name,vertexShader:Ae,fragmentShader:He,defines:E.defines,customVertexShaderID:ze,customFragmentShaderID:X,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:f,batching:_e,batchingColor:_e&&F._colorsTexture!==null,instancing:Ge,instancingColor:Ge&&F.instanceColor!==null,instancingMorph:Ge&&F.morphTexture!==null,outputColorSpace:ee===null?r.outputColorSpace:ee.isXRRenderTarget===!0?ee.texture.colorSpace:St,alphaToCoverage:!!E.alphaToCoverage,map:tt,matcap:kt,envMap:Ke,envMapMode:Ke&&G.mapping,envMapCubeUVHeight:q,aoMap:it,lightMap:gt,bumpMap:$e,normalMap:Qt,displacementMap:D,emissiveMap:Gt,n
vendor: 76,288 bytes, lines 3961-4012
3961ormalMapObjectSpace:Qt&&E.normalMapType===Q_,normalMapTangentSpace:Qt&&E.normalMapType===x0,metalnessMap:ct,roughnessMap:_t,anisotropy:Se,anisotropyMap:W,clearcoat:T,clearcoatMap:Me,clearcoatNormalMap:oe,clearcoatRoughnessMap:ye,dispersion:y,iridescence:O,iridescenceMap:Oe,iridescenceThicknessMap:ie,sheen:$,sheenColorMap:le,sheenRoughnessMap:Ee,specularMap:Ce,specularColorMap:ce,specularIntensityMap:Ye,transmission:K,transmissionMap:L,thicknessMap:fe,gradientMap:se,opaque:E.transparent===!1&&E.blending===Qs&&E.alphaToCoverage===!1,alphaMap:me,alphaTest:ne,alphaHash:j,combine:E.combine,mapUv:tt&&g(E.map.channel),aoMapUv:it&&g(E.aoMap.channel),lightMapUv:gt&&g(E.lightMap.channel),bumpMapUv:$e&&g(E.bumpMap.channel),normalMapUv:Qt&&g(E.normalMap.channel),displacementMapUv:D&&g(E.displacementMap.channel),emissiveMapUv:Gt&&g(E.emissiveMap.channel),metalnessMapUv:ct&&g(E.metalnessMap.channel),roughnessMapUv:_t&&g(E.roughnessMap.channel),anisotropyMapUv:W&&g(E.anisotropyMap.channel),clearcoatMapUv:Me&&g(E.clearcoatMap.channel),clearcoatNormalMapUv:oe&&g(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ye&&g(E.clearcoatRoughnessMap.channel),iridescenceMapUv:Oe&&g(E.iridescenceMap.channel),iridescenceThicknessMapUv:ie&&g(E.iridescenceThicknessMap.channel),sheenColorMapUv:le&&g(E.sheenColorMap.channel),sheenRoughnessMapUv:Ee&&g(E.sheenRoughnessMap.channel),specularMapUv:Ce&&g(E.specularMap.channel),specularColorMapUv:ce&&g(E.specularColorMap.channel),specularIntensityMapUv:Ye&&g(E.specularIntensityMap.channel),transmissionMapUv:L&&g(E.transmissionMap.channel),thicknessMapUv:fe&&g(E.thicknessMap.channel),alphaMapUv:me&&g(E.alphaMap.channel),vertexTangents:!!Q.attributes.tangent&&(Qt||Se),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!Q.attributes.color&&Q.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!Q.attributes.uv&&(tt||me),fog:!!P,useFog:E.fog===!0,fogExp2:!!P&&P.isFogExp2,flatShading:E.flatShading===!0&&E.wireframe===!1,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:ge,skinning:F.isSkinnedMesh===!0,morphTargets:Q.morphAttributes.position!==void 0,morphNormals:Q.morphAttributes.normal!==void 0,morphColors:Q.morphAttributes.color!==void 0,morphTargetsCount:Y,morphTextureStride:re,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:E.dithering,shadowMapEnabled:r.shadowMap.enabled&&R.length>0,shadowMapType:r.shadowMap.type,toneMapping:ke,decodeVideoTexture:tt&&E.map.isVideoTexture===!0&&Ze.getTransfer(E.map.colorSpace)===ft,decodeVideoTextureEmissive:Gt&&E.emissiveMap.isVideoTexture===!0&&Ze.getTransfer(E.emissiveMap.colorSpace)===ft,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Vt,flipSided:E.side===nn,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:ae&&E.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ae&&E.extensions.multiDraw===!0||_e)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return vt.vertexUv1s=l.has(1),vt.vertexUv2s=l.has(2),vt.vertexUv3s=l.has(3),l.clear(),vt}function A(E){const S=[];if(E.shaderID?S.push(E.shaderID):(S.push(E.customVertexShaderID),S.push(E.customFragmentShaderID)),E.defines!==void 0)for(const R in E.defines)S.push(R),S.push(E.defines[R]);return E.isRawShaderMaterial===!1&&(x(S,E),_(S,E),S.push(r.outputColorSpace)),S.push(E.customProgramCacheKey),S.join()}function x(E,S){E.push(S.precision),E.push(S.outputColorSpace),E.push(S.envMapMode),E.push(S.envMapCubeUVHeight),E.push(S.mapUv),E.push(S.alphaMapUv),E.push(S.lightMapUv),E.push(S.aoMapUv),E.push(S.bumpMapUv),E.push(S.normalMapUv),E.push(S.displacementMapUv),E.push(S.emissiveMapUv),E.push(S.metalnessMapUv),E.push(S.roughnessMapUv),E.push(S.anisotropyMapUv),E.push(S.clearcoatMapUv),E.push(S.clearcoatNormalMapUv),E.push(S.clearcoatRoughnessMapUv),E.push(S.iridescenceMapUv),E.push(S.iridescenceThicknessMapUv),E.push(S.sheenColorMapUv),E.push(S.sheenRoughnessMapUv),E.push(S.specularMapUv),E.push(S.specularColorMapUv),E.push(S.specularIntensityMapUv),E.push(S.transmissionMapUv),E.push(S.thicknessMapUv),E.push(S.combine),E.push(S.fogExp2),E.push(S.sizeAttenuation),E.push(S.morphTargetsCount),E.push(S.morphAttributeCount),E.push(S.numDirLights),E.push(S.numPointLights),E.push(S.numSpotLights),E.push(S.numSpotLightMaps),E.push(S.numHemiLights),E.push(S.numRectAreaLights),E.push(S.numDirLightShadows),E.push(S.numPointLightShadows),E.push(S.numSpotLightShadows),E.push(S.numSpotLightShadowsWithMaps),E.push(S.numLightProbes),E.push(S.shadowMapType),E.push(S.toneMapping),E.push(S.numClippingPlanes),E.push(S.numClipIntersection),E.push(S.depthPacking)}function _(E,S){o.disableAll(),S.instancing&&o.enable(0),S.instancingColor&&o.enable(1),S.instancingMorph&&o.enable(2),S.matcap&&o.enable(3),S.envMap&&o.enable(4),S.normalMapObjectSpace&&o.enable(5),S.normalMapTangentSpace&&o.enable(6),S.clearcoat&&o.enable(7),S.iridescence&&o.enable(8),S.alphaTest&&o.enable(9),S.vertexColors&&o.enable(10),S.vertexAlphas&&o.enable(11),S.vertexUv1s&&o.enable(12),S.vertexUv2s&&o.enable(13),S.vertexUv3s&&o.enable(14),S.vertexTangents&&o.enable(15),S.anisotropy&&o.enable(16),S.alphaHash&&o.enable(17),S.batching&&o.enable(18),S.dispersion&&o.enable(19),S.batchingColor&&o.enable(20),S.gradientMap&&o.enable(21),E.push(o.mask),o.disableAll(),S.fog&&o.enable(0),S.useFog&&o.enable(1),S.flatShading&&o.enable(2),S.logarithmicDepthBuffer&&o.enable(3),S.reversedDepthBuffer&&o.enable(4),S.skinning&&o.enable(5),S.morphTargets&&o.enable(6),S.morphNormals&&o.enable(7),S.morphColors&&o.enable(8),S.premultipliedAlpha&&o.enable(9),S.shadowMapEnabled&&o.enable(10),S.doubleSided&&o.enable(11),S.flipSided&&o.enable(12),S.useDepthPacking&&o.enable(13),S.dithering&&o.enable(14),S.transmission&&o.enable(15),S.sheen&&o.enable(16),S.opaque&&o.enable(17),S.pointsUvs&&o.enable(18),S.decodeVideoTexture&&o.enable(19),S.decodeVideoTextureEmissive&&o.enable(20),S.alphaToCoverage&&o.enable(21),E.push(o.mask)}function b(E){const S=p[E.type];let R;if(S){const N=fi[S];R=Bv.clone(N.uniforms)}else R=E.uniforms;return R}function v(E,S){let R=h.get(S);return R!==void 0?++R.usedTimes:(R=new CM(r,S,E,s),u.push(R),h.set(S,R)),R}function C(E){if(--E.usedTimes===0){const S=u.indexOf(E);u[S]=u[u.length-1],u.pop(),h.delete(E.cacheKey),E.destroy()}}function M(E){c.remove(E)}function w(){c.dispose()}return{getParameters:m,getProgramCacheKey:A,getUniforms:b,acquireProgram:v,releaseProgram:C,releaseShaderCache:M,programs:u,dispose:w}}function RM(){let r=new WeakMap;function e(a){return r.has(a)}function t(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function n(a){r.delete(a)}function i(a,o,c){r.get(a)[o]=c}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function BM(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function pA(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function AA(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(h,d,f,p,g,m){let A=r[e];return A===void 0?(A={id:h.id,object:h,geometry:d,material:f,groupOrder:p,renderOrder:h.renderOrder,z:g,group:m},r[e]=A):(A.id=h.id,A.object=h,A.geometry=d,A.material=f,A.groupOrder=p,A.renderOrder=h.renderOrder,A.z=g,A.group=m),e++,A}function o(h,d,f,p,g,m){const A=a(h,d,f,p,g,m);f.transmission>0?n.push(A):f.transparent===!0?i.push(A):t.push(A)}function c(h,d,f,p,g,m){const A=a(h,d,f,p,g,m);f.transmission>0?n.unshift(A):f.transparent===!0?i.unshift(A):t.unshift(A)}function l(h,d){t.length>1&&t.sort(h||BM),n.length>1&&n.sort(d||pA),i.length>1&&i.sort(d||pA)}function u(){for(let h=e,d=r.length;h<d;h++){const f=r[h];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:o,unshift:c,finish:u,sort:l}}function DM(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new AA,r.set(n,[a])):i>=s.length?(a=new AA,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function LM(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new B,color:new Ie};break;case"SpotLight":t={position:new B,direction:new B,color:new Ie,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new B,color:new Ie,distance:0,decay:0};break;case"HemisphereLight":t={direction:new B,skyColor:new Ie,groundColor:new Ie};break;case"RectAreaLight":t={color:new Ie,position:new B,halfWidth:new B,halfHeight:new B};break}return r[e.id]=t,t}}}function FM(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pe,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let PM=0;function NM(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function UM(r){const e=new LM,t=FM(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],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 l=0;l<9;l++)n.probe.push(new B);const i=new B,s=new Ue,a=new Ue;function o(l){let u=0,h=0,d=0;for(let E=0;E<9;E++)n.probe[E].set(0,0,0);let f=0,p=0,g=0,m=0,A=0,x=0,_=0,b=0,v=0,C=0,M=0;l.sort(NM);for(let E=0,S=l.length;E<S;E++){const R=l[E],N=R.color,F=R.intensity,P=R.distance;let Q=null;if(R.shadow&&R.shadow.map&&(R.shadow.map.texture.format===Jn?Q=R.shadow.map.texture:Q=R.shadow.map.depthTexture||R.shadow.map.texture),R.isAmbientLight)u+=N.r*F,h+=N.g*F,d+=N.b*F;else if(R.isLightProbe){for(let U=0;U<9;U++)n.probe[U].addScaledVector(R.sh.coefficients[U],F);M++}else if(R.isDirectionalLight){const U=e.get(R);if(U.color.copy(R.color).multiplyScalar(R.intensity),R.castShadow){const G=R.shadow,q=t.get(R);q.shadowIntensity=G.intensity,q.shadowBias=G.bias,q.shadowNormalBias=G.normalBias,q.shadowRadius=G.radius,q.shadowMapSize=G.mapSize,n.directionalShadow[f]=q,n.directionalShadowMap[f]=Q,n.directionalShadowMatrix[f]=R.shadow.matrix,x++}n.directional[f]=U,f++}else if(R.isSpotLight){const U=e.get(R);U.position.setFromMatrixPosition(R.matrixWorld),U.color.copy(N).multiplyScalar(F),U.distance=P,U.coneCos=Math.cos(R.angle),U.penumbraCos=Math.cos(R.angle*(1-R.penumbra)),U.decay=R.decay,n.spot[g]=U;const G=R.shadow;if(R.map&&(n.spotLightMap[v]=R.map,v++,G.updateMatrices(R),R.castShadow&&C++),n.spotLightMatrix[g]=G.matrix,R.castShadow){const q=t.get(R);q.shadowIntensity=G.intensity,q.shadowBias=G.bias,q.shadowNormalBias=G.normalBias,q.shadowRadius=G.radius,q.shadowMapSize=G.mapSize,n.spotShadow[g]=q,n.spotShadowMap[g]=Q,b++}g++}else if(R.isRectAreaLight){const U=e.get(R);U.color.copy(N).multiplyScalar(F),U.halfWidth.set(R.width*.5,0,0),U.halfHeight.set(0,R.height*.5,0),n.rectArea[m]=U,m++}else if(R.isPointLight){const U=e.get(R);if(U.color.copy(R.color).multiplyScalar(R.intensity),U.distance=R.distance,U.decay=R.decay,R.castShadow){const G=R.shadow,q=t.get(R);q.shadowIntensity=G.intensity,q.shadowBias=G.bias,q.shadowNormalBias=G.normalBias,q.shadowRadius=G.radius,q.shadowMapSize=G.mapSize,q.shadowCameraNear=G.camera.near,q.shadowCameraFar=G.camera.far,n.pointShadow[p]=q,n.pointShadowMap[p]=Q,n.pointShadowMatrix[p]=R.shadow.matrix,_++}n.point[p]=U,p++}else if(R.isHemisphereLight){const U=e.get(R);U.skyColor.copy(R.color).multiplyScalar(F),U.groundColor.copy(R.groundColor).multiplyScalar(F),n.hemi[A]=U,A++}}m>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ue.LTC_FLOAT_1,n.rectAreaLTC2=ue.LTC_FLOAT_2):(n.rectAreaLTC1=ue.LTC_HALF_1,n.rectAreaLTC2=ue.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=d;const w=n.hash;(w.directionalLength!==f||w.pointLength!==p||w.spotLength!==g||w.rectAreaLength!==m||w.hemiLength!==A||w.numDirectionalShadows!==x||w.numPointShadows!==_||w.numSpotShadows!==b||w.numSpotMaps!==v||w.numLightProbes!==M)&&(n.directional.length=f,n.spot.length=g,n.rectArea.length=m,n.point.length=p,n.hemi.length=A,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=_,n.pointShadowMap.length=_,n.spotShadow.length=b,n.spotShadowMap.length=b,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=_,n.spotLightMatrix.length=b+v-C,n.spotLightMap.length=v,n.numSpotLightShadowsWithMaps=C,n.numLightProbes=M,w.directionalLength=f,w.pointLength=p,w.spotLength=g,w.rectAreaLength=m,w.hemiLength=A,w.numDirectionalShadows=x,w.numPointShadows=_,w.numSpotShadows=b,w.numSpotMaps=v,w.numLightProbes=M,n.version=PM++)}function c(l,u){let h=0,d=0,f=0,p=0,g=0;const m=u.matrixWorldInverse;for(let A=0,x=l.length;A<x;A++){const _=l[A];if(_.isDirectionalLight){const b=n.directional[h];b.direction.setFromMatrixPosition(_.matrixWorld),i.setFromMatrixPosition(_.target.matrixWorld),b.direction.sub(i),b.direction.transformDirection(m),h++}else if(_.isSpotLight){const b=n.spot[f];b.position.setFromMatrixPosition(_.matrixWorld),b.position.applyMatrix4(m),b.direction.setFromMatrixPosition(_.matrixWorld),i.setFromMatrixPosition(_.target.matrixWorld),b.direction.sub(i),b.direction.transformDirection(m),f++}else if(_.isRectAreaLight){const b=n.rectArea[p];b.position.setFromMatrixPosition(_.matrixWorld),b.position.applyMatrix4(m),a.identity(),s.copy(_.matrixWorld),s.premultiply(m),a.extractRotation(s),b.halfWidth.set(_.width*.5,0,0),b.halfHeight.set(0,_.height*.5,0),b.halfWidth.applyMatrix4(a),b.halfHeight.applyMatrix4(a),p++}else if(_.isPointLight){const b=n.point[d];b.position.setFromMatrixPosition(_.matrixWorld),b.position.applyMatrix4(m),d++}else if(_.isHemisphereLight){const b=n.hemi[g];b.direction.setFromMatrixPosition(_.matrixWorld),b.direction.transformDirection(m),g++}}}return{setup:o,setupView:c,state:n}}function mA(r){const e=new UM(r),t=[],n=[];function i(u){l.camera=u,t.length=0,n.length=0}function s(u){t.push(u)}function a(u){n.push(u)}function o(){e.setup(t)}function c(u){e.setupView(t,u)}const l={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:l,setupLights:o,setupLightsView:c,pushLight:s,pushShadow:a}}function OM(r){let e=new WeakMap;function t(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new mA(r),e.set(i,[o])):s>=a.length?(o=new mA(r),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const kM=`void main() { 3962 gl_Position = vec4( position, 1.0 ); 3963}`,QM=`uniform sampler2D shadow_pass; 3964uniform vec2 resolution; 3965uniform float radius; 3966void main() { 3967 const float samples = float( VSM_SAMPLES ); 3968 float mean = 0.0; 3969 float squared_mean = 0.0; 3970 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3971 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3972 for ( float i = 0.0; i < samples; i ++ ) { 3973 float uvOffset = uvStart + i * uvStride; 3974 #ifdef HORIZONTAL_PASS 3975 vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; 3976 mean += distribution.x; 3977 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3978 #else 3979 float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; 3980 mean += depth; 3981 squared_mean += depth * depth; 3982 #endif 3983 } 3984 mean = mean / samples; 3985 squared_mean = squared_mean / samples; 3986 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); 3987 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); 3988}`,GM=[new B(1,0,0),new B(-1,0,0),new B(0,1,0),new B(0,-1,0),new B(0,0,1),new B(0,0,-1)],HM=[new B(0,-1,0),new B(0,-1,0),new B(0,0,1),new B(0,0,-1),new B(0,-1,0),new B(0,-1,0)],gA=new Ue,Sa=new B,Lh=new B;function zM(r,e,t){let n=new Sf;const i=new pe,s=new pe,a=new Mt,o=new z0,c=new TE,l={},u=t.maxTextureSize,h={[ti]:nn,[nn]:ti,[Vt]:Vt},d=new _n({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new pe},radius:{value:4}},vertexShader:kM,fragmentShader:QM}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const p=new sn;p.setAttribute("position",new Bt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new ot(p,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zc;let A=this.type;this.render=function(C,M,w){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||C.length===0)return;C.type===A_&&(we("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),C.type=zc);const E=r.getRenderTarget(),S=r.getActiveCubeFace(),R=r.getActiveMipmapLevel(),N=r.state;N.setBlending(Zn),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);const F=A!==this.type;F&&M.traverse(function(P){P.material&&(Array.isArray(P.material)?P.material.forEach(Q=>Q.needsUpdate=!0):P.material.needsUpdate=!0)});for(let P=0,Q=C.length;P<Q;P++){const U=C[P],G=U.shadow;if(G===void 0){we("WebGLShadowMap:",U,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;i.copy(G.mapSize);const q=G.getFrameExtents();if(i.multiply(q),s.copy(G.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/q.x),i.x=s.x*q.x,G.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/q.y),i.y=s.y*q.y,G.mapSize.y=s.y)),G.map===null||F===!0){if(G.map!==null&&(G.map.depthTexture!==null&&(G.map.depthTexture.dispose(),G.map.depthTexture=null),G.map.dispose()),this.type===Xa){if(U.isPointLight){we("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}G.map=new bn(i.x,i.y,{format:Jn,type:It,minFilter:We,magFilter:We,generateMipmaps:!1}),G.map.texture.name=U.name+".shadowMap",G.map.depthTexture=new yo(i.x,i.y,Nt),G.map.depthTexture.name=U.name+".shadowMapDepth",G.map.depthTexture.format=Vi,G.map.depthTexture.compareFunction=null,G.map.depthTexture.minFilter=yt,G.map.depthTexture.magFilter=yt}else{U.isPointLight?(G.map=new Ol(i.x),G.map.depthTexture=new Yv(i.x,ii)):(G.map=new bn(i.x,i.y),G.map.depthTexture=new yo(i.x,i.y,ii)),G.map.depthTexture.name=U.name+".shadowMap",G.map.depthTexture.format=Vi;const Z=r.state.buffers.depth.getReversed();this.type===zc?(G.map.depthTexture.compareFunction=Z?_f:bf,G.map.depthTexture.minFilter=We,G.map.depthTexture.magFilter=We):(G.map.depthTexture.compareFunction=null,G.map.depthTexture.minFilter=yt,G.map.depthTexture.magFilter=yt)}G.camera.updateProjectionMatrix()}const J=G.map.isWebGLCubeRenderTarget?6:1;for(let Z=0;Z<J;Z++){if(G.map.isWebGLCubeRenderTarget)r.setRenderTarget(G.map,Z),r.clear();else{Z===0&&(r.setRenderTarget(G.map),r.clear());const Y=G.getViewport(Z);a.set(s.x*Y.x,s.y*Y.y,s.x*Y.z,s.y*Y.w),N.viewport(a)}if(U.isPointLight){const Y=G.camera,re=G.matrix,Ae=U.distance||Y.far;Ae!==Y.far&&(Y.far=Ae,Y.updateProjectionMatrix()),Sa.setFromMatrixPosition(U.matrixWorld),Y.position.copy(Sa),Lh.copy(Y.position),Lh.add(GM[Z]),Y.up.copy(HM[Z]),Y.lookAt(Lh),Y.updateMatrixWorld(),re.makeTranslation(-Sa.x,-Sa.y,-Sa.z),gA.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),G._frustum.setFromProjectionMatrix(gA,Y.coordinateSystem,Y.reversedDepth)}else G.updateMatrices(U);n=G.getFrustum(),b(M,w,G.camera,U,this.type)}G.isPointLightShadow!==!0&&this.type===Xa&&x(G,w),G.needsUpdate=!1}A=this.type,m.needsUpdate=!1,r.setRenderTarget(E,S,R)};function x(C,M){const w=e.update(g);d.defines.VSM_SAMPLES!==C.blurSamples&&(d.defines.VSM_SAMPLES=C.blurSamples,f.defines.VSM_SAMPLES=C.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),C.mapPass===null&&(C.mapPass=new bn(i.x,i.y,{format:Jn,type:It})),d.uniforms.shadow_pass.value=C.map.depthTexture,d.uniforms.resolution.value=C.mapSize,d.uniforms.radius.value=C.radius,r.setRenderTarget(C.mapPass),r.clear(),r.renderBufferDirect(M,null,w,d,g,null),f.uniforms.shadow_pass.value=C.mapPass.texture,f.uniforms.resolution.value=C.mapSize,f.uniforms.radius.value=C.radius,r.setRenderTarget(C.map),r.clear(),r.renderBufferDirect(M,null,w,f,g,null)}function _(C,M,w,E){let S=null;const R=w.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(R!==void 0)S=R;else if(S=w.isPointLight===!0?c:o,r.localClippingEnabled&&M.clipShadows===!0&&Array.isArray(M.clippingPlanes)&&M.clippingPlanes.length!==0||M.displacementMap&&M.displacementScale!==0||M.alphaMap&&M.alphaTest>0||M.map&&M.alphaTest>0||M.alphaToCoverage===!0){const N=S.uuid,F=M.uuid;let P=l[N];P===void 0&&(P={},l[N]=P);let Q=P[F];Q===void 0&&(Q=S.clone(),P[F]=Q,M.addEventListener("dispose",v)),S=Q}if(S.visible=M.visible,S.wireframe=M.wireframe,E===Xa?S.side=M.shadowSide!==null?M.shadowSide:M.side:S.side=M.shadowSide!==null?M.shadowSide:h[M.side],S.alphaMap=M.alphaMap,S.alphaTest=M.alphaToCoverage===!0?.5:M.alphaTest,S.map=M.map,S.clipShadows=M.clipShadows,S.clippingPlanes=M.clippingPlanes,S.clipIntersection=M.clipIntersection,S.displacementMap=M.displacementMap,S.displacementScale=M.displacementScale,S.displacementBias=M.displacementBias,S.wireframeLinewidth=M.wireframeLinewidth,S.linewidth=M.linewidth,w.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const N=r.properties.get(S);N.light=w}return S}function b(C,M,w,E,S){if(C.visible===!1)return;if(C.layers.test(M.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&S===Xa)&&(!C.frustumCulled||n.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,C.matrixWorld);const F=e.update(C),P=C.material;if(Array.isArray(P)){const Q=F.groups;for(let U=0,G=Q.length;U<G;U++){const q=Q[U],J=P[q.materialIndex];if(J&&J.visible){const Z=_(C,J,E,S);C.onBeforeShadow(r,C,M,w,F,Z,q),r.renderBufferDirect(w,null,F,Z,C,q),C.onAfterShadow(r,C,M,w,F,Z,q)}}}else if(P.visible){const Q=_(C,P,E,S);C.onBeforeShadow(r,C,M,w,F,Q,null),r.renderBufferDirect(w,null,F,Q,C,null),C.onAfterShadow(r,C,M,w,F,Q,null)}}const N=C.children;for(let F=0,P=N.length;F<P;F++)b(N[F],M,w,E,S)}function v(C){C.target.removeEventListener("dispose",v);for(const w in l){const E=l[w],S=C.target.uuid;S in E&&(E[S].dispose(),delete E[S])}}}const VM={[rd]:ad,[od]:hd,[cd]:ud,[qr]:ld,[ad]:rd,[hd]:od,[ud]:cd,[ld]:qr};function WM(r,e){function t(){let L=!1;const fe=new Mt;let se=null;const me=new Mt(0,0,0,0);return{setMask:function(ne){se!==ne&&!L&&(r.colorMask(ne,ne,ne,ne),se=ne)},setLocked:function(ne){L=ne},setClear:function(ne,j,ae,ke,vt){vt===!0&&(ne*=ke,j*=ke,ae*=ke),fe.set(ne,j,ae,ke),me.equals(fe)===!1&&(r.clearColor(ne,j,ae,ke),me.copy(fe))},reset:function(){L=!1,se=null,me.set(-1,0,0,0)}}}function n(){let L=!1,fe=!1,se=null,me=null,ne=null;return{setReversed:function(j){if(fe!==j){const ae=e.get("EXT_clip_control");j?ae.clipControlEXT(ae.LOWER_LEFT_EXT,ae.ZERO_TO_ONE_EXT):ae.clipControlEXT(ae.LOWER_LEFT_EXT,ae.NEGATIVE_ONE_TO_ONE_EXT),fe=j;const ke=ne;ne=null,this.setClear(ke)}},getReversed:function(){return fe},setTest:function(j){j?ee(r.DEPTH_TEST):ge(r.DEPTH_TEST)},setMask:function(j){se!==j&&!L&&(r.depthMask(j),se=j)},setFunc:function(j){if(fe&&(j=VM[j]),me!==j){switch(j){case rd:r.depthFunc(r.NEVER);break;case ad:r.depthFunc(r.ALWAYS);break;case od:r.depthFunc(r.LESS);break;case qr:r.depthFunc(r.LEQUAL);break;case cd:r.depthFunc(r.EQUAL);break;case ld:r.depthFunc(r.GEQUAL);break;case hd:r.depthFunc(r.GREATER);break;case ud:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}me=j}},setLocked:function(j){L=j},setClear:function(j){ne!==j&&(fe&&(j=1-j),r.clearDepth(j),ne=j)},reset:function(){L=!1,se=null,me=null,ne=null,fe=!1}}}function i(){let L=!1,fe=null,se=null,me=null,ne=null,j=null,ae=null,ke=null,vt=null;return{setTest:function(ht){L||(ht?ee(r.STENCIL_TEST):ge(r.STENCIL_TEST))},setMask:function(ht){fe!==ht&&!L&&(r.stencilMask(ht),fe=ht)},setFunc:function(ht,oi,Ei){(se!==ht||me!==oi||ne!==Ei)&&(r.stencilFunc(ht,oi,Ei),se=ht,me=oi,ne=Ei)},setOp:function(ht,oi,Ei){(j!==ht||ae!==oi||ke!==Ei)&&(r.stencilOp(ht,oi,Ei),j=ht,ae=oi,ke=Ei)},setLocked:function(ht){L=ht},setClear:function(ht){vt!==ht&&(r.clearStencil(ht),vt=ht)},reset:function(){L=!1,fe=null,se=null,me=null,ne=null,j=null,ae=null,ke=null,vt=null}}}const s=new t,a=new n,o=new i,c=new WeakMap,l=new WeakMap;let u={},h={},d=new WeakMap,f=[],p=null,g=!1,m=null,A=null,x=null,_=null,b=null,v=null,C=null,M=new Ie(0,0,0),w=0,E=!1,S=null,R=null,N=null,F=null,P=null;const Q=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let U=!1,G=0;const q=r.getParameter(r.VERSION);q.indexOf("WebGL")!==-1?(G=parseFloat(/^WebGL (\d)/.exec(q)[1]),U=G>=1):q.indexOf("OpenGL ES")!==-1&&(G=parseFloat(/^OpenGL ES (\d)/.exec(q)[1]),U=G>=2);let J=null,Z={};const Y=r.getParameter(r.SCISSOR_BOX),re=r.getParameter(r.VIEWPORT),Ae=new Mt().fromArray(Y),He=new Mt().fromArray(re);function ze(L,fe,se,me){const ne=new Uint8Array(4),j=r.createTexture();r.bindTexture(L,j),r.texParameteri(L,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(L,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let ae=0;ae<se;ae++)L===r.TEXTURE_3D||L===r.TEXTURE_2D_ARRAY?r.texImage3D(fe,0,r.RGBA,1,1,me,0,r.RGBA,r.UNSIGNED_BYTE,ne):r.texImage2D(fe+ae,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,ne);return j}const X={};X[r.TEXTURE_2D]=ze(r.TEXTURE_2D,r.TEXTURE_2D,1),X[r.TEXTURE_CUBE_MAP]=ze(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),X[r.TEXTURE_2D_ARRAY]=ze(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),X[r.TEXTURE_3D]=ze(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ee(r.DEPTH_TEST),a.setFunc(qr),$e(!1),Qt(Jf),ee(r.CULL_FACE),it(Zn);function ee(L){u[L]!==!0&&(r.enable(L),u[L]=!0)}function ge(L){u[L]!==!1&&(r.disable(L),u[L]=!1)}function Ge(L,fe){return h[L]!==fe?(r.bindFramebuffer(L,fe),h[L]=fe,L===r.DRAW_FRAMEBUFFER&&(h[r.FRAMEBUFFER]=fe),L===r.FRAMEBUFFER&&(h[r.DRAW_FRAMEBUFFER]=fe),!0):!1}function _e(L,fe){let se=f,me=!1;if(L){se=d.get(fe),se===void 0&&(se=[],d.set(fe,se));const ne=L.textures;if(se.length!==ne.length||se[0]!==r.COLOR_ATTACHMENT0){for(let j=0,ae=ne.length;j<ae;j++)se[j]=r.COLOR_ATTACHMENT0+j;se.length=ne.length,me=!0}}else se[0]!==r.BACK&&(se[0]=r.BACK,me=!0);me&&r.drawBuffers(se)}function tt(L){return p!==L?(r.useProgram(L),p=L,!0):!1}const kt={[Ns]:r.FUNC_ADD,[g_]:r.FUNC_SUBTRACT,[x_]:r.FUNC_REVERSE_SUBTRACT};kt[b_]=r.MIN,kt[__]=r.MAX;const Ke={[v_]:r.ZERO,[E_]:r.ONE,[y_]:r.SRC_COLOR,[id]:r.SRC_ALPHA,[T_]:r.SRC_ALPHA_SATURATE,[M_]:r.DST_COLOR,[C_]:r.DST_ALPHA,[S_]:r.ONE_MINUS_SRC_COLOR,[sd]:r.ONE_MINUS_SRC_ALPHA,[w_]:r.ONE_MINUS_DST_COLOR,[I_]:r.ONE_MINUS_DST_ALPHA,[R_]:r.CONSTANT_COLOR,[B_]:r.ONE_MINUS_CONSTANT_COLOR,[D_]:r.CONSTANT_ALPHA,[L_]:r.ONE_MINUS_CONSTANT_ALPHA};function it(L,fe,se,me,ne,j,ae,ke,vt,ht){if(L===Zn){g===!0&&(ge(r.BLEND),g=!1);return}if(g===!1&&(ee(r.BLEND),g=!0),L!==m_){if(L!==m||ht!==E){if((A!==Ns||b!==Ns)&&(r.blendEquation(r.FUNC_ADD),A=Ns,b=Ns),ht)switch(L){case Qs:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case nd:r.blendFunc(r.ONE,r.ONE);break;case Zf:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case ep:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:Fe("WebGLState: Invalid blending: ",L);break}else switch(L){case Qs:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case nd:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case Zf:Fe("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case ep:Fe("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Fe("WebGLState: Invalid blending: ",L);break}x=null,_=null,v=null,C=null,M.set(0,0,0),w=0,m=L,E=ht}return}ne=ne||fe,j=j||se,ae=ae||me,(fe!==A||ne!==b)&&(r.blendEquationSeparate(kt[fe],kt[ne]),A=fe,b=ne),(se!==x||me!==_||j!==v||ae!==C)&&(r.blendFuncSeparate(Ke[se],Ke[me],Ke[j],Ke[ae]),x=se,_=me,v=j,C=ae),(ke.equals(M)===!1||vt!==w)&&(r.blendColor(ke.r,ke.g,ke.b,vt),M.copy(ke),w=vt),m=L,E=!1}function gt(L,fe){L.side===Vt?ge(r.CULL_FACE):ee(r.CULL_FACE);let se=L.side===nn;fe&&(se=!se),$e(se),L.blending===Qs&&L.transparent===!1?it(Zn):it(L.blending,L.blendEquation,L.blendSrc,L.blendDst,L.blendEquationAlpha,L.blendSrcAlpha,L.blendDstAlpha,L.blendColor,L.blendAlpha,L.premultipliedAlpha),a.setFunc(L.depthFunc),a.setTest(L.depthTest),a.setMask(L.depthWrite),s.setMask(L.colorWrite);const me=L.stencilWrite;o.setTest(me),me&&(o.setMask(L.stencilWriteMask),o.setFunc(L.stencilFunc,L.stencilRef,L.stencilFuncMask),o.setOp(L.stencilFail,L.stencilZFail,L.stencilZPass)),Gt(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),L.alphaToCoverage===!0?ee(r.SAMPLE_ALPHA_TO_COVERAGE):ge(r.SAMPLE_ALPHA_TO_COVERAGE)}function $e(L){S!==L&&(L?r.frontFace(r.CW):r.frontFace(r.CCW),S=L)}function Qt(L){L!==f_?(ee(r.CULL_FACE),L!==R&&(L===Jf?r.cullFace(r.BACK):L===p_?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):ge(r.CULL_FACE),R=L}function D(L){L!==N&&(U&&r.lineWidth(L),N=L)}function Gt(L,fe,se){L?(ee(r.POLYGON_OFFSET_FILL),(F!==fe||P!==se)&&(r.polygonOffset(fe,se),F=fe,P=se)):ge(r.POLYGON_OFFSET_FILL)}function ct(L){L?ee(r.SCISSOR_TEST):ge(r.SCISSOR_TEST)}function _t(L){L===void 0&&(L=r.TEXTURE0+Q-1),J!==L&&(r.activeTexture(L),J=L)}function Se(L,fe,se){se===void 0&&(J===null?se=r.TEXTURE0+Q-1:se=J);let me=Z[se];me===void 0&&(me={type:void 0,texture:void 0},Z[se]=me),(me.type!==L||me.texture!==fe)&&(J!==se&&(r.activeTexture(se),J=se),r.bindTexture(L,fe||X[L]),me.type=L,me.texture=fe)}function T(){const L=Z[J];L!==void 0&&L.type!==void 0&&(r.bindTexture(L.type,null),L.type=void 0,L.texture=void 0)}function y(){try{r.compressedTexImage2D(...arguments)}catch(L){Fe("WebGLState:",L)}}function O(){try{r.compressedTexImage3D(...arguments)}catch(L){Fe("WebGLState:",L)}}function $(){try{r.texSubImage2D(...arguments)}catch(L){Fe("WebGLState:",L)}}function K(){try{r.texSubImage3D(...arguments)}catch(L){Fe("WebGLState:",L)}}function W(){try{r.compressedTexSubImage2D(...arguments)}catch(L){Fe("WebGLState:",L)}}function Me(){try{r.compressedTexSubImage3D(...arguments)}catch(L){Fe("WebGLState:",L)}}function oe(){try{r.texStorage2D(...arguments)}catch(L){Fe("WebGLState:",L)}}function ye(){try{r.texStorage3D(...arguments)}catch(L){Fe("WebGLState:",L)}}function Oe(){try{r.texImage2D(...arguments)}catch(L){Fe("WebGLState:",L)}}function ie(){try{r.texImage3D(...arguments)}catch(L){Fe("WebGLState:",L)}}function le(L){Ae.equals(L)===!1&&(r.scissor(L.x,L.y,L.z,L.w),Ae.copy(L))}function Ee(L){He.equals(L)===!1&&(r.viewport(L.x,L.y,L.z,L.w),He.copy(L))}function Ce(L,fe){let se=l.get(fe);se===void 0&&(se=new WeakMap,l.set(fe,se));let me=se.get(L);me===void 0&&(me=r.getUniformBlockIndex(fe,L.name),se.set(L,me))}function ce(L,fe){const me=l.get(fe).get(L);c.get(fe)!==me&&(r.uniformBlockBinding(fe,me,L.__bindingPointIndex),c.set(fe,me))}function Ye(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),a.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),u={},J=null,Z={},h={},d=new WeakMap,f=[],p=null,g=!1,m=null,A=null,x=null,_=null,b=null,v=null,C=null,M=new Ie(0,0,0),w=0,E=!1,S=null,R=null,N=null,F=null,P=null,Ae.set(0,0,r.canvas.width,r.canvas.height),He.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ee,disable:ge,bindFramebuffer:Ge,drawBuffers:_e,useProgram:tt,setBlending:it,setMaterial:gt,setFlipSided:$e,setCullFace:Qt,setLineWidth:D,setPolygonOffset:Gt,setScissorTest:ct,activeTexture:_t,bindTexture:Se,unbindTexture:T,compressedTexImage2D:y,compressedTexImage3D:O,texImage2D:Oe,texImage3D:ie,updateUBOMapping:Ce,uniformBlockBinding:ce,texStorage2D:oe,texStorage3D:ye,texSubImage2D:$,texSubImage3D:K,compressedTexSubImage2D:W,compressedTexSubImage3D:Me,scissor:le,viewport:Ee,reset:Ye}}function qM(r,e,t,n,i,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new pe,u=new WeakMap;let h;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function p(T,y){return f?new OffscreenCanvas(T,y):_o("canvas")}function g(T,y,O){let $=1;const K=Se(T);if((K.width>O||K.height>O)&&($=O/Math.max(K.width,K.height)),$<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){const W=Math.floor($*K.width),Me=Math.floor($*K.height);h===void 0&&(h=p(W,Me));const oe=y?p(W,Me):h;return oe.width=W,oe.height=Me,oe.getContext("2d").drawImage(T,0,0,W,Me),we("WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+W+"x"+Me+")."),oe}else return"data"in T&&we("WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),T;return T}function m(T){return T.generateMipmaps}function A(T){r.generateMipmap(T)}function x(T){return T.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:T.isWebGL3DRenderTarget?r.TEXTURE_3D:T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function _(T,y,O,$,K=!1){if(T!==null){if(r[T]!==void 0)return r[T];we("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let W=y;if(y===r.RED&&(O===r.FLOAT&&(W=r.R32F),O===r.HALF_FLOAT&&(W=r.R16F),O===r.UNSIGNED_BYTE&&(W=r.R8)),y===r.RED_INTEGER&&(O===r.UNSIGNED_BYTE&&(W=r.R8UI),O===r.UNSIGNED_SHORT&&(W=r.R16UI),O===r.UNSIGNED_INT&&(W=r.R32UI),O===r.BYTE&&(W=r.R8I),O===r.SHORT&&(W=r.R16I),O===r.INT&&(W=r.R32I)),y===r.RG&&(O===r.FLOAT&&(W=r.RG32F),O===r.HALF_FLOAT&&(W=r.RG16F),O===r.UNSIGNED_BYTE&&(W=r.RG8)),y===r.RG_INTEGER&&(O===r.UNSIGNED_BYTE&&(W=r.RG8UI),O===r.UNSIGNED_SHORT&&(W=r.RG16UI),O===r.UNSIGNED_INT&&(W=r.RG32UI),O===r.BYTE&&(W=r.RG8I),O===r.SHORT&&(W=r.RG16I),O===r.INT&&(W=r.RG32I)),y===r.RGB_INTEGER&&(O===r.UNSIGNED_BYTE&&(W=r.RGB8UI),O===r.UNSIGNED_SHORT&&(W=r.RGB16UI),O===r.UNSIGNED_INT&&(W=r.RGB32UI),O===r.BYTE&&(W=r.RGB8I),O===r.SHORT&&(W=r.RGB16I),O===r.INT&&(W=r.RGB32I)),y===r.RGBA_INTEGER&&(O===r.UNSIGNED_BYTE&&(W=r.RGBA8UI),O===r.UNSIGNED_SHORT&&(W=r.RGBA16UI),O===r.UNSIGNED_INT&&(W=r.RGBA32UI),O===r.BYTE&&(W=r.RGBA8I),O===r.SHORT&&(W=r.RGBA16I),O===r.INT&&(W=r.RGBA32I)),y===r.RGB&&(O===r.UNSIGNED_INT_5_9_9_9_REV&&(W=r.RGB9_E5),O===r.UNSIGNED_INT_10F_11F_11F_REV&&(W=r.R11F_G11F_B10F)),y===r.RGBA){const Me=K?Al:Ze.getTransfer($);O===r.FLOAT&&(W=r.RGBA32F),O===r.HALF_FLOAT&&(W=r.RGBA16F),O===r.UNSIGNED_BYTE&&(W=Me===ft?r.SRGB8_ALPHA8:r.RGBA8),O===r.UNSIGNED_SHORT_4_4_4_4&&(W=r.RGBA4),O===r.UNSIGNED_SHORT_5_5_5_1&&(W=r.RGB5_A1)}return(W===r.R16F||W===r.R32F||W===r.RG16F||W===r.RG32F||W===r.RGBA16F||W===r.RGBA32F)&&e.get("EXT_color_buffer_float"),W}function b(T,y){let O;return T?y===null||y===ii||y===po?O=r.DEPTH24_STENCIL8:y===Nt?O=r.DEPTH32F_STENCIL8:y===fo&&(O=r.DEPTH24_STENCIL8,we("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):y===null||y===ii||y===po?O=r.DEPTH_COMPONENT24:y===Nt?O=r.DEPTH_COMPONENT32F:y===fo&&(O=r.DEPTH_COMPONENT16),O}function v(T,y){return m(T)===!0||T.isFramebufferTexture&&T.minFilter!==yt&&T.minFilter!==We?Math.log2(Math.max(y.width,y.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?y.mipmaps.length:1}function C(T){const y=T.target;y.removeEventListener("dispose",C),w(y),y.isVideoTexture&&u.delete(y)}function M(T){const y=T.target;y.removeEventListener("dispose",M),S(y)}function w(T){const y=n.get(T);if(y.__webglInit===void 0)return;const O=T.source,$=d.get(O);if($){const K=$[y.__cacheKey];K.usedTimes--,K.usedTimes===0&&E(T),Object.keys($).length===0&&d.delete(O)}n.remove(T)}function E(T){const y=n.get(T);r.deleteTexture(y.__webglTexture);const O=T.source,$=d.get(O);delete $[y.__cacheKey],a.memory.textures--}function S(T){const y=n.get(T);if(T.depthTexture&&(T.depthTexture.dispose(),n.remove(T.depthTexture)),T.isWebGLCubeRenderTarget)for(let $=0;$<6;$++){if(Array.isArray(y.__webglFramebuffer[$]))for(let K=0;K<y.__webglFramebuffer[$].length;K++)r.deleteFramebuffer(y.__webglFramebuffer[$][K]);else r.deleteFramebuffer(y.__webglFramebuffer[$]);y.__webglDepthbuffer&&r.deleteRenderbuffer(y.__webglDepthbuffer[$])}else{if(Array.isArray(y.__webglFramebuffer))for(let $=0;$<y.__webglFramebuffer.length;$++)r.deleteFramebuffer(y.__webglFramebuffer[$]);else r.deleteFramebuffer(y.__webglFramebuffer);if(y.__webglDepthbuffer&&r.deleteRenderbuffer(y.__webglDepthbuffer),y.__webglMultisampledFramebuffer&&r.deleteFramebuffer(y.__webglMultisampledFramebuffer),y.__webglColorRenderbuffer)for(let $=0;$<y.__webglColorRenderbuffer.length;$++)y.__webglColorRenderbuffer[$]&&r.deleteRenderbuffer(y.__webglColorRenderbuffer[$]);y.__webglDepthRenderbuffer&&r.deleteRenderbuffer(y.__webglDepthRenderbuffer)}const O=T.textures;for(let $=0,K=O.length;$<K;$++){const W=n.get(O[$]);W.__webglTexture&&(r.deleteTexture(W.__webglTexture),a.memory.textures--),n.remove(O[$])}n.remove(T)}let R=0;function N(){R=0}function F(){const T=R;return T>=i.maxTextures&&we("WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+i.maxTextures),R+=1,T}function P(T){const y=[];return y.push(T.wrapS),y.push(T.wrapT),y.push(T.wrapR||0),y.push(T.magFilter),y.push(T.minFilter),y.push(T.anisotropy),y.push(T.internalFormat),y.push(T.format),y.push(T.type),y.push(T.generateMipmaps),y.push(T.premultiplyAlpha),y.push(T.flipY),y.push(T.unpackAlignment),y.push(T.colorSpace),y.join()}function Q(T,y){const O=n.get(T);if(T.isVideoTexture&&ct(T),T.isRenderTargetTexture===!1&&T.isExternalTexture!==!0&&T.version>0&&O.__version!==T.version){const $=T.image;if($===null)we("WebGLRenderer: Texture marked for update but no image data found.");else if($.complete===!1)we("WebGLRenderer: Texture marked for update but image is incomplete");else{X(O,T,y);return}}else T.isExternalTexture&&(O.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,O.__webglTexture,r.TEXTURE0+y)}function U(T,y){const O=n.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&O.__version!==T.version){X(O,T,y);return}else T.isExternalTexture&&(O.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,O.__webglTexture,r.TEXTURE0+y)}function G(T,y){const O=n.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&O.__version!==T.version){X(O,T,y);return}t.bindTexture(r.TEXTURE_3D,O.__webglTexture,r.TEXTURE0+y)}function q(T,y){const O=n.get(T);if(T.isCubeDepthTexture!==!0&&T.version>0&&O.__version!==T.version){ee(O,T,y);return}t.bindTexture(r.TEXTURE_CUBE_MAP,O.__webglTexture,r.TEXTURE0+y)}const J={[ni]:r.REPEAT,[Lt]:r.CLAMP_TO_EDGE,[Ws]:r.MIRRORED_REPEAT},Z={[yt]:r.NEAREST,[la]:r.NEAREST_MIPMAP_NEAREST,[rs]:r.NEAREST_MIPMAP_LINEAR,[We]:r.LINEAR,[Gs]:r.LINEAR_MIPMAP_NEAREST,[gn]:r.LINEAR_MIPMAP_LINEAR},Y={[G_]:r.NEVER,[q_]:r.ALWAYS,[H_]:r.LESS,[bf]:r.LEQUAL,[z_]:r.EQUAL,[_f]:r.GEQUAL,[V_]:r.GREATER,[W_]:r.NOTEQUAL};function re(T,y){if(y.type===Nt&&e.has("OES_texture_float_linear")===!1&&(y.magFilter===We||y.magFilter===Gs||y.magFilter===rs||y.magFilter===gn||y.minFilter===We||y.minFilter===Gs||y.minFilter===rs||y.minFilter===gn)&&we("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(T,r.TEXTURE_WRAP_S,J[y.wrapS]),r.texParameteri(T,r.TEXTURE_WRAP_T,J[y.wrapT]),(T===r.TEXTURE_3D||T===r.TEXTURE_2D_ARRAY)&&r.texParameteri(T,r.TEXTURE_WRAP_R,J[y.wrapR]),r.texParameteri(T,r.TEXTURE_MAG_FILTER,Z[y.magFilter]),r.texParameteri(T,r.TEXTURE_MIN_FILTER,Z[y.minFilter]),y.compareFunction&&(r.texParameteri(T,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(T,r.TEXTURE_COMPARE_FUNC,Y[y.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(y.magFilter===yt||y.minFilter!==rs&&y.minFilter!==gn||y.type===Nt&&e.has("OES_texture_float_linear")===!1)return;if(y.anisotropy>1||n.get(y).__currentAnisotropy){const O=e.get("EXT_texture_filter_anisotropic");r.texParameterf(T,O.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(y.anisotropy,i.getMaxAnisotropy())),n.get(y).__currentAnisotropy=y.anisotropy}}}function Ae(T,y){let O=!1;T.__webglInit===void 0&&(T.__webglInit=!0,y.addEventListener("dispose",C));const $=y.source;let K=d.get($);K===void 0&&(K={},d.set($,K));const W=P(y);if(W!==T.__cacheKey){K[W]===void 0&&(K[W]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,O=!0),K[W].usedTimes++;const Me=K[T.__cacheKey];Me!==void 0&&(K[T.__cacheKey].usedTimes--,Me.usedTimes===0&&E(y)),T.__cacheKey=W,T.__webglTexture=K[W].texture}return O}function He(T,y,O){return Math.floor(Math.floor(T/O)/y)}function ze(T,y,O,$){const W=T.updateRanges;if(W.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,y.width,y.height,O,$,y.data);else{W.sort((ie,le)=>ie.start-le.start);let Me=0;for(let ie=1;ie<W.length;ie++){const le=W[Me],Ee=W[ie],Ce=le.start+le.count,ce=He(Ee.start,y.width,4),Ye=He(le.start,y.width,4);Ee.start<=Ce+1&&ce===Ye&&He(Ee.start+Ee.count-1,y.width,4)===ce?le.count=Math.max(le.count,Ee.start+Ee.count-le.start):(++Me,W[Me]=Ee)}W.length=Me+1;const oe=r.getParameter(r.UNPACK_ROW_LENGTH),ye=r.getParameter(r.UNPACK_SKIP_PIXELS),Oe=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,y.width);for(let ie=0,le=W.length;ie<le;ie++){const Ee=W[ie],Ce=Math.floor(Ee.start/4),ce=Math.ceil(Ee.count/4),Ye=Ce%y.width,L=Math.floor(Ce/y.width),fe=ce,se=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,Ye),r.pixelStorei(r.UNPACK_SKIP_ROWS,L),t.texSubImage2D(r.TEXTURE_2D,0,Ye,L,fe,se,O,$,y.data)}T.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,oe),r.pixelStorei(r.UNPACK_SKIP_PIXELS,ye),r.pixelStorei(r.UNPACK_SKIP_ROWS,Oe)}}function X(T,y,O){let $=r.TEXTURE_2D;(y.isDataArrayTexture||y.isCompressedArrayTexture)&&($=r.TEXTURE_2D_ARRAY),y.isData3DTexture&&($=r.TEXTURE_3D);const K=Ae(T,y),W=y.source;t.bindTexture($,T.__webglTexture,r.TEXTURE0+O);const Me=n.get(W);if(W.version!==Me.__version||K===!0){t.activeTexture(r.TEXTURE0+O);const oe=Ze.getPrimaries(Ze.workingColorSpace),ye=y.colorSpace===kn?null:Ze.getPrimaries(y.colorSpace),Oe=y.colorSpace===kn||oe===ye?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,y.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,y.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Oe);let ie=g(y.image,!1,i.maxTextureSize);ie=_t(y,ie);const le=s.convert(y.format,y.colorSpace),Ee=s.convert(y.type);let Ce=_(y.internalFormat,le,Ee,y.colorSpace,y.isVideoTexture);re($,y);let ce;const Ye=y.mipmaps,L=y.isVideoTexture!==!0,fe=Me.__version===void 0||K===!0,se=W.dataReady,me=v(y,ie);if(y.isDepthTexture)Ce=b(y.format===Os,y.type),fe&&(L?t.texStorage2D(r.TEXTURE_2D,1,Ce,ie.width,ie.height):t.texImage2D(r.TEXTURE_2D,0,Ce,ie.width,ie.height,0,le,Ee,null));else if(y.isDataTexture)if(Ye.length>0){L&&fe&&t.texStorage2D(r.TEXTURE_2D,me,Ce,Ye[0].width,Ye[0].height);for(let ne=0,j=Ye.length;ne<j;ne++)ce=Ye[ne],L?se&&t.texSubImage2D(r.TEXTURE_2D,ne,0,0,ce.width,ce.height,le,Ee,ce.data):t.texImage2D(r.TEXTURE_2D,ne,Ce,ce.width,ce.height,0,le,Ee,ce.data);y.generateMipmaps=!1}else L?(fe&&t.texStorage2D(r.TEXTURE_2D,me,Ce,ie.width,ie.height),se&&ze(y,ie,le,Ee)):t.texImage2D(r.TEXTURE_2D,0,Ce,ie.width,ie.height,0,le,Ee,ie.data);else if(y.isCompressedTexture)if(y.isCompressedArrayTexture){L&&fe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,me,Ce,Ye[0].width,Ye[0].height,ie.depth);for(let ne=0,j=Ye.length;ne<j;ne++)if(ce=Ye[ne],y.format!==Tt)if(le!==null)if(L){if(se)if(y.layerUpdates.size>0){const ae=$p(ce.width,ce.height,y.format,y.type);for(const ke of y.layerUpdates){const vt=ce.data.subarray(ke*ae/ce.data.BYTES_PER_ELEMENT,(ke+1)*ae/ce.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ne,0,0,ke,ce.width,ce.height,1,le,vt)}y.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ne,0,0,0,ce.width,ce.height,ie.depth,le,ce.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ne,Ce,ce.width,ce.height,ie.depth,0,ce.data,0,0);else we("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else L?se&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,ne,0,0,0,ce.width,ce.height,ie.depth,le,Ee,ce.data):t.texImage3D(r.TEXTURE_2D_ARRAY,ne,Ce,ce.width,ce.height,ie.depth,0,le,Ee,ce.data)}else{L&&fe&&t.texStorage2D(r.TEXTURE_2D,me,Ce,Ye[0].width,Ye[0].height);for(let ne=0,j=Ye.length;ne<j;ne++)ce=Ye[ne],y.format!==Tt?le!==null?L?se&&t.compressedTexSubImage2D(r.TEXTURE_2D,ne,0,0,ce.width,ce.height,le,ce.data):t.compressedTexImage2D(r.TEXTURE_2D,ne,Ce,ce.width,ce.height,0,ce.data):we("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):L?se&&t.texSubImage2D(r.TEXTURE_2D,ne,0,0,ce.width,ce.height,le,Ee,ce.data):t.texImage2D(r.TEXTURE_2D,ne,Ce,ce.width,ce.height,0,le,Ee,ce.data)}else if(y.isDataArrayTexture)if(L){if(fe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,me,Ce,ie.width,ie.height,ie.depth),se)if(y.layerUpdates.size>0){const ne=$p(ie.width,ie.height,y.format,y.type);for(const j of y.layerUpdates){const ae=ie.data.subarray(j*ne/ie.data.BYTES_PER_ELEMENT,(j+1)*ne/ie.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,j,ie.width,ie.height,1,le,Ee,ae)}y.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ie.width,ie.height,ie.depth,le,Ee,ie.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,Ce,ie.width,ie.height,ie.depth,0,le,Ee,ie.data);else if(y.isData3DTexture)L?(fe&&t.texStorage3D(r.TEXTURE_3D,me,Ce,ie.width,ie.height,ie.depth),se&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ie.width,ie.height,ie.depth,le,Ee,ie.data)):t.texImage3D(r.TEXTURE_3D,0,Ce,ie.width,ie.height,ie.depth,0,le,Ee,ie.data);else if(y.isFramebufferTexture){if(fe)if(L)t.texStorage2D(r.TEXTURE_2D,me,Ce,ie.width,ie.height);else{let ne=ie.width,j=ie.height;for(let ae=0;ae<me;ae++)t.texImage2D(r.TEXTURE_2D,ae,Ce,ne,j,0,le,Ee,null),ne>>=1,j>>=1}}else if(Ye.length>0){if(L&&fe){const ne=Se(Ye[0]);t.texStorage2D(r.TEXTURE_2D,me,Ce,ne.width,ne.height)}for(let ne=0,j=Ye.length;ne<j;ne++)ce=Ye[ne],L?se&&t.texSubImage2D(r.TEXTURE_2D,ne,0,0,le,Ee,ce):t.texImage2D(r.TEXTURE_2D,ne,Ce,le,Ee,ce);y.generateMipmaps=!1}else if(L){if(fe){const ne=Se(ie);t.texStorage2D(r.TEXTURE_2D,me,Ce,ne.width,ne.height)}se&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,le,Ee,ie)}else t.texImage2D(r.TEXTURE_2D,0,Ce,le,Ee,ie);m(y)&&A($),Me.__version=W.version,y.onUpdate&&y.onUpdate(y)}T.__version=y.version}function ee(T,y,O){if(y.image.length!==6)return;const $=Ae(T,y),K=y.source;t.bindTexture(r.TEXTURE_CUBE_MAP,T.__webglTexture,r.TEXTURE0+O);const W=n.get(K);if(K.version!==W.__version||$===!0){t.activeTexture(r.TEXTURE0+O);const Me=Ze.getPrimaries(Ze.workingColorSpace),oe=y.colorSpace===kn?null:Ze.getPrimaries(y.colorSpace),ye=y.colorSpace===kn||Me===oe?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,y.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,y.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,ye);const Oe=y.isCompressedTexture||y.image[0].isCompressedTexture,ie=y.image[0]&&y.image[0].isDataTexture,le=[];for(let j=0;j<6;j++)!Oe&&!ie?le[j]=g(y.image[j],!0,i.maxCubemapSize):le[j]=ie?y.image[j].image:y.image[j],le[j]=_t(y,le[j]);const Ee=le[0],Ce=s.convert(y.format,y.colorSpace),ce=s.convert(y.type),Ye=_(y.internalFormat,Ce,ce,y.colorSpace),L=y.isVideoTexture!==!0,fe=W.__version===void 0||$===!0,se=K.dataReady;let me=v(y,Ee);re(r.TEXTURE_CUBE_MAP,y);let ne;if(Oe){L&&fe&&t.texStorage2D(r.TEXTURE_CUBE_MAP,me,Ye,Ee.width,Ee.height);for(let j=0;j<6;j++){ne=le[j].mipmaps;for(let ae=0;ae<ne.length;ae++){const ke=ne[ae];y.format!==Tt?Ce!==null?L?se&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+j,ae,0,0,ke.width,ke.height,Ce,ke.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+j,ae,Ye,ke.width,ke.height,0,ke.data):we("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):L?se&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+j,ae,0,0,ke.width,ke.height,Ce,ce,ke.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+j,ae,Ye,ke.width,ke.height,0,Ce,ce,ke.data)}}}else{if(ne=y.mipmaps,L&&fe){ne.length>0&&me++;const j=Se(le[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,me,Ye,j.width,j.height)}for(let j=0;j<6;j++)if(ie){L?se&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,0,0,le[j].width,le[j].height,Ce,ce,le[j].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,Ye,le[j].width,le[j].height,0,Ce,ce,le[j].data);for(let ae=0;ae<ne.length;ae++){const vt=ne[ae].image[j].image;L?se&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+j,ae+1,0,0,vt.width,vt.height,Ce,ce,vt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+j,ae+1,Ye,vt.width,vt.height,0,Ce,ce,vt.data)}}else{L?se&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,0,0,Ce,ce,le[j]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,Ye,Ce,ce,le[j]);for(let ae=0;ae<ne.length;ae++){const ke=ne[ae];L?se&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+j,ae+1,0,0,Ce,ce,ke.image[j]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+j,ae+1,Ye,Ce,ce,ke.image[j])}}}m(y)&&A(r.TEXTURE_CUBE_MAP),W.__version=K.version,y.onUpdate&&y.onUpdate(y)}T.__version=y.version}function ge(T,y,O,$,K,W){const Me=s.convert(O.format,O.colorSpace),oe=s.convert(O.type),ye=_(O.internalFormat,Me,oe,O.colorSpace),Oe=n.get(y),ie=n.get(O);if(ie.__renderTarget=y,!Oe.__hasExternalTextures){const le=Math.max(1,y.width>>W),Ee=Math.max(1,y.height>>W);K===r.TEXTURE_3D||K===r.TEXTURE_2D_ARRAY?t.texImage3D(K,W,ye,le,Ee,y.depth,0,Me,oe,null):t.texImage2D(K,W,ye,le,Ee,0,Me,oe,null)}t.bindFramebuffer(r.FRAMEBUFFER,T),Gt(y)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,$,K,ie.__webglTexture,0,D(y)):(K===r.TEXTURE_2D||K>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,$,K,ie.__webglTexture,W),t.bindFramebuffer(r.FRAMEBUFFER,null)}function Ge(T,y,O){if(r.bindRenderbuffer(r.RENDERBUFFER,T),y.depthBuffer){const $=y.depthTexture,K=$&&$.isDepthTexture?$.type:null,W=b(y.stencilBuffer,K),Me=y.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Gt(y)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,D(y),W,y.width,y.height):O?r.renderbufferStorageMultisample(r.RENDERBUFFER,D(y),W,y.width,y.height):r.renderbufferStorage(r.RENDERBUFFER,W,y.width,y.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Me,r.RENDERBUFFER,T)}else{const $=y.textures;for(let K=0;K<$.length;K++){const W=$[K],Me=s.convert(W.format,W.colorSpace),oe=s.convert(W.type),ye=_(W.internalFormat,Me,oe,W.colorSpace);Gt(y)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,D(y),ye,y.width,y.height):O?r.renderbufferStorageMultisample(r.RENDERBUFFER,D(y),ye,y.width,y.height):r.renderbufferStorage(r.RENDERBUFFER,ye,y.width,y.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function _e(T,y,O){const $=y.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(r.FRAMEBUFFER,T),!(y.depthTexture&&y.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const K=n.get(y.depthTexture);if(K.__renderTarget=y,(!K.__webglTexture||y.depthTexture.image.width!==y.width||y.depthTexture.image.height!==y.height)&&(y.depthTexture.image.width=y.width,y.depthTexture.image.height=y.height,y.depthTexture.needsUpdate=!0),$){if(K.__webglInit===void 0&&(K.__webglInit=!0,y.depthTexture.addEventListener("dispose",C)),K.__webglTexture===void 0){K.__webglTexture=r.createTexture(),t.bindTexture(r.TEXTURE_CUBE_MAP,K.__webglTexture),re(r.TEXTURE_CUBE_MAP,y.depthTexture);const Oe=s.convert(y.depthTexture.format),ie=s.convert(y.depthTexture.type);let le;y.depthTexture.format===Vi?le=r.DEPTH_COMPONENT24:y.depthTexture.format===Os&&(le=r.DEPTH24_STENCIL8);for(let Ee=0;Ee<6;Ee++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,0,le,y.width,y.height,0,Oe,ie,null)}}else Q(y.depthTexture,0);const W=K.__webglTexture,Me=D(y),oe=$?r.TEXTURE_CUBE_MAP_POSITIVE_X+O:r.TEXTURE_2D,ye=y.depthTexture.format===Os?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(y.depthTexture.format===Vi)Gt(y)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ye,oe,W,0,Me):r.framebufferTexture2D(r.FRAMEBUFFER,ye,oe,W,0);else if(y.depthTexture.format===Os)Gt(y)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ye,oe,W,0,Me):r.framebufferTexture2D(r.FRAMEBUFFER,ye,oe,W,0);else throw new Error("Unknown depthTexture format")}function tt(T){const y=n.get(T),O=T.isWebGLCubeRenderTarget===!0;if(y.__boundDepthTexture!==T.depthTexture){const $=T.depthTexture;if(y.__depthDisposeCallback&&y.__depthDisposeCallback(),$){const K=()=>{delete y.__boundDepthTexture,delete y.__depthDisposeCallback,$.removeEventListener("dispose",K)};$.addEventListener("dispose",K),y.__depthDisposeCallback=K}y.__boundDepthTexture=$}if(T.depthTexture&&!y.__autoAllocateDepthBuffer)if(O)for(let $=0;$<6;$++)_e(y.__webglFramebuffer[$],T,$);else{const $=T.texture.mipmaps;$&&$.length>0?_e(y.__webglFramebuffer[0],T,0):_e(y.__webglFramebuffer,T,0)}else if(O){y.__webglDepthbuffer=[];for(let $=0;$<6;$++)if(t.bindFramebuffer(r.FRAMEBUFFER,y.__webglFramebuffer[$]),y.__webglDepthbuffer[$]===void 0)y.__webglDepthbuffer[$]=r.createRenderbuffer(),Ge(y.__webglDepthbuffer[$],T,!1);else{const K=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,W=y.__webglDepthbuffer[$];r.bindRenderbuffer(r.RENDERBUFFER,W),r.framebufferRenderbuffer(r.FRAMEBUFFER,K,r.RENDERBUFFER,W)}}else{const $=T.texture.mipmaps;if($&&$.length>0?t.bindFramebuffer(r.FRAMEBUFFER,y.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,y.__webglFramebuffer),y.__webglDepthbuffer===void 0)y.__webglDepthbuffer=r.createRenderbuffer(),Ge(y.__webglDepthbuffer,T,!1);else{const K=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,W=y.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,W),r.framebufferRenderbuffer(r.FRAMEBUFFER,K,r.RENDERBUFFER,W)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function kt(T,y,O){const $=n.get(T);y!==void 0&&ge($.__webglFramebuffer,T,T.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),O!==void 0&&tt(T)}function Ke(T){const y=T.texture,O=n.get(T),$=n.get(y);T.addEventListener("dispose",M);const K=T.textures,W=T.isWebGLCubeRenderTarget===!0,Me=K.length>1;if(Me||($.__webglTexture===void 0&&($.__webglTexture=r.createTexture()),$.__version=y.version,a.memory.textures++),W){O.__webglFramebuffer=[];for(let oe=0;oe<6;oe++)if(y.mipmaps&&y.mipmaps.length>0){O.__webglFramebuffer[oe]=[];for(let ye=0;ye<y.mipmaps.length;ye++)O.__webglFramebuffer[oe][ye]=r.createFramebuffer()}else O.__webglFramebuffer[oe]=r.createFramebuffer()}else{if(y.mipmaps&&y.mipmaps.length>0){O.__webglFramebuffer=[];for(let oe=0;oe<y.mipmaps.length;oe++)O.__webglFramebuffer[oe]=r.createFramebuffer()}else O.__webglFramebuffer=r.createFramebuffer();if(Me)for(let oe=0,ye=K.length;oe<ye;oe++){const Oe=n.get(K[oe]);Oe.__webglTexture===void 0&&(Oe.__webglTexture=r.createTexture(),a.memory.textures++)}if(T.samples>0&&Gt(T)===!1){O.__webglMultisampledFramebuffer=r.createFramebuffer(),O.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,O.__webglMultisampledFramebuffer);for(let oe=0;oe<K.length;oe++){const ye=K[oe];O.__webglColorRenderbuffer[oe]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,O.__webglColorRenderbuffer[oe]);const Oe=s.convert(ye.format,ye.colorSpace),ie=s.convert(ye.type),le=_(ye.internalFormat,Oe,ie,ye.colorSpace,T.isXRRenderTarget===!0),Ee=D(T);r.renderbufferStorageMultisample(r.RENDERBUFFER,Ee,le,T.width,T.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+oe,r.RENDERBUFFER,O.__webglColorRenderbuffer[oe])}r.bindRenderbuffer(r.RENDERBUFFER,null),T.depthBuffer&&(O.__webglDepthRenderbuffer=r.createRenderbuffer(),Ge(O.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(W){t.bindTexture(r.TEXTURE_CUBE_MAP,$.__webglTexture),re(r.TEXTURE_CUBE_MAP,y);for(let oe=0;oe<6;oe++)if(y.mipmaps&&y.mipmaps.length>0)for(let ye=0;ye<y.mipmaps.length;ye++)ge(O.__webglFramebuffer[oe][ye],T,y,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,ye);else ge(O.__webglFramebuffer[oe],T,y,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0);m(y)&&A(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Me){for(let oe=0,ye=K.length;oe<ye;oe++){const Oe=K[oe],ie=n.get(Oe);let le=r.TEXTURE_2D;(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(le=T.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(le,ie.__webglTexture),re(le,Oe),ge(O.__webglFramebuffer,T,Oe,r.COLOR_ATTACHMENT0+oe,le,0),m(Oe)&&A(le)}t.unbindTexture()}else{let oe=r.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(oe=T.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(oe,$.__webglTexture),re(oe,y),y.mipmaps&&y.mipmaps.length>0)for(let ye=0;ye<y.mipmaps.length;ye++)ge(O.__webglFramebuffer[ye],T,y,r.COLOR_ATTACHMENT0,oe,ye);else ge(O.__webglFramebuffer,T,y,r.COLOR_ATTACHMENT0,oe,0);m(y)&&A(oe),t.unbindTexture()}T.depthBuffer&&tt(T)}function it(T){const y=T.textures;for(let O=0,$=y.length;O<$;O++){const K=y[O];if(m(K)){const W=x(T),Me=n.get(K).__webglTexture;t.bindTexture(W,Me),A(W),t.unbindTexture()}}}const gt=[],$e=[];function Qt(T){if(T.samples>0){if(Gt(T)===!1){const y=T.textures,O=T.width,$=T.height;let K=r.COLOR_BUFFER_BIT;const W=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Me=n.get(T),oe=y.length>1;if(oe)for(let Oe=0;Oe<y.length;Oe++)t.bindFramebuffer(r.FRAMEBUFFER,Me.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Oe,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Me.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Oe,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Me.__webglMultisampledFramebuffer);const ye=T.texture.mipmaps;ye&&ye.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Me.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Me.__webglFramebuffer);for(let Oe=0;Oe<y.length;Oe++){if(T.resolveDepthBuffer&&(T.depthBuffer&&(K|=r.DEPTH_BUFFER_BIT),T.stencilBuffer&&T.resolveStencilBuffer&&(K|=r.STENCIL_BUFFER_BIT)),oe){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Me.__webglColorRenderbuffer[Oe]);const ie=n.get(y[Oe]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,ie,0)}r.blitFramebuffer(0,0,O,$,0,0,O,$,K,r.NEAREST),c===!0&&(gt.length=0,$e.length=0,gt.push(r.COLOR_ATTACHMENT0+Oe),T.depthBuffer&&T.resolveDepthBuffer===!1&&(gt.push(W),$e.push(W),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,$e)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,gt))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),oe)for(let Oe=0;Oe<y.length;Oe++){t.bindFramebuffer(r.FRAMEBUFFER,Me.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Oe,r.RENDERBUFFER,Me.__webglColorRenderbuffer[Oe]);const ie=n.get(y[Oe]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Me.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Oe,r.TEXTURE_2D,ie,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Me.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&c){const y=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[y])}}}function D(T){return Math.min(i.maxSamples,T.samples)}function Gt(T){const y=n.get(T);return T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&y.__useRenderToTexture!==!1}function ct(T){const y=a.render.frame;u.get(T)!==y&&(u.set(T,y),T.update())}function _t(T,y){const O=T.colorSpace,$=T.format,K=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||O!==St&&O!==kn&&(Ze.getTransfer(O)===ft?($!==Tt||K!==Le)&&we("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Fe("WebGLTextures: Unsupported texture color space:",O)),y}function Se(T){return typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement?(l.width=T.naturalWidth||T.width,l.height=T.naturalHeight||T.height):typeof VideoFrame<"u"&&T instanceof VideoFrame?(l.width=T.displayWidth,l.height=T.displayHeight):(l.width=T.width,l.height=T.height),l}this.allocateTextureUnit=F,this.resetTextureUnits=N,this.setTexture2D=Q,this.setTexture2DArray=U,this.setTexture3D=G,this.setTextureCube=q,this.rebindTextures=kt,this.setupRenderTarget=Ke,this.updateRenderTargetMipmap=it,this.updateMultisampleRenderTarget=Qt,this.setupDepthRenderbuffer=tt,this.setupFrameBufferTexture=ge,this.useMultisampledRTT=Gt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function XM(r,e){function t(n,i=kn){let s;const a=Ze.getTransfer(i);if(n===Le)return r.UNSIGNED_BYTE;if(n===ff)return r.UNSIGNED_SHORT_4_4_4_4;if(n===pf)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Pl)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Nl)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===uf)return r.BYTE;if(n===df)return r.SHORT;if(n===fo)return r.UNSIGNED_SHORT;if(n===Fl)return r.INT;if(n===ii)return r.UNSIGNED_INT;if(n===Nt)return r.FLOAT;if(n===It)return r.HALF_FLOAT;if(n===m0)return r.ALPHA;if(n===Ao)return r.RGB;if(n===Tt)return r.RGBA;if(n===Vi)return r.DEPTH_COMPONENT;if(n===Os)return r.DEPTH_STENCIL;if(n===as)return r.RED;if(n===Af)return r.RED_INTEGER;if(n===Jn)return r.RG;if(n===mf)return r.RG_INTEGER;if(n===gf)return r.RGBA_INTEGER;if(n===Or||n===Hs||n===kr||n===so)if(a===ft)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Or)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===kr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===so)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Or)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hs)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===kr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===so)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===nl||n===fd||n===jr||n===mo)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===nl)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===fd)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===jr)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===mo)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===il||n===go||n===xo||n===sl||n===rl||n===al||n===ol)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===il||n===go)return a===ft?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===xo)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===sl)return s.COMPRESSED_R11_EAC;if(n===rl)return s.COMPRESSED_SIGNED_R11_EAC;if(n===al)return s.COMPRESSED_RG11_EAC;if(n===ol)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===zs||n===pd||n===Ad||n===md||n===Qr||n===gd||n===xd||n===bd||n===_d||n===vd||n===Ed||n===yd||n===Sd||n===Cd)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===zs)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===pd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ad)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===md)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Qr)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===gd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===xd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===bd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===_d)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===vd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ed)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===yd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Sd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Cd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Kr||n===Id||n===cl)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Kr)return a===ft?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Id)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===cl)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===ll||n===hl||n===ul||n===dl)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===ll)return s.COMPRESSED_RED_RGTC1_EXT;if(n===hl)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===ul)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===dl)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===po?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const $M=` 3989void main() { 3990 3991 gl_Position = vec4( position, 1.0 ); 3992 3993}`,YM=` 3994uniform sampler2DArray depthColor; 3995uniform float depthWidth; 3996uniform float depthHeight; 3997 3998void main() { 3999 4000 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 4001 4002 if ( coord.x >= 1.0 ) { 4003 4004 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 4005 4006 } else { 4007 4008 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 4009 4010 } 4011 4012}`;class jM{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new L0(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new _n({vertexShader:$M,fragmentShader:YM,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new ot(new si(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class KM extends ri{constructor(e,t){super();const n=this;let i=null,s=1,a=null,o="local-floor",c=1,l=null,u=null,h=null,d=null,f=null,p=null;const g=typeof XRWebGLBinding<"u",m=new jM,A={},x=t.getContextAttributes();let _=null,b=null;const v=[],C=[],M=new pe;let w=null;const E=new tn;E.viewport=new Mt;const S=new tn;S.viewport=new Mt;const R=[E,S],N=new XE;let F=null,P=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(X){let ee=v[X];return ee===void 0&&(ee=new xh,v[X]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(X){let ee=v[X];return ee===void 0&&(ee=new xh,v[X]=ee),ee.getGripSpace()},this.getHand=function(X){let ee=v[X];return ee===void 0&&(ee=new xh,v[X]=ee),ee.getHandSpace()};function Q(X){const ee=C.indexOf(X.inputSource);if(ee===-1)return;const ge=v[ee];ge!==void 0&&(ge.update(X.inputSource,X.frame,l||a),ge.dispatchEvent({type:X.type,data:X.inputSource}))}function U(){i.removeEventListener("select",Q),i.removeEventListener("selectstart",Q),i.removeEventListener("selectend",Q),i.removeEventListener("squeeze",Q),i.removeEventListener("squeezestart",Q),i.removeEventListener("squeezeend",Q),i.removeEventListener("end",U),i.removeEventListener("inputsourceschange",G);for(let X=0;X<v.length;X++){const ee=C[X];ee!==null&&(C[X]=null,v[X].disconnect(ee))}F=null,P=null,m.reset();for(const X in A)delete A[X];e.setRenderTarget(_),f=null,d=null,h=null,i=null,b=null,ze.stop(),n.isPresenting=!1,e.setPixelRatio(w),e.setSize(M.width,M.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(X){s=X,n.isPresenting===!0&&we("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(X){o=X,n.isPresenting===!0&&we("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(X){l=X},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return h===null&&g&&(h=new XRWebGLBinding(i,t)),h},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(X){if(i=X,i!==null){if(_=e.getRenderTarget(),i.addEventListener("select",Q),i.addEventListener("selectstart",Q),i.addEventListener("selectend",Q),i.addEventListener("squeeze",Q),i.addEventListener("squeezestart",Q),i.addEventListener("squeezeend",Q),i.addEventListener("end",U),i.addEventListener("inputsourceschange",G),x.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(M),g&&"createProjectionLayer"in XRWebGLBinding.prototype){let ge=null,Ge=null,_e=null;x.depth&&(_e=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ge=x.stencil?Os:Vi,Ge=x.stencil?po:ii);const tt={colorFormat:t.RGBA8,depthFormat:_e,scaleFactor:s};h=this.getBinding(),d=h.createProjectionLayer(tt),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),b=new bn(d.textureWidth,d.textureHeight,{format:Tt,type:Le,depthTexture:new yo(d.textureWidth,d.textureHeight,Ge,void 0,void 0,void 0,void 0,void 0,void 0,ge),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const ge={antialias:x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,ge),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),b=new bn(f.framebufferWidth,f.framebufferHeight,{format:Tt,type:Le,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await i.requestReferenceSpace(o),ze.setContext(i),ze.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function G(X){for(let ee=0;ee<X.removed.length;ee++){const ge=X.removed[ee],Ge=C.indexOf(ge);Ge>=0&&(C[Ge]=null,v[Ge].disconnect(ge))}for(let ee=0;ee<X.added.length;ee++){const ge=X.added[ee];let Ge=C.indexOf(ge);if(Ge===-1){for(let tt=0;tt<v.length;tt++)if(tt>=C.length){C.push(ge),Ge=tt;break}else if(C[tt]===null){C[tt]=ge,Ge=tt;break}if(Ge===-1)break}const _e=v[Ge];_e&&_e.connect(ge)}}const q=new B,J=new B;function Z(X,ee,ge){q.setFromMatrixPosition(ee.matrixWorld),J.setFromMatrixPosition(ge.matrixWorld);const Ge=q.distanceTo(J),_e=ee.projectionMatrix.elements,tt=ge.projectionMatrix.elements,kt=_e[14]/(_e[10]-1),Ke=_e[14]/(_e[10]+1),it=(_e[9]+1)/_e[5],gt=(_e[9]-1)/_e[5],$e=(_e[8]-1)/_e[0],Qt=(tt[8]+1)/tt[0],D=kt*$e,Gt=kt*Qt,ct=Ge/(-$e+Qt),_t=ct*-$e;if(ee.matrixWorld.decompose(X.position,X.quaternion,X.scale),X.translateX(_t),X.translateZ(ct),X.matrixWorld.compose(X.position,X.quaternion,X.scale),X.matrixWorldInverse.copy(X.matrixWorld).invert(),_e[10]===-1)X.projectionMatrix.copy(ee.projectionMatrix),X.projectionMatrixInverse.copy(ee.projectionMatrixInverse);else{const Se=kt+ct,T=Ke+ct,y=D-_t,O=Gt+(Ge-_t),$=it*Ke/T*Se,K=gt*Ke/T*Se;X.projectionMatrix.makePerspective(y,O,$,K,Se,T),X.projectionMatrixInverse.copy(X.projectionMatrix).invert()}}function Y(X,ee){ee===null?X.matrixWorld.copy(X.matrix):X.matrixWorld.multiplyMatrices(ee.matrixWorld,X.matrix),X.matrixWorldInverse.copy(X.matrixWorld).invert()}this.updateCamera=function(X){if(i===null)return;let ee=X.near,ge=X.far;m.texture!==null&&(m.depthNear>0&&(ee=m.depthNear),m.depthFar>0&&(ge=m.depthFar)),N.near=S.near=E.near=ee,N.far=S.far=E.far=ge,(F!==N.near||P!==N.far)&&(i.updateRenderState({depthNear:N.near,depthFar:N.far}),F=N.near,P=N.far),N.layers.mask=X.layers.mask|6,E.layers.mask=N.layers.mask&3,S.layers.mask=N.layers.mask&5;const Ge=X.parent,_e=N.cameras;Y(N,Ge);for(let tt=0;tt<_e.length;tt++)Y(_e[tt],Ge);_e.length===2?Z(N,E,S):N.projectionMatrix.copy(E.projectionMatrix),re(X,N,Ge)};function re(X,ee,ge){ge===null?X.matrix.copy(ee.matrixWorld):(X.matrix.copy(ge.matrixWorld),X.matrix.invert(),X.matrix.multiply(ee.matrixWorld)),X.matrix.decompose(X.position,X.quaternion,X.scale),X.updateMatrixWorld(!0),X.projectionMatrix.copy(ee.projectionMatrix),X.projectionMatrixInverse.copy(ee.projectionMatrixInverse),X.isPerspectiveCamera&&(X.fov=ea*2*Math.atan(1/X.projectionMatrix.elements[5]),X.zoom=1)}this.getCamera=function(){return N},this.getFoveation=function(){if(!(d===null&&f===null))return c},this.setFoveation=function(X){c=X,d!==null&&(d.fixedFoveation=X),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=X)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(N)},this.getCameraTexture=function(X){return A[X]};let Ae=null;function He(X,ee){if(u=ee.getViewerPose(l||a),p=ee,u!==null){const ge=u.views;f!==null&&(e.setRenderTargetFramebuffer(b,f.framebuffer),e.setRenderTarget(b));let Ge=!1;ge.length!==N.cameras.length&&(N.cameras.length=0,Ge=!0);for(let Ke=0;Ke<ge.length;Ke++){const it=ge[Ke];let gt=null;if(f!==null)gt=f.getViewport(it);else{const Qt=h.getViewSubImage(d,it);gt=Qt.viewport,Ke===0&&(e.setRenderTargetTextures(b,Qt.colorTexture,Qt.depthStencilTexture),e.setRenderTarget(b))}let $e=R[Ke];$e===void 0&&($e=new tn,$e.layers.enable(Ke),$e.viewport=new Mt,R[Ke]=$e),$e.matrix.fromArray(it.transform.matrix),$e.matrix.decompose($e.position,$e.quaternion,$e.scale),$e.projectionMatrix.fromArray(it.projectionMatrix),$e.projectionMatrixInverse.copy($e.projectionMatrix).invert(),$e.viewport.set(gt.x,gt.y,gt.width,gt.height),Ke===0&&(N.matrix.copy($e.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale)),Ge===!0&&N.cameras.push($e)}const _e=i.enabledFeatures;if(_e&&_e.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&g){h=n.getBinding();const Ke=h.getDepthInformation(ge[0]);Ke&&Ke.isValid&&Ke.texture&&m.init(Ke,i.renderState)}if(_e&&_e.includes("camera-access")&&g){e.state.unbindTexture(),h=n.getBinding();for(let Ke=0;Ke<ge.length;Ke++){const it=ge[Ke].camera;if(it){let gt=A[it];gt||(gt=new L0,A[it]=gt);const $e=h.getCameraImage(it);gt.sourceTexture=$e}}}}for(let ge=0;ge<v.length;ge++){const Ge=C[ge],_e=v[ge];
vendor: 2,970 bytes, line 4012
4012Ge!==null&&_e!==void 0&&_e.update(Ge,ee,l||a)}Ae&&Ae(X,ee),ee.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ee}),p=null}const ze=new K0;ze.setAnimationLoop(He),this.setAnimationLoop=function(X){Ae=X},this.dispose=function(){}}}const _s=new Vn,JM=new Ue;function ZM(r,e){function t(m,A){m.matrixAutoUpdate===!0&&m.updateMatrix(),A.value.copy(m.matrix)}function n(m,A){A.color.getRGB(m.fogColor.value,I0(r)),A.isFog?(m.fogNear.value=A.near,m.fogFar.value=A.far):A.isFogExp2&&(m.fogDensity.value=A.density)}function i(m,A,x,_,b){A.isMeshBasicMaterial||A.isMeshLambertMaterial?s(m,A):A.isMeshToonMaterial?(s(m,A),h(m,A)):A.isMeshPhongMaterial?(s(m,A),u(m,A)):A.isMeshStandardMaterial?(s(m,A),d(m,A),A.isMeshPhysicalMaterial&&f(m,A,b)):A.isMeshMatcapMaterial?(s(m,A),p(m,A)):A.isMeshDepthMaterial?s(m,A):A.isMeshDistanceMaterial?(s(m,A),g(m,A)):A.isMeshNormalMaterial?s(m,A):A.isLineBasicMaterial?(a(m,A),A.isLineDashedMaterial&&o(m,A)):A.isPointsMaterial?c(m,A,x,_):A.isSpriteMaterial?l(m,A):A.isShadowMaterial?(m.color.value.copy(A.color),m.opacity.value=A.opacity):A.isShaderMaterial&&(A.uniformsNeedUpdate=!1)}function s(m,A){m.opacity.value=A.opacity,A.color&&m.diffuse.value.copy(A.color),A.emissive&&m.emissive.value.copy(A.emissive).multiplyScalar(A.emissiveIntensity),A.map&&(m.map.value=A.map,t(A.map,m.mapTransform)),A.alphaMap&&(m.alphaMap.value=A.alphaMap,t(A.alphaMap,m.alphaMapTransform)),A.bumpMap&&(m.bumpMap.value=A.bumpMap,t(A.bumpMap,m.bumpMapTransform),m.bumpScale.value=A.bumpScale,A.side===nn&&(m.bumpScale.value*=-1)),A.normalMap&&(m.normalMap.value=A.normalMap,t(A.normalMap,m.normalMapTransform),m.normalScale.value.copy(A.normalScale),A.side===nn&&m.normalScale.value.negate()),A.displacementMap&&(m.displacementMap.value=A.displacementMap,t(A.displacementMap,m.displacementMapTransform),m.displacementScale.value=A.displacementScale,m.displacementBias.value=A.displacementBias),A.emissiveMap&&(m.emissiveMap.value=A.emissiveMap,t(A.emissiveMap,m.emissiveMapTransform)),A.specularMap&&(m.specularMap.value=A.specularMap,t(A.specularMap,m.specularMapTransform)),A.alphaTest>0&&(m.alphaTest.value=A.alphaTest);const x=e.get(A),_=x.envMap,b=x.envMapRotation;_&&(m.envMap.value=_,_s.copy(b),_s.x*=-1,_s.y*=-1,_s.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(_s.y*=-1,_s.z*=-1),m.envMapRotation.value.setFromMatrix4(JM.makeRotationFromEuler(_s)),m.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=A.reflectivity,m.ior.value=A.ior,m.refractionRatio.value=A.refractionRatio),A.lightMap&&(m.lightMap.value=A.lightMap,m.lightMapIntensity.value=A.lightMapIntensity,t(A.lightMap,m.lightMapTransform)),A.aoMap&&(m.aoMap.value=A.aoMap,m.aoMapIntensity.value=A.aoMapIntensity,t(A.aoMap,m.aoMapTransform))}function a(m,A){m.diffuse.value.copy(A.color),m.opacity.value=A.opacity,A.map&&(m.map.value=A.map,t(A.map,m.mapTransform))}function o(m,A){m.dashSize.value=A.dashSize,m.totalSize.value=A.dashSize
vendor: 58,260 bytes, lines 4012-4029
4012+A.gapSize,m.scale.value=A.scale}function c(m,A,x,_){m.diffuse.value.copy(A.color),m.opacity.value=A.opacity,m.size.value=A.size*x,m.scale.value=_*.5,A.map&&(m.map.value=A.map,t(A.map,m.uvTransform)),A.alphaMap&&(m.alphaMap.value=A.alphaMap,t(A.alphaMap,m.alphaMapTransform)),A.alphaTest>0&&(m.alphaTest.value=A.alphaTest)}function l(m,A){m.diffuse.value.copy(A.color),m.opacity.value=A.opacity,m.rotation.value=A.rotation,A.map&&(m.map.value=A.map,t(A.map,m.mapTransform)),A.alphaMap&&(m.alphaMap.value=A.alphaMap,t(A.alphaMap,m.alphaMapTransform)),A.alphaTest>0&&(m.alphaTest.value=A.alphaTest)}function u(m,A){m.specular.value.copy(A.specular),m.shininess.value=Math.max(A.shininess,1e-4)}function h(m,A){A.gradientMap&&(m.gradientMap.value=A.gradientMap)}function d(m,A){m.metalness.value=A.metalness,A.metalnessMap&&(m.metalnessMap.value=A.metalnessMap,t(A.metalnessMap,m.metalnessMapTransform)),m.roughness.value=A.roughness,A.roughnessMap&&(m.roughnessMap.value=A.roughnessMap,t(A.roughnessMap,m.roughnessMapTransform)),A.envMap&&(m.envMapIntensity.value=A.envMapIntensity)}function f(m,A,x){m.ior.value=A.ior,A.sheen>0&&(m.sheenColor.value.copy(A.sheenColor).multiplyScalar(A.sheen),m.sheenRoughness.value=A.sheenRoughness,A.sheenColorMap&&(m.sheenColorMap.value=A.sheenColorMap,t(A.sheenColorMap,m.sheenColorMapTransform)),A.sheenRoughnessMap&&(m.sheenRoughnessMap.value=A.sheenRoughnessMap,t(A.sheenRoughnessMap,m.sheenRoughnessMapTransform))),A.clearcoat>0&&(m.clearcoat.value=A.clearcoat,m.clearcoatRoughness.value=A.clearcoatRoughness,A.clearcoatMap&&(m.clearcoatMap.value=A.clearcoatMap,t(A.clearcoatMap,m.clearcoatMapTransform)),A.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=A.clearcoatRoughnessMap,t(A.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),A.clearcoatNormalMap&&(m.clearcoatNormalMap.value=A.clearcoatNormalMap,t(A.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(A.clearcoatNormalScale),A.side===nn&&m.clearcoatNormalScale.value.negate())),A.dispersion>0&&(m.dispersion.value=A.dispersion),A.iridescence>0&&(m.iridescence.value=A.iridescence,m.iridescenceIOR.value=A.iridescenceIOR,m.iridescenceThicknessMinimum.value=A.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=A.iridescenceThicknessRange[1],A.iridescenceMap&&(m.iridescenceMap.value=A.iridescenceMap,t(A.iridescenceMap,m.iridescenceMapTransform)),A.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=A.iridescenceThicknessMap,t(A.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),A.transmission>0&&(m.transmission.value=A.transmission,m.transmissionSamplerMap.value=x.texture,m.transmissionSamplerSize.value.set(x.width,x.height),A.transmissionMap&&(m.transmissionMap.value=A.transmissionMap,t(A.transmissionMap,m.transmissionMapTransform)),m.thickness.value=A.thickness,A.thicknessMap&&(m.thicknessMap.value=A.thicknessMap,t(A.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=A.attenuationDistance,m.attenuationColor.value.copy(A.attenuationColor)),A.anisotropy>0&&(m.anisotropyVector.value.set(A.anisotropy*Math.cos(A.anisotropyRotation),A.anisotropy*Math.sin(A.anisotropyRotation)),A.anisotropyMap&&(m.anisotropyMap.value=A.anisotropyMap,t(A.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=A.specularIntensity,m.specularColor.value.copy(A.specularColor),A.specularColorMap&&(m.specularColorMap.value=A.specularColorMap,t(A.specularColorMap,m.specularColorMapTransform)),A.specularIntensityMap&&(m.specularIntensityMap.value=A.specularIntensityMap,t(A.specularIntensityMap,m.specularIntensityMapTransform))}function p(m,A){A.matcap&&(m.matcap.value=A.matcap)}function g(m,A){const x=e.get(A).light;m.referencePosition.value.setFromMatrixPosition(x.matrixWorld),m.nearDistance.value=x.shadow.camera.near,m.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function ew(r,e,t,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function c(x,_){const b=_.program;n.uniformBlockBinding(x,b)}function l(x,_){let b=i[x.id];b===void 0&&(p(x),b=u(x),i[x.id]=b,x.addEventListener("dispose",m));const v=_.program;n.updateUBOMapping(x,v);const C=e.render.frame;s[x.id]!==C&&(d(x),s[x.id]=C)}function u(x){const _=h();x.__bindingPointIndex=_;const b=r.createBuffer(),v=x.__size,C=x.usage;return r.bindBuffer(r.UNIFORM_BUFFER,b),r.bufferData(r.UNIFORM_BUFFER,v,C),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,_,b),b}function h(){for(let x=0;x<o;x++)if(a.indexOf(x)===-1)return a.push(x),x;return Fe("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(x){const _=i[x.id],b=x.uniforms,v=x.__cache;r.bindBuffer(r.UNIFORM_BUFFER,_);for(let C=0,M=b.length;C<M;C++){const w=Array.isArray(b[C])?b[C]:[b[C]];for(let E=0,S=w.length;E<S;E++){const R=w[E];if(f(R,C,E,v)===!0){const N=R.__offset,F=Array.isArray(R.value)?R.value:[R.value];let P=0;for(let Q=0;Q<F.length;Q++){const U=F[Q],G=g(U);typeof U=="number"||typeof U=="boolean"?(R.__data[0]=U,r.bufferSubData(r.UNIFORM_BUFFER,N+P,R.__data)):U.isMatrix3?(R.__data[0]=U.elements[0],R.__data[1]=U.elements[1],R.__data[2]=U.elements[2],R.__data[3]=0,R.__data[4]=U.elements[3],R.__data[5]=U.elements[4],R.__data[6]=U.elements[5],R.__data[7]=0,R.__data[8]=U.elements[6],R.__data[9]=U.elements[7],R.__data[10]=U.elements[8],R.__data[11]=0):(U.toArray(R.__data,P),P+=G.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,N,R.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(x,_,b,v){const C=x.value,M=_+"_"+b;if(v[M]===void 0)return typeof C=="number"||typeof C=="boolean"?v[M]=C:v[M]=C.clone(),!0;{const w=v[M];if(typeof C=="number"||typeof C=="boolean"){if(w!==C)return v[M]=C,!0}else if(w.equals(C)===!1)return w.copy(C),!0}return!1}function p(x){const _=x.uniforms;let b=0;const v=16;for(let M=0,w=_.length;M<w;M++){const E=Array.isArray(_[M])?_[M]:[_[M]];for(let S=0,R=E.length;S<R;S++){const N=E[S],F=Array.isArray(N.value)?N.value:[N.value];for(let P=0,Q=F.length;P<Q;P++){const U=F[P],G=g(U),q=b%v,J=q%G.boundary,Z=q+J;b+=J,Z!==0&&v-Z<G.storage&&(b+=v-Z),N.__data=new Float32Array(G.storage/Float32Array.BYTES_PER_ELEMENT),N.__offset=b,b+=G.storage}}}const C=b%v;return C>0&&(b+=v-C),x.__size=b,x.__cache={},this}function g(x){const _={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(_.boundary=4,_.storage=4):x.isVector2?(_.boundary=8,_.storage=8):x.isVector3||x.isColor?(_.boundary=16,_.storage=12):x.isVector4?(_.boundary=16,_.storage=16):x.isMatrix3?(_.boundary=48,_.storage=48):x.isMatrix4?(_.boundary=64,_.storage=64):x.isTexture?we("WebGLRenderer: Texture samplers can not be part of an uniforms group."):we("WebGLRenderer: Unsupported uniform value type.",x),_}function m(x){const _=x.target;_.removeEventListener("dispose",m);const b=a.indexOf(_.__bindingPointIndex);a.splice(b,1),r.deleteBuffer(i[_.id]),delete i[_.id],delete s[_.id]}function A(){for(const x in i)r.deleteBuffer(i[x]);a=[],i={},s={}}return{bind:c,update:l,dispose:A}}const tw=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]);let ci=null;function nw(){return ci===null&&(ci=new ha(tw,16,16,Jn,It),ci.name="DFG_LUT",ci.minFilter=We,ci.magFilter=We,ci.wrapS=Lt,ci.wrapT=Lt,ci.generateMipmaps=!1,ci.needsUpdate=!0),ci}class nx{constructor(e={}){const{canvas:t=$_(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:d=!1,outputBufferType:f=Le}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=a;const g=f,m=new Set([gf,mf,Af]),A=new Set([Le,ii,fo,po,ff,pf]),x=new Uint32Array(4),_=new Int32Array(4);let b=null,v=null;const C=[],M=[];let w=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Hn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const E=this;let S=!1;this._outputColorSpace=bt;let R=0,N=0,F=null,P=-1,Q=null;const U=new Mt,G=new Mt;let q=null;const J=new Ie(0);let Z=0,Y=t.width,re=t.height,Ae=1,He=null,ze=null;const X=new Mt(0,0,Y,re),ee=new Mt(0,0,Y,re);let ge=!1;const Ge=new Sf;let _e=!1,tt=!1;const kt=new Ue,Ke=new B,it=new Mt,gt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let $e=!1;function Qt(){return F===null?Ae:1}let D=n;function Gt(I,k){return t.getContext(I,k)}try{const I={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Dl}`),t.addEventListener("webglcontextlost",ke,!1),t.addEventListener("webglcontextrestored",vt,!1),t.addEventListener("webglcontextcreationerror",ht,!1),D===null){const k="webgl2";if(D=Gt(k,I),D===null)throw Gt(k)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(I){throw Fe("WebGLRenderer: "+I.message),I}let ct,_t,Se,T,y,O,$,K,W,Me,oe,ye,Oe,ie,le,Ee,Ce,ce,Ye,L,fe,se,me,ne;function j(){ct=new nI(D),ct.init(),se=new XM(D,ct),_t=new XC(D,ct,e,se),Se=new WM(D,ct),_t.reversedDepthBuffer&&d&&Se.buffers.depth.setReversed(!0),T=new rI(D),y=new RM,O=new qM(D,ct,Se,y,_t,se,T),$=new YC(E),K=new tI(E),W=new ly(D),me=new WC(D,W),Me=new iI(D,W,T,me),oe=new oI(D,Me,W,T),Ye=new aI(D,_t,O),Ee=new $C(y),ye=new TM(E,$,K,ct,_t,me,Ee),Oe=new ZM(E,y),ie=new DM,le=new OM(ct),ce=new VC(E,$,K,Se,oe,p,c),Ce=new zM(E,oe,_t),ne=new ew(D,T,_t,Se),L=new qC(D,ct,T),fe=new sI(D,ct,T),T.programs=ye.programs,E.capabilities=_t,E.extensions=ct,E.properties=y,E.renderLists=ie,E.shadowMap=Ce,E.state=Se,E.info=T}j(),g!==Le&&(w=new lI(g,t.width,t.height,i,s));const ae=new KM(E,D);this.xr=ae,this.getContext=function(){return D},this.getContextAttributes=function(){return D.getContextAttributes()},this.forceContextLoss=function(){const I=ct.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){const I=ct.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return Ae},this.setPixelRatio=function(I){I!==void 0&&(Ae=I,this.setSize(Y,re,!1))},this.getSize=function(I){return I.set(Y,re)},this.setSize=function(I,k,V=!0){if(ae.isPresenting){we("WebGLRenderer: Can't change size while VR device is presenting.");return}Y=I,re=k,t.width=Math.floor(I*Ae),t.height=Math.floor(k*Ae),V===!0&&(t.style.width=I+"px",t.style.height=k+"px"),w!==null&&w.setSize(t.width,t.height),this.setViewport(0,0,I,k)},this.getDrawingBufferSize=function(I){return I.set(Y*Ae,re*Ae).floor()},this.setDrawingBufferSize=function(I,k,V){Y=I,re=k,Ae=V,t.width=Math.floor(I*V),t.height=Math.floor(k*V),this.setViewport(0,0,I,k)},this.setEffects=function(I){if(g===Le){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(I){for(let k=0;k<I.length;k++)if(I[k].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}w.setEffects(I||[])},this.getCurrentViewport=function(I){return I.copy(U)},this.getViewport=function(I){return I.copy(X)},this.setViewport=function(I,k,V,z){I.isVector4?X.set(I.x,I.y,I.z,I.w):X.set(I,k,V,z),Se.viewport(U.copy(X).multiplyScalar(Ae).round())},this.getScissor=function(I){return I.copy(ee)},this.setScissor=function(I,k,V,z){I.isVector4?ee.set(I.x,I.y,I.z,I.w):ee.set(I,k,V,z),Se.scissor(G.copy(ee).multiplyScalar(Ae).round())},this.getScissorTest=function(){return ge},this.setScissorTest=function(I){Se.setScissorTest(ge=I)},this.setOpaqueSort=function(I){He=I},this.setTransparentSort=function(I){ze=I},this.getClearColor=function(I){return I.copy(ce.getClearColor())},this.setClearColor=function(){ce.setClearColor(...arguments)},this.getClearAlpha=function(){return ce.getClearAlpha()},this.setClearAlpha=function(){ce.setClearAlpha(...arguments)},this.clear=function(I=!0,k=!0,V=!0){let z=0;if(I){let H=!1;if(F!==null){const he=F.texture.format;H=m.has(he)}if(H){const he=F.texture.type,xe=A.has(he),de=ce.getClearColor(),ve=ce.getClearAlpha(),Te=de.r,Pe=de.g,Re=de.b;xe?(x[0]=Te,x[1]=Pe,x[2]=Re,x[3]=ve,D.clearBufferuiv(D.COLOR,0,x)):(_[0]=Te,_[1]=Pe,_[2]=Re,_[3]=ve,D.clearBufferiv(D.COLOR,0,_))}else z|=D.COLOR_BUFFER_BIT}k&&(z|=D.DEPTH_BUFFER_BIT),V&&(z|=D.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),D.clear(z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ke,!1),t.removeEventListener("webglcontextrestored",vt,!1),t.removeEventListener("webglcontextcreationerror",ht,!1),ce.dispose(),ie.dispose(),le.dispose(),y.dispose(),$.dispose(),K.dispose(),oe.dispose(),me.dispose(),ne.dispose(),ye.dispose(),ae.dispose(),ae.removeEventListener("sessionstart",Gf),ae.removeEventListener("sessionend",Hf),fs.stop()};function ke(I){I.preventDefault(),gl("WebGLRenderer: Context Lost."),S=!0}function vt(){gl("WebGLRenderer: Context Restored."),S=!1;const I=T.autoReset,k=Ce.enabled,V=Ce.autoUpdate,z=Ce.needsUpdate,H=Ce.type;j(),T.autoReset=I,Ce.enabled=k,Ce.autoUpdate=V,Ce.needsUpdate=z,Ce.type=H}function ht(I){Fe("WebGLRenderer: A WebGL context could not be created. Reason: ",I.statusMessage)}function oi(I){const k=I.target;k.removeEventListener("dispose",oi),Ei(k)}function Ei(I){qb(I),y.remove(I)}function qb(I){const k=y.get(I).programs;k!==void 0&&(k.forEach(function(V){ye.releaseProgram(V)}),I.isShaderMaterial&&ye.releaseShaderCache(I))}this.renderBufferDirect=function(I,k,V,z,H,he){k===null&&(k=gt);const xe=H.isMesh&&H.matrixWorld.determinant()<0,de=$b(I,k,V,z,H);Se.setMaterial(z,xe);let ve=V.index,Te=1;if(z.wireframe===!0){if(ve=Me.getWireframeAttribute(V),ve===void 0)return;Te=2}const Pe=V.drawRange,Re=V.attributes.position;let je=Pe.start*Te,At=(Pe.start+Pe.count)*Te;he!==null&&(je=Math.max(je,he.start*Te),At=Math.min(At,(he.start+he.count)*Te)),ve!==null?(je=Math.max(je,0),At=Math.min(At,ve.count)):Re!=null&&(je=Math.max(je,0),At=Math.min(At,Re.count));const Ut=At-je;if(Ut<0||Ut===1/0)return;me.setup(H,z,de,V,ve);let Ot,xt=L;if(ve!==null&&(Ot=W.get(ve),xt=fe,xt.setIndex(Ot)),H.isMesh)z.wireframe===!0?(Se.setLineWidth(z.wireframeLinewidth*Qt()),xt.setMode(D.LINES)):xt.setMode(D.TRIANGLES);else if(H.isLine){let Be=z.linewidth;Be===void 0&&(Be=1),Se.setLineWidth(Be*Qt()),H.isLineSegments?xt.setMode(D.LINES):H.isLineLoop?xt.setMode(D.LINE_LOOP):xt.setMode(D.LINE_STRIP)}else H.isPoints?xt.setMode(D.POINTS):H.isSprite&&xt.setMode(D.TRIANGLES);if(H.isBatchedMesh)if(H._multiDrawInstances!==null)vo("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),xt.renderMultiDrawInstances(H._multiDrawStarts,H._multiDrawCounts,H._multiDrawCount,H._multiDrawInstances);else if(ct.get("WEBGL_multi_draw"))xt.renderMultiDraw(H._multiDrawStarts,H._multiDrawCounts,H._multiDrawCount);else{const Be=H._multiDrawStarts,ut=H._multiDrawCounts,st=H._multiDrawCount,Cn=ve?W.get(ve).bytesPerElement:1,Zs=y.get(z).currentProgram.getUniforms();for(let In=0;In<st;In++)Zs.setValue(D,"_gl_DrawID",In),xt.render(Be[In]/Cn,ut[In])}else if(H.isInstancedMesh)xt.renderInstances(je,Ut,H.count);else if(V.isInstancedBufferGeometry){const Be=V._maxInstanceCount!==void 0?V._maxInstanceCount:1/0,ut=Math.min(V.instanceCount,Be);xt.renderInstances(je,Ut,ut)}else xt.render(je,Ut)};function Qf(I,k,V){I.transparent===!0&&I.side===Vt&&I.forceSinglePass===!1?(I.side=nn,I.needsUpdate=!0,Uo(I,k,V),I.side=ti,I.needsUpdate=!0,Uo(I,k,V),I.side=Vt):Uo(I,k,V)}this.compile=function(I,k,V=null){V===null&&(V=I),v=le.get(V),v.init(k),M.push(v),V.traverseVisible(function(H){H.isLight&&H.layers.test(k.layers)&&(v.pushLight(H),H.castShadow&&v.pushShadow(H))}),I!==V&&I.traverseVisible(function(H){H.isLight&&H.layers.test(k.layers)&&(v.pushLight(H),H.castShadow&&v.pushShadow(H))}),v.setupLights();const z=new Set;return I.traverse(function(H){if(!(H.isMesh||H.isPoints||H.isLine||H.isSprite))return;const he=H.material;if(he)if(Array.isArray(he))for(let xe=0;xe<he.length;xe++){const de=he[xe];Qf(de,V,H),z.add(de)}else Qf(he,V,H),z.add(he)}),v=M.pop(),z},this.compileAsync=function(I,k,V=null){const z=this.compile(I,k,V);return new Promise(H=>{function he(){if(z.forEach(function(xe){y.get(xe).currentProgram.isReady()&&z.delete(xe)}),z.size===0){H(I);return}setTimeout(he,10)}ct.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let $l=null;function Xb(I){$l&&$l(I)}function Gf(){fs.stop()}function Hf(){fs.start()}const fs=new K0;fs.setAnimationLoop(Xb),typeof self<"u"&&fs.setContext(self),this.setAnimationLoop=function(I){$l=I,ae.setAnimationLoop(I),I===null?fs.stop():fs.start()},ae.addEventListener("sessionstart",Gf),ae.addEventListener("sessionend",Hf),this.render=function(I,k){if(k!==void 0&&k.isCamera!==!0){Fe("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(S===!0)return;const V=ae.enabled===!0&&ae.isPresenting===!0,z=w!==null&&(F===null||V)&&w.begin(E,F);if(I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),k.parent===null&&k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),ae.enabled===!0&&ae.isPresenting===!0&&(w===null||w.isCompositing()===!1)&&(ae.cameraAutoUpdate===!0&&ae.updateCamera(k),k=ae.getCamera()),I.isScene===!0&&I.onBeforeRender(E,I,k,F),v=le.get(I,M.length),v.init(k),M.push(v),kt.multiplyMatrices(k.projectionMatrix,k.matrixWorldInverse),Ge.setFromProjectionMatrix(kt,Ai,k.reversedDepth),tt=this.localClippingEnabled,_e=Ee.init(this.clippingPlanes,tt),b=ie.get(I,C.length),b.init(),C.push(b),ae.enabled===!0&&ae.isPresenting===!0){const xe=E.xr.getDepthSensingMesh();xe!==null&&Yl(xe,k,-1/0,E.sortObjects)}Yl(I,k,0,E.sortObjects),b.finish(),E.sortObjects===!0&&b.sort(He,ze),$e=ae.enabled===!1||ae.isPresenting===!1||ae.hasDepthSensing()===!1,$e&&ce.addToRenderList(b,I),this.info.render.frame++,_e===!0&&Ee.beginShadows();const H=v.state.shadowsArray;if(Ce.render(H,I,k),_e===!0&&Ee.endShadows(),this.info.autoReset===!0&&this.info.reset(),(z&&w.hasRenderPass())===!1){const xe=b.opaque,de=b.transmissive;if(v.setupLights(),k.isArrayCamera){const ve=k.cameras;if(de.length>0)for(let Te=0,Pe=ve.length;Te<Pe;Te++){const Re=ve[Te];Vf(xe,de,I,Re)}$e&&ce.render(I);for(let Te=0,Pe=ve.length;Te<Pe;Te++){const Re=ve[Te];zf(b,I,Re,Re.viewport)}}else de.length>0&&Vf(xe,de,I,k),$e&&ce.render(I),zf(b,I,k)}F!==null&&N===0&&(O.updateMultisampleRenderTarget(F),O.updateRenderTargetMipmap(F)),z&&w.end(E),I.isScene===!0&&I.onAfterRender(E,I,k),me.resetDefaultState(),P=-1,Q=null,M.pop(),M.length>0?(v=M[M.length-1],_e===!0&&Ee.setGlobalState(E.clippingPlanes,v.state.camera)):v=null,C.pop(),C.length>0?b=C[C.length-1]:b=null};function Yl(I,k,V,z){if(I.visible===!1)return;if(I.layers.test(k.layers)){if(I.isGroup)V=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(k);else if(I.isLight)v.pushLight(I),I.castShadow&&v.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||Ge.intersectsSprite(I)){z&&it.setFromMatrixPosition(I.matrixWorld).applyMatrix4(kt);const xe=oe.update(I),de=I.material;de.visible&&b.push(I,xe,de,V,it.z,null)}}else if((I.isMesh||I.isLine||I.isPoints)&&(!I.frustumCulled||Ge.intersectsObject(I))){const xe=oe.update(I),de=I.material;if(z&&(I.boundingSphere!==void 0?(I.boundingSphere===null&&I.computeBoundingSphere(),it.copy(I.boundingSphere.center)):(xe.boundingSphere===null&&xe.computeBoundingSphere(),it.copy(xe.boundingSphere.center)),it.applyMatrix4(I.matrixWorld).applyMatrix4(kt)),Array.isArray(de)){const ve=xe.groups;for(let Te=0,Pe=ve.length;Te<Pe;Te++){const Re=ve[Te],je=de[Re.materialIndex];je&&je.visible&&b.push(I,xe,je,V,it.z,Re)}}else de.visible&&b.push(I,xe,de,V,it.z,null)}}const he=I.children;for(let xe=0,de=he.length;xe<de;xe++)Yl(he[xe],k,V,z)}function zf(I,k,V,z){const{opaque:H,transmissive:he,transparent:xe}=I;v.setupLightsView(V),_e===!0&&Ee.setGlobalState(E.clippingPlanes,V),z&&Se.viewport(U.copy(z)),H.length>0&&No(H,k,V),he.length>0&&No(he,k,V),xe.length>0&&No(xe,k,V),Se.buffers.depth.setTest(!0),Se.buffers.depth.setMask(!0),Se.buffers.color.setMask(!0),Se.setPolygonOffset(!1)}function Vf(I,k,V,z){if((V.isScene===!0?V.overrideMaterial:null)!==null)return;if(v.state.transmissionRenderTarget[z.id]===void 0){const je=ct.has("EXT_color_buffer_half_float")||ct.has("EXT_color_buffer_float");v.state.transmissionRenderTarget[z.id]=new bn(1,1,{generateMipmaps:!0,type:je?It:Le,minFilter:gn,samples:_t.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ze.workingColorSpace})}const he=v.state.transmissionRenderTarget[z.id],xe=z.viewport||U;he.setSize(xe.z*E.transmissionResolutionScale,xe.w*E.transmissionResolutionScale);const de=E.getRenderTarget(),ve=E.getActiveCubeFace(),Te=E.getActiveMipmapLevel();E.setRenderTarget(he),E.getClearColor(J),Z=E.getClearAlpha(),Z<1&&E.setClearColor(16777215,.5),E.clear(),$e&&ce.render(V);const Pe=E.toneMapping;E.toneMapping=Hn;const Re=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),v.setupLightsView(z),_e===!0&&Ee.setGlobalState(E.clippingPlanes,z),No(I,V,z),O.updateMultisampleRenderTarget(he),O.updateRenderTargetMipmap(he),ct.has("WEBGL_multisampled_render_to_texture")===!1){let je=!1;for(let At=0,Ut=k.length;At<Ut;At++){const Ot=k[At],{object:xt,geometry:Be,material:ut,group:st}=Ot;if(ut.side===Vt&&xt.layers.test(z.layers)){const Cn=ut.side;ut.side=nn,ut.needsUpdate=!0,Wf(xt,V,z,Be,ut,st),ut.side=Cn,ut.needsUpdate=!0,je=!0}}je===!0&&(O.updateMultisampleRenderTarget(he),O.updateRenderTargetMipmap(he))}E.setRenderTarget(de,ve,Te),E.setClearColor(J,Z),Re!==void 0&&(z.viewport=Re),E.toneMapping=Pe}function No(I,k,V){const z=k.isScene===!0?k.overrideMaterial:null;for(let H=0,he=I.length;H<he;H++){const xe=I[H],{object:de,geometry:ve,group:Te}=xe;let Pe=xe.material;Pe.allowOverride===!0&&z!==null&&(Pe=z),de.layers.test(V.layers)&&Wf(de,k,V,ve,Pe,Te)}}function Wf(I,k,V,z,H,he){I.onBeforeRender(E,k,V,z,H,he),I.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse,I.matrixWorld),I.normalMatrix.getNormalMatrix(I.modelViewMatrix),H.onBeforeRender(E,k,V,z,I,he),H.transparent===!0&&H.side===Vt&&H.forceSinglePass===!1?(H.side=nn,H.needsUpdate=!0,E.renderBufferDirect(V,k,z,H,I,he),H.side=ti,H.needsUpdate=!0,E.renderBufferDirect(V,k,z,H,I,he),H.side=Vt):E.renderBufferDirect(V,k,z,H,I,he),I.onAfterRender(E,k,V,z,H,he)}function Uo(I,k,V){k.isScene!==!0&&(k=gt);const z=y.get(I),H=v.state.lights,he=v.state.shadowsArray,xe=H.state.version,de=ye.getParameters(I,H.state,he,k,V),ve=ye.getProgramCacheKey(de);let Te=z.programs;z.environment=I.isMeshStandardMaterial?k.environment:null,z.fog=k.fog,z.envMap=(I.isMeshStandardMaterial?K:$).get(I.envMap||z.environment),z.envMapRotation=z.environment!==null&&I.envMap===null?k.environmentRotation:I.envMapRotation,Te===void 0&&(I.addEventListener("dispose",oi),Te=new Map,z.programs=Te);let Pe=Te.get(ve);if(Pe!==void 0){if(z.currentProgram===Pe&&z.lightsStateVersion===xe)return Xf(I,de),Pe}else de.uniforms=ye.getUniforms(I),I.onBeforeCompile(de,E),Pe=ye.acquireProgram(de,ve),Te.set(ve,Pe),z.uniforms=de.uniforms;const Re=z.uniforms;return(!I.isShaderMaterial&&!I.isRawShaderMaterial||I.clipping===!0)&&(Re.clippingPlanes=Ee.uniform),Xf(I,de),z.needsLights=jb(I),z.lightsStateVersion=xe,z.needsLights&&(Re.ambientLightColor.value=H.state.ambient,Re.lightProbe.value=H.state.probe,Re.directionalLights.value=H.state.directional,Re.directionalLightShadows.value=H.state.directionalShadow,Re.spotLights.value=H.state.spot,Re.spotLightShadows.value=H.state.spotShadow,Re.rectAreaLights.value=H.state.rectArea,Re.ltc_1.value=H.state.rectAreaLTC1,Re.ltc_2.value=H.state.rectAreaLTC2,Re.pointLights.value=H.state.point,Re.pointLightShadows.value=H.state.pointShadow,Re.hemisphereLights.value=H.state.hemi,Re.directionalShadowMap.value=H.state.directionalShadowMap,Re.directionalShadowMatrix.value=H.state.directionalShadowMatrix,Re.spotShadowMap.value=H.state.spotShadowMap,Re.spotLightMatrix.value=H.state.spotLightMatrix,Re.spotLightMap.value=H.state.spotLightMap,Re.pointShadowMap.value=H.state.pointShadowMap,Re.pointShadowMatrix.value=H.state.pointShadowMatrix),z.currentProgram=Pe,z.uniformsList=null,Pe}function qf(I){if(I.uniformsList===null){const k=I.currentProgram.getUniforms();I.uniformsList=qc.seqWithValue(k.seq,I.uniforms)}return I.uniformsList}function Xf(I,k){const V=y.get(I);V.outputColorSpace=k.outputColorSpace,V.batching=k.batching,V.batchingColor=k.batchingColor,V.instancing=k.instancing,V.instancingColor=k.instancingColor,V.instancingMorph=k.instancingMorph,V.skinning=k.skinning,V.morphTargets=k.morphTargets,V.morphNormals=k.morphNormals,V.morphColors=k.morphColors,V.morphTargetsCount=k.morphTargetsCount,V.numClippingPlanes=k.numClippingPlanes,V.numIntersection=k.numClipIntersection,V.vertexAlphas=k.vertexAlphas,V.vertexTangents=k.vertexTangents,V.toneMapping=k.toneMapping}function $b(I,k,V,z,H){k.isScene!==!0&&(k=gt),O.resetTextureUnits();const he=k.fog,xe=z.isMeshStandardMaterial?k.environment:null,de=F===null?E.outputColorSpace:F.isXRRenderTarget===!0?F.texture.colorSpace:St,ve=(z.isMeshStandardMaterial?K:$).get(z.envMap||xe),Te=z.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,Pe=!!V.attributes.tangent&&(!!z.normalMap||z.anisotropy>0),Re=!!V.morphAttributes.position,je=!!V.morphAttributes.normal,At=!!V.morphAttributes.color;let Ut=Hn;z.toneMapped&&(F===null||F.isXRRenderTarget===!0)&&(Ut=E.toneMapping);const Ot=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,xt=Ot!==void 0?Ot.length:0,Be=y.get(z),ut=v.state.lights;if(_e===!0&&(tt===!0||I!==Q)){const dn=I===Q&&z.id===P;Ee.setState(z,I,dn)}let st=!1;z.version===Be.__version?(Be.needsLights&&Be.lightsStateVersion!==ut.state.version||Be.outputColorSpace!==de||H.isBatchedMesh&&Be.batching===!1||!H.isBatchedMesh&&Be.batching===!0||H.isBatchedMesh&&Be.batchingColor===!0&&H.colorTexture===null||H.isBatchedMesh&&Be.batchingColor===!1&&H.colorTexture!==null||H.isInstancedMesh&&Be.instancing===!1||!H.isInstancedMesh&&Be.instancing===!0||H.isSkinnedMesh&&Be.skinning===!1||!H.isSkinnedMesh&&Be.skinning===!0||H.isInstancedMesh&&Be.instancingColor===!0&&H.instanceColor===null||H.isInstancedMesh&&Be.instancingColor===!1&&H.instanceColor!==null||H.isInstancedMesh&&Be.instancingMorph===!0&&H.morphTexture===null||H.isInstancedMesh&&Be.instancingMorph===!1&&H.morphTexture!==null||Be.envMap!==ve||z.fog===!0&&Be.fog!==he||Be.numClippingPlanes!==void 0&&(Be.numClippingPlanes!==Ee.numPlanes||Be.numIntersection!==Ee.numIntersection)||Be.vertexAlphas!==Te||Be.vertexTangents!==Pe||Be.morphTargets!==Re||Be.morphNormals!==je||Be.morphColors!==At||Be.toneMapping!==Ut||Be.morphTargetsCount!==xt)&&(st=!0):(st=!0,Be.__version=z.version);let Cn=Be.currentProgram;st===!0&&(Cn=Uo(z,k,H));let Zs=!1,In=!1,Aa=!1;const Et=Cn.getUniforms(),vn=Be.uniforms;if(Se.useProgram(Cn.program)&&(Zs=!0,In=!0,Aa=!0),z.id!==P&&(P=z.id,In=!0),Zs||Q!==I){Se.buffers.depth.getReversed()&&I.reversedDepth!==!0&&(I._reversedDepth=!0,I.updateProjectionMatrix()),Et.setValue(D,"projectionMatrix",I.projectionMatrix),Et.setValue(D,"viewMatrix",I.matrixWorldInverse);const En=Et.map.cameraPosition;En!==void 0&&En.setValue(D,Ke.setFromMatrixPosition(I.matrixWorld)),_t.logarithmicDepthBuffer&&Et.setValue(D,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&Et.setValue(D,"isOrthographic",I.isOrthographicCamera===!0),Q!==I&&(Q=I,In=!0,Aa=!0)}if(Be.needsLights&&(ut.state.directionalShadowMap.length>0&&Et.setValue(D,"directionalShadowMap",ut.state.directionalShadowMap,O),ut.state.spotShadowMap.length>0&&Et.setValue(D,"spotShadowMap",ut.state.spotShadowMap,O),ut.state.pointShadowMap.length>0&&Et.setValue(D,"pointShadowMap",ut.state.pointShadowMap,O)),H.isSkinnedMesh){Et.setOptional(D,H,"bindMatrix"),Et.setOptional(D,H,"bindMatrixInverse");const dn=H.skeleton;dn&&(dn.boneTexture===null&&dn.computeBoneTexture(),Et.setValue(D,"boneTexture",dn.boneTexture,O))}H.isBatchedMesh&&(Et.setOptional(D,H,"batchingTexture"),Et.setValue(D,"batchingTexture",H._matricesTexture,O),Et.setOptional(D,H,"batchingIdTexture"),Et.setValue(D,"batchingIdTexture",H._indirectTexture,O),Et.setOptional(D,H,"batchingColorTexture"),H._colorsTexture!==null&&Et.setValue(D,"batchingColorTexture",H._colorsTexture,O));const Fn=V.morphAttributes;if((Fn.position!==void 0||Fn.normal!==void 0||Fn.color!==void 0)&&Ye.update(H,V,Cn),(In||Be.receiveShadow!==H.receiveShadow)&&(Be.receiveShadow=H.receiveShadow,Et.setValue(D,"receiveShadow",H.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(vn.envMap.value=ve,vn.flipEnvMap.value=ve.isCubeTexture&&ve.isRenderTargetTexture===!1?-1:1),z.isMeshStandardMaterial&&z.envMap===null&&k.environment!==null&&(vn.envMapIntensity.value=k.environmentIntensity),vn.dfgLUT!==void 0&&(vn.dfgLUT.value=nw()),In&&(Et.setValue(D,"toneMappingExposure",E.toneMappingExposure),Be.needsLights&&Yb(vn,Aa),he&&z.fog===!0&&Oe.refreshFogUniforms(vn,he),Oe.refreshMaterialUniforms(vn,z,Ae,re,v.state.transmissionRenderTarget[I.id]),qc.upload(D,qf(Be),vn,O)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(qc.upload(D,qf(Be),vn,O),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&Et.setValue(D,"center",H.center),Et.setValue(D,"modelViewMatrix",H.modelViewMatrix),Et.setValue(D,"normalMatrix",H.normalMatrix),Et.setValue(D,"modelMatrix",H.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){const dn=z.uniformsGroups;for(let En=0,jl=dn.length;En<jl;En++){const ps=dn[En];ne.update(ps,Cn),ne.bind(ps,Cn)}}return Cn}function Yb(I,k){I.ambientLightColor.needsUpdate=k,I.lightProbe.needsUpdate=k,I.directionalLights.needsUpdate=k,I.directionalLightShadows.needsUpdate=k,I.pointLights.needsUpdate=k,I.pointLightShadows.needsUpdate=k,I.spotLights.needsUpdate=k,I.spotLightShadows.needsUpdate=k,I.rectAreaLights.needsUpdate=k,I.hemisphereLights.needsUpdate=k}function jb(I){return I.isMeshLambertMaterial||I.isMeshToonMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isShadowMaterial||I.isShaderMaterial&&I.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return F},this.setRenderTargetTextures=function(I,k,V){const z=y.get(I);z.__autoAllocateDepthBuffer=I.resolveDepthBuffer===!1,z.__autoAllocateDepthBuffer===!1&&(z.__useRenderToTexture=!1),y.get(I.texture).__webglTexture=k,y.get(I.depthTexture).__webglTexture=z.__autoAllocateDepthBuffer?void 0:V,z.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(I,k){const V=y.get(I);V.__webglFramebuffer=k,V.__useDefaultFramebuffer=k===void 0};const Kb=D.createFramebuffer();this.setRenderTarget=function(I,k=0,V=0){F=I,R=k,N=V;let z=null,H=!1,he=!1;if(I){const de=y.get(I);if(de.__useDefaultFramebuffer!==void 0){Se.bindFramebuffer(D.FRAMEBUFFER,de.__webglFramebuffer),U.copy(I.viewport),G.copy(I.scissor),q=I.scissorTest,Se.viewport(U),Se.scissor(G),Se.setScissorTest(q),P=-1;return}else if(de.__webglFramebuffer===void 0)O.setupRenderTarget(I);else if(de.__hasExternalTextures)O.rebindTextures(I,y.get(I.texture).__webglTexture,y.get(I.depthTexture).__webglTexture);else if(I.depthBuffer){const Pe=I.depthTexture;if(de.__boundDepthTexture!==Pe){if(Pe!==null&&y.has(Pe)&&(I.width!==Pe.image.width||I.height!==Pe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");O.setupDepthRenderbuffer(I)}}const ve=I.texture;(ve.isData3DTexture||ve.isDataArrayTexture||ve.isCompressedArrayTexture)&&(he=!0);const Te=y.get(I).__webglFramebuffer;I.isWebGLCubeRenderTarget?(Array.isArray(Te[k])?z=Te[k][V]:z=Te[k],H=!0):I.samples>0&&O.useMultisampledRTT(I)===!1?z=y.get(I).__webglMultisampledFramebuffer:Array.isArray(Te)?z=Te[V]:z=Te,U.copy(I.viewport),G.copy(I.scissor),q=I.scissorTest}else U.copy(X).multiplyScalar(Ae).floor(),G.copy(ee).multiplyScalar(Ae).floor(),q=ge;if(V!==0&&(z=Kb),Se.bindFramebuffer(D.FRAMEBUFFER,z)&&Se.drawBuffers(I,z),Se.viewport(U),Se.scissor(G),Se.setScissorTest(q),H){const de=y.get(I.texture);D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+k,de.__webglTexture,V)}else if(he){const de=k;for(let ve=0;ve<I.textures.length;ve++){const Te=y.get(I.textures[ve]);D.framebufferTextureLayer(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0+ve,Te.__webglTexture,V,de)}}else if(I!==null&&V!==0){const de=y.get(I.texture);D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_2D,de.__webglTexture,V)}P=-1},this.readRenderTargetPixels=function(I,k,V,z,H,he,xe,de=0){if(!(I&&I.isWebGLRenderTarget)){Fe("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ve=y.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&xe!==void 0&&(ve=ve[xe]),ve){Se.bindFramebuffer(D.FRAMEBUFFER,ve);try{const Te=I.textures[de],Pe=Te.format,Re=Te.type;if(!_t.textureFormatReadable(Pe)){Fe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!_t.textureTypeReadable(Re)){Fe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}k>=0&&k<=I.width-z&&V>=0&&V<=I.height-H&&(I.textures.length>1&&D.readBuffer(D.COLOR_ATTACHMENT0+de),D.readPixels(k,V,z,H,se.convert(Pe),se.convert(Re),he))}finally{const Te=F!==null?y.get(F).__webglFramebuffer:null;Se.bindFramebuffer(D.FRAMEBUFFER,Te)}}},this.readRenderTargetPixelsAsync=async function(I,k,V,z,H,he,xe,de=0){if(!(I&&I.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ve=y.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&xe!==void 0&&(ve=ve[xe]),ve)if(k>=0&&k<=I.width-z&&V>=0&&V<=I.height-H){Se.bindFramebuffer(D.FRAMEBUFFER,ve);const Te=I.textures[de],Pe=Te.format,Re=Te.type;if(!_t.textureFormatReadable(Pe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!_t.textureTypeReadable(Re))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const je=D.createBuffer();D.bindBuffer(D.PIXEL_PACK_BUFFER,je),D.bufferData(D.PIXEL_PACK_BUFFER,he.byteLength,D.STREAM_READ),I.textures.length>1&&D.readBuffer(D.COLOR_ATTACHMENT0+de),D.readPixels(k,V,z,H,se.convert(Pe),se.convert(Re),0);const At=F!==null?y.get(F).__webglFramebuffer:null;Se.bindFramebuffer(D.FRAMEBUFFER,At);const Ut=D.fenceSync(D.SYNC_GPU_COMMANDS_COMPLETE,0);return D.flush(),await Y_(D,Ut,4),D.bindBuffer(D.PIXEL_PACK_BUFFER,je),D.getBufferSubData(D.PIXEL_PACK_BUFFER,0,he),D.deleteBuffer(je),D.deleteSync(Ut),he}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(I,k=null,V=0){const z=Math.pow(2,-V),H=Math.floor(I.image.width*z),he=Math.floor(I.image.height*z),xe=k!==null?k.x:0,de=k!==null?k.y:0;O.setTexture2D(I,0),D.copyTexSubImage2D(D.TEXTURE_2D,V,0,0,xe,de,H,he),Se.unbindTexture()};const Jb=D.createFramebuffer(),Zb=D.createFramebuffer();this.copyTextureToTexture=function(I,k,V=null,z=null,H=0,he=null){he===null&&(H!==0?(vo("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),he=H,H=0):he=0);let xe,de,ve,Te,Pe,Re,je,At,Ut;const Ot=I.isCompressedTexture?I.mipmaps[he]:I.image;if(V!==null)xe=V.max.x-V.min.x,de=V.max.y-V.min.y,ve=V.isBox3?V.max.z-V.min.z:1,Te=V.min.x,Pe=V.min.y,Re=V.isBox3?V.min.z:0;else{const Fn=Math.pow(2,-H);xe=Math.floor(Ot.width*Fn),de=Math.floor(Ot.height*Fn),I.isDataArrayTexture?ve=Ot.depth:I.isData3DTexture?ve=Math.floor(Ot.depth*Fn):ve=1,Te=0,Pe=0,Re=0}z!==null?(je=z.x,At=z.y,Ut=z.z):(je=0,At=0,Ut=0);const xt=se.convert(k.format),Be=se.convert(k.type);let ut;k.isData3DTexture?(O.setTexture3D(k,0),ut=D.TEXTURE_3D):k.isDataArrayTexture||k.isCompressedArrayTexture?(O.setTexture2DArray(k,0),ut=D.TEXTURE_2D_ARRAY):(O.setTexture2D(k,0),ut=D.TEXTURE_2D),D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,k.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,k.unpackAlignment);const st=D.getParameter(D.UNPACK_ROW_LENGTH),Cn=D.getParameter(D.UNPACK_IMAGE_HEIGHT),Zs=D.getParameter(D.UNPACK_SKIP_PIXELS),In=D.getParameter(D.UNPACK_SKIP_ROWS),Aa=D.getParameter(D.UNPACK_SKIP_IMAGES);D.pixelStorei(D.UNPACK_ROW_LENGTH,Ot.width),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,Ot.height),D.pixelStorei(D.UNPACK_SKIP_PIXELS,Te),D.pixelStorei(D.UNPACK_SKIP_ROWS,Pe),D.pixelStorei(D.UNPACK_SKIP_IMAGES,Re);const Et=I.isDataArrayTexture||I.isData3DTexture,vn=k.isDataArrayTexture||k.isData3DTexture;if(I.isDepthTexture){const Fn=y.get(I),dn=y.get(k),En=y.get(Fn.__renderTarget),jl=y.get(dn.__renderTarget);Se.bindFramebuffer(D.READ_FRAMEBUFFER,En.__webglFramebuffer),Se.bindFramebuffer(D.DRAW_FRAMEBUFFER,jl.__webglFramebuffer);for(let ps=0;ps<ve;ps++)Et&&(D.framebufferTextureLayer(D.READ_FRAMEBUFFER,D.COLOR_ATTACHMENT0,y.get(I).__webglTexture,H,Re+ps),D.framebufferTextureLayer(D.DRAW_FRAMEBUFFER,D.COLOR_ATTACHMENT0,y.get(k).__webglTexture,he,Ut+ps)),D.blitFramebuffer(Te,Pe,xe,de,je,At,xe,de,D.DEPTH_BUFFER_BIT,D.NEAREST);Se.bindFramebuffer(D.READ_FRAMEBUFFER,null),Se.bindFramebuffer(D.DRAW_FRAMEBUFFER,null)}else if(H!==0||I.isRenderTargetTexture||y.has(I)){const Fn=y.get(I),dn=y.get(k);Se.bindFramebuffer(D.READ_FRAMEBUFFER,Jb),Se.bindFramebuffer(D.DRAW_FRAMEBUFFER,Zb);for(let En=0;En<ve;En++)Et?D.framebufferTextureLayer(D.READ_FRAMEBUFFER,D.COLOR_ATTACHMENT0,Fn.__webglTexture,H,Re+En):D.framebufferTexture2D(D.READ_FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_2D,Fn.__webglTexture,H),vn?D.framebufferTextureLayer(D.DRAW_FRAMEBUFFER,D.COLOR_ATTACHMENT0,dn.__webglTexture,he,Ut+En):D.framebufferTexture2D(D.DRAW_FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_2D,dn.__webglTexture,he),H!==0?D.blitFramebuffer(Te,Pe,xe,de,je,At,xe,de,D.COLOR_BUFFER_BIT,D.NEAREST):vn?D.copyTexSubImage3D(ut,he,je,At,Ut+En,Te,Pe,xe,de):D.copyTexSubImage2D(ut,he,je,At,Te,Pe,xe,de);Se.bindFramebuffer(D.READ_FRAMEBUFFER,null),Se.bindFramebuffer(D.DRAW_FRAMEBUFFER,null)}else vn?I.isDataTexture||I.isData3DTexture?D.texSubImage3D(ut,he,je,At,Ut,xe,de,ve,xt,Be,Ot.data):k.isCompressedArrayTexture?D.compressedTexSubImage3D(ut,he,je,At,Ut,xe,de,ve,xt,Ot.data):D.texSubImage3D(ut,he,je,At,Ut,xe,de,ve,xt,Be,Ot):I.isDataTexture?D.texSubImage2D(D.TEXTURE_2D,he,je,At,xe,de,xt,Be,Ot.data):I.isCompressedTexture?D.compressedTexSubImage2D(D.TEXTURE_2D,he,je,At,Ot.width,Ot.height,xt,Ot.data):D.texSubImage2D(D.TEXTURE_2D,he,je,At,xe,de,xt,Be,Ot);D.pixelStorei(D.UNPACK_ROW_LENGTH,st),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,Cn),D.pixelStorei(D.UNPACK_SKIP_PIXELS,Zs),D.pixelStorei(D.UNPACK_SKIP_ROWS,In),D.pixelStorei(D.UNPACK_SKIP_IMAGES,Aa),he===0&&k.generateMipmaps&&D.generateMipmap(ut),Se.unbindTexture()},this.initRenderTarget=function(I){y.get(I).__webglFramebuffer===void 0&&O.setupRenderTarget(I)},this.initTexture=function(I){I.isCubeTexture?O.setTextureCube(I,0):I.isData3DTexture?O.setTexture3D(I,0):I.isDataArrayTexture||I.isCompressedArrayTexture?O.setTexture2DArray(I,0):O.setTexture2D(I,0),Se.unbindTexture()},this.resetState=function(){R=0,N=0,F=null,Se.reset(),me.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ai}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Ze._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ze._getUnpackColorSpace()}}const Df=globalThis,xA=r=>r,vl=Df.trustedTypes,bA=vl?vl.createPolicy("lit-html",{createHTML:r=>r}):void 0,ix="$lit$",is=`lit$${Math.random().toFixed(9).slice(2)}$`,sx="?"+is,iw=`<${sx}>`,$s=document,wo=()=>$s.createComment(""),To=r=>r===null||typeof r!="object"&&typeof r!="function",Lf=Array.isArray,sw=r=>Lf(r)||typeof r?.[Symbol.iterator]=="function",Fh=`[ 4013\f\r]`,Ca=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_A=/-->/g,vA=/>/g,vs=RegExp(`>|${Fh}(?:([^\\s"'>=/]+)(${Fh}*=${Fh}*(?:[^ 4014\f\r"'\`<>=]|("|')|))|$)`,"g"),EA=/'/g,yA=/"/g,rx=/^(?:script|style|textarea|title)$/i,rw=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),zl=rw(1),aa=Symbol.for("lit-noChange"),Yt=Symbol.for("lit-nothing"),SA=new WeakMap,ks=$s.createTreeWalker($s,129);function ax(r,e){if(!Lf(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return bA!==void 0?bA.createHTML(e):e}const aw=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":e===3?"<math>":"",a=Ca;for(let o=0;o<t;o++){const c=r[o];let l,u,h=-1,d=0;for(;d<c.length&&(a.lastIndex=d,u=a.exec(c),u!==null);)d=a.lastIndex,a===Ca?u[1]==="!--"?a=_A:u[1]!==void 0?a=vA:u[2]!==void 0?(rx.test(u[2])&&(i=RegExp("</"+u[2],"g")),a=vs):u[3]!==void 0&&(a=vs):a===vs?u[0]===">"?(a=i??Ca,h=-1):u[1]===void 0?h=-2:(h=a.lastIndex-u[2].length,l=u[1],a=u[3]===void 0?vs:u[3]==='"'?yA:EA):a===yA||a===EA?a=vs:a===_A||a===vA?a=Ca:(a=vs,i=void 0);const f=a===vs&&r[o+1].startsWith("/>")?" ":"";s+=a===Ca?c+iw:h>=0?(n.push(l),c.slice(0,h)+ix+c.slice(h)+is+f):c+is+(h===-2?o:f)}return[ax(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};let kd=class ox{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,a=0;const o=e.length-1,c=this.parts,[l,u]=aw(e,t);if(this.el=ox.createElement(l,n),ks.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=ks.nextNode())!==null&&c.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(ix)){const d=u[a++],f=i.getAttribute(h).split(is),p=/([.?@])?(.*)/.exec(d);c.push({type:1,index:s,name:p[2],strings:f,ctor:p[1]==="."?cw:p[1]==="?"?lw:p[1]==="@"?hw:Vl}),i.removeAttribute(h)}else h.startsWith(is)&&(c.push({type:6,index:s}),i.removeAttribute(h));if(rx.test(i.tagName)){const h=i.textContent.split(is),d=h.length-1;if(d>0){i.textContent=vl?vl.emptyScript:"";for(let f=0;f<d;f++)i.append(h[f],wo()),ks.nextNode(),c.push({type:2,index:++s});i.append(h[d],wo())}}}else if(i.nodeType===8)if(i.data===sx)c.push({type:2,index:s});else{let h=-1;for(;(h=i.data.indexOf(is,h+1))!==-1;)c.push({type:7,index:s}),h+=is.length-1}s++}}static createElement(e,t){const n=$s.createElement("template");return n.innerHTML=e,n}};function oa(r,e,t=r,n){if(e===aa)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl;const s=To(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=oa(r,i._$AS(r,e.values),i,n)),e}class ow{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??$s).importNode(t,!0);ks.currentNode=i;let s=ks.nextNode(),a=0,o=0,c=n[0];for(;c!==void 0;){if(a===c.index){let l;c.type===2?l=new Lo(s,s.nextSibling,this,e):c.type===1?l=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(l=new uw(s,this,e)),this._$AV.push(l),c=n[++o]}a!==c?.index&&(s=ks.nextNode(),a++)}return ks.currentNode=$s,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class Lo{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=Yt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=oa(this,e,t),To(e)?e===Yt||e==null||e===""?(this._$AH!==Yt&&this._$AR(),this._$AH=Yt):e!==this._$AH&&e!==aa&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):sw(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Yt&&To(this._$AH)?this._$AA.nextSibling.data=e:this.T($s.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=kd.createElement(ax(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const s=new ow(i,this),a=s.u(this.options);s.p(t),this.T(a),this._$AH=s}}_$AC(e){let t=SA.get(e.strings);return t===void 0&&SA.set(e.strings,t=new kd(e)),t}k(e){Lf(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const s of e)i===t.length?t.push(n=new Lo(this.O(wo()),this.O(wo()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const n=xA(e).nextSibling;xA(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class Vl{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=Yt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Yt}_$AI(e,t=this,n,i){const s=this.strings;let a=!1;if(s===void 0)e=oa(this,e,t,0),a=!To(e)||e!==this._$AH&&e!==aa,a&&(this._$AH=e);else{const o=e;let c,l;for(e=s[0],c=0;c<s.length-1;c++)l=oa(this,o[n+c],t,c),l===aa&&(l=this._$AH[c]),a||=!To(l)||l!==this._$AH[c],l===Yt?e=Yt:e!==Yt&&(e+=(l??"")+s[c+1]),this._$AH[c]=l}a&&!i&&this.j(e)}j(e){e===Yt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}let cw=class extends Vl{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Yt?void 0:e}};class lw extends Vl{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Yt)}}class hw extends Vl{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=oa(this,e,t,0)??Yt)===aa)return;const n=this._$AH,i=e===Yt&&n!==Yt||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Yt&&(n===Yt||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class uw{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){oa(this,e)}}const dw=Df.litHtmlPolyfillSupport;dw?.(kd,Lo),(Df.litHtmlVersions??=[]).push("3.3.2");const cx=(r,e,t)=>{const n=t?.renderBefore??e;let i=n._$litPart$;if(i===void 0){const s=t?.renderBefore??null;n._$litPart$=i=new Lo(e.insertBefore(wo(),s),s,void 0,t??{})}return i._$AI(r),i};const Ff=globalThis;let Xc=class extends Ps{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=cx(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return aa}};Xc._$litElement$=!0,Xc.finalized=!0,Ff.litElementHydrateSupport?.({LitElement:Xc});const fw=Ff.litElementPolyfillSupport;fw?.({LitElement:Xc});(Ff.litElementVersions??=[]).push("4.2.2");const lx=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null,hx=lx&&self.XRSession.prototype.requestHitTestSource!=null,Ph=self.ResizeObserver!=null,Nh=self.IntersectionObserver!=null,ux=hx;(()=>{const r=navigator.userAgent||navigator.vendor||self.opera;let e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(r)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(r.substr(0,4)))&&(e=!0),e})();const pw=/android/i.test(navigator.userAgent),Aw=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,mw=/firefox/i.test(navigator.userAgent),gw=/OculusBrowser/.test(navigator.userAgent),xw=pw&&!mw&&!gw,bw=!!(window.webkit&&window.webkit.messageHandlers),CA=(()=>{if(Aw){if(bw)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{const r=document.createElement("a");return!!(r.relList&&r.relList.supports&&r.relList.supports("ar"))}}else return!1})();const dx=r=>r&&r!=="null"?_w(r):null,IA=()=>{if(ux)return;const r=[];throw lx||r.push("WebXR Device API"),hx||r.push("WebXR Hit Test API"),new Error(`The following APIs are required for AR, but are missing in this browser: ${r.join(", ")}`)},_w=r=>new URL(r,window.location.toString()).toString(),vw=(r,e)=>{let t=null;const n=(...i)=>{t==null&&(r(...i),t=self.setTimeout(()=>t=null,e))};return n.flush=()=>{t!=null&&(self.clearTimeout(t),t=null)},n},MA=(r,e)=>{let t=null;return(...n)=>{t!=null&&self.clearTimeout(t),t=self.setTimeout(()=>{t=null,r(...n)},e)}},pi=(r,e,t)=>Math.max(e,Math.min(t,r)),wA=(()=>{const r="model-viewer-debug-mode",e=new RegExp(`[?&]${r}(&|$)`);return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})(),Ew=(r=0)=>new Promise(e=>setTimeout(e,r)),yw=(r,e,t=null)=>new Promise(n=>{function i(s){(!t||t(s))&&(n(s),r.removeEventListener(e,i))}r.addEventListener(e,i)});var Es=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const Sw=.5,Cw=0,Iw=1,Mw=1,ja=Symbol("currentEnvironmentMap"),Ka=Symbol("currentBackground"),El=Symbol("updateEnvironment"),pc=Symbol("cancelEnvironmentUpdate"),ww=r=>{var e,t,n;class i extends r{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=Cw,this.shadowSoftness=Iw,this.exposure=Mw,this.toneMapping="auto",this.skyboxHeight="0",this[e]=null,this[t]=null,this[n]=null}updated(a){var o;if(super.updated(a),a.has("shadowIntensity")&&(this[te].setShadowIntensity(this.shadowIntensity*Sw),this[Kt]()),a.has("shadowSoftness")&&(this[te].setShadowSoftness(this.shadowSoftness),this[Kt]()),a.has("exposure")&&(this[te].exposure=this.exposure,this[Kt]()),a.has("toneMapping")){const c=new Map([["aces",lf],["agx",hf],["reinhard",of],["cineon",cf],["linear",af],["none",Hn]]);this[te].toneMapping=(o=c.get(this.toneMapping))!==null&&o!==void 0?o:Xr,this[Kt]()}(a.has("environmentImage")||a.has("skyboxImage"))&&this[ca]()&&this[El](),a.has("skyboxHeight")&&(this[te].setGroundedSkybox(),this[Kt]())}hasBakedShadow(){return this[te].bakedShadows.size>0}async[(e=ja,t=Ka,n=pc,El)](){const{skyboxImage:a,environmentImage:o}=this;this[pc]!=null&&(this[pc](),this[pc]=null);const{textureUtils:c}=this[at];if(c==null)return;const l=this[Ys].beginActivity("environment-update");try{const{environmentMap:u,skybox:h}=await c.generateEnvironmentMapAndSkybox(dx(a),o,d=>l(pi(d,0,1)),this.withCredentials);this[ja]!==u&&(this[ja]=u,this.dispatchEvent(new CustomEvent("environment-change"))),h!=null?this[Ka]=h.name===u.name?u:h:this[Ka]=null,this[te].setEnvironmentAndSkybox(this[ja],this[Ka])}catch(u){if(u instanceof Error)throw this[te].setEnvironmentAndSkybox(null,null),u}finally{l(1)}}}return Es([De({type:String,attribute:"environment-image"})],i.prototype,"environmentImage",void 0),Es([De({type:String,attribute:"skybox-image"})],i.prototype,"skyboxImage",void 0),Es([De({type:Number,attribute:"shadow-intensity"})],i.prototype,"shadowIntensity",void 0),Es([De({type:Number,attribute:"shadow-softness"})],i.prototype,"shadowSoftness",void 0),Es([De({type:Number})],i.prototype,"exposure",void 0),Es([De({type:String,attribute:"tone-mapping"})],i.prototype,"toneMapping",void 0),Es([De({type:String,attribute:"skybox-height"})],i.prototype,"skyboxHeight",void 0),i};const Tw=zl` 4015<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000"> 4016 <!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement 4017 support for dynamic re-coloring of UI components --> 4018 <defs> 4019 <filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%"> 4020 <feGaussianBlur in="SourceAlpha" stdDeviation="1"/> 4021 <feOffset dx="0" dy="0" result="offsetblur"/> 4022 <feFlood flood-color="#000000"/> 4023 <feComposite in2="offsetblur" operator="in"/> 4024 <feMerge> 4025 <feMergeNode/> 4026 <feMergeNode in="SourceGraphic"/> 4027 </feMerge> 4028 </filter> 4029 </defs>
4030 <path filter="url(#drop-shadow)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/> 4031 <path d="M0 0h24v24H0z" fill="none"/> 4032</svg>`;const Rw=zl` 4033<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36"> 4034 <defs> 4035 <path id="A" d="M.001.232h24.997V36H.001z" /> 4036 </defs> 4037 <g transform="translate(-11 -4)" fill="none" fill-rule="evenodd"> 4038 <path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" /> 4039 <g transform="translate(11 3)"> 4040 <path d="M8.733 11.165c.04-1.108.766-2.027 1.743-2.307a2.54 2.54 0 0 1 .628-.089c.16 0 .314.017.463.044 1.088.2 1.9 1.092 1.9 2.16v8.88h1.26c2.943-1.39 5-4.45 5-8.025a9.01 9.01 0 0 0-1.9-5.56l-.43-.5c-.765-.838-1.683-1.522-2.712-2-1.057-.49-2.226-.77-3.46-.77s-2.4.278-3.46.77c-1.03.478-1.947 1.162-2.71 2l-.43.5a9.01 9.01 0 0 0-1.9 5.56 9.04 9.04 0 0 0 .094 1.305c.03.21.088.41.13.617l.136.624c.083.286.196.56.305.832l.124.333a8.78 8.78 0 0 0 .509.953l.065.122a8.69 8.69 0 0 0 3.521 3.191l1.11.537v-9.178z" fill-opacity=".5" fill="#e4e4e4" /> 4041 <path d="M22.94 26.218l-2.76 7.74c-.172.485-.676.8-1.253.8H12.24c-1.606 0-3.092-.68-3.98-1.82-1.592-2.048-3.647-3.822-6.11-5.27-.095-.055-.15-.137-.152-.23-.004-.1.046-.196.193-.297.56-.393 1.234-.6 1.926-.6a3.43 3.43 0 0 1 .691.069l4.922.994V10.972c0-.663.615-1.203 1.37-1.203s1.373.54 1.373 1.203v9.882h2.953c.273 0 .533.073.757.21l6.257 3.874c.027.017.045.042.07.06.41.296.586.77.426 1.22M4.1 16.614c-.024-.04-.042-.083-.065-.122a8.69 8.69 0 0 1-.509-.953c-.048-.107-.08-.223-.124-.333l-.305-.832c-.058-.202-.09-.416-.136-.624l-.13-.617a9.03 9.03 0 0 1-.094-1.305c0-2.107.714-4.04 1.9-5.56l.43-.5c.764-.84 1.682-1.523 2.71-2 1.058-.49 2.226-.77 3.46-.77s2.402.28 3.46.77c1.03.477 1.947 1.16 2.712 2l.428.5a9 9 0 0 1 1.901 5.559c0 3.577-2.056 6.636-5 8.026h-1.26v-8.882c0-1.067-.822-1.96-1.9-2.16-.15-.028-.304-.044-.463-.044-.22 0-.427.037-.628.09-.977.28-1.703 1.198-1.743 2.306v9.178l-1.11-.537C6.18 19.098 4.96 18 4.1 16.614M22.97 24.09l-6.256-3.874c-.102-.063-.218-.098-.33-.144 2.683-1.8 4.354-4.855 4.354-8.243 0-.486-.037-.964-.104-1.43a9.97 9.97 0 0 0-1.57-4.128l-.295-.408-.066-.092a10.05 10.05 0 0 0-.949-1.078c-.342-.334-.708-.643-1.094-.922-1.155-.834-2.492-1.412-3.94-1.65l-.732-.088-.748-.03a9.29 9.29 0 0 0-1.482.119c-1.447.238-2.786.816-3.94 1.65a9.33 9.33 0 0 0-.813.686 9.59 9.59 0 0 0-.845.877l-.385.437-.36.5-.288.468-.418.778-.04.09c-.593 1.28-.93 2.71-.93 4.222 0 3.832 2.182 7.342 5.56 8.938l1.437.68v4.946L5 25.64a4.44 4.44 0 0 0-.888-.086c-.017 0-.034.003-.05.003-.252.004-.503.033-.75.08a5.08 5.08 0 0 0-.237.056c-.193.046-.382.107-.568.18-.075.03-.15.057-.225.1-.25.114-.494.244-.723.405a1.31 1.31 0 0 0-.566 1.122 1.28 1.28 0 0 0 .645 1.051C4 29.925 5.96 31.614 7.473 33.563a5.06 5.06 0 0 0 .434.491c1.086 1.082 2.656 1.713 4.326 1.715h6.697c.748-.001 1.43-.333 1.858-.872.142-.18.256-.38.336-.602l2.757-7.74c.094-.26.13-.53.112-.794s-.088-.52-.203-.76a2.19 2.19 0 0 0-.821-.91" fill-opacity=".6" fill="#000" /> 4042 <path d="M22.444 24.94l-6.257-3.874a1.45 1.45 0 0 0-.757-.211h-2.953v-9.88c0-.663-.616-1.203-1.373-1.203s-1.37.54-1.37 1.203v16.643l-4.922-.994a3.44 3.44 0 0 0-.692-.069 3.35 3.35 0 0 0-1.925.598c-.147.102-.198.198-.194.298.004.094.058.176.153.23 2.462 1.448 4.517 3.22 6.11 5.27.887 1.14 2.373 1.82 3.98 1.82h6.686c.577 0 1.08-.326 1.253-.8l2.76-7.74c.16-.448-.017-.923-.426-1.22-.025-.02-.043-.043-.07-.06z" fill="#fff" /> 4043 <g transform="translate(0 .769)"> 4044 <mask id="B" fill="#fff"> 4045 <use xlink:href="#A" /> 4046 </mask> 4047 <path d="M23.993 24.992a1.96 1.96 0 0 1-.111.794l-2.758 7.74c-.08.22-.194.423-.336.602-.427.54-1.11.87-1.857.872h-6.698c-1.67-.002-3.24-.633-4.326-1.715-.154-.154-.3-.318-.434-.49C5.96 30.846 4 29.157 1.646 27.773c-.385-.225-.626-.618-.645-1.05a1.31 1.31 0 0 1 .566-1.122 4.56 4.56 0 0 1 .723-.405l.225-.1a4.3 4.3 0 0 1 .568-.18l.237-.056c.248-.046.5-.075.75-.08.018 0 .034-.003.05-.003.303-.001.597.027.89.086l3.722.752V20.68l-1.436-.68c-3.377-1.596-5.56-5.106-5.56-8.938 0-1.51.336-2.94.93-4.222.015-.03.025-.06.
404704-.09.127-.267.268-.525.418-.778.093-.16.186-.316.288-.468.063-.095.133-.186.2-.277L3.773 5c.118-.155.26-.29.385-.437.266-.3.544-.604.845-.877a9.33 9.33 0 0 1 .813-.686C6.97 2.167 8.31 1.59 9.757 1.35a9.27 9.27 0 0 1 1.481-.119 8.82 8.82 0 0 1 .748.031c.247.02.49.05.733.088 1.448.238 2.786.816 3.94 1.65.387.28.752.588 1.094.922a9.94 9.94 0 0 1 .949 1.078l.066.092c.102.133.203.268.295.408a9.97 9.97 0 0 1 1.571 4.128c.066.467.103.945.103 1.43 0 3.388-1.67 6.453-4.353 8.243.11.046.227.08.33.144l6.256 3.874c.37.23.645.55.82.9.115.24.185.498.203.76m.697-1.195c-.265-.55-.677-1.007-1.194-1.326l-5.323-3.297c2.255-2.037 3.564-4.97 3.564-8.114 0-2.19-.637-4.304-1.84-6.114-.126-.188-.26-.37-.4-.552-.645-.848-1.402-1.6-2.252-2.204C15.472.91 13.393.232 11.238.232A10.21 10.21 0 0 0 5.23 2.19c-.848.614-1.606 1.356-2.253 2.205-.136.18-.272.363-.398.55C1.374 6.756.737 8.87.737 11.06c0 4.218 2.407 8.08 6.133 9.842l.863.41v3.092l-2.525-.51c-.356-.07-.717-.106-1.076-.106a5.45 5.45 0 0 0-3.14.996c-.653.46-1.022 1.202-.99 1.983a2.28 2.28 0 0 0 1.138 1.872c2.24 1.318 4.106 2.923 5.543 4.772 1.26 1.62 3.333 2.59 5.55 2.592h6.698c1.42-.001 2.68-.86 3.134-2.138l2.76-7.74c.272-.757.224-1.584-.134-2.325" fill-opacity=".05" fill="#000" mask="url(#B)" /> 4048 </g> 4049 </g> 4050 </g> 4051</svg>`;const Bw=zl` 4052<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon" 4053 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" 4054 viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"> 4055<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/> 4056<g id="Art_layer"> 4057 <path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/> 4058 <path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/> 4059 <path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/> 4060 <path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/> 4061 <g> 4062 <path d="M18.25,7.6l-5.5-3.18c-0.46-0.27-1.04-0.27-1.5,0L5.75,7.6C5.29,7.87,5,8.36,5,8.9v6.35c0,0.54,0.29,1.03,0.75,1.3 4063 l5.5,3.18c0.46,0.27,1.04,0.27,1.5,0l5.5-3.18c0.46-0.27,0.75-0.76,0.75-1.3V8.9C19,8.36,18.71,7.87,18.25,7.6z M7,14.96v-4.62 4064 l4,2.32v4.61L7,14.96z M12,10.93L8,8.61l4-2.31l4,2.31L12,10.93z M13,17.27v-4.61l4-2.32v4.62L13,17.27z"/> 4065 </g> 4066</g> 4067</svg>`;const Dw=zl` 4068<style> 4069:host { 4070 display: block; 4071 position: relative; 4072 contain: strict; 4073 width: 300px; 4074 height: 150px; 4075} 4076 4077.container { 4078 position: relative; 4079 overflow: hidden; 4080} 4081 4082.userInput { 4083 width: 100%; 4084 height: 100%; 4085 display: none; 4086 position: relative; 4087 outline-offset: -1px; 4088 outline-width: 1px; 4089} 4090 4091canvas { 4092 position: absolute; 4093 display: none; 4094 pointer-events: none; 4095 /* NOTE(cdata): Chrome 76 and below apparently have a bug 4096 * that causes our canvas not to display pixels unless it is 4097 * on its own render layer 4098 * @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893 4099 */ 4100 transform: translateZ(0); 4101} 4102 4103.show { 4104 display: block; 4105} 4106 4107/* Adapted from HTML5 Boilerplate 4108 * 4109 * @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */ 4110.screen-reader-only { 4111 border: 0; 4112 left: 0; 4113 top: 0; 4114 clip: rect(0, 0, 0, 0); 4115 height: 1px; 4116 margin: -1px; 4117 overflow: hidden; 4118 padding: 0; 4119 position: absolute; 4120 white-space: nowrap; 4121 width: 1px; 4122 pointer-events: none; 4123} 4124 4125.slot { 4126 position: absolute; 4127 pointer-events: none; 4128 top: 0; 4129 left: 0; 4130 width: 100%; 4131 height: 100%; 4132} 4133 4134.slot > * { 4135 pointer-events: initial; 4136} 4137 4138.annotation-wrapper ::slotted(*) { 4139 opacity: var(--max-hotspot-opacity, 1); 4140 transition: opacity 0.3s; 4141} 4142 4143.pointer-tumbling .annotation-wrapper ::slotted(*) { 4144 pointer-events: none; 4145} 4146 4147.annotation-wrapper ::slotted(*) { 4148 pointer-events: initial; 4149} 4150 4151.annotation-wrapper.hide ::slotted(*) { 4152 opacity: var(--min-hotspot-opacity, 0.25); 4153} 4154 4155.slot.poster { 4156 display: none; 4157 background-color: inherit; 4158} 4159 4160.slot.poster.show { 4161 display: inherit; 4162} 4163 4164.slot.poster > * { 4165 pointer-events: initial; 4166} 4167 4168.slot.poster:not(.show) > * { 4169 pointer-events: none; 4170} 4171 4172#default-poster { 4173 width: 100%; 4174 height: 100%; 4175 /* The default poster is a <button> so we need to set display 4176 * to prevent it from being affected by text-align: */ 4177 display: block; 4178 position: absolute; 4179 border: none; 4180 padding: 0; 4181 background-size: contain; 4182 background-repeat: no-repeat; 4183 background-position: center; 4184 background-color: #fff0; 4185} 4186 4187#default-progress-bar { 4188 display: block; 4189 position: relative; 4190 width: 100%; 4191 height: 100%; 4192 pointer-events: none; 4193 overflow: hidden; 4194} 4195 4196#default-progress-bar > .bar { 4197 position: absolute; 4198 top: 0; 4199 left: 0; 4200 width: 100%; 4201 height: var(--progress-bar-height, 5px); 4202 background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4)); 4203 transition: transform 0.09s; 4204 transform-origin: top left; 4205 transform: scaleX(0); 4206 overflow: hidden; 4207} 4208 4209#default-progress-bar > .bar.hide { 4210 transition: opacity 0.3s 1s; 4211 opacity: 0; 4212} 4213 4214.centered { 4215 align-items: center; 4216 justify-content: center; 4217} 4218 4219.cover { 4220 position: absolute; 4221 top: 0; 4222 left: 0; 4223 width: 100%; 4224 height: 100%; 4225 pointer-events: none; 4226} 4227 4228.slot.interaction-prompt { 4229 display: var(--interaction-prompt-display, flex); 4230 overflow: hidden; 4231 opacity: 0; 4232 will-change: opacity; 4233 transition: opacity 0.3s; 4234} 4235 4236.slot.interaction-prompt.visible { 4237 opacity: 1; 4238} 4239 4240.animated-container { 4241 will-change: transform, opacity; 4242 opacity: 0; 4243 transition: opacity 0.3s; 4244} 4245 4246.slot.interaction-prompt > * { 4247 pointer-events: none; 4248} 4249 4250.slot.ar-button { 4251 -moz-user-select: none; 4252 -webkit-tap-highlight-color: transparent; 4253 user-select: none; 4254 4255 display: var(--ar-button-display, block); 4256} 4257 4258.slot.ar-button:not(.enabled) { 4259 display: none; 4260} 4261 4262.fab { 4263 display: flex; 4264 align-items: center; 4265 justify-content: center; 4266 box-sizing: border-box; 4267 width: 40px; 4268 height: 40px; 4269 cursor: pointer; 4270 background-color: #fff; 4271 box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15); 4272 border-radius: 100px; 4273} 4274 4275.fab > * { 4276 opacity: 0.87; 4277} 4278 4279#default-ar-button { 4280 position: absolute; 4281 bottom: 16px; 4282 right: 16px; 4283 transform: scale(var(--ar-button-scale, 1)); 4284 transform-origin: bottom right; 4285} 4286 4287.slot.pan-target { 4288 display: block; 4289 position: absolute; 4290 width: 0; 4291 height: 0; 4292 left: 50%; 4293 top: 50%; 4294 transform: translate3d(-50%, -50%, 0); 4295 background-color: transparent; 4296 opacity: 0; 4297 transition: opacity 0.3s; 4298} 4299 4300#default-pan-target { 4301 width: 6px; 4302 height: 6px; 4303 border-radius: 6px; 4304 border: 1px solid white; 4305 box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.8); 4306} 4307 4308.slot.default { 4309 pointer-events: none; 4310} 4311 4312.slot.progress-bar { 4313 pointer-events: none; 4314} 4315 4316.slot.exit-webxr-ar-button { 4317 pointer-events: none; 4318} 4319 4320.slot.exit-webxr-ar-button:not(.enabled) { 4321 display: none; 4322} 4323 4324#default-exit-webxr-ar-button { 4325 display: flex; 4326 align-items: center; 4327 justify-content: center; 4328 position: absolute; 4329 top: env(safe-area-inset-top, 16px); 4330 right: 16px; 4331 width: 40px; 4332 height: 40px; 4333 box-sizing: border-box; 4334} 4335 4336#default-exit-webxr-ar-button > svg { 4337 fill: #fff; 4338} 4339</style> 4340<div class="container"> 4341 <div class="userInput" tabindex="0" role="img" 4342 aria-label="3D model"> 4343 <div class="slot canvas"> 4344 <slot name="canvas"> 4345 <canvas></canvas> 4346 </slot> 4347 </div> 4348 4349 </div> 4350 4351 <!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM 4352 will have their <slot> elements removed by ShadyCSS --> 4353 <div class="slot poster"> 4354 <slot name="poster"> 4355 <button type="button" id="default-poster" aria-hidden="true" aria-label="Loading 3D model"></button> 4356 </slot> 4357 </div> 4358 4359 <div class="slot ar-button"> 4360 <slot name="ar-button"> 4361 <a id="default-ar-button" part="default-ar-button" class="fab" 4362 tabindex="2" 4363 role="button" 4364 href="javascript:void(0);" 4365 aria-label="View in your space"> 4366 ${Bw} 4367 </a> 4368 </slot> 4369 </div> 4370 4371 <div class="slot pan-target"> 4372 <slot name="pan-target"> 4373 <div id="default-pan-target"> 4374 </div> 4375 </slot> 4376 </div> 4377 4378 <div class="slot interaction-prompt cover centered"> 4379 <div id="prompt" class="animated-container"> 4380 <slot name="interaction-prompt" aria-hidden="true"> 4381 ${Rw} 4382 </slot> 4383 </div> 4384 </div> 4385 4386 <div id="finger0" class="animated-container cover"> 4387 <slot name="finger0" aria-hidden="true"> 4388 </slot> 4389 </div> 4390 <div id="finger1" class="animated-container cover"> 4391 <slot name="finger1" aria-hidden="true"> 4392 </slot> 4393 </div> 4394 4395 <div class="slot default"> 4396 <slot></slot> 4397 4398 <div class="slot progress-bar"> 4399 <slot name="progress-bar"> 4400 <div id="default-progress-bar" aria-hidden="true"> 4401 <div class="bar" part="default-progress-bar"></div> 4402 </div> 4403 </slot> 4404 </div> 4405 4406 <div class="slot exit-webxr-ar-button"> 4407 <slot name="exit-webxr-ar-button"> 4408 <a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button" 4409 tabindex="3" 4410 aria-label="Exit AR" 4411 aria-hidden="true"> 4412 ${Tw} 4413 </a> 4414 </slot> 4415 </div> 4416 </div> 4417</div> 4418<div class="screen-reader-only" role="region" aria-label="Live announcements"> 4419 <span id="status" role="status"></span> 4420</div>`,Lw=r=>{cx(Dw,r)};var TA=(function(){var r
vendor: 19,025 bytes, line 4420
4420="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q:Odkr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq;w8Wqdbk;esezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9Uc;WFbGgocjdaocjd6EhDaicefhocbhqdnindndndnaeaq9nmbaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxalc9WGgmTmecbhPawcjdfhsaohzinaraz9Rax6mvarazaxfgo9RcK6mvczhlcbhHinalgic9WfgOawcj;cbffhldndndndndnazaOco4fRbbaHcoG4ciGPlbedibkal9cb83ibalcwf9cb83ibxikalaoRblaoRbbgOco4gAaAciSgAE86bbawcj;cbfaifglcGfaoclfaAfgARbbaOcl4ciGgCaCciSgCE86bbalcVfaAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc7faAaCfgARbbaOciGgOaOciSgOE86bbalctfaAaOfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkalaoRbwaoRbbgOcl4gAaAcsSgAE86bbawcj;cbfaifglcGfaocwfaAfgARbbaOcsGgOaOcsSgOE86bbalcVfaAaOfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekalao8Pbb83bbalcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaHcdfhHaiczfhlarao9RcL0mekkaiam6mvaoTmvdnakTmbawaPfRbbhHawcj;cbfhlashiakhOinaialRbbgzce4cbazceG9R7aHfgH86bbaiadfhialcefhlaOcufgOmbkkascefhsaohzaPcefgPad9hmbxikkcbc99arao9Radcaadca0ESEhoxlkaoaxad2fhCdnakmbadhlinaoTmlarao9Rax6mlaoaxfhoalcufglmbkaChoxekcbhmawcjdfhAinarao9Rax6miawamfRbbhHawcj;cbfhlaAhiakhOinaialRbbgzce4cbazceG9R7aHfgH86bbaiadfhialcefhlaOcufgOmbkaAcefhAaoaxfhoamcefgmad9hmbkaChokabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekc9:hokavcj;ebf8Kjjjjbaok;cseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhDaicefgqarfhidnaeTmbcmcsawceSEhkcbhxcbhmcbhPcbhwcbhlindnaiaD9nmbc9:hoxikdndnaqRbbgoc;Ve0mbavc;abfalaocu7gscl4fcsGcitfgzydlhrazydbhzdnaocsGgHak9pmbavawasfcsGcdtfydbaxaHEhoaHThsdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkaxasfhxcdhHavawcdtfaoBdbawasfhwcehsalhOxdkdndnaHcsSmbaHc987aHamffcefhoxekaicefhoai8SbbgHcFeGhsdndnaHcu9mmbaohixekaicvfhiascFbGhscrhHdninao8SbbgOcFbGaHtasVhsaOcu9kmeaocefhoaHcrfgHc8J9hmbxdkkaocefhikasce4cbasceG9R7amfhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhHavawcdtfaoBdbcehsawcefhwalhOaohmxekdnaocpe0mbaxcefgHavawaDaocsGfRbbgocl49RcsGcdtfydbaocz6gzEhravawao9RcsGcdtfydbaHazfgAaocsGgHEhoaHThCdndnadcd9hmbabaPcetfgHax87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHaxBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfaxBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgOaxBdlaOarBdbavawazfgwcsGcdtfaoBdbalcefcsGhOawaCfhwaxhzaAaCfhxxekaxcbaiRbbgOEgzaoc;:eSgHfhraOcsGhCaOcl4hAdndnaOcs0mbarcefhoxekarhoavawaA9RcsGcdtfydbhrkdndnaCmbaocefhxxekaohxavawaO9RcsGcdtfydbhokdndnaHTmbaicefhHxekaicdfhHai8SbegscFeGhzdnascu9kmbaicofhXazcFbGhzcrhidninaH8SbbgscFbGaitazVhzascu9kmeaHcefhHaicrfgic8J9hmbkaXhHxekaHcefhHkazce4cbazceG9R7amfgmhzkdndnaAcsSmbaHhsxekaHcefhsaH8SbbgicFeGhrdnaicu9kmbaHcvfhXarcFbGhrcrhidninas8SbbgHcFbGaitarVhraHcu9kmeascefhsaicrfgic8J9hmbkaXhsxekascefhskarce4cbarceG9R7amfgmhrkdndnaCcsSmbashixekascefhias8SbbgocFeGhHdnaocu9kmbascvfhXaHcFbGhHcrhodninai8SbbgscFbGaotaHVhHascu9kmeaicefhiaocrfgoc8J9hmbkaXhixekaicefhikaHce4cbaHceG9R7amfgmhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfazBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgXazBdlaXarBdbavawaOcz6aAcsSVfgwcsGcdtfaoBdbawaCTaCcsSVfhwalcefcsGhOkaqcefhqavc;abfaOcitfgOarBdlaOaoBdbavc;abfalasfcsGcitfgraoBdlarazBdbawcsGhwalaHfcsGhlaPcifgPae6mbkkcbc99aiaDSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;oiliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabaiavcefciGfcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:OhDxekcjjjj94hDkabaiavciGfgkcd7cetfaD87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:OhDxekcjjjj94hDkabaiavcufciGfcetfaD87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohvxekcjjjj94hvkabakcetfav87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklzNbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q:6dkr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq:p9sqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk:N8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhlaicefhodnaeTmbadTmbalc;WFbGglcjdalcjd6EhwcbhDinawaeaD9RaDawfae6Egqcsfglc9WGgkci2hxakcethmalcl4cifcd4hPabaDad2fhsakc;ab6hzcbhHincbhOaohAdndninaraA9RaP6meavcj;cbfaOak2fhCaAaPfhocbhidnazmbarao9Rc;Gb6mbcbhlinaCalfhidndndndndnaAalco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklbaoczfhokdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklzaoczfhokdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklaaoczfhokdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WaoclfaYpQbfaXc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WaocwfaYpQbfaXc:q:yjjbfRbbfhoxekaiaopbbbpkl8Waoczfhokalc;abfhialcjefak0meaihlarao9Rc;Fb0mbkkdnaiak9pmbaici4hlinarao9RcK6miaCaifhXdndndndndnaAaico4fRbbalcoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpkbbxikaXaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkbbaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaXaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkbbaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaXaopbbbpkbbaoczfhokalcdfhlaiczfgiak6mbkkaoTmeaohAaOcefgOclSmdxbkkc9:hoxlkdnakTmbavcjdfaHfhiavaHfpbdbhYcbhXinaiavcj;cbfaXfglpblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLalakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEalamfpblbg3cep9Ta3aQp9op9Hp9rg3alaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfhiaXczfgXak6mbkkaHclfgHad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfgDae6mbkkcbc99arao9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk::seHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhDaicefgqarfhidnaeTmbcmcsawceSEhkcbhxcbhmcbhPcbhwcbhlindnaiaD9nmbc9:hoxikdndnaqRbbgoc;Ve0mbavc;abfalaocu7gscl4fcsGcitfgzydlhrazydbhzdnaocsGgHak9pmbavawasfcsGcdtfydbaxaHEhoaHThsdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkaxasfhxcdhHavawcdtfaoBdbawasfhwcehsalhOxdkdndnaHcsSmbaHc987aHamffcefhoxekaicefhoai8SbbgHcFeGhsdndnaHcu9mmbaohixekaicvfhiascFbGhscrhHdninao8SbbgOcFbGaHtasVhsaOcu9kmeaocefhoaHcrfgHc8J9hmbxdkkaocefhikasce4cbasceG9R7amfhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhHavawcdtfaoBdbcehsawcefhwalhOaohmxekdnaocpe0mbaxcefgHavawaDaocsGfRbbgocl49RcsGcdtfydbaocz6gzEhravawao9RcsGcdtfydbaHazfgAaocsGgHEhoaHThCdndnadcd9hmbabaPcetfgHax87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHaxBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfaxBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgOaxBdlaOarBdbavawazfgwcsGcdtfaoBdbalcefcsGhOawaCfhwaxhzaAaCfhxxekaxcbaiRbbgOEgzaoc;:eSgHfhraOcsGhCaOcl4hAdndnaOcs0mbarcefhoxekarhoavawaA9RcsGcdtfydbhrkdndnaCmbaocefhxxekaohxavawaO9RcsGcdtfydbhokdndnaHTmbaicefhHxekaicdfhHai8SbegscFeGhzdnascu9kmbaicofhXazcFbGhzcrhidninaH8SbbgscFbGaitazVhzascu9kmeaHcefhHaicrfgic8J9hmbkaXhHxekaHcefhHkazce4cbazceG9R7amfgmhzkdndnaAcsSmbaHhsxekaHcefhsaH8SbbgicFeGhrdnaicu9kmbaHcvfhXarcFbGhrcrhidninas8SbbgHcFbGaitarVhraHcu9kmeascefhsaicrfgic8J9hmbkaXhsxekascefhskarce4cbarceG9R7amfgmhrkdndnaCcsSmbashixekascefhias8SbbgocFeGhHdnaocu9kmbascvfhXaHcFbGhHcrhodninai8SbbgscFbGaotaHVhHascu9kmeaicefhiaocrfgoc8J9hmbkaXhixekaicefhikaHce4cbaHceG9R7amfgmhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfazBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgXazBdlaXarBdbavawaOcz6aAcsSVfgwcsGcdtfaoBdbawaCTaCcsSVfhwalcefcsGhOkaqcefhqavc;abfaOcitfgOarBdlaOaoBdbavc;abfalasfcsGcitfgraoBdlarazBdbawcsGhwalaHfcsGhlaPcifgPae6mbkkcbc99aiaDSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalaeSmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;Meawaqawamp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oaoarpmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalaeSmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;Meawaqawamp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oaoarpmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaDakp;Mearp;Keamp9oaqakp;Mearp;Keczp:Rep9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalaeSmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaDakp;Mearp;Keamp9oaqakp;Mearp;Keczp:Rep9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnavalSmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz:Dbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),
vendor: 1,932 bytes, line 4420
4420n=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var i=WebAssembly.validate(t)?o(e):o(r),s,a=WebAssembly.instantiate(i,{}).then(function(A){s=A.instance,s.exports.__wasm_call_ctors()});function o(A){for(var x=new Uint8Array(A.length),_=0;_<A.length;++_){var b=A.charCodeAt(_);x[_]=b>96?b-97:b>64?b-39:b+4}for(var v=0,_=0;_<A.length;++_)x[v++]=x[_]<60?n[x[_]]:(x[_]-60)*64+x[++_];return x.buffer.slice(0,v)}function c(A,x,_,b,v,C,M){var w=A.exports.sbrk,E=b+3&-4,S=w(E*v),R=w(C.length),N=new Uint8Array(A.exports.memory.buffer);N.set(C,R);var F=x(S,b,v,R,C.length);if(F==0&&M&&M(S,E,v),_.set(N.subarray(S,S+b*v)),w(S-w(0)),F!=0)throw new Error("Malformed buffer data: "+F)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},u={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},h=[],d=0;function f(A){var x={object:new Worker(A),pending:0,requests:{}};return x.object.onmessage=function(_){var b=_.data;x.pending-=b.count,x.requests[b.id][b.action](b.value),delete x.requests[b.id]},x}function p(A){for(var x="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(i)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+m.name+";"+c.toString()+m.toString(),_=new Blob([x],{type:"text/javascript"}),b=URL.createObjectURL(_),v=h.length;v<A;++v)h[v]=f(b);for(var v=A;v<h.length;++v)h[v].object.postMessage({});h.length=A,URL.revokeObjectURL(b)}function g(A,x,_,b,v){for(var C=h[0],M=1;M<h.length;++M)h[M].pending<C.pending&&(C=h[M]);return new Promise(function(w,E){var S=new Uint8Array(_),R=++d;
4420C.pending+=A,C.requests[R]={resolve:w,reject:E},C.object.postMessage({id:R,count:A,size:x,source:S,mode:b,filter:v},[S.buffer])})}function m(A){var x=A.data;if(!x.id)return self.close();self.ready.then(function(_){try{var b=new Uint8Array(x.count*x.size);c(_,_.exports[x.mode],b,x.count,x.size,x.source,_.exports[x.filter]),self.postMessage({id:x.id,count:x.count,action:"resolve",value:b},[b.buffer])}catch(v){self.postMessage({id:x.id,count:x.count,action:"reject",value:v})}})}return{ready:a,supported:!0,useWorkers:function(A){p(A)},decodeVertexBuffer:function(A,x,_,b,v){c(s,s.exports.meshopt_decodeVertexBuffer,A,x,_,b,s.exports[l[v]])},decodeIndexBuffer:function(A,x,_,b){c(s,s.exports.meshopt_decodeIndexBuffer,A,x,_,b)},decodeIndexSequence:function(A,x,_,b){c(s,s.exports.meshopt_decodeIndexSequence,A,x,_,b)},decodeGltfBuffer:function(A,x,_,b,v,C){c(s,s.exports[u[v]],A,x,_,b,s.exports[l[C]])},decodeGltfBufferAsync:function(A,x,_,b,v){return h.length>0?g(A,x,_,u[b],l[v]):a.then(function(){var C=new Uint8Array(A*x);return c(s,s.exports[u[b]],C,A,x,_,s.exports[l[v]]),C})}}})();const Uh=new WeakMap;class Fw extends vi{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const s=new zi(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,a=>{this.parse(a,t,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,bt,n).catch(n)}decodeDracoFile(e,t,n,i,s=St,a=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:s};return this.decodeGeometry(e,o).then(t).catch(a)}decodeGeometry(e,t){const n=JSON.stringify(t);if(Uh.has(e)){const c=Uh.get(e);if(c.key===n)return c.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const s=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(s,a).then(c=>(i=c,new Promise((l,u)=>{i._callbacks[s]={resolve:l,reject:u},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return o.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),Uh.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new sn;e.index&&t.setIndex(new Bt(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const{name:i,array:s,itemSize:a,stride:o,vertexColorSpace:c}=e.attributes[n];let l;if(a===o)l=new Bt(s,a);else{const u=new T0(s,o);l=new kl(u,a,0)}i==="color"&&(this._assignVertexColorSpace(l,c),l.normalized=!(s instanceof Float32Array)),t.setAttribute(i,l)}return t}_assignVertexColorSpace(e,t){if(t!==bt)return;const n=new Ie;for(let i=0,s=e.count;i<s;i++)n.fromBufferAttribute(e,i),Ze.colorSpaceToWorking(n,bt),e.setXYZ(i,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new zi(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,s)=>{n.load(e,i,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const s=Pw.toString(),a=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(` 4421`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>
vendor: 34,533 bytes, line 4421
4421{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){const a=s.data;switch(a.type){case"decode":i._callbacks[a.id].resolve(a);break;case"error":i._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function Pw(){let r,e;onmessage=function(a){const o=a.data;switch(o.type){case"init":r=o.decoderConfig,e=new Promise(function(u){r.onModuleLoaded=function(h){u({draco:h})},DracoDecoderModule(r)});break;case"decode":const c=o.buffer,l=o.taskConfig;e.then(u=>{const h=u.draco,d=new h.Decoder;try{const f=t(h,d,new Int8Array(c),l),p=f.attributes.map(g=>g.array.buffer);f.index&&p.push(f.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:f},p)}catch(f){console.error(f),self.postMessage({type:"error",id:o.id,error:f.message})}finally{h.destroy(d)}});break}};function t(a,o,c,l){const u=l.attributeIDs,h=l.attributeTypes;let d,f;const p=o.GetEncodedGeometryType(c);if(p===a.TRIANGULAR_MESH)d=new a.Mesh,f=o.DecodeArrayToMesh(c,c.byteLength,d);else if(p===a.POINT_CLOUD)d=new a.PointCloud,f=o.DecodeArrayToPointCloud(c,c.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());const g={index:null,attributes:[]};for(const m in u){const A=self[h[m]];let x,_;if(l.useUniqueIDs)_=u[m],x=o.GetAttributeByUniqueId(d,_);else{if(_=o.GetAttributeId(d,a[u[m]]),_===-1)continue;x=o.GetAttribute(d,_)}const b=i(a,o,d,m,A,x);m==="color"&&(b.vertexColorSpace=l.vertexColorSpace),g.attributes.push(b)}return p===a.TRIANGULAR_MESH&&(g.index=n(a,o,d)),a.destroy(d),g}function n(a,o,c){const u=c.num_faces()*3,h=u*4,d=a._malloc(h);o.GetTrianglesUInt32Array(c,h,d);const f=new Uint32Array(a.HEAPF32.buffer,d,u).slice();return a._free(d),{array:f,itemSize:1}}function i(a,o,c,l,u,h){const d=c.num_points(),f=h.num_components(),p=s(a,u),g=f*u.BYTES_PER_ELEMENT,m=Math.ceil(g/4)*4,A=m/u.BYTES_PER_ELEMENT,x=d*g,_=d*m,b=a._malloc(x);o.GetAttributeDataArrayForAllPoints(c,h,p,x,b);const v=new u(a.HEAPF32.buffer,b,x/u.BYTES_PER_ELEMENT);let C;if(g===m)C=v.slice();else{C=new u(_/u.BYTES_PER_ELEMENT);let M=0;for(let w=0,E=v.length;w<E;w++){for(let S=0;S<f;S++)C[M+S]=v[w*f+S];M+=A}}return a._free(b),{name:l,count:d,itemSize:f,array:C,stride:A}}function s(a,o){switch(o){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}function RA(r,e){if(e===O_)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===Md||e===g0){let t=r.getIndex();if(t===null){const a=[],o=r.getAttribute("position");if(o!==void 0){for(let c=0;c<o.count;c++)a.push(c);r.setIndex(a),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const n=t.count-2,i=[];if(e===Md)for(let a=1;a<=n;a++)i.push(t.getX(0)),i.push(t.getX(a)),i.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(i.push(t.getX(a)),i.push(t.getX(a+1)),i.push(t.getX(a+2))):(i.push(t.getX(a+2)),i.push(t.getX(a+1)),i.push(t.getX(a)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}class Nw extends vi{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Gw(t)}),this.register(function(t){return new Hw(t)}),this.register(function(t){return new Kw(t)}),this.register(function(t){return new Jw(t)}),this.register(function(t){return new Zw(t)}),this.register(function(t){return new Vw(t)}),this.register(function(t){return new Ww(t)}),this.register(function(t){return new qw(t)}),this.register(function(t){return new Xw(t)}),this.register(function(t){return new Qw(t)}),this.register(function(t){return new $w(t)}),this.register(function(t){return new zw(t)}),this.register(function(t){return new jw(t)}),this.register(function(t){return new Yw(t)}),this.register(function(t){return new Ow(t)}),this.register(function(t){return new eT(t)}),this.register(function(t){return new tT(t)})}load(e,t,n,i){const s=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const l=ho.extractUrlBase(e);a=ho.resolveURL(l,this.path)}else a=ho.extractUrlBase(e);this.manager.itemStart(e);const o=function(l){i?i(l):console.error(l),s.manager.itemError(e),s.manager.itemEnd(e)},c=new zi(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{s.parse(l,a,function(u){t(u),s.manager.itemEnd(e)},o)}catch(u){o(u)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let s;const a={},o={},c=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===fx){try{a[et.KHR_BINARY_GLTF]=new nT(e)}catch(h){i&&i(h);return}s=JSON.parse(a[et.KHR_BINARY_GLTF].content)}else s=JSON.parse(c.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new AT(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const h=this.pluginCallbacks[u](l);h.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[h.name]=h,a[h.name]=!0}if(s.extensionsUsed)for(let u=0;u<s.extensionsUsed.length;++u){const h=s.extensionsUsed[u],d=s.extensionsRequired||[];switch(h){case et.KHR_MATERIALS_UNLIT:a[h]=new kw;break;case et.KHR_DRACO_MESH_COMPRESSION:a[h]=new iT(s,this.dracoLoader);break;case et.KHR_TEXTURE_TRANSFORM:a[h]=new sT;break;case et.KHR_MESH_QUANTIZATION:a[h]=new rT;break;default:d.indexOf(h)>=0&&o[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}}function Uw(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const et={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Ow{constructor(e){this.parser=e,this.name=et.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const s=t[n];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const s=t.json,c=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let l;const u=new Ie(16777215);c.color!==void 0&&u.setRGB(c.color[0],c.color[1],c.color[2],St);const h=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new j0(u),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new Y0(u),l.distance=h;break;case"spot":l=new GE(u),l.distance=h,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),ui(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),i=Promise.resolve(l),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,s=n.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(c){return n._getNodeRef(t.cache,o,c)})}}let kw=class{constructor(){this.name=et.KHR_MATERIALS_UNLIT}getMaterialType(){return ln}extendParams(e,t,n){const i=[];e.color=new Ie(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const a=s.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],St),e.opacity=a[3]}s.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",s.baseColorTexture,bt))}return Promise.all(i)}},Qw=class{constructor(e){this.parser=e,this.name=et.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}},Gw=class{constructor(e){this.parser=e,this.name=et.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:_i}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(s.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new pe(o,o)}return Promise.all(s)}},Hw=class{constructor(e){this.parser=e,this.name=et.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:_i}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return t.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}},zw=class{constructor(e){this.parser=e,this.name=et.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:_i}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(s)}},Vw=class{constructor(e){this.parser=e,this.name=et.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:_i}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new Ie(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=i.extensions[this.name];if(a.sheenColorFactor!==void 0){const o=a.sheenColorFactor;t.sheenColor.setRGB(o[0],o[1],o[2],St)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&s.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,bt)),a.sheenRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(s)}},Ww=class{constructor(e){this.parser=e,this.name=et.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:_i}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&s.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(s)}},qw=class{constructor(e){this.parser=e,this.name=et.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:_i}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&s.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=new Ie().setRGB(o[0],o[1],o[2],St),Promise.all(s)}},Xw=class{constructor(e){this.parser=e,this.name=et.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:_i}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}},$w=class{constructor(e){this.parser=e,this.name=et.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:_i}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&s.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=new Ie().setRGB(o[0],o[1],o[2],St),a.specularColorTexture!==void 0&&s.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,bt)),Promise.all(s)}},Yw=class{constructor(e){this.parser=e,this.name=et.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:_i}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&s.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(s)}},jw=class{constructor(e){this.parser=e,this.name=et.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:_i}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&s.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(s)}};class Kw{constructor(e){this.parser=e,this.name=et.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const s=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,a)}}class Jw{constructor(e){this.parser=e,this.name=et.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=i.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}}class Zw{constructor(e){this.parser=e,this.name=et.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=i.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}}class eT{constructor(e){this.name=et.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(o){const c=i.byteOffset||0,l=i.byteLength||0,u=i.count,h=i.byteStride,d=new Uint8Array(o,c,l);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(u,h,d,i.mode,i.filter).then(function(f){return f.buffer}):a.ready.then(function(){const f=new ArrayBuffer(u*h);return a.decodeGltfBuffer(new Uint8Array(f),u,h,d,i.mode,i.filter),f})})}else return null}}let tT=class{constructor(e){this.name=et.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const l of i.primitives)if(l.mode!==On.TRIANGLES&&l.mode!==On.TRIANGLE_STRIP&&l.mode!==On.TRIANGLE_FAN&&l.mode!==void 0)return null;const a=n.extensions[this.name].attributes,o=[],c={};for(const l in a)o.push(this.parser.getDependency("accessor",a[l]).then(u=>(c[l]=u,c[l])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(l=>{const u=l.pop(),h=u.isGroup?u.children:[u],d=l[0].count,f=[];for(const p of h){const g=new Ue,m=new B,A=new xn,x=new B(1,1,1),_=new kv(p.geometry,p.material,d);for(let b=0;b<d;b++)c.TRANSLATION&&m.fromBufferAttribute(c.TRANSLATION,b),c.ROTATION&&A.fromBufferAttribute(c.ROTATION,b),c.SCALE&&x.fromBufferAttribute(c.SCALE,b),_.setMatrixAt(b,g.compose(m,A,x));for(const b in c)if(b==="_COLOR_0"){const v=c[b];_.instanceColor=new Rd(v.array,v.itemSize,v.normalized)}else b!=="TRANSLATION"&&b!=="ROTATION"&&b!=="SCALE"&&p.geometry.setAttribute(b,c[b]);mt.prototype.copy.call(_,p),this.parser.assignFinalMaterial(_),f.push(_)}return u.isGroup?(u.clear(),u.add(...f),u):f[0]}))}};const fx="glTF",Ia=12,BA={JSON:1313821514,BIN:5130562};class nT{constructor(e){this.name=et.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Ia),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==fx)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Ia,s=new DataView(e,Ia);let a=0;for(;a<i;){const o=s.getUint32(a,!0);a+=4;const c=s.getUint32(a,!0);if(a+=4,c===BA.JSON){const l=new Uint8Array(e,Ia+a,o);this.content=n.decode(l)}else if(c===BA.BIN){const l=Ia+a;this.body=e.slice(l,l+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class iT{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=et.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},c={},l={};for(const u in a){const h=Qd[u]||u.toLowerCase();o[h]=a[u]}for(const u in e.attributes){const h=Qd[u]||u.toLowerCase();if(a[u]!==void 0){const d=n.accessors[e.attributes[u]],f=zr[d.componentType];l[h]=f.name,c[h]=d.normalized===!0}}return t.getDependency("bufferView",s).then(function(u){return new Promise(function(h,d){i.decodeDracoFile(u,function(f){for(const p in f.attributes){const g=f.attributes[p],m=c[p];m!==void 0&&(g.normalized=m)}h(f)},o,l,St,d)})})}}class sT{constructor(){this.name=et.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class rT{constructor(){this.name=et.KHR_MESH_QUANTIZATION}}class px extends Do{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let a=0;a!==i;a++)t[a]=n[s+a];return t}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=o*2,l=o*3,u=i-t,h=(n-t)/u,d=h*h,f=d*h,p=e*l,g=p-l,m=-2*f+3*d,A=f-d,x=1-m,_=A-d+h;for(let b=0;b!==o;b++){const v=a[g+b+o],C=a[g+b+c]*u,M=a[p+b+o],w=a[p+b]*u;s[b]=x*v+_*C+m*M+A*w}return s}}const aT=new xn;class oT extends px{interpolate_(e,t,n,i){const s=super.interpolate_(e,t,n,i);return aT.fromArray(s).normalize().toArray(s),s}}const On={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},zr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},DA={9728:yt,9729:We,9984:la,9985:Gs,9986:rs,9987:gn},LA={33071:Lt,33648:Ws,10497:ni},Oh={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Qd={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Ji={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},cT={CUBICSPLINE:void 0,LINEAR:Zr,STEP:Jr},kh={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function lT(r){return r.DefaultMaterial===void 0&&(r.DefaultMaterial=new Mo({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ti})),r.DefaultMaterial}function ys(r,e,t){for(const n in t.extensions)r[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function ui(r,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(r.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function hT(r,e,t){let n=!1,i=!1,s=!1;for(let l=0,u=e.length;l<u;l++){const h=e[l];if(h.POSITION!==void 0&&(n=!0),h.NORMAL!==void 0&&(i=!0),h.COLOR_0!==void 0&&(s=!0),n&&i&&s)break}if(!n&&!i&&!s)return Promise.resolve(r);const a=[],o=[],c=[];for(let l=0,u=e.length;l<u;l++){const h=e[l];if(n){const d=h.POSITION!==void 0?t.getDependency("accessor",h.POSITION):r.attributes.position;a.push(d)}if(i){const d=h.NORMAL!==void 0?t.getDependency("accessor",h.NORMAL):r.attributes.normal;o.push(d)}if(s){const d=h.COLOR_0!==void 0?t.getDependency("accessor",h.COLOR_0):r.attributes.color;c.push(d)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c)]).then(function(l){const u=l[0],h=l[1],d=l[2];return n&&(r.morphAttributes.position=u),i&&(r.morphAttributes.normal=h),s&&(r.morphAttributes.color=d),r.morphTargetsRelative=!0,r})}function uT(r,e){if(r.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)r.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(r.morphTargetInfluences.length===t.length){r.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)r.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function dT(r){let e;const t=r.extensions&&r.extensions[et.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Qh(t.attributes):e=r.indices+":"+Qh(r.attributes)+":"+r.mode,r.targets!==void 0)for(let n=0,i=r.targets.length;n<i;n++)e+=":"+Qh(r.targets[n]);return e}function Qh(r){let e="";const t=Object.keys(r).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+r[t[n]]+";";return e}function Gd(r){switch(r){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function fT(r){return r.search(/\.jpe?g($|\?)/i)>0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":r.search(/\.ktx2($|\?)/i)>0||r.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const pT=new Ue;class AT{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Uw,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,s=!1,a=-1;if(typeof navigator<"u"){const o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;const c=o.match(/Version\/(\d+)/);i=n&&c?parseInt(c[1],10):-1,s=o.indexOf("Firefox")>-1,a=s?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||s&&a<98?this.textureLoader=new $0(this.options.manager):this.textureLoader=new qE(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new zi(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return ys(s,o,i),ui(o,i),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(o)})).then(function(){for(const c of o.scenes)c.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i<s;i++){const a=t[i].joints;for(let o=0,c=a.length;o<c;o++)e[a[o]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const a=e[i];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),s=(a,o)=>{const c=this.associations.get(a);c!=null&&this.associations.set(o,c);for(const[l,u]of a.children.entries())s(u,o.children[l])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const s=e(t[i]);s&&n.push(s)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(s,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[et.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(s,a){n.load(ho.resolveURL(t.uri,i.path),s,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const i=t.byteLength||0,s=t.byteOffset||0;return n.slice(s,s+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const a=Oh[i.type],o=zr[i.componentType],c=i.normalized===!0,l=new o(i.count*a);return Promise.resolve(new Bt(l,a,c))}const s=[];return i.bufferView!==void 0?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),i.sparse!==void 0&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then(function(a){const o=a[0],c=Oh[i.type],l=zr[i.componentType],u=l.BYTES_PER_ELEMENT,h=u*c,d=i.byteOffset||0,f=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,p=i.normalized===!0;let g,m;if(f&&f!==h){const A=Math.floor(d/f),x="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+A+":"+i.count;let _=t.cache.get(x);_||(g=new l(o,A*f,i.count*f/u),_=new T0(g,f/u),t.cache.add(x,_)),m=new kl(_,c,d%f/u,p)}else o===null?g=new l(i.count*c):g=new l(o,d,i.count*c),m=new Bt(g,c,p);if(i.sparse!==void 0){const A=Oh.SCALAR,x=zr[i.sparse.indices.componentType],_=i.sparse.indices.byteOffset||0,b=i.sparse.values.byteOffset||0,v=new x(a[1],_,i.sparse.count*A),C=new l(a[2],b,i.sparse.count*c);o!==null&&(m=new Bt(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let M=0,w=v.length;M<w;M++){const E=v[M];if(m.setX(E,C[M*c]),c>=2&&m.setY(E,C[M*c+1]),c>=3&&m.setZ(E,C[M*c+2]),c>=4&&m.setW(E,C[M*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=p}return m})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,a=t.images[s];let o=this.textureLoader;if(a.uri){const c=n.manager.getHandler(a.uri);c!==null&&(o=c)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,t,n){const i=this,s=this.json,a=s.textures[e],o=s.images[t],c=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(t,n).then(function(u){u.flipY=!1,u.name=a.name||o.name||"",u.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(u.name=o.uri);const d=(s.samplers||{})[a.sampler]||{};return u.magFilter=DA[d.magFilter]||We,u.minFilter=DA[d.minFilter]||gn,u.wrapS=LA[d.wrapS]||ni,u.wrapT=LA[d.wrapT]||ni,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==yt&&u.minFilter!==We,i.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){const n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(
vendor: 1,218 bytes, line 4421
4421h=>h.clone());const a=i.images[e],o=self.URL||self.webkitURL;let c=a.uri||"",l=!1;if(a.bufferView!==void 0)c=n.getDependency("bufferView",a.bufferView).then(function(h){l=!0;const d=new Blob([h],{type:a.mimeType});return c=o.createObjectURL(d),c});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(c).then(function(h){return new Promise(function(d,f){let p=d;t.isImageBitmapLoader===!0&&(p=function(g){const m=new Rt(g);m.needsUpdate=!0,d(m)}),t.load(ho.resolveURL(h,s.path),p,void 0,f)})}).then(function(h){return l===!0&&o.revokeObjectURL(c),ui(h,a),h.userData.mimeType=a.mimeType||fT(a.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),h});return this.sourceCache[e]=u,u}assignTexture(e,t,n,i){const s=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),s.extensions[et.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[et.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const c=s.associations.get(a);a=s.extensions[et.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),s.associations.set(a,c)}}
vendor: 5,795 bytes, line 4421
4421return i!==void 0&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new D0,ei.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(o,c)),n=c}else if(e.isLine){const o="LineBasicMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new B0,ei.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(o,c)),n=c}if(i||s||a){let o="ClonedMaterial:"+n.uuid+":";i&&(o+="derivative-tangents:"),s&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let c=this.cache.get(o);c||(c=n.clone(),s&&(c.vertexColors=!0),a&&(c.flatShading=!0),i&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(o,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return Mo}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let a;const o={},c=s.extensions||{},l=[];if(c[et.KHR_MATERIALS_UNLIT]){const h=i[et.KHR_MATERIALS_UNLIT];a=h.getMaterialType(),l.push(h.extendParams(o,s,t))}else{const h=s.pbrMetallicRoughness||{};if(o.color=new Ie(1,1,1),o.opacity=1,Array.isArray(h.baseColorFactor)){const d=h.baseColorFactor;o.color.setRGB(d[0],d[1],d[2],St),o.opacity=d[3]}h.baseColorTexture!==void 0&&l.push(t.assignTexture(o,"map",h.baseColorTexture,bt)),o.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,o.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(o,"metalnessMap",h.metallicRoughnessTexture)),l.push(t.assignTexture(o,"roughnessMap",h.metallicRoughnessTexture))),a=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,o)})))}s.doubleSided===!0&&(o.side=Vt);const u=s.alphaMode||kh.OPAQUE;if(u===kh.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,u===kh.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==ln&&(l.push(t.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new pe(1,1),s.normalTexture.scale!==void 0)){const h=s.normalTexture.scale;o.normalScale.set(h,h)}if(s.occlusionTexture!==void 0&&a!==ln&&(l.push(t.assignTexture(o,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==ln){const h=s.emissiveFactor;o.emissive=new Ie().setRGB(h[0],h[1],h[2],St)}return s.emissiveTexture!==void 0&&a!==ln&&l.push(t.assignTexture(o,"emissiveMap",s.emissiveTexture,bt)),Promise.all(l).then(function(){const h=new a(o);return s.name&&(h.name=s.name),ui(h,s),t.associations.set(h,{materials:e}),s.extensions&&ys(i,h,s),h})}createUniqueName(e){const t=nt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(o){return n[et.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(c){return FA(c,o,t)})}const a=[];for(let o=0,c=e.length;o<c;o++){const l=e[o],u=dT(l),h=i[u];if(h)a.push(h.promise);else{let d;l.extensions&&l.extensions[et.KHR_DRACO_MESH_COMPRESSION]?d=s(l):d=FA(new sn,l,t),i[u]={primitive:l,promise:d},a.push(d)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,i=this.extensions,s=n.meshes[e],a=s.primitives,o=[];for(let c=0,l=a.length;c<l;c++){const u=a[c].material===void 0?lT(this.cache):this.getDependency("material",a[c].material);o.push(u)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(c){const l=c.slice(0,c.length-1),u=c[c.length-1],h=[];for(let f=0,p=u.length;f<p;f++){const g=u[f],m=a[f];let A;const x=l[f];if(m.mode===On.TRIANGLES||m.mode===On.TRIANGLE_STRIP||m.mode===On.TRIANGLE_FAN||m.mode===void 0)A=s.isSkinnedMesh===!0?new Nv(g,x):new ot(g,x),A.isSkinnedMesh===!0&&A.normalizeSkinWeights(),m.mode===On.TRIANGLE_STRIP?A.geometry=RA(A.geometry,g0):m.mode===On.TRIANGLE_FAN&&(A.geometry=RA(A.geometry,Md));else if(m.mode===On.LINES)A=new zv(g,x);else if(m.mode===On.LINE_STRIP)A=new Eo(g,x);else if(m.mode===On.LINE_LOOP)A=new Vv(g,x);else if(m.mode===On.POINTS)A=new Wv(g,x);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(A.geometry.morphAttributes).length>0&&uT(A,s),A.name=t.createUniqueName(s.name||"mesh_"+e),ui(A,s),m.extensions&&ys(i,A,m),t.assignFinalMaterial(A),h.push(A)}for(let f=0,p=h.length;f<p;f++)t.associations.set(h[f],{meshes:e,primitives:f});if(h.length===1)return s.extensions&&ys(i,h[0],s),h[0];const d=new os;s.extensions&&ys(i,d,s),t.associations.set(d,{meshes:e});for(let f=0,p=h.length;f<p;f++)d.add(h[f]);return d})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new tn(xl.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new Js(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),ui(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i<s;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const s=i.pop(),a=i,o=[],c=[];for(let l=0,u=a.length;l<u;l++){const h=a[l];if(h){o.push(h);const d=new Ue;s!==null&&d.fromArray(s.array,l*16),c.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}
4421return new yf(o,c)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],s=i.name?i.name:"animation_"+e,a=[],o=[],c=[],l=[],u=[];for(let h=0,d=i.channels.length;h<d;h++){const f=i.channels[h],p=i.samplers[f.sampler],g=f.target,m=g.node,A=i.parameters!==void 0?i.parameters[p.input]:p.input,x=i.parameters!==void 0?i.parameters[p.output]:p.output;g.node!==void 0&&(a.push(this.getDependency("node",m)),o.push(this.getDependency("accessor",A)),c.push(this.getDependency("accessor",x)),l.push(p),u.push(g))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(l),Promise.all(u)]).then(function(h){const d=h[0],f=h[1],p=h[2],g=h[3],m=h[4],A=[];for(let _=0,b=d.length;_<b;_++){const v=d[_],C=f[_],M=p[_],w=g[_],E=m[_];if(v===void 0)continue;v.updateMatrix&&v.updateMatrix();const S=n._createAnimationTracks(v,C,M,w,E);if(S)for(let R=0;R<S.length;R++)A.push(S[R])}const x=new Pd(s,void 0,A);return ui(x,i),x})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(s){const a=n._getNodeRef(n.meshCache,i.mesh,s);return i.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let c=0,l=i.weights.length;c<l;c++)o.morphTargetInfluences[c]=i.weights[c]}),a})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],s=n._loadNodeShallow(e),a=[],o=i.children||[];for(let l=0,u=o.length;l<u;l++)a.push(n.getDependency("node",o[l]));const c=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([s,Promise.all(a),c]).then(function(l){const u=l[0],h=l[1],d=l[2];d!==null&&u.traverse(function(f){f.isSkinnedMesh&&f.bind(d,pT)});for(let f=0,p=h.length;f<p;f++)u.add(h[f]);return u})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],a=s.name?i.createUniqueName(s.name):"",o=[],c=i._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&o.push(c),s.camera!==void 0&&o.push(i.getDependency("camera",s.camera).then(function(l){return i._getNodeRef(i.cameraCache,s.camera,l)})),i._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){o.push(l)}),this.nodeCache[e]=Promise.all(o).then(function(l){let u;if(s.isBone===!0?u=new R0:l.length>1?u=new os:l.length===1?u=l[0]:u=new mt,u!==l[0])for(let h=0,d=l.length;h<d;h++)u.add(l[h]);if(s.name&&(u.userData.name=s.name,u.name=a),ui(u,s),s.extensions&&ys(n,u,s),s.matrix!==void 0){const h=new Ue;h.fromArray(s.matrix),u.applyMatrix4(h)}else s.translation!==void 0&&u.position.fromArray(s.translation),s.rotation!==void 0&&u.quaternion.fromArray(s.rotation),s.scale!==void 0&&u.scale.fromArray(s.scale);if(!i.associations.has(u))i.associations.set(u,{});else if(s.mesh!==void 0&&i.meshCache.refs[s.mesh]>1){const h=i.associations.get(u);i.associations.set(u,{...h})}return i.associations.get(u).nodes=e,u}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,s=new os;n.name&&(s.name=i.createUniqueName(n.name)),ui(s,n),n.extensions&&ys(t,s,n);const a=n.nodes||[],o=[];for(let c=0,l=a.length;c<l;c++)o.push(i.getDependency("node",a[c]));return Promise.all(o).then(function(c){for(let u=0,h=c.length;u<h;u++)s.add(c[u]);const l=u=>{const h=new Map;for(const[d,f]of i.associations)(d instanceof ei||d instanceof Rt)&&h.set(d,f);return u.traverse(d=>{const f=i.associations.get(d);f!=null&&h.set(d,f)}),h};return i.associations=l(s),s})}_createAnimationTracks(e,t,n,i,s){const a=[],o=e.name?e.name:e.uuid,c=[];Ji[s.path]===Ji.weights?e.traverse(function(d){d.morphTargetInfluences&&c.push(d.name?d.name:d.uuid)}):c.push(o);let l;switch(Ji[s.path]){case Ji.weights:l=ia;break;case Ji.rotation:l=sa;break;case Ji.translation:case Ji.scale:l=ra;break;default:n.itemSize===1?l=ia:l=ra;break}const u=i.interpolation!==void 0?cT[i.interpolation]:Zr,h=this._getArrayFromAccessor(n);for(let d=0,f=c.length;d<f;d++){const p=new l(c[d]+"."+Ji[s.path],t.array,h,u);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(p),a.push(p)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Gd(t.constructor),i=new Float32Array(t.length);for(let s=0,a=t.length;s<a;s++)i[s]=t[s]*n;t=i}return t}
vendor: 4,715 bytes, line 4421
4421_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof sa?oT:px;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function mT(r,e,t){const n=e.attributes,i=new cn;if(n.POSITION!==void 0){const o=t.json.accessors[n.POSITION],c=o.min,l=o.max;if(c!==void 0&&l!==void 0){if(i.set(new B(c[0],c[1],c[2]),new B(l[0],l[1],l[2])),o.normalized){const u=Gd(zr[o.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const o=new B,c=new B;for(let l=0,u=s.length;l<u;l++){const h=s[l];if(h.POSITION!==void 0){const d=t.json.accessors[h.POSITION],f=d.min,p=d.max;if(f!==void 0&&p!==void 0){if(c.setX(Math.max(Math.abs(f[0]),Math.abs(p[0]))),c.setY(Math.max(Math.abs(f[1]),Math.abs(p[1]))),c.setZ(Math.max(Math.abs(f[2]),Math.abs(p[2]))),d.normalized){const g=Gd(zr[d.componentType]);c.multiplyScalar(g)}o.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(o)}r.boundingBox=i;const a=new Wn;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,r.boundingSphere=a}function FA(r,e,t){const n=e.attributes,i=[];function s(a,o){return t.getDependency("accessor",a).then(function(c){r.setAttribute(o,c)})}for(const a in n){const o=Qd[a]||a.toLowerCase();o in r.attributes||i.push(s(n[a],o))}if(e.indices!==void 0&&!r.index){const a=t.getDependency("accessor",e.indices).then(function(o){r.setIndex(o)});i.push(a)}return Ze.workingColorSpace!==St&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ze.workingColorSpace}" not supported.`),ui(r,e),mT(r,e,t),Promise.all(i).then(function(){return e.targets!==void 0?hT(r,e.targets,t):r})}class gT{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:i,msg:s,transfer:a}=this.queue.shift();this.workersResolve[e]=i,this.workers[e].postMessage(s,a)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(n=>{const i=this._getIdleWorker();i!==-1?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(e,t)):this.queue.push({resolve:n,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const xT=0,PA=2,bT=1,NA=2,_T=0,vT=1,ET=10,yT=0,Ax=9,mx=15,gx=16,xx=22,bx=37,_x=43,vx=76,Ex=83,yx=97,Sx=100,Cx=103,Ix=109,Mx=122,wx=123,Tx=131,Rx=132,Bx=133,Dx=134,Lx=137,Fx=138,Px=139,Nx=140,Ux=141,Ox=142,kx=145,Qx=146,Gx=148,Hx=152,Hd=153,ST=154,zd=155,CT=156,zx=157,Vx=158,Wx=165,qx=166,Xx=1000054e3,$x=1000054001,Yx=1000054004,jx=1000054005,Pf=1000066e3,Kx=1000066004;class Ma{constructor(e,t,n,i){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}const pn=[171,75,84,88,32,50,48,187,13,10,26,10];function UA(r){return new TextDecoder().decode(r)}function IT(r){const e=new Uint8Array(r.buffer,r.byteOffset,pn.length);if(e[0]!==pn[0]||e[1]!==pn[1]||e[2]!==pn[2]||e[3]!==pn[3]||e[4]!==pn[4]||e[5]!==pn[5]||e[6]!==pn[6]||e[7]!==
vendor: 3,927 bytes, line 4421
4421pn[7]||e[8]!==pn[8]||e[9]!==pn[9]||e[10]!==pn[10]||e[11]!==pn[11])throw new Error("Missing KTX 2.0 identifier.");const t={vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,levelCount:0,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null},n=17*Uint32Array.BYTES_PER_ELEMENT,i=new Ma(r,pn.length,n,!0);t.vkFormat=i._nextUint32(),t.typeSize=i._nextUint32(),t.pixelWidth=i._nextUint32(),t.pixelHeight=i._nextUint32(),t.pixelDepth=i._nextUint32(),t.layerCount=i._nextUint32(),t.faceCount=i._nextUint32(),t.levelCount=i._nextUint32(),t.supercompressionScheme=i._nextUint32();const s=i._nextUint32(),a=i._nextUint32(),o=i._nextUint32(),c=i._nextUint32(),l=i._nextUint64(),u=i._nextUint64(),h=3*Math.max(t.levelCount,1)*8,d=new Ma(r,pn.length+n,h,!0);for(let Y=0,re=Math.max(t.levelCount,1);Y<re;Y++)t.levels.push({levelData:new Uint8Array(r.buffer,r.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const f=new Ma(r,s,a,!0);f._skip(4);const p=f._nextUint16(),g=f._nextUint16(),m=f._nextUint16(),A=f._nextUint16(),x={vendorId:p,descriptorType:g,versionNumber:m,colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},_=(A/4-6)/4;for(let Y=0;Y<_;Y++){const re={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:Number.NEGATIVE_INFINITY,sampleUpper:Number.POSITIVE_INFINITY};64&re.channelType?(re.sampleLower=f._nextInt32(),re.sampleUpper=f._nextInt32()):(re.sampleLower=f._nextUint32(),re.sampleUpper=f._nextUint32()),x.samples[Y]=re}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(x);const b=new Ma(r,o,c,!0);for(;b._offset<c;){const Y=b._nextUint32(),re=b._scan(Y),Ae=UA(re);if(t.keyValue[Ae]=b._nextUint8Array(Y-re.byteLength-1),Ae.match(/^ktx/i)){const He=UA(t.keyValue[Ae]);t.keyValue[Ae]=He.substring(0,He.lastIndexOf("\0"))}b._skip(Y%4?4-Y%4:0)}if(u<=0)return t;const v=new Ma(r,l,u,!0),C=v._nextUint16(),M=v._nextUint16(),w=v._nextUint32(),E=v._nextUint32(),S=v._nextUint32(),R=v._nextUint32(),N=[];for(let Y=0,re=Math.max(t.levelCount,1);Y<re;Y++)N.push({imageFlags:v._nextUint32(),rgbSliceByteOffset:v._nextUint32(),rgbSliceByteLength:v._nextUint32(),alphaSliceByteOffset:v._nextUint32(),alphaSliceByteLength:v._nextUint32()});const F=l+v._offset,P=F+w,Q=P+E,U=Q+S,G=new Uint8Array(r.buffer,r.byteOffset+F,w),q=new Uint8Array(r.buffer,r.byteOffset+P,E),J=new Uint8Array(r.buffer,r.byteOffset+Q,S),Z=new Uint8Array(r.buffer,r.byteOffset+U,R);return t.globalData={endpointCount:C,selectorCount:M,imageDescs:N,endpointsData:G,selectorsData:q,tablesData:J,extendedData:Z},t}let Gh,Ni,Vd;const Hh={env:{emscripten_notify_memory_growth:function(r){Vd=new Uint8Array(Ni.exports.memory.buffer)}}};class MT{init(){return Gh||(Gh=typeof fetch<"u"?fetch("data:application/wasm;base64,"+OA).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Hh)).then(this._init):WebAssembly.instantiate(Buffer.from(OA,"base64"),Hh).then(this._init),Gh)}_init(e){Ni=e.instance,Hh.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Ni)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,i=Ni.exports.malloc(n);Vd.set(e,i),t=t||Number(Ni.exports.ZSTD_findDecompressedSize(i,n));const s=Ni.exports.malloc(t),a=Ni.exports.ZSTD_decompress(s,t,i,n),o=Vd.slice(s,s+a);return Ni.exports.free(i),Ni.exports.free(s),o}}const OA="
vendor: 3,610 bytes, line 4421
4421AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQ
vendor: 35,368 bytes, line 4421
4421RBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",
4421wT="display-p3",TT="display-p3-linear";({...Ze.spaces[bt]});const zh=new WeakMap;let Vh=0,Wh;class Qn extends vi{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new gT,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return console.warn('KTX2Loader: "detectSupportAsync()" has been deprecated. Use "detectSupport()" and "await renderer.init();" when creating the renderer.'),await e.init(),this.detectSupport(e)}detectSupport(e){return e.isWebGPURenderer===!0?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-s3tc"),bptcSupported:e.hasFeature("texture-compression-bc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},typeof navigator<"u"&&navigator.platform.indexOf("Linux")>=0&&navigator.userAgent.indexOf("Firefox")>=0&&this.workerConfig.astcSupported&&this.workerConfig.etc2Supported&&this.workerConfig.bptcSupported&&this.workerConfig.dxtSupported&&(this.workerConfig.astcSupported=!1,this.workerConfig.etc2Supported=!1)),this}init(){if(!this.transcoderPending){const e=new zi(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new zi(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,i]).then(([s,a])=>{const o=Qn.BasisWorker.toString(),c=["/* constants */","let _EngineFormat = "+JSON.stringify(Qn.EngineFormat),"let _EngineType = "+JSON.stringify(Qn.EngineType),"let _TranscoderFormat = "+JSON.stringify(Qn.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Qn.BasisFormat),"/* basis_transcoder.js */",s,"/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(` 4422`);this.workerSourceURL=URL.createObjectURL(new Blob([c])),this.transcoderBinary=a,this.workerPool.setWorkerCreator(()=>{const l=new Worker(this.workerSourceURL),u=this.transcoderBinary.slice(0);return l.postMessage({type:"init",config:this.workerConfig,transcoderBinary:u},[u]),l})}),Vh>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Vh++}return this.transcoderPending}load(e,t,n,i){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const s=new zi(this.manager);s.setPath(this.path),s.setCrossOrigin(this.crossOrigin),s.setWithCredentials(this.withCredentials),s.setRequestHeader(this.requestHeader),s.setResponseType("arraybuffer"),s.load(e,a=>{this.parse(a,t,i)},n,i)}parse(e,t,n){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(zh.has(e))return zh.get(e).promise.then(t).catch(n);this._createTexture(e).then(i=>t?t(i):null).catch(n)}_createTextureFrom(e,t){const{type:n,error:i,data:{faces:s,width:a,height:o,format:c,type:l,dfdFlags:u}}=e;if(n==="error")return Promise.reject(i);let h;if(t.faceCount===6)h=new $v(s,c,l);else{const d=s[0].mipmaps;h=t.layerCount>1?new Xv(d,a,o,t.layerCount,c,l):new Vs(d,a,o,c,l)}return h.minFilter=s[0].mipmaps.length===1?We:gn,h.magFilter=We,h.generateMipmaps=!1,h.needsUpdate=!0,h.colorSpace
4422=Jx(t),h.premultiplyAlpha=!!(u&bT),h}async _createTexture(e,t={}){const n=IT(new Uint8Array(e)),i=n.vkFormat===Pf&&n.dataFormatDescriptor[0].colorModel===167;if(!(n.vkFormat===yT||i&&!this.workerConfig.astcHDRSupported))return BT(n);const a=t,o=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:a},[e])).then(c=>this._createTextureFrom(c.data,n));return zh.set(e,{promise:o}),o}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Vh--}}Qn.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2};Qn.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25};Qn.EngineFormat={RGBAFormat:Tt,RGBA_ASTC_4x4_Format:zs,RGB_BPTC_UNSIGNED_Format:cl,RGBA_BPTC_Format:Kr,RGBA_ETC2_EAC_Format:xo,RGBA_PVRTC_4BPPV1_Format:jr,RGBA_S3TC_DXT5_Format:so,RGB_
vendor: 4,395 bytes, line 4422
4422ETC1_Format:il,RGB_ETC2_Format:go,RGB_PVRTC_4BPPV1_Format:nl,RGBA_S3TC_DXT1_Format:Hs};Qn.EngineType={UnsignedByteType:Le,HalfFloatType:It,FloatType:Nt};Qn.BasisWorker=function(){let r,e,t;const n=_EngineFormat,i=_EngineType,s=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(p){const g=p.data;switch(g.type){case"init":r=g.config,o(g.transcoderBinary);break;case"transcode":e.then(()=>{try{const{faces:m,buffers:A,width:x,height:_,hasAlpha:b,format:v,type:C,dfdFlags:M}=c(g.buffer);self.postMessage({type:"transcode",id:g.id,data:{faces:m,width:x,height:_,hasAlpha:b,format:v,type:C,dfdFlags:M}},A)}catch(m){console.error(m),self.postMessage({type:"error",id:g.id,error:m.message})}});break}});function o(p){e=new Promise(g=>{t={wasmBinary:p,onRuntimeInitialized:g},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function c(p){const g=new t.KTX2File(new Uint8Array(p));function m(){g.close(),g.delete()}if(!g.isValid())throw m(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");let A;if(g.isUASTC())A=a.UASTC;else if(g.isETC1S())A=a.ETC1S;else if(g.isHDR())A=a.UASTC_HDR;else throw new Error("THREE.KTX2Loader: Unknown Basis encoding");const x=g.getWidth(),_=g.getHeight(),b=g.getLayers()||1,v=g.getLevels(),C=g.getFaces(),M=g.getHasAlpha(),w=g.getDFDFlags(),{transcoderFormat:E,engineFormat:S,engineType:R}=h(A,x,_,M);if(!x||!_||!v)throw m(),new Error("THREE.KTX2Loader: Invalid texture");if(!g.startTranscoding())throw m(),new Error("THREE.KTX2Loader: .startTranscoding failed");const N=[],F=[];for(let P=0;P<C;P++){const Q=[];for(let U=0;U<v;U++){const G=[];let q,J;for(let Y=0;Y<b;Y++){const re=g.getImageLevelInfo(U,Y,P);P===0&&U===0&&Y===0&&(re.origWidth%4!==0||re.origHeight%4!==0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),v>1?(q=re.origWidth,J=re.origHeight):(q=re.width,J=re.height);let Ae=new Uint8Array(g.getImageTranscodedSizeInBytes(U,Y,0,E));const He=g.transcodeImage(Ae,U,Y,P,E,0,-1,-1);if(R===i.HalfFloatType&&(Ae=new Uint16Array(Ae.buffer,Ae.byteOffset,Ae.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!He)throw m(),new Error("THREE.KTX2Loader: .transcodeImage failed.");G.push(Ae)}const Z=f(G);Q.push({data:Z,width:q,height:J}),F.push(Z.buffer)}N.push({mipmaps:Q,width:x,height:_,format:S,type:R})}return m(),{faces:N,buffers:F,width:x,height:_,hasAlpha:M,dfdFlags:w,format:S,type:R}}const l=[{if:"astcSupported",basisFormat:[a.UASTC],transcoderFormat:[s.ASTC_4x4,s.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],engineType:[i.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.BC7_M5,s.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],engineType:[i.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.BC1,s.BC3],engineFormat:[n.RGBA_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],engineType:[i.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.ETC1,s.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],engineType:[i.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.ETC1],engineFormat:[n.RGB_ETC1_Format],engineType:[i.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.PVRTC1_4_RGB,s.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],engineType:[i.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[a.UASTC_HDR],transcoderFormat:[s.BC6H],engineFormat:[n.RGB_BPTC_UNSIGNED_Format],engineType:[i.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.RGBA32,s.RGBA32],engineFormat:[n.RGBAFormat,n.RGBAFormat],engineType:[i.UnsignedByteType,i.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[a.UASTC_HDR],transcoderFormat:[s.RGBA_HALF],engineFormat:[n.RGBAFormat],engineType:[i.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}
4422],u={[a.ETC1S]:l.filter(p=>p.basisFormat.includes(a.ETC1S)).sort((p,g)=>p.priorityETC1S-g.priorityETC1S),[a.UASTC]:l.filter(p=>p.basisFormat.includes(a.UASTC)).sort((p,g)=>p.priorityUASTC-g.priorityUASTC),[a.UASTC_HDR]:l.filter(p=>p.basisFormat.includes(a.UASTC_HDR)).sort((p,g)=>p.priorityHDR-g.priorityHDR)};function h(p,g,m,A){const x=u[p];for(let _=0;_<x.length;_++){const b=x[_];if(b.if&&!r[b.if]||!b.basisFormat.includes(p)||A&&b.transcoderFormat.length<2||b.needsPowerOfTwo&&!(d(g)&&d(m)))continue;const v=b.transcoderFormat[A?1:0],C=b.engineFormat[A?1:0],M=b.engineType[0];return{transcoderFormat:v,engineFormat:C,engineType:M}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}function d(p){return p<=2?!0:(p&p-1)===0&&p!==0}function f(p){if(p.length===1)return p[0];let g=0;for(let x=0;x<p.length;x++){const _=p[x];g+=_.byteLength}const m=new Uint8Array(g);let A=0;for(let x=0;x<p.length;x++){const _=p[x];m.set(_,A),A+=_.byteLength}return m}};const RT=new Set([Tt,Ao,Jn,as]),qh={[Ix]:Tt,[Cx]:Jn,[Sx]:as,[yx]:Tt,[Ex]:Jn,[vx]:as,[_x]:Tt,[bx]:Tt,[xx]:Jn,[gx]:Jn,[mx]:as,[Ax]:as,[wx]:Ao,[Mx]:Ao,[Hx]:xo,[Gx]:go,[Hd]:sl,[ST]:rl,[zd]:al,[CT]:ol,[Pf]:zs,[Vx]:zs,[zx]:zs,[Kx]:Qr,[qx]:Qr,[Wx]:Qr,[Dx]:Hs,[Bx]:Hs,[Rx]:Or,[Tx]:Or,[Fx]:kr,[Lx]:kr,[Nx]:hl,[Px]:ll,[Ox]:dl,[Ux]:ul,[Qx]:Kr,[kx]:Kr,[jx]:jr,[$x]:jr,[Yx]:mo,[Xx]:mo},mr={[Ix]:Nt,[Cx]:Nt,[Sx]:Nt,[yx]:It,[Ex]:It,[vx]:It,[_x]:Le,[bx]:Le,[xx]:Le,[gx]:Le,[mx]:Le,[Ax]:Le,[wx]:Pl,[Mx]:Nl,[Hx]:Le,[Gx]:Le,[Hd]:Le,[Hd]:Le,[zd]:Le,[zd]:Le,[Pf]:It,[Vx]:Le,[zx]:Le,[Kx]:It,[qx]:Le,[Wx]:Le,[Dx]:Le,[Bx]:Le,[Rx]:Le,[Tx]:Le,[Fx]:Le,[Lx]:Le,[Nx]:Le,[Px]:Le,[Ox]:Le,[Ux]:Le,[Qx]:Le,[kx]:Le,[jx]:Le,[$x]:Le,[Yx]:Le,[Xx]:Le};async function BT(r){const{vkFormat:e}=r;if(qh[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat: "+e);mr[e]===void 0&&console.warn('THREE.KTX2Loader: Missing ".type" for vkFormat: '+e);let t;r.supercompressionScheme===PA&&(Wh||(Wh=new Promise(async a=>{const o=new MT;await o.init(),a(o)})),t=await Wh);const n=[];for(let a=0;a<r.levels.length;a++){const o=Math.max(1,r.pixelWidth>>a),c=Math.max(1,r.pixelHeight>>a),l=r.pixelDepth?Math.max(1,r.pixelDepth>>a):0,u=r.levels[a];let h;if(r.supercompressionScheme===xT)h=u.levelData;else if(r.supercompressionScheme===PA)h=t.decode(u.levelData,u.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let d;mr[e]===Nt?d=new Float32Array(h.buffer,h.byteOffset,h.byteLength/Float32Array.BYTES_PER_ELEMENT):mr[e]===It?d=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT):mr[e]===Pl||mr[e]===Nl?d=new Uint32Array(h.buffer,h.byteOffset,h.byteLength/Uint32Array.BYTES_PER_ELEMENT):d=h,n.push({data:d,width:o,height:c,depth:l})}const i=r.levelCount===0||n.length>1;let s;if(RT.has(qh[e]))s=r.pixelDepth===0?new ha(n[0].data,r.pixelWidth,r.pixelHeight):new E0(n[0].data,r.pixelWidth,r.pixelHeight,r.pixelDepth),s.minFilter=i?la:yt,s.magFilter=yt,s.generateMipmaps=r.levelCount===0;else{if(r.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");s=new Vs(n,r.pixelWidth,r.pixelHeight),s.minFilter=i?gn:We,s.magFilter=We}
vendor: 4,597 bytes, line 4422
4422return s.mipmaps=n,s.type=mr[e],s.format=qh[e],s.colorSpace=Jx(r),s.needsUpdate=!0,Promise.resolve(s)}function Jx(r){const e=r.dataFormatDescriptor[0];return e.colorPrimaries===vT?e.transferFunction===NA?bt:St:e.colorPrimaries===ET?e.transferFunction===NA?wT:TT:(e.colorPrimaries===_T||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),kn)}var kA,QA;const Yn=Symbol("retainerCount"),Ti=Symbol("recentlyUsed"),Ac=Symbol("evict"),wa=Symbol("evictionThreshold"),Xh=Symbol("cache");class DT{constructor(e,t=5){this[kA]=new Map,this[QA]=[],this[Xh]=e,this[wa]=t}set evictionThreshold(e){this[wa]=e,this[Ac]()}get evictionThreshold(){return this[wa]}get cache(){return this[Xh]}retainerCount(e){return this[Yn].get(e)||0}reset(){this[Yn].clear(),this[Ti]=[]}retain(e){this[Yn].has(e)||this[Yn].set(e,0),this[Yn].set(e,this[Yn].get(e)+1);const t=this[Ti].indexOf(e);t!==-1&&this[Ti].splice(t,1),this[Ti].unshift(e),this[Ac]()}release(e){this[Yn].has(e)&&this[Yn].set(e,Math.max(this[Yn].get(e)-1,0)),this[Ac]()}[(kA=Yn,QA=Ti,Ac)](){if(!(this[Ti].length<this[wa]))for(let e=this[Ti].length-1;e>=this[wa];--e){const t=this[Ti][e];this[Yn].get(t)===0&&(this[Xh].delete(t),this[Ti].splice(e,1))}}}const LT=r=>{const e=[],t=new Set;for(const n of r){let i=n,s=0;for(;t.has(i);)i=n+"."+ ++s;t.add(i),e.push(i)}return e},FT=r=>{const e=new Map;for(const t of r.mappings)for(const n of t.variants)e.set(n,{material:null,gltfMaterialIndex:t.material});return e};class PT{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,n=t.json;if(n.extensions===void 0||n.extensions[this.name]===void 0)return null;const s=n.extensions[this.name].variants||[],a=LT(s.map(o=>o.name));for(const o of e.scenes)o.traverse(c=>{const l=c;if(!l.material)return;const u=t.associations.get(l);if(u==null||u.meshes==null||u.primitives==null)return;const p=n.meshes[u.meshes].primitives[u.primitives].extensions;!p||!p[this.name]||(l.userData.variantMaterials=FT(p[this.name]))});return e.userData.variants=a,Promise.resolve()}}var Zx,GA;Rt.DEFAULT_ANISOTROPY=4;const NT=(r,e,t=()=>{})=>{const n=i=>{const s=i.loaded/i.total;t(Math.max(0,Math.min(1,isFinite(s)?s:1)))};return new Promise((i,s)=>{e.load(r,i,n,s)})},UT=r=>new Promise((e,t)=>{const n=document.createElement("script");document.body.appendChild(n),n.onload=e,n.onerror=t,n.async=!0,n.src=r}),Ri=new Map,$h=new Map;let HA;const zA=new Fw;let VA;const Yh=new Qn;let jh,Kh;const Rs=Symbol("loader"),ns=Symbol("evictionPolicy"),WA=Symbol("GLTFInstance");class mn extends ri{static setDRACODecoderLocation(e){HA=e,zA.setDecoderPath(e)}static getDRACODecoderLocation(){return HA}static setKTX2TranscoderLocation(e){VA=e,Yh.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return VA}static setMeshoptDecoderLocation(e){jh!==e&&(jh=e,Kh=UT(e).then(()=>TA.ready).then(()=>TA))}static getMeshoptDecoderLocation(){return jh}static initializeKTX2Loader(e){Yh.detectSupport(e)}static get cache(){return Ri}static clearCache(){Ri.forEach((e,t)=>{this.delete(t)}),this[ns].reset()}static has(e){return Ri.has(e)}static async delete(e){if(!this.has(e))return;const t=Ri.get(e);$h.delete(e),Ri.delete(e),(await t).dispose()}static hasFinishedLoading(e){return!!$h.get(e)}constructor(e){super(),this[GA]=new Nw().register(t=>new PT(t)),this[WA]=e,this[Rs].setDRACOLoader(zA),this[Rs].setKTX2Loader(Yh)}get[(Zx=ns,GA=Rs,ns)](){return this.constructor[ns]}async preload(e,t,n=()=>{}){if(this[Rs].setWithCredentials(t.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!Ri.has(e)){Kh!=null&&this[Rs].setMeshoptDecoder(await Kh);const i=NT(e,this[Rs],o=>{n(o*.8)}),s=this[WA],a=i.then(o=>s.prepare(o)).then(o=>(n(.9),new s(o))).catch((o=>(console.error(o),new s)));Ri.set(e,a)}await Ri.get(e),$h.set(e,!0),n&&n(1)}async load(e,t,n=()=>{}){await this.preload(e,t,n);const s=await(await Ri.get(e)).clone();return this[ns].retain(e),s.dispose=()=>{this[ns].release(e)},s}}mn[Zx]=new DT(mn);class OT extends mt{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new pe(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const gr=new B,qA=new Ue,XA=new Ue,$A=new B,YA=new B;
4422class kT{constructor(e={}){const t=this;let n,i,s,a;const o={objects:new WeakMap},c=e.element!==void 0?e.element:document.createElement("div");c.style.overflow="hidden",this.domElement=c,this.sortObjects=!0,this.getSize=function(){return{width:n,height:i}},this.render=function(p,g){p.matrixWorldAutoUpdate===!0&&p.updateMatrixWorld(),g.parent===null&&g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),qA.copy(g.matrixWorldInverse),XA.multiplyMatrices(g.projectionMatrix,qA),u(p,p,g),this.sortObjects&&f(p)},this.setSize=function(p,g){n=p,i=g,s=n/2,a=i/2,c.style.width=p+"px",c.style.height=g+"px"};function l(p){p.isCSS2DObject&&(p.element.style.display="none");for(let g=0,m=p.children.length;g<m;g++)l(p.children[g])}function u(p,g,m){if(p.visible===!1){l(p);return}if(p.isCSS2DObject){gr.setFromMatrixPosition(p.matrixWorld),gr.applyMatrix4(XA);const A=gr.z>=-1&&gr.z<=1&&p.layers.test(m.layers)===!0,x=p.element;x.style.display=A===!0?"":"none",A===!0&&(p.onBeforeRender(t,g,m),x.style.transform="translate("+-100*p.center.x+"%,"+-100*p.center.y+"%)translate("+(gr.x*s+s)+"px,"+(-gr.
vendor: 33,635 bytes, line 4422
4422y*a+a)+"px)",x.parentNode!==c&&c.appendChild(x),p.onAfterRender(t,g,m));const _={distanceToCameraSquared:h(m,p)};o.objects.set(p,_)}for(let A=0,x=p.children.length;A<x;A++)u(p.children[A],g,m)}function h(p,g){return $A.setFromMatrixPosition(p.matrixWorld),YA.setFromMatrixPosition(g.matrixWorld),$A.distanceToSquared(YA)}function d(p){const g=[];return p.traverseVisible(function(m){m.isCSS2DObject&&g.push(m)}),g}function f(p){const g=d(p).sort(function(A,x){if(A.renderOrder!==x.renderOrder)return x.renderOrder-A.renderOrder;const _=o.objects.get(A).distanceToCameraSquared,b=o.objects.get(x).distanceToCameraSquared;return _-b}),m=g.length;for(let A=0,x=g.length;A<x;A++)g[A].element.style.zIndex=m-A}}}function mc(r,e,t){let n=t;const i=new B;return r.updateWorldMatrix(!0,!0),r.traverseVisible(s=>{const{geometry:a}=s;if(a!==void 0){const{position:o}=a.attributes;if(o!==void 0)for(let c=0,l=o.count;c<l;c++)s.isMesh?s.getVertexPosition(c,i):i.fromBufferAttribute(o,c),s.isSkinnedMesh||i.applyMatrix4(s.matrixWorld),n=e(n,i)}}),n}const jA={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class yl{constructor(){this.textureUtils=null,this.pluginCallbacks=[],this.register(function(e){return new jT(e)}),this.register(function(e){return new KT(e)}),this.register(function(e){return new t1(e)}),this.register(function(e){return new n1(e)}),this.register(function(e){return new i1(e)}),this.register(function(e){return new s1(e)}),this.register(function(e){return new JT(e)}),this.register(function(e){return new ZT(e)}),this.register(function(e){return new e1(e)}),this.register(function(e){return new r1(e)}),this.register(function(e){return new a1(e)}),this.register(function(e){return new o1(e)}),this.register(function(e){return new c1(e)}),this.register(function(e){return new l1(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}setTextureUtils(e){return this.textureUtils=e,this}parse(e,t,n,i){const s=new YT,a=[];for(let o=0,c=this.pluginCallbacks.length;o<c;o++)a.push(this.pluginCallbacks[o](s));s.setPlugins(a),s.setTextureUtils(this.textureUtils),s.writeAsync(e,t,i).catch(n)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,i,s,t)})}}const Je={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},Jh="KHR_mesh_quantization",Dn={};Dn[yt]=Je.NEAREST;Dn[la]=Je.NEAREST_MIPMAP_NEAREST;Dn[rs]=Je.NEAREST_MIPMAP_LINEAR;Dn[We]=Je.LINEAR;Dn[Gs]=Je.LINEAR_MIPMAP_NEAREST;Dn[gn]=Je.LINEAR_MIPMAP_LINEAR;Dn[Lt]=Je.CLAMP_TO_EDGE;Dn[ni]=Je.REPEAT;Dn[Ws]=Je.MIRRORED_REPEAT;const KA={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},QT=new Ie,JA=12,GT=1179937895,HT=2,ZA=8,zT=1313821514,VT=5130562;function Ja(r,e){return r.length===e.length&&r.every(function(t,n){return t===e[n]})}function WT(r){return new TextEncoder().encode(r).buffer}function qT(r){return Ja(r.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function XT(r,e,t){const n={min:new Array(r.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(r.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let i=e;i<e+t;i++)for(let s=0;s<r.itemSize;s++){let a;r.itemSize>4?a=r.array[i*r.itemSize+s]:(s===0?a=r.getX(i):s===1?a=r.getY(i):s===2?a=r.getZ(i):s===3&&(a=r.getW(i)),r.normalized===!0&&(a=xl.normalize(a,r.array))),n.min[s]=Math.min(n.min[s],a),n.max[s]=Math.max(n.max[s],a)}return n}function eb(r){return Math.ceil(r/4)*4}function Zh(r,e=0){const t=eb(r.byteLength);if(t!==r.byteLength){const n=new Uint8Array(t);if(n.set(new Uint8Array(r)),e!==0)for(let i=r.byteLength;i<t;i++)n[i]=e;return n.buffer}return r}function em(){return typeof document>"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function $T(r,e){if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas){let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),r.convertToBlob({type:e,quality:t})}else return new Promise(t=>r.toBlob(t,e))}class YT{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r"+Dl}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},this.textureUtils=null}setPlugins(e){this.plugins=e}setTextureUtils(e){this.textureUtils=e}async writeAsync(e,t,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),await this.processInputAsync(e),await Promise.all(this.pending);const i=this,s=i.buffers,a=i.json;n=i.options;const o=i.extensionsUsed,c=i.extensionsRequired,l=new Blob(s,{type:"application/octet-stream"}),u=Object.keys(o),h=Object.keys(c);if(u.length>0&&(a.extensionsUsed=u),h.length>0&&(a.extensionsRequired=h),a.buffers&&a.buffers.length>0&&(a.buffers[0].byteLength=l.size),n.binary===!0){const d=new FileReader;d.readAsArrayBuffer(l),d.onloadend=function(){const f=Zh(d.result),p=new DataView(new ArrayBuffer(ZA));p.setUint32(0,f.byteLength,!0),p.setUint32(4,VT,!0);const g=Zh(WT(JSON.stringify(a)),32),m=new DataView(new ArrayBuffer(ZA));m.setUint32(0,g.byteLength,!0),m.setUint32(4,zT,!0);const A=new ArrayBuffer(JA),x=new DataView(A);x.setUint32(0,GT,!0),x.setUint32(4,HT,!0);const _=JA+m.byteLength+g.byteLength+p.byteLength+f.byteLength;x.setUint32(8,_,!0);const b=new Blob([A,m,g,p,f],{type:"application/octet-stream"}),v=new FileReader;v.readAsArrayBuffer(b),v.onloadend=function(){t(v.result)}}}else if(a.buffers&&a.buffers.length>0){const d=new FileReader;d.readAsDataURL(l),d.onloadend=function(){const f=d.result;a.buffers[0].uri=f,t(a)}}else t(a)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const n=this.options,i=this.extensionsUsed;try{const s=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const a in s.gltfExtensions)t.extensions[a]=s.gltfExtensions[a],i[a]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const i=new Map;i.set(!0,this.uid++),i.set(!1,this.uid++),this.uids.set(e,i)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const n=new B;for(let i=0,s=e.count;i<s;i++)if(Math.abs(n.fromBufferAttribute(e,i).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const n=e.clone(),i=new B;for(let s=0,a=n.count;s<a;s++)i.fromBufferAttribute(n,s),i.x===0&&i.y===0&&i.z===0?i.setX(1):i.normalize(),n.setXYZ(s,i.x,i.y,i.z);return t.attributesNormalized.set(e,n),n}applyTextureTransform(e,t){let n=!1;const i={};(t.offset.x!==0||t.offset.y!==0)&&(i.offset=t.offset.toArray(),n=!0),t.rotation!==0&&(i.rotation=t.rotation,n=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(i.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,this.extensionsUsed.KHR_texture_transform=!0)}async buildMetalRoughTextureAsync(e,t){if(e===t)return e;function n(f){return f.colorSpace===bt?function(g){return g<.04045?g*.0773993808:Math.pow(g*.9478672986+.0521327014,2.4)}:function(g){return g}}e instanceof Vs&&(e=await this.decompressTextureAsync(e)),t instanceof Vs&&(t=await this.decompressTextureAsync(t));const i=e?e.image:null,s=t?t.image:null,a=Math.max(i?i.width:0,s?s.width:0),o=Math.max(i?i.height:0,s?s.height:0),c=em();c.width=a,c.height=o;const l=c.getContext("2d",{willReadFrequently:!0});l.fillStyle="#00ffff",l.fillRect(0,0,a,o);const u=l.getImageData(0,0,a,o);if(i){l.drawImage(i,0,0,a,o);const f=n(e),p=l.getImageData(0,0,a,o).data;for(let g=2;g<p.length;g+=4)u.data[g]=f(p[g]/256)*256}if(s){l.drawImage(s,0,0,a,o);const f=n(t),p=l.getImageData(0,0,a,o).data;for(let g=1;g<p.length;g+=4)u.data[g]=f(p[g]/256)*256}l.putImageData(u,0,0);const d=(e||t).clone();return d.source=new Ul(c),d.colorSpace=kn,d.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),d}async decompressTextureAsync(e,t=1/0){if(this.textureUtils===null)throw new Error("THREE.GLTFExporter: setTextureUtils() must be called to process compressed textures.");return await this.textureUtils.decompress(e,t)}processBuffer(e){const t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}processBufferView(e,t,n,i,s){const a=this.json;a.bufferViews||(a.bufferViews=[]);let o;switch(t){case Je.BYTE:case Je.UNSIGNED_BYTE:o=1;break;case Je.SHORT:case Je.UNSIGNED_SHORT:o=2;break;default:o=4}let c=e.itemSize*o;s===Je.ARRAY_BUFFER&&(c=Math.ceil(c/4)*4);const l=eb(i*c),u=new DataView(new ArrayBuffer(l));let h=0;for(let p=n;p<n+i;p++){for(let g=0;g<e.itemSize;g++){let m;e.itemSize>4?m=e.array[p*e.itemSize+g]:(g===0?m=e.getX(p):g===1?m=e.getY(p):g===2?m=e.getZ(p):g===3&&(m=e.getW(p)),e.normalized===!0&&(m=xl.normalize(m,e.array))),t===Je.FLOAT?u.setFloat32(h,m,!0):t===Je.INT?u.setInt32(h,m,!0):t===Je.UNSIGNED_INT?u.setUint32(h,m,!0):t===Je.SHORT?u.setInt16(h,m,!0):t===Je.UNSIGNED_SHORT?u.setUint16(h,m,!0):t===Je.BYTE?u.setInt8(h,m):t===Je.UNSIGNED_BYTE&&u.setUint8(h,m),h+=o}h%c!==0&&(h+=c-h%c)}const d={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:l};return s!==void 0&&(d.target=s),s===Je.ARRAY_BUFFER&&(d.byteStride=c),this.byteOffset+=l,a.bufferViews.push(d),{id:a.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise(function(i){const s=new FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){const a=Zh(s.result),o={buffer:t.processBuffer(a),byteOffset:t.byteOffset,byteLength:a.byteLength};t.byteOffset+=a.byteLength,i(n.bufferViews.push(o)-1)}})}processAccessor(e,t,n,i){const s=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let o;if(e.array.constructor===Float32Array)o=Je.FLOAT;else if(e.array.constructor===Int32Array)o=Je.INT;else if(e.array.constructor===Uint32Array)o=Je.UNSIGNED_INT;else if(e.array.constructor===Int16Array)o=Je.SHORT;else if(e.array.constructor===Uint16Array)o=Je.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)o=Je.BYTE;else if(e.array.constructor===Uint8Array)o=Je.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(n===void 0&&(n=0),(i===void 0||i===1/0)&&(i=e.count),i===0)return null;const c=XT(e,n,i);let l;t!==void 0&&(l=e===t.index?Je.ELEMENT_ARRAY_BUFFER:Je.ARRAY_BUFFER);const u=this.processBufferView(e,o,n,i,l),h={bufferView:u.id,byteOffset:u.byteOffset,componentType:o,count:i,max:c.max,min:c.min,type:a[e.itemSize]};return e.normalized===!0&&(h.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(h)-1}processImage(e,t,n,i="image/png"){if(e!==null){const s=this,a=s.cache,o=s.json,c=s.options,l=s.pending;a.images.has(e)||a.images.set(e,{});const u=a.images.get(e),h=i+":flipY/"+n.toString();if(u[h]!==void 0)return u[h];o.images||(o.images=[]);const d={mimeType:i},f=em();f.width=Math.min(e.width,c.maxTextureSize),f.height=Math.min(e.height,c.maxTextureSize);const p=f.getContext("2d",{willReadFrequently:!0});if(n===!0&&(p.translate(0,f.height),p.scale(1,-1)),e.data!==void 0){t!==Tt&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const m=new Uint8ClampedArray(e.height*e.width*4);for(let A=0;A<m.length;A+=4)m[A+0]=e.data[A+0],m[A+1]=e.data[A+1],m[A+2]=e.data[A+2],m[A+3]=e.data[A+3];p.putImageData(new ImageData(m,e.width,e.height),0,0)}else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)p.drawImage(e,0,0,f.width,f.height);else throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");c.binary===!0?l.push($T(f,i).then(m=>s.processBufferViewImage(m)).then(m=>{d.bufferView=m})):d.uri=_0.getDataURL(f,i);const g=o.images.push(d)-1;return u[h]=g,g}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const n={magFilter:Dn[e.magFilter],minFilter:Dn[e.minFilter],wrapS:Dn[e.wrapS],wrapT:Dn[e.wrapT]};return t.samplers.push(n)-1}async processTextureAsync(e){const n=this.options,i=this.cache,s=this.json;if(i.textures.has(e))return i.textures.get(e);s.textures||(s.textures=[]),e instanceof Vs&&(e=await this.decompressTextureAsync(e,n.maxTextureSize));let a=e.userData.mimeType;a==="image/webp"&&(a="image/png");const o={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,a)};e.name&&(o.name=e.name),await this._invokeAllAsync(async function(l){l.writeTexture&&await l.writeTexture(e,o)});const c=s.textures.push(o)-1;return i.textures.set(e,c),c}async processMaterialAsync(e){const t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const s=e.color.toArray().concat([e.opacity]);if(Ja(s,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=s),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=0,i.pbrMetallicRoughness.roughnessFactor=1),e.metalnessMap||e.roughnessMap){const o=await this.buildMetalRoughTextureAsync(e.metalnessMap,e.roughnessMap),c={index:await this.processTextureAsync(o),texCoord:o.channel};this.applyTextureTransform(c,o),i.pbrMetallicRoughness.metallicRoughnessTexture=c}if(e.map){const o={index:await this.processTextureAsync(e.map),texCoord:e.map.channel};this.applyTextureTransform(o,e.map),i.pbrMetallicRoughness.baseColorTexture=o}if(e.emissive){const o=e.emissive;if(Math.max(o.r,o.g,o.b)>0&&(i.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const l={index:await this.processTextureAsync(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(l,e.emissiveMap),i.emissiveTexture=l}}if(e.normalMap){const o={index:await this.processTextureAsync(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(o.scale=e.normalScale.x),this.applyTextureTransform(o,e.normalMap),i.normalTexture=o}if(e.aoMap){const o={index:await this.processTextureAsync(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(o.strength=e.aoMapIntensity),this.applyTextureTransform(o,e.aoMap),i.occlusionTexture=o}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===Vt&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),await this._invokeAllAsync(async function(o){o.writeMaterialAsync&&await o.writeMaterialAsync(e,i)});const a=n.materials.push(i)-1;return t.materials.set(e,a),a}async processMeshAsync(e){const t=this.cache,n=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let b=0,v=e.material.length;b<v;b++)i.push(e.material[b].uuid);else i.push(e.material.uuid);const s=i.join(":");if(t.meshes.has(s))return t.meshes.get(s);const a=e.geometry;let o;e.isLineSegments?o=Je.LINES:e.isLineLoop?o=Je.LINE_LOOP:e.isLine?o=Je.LINE_STRIP:e.isPoints?o=Je.POINTS:o=e.material.wireframe?Je.LINES:Je.TRIANGLES;const c={},l={},u=[],h=[],d={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=a.getAttribute("normal");f!==void 0&&!this.isNormalizedNormalAttribute(f)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),a.setAttribute("normal",this.createNormalizedNormalAttribute(f)));let p=null;for(let b in a.attributes){if(b.slice(0,5)==="morph")continue;const v=a.attributes[b];if(b=d[b]||b.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(b)||(b="_"+b),t.attributes.has(this.getUID(v))){l[b]=t.attributes.get(this.getUID(v));continue}p=null;const M=v.array;b==="JOINTS_0"&&!(M instanceof Uint16Array)&&!(M instanceof Uint8Array)?(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),p=new Bt(new Uint16Array(M),v.itemSize,v.normalized)):(M instanceof Uint32Array||M instanceof Int32Array)&&!b.startsWith("_")&&(console.warn(`GLTFExporter: Attribute "${b}" converted to type FLOAT.`),p=yl.Utils.toFloat32BufferAttribute(v));const w=this.processAccessor(p||v,a);w!==null&&(b.startsWith("_")||this.detectMeshQuantization(b,v),l[b]=w,t.attributes.set(this.getUID(v),w))}if(f!==void 0&&a.setAttribute("normal",f),Object.keys(l).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const b=[],v=[],C={};if(e.morphTargetDictionary!==void 0)for(const M in e.morphTargetDictionary)C[e.morphTargetDictionary[M]]=M;for(let M=0;M<e.morphTargetInfluences.length;++M){const w={};let E=!1;for(const S in a.morphAttributes){if(S!=="position"&&S!=="normal"){E||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),E=!0);continue}const R=a.morphAttributes[S][M],N=S.toUpperCase(),F=a.attributes[S];if(t.attributes.has(this.getUID(R,!0))){w[N]=t.attributes.get(this.getUID(R,!0));continue}const P=R.clone();if(!a.morphTargetsRelative)for(let Q=0,U=R.count;Q<U;Q++)for(let G=0;G<R.itemSize;G++)G===0&&P.setX(Q,R.getX(Q)-F.getX(Q)),G===1&&P.setY(Q,R.getY(Q)-F.getY(Q)),G===2&&P.setZ(Q,R.getZ(Q)-F.getZ(Q)),G===3&&P.setW(Q,R.getW(Q)-F.getW(Q));w[N]=this.processAccessor(P,a),t.attributes.set(this.getUID(F,!0),w[N])}h.push(w),b.push(e.morphTargetInfluences[M]),e.morphTargetDictionary!==void 0&&v.push(C[M])}c.weights=b,v.length>0&&(c.extras={},c.extras.targetNames=v)}const g=Array.isArray(e.material);if(g&&a.groups.length===0)return null;let m=!1;if(g&&a.index===null){const b=[];for(let v=0,C=a.attributes.position.count;v<C;v++)b[v]=v;a.setIndex(b),m=!0}const A=g?e.material:[e.material],x=g?a.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let b=0,v=x.length;b<v;b++){const C={mode:o,attributes:l};if(this.serializeUserData(a,C),h.length>0&&(C.targets=h),a.index!==null){let w=this.getUID(a.index);(x[b].start!==void 0||x[b].count!==void 0)&&(w+=":"+x[b].start+":"+x[b].count),t.attributes.has(w)?C.indices=t.attributes.get(w):(C.indices=this.processAccessor(a.index,a,x[b].start,x[b].count),t.attributes.set(w,C.indices)),C.indices===null&&delete C.indices}const M=await this.processMaterialAsync(A[x[b].materialIndex]);M!==null&&(C.material=M),u.push(C)}m===!0&&a.setIndex(null),c.primitives=u,n.meshes||(n.meshes=[]),await this._invokeAllAsync(function(b){b.writeMesh&&b.writeMesh(e,c)});const _=n.meshes.push(c)-1;return t.meshes.set(s,_),_}detectMeshQuantization(e,t){if(this.extensionsUsed[Jh])return;let n;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized");const i=e.split("_",1)[0];jA[i]&&jA[i].includes(n)&&(this.extensionsUsed[Jh]=!0,this.extensionsRequired[Jh]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const n=e.isOrthographicCamera,i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:xl.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const n=this.json,i=this.nodeMap;n.animations||(n.animations=[]),e=yl.Utils.mergeMorphTargetTracks(e.clone(),t);const s=e.tracks,a=[],o=[];for(let l=0;l<s.length;++l){const u=s[l],h=nt.parseTrackName(u.name);let d=nt.findNode(t,h.nodeName);const f=KA[h.propertyName];if(h.objectName==="bones"&&(d.isSkinnedMesh===!0?d=d.skeleton.getBoneByName(h.objectIndex):d=void 0),!d||!f){console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name);continue}const p=1;let g=u.values.length/u.times.length;f===KA.morphTargetInfluences&&(g/=d.morphTargetInfluences.length);let m;u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(m="CUBICSPLINE",g/=3):u.getInterpolation()===Jr?m="STEP":m="LINEAR",o.push({input:this.processAccessor(new Bt(u.times,p)),output:this.processAccessor(new Bt(u.values,g)),interpolation:m}),a.push({sampler:o.length-1,target:{node:i.get(d),path:f}})}const c={name:e.name||"clip_"+n.animations.length,samplers:o,channels:a};return this.serializeUserData(e,c),n.animations.push(c),n.animations.length-1}processSkin(e){const t=this.json,n=this.nodeMap,i=t.nodes[n.get(e)],s=e.skeleton;if(s===void 0)return null;const a=e.skeleton.bones[0];if(a===void 0)return null;const o=[],c=new Float32Array(s.bones.length*16),l=new Ue;for(let h=0;h<s.bones.length;++h)o.push(n.get(s.bones[h])),l.copy(s.boneInverses[h]),l.multiply(e.bindMatrix).toArray(c,h*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new Bt(c,16)),joints:o,skeleton:n.get(a)}),i.skin=t.skins.length-1}async processNodeAsync(e){const t=this.json,n=this.options,i=this.nodeMap;t.nodes||(t.nodes=[]);const s={};if(n.trs){const o=e.quaternion.toArray(),c=e.position.toArray(),l=e.scale.toArray();Ja(o,[0,0,0,1])||(s.rotation=o),Ja(c,[0,0,0])||(s.translation=c),Ja(l,[1,1,1])||(s.scale=l)}else e.matrixAutoUpdate&&e.updateMatrix(),qT(e.matrix)===!1&&(s.matrix=e.matrix.elements);if(e.name!==""&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints){const o=await this.processMeshAsync(e);o!==null&&(s.mesh=o)}else e.isCamera&&(s.camera=this.processCamera(e));e.isSkinnedMesh&&this.skins.push(e);const a=t.nodes.push(s)-1;if(i.set(e,a),e.children.length>0){const o=[];for(let c=0,l=e.children.length;c<l;c++){const u=e.children[c];if(u.visible||n.onlyVisible===!1){const h=await this.processNodeAsync(u);h!==null&&o.push(h)}}o.length>0&&(s.children=o)}return await this._invokeAllAsync(function(o){o.writeNode&&o.writeNode(e,s)}),a}async processSceneAsync(e){const t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const s=[];for(let a=0,o=e.children.length;a<o;a++){const c=e.children[a];if(c.visible||n.onlyVisible===!1){const l=await this.processNodeAsync(c);l!==null&&s.push(l)}}s.length>0&&(i.nodes=s),this.serializeUserData(e,i)}async processObjectsAsync(e){const t=new qs;t.name="AuxScene";for(let n=0;n<e.length;n++)t.children.push(e[n]);await this.processSceneAsync(t)}async processInputAsync(e){const t=this.options;e=e instanceof Array?e:[e],await this._invokeAllAsync(function(i){i.beforeParse&&i.beforeParse(e)});const n=[];for(let i=0;i<e.length;i++)e[i]instanceof qs?await this.processSceneAsync(e[i]):n.push(e[i]);n.length>0&&await this.processObjectsAsync(n);for(let i=0;i<this.skins.length;++i)this.processSkin(this.skins[i]);for(let i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);await this._invokeAllAsync(function(i){i.afterParse&&i.afterParse(e)})}async _invokeAllAsync(e){for(let t=0,n=this.plugins.length;t<n;t++)await e(this.plugins[t])}}class jT{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}const n=this.writer,i=n.json,s=n.extensionsUsed,a={};e.name&&(a.name=e.name),a.color=e.color.toArray(),a.intensity=e.intensity,e.isDirectionalLight?a.type="directional":e.isPointLight?(a.type="point",e.distance>0&&(a.range=e.distance)):e.isSpotLight&&(a.type="spot",e.distance>0&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(1-e.penumbra)*e.angle,a.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},s[this.name]=!0);const o=i.extensions[this.name].lights;o.push(a),t.extensions=t.extensions||{},t.extensions[this.name]={light:o.length-1}}}class KT{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}async writeMaterialAsync(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class JT{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;const n=this.writer,i=n.extensionsUsed,s={};if(s.clearcoatFactor=e.clearcoat,e.clearcoatMap){const a={index:await n.processTextureAsync(e.clearcoatMap),texCoord:e.clearcoatMap.channel};n.applyTextureTransform(a,e.clearcoatMap),s.clearcoatTexture=a}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const a={index:await n.processTextureAsync(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};n.applyTextureTransform(a,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=a}if(e.clearcoatNormalMap){const a={index:await n.processTextureAsync(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};e.clearcoatNormalScale.x!==1&&(a.scale=e.clearcoatNormalScale.x),n.applyTextureTransform(a,e.clearcoatNormalMap),s.clearcoatNormalTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ZT{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.dispersion===0)return;const i=this.writer.extensionsUsed,s={};s.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class e1{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;const n=this.writer,i=n.extensionsUsed,s={};if(s.iridescenceFactor=e.iridescence,e.iridescenceMap){const a={index:await n.processTextureAsync(e.iridescenceMap),texCoord:e.iridescenceMap.channel};n.applyTextureTransform(a,e.iridescenceMap),s.iridescenceTexture=a}if(s.iridescenceIor=e.iridescenceIOR,s.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],s.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const a={index:await n.processTextureAsync(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};n.applyTextureTransform(a,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class t1{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,i=n.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){const a={index:await n.processTextureAsync(e.transmissionMap),texCoord:e.transmissionMap.channel};n.applyTextureTransform(a,e.transmissionMap),s.transmissionTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class n1{constructor(e){this.writer=e,this.name="KHR_materials_volume"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,i=n.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){const a={index:await n.processTextureAsync(e.thicknessMap),texCoord:e.thicknessMap.channel};n.applyTextureTransform(a,e.thicknessMap),s.thicknessTexture=a}e.attenuationDistance!==1/0&&(s.attenuationDistance=e.attenuationDistance),s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class i1{constructor(e){this.writer=e,this.name="KHR_materials_ior"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const i=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class s1{constructor(e){this.writer=e,this.name="KHR_materials_specular"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(QT)&&!e.specularIntensityMap&&!e.specularColorMap)return;const n=this.writer,i=n.extensionsUsed,s={};if(e.specularIntensityMap){const a={index:await n.processTextureAsync(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};n.applyTextureTransform(a,e.specularIntensityMap),s.specularTexture=a}if(e.specularColorMap){const a={index:await n.processTextureAsync(e.specularColorMap),texCoord:e.specularColorMap.channel};n.applyTextureTransform(a,e.specularColorMap),s.specularColorTexture=a}s.specularFactor=e.specularIntensity,s.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class r1{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const n=this.writer,i=n.extensionsUsed,s={};if(e.sheenRoughnessMap){const a={index:await n.processTextureAsync(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};n.applyTextureTransform(a,e.sheenRoughnessMap),s.sheenRoughnessTexture=a}if(e.sheenColorMap){const a={index:await n.processTextureAsync(e.sheenColorMap),texCoord:e.sheenColorMap.channel};n.applyTextureTransform(a,e.sheenColorMap),s.sheenColorTexture=a}s.sheenRoughnessFactor=e.sheenRoughness,s.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class a1{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;const n=this.writer,i=n.extensionsUsed,s={};if(e.anisotropyMap){const a={index:await n.processTextureAsync(e.anisotropyMap)};n.applyTextureTransform(a,e.anisotropyMap),s.anisotropyTexture=a}s.anisotropyStrength=e.anisotropy,s.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class o1{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const i=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class c1{constructor(e){this.writer=e,this.name="EXT_materials_bump"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;const n=this.writer,i=n.extensionsUsed,s={};if(e.bumpMap){const a={index:await n.processTextureAsync(e.bumpMap),texCoord:e.bumpMap.channel};n.applyTextureTransform(a,e.bumpMap),s.bumpTexture=a}s.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class l1{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const n=this.writer,i=e,s=new Float32Array(i.count*3),a=new Float32Array(i.count*4),o=new Float32Array(i.count*3),c=new Ue,l=new B,u=new xn,h=new B;for(let f=0;f<i.count;f++)i.getMatrixAt(f,c),c.decompose(l,u,h),l.toArray(s,f*3),u.toArray(a,f*4),h.toArray(o,f*3);const d={TRANSLATION:n.processAccessor(new Bt(s,3)),ROTATION:n.processAccessor(new Bt(a,4)),SCALE:n.processAccessor(new Bt(o,3))};i.instanceColor&&(d._COLOR_0=n.processAccessor(i.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:d},n.extensionsUsed[this.name]=!0,n.extensionsRequired[this.name]=!0}}yl.Utils={insertKeyframe:function(r,e){const n=r.getValueSize(),i=new r.TimeBufferType(r.t
vendor: 9,111 bytes, line 4422
4422imes.length+1),s=new r.ValueBufferType(r.values.length+n),a=r.createInterpolant(new r.ValueBufferType(n));let o;if(r.times.length===0){i[0]=e;for(let c=0;c<n;c++)s[c]=0;o=0}else if(e<r.times[0]){if(Math.abs(r.times[0]-e)<.001)return 0;i[0]=e,i.set(r.times,1),s.set(a.evaluate(e),0),s.set(r.values,n),o=0}else if(e>r.times[r.times.length-1]){if(Math.abs(r.times[r.times.length-1]-e)<.001)return r.times.length-1;i[i.length-1]=e,i.set(r.times,0),s.set(r.values,0),s.set(a.evaluate(e),r.values.length),o=i.length-1}else for(let c=0;c<r.times.length;c++){if(Math.abs(r.times[c]-e)<.001)return c;if(r.times[c]<e&&r.times[c+1]>e){i.set(r.times.slice(0,c+1),0),i[c+1]=e,i.set(r.times.slice(c+1),c+2),s.set(r.values.slice(0,(c+1)*n),0),s.set(a.evaluate(e),(c+1)*n),s.set(r.values.slice((c+1)*n),(c+2)*n),o=c+1;break}}return r.times=i,r.values=s,o},mergeMorphTargetTracks:function(r,e){const t=[],n={},i=r.tracks;for(let s=0;s<i.length;++s){let a=i[s];const o=nt.parseTrackName(a.name),c=nt.findNode(e,o.nodeName);if(o.propertyName!=="morphTargetInfluences"||o.propertyIndex===void 0){t.push(a);continue}if(a.createInterpolant!==a.InterpolantFactoryMethodDiscrete&&a.createInterpolant!==a.InterpolantFactoryMethodLinear){if(a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),a=a.clone(),a.setInterpolation(Zr)}const l=c.morphTargetInfluences.length,u=c.morphTargetDictionary[o.propertyIndex];if(u===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+o.propertyIndex);let h;if(n[c.uuid]===void 0){h=a.clone();const f=new h.ValueBufferType(l*h.times.length);for(let p=0;p<h.times.length;p++)f[p*l+u]=h.values[p];h.name=(o.nodeName||"")+".morphTargetInfluences",h.values=f,n[c.uuid]=h,t.push(h);continue}const d=a.createInterpolant(new a.ValueBufferType(1));h=n[c.uuid];for(let f=0;f<h.times.length;f++)h.values[f*l+u]=d.evaluate(h.times[f]);for(let f=0;f<a.times.length;f++){const p=this.insertKeyframe(h,a.times[f]);h.values[p*l+u]=a.values[f]}}return r.tracks=t,r},toFloat32BufferAttribute:function(r){const e=new Bt(new Float32Array(r.count*r.itemSize),r.itemSize,!1);if(!r.normalized&&!r.isInterleavedBufferAttribute)return e.array.set(r.array),e;for(let t=0,n=r.count;t<n;t++)for(let i=0;i<r.itemSize;i++)e.setComponent(t,i,r.getComponent(t,i));return e}};const tm=r=>r.material!==void 0&&r.userData&&r.userData.variantMaterials&&!!Array.from(r.userData.variantMaterials.values()).filter(e=>$c(e.material)),$c=r=>r&&r.isMaterial&&!Array.isArray(r);class h1{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set,n=i=>{if(!tm(i))return;const s=i.userData.variantMaterials,a=i.userData.variantData;for(const[o,c]of a){const l=s.get(c.index);l&&$c(l.material)&&t.add(o)}};if(Array.isArray(e))for(const i of e)i.traverse(n);else e.traverse(n);t.forEach(i=>this.variantNames.push(i))}async writeMesh(e,t){if(!tm(e))return;const n=e.userData,i=n.variantMaterials,s=n.variantData,a=new Map,o=new Map,c=Array.from(s.values()).sort((h,d)=>h.index-d.index);for(const[h,d]of c.entries())o.set(d.index,h);for(const h of s.values()){const d=i.get(h.index);if(!d||!$c(d.material))continue;const f=await this.writer.processMaterialAsync(d.material);a.has(f)||a.set(f,{material:f,variants:[]}),a.get(f).variants.push(o.get(h.index))}const l=Array.from(a.values()).map((h=>h.variants.sort((d,f)=>d-f)&&h)).sort((h,d)=>h.material-d.material);if(l.length===0)return;const u=$c(n.originalMaterial)?await this.writer.processMaterialAsync(n.originalMaterial):-1;for(const h of t.primitives)u>=0&&(h.material=u),h.extensions=h.extensions||{},h.extensions[this.name]={mappings:l}}afterParse(){if(this.variantNames.length===0)return;const e=this.writer.json;e.extensions=e.extensions||{};const t=this.variantNames.map(n=>({name:n}));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}class u1{constructor(e,t,n,i,s){this.xrLight=e,this.renderer=t,this.lightProbe=n,this.xrWebGLBinding=null,this.estimationStartCallback=s,this.frameCallback=this.onXRFrame.bind(this);const a=t.xr.getSession();if(i&&"XRWebGLBinding"in window){const o=new Ol(16);e.environment=o.texture;const c=t.getContext();switch(a.preferredReflectionFormat){case"srgba8":c.getExtension("EXT_sRGB");break;case"rgba16f":c.getExtension("OES_texture_half_float");break}this.xrWebGLBinding=new XRWebGLBinding(a,c),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}a.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const i=t.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const s=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/s,i.primaryLightIntensity.y/s,i.primaryLightIntensity.z/s),this.xrLight.directionalLight.intensity=s,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class d1 extends os{constructor(e,t=!0){super(),this.lightProbe=new WE,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new j0,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let n=null,i=!1;e.xr.addEventListener("sessionstart",()=>{const s=e.xr.getSession();"requestLightProbe"in s&&s.requestLightProbe({reflectionFormat:s.preferredReflectionFormat}).then(a=>{n=new u1(this,e,a,t,()=>{i=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{n&&(n.dispose(),n=null),i&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{n&&(n.dispose(),n=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}const tb=1e4,f1=.001,nb=50;class en{constructor(e=nb){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(f1,e)}update(e,t,n,i){const s=2e-4*this.naturalFrequency;if(e==null||i===0||e===t&&this.velocity===0)return t;if(n<0)return e;const a=e-t,o=this.velocity+this.naturalFrequency*a,c=a+n*o,l=Math.exp(-this.naturalFrequency*n),u=(o-this.naturalFrequency*c)*l,h=-this.naturalFrequency*(u+o*l);return Math.abs(u)<s*Math.abs(i)&&h*a>=0?(this.velocity=0,t):(this.velocity=u,t+c*l)}}const rt={MIN_TOUCH_AREA:.05,BASE_RADIUS:.15,LINE_WIDTH:.02,SEGMENTS:16,DELTA_PHI:Math.PI/32,COLORS:{EDGE_FALLOFF:new Ie(.98,.98,.98),EDGE_CUTOFF:new Ie(.8,.8,.8),FILL_FALLOFF:new Ie(.4,.4,.4),FILL_CUTOFF:new Ie(.4,.4,.4),ACTIVE_EDGE:new Ie(1,1,1),ACTIVE_FILL:new Ie(.6,.6,.6)},MAX_OPACITY:.75,FILL_OPACITY_MULTIPLIER:.5,INTERACTIVE_OPACITY_MULTIPLIER:1.2,MIN_DISTANCE:.5,MAX_DISTANCE:10,BASE_SCALE:1,DISTANCE_SCALE_FACTOR:.3,COLOR_LERP_FACTOR:.15,SCREEN_SPACE_SCALE:1.2,SIZE_UPDATE_THRESHOLD:.001,GEOMETRY_UPDATE_DEBOUNCE:100},nm=new pe,gc=(r,e,t,n,i)=>{let s=e>0?t>0?0:-Math.PI/2:t>0?Math.PI/2:Math.PI;for(let a=0;a<=rt.SEGMENTS;++a)r.push(e+(n-i)*Math.cos(s),t+(n-i)*Math.sin(s),0,e+n*Math.cos(s),t+n*Math.sin(s),0),s+=rt.DELTA_PHI};class p1 extends ot{constructor(e,t){const n=new sn;super(n),this.shadowHeight=0,this.isActive=!1,this.isHovered=!1,this.lastGeometryUpdateTime=0,this.needsGeometryUpdate=!1,this.scene=e,this.side=t,this.currentSize=new B,this.goalSize=new B,this.sizeDamper=new en,this.updateSizeFromScene(),this.edgeMaterial=new ln({color:rt.COLORS.EDGE_FALLOFF,transparent:!0,opacity:0,side:Vt,depthWrite:!1,blending:nd}),this.fillMaterial=new ln({color:rt.COLORS.FILL_FALLOFF,transparent:!0,opacity:0,side:Vt,depthWrite:!1,blending:Qs}),this.material=this.edgeMaterial,this.goalOpacity=0,this.opacityDamper=new en,this.createHitMeshes(),this.updatePositionFromScene(),e.target.add(this),e.target.add(this.hitBox),this.offsetHeight=0}updateSizeFromScene(){const{size:e}=this.scene;this.goalSize.copy(e);const t=Math.sqrt(e.x*e.x+e.z*e.z),n=Math.max(rt.MIN_TOUCH_AREA,t*.4);this.goalSize.x<n&&(this.goalSize.x=n),this.goalSize.z<n&&(this.goalSize.z=n),this.updateGeometry()}updateGeometry(){const e=this.geometry,t=[],n=[],i=this.goalSize.x/2,s=(this.side==="back"?this.goalSize.y:this.goalSize.z)/2,a=Math.min(i,s),o=Math.max(rt.BASE_RADIUS*.7,a*.2),c=Math.max(rt.LINE_WIDTH*.7,a*.025);gc(n,i,s,o,c),gc(n,-i,s,o,c),gc(n,-i,-s,o,c),gc(n,i,-s,o,c);const l=n.length/3;for(let h=0;h<l-2;h+=2)t.push(h,h+1,h+3,h,h+3,h+2);const u=l-2;
vendor: 14,319 bytes, line 4422
4422t.push(u,u+1,1,u,1,0),e.setAttribute("position",new Jt(n,3)),e.setIndex(t),e.computeBoundingSphere()}createHitMeshes(){const e=this.goalSize.x/2,t=(this.side==="back"?this.goalSize.y:this.goalSize.z)/2,n=Math.min(e,t),i=Math.max(rt.BASE_RADIUS*.7,n*.2);this.hitPlane=new ot(new si(2*(e+i),2*(t+i))),this.hitPlane.visible=!1,this.hitPlane.material.side=Vt,this.add(this.hitPlane),this.hitBox=new ot(new Wi(this.goalSize.x+2*i,this.goalSize.y+i,this.goalSize.z+2*i)),this.hitBox.visible=!1,this.hitBox.material.side=Vt,this.add(this.hitBox)}updatePositionFromScene(){const{boundingBox:e}=this.scene;switch(e.getCenter(this.position),this.rotation.set(0,0,0),this.side){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=e.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=e.min.z,this.position.z=this.shadowHeight;break}if(this.hitBox){const t=this.side==="back"?(this.goalSize.y+rt.BASE_RADIUS)/2:(this.goalSize.y+rt.BASE_RADIUS)/2;this.hitBox.position.y=t+e.min.y}}updateFromModelChanges(){this.updateSizeFromScene(),this.updatePositionFromScene(),this.updateGeometry(),this.updateHitMeshes(),this.ensureProperOrientation(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=performance.now()}ensureProperOrientation(){this.side==="bottom"?(this.rotation.x=-Math.PI/2,this.rotation.y=0,this.rotation.z=0):this.side==="back"&&(this.rotation.x=0,this.rotation.y=0,this.rotation.z=0)}setScreenSpaceMode(e){e?this.scale.set(rt.SCREEN_SPACE_SCALE,rt.SCREEN_SPACE_SCALE,rt.SCREEN_SPACE_SCALE):this.scale.set(1,1,1)}updateHitMeshes(){if(this.hitPlane&&this.hitBox){const e=this.goalSize.x/2,t=(this.side==="back"?this.goalSize.y:this.goalSize.z)/2,n=Math.min(e,t),i=Math.max(rt.BASE_RADIUS*.7,n*.2),s=new si(2*(e+i),2*(t+i));this.hitPlane.geometry.dispose(),this.hitPlane.geometry=s;const a=new Wi(this.goalSize.x+2*i,this.goalSize.y+i,this.goalSize.z+2*i);this.hitBox.geometry.dispose(),this.hitBox.geometry=a}}setInteractionState(e,t=!1){this.isActive=e,this.isHovered=t,this.updateVisualState()}updateVisualState(){let e,t;this.isActive?(e=rt.COLORS.ACTIVE_EDGE,t=rt.COLORS.ACTIVE_FILL):this.isHovered?(e=rt.COLORS.EDGE_FALLOFF,t=rt.COLORS.FILL_FALLOFF):(e=rt.COLORS.EDGE_CUTOFF,t=rt.COLORS.FILL_CUTOFF),this.edgeMaterial.color.lerp(e,rt.COLOR_LERP_FACTOR),this.fillMaterial.color.lerp(t,rt.COLOR_LERP_FACTOR)}applyDistanceScaling(e){const t=e.distanceTo(this.position),n=Math.max(rt.MIN_DISTANCE,Math.min(rt.MAX_DISTANCE,t)),i=rt.BASE_SCALE+(n-rt.MIN_DISTANCE)*rt.DISTANCE_SCALE_FACTOR;this.scale.set(i,i,i)}getHit(e,t,n){nm.set(t,-n),this.hitPlane.visible=!0;const i=e.positionAndNormalFromPoint(nm,this.hitPlane);return this.hitPlane.visible=!1,i==null?null:i.position}getExpandedHit(e,t,n){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const i=this.getHit(e,t,n);return this.hitPlane.scale.set(1,1,1),i}controllerIntersection(e,t){this.hitBox.visible=!0;const n=e.hitFromController(t,this.hitBox);return this.hitBox.visible=!1,n}set offsetHeight(e){e-=.001,this.side==="back"?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return this.side==="back"?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?rt.MAX_OPACITY:0}updateOpacity(e){const t=this.material,n=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1);this.edgeMaterial.opacity=n,this.fillMaterial.opacity=n*rt.FILL_OPACITY_MULTIPLIER,(this.isActive||this.isHovered)&&(this.edgeMaterial.opacity=n*rt.INTERACTIVE_OPACITY_MULTIPLIER),this.visible=n>0}update(e,t){if(this.updateOpacity(e),!this.currentSize.equals(this.goalSize)){const i=new B;i.x=this.sizeDamper.update(this.currentSize.x,this.goalSize.x,e,1),i.y=this.sizeDamper.update(this.currentSize.y,this.goalSize.y,e,1),i.z=this.sizeDamper.update(this.currentSize.z,this.goalSize.z,e,1),i.distanceTo(this.currentSize)>rt.SIZE_UPDATE_THRESHOLD&&(this.currentSize.copy(i),this.needsGeometryUpdate=!0)}const n=performance.now();this.needsGeometryUpdate&&n-this.lastGeometryUpdateTime>rt.GEOMETRY_UPDATE_DEBOUNCE&&(this.updateGeometry(),this.updateHitMeshes(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=n),t&&this.applyDistanceScaling(t),this.updateVisualState()}getSize(){return this.goalSize.clone()}dispose(){const{geometry:e,material:t}=this.hitPlane;e.dispose(),t.dispose(),this.hitBox.geometry.dispose(),this.hitBox.material.dispose(),this.geometry.dispose(),this.edgeMaterial.dispose(),this.fillMaterial.dispose(),this.hitBox.removeFromParent(),this.removeFromParent()}}const hn=(r,e)=>({type:"number",number:r,unit:e}),Gi=(()=>{const r={};return t=>{const n=t;if(n in r)return r[n];const i=[];let s=0;for(;t;){if(++s>1e3){t="";break}const a=ib(t),o=a.nodes[0];if(o==null||o.terms.length===0)break;i.push(o),t=a.remainingInput}return r[n]=i}})(),ib=(()=>{const r=/^(\-\-|[a-z\u0240-\uffff])/i,e=/^([\*\+\/]|[\-]\s)/i,t=/^[\),]/;return s=>{const a=[];for(;s.length&&(s=s.trim(),!t.test(s));)if(s[0]==="("){const{nodes:o,remainingInput:c}=im(s);s=c,a.push({type:"function",name:{type:"ident",value:"calc"},arguments:o})}else if(r.test(s)){const o=A1(s),c=o.nodes[0];if(s=o.remainingInput,s[0]==="("){const{nodes:l,remainingInput:u}=im(s);a.push({type:"function",name:c,arguments:l}),s=u}else a.push(c)}else if(e.test(s))a.push({type:"operator",value:s[0]}),s=s.slice(1);else{const{nodes:o,remainingInput:c}=s[0]==="#"?g1(s):m1(s);if(o.length===0)break;a.push(o[0]),s=c}return{nodes:[{type:"expression",terms:a}],remainingInput:s}}})(),A1=(()=>{const r=/[^a-z0-9_\-\u0240-\uffff]/i;return e=>{const t=e.match(r),n=t==null?e:e.substr(0,t.index),i=t==null?"":e.substr(t.index);return{nodes:[{type:"ident",value:n}],remainingInput:i}}})(),m1=(()=>{const r=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,e=/^[a-z%]+/i,t=/^(m|mm|cm|rad|deg|[%])$/;return n=>{const i=n.match(r),s=i==null?"0":i[0];n=s==null?n:n.slice(s.length);const a=n.match(e);let o=a!=null&&a[0]!==""?a[0]:null;const c=a==null?n:n.slice(o.length);return o!=null&&!t.test(o)&&(o=null),{nodes:[{type:"number",number:parseFloat(s)||0,unit:o}],remainingInput:c}}})(),g1=(()=>{const r=/^[a-f0-9]*/i;return e=>{e=e.slice(1).trim();const t=e.match(r);return{nodes:t==null?[]:[{type:"hex",value:t[0]}],remainingInput:t==null?e:e.slice(t[0].length)}}})(),im=r=>{const e=[];for(r=r.slice(1).trim();r.length;){const t=ib(r);if(e.push(t.nodes[0]),r=t.remainingInput.trim(),r[0]===",")r=r.slice(1).trim();else if(r[0]===")"){r=r.slice(1);break}}return{nodes:e,remainingInput:r}},sm=Symbol("visitedTypes");class x1{constructor(e){this[sm]=e}walk(e,t){const n=e.slice();for(;n.length;){const i=n.shift();switch(this[sm].indexOf(i.type)>-1&&t(i),i.type){case"expression":n.unshift(...i.terms);break;case"function":n.unshift(i.name,...i.arguments);break}}}}const ds=Object.freeze({type:"number",number:0,unit:null});const Wl=(r,e=0)=>{let{number:t,unit:n}=r;if(!isFinite(t))t=e,n="rad";else if(r.unit==="rad"||r.unit==null)return r;return{type:"number",number:(n==="deg"&&t!=null?t:0)*Math.PI/180,unit:"rad"}},rm=(r,e=0)=>{let{number:t,unit:n}=r;if(!isFinite(t))t=e,n="m";else if(r.unit==="m")return r;let i;switch(n){default:i=1;break;case"cm":i=1/100;break;case"mm":i=1/1e3;break}return{type:"number",number:i*t,unit:"m"}},mi=(()=>{const r=t=>t,e={rad:r,deg:Wl,m:r,mm:rm,cm:rm};return(t,n=ds)=>{isFinite(t.number)||(t.number=n.number,t.unit=n.unit);const{unit:i}=t;if(i==null)return t;const s=e[i];return s==null?n:s(t)}})();var sb,am,om;const pa=Symbol("evaluate"),Yc=Symbol("lastValue");class Dt{constructor(){this[sb]=null}static evaluatableFor(e,t=ds){if(e instanceof Dt)return e;if(e.type==="number")return e.unit==="%"?new b1(e,t):e;switch(e.name.value){case"calc":return new E1(e,t);case"env":return new _1(e)}return ds}static evaluate(e){return e instanceof Dt?e.evaluate():e}static isConstant(e){return e instanceof Dt?e.isConstant:!0}static applyIntrinsics(e,t){const{basis:n,keywords:i}=t,{auto:s}=i;return n.map((a,o)=>{const c=s[o]==null?a:s[o];let l=e[o]?e[o]:c;if(l.type==="ident"){const u=l.value;u in i&&(l=i[u][o])}return(l==null||l.type==="ident")&&(l=c),l.unit==="%"?hn(l.number/100*a.number,a.unit):(l=mi(l,a),l.unit!==a.unit?a:l)})}get isConstant(){return!1}evaluate(){return(!this.isConstant||this[Yc]==null)&&(this[Yc]=this[pa]()),this[Yc]}}sb=Yc;const cm=Symbol("percentage"),eu=Symbol("basis");class b1 extends Dt{constructor(e,t){super(),this[cm]=e,this[eu]=t}get isConstant(){return!0}[pa](){return hn(this[cm].number/100*this[eu].number,this[eu].unit)}}const xc=Symbol("identNode");class _1 extends Dt{constructor(e){super(),this[am]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;t!=null&&t.type==="ident"&&(this[xc]=t)}get isConstant(){return!1}[(am=xc,pa)](){if(this[xc]!=null&&this[xc].value==="window-scroll-y"){const e=window.pageYOffset,t=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight);return{type:"number",number:e/(t-window.innerHeight)||0,unit:null}}return ds}}const v1=/[\*\/]/,xr=Symbol("evaluator");class E1 extends Dt{constructor(e,t=ds){if(super(),this[om]=null,e.arguments.length!==1)return;const n=e.arguments[0].terms.slice(),i=[];for(;n.length;){const s=n.shift();if(i.length>0){const a=i[i.length-1];if(a.type==="operator"&&v1.test(a.value)){const o=i.pop(),c=i.pop();if(c==null)return;i.push(new hm(o,Dt.evaluatableFor(c,t),Dt.evaluatableFor(s,t)));continue}}i.push(s.type==="operator"?s:Dt.evaluatableFor(s,t))}for(;i.length>2;){const[s,a,o]=i.splice(0,3);if(a.type!=="operator")return;i.unshift(new hm(a,Dt.evaluatableFor(s,t),Dt.evaluatableFor(o,t)))}i.length===1&&(this[xr]=i[0])}get isConstant(){return this[xr]==null||Dt.isConstant(this[xr])}[(om=xr,pa)](){return this[xr]!=null?Dt.evaluate(this[xr]):ds}}const lm=Symbol("operator"),tu=Symbol("left"),nu=Symbol("right");class hm extends Dt{constructor(e,t,n){super(),this[lm]=e,this[tu]=t,this[nu]=n}get isConstant(){return Dt.isConstant(this[tu])&&Dt.isConstant(this[nu])}[pa](){const e=mi(Dt.evaluate(this[tu])),t=mi(Dt.evaluate(this[nu])),{number:n,unit:i}=e,{number:s,unit:a}=t;if(a!=null&&i!=null&&a!=i)return ds;const o=i||a;let c;switch(this[lm].value){case"+":c=n+s;break;case"-":c=n-s;break;case"/":c=n/s;break;case"*":c=n*s;break;default:return ds}return{type:"number",number:c,unit:o}}}const iu=Symbol("evaluatables"),um=Symbol("intrinsics");class rb extends Dt{constructor(e,t){super(),this[um]=t;const n=e[0],i=n!=null?n.terms:[];this[iu]=t.basis.map((s,a)=>{const o=i[a];return o==null?{type:"ident",value:"auto"}:o.type==="ident"?o:Dt.evaluatableFor(o,s)})}get isConstant(){for(const e of this[iu])if(!Dt.isConstant(e))return!1;return!0}[pa](){const e=this[iu].map(t=>Dt.evaluate(t));return Dt.applyIntrinsics(e,this[um]).map(t=>t.number)}}var ab,ob,cb,lb;const br=Symbol("instances"),dm=Symbol("activateListener"),fm=Symbol("deactivateListener"),su=Symbol("notifyInstances"),pm=Symbol("notify"),Am=Symbol("callback");class di{static[su](){for(const e of di[br])e[pm]()}static[(ab=br,dm)](){window.addEventListener("scroll",this[su],{passive:!0})}static[fm](){window.removeEventListener("scroll",this[su])}constructor(e){this[Am]=e}observe(){di[br].size===0&&di[dm](),di[br].add(this)}disconnect(){di[br].delete(this),di[br].size===0&&di[fm]()}[pm](){this[Am]()}}di[ab]=new Set;const mm=Symbol("computeStyleCallback"),hb=Symbol("astWalker"),Za=Symbol("dependencies"),ub=Symbol("onScroll");class y1{constructor(e){this[ob]={},this[cb]=new x1(["function"]),this[lb]=()=>{this[mm]({relatedState:"window-scroll"})},this[mm]=e}observeEffectsFor(e){const t={},n=this[Za];this[hb].walk(e,i=>{const{name:s}=i,o=i.arguments[0].terms[0];if(!(s.value!=="env"||o==null||o.type!=="ident"))switch(o.value){case"window-scroll-y":if(t["window-scroll"]==null){const c="window-scroll"in n?n["window-scroll"]:new di(this[ub]);c.observe(),delete n["window-scroll"],t["window-scroll"]=c}break}});for(const i in n)n[i].disconnect();this[Za]=t}dispose(){for(const e in this[Za])this[Za][e].disconnect()}}ob=Za,cb=hb,lb=ub;const ts=r=>{const e=r.observeEffects||!1,t=r.intrinsics instanceof Function?r.intrinsics:(()=>r.intrinsics);return(n,i)=>{const s=n.updated,a=n.connectedCallback,o=n.disconnectedCallback,c=Symbol(`${i}StyleEffector`),l=Symbol(`${i}StyleEvaluator`),u=Symbol(`${i}UpdateEvaluator`),h=Symbol(`${i}EvaluateAndSync`);Object.defineProperties(n,{[c]:{value:null,writable:!0},[l]:{value:null,writable:!0},[u]:{value:function(){const d=Gi(this[i]);this[l]=new rb(d,t(this)),this[c]==null&&e&&(this[c]=new y1(()=>this[h]())),this[c]!=null&&this[c].observeEffectsFor(d)}},[h]:{value:function(){if(this[l]==null)return;const d=this[l].evaluate();this[r.updateHandler](d)}},updated:{value:function(d){d.has(i)&&(this[u](),this[h]()),s.call(this,d)}},connectedCallback:{value:function(){a.call(this),this.requestUpdate(i,this[i])}},disconnectedCallback:{value:function(){o.call(this),this[c]!=null&&(this[c].dispose(),this[c]=null)}}})}};const db=r=>r<.5?2*r*r:-1+(4-2*r)*r,S1=(r,e,t=db)=>n=>r+(e-r)*t(n),C1=(r,e)=>{const t=(i=>s=>i+=s),n=e.map(t(0));return i=>{i=pi(i,0,1),i*=n[n.length-1];const s=n.findIndex(c=>c>=i),a=s<1?0:n[s-1],o=n[s];return r[s]((i-a)/(o-a))}},Pr=r=>{const e=[],t=[];let n=r.initialValue;for(let i=0;i<r.keyframes.length;++i){const s=r.keyframes[i],{value:a,frames:o}=s,c=s.ease||db,l=S1(n,a,c);e.push(l),t.push(o),n=a}return C1(e,t)};var zt=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const I1=5e3,M1=Pr({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),w1=Pr({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),T1=30,R1=12,fb="0deg 75deg 105%",B1="auto auto auto",D1="auto",L1=2.2,F1=["front","right","back","left"],P1=["upper-","","lower-"],N1=3e3,U1=". Use mouse, touch or arrow keys to move.",bc={AUTO:"auto"},ru={BASIC:"basic",WIGGLE:"wiggle"},O1={NONE:"none"},gm=()=>
vendor: 24,025 bytes, line 4422
4422({basis:[Wl(hn(T1,"deg"))],keywords:{auto:[null]}}),k1=()=>({basis:[Wl(hn(R1,"deg"))],keywords:{auto:[null]}}),pb=(()=>{const r=Gi(fb)[0].terms,e=mi(r[0]),t=mi(r[1]);return n=>{const i=n[te].idealCameraDistance();return{basis:[e,t,hn(i,"m")],keywords:{auto:[null,null,hn(105,"%")]}}}})(),Q1=r=>{const e=L1*r[te].boundingSphere.radius;return{basis:[hn(-1/0,"rad"),hn(0,"rad"),hn(e,"m")],keywords:{auto:[null,null,null]}}},G1=r=>{const e=pb(r),n=new rb([],e).evaluate()[2];return{basis:[hn(1/0,"rad"),hn(Math.PI,"rad"),hn(n,"m")],keywords:{auto:[null,null,null]}}},H1=r=>{const e=r[te].boundingBox.getCenter(new B);return{basis:[hn(e.x,"m"),hn(e.y,"m"),hn(e.z,"m")],keywords:{auto:[null,null,null]}}},Ab=Math.PI/2,z1=Math.PI/3,V1=Ab/2,W1=2*Math.PI,dt=Symbol("controls"),jc=Symbol("panElement"),au=Symbol("promptElement"),_c=Symbol("promptAnimatedContainer"),ou=Symbol("fingerAnimatedContainers"),vc=Symbol("deferInteractionPrompt"),xm=Symbol("updateAria"),Bi=Symbol("a11y"),bm=Symbol("updateA11y"),_m=Symbol("updateCameraForRadius"),_r=Symbol("cancelPrompts"),cu=Symbol("onChange"),Ta=Symbol("onPointerChange"),Ss=Symbol("waitingToPromptUser"),Ec=Symbol("userHasInteracted"),vr=Symbol("promptElementVisibleTime"),Ra=Symbol("lastPromptOffset"),yc=Symbol("cancellationSource"),lu=Symbol("lastSpherical"),Ba=Symbol("jumpCamera"),hu=Symbol("initialized"),Da=Symbol("maintainThetaPhi"),vm=Symbol("syncCameraOrbit"),Em=Symbol("syncFieldOfView"),ym=Symbol("syncCameraTarget"),Sm=Symbol("syncMinCameraOrbit"),Cm=Symbol("syncMaxCameraOrbit"),Im=Symbol("syncMinFieldOfView"),Mm=Symbol("syncMaxFieldOfView"),q1=r=>{var e,t,n,i,s,a,o,c,l,u,h,d,f,p,g,m,A,x;class _ extends r{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=fb,this.cameraTarget=B1,this.fieldOfView=D1,this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=N1,this.interactionPrompt=bc.AUTO,this.interactionPromptStyle=ru.WIGGLE,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=O1.NONE,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=nb,this.a11y=null,this[e]=this.shadowRoot.querySelector(".interaction-prompt"),this[t]=this.shadowRoot.querySelector("#prompt"),this[n]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[i]=this.shadowRoot.querySelector(".pan-target"),this[s]=0,this[a]=1/0,this[o]=!1,this[c]=!1,this[l]=Ft.AUTOMATIC,this[u]=new j1(this[te].camera,this[Kn],this[te]),this[h]=new Wc,this[d]=!1,this[f]=!1,this[p]=!1,this[g]={},this[m]=()=>{const v=this[dt].changeSource;this[yc]=v,v===Ft.USER_INTERACTION&&(this[Ec]=!0,this[vc]())},this[A]=()=>{this[xm](),this[Kt]();const v=this[dt].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:v}}))},this[x]=v=>{this[Zc].classList.toggle("pointer-tumbling",v.type==="pointer-change-start")}}get inputSensitivity(){return this[dt].inputSensitivity}set inputSensitivity(v){this[dt].inputSensitivity=v}getCameraOrbit(){const{theta:v,phi:C,radius:M}=this[lu];return{theta:v,phi:C,radius:M,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return ss(this[at].isPresenting?this[at].arRenderer.target:this[te].getDynamicTarget())}getFieldOfView(){return this[dt].getFieldOfView()}getMinimumFieldOfView(){return this[dt].options.minimumFieldOfView}getMaximumFieldOfView(){return this[dt].options.maximumFieldOfView}getIdealAspect(){return this[te].idealAspect}jumpCameraToGoal(){this[Ba]=!0,this.requestUpdate(Ba,!1)}resetInteractionPrompt(){this[Ra]=0,this[vr]=1/0,this[Ec]=!1,this[Ss]=this.interactionPrompt===bc.AUTO&&this.cameraControls}zoom(v){const C=new WheelEvent("wheel",{deltaY:-30*v});this[Kn].dispatchEvent(C)}connectedCallback(){super.connectedCallback(),this[dt].addEventListener("user-interaction",this[_r]),this[dt].addEventListener("pointer-change-start",this[Ta]),this[dt].addEventListener("pointer-change-end",this[Ta])}disconnectedCallback(){super.disconnectedCallback(),this[dt].removeEventListener("user-interaction",this[_r]),this[dt].removeEventListener("pointer-change-start",this[Ta]),this[dt].removeEventListener("pointer-change-end",this[Ta])}updated(v){super.updated(v);const C=this[dt],M=this[te];if(v.has("cameraControls")&&(this.cameraControls?(C.enableInteraction(),this.interactionPrompt===bc.AUTO&&(this[Ss]=!0)):(C.disableInteraction(),this[vc]()),this[Kn].setAttribute("aria-label",this[Ur])),v.has("disableZoom")&&(C.disableZoom=this.disableZoom),v.has("disablePan")&&(C.enablePan=!this.disablePan),v.has("disableTap")&&(C.enableTap=!this.disableTap),(v.has("interactionPrompt")||v.has("cameraControls")||v.has("src"))&&(this.interactionPrompt===bc.AUTO&&this.cameraControls&&!this[Ec]?this[Ss]=!0:this[vc]()),v.has("interactionPromptStyle")&&(this[_c].style.opacity=this.interactionPromptStyle==ru.BASIC?"1":"0"),v.has("touchAction")){const w=this.touchAction;C.applyOptions({touchAction:w}),C.updateTouchActionStyle()}v.has("orbitSensitivity")&&(C.orbitSensitivity=this.orbitSensitivity),v.has("zoomSensitivity")&&(C.zoomSensitivity=this.zoomSensitivity),v.has("panSensitivity")&&(C.panSensitivity=this.panSensitivity),v.has("interpolationDecay")&&(C.setDamperDecayTime(this.interpolationDecay),M.setTargetDamperDecayTime(this.interpolationDecay)),v.has("a11y")&&this[bm](),this[Ba]===!0&&Promise.resolve().then(()=>{C.jumpToGoal(),M.jumpToGoal(),this[cu](),this[Ba]=!1})}async updateFraming(){const v=this[te],C=v.adjustedFoV(v.framedFoVDeg);await v.updateFraming();const M=v.adjustedFoV(v.framedFoVDeg),w=this[dt].getFieldOfView()/C;this[dt].setFieldOfView(M*w),this[Da]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(v,C,M){const w=this[Kn],E=this[ou];if(E[0].style.opacity==="1"){console.warn("interact() failed because an existing interaction is running.");return}const S=new Array;S.push({x:Pr(C.x),y:Pr(C.y)});const R=[{x:S[0].x(0),y:S[0].y(0)}];M!=null&&(S.push({x:Pr(M.x),y:Pr(M.y)}),R.push({x:S[1].x(0),y:S[1].y(0)}));let N=performance.now();const{width:F,height:P}=this[te],Q=this.getBoundingClientRect(),U=J=>{for(const[Z,Y]of R.entries()){const{style:re}=E[Z];re.transform=`translateX(${F*Y.x}px) translateY(${P*Y.y}px)`,J==="pointerdown"?re.opacity="1":J==="pointerup"&&(re.opacity="0");const Ae={pointerId:Z-5678,pointerType:"touch",target:w,clientX:F*Y.x+Q.x,clientY:P*Y.y+Q.y,altKey:!0};w.dispatchEvent(new PointerEvent(J,Ae))}},G=()=>{const J=this[yc];if(J!==Ft.AUTOMATIC||!w.isConnected){for(const Y of this[ou])Y.style.opacity="0";U("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:J}})),document.removeEventListener("visibilitychange",q);return}const Z=Math.min(1,(performance.now()-N)/v);for(const[Y,re]of R.entries())re.x=S[Y].x(Z),re.y=S[Y].y(Z);U("pointermove"),Z<1?requestAnimationFrame(G):(U("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:Ft.AUTOMATIC}})),document.removeEventListener("visibilitychange",q))},q=()=>{let J=0;document.visibilityState==="hidden"?J=performance.now()-N:N=performance.now()-J};document.addEventListener("visibilitychange",q),U("pointerdown"),this[yc]=Ft.AUTOMATIC,requestAnimationFrame(G)}[(e=au,t=_c,n=ou,i=jc,s=Ra,a=vr,o=Ec,c=Ss,l=yc,u=dt,h=lu,d=Ba,f=hu,p=Da,g=Bi,Em)](v){const C=this[dt],M=this[te];M.framedFoVDeg=v[0]*180/Math.PI,C.changeSource=Ft.NONE,C.setFieldOfView(M.adjustedFoV(M.framedFoVDeg)),this[_r]()}[vm](v){const C=this[dt];if(this[Da]){const{theta:M,phi:w}=this.getCameraOrbit();v[0]=M,v[1]=w,this[Da]=!1}C.changeSource=Ft.NONE,C.setOrbit(v[0],v[1],v[2]),this[_r]()}[Sm](v){this[dt].applyOptions({minimumAzimuthalAngle:v[0],minimumPolarAngle:v[1],minimumRadius:v[2]}),this.jumpCameraToGoal()}[Cm](v){this[dt].applyOptions({maximumAzimuthalAngle:v[0],maximumPolarAngle:v[1],maximumRadius:v[2]}),this[_m](v[2]),this.jumpCameraToGoal()}[Im](v){this[dt].applyOptions({minimumFieldOfView:v[0]*180/Math.PI}),this.jumpCameraToGoal()}[Mm](v){const C=this[te].adjustedFoV(v[0]*180/Math.PI);this[dt].applyOptions({maximumFieldOfView:C}),this.jumpCameraToGoal()}[ym](v){const[C,M,w]=v;this[at].arRenderer.isPresenting||this[te].setTarget(C,M,w),this[dt].changeSource=Ft.NONE,this[at].arRenderer.updateTarget(),this[_r]()}[gi](v,C){if(super[gi](v,C),this[at].isPresenting||!this[js]())return;const M=this[dt],w=this[te],E=performance.now();if(this[Ss]&&this.loaded&&E>this[no]+this.interactionPromptThreshold&&(this[Ss]=!1,this[vr]=E,this[au].classList.add("visible")),isFinite(this[vr])&&this.interactionPromptStyle===ru.WIGGLE){const N=(E-this[vr])/I1%1,F=M1(N),P=w1(N);if(this[_c].style.opacity=`${P}`,F!==this[Ra]){const Q=F*w.width*.05,U=(F-this[Ra])*Math.PI/16;this[_c].style.transform=`translateX(${Q}px)`,M.changeSource=Ft.AUTOMATIC,M.adjustOrbit(U,0,0),this[Ra]=F}}const S=M.update(v,C),R=w.updateTarget(C);(S||R)&&this[cu]()}[vc](){this[Ss]=!1,this[au].classList.remove("visible"),this[vr]=1/0}[_m](v){const C=Math.max(this[te].farRadius(),v),M=0,w=Math.abs(2*C);this[dt].updateNearFar(M,w)}[xm](){const{theta:v,phi:C}=this[dt].getCameraSpherical(this[lu]),M=(4+Math.floor((v%W1+V1)/Ab))%4,w=Math.floor(C/z1),E=F1[M],R=`${P1[w]}${E}`,N=R;N in this[Bi]?this[Ml](this[Bi][N]):this[Ml](`View from stage ${R}`)}get[Ur](){let v=U1;return"interaction-prompt"in this[Bi]&&(v=`. ${this[Bi]["interaction-prompt"]}`),super[Ur].replace(/\.$/,"")+(this.cameraControls?v:"")}async[wl](v){const C=this[dt],M=this[te],w=M.adjustedFoV(M.framedFoVDeg);super[wl](v);const E=M.adjustedFoV(M.framedFoVDeg)/w,S=C.getFieldOfView()*(isFinite(E)?E:1);C.updateAspect(this[te].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[dt].setFieldOfView(S),this.jumpCameraToGoal()}[xi](){super[xi](),this[hu]?this[Da]=!0:this[hu]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}[(m=_r,A=cu,x=Ta,bm)](){if(typeof this.a11y=="string")if(this.a11y.startsWith("{"))try{this[Bi]=JSON.parse(this.a11y)}catch(v){console.warn("Error parsing a11y JSON:",v)}else this.a11y.length>0?console.warn("Error not supported format, should be a JSON string:",this.a11y):this[Bi]={};else typeof this.a11y=="object"&&this.a11y!=null?this[Bi]=Object.assign({},this.a11y):this[Bi]={};this[Kn].setAttribute("aria-label",this[Ur])}}return zt([De({type:Boolean,attribute:"camera-controls"})],_.prototype,"cameraControls",void 0),zt([ts({intrinsics:pb,observeEffects:!0,updateHandler:vm}),De({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],_.prototype,"cameraOrbit",void 0),zt([ts({intrinsics:H1,observeEffects:!0,updateHandler:ym}),De({type:String,attribute:"camera-target",hasChanged:()=>!0})],_.prototype,"cameraTarget",void 0),zt([ts({intrinsics:gm,observeEffects:!0,updateHandler:Em}),De({type:String,attribute:"field-of-view",hasChanged:()=>!0})],_.prototype,"fieldOfView",void 0),zt([ts({intrinsics:Q1,updateHandler:Sm}),De({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],_.prototype,"minCameraOrbit",void 0),zt([ts({intrinsics:G1,updateHandler:Cm}),De({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],_.prototype,"maxCameraOrbit",void 0),zt([ts({intrinsics:k1,updateHandler:Im}),De({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],_.prototype,"minFieldOfView",void 0),zt([ts({intrinsics:gm,updateHandler:Mm}),De({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],_.prototype,"maxFieldOfView",void 0),zt([De({type:Number,attribute:"interaction-prompt-threshold"})],_.prototype,"interactionPromptThreshold",void 0),zt([De({type:String,attribute:"interaction-prompt"})],_.prototype,"interactionPrompt",void 0),zt([De({type:String,attribute:"interaction-prompt-style"})],_.prototype,"interactionPromptStyle",void 0),zt([De({type:Number,attribute:"orbit-sensitivity"})],_.prototype,"orbitSensitivity",void 0),zt([De({type:Number,attribute:"zoom-sensitivity"})],_.prototype,"zoomSensitivity",void 0),zt([De({type:Number,attribute:"pan-sensitivity"})],_.prototype,"panSensitivity",void 0),zt([De({type:String,attribute:"touch-action"})],_.prototype,"touchAction",void 0),zt([De({type:Boolean,attribute:"disable-zoom"})],_.prototype,"disableZoom",void 0),zt([De({type:Boolean,attribute:"disable-pan"})],_.prototype,"disablePan",void 0),zt([De({type:Boolean,attribute:"disable-tap"})],_.prototype,"disableTap",void 0),zt([De({type:Number,attribute:"interpolation-decay"})],_.prototype,"interpolationDecay",void 0),zt([De()],_.prototype,"a11y",void 0),_};const X1=.018,wm=2,$1=300,Y1=new pe,Tm=new B,Rm=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:0,maximumPolarAngle:Math.PI,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),Sc=Math.PI/8,Cc=.04,Ic=10,Ft={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class j1 extends ri{constructor(e,t,n){super(),this.camera=e,this.element=t,this.scene=n,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=Ft.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new Qe,this.panPerPixel=0,this.spherical=new Wc,this.goalSpherical=new Wc,this.thetaDamper=new en,this.phiDamper=new en,this.radiusDamper=new en,this.logFov=Math.log(Rm.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new en,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=i=>{if(this.enablePan)i.preventDefault();else for(const s of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:s.id})))},this.touchModeZoom=(i,s)=>{if(!this._disableZoom){const a=this.twoTouchDistance(this.pointers[0],this.pointers[1]),o=Cc*this.zoomSensitivity*(this.lastSeparation-a)*50/this.scene.height;this.lastSeparation=a,this.userAdjustOrbit(0,0,o)}this.panPerPixel>0&&this.movePan(i,s)},this.disableScroll=i=>{i.preventDefault()},this.touchModeRotate=(i,s)=>{const{touchAction:a}=this._options;if(!this.touchDecided&&a!=="none"){this.touchDecided=!0;const o=Math.abs(i),c=Math.abs(s);if(this.changeSource===Ft.USER_INTERACTION&&(a==="pan-y"&&c>o||a==="pan-x"&&o>c)){this.touchMode=null;return}else this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(i,s)},this.onPointerDown=i=>{if(this.pointers.length>2)return;const{element:s}=this;this.pointers.length===0&&(s.addEventListener("pointermove",this.onPointerMove),s.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=i.clientX,this.startPointerPosition.clientY=i.clientY,this.startTime=performance.now());try{s.setPointerCapture(i.pointerId)}catch{}this.pointers.push({clientX:i.clientX,clientY:i.clientY,id:i.pointerId}),this.isUserPointing=!1,i.pointerType==="touch"?(this.changeSource=i.altKey?Ft.AUTOMATIC:Ft.USER_INTERACTION,this.onTouchChange(i)):(this.changeSource=Ft.USER_INTERACTION,this.onMouseDown(i)),this.changeSource===Ft.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=i=>{const s=this.pointers.find(l=>l.id===i.pointerId);if(s==null)return;if(i.pointerType==="mouse"&&i.buttons===0){this.onPointerUp(i);return}const a=this.pointers.length,o=(i.clientX-s.clientX)/a,c=(i.clientY-s.clientY)/a;o===0&&c===0||(s.clientX=i.clientX,s.clientY=i.clientY,i.pointerType==="touch"?(this.changeSource=i.altKey?Ft.AUTOMATIC:Ft.USER_INTERACTION,this.touchMode!==null&&this.touchMode(o,c)):(this.changeSource=Ft.USER_INTERACTION,this.panPerPixel>0?this.movePan(o,c):this.handleSinglePointerMove(o,c)))},this.onPointerUp=i=>{const{element:s}=this,a=this.pointers.findIndex(o=>o.id===i.pointerId);a!==-1&&this.pointers.splice(a,1),this.panPerPixel>0&&!i.altKey&&this.resetRadius(),this.pointers.length===0?(s.removeEventListener("pointermove",this.onPointerMove),s.removeEventListener("pointerup",this.onPointerUp),s.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(i)):this.touchMode!==null&&this.onTouchChange(i),this.scene.element[jc].style.opacity=0,s.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=i=>{this.changeSource=Ft.USER_INTERACTION;const s=i.deltaY*(i.deltaMode==1?18:1)*Cc*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,s),i.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=i=>{const{changeSource:s}=this;this.changeSource=Ft.USER_INTERACTION,(i.shiftKey&&this.enablePan?this.panKeyCodeHandler(i):this.orbitZoomKeyCodeHandler(i))?(i.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=s},this._options=Object.assign({},Rm),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(this._interactionEnabled===!1){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",()=>{},{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(this._interactionEnabled===!0){const{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,e===!0?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new Wc){return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=t===0?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this.goalSpherical.theta,t=this.goalSpherical.phi,n=this.goalSpherical.radius){const{minimumAzimuthalAngle:i,maximumAzimuthalAngle:s,minimumPolarAngle:a,maximumPolarAngle:o,minimumRadius:c,maximumRadius:l}=this._options,{theta:u,phi:h,radius:d}=this.goalSpherical,f=pi(e,i,s);!isFinite(i)&&!isFinite(s)&&(this.spherical.theta=this.wrapAngle(this.spherical.theta-f)+f);const p=pi(t,a,o),g=pi(n,c,l);return f===u&&p===h&&g===d||!isFinite(f)||!isFinite(p)||!isFinite(g)?!1:(this.goalSpherical.theta=f,this.goalSpherical.phi=p,this.goalSpherical.radius=g,this.goalSpherical.makeSafe(),!0)}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:n}=this._options;e=pi(e,t,n),this.goalLogFov=Math.log(e)}setDamperDecayTime(e){this.thetaDamper.setDecayTime(e),this.phiDamper.setDecayTime(e),this.radiusDamper.setDecayTime(e),this.fovDamper.setDecayTime(e)}adjustOrbit(e,t,n){const{theta:i,phi:s,radius:a}=this.goalSpherical,{minimumRadius:o,maximumRadius:c,minimumFieldOfView:l,maximumFieldOfView:u}=this._options,h=this.spherical.theta-i,d=Math.PI-.001,f=i-pi(e,-d-h,d-h),p=s-t,g=n===0?0:((n>0?c:o)-a)/(Math.log(n>0?u:l)-this.goalLogFov),m=a+n*(isFinite(g)?g:(c-o)*2);if(this.setOrbit(f,p,m),n!==0){const A=this.goalLogFov+n;this.setFieldOfView(Math.exp(A))}}jumpToGoal(){this.update(0,tb)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:n,maximumRadius:i}=this._options,s=this.spherical.theta-this.goalSpherical.theta;return Math.abs(s)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=Math.sign(s)*2*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,n),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,i),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:e}=this.element;if(this._interactionEnabled){const{touchAction:t}=this._options;this._disableZoom&&t!=="none"?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new Vn(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix())}userAdjustOrbit(e,t,n){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,n*this.inputSensitivity)}wrapAngle(e){const t=(e+Math.PI)/(2*Math.PI);return(t-Math.floor(t))*2*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){const{clientX:n,clientY:i}=e,{clientX:s,clientY:a}=t,o=s-n,c=a-i;return Math.sqrt(o*o+c*c)}handleSinglePointerMove(e,t){const n=this.pixelLengthToSphericalAngle(e),i=this.pixelLengthToSphericalAngle(t);this.isUserPointing===!1&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(n,i,0)}initializePan(){const{theta:e,phi:t}=this.spherical,n=e-this.scene.yaw;this.panPerPixel=X1*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(n),-Math.cos(t)*Math.sin(n),0,0,Math.sin(t),0,Math.sin(n),-Math.cos(t)*Math.cos(n),0)}movePan(e,t){const{scene:n}=this,i=Tm.set(e,t,0).multiplyScalar(this.inputSensitivity),s=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;i.multiplyScalar(s);const a=n.getTarget();a.add(i.applyMatrix3(this.panProjection)),n.boundingSphere.clampPoint(a,a),n.setTarget(a.x,a.y,a.z)}recenter(e){if(performance.now()>this.startTime+$1||Math.abs(e.clientX-this.startPointerPosition.clientX)>wm||Math.abs(e.clientY-this.startPointerPosition.clientY)>wm)return;const{scene:t}=this,n=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(n==null){const{cameraTarget:i}=t.element;t.element.cameraTarget="",t.element.cameraTarget=i,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(n.position),t.setTarget(n.position.x,n.position.y,n.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(Y1.set(0,0));if(t==null)return;e.target.worldToLocal(t.position);const n=e.getTarget(),{theta:i,phi:s}=this.spherical,a=i-e.yaw,o=Tm.set(Math.sin(s)*Math.sin(a),Math.cos(s),Math.sin(s)*Math.cos(a)),c=o.dot(t.position.sub(n));n.add(o.multiplyScalar(c)),e.setTarget(n.x,n.y,n.z),this.setOrbit(void 0,void 0,this.goalSpherical.radiu
vendor: 43,698 bytes, lines 4422-4440
4422s-c)}onTouchChange(e){if(this.pointers.length===1)this.touchMode=this.touchModeRotate;else{if(this._disableZoom){this.touchMode=null,this.element.removeEventListener("touchmove",this.disableScroll);return}this.touchMode=this.touchDecided&&this.touchMode===null?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&this.touchMode!=null&&(this.initializePan(),e.altKey||(this.scene.element[jc].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(e.button===2||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[jc].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,Cc*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-1*Cc*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-Sc,0);break;case"ArrowDown":this.userAdjustOrbit(0,Sc,0);break;case"ArrowLeft":this.userAdjustOrbit(-Sc,0,0);break;case"ArrowRight":this.userAdjustOrbit(Sc,0,0);break;default:t=!1;break}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-1*Ic);break;case"ArrowDown":this.movePan(0,Ic);break;case"ArrowLeft":this.movePan(-1*Ic,0);break;case"ArrowRight":this.movePan(Ic,0);break;default:t=!1;break}return t}}const Bm=`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed"> 4423 <path d="M6.4,19L5,17.6L10.6,12L5,6.4L6.4,5L12,10.6L17.6,5L19,6.4L13.4,12L19,17.6L17.6,19L12,13.4L6.4,19Z"/> 4424</svg>`,Dm=`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed"> 4425 <path d="M7,17V9H5V7H9V17H7ZM11,17V15H13V17H11ZM16,17V9H14V7H18V17H16ZM11,13V11H13V13H11Z"/> 4426</svg>`,Lm=`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#E1E2E8"> 4427 <defs> 4428 <clipPath id="clip0"> 4429 <path d="M0,0h24v24h-24z"/> 4430 </clipPath> 4431 </defs> 4432 <g clip-path="url(#clip0)"> 4433 <path d="M12,22C10.75,22 9.575,21.767 8.475,21.3C7.392,20.817 6.442,20.175 5.625,19.375C4.825,18.558 4.183,17.608 3.7,16.525C3.233,15.425 3,14.25 3,13H5C5,14.95 5.675,16.608 7.025,17.975C8.392,19.325 10.05,20 12,20C13.95,20 15.6,19.325 16.95,17.975C18.317,16.608 19,14.95 19,13C19,11.05 18.317,9.4 16.95,8.05C15.6,6.683 13.95,6 12,6H11.85L13.4,7.55L12,9L8,5L12,1L13.4,2.45L11.85,4H12C13.25,4 14.417,4.242 15.5,4.725C16.6,5.192 17.55,5.833 18.35,6.65C19.167,7.45 19.808,8.4 20.275,9.5C20.758,10.583 21,11.75 21,13C21,14.25 20.758,15.425 20.275,16.525C19.808,17.608 19.167,18.558 18.35,19.375C17.55,20.175 16.6,20.817 15.5,21.3C14.417,21.767 13.25,22 12,22Z"/> 4434 </g> 4435</svg>`,li={width:.16,height:.07,cornerRadius:.03,opacity:1,color:0,minDistance:.5,maxDistance:10,baseScale:1,distanceScaleFactor:.3},La={size:.05,zOffset:.01,spacing:.07},Fa={canvasSize:128,filter:We};class Oi extends mt{constructor(){super(),this.isActualSize=!1,this.preRenderIcons(),this.createPanel(),this.createButtons(),this.opacityDamper=new en,this.goalOpacity=li.opacity}createPanel(){const e=this.createPanelShape(),t=new Mf(e),n=new ln({color:li.color,opacity:li.opacity,transparent:!0});this.panelMesh=new ot(t,n),this.panelMesh.name="MenuPanel",this.add(this.panelMesh)}createButtons(){this.exitButton=this.createButton("close"),this.exitButton.name="ExitButton",this.exitButton.position.set(La.spacing/2,0,La.zOffset),this.add(this.exitButton),this.toggleButton=this.createButton("view-real-size"),this.toggleButton.name="ToggleButton",this.toggleButton.position.set(-.07/2,0,La.zOffset),this.add(this.toggleButton)}createPanelShape(){const e=new O0,{width:t,height:n,cornerRadius:i}=li;return e.moveTo(-t/2+i,-n/2),e.lineTo(t/2-i,-n/2),e.quadraticCurveTo(t/2,-n/2,t/2,-n/2+i),e.lineTo(t/2,n/2-i),e.quadraticCurveTo(t/2,n/2,t/2-i,n/2),e.lineTo(-t/2+i,n/2),e.quadraticCurveTo(-t/2,n/2,-t/2,n/2-i),e.lineTo(-t/2,-n/2+i),e.quadraticCurveTo(-t/2,-n/2,-t/2+i,-n/2),e}preRenderIcons(){[{key:"close",svg:Bm},{key:"view-real-size",svg:Dm},{key:"replay",svg:Lm}].forEach(({key:t,svg:n})=>{Oi.iconTextures.has(t)||this.createTextureFromSvg(n,t)})}createTextureFromSvg(e,t){const n=document.createElement("canvas");n.width=Fa.canvasSize,n.height=Fa.canvasSize;const i=n.getContext("2d"),s=new Image,a=new Blob([e],{type:"image/svg+xml"}),o=URL.createObjectURL(a);s.onload=()=>{i.drawImage(s,0,0,Fa.canvasSize,Fa.canvasSize);const c=new Dd(n);c.needsUpdate=!0,c.minFilter=Fa.filter,Oi.iconTextures.set(t,c),URL.revokeObjectURL(o)},s.src=o}createButton(e){const t=new ln({transparent:!0}),n=new si(La.size,La.size),i=new ot(n,t),s=Oi.iconTextures.get(e);if(s)i.material.map=s,i.material.needsUpdate=!0;else{this.createTextureFromSvg(e==="close"?Bm:e==="view-real-size"?Dm:Lm,e);const a=()=>{const o=Oi.iconTextures.get(e);o?(i.material.map=o,i.material.needsUpdate=!0):setTimeout(a,10)};a()}return i}exitButtonControllerIntersection(e,t){return e.hitFromController(t,this.exitButton)}scaleModeButtonControllerIntersection(e,t){return e.hitFromController(t,this.toggleButton)}handleScaleToggle(e,t,n,i){if(!e)return null;this.isActualSize=!this.isActualSize;const s=this.isActualSize?"replay":"view-real-size";this.updateScaleModeButtonLabel(s);const a=this.isActualSize?1:t;return Math.max(n,Math.min(i,a))}updateScaleModeButtonLabel(e){const t=Oi.iconTextures.get(e);t&&(this.toggleButton.material.map=t,this.toggleButton.material.needsUpdate=!0)}updatePosition(e,t){if(!t)return;const n=new B;t.getWorldPosition(n);const i=t.getSize(),s=Math.min(i.x,i.z),a=-.2,o=.9,c=Math.max(.5,Math.min(2,s/1)),l=a*c,u=o*c,h=new B().copy(e.position).sub(n);h.y=0,h.normalize();const d=new B().copy(n).add(new B(0,l,0)).add(h.multiplyScalar(u));this.position.copy(d);const f=e.position.distanceTo(d),p=Math.max(li.minDistance,Math.min(li.maxDistance,f)),g=li.baseScale+(p-li.minDistance)*li.distanceScaleFactor;this.scale.set(g,g,g),this.lookAt(e.position)}set show(e){this.goalOpacity=e?li.opacity:0}updateOpacity(e){const n=this.panelMesh.material.opacity,i=this.opacityDamper.update(n,this.goalOpacity,e,1);this.traverse(s=>{if(s instanceof ot){const a=s.material;a.transparent&&(a.opacity=i)}}),this.visible=i>0}dispose(){var e;this.children.forEach(t=>{t instanceof ot&&(t.geometry&&t.geometry.dispose(),(Array.isArray(t.material)?t.material:[t.material]).forEach(i=>{i&&("map"in i&&i.map instanceof Dd&&i.map.dispose(),i.dispose())}))}),(e=this.parent)===null||e===void 0||e.remove(this)}}Oi.iconTextures=new Map;const K1=30,Mc=.8,Fm=1.5,J1=20,Z1=.2,eR=.25,tR=10,Cs=150,Pm=5,nR=new B(0,1,0),iR=.3,sR=1.5,rR=15,Nm=.3,uu=.01,aR=.15,oR=70,du=.001,cR=.2,ki={NOT_PRESENTING:"not-presenting",SESSION_STARTED:"session-started",OBJECT_PLACED:"object-placed",FAILED:"failed"},Wd={TRACKING:"tracking",NOT_TRACKING:"not-tracking"},Pa=new B,fu=new xn,lR=new Ue,hR=new B,uR=new tn(45,1,.1,100),Um=new sn().setFromPoints([new B(0,0,0),new B(0,0,-1)]),$t={SCREEN_SPACE:"screen-space",WORLD_SPACE:"world-space"};class dR extends ri{isWorldSpaceReady(){return this.xrMode===$t.WORLD_SPACE&&this.worldSpaceInitialPlacementDone}constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.menuPanel=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.xrMode=null,this.xrController1=null,this.xrController2=null,this.selectedXRController=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new B,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastDragPosition=new B,this.deltaRotation=new xn,this.scaleLine=new Eo(Um),this.firstRatio=0,this.lastAngle=0,this.goalPosition=new B,this.goalYaw=0,this.goalScale=1,this.xDamper=new en,this.yDamper=new en,this.zDamper=new en,this.yawDamper=new en,this.pitchDamper=new en,this.rollDamper=new en,this.scaleDamper=new en,this.wasTwoFingering=!1,this.worldSpaceInitialPlacementDone=!1,this.initialModelScale=1,this.minScale=1,this.maxScale=1,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onControllerSelectStart=t=>{var n,i,s;const a=this.presentedScene,o=t.target,c=this.menuPanel;if(this.menuPanel.exitButtonControllerIntersection(a,o)!=null){(n=this.menuPanel)===null||n===void 0||n.dispose(),this.stopPresenting();return}if(this.menuPanel.scaleModeButtonControllerIntersection(a,o)!=null){const d=this.menuPanel.handleScaleToggle(this.worldSpaceInitialPlacementDone,this.initialModelScale,this.minScale,this.maxScale);d!==null&&(this.goalScale=d);return}c&&(c.show=!1);const h=this.placementBox.controllerIntersection(a,o);if(h!=null){const f=new cn().setFromObject(a.pivot).min.y+cR;if(h.point.y<=f)this.selectedXRController!=null?(this.selectedXRController.userData.line.visible=!1,a.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/a.pivot.scale.x,this.scaleLine.visible=!0)):o.attach(a.pivot),this.selectedXRController=o,a.setShadowIntensity(.01);else if(o==this.xrController1?this.xrController1.userData.isSelected=!0:o==this.xrController2&&(this.xrController2.userData.isSelected=!0),!((i=this.xrController1)===null||i===void 0)&&i.userData.isSelected&&(!((s=this.xrController2)===null||s===void 0)&&s.userData.isSelected))a.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/a.pivot.scale.x,this.scaleLine.visible=!0);else{const g=o===this.xrController1?this.xrController2:this.xrController1;o.userData.initialX=o.position.x,g.userData.turning=!1,o.userData.turning=!0,o.userData.line.visible=!1}}},this.onControllerSelectEnd=t=>{const n=t.target;if(n.userData.turning=!1,n.userData.line.visible=!0,this.isTwoHandInteraction=!1,this.scaleLine.visible=!1,n==this.xrController1?this.xrController1.userData.isSelected=!1:n==this.xrController2&&(this.xrController2.userData.isSelected=!1),this.selectedXRController!=null&&this.selectedXRController!=n)return;const i=this.presentedScene;i.attach(i.pivot),this.selectedXRController=null,this.goalYaw=Math.atan2(i.pivot.matrix.elements[8],i.pivot.matrix.elements[10]),this.goalPosition.x=i.pivot.position.x,this.goalPosition.z=i.pivot.position.z,this.isWorldSpaceReady()&&(this.goalPosition.y=i.pivot.position.y);const s=this.menuPanel;s.show=!0},this.onUpdateScene=()=>{this.placementBox!=null&&this.isPresenting&&(this.placementBox.updateFromModelChanges(),this.placementBox.setScreenSpaceMode(this.xrMode===$t.SCREEN_SPACE)),this.xrMode!==$t.SCREEN_SPACE&&(this.menuPanel&&(this.menuPanel.dispose(),this.menuPanel=null),this.menuPanel=new Oi,this.presentedScene.add(this.menuPanel),this.menuPanel.updatePosition(this.presentedScene.getCamera(),this.placementBox))},this.onSelectStart=t=>{const n=this.transientHitTestSource;if(n==null)return;const i=this.frame.getHitTestResultsForTransientInput(n),s=this.presentedScene,a=this.placementBox;if(i.length===1){this.inputSource=t.inputSource;const{axes:o}=this.inputSource.gamepad,c=a.getHit(this.presentedScene,o[0],o[1]);a.show=!0,c!=null?(this.isTranslating=!0,this.lastDragPosition.copy(c)):this.placeOnWall===!1&&(this.isRotating=!0,this.lastAngle=o[0]*Fm)}else if(i.length===2){a.show=!0,this.isTwoHandInteraction=!0;const{separation:o,angle:c}=this.fingerPolar(i);this.lastAngle=c,this.firstRatio===0&&(this.firstRatio=o/s.pivot.scale.x),s.canScale&&this.setScale(o);return}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){IA();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:[],optionalFeatures:["hit-test","dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return IA(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return console.warn("Request to present in WebXR denied:"),console.warn(e),console.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&console.warn("Cannot present while a model is already presenting");let n=new Promise((l,u)=>{requestAnimationFrame(()=>l())});e.setHotspotsVisibility(!1),e.queueRender(),await n,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),t===!0&&(this.xrLight=new d1(this.threeRenderer),this.xrLight.addEventListener("estimationstart",()=>{if(!this.isPresenting||this.xrLight==null)return;const l=this.presentedScene;l.add(this.xrLight),l.environment=this.xrLight.environment}));const i=await this.resolveARSession();i.addEventListener("end",()=>{this.postSessionCleanup()},{once:!0});const s=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");s.classList.add("enabled"),s.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=s;const a=await i.requestReferenceSpace("viewer");this.xrMode=i.interactionMode,this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);const o=J1*Math.PI/180,c=this.placeOnWall===!0?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(o),z:-Math.cos(o)});i.requestHitTestSource({space:a,offsetRay:c}).then(l=>{this.initialHitSource=l}),this.xrMode!==$t.SCREEN_SPACE&&(this.setupXRControllers(),this.xDamper.setDecayTime(Cs),this.yDamper.setDecayTime(Cs),this.zDamper.setDecayTime(Cs),this.yawDamper.setDecayTime(Cs),this.pitchDamper.setDecayTime(Cs),this.rollDamper.setDecayTime(Cs),this.scaleDamper.setDecayTime(Cs)),this.currentSession=i,this.placementBox=new p1(e,this.placeOnWall?"back":"bottom"),this.placementBox&&this.placementBox.setScreenSpaceMode(this.xrMode===$t.SCREEN_SPACE),this.placementComplete=!1,this.xrMode!==$t.SCREEN_SPACE&&(this.menuPanel=new Oi,e.add(this.menuPanel),this.menuPanel.updatePosition(e.getCamera(),this.placementBox)),this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:ki.SESSION_STARTED})}setupXRControllerLine(e){if(!e.userData.line){const t=new Eo(Um);t.name="line",t.scale.z=Pm,e.userData.turning=!1,e.userData.line=t,e.add(t)}}setupController(e){this.setupXRControllerLine(e),e.addEventListener("selectstart",this.onControllerSelectStart),e.addEventListener("selectend",this.onControllerSelectEnd)}setupXRControllers(){this.xrController1=this.threeRenderer.xr.getController(0),this.xrController2=this.threeRenderer.xr.getController(1),this.setupController(this.xrController1),this.setupController(this.xrController2),this.scaleLine.name="scale line",this.scaleLine.visible=!1,this.xrController1.add(this.scaleLine);const e=this.presentedScene;e.add(this.xrController1),e.add(this.xrController2)}hover(e){if(this.xrMode===$t.SCREEN_SPACE||this.selectedXRController==e)return!1;const t=this.presentedScene,n=this.placementBox.controllerIntersection(t,e);return e.userData.line.scale.z=n==null?Pm:n.distance,n!=null}controllerSeparation(){return this.xrController1.position.distanceTo(this.xrController2.position)}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise(t=>{this.resolveCleanup=t});try{await this.currentSession.end(),await e}catch(t){console.warn("Error while trying to end WebXR AR session"),console.warn(t),this.postSessionCleanup()}}get isPresenting(){return this.presentedScene!=null}get target(){return this.oldTarget}updateTarget(){const e=this.presentedScene;if(e!=null){const t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}cleanupXRController(e){e.userData.turning=!1,e.userData.line.visible=!0,e.removeEventListener("selectstart",this.onControllerSelectStart),e.removeEventListener("selectend",this.onControllerSelectEnd),e.removeFromParent()}postSessionCleanup(){const e=this.currentSession;e!=null&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const t=this.presentedScene;if(this._presentedScene=null,t!=null){const{element:a}=t;this.xrLight!=null&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),this.menuPanel!=null&&(this.menuPanel.dispose(),this.menuPanel=null),t.add(t.pivot),t.pivot.quaternion.set(0,0,0,1),t.pivot.position.set(0,0,0),t.pivot.scale.set(1,1,1),t.setShadowOffset(0);const o=this.turntableRotation;o!=null&&(t.yaw=o);const c=this.oldShadowIntensity;c!=null&&t.setShadowIntensity(c),t.setEnvironmentAndSkybox(a[ja],a[Ka]);const l=this.oldTarget;t.setTarget(l.x,l.y,l.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0);const{width:u,height:h}=a.getBoundingClientRect();t.setSize(u,h),requestAnimationFrame(()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:Ft.NONE}}))})}this.renderer.height=0;const n=this.exitWebXRButtonContainer;n!=null&&(n.classList.remove("enabled"),n.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const i=this.transientHitTestSource;i!=null&&(i.cancel(),this.transientHitTestSource=null);const s=this.initialHitSource;s!=null&&(s.cancel(),this.initialHitSource=null),this.placementBox!=null&&(this.placementBox.dispose(),this.placementBox=null),this.xrMode!==$t.SCREEN_SPACE&&(this.xrController1!=null&&(this.cleanupXRController(this.xrController1),this.xrController1=null),this.xrController2!=null&&(this.cleanupXRController(this.xrController2),this.xrController2=null),this.selectedXRController=null,this.scaleLine.visible=!1),this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,this.worldSpaceInitialPlacementDone=!1,this.resolveCleanup!=null&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:ki.NOT_PRESENTING})}updateView(e){const t=this.presentedScene,n=this.threeRenderer.xr;n.updateCamera(uR),t.xrCamera=n.getCamera();const{elements:i}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(i[1],i[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const a=e.recommendedViewportScale;e.requestViewportScale(Math.max(a,eR))}const s=n.getBaseLayer();if(s!=null){const a=s instanceof XRWebGLLayer?s.getViewport(e):n.getBinding().getViewSubImage(s,e).viewport;this.threeRenderer.setViewport(a.x,a.y,a.width,a.height)}}placeInitially(){const e=this.presentedScene,{pivot:t,element:n}=e,{position:i}=t,s=e.getCamera(),{width:a,height:o}=this.overlay.getBoundingClientRect();e.setSize(a,o),s.projectionMatrixInverse.copy(s.projectionMatrix).invert();const{theta:c}=n.getCameraOrbit(),l=s.getWorldDirection(Pa);if(e.yaw=Math.atan2(-l.x,-l.z)-c,this.goalYaw=e.yaw,this.xrMode===$t.WORLD_SPACE&&!this.worldSpaceInitialPlacementDone){const{position:u,scale:h}=this.calculateWorldSpaceOptimalPlacement(e,s);this.goalPosition.copy(u),this.goalScale=h,this.initialModelScale=h,i.copy(u),t.scale.set(h,h,h),this.worldSpaceInitialPlacementDone=!0,this.calculateWorldSpaceScaleLimits(e),this.enableWorldSpaceUserInteraction()}else if(this.xrMode===$t.SCREEN_SPACE){const u=Math.max(1,2*e.boundingSphere.radius);i.copy(s.position).add(l.multiplyScalar(u)),this.updateTarget();const h=e.getTarget();i.add(h).sub(this.oldTarget),this.goalPosition.copy(i)}if(e.setHotspotsVisibility(!0),this.xrMode===$t.SCREEN_SPACE){const{session:u}=this.frame;u.addEventListener("selectstart",this.onSelectStart),u.addEventListener("selectend",this.onSelectEnd),u.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then(h=>{this.transientHitTestSource=h})}}getTouchLocation(){const{axes:e}=this.inputSource.gamepad;let t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return t!=null&&(Pa.copy(t).sub(this.presentedScene.getCamera().position),Pa.length()>tR)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),n=e.getPose(t);if(n==null)return null;const i=lR.fromArray(n.transform.matrix);return this.placeOnWall===!0&&(this.goalYaw=Math.atan2(i.elements[4],i.elements[6])),i.elements[5]>.75!==this.placeOnWall?hR.setFromMatrixPosition(i):null}moveToFloor(e){if(this.xrMode===$t.WORLD_SPACE&&!this.worldSpaceInitialPlacementDone){this.placementBox.show=!1,this.dispatchEvent({type:"status",status:ki.OBJECT_PLACED});return}const t=this.initialHitSource;if(t==null)return;const n=e.getHitTestResults(t);if(n.length==0)return;const i=n[0],s=this.getHitPoint(i);s!=null&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(s):this.goalPosition.y=s.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:ki.OBJECT_PLACED}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,n=e[1].inputSource.gamepad.axes,i=n[0]-t[0],s=n[1]-t[1],a=Math.atan2(s,i);let o=this.lastAngle-a;return o>Math.PI?o-=2*Math.PI:o<-Math.PI&&(o+=2*Math.PI),{separation:Math.sqrt(i*i+s*s),deltaYaw:o,angle:a}}setScale(e){let t=e/this.firstRatio;t=Math.abs(t-1)<Z1?1:t,this.isWorldSpaceReady()&&(t=Math.max(this.minScale,Math.min(this.maxScale,t))),this.goalScale=t}processInput(e){const t=this.transientHitTestSource;if(t==null)return;const n=e.getHitTestResultsForTransientInput(t),i=this.presentedScene,s=i.pivot.scale.x;if(n.length===2){if(!this.wasTwoFingering){const{separation:l,angle:u}=this.fingerPolar(n);this.firstRatio=l/s,this.lastAngle=u,this.wasTwoFingering=!0,this.isTwoHandInteraction=!0;return}const{separation:a,deltaYaw:o,angle:c}=this.fingerPolar(n);this.goalYaw+=o,this.lastAngle=c,i.canScale&&this.setScale(a),this.isTwoHandInteraction=!0;return}else this.wasTwoFingering&&(this.wasTwoFingering=!1,this.isTwoHandInteraction=!1,this.firstRatio=0);if(!(!this.isTranslating&&!this.isTwoHandInteraction&&!this.isRotating))if(this.isRotating){const a=this.inputSource.gamepad.axes[0]*Fm;this.goalYaw+=a-this.lastAngle,this.lastAngle=a}else this.isTranslating&&n.forEach(a=>{if(a.inputSource!==this.inputSource)return;let o=null;if(a.results.length>0&&(o=this.getHitPoint(a.results[0])),o==null&&(o=this.getTouchLocation()),o!=null){if(this.goalPosition.sub(this.lastDragPosition),this.isWorldSpaceReady())console.log("[processInput] Setting goalPosition.y to hit.y:",o.y),this.goalPosition.add(o);else if(this.placeOnWall===!1){const c=o.y-this.lastDragPosition.y;if(c<0){this.placementBox.offsetHeight=c/s,this.presentedScene.setShadowOffset(c);const l=Pa.copy(i.getCamera().position),u=-c/(l.y-o.y);l.multiplyScalar(u),o.multiplyScalar(1-u).add(l)}this.goalPosition.add(o)}else this.goalPosition.add(o);this.lastDragPosition.copy(o)}})}applyXRControllerRotation(e,t){if(!e.userData.turning)return;const n=(e.position.x-e.userData.initialX)*iR;this.deltaRotation.setFromAxisAngle(nR,n),t.quaternion.multiplyQuaternions(this.deltaRotation,t.quaternion)}handleScalingInXR(e,t){if(this.xrMode===$t.WORLD_SPACE&&!this.worldSpaceInitialPlacementDone)return;if(this.xrController1&&this.xrController2&&this.isTwoHandInteraction){const i=this.controllerSeparation();this.setScale(i),this.scaleLine.scale.z=-i,this.scaleLine.lookAt(this.xrController2.position)}const n=e.pivot.scale.x;if(this.goalScale!==n){const i=this.scaleDamper.update(n,this.goalScale,t,1);e.pivot.scale.set(i,i,i)}}updatePivotPosition(e,t){const{pivot:n}=e,i=this.placementBox,s=e.boundingSphere.radius,a=this.goalPosition,o=n.position;let c=Ft.NONE;if(!a.equals(o)){c=Ft.USER_INTERACTION;let{x:l,y:u,z:h}=o;if(l=this.xDamper.update(l,a.x,t,s),u=this.yDamper.update(u,a.y,t,s),h=this.zDamper.update(h,a.z,t,s),o.set(l,u,h),this.xrMode===$t.SCREEN_SPACE&&!this.isTranslating){const d=a.y-u;this.placementComplete&&this.placeOnWall===!1?(i.offsetHeight=d/e.pivot.scale.x,e.setShadowOffset(d)):d===0&&(this.placementComplete=!0,i.show=!1,e.setShadowIntensity(Mc))}this.xrMode!==$t.SCREEN_SPACE&&a.equals(o)&&e.setShadowIntensity(Mc),this.isWorldSpaceReady()&&e.setShadowIntensity(Mc)}if(this.xrMode===$t.WORLD_SPACE&&!this.worldSpaceInitialPlacementDone&&this.goalScale!==n.scale.x){const l=this.scaleDamper.update(n.scale.x,this.goalScale,t,1);n.scale.set(l,l,l)}return e.updateTarget(t),c}updateYaw(e,t){fu.setFromAxisAngle(Pa.set(0,1,0),this.goalYaw);const n=e.pivot.quaternion.angleTo(fu),i=n-this.yawDamper.update(n,0,t,Math.PI);e.pivot.quaternion.rotateTowards(fu,i)}updateMenuPanel(e,t,n){this.menuPanel&&(this.menuPanel.updateOpacity(n),this.menuPanel.updatePosition(e.getCamera(),t))}applyXRInputToScene(e){const t=this.presentedScene,n=t.pivot,i=this.placementBox;if(this.updatePlacementBoxOpacity(i,e),this.updateTwoHandInteractionState(),this.applyXRControllerRotations(n),this.handleScalingInXR(t,e),n.parent!==t){this.updateMenuPanel(t,i,e);return}const s=this.updatePivotPosition(t,e);this.updateYaw(t,e),this.dispatchCameraChangeEvent(t,s),this.updateMenuPanel(t,i,e)}updatePlacementBoxOpacity(e,t){const n=this.presentedScene.getCamera();e.update(t,n.position);const i=this.hover(this.xrController1),s=this.hover(this.xrController2),a=(i||s)&&!this.isTwoHandInteraction;e.setInteractionState(this.isTranslating||this.isRotating,a)}updateTwoHandInteractionState(){var e,t;const n=((e=this.xrController1)===null||e===void 0?void 0:e.userData.isSelected)&&((t=this.xrController2)===null||t===void 0?void 0:t.userData.isSelected);this.isTwoHandInteraction=!!n}applyXRControllerRotations(e){this.isTwoHandInteraction||(this.xrController1&&this.applyXRControllerRotation(this.xrController1,e),this.xrController2&&this.applyXRControllerRotation(this.xrController2,e))}dispatchCameraChangeEvent(e,t){e.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:t}}))}updateXRControllerHover(){const e=this.hover(this.xrController1),t=this.hover(this.xrController2),n=(e||t)&&!this.isTwoHandInteraction;this.placementBox&&(this.placementBox.setInteractionState(this.isTranslating||this.isRotating,n),this.placementBox.show=n)}enableWorldSpaceUserInteraction(){this.placementBox&&(this.placementBox.show=!0),this.presentedScene&&this.presentedScene.setShadowIntensity(Mc)}handleFirstView(e,t){(this.xrMode!==$t.WORLD_SPACE||!this.worldSpaceInitialPlacementDone)&&this.moveToFloor(e),this.processInput(e);const n=t-this.lastTick;this.applyXRInputToScene(n),this.renderer.preRender(this.presentedScene,t,n),this.lastTick=t,this.presentedScene.renderShadow(this.threeRenderer)}onWebXRFrame(e,t){this.xrMode!==$t.SCREEN_SPACE&&this.updateXRControllerHover(),this.frame=t,++this.frames;const n=this.threeRenderer.xr.getReferenceSpace(),i=t.getViewerPose(n);i==null&&this.tracking===!0&&this.frames>K1&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:Wd.NOT_TRACKING}));const s=this.presentedScene;if(i==null||s==null||!s.element.loaded){this.threeRenderer.clear();return}this.tracking===!1&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:Wd.TRACKING}));let a=!0;for(const o of i.views)this.updateView(o),a&&(this.handleFirstView(t,e),a=!1),this.threeRenderer.render(s,s.getCamera())}calculateWorldSpaceOptimalPlacement(e,t){const n=e.boundingBox,i={x:(n.max.x-n.min.x)/2,y:(n.max.y-n.min.y)/2,z:(n.max.z-n.min.z)/2},s=aR,a=Math.max(sR+s,2*Math.max(i.x,i.z)+s),o=rR*Math.PI/180,c=new B(0,-a*Math.sin(o),-a*Math.cos(o)),l=t.matrixWorld,u=c.clone().applyMatrix4(l),h=Math.max(i.x,i.z)+s,d=i.y,f=a*Nm,g=a*Nm/Math.max(d,uu),m=f/Math.max(h,uu),A=Math.min(g,m);return{position:u.clone().sub(new B(0,A*i.y,0)),scale:A}}calculateWorldSpaceScaleLimits(e){const t=e.size,n=Math.max(t.x,t.y,t.z),i=Math.max(Math.min(t.x,t.y,t.z),du),s=uu/Math.max(n,du),a=oR/Math.max(i,du);this.minScale=Math.min(s,a,this.goalScale),this.maxScale=Math.max(s,a,this.goalScale)}}function fR(r){const e=new Map,t=new Map,n=r.clone();return mb(r,n,function(i,s){e.set(s,i),t.set(i,s)}),n.traverse(function(i){if(!i.isSkinnedMesh)return;const s=i,a=e.get(i),o=a.skeleton.bones;s.skeleton=a.skeleton.clone(),s.bindMatrix.copy(a.bindMatrix),s.skeleton.bones=o.map(function(c){return t.get(c)}),s.bind(s.skeleton,s.bindMatrix)}),n}function mb(r,e,t){t(r,e);for(let n=0;n<r.children.length;n++)mb(r.children[n],e.children[n],t)}const Om=Symbol("prepared"),Sl=Symbol("prepare"),hi=Symbol("preparedGLTF"),Cl=Symbol("clone");class pR{static prepare(e){if(e.scene==null)throw new Error("Model does not have a scene");if(e[Om])return e;const t=this[Sl](e);return t[Om]=!0,t}static[Sl](e){const{scene:t}=e,n=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:n})}get parser(){return this[hi].parser}get animations(){return this[hi].animations}get scene(){return this[hi].scene}get scenes(){return this[hi].scenes}get cameras(){return this[hi].cameras}get asset(){return this[hi].asset}get userData(){return this[hi].userData}constructor(e){this[hi]=e}clone(){const e=this.constructor,t=this[Cl]();return new e(t)}dispose(){this.scenes.forEach(e=>{e.traverse(t=>{const n=t;if(!n.material)return;(Array.isArray(n.material)?n.material:[n.material]).forEach(s=>{for(const a in s){const o=s[a];if(o instanceof Rt){const c=o.source.data;c.close!=null&&c.close(),o.dispose()}}s.dispose()}),n.geometry.dispose()})})}[Cl](){const e=this[hi],t=fR(this.scene);AR(t,this.scene);const n=[t],i=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:n,userData:i})}}const AR=(r,e)=>{gb(r,e,(t,n)=>{n.userData.variantMaterials!==void 0&&(t.userData.variantMaterials=new Map(n.userData.variantMaterials)),n.userData.variantData!==void 0&&(t.userData.variantData=n.userData.variantData),n.userData.originalMaterial!==void 0&&(t.userData.originalMaterial=n.userData.originalMaterial)})},gb=(r,e,t)=>{t(r,e);for(let n=0;n<r.children.length;n++)gb(r.children[n],e.children[n],t)},km=Symbol("threeGLTF"),Qm=Symbol("gltf"),Gm=Symbol("gltfElementMap"),Hm=Symbol("threeObjectMap"),zm=Symbol("parallelTraverseThreeScene"),Vm=Symbol("correlateOriginalThreeGLTF"),Wm=Symbol("correlateCloneThreeGLTF");class Ro{static from(e,t){return t!=null?this[Wm](e,t):this[Vm](e)}static[Vm](e){const t=e.parser.json,n=e.parser.associations,i=new Map,s={name:"Default"},a={index:-1};for(const o of n.keys())o instanceof ei&&n.get(o)==null&&(a.index<0&&(t.materials==null&&(t.materials=[]),a.index=t.materials.length,t.materials.push(s)),o.name=s.name,n.set(o,{materials:a.index}));for(const[o,c]of n){c&&(o.userData=o.userData||{},o.userData.associations=c);for(const l in c)if(l!=null&&l!=="primitives"){const u=l,d=(t[u]||[])[c[u]];if(d==null)continue;let f=i.get(d);f==null&&(f=new Set,i.set(d,f)),f.add(o)}}return new Ro(e,t,n,i)}static[Wm](e,t){const n=t.threeGLTF,i=t.gltf,s=JSON.parse(JSON.stringify(i)),a=new Map,o=new Map;for(let c=0;c<n.scenes.length;c++)this[zm](n.scenes[c],e.scenes[c],(l,u)=>{const h=t.threeObjectMap.get(l);if(h!=null){for(const d in h)if(d!=null&&d!=="primitives"){const f=d,p=h[f],g=s[f][p],m=a.get(u)||{};m[f]=p,a.set(u,m);const A=o.get(g)||new Set;A.add(u),o.set(g,A)}}});return new Ro(e,s,a,o)}static[zm](e,t,n){const i=(s,a)=>{if(n(s,a),s.isObject3D){const o=s,c=a;if(o.material)if(Array.isArray(o.material))for(let l=0;l<o.material.length;++l)n(o.material[l],c.material[l]);else n(o.material,c.material);for(let l=0;l<s.children.length;++l)i(s.children[l],a.children[l])}};i(e,t)}get threeGLTF(){return this[km]}get gltf(){return this[Qm]}get gltfElementMap(){return this[Gm]}get threeObjectMap(){return this[Hm]}constructor(e,t,n,i){this[km]=e,this[Qm]=t,this[Gm]=i,this[Hm]=n}}const Na=Symbol("correlatedSceneGraph");class mR extends pR{static[Sl](e){const t=super[Sl](e);t[Na]==null&&(t[Na]=Ro.from(t));const{scene:n}=t,i=new Wn(void 0,1/0);return n.traverse(s=>{s.renderOrder=1e3,s.frustumCulled=!1,s.name||(s.name=s.uuid);const a=s;if(a.material){const{geometry:o}=a;a.castShadow=!0,a.isSkinnedMesh&&(o.boundingSphere=i,o.boundingBox=null);const c=a.material;if(c.isMeshBasicMaterial===!0&&(c.toneMapped=!1),c.shadowSide=ti,c.aoMap){const{gltf:l,threeObjectMap:u}=t[Na],h=u.get(c);if(l.materials!=null&&h!=null&&h.materials!=null){const d=l.materials[h.materials];d.occlusionTexture&&d.occlusionTexture.texCoord===0&&o.attributes.uv!=null&&o.setAttribute("uv2",o.attributes.uv)}}}}),t}get correlatedSceneGraph(){return this[hi][Na]}[Cl](){const e=super[Cl](),t=new Map;return e.scene.traverse(n=>{const i=n;if(i.material){const a=i.material;if(a!=null){if(t.has(a.uuid)){i.material=t.get(a.uuid);return}i.material=a.clone(),t.set(a.uuid,i.material)}}const s=n;s.target!==void 0&&s.add(s.target)}),e[Na]=Ro.from(e,this.correlatedSceneGraph),e}}const xb=(r,e,t)=>{let n;switch(r){case Le:n=new Uint8ClampedArray(e*t*4);break;case It:n=new Uint16Array(e*t*4);break;case ii:n=new Uint32Array(e*t*4);break;case uf:n=new Int8Array(e*t*4);break;case df:n=new Int16Array(e*t*4);break;case Fl:n=new Int32Array(e*t*4);break;case Nt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let wc;const gR=(r,e,t,n)=>{if(wc!==void 0)return wc;const i=new bn(1,1,n);e.setRenderTarget(i);const s=new ot(new si,new ln({color:16777215}));e.render(s,t),e.setRenderTarget(null);const a=xb(r,i.width,i.height);return e.readRenderTargetPixels(i,0,0,i.width,i.height,a),i.dispose(),s.geometry.dispose(),s.material.dispose(),wc=a[0]!==0,wc};class Nf{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Tt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:We,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:We,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:Lt,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:Lt};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=Nf.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new qs,this._camera=new Js,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!gR(this._type,this._renderer,this._camera,t)){let n;this._type===It&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?Nt:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${Nt}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new ot(new si,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new bn(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:$r}static instantiateRenderer(){const e=new nx;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=xb(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new ha(this.toArray(),this.width,this.height,Tt,this._type,e?.mapping||$r,e?.wrapS||Lt,e?.wrapT||Lt,e?.magFilter||We,e?.minFilter||We,e?.anisotropy||1,St);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof _n&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof Rt&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof Rt&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class bb extends Error{}class _b extends Error{}const Ua=(r,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(r);if(n)return n[1];const i=new RegExp(`<${e}[^>]*>([\\s\\S]*?)</${e}>`,"i").exec(r);if(i){const s=i[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return s&&s.length===3?s.map(a=>a.replace(/<\/?rdf:li>/g,"")):i[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},xR=r=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(r):e=r.toString();let t=e.indexOf("<x:xmpmeta");for(;t!==-1;){const n=e.indexOf("x:xmpmeta>",t),i=e.slice(t,n+10);try{const s=Ua(i,"hdrgm:GainMapMin","0"),a=Ua(i,"hdrgm:GainMapMax"),o=Ua(i,"hdrgm:Gamma","1"),c=Ua(i,"hdrgm:OffsetSDR","0.015625"),l=Ua(i,"hdrgm:OffsetHDR","0.015625"),u=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(i),h=u?u[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(i);if(!d)throw new Error("Incomplete gainmap metadata");const f=d[1];return{gainMapMin:Array.isArray(s)?s.map(p=>parseFloat(p)):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(a)?a.map(p=>parseFloat(p)):[parseFloat(a),parseFloat(a),parseFloat(a)],gamma:Array.isArray(o)?o.map(p=>parseFloat(p)):[parseFloat(o),parseFloat(o),parseFloat(o)],offsetSdr:Array.isArray(c)?c.map(p=>parseFloat(p)):[parseFloat(c),parseFloat(c),parseFloat(c)],offsetHdr:Array.isArray(l)?l.map(p=>parseFloat(p)):[parseFloat(l),parseFloat(l),parseFloat(l)],hdrCapacityMin:parseFloat(h),hdrCapacityMax:parseFloat(f)}}catch{}t=e.indexOf("<x:xmpmeta",n)}};class bR{options;constructor(e){this.options={debug:e&&e.debug!==void 0?e.debug:!1,extractFII:e&&e.extractFII!==void 0?e.extractFII:!0,extractNonFII:e&&e.extractNonFII!==void 0?e.extractNonFII:!0}}extract(e){return new Promise((t,n)=>{const i=this.options.debug,s=new DataView(e.buffer);if(s.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const a=s.byteLength;let o=2,c=0,l;for(;o<a;){if(++c>250){n(new Error(`Found no marker after ${c} loops 😵`));return}if(s.getUint8(o)!==255){n(new Error(`Not a valid marker at offset 0x${o.toString(16)}, found: 0x${s.getUint8(o).toString(16)}`));return}if(l=s.getUint8(o+1),i&&console.log(`Marker: ${l.toString(16)}`),l===226){i&&console.log("Found APP2 marker (0xffe2)");const u=o+4;if(s.getUint32(u)===1297106432){const h=u+4;let d;if(s.getUint16(h)===18761)d=!1;else if(s.getUint16(h)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(s.getUint16(h+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const f=s.getUint32(h+4,!d);if(f<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const p=h+f,g=s.getUint16(p,!d),m=p+2;let A=0;for(let v=m;v<m+12*g;v+=12)s.getUint16(v,!d)===45057&&(A=s.getUint32(v+8,!d));const _=p+2+g*12+4,b=[];for(let v=_;v<_+A*16;v+=16){const C={MPType:s.getUint32(v,!d),size:s.getUint32(v+4,!d),dataOffset:s.getUint32(v+8,!d),dependantImages:s.getUint32(v+12,!d),start:-1,end:-1,isFII:!1};C.dataOffset?(C.start=h+C.dataOffset,C.isFII=!1):(C.start=0,C.isFII=!0),C.end=C.start+C.size,b.push(C)}if(this.options.extractNonFII&&b.length){const v=new Blob([s]),C=[];for(const M of b){if(M.isFII&&!this.options.extractFII)continue;const w=v.slice(M.start,M.end+1,"image/jpeg");C.push(w)}t(C)}}}o+=2+s.getUint16(o+2)}})}}const _R=async r=>{const e=xR(r);if(!e)throw new _b("Gain map XMP metadata not found");const n=await new bR({extractFII:!0,extractNonFII:!0}).extract(r);if(n.length!==2)throw new bb("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},qm=r=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=i=>{t(i)},n.src=URL.createObjectURL(r)});class vR extends vi{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new X0}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new Rt,sdr:new Rt});return this._config.createQuadRenderer({width:16,height:16,type:It,colorSpace:St,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const i=t?new Blob([t],{type:"image/jpeg"}):void 0,s=new Blob([e],{type:"image/jpeg"});let a,o,c=!1;if(typeof createImageBitmap>"u"){const l=await Promise.all([i?qm(i):Promise.resolve(void 0),qm(s)]);o=l[0],a=l[1],c=n==="flipY"}else{const l=await Promise.all([i?createImageBitmap(i,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(s,{imageOrientation:n||"flipY"})]);o=l[0],a=l[1]}return{sdrImage:a,gainMapImage:o,needsFlip:c}}createTextures(e,t,n){const i=new Rt(t||new ImageData(2,2),$r,Lt,Lt,We,np,Tt,Le,1,St);i.flipY=n,i.needsUpdate=!0;const s=new Rt(e,$r,Lt,Lt,We,np,Tt,Le,1,bt);return s.flipY=n,s.needsUpdate=!0,{gainMap:i,sdr:s}}updateQuadRenderer(e,t,n,i,s){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=i,e.material.gainMapMin=s.gainMapMin,e.material.gainMapMax=s.gainMapMax,e.material.offsetHdr=s.offsetHdr,e.material.offsetSdr=s.offsetSdr,e.material.gamma=s.gamma,e.material.hdrCapacityMin=s.hdrCapacityMin,e.material.hdrCapacityMax=s.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,s.hdrCapacityMax),e.material.needsUpdate=!0}}const ER=` 4436varying vec2 vUv; 4437 4438void main() { 4439 vUv = uv; 4440 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0
4440); 4441} 4442`,yR=` 4443// min half float value 4444#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) 4445// max half float value 4446#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) 4447 4448uniform sampler2D sdr; 4449uniform sampler2D gainMap; 4450uniform vec3 gamma; 4451uniform vec3 offsetHdr; 4452uniform vec3 offsetSdr; 4453uniform vec3 gainMapMin; 4454uniform vec3 gainMapMax; 4455uniform float weightFactor; 4456 4457varying vec2 vUv; 4458 4459void main() { 4460 vec3 rgb = texture2D( sdr, vUv ).rgb; 4461 vec3 recovery = texture2D( gainMap, vUv ).rgb; 4462 vec3 logRecovery = pow( recovery, gamma ); 4463 vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; 4464 vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; 4465 vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); 4466 gl_FragColor = vec4( clampedHdrColor , 1.0 ); 4467} 4468`;class SR extends _n{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:i,gainMapMax:s,maxDisplayBoost:a,hdrCapacityMin:o,hdrCapacityMax:c,sdr:l,gainMap:u}){super({name:"GainMapDecoderMaterial",vertexShader:ER,fragmentShader:yR,uniforms:{sdr:{value:l},gainMap:{value:u},gamma:{value:new B(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new B().fromArray(t)},offsetSdr:{value:new B().fromArray(n)},gainMapMin:{value:new B().fromArray(i)},gainMapMax:{value:new B().fromArray(s)},weightFactor:{value:(Math.log2(a)-o)/(c-o)}},blending:Zn,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=a,this._hdrCapacityMin=o,this._hdrCapacityMax=c,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class CR extends vR{constructor(e,t){super({renderer:e,createMaterial:n=>new SR(n),createQuadRenderer:n=>new Nf(n)},t)}async render(e,t,n,i){const{sdrImage:s,gainMapImage:a,needsFlip:o}=await this.processImages(n,i,"flipY"),{gainMap:c,sdr:l}=this.createTextures(s,a,o);this.updateQuadRenderer(e,s,c,l,t),e.render()}}class IR extends CR{load(e,t,n,i){const s=this.prepareQuadRenderer(),a=new zi(this._internalLoadingManager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(this.withCredentials),this.manager.itemStart(e),a.load(e,async o=>{if(typeof o=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const c=new Uint8Array(o);let l,u,h;try{const d=await _R(c);l=d.sdr,u=d.gainMap,h=d.metadata}catch(d){if(d instanceof _b||d instanceof bb)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),h={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},l=c;else throw d}try{await this.render(s,h,l.buffer,u?.buffer)}catch(d){this.manager.itemError(e),typeof i=="function"&&i(d),s.disposeOnDemandRenderer();return}typeof t=="function"&&t(s),this.manager.itemEnd(e),s.disposeOnDemandRenderer()},n,o=>{this.manager.itemError(e),typeof i=="function"&&i(o)}),s}}class MR extends kE{constructor(e){super(e),this.type=It}parse(e){const a=function(w,E){switch(w){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(E||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(E||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(E||""));default:case 4:throw new Error("THREE.HDRLoader: Memory Error: "+(E||""))}},h=function(w,E,S){E=E||1024;let N=w.pos,F=-1,P=0,Q="",U=String.fromCharCode.apply(null,new Uint16Array(w.subarray(N,N+128)));for(;0>(F=U.indexOf(` 4469`))&&P<E&&N<w.byteLength;)Q+=U,P+=U.length,N+=128,U+=String.fromCharCode.apply(null,new Uint16Array(w.subarray(N,N+128)));return-1<F?(w.pos+=P+F+1,Q+U.slice(0,F)):!1},d=function(w){const E=/^#\?(\S+)/,S=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,R=/^\s*EXPOSURE\s*=\s
vendor: 2,523 bytes, lines 4469-4472
4469*(\d+(\.\d+)?)\s*$/,N=/^\s*FORMAT=(\S+)\s*$/,F=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,P={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let Q,U;for((w.pos>=w.byteLength||!(Q=h(w)))&&a(1,"no header found"),(U=Q.match(E))||a(3,"bad initial token"),P.valid|=1,P.programtype=U[1],P.string+=Q+` 4470`;Q=h(w),Q!==!1;){if(P.string+=Q+` 4471`,Q.charAt(0)==="#"){P.comments+=Q+` 4472`;continue}if((U=Q.match(S))&&(P.gamma=parseFloat(U[1])),(U=Q.match(R))&&(P.exposure=parseFloat(U[1])),(U=Q.match(N))&&(P.valid|=2,P.format=U[1]),(U=Q.match(F))&&(P.valid|=4,P.height=parseInt(U[1],10),P.width=parseInt(U[2],10)),P.valid&2&&P.valid&4)break}return P.valid&2||a(3,"missing format specifier"),P.valid&4||a(3,"missing image size specifier"),P},f=function(w,E,S){const R=E;if(R<8||R>32767||w[0]!==2||w[1]!==2||w[2]&128)return new Uint8Array(w);R!==(w[2]<<8|w[3])&&a(3,"wrong scanline width");const N=new Uint8Array(4*E*S);N.length||a(4,"unable to allocate buffer space");let F=0,P=0;const Q=4*R,U=new Uint8Array(4),G=new Uint8Array(Q);let q=S;for(;q>0&&P<w.byteLength;){P+4>w.byteLength&&a(1),U[0]=w[P++],U[1]=w[P++],U[2]=w[P++],U[3]=w[P++],(U[0]!=2||U[1]!=2||(U[2]<<8|U[3])!=R)&&a(3,"bad rgbe scanline format");let J=0,Z;for(;J<Q&&P<w.byteLength;){Z=w[P++];const re=Z>128;if(re&&(Z-=128),(Z===0||J+Z>Q)&&a(3,"bad scanline data"),re){const Ae=w[P++];for(let He=0;He<Z;He++)G[J++]=Ae}else G.set(w.subarray(P,P+Z),J),J+=Z,P+=Z}const Y=R;for(let re=0;re<Y;re++){let Ae=0;N[F]=G[re+Ae],Ae+=R,N[F+1]=G[re+Ae],Ae+=R,N[F+2]=G[re+Ae],Ae+=R,N[F+3]=G[re+Ae],F+=4}q--}return N},p=function(w,E,S,R){const N=w[E+3],F=Math.pow(2,N-128)/255;S[R+0]=w[E+0]*F,S[R+1]=w[E+1]*F,S[R+2]=w[E+2]*F,S[R+3]=1},g=function(w,E,S,R){const N=w[E+3],F=Math.pow(2,N-128)/255;S[R+0]=qo.toHalfFloat(Math.min(w[E+0]*F,65504)),S[R+1]=qo.toHalfFloat(Math.min(w[E+1]*F,65504)),S[R+2]=qo.toHalfFloat(Math.min(w[E+2]*F,65504)),S[R+3]=qo.toHalfFloat(1)},m=new Uint8Array(e);m.pos=0;const A=d(m),x=A.width,_=A.height,b=f(m.subarray(m.pos),x,_);let v,C,M;switch(this.type){case Nt:M=b.length/4;const w=new Float32Array(M*4);for(let S=0;S<M;S++)p(b,S*4,w,S*4);v=w,C=Nt;break;case It:M=b.length/4;const E=new Uint16Array(M*4);for(let S=0;S<M;S++)g(b,S*4,E,S*4);v=E,C=It;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:x,height:_,data:v,header:A.string,gamma:A.gamma,exposure:A.exposure,type:C}}setDataType(e){return this.type=e,this}load(e,t,n,i){function s(a,o){switch(a.type){case Nt:case It:a.colorSpace
vendor: 4,348 bytes, line 4472
4472=St,a.minFilter=We,a.magFilter=We,a.generateMipmaps=!1,a.flipY=!0;break}t&&t(a,o)}return super.load(e,s,n,i)}}class wR extends MR{constructor(e){console.warn("RGBELoader has been deprecated. Please use HDRLoader instead."),super(e)}}const TR={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},RR={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class Xm extends qs{constructor(e){super(),this.position.y=-3.5;const t=new Wi;t.deleteAttribute("uv");const n=new Mo({metalness:0,side:nn}),i=new Mo({metalness:0}),s=e=="legacy"?TR:RR,a=new Y0(16777215,s.topLight.intensity,28,2);a.position.set(...s.topLight.position),this.add(a);const o=new ot(t,n);o.position.set(...s.room.position),o.scale.set(...s.room.scale),this.add(o);for(const c of s.boxes){const l=new ot(t,i);l.position.set(...c.position),l.rotation.set(0,c.rotation,0),l.scale.set(...c.scale),this.add(l)}for(const c of s.lights){const l=new ot(t,this.createAreaLightMaterial(c.intensity));l.position.set(...c.position),l.scale.set(...c.scale),this.add(l)}}createAreaLightMaterial(e){const t=new ln;return t.color.setScalar(e),t}}const BR=.04,Er=20,DR=/\.hdr(\.js)?$/;class $m{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}ldrLoader(e){return this._ldrLoader==null&&(this._ldrLoader=new $0),this._ldrLoader.setWithCredentials(e),this._ldrLoader}imageLoader(e){return this._imageLoader==null&&(this._imageLoader=new IR(this.threeRenderer)),this._imageLoader.setWithCredentials(e),this._imageLoader}hdrLoader(e){return this._hdrLoader==null&&(this._hdrLoader=new wR,this._hdrLoader.setDataType(It)),this._hdrLoader.setWithCredentials(e),this._hdrLoader}async getLottieLoader(e){if(this._lottieLoader==null){const{LottieLoader:t}=await import(this.lottieLoaderUrl);this._lottieLoader=new t}return this._lottieLoader.setWithCredentials(e),this._lottieLoader}async loadImage(e,t){const n=await new Promise((i,s)=>this.ldrLoader(t).load(e,i,()=>{},s));return n.name=e,n.flipY=!1,n}async loadLottie(e,t,n){const i=await this.getLottieLoader(n);i.setQuality(t);const s=await new Promise((a,o)=>i.load(e,a,()=>{},o));return s.name=e,s}async loadEquirect(e,t=!1,n=()=>{}){try{const i=DR.test(e),s=i?this.hdrLoader(t):this.imageLoader(t),a=await new Promise((o,c)=>s.load(e,l=>{const{renderTarget:u}=l;if(u!=null){const{texture:h}=u;l.dispose(!1),o(h)}else o(l)},l=>{n(l.loaded/l.total*.9)},c));
vendor: 21,876 bytes, lines 4472-4534
4472return n(1),a.name=e,a.mapping=tl,i||(a.colorSpace=bt),a}finally{n&&n(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,n=()=>{},i=!1){const s=t!=="legacy";(t==="legacy"||t==="neutral")&&(t=null),t=dx(t);let a=Promise.resolve(null),o;e&&(a=this.loadEquirectFromUrl(e,i,n)),t?o=this.loadEquirectFromUrl(t,i,n):e?o=this.loadEquirectFromUrl(e,i,n):o=s?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[c,l]=await Promise.all([o,a]);if(c==null)throw new Error("Failed to load environment map.");return{environmentMap:c,skybox:l}}async loadEquirectFromUrl(e,t,n){if(!this.skyboxCache.has(e)){const i=this.loadEquirect(e,t,n);this.skyboxCache.set(e,i)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await Ew();const n=this.threeRenderer,i=new Ol(256,{generateMipmaps:!1,type:It,format:Tt,colorSpace:St,depthBuffer:!0}),s=new Td(.1,100,i),a=s.renderTarget.texture;a.name=t;const o=n.outputColorSpace,c=n.toneMapping;return n.toneMapping=Hn,n.outputColorSpace=St,s.update(n,e),this.blurCubemap(i,BR),n.toneMapping=c,n.outputColorSpace=o,a}async loadGeneratedEnvironmentMap(){return this.generatedEnvironmentMap==null&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new Xm("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return this.generatedEnvironmentMapAlt==null&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new Xm("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(this.blurMaterial==null){this.blurMaterial=this.getBlurShader(Er);const i=new Wi,s=new ot(i,this.blurMaterial);this.blurScene=new qs,this.blurScene.add(s)}const n=e.clone();this.halfblur(e,n,t,"latitudinal"),this.halfblur(n,e,t,"longitudinal")}halfblur(e,t,n,i){const a=e.width,o=isFinite(n)?Math.PI/(2*a):2*Math.PI/(2*Er-1),c=n/o,l=isFinite(n)?1+Math.floor(3*c):Er;l>Er&&console.warn(`sigmaRadians, ${n}, is too large and will clip, as it requested ${l} samples when the maximum is set to ${Er}`);const u=[];let h=0;for(let p=0;p<Er;++p){const g=p/c,m=Math.exp(-g*g/2);u.push(m),p==0?h+=m:p<l&&(h+=2*m)}for(let p=0;p<u.length;p++)u[p]=u[p]/h;const d=this.blurMaterial.uniforms;d.envMap.value=e.texture,d.samples.value=l,d.weights.value=u,d.latitudinal.value=i==="latitudinal",d.dTheta.value=o,new Td(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),n=new B(0,1,0);return new _n({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:n}},vertexShader:` 4473 4474 varying vec3 vOutputDirection; 4475 4476 void main() { 4477 4478 vOutputDirection = vec3( position ); 4479 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4480 4481 } 4482 `,fragmentShader:` 4483 varying vec3 vOutputDirection; 4484 4485 uniform samplerCube envMap; 4486 uniform int samples; 4487 uniform float weights[ n ]; 4488 uniform bool latitudinal; 4489 uniform float dTheta; 4490 uniform vec3 poleAxis; 4491 4492 vec3 getSample( float theta, vec3 axis ) { 4493 4494 float cosTheta = cos( theta ); 4495 // Rodrigues' axis-angle rotation 4496 vec3 sampleDirection = vOutputDirection * cosTheta 4497 + cross( axis, vOutputDirection ) * sin( theta ) 4498 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 4499 4500 return vec3( textureCube( envMap, sampleDirection ) ); 4501 4502 } 4503 4504 void main() { 4505 4506 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 4507 4508 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 4509 4510 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 4511 4512 } 4513 4514 axis = normalize( axis ); 4515 4516 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 4517 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 4518 4519 for ( int i = 1; i < n; i++ ) { 4520 4521 if ( i >= samples ) { 4522 4523 break; 4524 4525 } 4526 4527 float theta = dTheta * float( i ); 4528 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 4529 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 4530 4531 } 4532 } 4533 `,blending:Zn,depthTest:!1,depthWrite:!1,side:nn})}async dispose(){for(const[,e]of this.skyboxCache)(await e).dispose();this.generatedEnvironmentMap!=null&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),this.generatedEnvironmentMapAlt!=null&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),this.blurMaterial!=null&&this.blurMaterial.dispose()}}const LR=.2,pu=40,Au=60,Ym=5,yr=[1,.79,.62,.5,.4,.31,.25],FR=3,jm="high-performance",PR=1.3;class Gn extends ri{static get singleton(){return this._singleton||(this._singleton=new Gn({powerPreference:(self.ModelViewerElement||{}).powerPreference||jm,debug:wA()})),this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Gn({powerPreference:(self.ModelViewerElement||{}).powerPreference||jm,debug:wA()});for(const t of e)t.connectedCallback()}get canRender(){return this.threeRenderer!=null}get scaleFactor(){return yr[this.scaleStep]}set minScale(e){let t=1;for(;t<yr.length&&!(yr[t]<e);)++t;this.lastStep=t-1}constructor(e){super(),this.loader=new mn(mR),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=FR,this.avgFrameDuration=(Au+pu)/2,this.onWebGLContextLost=t=>{this.dispatchEvent({type:"contextlost",sourceEvent:t})},this.onWebGLContextRestored=()=>{var t;(t=this.textureUtils)===null||t===void 0||t.dispose(),this.textureUtils=this.canRender?new $m(this.threeRenderer):null;for(const n of this.scenes)n.element[El]()},this.dpr=window.devicePixelRatio,this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new nx({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=Xr}catch(t){console.warn(t)}this.arRenderer=this.canRender?new dR(this):null,this.textureUtils=this.canRender?new $m(this.threeRenderer):null,this.canRender&&mn.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}registerScene(e){if(this.scenes.add(e),e.forceRescale(),this.canRender){const t=new pe;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.scenes.size>0&&this.threeRenderer.setAnimationLoop((n,i)=>this.render(n,i))}}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&this.scenes.size===0&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return e.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:e.element[Kd]}countVisibleScenes(){const{canvas3D:e}=this;let t=0,n=null;for(const s of this.scenes){const{element:a}=s;a.modelIsVisible&&s.externalRenderer==null&&++t,e.parentElement===s.canvas.parentElement&&(n=s)}const i=t>1;if(n!=null){const s=i&&!this.multipleScenesVisible,a=!n.element.modelIsVisible;if(s||a){const{width:o,height:c}=this.sceneSize(n);this.copyPixels(n,o,c),e.parentElement.removeChild(e)}}this.multipleScenesVisible=i}updateRendererSize(){var e;const t=window.devicePixelRatio;if(t!==this.dpr)for(const s of this.scenes){const{element:a}=s;a[Dr](a.getBoundingClientRect())}let n=0,i=0;for(const s of this.scenes)n=Math.max(n,s.width),i=Math.max(i,s.height);if(!(n===this.width&&i===this.height&&t===this.dpr)){this.width=n,this.height=i,this.dpr=t,n=Math.ceil(n*t),i=Math.ceil(i*t),this.canRender&&this.threeRenderer.setSize(n,i,!1);for(const s of this.scenes){const{canvas:a}=s;a.width=n,a.height=i,s.forceRescale(),(e=s.effectRenderer)===null||e===void 0||e.setSize(n,i)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=pi(LR*(e-this.avgFrameDuration),-Ym,Ym),this.avgFrameDuration>Au?++this.scaleStep:this.avgFrameDuration<pu&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=(Au+pu)/2)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else if(e.scaleStep!=0)e.scaleStep=0,this.rescaleCanvas(e);else return!1;return!0}rescaleCanvas(e){const t=yr[e.scaleStep],n=Math.ceil(this.width/t),i=Math.ceil(this.height/t),{style:s}=e.canvas;s.width=`${n}px`,s.height=`${i}px`,this.canvas3D.style.width=`${n}px`,this.canvas3D.style.height=`${i}px`;const a=this.dpr*t,o=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:a,minimumDpr:this.dpr*yr[this.lastStep],pixelWidth:Math.ceil(e.width*a),pixelHeight:Math.ceil(e.height*a),reason:o}}))}sceneSize(e){const{dpr:t}=this,n=yr[e.scaleStep],i=Math.min(Math.ceil(e.width*n*t),this.canvas3D.width),s=Math.min(Math.ceil(e.height*n*t),this.canvas3D.height);return{width:i,height:s}}copyPixels(e,t,n){const i=e.context;if(i==null){console.log("could not acquire 2d context");return}i.clearRect(0,0,t,n),i.drawImage(this.canvas3D,0,0,t,n,0,0,t,n),e.canvas.classList.add("show")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const n of this.scenes)n.element.modelIsVisible===t&&e.push(n);return e}get isPresenting(){var e;return((e=this.arRenderer)===null||e===void 0?void 0:e.isPresenting)===!0}preRender(e,t,n){const{element:i,exposure:s,toneMapping:a}=e;i[gi](t,n);const o=typeof s=="number"&&!Number.isNaN(s),c=i.environmentImage,l=i.skyboxImage,u=a===Xr&&(c==="neutral"||c==="legacy"||!c&&!l);this.threeRenderer.toneMappingExposure=(o?s:1)*(u?PR:1)}render(e,t){if(t!=null){this.arRenderer!=null&&this.arRenderer.onWebXRFrame(e,t);return}const n=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(n),this.renderedLastFrame=!1);const{canvas3D:i}=this;for(const s of this.orderedScenes()){const{element:a}=s;if(!a.loaded||!a.modelIsVisible&&s.renderCount>0||(this.preRender(s,e,n),!this.shouldRender(s)))continue;if(s.externalRenderer!=null){const l=s.getCamera();l.updateMatrix();const{matrix:u,projectionMatrix:h}=l,d=u.elements.slice(),f=s.getTarget();d[12]+=f.x,d[13]+=f.y,d[14]+=f.z,s.externalRenderer.render({viewMatrix:d,projectionMatrix:h.elements});continue}if(!a.modelIsVisible&&!this.multipleScenesVisible)for(const l of this.scenes)l.element.modelIsVisible&&l.queueRender();const{width:o,height:c}=this.sceneSize(s);s.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-c,o,c),s.effectRenderer!=null?s.effectRenderer.render(n):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=s.toneMapping,this.threeRenderer.render(s,s.camera)),this.multipleScenesVisible||!s.element.modelIsVisible&&s.renderCount===0?this.copyPixels(s,o,c):i.parentElement!==s.canvas.parentElement&&(s.canvas.parentElement.appendChild(i),s.canvas.classList.remove("show")),s.hasRendered(),++s.renderCount,this.renderedLastFrame=!0}}dispose(){this.textureUtils!=null&&this.textureUtils.dispose(),this.threeRenderer!=null&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const e=[];for(const t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}const Xe=Symbol("correlatedObjects"),lt=Symbol("onUpdate");class Fo{constructor(e,t){this[lt]=e,this[Xe]=t}}const Km=new ln,NR=new si(2,2);let UR=0;const Un=Symbol("threeTexture"),Jm=Symbol("threeTextures");let OR=class extends Fo{get[Un](){var e;return(e=this[Xe])===null||e===void 0?void 0:e.values().next().value}get[Jm](){return this[Xe]}constructor(e,t){super(e,new Set(t?[t]:[]));const n=this[Un].image;n.src||(n.src=t.name?t.name:"adhoc_image"+UR++),n.name||(n.name=t&&n&&n.src?n.src.split("/").pop():"adhoc_image")}get name(){return this[Un].image.name||""}get uri(){return this[Un].image.src}get bufferView(){return this[Un].image.bufferView}get element(){const e=this[Un];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[Un];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return this.uri!=null?"external":"embedded"}set name(e){for(const t of this[Jm])t.image.name=e}update(){const e=this[Un];e&&e.isCanvasTexture&&!e.animation&&(this[Un].needsUpdate=!0,this[lt]())}async createThumbnail(e,t){const n=new qs;Km.map=this[Un];const i=new ot(NR,Km);n.add(i);const s=new Js(-1,1,1,-1,0,1),{threeRenderer:a}=Gn.singleton,o=new bn(e,t);a.setRenderTarget(o),a.render(n,s),a.setRenderTarget(null);const c=new Uint8Array(e*t*4);a.readRenderTargetPixels(o,0,0,e,t,c),ls.width=e,ls.height=t;const l=ls.getContext("2d"),u=l.createImageData(e,t);return u.data.set(c),l.putImageData(u,0,0),new Promise(async(h,d)=>{ls.toBlob(f=>{if(!f)return d("Failed to capture thumbnail.");h(URL.createObjectURL(f))},"image/png")})}};var jt;(function(r){r[r.Nearest=9728]="Nearest",r[r.Linear=9729]="Linear",r[r.NearestMipmapNearest=9984]="NearestMipmapNearest",r[r.LinearMipmapNearest=9985]="LinearMipmapNearest",r[r.NearestMipmapLinear=9986]="NearestMipmapLinear",r[r.LinearMipmapLinear=9987]="LinearMipmapLinear"})(jt||(jt={}));var hs;(function(r){r[r.ClampToEdge=33071]="ClampToEdge",r[r.MirroredRepeat=33648]="MirroredRepeat",r[r.Repeat=10497]="Repeat"})(hs||(hs={}));const Zm=new Map([[hs.Repeat,ni],[hs.ClampToEdge,Lt],[hs.MirroredRepeat,Ws]]),qd=new Map([[ni,hs.Repeat],[Lt,hs.ClampToEdge],[Ws,hs.MirroredRepeat]]),kR=new Map([[jt.Nearest,yt],[jt.Linear,We],[jt.NearestMipmapNearest,la],[jt.LinearMipmapNearest,Gs],[jt.NearestMipmapLinear,rs],[jt.LinearMipmapLinear,gn]]),vb=new Map([[yt,jt.Nearest],[We,jt.Linear],[la,jt.NearestMipmapNearest],[Gs,jt.LinearMipmapNearest],[rs,jt.NearestMipmapLinear],[gn,jt.LinearMipmapLinear]]),QR=new Map([[jt.Nearest,yt],[jt.Linear,We]]),Eb=new Map([[yt,jt.Nearest],[We,jt.Linear]]),GR=r=>vb.has(r),HR=r=>Eb.has(r),zR=r=>qd.has(r),VR=(r,e)=>{switch(r){case"minFilter":return GR(e);case"magFilter":return HR(e);case"wrapS":case"wrapT":return zR(e);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${r}" on Sampler`)}},Di=Symbol("threeTexture"),eg=Symbol("threeTextures"),Zi=Symbol("setProperty");class WR extends Fo{get[Di](){var e;return(e=this[Xe])===null||e===void 0?void 0:e.values().next().value}get[eg](){return this[Xe]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[Di].name||""}get minFilter(){return vb.get(this[Di].minFilter)}get magFilter(){return Eb.get(this[Di].magFilter)}get wrapS(){return qd.get(this[Di].wrapS)}get wrapT(){return qd.get(this[Di].wrapT)}get rotation(){return this[Di].rotation}get scale(){return Jd(this[Di].repeat)}get offset(){return Jd(this[Di].offset)}setMinFilter(e){this[Zi]("minFilter",kR.get(e))}setMagFilter(e){this[Zi]("magFilter",QR.get(e))}setWrapS(e){this[Zi]("wrapS",Zm.get(e))}setWrapT(e){this[Zi]("wrapT",Zm.get(e))}setRotation(e){e==null&&(e=0),this[Zi]("rotation",e)}setScale(e){e==null&&(e={u:1,v:1}),this[Zi]("repeat",new pe(e.u,e.v))}setOffset(e){e==null&&(e={u:0,v:0}),this[Zi]("offset",new pe(e.u,e.v))}[Zi](e,t){if(VR(e,t))for(const n of this[eg])n[e]=t,n.needsUpdate=!0;this[lt]()}}const tg=Symbol("image"),ng=Symbol("sampler"),ig=Symbol("threeTexture");class yb extends Fo{get[ig](){var e;return(e=this[Xe])===null||e===void 0?void 0:e.values().next().value}constructor(e,t){super(e,new Set(t?[t]:[])),this[ng]=new WR(e,t),this[tg]=new OR(e,t)}get name(){return this[ig].name||""}set name(e){for(const t of this[Xe])t.name=e}get sampler(){return this[ng]}get source(){return this[tg]}}var Sb,Cb,Ib;const Bs=Symbol("texture"),Ds=Symbol("transform"),mu=Symbol("materials"),sg=Symbol("usage"),Sr=Symbol("onUpdate"),eo=Symbol("activeVideo");var Ne;(function(r){r[r.Base=0]="Base",r[r.MetallicRoughness=1]="MetallicRoughness",r[r.Normal=2]="Normal",r[r.Occlusion=3]="Occlusion",r[r.Emissive=4]="Emissive",r[r.Clearcoat=5]="Clearcoat",r[r.ClearcoatRoughness=6]="ClearcoatRoughness",r[r.ClearcoatNormal=7]="ClearcoatNormal",r[r.SheenColor=8]="SheenColor",r[r.SheenRoughness=9]="SheenRoughness",r[r.Transmission=10]="Transmission",r[r.Thickness=11]="Thickness",r[r.Specular=12]="Specular",r[r.SpecularColor=13]="SpecularColor",r[r.Iridescence=14]="Iridescence",r[r.IridescenceThickness=15]="IridescenceThickness",r[r.Anisotropy=16]="Anisotropy"})(Ne||(Ne={}));class Nr{constructor(e,t,n,i){this[Sb]=null,this[Cb]={rotation:0,scale:new pe(1,1),offset:new pe(0,0)},this[Ib]=!1,n&&(this[Ds].rotation=n.rotation,this[Ds].scale.copy(n.repeat),this[Ds].offset.copy(n.offset),this[Bs]=new yb(e,n)),this[Sr]=e,this[mu]=i,this[sg]=t}get texture(){return this[Bs]}setTexture(e){var t,n;const i=e!=null?e.source[Un]:null,s=(t=this[Bs])===null||t===void 0?void 0:t.source[Un];if(s!=null&&s.isVideoTexture?this[eo]=!1:!((n=this[Bs])===null||n===void 0)&&n.source.animation&&this[Bs].source.animation.removeEventListener("enterFrame",this[Sr]),this[Bs]=e,i!=null&&i.isVideoTexture){const o=i.image;if(this[eo]=!0,o.requestVideoFrameCallback!=null){const c=()=>{this[eo]&&(this[Sr](),o.requestVideoFrameCallback(c))};o.requestVideoFrameCallback(c)}else{const c=()=>{this[eo]&&(this[Sr](),requestAnimationFrame(c))};requestAnimationFrame(c)}}else e?.source.animation!=null&&e.source.animation.addEventListener("enterFrame",this[Sr]);let a=bt;if(this[mu])for(const o of this[mu]){switch(this[sg]){case Ne.Base:o.map=i;break;case Ne.MetallicRoughness:a=St,o.metalnessMap=i,o.roughnessMap=i;break;case Ne.Normal:a=St,o.normalMap=i;break;case Ne.Occlusion:a=St,o.aoMap=i;break;case Ne.Emissive:o.emissiveMap=i;break;case Ne.Clearcoat:o.clearcoatMap=i;break;case Ne.ClearcoatRoughness:o.clearcoatRoughnessMap=i;break;case Ne.ClearcoatNormal:o.clearcoatNormalMap=i;break;case Ne.SheenColor:o.sheenColorMap=i;break;case Ne.SheenRoughness:o.sheenRoughnessMap=i;break;case Ne.Transmission:o.transmissionMap=i;break;case Ne.Thickness:o.thicknessMap=i;break;case Ne.Specular:o.specularIntensityMap=i;break;case Ne.SpecularColor:o.specularColorMap=i;break;case Ne.Iridescence:o.iridescenceMap=i;break;case Ne.IridescenceThickness:o.iridescenceThicknessMap=i;break;case Ne.Anisotropy:o.anisotropyMap=i;break}o.needsUpdate=!0}i&&(i.colorSpace=a,i.rotation=this[Ds].rotation,i.repeat=this[Ds].scale,i.offset=this[Ds].offset),this[Sr]()}}Sb=Bs,Cb=Ds,Ib=eo;const Oa=Symbol("threeMaterial"),Tc=Symbol("threeMaterials"),rg=Symbol("baseColorTexture"),ag=Symbol("metallicRoughnessTexture");class qR extends Fo{get[Tc](){return this[Xe]}get[Oa](){var e;return(e=this[Xe])===null||e===void 0?void 0:e.values().next().value}constructor(e,t){super(e,t);const{map:n,metalnessMap:i}=t.values().next().value;this[rg]=new Nr(e,Ne.Base,n,t),this[ag]=new Nr(e,Ne.MetallicRoughness,i,t)}get baseColorFactor(){const e=[0,0,0,this[Oa].opacity];return this[Oa].color.toArray(e),e}get metallicFactor(){return this[Oa].metalness}get roughnessFactor(){return this[Oa].roughness}get baseColorTexture(){return this[rg]}get metallicRoughnessTexture(){return this[ag]}setBaseColorFactor(e){const t=new Ie;e instanceof Array?t.fromArray(e):t.set(e);for(const n of this[Tc])n.color.set(t),e instanceof Array&&e.length>3?n.opacity=e[3]:(e=[0,0,0,n.opacity],t.toArray(e));this[lt]()}setMetallicFactor(e){for(const t of this[Tc])t.metalness=e;this[lt]()}setRoughnessFactor(e){for(const t of this[Tc])t.roughness=e;this[lt]()}}var og,cg;const lg=Symbol("pbrMetallicRoughness"),hg=Symbol("normalTexture"),ug=Symbol("occlusionTexture"),dg=Symbol("emissiveTexture"),Ct=Symbol("backingThreeMaterial"),fg=Symbol("applyAlphaCutoff"),gu=Symbol("getAlphaMode"),Cr=Symbol("lazyLoadGLTFInfo"),xu=Symbol("initialize"),Xd=Symbol("getLoadedMaterial"),be=Symbol("ensureMaterialIsLoaded"),pg=Symbol("gltfIndex"),to=Symbol("setActive"),Vr=Symbol("variantIndices"),bu=Symbol("isActive"),Ag=Symbol("modelVariants"),_u=Symbol("name"),yn=Symbol("pbrTextures");class vu extends Fo{get[(og=Vr,cg=yn,Ct)](){return this[Xe].values().next().value}constructor(e,t,n,i,s,a,o=void 0){super(e,s),this[og]=new Set,this[cg]=new Map,this[pg]=t,this[bu]=n,this[Ag]=i,this[_u]=a,o==null?this[xu]():this[Cr]=o}[xu](){const e=this[lt],t=this[Xe];this[lg]=new qR(e,t);const{normalMap:n,aoMap:i,emissiveMap:s}=t.values().next().value;this[hg]=new Nr(e,Ne.Normal,n,t),this[ug]=new Nr(e,Ne.Occlusion,i,t),this[dg]=new Nr(e,Ne.Emissive,s,t);const a=o=>{this[yn].set(o,new Nr(e,o,null,t))};a(Ne.Clearcoat),a(Ne.ClearcoatRoughness),a(Ne.ClearcoatNormal),a(Ne.SheenColor),a(Ne.SheenRoughness),a(Ne.Transmission),a(Ne.Thickness),a(Ne.Specular),a(Ne.SpecularColor),a(Ne.Iridescence),a(Ne.IridescenceThickness),a(Ne.Anisotropy)}async[Xd](){if(this[Cr]!=null){const e=await this[Cr].doLazyLoad();return this[xu](),this[Cr]=void 0,this.ensureLoaded=async()=>{},e}return null}colorFromRgb(e){const t=new Ie;return e instanceof Array?t.fromArray(e):t.set(e),t}[be](){if(this[Cr]!=null)throw new Error(`Material "${this.name}" has not been loaded, call 'await 4534 myMaterial.ensureLoaded()' before using an unloaded material.`)}
vendor: 7,760 bytes, line 4534
4534async ensureLoaded(){await this[Xd]()}get isLoaded(){return this[Cr]==null}get isActive(){return this[bu]}[to](e){this[bu]=e}get name(){return this[_u]||""}set name(e){if(this[_u]=e,this[Xe]!=null)for(const t of this[Xe])t.name=e}get pbrMetallicRoughness(){return this[be](),this[lg]}get normalTexture(){return this[be](),this[hg]}get occlusionTexture(){return this[be](),this[ug]}get emissiveTexture(){return this[be](),this[dg]}get emissiveFactor(){return this[be](),this[Ct].emissive.toArray()}get index(){return this[pg]}hasVariant(e){const t=this[Ag].get(e);return t!=null&&this[Vr].has(t.index)}setEmissiveFactor(e){this[be]();const t=this.colorFromRgb(e);for(const n of this[Xe])n.emissive.set(t);this[lt]()}[gu](){return this[Ct].transparent?"BLEND":this[Ct].alphaTest>0?"MASK":"OPAQUE"}[fg](){this[be]();for(const e of this[Xe])this[gu]()==="MASK"?e.alphaTest==null&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[be]();for(const t of this[Xe])t.alphaTest=e,t.needsUpdate=!0;this[fg](),this[lt]()}getAlphaCutoff(){return this[be](),this[Ct].alphaTest}setDoubleSided(e){this[be]();for(const t of this[Xe])t.side=e?Vt:ti,t.needsUpdate=!0;this[lt]()}getDoubleSided(){return this[be](),this[Ct].side==Vt}setAlphaMode(e){this[be]();const t=(n,i)=>{n.transparent=i,n.depthWrite=!i};for(const n of this[Xe])t(n,e==="BLEND"),e==="MASK"?n.alphaTest=.5:n.alphaTest=void 0,n.needsUpdate=!0;this[lt]()}getAlphaMode(){return this[be](),this[gu]()}get emissiveStrength(){return this[be](),this[Ct].emissiveIntensity}setEmissiveStrength(e){this[be]();for(const t of this[Xe])t.emissiveIntensity=e;this[lt]()}get clearcoatFactor(){return this[be](),this[Ct].clearcoat}get clearcoatRoughnessFactor(){return this[be](),this[Ct].clearcoatRoughness}get clearcoatTexture(){return this[be](),this[yn].get(Ne.Clearcoat)}get clearcoatRoughnessTexture(){return this[be](),this[yn].get(Ne.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[be](),this[yn].get(Ne.ClearcoatNormal)}get clearcoatNormalScale(){return this[be](),this[Ct].clearcoatNormalScale.x}setClearcoatFactor(e){this[be]();for(const t of this[Xe])t.clearcoat=e;this[lt]()}setClearcoatRoughnessFactor(e){this[be]();for(const t of this[Xe])t.clearcoatRoughness=e;this[lt]()}setClearcoatNormalScale(e){this[be]();for(const t of this[Xe])t.clearcoatNormalScale=new pe(e,e);this[lt]()}get ior(){return this[be](),this[Ct].ior}setIor(e){this[be]();for(const t of this[Xe])t.ior=e;this[lt]()}get sheenColorFactor(){return this[be](),this[Ct].sheenColor.toArray()}get sheenColorTexture(){return this[be](),this[yn].get(Ne.SheenColor)}get sheenRoughnessFactor(){return this[be](),this[Ct].sheenRoughness}get sheenRoughnessTexture(){return this[be](),this[yn].get(Ne.SheenRoughness)}setSheenColorFactor(e){this[be]();const t=this.colorFromRgb(e);for(const n of this[Xe])n.sheenColor.set(t),n.sheen=1;this[lt]()}setSheenRoughnessFactor(e){this[be]();for(const t of this[Xe])t.sheenRoughness=e,t.sheen=1;this[lt]()}get transmissionFactor(){return this[be](),this[Ct].transmission}get transmissionTexture(){return this[be](),this[yn].get(Ne.Transmission)}setTransmissionFactor(e){this[be]();for(const t of this[Xe])t.transmission=e;this[lt]()}get thicknessFactor(){return this[be](),this[Ct].thickness}get thicknessTexture(){return this[be](),this[yn].get(Ne.Thickness)}get attenuationDistance(){return this[be](),this[Ct].attenuationDistance}get attenuationColor(){return this[be](),this[Ct].attenuationColor.toArray()}setThicknessFactor(e){this[be]();for(const t of this[Xe])t.thickness=e;this[lt]()}setAttenuationDistance(e){this[be]();for(const t of this[Xe])t.attenuationDistance=e;this[lt]()}setAttenuationColor(e){this[be]();const t=this.colorFromRgb(e);for(const n of this[Xe])n.attenuationColor.set(t);this[lt]()}get specularFactor(){return this[be](),this[Ct].specularIntensity}get specularTexture(){return this[be](),this[yn].get(Ne.Specular)}get specularColorFactor(){return this[be](),this[Ct].specularColor.toArray()}get specularColorTexture(){return this[be](),this[yn].get(Ne.SheenColor)}setSpecularFactor(e){this[be]();for(const t of this[Xe])t.specularIntensity=e;this[lt]()}setSpecularColorFactor(e){this[be]();const t=this.colorFromRgb(e);for(const n of this[Xe])n.specularColor.set(t);this[lt]()}get iridescenceFactor(){return this[be](),this[Ct].iridescence}get iridescenceTexture(){return this[be](),this[yn].get(Ne.Iridescence)}get iridescenceIor(){return this[be](),this[Ct].iridescenceIOR}get iridescenceThicknessMinimum(){return this[be](),this[Ct].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[be](),this[Ct].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[be](),this[yn].get(Ne.IridescenceThickness)}setIridescenceFactor(e){this[be]();for(const t of this[Xe])t.iridescence=e;this[lt]()}setIridescenceIor(e){this[be]();for(const t of this[Xe])t.iridescenceIOR=e;this[lt]()}setIridescenceThicknessMinimum(e){this[be]();for(const t of this[Xe])t.iridescenceThicknessRange[0]=e;this[lt]()}setIridescenceThicknessMaximum(e){this[be]();for(const t of this[Xe])t.iridescenceThicknessRange[1]=e;this[lt]()}get anisotropyStrength(){return this[be](),this[Ct].anisotropy}get anisotropyRotation(){return this[be](),this[Ct].anisotropyRotation}get anisotropyTexture(){return this[be](),this[yn].get(Ne.Anisotropy)}setAnisotropyStrength(e){this[be]();for(const t of this[Xe])t.anisotropy=e;this[lt]()}setAnisotropyRotation(e){this[be]();for(const t of this[Xe])t.anisotropyRotation=e;this[lt]()}}let Mb=class{constructor(e){this.name="",this.children=new Array,this.name=e}};class Eu extends Mb{constructor(e,t,n,i){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:s,threeGLTF:a,threeObjectMap:o}=i;this.parser=a.parser,this.modelVariants=n,this.mesh.userData.variantData=n;const c=o.get(e.material);c.materials!=null?this.initialMaterialIdx=this.activeMaterialIdx=c.materials:console.error(`Primitive (${e.name}) missing initial material reference.`);const l=e.userData.associations||{};if(l.meshes==null){console.error("Mesh is missing primitive index association");return}const d=((s.meshes||[])[l.meshes].primitives||[])[l.primitives];if(d==null){console.error("Mesh primitive definition is missing.");return}if(d.material!=null)this.materials.set(d.material,t[d.material]);else{const f=t.findIndex(p=>p.name==="Default");f>=0?this.materials.set(f,t[f]):console.warn("gltfPrimitive has no material!")}if(d.extensions&&d.extensions.KHR_materials_variants){const f=d.extensions.KHR_materials_variants,g=a.parser.json.extensions.KHR_materials_variants.variants;for(const m of f.mappings){const A=t[m.material];this.materials.set(m.material,A);for(const x of m.variants){const{name:_}=g[x];this.variantToMaterialMap.set(x,A),A[Vr].add(x),n.has(_)||n.set(_,{name:_,index:x})}}}}async setActiveMaterial(e){const t=this.materials.get(e);if(e!==this.activeMaterialIdx){const n=t[Xe],i=await t[Xd]();i!=null?this.mesh.material=i:this.mesh.material=n.values().next().value,this.parser.assignFinalMaterial(this.mesh),n.add(this.mesh.material),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(e==null)return this.setActiveMaterial(this.initialMaterialIdx);if(this.variantToMaterialMap!=null&&this.modelVariants.has(e)){const t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(this.variantToMaterialMap!=null&&e!=null){const t=this.variantToMaterialMap.get(e);if(t!=null)return this.setActiveMaterial(t.index)}return null}
vendor: 4,102 bytes, lines 4534-4535
4534async instantiateVariants(){if(this.variantToMaterialMap!=null)for(const e of this.variantToMaterialMap.keys()){const t=this.mesh.userData.variantMaterials.get(e);if(t.material!=null)continue;const n=await this.enableVariantHelper(e);n!=null&&(t.material=n)}}get variantInfo(){return this.variantToMaterialMap}addVariant(e,t){if(!this.ensureVariantIsUnused(t))return!1;this.modelVariants.has(t)||this.modelVariants.set(t,{name:t,index:this.modelVariants.size});const i=this.modelVariants.get(t).index;return e[Vr].add(i),this.variantToMaterialMap.set(i,e),this.materials.set(e.index,e),this.updateVariantUserData(i,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;t?.delete(e)}}updateVariantUserData(e,t){t[Vr].add(e),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map,this.mesh.userData.variantMaterials.set(e,{material:t[Xe].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return t!=null&&this.variantInfo.has(t.index)?(console.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1):!0}}var mg,gg,xg,bg,_g,vg;const Is=Symbol("materials"),Rc=Symbol("hierarchy"),Eg=Symbol("roots"),Li=Symbol("primitives"),wb=Symbol("prepareVariantsForExport"),Tb=Symbol("switchVariant"),Rb=Symbol("materialFromPoint"),$d=Symbol("nodeFromPoint"),Bb=Symbol("nodeFromIndex"),on=Symbol("variantData"),Yd=Symbol("availableVariants"),yu=Symbol("modelOnUpdate"),yg=Symbol("cloneMaterial");class XR{constructor(e,t,n,i){this.gltf=e,this.gltfElementMap=t,this.mapKey=n,this.doLazyLoad=i}}class $R{constructor(e,t=()=>{}){this[mg]=new Array,this[gg]=new Array,this[xg]=new Array,this[bg]=new Array,this[_g]=()=>{},this[vg]=new Map,this[yu]=t;const{gltf:n,threeGLTF:i,gltfElementMap:s}=e;for(const[c,l]of n.materials.entries()){const u=s.get(l);if(u!=null)this[Is].push(new vu(t,c,!0,this[on],u,l.name));else{const d=(n.materials||[])[c],f=new Set;s.set(d,f);const p=async()=>{const g=await i.parser.getDependency("material",c);return f.add(g),g};this[Is].push(new vu(t,c,!1,this[on],f,l.name,new XR(n,s,d,p)))}}const a=new Map,o=new Array;for(const c of i.scene.children)o.push(c);for(;o.length>0;){const c=o.pop();let l=null;c instanceof ot?(l=new Eu(c,this.materials,this[on],e),this[Li].push(l)):l=new Mb(c.name);const u=a.get(c);u!=null?u.children.push(l):this[Eg].push(l),this[Rc].push(l);for(const h of c.children)o.push(h),a.set(c,l)}}get materials(){return this[Is]}[(mg=Is,gg=Rc,xg=Eg,bg=Li,_g=yu,vg=on,Yd)](){const e=Array.from(this[on].values());return e.sort((t,n)=>t.index-n.index),e.map(t=>t.name)}getMaterialByName(e){const t=this[Is].filter(n=>n.name===e);return t.length>0?t[0]:null}[Bb](e,t){const n=this[Rc].find(i=>{if(i instanceof Eu){const{meshes:s,primitives:a}=i.mesh.userData.associations;if(s==e&&a==t)return!0}return!1});return n??null}[$d](e){return this[Rc].find(t=>t instanceof Eu&&t.mesh===e.object)}[Rb](e){return this[$d](e).getActiveMaterial()}async[Tb](e){for(const t of this[Li])await t.enableVariant(e);for(const t of this.materials)t[to](!1);for(const t of this[Li])this.materials[t.getActiveMaterial().index][to](!0)}async[wb](){const e=new Array;for(const t of this[Li])e.push(t.instantiateVariants());await Promise.all(e)}[yg](e,t){const n=this.materials[e];n.isLoaded||console.error(`Cloning an unloaded material, 4535 call 'material.ensureLoaded() before cloning the material.`);const i=n[Xe],s=new Set;for(const[o,c]of i.entries()){const l=c.clone();l.name=t+(i.size>1?"_inst"+o:""),s.add(l)}const a=new vu(this[yu],this[Is].length,!1,this[on],s,t);return this[Is].push(a),a}createMaterialInstanceForVariant(e,t,n,i=!0){let s=null;for(const a of this[Li]){const o=this[on].get(n);o!=null&&a.variantInfo.has(o.index)||a.getMaterial(e)!=null&&(this.hasVariant(n)||this.createVariant(n),s==null&&(s=this[yg](e,t)),a.addVariant(s,n))}if(i&&s!=null){s[to](!0),this.materials[e][to](!1);for(const a of this[Li])a.enableVariant(n)}return s}
vendor: 11,386 bytes, lines 4535-4599
4535createVariant(e){this[on].has(e)?console.warn(`Variant '${e}'' already exists`):this[on].set(e,{name:e,index:this[on].size})}hasVariant(e){return this[on].has(e)}setMaterialToVariant(e,t){if(this[Yd]().find(n=>n===t)==null){console.warn(`Can't add material to '${t}', the variant does not exist.'`);return}if(e<0||e>=this.materials.length){console.error("setMaterialToVariant(): materialIndex is out of bounds.");return}for(const n of this[Li]){const i=n.getMaterial(e);i!=null&&n.addVariant(i,t)}}updateVariantName(e,t){const n=this[on].get(e);n!=null&&(n.name=t,this[on].set(t,n),this[on].delete(e))}deleteVariant(e){const t=this[on].get(e);if(t!=null){for(const n of this.materials)n.hasVariant(e)&&n[Vr].delete(t.index);for(const n of this[Li])n.deleteVariant(t.index);this[on].delete(e)}}}var Su=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const Kc=Symbol("currentGLTF"),Jc=Symbol("originalGltfJson"),Ls=Symbol("model"),Cu=Symbol("getOnUpdateMethod"),ka=Symbol("buildTexture"),YR=r=>{var e,t,n;class i extends r{constructor(){super(...arguments),this[e]=void 0,this[t]=null,this[n]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[Ls]}get availableVariants(){return this.model?this.model[Yd]():[]}get originalGltfJson(){return this[Jc]}[(e=Ls,t=Kc,n=Jc,Cu)](){return()=>{this[Kt]()}}[ka](a){return a.colorSpace=bt,a.wrapS=ni,a.wrapT=ni,new yb(this[Cu](),a)}async createTexture(a,o="image/png"){const{textureUtils:c}=this[at],l=await c.loadImage(a,this.withCredentials);return l.userData.mimeType=o,this[ka](l)}async createLottieTexture(a,o=1){const{textureUtils:c}=this[at],l=await c.loadLottie(a,o,this.withCredentials);return this[ka](l)}createVideoTexture(a){const o=document.createElement("video");o.crossOrigin=this.withCredentials?"use-credentials":"anonymous",o.src=a,o.muted=!0,o.playsInline=!0,o.loop=!0,o.play();const c=new qv(o);return this[ka](c)}createCanvasTexture(){const a=document.createElement("canvas"),o=new Dd(a);return this[ka](o)}async updated(a){if(super.updated(a),a.has("variantName")){const o=this[Ys].beginActivity("variant-update");o(.1);const c=this[Ls],{variantName:l}=this;c!=null&&(await c[Tb](l),this[Kt](),this.dispatchEvent(new CustomEvent("variant-applied"))),o(1)}if(a.has("orientation")||a.has("scale")){if(!this.loaded)return;const o=this[te];o.applyTransform(),o.updateBoundingBox(),o.updateShadow(),this[at].arRenderer.onUpdateScene(),this[Kt]()}}[xi](){super[xi]();const{currentGLTF:a}=this[te];if(a!=null){const{correlatedSceneGraph:o}=a;o!=null&&a!==this[Kc]&&(this[Ls]=new $R(o,this[Cu]()),this[Jc]=JSON.parse(JSON.stringify(o.gltf))),"variants"in a.userData&&this.requestUpdate("variantName")}this[Kc]=a}async exportScene(a){const o=this[te];return new Promise(async(c,l)=>{const u={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(u,a),u.animations=o.animations,u.truncateDrawRange=!0;const h=o.shadow;let d=!1;h!=null&&(d=h.visible,h.visible=!1),await this[Ls][wb](),new yl().register(p=>new h1(p)).parse(o.model,p=>c(new Blob([u.binary?p:JSON.stringify(p)],{type:u.binary?"application/octet-stream":"application/json"})),()=>l("glTF export failed"),u),h!=null&&(h.visible=d)})}materialFromPoint(a,o){const c=this[Ls];if(c==null)return null;const l=this[te],u=l.getNDC(a,o),h=l.hitFromPoint(u);return h==null||h.face==null?null:c[Rb](h)}}return Su([De({type:String,attribute:"variant-name"})],i.prototype,"variantName",void 0),Su([De({type:String,attribute:"orientation"})],i.prototype,"orientation",void 0),Su([De({type:String,attribute:"scale"})],i.prototype,"scale",void 0),i};class jR extends ot{constructor(){super(void 0,new ln({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&this.geometry!=null&&this.map!=null}updateGeometry(e=this.height,t=this.radius,n=128){(e!=this.height||t!=this.radius||n!=this.resolution)&&(this.height=e,this.radius=t,this.resolution=n,e>0&&t>0&&(this.geometry.dispose(),this.geometry=KR(e,t,n)))}}function KR(r,e,t){const n=new wf(e,2*t,t);n.scale(1,1,-1);const i=n.getAttribute("position"),s=new B;for(let a=0;a<i.count;++a)if(s.fromBufferAttribute(i,a),s.y<0){const o=-r*3/2,c=s.y<o?-r/s.y:1-s.y*s.y/(3*o*o);s.multiplyScalar(c),s.toArray(i.array,3*a)}return i.needsUpdate=!0,n}const Bc=new B,Iu=new B,Mu=new B,Dc=new Qe,Sg=new Rn,Cg=new xn;class Db extends OT{constructor(e){super(document.createElement("div")),this.normal=new B(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}get facingCamera(){return!this.element.classList.contains("hide")}show(){(!this.facingCamera||!this.initialized)&&this.updateVisibility(!0)}hide(){(this.facingCamera||!this.initialized)&&this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,this.referenceCount===0}updatePosition(e){if(e==null)return;const t=Gi(e)[0].terms;for(let n=0;n<3;++n)this.position.setComponent(n,mi(t[n]).number);this.updateMatrixWorld()}updateNormal(e){if(e==null)return;const t=Gi(e)[0].terms;for(let n=0;n<3;++n)this.normal.setComponent(n,t[n].number)}updateSurface(){const{mesh:e,tri:t,bary:n}=this;if(e==null||t==null||n==null)return;e.getVertexPosition(t.x,Bc),e.getVertexPosition(t.y,Iu),e.getVertexPosition(t.z,Mu),Bc.toArray(Dc.elements,0),Iu.toArray(Dc.elements,3),Mu.toArray(Dc.elements,6),this.position.copy(n).applyMatrix3(Dc);const i=this.parent;i.worldToLocal(e.localToWorld(this.position)),Sg.set(Bc,Iu,Mu),Sg.getNormal(this.normal).transformDirection(e.matrixWorld);const s=i.parent;Cg.setFromAxisAngle(Bc.set(0,1,0),-s.rotation.y),this.normal.applyQuaternion(Cg)}orient(e){this.pivot.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach(t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const n=t,i=n.dataset.visibilityAttribute;if(i!=null){const s=`data-${i}`;n.toggleAttribute(s,e)}n.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))}),this.initialized=!0}}const JR={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:` 4536 4537 varying vec2 vUv; 4538 4539 void main() { 4540 4541 vUv = uv; 4542 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4543 4544 }`,fragmentShader:` 4545 4546 uniform sampler2D tDiffuse; 4547 uniform float h; 4548 4549 varying vec2 vUv; 4550 4551 void main() { 4552 4553 vec4 sum = vec4( 0.0 ); 4554 4555 sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051; 4556 sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918; 4557 sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245; 4558 sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531; 4559 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633; 4560 sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531; 4561 sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245; 4562 sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918; 4563 sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051; 4564 4565 gl_FragColor = sum; 4566 4567 }`},ZR={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:` 4568 4569 varying vec2 vUv; 4570 4571 void main() { 4572 4573 vUv = uv; 4574 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4575 4576 }`,fragmentShader:` 4577 4578 uniform sampler2D tDiffuse; 4579 uniform float v; 4580 4581 varying vec2 vUv; 4582 4583 void main() { 4584 4585 vec4 sum = vec4( 0.0 ); 4586 4587 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051; 4588 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918; 4589 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245; 4590 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531; 4591 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633; 4592 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531; 4593 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245; 4594 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918; 4595 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051; 4596 4597 gl_FragColor = sum; 4598 4599 }`};function Ig(r,e,t){return(1-t)*r+t*e}const Mg=9,eB=6,wu=2,tB=.3;class nB extends mt{constructor(e,t,n){super(),this.camera=new Js,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new z0,this.horizontalBlurMaterial=new _n(JR),this.verticalBlurMaterial=new _n(ZR),this.intensity=0,this.softness=1,this.boundingBox=new cn,this.size=new B,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:i}=this;i.rotation.x=Math.PI/2,i.left=-.5,i.right=.5,i.bottom=-.5,i.top=.5,this.add(i);const s=new si,a=new ln({opacity:1,transparent:!0,side:nn});this.floor=new ot(s,a),this.floor.userData.noHit=!0,i.add(this.floor),this.blurPlane=new ot(s),this.blurPlane.visible=!1,i.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(o){o.fragmentShader=o.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.depthMaterial.side=Vt,this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,n)}setScene(e,t,n){const{boundingBox:i,size:s,rotation:a,position:o}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(s.x,s.y,s.z)*(this.isAnimated?wu:1),this.boundingBox.getCenter(o),n==="back"){const{min:c,max:l}=i;[c.y,c.z]=[c.z,c.y],[l.y,l.z]=[l.z,l.y],[s.y,s.z]=[s.z,s.y],a.x=Math.PI/2,a.y=Math.PI}else a.x=0,a.y=0;if(this.isAnimated){const c=i.min.y,l=i.max.y;s.y=this.maxDimension,i.expandByVector(s.subScalar(this.maxDimension).multiplyScalar(-.5)),i.min.y=c,i.max.y=l,s.set(this.maxDimension,l-c,this.maxDimension)}n==="bottom"?o.y=i.min.y:o.z=i.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:n}=this,i=this.isAnimated?wu:1,s=i*Math.pow(2,Mg-e*(Mg-eB));this.setMapSize(s);const a=t.y/2,o=t.y*i;n.near=0,n.far=Ig(o,a,e),this.depthMaterial.opacity=1/e,n.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=wu);const n=Math.floor(t.x>t.z?e:e*t.x/t.z),i=Math.floor(t.x>t.z?e*t.z/t.x:e),s=10,a=s+n,o=s+i;if(this.renderTarget!=null&&(this.renderTarget.width!==a||this.renderTarget.height!==o)&&(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),this.renderTarget==null){const c={format:Tt};this.renderTarget=new bn(a,o,c),this.renderTargetBlur=new bn(a,o,c),this.floor.material.map=this.renderTarget.texture}
vendor: 4,657 bytes, line 4599
4599this.camera.scale.set(t.x*(1+s/n),t.z*(1+s/i),1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*Ig(tB,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return .001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial;const n=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;const i=e.xr.enabled;e.xr.enabled=!1;const s=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=i,e.setRenderTarget(s),e.setClearAlpha(n)}blurShadow(e){const{camera:t,horizontalBlurMaterial:n,verticalBlurMaterial:i,renderTarget:s,renderTargetBlur:a,blurPlane:o}=this;o.visible=!0,o.material=n,n.uniforms.h.value=1/this.renderTarget.width,n.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(a),e.render(o,t),o.material=i,i.uniforms.v.value=1/this.renderTarget.height,i.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(s),e.render(o,t),o.visible=!1}dispose(){this.renderTarget!=null&&this.renderTarget.dispose(),this.renderTargetBlur!=null&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}const wg=10,Tu=100,Ru=new B,Tg=new B,Rg=new B,Lc=new oy,iB=new B,Qa=new pe;class sB extends qs{constructor({canvas:e,element:t,width:n,height:i}){super(),this.annotationRenderer=new kT,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.appendedAnimations=[],this.markedAnimations=[],this.camera=new tn(45,1,.1,100),this.xrCamera=null,this.url=null,this.pivot=new mt,this.target=new mt,this.animationNames=[],this.boundingBox=new cn,this.boundingSphere=new Wn,this.size=new B,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=Xr,this.canScale=!0,this.isDirty=!1,this.goalTarget=new B,this.targetDamperX=new en,this.targetDamperY=new en,this.targetDamperZ=new en,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new jR,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new tn(45,1,.1,100),this.camera.name="MainCamera",this.add(this.pivot),this.pivot.name="Pivot",this.pivot.add(this.target),this.setSize(n,i),this.target.name="Target",this.mixer=new ay(this.target);const{domElement:s}=this.annotationRenderer,{style:a}=s;a.display="none",a.pointerEvents="none",a.position="absolute",a.top="0",this.element.shadowRoot.querySelector(".default").appendChild(s),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return this.xrCamera!=null?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(e){this.reset(),this._model=e,this.target.add(e),await this.setupScene()}async setSource(e,t=()=>{}){if(!e||e===this.url){t(1);return}if(this.reset(),this.url=e,this.externalRenderer!=null){const o=await this.externalRenderer.load(t);this.boundingSphere.radius=o.framedRadius,this.idealAspect=o.fieldOfViewAspect;return}this.cancelPendingSourceChange!=null&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);let n;try{n=await new Promise((o,c)=>{this.cancelPendingSourceChange=()=>c(),(async()=>{try{const l=await this.element[at].loader.load(e,this.element,t);o(l)}catch(l){c(l)}})()})}catch(o){if(o==null)return;throw o}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=n,n!=null&&(this._model=n.scene,this.target.add(n.scene));const{animations:i}=n,s=new Map,a=[];for(const o of i)s.set(o.name,o),a.push(o.name);this.animations=i,this.animationsByName=s,this.animationNames=a,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),this.shadow!=null&&this.shadow.setIntensity(0),this.bakedSha
vendor: 4,207 bytes, line 4599
4599dows.clear();const{_model:e}=this;e!=null&&(e.removeFromParent(),this._model=null);const t=this._currentGLTF;t!=null&&(t.dispose(),this._currentGLTF=null),this.currentAnimationAction!=null&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),this.shadow!=null&&(this.shadow.dispose(),this.shadow=null),this.element[Kc]=null,this.element[Jc]=null,this.element[Ls]=null}get currentGLTF(){return this._currentGLTF}setSize(e,t){if(!(this.width===e&&this.height===t)){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,this.externalRenderer!=null){const n=window.devicePixelRatio;this.externalRenderer.resize(e*n,t*n)}this.queueRender()}}markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){const t=new cn;e.traverse(n=>{const i=n;if(!i.material||!i.material.transparent)return;t.setFromObject(i);const a=t.getSize(iB),o=Math.min(a.x,a.y,a.z);Math.max(a.x,a.y,a.z)<Tu*o||this.markBakedShadow(i)})}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,n=new cn;this.boundingBox.getSize(this.size);for(const i of this.bakedShadows)n.setFromObject(i),!(n.min.y<e.y+this.size.y/Tu&&n.min.x<=e.x&&n.max.x>=t.x&&n.min.z<=e.z&&n.max.z>=t.z)&&(n.min.z<e.z+this.size.z/Tu&&n.min.x<=e.x&&n.max.x>=t.x&&n.min.y<=e.y&&n.max.y>=t.y||this.unmarkBakedShadow(i))}applyTransform(){const{model:e}=this;if(e==null)return;const t=Gi(this.element.orientation)[0].terms,n=mi(t[0]).number,i=mi(t[1]).number,s=mi(t[2]).number;e.quaternion.setFromEuler(new Vn(i,s,n,"YXZ"));const a=Gi(this.element.scale)[0].terms;e.scale.set(a[0].number,a[1].number,a[2].number)}updateBoundingBox(){const{model:e}=this;if(e==null)return;this.target.remove(e),this.findBakedShadows(e);const t=(n,i)=>n.expandByPoint(i);this.setBakedShadowVisibility(!1),this.boundingBox=mc(e,t,new cn),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach(n=>this.unmarkBakedShadow(n)),this.boundingBox=mc(e,t,new cn)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){const{model:e}=this;if(e==null)return;this.target.remove(e),this.setBakedShadowVisibility(!1);const{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget());const n=(s,a)=>Math.max(s,t.distanceToSquared(a));this.boundingSphere.radius=Math.sqrt(mc(e,n,0));const i=(s,a)=>{a.sub(t);const o=Math.sqrt(a.x*a.x+a.z*a.z);return Math.max(s,o/(this.idealCameraDistance()-Math.abs(a.y)))};this.idealAspect=mc(e,i,0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(const t of this.bakedShadows)t.visible=e}idealCameraDistance(){const e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){const t=Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect);return 2*Math.atan(t)*180/Math.PI}getNDC(e,t){if(this.xrCamera!=null)Qa.set(e/window.screen.width,t/window.screen.height);else{const n=this.element.getBoundingClientRect();Qa.set((e-n.x)/this.width,(t-n.y)/this.height)}return Qa.multiplyScalar(2).subScalar(1),Qa.y*=-1,Qa}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[at].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(this.groundedSkybox.parent!=null?wg:1)}setGroundedSkybox(){const e=Gi(this.element.skyboxHeight)[0].terms[0],t=mi(e).number,n=wg*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,n),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackgroun
vendor: 9,931 bytes, line 4599
4599d(this.groundedSkybox.map)}setTarget(e,t,n){this.goalTarget.set(-e,-t,-n)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}getDynamicTarget(){return this.target.position.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(tb)}updateTarget(e){const t=this.goalTarget,n=this.target.position;if(t.equals(n))return!1;{const i=this.boundingSphere.radius/10;let{x:s,y:a,z:o}=n;return s=this.targetDamperX.update(s,t.x,e,i),a=this.targetDamperY.update(a,t.y,e,i),o=this.targetDamperZ.update(o,t.z,e,i),this.groundedSkybox.position.x=-s,this.groundedSkybox.position.z=-o,this.target.position.set(s,a,o),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:n,z:i}=this.position;this.yaw=Math.atan2(e-n,t-i)}get model(){return this._model}set yaw(e){this.pivot.rotation.y=e,this.groundedSkybox.rotation.y=-e,this.queueRender()}get yaw(){return this.pivot.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(this.currentAnimationAction!=null){const e=Math.max(this.currentAnimationAction._loopCount,0);return this.currentAnimationAction.loop===fl&&(e&1)===1?this.duration-this.currentAnimationAction.time:this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return this.currentAnimationAction!=null&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return this.currentAnimationAction!=null}playAnimation(e=null,t=0,n=Gr,i=1/0){if(this._currentGLTF==null)return;const{animations:s}=this;if(s==null||s.length===0)return;let a=null;if(e!=null&&(a=this.animationsByName.get(e),a==null)){const o=parseInt(e);!isNaN(o)&&o>=0&&o<s.length&&(a=s[o])}a==null&&(a=s[0]);try{const{currentAnimationAction:o}=this,c=this.mixer.clipAction(a,this);this.currentAnimationAction=c,this.element.paused?this.mixer.stopAllAction():(c.paused=!1,o!=null&&c!==o?c.crossFadeFrom(o,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),c.setLoop(n,i),c.enabled=!0,c.clampWhenFinished=!0,c.play()}catch(o){console.error(o)}}appendAnimation(e="",t=Gr,n=1/0,i=1,s=1,a=!1,o=!1,c=!0,l=null,u=!1){if(this._currentGLTF==null||e===this.element.animationName)return;const{animations:h}=this;if(h==null||h.length===0)return;const d=e?this.animationsByName.get(e):null;if(d==null)return;if(typeof n=="string"?isNaN(parseFloat(n))?(n=1/0,console.warn(`Invalid repetitionCount value: ${n}. Using default: Infinity`)):(parseInt(n)<1&&console.warn(`Invalid repetitionCount value: ${n}. Using 1 as minimum.`),n=Math.max(parseInt(n),1)):typeof n=="number"&&n<1?(n=1,console.warn(`Invalid repetitionCount value: ${n}. Using 1 value as minimum.`)):console.warn(`Invalid repetitionCount value: ${n}. Using default: Infinity`),n===1&&t!==bo&&(t=bo),typeof i=="string"){const x=parseFloat(i);isNaN(x)||x<0||x>1?(i=1,console.warn(`Invalid weight value: ${i}. Using default: 1`)):i=x}if(typeof s=="string"){const x=parseFloat(s);isNaN(x)||x<0?(s=1,console.warn(`Invalid timeScale value: ${s}. Using default: 1`)):s=x}if(typeof l=="string"){const x=parseFloat(l);isNaN(x)?(l=null,console.warn(`Invalid time value: ${l}. Using default: 0 or previous time`)):l=x}const{shouldFade:f,duration:p}=this.parseFadeValue(a,!1,1.25),g=1.25;let m=!1,A=0;typeof o=="boolean"?(m=o,A=o?g:0):typeof o=="number"?(m=o>0,A=Math.max(o,0),o<0&&console.warn(`Invalid warp value: ${o}. Using default: false`)):typeof o=="string"&&(o.toLowerCase().trim()==="true"?(m=!0,A=g):o.toLowerCase().trim()==="false"?m=!1:isNaN(parseFloat(o))?console.warn(`Invalid warp value: ${o}. Using default: false`):(A=Math.max(parseFloat(o),0),m=A>0,A<=0&&console.warn(`Invalid warp value: ${o}. Using default: false`)));try{const x=this.mixer.existingAction(d)||this.mixer.clipAction(d,this),_=x.timeScale;u&&this.appendedAnimations.includes(e)&&(this.markedAnimations.map(b=>b.name).includes(e)||this.markedAnimations.push({name:e,loopMode:t,repetitionCount:n})),typeof l=="number"&&(x.time=Math.min(Math.max(l,0),d.duration)),f?x.fadeIn(p):i>=0&&(x.weight=Math.min(Math.max(i,0),1)),m?x.warp(c?_:0,s,A):x.timeScale=s,x.isRunning()||(x.time==d.duration&&x.stop(),x.setLoop(t,n),x.paused=!1,x.enabled=!0,x.clampWhenFinished=!0,x.play()),this.appendedAnimations.includes(e)||this.element[te].appendedAnimations.push(e)}catch(x){console.error(x)}}parseFadeValue(e,t=!0,n=1.5){const i=s=>s.toLowerCase().trim();if(typeof e=="boolean")return{shouldFade:e,duration:e?n:0};if(typeof e=="number"){const s=Math.max(e,0);return{shouldFade:s>0,duration:s}}if(typeof e=="string"){const s=i(e);if(s==="true")return{shouldFade:!0,duration:n};if(s==="false")return{shouldFade:!1,duration:0};const a=parseFloat(s);if(!isNaN(a)){const o=Math.max(a,0);return{shouldFade:o>0,duration:o}}}return console.warn(`Invalid fade value: ${e}. Using default: ${t}`),{shouldFade:t,duration:t?n:0}}detachAnimation(e="",t=!0){if(this._currentGLTF==null||e===this.element.animationName)return;const{animations:n}=this;if(n==null||n.length===0)return;const i=e?this.animationsByName.get(e):null;if(i==null)return;const{shouldFade:s,duration:a}=this.parseFadeValue(t,!0,1.5);try{const o=this.mixer.existingAction(i)||this.mixer.clipAction(i,this);s?o.fadeOut(a):o.stop(),this.element[te].appendedAnimations=this.element[te].appendedAnimations.filter(c=>c!==e)}catch(o){console.error(o)}}updateAnimationLoop(e="",t=Gr,n=1/0){if(this._currentGLTF==null||e===this.element.animationName)return;const{animations:i}=this;if(i==null||i.length===0)return;let s=null;if(e&&(s=this.animationsByName.get(e)),s!=null)try{const a=this.mixer.existingAction(s)||this.mixer.clipAction(s,this);a.stop(),a.setLoop(t,n),a.play()}catch(a){console.error(a)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){const e=this.shadow;if(e!=null){const t=this.element.arPlacement==="wall"?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){const t=this.shadow;t!=null&&t.needsUpdate==!0&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){this.shadow!=null&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if(this.shadowIntensity=e,this._currentGLTF!=null&&(this.setBakedShadowVisibility(),!(e<=0&&this.shadow==null))){if(this.shadow==null){const t=this.element.arPlacement==="wall"?"back":"bottom";this.shadow=new nB(this,this.shadowSoftness,t)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;const t=this.shadow;t?.setSoftness(e)}setShadowOffset(e){const t=this.shadow;t?.setOffset(e)}getHit(e=this){return Lc.intersectObject(e,!0).find(n=>n.object.visible&&!n.object.userData.noHit)}hitFromController(e,t=this){return Lc.setFromXRController(e),this.getHit(t)}hitFromPoint(e,t=this){return Lc.setFromCamera(e,this.getCamera()),this.getHit(t)}positionAndNormalFromPoint(e,t=this){var n;const i=this.hitFromPoint(e,t);if(i==null)return null;const s=i.point,a=i.face!=null?i.face.normal.clone().applyNormalMatrix(new Qe().getNormalMatrix(i.object.matrixWorld)):Lc.ray.direction.clone().multiplyScalar(-1),o=(n=i.uv)!==null&&n!==void 0?n:null;return{position:s,normal:a,uv:o}}surfaceFromPoint(e,t=this){const n=this.element.model;if(n==null)return null;const i=this.hitFromPoint(e,t);if(i==null||i.face==null)return null;const s=n[$d](i),{meshes:a,primitives:o}=s.mesh.userData.associations,c=new B,l=new B,u=new B,{a:h,b:d,c:f}=i.face,p=i.object;p.getVertexPosition(h,c),p.getVertexPosition(d,l),p.getVertexPosition(f,u);const g=new Rn(c,l,u),m=new B;return g.getBarycoord(p.worldToLocal(i.point),m),`${a} ${o} ${h} ${d} ${f} ${m.x.toFixed(3)} ${m.y.toFixed(3)} ${m.z.toFixed(3)}`}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element),this.updateSurfaceHotspot(e)}removeHotspot(e){this.target.remove(e)}forHotspots(e){const{children:t}=this.target;for(let n=0,i=t.length;n<i;n++){const s=t[n];s instanceof Db&&e(s)}}updateSurfaceHotspot(e){if(e.surface==null||this.element.model==null)return;const t=Gi(e.surface)[0].terms;if(t.length!=8){console.warn(e.surface+" does not have exactly 8 numbers.");return}const n=this.element.model[Bb](t[0].number,t[1].number);if(n==null){console.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");return}const i=n.mesh.geometry.attributes.position.count,s=new B(t[2].number,t[3].number,t[4].number);if(s.x>=i||s.y>=i||s.z>=i){console.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");return}const a=new B(t[5].number,t[6].number,t[7].number);e.mesh=n.mesh,e.tri=s,e.bary=a,e.updateSurface()}animateSurfaceHotspots(){this.element.paused||this.forHotspots(e=>{e.updateSurface()})}updateHotspotsVisibility(e){this.forHotspots(t=>{Ru.copy(e),Tg.setFromMatrixPosition(t.matrixWorld),Ru.sub(Tg),Rg.copy(t.normal).transformDirection(this.target.matrixWorld),Ru.dot(Rg)<0?t.hide():t.show()})}orientHotspots(e){this.forHotspots(t=>{t.orient(e)})}setHotspotsVisibility(e){this.forHotspots(t=>{t.visible=e})}updateSchema(e){var t;const{schemaElement:n,element:i}=this,{alt:s,poster:a,iosSrc:o}=i;if(e!=null){const c=[{"@type":"MediaObject",contentUrl:e,encodingFormat:((t=e.split(".").pop())===null||t===void 0?void 0:t.toLowerCase())==="gltf"?"model/gltf+json":"model/gltf-binary"}];o&&c.push({"@type":"MediaObject",contentUrl:o,encodingFormat:"model/vnd.usdz+zip"});const l={"@context":"http://schema.org/","@type":"3DModel",image:a??void 0,name:s??void 0,encoding:c};n.textContent=JSON.stringify(l),document.head.appendChild(n)}else n.parentElement!=null&&n.parentElement.removeChild(n)}}
vendor: 3,729 bytes, line 4599
4599class rB extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){const t={progress:0,completed:!1};return this.ongoingActivities.add(t),this.ongoingActivityCount===1&&this.announceTotalProgress(t,0,e),n=>{let i;return i=Math.max(pi(n,0,1),t.progress),i!==t.progress&&this.announceTotalProgress(t,i,e),t.progress}}announceTotalProgress(e,t,n){let i=0,s=0;t==1&&(e.completed=!0);for(const c of this.ongoingActivities){const{progress:l}=c;i+=1-l,c.completed&&s++}const a=e.progress;e.progress=t,this.totalProgress+=(t-a)*(1-this.totalProgress)/i;const o=s===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:o,reason:n}})),s===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var ql=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Bg,Dg,Lg,Fg,Pg,Ng,Ug,Og,kg,Qg,Gg,Hg,zg;const aB=10,oB=50,cB=0,lB=300,hB=150,ls=document.createElement("canvas"),Bu=Symbol("fallbackResizeHandler"),Vg=Symbol("defaultAriaLabel"),Fc=Symbol("resizeObserver"),Ir=Symbol("clearModelTimeout"),Du=Symbol("onContextLost"),Mr=Symbol("loaded"),Lu=Symbol("status"),Fu=Symbol("onFocus"),Pu=Symbol("onBlur"),Dr=Symbol("updateSize"),Pc=Symbol("intersectionObserver"),Fs=Symbol("isElementInViewport"),Il=Symbol("announceModelVisibility"),Ur=Symbol("ariaLabel"),jd=Symbol("altDefaulted"),Ga=Symbol("statusElement"),Ml=Symbol("updateStatus"),no=Symbol("loadedTime"),Wr=Symbol("updateSource"),Wg=Symbol("markLoaded"),Zc=Symbol("container"),Kn=Symbol("input"),Kd=Symbol("canvas"),te=Symbol("scene"),Kt=Symbol("needsRender"),gi=Symbol("tick"),xi=Symbol("onModelLoad"),wl=Symbol("onResize"),at=Symbol("renderer"),Ys=Symbol("progressTracker"),qg=Symbol("getLoaded"),js=Symbol("getModelIsVisible"),ca=Symbol("shouldAttemptPreload"),ss=r=>({x:r.x,y:r.y,z:r.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),Jd=r=>({u:r.x,v:r.y,toString(){return`${this.u} ${this.v}`}});class Po extends Ps{static get is(){return"model-viewer"}static set modelCacheSize(e){mn[ns].evictionThreshold=e}static get modelCacheSize(){return mn[ns].evictionThreshold}static set minimumRenderScale(e){e>1&&console.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&console.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Gn.singleton.minScale=e}static get minimumRenderScale(){return Gn.singleton.minScale}get loaded(){return this[qg]()}get[(Bg=Fs,Dg=Mr,Lg=no,Fg=Lu,Pg=Ir,Ng=Bu,Ug=Il,Og=Fc,kg=Pc,Qg=Ys,at)](){return Gn.singleton}get modelIsVisible(){return this[js]()}constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[Bg]=!1,this[Dg]=!1,this[Lg]=0,this[Fg]="",this[Pg]=null,this[Ng]=MA(()=>{const i=this.getBoundingClientRect();this[Dr](i)},oB),this[Ug]=MA(i=>{const s=this.modelIsVisible;s!==i&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:s}}))},cB),this[Og]=null,this[kg]=null,this[Qg]=new rB,this[Gg]=()=>{this[Ga].textContent=this[Lu]},this[Hg]=()=>{this[Ga].textContent=""},this[zg]=i=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:i.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;Lw(e),this[Zc]=e.querySelector(".container"),this[Kn]=e.querySelector(".userIn
4599put"),this[Kd]=e.querySelector("canvas"),this[Ga]=e.querySelector("#status"),this[Vg]=this[Kn].getAttribute("aria-label");let t,n;if(this.isConnected){const i=this.getBoundingClientRect();t=i.width,n=i.height}else t=lB,n=hB;this[te]=new sB({canvas:this[Kd],element:this,width:t,height:n}),Promise.resolve().then(()=>{this[Dr](this.getBoundingClientRect())}),Ph&&(this[Fc]=new ResizeObserver(i=>{if(!this[at].isPresenting)for(let s of i)s.target===this&&this[Dr](s.contentRect)})),Nh?this[Pc]=new IntersectionObserver(i=>{for(let s of i)if(s.target===this){const a=this.modelIsVisible;this[Fs]=s.isIntersecting,this[Il](a),this[Fs]&&!this.loaded&&this[Wr]()}},{root:null,rootMargin:"0px",threshold:1e-5}):this[Fs]=!0}connectedCallback(){super.connectedCallback&&super.connectedCallback(),Ph?this[Fc].observe(this):self.addEventListener("resize",this[Bu]),Nh&&this[Pc].observe(this),this.addEventListener("focus",this[Fu]),this.addEventListener("blur",this[Pu]);const e=this[at];e.addEventListener("contextlost",this[Du]),e.registerScene(this[te]),this[Ir]!=null&&(self.clearTimeout(this[Ir]),this[Ir]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),Ph?this[Fc].unobserve(this):self.removeEventListener("resize",this[Bu]),Nh&&this[Pc].unobserve(this),this.removeEventListener("focus",this[Fu]),this.removeEventListener("blur",this[Pu]);const e=this[at];e.removeEventListener("contextlost",this[Du]),e.unregisterScene(this[te]),this[Ir]=self.setTimeout(()=>{this[te].dispose(),this[Ir]=null},aB)}updated(e){super.updated(e),e.has("src")&&(this.src==null?(this[Mr]=!1,this[no]=0,this[te].reset()):this.src!==this[te].url&&(this[Mr]=!1,this[no]=0,this[Wr]())),e.has("alt")&&this[Kn].setAttribute("aria-label",this[Ur]),e.has("generateSchema")&&(this.generateSchema?this[te].updateSchema(this.src):this[te].updateSchema(null))}toDataURL(e,t){return this[at].displayCanvas(this[te]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,n=e?e.qualityArgument:void 0,i=e?e.idealAspect:void 0,{width:s,height:a,idealAspect:o,aspect:c}=this[te],{dpr:l,scaleFactor:u}=this[at];let h=s*u*l,d=a*u*l,f=0,p=0;if(i===!0)if(o>c){const g=d;d=Math.round(h/o),p=(g-d)/2}else{const g=h;h=Math.round(d*o),f=(g-h)/2}ls.width=h,ls.height=d;try{return new Promise(async(g,m)=>{ls.getContext("2d").drawImage(this[at].displayCanvas(this[te]),f,p,h,d,0,0,h,d),ls.toBlob(A=>{if(!A)return m(new Error("Unable to retrieve canvas blob"));g(A)},t,n)})}finally{this[Dr]({width:s,height:a})}}registerEffectComposer(e){e.setRenderer(this[at].threeRenderer),e.setMainCamera(this[te].getCamera()),e.setMainScene(this[te]),this[te].effectRenderer=e}unregisterEffectComposer(){this[te].effectRenderer=null}registerRenderer(e){this[te].externalRenderer=e}unregisterRenderer(){this[te].externalRenderer=null}get[Ur](){return this[jd]}get[jd](){return this.alt==null||this.alt==="null"?this[Vg]:this.alt}[qg](){return this[Mr]}[js](){return this.loaded&&this[Fs]}[ca](){return!!this.src&&this[Fs]}[Dr]({width:e,height:t}){e===0||t===0||(this[Zc].style.width=`${e}px`,this[Zc].style.height=`${t}px`,this[wl]({width:e,height:t}))}[gi](e,t){var n;(n=this[te].effectRenderer)===null||n===void 0||n.beforeRender(e,t)}[Wg](){this[Mr]||(this[Mr]=!0,this[no]=performance.now())}[Kt](){this[te].queueRender()}[xi](){}[Ml](e){this[Lu]=e;const t=this.getRootNode();t!=null&&t.activeElement===this&&this[Ga].textContent!=e&&(this[Ga].textContent=e)}[(Gg=Fu,Hg=Pu,wl)](e){this[te].setSize(e.width,e.height)}async[(zg=Du,Wr)](){const e=this[te];if(this.loaded||!this[ca]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[Ml]("Loading"),e.stopAnimation();const t=this[Ys].beginActivity("model-load"),n=this.src;try{const i=e.setSource(n,a=>t(pi(a,0,1)*.95)),s=this[El]();await Promise.all([i,s]),this[Wg](),this[xi](),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("before-render"))}),await new Promise(a=>{const o=setTimeout(()=>{console.warn("rAF timed out in updateSource"),a()},500);requestAnimationFrame(()=>{requestAnimationFrame(()=>{clearTimeout(o),a()})})}),this.dispatchEvent(new CustomEvent("load",{detail:{url:n}}))}catch(i){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:i}}))}finally{t(1)}}}ql([De({type:String})],Po.prototype,"alt",void 0);ql([De({type:String})],Po.prototype,"src",void 0);ql([De({type:Boolean,attribute:"with-credentials"})],Po.prototype,"withCredentials",void 0);ql([De({type:Boolean,attribute:"generate-schema"})],Po.prototype,"generateSchema",void 0);var Nu=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const Xg=1e3,Nc=Symbol("changeAnimation"),$g=Symbol("appendAnimation"),Yg=Symbol("detachAnimation"),Tn=Symbol("paused"),uB={repetitions:1/0,pingpong:!1},dB={pingpong:!1,repetitions:null,weight:1,timeScale:1,fade:!1,warp:!1,relativeWarp:!0,time:null},fB={fade:!0},pB=r=>{var e;class t extends r{constructor(...i){super(i),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[e]=!0,this[te].subscribeMixerEvent("loop",s=>{const a=s.action._loopCount,o=s.action._clip.name,c=s.action._clip.uuid,l=this[te].markedAnimations.find(u=>u.name===o);if(l){this[te].updateAnimationLoop(l.name,l.loopMode,l.repetitionCount);const u=this[te].markedAnimations.filter(h=>h.name!==o);this[te].markedAnimations=u}this.dispatchEvent(new CustomEvent("loop",{detail:{count:a,name:o,uuid:c}}))}),this[te].subscribeMixerEvent("finished",s=>{if(!this[te].appendedAnimations.includes(s.action._clip.name))this[Tn]=!0;else{const a=this[te].appendedAnimations.filter(o=>o!==s.action._clip.name);this[te].appendedAnimations=a}this.dispatchEvent(new CustomEvent("finished"))})}get availableAnimations(){return this.loaded?this[te].animationNames:[]}get duration(){return this[te].duration}get paused(){return this[Tn]}get currentTime(){return this[te].animationTime}get appendedAnimations(){return this[te].appendedAnimations}set currentTime(i){this[te].animationTime=i,this[Kt]()}get timeScale(){return this[te].animationTimeScale}set timeScale(i){this[te].animationTimeScale=i}pause(){this[Tn]||(this[Tn]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(i){this.availableAnimations.length>
vendor: 4,598 bytes, line 4599
45990&&(this[Tn]=!1,this[Nc](i),this.dispatchEvent(new CustomEvent("play")))}appendAnimation(i,s){this.availableAnimations.length>0&&(this[Tn]=!1,this[$g](i,s),this.dispatchEvent(new CustomEvent("append-animation")))}detachAnimation(i,s){this.availableAnimations.length>0&&(this[Tn]=!1,this[Yg](i,s),this.dispatchEvent(new CustomEvent("detach-animation")))}[(e=Tn,xi)](){super[xi](),this[Tn]=!0,this.animationName!=null&&this[Nc](),this.autoplay&&this.play()}[gi](i,s){super[gi](i,s),!(this[Tn]||!this[js]()&&!this[at].isPresenting)&&(this[te].updateAnimation(s/Xg),this[Kt]())}updated(i){super.updated(i),i.has("autoplay")&&this.autoplay&&this.play(),i.has("animationName")&&this[Nc]()}[Nc](i=uB){var s;const a=(s=i.repetitions)!==null&&s!==void 0?s:1/0,o=i.pingpong?fl:a===1?bo:Gr;this[te].playAnimation(this.animationName,this.animationCrossfadeDuration/Xg,o,a),this[Tn]&&(this[te].updateAnimation(0),this[Kt]())}[$g](i="",s=dB){var a;const o=(a=s.repetitions)!==null&&a!==void 0?a:1/0,c=s.pingpong?fl:o===1?bo:Gr,l=!!s.repetitions||"pingpong"in s;this[te].appendAnimation(i||this.animationName,c,o,s.weight,s.timeScale,s.fade,s.warp,s.relativeWarp,s.time,l),this[Tn]&&(this[te].updateAnimation(0),this[Kt]())}[Yg](i="",s=fB){this[te].detachAnimation(i||this.animationName,s.fade),this[Tn]&&(this[te].updateAnimation(0),this[Kt]())}}return Nu([De({type:Boolean})],t.prototype,"autoplay",void 0),Nu([De({type:String,attribute:"animation-name"})],t.prototype,"animationName",void 0),Nu([De({type:Number,attribute:"animation-crossfade-duration"})],t.prototype,"animationCrossfadeDuration",void 0),t};const Ms=Symbol("hotspotMap"),Uu=Symbol("mutationCallback"),Ha=Symbol("observer"),Ou=Symbol("addHotspot"),jg=Symbol("removeHotspot"),ku=new Ue,AB=r=>{var e,t,n;class i extends r{constructor(){super(...arguments),this[e]=new Map,this[t]=a=>{a.forEach(o=>{(!(o instanceof MutationRecord)||o.type==="childList")&&(o.addedNodes.forEach(c=>{this[Ou](c)}),o.removedNodes.forEach(c=>{this[jg](c)}),this[Kt]())})},this[n]=new MutationObserver(this[Uu])}connectedCallback(){super.connectedCallback();for(let o=0;o<this.children.length;++o)this[Ou](this.children[o]);const{ShadyDOM:a}=self;a==null?this[Ha].observe(this,{childList:!0}):this[Ha]=a.observeChildren(this,this[Uu])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:a}=self;a==null?this[Ha].disconnect():a.unobserveChildren(this[Ha])}[(e=Ms,t=Uu,n=Ha,xi)](){super[xi]();const a=this[te];a.forHotspots(o=>{a.updateSurfaceHotspot(o)})}[gi](a,o){super[gi](a,o);const c=this[te],{annotationRenderer:l}=c,u=c.getCamera();c.shouldRender()&&(c.animateSurfaceHotspots(),c.updateHotspotsVisibility(u.position),l.domElement.style.display="",l.render(c,u))}updateHotspot(a){const o=this[Ms].get(a.name);o!=null&&(o.updatePosition(a.position),o.updateNormal(a.normal),o.surface=a.surface,this[te].updateSurfaceHotspot(o),this[Kt]())}queryHotspot(a){const o=this[Ms].get(a);if(o==null)return null;const c=ss(o.position),l=ss(o.normal),u=o.facingCamera,h=this[te],d=h.getCamera(),f=new B;f.setFromMatrixPosition(o.matrixWorld),f.project(d);const p=h.width/2,g=h.height/2;f.x=f.x*p+p,f.y=-(f.y*g)+g;const m=ss(new B(f.x,f.y,f.z));return!Number.isFinite(m.x)||!Number.isFinite(m.y)?null:{position:c,normal:l,canvasPosition:m,facingCamera:u}}positionAndNormalFromPoint(a,o){const c=this[te],l=c.getNDC(a,o),u=c.positionAndNormalFromPoint(l);if(u==null)return null;ku.copy(c.target.matrixWorld).invert();const h=ss(u.position.applyMatrix4(ku)),d=ss(u.normal.transformDirection(ku));let f=null;return u.uv!=null&&(f=Jd(u.uv)),{position:h,normal:d,uv:f}}surfaceFromPoint(a,o){const c=this[te],l=c.getNDC(a,o);return c.surfaceFromPoint(l)}[Ou](a){if(!(a instanceof HTMLElement&&a.slot.indexOf("hotspot")===0))return;let o=this[Ms].get(a.slot);o!=null?o.increment():(o=new Db({name:a.slot,position:a.dataset.position,normal:a.dataset.normal,surface:a.dataset.surface}),this[Ms].set(a.slot,o),this[te].addHotspot(o)),this[te].queueRender()}[jg](a){if(!(a instanceof HTMLElement))return;const o=this[Ms].get(a.slot);o&&(o.decrement()&&(this[te].removeHotspot(o),this[Ms].delete(a.slot)),this[te].queueRender())}}return i};var un=Uint8Array,Ln=Uint16Array,Uf=Int32Array,Of=new un([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),kf=new un([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Kg=new un([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Lb=function(r,e){for(var t=new Ln(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];for(var i=new Uf(t[30]),n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)i[s]=s-t[n]<<5|n;return{b:t,r:i}
vendor: 4,126 bytes, line 4599
4599},Fb=Lb(Of,2),mB=Fb.b,Zd=Fb.r;mB[28]=258,Zd[258]=28;var gB=Lb(kf,0),Jg=gB.r,ef=new Ln(32768);for(var wt=0;wt<32768;++wt){var es=(wt&43690)>>1|(wt&21845)<<1;es=(es&52428)>>2|(es&13107)<<2,es=(es&61680)>>4|(es&3855)<<4,ef[wt]=((es&65280)>>8|(es&255)<<8)>>1}var uo=(function(r,e,t){for(var n=r.length,i=0,s=new Ln(e);i<n;++i)r[i]&&++s[r[i]-1];var a=new Ln(e);for(i=1;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;var o;if(t){o=new Ln(1<<e);var c=15-e;for(i=0;i<n;++i)if(r[i])for(var l=i<<4|r[i],u=e-r[i],h=a[r[i]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)o[ef[h]>>c]=l}else for(o=new Ln(n),i=0;i<n;++i)r[i]&&(o[i]=ef[a[r[i]-1]++]>>15-r[i]);return o}),Ks=new un(288);for(var wt=0;wt<144;++wt)Ks[wt]=8;for(var wt=144;wt<256;++wt)Ks[wt]=9;for(var wt=256;wt<280;++wt)Ks[wt]=7;for(var wt=280;wt<288;++wt)Ks[wt]=8;var Tl=new un(32);for(var wt=0;wt<32;++wt)Tl[wt]=5;var xB=uo(Ks,9,0),bB=uo(Tl,5,0),Pb=function(r){return(r+7)/8|0},Nb=function(r,e,t){return(t==null||t>r.length)&&(t=r.length),new un(r.subarray(e,t))},_B=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Xl=function(r,e,t){var n=new Error(e||_B[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,Xl),!t)throw n;return n},Fi=function(r,e,t){t<<=e&7;var n=e/8|0;r[n]|=t,r[n+1]|=t>>8},za=function(r,e,t){t<<=e&7;var n=e/8|0;r[n]|=t,r[n+1]|=t>>8,r[n+2]|=t>>16},Qu=function(r,e){for(var t=[],n=0;n<r.length;++n)r[n]&&t.push({s:n,f:r[n]});var i=t.length,s=t.slice();if(!i)return{t:Ob,l:0};if(i==1){var a=new un(t[0].s+1);return a[t[0].s]=1,{t:a,l:1}}t.sort(function(v,C){return v.f-C.f}),t.push({s:-1,f:25001});var o=t[0],c=t[1],l=0,u=1,h=2;for(t[0]={s:-1,f:o.f+c.f,l:o,r:c};u!=i-1;)o=t[t[l].f<t[h].f?l++:h++],c=t[l!=u&&t[l].f<t[h].f?l++:h++],t[u++]={s:-1,f:o.f+c.f,l:o,r:c};for(var d=s[0].s,n=1;n<i;++n)s[n].s>d&&(d=s[n].s);var f=new Ln(d+1),p=tf(t[u-1],f,0);if(p>e){var n=0,g=0,m=p-e,A=1<<m;for(s.sort(function(C,M){return f[M.s]-f[C.s]||C.f-M.f});n<i;++n){var x=s[n].s;if(f[x]>e)g+=A-(1<<p-f[x]),f[x]=e;else break}for(g>>=m;g>0;){var _=s[n].s;f[_]<e?g-=1<<e-f[_]++-1:++n}for(;n>=0&&g;--n){var b=s[n].s;f[b]==e&&(--f[b],++g)}p=e}return{t:new un(f),l:p}},tf=function(r,e,t){return r.s==-1?Math.max(tf(r.l,e,t+1),tf(r.r,e,t+1)):e[r.s]=t},Zg=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new Ln(++e),n=0,i=r[0],s=1,a=function(c){t[n++]=c},o=1;o<=e;++o)if(r[o]==i&&o!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=r[o]}return{c:t.subarray(0,n),n:e}},Va=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},Ub=function(r,e,t){var n=t.length,i=Pb(e+2);r[i]=n&255,r[i+1]=n>>8,r[i+2]=r[i]^255,r[i+3]=r[i+1]^255;for(var s=0;s<n;++s)r[i+s+4]=t[s];return(i+4+n)*8},e0=function(r,e,t,n,i,s,a,o,c,l,u){Fi(e,u++,t),++i[256];for(var h=Qu(i,15),d=h.t,f=h.l,p=Qu(s,15),g=p.t,m=p.l,A=Zg(d),x=A.c,_=A.n,b=Zg(g),v=b.c,C=b.n,M=new Ln(19),w=0;w<x.length;++w)++M[x[w]&31];for(var w=0;w<v.length;++w)++M[v[w]&31];for(var E=Qu(M,7),S=E.t,R=E.l,N=19;N>4&&!S[Kg[N-1]];--N);var F=l+5<<3,P=Va(i,Ks)+Va(s,Tl)+a,Q=Va(i,d)+Va(s,g)+a+14+3*N+Va(M,S)+2*M[16]+3*M[17]+7*M[18];if(c>=0&&F<=P&&F<=Q)return Ub(e,u,r.subarray(c,c+l));var U,G,q,J;if(Fi(e,u,1+(Q<P)),u+=2,Q<P){U=uo(d,f,0),G=d,q=uo(g,m,0),J=g;var Z=uo(S,R,0);Fi(e,u,_-257),Fi(e,u+5,C-1),Fi(e,u+10,N-4),u+=14;for(var w=0;w<N;++w)Fi(e,u+3*w,S[Kg[w]]);u+=3*N;for(var Y=[x,v],re=0;re<2;++re)for(var Ae=Y[re],w=0;w<Ae.length;++w){var He=Ae[w]&31;Fi(e,u,Z[He]),u+=S[He],He>15&&(Fi(e,u,Ae[w]>>5&127),u+=Ae[w]>>12)}}else U=xB,G=Ks,q=bB,J=Tl;for(var w=0;w<o;++w){var ze=n[w];if(ze>255){var He=ze>>18&31;za(e,u,U[He+257]),u+=G[He+257],He>7&&(Fi(e,u,ze>>23&31),u+=Of[He]);var X=ze&31;za(e,u,q[X]),u+=J[X],X>3&&(za(e,u,ze>>5&8191),u+=kf[X])}else za(e,u,U[ze]),u+=G[ze]}return za(e,u,U[256]),u+G[256]},vB=new Uf([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ob=new un(0),E
vendor: 4,835 bytes, line 4599
4599B=function(r,e,t,n,i,s){var a=s.z||r.length,o=new un(n+a+5*(1+Math.ceil(a/7e3))+i),c=o.subarray(n,o.length-i),l=s.l,u=(s.r||0)&7;if(e){u&&(c[0]=s.r>>3);for(var h=vB[e-1],d=h>>13,f=h&8191,p=(1<<t)-1,g=s.p||new Ln(32768),m=s.h||new Ln(p+1),A=Math.ceil(t/3),x=2*A,_=function(it){return(r[it]^r[it+1]<<A^r[it+2]<<x)&p},b=new Uf(25e3),v=new Ln(288),C=new Ln(32),M=0,w=0,E=s.i||0,S=0,R=s.w||0,N=0;E+2<a;++E){var F=_(E),P=E&32767,Q=m[F];if(g[P]=Q,m[F]=P,R<=E){var U=a-E;if((M>7e3||S>24576)&&(U>423||!l)){u=e0(r,c,0,b,v,C,w,S,N,E-N,u),S=M=w=0,N=E;for(var G=0;G<286;++G)v[G]=0;for(var G=0;G<30;++G)C[G]=0}var q=2,J=0,Z=f,Y=P-Q&32767;if(U>2&&F==_(E-Y))for(var re=Math.min(d,U)-1,Ae=Math.min(32767,E),He=Math.min(258,U);Y<=Ae&&--Z&&P!=Q;){if(r[E+q]==r[E+q-Y]){for(var ze=0;ze<He&&r[E+ze]==r[E+ze-Y];++ze);if(ze>q){if(q=ze,J=Y,ze>re)break;for(var X=Math.min(Y,ze-2),ee=0,G=0;G<X;++G){var ge=E-Y+G&32767,Ge=g[ge],_e=ge-Ge&32767;_e>ee&&(ee=_e,Q=ge)}}}P=Q,Q=g[P],Y+=P-Q&32767}if(J){b[S++]=268435456|Zd[q]<<18|Jg[J];var tt=Zd[q]&31,kt=Jg[J]&31;w+=Of[tt]+kf[kt],++v[257+tt],++C[kt],R=E+q,++M}else b[S++]=r[E],++v[r[E]]}}for(E=Math.max(E,R);E<a;++E)b[S++]=r[E],++v[r[E]];u=e0(r,c,l,b,v,C,w,S,N,E-N,u),l||(s.r=u&7|c[u/8|0]<<3,u-=7,s.h=m,s.p=g,s.i=E,s.w=R)}else{for(var E=s.w||0;E<a+l;E+=65535){var Ke=E+65535;Ke>=a&&(c[u/8|0]=l,Ke=a),u=Ub(c,u+1,r.subarray(E,Ke))}s.i=a}return Nb(o,0,n+Pb(u)+i)},yB=(function(){for(var r=new Int32Array(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(t&1&&-306674912)^t>>>1;r[e]=t}return r})(),SB=function(){var r=-1;return{p:function(e){for(var t=r,n=0;n<e.length;++n)t=yB[t&255^e[n]]^t>>>8;r=t},d:function(){return~r}}},CB=function(r,e,t,n,i){if(!i&&(i={l:1},e.dictionary)){var s=e.dictionary.subarray(-32768),a=new un(s.length+r.length);a.set(s),a.set(r,s.length),r=a,i.w=s.length}return EB(r,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+e.mem,t,n,i)},kb=function(r,e){var t={};for(var n in r)t[n]=r[n];for(var n in e)t[n]=e[n];return t},Zt=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function IB(r,e){return CB(r,e||{},0,0)}var Qb=function(r,e,t,n){for(var i in r){var s=r[i],a=e+i,o=n;Array.isArray(s)&&(o=kb(n,s[1]),s=s[0]),s instanceof un?t[a]=[s,o]:(t[a+="/"]=[new un(0),o],Qb(s,a,t,n))}},t0=typeof TextEncoder<"u"&&new TextEncoder,MB=typeof TextDecoder<"u"&&new TextDecoder,wB=0;try{MB.decode(Ob,{stream:!0}),wB=1}catch{}function Rl(r,e){var t;if(t0)return t0.encode(r);for(var n=r.length,i=new un(r.length+(r.length>>1)),s=0,a=function(l){i[s++]=l},t=0;t<n;++t){if(s+5>i.length){var o=new un(s+8+(n-t<<1));o.set(i),i=o}var c=r.charCodeAt(t);c<128||e?a(c):c<2048?(a(192|c>>6),a(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|r.charCodeAt(++t)&1023,a(240|c>>18),a(128|c>>12&63),a(128|c>>6&63),a(128|c&63)):(a(224|c>>12),a(128|c>>6&63),a(128|c&63))}return Nb(i,0,s)}var nf=function(r){var e=0;if(r)for(var t in r){var n=r[t].length;n>65535&&Xl(9),e+=n+4}return e},n0=function(r,e,t,n,i,s,a,o){var c=n.length,l=t.extra,u=o&&o.length,h=nf(l);Zt(r,e,a!=null?33639248:67324752),e+=4,a!=null&&(r[e++]=20,r[e++]=t.os),r[e]=20,e+=2,r[e++]=t.flag<<1|(s<0&&8),r[e++]=i&&8,r[e++]=t.compression&255,r[e++]=t.compression>>8;var d=new Date(t.mtime==null?Date.now():t.mtime),f=d.getFullYear()-1980;if((f<0||f>119)&&Xl(10),Zt(r,e,f<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),e+=4,s!=-1&&(Zt(r,e,t.crc),Zt(r,e+4,s<0?-s-2:s),Zt(r,e+8,t.size)),Zt(r,e+12,c),Zt(r,e+14,h),e+=16,a!=null&&(Zt(r,e,u),Zt(r,e+6,t.attrs),Zt(r,e+10,a),e+=14),r.set(n,e),e+=c,h)for(var p in l){var g=l[p],m=g.length;Zt(r,e,+p),Zt(r,e+2,m),r.set(g,e+4),e+=4+m}return u&&(r.set(o,e),e+=u),e},TB=function(r,e,t,n,i){Zt(r,e,101010256),Zt(r,e+8,t),Zt(r,e+10,t),Zt(r,e+12,n),Zt(r,e+16,i)};function RB(r,e){e||(e={});var t={},n=[];Qb(r,"",t,e);var i=0,s=0;for(var a in t){var o=t[a],c=o[0],l=o[1],u=l.level==0?0:8,h=Rl(a),d=h.length,f=l.comment,p=f&&Rl(f),g=p&&p.length,m=nf(l.extra);d>65535&&Xl(11);var A=u?IB(c,l):c,x=A.length,_=SB();_.p(c),n.push(kb(l,{size:c.length,crc:_.d(),c:A,f:h,m:p,u:d!=a.length||p&&f.length!=g,o:i,compression:u})),i+=30+d+m+x,s+=76+2*(d+m)+(g||0)+x}for(var b=new un(s+22),v=i,C=s-i,M=0;M<n.length;++M){var h=n[M];n0(b,h.o,h,h.f,h.u,h.c.length);var w=30+h.f.length+nf(h.extra);b.set(h.c,h.o+w),n0(b,i,h,h.f,h.u,h.c.length,h.o,h.m),i+=16+w+(h.m?h.m.length:0)}return TB(b,i,n.length,C,v),b}class Bn{constructor(e,t="",n=[],i=[]){this.name=e,this.type=t,this.metadata=n,this.properties=i,this.children=[]}addMetadata(e,t){this.metadata.push({key:e,value:t})}addProperty(e,t=[]){this.properties.push({property:e,metadata:t})}addChild(e){this.children.push(e)}toString(e=0){const t=" ".repeat(e),n=this.metadata.map(u=>{const h=u.key,d=u.value;if(Array.isArray(d)){const f=[];return f.push(`${h} = {`),d.forEach(p=>{f.push(`${t} ${p}`)}
4599),f.push(`${t} }`),f.join(` 4600`)}else return`${h} = ${d}`}),i=n.length?` ( 4601${n.map(u=>`${t} ${u}`).join(` 4602`)} 4603${t})`:"",s=this.properties.map(u=>{const h=u.property,d=u.metadata.length?` ( 4604${u.metadata.map(f=>`${t} ${f}`).join(` 4605`)} 4606${t} )`:"";return`${t} ${h}${d}`}),a=this.children.map(u=>u.toString(e+1)),o=[];if(s.length>0&&o.push(...s),a.length>0){s.length>0&&o.push("");for(let u=0;u<a.length;u++)o.push(a[u]),u<a.length-1&&o.push("")}const c=o.join(` 4607`),l=this.type?this.type+" ":"";return`${t}def ${l}"${this.name}"${i} 4608${t}{ 4609${c} 4610${t}}`}}class BB{constructor(){this.textureUtils=null}setTextureUtils(e){this.textureUtils=e}parse(e,t,n,i){this.parseAsync(e,i).then(t).catch(n)}async parseAsync(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},includeAnchoringProperties:!0,onlyVisible:!0,quickLookCompatible:!1,maxTextureSize:1024},t);const n=new Set,i={},s="model.usda";i[s]=null;const a=new Bn("Root","Xform"),o=new Bn("Scenes","Scope");o.addMetadata("kind",'"sceneLibrary"'),a.addChild(o);const c="Scene",l=new Bn(c,"Xform");l.addMetadata("customData",["bool preliminary_collidesWithEnvironment = 0",`string sceneName = "${c}"`]),l.addMetadata("sceneName",`"${c}"`),t.includeAnchoringProperties&&(l.addProperty(`token preliminary:anchoring:type = "${t.ar.anchoring.type}"`),l.addProperty(`token preliminary:planeAnchoring:alignment = "${t.ar.planeAnchoring.alignment}"`)),o.addChild(l);let u;const h={},d={};zb(e,l,h,n,i,t);const f=kB(h,d,t.quickLookCompatible);u=Hb()+` 4611`+a.toString()+` 4612 4613`+f.toString(),i[s]=Rl(u),u=null;for(const g in d){let m=d[g];if(m.isCompressedTexture===!0){if(this.textureUtils===null)throw new Error("THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.");m=await this.textureUtils.decompress(m)}const A=DB(m.image,m.flipY,t.maxTextureSize),x=await new Promise(_=>A.toBlob(_,"image/png",1));i[`textures/Texture_${g}.png`]=new Uint8Array(await x.arrayBuffer())}let p=0;for(const g in i){const m=i[g],A=34+g.length;p+=A;const x=p&63;if(x!==4){const _=64-x,b=new Uint8Array(_);i[g]=[m,{extra:{12345:b}}]}p=m.length}return RB(i,{level:0})}}function Gb(r,e){let t=r.name;return t=t.replace(/[^A-Za-z0-9_]/g,""),/^[0-9]/.test(t)&&(t="_"+t),t===""&&(r.isCamera?t="Camera":t="Object"),e.has(t)&&(t=t+"_"+r.id),e.add(t),t}function DB(r,e,t){if(typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&r instanceof ImageBitmap){const n=t/Math.max(r.width,r.height),i=document.createElement("canvas");i.width=r.width*Math.min(1,n),i.height=r.height*Math.min(1,n);const s=i.getContext("2d");return e===!0&&(s.translate(0,i.height),s.scale(1,-1)),s.drawImage(r,0,0,i.width,i.height),i}else throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const Sn=7;function Hb(){return`#usda 1.0 4614( 4615 customLayerData = { 4616 string creator = "Three.js USDZExporter" 4617 } 4618 defaultPrim = "Root" 4619 metersPerUnit = 1 4620 upAxis = "Y" 4621) 4622`}function zb(r,e,t,n,i,s){for(let a=0,o=r.children.length;a<o;a++){const c=r.children[a];if(c.visible===!1&&s.onlyVisible===!0)continue;let l;if(c.isMesh){const u=c.geometry,h=c.material;if(h.isMeshStandardMaterial){const d="geometries/Geometry_"+u.id+".usda";if(!(d in i)){const f=FB(u);i[d]=Rl(Hb()+` 4623`+f.toString())}h.uuid in t||(t[h.uuid]=h),l=LB(c,u,t[h.uuid],n)}else console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",c)}else c.isCamera?l=HB(c,n):l=Vb(c,n);l&&(e.addChild(l),zb(c,l,t,n,i,s))}}function Vb(r,e){const t=Gb(r,e),n=Wb(r.matrix);r.matrix.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",r);const i=new Bn(t,"Xform");return i.addProperty(`matrix4d xformOp:transform = ${n}`),i.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]'),i}function LB(r,e,t,n){const i=Vb(r,n);return i.addMetadata("prepend references",`@./geometries/Geometry_${e.id}.usda@</Geometry>`),i.addMetadata("prepend apiSchemas",'["MaterialBindingAPI"]'),i.addProperty(`rel material:binding = </Materials/Material_${t.id}>`),i}function Wb(r){const e=r.elements;return`( ${Uc(e,0)}, ${Uc(e,4)}, ${Uc(e,8)}, ${Uc(e,12)} )`}function Uc(r,e){return`(${r[e+0]}, ${r[e+1]}, ${r[e+2]}, ${r[e+3]})`}function FB(r){const e=new Bn("Geometry"),t=PB(r);return e.addChild(t),e}function PB(r){const e="Geometry",t=r.attributes,n=t.position.count,i=new Bn(e,"Mesh");i.addProperty(`int[] faceVertexCounts = [${NB(r)}]`),i.addProperty(`int[] faceVertexIndices = [${UB(r)}]`),i.addProperty(`normal3f[] normals = [${Gu(t.normal,n)}]`,['interpolation = "vertex"']),i.addProperty(`point3f[] points = [${Gu(t.position,n)}]`);for(let a=0;a<4;a++){const o=a>0?a:"",c=t["uv"+o];c!==void 0&&i.addProperty(`texCoord2f[] primvars:st${o} = [${OB(c)}]`,['interpolation = "vertex"'])}const s=t.color;return s!==void 0&&i.addProperty(`color3f[] primvars:displayColor = [${Gu(s,n)}]`,['interpolation = "vertex"']),i.addProperty('uniform token subdivisionScheme = "none"'),i}function NB(r){const e=r.index!==null?r.index.count:r.attributes.position.count;return Array(e/3).fill(3).join(", ")}function UB(r){const e=r.index,t=[];if(e!==null)for(let n=0;n<e.count;n++)t.push(e.getX(n));else{const n=r.attributes.position.count;for(let i=0;i<n;i++)t.push(i)}return t.join(", ")}function Gu(r,e){if(r===void 0)return console.warn("USDZExporter: Normals missing."),Array(e).fill("(0, 0, 0)").join(", ");const t=[];for(let n=0;n<r.count;n++){const i=r.getX(n),s=r.getY(n),a=r.getZ(n);t.push(`(${i.toPrecision(Sn)}, ${s.toPrecision(Sn)}, ${a.toPrecision(Sn)})`)}return t.join(", ")}function OB(r){const e=[];for(let t=0;t<r.count;t++){const n=r.getX(t),i=r.getY(t);e.push(`(${n.toPrecision(Sn)}, ${1-i.toPrecision(Sn)})`)}return e.join(", ")}function kB(r,e,t=!1){const n=new Bn("Materials");for(const i in r){const s=r[i];n.addChild(QB(s,e,t))}return n}function QB(r,e,t=!1){const n=new Bn(`Material_${r.id}`,"Material");function i(a,o,c){const l=a.source.id+"_"+a.flipY;e[l]=a;const u=a.channel>0?"st"+a.channel:"st",h={1e3:"repeat",1001:"clamp",1002:"mirror"},d=a.repeat.clone(),f=a.offset.clone(),p=a.rotation,g=Math.sin(p),m=Math.cos(p);f.y=1-f.y-d.y,t?(f.x=f.x/d.x,f.y=f.y/d.y,f.x+=g/d.x,f.y+=m-1):(f.x+=g*d.x,f.y+=(1-m)*d.y);const A=new Bn(`PrimvarReader_${o}`,"Shader");A.addProperty('uniform token info:id = "UsdPrimvarReader_float2"'),A.addProperty("float2 inputs:fallback = (0.0, 0.0)"),A.addProperty(`string inputs:varname = "${u}"`),A.addProperty("float2 outputs:result");const x=new Bn(`Transform2d_${o}`,"Shader");x.addProperty('uniform token info:id = "UsdTransform2d"'),x.addProperty(`float2 inputs:in.connect = </Materials/Material_${r.id}/PrimvarReader_${o}.outputs:result>`),x.addProperty(`float inputs:rotation = ${(p*(180/Math.PI)).toFixed(Sn)}`),x.addProperty(`float2 inputs:scale = ${s0(d)}`),x.addProperty(`float2 inputs:translation = ${s0(f)}`),x.addProperty("float2 outputs:result");const _=new Bn(`Texture_${a.id}_${o}`,"Shader");return _.addProperty('uniform token info:id = "UsdUVTexture"'),_.addProperty(`asset inputs:file = @textures/Texture_${l}.png@`),_.addProperty(`float2 inputs:st.connect = </Materials/Material_${r.id}/Transform2d_${o}.outputs:result>`),c!==void 0&&_.addProperty(`float4 inputs:scale = ${GB(c)}`),o==="normal"&&(_.addProperty("float4 inputs:scale = (2, 2, 2, 1)"),_.addProperty("float4 inputs:bias = (-1, -1, -1, 0)")),_.addProperty(`token input
4623s:sourceColorSpace = "${a.colorSpace===kn?"raw":"sRGB"}"`),_.addProperty(`token inputs:wrapS = "${h[a.wrapS]}"`),_.addProperty(`token inputs:wrapT = "${h[a.wrapT]}"`),_.addProperty("float outputs:r"),_.addProperty("float outputs:g"),_.addProperty("float outputs:b"),_.addProperty("float3 outputs:rgb"),(r.transparent||r.alphaTest>0)&&_.addProperty("float outputs:a"),[A,x,_]}r.side===Vt&&console.warn("THREE.USDZExporter: USDZ does not support double sided materials",r);const s=new Bn("PreviewSurface","Shader");if(s.addProperty('uniform token info:id = "UsdPreviewSurface"'),r.map!==null?(s.addProperty(`color3f inputs:diffuseColor.connect = </Materials/Material_${r.id}/Texture_${r.map.id}_diffuse.outputs:rgb>`),r.transparent?s.addProperty(`float inputs:opacity.connect = </Materials/Material_${r.id}/Texture_${r.map.id}_diffuse.outputs:a>`):r.alphaTest>0&&(s.addProperty(`float inputs:opacity.connect = </Materials/Material_${r.id}/Texture_${r.map.id}_diffuse.outputs:a>`),s.addProperty(`float inputs:opacityThreshold = ${r.alphaTest}`)),i(r.map,"diffuse",r.color).forEach(o=>n.addChild(o))):s.addProperty(`color3f inputs:diffuseColor = ${i0(r.color)}`),r.emissiveMap!==null){s.addProperty(`color3f inputs:emissiveColor.connect = </Materials/Material_${r.id}/Texture_${r.emissiveMap.id}_emissive.outputs:rgb>`);const a=new Ie(r.emissive.r*r.emissiveIntensity,r.emissive.g*r.emissiveIntensity,r.emissive.b*r.emissiveIntensity);i(r.emissiveMap,"emissive",a).forEach(c=>n.addChild(c))}else r.emissive.getHex()>0&&s.addProperty(`color3f inputs:emissiveColor = ${i0(r.emissive)}`);if(r.normalMap!==null&&(s.addProperty(`normal3f inputs:normal.connect = </Materials/Material_${r.id}/Texture_${r.normalMap.id}_normal.outputs:rgb>`),i(r.normalMap,"normal").forEach(o=>n.addChild(o))),r.aoMap!==null){s.addProperty(`float inputs:occlusion.connect = </Materials/Material_${r.id}/Texture_${r.aoMap.id}_occlusion.outputs:r>`);const a=new Ie(r.aoMapIntensity,r.aoMapIntensity,r.aoMapIntensity);i(r.aoMap,"occlusion",a).forEach(c=>n.addChild(c))}if(r.roughnessMap!==null){s.addProperty(`float inputs:roughness.connect = </Materials/Material_${r.id}/Texture_${r.roughnessMap.id}_roughness.outputs:g>`);const a=new Ie(r.roughness,r.roughness,r.roughness);i(r.roughnessMap,"roughness",a).forEach(c=>n.addChild(c))}else s.addProperty(`float inputs:roughness = ${r.roughness}`);if(r.metalnessMap!==null){s.addProperty(`float inputs:metallic.connect = </Materials/Material_${r.id}/Texture_${r.metalnessMap.id}_metallic.outputs:b>`);const a=new Ie(r.metalness,r.metalness,r.metalness);i(r.metalnessMap,"metallic",a).forEach(c=>n.addChild(c))}else s.addProperty(`float inputs:metallic = ${r.metalness}`);if(r.alphaMap!==null?(s.addProperty(`float inputs:opacity.connect = </Materials/Material_${r.id}/Texture_${r.alphaMap.id}_opacity.outputs:r>`),s.addProperty("float inputs:opacityThreshold = 0.0001"),i(r.alphaMap,"opacity").forEach(o=>n.addChild(o))):s.addProperty(`float inputs:opacity = ${r.opacity}`),r.isMeshPhysicalMaterial){if(r.clearcoatMap!==null){s.addProperty(`float inputs:clearcoat.connect = </Materials/Material_${r.id}/Texture_${r.clearcoatMap.id}_clearcoat.outputs:r>`);const a=new Ie(r.clearcoat,r.clearcoat,r.clearcoat);i(r.clearcoatMap,"clearcoat",a).forEach(c=>n.addChild(c))}else s.addProperty(`float inputs:clearcoat = ${r.clearcoat}`);if(r.clearcoatRoughnessMap!==null){s.addProperty(`float inputs:clearcoatRoughness.connect = </Materials/Material_${r.id}/Texture_${r.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`);const a=new Ie(r.clearcoatRoughness,r.clearcoatRoughness,r.clearcoatRoughness);i(r.clearcoatRoughnessMap,"clearcoatRoughness",a).forEach(c=>n.addChild(c))}else s.addProperty(`float inputs:clearcoatRoughness = ${r.clearcoatRoughness}`);s.addProperty(`float inputs:ior = ${r.ior}`)}return s.addProperty("int inputs:useSpecularWorkflow = 0"),s.addProperty("token outputs:surface"),n.addChild(s),n.addProperty(`token outputs:surface.connect = </Materials/Material_${r.id}/PreviewSurface.outputs:surface>`),n}function i0(r){return`(${r.r}, ${r.g}, ${r.b})`}function GB(r){return`(${r.r}, ${r.g}, ${r.b}, 1.0)`}function s0(r){return`(${r.x}, ${r.y})`}function HB(r,e){const t=Gb(r,e),n=Wb(r.matrix);r.matrix.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",r);const i=new Bn(t,"Camera");i.addProperty(`matrix4d xformOp:transform = ${n}`),i.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]');const s=r.isOrthographicCamera?"orthographic":"perspective";i.addProperty(`token projection = "${s}"`);const a=`(${r.near.toPrecision(Sn)}, ${r.far.toPrecision(Sn)})`;i.addProperty(`float2 clippingRange = ${a}`);let o;r.isOrthographicCamera?o=((Math.abs(r.left)+Math.abs(r.right))*10).toPrecision(Sn):o=r.getFilmWidth().toPrecision(Sn),i.addProperty(`float horizontalAperture = ${o}`);let c;if(r.isOrthographicCamera?c=((Math.abs(r.top)+Math.abs(r.bottom))*10).toPrecision(Sn):c=r.getFilmHeight().toPrecision(Sn),i.addProperty(`float verticalAperture = ${c}`),r.isPerspectiveCamera){const l=r.getFocalLength().toPrecision(Sn);i.addProperty(`float focalLength = ${l}`);const u=r.focus.toPrecision(Sn);i.addProperty(`float focusDistance = ${u}`)}return i}const zB=r=>e=>{try{const t=Gi(e),n=(t.length?t[0].terms:[]).filter(i=>i&&i.type==="ident").map(i=>i.value).filter(i=>r.indexOf(i)>-1);return new Set(n)}catch{}return new Set};var ws=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};let r0=!1,a0=!1;const o0="#model-viewer-no-ar-fallback",VB=zB(["quick-look","scene-viewer","webxr","none"]),WB="webxr scene-viewer quick-look",Nn={QUICK_LOOK:"quick-look",SCENE_VIEWER:"scene-viewer",WEBXR:"webxr",NONE:"none"},Pi=Symbol("arButtonContainer"),c0=Symbol("enterARWithWebXR"),l0=Symbol("openSceneViewer"),h0=Symbol("openIOSARQuickLook"),qB=Symbol("canActivateAR"),Oc=Symbol("arMode"),Hu=Symbol("arModes"),wr=Symbol("arAnchor"),kc=Symbol("preload"),Qc=Symbol("onARButtonContainerClick"),zu=Symbol("onARStatus"),Vu=Symbol("onARTracking"),Wu=Symbol("onARTap"),Wa=Symbol("selectARMode"),qu=Symbol("triggerLoad"),XB=r=>{var e,t,n,i,s,a,o,c,l,u;class h extends r{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arUsdzMaxTextureSize="auto",this.arPlacement="floor",this.arModes=WB,this.iosSrc=null,this.xrEnvironment=!1,this[e]=!1,this[t]=this.shadowRoot.querySelector(".ar-button"),this[n]=document.createElement("a"),this[i]=new Set,this[s]=Nn.NONE,this[a]=!1,this[o]=f=>{f.preventDefault(),this.activateAR()},this[c]=({status:f})=>{(f===ki.NOT_PRESENTING||this[at].arRenderer.presentedScene===this[te])&&(this.setAttribute("ar-status",f),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:f}})),f===ki.NOT_PRESENTING?this.removeAttribute("ar-tracking"):f===ki.SESSION_STARTED&&this.setAttribute("ar-tracking",Wd.TRACKING))},this[l]=({status:f})=>{this.setAttribute("ar-tracking",f),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:f}}))},this[u]=f=>{f.data=="_apple_ar_quicklook_button_tapped"&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[Oc]!==Nn.NONE}connectedCallback(){super.connectedCallback(),this[at].arRenderer!=null&&(this[at].arRenderer.addEventListener("status",this[zu]),this.setAttribute("ar-status",ki.NOT_PRESENTING),this[at].arRenderer.addEventListener("tracking",this[Vu])),this[wr].addEventListener("message",this[Wu])}disconnectedCallback(){super.disconnectedCallback(),this[at].arRenderer!=null&&(this[at].arRenderer.removeEventListener("status",this[zu]),this[at].arRenderer.removeEventListener("tracking",this[Vu])),this[wr].removeEventListener("message",this[Wu])}update(f){super.update(f),f.has("arScale")&&(this[te].canScale=this.arScale!=="fixed"),f.has("arPlacement")&&(this[te].updateShadow(),this[Kt]()),f.has("arModes")&&(this[Hu]=VB(this.arModes)),(f.has("ar")||f.has("arModes")||f.has("src")||f.has("iosSrc")||f.has("arUsdzMaxTextureSize"))&&this[Wa]()}async activateAR(){switch(this[Oc]){case Nn.QUICK_LOOK:await this[h0]();break;case Nn.WEBXR:await this[c0]();break;case Nn.SCENE_VIEWER:this[l0]();break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities");break}}async[(e=qB,t=Pi,n=wr,i=Hu,s=Oc,a=kc,o=Qc,c=zu,l=Vu,u=Wu,Wa)](){var f;let p=Nn.NONE;if(this.ar){if(this.src!=null)for(const g of this[Hu]){if(g==="webxr"&&ux&&!r0&&await this[at].arRenderer.supportsPresentation()){p=Nn.WEBXR;break}if(g==="scene-viewer"&&!a0&&(xw||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(!((f=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)===null||f===void 0)&&f.includes("XR")))){p=Nn.SCENE_VIEWER;break}if(g==="quick-look"&&CA){p=Nn.QUICK_LOOK;break}}p===Nn.NONE&&this.iosSrc!=null&&CA&&(p=Nn.QUICK_LOOK)}if(p!==Nn.NONE)this[Pi].classList.add("enabled"),this[Pi].addEventListener("click",this[Qc]);else if(this[Pi].classList.contains("enabled")){this[Pi].removeEventListener("click",this[Qc]),this[Pi].classList.remove("enabled");const g=ki.FAILED;this.setAttribute("ar-status",g),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:g}}))}this[Oc]=p}async[c0](){console.log("Attempting to present in AR with WebXR..."),await this[qu]();try{this[Pi].removeEventListener("click",this[Qc]);const{arRenderer:f}=this[at];f.placeOnWall=this.arPlacement==="wall",await f.present(this[te],this.xrEnvironment)}catch(f){console.warn("Error while trying to present in AR with WebXR"),console.error(f),await this[at].arRenderer.stopPresenting(),r0=!0,console.warn("Falling back to next ar-mode"),await this[Wa](),this.activateAR()}finally{this[Wa]()}}async[qu](){this.loaded||(this[kc]=!0,this[Wr](),await yw(this,"load"),this[kc]=!1)}[ca](){return super[ca]()||this[kc]}[l0](){const f=self.location.toString(),p=new URL(f),g=new URL(this.src,f);g.hash&&(g.hash="");const m=new URLSearchParams(g.search);if(p.hash=o0,m.set("mode","ar_preferred"),m.has("disable_occlusion")||m.set("disable_occlusion","true"),this.arScale==="fixed"&&m.set("resizable","false"),this.arPlacement==="wall"&&m.set("enable_vertical_placement","true"),m.has("sound")){const _=new URL(m.get("sound"),f);m.set("sound",_.toString())}if(m.has("link")){const _=new URL(m.get("link"),f);m.set("link",_.toString())}const A=`intent://arvr.google.com/scene-viewer/1.2?${m.toString()+"&file="+encodeURIComponent(g.toString())}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(p.toString())};end;`,x=()=>{self.location.hash===o0&&(a0=!0,self.history.back(),console.warn("Error while trying to present in AR with Scene Viewer"),console.warn("Falling back to next ar-mode"),this[Wa]())};self.addEventListener("hashchange",x,{once:!0}),this[wr].setAttribute("href",A),console.log("Attempting to present in AR with Scene Viewer..."),this[wr].click()}async[h0](){const f=!this.iosSrc;this[Pi].classList.remove("enabled");const p=f?await this.prepareUSDZ():this.iosSrc,g=new URL(p,self.location.toString());if(f){const x=self.location.toString(),_=new URL(x),b=new URL(this.src,_);b.hash&&(g.hash=b.hash)}this.arScale==="fixed"&&(g.hash&&(g.hash+="&"),g.hash+="allowsContentScaling=0");const m=this[wr];m.setAttribute("rel","ar");const A=document.createElement("img");m.appendChild(A),m.setAttribute("href",g.toString()),f&&m.setAttribute("download","model.usdz"),m.style.display="none",m.isConnected||this.shadowRoot.appendChild(m),console.log("Attempting to present in AR with Quick Look..."),m.click(),m.removeChild(A),f&&URL.revokeObjectURL(p),this[Pi].classList.add("enabled")}async prepareUSDZ(){const f=this[Ys].beginActivity("usdz-conversion");await this[qu]();const{model:p,shadow:g,target:m}=this[te];if(p==null)return"";let A=!1;g!=null&&(A=g.visible,g.visible=!1),f(.2);const x=new BB;m.remove(p),p.position.copy(m.position),p.updateWorldMatrix(!1,!0);const _=await x.parseAsync(p,{maxTextureSize:isNaN(this.arUsdzMaxTextureSize)?1/0:Math.max(parseInt(this.arUsdzMaxTextureSize),
vendor: 6,489 bytes, line 4623
462316)});p.position.set(0,0,0),m.add(p);const b=new Blob([_],{type:"model/vnd.usdz+zip"}),v=URL.createObjectURL(b);return f(1),g!=null&&(g.visible=A),v}}return ws([De({type:Boolean,attribute:"ar"})],h.prototype,"ar",void 0),ws([De({type:String,attribute:"ar-scale"})],h.prototype,"arScale",void 0),ws([De({type:String,attribute:"ar-usdz-max-texture-size"})],h.prototype,"arUsdzMaxTextureSize",void 0),ws([De({type:String,attribute:"ar-placement"})],h.prototype,"arPlacement",void 0),ws([De({type:String,attribute:"ar-modes"})],h.prototype,"arModes",void 0),ws([De({type:String,attribute:"ios-src"})],h.prototype,"iosSrc",void 0),ws([De({type:Boolean,attribute:"xr-environment"})],h.prototype,"xrEnvironment",void 0),h};var Xu=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const $B=100,YB="https://www.gstatic.com/draco/versioned/decoders/1.5.6/",jB="https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/",KB="https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/loaders/LottieLoader.js",$u={AUTO:"auto"},u0={AUTO:"auto",EAGER:"eager"},Tr=Symbol("defaultProgressBarElement"),Yu=Symbol("posterContainerElement"),Rr=Symbol("defaultPosterElement"),qa=Symbol("shouldDismissPoster"),ju=Symbol("hidePoster"),Gc=Symbol("modelIsRevealed"),Ku=Symbol("updateProgressBar"),JB=Symbol("ariaLabelCallToAction"),Ju=Symbol("onProgress"),ZB=r=>{var e,t,n,i,s,a,o,c;class l extends r{static set dracoDecoderLocation(h){mn.setDRACODecoderLocation(h)}static get dracoDecoderLocation(){return mn.getDRACODecoderLocation()}static set ktx2TranscoderLocation(h){mn.setKTX2TranscoderLocation(h)}static get ktx2TranscoderLocation(){return mn.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(h){mn.setMeshoptDecoderLocation(h)}static get meshoptDecoderLocation(){return mn.getMeshoptDecoderLocation()}static set lottieLoaderLocation(h){Gn.singleton.textureUtils.lottieLoaderUrl=h}static get lottieLoaderLocation(){return Gn.singleton.textureUtils.lottieLoaderUrl}static mapURLs(h){Gn.singleton.loader[Rs].manager.setURLModifier(h)}dismissPoster(){this.loaded?this[ju]():(this[qa]=!0,this[Wr]())}showPoster(){const h=this[Yu];if(h.classList.contains("show"))return;h.classList.add("show"),this[Kn].classList.remove("show");const d=this[Rr];d.removeAttribute("tabindex"),d.removeAttribute("aria-hidden");const f=this.modelIsVisible;this[Gc]=!1,this[Il](f)}getDimensions(){return ss(this[te].size)}getBoundingBoxCenter(){return ss(this[te].boundingBox.getCenter(new B))}constructor(...h){super(...h),this.poster=null,this.reveal=$u.AUTO,this.loading=u0.AUTO,this[e]=!1,this[t]=!1,this[n]=this.shadowRoot.querySelector(".slot.poster"),this[i]=this.shadowRoot.querySelector("#default-poster"),this[s]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[a]=this[Rr].getAttribute("aria-label"),this[o]=vw(m=>{const A=this[Tr].parentNode;requestAnimationFrame(()=>{this[Tr].style.transform=`scaleX(${m})`,m===0&&(A.removeChild(this[Tr]),A.appendChild(this[Tr])),this[Tr].classList.toggle("hide",m===1)})},$B),this[c]=m=>{const A=m.detail.totalProgress,x=m.detail.reason;A===1&&(this[Ku].flush(),this.loaded&&(this[qa]||this.reveal===$u.AUTO)&&this[ju]()),this[Ku](A),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:A,reason:x}}))};const d=self.ModelViewerElement||{},f=d.dracoDecoderLocation||YB;mn.setDRACODecoderLocation(f);const p=d.ktx2TranscoderLocation||jB;mn.setKTX2TranscoderLocation(p),d.meshoptDecoderLocation&&mn.setMeshoptDecoderLocation(d.meshoptDecoderLocation);const g=d.lottieLoaderLocation||KB;Gn.singleton.textureUtils!=null&&(Gn.singleton.textureUtils.lottieLoaderUrl=g)}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[Ys].addEventListener("progress",this[Ju])}disconnectedCallback(){super.disconnectedCallback(),this[Ys].removeEventListener("progress",this[Ju])}async updated(h){super.updated(h),h.has("poster")&&this.poster!=null&&(this[Rr].style.backgroundImage=`url(${this.poster})`),h.has("alt")&&this[Rr].setAttribute("aria-label",this[jd]),(h.has("reveal")||h.has("loading"))&&this[Wr]()}[(e=Gc,t=qa,n=Yu,i=Rr,s=Tr,a=JB,o=Ku,c=Ju,ca)](){return!!this.src&&(this[qa]||this.loading===u0.EAGER||this.reveal===$u.AUTO&&this[Fs])}[ju](){this[qa]=!1;const h=this[Yu];if(!h.classList.contains("show"))return;h.classList.remove("show"),this[Kn].classList.add("show");const d=this.modelIsVisible;this[Gc]=!0,this[Il](d);const f=this.getRootNode();f&&f.activeElement===this&&this[Kn].focus();const p=this[Rr];p.setAttribute("aria-hidden","true"),p.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[js](){return super[js]()&&this[Gc]}}return Xu([De({type:String})],l.prototype,"poster",void 0),Xu([De({type:String})],l.prototype,"reveal",void 0),Xu([De({type:String})],l.prototype,"loading",void 0),l};var Zu=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const eD=Math.PI/32,tD=3e3,nD={basis:[Wl(hn(eD,"rad"))],keywords:{auto:[null]}},Br=Symbol("autoRotateStartTime"),ed=Symbol("radiansPerSecond"),d0=Symbol("syncRotationRate"),td=Symbol("onCameraChange"),iD=r=>{var e,t,n;class i extends r{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=tD,this.rotationPerSecond="auto",this[e]=performance.now(),this[t]=0,this[n]=a=>{this.autoRotate&&a.detail.source==="user-interaction"&&(this[Br]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[td]),this[Br]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[td]),this[Br]=performance.now()}updated(a){super.updated(a),a.has("autoRotate")&&(this[Br]=performance.now())}[(e=Br,t=ed,d0)](a){this[ed]=a[0]}[gi](a,o){if(super[gi](a,o),!this.autoRotate||!this[js]()||this[at].isPresenting)return;const c=Math.min(o,a-this[Br]-this.autoRotateDelay);c>0&&(this[te].yaw=this.turntableRotation+this[ed]*c*.001)}get turntableRotation(){return this[te].yaw}
4623resetTurntableRotation(a=0){this[te].yaw=a}}return n=td,Zu([De({type:Boolean,attribute:"auto-rotate"})],i.prototype,"autoRotate",void 0),Zu([De({type:Number,attribute:"auto-rotate-delay"})],i.prototype,"autoRotateDelay",void 0),Zu([ts({intrinsics:nD,updateHandler:d0}),De({type:String,attribute:"rotation-per-second"})],i.prototype,"rotationPerSecond",void 0),i};const sD=AB(YR(iD(ww(q1(XB(ZB(pB(Po))))))));customElements.define("model-viewer",sD);export{Dd as CanvasTexture,zi as FileLoader,vi as Loader,sD as ModelViewerElement,yt as NearestFilter};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.