PageSourceSearch

https://cs-weglot.vercel.app/assets/index.f0ec4c6d.js

js cs-weglot.vercel.app collected 2026-10-03 06:30:10 UTC 955,692 bytes, 4,450 lines download raw bytes

vendor: 9,748 bytes, lines 1-5
1var Q0=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var yO=Q0((mi,gi)=>{(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function i(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerpolicy&&(s.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?s.credentials="include":r.crossorigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(r){if(r.ep)return;r.ep=!0;const s=i(r);fetch(r.href,s)}})();/**
2 * @license
3 * Copyright 2010-2022 Three.js Authors
4 * SPDX-License-Identifier: MIT
5 */const Oh="144",ev=0,Cu=1,tv=2,Rh=1,iv=2,io=3,Or=0,vi=1,An=2,tr=0,Tr=1,Lu=2,Pu=3,Du=4,nv=5,hs=100,rv=101,sv=102,Ou=103,Ru=104,ov=200,av=201,lv=202,cv=203,rm=204,sm=205,hv=206,uv=207,dv=208,fv=209,pv=210,mv=0,gv=1,vv=2,Rc=3,yv=4,xv=5,_v=6,bv=7,om=0,wv=1,Sv=2,Cn=0,Mv=1,Av=2,Tv=3,Ev=4,Cv=5,am=300,Rr=301,Ir=302,Ic=303,zc=304,Po=306,Nc=1e3,Vi=1001,Uc=1002,ni=1003,Iu=1004,zu=1005,Ci=1006,Lv=1007,il=1008,zr=1009,Pv=1010,Dv=1011,lm=1012,Ov=1013,wr=1014,Sr=1015,yo=1016,Rv=1017,Iv=1018,ys=1020,zv=1021,Nv=1022,nn=1023,Uv=1024,Bv=1025,Er=1026,Ts=1027,Fv=1028,kv=1029,Vv=1030,Gv=1031,Hv=1033,Cl=33776,Ll=33777,Pl=33778,Dl=33779,Nu=35840,Uu=35841,Bu=35842,Fu=35843,Wv=36196,ku=37492,Vu=37496,Gu=37808,Hu=37809,Wu=37810,ju=37811,qu=37812,Xu=37813,Yu=37814,$u=37815,Zu=37816,Ju=37817,Ku=37818,Qu=37819,ed=37820,td=37821,id=36492,ln=3e3,Et=3001,jv=3200,qv=3201,Xv=0,Yv=1,wn="srgb",Mr="srgb-linear",Ol=7680,$v=519,Bc=35044,nd="300 es",Fc=1035;class In{addEventListener(e,i){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(i)===-1&&n[e].push(i)}hasEventListener(e,i){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(i)!==-1}removeEventListener(e,i){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(i);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const Xt=["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","55","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 rd=1234567;const co=Math.PI/180,xo=180/Math.PI;function on(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Xt[t&255]+Xt[t>>8&255]+Xt[t>>16&255]+Xt[t>>24&255]+"-"+Xt[e&255]+Xt[e>>8&255]+"-"+Xt[e>>16&15|64]+Xt[e>>24&255]+"-"+Xt[i&63|128]+Xt[i>>8&255]+"-"+Xt[i>>16&255]+Xt[i>>24&255]+Xt[n&255]+Xt[n>>8&255]+Xt[n>>16&255]+Xt[n>>24&255]).toLowerCase()}function Ht(t,e,i){return Math.max(e,Math.min(i,t))}function Ih(t,e){return(t%e+e)%e}function Zv(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)}function Jv(t,e,i){return t!==e?(i-t)/(e-t):0}function ho(t,e,i){return(1-i)*t+i*e}function Kv(t,e,i,n){return ho(t,e,1-Math.exp(-i*n))}function Qv(t,e=1){return e-Math.abs(Ih(t,e*2)-e)}function ey(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*(3-2*t))}function ty(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*t*(t*(t*6-15)+10))}function iy(t,e){return t+Math.floor(Math.random()*(e-t+1))}function ny(t,e){return t+Math.random()*(e-t)}function ry(t){return t*(.5-Math.random())}function sy(t){t!==void 0&&(rd=t);let e=rd+=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 oy(t){return t*co}function ay(t){return t*xo}function kc(t){return(t&t-1)===0&&t!==0}function ly(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Ia(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function cy(t,e,i,n,r){const s=Math.cos,o=Math.sin,a=s(i/2),l=o(i/2),h=s((e+n)/2),f=o((e+n)/2),c=s((e-n)/2),u=o((e-n)/2),d=s((n-e)/2),m=o((n-e)/2);switch(r){case"XYX":t.set(a*f,l*c,l*u,a*h);break;case"YZY":t.set(l*u,a*f,l*c,a*h);break;case"ZXZ":t.set(l*c,l*u,a*f,a*h);break;case"XZX":t.set(a*f,l*m,l*d,a*h);break;case"YXY":t.set(l*d,a*f,l*m,a*h);break;case"ZYZ":t.set(l*m,l*d,a*f,a*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Tn(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function yt(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}var At=Object.freeze({__proto__:null,DEG2RAD:co,RAD2DEG:xo,generateUUID:on,clamp:Ht,euclideanModulo:Ih,mapLinear:Zv,inverseLerp:Jv,lerp:ho,damp:Kv,pingpong:Qv,smoothstep:ey,smootherstep:ty,randInt:iy,randFloat:ny,randFloatSpread:ry,seededRandom:sy,degToRad:oy,radToDeg:ay,isPowerOfTwo:kc,ceilPowerOfTwo:ly,floorPowerOfTwo:Ia,setQuaternionFromProperEuler:cy,normalize:yt,denormalize:Tn});class Z{constructor(e=0,i=0){Z.prototype.isVector2=!0,this.x=e,this.y=i}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,i){return this.x=e,this.y=i,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,i){switch(e){case 0:this.x=i;break;case 1:this.y=i;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,i){return this.x=e.x+i.x,this.y=e.y+i.y,this}addScaledVector(e,i){return this.x+=e.x*i,this.y+=e.y*i,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,i){return this.x=e.x-i.x,this.y=e.y-i.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 i=this.x,n=this.y,r=e.elements;return this.x=r[0]*i+r[3]*n+r[6],this.y=r[1]*i+r[4]*n+r[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,i){return this.x=Math.max(e.x,Math.min(i.x,this.x)),this.y=Math.max(e.y,Math.min(i.y,this.y)),this}clampScalar(e,i){return this.x=Math.max(e,Math.min(i,this.x)),this.y=Math.max(e,Math.min(i,this.y)),this}clampLength(e,i){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(i,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const i=this.x-e.x,n=this.y-e.y;return i*i+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,i){return this.x+=(e.x-this.x)*i,this.y+=(e.y-this.y)*i,this}lerpVectors(e,i,n){return this.x=e.x+(i.x-e.x)*n,this.y=e.y+(i.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,i=0){return this.x=e[i],this.y=e[i+1],this}toArray(e=[],i=0){return e[i]=this.x,e[i+1]=this.y,e}fromBufferAttribute(e,i){return this.x=e.getX(i),this.y=e.getY(i),this}
vendor: 16,284 bytes, line 5
5rotateAround(e,i){const n=Math.cos(i),r=Math.sin(i),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class qt{constructor(){qt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,i,n,r,s,o,a,l,h){const f=this.elements;return f[0]=e,f[1]=r,f[2]=a,f[3]=i,f[4]=s,f[5]=l,f[6]=n,f[7]=o,f[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const i=this.elements,n=e.elements;return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i[4]=n[4],i[5]=n[5],i[6]=n[6],i[7]=n[7],i[8]=n[8],this}extractBasis(e,i,n){return e.setFromMatrix3Column(this,0),i.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const i=e.elements;return this.set(i[0],i[4],i[8],i[1],i[5],i[9],i[2],i[6],i[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,i){const n=e.elements,r=i.elements,s=this.elements,o=n[0],a=n[3],l=n[6],h=n[1],f=n[4],c=n[7],u=n[2],d=n[5],m=n[8],g=r[0],p=r[3],v=r[6],y=r[1],b=r[4],x=r[7],M=r[2],w=r[5],T=r[8];return s[0]=o*g+a*y+l*M,s[3]=o*p+a*b+l*w,s[6]=o*v+a*x+l*T,s[1]=h*g+f*y+c*M,s[4]=h*p+f*b+c*w,s[7]=h*v+f*x+c*T,s[2]=u*g+d*y+m*M,s[5]=u*p+d*b+m*w,s[8]=u*v+d*x+m*T,this}multiplyScalar(e){const i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=e,i[4]*=e,i[7]*=e,i[2]*=e,i[5]*=e,i[8]*=e,this}determinant(){const e=this.elements,i=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],h=e[7],f=e[8];return i*o*f-i*a*h-n*s*f+n*a*l+r*s*h-r*o*l}invert(){const e=this.elements,i=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],h=e[7],f=e[8],c=f*o-a*h,u=a*l-f*s,d=h*s-o*l,m=i*c+n*u+r*d;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/m;return e[0]=c*g,e[1]=(r*h-f*n)*g,e[2]=(a*n-r*o)*g,e[3]=u*g,e[4]=(f*i-r*l)*g,e[5]=(r*s-a*i)*g,e[6]=d*g,e[7]=(n*l-h*i)*g,e[8]=(o*i-n*s)*g,this}transpose(){let e;const i=this.elements;return e=i[1],i[1]=i[3],i[3]=e,e=i[2],i[2]=i[6],i[6]=e,e=i[5],i[5]=i[7],i[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const i=this.elements;return e[0]=i[0],e[1]=i[3],e[2]=i[6],e[3]=i[1],e[4]=i[4],e[5]=i[7],e[6]=i[2],e[7]=i[5],e[8]=i[8],this}setUvTransform(e,i,n,r,s,o,a){const l=Math.cos(s),h=Math.sin(s);return this.set(n*l,n*h,-n*(l*o+h*a)+o+e,-r*h,r*l,-r*(-h*o+l*a)+a+i,0,0,1),this}scale(e,i){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=i,n[4]*=i,n[7]*=i,this}rotate(e){const i=Math.cos(e),n=Math.sin(e),r=this.elements,s=r[0],o=r[3],a=r[6],l=r[1],h=r[4],f=r[7];return r[0]=i*s+n*l,r[3]=i*o+n*h,r[6]=i*a+n*f,r[1]=-n*s+i*l,r[4]=-n*o+i*h,r[7]=-n*a+i*f,this}translate(e,i){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=i*n[2],n[4]+=i*n[5],n[7]+=i*n[8],this}equals(e){const i=this.elements,n=e.elements;for(let r=0;r<9;r++)if(i[r]!==n[r])return!1;return!0}fromArray(e,i=0){for(let n=0;n<9;n++)this.elements[n]=e[n+i];return this}toArray(e=[],i=0){const n=this.elements;return e[i]=n[0],e[i+1]=n[1],e[i+2]=n[2],e[i+3]=n[3],e[i+4]=n[4],e[i+5]=n[5],e[i+6]=n[6],e[i+7]=n[7],e[i+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}function cm(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const hy={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Ho(t,e){return new hy[t](e)}function za(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Cr(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Ea(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}const Rl={[wn]:{[Mr]:Cr},[Mr]:{[wn]:Ea}},Ri={legacyMode:!0,get workingColorSpace(){return Mr},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,i){if(this.legacyMode||e===i||!e||!i)return t;if(Rl[e]&&Rl[e][i]!==void 0){const n=Rl[e][i];return t.r=n(t.r),t.g=n(t.g),t.b=n(t.b),t}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}},hm={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},Ft={r:0,g:0,b:0},Ii={h:0,s:0,l:0},Wo={h:0,s:0,l:0};function Il(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+(e-t)*6*i:i<1/2?e:i<2/3?t+(e-t)*6*(2/3-i):t}function jo(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}class Xe{constructor(e,i,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,i===void 0&&n===void 0?this.set(e):this.setRGB(e,i,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,i=wn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ri.toWorkingColorSpace(this,i),this}setRGB(e,i,n,r=Mr){return this.r=e,this.g=i,this.b=n,Ri.toWorkingColorSpace(this,r),this}setHSL(e,i,n,r=Mr){if(e=Ih(e,1),i=Ht(i,0,1),n=Ht(n,0,1),i===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+i):n+i-n*i,o=2*n-s;this.r=Il(o,s,e+1/3),this.g=Il(o,s,e),this.b=Il(o,s,e-1/3)}return Ri.toWorkingColorSpace(this,r),this}setStyle(e,i=wn){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,Ri.toWorkingColorSpace(this,i),n(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,Ri.toWorkingColorSpace(this,i),n(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const l=parseFloat(s[1])/360,h=parseFloat(s[2])/100,f=parseFloat(s[3])/100;return n(s[4]),this.setHSL(l,h,f,i)}break}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,Ri.toWorkingColorSpace(this,i),this;if(o===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,Ri.toWorkingColorSpace(this,i),this}return e&&e.length>0?this.setColorName(e,i):this}setColorName(e,i=wn){const n=hm[e.toLowerCase()];return n!==void 0?this.setHex(n,i):console.warn("THREE.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=Cr(e.r),this.g=Cr(e.g),this.b=Cr(e.b),this}copyLinearToSRGB(e){return this.r=Ea(e.r),this.g=Ea(e.g),this.b=Ea(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=wn){return Ri.fromWorkingColorSpace(jo(this,Ft),e),Ht(Ft.r*255,0,255)<<16^Ht(Ft.g*255,0,255)<<8^Ht(Ft.b*255,0,255)<<0}getHexString(e=wn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,i=Mr){Ri.fromWorkingColorSpace(jo(this,Ft),i);const n=Ft.r,r=Ft.g,s=Ft.b,o=Math.max(n,r,s),a=Math.min(n,r,s);let l,h;const f=(a+o)/2;if(a===o)l=0,h=0;else{const c=o-a;switch(h=f<=.5?c/(o+a):c/(2-o-a),o){case n:l=(r-s)/c+(r<s?6:0);break;case r:l=(s-n)/c+2;break;case s:l=(n-r)/c+4;break}l/=6}return e.h=l,e.s=h,e.l=f,e}getRGB(e,i=Mr){return Ri.fromWorkingColorSpace(jo(this,Ft),i),e.r=Ft.r,e.g=Ft.g,e.b=Ft.b,e}getStyle(e=wn){return Ri.fromWorkingColorSpace(jo(this,Ft),e),e!==wn?`color(${e} ${Ft.r} ${Ft.g} ${Ft.b})`:`rgb(${Ft.r*255|0},${Ft.g*255|0},${Ft.b*255|0})`}offsetHSL(e,i,n){return this.getHSL(Ii),Ii.h+=e,Ii.s+=i,Ii.l+=n,this.setHSL(Ii.h,Ii.s,Ii.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,i){return this.r=e.r+i.r,this.g=e.g+i.g,this.b=e.b+i.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,i){return this.r+=(e.r-this.r)*i,this.g+=(e.g-this.g)*i,this.b+=(e.b-this.b)*i,this}lerpColors(e,i,n){return this.r=e.r+(i.r-e.r)*n,this.g=e.g+(i.g-e.g)*n,this.b=e.b+(i.b-e.b)*n,this}lerpHSL(e,i){this.getHSL(Ii),e.getHSL(Wo);const n=ho(Ii.h,Wo.h,i),r=ho(Ii.s,Wo.s,i),s=ho(Ii.l,Wo.l,i);return this.setHSL(n,r,s),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,i=0){return this.r=e[i],this.g=e[i+1],this.b=e[i+2],this}toArray(e=[],i=0){return e[i]=this.r,e[i+1]=this.g,e[i+2]=this.b,e}fromBufferAttribute(e,i){return this.r=e.getX(i),this.g=e.getY(i),this.b=e.getZ(i),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}Xe.NAMES=hm;let Xr;class um{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Xr===void 0&&(Xr=za("canvas")),Xr.width=e.width,Xr.height=e.height;const n=Xr.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),i=Xr}return i.width>2048||i.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),i.toDataURL("image/jpeg",.6)):i.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const i=za("canvas");i.width=e.width,i.height=e.height;const n=i.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Cr(s[o]/255)*255;return n.putImageData(r,0,0),i}else if(e.data){const i=e.data.slice(0);for(let n=0;n<i.length;n++)i instanceof Uint8Array||i instanceof Uint8ClampedArray?i[n]=Math.floor(Cr(i[n]/255)*255):i[n]=Cr(i[n]);return{data:i,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class dm{constructor(e=null){this.isSource=!0,this.uuid=on(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const i=e===void 0||typeof e=="string";if(!i&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(zl(r[o].image)):s.push(zl(r[o]))}else s=zl(r);n.url=s}return i||(e.images[this.uuid]=n),n}}function zl(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?um.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let uy=0;class yi extends In{constructor(e=yi.DEFAULT_IMAGE,i=yi.DEFAULT_MAPPING,n=Vi,r=Vi,s=Ci,o=il,a=nn,l=zr,h=1,f=ln){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:uy++}),this.uuid=on(),this.name="",this.source=new dm(e),this.mipmaps=[],this.mapping=i,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=h,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Z(0,0),this.repeat=new Z(1,1),this.center=new Z(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new qt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=f,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}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.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.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const i=e===void 0||typeof e=="string";if(!i&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,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,type:this.t
vendor: 4,773 bytes, line 5
5ype,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),i||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==am)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Nc:e.x=e.x-Math.floor(e.x);break;case Vi:e.x=e.x<0?0:1;break;case Uc: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 Nc:e.y=e.y-Math.floor(e.y);break;case Vi:e.y=e.y<0?0:1;break;case Uc: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)}}yi.DEFAULT_IMAGE=null;yi.DEFAULT_MAPPING=am;class tt{constructor(e=0,i=0,n=0,r=1){tt.prototype.isVector4=!0,this.x=e,this.y=i,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,i,n,r){return this.x=e,this.y=i,this.z=n,this.w=r,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,i){switch(e){case 0:this.x=i;break;case 1:this.y=i;break;case 2:this.z=i;break;case 3:this.w=i;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,i){return this.x=e.x+i.x,this.y=e.y+i.y,this.z=e.z+i.z,this.w=e.w+i.w,this}addScaledVector(e,i){return this.x+=e.x*i,this.y+=e.y*i,this.z+=e.z*i,this.w+=e.w*i,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,i){return this.x=e.x-i.x,this.y=e.y-i.y,this.z=e.z-i.z,this.w=e.w-i.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 i=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*i+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*i+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*i+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*i+o[7]*n+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const i=Math.sqrt(1-e.w*e.w);return i<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/i,this.y=e.y/i,this.z=e.z/i),this}setAxisAngleFromRotationMatrix(e){let i,n,r,s;const l=e.elements,h=l[0],f=l[4],c=l[8],u=l[1],d=l[5],m=l[9],g=l[2],p=l[6],v=l[10];if(Math.abs(f-u)<.01&&Math.abs(c-g)<.01&&Math.abs(m-p)<.01){if(Math.abs(f+u)<.1&&Math.abs(c+g)<.1&&Math.abs(m+p)<.1&&Math.abs(h+d+v-3)<.1)return this.set(1,0,0,0),this;i=Math.PI;const b=(h+1)/2,x=(d+1)/2,M=(v+1)/2,w=(f+u)/4,T=(c+g)/4,_=(m+p)/4;return b>x&&b>M?b<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(b),r=w/n,s=T/n):x>M?x<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(x),n=w/r,s=_/r):M<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(M),n=T/s,r=_/s),this.set(n,r,s,i),this}let y=Math.sqrt((p-m)*(p-m)+(c-g)*(c-g)+(u-f)*(u-f));return Math.abs(y)<.001&&(y=1),this.x=(p-m)/y,this.y=(c-g)/y,this.z=(u-f)/y,this.w=Math.acos((h+d+v-1)/2),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,i){return this.x=Math.max(e.x,Math.min(i.x,this.x)),this.y=Math.max(e.y,Math.min(i.y,this.y)),this.z=Math.max(e.z,Math.min(i.z,this.z)),this.w=Math.max(e.w,Math.min(i.w,this.w)),this}clampScalar(e,i){return this.x=Math.max(e,Math.min(i,this.x)),this.y=Math.max(e,Math.min(i,this.y)),this.z=Math.max(e,Math.min(i,this.z)),this.w=Math.max(e,Math.min(i,this.w)),this}clampLength(e,i){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(i,n)))}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}
vendor: 28,639 bytes, line 5
5round(){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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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,i){return this.x+=(e.x-this.x)*i,this.y+=(e.y-this.y)*i,this.z+=(e.z-this.z)*i,this.w+=(e.w-this.w)*i,this}lerpVectors(e,i,n){return this.x=e.x+(i.x-e.x)*n,this.y=e.y+(i.y-e.y)*n,this.z=e.z+(i.z-e.z)*n,this.w=e.w+(i.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,i=0){return this.x=e[i],this.y=e[i+1],this.z=e[i+2],this.w=e[i+3],this}toArray(e=[],i=0){return e[i]=this.x,e[i+1]=this.y,e[i+2]=this.z,e[i+3]=this.w,e}fromBufferAttribute(e,i){return this.x=e.getX(i),this.y=e.getY(i),this.z=e.getZ(i),this.w=e.getW(i),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 Nr extends In{constructor(e,i,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=i,this.depth=1,this.scissor=new tt(0,0,e,i),this.scissorTest=!1,this.viewport=new tt(0,0,e,i);const r={width:e,height:i,depth:1};this.texture=new yi(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Ci,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,i,n=1){(this.width!==e||this.height!==i||this.depth!==n)&&(this.width=e,this.height=i,this.depth=n,this.texture.image.width=e,this.texture.image.height=i,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,i),this.scissor.set(0,0,e,i)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const i=Object.assign({},e.texture.image);return this.texture.source=new dm(i),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class fm extends yi{constructor(e=null,i=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:i,height:n,depth:r},this.magFilter=ni,this.minFilter=ni,this.wrapR=Vi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class dy extends yi{constructor(e=null,i=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:i,height:n,depth:r},this.magFilter=ni,this.minFilter=ni,this.wrapR=Vi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Fr{constructor(e=0,i=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=i,this._z=n,this._w=r}static slerpFlat(e,i,n,r,s,o,a){let l=n[r+0],h=n[r+1],f=n[r+2],c=n[r+3];const u=s[o+0],d=s[o+1],m=s[o+2],g=s[o+3];if(a===0){e[i+0]=l,e[i+1]=h,e[i+2]=f,e[i+3]=c;return}if(a===1){e[i+0]=u,e[i+1]=d,e[i+2]=m,e[i+3]=g;return}if(c!==g||l!==u||h!==d||f!==m){let p=1-a;const v=l*u+h*d+f*m+c*g,y=v>=0?1:-1,b=1-v*v;if(b>Number.EPSILON){const M=Math.sqrt(b),w=Math.atan2(M,v*y);p=Math.sin(p*w)/M,a=Math.sin(a*w)/M}const x=a*y;if(l=l*p+u*x,h=h*p+d*x,f=f*p+m*x,c=c*p+g*x,p===1-a){const M=1/Math.sqrt(l*l+h*h+f*f+c*c);l*=M,h*=M,f*=M,c*=M}}e[i]=l,e[i+1]=h,e[i+2]=f,e[i+3]=c}static multiplyQuaternionsFlat(e,i,n,r,s,o){const a=n[r],l=n[r+1],h=n[r+2],f=n[r+3],c=s[o],u=s[o+1],d=s[o+2],m=s[o+3];return e[i]=a*m+f*c+l*d-h*u,e[i+1]=l*m+f*u+h*c-a*d,e[i+2]=h*m+f*d+a*u-l*c,e[i+3]=f*m-a*c-l*u-h*d,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,i,n,r){return this._x=e,this._y=i,this._z=n,this._w=r,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,i){const n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,h=a(n/2),f=a(r/2),c=a(s/2),u=l(n/2),d=l(r/2),m=l(s/2);switch(o){case"XYZ":this._x=u*f*c+h*d*m,this._y=h*d*c-u*f*m,this._z=h*f*m+u*d*c,this._w=h*f*c-u*d*m;break;case"YXZ":this._x=u*f*c+h*d*m,this._y=h*d*c-u*f*m,this._z=h*f*m-u*d*c,this._w=h*f*c+u*d*m;break;case"ZXY":this._x=u*f*c-h*d*m,this._y=h*d*c+u*f*m,this._z=h*f*m+u*d*c,this._w=h*f*c-u*d*m;break;case"ZYX":this._x=u*f*c-h*d*m,this._y=h*d*c+u*f*m,this._z=h*f*m-u*d*c,this._w=h*f*c+u*d*m;break;case"YZX":this._x=u*f*c+h*d*m,this._y=h*d*c+u*f*m,this._z=h*f*m-u*d*c,this._w=h*f*c-u*d*m;break;case"XZY":this._x=u*f*c-h*d*m,this._y=h*d*c-u*f*m,this._z=h*f*m+u*d*c,this._w=h*f*c+u*d*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return i!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,i){const n=i/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const i=e.elements,n=i[0],r=i[4],s=i[8],o=i[1],a=i[5],l=i[9],h=i[2],f=i[6],c=i[10],u=n+a+c;if(u>0){const d=.5/Math.sqrt(u+1);this._w=.25/d,this._x=(f-l)*d,this._y=(s-h)*d,this._z=(o-r)*d}else if(n>a&&n>c){const d=2*Math.sqrt(1+n-a-c);this._w=(f-l)/d,this._x=.25*d,this._y=(r+o)/d,this._z=(s+h)/d}else if(a>c){const d=2*Math.sqrt(1+a-n-c);this._w=(s-h)/d,this._x=(r+o)/d,this._y=.25*d,this._z=(l+f)/d}else{const d=2*Math.sqrt(1+c-n-a);this._w=(o-r)/d,this._x=(s+h)/d,this._y=(l+f)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,i){let n=e.dot(i)+1;return n<Number.EPSILON?(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*i.z-e.z*i.y,this._y=e.z*i.x-e.x*i.z,this._z=e.x*i.y-e.y*i.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ht(this.dot(e),-1,1)))}rotateTowards(e,i){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,i/n);return this.slerp(e,r),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,i){const n=e._x,r=e._y,s=e._z,o=e._w,a=i._x,l=i._y,h=i._z,f=i._w;return this._x=n*f+o*a+r*h-s*l,this._y=r*f+o*l+s*a-n*h,this._z=s*f+o*h+n*l-r*a,this._w=o*f-n*a-r*l-s*h,this._onChangeCallback(),this}slerp(e,i){if(i===0)return this;if(i===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+n*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const d=1-i;return this._w=d*o+i*this._w,this._x=d*n+i*this._x,this._y=d*r+i*this._y,this._z=d*s+i*this._z,this.normalize(),this._onChangeCallback(),this}const h=Math.sqrt(l),f=Math.atan2(h,a),c=Math.sin((1-i)*f)/h,u=Math.sin(i*f)/h;return this._w=o*c+this._w*u,this._x=n*c+this._x*u,this._y=r*c+this._y*u,this._z=s*c+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,i,n){return this.copy(e).slerp(i,n)}random(){const e=Math.random(),i=Math.sqrt(1-e),n=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(i*Math.cos(r),n*Math.sin(s),n*Math.cos(s),i*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,i=0){return this._x=e[i],this._y=e[i+1],this._z=e[i+2],this._w=e[i+3],this._onChangeCallback(),this}toArray(e=[],i=0){return e[i]=this._x,e[i+1]=this._y,e[i+2]=this._z,e[i+3]=this._w,e}fromBufferAttribute(e,i){return this._x=e.getX(i),this._y=e.getY(i),this._z=e.getZ(i),this._w=e.getW(i),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class E{constructor(e=0,i=0,n=0){E.prototype.isVector3=!0,this.x=e,this.y=i,this.z=n}set(e,i,n){return n===void 0&&(n=this.z),this.x=e,this.y=i,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,i){switch(e){case 0:this.x=i;break;case 1:this.y=i;break;case 2:this.z=i;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,i){return this.x=e.x+i.x,this.y=e.y+i.y,this.z=e.z+i.z,this}addScaledVector(e,i){return this.x+=e.x*i,this.y+=e.y*i,this.z+=e.z*i,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,i){return this.x=e.x-i.x,this.y=e.y-i.y,this.z=e.z-i.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,i){return this.x=e.x*i.x,this.y=e.y*i.y,this.z=e.z*i.z,this}applyEuler(e){return this.applyQuaternion(sd.setFromEuler(e))}applyAxisAngle(e,i){return this.applyQuaternion(sd.setFromAxisAngle(e,i))}applyMatrix3(e){const i=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*i+s[3]*n+s[6]*r,this.y=s[1]*i+s[4]*n+s[7]*r,this.z=s[2]*i+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const i=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*i+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*i+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*i+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*i+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){const i=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,h=l*i+o*r-a*n,f=l*n+a*i-s*r,c=l*r+s*n-o*i,u=-s*i-o*n-a*r;return this.x=h*l+u*-s+f*-a-c*-o,this.y=f*l+u*-o+c*-s-h*-a,this.z=c*l+u*-a+h*-o-f*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const i=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*i+s[4]*n+s[8]*r,this.y=s[1]*i+s[5]*n+s[9]*r,this.z=s[2]*i+s[6]*n+s[10]*r,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,i){return this.x=Math.max(e.x,Math.min(i.x,this.x)),this.y=Math.max(e.y,Math.min(i.y,this.y)),this.z=Math.max(e.z,Math.min(i.z,this.z)),this}clampScalar(e,i){return this.x=Math.max(e,Math.min(i,this.x)),this.y=Math.max(e,Math.min(i,this.y)),this.z=Math.max(e,Math.min(i,this.z)),this}clampLength(e,i){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(i,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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,i){return this.x+=(e.x-this.x)*i,this.y+=(e.y-this.y)*i,this.z+=(e.z-this.z)*i,this}lerpVectors(e,i,n){return this.x=e.x+(i.x-e.x)*n,this.y=e.y+(i.y-e.y)*n,this.z=e.z+(i.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,i){const n=e.x,r=e.y,s=e.z,o=i.x,a=i.y,l=i.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){const i=e.lengthSq();if(i===0)return this.set(0,0,0);const n=e.dot(this)/i;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Nl.copy(this).projectOnVector(e),this.sub(Nl)}reflect(e){return this.sub(Nl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const i=Math.sqrt(this.lengthSq()*e.lengthSq());if(i===0)return Math.PI/2;const n=this.dot(e)/i;return Math.acos(Ht(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const i=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return i*i+n*n+r*r}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,i,n){const r=Math.sin(i)*e;return this.x=r*Math.sin(n),this.y=Math.cos(i)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,i,n){return this.x=e*Math.sin(i),this.y=n,this.z=e*Math.cos(i),this}setFromMatrixPosition(e){const i=e.elements;return this.x=i[12],this.y=i[13],this.z=i[14],this}setFromMatrixScale(e){const i=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=i,this.y=n,this.z=r,this}setFromMatrixColumn(e,i){return this.fromArray(e.elements,i*4)}setFromMatrix3Column(e,i){return this.fromArray(e.elements,i*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,i=0){return this.x=e[i],this.y=e[i+1],this.z=e[i+2],this}toArray(e=[],i=0){return e[i]=this.x,e[i+1]=this.y,e[i+2]=this.z,e}fromBufferAttribute(e,i){return this.x=e.getX(i),this.y=e.getY(i),this.z=e.getZ(i),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,i=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(i),this.y=n*Math.sin(i),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Nl=new E,sd=new Fr;class Xi{constructor(e=new E(1/0,1/0,1/0),i=new E(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=i}set(e,i){return this.min.copy(e),this.max.copy(i),this}setFromArray(e){let i=1/0,n=1/0,r=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,h=e.length;l<h;l+=3){const f=e[l],c=e[l+1],u=e[l+2];f<i&&(i=f),c<n&&(n=c),u<r&&(r=u),f>s&&(s=f),c>o&&(o=c),u>a&&(a=u)}return this.min.set(i,n,r),this.max.set(s,o,a),this}setFromBufferAttribute(e){let i=1/0,n=1/0,r=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,h=e.count;l<h;l++){const f=e.getX(l),c=e.getY(l),u=e.getZ(l);f<i&&(i=f),c<n&&(n=c),u<r&&(r=u),f>s&&(s=f),c>o&&(o=c),u>a&&(a=u)}return this.min.set(i,n,r),this.max.set(s,o,a),this}setFromPoints(e){this.makeEmpty();for(let i=0,n=e.length;i<n;i++)this.expandByPoint(e[i]);return this}setFromCenterAndSize(e,i){const n=dr.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,i=!1){return this.makeEmpty(),this.expandByObject(e,i)}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,i=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0)if(i&&n.attributes!=null&&n.attributes.position!==void 0){const s=n.attributes.position;for(let o=0,a=s.count;o<a;o++)dr.fromBufferAttribute(s,o).applyMatrix4(e.matrixWorld),this.expandByPoint(dr)}else n.boundingBox===null&&n.computeBoundingBox(),Ul.copy(n.boundingBox),Ul.applyMatrix4(e.matrixWorld),this.union(Ul);const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],i);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,i){return i.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,dr),dr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let i,n;return e.normal.x>0?(i=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(i=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(i+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(i+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(i+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(i+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),i<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(qs),qo.subVectors(this.max,qs),Yr.subVectors(e.a,qs),$r.subVectors(e.b,qs),Zr.subVectors(e.c,qs),Un.subVectors($r,Yr),Bn.subVectors(Zr,$r),fr.subVectors(Yr,Zr);let i=[0,-Un.z,Un.y,0,-Bn.z,Bn.y,0,-fr.z,fr.y,Un.z,0,-Un.x,Bn.z,0,-Bn.x,fr.z,0,-fr.x,-Un.y,Un.x,0,-Bn.y,Bn.x,0,-fr.y,fr.x,0];return!Bl(i,Yr,$r,Zr,qo)||(i=[1,0,0,0,1,0,0,0,1],!Bl(i,Yr,$r,Zr,qo))?!1:(Xo.crossVectors(Un,Bn),i=[Xo.x,Xo.y,Xo.z],Bl(i,Yr,$r,Zr,qo))}clampPoint(e,i){return i.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return dr.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(dr).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:(mn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),mn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),mn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),mn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),mn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),mn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),mn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),mn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(mn),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)}}const mn=[new E,new E,new E,new E,new E,new E,new E,new E],dr=new E,Ul=new Xi,Yr=new E,$r=new E,Zr=new E,Un=new E,Bn=new E,fr=new E,qs=new E,qo=new E,Xo=new E,pr=new E;function Bl(t,e,i,n,r){for(let s=0,o=t.length-3;s<=o;s+=3){pr.fromArray(t,s);const a=r.x*Math.abs(pr.x)+r.y*Math.abs(pr.y)+r.z*Math.abs(pr.z),l=e.dot(pr),h=i.dot(pr),f=n.dot(pr);if(Math.max(-Math.max(l,h,f),Math.min(l,h,f))>a)return!1}return!0}const fy=new Xi,od=new E,Yo=new E,Fl=new E;class cn{constructor(e=new E,i=-1){this.center=e,this.radius=i}set(e,i){return this.center.copy(e),this.radius=i,this}setFromPoints(e,i){const n=this.center;i!==void 0?n.copy(i):fy.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),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 i=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=i*i}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,i){const n=this.center.distanceToSquared(e);return i.copy(e),n>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i}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){Fl.subVectors(e,this.center);const i=Fl.lengthSq();if(i>this.radius*this.radius){const n=Math.sqrt(i),r=(n-this.radius)*.5;this.center.add(Fl.multiplyScalar(r/n)),this.radius+=r}return this}union(e){return this.center.equals(e.center)===!0?Yo.set(0,0,1).multiplyScalar(e.radius):Yo.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(od.copy(e.center).add(Yo)),this.expandByPoint(od.copy(e.center).sub(Yo)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const gn=new E,kl=new E,$o=new E,Fn=new E,Vl=new E,Zo=new E,Gl=new E;class Rs{constructor(e=new E,i=new E(0,0,-1)){this.origin=e,this.direction=i}set(e,i){return this.origin.copy(e),this.direction.copy(i),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,i){return i.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,gn)),this}closestPointToPoint(e,i){i.subVectors(e,this.origin);const n=i.dot(this.direction);return n<0?i.copy(this.origin):i.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const i=gn.subVectors(e,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(e):(gn.copy(this.direction).multiplyScalar(i).add(this.origin),gn.distanceToSquared(e))}distanceSqToSegment(e,i,n,r){kl.copy(e).add(i).multiplyScalar(.5),$o.copy(i).sub(e).normalize(),Fn.copy(this.origin).sub(kl);const s=e.distanceTo(i)*.5,o=-this.direction.dot($o),a=Fn.dot(this.direction),l=-Fn.dot($o),h=Fn.lengthSq(),f=Math.abs(1-o*o);let c,u,d,m;if(f>0)if(c=o*l-a,u=o*a-l,m=s*f,c>=0)if(u>=-m)if(u<=m){const g=1/f;c*=g,u*=g,d=c*(c+o*u+2*a)+u*(o*c+u+2*l)+h}else u=s,c=Math.max(0,-(o*u+a)),d=-c*c+u*(u+2*l)+h;else u=-s,c=Math.max(0,-(o*u+a)),d=-c*c+u*(u+2*l)+h;else u<=-m?(c=Math.max(0,-(-o*s+a)),u=c>0?-s:Math.min(Math.max(-s,-l),s),d=-c*c+u*(u+2*l)+h):u<=m?(c=0,u=Math.min(Math.max(-s,-l),s),d=u*(u+2*l)+h):(c=Math.max(0,-(o*s+a)),u=c>0?s:Math.min(Math.max(-s,-l),s),d=-c*c+u*(u+2*l)+h);else u=o>0?-s:s,c=Math.max(0,-(o*u+a)),d=-c*c+u*(u+2*l)+h;return n&&n.copy(this.direction).multiplyScalar(c).add(this.origin),r&&r.copy($o).multiplyScalar(u).add(kl),d}intersectSphere(e,i){gn.subVectors(e.center,this.origin);const n=gn.dot(this.direction),r=gn.dot(gn)-n*n,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=n-o,l=n+o;return a<0&&l<0?null:a<0?this.at(l,i):this.at(a,i)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const i=e.normal.dot(this.direction);if(i===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/i;return n>=0?n:null}intersectPlane(e,i){const n=this.distanceToPlane(e);return n===null?null:this.at(n,i)}intersectsPlane(e){const i=e.distanceToPoint(this.origin);return i===0||e.normal.dot(this.direction)*i<0}intersectBox(e,i){let n,r,s,o,a,l;const h=1/this.direction.x,f=1/this.direction.y,c=1/this.direction.z,u=this.origin;return h>=0?(n=(e.min.x-u.x)*h,r=(e.max.x-u.x)*h):(n=(e.max.x-u.x)*h,r=(e.min.x-u.x)*h),f>=0?(s=(e.min.y-u.y)*f,o=(e.max.y-u.y)*f):(s=(e.max.y-u.y)*f,o=(e.min.y-u.y)*f),n>o||s>r||((s>n||n!==n)&&(n=s),(o<r||r!==r)&&(r=o),c>=0?(a=(e.min.z-u.z)*c,l=(e.max.z-u.z)*c):(a=(e.max.z-u.z)*c,l=(e.min.z-u.z)*c),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,i)}intersectsBox(e){return this.intersectBox(e,gn)!==null}intersectTriangle(e,i,n,r,s){Vl.subVectors(i,e),Zo.subVectors(n,e),Gl.crossVectors(Vl,Zo);let o=this.direction.dot(Gl),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Fn.subVectors(this.origin,e);const l=a*this.direction.dot(Zo.crossVectors(Fn,Zo));if(l<0)return null;const h=a*this.direction.dot(Vl.cross(Fn));if(h<0||l+h>o)return null;const f=-a*Fn.dot(Gl);return f<0?null:this.at(f/o,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 Ye{constructor(){Ye.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,i,n,r,s,o,a,l,h,f,c,u,d,m,g,p){const v=this.elements;return v[0]=e,v[4]=i,v[8]=n,v[12]=r,v[1]=s,v[5]=o,v[9]=a,v[13]=l,v[2]=h,v[6]=f,v[10]=c,v[14]=u,v[3]=d,v[7]=m,v[11]=g,v[15]=p,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 Ye().fromArray(this.elements)}copy(e){const i=this.elements,n=e.elements;return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i[4]=n[4],i[5]=n[5],i[6]=n[6],i[7]=n[7],i[8]=n[8],i[9]=n[9],i[10]=n[10],i[11]=n[11],i[12]=n[12],i[13]=n[13],i[14]=n[14],i[15]=n[15],this}copyPosition(e){const i=this.elements,n=e.elements;return i[12]=n[12],i[13]=n[13],i[14]=n[14],this}setFromMatrix3(e){const i=e.elements;return this.set(i[0],i[3],i[6],0,i[1],i[4],i[7],0,i[2],i[5],i[8],0,0,0,0,1),this}extractBasis(e,i,n){return e.setFromMatrixColumn(this,0),i.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,i,n){return this.set(e.x,i.x,n.x,0,e.y,i.y,n.y,0,e.z,i.z,n.z,0,0,0,0,1),this}extractRotation(e){const i=this.elements,n=e.elements,r=1/Jr.setFromMatrixColumn(e,0).length(),s=1/Jr.setFromMatrixColumn(e,1).length(),o=1/Jr.setFromMatrixColumn(e,2).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[3]=0,i[4]=n[4]*s,i[5]=n[5]*s,i[6]=n[6]*s,i[7]=0,i[8]=n[8]*o,i[9]=n[9]*o,i[10]=n[10]*o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}makeRotationFromEuler(e){const i=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),h=Math.sin(r),f=Math.cos(s),c=Math.sin(s);if(e.order==="XYZ"){const u=o*f,d=o*c,m=a*f,g=a*c;i[0]=l*f,i[4]=-l*c,i[8]=h,i[1]=d+m*h,i[5]=u-g*h,i[9]=-a*l,i[2]=g-u*h,i[6]=m+d*h,i[10]=o*l}else if(e.order==="YXZ"){const u=l*f,d=l*c,m=h*f,g=h*c;
vendor: 3,787 bytes, line 5
5i[0]=u+g*a,i[4]=m*a-d,i[8]=o*h,i[1]=o*c,i[5]=o*f,i[9]=-a,i[2]=d*a-m,i[6]=g+u*a,i[10]=o*l}else if(e.order==="ZXY"){const u=l*f,d=l*c,m=h*f,g=h*c;i[0]=u-g*a,i[4]=-o*c,i[8]=m+d*a,i[1]=d+m*a,i[5]=o*f,i[9]=g-u*a,i[2]=-o*h,i[6]=a,i[10]=o*l}else if(e.order==="ZYX"){const u=o*f,d=o*c,m=a*f,g=a*c;i[0]=l*f,i[4]=m*h-d,i[8]=u*h+g,i[1]=l*c,i[5]=g*h+u,i[9]=d*h-m,i[2]=-h,i[6]=a*l,i[10]=o*l}else if(e.order==="YZX"){const u=o*l,d=o*h,m=a*l,g=a*h;i[0]=l*f,i[4]=g-u*c,i[8]=m*c+d,i[1]=c,i[5]=o*f,i[9]=-a*f,i[2]=-h*f,i[6]=d*c+m,i[10]=u-g*c}else if(e.order==="XZY"){const u=o*l,d=o*h,m=a*l,g=a*h;i[0]=l*f,i[4]=-c,i[8]=h*f,i[1]=u*c+g,i[5]=o*f,i[9]=d*c-m,i[2]=m*c-d,i[6]=a*f,i[10]=g*c+u}return i[3]=0,i[7]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}makeRotationFromQuaternion(e){return this.compose(py,e,my)}lookAt(e,i,n){const r=this.elements;return di.subVectors(e,i),di.lengthSq()===0&&(di.z=1),di.normalize(),kn.crossVectors(n,di),kn.lengthSq()===0&&(Math.abs(n.z)===1?di.x+=1e-4:di.z+=1e-4,di.normalize(),kn.crossVectors(n,di)),kn.normalize(),Jo.crossVectors(di,kn),r[0]=kn.x,r[4]=Jo.x,r[8]=di.x,r[1]=kn.y,r[5]=Jo.y,r[9]=di.y,r[2]=kn.z,r[6]=Jo.z,r[10]=di.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,i){const n=e.elements,r=i.elements,s=this.elements,o=n[0],a=n[4],l=n[8],h=n[12],f=n[1],c=n[5],u=n[9],d=n[13],m=n[2],g=n[6],p=n[10],v=n[14],y=n[3],b=n[7],x=n[11],M=n[15],w=r[0],T=r[4],_=r[8],A=r[12],S=r[1],D=r[5],O=r[9],z=r[13],I=r[2],H=r[6],ee=r[10],G=r[14],B=r[3],N=r[7],R=r[11],k=r[15];return s[0]=o*w+a*S+l*I+h*B,s[4]=o*T+a*D+l*H+h*N,s[8]=o*_+a*O+l*ee+h*R,s[12]=o*A+a*z+l*G+h*k,s[1]=f*w+c*S+u*I+d*B,s[5]=f*T+c*D+u*H+d*N,s[9]=f*_+c*O+u*ee+d*R,s[13]=f*A+c*z+u*G+d*k,s[2]=m*w+g*S+p*I+v*B,s[6]=m*T+g*D+p*H+v*N,s[10]=m*_+g*O+p*ee+v*R,s[14]=m*A+g*z+p*G+v*k,s[3]=y*w+b*S+x*I+M*B,s[7]=y*T+b*D+x*H+M*N,s[11]=y*_+b*O+x*ee+M*R,s[15]=y*A+b*z+x*G+M*k,this}multiplyScalar(e){const i=this.elements;return i[0]*=e,i[4]*=e,i[8]*=e,i[12]*=e,i[1]*=e,i[5]*=e,i[9]*=e,i[13]*=e,i[2]*=e,i[6]*=e,i[10]*=e,i[14]*=e,i[3]*=e,i[7]*=e,i[11]*=e,i[15]*=e,this}determinant(){const e=this.elements,i=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],h=e[13],f=e[2],c=e[6],u=e[10],d=e[14],m=e[3],g=e[7],p=e[11],v=e[15];return m*(+s*l*c-r*h*c-s*a*u+n*h*u+r*a*d-n*l*d)+g*(+i*l*d-i*h*u+s*o*u-r*o*d+r*h*f-s*l*f)+p*(+i*h*c-i*a*d-s*o*c+n*o*d+s*a*f-n*h*f)+v*(-r*a*f-i*l*c+i*a*u+r*o*c-n*o*u+n*l*f)}transpose(){const e=this.elements;let i;return i=e[1],e[1]=e[4],e[4]=i,i=e[2],e[2]=e[8],e[8]=i,i=e[6],e[6]=e[9],e[9]=i,i=e[3],e[3]=e[12],e[12]=i,i=e[7],e[7]=e[13],e[13]=i,i=e[11],e[11]=e[14],e[14]=i,this}setPosition(e,i,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=i,r[14]=n),this}invert(){const e=this.elements,i=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],h=e[7],f=e[8],c=e[9],u=e[10],d=e[11],m=e[12],g=e[13],p=e[14],v=e[15],y=c*p*h-g*u*h+g*l*d-a*p*d-c*l*v+a*u*v,b=m*u*h-f*p*h-m*l*d+o*p*d+f*l*v-o*u*v,x=f*g*h-m*c*h+m*a*d-o*g*d-f*a*v+o*c*v,M=m*c*l-f*g*l-m*a*u+o*g*u+f*a*p-o*c*p,w=i*y+n*b+r*x+s*M;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/w;return e[0]=y*T,e[1]=(g*u*s-c*p*s-g*r*d+n*p*d+c*r*v-n*u*v)*T,e[2]=(a*p*s-g*l*s+g*r*h-n*p*h-a*r*v+n*l*v)*T,e[3]=(c*l*s-a*u*s-c*r*h+n*u*h+a*r*d-n*l*d)*T,e[4]=b*T,e[5]=(f*p*s-m*u*s+m*r*d-i*p*d-f*r*v+i*u*v)*T,e[6]=(m*l*s-o*p*s-m*r*h+i*p*h+o*r*v-i*l*v)*T,e[7]=(o*u*s-f*l*s+f*r*h-i*u*h-o*r*d+i*l*d)*T,e[8]=x*T,e[9]=(m*c*s-f*g*s-m*n*d+i*g*d+f*n*v-i*c*v)*T,e[10]=(o*g*s-m*a*s+m*n*h-i*g*h-o*n*v+i*a*v)*T,e[11]=(f*a*s-o*c*s-f*n*h+i*c*h+o*n*d-i*a*d)*T,e[12]=M*T,e[13]=(f*g*r-m*c*r+m*n*u-i*g*u-f*n*p+i*c*p)*T,e[14]=(m*a*r-o*g*r-m*n*l+i*g*l+o*n*p-i*a*p)*T,e[15]=(o*c*r-f*a*r+f*n*l-i*c*l-o*n*u+i*a*u)*T,this}scale(e){const i=this.elements,n=e.x,r=e.y,s=e.z;
vendor: 27,253 bytes, line 5
5return i[0]*=n,i[4]*=r,i[8]*=s,i[1]*=n,i[5]*=r,i[9]*=s,i[2]*=n,i[6]*=r,i[10]*=s,i[3]*=n,i[7]*=r,i[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,i=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],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(i,n,r))}makeTranslation(e,i,n){return this.set(1,0,0,e,0,1,0,i,0,0,1,n,0,0,0,1),this}makeRotationX(e){const i=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,i,-n,0,0,n,i,0,0,0,0,1),this}makeRotationY(e){const i=Math.cos(e),n=Math.sin(e);return this.set(i,0,n,0,0,1,0,0,-n,0,i,0,0,0,0,1),this}makeRotationZ(e){const i=Math.cos(e),n=Math.sin(e);return this.set(i,-n,0,0,n,i,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,i){const n=Math.cos(i),r=Math.sin(i),s=1-n,o=e.x,a=e.y,l=e.z,h=s*o,f=s*a;return this.set(h*o+n,h*a-r*l,h*l+r*a,0,h*a+r*l,f*a+n,f*l-r*o,0,h*l-r*a,f*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,i,n){return this.set(e,0,0,0,0,i,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,i,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,i,r,1,0,0,0,0,1),this}compose(e,i,n){const r=this.elements,s=i._x,o=i._y,a=i._z,l=i._w,h=s+s,f=o+o,c=a+a,u=s*h,d=s*f,m=s*c,g=o*f,p=o*c,v=a*c,y=l*h,b=l*f,x=l*c,M=n.x,w=n.y,T=n.z;return r[0]=(1-(g+v))*M,r[1]=(d+x)*M,r[2]=(m-b)*M,r[3]=0,r[4]=(d-x)*w,r[5]=(1-(u+v))*w,r[6]=(p+y)*w,r[7]=0,r[8]=(m+b)*T,r[9]=(p-y)*T,r[10]=(1-(u+g))*T,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,i,n){const r=this.elements;let s=Jr.set(r[0],r[1],r[2]).length();const o=Jr.set(r[4],r[5],r[6]).length(),a=Jr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],zi.copy(this);const h=1/s,f=1/o,c=1/a;return zi.elements[0]*=h,zi.elements[1]*=h,zi.elements[2]*=h,zi.elements[4]*=f,zi.elements[5]*=f,zi.elements[6]*=f,zi.elements[8]*=c,zi.elements[9]*=c,zi.elements[10]*=c,i.setFromRotationMatrix(zi),n.x=s,n.y=o,n.z=a,this}makePerspective(e,i,n,r,s,o){const a=this.elements,l=2*s/(i-e),h=2*s/(n-r),f=(i+e)/(i-e),c=(n+r)/(n-r),u=-(o+s)/(o-s),d=-2*o*s/(o-s);return a[0]=l,a[4]=0,a[8]=f,a[12]=0,a[1]=0,a[5]=h,a[9]=c,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,i,n,r,s,o){const a=this.elements,l=1/(i-e),h=1/(n-r),f=1/(o-s),c=(i+e)*l,u=(n+r)*h,d=(o+s)*f;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-c,a[1]=0,a[5]=2*h,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*f,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const i=this.elements,n=e.elements;for(let r=0;r<16;r++)if(i[r]!==n[r])return!1;return!0}fromArray(e,i=0){for(let n=0;n<16;n++)this.elements[n]=e[n+i];return this}toArray(e=[],i=0){const n=this.elements;return e[i]=n[0],e[i+1]=n[1],e[i+2]=n[2],e[i+3]=n[3],e[i+4]=n[4],e[i+5]=n[5],e[i+6]=n[6],e[i+7]=n[7],e[i+8]=n[8],e[i+9]=n[9],e[i+10]=n[10],e[i+11]=n[11],e[i+12]=n[12],e[i+13]=n[13],e[i+14]=n[14],e[i+15]=n[15],e}}const Jr=new E,zi=new Ye,py=new E(0,0,0),my=new E(1,1,1),kn=new E,Jo=new E,di=new E,ad=new Ye,ld=new Fr;class nr{constructor(e=0,i=0,n=0,r=nr.DefaultOrder){this.isEuler=!0,this._x=e,this._y=i,this._z=n,this._order=r}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,i,n,r=this._order){return this._x=e,this._y=i,this._z=n,this._order=r,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,i=this._order,n=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],h=r[5],f=r[9],c=r[2],u=r[6],d=r[10];switch(i){case"XYZ":this._y=Math.asin(Ht(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-f,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(u,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Ht(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,h)):(this._y=Math.atan2(-c,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ht(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ht(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,h));break;case"YZX":this._z=Math.asin(Ht(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,h),this._y=Math.atan2(-c,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Ht(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(u,h),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-f,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+i)}return this._order=i,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,i,n){return ad.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ad,i,n)}setFromVector3(e,i=this._order){return this.set(e.x,e.y,e.z,i)}reorder(e){return ld.setFromEuler(this),this.setFromQuaternion(ld,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=[],i=0){return e[i]=this._x,e[i+1]=this._y,e[i+2]=this._z,e[i+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}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}nr.DefaultOrder="XYZ";nr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class zh{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 gy=0;const cd=new E,Kr=new Fr,vn=new Ye,Ko=new E,Xs=new E,vy=new E,yy=new Fr,hd=new E(1,0,0),ud=new E(0,1,0),dd=new E(0,0,1),xy={type:"added"},fd={type:"removed"};class gt extends In{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:gy++}),this.uuid=on(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=gt.DefaultUp.clone();const e=new E,i=new nr,n=new Fr,r=new E(1,1,1);function s(){n.setFromEuler(i,!1)}function o(){i.setFromQuaternion(n,void 0,!1)}i._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Ye},normalMatrix:{value:new qt}}),this.matrix=new Ye,this.matrixWorld=new Ye,this.matrixAutoUpdate=gt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=gt.DefaultMatrixWorldAutoUpdate,this.layers=new zh,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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,i){this.quaternion.setFromAxisAngle(e,i)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,i){return Kr.setFromAxisAngle(e,i),this.quaternion.multiply(Kr),this}rotateOnWorldAxis(e,i){return Kr.setFromAxisAngle(e,i),this.quaternion.premultiply(Kr),this}rotateX(e){return this.rotateOnAxis(hd,e)}rotateY(e){return this.rotateOnAxis(ud,e)}rotateZ(e){return this.rotateOnAxis(dd,e)}translateOnAxis(e,i){return cd.copy(e).applyQuaternion(this.quaternion),this.position.add(cd.multiplyScalar(i)),this}translateX(e){return this.translateOnAxis(hd,e)}translateY(e){return this.translateOnAxis(ud,e)}translateZ(e){return this.translateOnAxis(dd,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(vn.copy(this.matrixWorld).invert())}lookAt(e,i,n){e.isVector3?Ko.copy(e):Ko.set(e,i,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Xs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?vn.lookAt(Xs,Ko,this.up):vn.lookAt(Ko,Xs,this.up),this.quaternion.setFromRotationMatrix(vn),r&&(vn.extractRotation(r.matrixWorld),Kr.setFromRotationMatrix(vn),this.quaternion.premultiply(Kr.invert()))}add(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.add(arguments[i]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(xy)):console.error("THREE.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 i=this.children.indexOf(e);return i!==-1&&(e.parent=null,this.children.splice(i,1),e.dispatchEvent(fd)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const i=this.children[e];i.parent=null,i.dispatchEvent(fd)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),vn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),vn.multiply(e.parent.matrixWorld)),e.applyMatrix4(vn),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,i){if(this[e]===i)return this;for(let n=0,r=this.children.length;n<r;n++){const o=this.children[n].getObjectByProperty(e,i);if(o!==void 0)return o}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xs,e,vy),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xs,yy,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const i=this.matrixWorld.elements;return e.set(i[8],i[9],i[10]).normalize()}raycast(){}traverse(e){e(this);const i=this.children;for(let n=0,r=i.length;n<r;n++)i[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const i=this.children;for(let n=0,r=i.length;n<r;n++)i[n].traverseVisible(e)}traverseAncestors(e){const i=this.parent;i!==null&&(e(i),i.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.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const i=this.children;for(let n=0,r=i.length;n<r;n++){const s=i[n];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,i){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),i===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++){const a=r[s];a.matrixWorldAutoUpdate===!0&&a.updateWorldMatrix(!1,!0)}}}toJSON(e){const i=e===void 0||typeof e=="string",n={};i&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let h=0,f=l.length;h<f;h++){const c=l[h];s(e.shapes,c)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,h=this.material.length;l<h;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(i){const a=o(e.geometries),l=o(e.materials),h=o(e.textures),f=o(e.images),c=o(e.shapes),u=o(e.skeletons),d=o(e.animations),m=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),h.length>0&&(n.textures=h),f.length>0&&(n.images=f),c.length>0&&(n.shapes=c),u.length>0&&(n.skeletons=u),d.length>0&&(n.animations=d),m.length>0&&(n.nodes=m)}return n.object=r,n;function o(a){const l=[];for(const h in a){const f=a[h];delete f.metadata,l.push(f)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,i=!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.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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.userData=JSON.parse(JSON.stringify(e.userData)),i===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}gt.DefaultUp=new E(0,1,0);gt.DefaultMatrixAutoUpdate=!0;gt.DefaultMatrixWorldAutoUpdate=!0;const Ni=new E,yn=new E,Hl=new E,xn=new E,Qr=new E,es=new E,pd=new E,Wl=new E,jl=new E,ql=new E;class en{constructor(e=new E,i=new E,n=new E){this.a=e,this.b=i,this.c=n}static getNormal(e,i,n,r){r.subVectors(n,i),Ni.subVectors(e,i),r.cross(Ni);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,i,n,r,s){Ni.subVectors(r,i),yn.subVectors(n,i),Hl.subVectors(e,i);const o=Ni.dot(Ni),a=Ni.dot(yn),l=Ni.dot(Hl),h=yn.dot(yn),f=yn.dot(Hl),c=o*h-a*a;if(c===0)return s.set(-2,-1,-1);const u=1/c,d=(h*l-a*f)*u,m=(o*f-a*l)*u;return s.set(1-d-m,m,d)}static containsPoint(e,i,n,r){return this.getBarycoord(e,i,n,r,xn),xn.x>=0&&xn.y>=0&&xn.x+xn.y<=1}static getUV(e,i,n,r,s,o,a,l){return this.getBarycoord(e,i,n,r,xn),l.set(0,0),l.addScaledVector(s,xn.x),l.addScaledVector(o,xn.y),l.addScaledVector(a,xn.z),l}static isFrontFacing(e,i,n,r){return Ni.subVectors(n,i),yn.subVectors(e,i),Ni.cross(yn).dot(r)<0}set(e,i,n){return this.a.copy(e),this.b.copy(i),this.c.copy(n),this}setFromPointsAndIndices(e,i,n,r){return this.a.copy(e[i]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,i,n,r){return this.a.fromBufferAttribute(e,i),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),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 Ni.subVectors(this.c,this.b),yn.subVectors(this.a,this.b),Ni.cross(yn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return en.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,i){return en.getBarycoord(e,this.a,this.b,this.c,i)}getUV(e,i,n,r,s){return en.getUV(e,this.a,this.b,this.c,i,n,r,s)}containsPoint(e){return en.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return en.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,i){const n=this.a,r=this.b,s=this.c;let o,a;Qr.subVectors(r,n),es.subVectors(s,n),Wl.subVectors(e,n);const l=Qr.dot(Wl),h=es.dot(Wl);if(l<=0&&h<=0)return i.copy(n);jl.subVectors(e,r);const f=Qr.dot(jl),c=es.dot(jl);if(f>=0&&c<=f)return i.copy(r);const u=l*c-f*h;if(u<=0&&l>=0&&f<=0)return o=l/(l-f),i.copy(n).addScaledVector(Qr,o);ql.subVectors(e,s);const d=Qr.dot(ql),m=es.dot(ql);if(m>=0&&d<=m)return i.copy(s);const g=d*h-l*m;if(g<=0&&h>=0&&m<=0)return a=h/(h-m),i.copy(n).addScaledVector(es,a);const p=f*m-d*c;if(p<=0&&c-f>=0&&d-m>=0)return pd.subVectors(s,r),a=(c-f)/(c-f+(d-m)),i.copy(r).addScaledVector(pd,a);const v=1/(p+g+u);return o=g*v,a=u*v,i.copy(n).addScaledVector(Qr,o).addScaledVector(es,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let _y=0;class Do extends In{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:_y++}),this.uuid=on(),this.name="",this.type="Material",this.blending=Tr,this.side=Or,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=rm,this.blendDst=sm,this.blendEquation=hs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Rc,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=$v,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ol,this.stencilZFail=Ol,this.stencilZPass=Ol,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.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}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const i in e){const n=e[i];if(n===void 0){console.warn("THREE.Material: '"+i+"' parameter is undefined.");continue}const r=this[i];if(r===void 0){console.warn("THREE."+this.type+": '"+i+"' is not a property of this material.");continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[i]=n}}toJSON(e){const i=e===void 0||typeof e=="string";i&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};n.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&&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.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.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.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Tr&&(n.blending=this.blending),this.side!==Or&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,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.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),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=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(i){const s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}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.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 i=e.clippingPlanes;let n=null;if(i!==null){const r=i.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=i[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 4,391 bytes, line 5
5adows,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.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,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 Nh extends Do{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(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.combine=om,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.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 Ut=new E,Qo=new Z;class it{constructor(e,i,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=i,this.count=e!==void 0?e.length/i:0,this.normalized=n===!0,this.usage=Bc,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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}copyAt(e,i,n){e*=this.itemSize,n*=i.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=i.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let i=0,n=this.count;i<n;i++)Qo.fromBufferAttribute(this,i),Qo.applyMatrix3(e),this.setXY(i,Qo.x,Qo.y);else if(this.itemSize===3)for(let i=0,n=this.count;i<n;i++)Ut.fromBufferAttribute(this,i),Ut.applyMatrix3(e),this.setXYZ(i,Ut.x,Ut.y,Ut.z);return this}applyMatrix4(e){for(let i=0,n=this.count;i<n;i++)Ut.fromBufferAttribute(this,i),Ut.applyMatrix4(e),this.setXYZ(i,Ut.x,Ut.y,Ut.z);return this}applyNormalMatrix(e){for(let i=0,n=this.count;i<n;i++)Ut.fromBufferAttribute(this,i),Ut.applyNormalMatrix(e),this.setXYZ(i,Ut.x,Ut.y,Ut.z);return this}transformDirection(e){for(let i=0,n=this.count;i<n;i++)Ut.fromBufferAttribute(this,i),Ut.transformDirection(e),this.setXYZ(i,Ut.x,Ut.y,Ut.z);return this}set(e,i=0){return this.array.set(e,i),this}getX(e){let i=this.array[e*this.itemSize];return this.normalized&&(i=Tn(i,this.array)),i}setX(e,i){return this.normalized&&(i=yt(i,this.array)),this.array[e*this.itemSize]=i,this}getY(e){let i=this.array[e*this.itemSize+1];return this.normalized&&(i=Tn(i,this.array)),i}setY(e,i){return this.normalized&&(i=yt(i,this.array)),this.array[e*this.itemSize+1]=i,this}getZ(e){let i=this.array[e*this.itemSize+2];return this.normalized&&(i=Tn(i,this.array)),i}setZ(e,i){return this.normalized&&(i=yt(i,this.array)),this.array[e*this.itemSize+2]=i,this}getW(e){let i=this.array[e*this.itemSize+3];return this.normalized&&(i=Tn(i,this.array)),i}setW(e,i){return this.normalized&&(i=yt(i,this.array)),this.array[e*this.itemSize+3]=i,this}setXY(e,i,n){return e*=this.itemSize,this.normalized&&(i=yt(i,this.array),n=yt(n,this.array)),this.array[e+0]=i,this.array[e+1]=n,this}setXYZ(e,i,n,r){return e*=this.itemSize,this.normalized&&(i=yt(i,this.array),n=yt(n,this.array),r=yt(r,this.array)),this.array[e+0]=i,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,i,n,r,s){return e*=this.itemSize,this.normalized&&(i=yt(i,this.array),n=yt(n,this.array),r=yt(r,this.array),s=yt(s,this.array)),this.array[e+0]=i,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}
vendor: 3,484 bytes, line 5
5onUpload(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!==Bc&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class pm extends it{constructor(e,i,n){super(new Uint16Array(e),i,n)}}class uo extends it{constructor(e,i,n){super(new Uint32Array(e),i,n)}}class Pe extends it{constructor(e,i,n){super(new Float32Array(e),i,n)}}let by=0;const bi=new Ye,Xl=new gt,ts=new E,fi=new Xi,Ys=new Xi,Vt=new E;class We extends In{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:by++}),this.uuid=on(),this.name="",this.type="BufferGeometry",this.index=null,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(cm(e)?uo:pm)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,i){return this.attributes[e]=i,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,i,n=0){this.groups.push({start:e,count:i,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,i){this.drawRange.start=e,this.drawRange.count=i}applyMatrix4(e){const i=this.attributes.position;i!==void 0&&(i.applyMatrix4(e),i.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new qt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return bi.makeRotationFromQuaternion(e),this.applyMatrix4(bi),this}rotateX(e){return bi.makeRotationX(e),this.applyMatrix4(bi),this}rotateY(e){return bi.makeRotationY(e),this.applyMatrix4(bi),this}rotateZ(e){return bi.makeRotationZ(e),this.applyMatrix4(bi),this}translate(e,i,n){return bi.makeTranslation(e,i,n),this.applyMatrix4(bi),this}scale(e,i,n){return bi.makeScale(e,i,n),this.applyMatrix4(bi),this}lookAt(e){return Xl.lookAt(e),Xl.updateMatrix(),this.applyMatrix4(Xl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ts).negate(),this.translate(ts.x,ts.y,ts.z),this}setFromPoints(e){const i=[];for(let n=0,r=e.length;n<r;n++){const s=e[n];i.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Pe(i,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Xi);const e=this.attributes.position,i=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "fal
5se".',this),this.boundingBox.set(new E(-1/0,-1/0,-1/0),new E(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),i)for(let n=0,r=i.length;n<r;n++){const s=i[n];fi.setFromBufferAttribute(s),this.morphTargetsRelative?(Vt.addVectors(this.boundingBox.min,fi.min),this.boundingBox.expandByPoint(Vt),Vt.addVectors(this.boundingBox.max,fi.max),this.boundingBox.expandByPoint(Vt)):(this.boundingBox.expandByPoint(fi.min),this.boundingBox.expandByPoint(fi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.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 cn);const e=this.attributes.position,i=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
5se".',this),this.boundingSphere.set(new E,1/0);return}if(e){const n=this.boundingSphere.center;if(fi.setFromBufferAttribute(e),i)for(let s=0,o=i.length;s<o;s++){const a=i[s];Ys.setFromBufferAttribute(a),this.morphTargetsRelative?(Vt.addVectors(fi.min,Ys.min),fi.expandByPoint(Vt),Vt.addVectors(fi.max,Ys.max),fi.expandByPoint(Vt)):(fi.expandByPoint(Ys.min),fi.expandByPoint(Ys.max))}fi.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Vt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Vt));if(i)for(let s=0,o=i.length;s<o;s++){const a=i[s],l=this.morphTargetsRelative;for(let h=0,f=a.count;h<f;h++)Vt.fromBufferAttribute(a,h),l&&(ts.fromBufferAttribute(e,h),Vt.add(ts)),r=Math.max(r,n.distanceToSquared(Vt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,i=this.attributes;if(e===null||i.position===void 0||i.normal===void 0||i.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.array,r=i.position.array,s=i.normal.array,o=i.uv.array,a=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new it(new Float32Array(4*a),4));const l=this.getAttribute("tangent").array,h=[],f=[];for(let S=0;S<a;S++)h[S]=new E,f[S]=new E;const c=new E,u=new E,d=new E,m=new Z,g=new Z,p=new Z,v=new E,y=new E;function b(S,D,O){c.fromArray(r,S*3),u.fromArray(r,D*3),d.fromArray(r,O*3),m.fromArray(o,S*2),g.fromArray(o,D*2),p.fromArray(o,O*2),u.sub(c),d.sub(c),g.sub(m),p.sub(m);const z=1/(g.x*p.y-p.x*g.y);!isFinite(z)||(v.copy(u).multiplyScalar(p.y).addScaledVector(d,-g.y).multiplyScalar(z),y.copy(d).multiplyScalar(g.x).addScaledVector(u,-p.x).multiplyScalar(z),h[S].add(v),h[D].add(v),h[O].add(v),f[S].add(y),f[D].add(y),f[O].add(y))}let x=this.groups;x.length===0&&(x=[{start:0,count:n.length}]);for(let S=0,D=x.length;S<D;++S){const O=x[S],z=O.start,I=O.count;for(let H=z,ee=z+I;H<ee;H+=3)b(n[H+0],n[H+1],n[H+2])}const M=new E,w=new E,T=new E,_=new E;function A(S){T.fromArray(s,S*3),_.copy(T);const D=h[S];M.copy(D),M.sub(T.multiplyScalar(T.dot(D))).normalize(),w.crossVectors(_,D);const z=w.dot(f[S])<0?-1:1;l[S*4]=M.x,l[S*4+1]=M.y,l[S*4+2]=M.z,l[S*4+3]=z}for(let S=0,D=x.length;S<D;++S){const O=x[S],z=O.start,I=O.count;for(let H=z,ee=z+I;H<ee;H+=3)A(n[H+0]),A(n[H+1]),A(n[H+2])}}computeVertexNormals(){const e=this.index,i=this.getAttribute("position");if(i!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new it(new Float32Array(i.count*3),3),this.setAttribute("normal",n);else for(let u=0,d=n.count;u<d;u++)n.setXYZ(u,0,0,0);const r=new E,s=new E,o=new E,a=new E,l=new E,h=new E,f=new E,c=new E;if(e)for(let u=0,d=e.count;u<d;u+=3){const m=e.getX(u+0),g=e.getX(u+1),p=e.getX(u+2);r.fromBufferAttribute(i,m),s.fromBufferAttribute(i,g),o.fromBufferAttribute(i,p),f.subVectors(o,s),c.subVectors(r,s),f.cross(c),a.fromBufferAttribute(n,m),l.fromBufferAttribute(n,g),h.fromBufferAttribute(n,p),a.add(f),l.add(f),h.add(f),n.setXYZ(m,a.x,a.y,a.z),n.setXYZ(g,l.x,l.y,l.z),n.setXYZ(p,h.x,h.y,h.z)}else for(let u=0,d=i.count;u<d;u+=3)r.fromBufferAttribute(i,u+0),s.fromBufferAttribute(i,u+1),o.fromBufferAttribute(i,u+2),f.subVectors(o,s),c.subVectors(r,s),f.cross(c),n.setXYZ(u+0,f.x,f.y,f.z),n.setXYZ(u+1,f.x,f.y,f.z),n.setXYZ(u+2,f.x,f.y,f.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){const e=this.attributes.normal;for(let i=0,n=e.count;i<n;i++)Vt.fromBufferAttribute(e,i),Vt.normalize(),e.setXYZ(i,Vt.x,Vt.y,Vt.z)}toNonIndexed(){function e(a,l){const h=a.array,f=a.itemSize,c=a.normalized,u=new h.constructor(l.length*f);let d=0,m=0;for(let g=0,p=l.length;g<p;g++){a.isInterleavedBufferAttribute?d=l[g]*a.data.stride+a.offset:d=l[g]*f;for(let v=0;v<f;v++)u[m++]=h[d++]}return new it(u,f,c)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const i=new We,n=this.index.array,r=this.attributes;for(const a in r){const l=r[a],h=e(l,n);i.setAttribute(a,h)}const s=this.morphAttributes;for(const a in s){const l=[],h=s[a];for(let f=0,c=h.length;f<c;f++){const u=h[f],d=e(u,n);l.push(d)}i.morphAttributes[a]=l}i.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const h=o[a];i.addGroup(h.start,h.count,h.materialIndex)}return i}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 25,452 bytes, lines 5-122
5if(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 l=this.parameters;for(const h in l)l[h]!==void 0&&(e[h]=l[h]);return e}e.data={attributes:{}};const i=this.index;i!==null&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});const n=this.attributes;for(const l in n){const h=n[l];e.data.attributes[l]=h.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const h=this.morphAttributes[l],f=[];for(let c=0,u=h.length;c<u;c++){const d=h[c];f.push(d.toJSON(e.data))}f.length>0&&(r[l]=f,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),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 i={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(i));const r=e.attributes;for(const h in r){const f=r[h];this.setAttribute(h,f.clone(i))}const s=e.morphAttributes;for(const h in s){const f=[],c=s[h];for(let u=0,d=c.length;u<d;u++)f.push(c[u].clone(i));this.morphAttributes[h]=f}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let h=0,f=o.length;h<f;h++){const c=o[h];this.addGroup(c.start,c.count,c.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}const md=new Ye,is=new Rs,Yl=new cn,Vn=new E,Gn=new E,Hn=new E,$l=new E,Zl=new E,Jl=new E,ea=new E,ta=new E,ia=new E,na=new Z,ra=new Z,sa=new Z,Kl=new E,oa=new E;class Di extends gt{constructor(e=new We,i=new Nh){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=i,this.updateMorphTargets()}copy(e,i){return super.copy(e,i),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const i=this.geometry.morphAttributes,n=Object.keys(i);if(n.length>0){const r=i[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}raycast(e,i){const n=this.geometry,r=this.material,s=this.matrixWorld;if(r===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),Yl.copy(n.boundingSphere),Yl.applyMatrix4(s),e.ray.intersectsSphere(Yl)===!1)||(md.copy(s).invert(),is.copy(e.ray).applyMatrix4(md),n.boundingBox!==null&&is.intersectsBox(n.boundingBox)===!1))return;let o;const a=n.index,l=n.attributes.position,h=n.morphAttributes.position,f=n.morphTargetsRelative,c=n.attributes.uv,u=n.attributes.uv2,d=n.groups,m=n.drawRange;if(a!==null)if(Array.isArray(r))for(let g=0,p=d.length;g<p;g++){const v=d[g],y=r[v.materialIndex],b=Math.max(v.start,m.start),x=Math.min(a.count,Math.min(v.start+v.count,m.start+m.count));for(let M=b,w=x;M<w;M+=3){const T=a.getX(M),_=a.getX(M+1),A=a.getX(M+2);o=aa(this,y,e,is,l,h,f,c,u,T,_,A),o&&(o.faceIndex=Math.floor(M/3),o.face.materialIndex=v.materialIndex,i.push(o))}}else{const g=Math.max(0,m.start),p=Math.min(a.count,m.start+m.count);for(let v=g,y=p;v<y;v+=3){const b=a.getX(v),x=a.getX(v+1),M=a.getX(v+2);o=aa(this,r,e,is,l,h,f,c,u,b,x,M),o&&(o.faceIndex=Math.floor(v/3),i.push(o))}}else if(l!==void 0)if(Array.isArray(r))for(let g=0,p=d.length;g<p;g++){const v=d[g],y=r[v.materialIndex],b=Math.max(v.start,m.start),x=Math.min(l.count,Math.min(v.start+v.count,m.start+m.count));for(let M=b,w=x;M<w;M+=3){const T=M,_=M+1,A=M+2;o=aa(this,y,e,is,l,h,f,c,u,T,_,A),o&&(o.faceIndex=Math.floor(M/3),o.face.materialIndex=v.materialIndex,i.push(o))}}else{const g=Math.max(0,m.start),p=Math.min(l.count,m.start+m.count);for(let v=g,y=p;v<y;v+=3){const b=v,x=v+1,M=v+2;o=aa(this,r,e,is,l,h,f,c,u,b,x,M),o&&(o.faceIndex=Math.floor(v/3),i.push(o))}}}}function wy(t,e,i,n,r,s,o,a){let l;if(e.side===vi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side!==An,a),l===null)return null;oa.copy(a),oa.applyMatrix4(t.matrixWorld);const h=i.ray.origin.distanceTo(oa);return h<i.near||h>i.far?null:{distance:h,point:oa.clone(),object:t}}function aa(t,e,i,n,r,s,o,a,l,h,f,c){Vn.fromBufferAttribute(r,h),Gn.fromBufferAttribute(r,f),Hn.fromBufferAttribute(r,c);const u=t.morphTargetInfluences;if(s&&u){ea.set(0,0,0),ta.set(0,0,0),ia.set(0,0,0);for(let m=0,g=s.length;m<g;m++){const p=u[m],v=s[m];p!==0&&($l.fromBufferAttribute(v,h),Zl.fromBufferAttribute(v,f),Jl.fromBufferAttribute(v,c),o?(ea.addScaledVector($l,p),ta.addScaledVector(Zl,p),ia.addScaledVector(Jl,p)):(ea.addScaledVector($l.sub(Vn),p),ta.addScaledVector(Zl.sub(Gn),p),ia.addScaledVector(Jl.sub(Hn),p)))}Vn.add(ea),Gn.add(ta),Hn.add(ia)}t.isSkinnedMesh&&(t.boneTransform(h,Vn),t.boneTransform(f,Gn),t.boneTransform(c,Hn));const d=wy(t,e,i,n,Vn,Gn,Hn,Kl);if(d){a&&(na.fromBufferAttribute(a,h),ra.fromBufferAttribute(a,f),sa.fromBufferAttribute(a,c),d.uv=en.getUV(Kl,Vn,Gn,Hn,na,ra,sa,new Z)),l&&(na.fromBufferAttribute(l,h),ra.fromBufferAttribute(l,f),sa.fromBufferAttribute(l,c),d.uv2=en.getUV(Kl,Vn,Gn,Hn,na,ra,sa,new Z));const m={a:h,b:f,c,normal:new E,materialIndex:0};en.getNormal(Vn,Gn,Hn,m.normal),d.face=m}return d}class Dn extends We{constructor(e=1,i=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:i,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],h=[],f=[],c=[];let u=0,d=0;m("z","y","x",-1,-1,n,i,e,o,s,0),m("z","y","x",1,-1,n,i,-e,o,s,1),m("x","z","y",1,1,e,n,i,r,o,2),m("x","z","y",1,-1,e,n,-i,r,o,3),m("x","y","z",1,-1,e,i,n,r,s,4),m("x","y","z",-1,-1,e,i,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Pe(h,3)),this.setAttribute("normal",new Pe(f,3)),this.setAttribute("uv",new Pe(c,2));function m(g,p,v,y,b,x,M,w,T,_,A){const S=x/T,D=M/_,O=x/2,z=M/2,I=w/2,H=T+1,ee=_+1;let G=0,B=0;const N=new E;for(let R=0;R<ee;R++){const k=R*D-z;for(let F=0;F<H;F++){const U=F*S-O;N[g]=U*y,N[p]=k*b,N[v]=I,h.push(N.x,N.y,N.z),N[g]=0,N[p]=0,N[v]=w>0?1:-1,f.push(N.x,N.y,N.z),c.push(F/T),c.push(1-R/_),G+=1}}for(let R=0;R<_;R++)for(let k=0;k<T;k++){const F=u+k+H*R,U=u+k+H*(R+1),W=u+(k+1)+H*(R+1),ie=u+(k+1)+H*R;l.push(F,U,ie),l.push(U,W,ie),B+=6}a.addGroup(d,B,A),d+=B,u+=G}}static fromJSON(e){return new Dn(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Es(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function Yt(t){const e={};for(let i=0;i<t.length;i++){const n=Es(t[i]);for(const r in n)e[r]=n[r]}return e}function Sy(t){const e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}const Is={clone:Es,merge:Yt};var My=`void main() {
6	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7}`,Ay=`void main() {
8	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
9}`;class rr extends Do{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=My,this.fragmentShader=Ay,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[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=Es(e.uniforms),this.uniformsGroups=Sy(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}toJSON(e){const i=super.toJSON(e);i.glslVersion=this.glslVersion,i.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?i.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?i.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?i.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?i.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?i.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?i.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?i.uniforms[r]={type:"m4",value:o.toArray()}:i.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(i.defines=this.defines),i.vertexShader=this.vertexShader,i.fragmentShader=this.fragmentShader;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(i.extensions=n),i}}class Oo extends gt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ye,this.projectionMatrix=new Ye,this.projectionMatrixInverse=new Ye}copy(e,i){return super.copy(e,i),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const i=this.matrixWorld.elements;return e.set(-i[8],-i[9],-i[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,i){super.updateWorldMatrix(e,i),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class ri extends Oo{constructor(e=50,i=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=i,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,i){return super.copy(e,i),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 i=.5*this.getFilmHeight()/e;this.fov=xo*2*Math.atan(i),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(co*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return xo*2*Math.atan(Math.tan(co*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,i,n,r,s,o){this.aspect=e/i,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=i,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let i=e*Math.tan(co*.5*this.fov)/this.zoom,n=2*i,r=this.aspect*n,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,h=o.fullHeight;s+=o.offsetX*r/l,i-=o.offsetY*n/h,r*=o.width/l,n*=o.height/h}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,i,i-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const i=super.toJSON(e);return i.object.fov=this.fov,i.object.zoom=this.zoom,i.object.near=this.near,i.object.far=this.far,i.object.focus=this.focus,i.object.aspect=this.aspect,this.view!==null&&(i.object.view=Object.assign({},this.view)),i.object.filmGauge=this.filmGauge,i.object.filmOffset=this.filmOffset,i}}const ns=90,rs=1;class Ty extends gt{constructor(e,i,n){super(),this.type="CubeCamera",this.renderTarget=n;const r=new ri(ns,rs,e,i);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new E(1,0,0)),this.add(r);const s=new ri(ns,rs,e,i);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new E(-1,0,0)),this.add(s);const o=new ri(ns,rs,e,i);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new E(0,1,0)),this.add(o);const a=new ri(ns,rs,e,i);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new E(0,-1,0)),this.add(a);const l=new ri(ns,rs,e,i);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new E(0,0,1)),this.add(l);const h=new ri(ns,rs,e,i);h.layers=this.layers,h.up.set(0,-1,0),h.lookAt(new E(0,0,-1)),this.add(h)}update(e,i){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget,[r,s,o,a,l,h]=this.children,f=e.getRenderTarget(),c=e.toneMapping,u=e.xr.enabled;e.toneMapping=Cn,e.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(i,r),e.setRenderTarget(n,1),e.render(i,s),e.setRenderTarget(n,2),e.render(i,o),e.setRenderTarget(n,3),e.render(i,a),e.setRenderTarget(n,4),e.render(i,l),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(i,h),e.setRenderTarget(f),e.toneMapping=c,e.xr.enabled=u,n.texture.needsPMREMUpdate=!0}}class Uh extends yi{constructor(e,i,n,r,s,o,a,l,h,f){e=e!==void 0?e:[],i=i!==void 0?i:Rr,super(e,i,n,r,s,o,a,l,h,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Ey extends Nr{constructor(e,i={}){super(e,e,i),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Uh(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:Ci}fromEquirectangularTexture(e,i){this.texture.type=i.type,this.texture.encoding=i.encoding,this.texture.generateMipmaps=i.generateMipmaps,this.texture.minFilter=i.minFilter,this.texture.magFilter=i.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
10
11				varying vec3 vWorldDirection;
12
13				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
14
15					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
16
17				}
18
19				void main() {
20
21					vWorldDirection = transformDirection( position, modelMatrix );
22
23					#include <begin_vertex>
24					#include <project_vertex>
25
26				}
27			`,fragmentShader:`
28
29				uniform sampler2D tEquirect;
30
31				varying vec3 vWorldDirection;
32
33				#include <common>
34
35				void main() {
36
37					vec3 direction = normalize( vWorldDirection );
38
39					vec2 sampleUV = equirectUv( direction );
40
41					gl_FragColor = texture2D( tEquirect, sampleUV );
42
43				}
44			`},r=new Dn(5,5,5),s=new rr({name:"CubemapFromEquirect",uniforms:Es(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:vi,blending:tr});s.uniforms.tEquirect.value=i;const o=new Di(r,s),a=i.minFilter;return i.minFilter===il&&(i.minFilter=Ci),new Ty(1,10,this).update(e,o),i.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,i,n,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(i,n,r);e.setRenderTarget(s)}}const Ql=new E,Cy=new E,Ly=new qt;class qn{constructor(e=new E(1,0,0),i=0){this.isPlane=!0,this.normal=e,this.constant=i}set(e,i){return this.normal.copy(e),this.constant=i,this}setComponents(e,i,n,r){return this.normal.set(e,i,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,i){return this.normal.copy(e),this.constant=-i.dot(this.normal),this}setFromCoplanarPoints(e,i,n){const r=Ql.subVectors(n,i).cross(Cy.subVectors(e,i)).normalize();return this.setFromNormalAndCoplanarPoint(r,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,i){return i.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,i){const n=e.delta(Ql),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?i.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:i.copy(n).multiplyScalar(s).add(e.start)}intersectsLine(e){const i=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return i<0&&n>0||n<0&&i>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,i){const n=i||Ly.getNormalMatrix(e),r=this.coplanarPoint(Ql).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.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 ss=new cn,la=new E;class Bh{constructor(e=new qn,i=new qn,n=new qn,r=new qn,s=new qn,o=new qn){this.planes=[e,i,n,r,s,o]}set(e,i,n,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(i),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const i=this.planes;for(let n=0;n<6;n++)i[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const i=this.planes,n=e.elements,r=n[0],s=n[1],o=n[2],a=n[3],l=n[4],h=n[5],f=n[6],c=n[7],u=n[8],d=n[9],m=n[10],g=n[11],p=n[12],v=n[13],y=n[14],b=n[15];return i[0].setComponents(a-r,c-l,g-u,b-p).normalize(),i[1].setComponents(a+r,c+l,g+u,b+p).normalize(),i[2].setComponents(a+s,c+h,g+d,b+v).normalize(),i[3].setComponents(a-s,c-h,g-d,b-v).normalize(),i[4].setComponents(a-o,c-f,g-m,b-y).normalize(),i[5].setComponents(a+o,c+f,g+m,b+y).normalize(),this}intersectsObject(e){const i=e.geometry;return i.boundingSphere===null&&i.computeBoundingSphere(),ss.copy(i.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ss)}intersectsSprite(e){return ss.center.set(0,0,0),ss.radius=.7071067811865476,ss.applyMatrix4(e.matrixWorld),this.intersectsSphere(ss)}intersectsSphere(e){const i=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(i[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const i=this.planes;for(let n=0;n<6;n++){const r=i[n];if(la.x=r.normal.x>0?e.max.x:e.min.x,la.y=r.normal.y>0?e.max.y:e.min.y,la.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(la)<0)return!1}return!0}containsPoint(e){const i=this.planes;for(let n=0;n<6;n++)if(i[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function mm(){let t=null,e=!1,i=null,n=null;function r(s,o){i(s,o),n=t.requestAnimationFrame(r)}return{start:function(){e!==!0&&i!==null&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){i=s},setContext:function(s){t=s}}}function Py(t,e){const i=e.isWebGL2,n=new WeakMap;function r(h,f){const c=h.array,u=h.usage,d=t.createBuffer();t.bindBuffer(f,d),t.bufferData(f,c,u),h.onUploadCallback();let m;if(c instanceof Float32Array)m=5126;else if(c instanceof Uint16Array)if(h.isFloat16BufferAttribute)if(i)m=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else m=5123;else if(c instanceof Int16Array)m=5122;else if(c instanceof Uint32Array)m=5125;else if(c instanceof Int32Array)m=5124;else if(c instanceof Int8Array)m=5120;else if(c instanceof Uint8Array)m=5121;else if(c instanceof Uint8ClampedArray)m=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:h.version}}function s(h,f,c){const u=f.array,d=f.updateRange;t.bindBuffer(c,h),d.count===-1?t.bufferSubData(c,0,u):(i?t.bufferSubData(c,d.offset*u.BYTES_PER_ELEMENT,u,d.offset,d.count):t.bufferSubData(c,d.offset*u.BYTES_PER_ELEMENT,u.subarray(d.offset,d.offset+d.count)),d.count=-1)}function o(h){return h.isInterleavedBufferAttribute&&(h=h.data),n.get(h)}function a(h){h.isInterleavedBufferAttribute&&(h=h.data);const f=n.get(h);f&&(t.deleteBuffer(f.buffer),n.delete(h))}function l(h,f){if(h.isGLBufferAttribute){const u=n.get(h);(!u||u.version<h.version)&&n.set(h,{buffer:h.buffer,type:h.type,bytesPerElement:h.elementSize,version:h.version});return}h.isInterleavedBufferAttribute&&(h=h.data);const c=n.get(h);c===void 0?n.set(h,r(h,f)):c.version<h.version&&(s(c.buffer,h,f),c.version=h.version)}return{get:o,remove:a,update:l}}class Ro extends We{constructor(e=1,i=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:i,widthSegments:n,heightSegments:r};const s=e/2,o=i/2,a=Math.floor(n),l=Math.floor(r),h=a+1,f=l+1,c=e/a,u=i/l,d=[],m=[],g=[],p=[];for(let v=0;v<f;v++){const y=v*u-o;for(let b=0;b<h;b++){const x=b*c-s;m.push(x,-y,0),g.push(0,0,1),p.push(b/a),p.push(1-v/l)}}for(let v=0;v<l;v++)for(let y=0;y<a;y++){const b=y+h*v,x=y+h*(v+1),M=y+1+h*(v+1),w=y+1+h*v;d.push(b,x,w),d.push(x,M,w)}this.setIndex(d),this.setAttribute("position",new Pe(m,3)),this.setAttribute("normal",new Pe(g,3)),this.setAttribute("uv",new Pe(p,2))}static fromJSON(e){return new Ro(e.width,e.height,e.widthSegments,e.heightSegments)}}var Dy=`#ifdef USE_ALPHAMAP
45	diffuseColor.a *= texture2D( alphaMap, vUv ).g;
46#endif`,Oy=`#ifdef USE_ALPHAMAP
47	uniform sampler2D alphaMap;
48#endif`,Ry=`#ifdef USE_ALPHATEST
49	if ( diffuseColor.a < alphaTest ) discard;
50#endif`,Iy=`#ifdef USE_ALPHATEST
51	uniform float alphaTest;
52#endif`,zy=`#ifdef USE_AOMAP
53	float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
54	reflectedLight.indirectDiffuse *= ambientOcclusion;
55	#if defined( USE_ENVMAP ) && defined( STANDARD )
56		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
57		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
58	#endif
59#endif`,Ny=`#ifdef USE_AOMAP
60	uniform sampler2D aoMap;
61	uniform float aoMapIntensity;
62#endif`,Uy="vec3 transformed = vec3( position );",By=`vec3 objectNormal = vec3( normal );
63#ifdef USE_TANGENT
64	vec3 objectTangent = vec3( tangent.xyz );
65#endif`,Fy=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
66	return RECIPROCAL_PI * diffuseColor;
67}
68vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
69	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
70	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
71}
72float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
73	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
74	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
75}
76vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
77    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
78    float x2 = x * x;
79    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
80    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
81}
82float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
83	float a2 = pow2( alpha );
84	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
85	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
86	return 0.5 / max( gv + gl, EPSILON );
87}
88float D_GGX( const in float alpha, const in float dotNH ) {
89	float a2 = pow2( alpha );
90	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
91	return RECIPROCAL_PI * a2 / pow2( denom );
92}
93vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
94	float alpha = pow2( roughness );
95	vec3 halfDir = normalize( lightDir + viewDir );
96	float dotNL = saturate( dot( normal, lightDir ) );
97	float dotNV = saturate( dot( normal, viewDir ) );
98	float dotNH = saturate( dot( normal, halfDir ) );
99	float dotVH = saturate( dot( viewDir, halfDir ) );
100	vec3 F = F_Schlick( f0, f90, dotVH );
101	float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
102	float D = D_GGX( alpha, dotNH );
103	return F * ( V * D );
104}
105#ifdef USE_IRIDESCENCE
106	vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {
107		float alpha = pow2( roughness );
108		vec3 halfDir = normalize( lightDir + viewDir );
109		float dotNL = saturate( dot( normal, lightDir ) );
110		float dotNV = saturate( dot( normal, viewDir ) );
111		float dotNH = saturate( dot( normal, halfDir ) );
112		float dotVH = saturate( dot( viewDir, halfDir ) );
113		vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );
114		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
115		float D = D_GGX( alpha, dotNH );
116		return F * ( V * D );
117	}
118#endif
119vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
120	const float LUT_SIZE = 64.0;
121	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
122	const float LUT_BIAS = 0.5 / LUT_SIZE;
123	float dotNV = saturate( dot( N, V ) );
124	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
125	uv = uv * LUT_SCALE + LUT_BIAS;
126	return uv;
127}
128float LTC_ClippedSphereFormFactor( const in vec3 f ) {
129	float l = length( f );
130	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
131}
132vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
133	float x = dot( v1, v2 );
134	float y = abs( x );
135	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
136	float b = 3.4175940 + ( 4.1616724 + y ) * y;
137	float v = a / b;
138	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
139	return cross( v1, v2 ) * theta_sintheta;
140}
141vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
142	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
143	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
144	vec3 lightNormal = cross( v1, v2 );
145	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
146	vec3 T1, T2;
147	T1 = normalize( V - N * dot( V, N ) );
148	T2 = - cross( N, T1 );
149	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
150	vec3 coords[ 4 ];
151	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
152	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
153	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
154	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
155	coords[ 0 ] = normalize( coords[ 0 ] );
156	coords[ 1 ] = normalize( coords[ 1 ] );
157	coords[ 2 ] = normalize( coords[ 2 ] );
158	coords[ 3 ] = normalize( coords[ 3 ] );
159	vec3 vectorFormFactor = vec3( 0.0 );
160	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
161	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
162	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
163	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
164	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
165	return vec3( result );
166}
167float G_BlinnPhong_Implicit( ) {
168	return 0.25;
169}
170float D_BlinnPhong( const in float shininess, const in float dotNH ) {
171	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
172}
173vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
174	vec3 halfDir = normalize( lightDir + viewDir );
175	float dotNH = saturate( dot( normal, halfDir ) );
176	float dotVH = saturate( dot( viewDir, halfDir ) );
177	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
178	float G = G_BlinnPhong_Implicit( );
179	float D = D_BlinnPhong( shininess, dotNH );
180	return F * ( G * D );
181}
182#if defined( USE_SHEEN )
183float D_Charlie( float roughness, float dotNH ) {
184	float alpha = pow2( roughness );
185	float invAlpha = 1.0 / alpha;
186	float cos2h = dotNH * dotNH;
187	float sin2h = max( 1.0 - cos2h, 0.0078125 );
188	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
189}
190float V_Neubelt( float dotNV, float dotNL ) {
191	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
192}
193vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
194	vec3 halfDir = normalize( lightDir + viewDir );
195	float dotNL = saturate( dot( normal, lightDir ) );
196	float dotNV = saturate( dot( normal, viewDir ) );
197	float dotNH = saturate( dot( normal, halfDir ) );
198	float D = D_Charlie( sheenRoughness, dotNH );
199	float V = V_Neubelt( dotNV, dotNL );
200	return sheenColor * ( D * V );
201}
202#endif`,ky=`#ifdef USE_IRIDESCENCE
203	const mat3 XYZ_TO_REC709 = mat3(
204		 3.2404542, -0.9692660,  0.0556434,
205		-1.5371385,  1.8760108, -0.2040259,
206		-0.4985314,  0.0415560,  1.0572252
207	);
208	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
209		vec3 sqrtF0 = sqrt( fresnel0 );
210		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
211	}
212	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
213		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
214	}
215	float IorToFresnel0( float transmittedIor, float incidentIor ) {
216		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
217	}
218	vec3 evalSensitivity( float OPD, vec3 shift ) {
219		float phase = 2.0 * PI * OPD * 1.0e-9;
220		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
221		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
222		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
223		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
224		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 ) );
225		xyz /= 1.0685e-7;
226		vec3 rgb = XYZ_TO_REC709 * xyz;
227		return rgb;
228	}
229	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
230		vec3 I;
231		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
232		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
233		float cosTheta2Sq = 1.0 - sinTheta2Sq;
234		if ( cosTheta2Sq < 0.0 ) {
235			 return vec3( 1.0 );
236		}
237		float cosTheta2 = sqrt( cosTheta2Sq );
238		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
239		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
240		float R21 = R12;
241		float T121 = 1.0 - R12;
242		float phi12 = 0.0;
243		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
244		float phi21 = PI - phi12;
245		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
246		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
247		vec3 phi23 = vec3( 0.0 );
248		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
249		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
250		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
251		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
252		vec3 phi = vec3( phi21 ) + phi23;
253		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
254		vec3 r123 = sqrt( R123 );
255		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
256		vec3 C0 = R12 + Rs;
257		I = C0;
258		vec3 Cm = Rs - T121;
259		for ( int m = 1; m <= 2; ++ m ) {
260			Cm *= r123;
261			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
262			I += Cm * Sm;
263		}
264		return max( I, vec3( 0.0 ) );
265	}
266#endif`,Vy=`#ifdef USE_BUMPMAP
267	uniform sampler2D bumpMap;
268	uniform float bumpScale;
269	vec2 dHdxy_fwd() {
270		vec2 dSTdx = dFdx( vUv );
271		vec2 dSTdy = dFdy( vUv );
272		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
273		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
274		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
275		return vec2( dBx, dBy );
276	}
277	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
278		vec3 vSigmaX = dFdx( surf_pos.xyz );
279		vec3 vSigmaY = dFdy( surf_pos.xyz );
280		vec3 vN = surf_norm;
281		vec3 R1 = cross( vSigmaY, vN );
282		vec3 R2 = cross( vN, vSigmaX );
283		float fDet = dot( vSigmaX, R1 ) * faceDirection;
284		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
285		return normalize( abs( fDet ) * surf_norm - vGrad );
286	}
287#endif`,Gy=`#if NUM_CLIPPING_PLANES > 0
288	vec4 plane;
289	#pragma unroll_loop_start
290	for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
291		plane = clippingPlanes[ i ];
292		if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
293	}
294	#pragma unroll_loop_end
295	#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
296		bool clipped = true;
297		#pragma unroll_loop_start
298		for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
299			plane = clippingPlanes[ i ];
300			clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
301		}
302		#pragma unroll_loop_end
303		if ( clipped ) discard;
304	#endif
305#endif`,Hy=`#if NUM_CLIPPING_PLANES > 0
306	varying vec3 vClipPosition;
307	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
308#endif`,Wy=`#if NUM_CLIPPING_PLANES > 0
309	varying vec3 vClipPosition;
310#endif`,jy=`#if NUM_CLIPPING_PLANES > 0
311	vClipPosition = - mvPosition.xyz;
312#endif`,qy=`#if defined( USE_COLOR_ALPHA )
313	diffuseColor *= vColor;
314#elif defined( USE_COLOR )
315	diffuseColor.rgb *= vColor;
316#endif`,Xy=`#if defined( USE_COLOR_ALPHA )
317	varying vec4 vColor;
318#elif defined( USE_COLOR )
319	varying vec3 vColor;
320#endif`,Yy=`#if defined( USE_COLOR_ALPHA )
321	varying vec4 vColor;
322#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
323	varying vec3 vColor;
324#endif`,$y=`#if defined( USE_COLOR_ALPHA )
325	vColor = vec4( 1.0 );
326#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
327	vColor = vec3( 1.0 );
328#endif
329#ifdef USE_COLOR
330	vColor *= color;
331#endif
332#ifdef USE_INSTANCING_COLOR
333	vColor.xyz *= instanceColor.xyz;
334#endif`,Zy=`#define PI 3.141592653589793
335#define PI2 6.283185307179586
336#define PI_HALF 1.5707963267948966
337#define RECIPROCAL_PI 0.3183098861837907
338#define RECIPROCAL_PI2 0.15915494309189535
339#define EPSILON 1e-6
340#ifndef saturate
341#define saturate( a ) clamp( a, 0.0, 1.0 )
342#endif
343#define whiteComplement( a ) ( 1.0 - saturate( a ) )
344float pow2( const in float x ) { return x*x; }
345vec3 pow2( const in vec3 x ) { return x*x; }
346float pow3( const in float x ) { return x*x*x; }
347float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
348float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
349float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
350highp float rand( const in vec2 uv ) {
351	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
352	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
353	return fract( sin( sn ) * c );
354}
355#ifdef HIGH_PRECISION
356	float precisionSafeLength( vec3 v ) { return length( v ); }
357#else
358	float precisionSafeLength( vec3 v ) {
359		float maxComponent = max3( abs( v ) );
360		return length( v / maxComponent ) * maxComponent;
361	}
362#endif
363struct IncidentLight {
364	vec3 color;
365	vec3 direction;
366	bool visible;
367};
368struct ReflectedLight {
369	vec3 directDiffuse;
370	vec3 directSpecular;
371	vec3 indirectDiffuse;
372	vec3 indirectSpecular;
373};
374struct GeometricContext {
375	vec3 position;
376	vec3 normal;
377	vec3 viewDir;
378#ifdef USE_CLEARCOAT
379	vec3 clearcoatNormal;
380#endif
381};
382vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
383	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
384}
385vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
386	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
387}
388mat3 transposeMat3( const in mat3 m ) {
389	mat3 tmp;
390	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
391	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
392	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
393	return tmp;
394}
395float luminance( const in vec3 rgb ) {
396	const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
397	return dot( weights, rgb );
398}
399bool isPerspectiveMatrix( mat4 m ) {
400	return m[ 2 ][ 3 ] == - 1.0;
401}
402vec2 equirectUv( in vec3 dir ) {
403	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
404	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
405	return vec2( u, v );
406}`,Jy=`#ifdef ENVMAP_TYPE_CUBE_UV
407	#define cubeUV_minMipLevel 4.0
408	#define cubeUV_minTileSize 16.0
409	float getFace( vec3 direction ) {
410		vec3 absDirection = abs( direction );
411		float face = - 1.0;
412		if ( absDirection.x > absDirection.z ) {
413			if ( absDirection.x > absDirection.y )
414				face = direction.x > 0.0 ? 0.0 : 3.0;
415			else
416				face = direction.y > 0.0 ? 1.0 : 4.0;
417		} else {
418			if ( absDirection.z > absDirection.y )
419				face = direction.z > 0.0 ? 2.0 : 5.0;
420			else
421				face = direction.y > 0.0 ? 1.0 : 4.0;
422		}
423		return face;
424	}
425	vec2 getUV( vec3 direction, float face ) {
426		vec2 uv;
427		if ( face == 0.0 ) {
428			uv = vec2( direction.z, direction.y ) / abs( direction.x );
429		} else if ( face == 1.0 ) {
430			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
431		} else if ( face == 2.0 ) {
432			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
433		} else if ( face == 3.0 ) {
434			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
435		} else if ( face == 4.0 ) {
436			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
437		} else {
438			uv = vec2( direction.x, direction.y ) / abs( direction.z );
439		}
440		return 0.5 * ( uv + 1.0 );
441	}
442	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
443		float face = getFace( direction );
444		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
445		mipInt = max( mipInt, cubeUV_minMipLevel );
446		float faceSize = exp2( mipInt );
447		vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
448		if ( face > 2.0 ) {
449			uv.y += faceSize;
450			face -= 3.0;
451		}
452		uv.x += face * faceSize;
453		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
454		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
455		uv.x *= CUBEUV_TEXEL_WIDTH;
456		uv.y *= CUBEUV_TEXEL_HEIGHT;
457		#ifdef texture2DGradEXT
458			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
459		#else
460			return texture2D( envMap, uv ).rgb;
461		#endif
462	}
463	#define cubeUV_r0 1.0
464	#define cubeUV_v0 0.339
465	#define cubeUV_m0 - 2.0
466	#define cubeUV_r1 0.8
467	#define cubeUV_v1 0.276
468	#define cubeUV_m1 - 1.0
469	#define cubeUV_r4 0.4
470	#define cubeUV_v4 0.046
471	#define cubeUV_m4 2.0
472	#define cubeUV_r5 0.305
473	#define cubeUV_v5 0.016
474	#define cubeUV_m5 3.0
475	#define cubeUV_r6 0.21
476	#define cubeUV_v6 0.0038
477	#define cubeUV_m6 4.0
478	float roughnessToMip( float roughness ) {
479		float mip = 0.0;
480		if ( roughness >= cubeUV_r1 ) {
481			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
482		} else if ( roughness >= cubeUV_r4 ) {
483			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
484		} else if ( roughness >= cubeUV_r5 ) {
485			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
486		} else if ( roughness >= cubeUV_r6 ) {
487			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
488		} else {
489			mip = - 2.0 * log2( 1.16 * roughness );		}
490		return mip;
491	}
492	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
493		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
494		float mipF = fract( mip );
495		float mipInt = floor( mip );
496		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
497		if ( mipF == 0.0 ) {
498			return vec4( color0, 1.0 );
499		} else {
500			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
501			return vec4( mix( color0, color1, mipF ), 1.0 );
502		}
503	}
504#endif`,Ky=`vec3 transformedNormal = objectNormal;
505#ifdef USE_INSTANCING
506	mat3 m = mat3( instanceMatrix );
507	transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
508	transformedNormal = m * transformedNormal;
509#endif
510transformedNormal = normalMatrix * transformedNormal;
511#ifdef FLIP_SIDED
512	transformedNormal = - transformedNormal;
513#endif
514#ifdef USE_TANGENT
515	vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
516	#ifdef FLIP_SIDED
517		transformedTangent = - transformedTangent;
518	#endif
519#endif`,Qy=`#ifdef USE_DISPLACEMENTMAP
520	uniform sampler2D displacementMap;
521	uniform float displacementScale;
522	uniform float displacementBias;
523#endif`,ex=`#ifdef USE_DISPLACEMENTMAP
524	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + dis
524placementBias );
525#endif`,tx=`#ifdef USE_EMISSIVEMAP
526	vec4 emissiveColor = texture2D( emissiveMap, vUv );
527	totalEmissiveRadiance *= emissiveColor.rgb;
528#endif`,ix=`#ifdef USE_EMISSIVEMAP
529	uniform sampler2D emissiveMap;
530#endif`,nx="gl_FragColor = linearToOutputTexel( gl_FragColor );",rx=`vec4 LinearToLinear( in vec4 value ) {
531	return value;
532}
533vec4 LinearTosRGB( in vec4 value ) {
534	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 );
535}`,sx=`#ifdef USE_ENVMAP
536	#ifdef ENV_WORLDPOS
537		vec3 cameraToFrag;
538		if ( isOrthographic ) {
539			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
540		} else {
541			cameraToFrag = normalize( vWorldPosition - cameraPosition );
542		}
543		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
544		#ifdef ENVMAP_MODE_REFLECTION
545			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
546		#else
547			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
548		#endif
549	#else
550		vec3 reflectVec = vReflect;
551	#endif
552	#ifdef ENVMAP_TYPE_CUBE
553		vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
554	#elif defined( ENVMAP_TYPE_CUBE_UV )
555		vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
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`,ox=`#ifdef USE_ENVMAP
567	uniform float envMapIntensity;
568	uniform float flipEnvMap;
569	#ifdef ENVMAP_TYPE_CUBE
570		uniform samplerCube envMap;
571	#else
572		uniform sampler2D envMap;
573	#endif
574	
575#endif`,ax=`#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`,lx=`#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`,cx=`#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`,hx=`#ifdef USE_FOG
615	vFogDepth = - mvPosition.z;
616#endif`,ux=`#ifdef USE_FOG
617	varying float vFogDepth;
618#endif`,dx=`#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`,fx=`#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`,px=`#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}`,mx=`#ifdef USE_LIGHTMAP
647	vec4 lightMapTexel = texture2D( lightMap, vUv2 );
648	vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
649	reflectedLight.indirectDiffuse += lightMapIrradiance;
650#endif`,gx=`#ifdef USE_LIGHTMAP
651	uniform sampler2D lightMap;
652	uniform float lightMapIntensity;
653#endif`,vx=`LambertMaterial material;
654material.diffuseColor = diffuseColor.rgb;
655material.specularStrength = specularStrength;`,yx=`varying vec3 vViewPosition;
656struct LambertMaterial {
657	vec3 diffuseColor;
658	float specularStrength;
659};
660void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
661	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
662	vec3 irradiance = dotNL * directLight.color;
663	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
664}
665void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
666	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
667}
668#define RE_Direct				RE_Direct_Lambert
669#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert
670#define Material_LightProbeLOD( material )	(0)`,xx=`uniform bool receiveShadow;
671uniform vec3 ambientLightColor;
672uniform vec3 lightProbe[ 9 ];
673vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
674	float x = normal.x, y = normal.y, z = normal.z;
675	vec3 result = shCoefficients[ 0 ] * 0.886227;
676	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
677	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
678	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
679	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
680	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
681	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
682	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
683	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
684	return result;
685}
686vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
687	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
688	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
689	return irradiance;
690}
691vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
692	vec3 irradiance = ambientLightColor;
693	return irradiance;
694}
695float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
696	#if defined ( PHYSICALLY_CORRECT_LIGHTS )
697		float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
698		if ( cutoffDistance > 0.0 ) {
699			distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
700		}
701		return distanceFalloff;
702	#else
703		if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
704			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
705		}
706		return 1.0;
707	#endif
708}
709float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
710	return smoothstep( coneCosine, penumbraCosine, angleCosine );
711}
712#if NUM_DIR_LIGHTS > 0
713	struct DirectionalLight {
714		vec3 direction;
715		vec3 color;
716	};
717	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
718	void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
719		light.color = directionalLight.color;
720		light.direction = directionalLight.direction;
721		light.visible = true;
722	}
723#endif
724#if NUM_POINT_LIGHTS > 0
725	struct PointLight {
726		vec3 position;
727		vec3 color;
728		float distance;
729		float decay;
730	};
731	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
732	void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
733		vec3 lVector = pointLight.position - geometry.position;
734		light.direction = normalize( lVector );
735		float lightDistance = length( lVector );
736		light.color = pointLight.color;
737		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
738		light.visible = ( light.color != vec3( 0.0 ) );
739	}
740#endif
741#if NUM_SPOT_LIGHTS > 0
742	struct SpotLight {
743		vec3 position;
744		vec3 direction;
745		vec3 color;
746		float distance;
747		float decay;
748		float coneCos;
749		float penumbraCos;
750	};
751	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
752	void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
753		vec3 lVector = spotLight.position - geometry.position;
754		light.direction = normalize( lVector );
755		float angleCos = dot( light.direction, spotLight.direction );
756		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
757		if ( spotAttenuation > 0.0 ) {
758			float lightDistance = length( lVector );
759			light.color = spotLight.color * spotAttenuation;
760			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
761			light.visible = ( light.color != vec3( 0.0 ) );
762		} else {
763			light.color = vec3( 0.0 );
764			light.visible = false;
765		}
766	}
767#endif
768#if NUM_RECT_AREA_LIGHTS > 0
769	struct RectAreaLight {
770		vec3 color;
771		vec3 position;
772		vec3 halfWidth;
773		vec3 halfHeight;
774	};
775	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
776	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
777#endif
778#if NUM_HEMI_LIGHTS > 0
779	struct HemisphereLight {
780		vec3 direction;
781		vec3 skyColor;
782		vec3 groundColor;
783	};
784	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
785	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
786		float dotNL = dot( normal, hemiLight.direction );
787		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
788		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
789		return irradiance;
790	}
791#endif`,_x=`#if defined( USE_ENVMAP )
792	vec3 getIBLIrradiance( const in vec3 normal ) {
793		#if defined( ENVMAP_TYPE_CUBE_UV )
794			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
795			vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
796			return PI * envMapColor.rgb * envMapIntensity;
797		#else
798			return vec3( 0.0 );
799		#endif
800	}
801	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
802		#if defined( ENVMAP_TYPE_CUBE_UV )
803			vec3 reflectVec = reflect( - viewDir, normal );
804			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
805			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
806			vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
807			return envMapColor.rgb * envMapIntensity;
808		#else
809			return vec3( 0.0 );
810		#endif
811	}
812#endif`,bx=`ToonMaterial material;
813material.diffuseColor = diffuseColor.rgb;`,wx=`varying vec3 vViewPosition;
814struct ToonMaterial {
815	vec3 diffuseColor;
816};
817void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
818	vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
819	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
820}
821void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
822	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
823}
824#define RE_Direct				RE_Direct_Toon
825#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon
826#define Material_LightProbeLOD( material )	(0)`,Sx=`BlinnPhongMaterial material;
827material.diffuseColor = diffuseColor.rgb;
828material.specularColor = specular;
829material.specularShininess = shininess;
830material.specularStrength = specularStrength;`,Mx=`varying vec3 vViewPosition;
831struct BlinnPhongMaterial {
832	vec3 diffuseColor;
833	vec3 specularColor;
834	float specularShininess;
835	float specularStrength;
836};
837void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
838	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
839	vec3 irradiance = dotNL * directLight.color;
840	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
841	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
842}
843void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
844	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
845}
846#define RE_Direct				RE_Direct_BlinnPhong
847#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong
848#define Material_LightProbeLOD( material )	(0)`,Ax=`PhysicalMaterial material;
849material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
850vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
851float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
852material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
853material.roughness = min( material.roughness, 1.0 );
854#ifdef IOR
855	material.ior = ior;
856	#ifdef SPECULAR
857		float specularIntensityFactor = specularIntensity;
858		vec3 specularColorFactor = specularColor;
859		#ifdef USE_SPECULARINTENSITYMAP
860			specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
861		#endif
862		#ifdef USE_SPECULARCOLORMAP
863			specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;
864		#endif
865		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
866	#else
867		float specularIntensityFactor = 1.0;
868		vec3 specularColorFactor = vec3( 1.0 );
869		material.specularF90 = 1.0;
870	#endif
871	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
872#else
873	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
874	material.specularF90 = 1.0;
875#endif
876#ifdef USE_CLEARCOAT
877	material.clearcoat = clearcoat;
878	material.clearcoatRoughness = clearcoatRoughness;
879	material.clearcoatF0 = vec3( 0.04 );
880	material.clearcoatF90 = 1.0;
881	#ifdef USE_CLEARCOATMAP
882		material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
883	#endif
884	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
885		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
886	#endif
887	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
888	material.clearcoatRoughness += geometryRoughness;
889	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
890#endif
891#ifdef USE_IRIDESCENCE
892	material.iridescence = iridescence;
893	material.iridescenceIOR = iridescenceIOR;
894	#ifdef USE_IRIDESCENCEMAP
895		material.iridescence *= texture2D( iridescenceMap, vUv ).r;
896	#endif
897	#ifdef USE_IRIDESCENCE_THICKNESSMAP
898		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;
899	#else
900		material.iridescenceThickness = iridescenceThicknessMaximum;
901	#endif
902#endif
903#ifdef USE_SHEEN
904	material.sheenColor = sheenColor;
905	#ifdef USE_SHEENCOLORMAP
906		material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;
907	#endif
908	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
909	#ifdef USE_SHEENROUGHNESSMAP
910		material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
911	#endif
912#endif`,Tx=`struct PhysicalMaterial {
913	vec3 diffuseColor;
914	float roughness;
915	vec3 specularColor;
916	float specularF90;
917	#ifdef USE_CLEARCOAT
918		float clearcoat;
919		float clearcoatRoughness;
920		vec3 clearcoatF0;
921		float clearcoatF90;
922	#endif
923	#ifdef USE_IRIDESCENCE
924		float iridescence;
925		float iridescenceIOR;
926		float iridescenceThickness;
927		vec3 iridescenceFresnel;
928		vec3 iridescenceF0;
929	#endif
930	#ifdef USE_SHEEN
931		vec3 sheenColor;
932		float sheenRoughness;
933	#endif
934	#ifdef IOR
935		float ior;
936	#endif
937	#ifdef USE_TRANSMISSION
938		float transmission;
939		float transmissionAlpha;
940		float thickness;
941		float attenuationDistance;
942		vec3 attenuationColor;
943	#endif
944};
945vec3 clearcoatSpecular = vec3( 0.0 );
946vec3 sheenSpecular = vec3( 0.0 );
947float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
948	float dotNV = saturate( dot( normal, viewDir ) );
949	float r2 = roughness * roughness;
950	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
951	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
952	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
953	return saturate( DG * RECIPROCAL_PI );
954}
955vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
956	float dotNV = saturate( dot( normal, viewDir ) );
957	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
958	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
959	vec4 r = roughness * c0 + c1;
960	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
961	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
962	return fab;
963}
964vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
965	vec2 fab = DFGApprox( normal, viewDir, roughness );
966	return specularColor * fab.x + specularF90 * fab.y;
967}
968#ifdef USE_IRIDESCENCE
969void 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 ) {
970#else
971void 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 ) {
972#endif
973	vec2 fab = DFGApprox( normal, viewDir, roughness );
974	#ifdef USE_IRIDESCENCE
975		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
976	#else
977		vec3 Fr = specularColor;
978	#endif
979	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
980	float Ess = fab.x + fab.y;
981	float Ems = 1.0 - Ess;
982	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
983	singleScatter += FssEss;
984	multiScatter += Fms * Ems;
985}
986#if NUM_RECT_AREA_LIGHTS > 0
987	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
988		vec3 normal = geometry.normal;
989		vec3 viewDir = geometry.viewDir;
990		vec3 position = geometry.position;
991		vec3 lightPos = rectAreaLight.position;
992		vec3 halfWidth = rectAreaLight.halfWidth;
993		vec3 halfHeight = rectAreaLight.halfHeight;
994		vec3 lightColor = rectAreaLight.color;
995		float roughness = material.roughness;
996		vec3 rectCoords[ 4 ];
997		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
998		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
999		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1000		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1001		vec4 t1 = texture2D( ltc_1, uv );
1002		vec4 t2 = texture2D( ltc_2, uv );
1003		mat3 mInv = mat3(
1004			vec3( t1.x, 0, t1.y ),
1005			vec3(    0, 1,    0 ),
1006			vec3( t1.z, 0, t1.w )
1007		);
1008		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1009		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1010		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1011	}
1012#endif
1013void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1014	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
1015	vec3 irradiance = dotNL * directLight.color;
1016	#ifdef USE_CLEARCOAT
1017		float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
1018		vec3 ccIrradiance = dotNLcc * directLight.color;
1019		clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1020	#endif
1021	#ifdef USE_SHEEN
1022		sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
1023	#endif
1024	#ifdef USE_IRIDESCENCE
1025		reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );
1026	#else
1027		reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
1028	#endif
1029	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1030}
1031void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1032	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1033}
1034void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1035	#ifdef USE_CLEARCOAT
1036		clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1037	#endif
1038	#ifdef USE_SHEEN
1039		sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
1040	#endif
1041	vec3 singleScattering = vec3( 0.0 );
1042	vec3 multiScattering = vec3( 0.0 );
1043	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1044	#ifdef USE_IRIDESCENCE
1045		computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1046	#else
1047		computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1048	#endif
1049	vec3 totalScattering = singleScattering + multiScattering;
1050	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1051	reflectedLight.indirectSpecular += radiance * singleScattering;
1052	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1053	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1054}
1055#define RE_Direct				RE_Direct_Physical
1056#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1057#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1058#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1059float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1060	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1061}`,Ex=`
1062GeometricContext geometry;
1063geometry.position = - vViewPosition;
1064geometry.normal = normal;
1065geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1066#ifdef USE_CLEARCOAT
1067	geometry.clearcoatNormal = clearcoatNormal;
1068#endif
1069#ifdef USE_IRIDESCENCE
1070	float dotNVi = saturate( dot( normal, geometry.viewDir ) );
1071	if ( material.iridescenceThickness == 0.0 ) {
1072		material.iridescence = 0.0;
1073	} else {
1074		material.iridescence = saturate( material.iridescence );
1075	}
1076	if ( material.iridescence > 0.0 ) {
1077		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1078		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1079	}
1080#endif
1081IncidentLight directLight;
1082#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1083	PointLight pointLight;
1084	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1085	PointLightShadow pointLightShadow;
1086	#endif
1087	#pragma unroll_loop_start
1088	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1089		pointLight = pointLights[ i ];
1090		getPointLightInfo( pointLight, geometry, directLight );
1091		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1092		pointLightShadow = pointLightShadows[ i ];
1093		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1094		#endif
1095		RE_Direct( directLight, geometry, material, reflectedLight );
1096	}
1097	#pragma unroll_loop_end
1098#endif
1099#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1100	SpotLight spotLight;
1101	vec4 spotColor;
1102	vec3 spotLightCoord;
1103	bool inSpotLightMap;
1104	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1105	SpotLightShadow spotLightShadow;
1106	#endif
1107	#pragma unroll_loop_start
1108	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1109		spotLight = spotLights[ i ];
1110		getSpotLightInfo( spotLight, geometry, directLight );
1111		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1112		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1113		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1114		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1115		#else
1116		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1117		#endif
1118		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1119			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1120			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1121			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1122			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1123		#endif
1124		#undef SPOT_LIGHT_MAP_INDEX
1125		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1126		spotLightShadow = spotLightShadows[ i ];
1127		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1128		#endif
1129		RE_Direct( directLight, geometry, material, reflectedLight );
1130	}
1131	#pragma unroll_loop_end
1132#endif
1133#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1134	DirectionalLight directionalLight;
1135	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1136	DirectionalLightShadow directionalLightShadow;
1137	#endif
1138	#pragma unroll_loop_start
1139	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1140		directionalLight = directionalLights[ i ];
1141		getDirectionalLightInfo( directionalLight, geometry, directLight );
1142		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1143		directionalLightShadow = directionalLightShadows[ i ];
1144		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1145		#endif
1146		RE_Direct( directLight, geometry, material, reflectedLight );
1147	}
1148	#pragma unroll_loop_end
1149#endif
1150#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1151	RectAreaLight rectAreaLight;
1152	#pragma unroll_loop_start
1153	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1154		rectAreaLight = rectAreaLights[ i ];
1155		RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
1156	}
1157	#pragma unroll_loop_end
1158#endif
1159#if defined( RE_IndirectDiffuse )
1160	vec3 iblIrradiance = vec3( 0.0 );
1161	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1162	irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
1163	#if ( NUM_HEMI_LIGHTS > 0 )
1164		#pragma unroll_loop_start
1165		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1166			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
1167		}
1168		#pragma unroll_loop_end
1169	#endif
1170#endif
1171#if defined( RE_IndirectSpecular )
1172	vec3 radiance = vec3( 0.0 );
1173	vec3 clearcoatRadiance = vec3( 0.0 );
1174#endif`,Cx=`#if defined( RE_IndirectDiffuse )
1175	#ifdef USE_LIGHTMAP
1176		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
1177		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1178		irradiance += lightMapIrradiance;
1179	#endif
1180	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1181		iblIrradiance += getIBLIrradiance( geometry.normal );
1182	#endif
1183#endif
1184#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1185	radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
1186	#ifdef USE_CLEARCOAT
1187		clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
1188	#endif
1189#endif`,Lx=`#if defined( RE_IndirectDiffuse )
1190	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
1191#endif
1192#if defined( RE_IndirectSpecular )
1193	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
1194#endif`,Px=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1195	gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1196#endif`,Dx=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1197	uniform float logDepthBufFC;
1198	varying float vFragDepth;
1199	varying float vIsPerspective;
1200#endif`,Ox=`#ifdef USE_LOGDEPTHBUF
1201	#ifdef USE_LOGDEPTHBUF_EXT
1202		varying float vFragDepth;
1203		varying float vIsPerspective;
1204	#else
1205		uniform float logDepthBufFC;
1206	#endif
1207#endif`,Rx=`#ifdef USE_LOGDEPTHBUF
1208	#ifdef USE_LOGDEPTHBUF_EXT
1209		vFragDepth = 1.0 + gl_Position.w;
1210		vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1211	#else
1212		if ( isPerspectiveMatrix( projectionMatrix ) ) {
1213			gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
1214			gl_Position.z *= gl_Position.w;
1215		}
1216	#endif
1217#endif`,Ix=`#ifdef USE_MAP
1218	vec4 sampledDiffuseColor = texture2D( map, vUv );
1219	#ifdef DECODE_VIDEO_TEXTURE
1220		sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
1221	#endif
1222	diffuseColor *= sampledDiffuseColor;
1223#endif`,zx=`#ifdef USE_MAP
1224	uniform sampler2D map;
1225#endif`,Nx=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1226	vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1227#endif
1228#ifdef USE_MAP
1229	diffuseColor *= texture2D( map, uv );
1230#endif
1231#ifdef USE_ALPHAMAP
1232	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1233#endif`,Ux=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1234	uniform mat3 uvTransform;
1235#endif
1236#ifdef USE_MAP
1237	uniform sampler2D map;
1238#endif
1239#ifdef USE_ALPHAMAP
1240	uniform sampler2D alphaMap;
1241#endif`,Bx=`float metalnessFactor = metalness;
1242#ifdef USE_METALNESSMAP
1243	vec4 texelMetalness = texture2D( metalnessMap, vUv );
1244	metalnessFactor *= texelMetalness.b;
1245#endif`,Fx=`#ifdef USE_METALNESSMAP
1246	uniform sampler2D metalnessMap;
1247#endif`,kx=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
1248	vColor *= morphTargetBaseInfluence;
1249	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1250		#if defined( USE_COLOR_ALPHA )
1251			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1252		#elif defined( USE_COLOR )
1253			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1254		#endif
1255	}
1256#endif`,Vx=`#ifdef USE_MORPHNORMALS
1257	objectNormal *= morphTargetBaseInfluence;
1258	#ifdef MORPHTARGETS_TEXTURE
1259		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1260			if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1261		}
1262	#else
1263		objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
1264		objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
1265		objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
1266		objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
1267	#endif
1268#endif`,Gx=`#ifdef USE_MORPHTARGETS
1269	uniform float morphTargetBaseInfluence;
1270	#ifdef MORPHTARGETS_TEXTURE
1271		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1272		uniform sampler2DArray morphTargetsTexture;
1273		uniform ivec2 morphTargetsTextureSize;
1274		vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1275			int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1276			int y = texelIndex / morphTargetsTextureSize.x;
1277			int x = texelIndex - y * morphTargetsTextureSize.x;
1278			ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1279			return texelFetch( morphTargetsTexture, morphUV, 0 );
1280		}
1281	#else
1282		#ifndef USE_MORPHNORMALS
1283			uniform float morphTargetInfluences[ 8 ];
1284		#else
1285			uniform float morphTargetInfluences[ 4 ];
1286		#endif
1287	#endif
1288#endif`,Hx=`#ifdef USE_MORPHTARGETS
1289	transformed *= morphTargetBaseInfluence;
1290	#ifdef MORPHTARGETS_TEXTURE
1291		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1292			if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1293		}
1294	#else
1295		transformed += morphTarget0 * morphTargetInfluences[ 0 ];
1296		transformed += morphTarget1 * morphTargetInfluences[ 1 ];
1297		transformed += morphTarget2 * morphTargetInfluences[ 2 ];
1298		transformed += morphTarget3 * morphTargetInfluences[ 3 ];
1299		#ifndef USE_MORPHNORMALS
1300			transformed += morphTarget4 * morphTargetInfluences[ 4 ];
1301			transformed += morphTarget5 * morphTargetInfluences[ 5 ];
1302			transformed += morphTarget6 * morphTargetInfluences[ 6 ];
1303			transformed += morphTarget7 * morphTargetInfluences[ 7 ];
1304		#endif
1305	#endif
1306#endif`,Wx=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1307#ifdef FLAT_SHADED
1308	vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
1309	vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
1310	vec3 normal = normalize( cross( fdx, fdy ) );
1311#else
1312	vec3 normal = normalize( vNormal );
1313	#ifdef DOUBLE_SIDED
1314		normal = normal * faceDirection;
1315	#endif
1316	#ifdef USE_TANGENT
1317		vec3 tangent = normalize( vTangent );
1318		vec3 bitangent = normalize( vBitangent );
1319		#ifdef DOUBLE_SIDED
1320			tangent = tangent * faceDirection;
1321			bitangent = bitangent * faceDirection;
1322		#endif
1323		#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
1324			mat3 vTBN = mat3( tangent, bitangent, normal );
1325		#endif
1326	#endif
1327#endif
1328vec3 geometryNormal = normal;`,jx=`#ifdef OBJECTSPACE_NORMALMAP
1329	normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
1330	#ifdef FLIP_SIDED
1331		normal = - normal;
1332	#endif
1333	#ifdef DOUBLE_SIDED
1334		normal = normal * faceDirection;
1335	#endif
1336	normal = normalize( normalMatrix * normal );
1337#elif defined( TANGENTSPACE_NORMALMAP )
1338	vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
1339	mapN.xy *= normalScale;
1340	#ifdef USE_TANGENT
1341		normal = normalize( vTBN * mapN );
1342	#else
1343		normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
1344	#endif
1345#elif defined( USE_BUMPMAP )
1346	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1347#endif`,qx=`#ifndef FLAT_SHADED
1348	varying vec3 vNormal;
1349	#ifdef USE_TANGENT
1350		varying vec3 vTangent;
1351		varying vec3 vBitangent;
1352	#endif
1353#endif`,Xx=`#ifndef FLAT_SHADED
1354	varying vec3 vNormal;
1355	#ifdef USE_TANGENT
1356		varying vec3 vTangent;
1357		varying vec3 vBitangent;
1358	#endif
1359#endif`,Yx=`#ifndef FLAT_SHADED
1360	vNormal = normalize( transformedNormal );
1361	#ifdef USE_TANGENT
1362		vTangent = normalize( transformedTangent );
1363		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1364	#endif
1365#endif`,$x=`#ifdef USE_NORMALMAP
1366	uniform sampler2D normalMap;
1367	uniform vec2 normalScale;
1368#endif
1369#ifdef OBJECTSPACE_NORMALMAP
1370	uniform mat3 normalMatrix;
1371#endif
1372#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
1373	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
1374		vec3 q0 = dFdx( eye_pos.xyz );
1375		vec3 q1 = dFdy( eye_pos.xyz );
1376		vec2 st0 = dFdx( vUv.st );
1377		vec2 st1 = dFdy( vUv.st );
1378		vec3 N = surf_norm;
1379		vec3 q1perp = cross( q1, N );
1380		vec3 q0perp = cross( N, q0 );
1381		vec3 T = q1perp * st0.x + q0perp * st1.x;
1382		vec3 B = q1perp * st0.y + q0perp * st1.y;
1383		float det = max( dot( T, T ), dot( B, B ) );
1384		float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
1385		return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
1386	}
1387#endif`,Zx=`#ifdef USE_CLEARCOAT
1388	vec3 clearcoatNormal = geometryNormal;
1389#endif`,Jx=`#ifdef USE_CLEARCOAT_NORMALMAP
1390	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
1391	clearcoatMapN.xy *= clearcoatNormalScale;
1392	#ifdef USE_TANGENT
1393		clearcoatNormal = normalize( vTBN * clearcoatMapN );
1394	#else
1395		clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
1396	#endif
1397#endif`,Kx=`#ifdef USE_CLEARCOATMAP
1398	uniform sampler2D clearcoatMap;
1399#endif
1400#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1401	uniform sampler2D clearcoatRoughnessMap;
1402#endif
1403#ifdef USE_CLEARCOAT_NORMALMAP
1404	uniform sampler2D clearcoatNormalMap;
1405	uniform vec2 clearcoatNormalScale;
1406#endif`,Qx=`#ifdef USE_IRIDESCENCEMAP
1407	uniform sampler2D iridescenceMap;
1408#endif
1409#ifdef USE_IRIDESCENCE_THICKNESSMAP
1410	uniform sampler2D iridescenceThicknessMap;
1411#endif`,e_=`#ifdef OPAQUE
1412diffuseColor.a = 1.0;
1413#endif
1414#ifdef USE_TRANSMISSION
1415diffuseColor.a *= material.transmissionAlpha + 0.1;
1416#endif
1417gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,t_=`vec3 packNormalToRGB( const in vec3 normal ) {
1418	return normalize( normal ) * 0.5 + 0.5;
1419}
1420vec3 unpackRGBToNormal( const in vec3 rgb ) {
1421	return 2.0 * rgb.xyz - 1.0;
1422}
1423const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
1424const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
1425const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
1426const float ShiftRight8 = 1. / 256.;
1427vec4 packDepthToRGBA( const in float v ) {
1428	vec4 r = vec4( fract( v * PackFactors ), v );
1429	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
1430}
1431float unpackRGBAToDepth( const in vec4 v ) {
1432	return dot( v, UnpackFactors );
1433}
1434vec4 pack2HalfToRGBA( vec2 v ) {
1435	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1436	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1437}
1438vec2 unpackRGBATo2Half( vec4 v ) {
1439	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1440}
1441float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1442	return ( viewZ + near ) / ( near - far );
1443}
1444float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
1445	return linearClipZ * ( near - far ) - near;
1446}
1447float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1448	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1449}
1450float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
1451	return ( near * far ) / ( ( far - near ) * invClipZ - far );
1452}`,i_=`#ifdef PREMULTIPLIED_ALPHA
1453	gl_FragColor.rgb *= gl_FragColor.a;
1454#endif`,n_=`vec4 mvPosition = vec4( transformed, 1.0 );
1455#ifdef USE_INSTANCING
1456	mvPosition = instanceMatrix * mvPosition;
1457#endif
1458mvPosition = modelViewMatrix * mvPosition;
1459gl_Position = projectionMatrix * mvPosition;`,r_=`#ifdef DITHERING
1460	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1461#endif`,s_=`#ifdef DITHERING
1462	vec3 dithering( vec3 color ) {
1463		float grid_position = rand( gl_FragCoord.xy );
1464		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1465		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1466		return color + dither_shift_RGB;
1467	}
1468#endif`,o_=`float roughnessFactor = roughness;
1469#ifdef USE_ROUGHNESSMAP
1470	vec4 texelRoughness = texture2D( roughnessMap, vUv );
1471	roughnessFactor *= texelRoughness.g;
1472#endif`,a_=`#ifdef USE_ROUGHNESSMAP
1473	uniform sampler2D roughnessMap;
1474#endif`,l_=`#if NUM_SPOT_LIGHT_COORDS > 0
1475  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1476#endif
1477#if NUM_SPOT_LIGHT_MAPS > 0
1478  uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1479#endif
1480#ifdef USE_SHADOWMAP
1481	#if NUM_DIR_LIGHT_SHADOWS > 0
1482		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1483		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1484		struct DirectionalLightShadow {
1485			float shadowBias;
1486			float shadowNormalBias;
1487			float shadowRadius;
1488			vec2 shadowMapSize;
1489		};
1490		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1491	#endif
1492	#if NUM_SPOT_LIGHT_SHADOWS > 0
1493		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1494		struct SpotLightShadow {
1495			float shadowBias;
1496			float shadowNormalBias;
1497			float shadowRadius;
1498			vec2 shadowMapSize;
1499		};
1500		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1501	#endif
1502	#if NUM_POINT_LIGHT_SHADOWS > 0
1503		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1504		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1505		struct PointLightShadow {
1506			float shadowBias;
1507			float shadowNormalBias;
1508			float shadowRadius;
1509			vec2 shadowMapSize;
1510			float shadowCameraNear;
1511			float shadowCameraFar;
1512		};
1513		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1514	#endif
1515	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1516		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1517	}
1518	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1519		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1520	}
1521	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1522		float occlusion = 1.0;
1523		vec2 distribution = texture2DDistribution( shadow, uv );
1524		float hard_shadow = step( compare , distribution.x );
1525		if (hard_shadow != 1.0 ) {
1526			float distance = compare - distribution.x ;
1527			float variance = max( 0.00000, distribution.y * distribution.y );
1528			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
1529		}
1530		return occlusion;
1531	}
1532	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1533		float shadow = 1.0;
1534		shadowCoord.xyz /= shadowCoord.w;
1535		shadowCoord.z += shadowBias;
1536		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
1537		bool inFrustum = all( inFrustumVec );
1538		bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
1539		bool frustumTest = all( frustumTestVec );
1540		if ( frustumTest ) {
1541		#if defined( SHADOWMAP_TYPE_PCF )
1542			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1543			float dx0 = - texelSize.x * shadowRadius;
1544			float dy0 = - texelSize.y * shadowRadius;
1545			float dx1 = + texelSize.x * shadowRadius;
1546			float dy1 = + texelSize.y * shadowRadius;
1547			float dx2 = dx0 / 2.0;
1548			float dy2 = dy0 / 2.0;
1549			float dx3 = dx1 / 2.0;
1550			float dy3 = dy1 / 2.0;
1551			shadow = (
1552				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1553				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1554				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1555				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1556				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1557				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1558				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1559				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1560				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1561				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1562				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1563				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1564				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1565				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1566				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1567				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1568				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1569			) * ( 1.0 / 17.0 );
1570		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1571			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1572			float dx = texelSize.x;
1573			float dy = texelSize.y;
1574			vec2 uv = shadowCoord.xy;
1575			vec2 f = fract( uv * shadowMapSize + 0.5 );
1576			uv -= f * texelSize;
1577			shadow = (
1578				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1579				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1580				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1581				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1582				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1583					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1584					 f.x ) +
1585				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1586					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1587					 f.x ) +
1588				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1589					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1590					 f.y ) +
1591				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1592					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1593					 f.y ) +
1594				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1595						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1596						  f.x ),
1597					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1598						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1599						  f.x ),
1600					 f.y )
1601			) * ( 1.0 / 9.0 );
1602		#elif defined( SHADOWMAP_TYPE_VSM )
1603			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1604		#else
1605			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1606		#endif
1607		}
1608		return shadow;
1609	}
1610	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1611		vec3 absV = abs( v );
1612		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1613		absV *= scaleToCube;
1614		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1615		vec2 planar = v.xy;
1616		float almostATexel = 1.5 * texelSizeY;
1617		float almostOne = 1.0 - almostATexel;
1618		if ( absV.z >= almostOne ) {
1619			if ( v.z > 0.0 )
1620				planar.x = 4.0 - v.x;
1621		} else if ( absV.x >= almostOne ) {
1622			float signX = sign( v.x );
1623			planar.x = v.z * signX + 2.0 * signX;
1624		} else if ( absV.y >= almostOne ) {
1625			float signY = sign( v.y );
1626			planar.x = v.x + 2.0 * signY + 2.0;
1627			planar.y = v.z * signY - 2.0;
1628		}
1629		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1630	}
1631	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1632		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1633		vec3 lightToPosition = shadowCoord.xyz;
1634		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;
1635		vec3 bd3D = normalize( lightToPosition );
1636		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1637			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1638			return (
1639				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1640				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1641				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1642				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1643				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1644				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1645				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1646				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1647				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1648			) * ( 1.0 / 9.0 );
1649		#else
1650			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1651		#endif
1652	}
1653#endif`,c_=`#if NUM_SPOT_LIGHT_COORDS > 0
1654  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1655  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1656#endif
1657#ifdef USE_SHADOWMAP
1658	#if NUM_DIR_LIGHT_SHADOWS > 0
1659		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1660		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1661		struct DirectionalLightShadow {
1662			float shadowBias;
1663			float shadowNormalBias;
1664			float shadowRadius;
1665			vec2 shadowMapSize;
1666		};
1667		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1668	#endif
1669	#if NUM_SPOT_LIGHT_SHADOWS > 0
1670		struct SpotLightShadow {
1671			float shadowBias;
1672			float shadowNormalBias;
1673			float shadowRadius;
1674			vec2 shadowMapSize;
1675		};
1676		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1677	#endif
1678	#if NUM_POINT_LIGHT_SHADOWS > 0
1679		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1680		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1681		struct PointLightShadow {
1682			float shadowBias;
1683			float shadowNormalBias;
1684			float shadowRadius;
1685			vec2 shadowMapSize;
1686			float shadowCameraNear;
1687			float shadowCameraFar;
1688		};
1689		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1690	#endif
1691#endif`,h_=`#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1692	#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
1693		vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1694		vec4 shadowWorldPosition;
1695	#endif
1696	#if NUM_DIR_LIGHT_SHADOWS > 0
1697	#pragma unroll_loop_start
1698	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1699		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1700		vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1701	}
1702	#pragma unroll_loop_end
1703	#endif
1704	#if NUM_SPOT_LIGHT_COORDS > 0
1705	#pragma unroll_loop_start
1706	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1707		shadowWorldPosition = worldPosition;
1708		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1709			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1710		#endif
1711		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1712	}
1713	#pragma unroll_loop_end
1714	#endif
1715	#if NUM_POINT_LIGHT_SHADOWS > 0
1716	#pragma unroll_loop_start
1717	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1718		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1719		vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1720	}
1721	#pragma unroll_loop_end
1722	#endif
1723#endif`,u_=`float getShadowMask() {
1724	float shadow = 1.0;
1725	#ifdef USE_SHADOWMAP
1726	#if NUM_DIR_LIGHT_SHADOWS > 0
1727	DirectionalLightShadow directionalLight;
1728	#pragma unroll_loop_start
1729	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1730		directionalLight = directionalLightShadows[ i ];
1731		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1732	}
1733	#pragma unroll_loop_end
1734	#endif
1735	#if NUM_SPOT_LIGHT_SHADOWS > 0
1736	SpotLightShadow spotLight;
1737	#pragma unroll_loop_start
1738	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1739		spotLight = spotLightShadows[ i ];
1740		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1741	}
1742	#pragma unroll_loop_end
1743	#endif
1744	#if NUM_POINT_LIGHT_SHADOWS > 0
1745	PointLightShadow pointLight;
1746	#pragma unroll_loop_start
1747	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1748		pointLight = pointLightShadows[ i ];
1749		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1750	}
1751	#pragma unroll_loop_end
1752	#endif
1753	#endif
1754	return shadow;
1755}`,d_=`#ifdef USE_SKINNING
1756	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1757	mat4 boneMatY = getBoneMatrix( skinIndex.y );
1758	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1759	mat4 boneMatW = getBoneMatrix( skinIndex.w );
1760#endif`,f_=`#ifdef USE_SKINNING
1761	uniform mat4 bindMatrix;
1762	uniform mat4 bindMatrixInverse;
1763	uniform highp sampler2D boneTexture;
1764	uniform int boneTextureSize;
1765	mat4 getBoneMatrix( const in float i ) {
1766		float j = i * 4.0;
1767		float x = mod( j, float( boneTextureSize ) );
1768		float y = floor( j / float( boneTextureSize ) );
1769		float dx = 1.0 / float( boneTextureSize );
1770		float dy = 1.0 / float( boneTextureSize );
1771		y = dy * ( y + 0.5 );
1772		vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
1773		vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
1774		vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
1775		vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
1776		mat4 bone = mat4( v1, v2, v3, v4 );
1777		return bone;
1778	}
1779#endif`,p_=`#ifdef USE_SKINNING
1780	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
1781	vec4 skinned = vec4( 0.0 );
1782	skinned += boneMatX * skinVertex * skinWeight.x;
1783	skinned += boneMatY * skinVertex * skinWeight.y;
1784	skinned += boneMatZ * skinVertex * skinWeight.z;
1785	skinned += boneMatW * skinVertex * skinWeight.w;
1786	transformed = ( bindMatrixInverse * skinned ).xyz;
1787#endif`,m_=`#ifdef USE_SKINNING
1788	mat4 skinMatrix = mat4( 0.0 );
1789	skinMatrix += skinWeight.x * boneMatX;
1790	skinMatrix += skinWeight.y * boneMatY;
1791	skinMatrix += skinWeight.z * boneMatZ;
1792	skinMatrix += skinWeight.w * boneMatW;
1793	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
1794	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
1795	#ifdef USE_TANGENT
1796		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
1797	#endif
1798#endif`,g_=`float specularStrength;
1799#ifdef USE_SPECULARMAP
1800	vec4 texelSpecular = texture2D( specularMap, vUv );
1801	specularStrength = texelSpecular.r;
1802#else
1803	specularStrength = 1.0;
1804#endif`,v_=`#ifdef USE_SPECULARMAP
1805	uniform sampler2D specularMap;
1806#endif`,y_=`#if defined( TONE_MAPPING )
1807	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
1808#endif`,x_=`#ifndef saturate
1809#define saturate( a ) clamp( a, 0.0, 1.0 )
1810#endif
1811uniform float toneMappingExposure;
1812vec3 LinearToneMapping( vec3 color ) {
1813	return toneMappingExposure * color;
1814}
1815vec3 ReinhardToneMapping( vec3 color ) {
1816	color *= toneMappingExposure;
1817	return saturate( color / ( vec3( 1.0 ) + color ) );
1818}
1819vec3 OptimizedCineonToneMapping( vec3 color ) {
1820	color *= toneMappingExposure;
1821	color = max( vec3( 0.0 ), color - 0.004 );
1822	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
1823}
1824vec3 RRTAndODTFit( vec3 v ) {
1825	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
1826	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
1827	return a / b;
1828}
1829vec3 ACESFilmicToneMapping( vec3 color ) {
1830	const mat3 ACESInputMat = mat3(
1831		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
1832		vec3( 0.04823, 0.01566, 0.83777 )
1833	);
1834	const mat3 ACESOutputMat = mat3(
1835		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
1836		vec3( -0.07367, -0.00605,  1.07602 )
1837	);
1838	color *= toneMappingExposure / 0.6;
1839	color = ACESInputMat * color;
1840	color = RRTAndODTFit( color );
1841	color = ACESOutputMat * color;
1842	return saturate( color );
1843}
1844vec3 CustomToneMapping( vec3 color ) { return color; }`,__=`#ifdef USE_TRANSMISSION
1845	material.transmission = transmission;
1846	material.transmissionAlpha = 1.0;
1847	material.thickness = thickness;
1848	material.attenuationDistance = attenuationDistance;
1849	material.attenuationColor = attenuationColor;
1850	#ifdef USE_TRANSMISSIONMAP
1851		material.transmission *= texture2D( transmissionMap, vUv ).r;
1852	#endif
1853	#ifdef USE_THICKNESSMAP
1854		material.thickness *= texture2D( thicknessMap, vUv ).g;
1855	#endif
1856	vec3 pos = vWorldPosition;
1857	vec3 v = normalize( cameraPosition - pos );
1858	vec3 n = inverseTransformDirection( normal, viewMatrix );
1859	vec4 transmission = getIBLVolumeRefraction(
1860		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
1861		pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
1862		material.attenuationColor, material.attenuationDistance );
1863	material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );
1864	totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );
1865#endif`,b_=`#ifdef USE_TRANSMISSION
1866	uniform float transmission;
1867	uniform float thickness;
1868	uniform float attenuationDistance;
1869	uniform vec3 attenuationColor;
1870	#ifdef USE_TRANSMISSIONMAP
1871		uniform sampler2D transmissionMap;
1872	#endif
1873	#ifdef USE_THICKNESSMAP
1874		uniform sampler2D thicknessMap;
1875	#endif
1876	uniform vec2 transmissionSamplerSize;
1877	uniform sampler2D transmissionSamplerMap;
1878	uniform mat4 modelMatrix;
1879	uniform mat4 projectionMatrix;
1880	varying vec3 vWorldPosition;
1881	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
1882		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
1883		vec3 modelScale;
1884		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
1885		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
1886		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
1887		return normalize( refractionVector ) * thickness * modelScale;
1888	}
1889	float applyIorToRoughness( const in float roughness, const in float ior ) {
1890		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
1891	}
1892	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
1893		float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
1894		#ifdef texture2DLodEXT
1895			return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
1896		#else
1897			return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
1898		#endif
1899	}
1900	vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
1901		if ( attenuationDistance == 0.0 ) {
1902			return radiance;
1903		} else {
1904			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
1905			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance * radiance;
1906		}
1907	}
1908	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
1909		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
1910		const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
1911		const in vec3 attenuationColor, const in float attenuationDistance ) {
1912		vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
1913		vec3 refractedRayExit = position + transmissionRay;
1914		vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
1915		vec2 refractionCoords = ndcPos.xy / ndcPos.w;
1916		refractionCoords += 1.0;
1917		refractionCoords /= 2.0;
1918		vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
1919		vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
1920		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
1921		return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
1922	}
1923#endif`,w_=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
1924	varying vec2 vUv;
1925#endif`,S_=`#ifdef USE_UV
1926	#ifdef UVS_VERTEX_ONLY
1927		vec2 vUv;
1928	#else
1929		varying vec2 vUv;
1930	#endif
1931	uniform mat3 uvTransform;
1932#endif`,M_=`#ifdef USE_UV
1933	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
1934#endif`,A_=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1935	varying vec2 vUv2;
1936#endif`,T_=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1937	attribute vec2 uv2;
1938	varying vec2 vUv2;
1939	uniform mat3 uv2Transform;
1940#endif`,E_=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1941	vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
1942#endif`,C_=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_L
1942IGHT_COORDS > 0
1943	vec4 worldPosition = vec4( transformed, 1.0 );
1944	#ifdef USE_INSTANCING
1945		worldPosition = instanceMatrix * worldPosition;
1946	#endif
1947	worldPosition = modelMatrix * worldPosition;
1948#endif`;const L_=`varying vec2 vUv;
1949uniform mat3 uvTransform;
1950void main() {
1951	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
1952	gl_Position = vec4( position.xy, 1.0, 1.0 );
1953}`,P_=`uniform sampler2D t2D;
1954varying vec2 vUv;
1955void main() {
1956	gl_FragColor = texture2D( t2D, vUv );
1957	#ifdef DECODE_VIDEO_TEXTURE
1958		gl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );
1959	#endif
1960	#include <tonemapping_fragment>
1961	#include <encodings_fragment>
1962}`,D_=`varying vec3 vWorldDirection;
1963#include <common>
1964void main() {
1965	vWorldDirection = transformDirection( position, modelMatrix );
1966	#include <begin_vertex>
1967	#include <project_vertex>
1968	gl_Position.z = gl_Position.w;
1969}`,O_=`#include <envmap_common_pars_fragment>
1970uniform float opacity;
1971varying vec3 vWorldDirection;
1972#include <cube_uv_reflection_fragment>
1973void main() {
1974	vec3 vReflect = vWorldDirection;
1975	#include <envmap_fragment>
1976	gl_FragColor = envColor;
1977	gl_FragColor.a *= opacity;
1978	#include <tonemapping_fragment>
1979	#include <encodings_fragment>
1980}`,R_=`#include <common>
1981#include <uv_pars_vertex>
1982#include <displacementmap_pars_vertex>
1983#include <morphtarget_pars_vertex>
1984#include <skinning_pars_vertex>
1985#include <logdepthbuf_pars_vertex>
1986#include <clipping_planes_pars_vertex>
1987varying vec2 vHighPrecisionZW;
1988void main() {
1989	#include <uv_vertex>
1990	#include <skinbase_vertex>
1991	#ifdef USE_DISPLACEMENTMAP
1992		#include <beginnormal_vertex>
1993		#include <morphnormal_vertex>
1994		#include <skinnormal_vertex>
1995	#endif
1996	#include <begin_vertex>
1997	#include <morphtarget_vertex>
1998	#include <skinning_vertex>
1999	#include <displacementmap_vertex>
2000	#include <project_vertex>
2001	#include <logdepthbuf_vertex>
2002	#include <clipping_planes_vertex>
2003	vHighPrecisionZW = gl_Position.zw;
2004}`,I_=`#if DEPTH_PACKING == 3200
2005	uniform float opacity;
2006#endif
2007#include <common>
2008#include <packing>
2009#include <uv_pars_fragment>
2010#include <map_pars_fragment>
2011#include <alphamap_pars_fragment>
2012#include <alphatest_pars_fragment>
2013#include <logdepthbuf_pars_fragment>
2014#include <clipping_planes_pars_fragment>
2015varying vec2 vHighPrecisionZW;
2016void main() {
2017	#include <clipping_planes_fragment>
2018	vec4 diffuseColor = vec4( 1.0 );
2019	#if DEPTH_PACKING == 3200
2020		diffuseColor.a = opacity;
2021	#endif
2022	#include <map_fragment>
2023	#include <alphamap_fragment>
2024	#include <alphatest_fragment>
2025	#include <logdepthbuf_fragment>
2026	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2027	#if DEPTH_PACKING == 3200
2028		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2029	#elif DEPTH_PACKING == 3201
2030		gl_FragColor = packDepthToRGBA( fragCoordZ );
2031	#endif
2032}`,z_=`#define DISTANCE
2033varying vec3 vWorldPosition;
2034#include <common>
2035#include <uv_pars_vertex>
2036#include <displacementmap_pars_vertex>
2037#include <morphtarget_pars_vertex>
2038#include <skinning_pars_vertex>
2039#include <clipping_planes_pars_vertex>
2040void main() {
2041	#include <uv_vertex>
2042	#include <skinbase_vertex>
2043	#ifdef USE_DISPLACEMENTMAP
2044		#include <beginnormal_vertex>
2045		#include <morphnormal_vertex>
2046		#include <skinnormal_vertex>
2047	#endif
2048	#include <begin_vertex>
2049	#include <morphtarget_vertex>
2050	#include <skinning_vertex>
2051	#include <displacementmap_vertex>
2052	#include <project_vertex>
2053	#include <worldpos_vertex>
2054	#include <clipping_planes_vertex>
2055	vWorldPosition = worldPosition.xyz;
2056}`,N_=`#define DISTANCE
2057uniform vec3 referencePosition;
2058uniform float nearDistance;
2059uniform float farDistance;
2060varying vec3 vWorldPosition;
2061#include <common>
2062#include <packing>
2063#include <uv_pars_fragment>
2064#include <map_pars_fragment>
2065#include <alphamap_pars_fragment>
2066#include <alphatest_pars_fragment>
2067#include <clipping_planes_pars_fragment>
2068void main () {
2069	#include <clipping_planes_fragment>
2070	vec4 diffuseColor = vec4( 1.0 );
2071	#include <map_fragment>
2072	#include <alphamap_fragment>
2073	#include <alphatest_fragment>
2074	float dist = length( vWorldPosition - referencePosition );
2075	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2076	dist = saturate( dist );
2077	gl_FragColor = packDepthToRGBA( dist );
2078}`,U_=`varying vec3 vWorldDirection;
2079#include <common>
2080void main() {
2081	vWorldDirection = transformDirection( position, modelMatrix );
2082	#include <begin_vertex>
2083	#include <project_vertex>
2084}`,B_=`uniform sampler2D tEquirect;
2085varying vec3 vWorldDirection;
2086#include <common>
2087void main() {
2088	vec3 direction = normalize( vWorldDirection );
2089	vec2 sampleUV = equirectUv( direction );
2090	gl_FragColor = texture2D( tEquirect, sampleUV );
2091	#include <tonemapping_fragment>
2092	#include <encodings_fragment>
2093}`,F_=`uniform float scale;
2094attribute float lineDistance;
2095varying float vLineDistance;
2096#include <common>
2097#include <color_pars_vertex>
2098#include <fog_pars_vertex>
2099#include <morphtarget_pars_vertex>
2100#include <logdepthbuf_pars_vertex>
2101#include <clipping_planes_pars_vertex>
2102void main() {
2103	vLineDistance = scale * lineDistance;
2104	#include <color_vertex>
2105	#include <morphcolor_vertex>
2106	#include <begin_vertex>
2107	#include <morphtarget_vertex>
2108	#include <project_vertex>
2109	#include <logdepthbuf_vertex>
2110	#include <clipping_planes_vertex>
2111	#include <fog_vertex>
2112}`,k_=`uniform vec3 diffuse;
2113uniform float opacity;
2114uniform float dashSize;
2115uniform float totalSize;
2116varying float vLineDistance;
2117#include <common>
2118#include <color_pars_fragment>
2119#include <fog_pars_fragment>
2120#include <logdepthbuf_pars_fragment>
2121#include <clipping_planes_pars_fragment>
2122void main() {
2123	#include <clipping_planes_fragment>
2124	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2125		discard;
2126	}
2127	vec3 outgoingLight = vec3( 0.0 );
2128	vec4 diffuseColor = vec4( diffuse, opacity );
2129	#include <logdepthbuf_fragment>
2130	#include <color_fragment>
2131	outgoingLight = diffuseColor.rgb;
2132	#include <output_fragment>
2133	#include <tonemapping_fragment>
2134	#include <encodings_fragment>
2135	#include <fog_fragment>
2136	#include <premultiplied_alpha_fragment>
2137}`,V_=`#include <common>
2138#include <uv_pars_vertex>
2139#include <uv2_pars_vertex>
2140#include <envmap_pars_vertex>
2141#include <color_pars_vertex>
2142#include <fog_pars_vertex>
2143#include <morphtarget_pars_vertex>
2144#include <skinning_pars_vertex>
2145#include <logdepthbuf_pars_vertex>
2146#include <clipping_planes_pars_vertex>
2147void main() {
2148	#include <uv_vertex>
2149	#include <uv2_vertex>
2150	#include <color_vertex>
2151	#include <morphcolor_vertex>
2152	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2153		#include <beginnormal_vertex>
2154		#include <morphnormal_vertex>
2155		#include <skinbase_vertex>
2156		#include <skinnormal_vertex>
2157		#include <defaultnormal_vertex>
2158	#endif
2159	#include <begin_vertex>
2160	#include <morphtarget_vertex>
2161	#include <skinning_vertex>
2162	#include <project_vertex>
2163	#include <logdepthbuf_vertex>
2164	#include <clipping_planes_vertex>
2165	#include <worldpos_vertex>
2166	#include <envmap_vertex>
2167	#include <fog_vertex>
2168}`,G_=`uniform vec3 diffuse;
2169uniform float opacity;
2170#ifndef FLAT_SHADED
2171	varying vec3 vNormal;
2172#endif
2173#include <common>
2174#include <dithering_pars_fragment>
2175#include <color_pars_fragment>
2176#include <uv_pars_fragment>
2177#include <uv2_pars_fragment>
2178#include <map_pars_fragment>
2179#include <alphamap_pars_fragment>
2180#include <alphatest_pars_fragment>
2181#include <aomap_pars_fragment>
2182#include <lightmap_pars_fragment>
2183#include <envmap_common_pars_fragment>
2184#include <envmap_pars_fragment>
2185#include <fog_pars_fragment>
2186#include <specularmap_pars_fragment>
2187#include <logdepthbuf_pars_fragment>
2188#include <clipping_planes_pars_fragment>
2189void main() {
2190	#include <clipping_planes_fragment>
2191	vec4 diffuseColor = vec4( diffuse, opacity );
2192	#include <logdepthbuf_fragment>
2193	#include <map_fragment>
2194	#include <color_fragment>
2195	#include <alphamap_fragment>
2196	#include <alphatest_fragment>
2197	#include <specularmap_fragment>
2198	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2199	#ifdef USE_LIGHTMAP
2200		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
2201		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2202	#else
2203		reflectedLight.indirectDiffuse += vec3( 1.0 );
2204	#endif
2205	#include <aomap_fragment>
2206	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2207	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2208	#include <envmap_fragment>
2209	#include <output_fragment>
2210	#include <tonemapping_fragment>
2211	#include <encodings_fragment>
2212	#include <fog_fragment>
2213	#include <premultiplied_alpha_fragment>
2214	#include <dithering_fragment>
2215}`,H_=`#define LAMBERT
2216varying vec3 vViewPosition;
2217#include <common>
2218#include <uv_pars_vertex>
2219#include <uv2_pars_vertex>
2220#include <displacementmap_pars_vertex>
2221#include <envmap_pars_vertex>
2222#include <color_pars_vertex>
2223#include <fog_pars_vertex>
2224#include <normal_pars_vertex>
2225#include <morphtarget_pars_vertex>
2226#include <skinning_pars_vertex>
2227#include <shadowmap_pars_vertex>
2228#include <logdepthbuf_pars_vertex>
2229#include <clipping_planes_pars_vertex>
2230void main() {
2231	#include <uv_vertex>
2232	#include <uv2_vertex>
2233	#include <color_vertex>
2234	#include <morphcolor_vertex>
2235	#include <beginnormal_vertex>
2236	#include <morphnormal_vertex>
2237	#include <skinbase_vertex>
2238	#include <skinnormal_vertex>
2239	#include <defaultnormal_vertex>
2240	#include <normal_vertex>
2241	#include <begin_vertex>
2242	#include <morphtarget_vertex>
2243	#include <skinning_vertex>
2244	#include <displacementmap_vertex>
2245	#include <project_vertex>
2246	#include <logdepthbuf_vertex>
2247	#include <clipping_planes_vertex>
2248	vViewPosition = - mvPosition.xyz;
2249	#include <worldpos_vertex>
2250	#include <envmap_vertex>
2251	#include <shadowmap_vertex>
2252	#include <fog_vertex>
2253}`,W_=`#define LAMBERT
2254uniform vec3 diffuse;
2255uniform vec3 emissive;
2256uniform float opacity;
2257#include <common>
2258#include <packing>
2259#include <dithering_pars_fragment>
2260#include <color_pars_fragment>
2261#include <uv_pars_fragment>
2262#include <uv2_pars_fragment>
2263#include <map_pars_fragment>
2264#include <alphamap_pars_fragment>
2265#include <alphatest_pars_fragment>
2266#include <aomap_pars_fragment>
2267#include <lightmap_pars_fragment>
2268#include <emissivemap_pars_fragment>
2269#include <envmap_common_pars_fragment>
2270#include <envmap_pars_fragment>
2271#include <fog_pars_fragment>
2272#include <bsdfs>
2273#include <lights_pars_begin>
2274#include <normal_pars_fragment>
2275#include <lights_lambert_pars_fragment>
2276#include <shadowmap_pars_fragment>
2277#include <bumpmap_pars_fragment>
2278#include <normalmap_pars_fragment>
2279#include <specularmap_pars_fragment>
2280#include <logdepthbuf_pars_fragment>
2281#include <clipping_planes_pars_fragment>
2282void main() {
2283	#include <clipping_planes_fragment>
2284	vec4 diffuseColor = vec4( diffuse, opacity );
2285	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2286	vec3 totalEmissiveRadiance = emissive;
2287	#include <logdepthbuf_fragment>
2288	#include <map_fragment>
2289	#include <color_fragment>
2290	#include <alphamap_fragment>
2291	#include <alphatest_fragment>
2292	#include <specularmap_fragment>
2293	#include <normal_fragment_begin>
2294	#include <normal_fragment_maps>
2295	#include <emissivemap_fragment>
2296	#include <lights_lambert_fragment>
2297	#include <lights_fragment_begin>
2298	#include <lights_fragment_maps>
2299	#include <lights_fragment_end>
2300	#include <aomap_fragment>
2301	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2302	#include <envmap_fragment>
2303	#include <output_fragment>
2304	#include <tonemapping_fragment>
2305	#include <encodings_fragment>
2306	#include <fog_fragment>
2307	#include <premultiplied_alpha_fragment>
2308	#include <dithering_fragment>
2309}`,j_=`#define MATCAP
2310varying vec3 vViewPosition;
2311#include <common>
2312#include <uv_pars_vertex>
2313#include <color_pars_vertex>
2314#include <displacementmap_pars_vertex>
2315#include <fog_pars_vertex>
2316#include <normal_pars_vertex>
2317#include <morphtarget_pars_vertex>
2318#include <skinning_pars_vertex>
2319#include <logdepthbuf_pars_vertex>
2320#include <clipping_planes_pars_vertex>
2321void main() {
2322	#include <uv_vertex>
2323	#include <color_vertex>
2324	#include <morphcolor_vertex>
2325	#include <beginnormal_vertex>
2326	#include <morphnormal_vertex>
2327	#include <skinbase_vertex>
2328	#include <skinnormal_vertex>
2329	#include <defaultnormal_vertex>
2330	#include <normal_vertex>
2331	#include <begin_vertex>
2332	#include <morphtarget_vertex>
2333	#include <skinning_vertex>
2334	#include <displacementmap_vertex>
2335	#include <project_vertex>
2336	#include <logdepthbuf_vertex>
2337	#include <clipping_planes_vertex>
2338	#include <fog_vertex>
2339	vViewPosition = - mvPosition.xyz;
2340}`,q_=`#define MATCAP
2341uniform vec3 diffuse;
2342uniform float opacity;
2343uniform sampler2D matcap;
2344varying vec3 vViewPosition;
2345#include <common>
2346#include <dithering_pars_fragment>
2347#include <color_pars_fragment>
2348#include <uv_pars_fragment>
2349#include <map_pars_fragment>
2350#include <alphamap_pars_fragment>
2351#include <alphatest_pars_fragment>
2352#include <fog_pars_fragment>
2353#include <normal_pars_fragment>
2354#include <bumpmap_pars_fragment>
2355#include <normalmap_pars_fragment>
2356#include <logdepthbuf_pars_fragment>
2357#include <clipping_planes_pars_fragment>
2358void main() {
2359	#include <clipping_planes_fragment>
2360	vec4 diffuseColor = vec4( diffuse, opacity );
2361	#include <logdepthbuf_fragment>
2362	#include <map_fragment>
2363	#include <color_fragment>
2364	#include <alphamap_fragment>
2365	#include <alphatest_fragment>
2366	#include <normal_fragment_begin>
2367	#include <normal_fragment_maps>
2368	vec3 viewDir = normalize( vViewPosition );
2369	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
2370	vec3 y = cross( viewDir, x );
2371	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
2372	#ifdef USE_MATCAP
2373		vec4 matcapColor = texture2D( matcap, uv );
2374	#else
2375		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
2376	#endif
2377	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
2378	#include <output_fragment>
2379	#include <tonemapping_fragment>
2380	#include <encodings_fragment>
2381	#include <fog_fragment>
2382	#include <premultiplied_alpha_fragment>
2383	#include <dithering_fragment>
2384}`,X_=`#define NORMAL
2385#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2386	varying vec3 vViewPosition;
2387#endif
2388#include <common>
2389#include <uv_pars_vertex>
2390#include <displacementmap_pars_vertex>
2391#include <normal_pars_vertex>
2392#include <morphtarget_pars_vertex>
2393#include <skinning_pars_vertex>
2394#include <logdepthbuf_pars_vertex>
2395#include <clipping_planes_pars_vertex>
2396void main() {
2397	#include <uv_vertex>
2398	#include <beginnormal_vertex>
2399	#include <morphnormal_vertex>
2400	#include <skinbase_vertex>
2401	#include <skinnormal_vertex>
2402	#include <defaultnormal_vertex>
2403	#include <normal_vertex>
2404	#include <begin_vertex>
2405	#include <morphtarget_vertex>
2406	#include <skinning_vertex>
2407	#include <displacementmap_vertex>
2408	#include <project_vertex>
2409	#include <logdepthbuf_vertex>
2410	#include <clipping_planes_vertex>
2411#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2412	vViewPosition = - mvPosition.xyz;
2413#endif
2414}`,Y_=`#define NORMAL
2415uniform float opacity;
2416#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2417	varying vec3 vViewPosition;
2418#endif
2419#include <packing>
2420#include <uv_pars_fragment>
2421#include <normal_pars_fragment>
2422#include <bumpmap_pars_fragment>
2423#include <normalmap_pars_fragment>
2424#include <logdepthbuf_pars_fragment>
2425#include <clipping_planes_pars_fragment>
2426void main() {
2427	#include <clipping_planes_fragment>
2428	#include <logdepthbuf_fragment>
2429	#include <normal_fragment_begin>
2430	#include <normal_fragment_maps>
2431	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
2432	#ifdef OPAQUE
2433		gl_FragColor.a = 1.0;
2434	#endif
2435}`,$_=`#define PHONG
2436varying vec3 vViewPosition;
2437#include <common>
2438#include <uv_pars_vertex>
2439#include <uv2_pars_vertex>
2440#include <displacementmap_pars_vertex>
2441#include <envmap_pars_vertex>
2442#include <color_pars_vertex>
2443#include <fog_pars_vertex>
2444#include <normal_pars_vertex>
2445#include <morphtarget_pars_vertex>
2446#include <skinning_pars_vertex>
2447#include <shadowmap_pars_vertex>
2448#include <logdepthbuf_pars_vertex>
2449#include <clipping_planes_pars_vertex>
2450void main() {
2451	#include <uv_vertex>
2452	#include <uv2_vertex>
2453	#include <color_vertex>
2454	#include <morphcolor_vertex>
2455	#include <beginnormal_vertex>
2456	#include <morphnormal_vertex>
2457	#include <skinbase_vertex>
2458	#include <skinnormal_vertex>
2459	#include <defaultnormal_vertex>
2460	#include <normal_vertex>
2461	#include <begin_vertex>
2462	#include <morphtarget_vertex>
2463	#include <skinning_vertex>
2464	#include <displacementmap_vertex>
2465	#include <project_vertex>
2466	#include <logdepthbuf_vertex>
2467	#include <clipping_planes_vertex>
2468	vViewPosition = - mvPosition.xyz;
2469	#include <worldpos_vertex>
2470	#include <envmap_vertex>
2471	#include <shadowmap_vertex>
2472	#include <fog_vertex>
2473}`,Z_=`#define PHONG
2474uniform vec3 diffuse;
2475uniform vec3 emissive;
2476uniform vec3 specular;
2477uniform float shininess;
2478uniform float opacity;
2479#include <common>
2480#include <packing>
2481#include <dithering_pars_fragment>
2482#include <color_pars_fragment>
2483#include <uv_pars_fragment>
2484#include <uv2_pars_fragment>
2485#include <map_pars_fragment>
2486#include <alphamap_pars_fragment>
2487#include <alphatest_pars_fragment>
2488#include <aomap_pars_fragment>
2489#include <lightmap_pars_fragment>
2490#include <emissivemap_pars_fragment>
2491#include <envmap_common_pars_fragment>
2492#include <envmap_pars_fragment>
2493#include <fog_pars_fragment>
2494#include <bsdfs>
2495#include <lights_pars_begin>
2496#include <normal_pars_fragment>
2497#include <lights_phong_pars_fragment>
2498#include <shadowmap_pars_fragment>
2499#include <bumpmap_pars_fragment>
2500#include <normalmap_pars_fragment>
2501#include <specularmap_pars_fragment>
2502#include <logdepthbuf_pars_fragment>
2503#include <clipping_planes_pars_fragment>
2504void main() {
2505	#include <clipping_planes_fragment>
2506	vec4 diffuseColor = vec4( diffuse, opacity );
2507	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2508	vec3 totalEmissiveRadiance = emissive;
2509	#include <logdepthbuf_fragment>
2510	#include <map_fragment>
2511	#include <color_fragment>
2512	#include <alphamap_fragment>
2513	#include <alphatest_fragment>
2514	#include <specularmap_fragment>
2515	#include <normal_fragment_begin>
2516	#include <normal_fragment_maps>
2517	#include <emissivemap_fragment>
2518	#include <lights_phong_fragment>
2519	#include <lights_fragment_begin>
2520	#include <lights_fragment_maps>
2521	#include <lights_fragment_end>
2522	#include <aomap_fragment>
2523	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
2524	#include <envmap_fragment>
2525	#include <output_fragment>
2526	#include <tonemapping_fragment>
2527	#include <encodings_fragment>
2528	#include <fog_fragment>
2529	#include <premultiplied_alpha_fragment>
2530	#include <dithering_fragment>
2531}`,J_=`#define STANDARD
2532varying vec3 vViewPosition;
2533#ifdef USE_TRANSMISSION
2534	varying vec3 vWorldPosition;
2535#endif
2536#include <common>
2537#include <uv_pars_vertex>
2538#include <uv2_pars_vertex>
2539#include <displacementmap_pars_vertex>
2540#include <color_pars_vertex>
2541#include <fog_pars_vertex>
2542#include <normal_pars_vertex>
2543#include <morphtarget_pars_vertex>
2544#include <skinning_pars_vertex>
2545#include <shadowmap_pars_vertex>
2546#include <logdepthbuf_pars_vertex>
2547#include <clipping_planes_pars_vertex>
2548void main() {
2549	#include <uv_vertex>
2550	#include <uv2_vertex>
2551	#include <color_vertex>
2552	#include <morphcolor_vertex>
2553	#include <beginnormal_vertex>
2554	#include <morphnormal_vertex>
2555	#include <skinbase_vertex>
2556	#include <skinnormal_vertex>
2557	#include <defaultnormal_vertex>
2558	#include <normal_vertex>
2559	#include <begin_vertex>
2560	#include <morphtarget_vertex>
2561	#include <skinning_vertex>
2562	#include <displacementmap_vertex>
2563	#include <project_vertex>
2564	#include <logdepthbuf_vertex>
2565	#include <clipping_planes_vertex>
2566	vViewPosition = - mvPosition.xyz;
2567	#include <worldpos_vertex>
2568	#include <shadowmap_vertex>
2569	#include <fog_vertex>
2570#ifdef USE_TRANSMISSION
2571	vWorldPosition = worldPosition.xyz;
2572#endif
2573}`,K_=`#define STANDARD
2574#ifdef PHYSICAL
2575	#define IOR
2576	#define SPECULAR
2577#endif
2578uniform vec3 diffuse;
2579uniform vec3 emissive;
2580uniform float roughness;
2581uniform float metalness;
2582uniform float opacity;
2583#ifdef IOR
2584	uniform float ior;
2585#endif
2586#ifdef SPECULAR
2587	uniform float specularIntensity;
2588	uniform vec3 specularColor;
2589	#ifdef USE_SPECULARINTENSITYMAP
2590		uniform sampler2D specularIntensityMap;
2591	#endif
2592	#ifdef USE_SPECULARCOLORMAP
2593		uniform sampler2D specularColorMap;
2594	#endif
2595#endif
2596#ifdef USE_CLEARCOAT
2597	uniform float clearcoat;
2598	uniform float clearcoatRoughness;
2599#endif
2600#ifdef USE_IRIDESCENCE
2601	uniform float iridescence;
2602	uniform float iridescenceIOR;
2603	uniform float iridescenceThicknessMinimum;
2604	uniform float iridescenceThicknessMaximum;
2605#endif
2606#ifdef USE_SHEEN
2607	uniform vec3 sheenColor;
2608	uniform float sheenRoughness;
2609	#ifdef USE_SHEENCOLORMAP
2610		uniform sampler2D sheenColorMap;
2611	#endif
2612	#ifdef USE_SHEENROUGHNESSMAP
2613		uniform sampler2D sheenRoughnessMap;
2614	#endif
2615#endif
2616varying vec3 vViewPosition;
2617#include <common>
2618#include <packing>
2619#include <dithering_pars_fragment>
2620#include <color_pars_fragment>
2621#include <uv_pars_fragment>
2622#include <uv2_pars_fragment>
2623#include <map_pars_fragment>
2624#include <alphamap_pars_fragment>
2625#include <alphatest_pars_fragment>
2626#include <aomap_pars_fragment>
2627#include <lightmap_pars_fragment>
2628#include <emissivemap_pars_fragment>
2629#include <bsdfs>
2630#include <iridescence_fragment>
2631#include <cube_uv_reflection_fragment>
2632#include <envmap_common_pars_fragment>
2633#include <envmap_physical_pars_fragment>
2634#include <fog_pars_fragment>
2635#include <lights_pars_begin>
2636#include <normal_pars_fragment>
2637#include <lights_physical_pars_fragment>
2638#include <transmission_pars_fragment>
2639#include <shadowmap_pars_fragment>
2640#include <bumpmap_pars_fragment>
2641#include <normalmap_pars_fragment>
2642#include <clearcoat_pars_fragment>
2643#include <iridescence_pars_fragment>
2644#include <roughnessmap_pars_fragment>
2645#include <metalnessmap_pars_fragment>
2646#include <logdepthbuf_pars_fragment>
2647#include <clipping_planes_pars_fragment>
2648void main() {
2649	#include <clipping_planes_fragment>
2650	vec4 diffuseColor = vec4( diffuse, opacity );
2651	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2652	vec3 totalEmissiveRadiance = emissive;
2653	#include <logdepthbuf_fragment>
2654	#include <map_fragment>
2655	#include <color_fragment>
2656	#include <alphamap_fragment>
2657	#include <alphatest_fragment>
2658	#include <roughnessmap_fragment>
2659	#include <metalnessmap_fragment>
2660	#include <normal_fragment_begin>
2661	#include <normal_fragment_maps>
2662	#include <clearcoat_normal_fragment_begin>
2663	#include <clearcoat_normal_fragment_maps>
2664	#include <emissivemap_fragment>
2665	#include <lights_physical_fragment>
2666	#include <lights_fragment_begin>
2667	#include <lights_fragment_maps>
2668	#include <lights_fragment_end>
2669	#include <aomap_fragment>
2670	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
2671	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
2672	#include <transmission_fragment>
2673	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
2674	#ifdef USE_SHEEN
2675		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
2676		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
2677	#endif
2678	#ifdef USE_CLEARCOAT
2679		float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
2680		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
2681		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
2682	#endif
2683	#include <output_fragment>
2684	#include <tonemapping_fragment>
2685	#include <encodings_fragment>
2686	#include <fog_fragment>
2687	#include <premultiplied_alpha_fragment>
2688	#include <dithering_fragment>
2689}`,Q_=`#define TOON
2690varying vec3 vViewPosition;
2691#include <common>
2692#include <uv_pars_vertex>
2693#include <uv2_pars_vertex>
2694#include <displacementmap_pars_vertex>
2695#include <color_pars_vertex>
2696#include <fog_pars_vertex>
2697#include <normal_pars_vertex>
2698#include <morphtarget_pars_vertex>
2699#include <skinning_pars_vertex>
2700#include <shadowmap_pars_vertex>
2701#include <logdepthbuf_pars_vertex>
2702#include <clipping_planes_pars_vertex>
2703void main() {
2704	#include <uv_vertex>
2705	#include <uv2_vertex>
2706	#include <color_vertex>
2707	#include <morphcolor_vertex>
2708	#include <beginnormal_vertex>
2709	#include <morphnormal_vertex>
2710	#include <skinbase_vertex>
2711	#include <skinnormal_vertex>
2712	#include <defaultnormal_vertex>
2713	#include <normal_vertex>
2714	#include <begin_vertex>
2715	#include <morphtarget_vertex>
2716	#include <skinning_vertex>
2717	#include <displacementmap_vertex>
2718	#include <project_vertex>
2719	#include <logdepthbuf_vertex>
2720	#include <clipping_planes_vertex>
2721	vViewPosition = - mvPosition.xyz;
2722	#include <worldpos_vertex>
2723	#include <shadowmap_vertex>
2724	#include <fog_vertex>
2725}`,e1=`#define TOON
2726uniform vec3 diffuse;
2727uniform vec3 emissive;
2728uniform float opacity;
2729#include <common>
2730#include <packing>
2731#include <dithering_pars_fragment>
2732#include <color_pars_fragment>
2733#include <uv_pars_fragment>
2734#include <uv2_pars_fragment>
2735#include <map_pars_fragment>
2736#include <alphamap_pars_fragment>
2737#include <alphatest_pars_fragment>
2738#include <aomap_pars_fragment>
2739#include <lightmap_pars_fragment>
2740#include <emissivemap_pars_fragment>
2741#include <gradientmap_pars_fragment>
2742#include <fog_pars_fragment>
2743#include <bsdfs>
2744#include <lights_pars_begin>
2745#include <normal_pars_fragment>
2746#include <lights_toon_pars_fragment>
2747#include <shadowmap_pars_fragment>
2748#include <bumpmap_pars_fragment>
2749#include <normalmap_pars_fragment>
2750#include <logdepthbuf_pars_fragment>
2751#include <clipping_planes_pars_fragment>
2752void main() {
2753	#include <clipping_planes_fragment>
2754	vec4 diffuseColor = vec4( diffuse, opacity );
2755	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2756	vec3 totalEmissiveRadiance = emissive;
2757	#include <logdepthbuf_fragment>
2758	#include <map_fragment>
2759	#include <color_fragment>
2760	#include <alphamap_fragment>
2761	#include <alphatest_fragment>
2762	#include <normal_fragment_begin>
2763	#include <normal_fragment_maps>
2764	#include <emissivemap_fragment>
2765	#include <lights_toon_fragment>
2766	#include <lights_fragment_begin>
2767	#include <lights_fragment_maps>
2768	#include <lights_fragment_end>
2769	#include <aomap_fragment>
2770	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2771	#include <output_fragment>
2772	#include <tonemapping_fragment>
2773	#include <encodings_fragment>
2774	#include <fog_fragment>
2775	#include <premultiplied_alpha_fragment>
2776	#include <dithering_fragment>
2777}`,t1=`uniform float size;
2778uniform float scale;
2779#include <common>
2780#include <color_pars_vertex>
2781#include <fog_pars_vertex>
2782#include <morphtarget_pars_vertex>
2783#include <logdepthbuf_pars_vertex>
2784#include <clipping_planes_pars_vertex>
2785void main() {
2786	#include <color_vertex>
2787	#include <morphcolor_vertex>
2788	#include <begin_vertex>
2789	#include <morphtarget_vertex>
2790	#include <project_vertex>
2791	gl_PointSize = size;
2792	#ifdef USE_SIZEATTENUATION
2793		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
2794		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
2795	#endif
2796	#include <logdepthbuf_vertex>
2797	#include <clipping_planes_vertex>
2798	#include <worldpos_vertex>
2799	#include <fog_vertex>
2800}`,i1=`uniform vec3 diffuse;
2801uniform float opacity;
2802#include <common>
2803#include <color_pars_fragment>
2804#include <map_particle_pars_fragment>
2805#include <alphatest_pars_fragment>
2806#include <fog_pars_fragment>
2807#include <logdepthbuf_pars_fragment>
2808#include <clipping_planes_pars_fragment>
2809void main() {
2810	#include <clipping_planes_fragment>
2811	vec3 outgoingLight = vec3( 0.0 );
2812	vec4 diffuseColor = vec4( diffuse, opacity );
2813	#include <logdepthbuf_fragment>
2814	#include <map_particle_fragment>
2815	#include <color_fragment>
2816	#include <alphatest_fragment>
2817	outgoingLight = diffuseColor.rgb;
2818	#include <output_fragment>
2819	#include <tonemapping_fragment>
2820	#include <encodings_fragment>
2821	#include <fog_fragment>
2822	#include <premultiplied_alpha_fragment>
2823}`,n1=`#include <common>
2824#include <fog_pars_vertex>
2825#include <morphtarget_pars_vertex>
2826#include <skinning_pars_vertex>
2827#include <shadowmap_pars_vertex>
2828void main() {
2829	#include <beginnormal_vertex>
2830	#include <morphnormal_vertex>
2831	#include <skinbase_vertex>
2832	#include <skinnormal_vertex>
2833	#include <defaultnormal_vertex>
2834	#include <begin_vertex>
2835	#include <morphtarget_vertex>
2836	#include <skinning_vertex>
2837	#include <project_vertex>
2838	#include <worldpos_vertex>
2839	#include <shadowmap_vertex>
2840	#include <fog_vertex>
2841}`,r1=`uniform vec3 color;
2842uniform float opacity;
2843#include <common>
2844#include <packing>
2845#include <fog_pars_fragment>
2846#include <bsdfs>
2847#include <lights_pars_begin>
2848#include <shadowmap_pars_fragment>
2849#include <shadowmask_pars_fragment>
2850void main() {
2851	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
2852	#include <tonemapping_fragment>
2853	#include <encodings_fragment>
2854	#include <fog_fragment>
2855}`,s1=`uniform float rotation;
2856uniform vec2 center;
2857#include <common>
2858#include <uv_pars_vertex>
2859#include <fog_pars_vertex>
2860#include <logdepthbuf_pars_vertex>
2861#include <clipping_planes_pars_vertex>
2862void main() {
2863	#include <uv_vertex>
2864	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
2865	vec2 scale;
2866	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
2867	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
2868	#ifndef USE_SIZEATTENUATION
2869		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
2870		if ( isPerspective ) scale *= - mvPosition.z;
2871	#endif
2872	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
2873	vec2 rotatedPosition;
2874	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
2875	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
2876	mvPosition.xy += rotatedPosition;
2877	gl_Position = projectionMatrix * mvPosition;
2878	#include <logdepthbuf_vertex>
2879	#include <clipping_planes_vertex>
2880	#include <fog_vertex>
2881}`,o1=`uniform vec3 diffuse;
2882uniform float opacity;
2883#include <common>
2884#include <uv_pars_fragment>
2885#include <map_pars_fragment>
2886#include <alphamap_pars_fragment>
2887#include <alphatest_pars_fragment>
2888#include <fog_pars_fragment>
2889#include <logdepthbuf_pars_fragment>
2890#include <clipping_planes_pars_fragment>
2891void main() {
2892	#include <clipping_planes_fragment>
2893	vec3 outgoingLight = vec3( 0.0 );
2894	vec4 diffuseColor = vec4( diffuse, opacity );
2895	#include <logdepthbuf_fragment>
2896	#include <map_fragment>
2897	#include <alphamap_fragment>
2898	#include <alphatest_fragment>
2899	outgoingLight = diffuseColor.rgb;
2900	#include <output_fragment>
2901	#include <tonemapping_fragment>
2902	#include <encodings_fragment>
2903	#include <fog_fragment>
2904}`,et={alphamap_fragment:Dy,alphamap_pars_fragment:Oy,alphatest_fragment:Ry,alphatest_pars_fragment:Iy,aomap_fragment:zy,aomap_pars_fragment:Ny,begin_vertex:Uy,beginnormal_vertex:By,bsdfs:Fy,iridescence_fragment:ky,bumpmap_pars_fragment:Vy,clipping_planes_fragment:Gy,clipping_planes_pars_fragment:Hy,clipping_planes_pars_vertex:Wy,clipping_planes_vertex:jy,color_fragment:qy,color_pars_fragment:Xy,color_pars_vertex:Yy,color_vertex:$y,common:Zy,cube_uv_reflection_fragment:Jy,defaultnormal_vertex:Ky,displacementmap_pars_vertex:Qy,displacementmap_vertex:ex,emissivemap_fragment:tx,emissivemap_pars_fragment:ix,encodings_fragment:nx,encodings_pars_fragment:rx,envmap_fragment:sx,envmap_common_pars_fragment:ox,envmap_pars_fragment:ax,envmap_pars_vertex:lx,envmap_physical_pars_fragment:_x,envmap_vertex:cx,fog_vertex:hx,fog_pars_vertex:ux,fog_fragment:dx,fog_pars_fragment:fx,gradientmap_pars_fragment:px,lightmap_fragment:mx,lightmap_pars_fragment:gx,lights_lambert_fragment:vx,lights_lambert_pars_fragment:yx,lights_pars_begin:xx,lights_toon_fragment:bx,lights_toon_pars_fragment:wx,lights_phong_fragment:Sx,lights_phong_pars_fragment:Mx,lights_physical_fragment:Ax,lights_physical_pars_fragment:Tx,lights_fragment_begin:Ex,lights_fragment_maps:Cx,lights_fragment_end:Lx,logdepthbuf_fragment:Px,logdepthbuf_pars_fragment:Dx,logdepthbuf_pars_vertex:Ox,logdepthbuf_vertex:Rx,map_fragment:Ix,map_pars_fragment:zx,map_particle_fragment:Nx,map_particle_pars_fragment:Ux,metalnessmap_fragment:Bx,metalnessmap_pars_fragment:Fx,morphcolor_vertex:kx,morphnormal_vertex:Vx,morphtarget_pars_vertex:Gx,morphtarget_vertex:Hx,normal_fragment_begin:Wx,normal_fragment_maps:jx,normal_pars_fragment:qx,normal_pars_vertex:Xx,normal_vertex:Yx,normalmap_pars_fragment:$x,clearcoat_normal_fragment_begin:Zx,clearcoat_normal_fragment_maps:Jx,clearcoat_pars_fragment:Kx,iridescence_pars_fragment:Qx,output_fragment:e_,packing:t_,premultiplied_alpha_fragment:i_,project_vertex:n_,dithering_fragment:r_,dithering_pars_fragment:s_,roughnessmap_fragment:o_,roughnessmap_pars_fragment:a_,shadowmap_pars_fragment:l_,shadowmap_pars_vertex:c_,shadowmap_vertex:h_,shadowmask_pars_fragment:u_,skinbase_vertex:d_,skinning_pars_vertex:f_,skinning_vertex:p_,skinnormal_vertex:m_,specularmap_fragment:g_,specularmap_pars_fragment:v_,tonemapping_fragment:y_,tonemapping_pars_fragment:x_,transmission_fragment:__,transmission_pars_fragment:b_,uv_pars_fragment:w_,uv_pars_vertex:S_,uv_vertex:M_,uv2_pars_fragment:A_,uv2_pars_vertex:T_,uv2_vertex:E_,worldpos_vertex:C_,background_vert:L_,background_frag:P_,cube_vert:D_,cube_frag:O_,depth_vert:R_,depth_frag:I_,distanceRGBA_vert:z_,distanceRGBA_frag:N_,equirect_vert:U_,equirect_frag:B_,linedashed_vert:F_,linedashed_frag:k_,meshbasic_vert:V_,meshbasic_frag:G_,meshlambert_vert:H_,meshlambert_frag:W_,meshmatcap_vert:j_,meshmatcap_frag:q_,meshnormal_vert:X_,meshnormal_frag:Y_,meshphong_vert:$_,meshphong_frag:Z_,meshphysical_vert:J_,meshphysical_frag:K_,meshtoon_vert:Q_,meshtoon_frag:e1,points_vert:t1,points_frag:i1,shadow_vert:n1,shadow_frag:r1,sprite_vert:s1,sprite_frag:o1},ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new qt},uv2Transform:{value:new qt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Z(1,1)}}
vendor: 6,045 bytes, line 2904
2904,displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new qt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new Z(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new qt}}},Fi={basic:{uniforms:Yt([ge.common,ge.specularmap,ge.envmap,ge.aomap,ge.lightmap,ge.fog]),vertexShader:et.meshbasic_vert,fragmentShader:et.meshbasic_frag},lambert:{uniforms:Yt([ge.common,ge.specularmap,ge.envmap,ge.aomap,ge.lightmap,ge.emissivemap,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.fog,ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:et.meshlambert_vert,fragmentShader:et.meshlambert_frag},phong:{uniforms:Yt([ge.common,ge.specularmap,ge.envmap,ge.aomap,ge.lightmap,ge.emissivemap,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.fog,ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30}}]),vertexShader:et.meshphong_vert,fragmentShader:et.meshphong_frag},standard:{uniforms:Yt([ge.common,ge.envmap,ge.aomap,ge.lightmap,ge.emissivemap,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.roughnessmap,ge.metalnessmap,ge.fog,ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:et.meshphysical_vert,fragmentShader:et.meshphysical_frag},toon:{uniforms:Yt([ge.common,ge.aomap,ge.lightmap,ge.emissivemap,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.gradientmap,ge.fog,ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:et.meshtoon_vert,fragmentShader:et.meshtoon_frag},matcap:{uniforms:Yt([ge.common,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.fog,{matcap:{value:null}}]),vertexShader:et.meshmatcap_vert,fragmentShader:et.meshmatcap_frag},points:{uniforms:Yt([ge.points,ge.fog]),vertexShader:et.points_vert,fragmentShader:et.points_frag},dashed:{uniforms:Yt([ge.common,ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:et.linedashed_vert,fragmentShader:et.linedashed_frag},depth:{uniforms:Yt([ge.common,ge.displacementmap]),vertexShader:et.depth_vert,fragmentShader:et.depth_frag},normal:{uniforms:Yt([ge.common,ge.bumpmap,ge.normalmap,ge.displacementmap,{opacity:{value:1}}]),vertexShader:et.meshnormal_vert,fragmentShader:et.meshnormal_frag},sprite:{uniforms:Yt([ge.sprite,ge.fog]),vertexShader:et.sprite_vert,fragmentShader:et.sprite_frag},background:{uniforms:{uvTransform:{value:new qt},t2D:{value:null}},vertexShader:et.background_vert,fragmentShader:et.background_frag},cube:{uniforms:Yt([ge.envmap,{opacity:{value:1}}]),vertexShader:et.cube_vert,fragmentShader:et.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:et.equirect_vert,fragmentShader:et.equirect_frag},distanceRGBA:{uniforms:Yt([ge.common,ge.displacementmap,{referencePosition:{value:new E},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:et.distanceRGBA_vert,fragmentShader:et.distanceRGBA_frag},shadow:{uniforms:Yt([ge.lights,ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:et.shadow_vert,fragmentShader:et.shadow_frag}};Fi.physical={uniforms:Yt([Fi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Z(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Z},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null}}]),vertexShader:et.meshphysical_vert,fragmentShader:et.meshphysical_frag};function a1(t,e,i,n,r,s){const o=new Xe(0);let a=r===!0?0:1,l,h,f=null,c=0,u=null;function d(g,p){let v=!1,y=p.isScene===!0?p.background:null;y&&y.isTexture&&(y=e.get(y));const b=t.xr,x=b.getSession&&b.getSession();x&&x.environmentBlendMode==="additive"&&(y=null),y===null?m(o,a):y&&y.isColor&&(m(y,1),v=!0),(t.autoClear||v)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),y&&(y.isCubeTexture||y.mapping===Po)?(h===void 0&&(h=new Di(new Dn(1,1,1),new rr({name:"Backgroun
2904dCubeMaterial",uniforms:Es(Fi.cube.uniforms),vertexShader:Fi.cube.vertexShader,fragmentShader:Fi.cube.fragmentShader,side:vi,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(M,w,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(h)),h.material.uniforms.envMap.value=y,h.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,(f!==y||c!==y.version||u!==t.toneMapping)&&(h.material.needsUpdate=!0,f=y,c=y.version,u=t.toneMapping),h.layers.enableAll(),g.unshift(h,h.geometry,h.material,0,0,null)):y&&y.isTexture&&(l===void 0&&(l=new Di(new Ro(2,2),new rr({name:"BackgroundMaterial",uniforms:Es(Fi.background.uniforms),vertexShader:Fi.background.vertexShader,fragmentShader:Fi.background.fragmentShader,side:Or,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=y,y.matrixAutoUpdate===!0&&y.updateMatrix(),l.material.uniforms.uvTransform.value.copy(y.matrix),(f!==y||c!==y.version||u!==t.toneMapping)&&(l.material.needsUpdate=!0,f=y,c=y.version,u=t.toneMapping),l.layers.enableAll(),g.unshift(l,l.geometry,l.material,0,0,null))}function m(g,p){i.buffers.color.setClear(g.r,g.g,g.b,p,s)}return{getClearColor:function(){return o},setClearColor:function(g,p=1){o.set(g),a=p,m(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(g){a=g,m(o,a)},render:d}}function l1(t,e,i,n){const r=t.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},l=p(null);let h=l,f=!1;function c(I,H,ee,G,B){let N=!1;if(o){const R=g(G,ee,H);h!==R&&(h=R,d(h.object)),N=v(I,G,ee,B),N&&y(I,G,ee,B)}else{const R=H.wireframe===!0;(h.geometry!==G.id||h.program!==ee.id||h.wireframe!==R)&&(h.geometry=G.id,h.program=ee.id,h.wireframe=R,N=!0)}B!==null&&i.update(B,34963),(N||f)&&(f=!1,_(I,H,ee,G),B!==null&&t.bindBuffer(34963,i.get(B).buffer))}function u(){return n.isWebGL2?t.createVertexArray():s.createVertexArrayOES()}function d(I){return n.isWebGL2?t.bindVertexArray(I):s.bindVertexArrayOES(I)}function m(I){return n.isWebGL2?t.deleteVertexArray(I):s.deleteVertexArrayOES(I)}function g(I,H,ee){const G=ee.wireframe===!0;let B=a[I.id];B===void 0&&(B={},a[I.id]=B);let N=B[H.id];N===void 0&&(N={},B[H.id]=N);let R=N[G];return R===void 0&&(R=p(u()),N[G]=R),R}function p(I){const H=[],ee=[],G=[];for(let B=0;B<r;B++)H[B]=0,ee[B]=0,G[B]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:H,enabledAttributes:ee,attributeDivisors:G,object:I,attributes:{},index:null}}function v(I,H,ee,G){const B=h.attributes,N=H.attributes;let R=0;const k=ee.getAttributes();for(const F in k)if(k[F].location>=0){const W=B[F];let ie=N[F];if(ie===void 0&&(F==="instanceMatrix"&&I.instanceMatrix&&(ie=I.instanceMatrix),F==="instanceColor"&&I.instanceColor&&(ie=I.instanceColor)),W===void 0||W.attribute!==ie||ie&&W.data!==ie.data)return!0;R++}return h.attributesNum!==R||h.index!==G}function y(I,H,ee,G){const B={},N=H.attributes;let R=0;const k=ee.getAttributes();for(const F in k)if(k[F].location>=0){let W=N[F];W===void 0&&(F==="instanceMatrix"&&I.instanceMatrix&&(W=I.instanceMatrix),F==="instanceColor"&&I.instanceColor&&(W=I.instanceColor));const ie={};ie.attribute=W,W&&W.data&&(ie.data=W.data),B[F]=ie,R++}h.attributes=B,h.attributesNum=R,h.index=G}function b(){const I=h.newAttributes;for(let H=0,ee=I.length;H<ee;H++)I[H]=0}function x(I){M(I,0)}function M(I,H){const ee=h.newAttributes,G=h.enabledAttributes,B=h.attributeDivisors;ee[I]=1,G[I]===0&&(t.enableVertexAttribArray(I),G[I]=1),B[I]!==H&&((n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](I,H),B[I]=H)}function w(){const I=h.newAttributes,H=h.enabledAttributes;for(let ee=0,G=H.length;ee<G;ee++)H[ee]!==I[ee]&&(t.disableVertexAttribArray(ee),H[ee]=0)}function T(I,H,ee,G,B,N){n.isWebGL2===!0&&(ee===5124||ee===5125)?t.vertexAttribIPointer(I,H,ee,B,N):t.vertexAttribPointer(I,H,ee,G,B,N)}
vendor: 5,381 bytes, line 2904
2904function _(I,H,ee,G){if(n.isWebGL2===!1&&(I.isInstancedMesh||G.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;b();const B=G.attributes,N=ee.getAttributes(),R=H.defaultAttributeValues;for(const k in N){const F=N[k];if(F.location>=0){let U=B[k];if(U===void 0&&(k==="instanceMatrix"&&I.instanceMatrix&&(U=I.instanceMatrix),k==="instanceColor"&&I.instanceColor&&(U=I.instanceColor)),U!==void 0){const W=U.normalized,ie=U.itemSize,V=i.get(U);if(V===void 0)continue;const K=V.buffer,Y=V.type,J=V.bytesPerElement;if(U.isInterleavedBufferAttribute){const Q=U.data,he=Q.stride,de=U.offset;if(Q.isInstancedInterleavedBuffer){for(let ae=0;ae<F.locationSize;ae++)M(F.location+ae,Q.meshPerAttribute);I.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=Q.meshPerAttribute*Q.count)}else for(let ae=0;ae<F.locationSize;ae++)x(F.location+ae);t.bindBuffer(34962,K);for(let ae=0;ae<F.locationSize;ae++)T(F.location+ae,ie/F.locationSize,Y,W,he*J,(de+ie/F.locationSize*ae)*J)}else{if(U.isInstancedBufferAttribute){for(let Q=0;Q<F.locationSize;Q++)M(F.location+Q,U.meshPerAttribute);I.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=U.meshPerAttribute*U.count)}else for(let Q=0;Q<F.locationSize;Q++)x(F.location+Q);t.bindBuffer(34962,K);for(let Q=0;Q<F.locationSize;Q++)T(F.location+Q,ie/F.locationSize,Y,W,ie*J,ie/F.locationSize*Q*J)}}else if(R!==void 0){const W=R[k];if(W!==void 0)switch(W.length){case 2:t.vertexAttrib2fv(F.location,W);break;case 3:t.vertexAttrib3fv(F.location,W);break;case 4:t.vertexAttrib4fv(F.location,W);break;default:t.vertexAttrib1fv(F.location,W)}}}}w()}function A(){O();for(const I in a){const H=a[I];for(const ee in H){const G=H[ee];for(const B in G)m(G[B].object),delete G[B];delete H[ee]}delete a[I]}}function S(I){if(a[I.id]===void 0)return;const H=a[I.id];for(const ee in H){const G=H[ee];for(const B in G)m(G[B].object),delete G[B];delete H[ee]}delete a[I.id]}function D(I){for(const H in a){const ee=a[H];if(ee[I.id]===void 0)continue;const G=ee[I.id];for(const B in G)m(G[B].object),delete G[B];delete ee[I.id]}}function O(){z(),f=!0,h!==l&&(h=l,d(h.object))}function z(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:c,reset:O,resetDefaultState:z,dispose:A,releaseStatesOfGeometry:S,releaseStatesOfProgram:D,initAttributes:b,enableAttribute:x,disableUnusedAttributes:w}}function c1(t,e,i,n){const r=n.isWebGL2;let s;function o(h){s=h}function a(h,f){t.drawArrays(s,h,f),i.update(f,s,1)}function l(h,f,c){if(c===0)return;let u,d;if(r)u=t,d="drawArraysInstanced";else if(u=e.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",u===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}u[d](s,h,f,c),i.update(f,s,c)}this.setMode=o,this.render=a,this.renderInstances=l}function h1(t,e,i){let n;function r(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const T=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(T.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(T){if(T==="highp"){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";T="mediump"}return T==="mediump"&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&t instanceof WebGL2ComputeRenderingContext;let a=i.precision!==void 0?i.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const h=o||e.has("WEBGL_draw_buffers"),f=i.logarithmicDepthBuffer===!0,c=t.getParameter(34930),u=t.getParameter(35660),d=t.getParameter(3379),m=t.getParameter(34076),g=t.getParameter(34921),p=t.getParameter(36347),v=t.getParameter(36348),y=t.getParameter(36349),b=u>0,x=o||e.has("OES_texture_float"),M=b&&x,w=o?t.getParameter(36183):0;return{isWebGL2:o,drawBuffers:h,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:f,maxTextures:c,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:m,maxAttributes:g,maxVertexUniforms:p,maxVaryings:v,maxFragmentUniforms:y,vertexTextures:b,floatFragmentTextures:x,floatVertexTextures:M,maxSamples:w}}function u1(t){const e=this;let i=null,n=0,r=!1,s=!1;const o=new qn,a=new qt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(c,u,d){const m=c.length!==0||u||n!==0||r;return r=u,i=f(c,d,0),n=c.length,m},this.beginShadows=function(){s=!0,f(null)},this.endShadows=function(){s=!1,h()},this.setState=function(c,u,d){const m=c.clippingPlanes,g=c.clipIntersection,p=c.clipShadows,v=t.get(c);if(!r||m===null||m.length===0||s&&!p)s?f(null):h();else{const y=s?0:n,b=y*4;let x=v.clippingState||null;l.value=x,x=f(m,u,b,d);for(let M=0;M!==b;++M)x[M]=i[M];v.clippingState=x,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=y}};function h(){l.value!==i&&(l.value=i,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function f(c,u,d,m){const g=c!==null?c.length:0;let p=null;if(g!==0){if(p=l.value,m!==!0||p===null){const v=d+g*4,y=u.matrixWorldInverse;a.getNormalMatrix(y),(p===null||p.length<v)&&(p=new Float32Array(v));for(let b=0,x=d;b!==g;
vendor: 10,666 bytes, lines 2904-2979
2904++b,x+=4)o.copy(c[b]).applyMatrix4(y,a),o.normal.toArray(p,x),p[x+3]=o.constant}l.value=p,l.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,p}}function d1(t){let e=new WeakMap;function i(o,a){return a===Ic?o.mapping=Rr:a===zc&&(o.mapping=Ir),o}function n(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){const a=o.mapping;if(a===Ic||a===zc)if(e.has(o)){const l=e.get(o).texture;return i(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const h=new Ey(l.height/2);return h.fromEquirectangularTexture(t,o),e.set(o,h),o.addEventListener("dispose",r),i(h.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class nl extends Oo{constructor(e=-1,i=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=i,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,i){return super.copy(e,i),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,i,n,r,s,o){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=i,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),i=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,o=n+e,a=r+i,l=r-i;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=h*this.view.offsetX,o=s+h*this.view.width,a-=f*this.view.offsetY,l=a-f*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const i=super.toJSON(e);return i.object.zoom=this.zoom,i.object.left=this.left,i.object.right=this.right,i.object.top=this.top,i.object.bottom=this.bottom,i.object.near=this.near,i.object.far=this.far,this.view!==null&&(i.object.view=Object.assign({},this.view)),i}}const ps=4,gd=[.125,.215,.35,.446,.526,.582],_r=20,ec=new nl,vd=new Xe;let tc=null;const gr=(1+Math.sqrt(5))/2,os=1/gr,yd=[new E(1,1,1),new E(-1,1,1),new E(1,1,-1),new E(-1,1,-1),new E(0,gr,os),new E(0,gr,-os),new E(os,0,gr),new E(-os,0,gr),new E(gr,os,0),new E(-gr,os,0)];class xd{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,i=0,n=.1,r=100){tc=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),i>0&&this._blur(s,0,0,i),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,i=null){return this._fromTexture(e,i)}fromCubemap(e,i=null){return this._fromTexture(e,i)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=wd(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=bd(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.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._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(tc),e.scissorTest=!1,ca(e,0,0,e.width,e.height)}_fromTexture(e,i){e.mapping===Rr||e.mapping===Ir?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),tc=this._renderer.getRenderTarget();const n=i||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),i=4*this._cubeSize,n={magFilter:Ci,minFilter:Ci,generateMipmaps:!1,type:yo,format:nn,encoding:ln,depthBuffer:!1},r=_d(e,i,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=_d(e,i,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=f1(s)),this._blurMaterial=p1(s,e,i)}return r}_compileMaterial(e){const i=new Di(this._lodPlanes[0],e);this._renderer.compile(i,ec)}_sceneToCubeUV(e,i,n,r){const a=new ri(90,1,i,n),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],f=this._renderer,c=f.autoClear,u=f.toneMapping;f.getClearColor(vd),f.toneMapping=Cn,f.autoClear=!1;const d=new Nh({name:"PMREM.Background",side:vi,depthWrite:!1,depthTest:!1}),m=new Di(new Dn,d);let g=!1;const p=e.background;p?p.isColor&&(d.color.copy(p),e.background=null,g=!0):(d.color.copy(vd),g=!0);for(let v=0;v<6;v++){const y=v%3;y===0?(a.up.set(0,l[v],0),a.lookAt(h[v],0,0)):y===1?(a.up.set(0,0,l[v]),a.lookAt(0,h[v],0)):(a.up.set(0,l[v],0),a.lookAt(0,0,h[v]));const b=this._cubeSize;ca(r,y*b,v>2?b:0,b,b),f.setRenderTarget(r),g&&f.render(m,a),f.render(e,a)}m.geometry.dispose(),m.material.dispose(),f.toneMapping=u,f.autoClear=c,e.background=p}_textureToCubeUV(e,i){const n=this._renderer,r=e.mapping===Rr||e.mapping===Ir;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=wd()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=bd());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Di(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;ca(i,0,0,3*l,2*l),n.setRenderTarget(i),n.render(o,ec)}_applyPMREM(e){const i=this._renderer,n=i.autoClear;i.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=yd[(r-1)%yd.length];this._blur(e,r-1,r,s,o)}i.autoClear=n}_blur(e,i,n,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,i,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,i,n,r,s,o,a){const l=this._renderer,h=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const f=3,c=new Di(this._lodPlanes[r],h),u=h.uniforms,d=this._sizeLods[n]-1,m=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*_r-1),g=s/m,p=isFinite(s)?1+Math.floor(f*g):_r;p>_r&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${_r}`);const v=[];let y=0;for(let T=0;T<_r;++T){const _=T/g,A=Math.exp(-_*_/2);v.push(A),T===0?y+=A:T<p&&(y+=2*A)}for(let T=0;T<v.length;T++)v[T]=v[T]/y;u.envMap.value=e.texture,u.samples.value=p,u.weights.value=v,u.latitudinal.value=o==="latitudinal",a&&(u.poleAxis.value=a);const{_lodMax:b}=this;u.dTheta.value=m,u.mipInt.value=b-n;const x=this._sizeLods[r],M=3*x*(r>b-ps?r-b+ps:0),w=4*(this._cubeSize-x);ca(i,M,w,3*x,2*x),l.setRenderTarget(i),l.render(c,ec)}}function f1(t){const e=[],i=[],n=[];let r=t;const s=t-ps+1+gd.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);i.push(a);let l=1/a;o>t-ps?l=gd[o-t+ps-1]:o===0&&(l=0),n.push(l);const h=1/(a-2),f=-h,c=1+h,u=[f,f,c,f,c,c,f,f,c,c,f,c],d=6,m=6,g=3,p=2,v=1,y=new Float32Array(g*m*d),b=new Float32Array(p*m*d),x=new Float32Array(v*m*d);for(let w=0;w<d;w++){const T=w%3*2/3-1,_=w>2?0:-1,A=[T,_,0,T+2/3,_,0,T+2/3,_+1,0,T,_,0,T+2/3,_+1,0,T,_+1,0];y.set(A,g*m*w),b.set(u,p*m*w);const S=[w,w,w,w,w,w];x.set(S,v*m*w)}const M=new We;M.setAttribute("position",new it(y,g)),M.setAttribute("uv",new it(b,p)),M.setAttribute("faceIndex",new it(x,v)),e.push(M),r>ps&&r--}return{lodPlanes:e,sizeLods:i,sigmas:n}}function _d(t,e,i){const n=new Nr(t,e,i);return n.texture.mapping=Po,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ca(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function p1(t,e,i){const n=new Float32Array(_r),r=new E(0,1,0);return new rr({name:"SphericalGaussianBlur",defines:{n:_r,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Fh(),fragmentShader:`
2905
2906			precision mediump float;
2907			precision mediump int;
2908
2909			varying vec3 vOutputDirection;
2910
2911			uniform sampler2D envMap;
2912			uniform int samples;
2913			uniform float weights[ n ];
2914			uniform bool latitudinal;
2915			uniform float dTheta;
2916			uniform float mipInt;
2917			uniform vec3 poleAxis;
2918
2919			#define ENVMAP_TYPE_CUBE_UV
2920			#include <cube_uv_reflection_fragment>
2921
2922			vec3 getSample( float theta, vec3 axis ) {
2923
2924				float cosTheta = cos( theta );
2925				// Rodrigues' axis-angle rotation
2926				vec3 sampleDirection = vOutputDirection * cosTheta
2927					+ cross( axis, vOutputDirection ) * sin( theta )
2928					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
2929
2930				return bilinearCubeUV( envMap, sampleDirection, mipInt );
2931
2932			}
2933
2934			void main() {
2935
2936				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
2937
2938				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
2939
2940					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
2941
2942				}
2943
2944				axis = normalize( axis );
2945
2946				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2947				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
2948
2949				for ( int i = 1; i < n; i++ ) {
2950
2951					if ( i >= samples ) {
2952
2953						break;
2954
2955					}
2956
2957					float theta = dTheta * float( i );
2958					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
2959					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
2960
2961				}
2962
2963			}
2964		`,blending:tr,depthTest:!1,depthWrite:!1})}function bd(){return new rr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Fh(),fragmentShader:`
2965
2966			precision mediump float;
2967			precision mediump int;
2968
2969			varying vec3 vOutputDirection;
2970
2971			uniform sampler2D envMap;
2972
2973			#include <common>
2974
2975			void main() {
2976
2977				vec3 outputDirection = normalize( vOutputDirection );
2978				vec2 uv = equirectUv( outputDirection );
2979
2980				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
2981
2982			}
2983		`,blending:tr,depthTest:!1,depthWrite:!1})}function wd(){return new rr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Fh(),fragmentShader:`
2984
2985			precision mediump float;
2986			precision mediump int;
2987
2988			uniform float flipEnvMap;
2989
2990			varying vec3 vOutputDirection;
2991
2992			uniform samplerCube envMap;
2993
2994			void main() {
2995
2996				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
2997
2998			}
2999		`,blending:tr,depthTest:!1,depthWrite:!1})}function Fh(){return`
3000
3001		precision mediump float;
3002		precision mediump int;
3003
3004		attribute float faceIndex;
3005
3006		varying vec3 vOutputDirection;
3007
3008		// RH coordinate system; PMREM face-indexing convention
3009		vec3 getDirection( vec2 uv, float face ) {
3010
3011			uv = 2.0 * uv - 1.0;
3012
3013			vec3 direction = vec3( uv, 1.0 );
3014
3015			if ( face == 0.0 ) {
3016
3017				direction = direction.zyx; // ( 1, v, u ) pos x
3018
3019			} else if ( face == 1.0 ) {
3020
3021				direction = direction.xzy;
3022				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3023
3024			} else if ( face == 2.0 ) {
3025
3026				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3027
3028			} else if ( face == 3.0 ) {
3029
3030				direction = direction.zyx;
3031				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3032
3033			} else if ( face == 4.0 ) {
3034
3035				direction = direction.xzy;
3036				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3037
3038			} else if ( face == 5.0 ) {
3039
3040				direction.z *= -1.0; // ( u, v, -1 ) neg z
3041
3042			}
3043
3044			return direction;
3045
3046		}
3047
3048		void main() {
3049
3050			vOutputDirection = getDirection( uv, faceIndex );
3051			gl_Position = vec4( position, 1.0 );
3052
3053		}
3054	`}function m1(t){let e=new WeakMap,i=null;function n(a){if(a&&a.isTexture){const l=a.mapping,h=l===Ic||l===zc,f=l===Rr||l===Ir;if(h||f)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let c=e.get(a);return i===null&&(i=new xd(t)),c=h?i.fromEquirectangular(a,c):i.fromCubemap(a,c),e.set(a,c),c.texture}else{if(e.has(a))return e.get(a).texture;{const c=a.image;if(h&&c&&c.height>0||f&&c&&r(c)){i===null&&(i=new xd(t));const u=h?i.fromEquirectangular(a):i.fromCubemap(a);return e.set(a,u),a.addEventListener("dispose",s),u.texture}else return null}}}return a}function r(a){let l=0;const h=6;for(let f=0;f<h;f++)a[f]!==void 0&&l++;return l===h}function s(a){const l=a.target;l.removeEventListener("dispose",s);const h=e.get(l);h!==void 0&&(e.delete(l),h.dispose())}function o(){e=new WeakMap,i!==null&&(i.dispose(),i=null)}return{get:n,dispose:o}}function g1(t){const e={};function i(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(n){return i(n)!==null},init:function(n){n.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture")},get:function(n){const r=i(n);return r===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function v1(t,e,i,n){const r={},s=new WeakMap;function o(c){const u=c.target;u.index!==null&&e.remove(u.index);for(const m in u.attributes)e.remove(u.attributes[m]);u.removeEventListener("dispose",o),delete r[u.id];const d=s.get(u);d&&(e.remove(d),s.delete(u)),n.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,i.memory.geometries--}function a(c,u){return r[u.id]===!0||(u.addEventListener("dispose",o),r[u.id]=!0,i.memory.geometries++),u}function l(c){const u=c.attributes;for(const m in u)e.update(u[m],34962);const d=c.morphAttributes;for(const m in d){const g=d[m];for(let p=0,v=g.length;p<v;p++)e.update(g[p],34962)}}function h(c){const u=[],d=c.index,m=c.attributes.position;let g=0;if(d!==null){const y=d.array;g=d.version;for(let b=0,x=y.length;b<x;b+=3){const M=y[b+0],w=y[b+1],T=y[b+2];u.push(M,w,w,T,T,M)}}else{const y=m.array;g=m.version;for(let b=0,x=y.length/3-1;b<x;b+=3){const M=b+0,w=b+1,T=b+2;u.push(M,w,w,T,T,M)}}const p=new(cm(u)?uo:pm)(u,1);p.version=g;const v=s.get(c);v&&e.remove(v),s.set(c,p)}function f(c){const u=s.get(c);if(u){const d=c.index;d!==null&&u.version<d.version&&h(c)}else h(c);return s.get(c)}return{get:a,update:l,getWireframeAttribute:f}}
vendor: 13,339 bytes, lines 3054-3062
3054function y1(t,e,i,n){const r=n.isWebGL2;let s;function o(u){s=u}let a,l;function h(u){a=u.type,l=u.bytesPerElement}function f(u,d){t.drawElements(s,d,a,u*l),i.update(d,s,1)}function c(u,d,m){if(m===0)return;let g,p;if(r)g=t,p="drawElementsInstanced";else if(g=e.get("ANGLE_instanced_arrays"),p="drawElementsInstancedANGLE",g===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}g[p](s,d,a,u*l,m),i.update(d,s,m)}this.setMode=o,this.setIndex=h,this.render=f,this.renderInstances=c}function x1(t){const e={geometries:0,textures:0},i={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(i.calls++,o){case 4:i.triangles+=a*(s/3);break;case 1:i.lines+=a*(s/2);break;case 3:i.lines+=a*(s-1);break;case 2:i.lines+=a*s;break;case 0:i.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){i.frame++,i.calls=0,i.triangles=0,i.points=0,i.lines=0}return{memory:e,render:i,programs:null,autoReset:!0,reset:r,update:n}}function _1(t,e){return t[0]-e[0]}function b1(t,e){return Math.abs(e[1])-Math.abs(t[1])}function w1(t,e,i){const n={},r=new Float32Array(8),s=new WeakMap,o=new tt,a=[];for(let h=0;h<8;h++)a[h]=[h,0];function l(h,f,c,u){const d=h.morphTargetInfluences;if(e.isWebGL2===!0){const g=f.morphAttributes.position||f.morphAttributes.normal||f.morphAttributes.color,p=g!==void 0?g.length:0;let v=s.get(f);if(v===void 0||v.count!==p){let ee=function(){I.dispose(),s.delete(f),f.removeEventListener("dispose",ee)};var m=ee;v!==void 0&&v.texture.dispose();const x=f.morphAttributes.position!==void 0,M=f.morphAttributes.normal!==void 0,w=f.morphAttributes.color!==void 0,T=f.morphAttributes.position||[],_=f.morphAttributes.normal||[],A=f.morphAttributes.color||[];let S=0;x===!0&&(S=1),M===!0&&(S=2),w===!0&&(S=3);let D=f.attributes.position.count*S,O=1;D>e.maxTextureSize&&(O=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const z=new Float32Array(D*O*4*p),I=new fm(z,D,O,p);I.type=Sr,I.needsUpdate=!0;const H=S*4;for(let G=0;G<p;G++){const B=T[G],N=_[G],R=A[G],k=D*O*4*G;for(let F=0;F<B.count;F++){const U=F*H;x===!0&&(o.fromBufferAttribute(B,F),z[k+U+0]=o.x,z[k+U+1]=o.y,z[k+U+2]=o.z,z[k+U+3]=0),M===!0&&(o.fromBufferAttribute(N,F),z[k+U+4]=o.x,z[k+U+5]=o.y,z[k+U+6]=o.z,z[k+U+7]=0),w===!0&&(o.fromBufferAttribute(R,F),z[k+U+8]=o.x,z[k+U+9]=o.y,z[k+U+10]=o.z,z[k+U+11]=R.itemSize===4?o.w:1)}}v={count:p,texture:I,size:new Z(D,O)},s.set(f,v),f.addEventListener("dispose",ee)}let y=0;for(let x=0;x<d.length;x++)y+=d[x];const b=f.morphTargetsRelative?1:1-y;u.getUniforms().setValue(t,"morphTargetBaseInfluence",b),u.getUniforms().setValue(t,"morphTargetInfluences",d),u.getUniforms().setValue(t,"morphTargetsTexture",v.texture,i),u.getUniforms().setValue(t,"morphTargetsTextureSize",v.size)}else{const g=d===void 0?0:d.length;let p=n[f.id];if(p===void 0||p.length!==g){p=[];for(let M=0;M<g;M++)p[M]=[M,0];n[f.id]=p}for(let M=0;M<g;M++){const w=p[M];w[0]=M,w[1]=d[M]}p.sort(b1);for(let M=0;M<8;M++)M<g&&p[M][1]?(a[M][0]=p[M][0],a[M][1]=p[M][1]):(a[M][0]=Number.MAX_SAFE_INTEGER,a[M][1]=0);a.sort(_1);const v=f.morphAttributes.position,y=f.morphAttributes.normal;let b=0;for(let M=0;M<8;M++){const w=a[M],T=w[0],_=w[1];T!==Number.MAX_SAFE_INTEGER&&_?(v&&f.getAttribute("morphTarget"+M)!==v[T]&&f.setAttribute("morphTarget"+M,v[T]),y&&f.getAttribute("morphNormal"+M)!==y[T]&&f.setAttribute("morphNormal"+M,y[T]),r[M]=_,b+=_):(v&&f.hasAttribute("morphTarget"+M)===!0&&f.deleteAttribute("morphTarget"+M),y&&f.hasAttribute("morphNormal"+M)===!0&&f.deleteAttribute("morphNormal"+M),r[M]=0)}const x=f.morphTargetsRelative?1:1-b;u.getUniforms().setValue(t,"morphTargetBaseInfluence",x),u.getUniforms().setValue(t,"morphTargetInfluences",r)}}return{update:l}}function S1(t,e,i,n){let r=new WeakMap;function s(l){const h=n.render.frame,f=l.geometry,c=e.get(l,f);return r.get(c)!==h&&(e.update(c),r.set(c,h)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),i.update(l.instanceMatrix,34962),l.instanceColor!==null&&i.update(l.instanceColor,34962)),c}function o(){r=new WeakMap}function a(l){const h=l.target;h.removeEventListener("dispose",a),i.remove(h.instanceMatrix),h.instanceColor!==null&&i.remove(h.instanceColor)}return{update:s,dispose:o}}const gm=new yi,vm=new fm,ym=new dy,xm=new Uh,Sd=[],Md=[],Ad=new Float32Array(16),Td=new Float32Array(9),Ed=new Float32Array(4);function zs(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let s=Sd[r];if(s===void 0&&(s=new Float32Array(r),Sd[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=i,t[o].toArray(s,a)}return s}function ei(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function ti(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function rl(t,e){let i=Md[e];i===void 0&&(i=new Int32Array(e),Md[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function M1(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function A1(t,e){const i=this.cache;if(e.x!==void 0)(i[0]!==e.x||i[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(ei(i,e))return;t.uniform2fv(this.addr,e),ti(i,e)}}function T1(t,e){const i=this.cache;if(e.x!==void 0)(i[0]!==e.x||i[1]!==e.y||i[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(e.r!==void 0)(i[0]!==e.r||i[1]!==e.g||i[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(ei(i,e))return;t.uniform3fv(this.addr,e),ti(i,e)}}function E1(t,e){const i=this.cache;if(e.x!==void 0)(i[0]!==e.x||i[1]!==e.y||i[2]!==e.z||i[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(ei(i,e))return;t.uniform4fv(this.addr,e),ti(i,e)}}function C1(t,e){const i=this.cache,n=e.elements;if(n===void 0){if(ei(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),ti(i,e)}else{if(ei(i,n))return;Ed.set(n),t.uniformMatrix2fv(this.addr,!1,Ed),ti(i,n)}}function L1(t,e){const i=this.cache,n=e.elements;if(n===void 0){if(ei(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),ti(i,e)}else{if(ei(i,n))return;Td.set(n),t.uniformMatrix3fv(this.addr,!1,Td),ti(i,n)}}function P1(t,e){const i=this.cache,n=e.elements;if(n===void 0){if(ei(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),ti(i,e)}else{if(ei(i,n))return;Ad.set(n),t.uniformMatrix4fv(this.addr,!1,Ad),ti(i,n)}}function D1(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function O1(t,e){const i=this.cache;ei(i,e)||(t.uniform2iv(this.addr,e),ti(i,e))}function R1(t,e){const i=this.cache;ei(i,e)||(t.uniform3iv(this.addr,e),ti(i,e))}function I1(t,e){const i=this.cache;ei(i,e)||(t.uniform4iv(this.addr,e),ti(i,e))}function z1(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function N1(t,e){const i=this.cache;ei(i,e)||(t.uniform2uiv(this.addr,e),ti(i,e))}function U1(t,e){const i=this.cache;ei(i,e)||(t.uniform3uiv(this.addr,e),ti(i,e))}function B1(t,e){const i=this.cache;ei(i,e)||(t.uniform4uiv(this.addr,e),ti(i,e))}function F1(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2D(e||gm,r)}function k1(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||ym,r)}function V1(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(e||xm,r)}function G1(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||vm,r)}function H1(t){switch(t){case 5126:return M1;case 35664:return A1;case 35665:return T1;case 35666:return E1;case 35674:return C1;case 35675:return L1;case 35676:return P1;case 5124:case 35670:return D1;case 35667:case 35671:return O1;case 35668:case 35672:return R1;case 35669:case 35673:return I1;case 5125:return z1;case 36294:return N1;case 36295:return U1;case 36296:return B1;case 35678:case 36198:case 36298:case 36306:case 35682:return F1;case 35679:case 36299:case 36307:return k1;case 35680:case 36300:case 36308:case 36293:return V1;case 36289:case 36303:case 36311:case 36292:return G1}}function W1(t,e){t.uniform1fv(this.addr,e)}function j1(t,e){const i=zs(e,this.size,2);t.uniform2fv(this.addr,i)}function q1(t,e){const i=zs(e,this.size,3);t.uniform3fv(this.addr,i)}function X1(t,e){const i=zs(e,this.size,4);t.uniform4fv(this.addr,i)}function Y1(t,e){const i=zs(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function $1(t,e){const i=zs(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function Z1(t,e){const i=zs(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function J1(t,e){t.uniform1iv(this.addr,e)}function K1(t,e){t.uniform2iv(this.addr,e)}function Q1(t,e){t.uniform3iv(this.addr,e)}function eb(t,e){t.uniform4iv(this.addr,e)}function tb(t,e){t.uniform1uiv(this.addr,e)}function ib(t,e){t.uniform2uiv(this.addr,e)}function nb(t,e){t.uniform3uiv(this.addr,e)}function rb(t,e){t.uniform4uiv(this.addr,e)}function sb(t,e,i){const n=e.length,r=rl(i,n);t.uniform1iv(this.addr,r);for(let s=0;s!==n;++s)i.setTexture2D(e[s]||gm,r[s])}function ob(t,e,i){const n=e.length,r=rl(i,n);t.uniform1iv(this.addr,r);for(let s=0;s!==n;++s)i.setTexture3D(e[s]||ym,r[s])}function ab(t,e,i){const n=e.length,r=rl(i,n);t.uniform1iv(this.addr,r);for(let s=0;s!==n;++s)i.setTextureCube(e[s]||xm,r[s])}function lb(t,e,i){const n=e.length,r=rl(i,n);t.uniform1iv(this.addr,r);for(let s=0;s!==n;++s)i.setTexture2DArray(e[s]||vm,r[s])}function cb(t){switch(t){case 5126:return W1;case 35664:return j1;case 35665:return q1;case 35666:return X1;case 35674:return Y1;case 35675:return $1;case 35676:return Z1;case 5124:case 35670:return J1;case 35667:case 35671:return K1;case 35668:case 35672:return Q1;case 35669:case 35673:return eb;case 5125:return tb;case 36294:return ib;case 36295:return nb;case 36296:return rb;case 35678:case 36198:case 36298:case 36306:case 35682:return sb;case 35679:case 36299:case 36307:return ob;case 35680:case 36300:case 36308:case 36293:return ab;case 36289:case 36303:case 36311:case 36292:return lb}}class hb{constructor(e,i,n){this.id=e,this.addr=n,this.cache=[],this.setValue=H1(i.type)}}class ub{constructor(e,i,n){this.id=e,this.addr=n,this.cache=[],this.size=i.size,this.setValue=cb(i.type)}}class db{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,i,n){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,i[a.id],n)}}}const ic=/(\w+)(\])?(\[|\.)?/g;function Cd(t,e){t.seq.push(e),t.map[e.id]=e}function fb(t,e,i){const n=t.name,r=n.length;for(ic.lastIndex=0;;){const s=ic.exec(n),o=ic.lastIndex;let a=s[1];const l=s[2]==="]",h=s[3];if(l&&(a=a|0),h===void 0||h==="["&&o+2===r){Cd(i,h===void 0?new hb(a,t,e):new ub(a,t,e));break}else{let c=i.map[a];c===void 0&&(c=new db(a),Cd(i,c)),i=c}}}class Ca{constructor(e,i){this.seq=[],this.map={};const n=e.getProgramParameter(i,35718);for(let r=0;r<n;++r){const s=e.getActiveUniform(i,r),o=e.getUniformLocation(i,s.name);fb(s,o,this)}}setValue(e,i,n,r){const s=this.map[i];s!==void 0&&s.setValue(e,n,r)}setOptional(e,i,n){const r=i[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,i,n,r){for(let s=0,o=i.length;s!==o;++s){const a=i[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,i){const n=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in i&&n.push(o)}return n}}function Ld(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}let pb=0;function mb(t,e){const i=t.split(`
3055`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,i.length);for(let o=r;o<s;o++){const a=o+1;n.push(`${a===e?">":" "} ${a}: ${i[o]}`)}return n.join(`
3056`)}function gb(t){switch(t){case ln:return["Linear","( value )"];case Et:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function Pd(t,e,i){const n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return i.toUpperCase()+`
3057
3058`+r+`
3059
3060`+mb(t.getShaderSource(e),o)}else return r}function vb(t,e){const i=gb(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function yb(t,e){let i;switch(e){case Mv:i="Linear";break;case Av:i="Reinhard";break;case Tv:i="OptimizedCineon";break;case Ev:i="ACESFilmic";break;case Cv:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function xb(t){return[t.extensionDerivatives||!!t.envMapCubeUVHeight||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||t.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(no).join(`
3061`)}function _b(t){const e=[];for(const i in t){const n=t[i];n!==!1&&e.push("#define "+i+" "+n)}return e.join(`
3062`)}function bb(t,e){const i={}
3062,n=t.getProgramParameter(e,35721);for(let r=0;r<n;r++){const s=t.getActiveAttrib(e,r),o=s.name;let a=1;s.type===35674&&(a=2),s.type===35675&&(a=3),s.type===35676&&(a=4),i[o]={type:s.type,location:t.getAttribLocation(e,o),locationSize:a}}return i}function no(t){return t!==""}function Dd(t,e){const i=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.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,i).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 Od(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const wb=/^[ \t]*#include +<([\w\d./]+)>/gm;function Vc(t){return t.replace(wb,Sb)}function Sb(t,e){const i=et[e];if(i===void 0)throw new Error("Can not resolve #include <"+e+">");return Vc(i)}const Mb=/#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 Rd(t){return t.replace(Mb,Ab)}function Ab(t,e,i,n){let r="";for(let s=parseInt(e);s<parseInt(i);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Id(t){let e="precision "+t.precision+` float;
3063precision `+t.precision+" int;";return t.precision==="highp"?e+=`
3064#define HIGH_PRECISION`:t.precision==="mediump"?e+=`
3065#define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
3066#define LOW_PRECISION`),e}function Tb(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===Rh?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===iv?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===io&&(e="SHADOWMAP_TYPE_VSM"),e}function Eb(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Rr:case Ir:e="ENVMAP_TYPE_CUBE";break;case Po:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Cb(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Ir:e="ENVMAP_MODE_REFRACTION";break}return e}function Lb(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case om:e="ENVMAP_BLENDING_MULTIPLY";break;case wv:e="ENVMAP_BLENDING_MIX";break;case Sv:e="ENVMAP_BLENDING_ADD";break}return e}function Pb(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const i=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,i),7*16)),texelHeight:n,maxMip:i}}function Db(t,e,i,n){const r=t.getContext(),s=i.defines;let o=i.vertexShader,a=i.fragmentShader;const l=Tb(i),h=Eb(i),f=Cb(i),c=Lb(i),u=Pb(i),d=i.isWebGL2?"":xb(i),m=_b(s),g=r.createProgram();let p,v,y=i.glslVersion?"#version "+i.glslVersion+`
3067`:"";i.isRawShaderMaterial?(p=[m].filter(no).join(`
3068`),p.length>0&&(p+=`
3069`),v=[d,m].filter(no).join(`
3070`),v.length>0&&(v+=`
3071`)):(p=[Id(i),"#define SHADER_NAME "+i.shaderName,m,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+f:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alph
vendor: 4,859 bytes, lines 3071-3073
3071aMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&i.flatShading===!1?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
3072`].filter(no).join(`
3073`),v=[d,Id(i),"#define SHADER_NAME "+i.shaderName,m,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.envMap?"#define "+f:"",i.envMap?"#define "+c:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.p
vendor: 9,347 bytes, lines 3073-3084
3073hysicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==Cn?"#define TONE_MAPPING":"",i.toneMapping!==Cn?et.tonemapping_pars_fragment:"",i.toneMapping!==Cn?yb("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",et.encodings_pars_fragment,vb("linearToOutputTexel",i.outputEncoding),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"",`
3074`].filter(no).join(`
3075`)),o=Vc(o),o=Dd(o,i),o=Od(o,i),a=Vc(a),a=Dd(a,i),a=Od(a,i),o=Rd(o),a=Rd(a),i.isWebGL2&&i.isRawShaderMaterial!==!0&&(y=`#version 300 es
3076`,p=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
3077`)+`
3078`+p,v=["#define varying in",i.glslVersion===nd?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===nd?"":"#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(`
3079`)+`
3080`+v);const b=y+p+o,x=y+v+a,M=Ld(r,35633,b),w=Ld(r,35632,x);if(r.attachShader(g,M),r.attachShader(g,w),i.index0AttributeName!==void 0?r.bindAttribLocation(g,0,i.index0AttributeName):i.morphTargets===!0&&r.bindAttribLocation(g,0,"position"),r.linkProgram(g),t.debug.checkShaderErrors){const A=r.getProgramInfoLog(g).trim(),S=r.getShaderInfoLog(M).trim(),D=r.getShaderInfoLog(w).trim();let O=!0,z=!0;if(r.getProgramParameter(g,35714)===!1){O=!1;const I=Pd(r,M,"vertex"),H=Pd(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(g,35715)+`
3081
3082Program Info Log: `+A+`
3083`+I+`
3084`+H)}else A!==""?console.warn("THREE.WebGLProgram: Program Info Log:",A):(S===""||D==="")&&(z=!1);z&&(this.diagnostics={runnable:O,programLog:A,vertexShader:{log:S,prefix:p},fragmentShader:{log:D,prefix:v}})}r.deleteShader(M),r.deleteShader(w);let T;this.getUniforms=function(){return T===void 0&&(T=new Ca(r,g)),T};let _;return this.getAttributes=function(){return _===void 0&&(_=bb(r,g)),_},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(g),this.program=void 0},this.name=i.shaderName,this.id=pb++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=M,this.fragmentShader=w,this}let Ob=0;class Rb{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const i=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(i),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const i=this.materialCache.get(e);for(const n of i)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 i=this.materialCache;let n=i.get(e);return n===void 0&&(n=new Set,i.set(e,n)),n}_getShaderStage(e){const i=this.shaderCache;let n=i.get(e);return n===void 0&&(n=new Ib(e),i.set(e,n)),n}}class Ib{constructor(e){this.id=Ob++,this.code=e,this.usedTimes=0}}function zb(t,e,i,n,r,s,o){const a=new zh,l=new Rb,h=[],f=r.isWebGL2,c=r.logarithmicDepthBuffer,u=r.vertexTextures;let d=r.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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(_,A,S,D,O){const z=D.fog,I=O.geometry,H=_.isMeshStandardMaterial?D.environment:null,ee=(_.isMeshStandardMaterial?i:e).get(_.envMap||H),G=!!ee&&ee.mapping===Po?ee.image.height:null,B=m[_.type];_.precision!==null&&(d=r.getMaxPrecision(_.precision),d!==_.precision&&console.warn("THREE.WebGLProgram.getParameters:",_.precision,"not supported, using",d,"instead."));const N=I.morphAttributes.position||I.morphAttributes.normal||I.morphAttributes.color,R=N!==void 0?N.length:0;let k=0;I.morphAttributes.position!==void 0&&(k=1),I.morphAttributes.normal!==void 0&&(k=2),I.morphAttributes.color!==void 0&&(k=3);let F,U,W,ie;if(B){const he=Fi[B];F=he.vertexShader,U=he.fragmentShader}else F=_.vertexShader,U=_.fragmentShader,l.update(_),W=l.getVertexShaderID(_),ie=l.getFragmentShaderID(_);const V=t.getRenderTarget(),K=_.alphaTest>0,Y=_.clearcoat>0,J=_.iridescence>0;return{isWebGL2:f,shaderID:B,shaderName:_.type,vertexShader:F,fragmentShader:U,defines:_.defines,customVertexShaderID:W,customFragmentShaderID:ie,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:d,instancing:O.isInstancedMesh===!0,instancingColor:O.isInstancedMesh===!0&&O.instanceColor!==null,supportsVertexTextures:u,outputEncoding:V===null?t.outputEncoding:V.isXRRenderTarget===!0?V.texture.encoding:ln,map:!!_.map,matcap:!!_.matcap,envMap:!!ee,envMapMode:ee&&ee.mapping,envMapCubeUVHeight:G,lightMap:!!_.lightMap,aoMap:!!_.aoMap,emissiveMap:!!_.emissiveMap,bumpMap:!!_.bumpMap,normalMap:!!_.normalMap,objectSpaceNormalMap:_.normalMapType===Yv,tangentSpaceNormalMap:_.normalMapType===Xv,decodeVideoTexture:!!_.map&&_.map.isVideoTexture===!0&&_.map.encoding===Et,clearcoat:Y,clearcoatMap:Y&&!!_.clearcoatMap,clearcoatRoughnessMap:Y&&!!_.clearcoatRoughnessMap,clearcoatNormalMap:Y&&!!_.clearcoatNormalMap,iridescence:J,iridescenceMap:J&&!!_.iridescenceMap,iridescenceThicknessMap:J&&!!_.iridescenceThicknessMap,displacementMap:!!_.displacementMap,roughnessMap:!!_.roughnessMap,metalnessMap:!!_.metalnessMap,specularMap:!!_.specularMap,specularIntensityMap:!!_.specularIntensityMap,specularColorMap:!!_.specularColorMap,opaque:_.transparent===!1&&_.blending===Tr,alphaMap:!!_.alphaMap,alphaTest:K,gradientMap:!!_.gradientMap,sheen:_.sheen>0,sheenColorMap:!!_.sheenColorMap,sheenRoughnessMap:!!_.sheenRoughnessMap,transmission:_.transmission>0,transmissionMap:!!_.transmissionMap,thicknessMap:!!_.thicknessMap,combine:_.combine,vertexTangents:!!_.normalMap&&!!I.attributes.tangent,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!I.attributes.color&&I.attributes.color.itemSize===4,vertexUvs:!!_.map||!!_.bumpMap||!!_.normalMap||!!_.specularMap||!!_.alphaMap||!!_.emissiveMap||!!_.roughnessMap||!!_.metalnessMap||!!_.clearcoatMap||!!_.clearcoatRoughnessMap||!!_.clearcoatNormalMap||!!_.iridescenceMap||!!_.iridescenceThicknessMap||!!_.displacementMap||!!_.transmissionMap||!!_.thicknessMap||!!_.specularIntensityMap||!!_.specularColorMap||!!_.sheenColorMap||!!_.sheenRoughnessMap,uvsVertexOnly:!(!!_.map||!!_.bumpMap||!!_.normalMap||!!_.specularMap||!!_.alphaMap||!!_.emissiveMap||!!_.roughnessMap||!!_.metalnessMap||!!_.clearcoatNormalMap||!!_.iridescenceMap||!!_.iridescenceThicknessMap||_.transmission>0||!!_.transmissionMap||!!_.thicknessMap||!!_.specularIntensityMap||!!_.specularColorMap||_.sheen>0||!!_.sheenColorMap||!!_.sheenRoughnessMap)&&!!_.displacementMap,fog:!!z,useFog:_.fog===!0,fogExp2:z&&z.isFogExp2,flatShading:!!_.flatShading,sizeAttenuation:_.sizeAttenuation,logarithmicDepthBuffer:c,skinning:O.isSkinnedMesh===!0,morphTargets:I.morphAttributes.position!==void 0,morphNormals:I.morphAttributes.normal!==void 0,morphColors:I.morphAttributes.color!==void 0,morphTargetsCount:R,morphTextureStride:k,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:_.dithering,shadowMapEnabled:t.shadowMap.enabled&&S.length>0,shadowMapType:t.shadowMap.type,toneMapping:_.toneMapped?t.toneMapping:Cn,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===An,flipSided:_.side===vi,useDepthPacking:!!_.depthPacking,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionDerivatives:_.extensions&&_.extensions.derivatives,extensionFragDepth:_.extensions&&_.extensions.fragDepth,extensionDrawBuffers:_.extensions&&_.extensions.drawBuffers,extensionShaderTextureLOD:_.extensions&&_.extensions.shaderTextureLOD,rendererExtensionFragDepth:f||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:f||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:f||n.has("EXT_shader_texture_lod"),customProgramCacheKey:_.customProgramCacheKey()}}function p(_){const A=[];
vendor: 13,134 bytes, lines 3084-3090
3084if(_.shaderID?A.push(_.shaderID):(A.push(_.customVertexShaderID),A.push(_.customFragmentShaderID)),_.defines!==void 0)for(const S in _.defines)A.push(S),A.push(_.defines[S]);return _.isRawShaderMaterial===!1&&(v(A,_),y(A,_),A.push(t.outputEncoding)),A.push(_.customProgramCacheKey),A.join()}function v(_,A){_.push(A.precision),_.push(A.outputEncoding),_.push(A.envMapMode),_.push(A.envMapCubeUVHeight),_.push(A.combine),_.push(A.vertexUvs),_.push(A.fogExp2),_.push(A.sizeAttenuation),_.push(A.morphTargetsCount),_.push(A.morphAttributeCount),_.push(A.numDirLights),_.push(A.numPointLights),_.push(A.numSpotLights),_.push(A.numSpotLightMaps),_.push(A.numHemiLights),_.push(A.numRectAreaLights),_.push(A.numDirLightShadows),_.push(A.numPointLightShadows),_.push(A.numSpotLightShadows),_.push(A.numSpotLightShadowsWithMaps),_.push(A.shadowMapType),_.push(A.toneMapping),_.push(A.numClippingPlanes),_.push(A.numClipIntersection),_.push(A.depthPacking)}function y(_,A){a.disableAll(),A.isWebGL2&&a.enable(0),A.supportsVertexTextures&&a.enable(1),A.instancing&&a.enable(2),A.instancingColor&&a.enable(3),A.map&&a.enable(4),A.matcap&&a.enable(5),A.envMap&&a.enable(6),A.lightMap&&a.enable(7),A.aoMap&&a.enable(8),A.emissiveMap&&a.enable(9),A.bumpMap&&a.enable(10),A.normalMap&&a.enable(11),A.objectSpaceNormalMap&&a.enable(12),A.tangentSpaceNormalMap&&a.enable(13),A.clearcoat&&a.enable(14),A.clearcoatMap&&a.enable(15),A.clearcoatRoughnessMap&&a.enable(16),A.clearcoatNormalMap&&a.enable(17),A.iridescence&&a.enable(18),A.iridescenceMap&&a.enable(19),A.iridescenceThicknessMap&&a.enable(20),A.displacementMap&&a.enable(21),A.specularMap&&a.enable(22),A.roughnessMap&&a.enable(23),A.metalnessMap&&a.enable(24),A.gradientMap&&a.enable(25),A.alphaMap&&a.enable(26),A.alphaTest&&a.enable(27),A.vertexColors&&a.enable(28),A.vertexAlphas&&a.enable(29),A.vertexUvs&&a.enable(30),A.vertexTangents&&a.enable(31),A.uvsVertexOnly&&a.enable(32),_.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.skinning&&a.enable(4),A.morphTargets&&a.enable(5),A.morphNormals&&a.enable(6),A.morphColors&&a.enable(7),A.premultipliedAlpha&&a.enable(8),A.shadowMapEnabled&&a.enable(9),A.physicallyCorrectLights&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.specularIntensityMap&&a.enable(15),A.specularColorMap&&a.enable(16),A.transmission&&a.enable(17),A.transmissionMap&&a.enable(18),A.thicknessMap&&a.enable(19),A.sheen&&a.enable(20),A.sheenColorMap&&a.enable(21),A.sheenRoughnessMap&&a.enable(22),A.decodeVideoTexture&&a.enable(23),A.opaque&&a.enable(24),_.push(a.mask)}function b(_){const A=m[_.type];let S;if(A){const D=Fi[A];S=Is.clone(D.uniforms)}else S=_.uniforms;return S}function x(_,A){let S;for(let D=0,O=h.length;D<O;D++){const z=h[D];if(z.cacheKey===A){S=z,++S.usedTimes;break}}return S===void 0&&(S=new Db(t,A,_,s),h.push(S)),S}function M(_){if(--_.usedTimes===0){const A=h.indexOf(_);h[A]=h[h.length-1],h.pop(),_.destroy()}}function w(_){l.remove(_)}function T(){l.dispose()}return{getParameters:g,getProgramCacheKey:p,getUniforms:b,acquireProgram:x,releaseProgram:M,releaseShaderCache:w,programs:h,dispose:T}}function Nb(){let t=new WeakMap;function e(s){let o=t.get(s);return o===void 0&&(o={},t.set(s,o)),o}function i(s){t.delete(s)}function n(s,o,a){t.get(s)[o]=a}function r(){t=new WeakMap}return{get:e,remove:i,update:n,dispose:r}}function Ub(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function zd(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Nd(){const t=[];let e=0;const i=[],n=[],r=[];function s(){e=0,i.length=0,n.length=0,r.length=0}function o(c,u,d,m,g,p){let v=t[e];return v===void 0?(v={id:c.id,object:c,geometry:u,material:d,groupOrder:m,renderOrder:c.renderOrder,z:g,group:p},t[e]=v):(v.id=c.id,v.object=c,v.geometry=u,v.material=d,v.groupOrder=m,v.renderOrder=c.renderOrder,v.z=g,v.group=p),e++,v}function a(c,u,d,m,g,p){const v=o(c,u,d,m,g,p);d.transmission>0?n.push(v):d.transparent===!0?r.push(v):i.push(v)}function l(c,u,d,m,g,p){const v=o(c,u,d,m,g,p);d.transmission>0?n.unshift(v):d.transparent===!0?r.unshift(v):i.unshift(v)}function h(c,u){i.length>1&&i.sort(c||Ub),n.length>1&&n.sort(u||zd),r.length>1&&r.sort(u||zd)}function f(){for(let c=e,u=t.length;c<u;c++){const d=t[c];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:i,transmissive:n,transparent:r,init:s,push:a,unshift:l,finish:f,sort:h}}function Bb(){let t=new WeakMap;function e(n,r){const s=t.get(n);let o;return s===void 0?(o=new Nd,t.set(n,[o])):r>=s.length?(o=new Nd,s.push(o)):o=s[r],o}function i(){t=new WeakMap}return{get:e,dispose:i}}function Fb(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new E,color:new Xe};break;case"SpotLight":i={position:new E,direction:new E,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new E,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":i={direction:new E,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":i={color:new Xe,position:new E,halfWidth:new E,halfHeight:new E};break}return t[e.id]=i,i}}}function kb(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let i;switch(e.type){case"DirectionalLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Z};break;case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Z};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Z,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=i,i}}}let Vb=0;function Gb(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Hb(t,e){const i=new Fb,n=kb(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let f=0;f<9;f++)r.probe.push(new E);const s=new E,o=new Ye,a=new Ye;function l(f,c){let u=0,d=0,m=0;for(let D=0;D<9;D++)r.probe[D].set(0,0,0);let g=0,p=0,v=0,y=0,b=0,x=0,M=0,w=0,T=0,_=0;f.sort(Gb);const A=c!==!0?Math.PI:1;for(let D=0,O=f.length;D<O;D++){const z=f[D],I=z.color,H=z.intensity,ee=z.distance,G=z.shadow&&z.shadow.map?z.shadow.map.texture:null;if(z.isAmbientLight)u+=I.r*H*A,d+=I.g*H*A,m+=I.b*H*A;else if(z.isLightProbe)for(let B=0;B<9;B++)r.probe[B].addScaledVector(z.sh.coefficients[B],H);else if(z.isDirectionalLight){const B=i.get(z);if(B.color.copy(z.color).multiplyScalar(z.intensity*A),z.castShadow){const N=z.shadow,R=n.get(z);R.shadowBias=N.bias,R.shadowNormalBias=N.normalBias,R.shadowRadius=N.radius,R.shadowMapSize=N.mapSize,r.directionalShadow[g]=R,r.directionalShadowMap[g]=G,r.directionalShadowMatrix[g]=z.shadow.matrix,x++}r.directional[g]=B,g++}else if(z.isSpotLight){const B=i.get(z);B.position.setFromMatrixPosition(z.matrixWorld),B.color.copy(I).multiplyScalar(H*A),B.distance=ee,B.coneCos=Math.cos(z.angle),B.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),B.decay=z.decay,r.spot[v]=B;const N=z.shadow;if(z.map&&(r.spotLightMap[T]=z.map,T++,N.updateMatrices(z),z.castShadow&&_++),r.spotLightMatrix[v]=N.matrix,z.castShadow){const R=n.get(z);R.shadowBias=N.bias,R.shadowNormalBias=N.normalBias,R.shadowRadius=N.radius,R.shadowMapSize=N.mapSize,r.spotShadow[v]=R,r.spotShadowMap[v]=G,w++}v++}else if(z.isRectAreaLight){const B=i.get(z);B.color.copy(I).multiplyScalar(H),B.halfWidth.set(z.width*.5,0,0),B.halfHeight.set(0,z.height*.5,0),r.rectArea[y]=B,y++}else if(z.isPointLight){const B=i.get(z);if(B.color.copy(z.color).multiplyScalar(z.intensity*A),B.distance=z.distance,B.decay=z.decay,z.castShadow){const N=z.shadow,R=n.get(z);R.shadowBias=N.bias,R.shadowNormalBias=N.normalBias,R.shadowRadius=N.radius,R.shadowMapSize=N.mapSize,R.shadowCameraNear=N.camera.near,R.shadowCameraFar=N.camera.far,r.pointShadow[p]=R,r.pointShadowMap[p]=G,r.pointShadowMatrix[p]=z.shadow.matrix,M++}r.point[p]=B,p++}else if(z.isHemisphereLight){const B=i.get(z);B.skyColor.copy(z.color).multiplyScalar(H*A),B.groundColor.copy(z.groundColor).multiplyScalar(H*A),r.hemi[b]=B,b++}}y>0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ge.LTC_FLOAT_1,r.rectAreaLTC2=ge.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=ge.LTC_HALF_1,r.rectAreaLTC2=ge.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=u,r.ambient[1]=d,r.ambient[2]=m;const S=r.hash;(S.directionalLength!==g||S.pointLength!==p||S.spotLength!==v||S.rectAreaLength!==y||S.hemiLength!==b||S.numDirectionalShadows!==x||S.numPointShadows!==M||S.numSpotShadows!==w||S.numSpotMaps!==T)&&(r.directional.length=g,r.spot.length=v,r.rectArea.length=y,r.point.length=p,r.hemi.length=b,r.directionalShadow.length=x,r.directionalShadowMap.length=x,r.pointShadow.length=M,r.pointShadowMap.length=M,r.spotShadow.length=w,r.spotShadowMap.length=w,r.directionalShadowMatrix.length=x,r.pointShadowMatrix.length=M,r.spotLightMatrix.length=w+T-_,r.spotLightMap.length=T,r.numSpotLightShadowsWithMaps=_,S.directionalLength=g,S.pointLength=p,S.spotLength=v,S.rectAreaLength=y,S.hemiLength=b,S.numDirectionalShadows=x,S.numPointShadows=M,S.numSpotShadows=w,S.numSpotMaps=T,r.version=Vb++)}function h(f,c){let u=0,d=0,m=0,g=0,p=0;const v=c.matrixWorldInverse;for(let y=0,b=f.length;y<b;y++){const x=f[y];if(x.isDirectionalLight){const M=r.directional[u];M.direction.setFromMatrixPosition(x.matrixWorld),s.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(v),u++}else if(x.isSpotLight){const M=r.spot[m];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),M.direction.setFromMatrixPosition(x.matrixWorld),s.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(v),m++}else if(x.isRectAreaLight){const M=r.rectArea[g];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),a.identity(),o.copy(x.matrixWorld),o.premultiply(v),a.extractRotation(o),M.halfWidth.set(x.width*.5,0,0),M.halfHeight.set(0,x.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),g++}else if(x.isPointLight){const M=r.point[d];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),d++}else if(x.isHemisphereLight){const M=r.hemi[p];M.direction.setFromMatrixPosition(x.matrixWorld),M.direction.transformDirection(v),p++}}}return{setup:l,setupView:h,state:r}}function Ud(t,e){const i=new Hb(t,e),n=[],r=[];function s(){n.length=0,r.length=0}function o(c){n.push(c)}function a(c){r.push(c)}function l(c){i.setup(n,c)}function h(c){i.setupView(n,c)}return{init:s,state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:l,setupLightsView:h,pushLight:o,pushShadow:a}}function Wb(t,e){let i=new WeakMap;function n(s,o=0){const a=i.get(s);let l;return a===void 0?(l=new Ud(t,e),i.set(s,[l])):o>=a.length?(l=new Ud(t,e),a.push(l)):l=a[o],l}function r(){i=new WeakMap}return{get:n,dispose:r}}class jb extends Do{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=jv,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 qb extends Do{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new E,this.nearDistance=1,this.farDistance=1e3,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.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Xb=`void main() {
3085	gl_Position = vec4( position, 1.0 );
3086}`,Yb=`uniform sampler2D shadow_pass;
3087uniform vec2 resolution;
3088uniform float radius;
3089#include <packing>
3090void main() {
3091	const float samples = float( VSM_SAMPLES );
3092	float mean = 0.0;
3093	float squared_mean = 0.0;
3094	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3095	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3096	for ( float i = 0.0; i < samples; i ++ ) {
3097		float uvOffset = uvStart + i * uvStride;
3098		#ifdef HORIZONTAL_PASS
3099			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3100			mean += distribution.x;
3101			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3102		#else
3103			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3104			mean += depth;
3105			squared_mean += depth * depth;
3106		#endif
3107	}
3108	mean = mean / samples;
3109	squared_mean = squared_mean / samples;
3110	float std_dev = sqrt( squared_mean - mean * mean );
3111	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3112}`;function $b(t,e,i){let n=new Bh;const r=new Z,s=new Z,o=new tt,a=new jb({depthPacking:qv}),l=new qb,h={},f=i.maxTextureSize,c={0:vi,1:Or,2:An},u=new rr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Z},radius:{value:4}},vertexShader:Xb,fragmentShader:Yb}),d=u.clone();d.defines.HORIZONTAL_PASS=1;const m=new We;m.setAttribute("position",new it(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new Di(m,u),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Rh,this.render=function(x,M,w){if(p.enabled===!1||p.autoUpdate===!1&&p.needsUpdate===!1||x.length===0)return;const T=t.getRenderTarget(),_=t.getActiveCubeFace(),A=t.getActiveMipmapLevel(),S=t.state;S.setBlending(tr),S.buffers.color.setClear(1,1,1,1),S.buffers.depth.setTest(!0),S.setScissorTest(!1);for(let D=0,O=x.length;D<O;D++){const z=x[D],I=z.shadow;if(I===void 0){console.warn("THREE.WebGLShadowMap:",z,"has no shadow.");continue}if(I.autoUpdate===!1&&I.needsUpdate===!1)continue;r.copy(I.mapSize);const H=I.getFrameExtents();if(r.multiply(H),s.copy(I.mapSize),(r.x>f||r.y>f)&&(r.x>f&&(s.x=Math.floor(f/H.x),r.x=s.x*H.x,I.mapSize.x=s.x),r.y>f&&(s.y=Math.floor(f/H.y),r.y=s.y*H.y,I.mapSize.y=s.y)),I.map===null){const G=this.type!==io?{minFilter:ni,magFilter:ni}:{};I.map=new Nr(r.x,r.y,G),I.map.texture.name=z.name+".shadowMap",I.camera.updateProjectionMatrix()}
vendor: 5,192 bytes, line 3112
3112t.setRenderTarget(I.map),t.clear();const ee=I.getViewportCount();for(let G=0;G<ee;G++){const B=I.getViewport(G);o.set(s.x*B.x,s.y*B.y,s.x*B.z,s.y*B.w),S.viewport(o),I.updateMatrices(z,G),n=I.getFrustum(),b(M,w,I.camera,z,this.type)}I.isPointLightShadow!==!0&&this.type===io&&v(I,w),I.needsUpdate=!1}p.needsUpdate=!1,t.setRenderTarget(T,_,A)};function v(x,M){const w=e.update(g);u.defines.VSM_SAMPLES!==x.blurSamples&&(u.defines.VSM_SAMPLES=x.blurSamples,d.defines.VSM_SAMPLES=x.blurSamples,u.needsUpdate=!0,d.needsUpdate=!0),x.mapPass===null&&(x.mapPass=new Nr(r.x,r.y)),u.uniforms.shadow_pass.value=x.map.texture,u.uniforms.resolution.value=x.mapSize,u.uniforms.radius.value=x.radius,t.setRenderTarget(x.mapPass),t.clear(),t.renderBufferDirect(M,null,w,u,g,null),d.uniforms.shadow_pass.value=x.mapPass.texture,d.uniforms.resolution.value=x.mapSize,d.uniforms.radius.value=x.radius,t.setRenderTarget(x.map),t.clear(),t.renderBufferDirect(M,null,w,d,g,null)}function y(x,M,w,T,_,A){let S=null;const D=w.isPointLight===!0?x.customDistanceMaterial:x.customDepthMaterial;if(D!==void 0?S=D:S=w.isPointLight===!0?l:a,t.localClippingEnabled&&M.clipShadows===!0&&Array.isArray(M.clippingPlanes)&&M.clippingPlanes.length!==0||M.displacementMap&&M.displacementScale!==0||M.alphaMap&&M.alphaTest>0){const O=S.uuid,z=M.uuid;let I=h[O];I===void 0&&(I={},h[O]=I);let H=I[z];H===void 0&&(H=S.clone(),I[z]=H),S=H}return S.visible=M.visible,S.wireframe=M.wireframe,A===io?S.side=M.shadowSide!==null?M.shadowSide:M.side:S.side=M.shadowSide!==null?M.shadowSide:c[M.side],S.alphaMap=M.alphaMap,S.alphaTest=M.alphaTest,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&&(S.referencePosition.setFromMatrixPosition(w.matrixWorld),S.nearDistance=T,S.farDistance=_),S}function b(x,M,w,T,_){if(x.visible===!1)return;if(x.layers.test(M.layers)&&(x.isMesh||x.isLine||x.isPoints)&&(x.castShadow||x.receiveShadow&&_===io)&&(!x.frustumCulled||n.intersectsObject(x))){x.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,x.matrixWorld);const D=e.update(x),O=x.material;if(Array.isArray(O)){const z=D.groups;for(let I=0,H=z.length;I<H;I++){const ee=z[I],G=O[ee.materialIndex];if(G&&G.visible){const B=y(x,G,T,w.near,w.far,_);t.renderBufferDirect(w,null,D,B,x,ee)}}}else if(O.visible){const z=y(x,O,T,w.near,w.far,_);t.renderBufferDirect(w,null,D,z,x,null)}}const S=x.children;for(let D=0,O=S.length;D<O;D++)b(S[D],M,w,T,_)}}function Zb(t,e,i){const n=i.isWebGL2;function r(){let j=!1;const Te=new tt;let se=null;const be=new tt(0,0,0,0);return{setMask:function(ue){se!==ue&&!j&&(t.colorMask(ue,ue,ue,ue),se=ue)},setLocked:function(ue){j=ue},setClear:function(ue,xe,Oe,ze,Ze){Ze===!0&&(ue*=ze,xe*=ze,Oe*=ze),Te.set(ue,xe,Oe,ze),be.equals(Te)===!1&&(t.clearColor(ue,xe,Oe,ze),be.copy(Te))},reset:function(){j=!1,se=null,be.set(-1,0,0,0)}}}function s(){let j=!1,Te=null,se=null,be=null;return{setTest:function(ue){ue?K(2929):Y(2929)},setMask:function(ue){Te!==ue&&!j&&(t.depthMask(ue),Te=ue)},setFunc:function(ue){if(se!==ue){if(ue)switch(ue){case mv:t.depthFunc(512);break;case gv:t.depthFunc(519);break;case vv:t.depthFunc(513);break;case Rc:t.depthFunc(515);break;case yv:t.depthFunc(514);break;case xv:t.depthFunc(518);break;case _v:t.depthFunc(516);break;case bv:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);se=ue}},setLocked:function(ue){j=ue},setClear:function(ue){be!==ue&&(t.clearDepth(ue),be=ue)},reset:function(){j=!1,Te=null,se=null,be=null}}}function o(){let j=!1,Te=null,se=null,be=null,ue=null,xe=null,Oe=null,ze=null,Ze=null;return{setTest:function(He){j||(He?K(2960):Y(2960))},setMask:function(He){Te!==He&&!j&&(t.stencilMask(He),Te=He)},setFunc:function(He,rt,Qe){(se!==He||be!==rt||ue!==Qe)&&(t.stencilFunc(He,rt,Qe),se=He,be=rt,ue=Qe)},setOp:function(He,rt,Qe){(xe!==He||Oe!==rt||ze!==Qe)&&(t.stencilOp(He,rt,Qe),xe=He,Oe=rt,ze=Qe)},setLocked:function(He){j=He},setClear:function(He){Ze!==He&&(t.clearStencil(He),Ze=He)},reset:function(){j=!1,Te=null,se=null,be=null,ue=null,xe=null,Oe=null,ze=null,Ze=null}}}const a=new r,l=new s,h=new o,f=new WeakMap,c=new WeakMap;let u={},d={},m=new WeakMap,g=[],p=null,v=!1,y=null,b=null,x=null,M=null,w=null,T=null,_=null,A=!1,S=null,D=null,O=null,z=null,I=null;const H=t.getParameter(35661);let ee=!1,G=0;const B=t.getParameter(7938);B.indexOf("WebGL")!==-1?(G=parseFloat(/^WebGL (\d)/.exec(B)[1]),ee=G>=1):B.indexOf("OpenGL ES")!==-1&&(G=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),ee=G>=2);let N=null,R={};const k=t.getParameter(3088),F=t.getParameter(2978),U=new tt().fromArray(k),W=new tt().fromArray(F);function ie(j,Te,se){const be=new Uint8Array(4),ue=t.createTexture();t.bindTexture(j,ue),t.texParameteri(j,10241,9728),t.texParameteri(j,10240,9728);for(let xe=0;xe<se;xe++)t.texImage2D(Te+xe,0,6408,1,1,0,6408,5121,be);return ue}const V={};V[3553]=ie(3553,3553,1),V[34067]=ie(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),h.setClear(0),K(2929),l.setFu
3112nc(Rc),me(!1),De(Cu),K(2884),ve(tr);function K(j){u[j]!==!0&&(t.enable(j),u[j]=!0)}function Y(j){u[j]!==!1&&(t.disable(j),u[j]=!1)}function J(j,Te){return d[j]!==Te?(t.bindFramebuffer(j,Te),d[j]=Te,n&&(j===36009&&(d[36160]=Te),j===36160&&(d[36009]=Te)),!0):!1}function Q(j,Te){let se=g,be=!1;if(j)if(se=m.get(Te),se===void 0&&(se=[],m.set(Te,se)),j.isWebGLMultipleRenderTargets){const ue=j.texture;if(se.length!==ue.length||se[0]!==36064){for(let xe=0,Oe=ue.length;xe<Oe;xe++)se[xe]=36064+xe;se.length=ue.length,be=!0}}else se[0]!==36064&&(se[0]=36064,be=!0);else se[0]!==1029&&(se[0]=1029,be=!0);be&&(i.isWebGL2?t.drawBuffers(se):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(se))}function he(j){return p!==j?(t.useProgram(j),p=j,!0):!1}const de={[hs]:32774,[rv]:32778,[sv]:32779};if(n)de[Ou]=32775,de[Ru]=32776;else{const j=e.get("EXT_blend_minmax");j!==null&&(de[Ou]=j.MIN_EXT,de[Ru]=j.MAX_EXT)}const ae={[ov]:0,[av]:1,[lv]:768,[rm]:770,[pv]:776,[dv]:774,[hv]:772,[cv]:769,[sm]:771,[fv]:775,[uv]:773};function ve(j,Te,se,be,ue,xe,Oe,ze){if(j===tr){v===!0&&(Y(3042),v=!1);return}if(v===!1&&(K(3042),v=!0),j!==nv){if(j!==y||ze!==A){if((b!==hs||w!==hs)&&(t.blendEquation(32774),b=hs,w=hs),ze)switch(j){case Tr:t.blendFuncSeparate(1,771,1,771);break;case Lu:t.blendFunc(1,1);break;case Pu:t.blendFuncSeparate(0,769,0,1);break;case Du:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",j);break}else switch(j){case Tr:t.blendFuncSeparate(770,771,1,771);break;case Lu:t.blendFunc(770,1);break;case Pu:t.blendFuncSeparate(0,769,0,1);break;case Du:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",j);break}x=null,M=null,T=null,_=null,y=j,A=ze}return}ue=ue||Te,xe=xe||se,Oe=Oe||be,(Te!==b||ue!==w)&&(t.blendEquationSeparate(de[Te],de[ue]),b=Te,w=ue),(se!==x||be!==M||xe!==T||Oe!==_)&&(t.blendFuncSeparate(ae[se],ae[be],ae[xe],ae[Oe]),x=se,M=be,T=xe,_=Oe),y=j,A=null}function pe(j,Te){j.side===An?Y(2884):K(2884);let se=j.side===vi;Te&&(se=!se),me(se),j.blending===Tr&&j.transparent===!1?ve(tr):ve(j.blending,j.blendEquation,j.blendSrc,j.blendDst,j.blendEquationAlpha,j.blendSrcAlpha,j.blendDstAlpha,j.premultipliedAlpha),l.setFunc(j.depthFunc),l.setTest(j.depthTest),l.setMask(j.depthWrite),a.setMask(j.colorWrite);const be=j.stencilWrite;h.setTest(be),be&&(h.setMask(j.stencilWriteMask),h.setFunc(j.stencilFunc,j.stencilRef,j.stencilFuncMask),h.setOp(j.stencilFail,j.stencilZFail,j.stencilZPass)),Me(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits),j.alphaToCoverage===!0?K(32926):Y(32926)}function me(j){S!==j&&(j?t.frontFace(2304):t.frontFace(2305),S=j)}function De(j){j!==ev?(K(2884),j!==D&&(j===Cu?t.cullFace(1029):j===tv?t.cullFace(1028):t.cullFace(1032))):Y(2884),D=j}function Se(j){j!==O&&(ee&&t.lineWidth(j),O=j)}function Me(j,Te,se){j?(K(32823),(z!==Te||I!==se)&&(t.polygonOffset(Te,se),z=Te,I=se)):Y(32823)}function vt(j){j?K(3089):Y(3089)}function Ue(j){j===void 0&&(j=33984+H-1),N!==j&&(t.activeTexture(j),N=j)}function P(j,Te){N===null&&Ue();let se=R[N];se===void 0&&(se={type:void 0,texture:void 0},R[N]=se),(se.type!==j||se.texture!==Te)&&(t.bindTexture(j,Te||V[j]),se.type=j,se.texture=Te)}function C(){const j=R[N];j!==void 0&&j.type!==void 0&&(t.bindTexture(j.type,null),j.type=void 0,j.texture=void 0)}function re(){try{t.compressedTexImage2D.apply(t,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function fe(){try{t.texSubImage2D.apply(t,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function ye(){try{t.texSubImage3D.apply(t,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function we(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function Ve(){try{t.texStorage2D.apply(t,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function ne(){try{t.texStorage3D.apply(t,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function Ie(){try{t.texImage2D.apply(t,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function _e(){try{t.texImage3D.apply(t,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function Ce(j){U.equals(j)===!1&&(t.scissor(j.x,j.y,j.z,j.w),U.copy(j))}function Ae(j){W.equals(j)===!1&&(t.viewport(j.x,j.y,j.z,j.w),W.copy(j))}function je(j,Te){let se=c.get(Te);se===void 0&&(se=new WeakMap,c.set(Te,se));let be=se.get(j);be===void 0&&(be=t.getUniformBlockIndex(Te,j.name),se.set(j,be))}function nt(j,Te){const be=c.get(Te).get(j);f.get(j)!==be&&(t.uniformBlockBinding(Te,be,j.__bindingPointIndex),f.set(j,be))}function _t(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,
vendor: 4,322 bytes, line 3112
3112!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),n===!0&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),u={},N=null,R={},d={},m=new WeakMap,g=[],p=null,v=!1,y=null,b=null,x=null,M=null,w=null,T=null,_=null,A=!1,S=null,D=null,O=null,z=null,I=null,U.set(0,0,t.canvas.width,t.canvas.height),W.set(0,0,t.canvas.width,t.canvas.height),a.reset(),l.reset(),h.reset()}return{buffers:{color:a,depth:l,stencil:h},enable:K,disable:Y,bindFramebuffer:J,drawBuffers:Q,useProgram:he,setBlending:ve,setMaterial:pe,setFlipSided:me,setCullFace:De,setLineWidth:Se,setPolygonOffset:Me,setScissorTest:vt,activeTexture:Ue,bindTexture:P,unbindTexture:C,compressedTexImage2D:re,texImage2D:Ie,texImage3D:_e,updateUBOMapping:je,uniformBlockBinding:nt,texStorage2D:Ve,texStorage3D:ne,texSubImage2D:fe,texSubImage3D:ye,compressedTexSubImage2D:we,scissor:Ce,viewport:Ae,reset:_t}}function Jb(t,e,i,n,r,s,o){const a=r.isWebGL2,l=r.maxTextures,h=r.maxCubemapSize,f=r.maxTextureSize,c=r.maxSamples,u=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,d=/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap;let g;const p=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(P,C){return v?new OffscreenCanvas(P,C):za("canvas")}function b(P,C,re,fe){let ye=1;if((P.width>fe||P.height>fe)&&(ye=fe/Math.max(P.width,P.height)),ye<1||C===!0)if(typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&P instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&P instanceof ImageBitmap){const we=C?Ia:Math.floor,Ve=we(ye*P.width),ne=we(ye*P.height);g===void 0&&(g=y(Ve,ne));const Ie=re?y(Ve,ne):g;return Ie.width=Ve,Ie.height=ne,Ie.getContext("2d").drawImage(P,0,0,Ve,ne),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+P.width+"x"+P.height+") to ("+Ve+"x"+ne+")."),Ie}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+P.width+"x"+P.height+")."),P;return P}function x(P){return kc(P.width)&&kc(P.height)}function M(P){return a?!1:P.wrapS!==Vi||P.wrapT!==Vi||P.minFilter!==ni&&P.minFilter!==Ci}function w(P,C){return P.generateMipmaps&&C&&P.minFilter!==ni&&P.minFilter!==Ci}function T(P){t.generateMipmap(P)}function _(P,C,re,fe,ye=!1){if(a===!1)return C;if(P!==null){if(t[P]!==void 0)return t[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let we=C;return C===6403&&(re===5126&&(we=33326),re===5131&&(we=33325),re===5121&&(we=33321)),C===33319&&(re===5126&&(we=33328),re===5131&&(we=33327),re===5121&&(we=33323)),C===6408&&(re===5126&&(we=34836),re===5131&&(we=34842),re===5121&&(we=fe===Et&&ye===!1?35907:32856),re===32819&&(we=32854),re===32820&&(we=32855)),(we===33325||we===33326||we===33327||we===33328||we===34842||we===34836)&&e.get("EXT_color_buffer_float"),we}function A(P,C,re){return w(P,re)===!0||P.isFramebufferTexture&&P.minFilter!==ni&&P.minFilter!==Ci?Math.log2(Math.max(C.width,C.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?C.mipmaps.length:1}function S(P){return P===ni||P===Iu||P===zu?9728:9729}function D(P){const C=P.target;C.removeEventListener("dispose",D),z(C),C.isVideoTexture&&m.delete(C)}function O(P){const C=P.target;C.removeEventListener("dispose",O),H(C)}function z(P){const C=n.get(P);if(C.__webglInit===void 0)return;const re=P.source,fe=p.get(re);if(fe){const ye=fe[C.__cacheKey];ye.usedTimes--,ye.usedTimes===0&&I(P),Object.keys(fe).length===0&&p.delete(re)}n.remove(P)}function I(P){const C=n.get(P);t.deleteTexture(C.__webglTexture);const re=P.source,fe=p.get(re);delete fe[C.__cacheKey],o.memory.textures--}function H(P){const C=P.texture,re=n.get(P),fe=n.get(C);if(fe.__webglTexture!==void 0&&(t.deleteTexture(fe.__webglTexture),o.memory.textures--),P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRen
3112derTarget)for(let ye=0;ye<6;ye++)t.deleteFramebuffer(re.__webglFramebuffer[ye]),re.__webglDepthbuffer&&t.deleteRenderbuffer(re.__webglDepthbuffer[ye]);else{if(t.deleteFramebuffer(re.__webglFramebuffer),re.__webglDepthbuffer&&t.deleteRenderbuffer(re.__webglDepthbuffer),re.__webglMultisampledFramebuffer&&t.deleteFramebuffer(re.__webglMultisampledFramebuffer),re.__webglColorRenderbuffer)for(let ye=0;ye<re.__webglColorRenderbuffer.length;ye++)re.__webglColorRenderbuffer[ye]&&t.deleteRenderbuffer(re.__webglColorRenderbuffer[ye]);re.__webglDepthRenderbuffer&&t.deleteRenderbuffer(re.__webglDepthRenderbuffer)}if(P.isWebGLMultipleRenderTargets)for(let ye=0,we=C.length;ye<we;ye++){const Ve=n.get(C[ye]);Ve.__webglTexture&&(t.deleteTexture(Ve.__webglTexture),o.memory.textures--),n.remove(C[ye])}n.remove(C),n.remove(P)}let ee=0;function G(){ee=0}function B(){const P=ee;return P>=l&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+l),ee+=1,P}function N(P){const C=[];return C.push(P.wrapS),C.push(P.wrapT),C.push(P.magFilter),C.push(P.minFilter),C.push(P.anisotropy),C.push(P.internalFormat),C.push(P.format),C.push(P.type),C.push(P.generateMipmaps),C.push(P.premultiplyAlpha),C.push(P.flipY),C.push(P.unpackAlignment),C.push(P.encoding),C.join()}function R(P,C){const re=n.get(P);if(P.isVideoTexture&&vt(P),P.isRenderTargetTexture===!1&&P.version>0&&re.__version!==P.version){const fe=P.image;if(fe===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(fe.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Y(re,P,C);return}}i.activeTexture(33984+C),i.bindTexture(3553,re.__webglTexture)}function k(P,C){const re=n.get(P);if(P.version>0&&re.__version!==P.version){Y(re,P,C);return}i.activeTexture(33984+C),i.bindTexture(35866,re.__webglTexture)}function F(P,C){const re=n.get(P);if(P.version>0&&re.__version!==P.version){Y(re,P,C);return}i.activeTexture(33984+C),i.bindTexture(32879,re.__webglTexture)}function U(P,C){const re=n.get(P);if(P.version>0&&re.__version!==P.version){J(re,P,C);return}i.activeTexture(33984+C),i.bindTexture(34067,re.__webglTexture)}const W={[Nc]:10497,[Vi]:33071,[Uc]:33648},ie={[ni]:9728,[Iu]:9984,[zu]:9986,[Ci]:9729,[Lv]:9985,[il]:9987};function V(P,C,re){if(re?(t.texParameteri(P,10242,W[C.wrapS]),t.texParameteri(P,10243,W[C.wrapT]),(P===32879||P===35866)&&t.texParameteri(P,32882,W[C.wrapR]),t.texParameteri(P,10240,ie[C.magFilter]),t.texParameteri(P,10241,ie[C.minFilter])):(t.texParameteri(P,10242,33071),t.texParameteri(P,10243,33071),(P===32879||P===35866)&&t.texParameteri(P,32882,33071),(C.wrapS!==Vi||C.wrapT!==Vi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(P,10240,S(C.magFilter)),t.texParameteri(P,10241,S(C.minFilter)),C.minFilter!==ni&&C.minFilter!==Ci&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const fe=e.get("EXT_texture_filter_anisotropic");if(C.type===Sr&&e.has("OES_texture_float_linear")===!1||a===!1&&C.type===yo&&e.has("OES_texture_half_float_linear")===!1)return;(C.anisotropy>1||n.get(C).__currentAnisotropy)&&(t.texParameterf(P,fe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,r.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy)}}function K(P,C){let re=!1;P.__webglInit===void 0&&(P.__webglInit=!0,C.addEventListener("dispose",D));const fe=C.source;let ye=p.get(fe);ye===void 0&&(ye={},p.set(fe,ye));const we=N(C);if(we!==P.__cacheKey){ye[we]===void 0&&(ye[we]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,re=!0),ye[we].usedTimes++;const Ve=ye[P.__cacheKey];Ve!==void 0&&(ye[P.__cacheKey].usedTimes--,Ve.usedTimes===0&&I(C)),P.__cacheKey=we,P.__webglTexture=ye[we].texture}return re}function Y(P,C,re){let fe=3553;C.isDataArrayTexture&&(fe=35866),C.isData3DTexture&&(fe=32879);const ye=K(P,C),we=C.source;if(i.activeTexture(33984+re),i.bindTexture(fe,P.__webglTexture),we.version!==we.__currentVersion||ye===!0){t.pixelStorei(37440,C.flipY),t.pixelStorei(37441,C.premultiplyAlpha),t.pixelStorei(3317,C.unpackAlignment),t.pixelStorei(37443,0);const Ve=M(C)&&x(C.image)===!1;let ne=b(C.image,Ve,!1,f);ne=Ue(C,ne);const Ie=x(ne)||a,_e=s.convert(C.format,C.encoding);let Ce=s.convert(C.type),Ae=_(C.internalFormat,_e,Ce,C.encoding,C.isVideoTexture);V(fe,C,Ie);let je;const nt=C.mipmaps,_t=a&&C.isVideoTexture!==!0,j=we.__currentVersion===void 0||ye===!0,Te=A(C,ne,Ie);if(C.isDepthTexture)Ae=6402,a?C.type===Sr?Ae=36012:C.type===wr?Ae=33190:C.type===ys?Ae=35056:Ae=33189:C.type===Sr&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),C.format===Er&&Ae===6402&&C.type!==lm&&C.type!==wr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),C.type=wr,Ce=s.convert(C.type)),C.format===Ts&&Ae===6402&&(Ae=34041,C.type!==ys&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),C.type=ys,Ce=s.convert(C.type))),j&&(_t?i.texStorage2D(3553,1,Ae,ne.width,ne.height):i.texImage2D(3553,0,Ae,ne.width,ne.height,0,_e,Ce,null));else if(C.isDataTexture)if(nt.length>0&&Ie){_t&&j&&i.texStorage2D(3553,Te,Ae,nt[0].width,nt[0].height);for(let se=0,be=nt.length;se<be;se++)je=nt[se],_t?i.texSubImage2D(3553,se,0,0,je.width,je.height,_e,Ce,je.data):i.texImage2D(3553,se,Ae,je.width,je.height,0,_e,Ce,je.data);C.generateMipmaps=!1}else _t?(j&&i.texStorage2D(3553,Te,Ae,ne.width,ne.height),i.texSubImage2D(3553,0,0,0,ne.width,ne.height,_e,Ce,ne.data)):i.texImage2D(3553,0,Ae,ne.width,ne.height,0,_e,Ce,ne.data);else if(C.isCompressedTexture){_t&&j&&i.texStorage2D(3553,Te,Ae,nt[0].width,nt[0].height);for(let se=0,be=nt.length;se<be;se++)je=nt[se],C.format!==nn?_e!==null?_t?i.compressedTexSubImage2D(3553,se,0,0,je.width,je.height,_e,je.data):i.compressedTexImage2D(3553,se,Ae,je.width,je.height,0,je.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_t?i.texSubImage2D(3553,se,0,0,je.width,je.height,_e,Ce,je.data):i.texImage2D(3553,se,Ae,je.width,je.height,0,_e,Ce,je.data)}else if(C.isDataArrayTexture)_t?(j&&i.texStorage3D(35866,Te,Ae,ne.width,ne.height,ne.depth),i.texSubImage3D(35866,0,0,0,0,ne.width,ne.height,ne.depth,_e,Ce,ne.data)):i.texImage3D(35866,0,Ae,ne.width,ne.height,ne.depth,0,_e,Ce,ne.data);else if(C.isData3DTexture)_t?(j&&i.texStorage3D(32879,Te,Ae,ne.width,ne.height,ne.depth),i.texSubImage3D(32879,0,0,0,0,ne.width,ne.height,ne.depth,_e,Ce,ne.data)):i.texImage3D(32879,0,Ae,ne.width,ne.height,ne.depth,0,_e,Ce,ne.data);else if(C.isFramebufferTexture){if(j)if(_t)i.texStorage2D(3553,Te,Ae,ne.width,ne.height);
vendor: 8,592 bytes, line 3112
3112else{let se=ne.width,be=ne.height;for(let ue=0;ue<Te;ue++)i.texImage2D(3553,ue,Ae,se,be,0,_e,Ce,null),se>>=1,be>>=1}}else if(nt.length>0&&Ie){_t&&j&&i.texStorage2D(3553,Te,Ae,nt[0].width,nt[0].height);for(let se=0,be=nt.length;se<be;se++)je=nt[se],_t?i.texSubImage2D(3553,se,0,0,_e,Ce,je):i.texImage2D(3553,se,Ae,_e,Ce,je);C.generateMipmaps=!1}else _t?(j&&i.texStorage2D(3553,Te,Ae,ne.width,ne.height),i.texSubImage2D(3553,0,0,0,_e,Ce,ne)):i.texImage2D(3553,0,Ae,_e,Ce,ne);w(C,Ie)&&T(fe),we.__currentVersion=we.version,C.onUpdate&&C.onUpdate(C)}P.__version=C.version}function J(P,C,re){if(C.image.length!==6)return;const fe=K(P,C),ye=C.source;if(i.activeTexture(33984+re),i.bindTexture(34067,P.__webglTexture),ye.version!==ye.__currentVersion||fe===!0){t.pixelStorei(37440,C.flipY),t.pixelStorei(37441,C.premultiplyAlpha),t.pixelStorei(3317,C.unpackAlignment),t.pixelStorei(37443,0);const we=C.isCompressedTexture||C.image[0].isCompressedTexture,Ve=C.image[0]&&C.image[0].isDataTexture,ne=[];for(let se=0;se<6;se++)!we&&!Ve?ne[se]=b(C.image[se],!1,!0,h):ne[se]=Ve?C.image[se].image:C.image[se],ne[se]=Ue(C,ne[se]);const Ie=ne[0],_e=x(Ie)||a,Ce=s.convert(C.format,C.encoding),Ae=s.convert(C.type),je=_(C.internalFormat,Ce,Ae,C.encoding),nt=a&&C.isVideoTexture!==!0,_t=ye.__currentVersion===void 0||fe===!0;let j=A(C,Ie,_e);V(34067,C,_e);let Te;if(we){nt&&_t&&i.texStorage2D(34067,j,je,Ie.width,Ie.height);for(let se=0;se<6;se++){Te=ne[se].mipmaps;for(let be=0;be<Te.length;be++){const ue=Te[be];C.format!==nn?Ce!==null?nt?i.compressedTexSubImage2D(34069+se,be,0,0,ue.width,ue.height,Ce,ue.data):i.compressedTexImage2D(34069+se,be,je,ue.width,ue.height,0,ue.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):nt?i.texSubImage2D(34069+se,be,0,0,ue.width,ue.height,Ce,Ae,ue.data):i.texImage2D(34069+se,be,je,ue.width,ue.height,0,Ce,Ae,ue.data)}}}else{Te=C.mipmaps,nt&&_t&&(Te.length>0&&j++,i.texStorage2D(34067,j,je,ne[0].width,ne[0].height));for(let se=0;se<6;se++)if(Ve){nt?i.texSubImage2D(34069+se,0,0,0,ne[se].width,ne[se].height,Ce,Ae,ne[se].data):i.texImage2D(34069+se,0,je,ne[se].width,ne[se].height,0,Ce,Ae,ne[se].data);for(let be=0;be<Te.length;be++){const xe=Te[be].image[se].image;nt?i.texSubImage2D(34069+se,be+1,0,0,xe.width,xe.height,Ce,Ae,xe.data):i.texImage2D(34069+se,be+1,je,xe.width,xe.height,0,Ce,Ae,xe.data)}}else{nt?i.texSubImage2D(34069+se,0,0,0,Ce,Ae,ne[se]):i.texImage2D(34069+se,0,je,Ce,Ae,ne[se]);for(let be=0;be<Te.length;be++){const ue=Te[be];nt?i.texSubImage2D(34069+se,be+1,0,0,Ce,Ae,ue.image[se]):i.texImage2D(34069+se,be+1,je,Ce,Ae,ue.image[se])}}}w(C,_e)&&T(34067),ye.__currentVersion=ye.version,C.onUpdate&&C.onUpdate(C)}P.__version=C.version}function Q(P,C,re,fe,ye){const we=s.convert(re.format,re.encoding),Ve=s.convert(re.type),ne=_(re.internalFormat,we,Ve,re.encoding);n.get(C).__hasExternalTextures||(ye===32879||ye===35866?i.texImage3D(ye,0,ne,C.width,C.height,C.depth,0,we,Ve,null):i.texImage2D(ye,0,ne,C.width,C.height,0,we,Ve,null)),i.bindFramebuffer(36160,P),Me(C)?u.framebufferTexture2DMultisampleEXT(36160,fe,ye,n.get(re).__webglTexture,0,Se(C)):t.framebufferTexture2D(36160,fe,ye,n.get(re).__webglTexture,0),i.bindFramebuffer(36160,null)}function he(P,C,re){if(t.bindRenderbuffer(36161,P),C.depthBuffer&&!C.stencilBuffer){let fe=33189;if(re||Me(C)){const ye=C.depthTexture;ye&&ye.isDepthTexture&&(ye.type===Sr?fe=36012:ye.type===wr&&(fe=33190));const we=Se(C);Me(C)?u.renderbufferStorageMultisampleEXT(36161,we,fe,C.width,C.height):t.renderbufferStorageMultisample(36161,we,fe,C.width,C.height)}else t.renderbufferStorage(36161,fe,C.width,C.height);t.framebufferRenderbuffer(36160,36096,36161,P)}else if(C.depthBuffer&&C.stencilBuffer){const fe=Se(C);re&&Me(C)===!1?t.renderbufferStorageMultisample(36161,fe,35056,C.width,C.height):Me(C)?u.renderbufferStorageMultisampleEXT(36161,fe,35056,C.width,C.height):t.renderbufferStorage(36161,34041,C.width,C.height),t.framebufferRenderbuffer(36160,33306,36161,P)}else{const fe=C.isWebGLMultipleRenderTargets===!0?C.texture:[C.texture];for(let ye=0;ye<fe.length;ye++){const we=fe[ye],Ve=s.convert(we.format,we.encoding),ne=s.convert(we.type),Ie=_(we.internalFormat,Ve,ne,we.encoding),_e=Se(C);re&&Me(C)===!1?t.renderbufferStorageMultisample(36161,_e,Ie,C.width,C.height):Me(C)?u.renderbufferStorageMultisampleEXT(36161,_e,Ie,C.width,C.height):t.renderbufferStorage(36161,Ie,C.width,C.height)}}t.bindRenderbuffer(36161,null)}function de(P,C){if(C&&C.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,P),!(C.depthTexture&&C.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(C.depthTexture).__webglTexture||C.depthTexture.image.width!==C.width||C.depthTexture.image.height!==C.height)&&(C.depthTexture.image.width=C.width,C.depthTexture.image.height=C.height,C.depthTexture.needsUpdate=!0),R(C.depthTexture,0);const fe=n.get(C.depthTexture).__webglTexture,ye=Se(C);if(C.depthTexture.format===Er)Me(C)?u.framebufferTexture2DMultisampleEXT(36160,36096,3553,fe,0,ye):t.framebufferTexture2D(36160,36096,3553,fe,0);else if(C.depthTexture.format===Ts)Me(C)?u.framebufferTexture2DMultisampleEXT(36160,33306,3553,fe,0,ye):t.framebufferTexture2D(36160,33306,3553,fe,0);else throw new Error("Unknown depthTexture format")}function ae(P){const C=n.get(P),re=P.isWebGLCubeRenderTarget===!0;if(P.depthTexture&&!C.__autoAllocateDepthBuffer){if(re)throw new Error("target.depthTexture not supported in Cube render targets");de(C.__webglFramebuffer,P)}else if(re){C.__webglDepthbuffer=[];for(let fe=0;fe<6;fe++)i.bindFramebuffer(36160,C.__webglFramebuffer[fe]),C.__webglDepthbuffer[fe]=t.createRenderbuffer(),he(C.__webglDepthbuffer[fe],P,!1)}else i.bindFramebuffer(36160,C.__webglFramebuffer),C.__webglDepthbuffer=t.createRenderbuffer(),he(C.__webglDepthbuffer,P,!1);i.bindFramebuffer(36160,null)}function ve(P,C,re){const fe=n.get(P);C!==void 0&&Q(fe.__webglFramebuffer,P,P.texture,36064,3553),re!==void 0&&ae(P)}function pe(P){const C=P.texture,re=n.get(P),fe=n.get(C);P.addEventListener("dispose",O),P.isWebGLMultipleRenderTargets!==!0&&(fe.__webglTexture===void 0&&(fe.__webglTexture=t.createTexture()),fe.__version=C.version,o.memory.textures++);const ye=P.isWebGLCubeRenderTarget===!0,we=P.isWebGLMultipleRenderTargets===!0,Ve=x(P)||a;if(ye){re.__webglFramebuffer=[];for(let ne=0;ne<6;ne++)re.__webglFramebuffer[ne]=t.createFramebuffer()}else{if(re.__webglFramebuffer=t.createFramebuffer(),we)if(r.drawBuffers){const ne=P.texture;for(let Ie=0,_e=ne.length;Ie<_e;Ie++){const Ce=n.get(ne[Ie]);Ce.__webglTexture===void 0&&(Ce.__webglTexture=t.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(a&&P.samples>0&&Me(P)===!1){const ne=we?C:[C];re.__webglMultisampledFramebuffer=t.createFramebuffer(),re.__webglColorRenderbuffer=[],i.bindFramebuffer(36160,re.__webglMultisampledFramebuffer);for(let Ie=0;Ie<ne.length;Ie++){const _e=ne[Ie];re.__webglColorRenderbuffer[Ie]=t.createRenderbuffer(),t.bindRenderbuffer(36161,re.__webglColorRenderbuffer[Ie]);const Ce=s.convert(_e.format,_e.encoding),Ae=s.convert(_e.type),je=_(_e.internalFormat,Ce,Ae,_e.encoding),nt=Se(P);t.renderbufferStorageMultisample(36161,nt,je,P.width,P.height),t.framebufferRenderbuffer(36160,36064+Ie,36161,re.__webglColorRenderbuffer[Ie])}t.bindRenderbuffer(36161,null),P.depthBuffer&&(re.__webglDepthRenderbuffer=t.createRenderbuffer(),he(re.__webglDepthRenderbuffer,P,!0)),i.bindFramebuffer(36160,null)}}if(ye){i.bindTexture(34067,fe.__webglTexture),V(34067,C,Ve);for(let ne=0;ne<6;ne++)Q(re.__webglFramebuffer[ne],P,C,36064,34069+ne);w(C,Ve)&&T(34067),i.unbindTexture()}else if(we){const ne=P.texture;for(let Ie=0,_e=ne.length;Ie<_e;Ie++){const Ce=ne[Ie],Ae=n.get(Ce);i.bindTexture(3553,Ae.__webglTexture),V(3553,Ce,Ve),Q(re.__webglFramebuffer,P,Ce,36064+Ie,3553),w(Ce,Ve)&&T(3553)}i.unbindTexture()}else{let ne=3553;(P.isWebGL3DRenderTarget||P.isWebGLArrayRenderTarget)&&(a?ne=P.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),i.bindTexture(ne,fe.__webglTexture),V(ne,C,Ve),Q(re.__webglFramebuffer,P,C,36064,ne),w(C,Ve)&&T(ne),i.unbindTexture()}P.depthBuffer&&ae(P)}function me(P){const C=x(P)||a,re=P.isWebGLMultipleRenderTargets===!0?P.texture:[P.texture];for(let fe=0,ye=re.length;fe<ye;fe++){const we=re[fe];
3112if(w(we,C)){const Ve=P.isWebGLCubeRenderTarget?34067:3553,ne=n.get(we).__webglTexture;i.bindTexture(Ve,ne),T(Ve),i.unbindTexture()}}}function De(P){if(a&&P.samples>0&&Me(P)===!1){const C=P.isWebGLMultipleRenderTargets?P.texture:[P.texture],re=P.width,fe=P.height;let ye=16384;const we=[],Ve=P.stencilBuffer?33306:36096,ne=n.get(P),Ie=P.isWebGLMultipleRenderTargets===!0;if(Ie)for(let _e=0;_e<C.length;_e++)i.bindFramebuffer(36160,ne.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+_e,36161,null),i.bindFramebuffer(36160,ne.__webglFramebuffer),t.framebufferTexture2D(36009,36064+_e,3553,null,0);i.bindFramebuffer(36008,ne.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,ne.__webglFramebuffer);for(let _e=0;_e<C.length;_e++){we.push(36064+_e),P.depthBuffer&&we.push(Ve);const Ce=ne.__ignoreDepthValues!==void 0?ne.__ignoreDepthValues:!1;if(Ce===!1&&(P.depthBuffer&&(ye|=256),P.stencilBuffer&&(ye|=1024)),Ie&&t.framebufferRenderbuffer(36008,36064,36161,ne.__webglColorRenderbuffer[_e]),Ce===!0&&(t.invalidateFramebuffer(36008,[Ve]),t.invalidateFramebuffer(36009,[Ve])),Ie){const Ae=n.get(C[_e]).__webglTexture;t.framebufferTexture2D(36009,36064,3553,Ae,0)}t.blitFramebuffer(0,0,re,fe,0,0,re,fe,ye,9728),d&&t.invalidateFramebuffer(36008,we)}if(i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,null),Ie)for(let _e=0;_e<C.length;_e++){i.bindFramebuffer(36160,ne.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+_e,36161,ne.__webglColorRenderbuffer[_e]);const Ce=n.get(C[_e]).__webglTexture;i.bindFramebuffer(36160,ne.__webglFramebuffer),t.framebufferTexture2D(36009,36064+_e,3553,Ce,0)}i.bindFramebuffer(36009,ne.__webglMultisampledFramebuffer)}}function Se(P){return Math.min(c,P.samples)}function Me(P){const C=n.get(P);return a&&P.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function vt(P){const C=o.render.frame;m.get(P)!==C&&(m.set(P,C),P.update())}function Ue(P,C){const re=P.encoding,fe=P.format,ye=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||P.format===Fc||re!==ln&&(re===Et?a===!1?e.has("EXT_sRGB")===!0&&fe===nn?(P.format=Fc,P.minFilter=Ci,P.generateMipmaps=!1):C=um.sRGBToLinear(C):(fe!==nn||ye!==zr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",re)),C}this.allocateTextureUnit=B,this.resetTextureUnits=G,this.setTexture2D=R,this.setTexture2DArray=k,this.setTexture3D=F,this.setTextureCube=U,this.rebindTextures=ve,this.setupRenderTarget=pe,this.updateRenderTargetMipmap=me,this.updateMultisampleRenderTarget=De,this.setupDepthRenderbuffer=ae,this.setupFrameBufferTexture=Q,this.useMultisampledRTT=Me}function Kb(t,e,i){const n=i.isWebGL2;function r(s,o=null){let a;if(s===zr)return 5121;if(s===Rv)return 32819;if(s===Iv)return 32820;if(s===Pv)return 5120;if(s===Dv)return 5122;if(s===lm)return 5123;if(s===Ov)return 5124;if(s===wr)return 5125;if(s===Sr)return 5126;if(s===yo)return n?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===zv)return 6406;if(s===nn)return 6408;if(s===Uv)return 6409;if(s===Bv)return 6410;if(s===Er)return 6402;if(s===Ts)return 34041;if(s===Fv)return 6403;if(s===Nv)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===Fc)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===kv)return 36244;if(s===Vv)return 33319;if(s===Gv)return 33320;if(s===Hv)return 36249;if(s===Cl||s===Ll||s===Pl||s===Dl)if(o===Et)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===Cl)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Ll)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Pl)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Dl)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===Cl)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Ll)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Pl)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Dl)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Nu||s===Uu||s===Bu||s===Fu)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Nu)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Uu)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Bu)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Fu)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Wv)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===ku||s===Vu)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===ku)return o===Et?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Vu)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Gu||s===Hu||s===Wu||s===ju||s===qu||s===Xu||s===Yu||s===$u||s===Zu||s===Ju||s===Ku||s===Qu||s===ed||s===td)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Gu)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Hu)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Wu)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===ju)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===qu)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Xu)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Yu)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===$u)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Zu)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Ju)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Ku)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Qu)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===ed)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===td)return o===Et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===id)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===id)return o===Et?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;
vendor: 9,957 bytes, line 3112
3112return s===ys?n?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):t[s]!==void 0?t[s]:null}return{convert:r}}class Qb extends ri{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class ro extends gt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const ew={type:"move"};class nc{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ro,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 ro,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new E,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new E),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ro,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new E,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new E),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}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,i,n){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,h=this._hand;if(e&&i.session.visibilityState!=="visible-blurred"){if(h&&e.hand){o=!0;for(const g of e.hand.values()){const p=i.getJointPose(g,n);if(h.joints[g.jointName]===void 0){const y=new ro;y.matrixAutoUpdate=!1,y.visible=!1,h.joints[g.jointName]=y,h.add(y)}const v=h.joints[g.jointName];p!==null&&(v.matrix.fromArray(p.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.jointRadius=p.radius),v.visible=p!==null}const f=h.joints["index-finger-tip"],c=h.joints["thumb-tip"],u=f.position.distanceTo(c.position),d=.02,m=.005;h.inputState.pinching&&u>d+m?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&u<=d-m&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=i.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=i.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(ew)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),h!==null&&(h.visible=o!==null),this}}class tw extends yi{constructor(e,i,n,r,s,o,a,l,h,f){if(f=f!==void 0?f:Er,f!==Er&&f!==Ts)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&f===Er&&(n=wr),n===void 0&&f===Ts&&(n=ys),super(null,r,s,o,a,l,f,n,h),this.isDepthTexture=!0,this.image={width:e,height:i},this.magFilter=a!==void 0?a:ni,this.minFilter=l!==void 0?l:ni,this.flipY=!1,this.generateMipmaps=!1}}class iw extends In{constructor(e,i){super();const n=this;let r=null,s=1,o=null,a="local-floor",l=null,h=null,f=null,c=null,u=null,d=null;const m=i.getContextAttributes();let g=null,p=null;const v=[],y=[],b=new ri;b.layers.enable(1),b.viewport=new tt;const x=new ri;x.layers.enable(2),x.viewport=new tt;const M=[b,x],w=new Qb;w.layers.enable(1),w.layers.enable(2);let T=null,_=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(N){let R=v[N];return R===void 0&&(R=new nc,v[N]=R),R.getTargetRaySpace()},this.getControllerGrip=function(N){let R=v[N];return R===void 0&&(R=new nc,v[N]=R),R.getGripSpace()},this.getHand=function(N){let R=v[N];return R===void 0&&(R=new nc,v[N]=R),R.getHandSpace()};function A(N){const R=y.indexOf(N.inputSource);if(R===-1)return;const k=v[R];k!==void 0&&k.dispatchEvent({type:N.type,data:N.inputSource})}function S(){r.removeEventListener("select",A),r.removeEventListener("selectstart",A),r.removeEventListener("selectend",A),r.removeEventListener("squeeze",A),r.removeEventListener("squeezestart",A),r.removeEventListener("squeezeend",A),r.removeEventListener("end",S),r.removeEventListener("inputsourceschange",D);for(let N=0;N<v.length;N++){const R=y[N];R!==null&&(y[N]=null,v[N].disconnect(R))}T=null,_=null,e.setRenderTarget(g),u=null,c=null,f=null,r=null,p=null,B.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(N){s=N,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(N){a=N,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(N){l=N},this.getBaseLayer=function(){return c!==null?c:u},this.getBinding=function(){return f},this.getFrame=function(){return d},this.getSession=function(){return r},this.setSession=async function(N){if(r=N,r!==null){if(g=e.getRenderTarget(),r.addEventListener("select",A),r.addEventListener("selectstart",A),r.addEventListener("selectend",A),r.addEventListener("squeeze",A),r.addEventListener("squeezestart",A),r.addEventListener("squeezeend",A),r.addEventListener("end",S),r.addEventListener("inputsourceschange",D),m.xrCompatible!==!0&&await i.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const R={antialias:r.renderState.layers===void 0?m.antialias:!0,alpha:m.alpha,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};u=new XRWebGLLayer(r,i,R),r.updateRenderState({baseLayer:u}),p=new Nr(u.framebufferWidth,u.framebufferHeight,{format:nn,type:zr,encoding:e.outputEncoding,stencilBuffer:m.stencil})}else{let R=null,k=null,F=null;m.depth&&(F=m.stencil?35056:33190,R=m.stencil?Ts:Er,k=m.stencil?ys:wr);const U={colorFormat:32856,depthFormat:F,scaleFactor:s};f=new XRWebGLBinding(r,i),c=f.createProjectionLayer(U),r.updateRenderState({layers:[c]}),p=new Nr(c.textureWidth,c.textureHeight,{format:nn,type:zr,depthTexture:new tw(c.textureWidth,c.textureHeight,k,void 0,void 0,void 0,void 0,void 0,void 0,R),stencilBuffer:m.stencil,encoding:e.outputEncoding,samples:m.antialias?4:0});const W=e.properties.get(p);W.__ignoreDepthValues=c.ignoreDepthValues}p.isXRRenderTarget=!0,this.setFoveation(1),l=null,o=await r.requestReferenceSpace(a),B.setContext(r),B.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};function D(N){for(let R=0;R<N.removed.length;R++){const k=N.removed[R],F=y.indexOf(k);F>=0&&(y[F]=null,v[F].dispatchEvent({type:"disconnected",data:k}))}for(let R=0;R<N.added.length;R++){const k=N.added[R];let F=y.indexOf(k);if(F===-1){for(let W=0;W<v.length;W++)if(W>=y.length){y.push(k),F=W;break}else if(y[W]===null){y[W]=k,F=W;break}if(F===-1)break}const U=v[F];U&&U.dispatchEvent({type:"connected",data:k})}}const O=new E,z=new E;function I(N,R,k){O.setFromMatrixPosition(R.matrixWorld),z.setFromMatrixPosition(k.matrixWorld);const F=O.distanceTo(z),U=R.projectionMatrix.elements,W=k.projectionMatrix.elements,ie=U[14]/(U[10]-1),V=U[14]/(U[10]+1),K=(U[9]+1)/U[5],Y=(U[9]-1)/U[5],J=(U[8]-1)/U[0],Q=(W[8]+1)/W[0],he=ie*J,de=ie*Q,ae=F/(-J+Q),ve=ae*-J;R.matrixWorld.decompose(N.position,N.quaternion,N.scale),N.translateX(ve),N.translateZ(ae),N.matrixWorld.compose(N.position,N.quaternion,N.scale),N.matrixWorldInverse.copy(N.matrixWorld).invert();const pe=ie+ae,me=V+ae,De=he-ve,Se=de+(F-ve),Me=K*V/me*pe,vt=Y*V/me*pe;N.projectionMatrix.makePerspective(De,Se,Me,vt,pe,me)}function H(N,R){R===null?N.matrixWorld.copy(N.matrix):N.matrixWorld.multiplyMatrices(R.matrixWorld,N.matrix),N.matrixWorldInverse.copy(N.matrixWorld).invert()}this.updateCamera=function(N){if(r===null)return;w.near=x.near=b.near=N.near,w.far=x.far=b.far=N.far,(T!==w.near||_!==w.far)&&(r.updateRenderState({depthNear:w.near,depthFar:w.far}),T=w.near,_=w.far);const R=N.parent,k=w.cameras;H(w,R);for(let U=0;U<k.length;U++)H(k[U],R);w.matrixWorld.decompose(w.position,w.quaternion,w.scale),N.matrix.copy(w.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale);const F=N.children;for(let U=0,W=F.length;U<W;U++)F[U].updateMatrixWorld(!0);k.length===2?I(w,b,x):w.projectionMatrix.copy(b.projectionMatrix)},this.getCamera=function(){return w},this.getFoveation=function(){if(c!==null)return c.fixedFoveation;if(u!==null)return u.fixedFoveation},this.setFoveation=function(N){c!==null&&(c.fixedFoveation=N),u!==null&&u.fixedFoveation!==void 0&&(u.fixedFoveation=N)};let ee=null;function G(N,R){if(h=R.getViewerPose(l||o),d=R,h!==null){const k=h.views;u!==null&&(e.setRenderTargetFramebuffer(p,u.framebuffer),e.setRenderTarget(p));let F=!1;k.length!==w.cameras.length&&(w.cameras.length=0,F=!0);for(let U=0;U<k.length;U++){const W=k[U];let ie=null;if(u!==null)ie=u.getViewport(W);else{const K=f.getViewSubImage(c,W);ie=K.viewport,U===0&&(e.setRenderTargetTextures(p,K.colorTexture,c.ignoreDepthValues?void 0:K.depthStencilTexture),e.setRenderTarget(p))}let V=M[U];V===void 0&&(V=new ri,V.layers.enable(U),V.viewport=new tt,M[U]=V),V.matrix.fromArray(W.transform.matrix),V.projectionMatrix.fromArray(W.projectionMatrix),V.viewport.set(ie.x,ie.y,ie.width,ie.height),U===0&&w.matrix.copy(V.matrix
3112),F===!0&&w.cameras.push(V)}}for(let k=0;k<v.length;k++){const F=y[k],U=v[k];F!==null&&U!==void 0&&U.update(F,R,l||o)}ee&&ee(N,R),d=null}const B=new mm;B.setAnimationLoop(G),this.setAnimationLoop=function(N){ee=N},this.dispose=function(){}}}function nw(t,e){function i(g,p){g.fogColor.value.copy(p.color),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function n(g,p,v,y,b){p.isMeshBasicMaterial||p.isMeshLambertMaterial?r(g,p):p.isMeshToonMaterial?(r(g,p),f(g,p)):p.isMeshPhongMaterial?(r(g,p),h(g,p)):p.isMeshStandardMaterial?(r(g,p),c(g,p),p.isMeshPhysicalMaterial&&u(g,p,b)):p.isMeshMatcapMaterial?(r(g,p),d(g,p)):p.isMeshDepthMaterial?r(g,p):p.isMeshDistanceMaterial?(r(g,p),m(g,p)):p.isMeshNormalMaterial?r(g,p):p.isLineBasicMaterial?(s(g,p),p.isLineDashedMaterial&&o(g,p)):p.isPointsMaterial?a(g,p,v,y):p.isSpriteMaterial?l(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===vi&&(g.bumpScale.value*=-1)),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===vi&&g.normalScale.value.negate()),p.specularMap&&(g.specularMap.value=p.specularMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const v=e.get(p).envMap;if(v&&(g.envMap.value=v,g.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap){g.lightMap.value=p.lightMap;const x=t.physicallyCorrectLights!==!0?Math.PI:1;g.lightMapIntensity.value=p.lightMapIntensity*x}p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity);let y;p.map?y=p.map:p.specularMap?y=p.specularMap:p.displacementMap?y=p.displacementMap:p.normalMap?y=p.normalMap:p.bumpMap?y=p.bumpMap:p.roughnessMap?y=p.roughnessMap:p.metalnessMap?y=p.metalnessMap:p.alphaMap?y=p.alphaMap:p.emissiveMap?y=p.emissiveMap:p.clearcoatMap?y=p.clearcoatMap:p.clearcoatNormalMap?y=p.clearcoatNormalMap:p.clearcoatRoughnessMap?y=p.clearcoatRoughnessMap:p.iridescenceMap?
vendor: 26,692 bytes, line 3112
3112y=p.iridescenceMap:p.iridescenceThicknessMap?y=p.iridescenceThicknessMap:p.specularIntensityMap?y=p.specularIntensityMap:p.specularColorMap?y=p.specularColorMap:p.transmissionMap?y=p.transmissionMap:p.thicknessMap?y=p.thicknessMap:p.sheenColorMap?y=p.sheenColorMap:p.sheenRoughnessMap&&(y=p.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),g.uvTransform.value.copy(y.matrix));let b;p.aoMap?b=p.aoMap:p.lightMap&&(b=p.lightMap),b!==void 0&&(b.isWebGLRenderTarget&&(b=b.texture),b.matrixAutoUpdate===!0&&b.updateMatrix(),g.uv2Transform.value.copy(b.matrix))}function s(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity}function o(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function a(g,p,v,y){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*v,g.scale.value=y*.5,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);let b;p.map?b=p.map:p.alphaMap&&(b=p.alphaMap),b!==void 0&&(b.matrixAutoUpdate===!0&&b.updateMatrix(),g.uvTransform.value.copy(b.matrix))}function l(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);let v;p.map?v=p.map:p.alphaMap&&(v=p.alphaMap),v!==void 0&&(v.matrixAutoUpdate===!0&&v.updateMatrix(),g.uvTransform.value.copy(v.matrix))}function h(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function f(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function c(g,p){g.roughness.value=p.roughness,g.metalness.value=p.metalness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap),p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap),e.get(p).envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function u(g,p,v){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap)),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap),p.clearcoatNormalMap&&(g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),g.clearcoatNormalMap.value=p.clearcoatNormalMap,p.side===vi&&g.clearcoatNormalScale.value.negate())),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap)),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap)}function d(g,p){p.matcap&&(g.matcap.value=p.matcap)}function m(g,p){g.referencePosition.value.copy(p.referencePosition),g.nearDistance.value=p.nearDistance,g.farDistance.value=p.farDistance}return{refreshFogUniforms:i,refreshMaterialUniforms:n}}function rw(t,e,i,n){let r={},s={},o=[];const a=i.isWebGL2?t.getParameter(35375):0;function l(y,b){const x=b.program;n.uniformBlockBinding(y,x)}function h(y,b){let x=r[y.id];x===void 0&&(m(y),x=f(y),r[y.id]=x,y.addEventListener("dispose",p));const M=b.program;n.updateUBOMapping(y,M);const w=e.render.frame;s[y.id]!==w&&(u(y),s[y.id]=w)}function f(y){const b=c();y.__bindingPointIndex=b;const x=t.createBuffer(),M=y.__size,w=y.usage;return t.bindBuffer(35345,x),t.bufferData(35345,M,w),t.bindBuffer(35345,null),t.bindBufferBase(35345,b,x),x}function c(){for(let y=0;y<a;y++)if(o.indexOf(y)===-1)return o.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(y){const b=r[y.id],x=y.uniforms,M=y.__cache;t.bindBuffer(35345,b);for(let w=0,T=x.length;w<T;w++){const _=x[w];if(d(_,w,M)===!0){const A=_.value,S=_.__offset;typeof A=="number"?(_.__data[0]=A,t.bufferSubData(35345,S,_.__data)):(_.value.isMatrix3?(_.__data[0]=_.value.elements[0],_.__data[1]=_.value.elements[1],_.__data[2]=_.value.elements[2],_.__data[3]=_.value.elements[0],_.__data[4]=_.value.elements[3],_.__data[5]=_.value.elements[4],_.__data[6]=_.value.elements[5],_.__data[7]=_.value.elements[0],_.__data[8]=_.value.elements[6],_.__data[9]=_.value.elements[7],_.__data[10]=_.value.elements[8],_.__data[11]=_.value.elements[0]):A.toArray(_.__data),t.bufferSubData(35345,S,_.__data))}}t.bindBuffer(35345,null)}function d(y,b,x){const M=y.value;if(x[b]===void 0)return typeof M=="number"?x[b]=M:x[b]=M.clone(),!0;if(typeof M=="number"){if(x[b]!==M)return x[b]=M,!0}else{const w=x[b];if(w.equals(M)===!1)return w.copy(M),!0}return!1}function m(y){const b=y.uniforms;let x=0;const M=16;let w=0;for(let T=0,_=b.length;T<_;T++){const A=b[T],S=g(A);if(A.__data=new Float32Array(S.storage/Float32Array.BYTES_PER_ELEMENT),A.__offset=x,T>0){w=x%M;const D=M-w;w!==0&&D-S.boundary<0&&(x+=M-w,A.__offset=x)}x+=S.storage}return w=x%M,w>0&&(x+=M-w),y.__size=x,y.__cache={},this}function g(y){const b=y.value,x={boundary:0,storage:0};return typeof b=="number"?(x.boundary=4,x.storage=4):b.isVector2?(x.boundary=8,x.storage=8):b.isVector3||b.isColor?(x.boundary=16,x.storage=12):b.isVector4?(x.boundary=16,x.storage=16):b.isMatrix3?(x.boundary=48,x.storage=48):b.isMatrix4?(x.boundary=64,x.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),x}function p(y){const b=y.target;b.removeEventListener("dispose",p);const x=o.indexOf(b.__bindingPointIndex);o.splice(x,1),t.deleteBuffer(r[b.id]),delete r[b.id],delete s[b.id]}function v(){for(const y in r)t.deleteBuffer(r[y]);o=[],r={},s={}}return{bind:l,update:h,dispose:v}}function sw(){const t=za("canvas");return t.style.display="block",t}function _m(t={}){this.isWebGLRenderer=!0;const e=t.canvas!==void 0?t.canvas:sw(),i=t.context!==void 0?t.context:null,n=t.depth!==void 0?t.depth:!0,r=t.stencil!==void 0?t.stencil:!0,s=t.antialias!==void 0?t.antialias:!1,o=t.premultipliedAlpha!==void 0?t.premultipliedAlpha:!0,a=t.preserveDrawingBuffer!==void 0?t.preserveDrawingBuffer:!1,l=t.powerPreference!==void 0?t.powerPreference:"default",h=t.failIfMajorPerformanceCaveat!==void 0?t.failIfMajorPerformanceCaveat:!1;let f;i!==null?f=i.getContextAttributes().alpha:f=t.alpha!==void 0?t.alpha:!1;let c=null,u=null;const d=[],m=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=ln,this.physicallyCorrectLights=!1,this.toneMapping=Cn,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});const g=this;let p=!1,v=0,y=0,b=null,x=-1,M=null;const w=new tt,T=new tt;let _=null,A=e.width,S=e.height,D=1,O=null,z=null;const I=new tt(0,0,A,S),H=new tt(0,0,A,S);let ee=!1;const G=new Bh;let B=!1,N=!1,R=null;const k=new Ye,F=new Z,U=new E,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ie(){return b===null?D:1}let V=i;function K(L,$){for(let oe=0;oe<L.length;oe++){const X=L[oe],ce=e.getContext(X,$);if(ce!==null)return ce}return null}try{const L={alpha:!0,depth:n,stencil:r,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:a,powerPreference:l,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Oh}`),e.addEventListener("webglcontextlost",je,!1),e.addEventListener("webglcontextrestored",nt,!1),e.addEventListener("webglcontextcreationerror",_t,!1),V===null){const $=["webgl2","webgl","experimental-webgl"];if(g.isWebGL1Renderer===!0&&$.shift(),V=K($,L),V===null)throw K($)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}V.getShaderPrecisionFormat===void 0&&(V.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(L){throw console.error("THREE.WebGLRenderer: "+L.message),L}let Y,J,Q,he,de,ae,ve,pe,me,De,Se,Me,vt,Ue,P,C,re,fe,ye,we,Ve,ne,Ie,_e;function Ce(){Y=new g1(V),J=new h1(V,Y,t),Y.init(J),ne=new Kb(V,Y,J),Q=new Zb(V,Y,J),he=new x1,de=new Nb,ae=new Jb(V,Y,Q,de,J,ne,he),ve=new d1(g),pe=new m1(g),me=new Py(V,J),Ie=new l1(V,Y,me,J),De=new v1(V,me,he,Ie),Se=new S1(V,De,me,he),ye=new w1(V,J,ae),C=new u1(de),Me=new zb(g,ve,pe,Y,J,Ie,C),vt=new nw(g,de),Ue=new Bb,P=new Wb(Y,J),fe=new a1(g,ve,Q,Se,f,o),re=new $b(g,Se,J),_e=new rw(V,he,J,Q),we=new c1(V,Y,he,J),Ve=new y1(V,Y,he,J),he.programs=Me.programs,g.capabilities=J,g.extensions=Y,g.properties=de,g.renderLists=Ue,g.shadowMap=re,g.state=Q,g.info=he}Ce();const Ae=new iw(g,V);this.xr=Ae,this.getContext=function(){return V},this.getContextAttributes=function(){return V.getContextAttributes()},this.forceContextLoss=function(){const L=Y.get("WEBGL_lose_context");L&&L.loseContext()},this.forceContextRestore=function(){const L=Y.get("WEBGL_lose_context");L&&L.restoreContext()},this.getPixelRatio=function(){return D},this.setPixelRatio=function(L){L!==void 0&&(D=L,this.setSize(A,S,!1))},this.getSize=function(L){return L.set(A,S)},this.setSize=function(L,$,oe){if(Ae.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}A=L,S=$,e.width=Math.floor(L*D),e.height=Math.floor($*D),oe!==!1&&(e.style.width=L+"px",e.style.height=$+"px"),this.setViewport(0,0,L,$)},this.getDrawingBufferSize=function(L){return L.set(A*D,S*D).floor()},this.setDrawingBufferSize=function(L,$,oe){A=L,S=$,D=oe,e.width=Math.floor(L*oe),e.height=Math.floor($*oe),this.setViewport(0,0,L,$)},this.getCurrentViewport=function(L){return L.copy(w)},this.getViewport=function(L){return L.copy(I)},this.setViewport=function(L,$,oe,X){L.isVector4?I.set(L.x,L.y,L.z,L.w):I.set(L,$,oe,X),Q.viewport(w.copy(I).multiplyScalar(D).floor())},this.getScissor=function(L){return L.copy(H)},this.setScissor=function(L,$,oe,X){L.isVector4?H.set(L.x,L.y,L.z,L.w):H.set(L,$,oe,X),Q.scissor(T.copy(H).multiplyScalar(D).floor())},this.getScissorTest=function(){return ee},this.setScissorTest=function(L){Q.setScissorTest(ee=L)},this.setOpaqueSort=function(L){O=L},this.setTransparentSort=function(L){z=L},this.getClearColor=function(L){return L.copy(fe.getClearColor())},this.setClearColor=function(){fe.setClearColor.apply(fe,arguments)},this.getClearAlpha=function(){return fe.getClearAlpha()},this.setClearAlpha=function(){fe.setClearAlpha.apply(fe,arguments)},this.clear=function(L=!0,$=!0,oe=!0){let X=0;L&&(X|=16384),$&&(X|=256),oe&&(X|=1024),V.clear(X)},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(){e.removeEventListener("webglcontextlost",je,!1),e.removeEventListener("webglcontextrestored",nt,!1),e.removeEventListener("webglcontextcreationerror",_t,!1),Ue.dispose(),P.dispose(),de.dispose(),ve.dispose(),pe.dispose(),Se.dispose(),Ie.dispose(),_e.dispose(),Me.dispose(),Ae.dispose(),Ae.removeEventListener("sessionstart",xe),Ae.removeEventListener("sessionend",Oe),R&&(R.dispose(),R=null),ze.stop()};function je(L){L.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),p=!0}function nt(){console.log("THREE.WebGLRenderer: Context Restored."),p=!1;const L=he.autoReset,$=re.enabled,oe=re.autoUpdate,X=re.needsUpdate,ce=re.type;Ce(),he.autoReset=L,re.enabled=$,re.autoUpdate=oe,re.needsUpdate=X,re.type=ce}function _t(L){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",L.statusMessage)}function j(L){const $=L.target;$.removeEventListener("dispose",j),Te($)}function Te(L){se(L),de.remove(L)}function se(L){const $=de.get(L).programs;$!==void 0&&($.forEach(function(oe){Me.releaseProgram(oe)}),L.isShaderMaterial&&Me.releaseShaderCache(L))}this.renderBufferDirect=function(L,$,oe,X,ce,Fe){$===null&&($=W);const qe=ce.isMesh&&ce.matrixWorld.determinant()<0,Je=hi(L,$,oe,X,ce);Q.setMaterial(X,qe);let $e=oe.index;const ht=oe.attributes.position;if($e===null){if(ht===void 0||ht.count===0)return}else if($e.count===0)return;let st=1;X.wireframe===!0&&($e=De.getWireframeAttribute(oe),st=2),Ie.setup(ce,X,Je,oe,$e);let ot,Lt=we;$e!==null&&(ot=me.get($e),Lt=Ve,Lt.setIndex(ot));const hr=$e!==null?$e.count:ht.count,Wr=oe.drawRange.start*st,jr=oe.drawRange.count*st,Yi=Fe!==null?Fe.start*st:0,lt=Fe!==null?Fe.count*st:1/0,qr=Math.max(Wr,Yi),Nt=Math.min(hr,Wr+jr,Yi+lt)-1,_i=Math.max(0,Nt-qr+1);if(_i!==0){if(ce.isMesh)X.wireframe===!0?(Q.setLineWidth(X.wireframeLinewidth*ie()),Lt.setMode(1)):Lt.setMode(4);else if(ce.isLine){let Nn=X.linewidth;Nn===void 0&&(Nn=1),Q.setLineWidth(Nn*ie()),ce.isLineSegments?Lt.setMode(1):ce.isLineLoop?Lt.setMode(2):Lt.setMode(3)}else ce.isPoints?Lt.setMode(0):ce.isSprite&&Lt.setMode(4);if(ce.isInstancedMesh)Lt.renderInstances(qr,_i,ce.count);else if(oe.isInstancedBufferGeometry){const Nn=Math.min(oe.instanceCount,oe._maxInstanceCount);Lt.renderInstances(qr,_i,Nn)}else Lt.render(qr,_i)}},this.compile=function(L,$){function oe(X,ce,Fe){X.transparent===!0&&X.side===An?(X.side=vi,X.needsUpdate=!0,ft(X,ce,Fe),X.side=Or,X.needsUpdate=!0,ft(X,ce,Fe),X.side=An):ft(X,ce,Fe)}u=P.get(L),u.init(),m.push(u),L.traverseVisible(function(X){X.isLight&&X.layers.test($.layers)&&(u.pushLight(X),X.castShadow&&u.pushShadow(X))}),u.setupLights(g.physicallyCorrectLights),L.traverse(function(X){const ce=X.material;if(ce)if(Array.isArray(ce))for(let Fe=0;Fe<ce.length;Fe++){const qe=ce[Fe];oe(qe,L,X)}else oe(ce,L,X)}),m.pop(),u=null};let be=null;function ue(L){be&&be(L)}function xe(){ze.stop()}function Oe(){ze.start()}const ze=new mm;ze.setAnimationLoop(ue),typeof self<"u"&&ze.setContext(self),this.setAnimationLoop=function(L){be=L,Ae.setAnimationLoop(L),L===null?ze.stop():ze.start()},Ae.addEventListener("sessionstart",xe),Ae.addEventListener("sessionend",Oe),this.render=function(L,$){if($!==void 0&&$.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(p===!0)return;L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),$.parent===null&&$.matrixWorldAutoUpdate===!0&&$.updateMatrixWorld(),Ae.enabled===!0&&Ae.isPresenting===!0&&(Ae.cameraAutoUpdate===!0&&Ae.updateCamera($),$=Ae.getCamera()),L.isScene===!0&&L.onBeforeRender(g,L,$,b),u=P.get(L,m.length),u.init(),m.push(u),k.multiplyMatrices($.projectionMatrix,$.matrixWorldInverse),G.setFromProjectionMatrix(k),N=this.localClippingEnabled,B=C.init(this.clippingPlanes,N,$),c=Ue.get(L,d.length),c.init(),d.push(c),Ze(L,$,0,g.sortObjects),c.finish(),g.sortObjects===!0&&c.sort(O,z),B===!0&&C.beginShadows();const oe=u.state.shadowsArray;if(re.render(oe,L,$),B===!0&&C.endShadows(),this.info.autoReset===!0&&this.info.reset(),fe.render(c,L),u.setupLights(g.physicallyCorrectLights),$.isArrayCamera){const X=$.cameras;for(let ce=0,Fe=X.length;ce<Fe;ce++){const qe=X[ce];He(c,L,qe,qe.viewport)}}else He(c,L,$);b!==null&&(ae.updateMultisampleRenderTarget(b),ae.updateRenderTargetMipmap(b)),L.isScene===!0&&L.onAfterRender(g,L,$),Ie.resetDefaultState(),x=-1,M=null,m.pop(),m.length>0?u=m[m.length-1]:u=null,d.pop(),d.length>0?c=d[d.length-1]:c=null};function Ze(L,$,oe,X){if(L.visible===!1)return;if(L.layers.test($.layers)){if(L.isGroup)oe=L.renderOrder;else if(L.isLOD)L.autoUpdate===!0&&L.update($);else if(L.isLight)u.pushLight(L),L.castShadow&&u.pushShadow(L);else if(L.isSprite){if(!L.frustumCulled||G.intersectsSprite(L)){X&&U.setFromMatrixPosition(L.matrixWorld).applyMatrix4(k);const qe=Se.update(L),Je=L.material;Je.visible&&c.push(L,qe,Je,oe,U.z,null)}}else if((L.isMesh||L.isLine||L.isPoints)&&(L.isSkinnedMesh&&L.skeleton.frame!==he.render.frame&&(L.skeleton.update(),L.skeleton.frame=he.render.frame),!L.frustumCulled||G.intersectsObject(L))){X&&U.setFromMatrixPosition(L.matrixWorld).applyMatrix4(k);const qe=Se.update(L),Je=L.material;if(Array.isArray(Je)){const $e=qe.groups;for(let ht=0,st=$e.length;ht<st;ht++){const ot=$e[ht],Lt=Je[ot.materialIndex];Lt&&Lt.visible&&c.push(L,qe,Lt,oe,U.z,ot)}}else Je.visible&&c.push(L,qe,Je,oe,U.z,null)}}const Fe=L.children;for(let qe=0,Je=Fe.length;qe<Je;qe++)Ze(Fe[qe],$,oe,X)}function He(L,$,oe,X){const ce=L.opaque,Fe=L.transmissive,qe=L.transparent;u.setupLightsView(oe),Fe.length>0&&rt(ce,$,oe),X&&Q.viewport(w.copy(X)),ce.length>0&&Qe(ce,$,oe),Fe.length>0&&Qe(Fe,$,oe),qe.length>0&&Qe(qe,$,oe),Q.buffers.depth.setTest(!0),Q.buffers.depth.setMask(!0),Q.buffers.color.setMask(!0),Q.setPolygonOffset(!1)}function rt(L,$,oe){const X=J.isWebGL2;R===null&&(R=new Nr(1,1,{generateMipmaps:!0,type:Y.has("EXT_color_buffer_half_float")?yo:zr,minFilter:il,samples:X&&s===!0?4:0})),g.getDrawingBufferSize(F),X?R.setSize(F.x,F.y):R.setSize(Ia(F.x),Ia(F.y));const ce=g.getRenderTarget();g.setRenderTarget(R),g.clear();const Fe=g.toneMapping;g.toneMapping=Cn,Qe(L,$,oe),g.toneMapping=Fe,ae.updateMultisampleRenderTarget(R),ae.updateRenderTargetMipmap(R),g.setRenderTarget(ce)}function Qe(L,$,oe){const X=$.isScene===!0?$.overrideMaterial:null;for(let ce=0,Fe=L.length;ce<Fe;ce++){const qe=L[ce],Je=qe.object,$e=qe.geometry,ht=X===null?qe.material:X,st=qe.group;Je.layers.test(oe.layers)&&bt(Je,$,oe,$e,ht,st)}}function bt(L,$,oe,X,ce,Fe){L.onBeforeRender(g,$,oe,X,ce,Fe),L.modelViewMatrix.multiplyMatrices(oe.matrixWorldInverse,L.matrixWorld),L.normalMatrix.getNormalMatrix(L.modelViewMatrix),ce.onBeforeRender(g,$,oe,X,L,Fe),ce.transparent===!0&&ce.side===An?(ce.side=vi,ce.needsUpdate=!0,g.renderBufferDirect(oe,$,X,ce,L,Fe),ce.side=Or,ce.needsUpdate=!0,g.renderBufferDirect(oe,$,X,ce,L,Fe),ce.side=An):g.renderBufferDirect(oe,$,X,ce,L,Fe),L.onAfterRender(g,$,oe,X,ce,Fe)}function ft(L,$,oe){$.isScene!==!0&&($=W);const X=de.get(L),ce=u.state.lights,Fe=u.state.shadowsArray,qe=ce.state.version,Je=Me.getParameters(L,ce.state,Fe,$,oe),$e=Me.getProgramCacheKey(Je);let ht=X.programs;X.environment=L.isMeshStandardMaterial?$.environment:null,X.fog=$.fog,X.envMap=(L.isMeshStandardMaterial?pe:ve).get(L.envMap||X.environment),ht===void 0&&(L.addEventListener("dispose",j),ht=new Map,X.programs=ht);let st=ht.get($e);if(st!==void 0){if(X.currentProgram===st&&X.lightsStateVersion===qe)return Bt(L,Je),st}else Je.uniforms=Me.getUniforms(L),L.onBuild(oe,Je,g),L.onBeforeCompile(Je,g),st=Me.acquireProgram(Je,$e),ht.set($e,st),X.uniforms=Je.uniforms;const ot=X.uniforms;(!L.isShaderMaterial&&!L.isRawShaderMaterial||L.clipping===!0)&&(ot.clippingPlanes=C.uniform),Bt(L,Je),X.needsLights=zn(L),X.lightsStateVersion=qe,X.needsLights&&(ot.ambientLightColor.value=ce.state.ambient,ot.lightProbe.value=ce.state.probe,ot.directionalLights.value=ce.state.directional,ot.directionalLightShadows.value=ce.state.directionalShadow,ot.spotLights.value=ce.state.spot,ot.spotLightShadows.value=ce.state.spotShadow,ot.rectAreaLights.value=ce.state.rectArea,ot.ltc_1.value=ce.state.rectAreaLTC1,ot.ltc_2.value=ce.state.rectAreaLTC2,ot.pointLights.value=ce.state.point,ot.pointLightShadows.value=ce.state.pointShadow,ot.hemisphereLights.value=ce.state.hemi,ot.directionalShadowMap.value=ce.state.directionalShadowMap,ot.directionalShadowMatrix.value=ce.state.directionalShadowMatrix,ot.spotShadowMap.value=ce.state.spotShadowMap,ot.spotLightMatrix.value=ce.state.spotLightMatrix,ot.spotLightMap.value=ce.state.spotLightMap,ot.pointShadowMap.value=ce.state.pointShadowMap,ot.pointShadowMatrix.value=ce.state.pointShadowMatrix);const Lt=st.getUniforms(),hr=Ca.seqWithValue(Lt.seq,ot);return X.currentProgram=st,X.uniformsList=hr,st}function Bt(L,$){const oe=de.get(L);oe.outputEncoding=$.outputEncoding,oe.instancing=$.instancing,oe.skinning=$.skinning,oe.morphTargets=$.morphTargets,oe.morphNormals=$.morphNormals,oe.morphColors=$.morphColors,oe.morphTargetsCount=$.morphTargetsCount,oe.numClippingPlanes=$.numClippingPlanes,oe.numIntersection=$.numClipIntersection,oe.vertexAlphas=$.vertexAlphas,oe.vertexTangents=$.vertexTangents,oe.toneMapping=$.toneMapping}function hi(L,$,oe,X,ce){$.isScene!==!0&&($=W),ae.resetTextureUnits();const Fe=$.fog,qe=X.isMeshStandardMaterial?$.environment:null,Je=b===null?g.outputEncoding:b.isXRRenderTarget===!0?b.texture.encoding:ln,$e=(X.isMeshStandardMaterial?pe:ve).get(X.envMap||qe),ht=X.vertexColors===!0&&!!oe.attributes.color&&oe.attributes.color.itemSize===4,st=!!X.normalMap&&!!oe.attributes.tangent,ot=!!oe.morphAttributes.position,Lt=!!oe.morphAttributes.normal,hr=!!oe.morphAttributes.color,Wr=X.toneMapped?g.toneMapping:Cn,jr=oe.morphAttributes.position||oe.morphAttributes.normal||oe.morphAttributes.color,Yi=jr!==void 0?jr.length:0,lt=de.get(X),qr=u.state.lights;if(B===!0&&(N===!0||L!==M)){const ui=L===M&&X.id===x;C.setState(X,L,ui)}let Nt=!1;X.version===lt.__version?(lt.needsLights&&lt.lightsStateVersion!==qr.state.version||lt.outputEncoding!==Je||ce.isInstancedMesh&&lt.instancing===!1||!ce.isInstancedMesh&&lt.instancing===!0||ce.isSkinnedMesh&&lt.skinning===!1||!ce.isSkinnedMesh&&lt.skinning===!0||lt.envMap!==$e||X.fog===!0&&lt.fog!==Fe||lt.numClippingPlanes!==void 0&&(lt.numClippingPlanes!==C.numPlanes||lt.numIntersection!==C.numIntersection)||lt.vertexAlphas!==ht||lt.vertexTangents!==st||lt.morphTargets!==ot||lt.morphNormals!==Lt||lt.morphColors!==hr||lt.toneMapping!==Wr||J.isWebGL2===!0&&lt.morphTargetsCount!==Yi)&&(Nt=!0):(Nt=!0,lt.__version=X.version);let _i=lt.currentProgram;Nt===!0&&(_i=ft(X,$,ce));let Nn=!1,js=!1,Al=!1;const Jt=_i.getUniforms(),ur=lt.uniforms;if(Q.useProgram(_i.program)&&(Nn=!0,js=!0,Al=!0),X.id!==x&&(x=X.id,js=!0),Nn||M!==L){if(Jt.setValue(V,"projectionMatrix",L.projectionMatrix),J.logarithmicDepthBuffer&&Jt.setValue(V,"logDepthBufFC",2/(Math.log(L.far+1)/Math.LN2)),M!==L&&(M=L,js=!0,Al=!0),X.isShaderMaterial||X.isMeshPhongMaterial||X.isMeshToonMaterial||X.isMeshStandardMaterial||X.envMap){const ui=Jt.map.cameraPosition;ui!==void 0&&ui.setValue(V,U.setFromMatrixPosition(L.matrixWorld))}(X.isMeshPhongMaterial||X.isMeshToonMaterial||X.isMeshLambertMaterial||X.isMeshBasicMaterial||X.isMeshStandardMaterial||X.isShaderMaterial)&&Jt.setValue(V,"isOrthographic",L.isOrthographicCamera===!0),(X.isMeshPhongMaterial||X.isMeshToonMaterial||X.isMeshLambertMaterial||X.isMeshBasicMaterial||X.isMeshStandardMaterial||X.isShaderMaterial||X.isShadowMaterial||ce.isSkinnedMesh)&&Jt.setValue(V,"viewMatrix",L.matrixWorldInverse)}if(ce.isSkinnedMesh){Jt.setOptional(V,ce,"bindMatrix"),Jt.setOptional(V,ce,"bindMatrixInverse");const ui=ce.skeleton;ui&&(J.floatVertexTextures?(ui.boneTexture===null&&ui.computeBoneTexture(),Jt.setValue(V,"boneTexture",ui.boneTexture,ae),Jt.setValue(V,"boneTextureSize",ui.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Tl=oe.morphAttributes;if((Tl.position!==void 0||Tl.normal!==void 0||Tl.color!==void 0&&J.isWebGL2===!0)&&ye.update(ce,oe,X,_i),(js||lt.receiveShadow!==ce.receiveShadow)&&(lt.receiveShadow=ce.receiveShadow,Jt.setValue(V,"receiveShadow",ce.receiveShadow)),X.isMeshGouraudMaterial&&X.envMap!==null&&(ur.envMap.value=$e,ur.flipEnvMap.value=$e.isCubeTexture&&$e.isRenderTargetTexture===!1?-1:1),js&&(Jt.setValue(V,"toneMappingExposure",g.toneMappingExposure),lt.needsLights&&Zt(ur,Al),Fe&&X.fog===!0&&vt.refreshFogUniforms(ur,Fe),vt.refreshMaterialUniforms(ur,X,D,S,R),Ca.upload(V,lt.uniformsList,ur,ae)),X.isShaderMaterial&&X.uniformsNeedUpdate===!0&&(Ca.upload(V,lt.uniformsList,ur,ae),X.uniformsNeedUpdate=!1),X.isSpriteMaterial&&Jt.setValue(V,"center",ce.center),Jt.setValue(V,"modelViewMatrix",ce.modelViewMatrix),Jt.setValue(V,"normalMatrix",ce.normalMatrix),Jt.setValue(V,"modelMatrix",ce.matrixWorld),X.isShaderMaterial||X.isRawShaderMaterial){const ui=X.uniformsGroups;for(let El=0,K0=ui.length;El<K0;El++)if(J.isWebGL2){const Eu=ui[El];_e.update(Eu,_i),_e.bind(Eu,_i)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return _i}function Zt(L,$){L.ambientLightColor.needsUpdate=$,L.lightProbe.needsUpdate=$,L.directionalLights.needsUpdate=$,L.directionalLightShadows.needsUpdate=$,L.pointLights.needsUpdate=$,L.pointLightShadows.needsUpdate=$,L.spotLights.needsUpdate=$,L.spotLightShadows.needsUpdate=$,L.rectAreaLights.needsUpdate=$,L.hemisphereLights.needsUpdate=$}function zn(L){return L.isMeshLambertMaterial||L.isMeshToonMaterial||L.isMeshPhongMaterial||L.isMeshStandardMaterial||L.isShadowMaterial||L.isShaderMaterial&&L.lights===!0}this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(L,$,oe){de.get(L.texture).__webglTexture=$,de.get(L.depthTexture).__webglTexture=oe;const X=de.get(L);X.__hasExternalTextures=!0,X.__hasExternalTextures&&(X.__autoAllocateDepthBuffer=oe===void 0,X.__autoAllocateDepthBuffer||Y.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),X.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(L,$){const oe=de.get(L);oe.__webglFramebuffer=$,oe.__useDefaultFramebuffer=$===void 0},this.setRenderTarget=function(L,$=0,oe=0){b=L,v=$,y=oe;let X=!0;if(L){const $e=de.get(L);$e.__useDefaultFramebuffer!==void 0?(Q.bindFramebuffer(36160,null),X=!1):$e.__webglFramebuffer===void 0?ae.setupRenderTarget(L):$e.__hasExternalTextures&&ae.rebindTextures(L,de.get(L.texture).__webglTexture,de.get(L.depthTexture).__webglTexture)}let ce=null,Fe=!1,qe=!1;if(L){const $e=L.texture;($e.isData3DTexture||$e.isDataArrayTexture)&&(qe=!0);const ht=de.get(L).__webglFramebuffer;
3112L.isWebGLCubeRenderTarget?(ce=ht[$],Fe=!0):J.isWebGL2&&L.samples>0&&ae.useMultisampledRTT(L)===!1?ce=de.get(L).__webglMultisampledFramebuffer:ce=ht,w.copy(L.viewport),T.copy(L.scissor),_=L.scissorTest}else w.copy(I).multiplyScalar(D).floor(),T.copy(H).multiplyScalar(D).floor(),_=ee;if(Q.bindFramebuffer(36160,ce)&&J.drawBuffers&&X&&Q.drawBuffers(L,ce),Q.viewport(w),Q.scissor(T),Q.setScissorTest(_),Fe){const $e=de.get(L.texture);V.framebufferTexture2D(36160,36064,34069+$,$e.__webglTexture,oe)}else if(qe){const $e=de.get(L.texture),ht=$||0;V.framebufferTextureLayer(36160,36064,$e.__webglTexture,oe||0,ht)}x=-1},this.readRenderTargetPixels=function(L,$,oe,X,ce,Fe,qe){if(!(L&&L.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Je=de.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&qe!==void 0&&(Je=Je[qe]),Je){Q.bindFramebuffer(36160,Je);try{const $e=L.texture,ht=$e.format,st=$e.type;if(ht!==nn&&ne.convert(ht)!==V.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ot=st===yo&&(Y.has("EXT_color_buffer_half_float")||J.isWebGL2&&Y.has("EXT_color_buffer_float"));if(st!==zr&&ne.convert(st)!==V.getParameter(35738)&&!(st===Sr&&(J.isWebGL2||Y.has("OES_texture_float")||Y.has("WEBGL_color_buffer_float")))&&!ot){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}$>=0&&$<=L.width-X&&oe>=0&&oe<=L.height-ce&&V.readPixels($,oe,X,ce,ne.convert(ht),ne.convert(st),Fe)}finally{const $e=b!==null?de.get(b).__webglFramebuffer:null;Q.bindFramebuffer(36160,$e)}}},this.copyFramebufferToTexture=function(L,$,oe=0){const X=Math.pow(2,-oe),ce=Math.floor($.image.width*X),Fe=Math.floor($.image.height*X);ae.setTexture2D($,0),V.copyTexSubImage2D(3553,oe,0,0,L.x,L.y,ce,Fe),Q.unbindTexture()},this.copyTextureToTexture=function(L,$,oe,X=0){const ce=$.image.width,Fe=$.image.height,qe=ne.convert(oe.format),Je=ne.convert(oe.type);ae.setTexture2D(oe,0),V.pixelStorei(37440,oe.flipY),V.pixelStorei(37441,oe.premultiplyAlpha),V.pixelStorei(3317,oe.unpackAlignment),$.isDataTexture?V.texSubImage2D(3553,X,L.x,L.y,ce,Fe,qe,Je,$.image.data):$.isCompressedTexture?V.compressedTexSubImage2D(3553,X,L.x,L.y,$.mipmaps[0].width,$.mipmaps[0].height,qe,$.mipmaps[0].data):V.texSubImage2D(3553,X,L.x,L.y,qe,Je,$.image),X===0&&oe.generateMipmaps&&V.generateMipmap(3553),Q.unbindTexture()},this.copyTextureToTexture3D=function(L,$,oe,X,ce=0){if(g.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Fe=L.max.x-L.min.x+1,qe=L.max.y-L.min.y+1,Je=L.max.z-L.min.z+1,$e=ne.convert(X.format),ht=ne.convert(X.type);let st;if(X.isData3DTexture)ae.setTexture3D(X,0),st=32879;else if(X.isDataArrayTexture)ae.setTexture2DArray(X,0),st=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}V.pixelStorei(37440,X.flipY),V.pixelStorei(37441,X.premultiplyAlpha),V.pixelStorei(3317,X.unpackAlignment);const ot=V.getParameter(3314),Lt=V.getParameter(32878),hr=V.getParameter(3316),Wr=V.getParameter(3315),jr=V.getParameter(32877),Yi=oe.isCompressedTexture?oe.mipmaps[0]:oe.image;V.pixelStorei(3314,Yi.width),V.pixelStorei(32878,Yi.height),V.pixelStorei(3316,L.min.x),V.pixelStorei(3315,L.min.y),V.pixelStorei(32877,L.min.z),oe.isDataTexture||oe.isData3DTexture?V.texSubImage3D(st,ce,$.x,$.y,$.z,Fe,qe,Je,$e,ht,Yi.data):oe.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),V.compressedTexSubImage3D(st,ce,$.x,$.y,$.z,Fe,qe,Je,$e,Yi.data)):V.texSubImage3D(st,ce,$.x,$.y,$.z,Fe,qe,Je,$e,ht,Yi),V.pixelStorei(3314,ot),V.pixelStorei(32878,Lt),V.pixelStorei(3316,hr),V.pixelStorei(3315,Wr),V.pixelStorei(32877,jr),ce===0&&X.generateMipmaps&&V.generateMipmap(st),Q.unbindTexture()},this.initTexture=function(L){L.isCubeTexture?ae.setTextureCube(L,0):L.isData3DTexture?ae.setTexture3D(L,0):L.isDataArrayTexture?ae.setTexture2DArray(L,0):ae.setTexture2D(L,0),Q.unbindTexture()},this.resetState=function(){v=0,y=0,b=null,Q.reset(),Ie.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class ow extends _m{}ow.prototype.isWebGL1Renderer=!0;class kh{constructor(e,i=1,n=1e3){this.isFog=!0,this.name="",this.color=new Xe(e),this.near=i,this.far=n}clone(){return new kh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class bm extends gt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,i){return super.copy(e,i),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const i=super.toJSON(e);return this.fog!==null&&(i.object.fog=this.fog.toJSON()),i}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class aw{constructor(e,i){this.isInterleavedBuffer=!0,this.array=e,this.stride=i,this.count=e!==void 0?e.length/i:0,this.usage=Bc,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=on()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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,i,n){e*=this.stride,n*=i.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=i.array[n+r];return this}set(e,i=0){return this.array.set(e,i),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=on()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const i=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(i,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=on()),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}}}
vendor: 13,650 bytes, line 3112
3112const Kt=new E;class Na{constructor(e,i,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=i,this.offset=n,this.normalized=r===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let i=0,n=this.data.count;i<n;i++)Kt.fromBufferAttribute(this,i),Kt.applyMatrix4(e),this.setXYZ(i,Kt.x,Kt.y,Kt.z);return this}applyNormalMatrix(e){for(let i=0,n=this.count;i<n;i++)Kt.fromBufferAttribute(this,i),Kt.applyNormalMatrix(e),this.setXYZ(i,Kt.x,Kt.y,Kt.z);return this}transformDirection(e){for(let i=0,n=this.count;i<n;i++)Kt.fromBufferAttribute(this,i),Kt.transformDirection(e),this.setXYZ(i,Kt.x,Kt.y,Kt.z);return this}setX(e,i){return this.normalized&&(i=yt(i,this.array)),this.data.array[e*this.data.stride+this.offset]=i,this}setY(e,i){return this.normalized&&(i=yt(i,this.array)),this.data.array[e*this.data.stride+this.offset+1]=i,this}setZ(e,i){return this.normalized&&(i=yt(i,this.array)),this.data.array[e*this.data.stride+this.offset+2]=i,this}setW(e,i){return this.normalized&&(i=yt(i,this.array)),this.data.array[e*this.data.stride+this.offset+3]=i,this}getX(e){let i=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(i=Tn(i,this.array)),i}getY(e){let i=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(i=Tn(i,this.array)),i}getZ(e){let i=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(i=Tn(i,this.array)),i}getW(e){let i=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(i=Tn(i,this.array)),i}setXY(e,i,n){return e=e*this.data.stride+this.offset,this.normalized&&(i=yt(i,this.array),n=yt(n,this.array)),this.data.array[e+0]=i,this.data.array[e+1]=n,this}setXYZ(e,i,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(i=yt(i,this.array),n=yt(n,this.array),r=yt(r,this.array)),this.data.array[e+0]=i,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,i,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(i=yt(i,this.array),n=yt(n,this.array),r=yt(r,this.array),s=yt(s,this.array)),this.data.array[e+0]=i,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.");const i=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)i.push(this.data.array[r+s])}return new it(new this.array.constructor(i),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 Na(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.");const i=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)i.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:i,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}}}class lw extends it{constructor(e,i,n,r=1){super(e,i,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}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}}class kr extends Do{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Xe(16777215),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.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Bd=new E,Fd=new E,kd=new Ye,rc=new Rs,ha=new cn;class Gc extends gt{constructor(e=new We,i=new kr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=i,this.updateMorphTargets()}copy(e,i){return super.copy(e,i),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const i=e.attributes.position,n=[0];for(let r=1,s=i.count;r<s;r++)Bd.fromBufferAttribute(i,r-1),Fd.fromBufferAttribute(i,r),n[r]=n[r-1],n[r]+=Bd.distanceTo(Fd);e.setAttribute("lineDistance",new Pe(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,i){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ha.copy(n.boundingSphere),ha.applyMatrix4(r),ha.radius+=s,e.ray.intersectsSphere(ha)===!1)return;kd.copy(r).invert(),rc.copy(e.ray).applyMatrix4(kd);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,h=new E,f=new E,c=new E,u=new E,d=this.isLineSegments?2:1,m=n.index,p=n.attributes.position;if(m!==null){const v=Math.max(0,o.start),y=Math.min(m.count,o.start+o.count);for(let b=v,x=y-1;b<x;b+=d){const M=m.getX(b),w=m.getX(b+1);if(h.fromBufferAttribute(p,M),f.fromBufferAttribute(p,w),rc.distanceSqToSegment(h,f,u,c)>l)continue;u.applyMatrix4(this.matrixWorld);const _=e.ray.origin.distanceTo(u);_<e.near||_>e.far||i.push({distance:_,point:c.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else{const v=Math.max(0,o.start),y=Math.min(p.count,o.start+o.count);for(let b=v,x=y-1;b<x;b+=d){if(h.fromBufferAttribute(p,b),f.fromBufferAttribute(p,b+1),rc.distanceSqToSegment(h,f,u,c)>l)continue;u.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(u);w<e.near||w>e.far||i.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const i=this.geometry.morphAttributes,n=Object.keys(i);if(n.length>0){const r=i[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}const Vd=new E,Gd=new E;class Io extends Gc{constructor(e,i){super(e,i),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const i=e.attributes.position,n=[];for(let r=0,s=i.count;r<s;r+=2)Vd.fromBufferAttribute(i,r),Gd.fromBufferAttribute(i,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Vd.distanceTo(Gd);e.setAttribute("lineDistance",new Pe(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class dn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,i){const n=this.getUtoTmapping(e);return this.getPoint(n,i)}getPoints(e=5){const i=[];for(let n=0;n<=e;n++)i.push(this.getPoint(n/e));return i}getSpacedPoints(e=5){const i=[];for(let n=0;n<=e;n++)i.push(this.getPointAt(n/e));return i}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 i=[];let n,r=this.getPoint(0),s=0;i.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),i.push(s),r=n;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,i){const n=this.getLengths();let r=0;const s=n.length;let o;i?o=i:o=e*n[s-1];let a=0,l=s-1,h;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),h=n[r]-o,h<0)a=r+1;else if(h>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);const f=n[r],u=n[r+1]-f,d=(o-f)/u;return(r+d)/(s-1)}getTangent(e,i){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=i||(o.isVector2?new Z:new E);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,i){const n=this.getUtoTmapping(e);return this.getTangent(n,i)}computeFrenetFrames(e,i){const n=new E,r=[],s=[],o=[],a=new E,l=new Ye;for(let d=0;d<=e;d++){const m=d/e;r[d]=this.getTangentAt(m,new E)}s[0]=new E,o[0]=new E;let h=Number.MAX_VALUE;const f=Math.abs(r[0].x),c=Math.abs(r[0].y),u=Math.abs(r[0].z);f<=h&&(h=f,n.set(1,0,0)),c<=h&&(h=c,n.set(0,1,0)),u<=h&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(r[d-1],r[d]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(Ht(r[d-1].dot(r[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,m))}o[d].crossVectors(r[d],s[d])}if(i===!0){let d=Math.acos(Ht(s[0].dot(s[e]),-1,1));d/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(r[m],d*m)),o[m].crossVectors(r[m],s[m])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class sl extends dn{constructor(e=0,i=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=i,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,i){const n=i||new Z,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),h=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const f=Math.cos(this.aRotation),c=Math.sin(this.aRotation),u=l-this.aX,d=h-this.aY;l=u*f-d*c+this.aX,h=u*c+d*f+this.aY}return n.set(l,h)}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 cw extends sl{constructor(e,i,n,r,s,o){super(e,i,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function Vh(){let t=0,e=0,i=0,n=0;function r(s,o,a,l){t=s,e=a,i=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,h){r(o,a,h*(a-s),h*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,h,f,c){let u=(o-s)/h-(a-s)/(h+f)+(a-o)/f,d=(a-o)/f-(l-o)/(f+c)+(l-a)/c;u*=f,d*=f,r(o,a,u,d)},calc:function(s){const o=s*s,a=o*s;return t+e*s+i*o+n*a}}}const ua=new E,sc=new Vh,oc=new Vh,ac=new Vh;class hw extends dn{constructor(e=[],i=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=i,this.curveType=n,this.tension=r}getPoint(e,i=new E){const n=i,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let h,f;this.closed||a>0?h=r[(a-1)%s]:(ua.subVectors(r[0],r[1]).add(r[0]),h=ua);const c=r[a%s],u=r[(a+1)%s];if(this.closed||a+2<s?f=r[(a+2)%s]:(ua.subVectors(r[s-1],r[s-2]).add(r[s-1]),f=ua),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let m=Math.pow(h.distanceToSquared(c),d),g=Math.pow(c.distanceToSquared(u),d),p=Math.pow(u.distanceToSquared(f),d);g<1e-4&&(g=1),m<1e-4&&(m=g),p<1e-4&&(p=g),sc.initNonuniformCatmullRom(h.x,c.x,u.x,f.x,m,g,p),oc.initNonuniformCatmullRom(h.y,c.y,u.y,f.y,m,g,p),ac.initNonuniformCatmullRom(h.z,c.z,u.z,f.z,m,g,p)}else this.curveType==="catmullrom"&&(sc.initCatmullRom(h.x,c.x,u.x,f.x,this.tension),oc.initCatmullRom(h.y,c.y,u.y,f.y,this.tension),ac.initCatmullRom(h.z,c.z,u.z,f.z,this.tension));return n.set(sc.calc(l),oc.calc(l),ac.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let i=0,n=e.points.length;i<n;i++){const r=e.points[i];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let i=0,n=this.points.length;i<n;i++){const r=this.points[i];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let i=0,n=e.points.length;i<n;i++){const r=e.points[i];this.points.push(new E().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Hd(t,e,i,n,r){const s=(n-e)*.5,o=(r-i)*.5,a=t*t,l=t*a;return(2*i-2*n+s+o)*l+(-3*i+3*n-2*s-o)*a+s*t+i}function uw(t,e){const i=1-t;return i*i*e}function dw(t,e){return 2*(1-t)*t*e}function fw(t,e){return t*t*e}
vendor: 6,133 bytes, line 3112
3112function fo(t,e,i,n){return uw(t,e)+dw(t,i)+fw(t,n)}function pw(t,e){const i=1-t;return i*i*i*e}function mw(t,e){const i=1-t;return 3*i*i*t*e}function gw(t,e){return 3*(1-t)*t*t*e}function vw(t,e){return t*t*t*e}function po(t,e,i,n,r){return pw(t,e)+mw(t,i)+gw(t,n)+vw(t,r)}class Gi extends dn{constructor(e=new Z,i=new Z,n=new Z,r=new Z){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=i,this.v2=n,this.v3=r}getPoint(e,i=new Z){const n=i,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(po(e,r.x,s.x,o.x,a.x),po(e,r.y,s.y,o.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.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 yw extends dn{constructor(e=new E,i=new E,n=new E,r=new E){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=i,this.v2=n,this.v3=r}getPoint(e,i=new E){const n=i,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(po(e,r.x,s.x,o.x,a.x),po(e,r.y,s.y,o.y,a.y),po(e,r.z,s.z,o.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.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 Wi extends dn{constructor(e=new Z,i=new Z){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=i}getPoint(e,i=new Z){const n=i;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,i){return this.getPoint(e,i)}getTangent(e,i){const n=i||new Z;return n.copy(this.v2).sub(this.v1).normalize(),n}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 wm extends dn{constructor(e=new E,i=new E){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=i}getPoint(e,i=new E){const n=i;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,i){return this.getPoint(e,i)}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 sr extends dn{constructor(e=new Z,i=new Z,n=new Z){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=i,this.v2=n}getPoint(e,i=new Z){const n=i,r=this.v0,s=this.v1,o=this.v2;return n.set(fo(e,r.x,s.x,o.x),fo(e,r.y,s.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}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 xw extends dn{constructor(e=new E,i=new E,n=new E){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=i,this.v2=n}getPoint(e,i=new E){const n=i,r=this.v0,s=this.v1,o=this.v2;return n.set(fo(e,r.x,s.x,o.x),fo(e,r.y,s.y,o.y),fo(e,r.z,s.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}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 Gh extends dn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,i=new Z){const n=i,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],h=r[o],f=r[o>r.length-2?r.length-1:o+1],c=r[o>r.length-3?r.length-1:o+2];return n.set(Hd(a,l.x,h.x,f.x,c.x),Hd(a,l.y,h.y,f.y,c.y)),n}copy(e){super.copy(e),this.points=[];for(let i=0,n=e.points.length;i<n;i++){const r=e.points[i];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let i=0,n=this.points.length;i<n;i++){const r=this.points[i];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let i=0,n=e.points.length;i<n;i++){const r=e.points[i];this.points.push(new Z().fromArray(r))}return this}}var _w=Object.freeze({__proto__:null,ArcCurve:cw,CatmullRomCurve3:hw,CubicBezierCurve:Gi,CubicBezierCurve3:yw,EllipseCurve:sl,LineCurve:Wi,LineCurve3:wm,QuadraticBezierCurve:sr,QuadraticBezierCurve3:xw,SplineCurve:Gh});class bw extends dn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),i=this.curves[this.curves.length-1].getPoint(1);e.equals(i)||this.curves.push(new Wi(i,e))}getPoint(e,i){const n=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const o=r[s]-n,a=this.curves[s],l=a.getLength(),h=l===0?0:1-o/l;return a.getPointAt(h,i)}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 i=0;for(let n=0,r=this.curves.length;n<r;n++)i+=this.curves[n].getLength(),e.push(i);return this.cacheLengths=e,e}getSpacedPoints(e=40){const i=[];for(let n=0;n<=e;n++)i.push(this.getPoint(n/e));return this.autoClose&&i.push(i[0]),i}getPoints(e=12){const i=[];let n;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isS
vendor: 8,037 bytes, line 3112
3112plineCurve?e*o.points.length:e,l=o.getPoints(a);for(let h=0;h<l.length;h++){const f=l[h];n&&n.equals(f)||(i.push(f),n=f)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(e){super.copy(e),this.curves=[];for(let i=0,n=e.curves.length;i<n;i++){const r=e.curves[i];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let i=0,n=this.curves.length;i<n;i++){const r=this.curves[i];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let i=0,n=e.curves.length;i<n;i++){const r=e.curves[i];this.curves.push(new _w[r.type]().fromJSON(r))}return this}}class Ua extends bw{constructor(e){super(),this.type="Path",this.currentPoint=new Z,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let i=1,n=e.length;i<n;i++)this.lineTo(e[i].x,e[i].y);return this}moveTo(e,i){return this.currentPoint.set(e,i),this}lineTo(e,i){const n=new Wi(this.currentPoint.clone(),new Z(e,i));return this.curves.push(n),this.currentPoint.set(e,i),this}quadraticCurveTo(e,i,n,r){const s=new sr(this.currentPoint.clone(),new Z(e,i),new Z(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,i,n,r,s,o){const a=new Gi(this.currentPoint.clone(),new Z(e,i),new Z(n,r),new Z(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const i=[this.currentPoint.clone()].concat(e),n=new Gh(i);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,i,n,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,i+l,n,r,s,o),this}absarc(e,i,n,r,s,o){return this.absellipse(e,i,n,n,r,s,o),this}ellipse(e,i,n,r,s,o,a,l){const h=this.currentPoint.x,f=this.currentPoint.y;return this.absellipse(e+h,i+f,n,r,s,o,a,l),this}absellipse(e,i,n,r,s,o,a,l){const h=new sl(e,i,n,r,s,o,a,l);if(this.curves.length>0){const c=h.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(h);const f=h.getPoint(1);return this.currentPoint.copy(f),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 Hh extends We{constructor(e=[new Z(0,-.5),new Z(.5,0),new Z(0,.5)],i=12,n=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:i,phiStart:n,phiLength:r},i=Math.floor(i),r=Ht(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],h=[],f=1/i,c=new E,u=new Z,d=new E,m=new E,g=new E;let p=0,v=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:p=e[y+1].x-e[y].x,v=e[y+1].y-e[y].y,d.x=v*1,d.y=-p,d.z=v*0,g.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(g.x,g.y,g.z);break;default:p=e[y+1].x-e[y].x,v=e[y+1].y-e[y].y,d.x=v*1,d.y=-p,d.z=v*0,m.copy(d),d.x+=g.x,d.y+=g.y,d.z+=g.z,d.normalize(),l.push(d.x,d.y,d.z),g.copy(m)}for(let y=0;y<=i;y++){const b=n+y*f*r,x=Math.sin(b),M=Math.cos(b);for(let w=0;w<=e.length-1;w++){c.x=e[w].x*x,c.y=e[w].y,c.z=e[w].x*M,o.push(c.x,c.y,c.z),u.x=y/i,u.y=w/(e.length-1),a.push(u.x,u.y);const T=l[3*w+0]*x,_=l[3*w+1],A=l[3*w+0]*M;h.push(T,_,A)}}for(let y=0;y<i;y++)for(let b=0;b<e.length-1;b++){const x=b+y*e.length,M=x,w=x+e.length,T=x+e.length+1,_=x+1;s.push(M,w,_),s.push(T,_,w)}this.setIndex(s),this.setAttribute("position",new Pe(o,3)),this.setAttribute("uv",new Pe(a,2)),this.setAttribute("normal",new Pe(h,3))}static fromJSON(e){return new Hh(e.points,e.segments,e.phiStart,e.phiLength)}}class ol extends We{constructor(e=1,i=1,n=1,r=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:i,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const h=this;r=Math.floor(r),s=Math.floor(s);const f=[],c=[],u=[],d=[];let m=0;const g=[],p=n/2;let v=0;y(),o===!1&&(e>0&&b(!0),i>0&&b(!1)),this.setIndex(f),this.setAttribute("position",new Pe(c,3)),this.setAttribute("normal",new Pe(u,3)),this.setAttribute("uv",new Pe(d,2));function y(){const x=new E,M=new E;let w=0;const T=(i-e)/n;for(let _=0;_<=s;_++){const A=[],S=_/s,D=S*(i-e)+e;for(let O=0;O<=r;O++){const z=O/r,I=z*l+a,H=Math.sin(I),ee=Math.cos(I);M.x=D*H,M.y=-S*n+p,M.z=D*ee,c.push(M.x,M.y,M.z),x.set(H,T,ee).normalize(),u.push(x.x,x.y,x.z),d.push(z,1-S),A.push(m++)}g.push(A)}for(let _=0;_<r;_++)for(let A=0;A<s;A++){const S=g[A][_],D=g[A+1][_],O=g[A+1][_+1],z=g[A][_+1];f.push(S,D,z),f.push(D,O,z),w+=6}h.addGroup(v,w,0),v+=w}function b(x){const M=m,w=new Z,T=new E;let _=0;const A=x===!0?e:i,S=x===!0?1:-1;for(let O=1;O<=r;O++)c.push(0,p*S,0),u.push(0,S,0),d.push(.5,.5),m++;const D=m;for(let O=0;O<=r;O++){const I=O/r*l+a,H=Math.cos(I),ee=Math.sin(I);T.x=A*ee,T.y=p*S,T.z=A*H,c.push(T.x,T.y,T.z),u.push(0,S,0),w.x=H*.5+.5,w.y=ee*.5*S+.5,d.push(w.x,w.y),m++}for(let O=0;O<r;O++){const z=M+O,I=D+O;x===!0?f.push(I,I+1,z):f.push(I+1,I,z),_+=3}h.addGroup(v,_,x===!0?1:2),v+=_}}static fromJSON(e){return new ol(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Wh extends ol{constructor(e=1,i=1,n=8,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,i,n,r,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:i,radialSegments:n,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Wh(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class al extends We{constructor(e=[],i=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:i,radius:n,detail:r};const s=[],o=[];a(r),h(n),f(),this.setAttribute("position",new Pe(s,3)),this.setAttribute("normal",new Pe(s.slice(),3)),this.setAttribute("uv",new Pe(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(y){const b=new E,x=new E,M=new E;for(let w=0;w<i.length;w+=3)d(i[w+0],b),d(i[w+1],x),d(i[w+2],M),l(b,x,M,y)}function l(y,b,x,M){const w=M+1,T=[];for(let _=0;_<=w;_++){T[_]=[];const A=y.clone().lerp(x,_/w),S=b.clone().lerp(x,_/w),D=w-_;for(let O=0;O<=D;O++)O===0&&_===w?T[_][O]=A:T[_][O]=A.clone().lerp(S,O/D)}for(let _=0;_<w;_++)for(let A=0;A<2*(w-_)-1;A++){const S=Math.floor(A/2);A%2===0?(u(T[_][S+1]),u(T[_+1][S]),u(T[_][S])):(u(T[_][S+1]),u(T[_+1][S+1]),u(T[_+1][S]))}}function h(y){const b=new E;for(let x=0;x<s.length;x+=3)b.x=s[x+0],b.y=s[x+1],b.z=s[x+2],b.normalize().multiplyScalar(y),s[x+0]=b.x,s[x+1]=b.y,s[x+2]=b.z}function f(){const y=new E;for(let b=0;b<s.length;b+=3){y.x=s[b+0],y.y=s[b+1],y.z=s[b+2];const x=p(y)/2/Math.PI+.5,M=v(y)/Math.PI+.5;o.push(x,1-M)}m(),c()}function c(){for(let y=0;y<o.length;y+=6){const b=o[y+0],x=o[y+2],M=o[y+4],w=Math.max(b,x,M),T=Math.min(b,x,M);w>.9&&T<.1&&(b<.2&&(o[y+0]+=1),x<.2&&(o[y+2]+=1),M<.2&&(o[y+4]+=1))}}function u(y){s.push(y.x,y.y,y.z)}function d(y,b){const x=y*3;b.x=e[x+0],b.y=e[x+1],b.z=e[x+2]}function m(){const y=new E,b=new E,x=new E,M=new E,w=new Z,T=new Z,_=new Z;for(let A=0,S=0;A<s.length;A+=9,S+=6){y.set(s[A+0],s[A+1],s[A+2]),b.set(s[A+3],s[A+4],s[A+5]),x.set(s[A+6],s[A+7],s[A+8]),w.set(o[S+0],o[S+1]),T.set(o[S+2],o[S+3]),_.set(o[S+4],o[S+5]),M.copy(y).add(b).add(x).divideScalar(3);const D=p(M);g(w,S+0,y,D),g(T,S+2,b,D),g(_,S+4,x,D)}}function g(y,b,x,M){M<0&&y.x===1&&(o[b]=y.x-1),x.x===0&&x.z===0&&(o[b]=M/2/Math.PI+.5)}function p(y){return Math.atan2(y.z,-y.x)}function v(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}static fromJSON(e){return new al(e.vertices,e.indices,e.radius,e.details)}}class jh extends al{constructor(e=1,i=0){const n=(1+Math.sqrt(5))/2,r=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
311219,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,i),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:i}}static fromJSON(e){return new jh(e.radius,e.detail)}}class Ba extends Ua{constructor(e){super(e),this.uuid=on(),this.type="Shape",this.holes=[]}getPointsHoles(e){const i=[];for(let n=0,r=this.holes.length;n<r;n++)i[n]=this.holes[n].getPoints(e);return i}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let i=0,n=e.holes.length;i<n;i++){const r=e.holes[i];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let i=0,n=this.holes.length;i<n;i++){const r=this.holes[i];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let i=0,n=e.holes.length;i<n;i++){const r=e.holes[i];this.holes.push(new Ua().fromJSON(r))}return this}}const ww={triangulate:function(t,e,i=2){const n=e&&e.length,r=n?e[0]*i:t.length;let s=Sm(t,0,r,i,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,h,f,c,u,d;if(n&&(s=Ew(t,e,s,i)),t.length>80*i){a=h=t[0],l=f=t[1];for(let m=i;m<r;m+=i)c=t[m],u=t[m+1],c<a&&(a=c),u<l&&(l=u),c>h&&(h=c),u>f&&(f=u);d=Math.max(h-a,f-l),d=d!==0?1/d:0}return _o(s,o,i,a,l,d),o}};function Sm(t,e,i,n,r){let s,o;if(r===Bw(t,e,i,n)>0)for(s=e;s<i;s+=n)o=Wd(s,t[s],t[s+1],o);else for(s=i-n;s>=e;s-=n)o=Wd(s,t[s],t[s+1],o);return o&&ll(o,o.next)&&(wo(o),o=o.next),o}function or(t,e){if(!t)return t;e||(e=t);let i=t,n;do if(n=!1,!i.steiner&&(ll(i,i.next)||Ct(i.prev,i,i.next)===0)){if(wo(i),i=e=i.prev,i===i.next)break;n=!0}else i=i.next;while(n||i!==e);return e}function _o(t,e,i,n,r,s,o){if(!t)return;!o&&s&&Ow(t,n,r,s);let a=t,l,h;for(;t.prev!==t.next;){if(l=t.prev,h=t.next,s?Mw(t,n,r,s):Sw(t)){e.push(l.i/i),e.push(t.i/i),e.push(h.i/i),wo(t),t=h.next,a=h.next;continue}if(t=h,t===a){o?o===1?(t=Aw(or(t),e,i),_o(t,e,i,n,r,s,2)):o===2&&Tw(t,e,i,n,r,s):_o(or(t),e,i,n,r,s,1);break}}}function Sw(t){const e=t.prev,i=t,n=t.next;if(Ct(e,i,n)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(ms(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&Ct(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Mw(t,e,i,n){const r=t.prev,s=t,o=t.next;if(Ct(r,s,o)>=0)return!1;const a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,l=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,h=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,f=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,c=Hc(a,l,e,i,n),u=Hc(h,f,e,i,n);let d=t.prevZ,m=t.nextZ;for(;d&&d.z>=c&&m&&m.z<=u;){if(d!==t.prev&&d!==t.next&&ms(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&Ct(d.prev,d,d.next)>
3112=0||(d=d.prevZ,m!==t.prev&&m!==t.next&&ms(r.x,r.y,s.x,s.y,o.x,o.y,m.x,m.y)&&Ct(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&ms(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&Ct(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=u;){if(m!==t.prev&&m!==t.next&&ms(r.x,r.y,s.x,s.y,o.x,o.y,m.x,m.y)&&Ct(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Aw(t,e,i){let n=t;do{const r=n.prev,s=n.next.next;!ll(r,s)&&Mm(r,n,n.next,s)&&bo(r,s)&&bo(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),wo(n),wo(n.next),n=t=s),n=n.next}while(n!==t);return or(n)}function Tw(t,e,i,n,r,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&zw(o,a)){let l=Am(o,a);o=or(o,o.next),l=or(l,l.next),_o(o,e,i,n,r,s),_o(l,e,i,n,r,s);return}a=a.next}o=o.next}while(o!==t)}function Ew(t,e,i,n){const r=[];let s,o,a,l,h;for(s=0,o=e.length;s<o;s++)a=e[s]*n,l=s<o-1?e[s+1]*n:t.length,h=Sm(t,a,l,n,!1),h===h.next&&(h.steiner=!0),r.push(Iw(h));for(r.sort(Cw),s=0;s<r.length;s++)Lw(r[s],i),i=or(i,i.next);return i}function Cw(t,e){return t.x-e.x}function Lw(t,e){if(e=Pw(t,e),e){const i=Am(e,t);or(e,e.next),or(i,i.next)}}function Pw(t,e){let i=e;const n=t.x,r=t.y;let s=-1/0,o;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const u=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(u<=n&&u>s){if(s=u,u===n){if(r===i.y)return i;if(r===i.next.y)return i.next}o=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!o)return null;if(n===s)return o;const a=o,l=o.x,h=o.y;let f=1/0,c;i=o;do n>=i.x&&i.x>=l&&n!==i.x&&ms(r<h?n:s,r,l,h,r<h?s:n,r,i.x,i.y)&&(c=Math.abs(r-i.y)/(n-i.x),bo(i,t)&&(c<f||c===f&&(i.x>o.x||i.x===o.x&&Dw(o,i)))&&(o=i,f=c)),i=i.next;while(i!==a);return o}function Dw(t,e){return Ct(t.prev,t,e.prev)<0&&Ct(e.next,t,t.next)<0}function Ow(t,e,i,n){let r=t;do r.z===null&&(r.z=Hc(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,Rw(r)}function Rw(t){let e,i,n,r,s,o,a,l,h=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,n=i,a=0,e=0;e<h&&(a++,n=n.nextZ,!!n);e++);for(l=h;a>0||l>0&&n;)a!==0&&(l===0||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,h*=2}while(o>1);return t}function Hc(t,e,i,n,r){return t=32767*(t-i)*r,e=32767*(e-n)*r,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Iw(t){let e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}function ms(t,e,i,n,r,s,o,a){return(r-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(s-a)-(r-o)*(n-a)>=0}function zw(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Nw(t,e)&&(bo(t,e)&&bo(e,t)&&Uw(t,e)&&(Ct(t.prev,t,e.prev)||Ct(t,e.prev,e))||ll(t,e)&&Ct(t.prev,t,t.next)>0&&Ct(e.prev,e,e.next)>0)}function Ct(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ll(t,e){return t.x===e.x&&t.y===e.y}function Mm(t,e,i,n){const r=fa(Ct(t,e,i)),s=fa(Ct(t,e,n)),o=fa(Ct(i,n,t)),a=fa(Ct(i,n,e));return!!(r!==s&&o!==a||r===0&&da(t,i,e)||s===0&&da(t,n,e)||o===0&&da(i,t,n)||a===0&&da(i,e,n))}function da(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function fa(t){return t>0?1:t<0?-1:0}function Nw(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Mm(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}function bo(t,e){return Ct(t.prev,t,t.next)<0?Ct(t,e,t.next)>=0&&Ct(t,t.prev,e)>=0:Ct(t,e,t.prev)<0||Ct(t,t.next,e)<0}function Uw(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next;while(i!==t);return n}function Am(t,e){const i=new Wc(t.i,t.x,t.y),n=new Wc(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function Wd(t,e,i,n){const r=new Wc(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function wo(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Wc(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Bw(t,e,i,n){let r=0;for(let s=e,o=i-n;s<i;
vendor: 23,235 bytes, line 3112
3112s+=n)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}class qh{static area(e){const i=e.length;let n=0;for(let r=i-1,s=0;s<i;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return qh.area(e)<0}static triangulateShape(e,i){const n=[],r=[],s=[];jd(e),qd(n,e);let o=e.length;i.forEach(jd);for(let l=0;l<i.length;l++)r.push(o),o+=i[l].length,qd(n,i[l]);const a=ww.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function jd(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function qd(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class Xh extends al{constructor(e=1,i=0){const n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,s,e,i),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:i}}static fromJSON(e){return new Xh(e.radius,e.detail)}}class cl extends We{constructor(e=1,i=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:i,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},i=Math.max(3,Math.floor(i)),n=Math.max(2,Math.floor(n));const l=Math.min(o+a,Math.PI);let h=0;const f=[],c=new E,u=new E,d=[],m=[],g=[],p=[];for(let v=0;v<=n;v++){const y=[],b=v/n;let x=0;v==0&&o==0?x=.5/i:v==n&&l==Math.PI&&(x=-.5/i);for(let M=0;M<=i;M++){const w=M/i;c.x=-e*Math.cos(r+w*s)*Math.sin(o+b*a),c.y=e*Math.cos(o+b*a),c.z=e*Math.sin(r+w*s)*Math.sin(o+b*a),m.push(c.x,c.y,c.z),u.copy(c).normalize(),g.push(u.x,u.y,u.z),p.push(w+x,1-b),y.push(h++)}f.push(y)}for(let v=0;v<n;v++)for(let y=0;y<i;y++){const b=f[v][y+1],x=f[v][y],M=f[v+1][y],w=f[v+1][y+1];(v!==0||o>0)&&d.push(b,x,w),(v!==n-1||l<Math.PI)&&d.push(x,M,w)}this.setIndex(d),this.setAttribute("position",new Pe(m,3)),this.setAttribute("normal",new Pe(g,3)),this.setAttribute("uv",new Pe(p,2))}static fromJSON(e){return new cl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Yh extends We{constructor(e=1,i=.4,n=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:i,tubularSegments:n,radialSegments:r,p:s,q:o},n=Math.floor(n),r=Math.floor(r);const a=[],l=[],h=[],f=[],c=new E,u=new E,d=new E,m=new E,g=new E,p=new E,v=new E;for(let b=0;b<=n;++b){const x=b/n*s*Math.PI*2;y(x,s,o,e,d),y(x+.01,s,o,e,m),p.subVectors(m,d),v.addVectors(m,d),g.crossVectors(p,v),v.crossVectors(g,p),g.normalize(),v.normalize();for(let M=0;M<=r;++M){const w=M/r*Math.PI*2,T=-i*Math.cos(w),_=i*Math.sin(w);c.x=d.x+(T*v.x+_*g.x),c.y=d.y+(T*v.y+_*g.y),c.z=d.z+(T*v.z+_*g.z),l.push(c.x,c.y,c.z),u.subVectors(c,d).normalize(),h.push(u.x,u.y,u.z),f.push(b/n),f.push(M/r)}}for(let b=1;b<=n;b++)for(let x=1;x<=r;x++){const M=(r+1)*(b-1)+(x-1),w=(r+1)*b+(x-1),T=(r+1)*b+x,_=(r+1)*(b-1)+x;a.push(M,w,_),a.push(w,T,_)}this.setIndex(a),this.setAttribute("position",new Pe(l,3)),this.setAttribute("normal",new Pe(h,3)),this.setAttribute("uv",new Pe(f,2));function y(b,x,M,w,T){const _=Math.cos(b),A=Math.sin(b),S=M/x*b,D=Math.cos(S);T.x=w*(2+D)*.5*_,T.y=w*(2+D)*A*.5,T.z=w*Math.sin(S)*.5}}static fromJSON(e){return new Yh(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}const Xd={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Fw{constructor(e,i,n){const r=this;let s=!1,o=0,a=0,l;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=i,this.onError=n,this.itemStart=function(f){a++,s===!1&&r.onStart!==void 0&&r.onStart(f,o,a),s=!0},this.itemEnd=function(f){o++,r.onProgress!==void 0&&r.onProgress(f,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(f){r.onError!==void 0&&r.onError(f)},this.resolveURL=function(f){return l?l(f):f},this.setURLModifier=function(f){return l=f,this},this.addHandler=function(f,c){return h.push(f,c),this},this.removeHandler=function(f){const c=h.indexOf(f);return c!==-1&&h.splice(c,2),this},this.getHandler=function(f){for(let c=0,u=h.length;c<u;c+=2){const d=h[c],m=h[c+1];if(d.global&&(d.lastIndex=0),d.test(f))return m}return null}}}const kw=new Fw;class hl{constructor(e){this.manager=e!==void 0?e:kw,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,i){const n=this;return new Promise(function(r,s){n.load(e,r,i,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}}const _n={};class Vw extends Error{constructor(e,i){super(e),this.response=i}}class Fa extends hl{constructor(e){super(e)}load(e,i,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Xd.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{i&&i(s),this.manager.itemEnd(e)},0),s;if(_n[e]!==void 0){_n[e].push({onLoad:i,onProgress:n,onError:r});return}_n[e]=[],_n[e].push({onLoad:i,onProgress:n,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const f=_n[e],c=h.body.getReader(),u=h.headers.get("Content-Length"),d=u?parseInt(u):0,m=d!==0;let g=0;const p=new ReadableStream({start(v){y();function y(){c.read().then(({done:b,value:x})=>{if(b)v.close();else{g+=x.byteLength;const M=new ProgressEvent("progress",{lengthComputable:m,loaded:g,total:d});for(let w=0,T=f.length;w<T;w++){const _=f[w];_.onProgress&&_.onProgress(M)}v.enqueue(x),y()}})}}});return new Response(p)}else throw new Vw(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(l){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(f=>new DOMParser().parseFromString(f,a));case"json":return h.json();default:if(a===void 0)return h.text();{const c=/charset="?([^;"\s]*)"?/i.exec(a),u=c&&c[1]?c[1].toLowerCase():void 0,d=new TextDecoder(u);return h.arrayBuffer().then(m=>d.decode(m))}}}).then(h=>{Xd.add(e,h);const f=_n[e];delete _n[e];for(let c=0,u=f.length;c<u;c++){const d=f[c];d.onLoad&&d.onLoad(h)}}).catch(h=>{const f=_n[e];if(f===void 0)throw this.manager.itemError(e),h;delete _n[e];for(let c=0,u=f.length;c<u;c++){const d=f[c];d.onError&&d.onError(h)}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}}class ul extends gt{constructor(e,i=1){super(),this.isLight=!0,this.type="Light",this.color=new Xe(e),this.intensity=i}dispose(){}copy(e,i){return super.copy(e,i),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const i=super.toJSON(e);return i.object.color=this.color.getHex(),i.object.intensity=this.intensity,this.groundColor!==void 0&&(i.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(i.object.distance=this.distance),this.angle!==void 0&&(i.object.angle=this.angle),this.decay!==void 0&&(i.object.decay=this.decay),this.penumbra!==void 0&&(i.object.penumbra=this.penumbra),this.shadow!==void 0&&(i.object.shadow=this.shadow.toJSON()),i}}class jc extends ul{constructor(e,i,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(gt.DefaultUp),this.updateMatrix(),this.groundColor=new Xe(i)}copy(e,i){return super.copy(e,i),this.groundColor.copy(e.groundColor),this}}const Yd=new Ye,$d=new E,Zd=new E;class $h{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Z(512,512),this.map=null,this.mapPass=null,this.matrix=new Ye,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Bh,this._frameExtents=new Z(1,1),this._viewportCount=1,this._viewports=[new tt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const i=this.camera,n=this.matrix;$d.setFromMatrixPosition(e.matrixWorld),i.position.copy($d),Zd.setFromMatrixPosition(e.target.matrixWorld),i.lookAt(Zd),i.updateMatrixWorld(),Yd.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Yd),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(i.projectionMatrix),n.multiply(i.matrixWorldInverse)}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.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return 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 Gw extends $h{constructor(){super(new ri(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const i=this.camera,n=xo*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||i.far;(n!==i.fov||r!==i.aspect||s!==i.far)&&(i.fov=n,i.aspect=r,i.far=s,i.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Hw extends ul{constructor(e,i,n=0,r=Math.PI/3,s=0,o=1){super(e,i),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(gt.DefaultUp),this.updateMatrix(),this.target=new gt,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new Gw}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,i){return super.copy(e,i),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Jd=new Ye,$s=new E,lc=new E;class Ww extends $h{constructor(){super(new ri(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Z(4,2),this._viewportCount=6,this._viewports=[new tt(2,1,1,1),new tt(0,1,1,1),new tt(3,1,1,1),new tt(1,1,1,1),new tt(3,0,1,1),new tt(1,0,1,1)],this._cubeDirections=[new E(1,0,0),new E(-1,0,0),new E(0,0,1),new E(0,0,-1),new E(0,1,0),new E(0,-1,0)],this._cubeUps=[new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,0,1),new E(0,0,-1)]}updateMatrices(e,i=0){const n=this.camera,r=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),$s.setFromMatrixPosition(e.matrixWorld),n.position.copy($s),lc.copy(n.position),lc.add(this._cubeDirections[i]),n.up.copy(this._cubeUps[i]),n.lookAt(lc),n.updateMatrixWorld(),r.makeTranslation(-$s.x,-$s.y,-$s.z),Jd.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Jd)}}class jw extends ul{constructor(e,i,n=0,r=1){super(e,i),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new Ww}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,i){return super.copy(e,i),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class qw extends $h{constructor(){super(new nl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Xw extends ul{constructor(e,i){super(e,i),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(gt.DefaultUp),this.updateMatrix(),this.target=new gt,this.shadow=new qw}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Yw extends We{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Tm extends hl{constructor(e){super(e)}load(e,i,n,r){const s=this,o=new Fa(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{i(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}parse(e){const i={},n={};function r(d,m){if(i[m]!==void 0)return i[m];const p=d.interleavedBuffers[m],v=s(d,p.buffer),y=Ho(p.type,v),b=new aw(y,p.stride);return b.uuid=p.uuid,i[m]=b,b}function s(d,m){if(n[m]!==void 0)return n[m];const p=d.arrayBuffers[m],v=new Uint32Array(p).buffer;return n[m]=v,v}const o=e.isInstancedBufferGeometry?new Yw:new We,a=e.data.index;if(a!==void 0){const d=Ho(a.type,a.array);o.setIndex(new it(d,1))}const l=e.data.attributes;for(const d in l){const m=l[d];let g;if(m.isInterleavedBufferAttribute){const p=r(e.data,m.data);g=new Na(p,m.itemSize,m.offset,m.normalized)}else{const p=Ho(m.type,m.array),v=m.isInstancedBufferAttribute?lw:it;g=new v(p,m.itemSize,m.normalized)}m.name!==void 0&&(g.name=m.name),m.usage!==void 0&&g.setUsage(m.usage),m.updateRange!==void 0&&(g.updateRange.offset=m.updateRange.offset,g.updateRange.count=m.updateRange.count),o.setAttribute(d,g)}const h=e.data.morphAttributes;if(h)for(const d in h){const m=h[d],g=[];for(let p=0,v=m.length;p<v;p++){const y=m[p];let b;if(y.isInterleavedBufferAttribute){const x=r(e.data,y.data);b=new Na(x,y.itemSize,y.offset,y.normalized)}else{const x=Ho(y.type,y.array);b=new it(x,y.itemSize,y.normalized)}y.name!==void 0&&(b.name=y.name),g.push(b)}o.morphAttributes[d]=g}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const c=e.data.groups||e.data.drawcalls||e.data.offsets;if(c!==void 0)for(let d=0,m=c.length;d!==m;++d){const g=c[d];o.addGroup(g.start,g.count,g.materialIndex)}const u=e.data.boundingSphere;if(u!==void 0){const d=new E;u.center!==void 0&&d.fromArray(u.center),o.boundingSphere=new cn(d,u.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class $w{constructor(e,i,n=0,r=1/0){this.ray=new Rs(e,i),this.near=n,this.far=r,this.camera=null,this.layers=new zh,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,i){this.ray.set(e,i)}setFromCamera(e,i){i.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(i.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(i).sub(this.ray.origin).normalize(),this.camera=i):i.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(i.near+i.far)/(i.near-i.far)).unproject(i),this.ray.direction.set(0,0,-1).transformDirection(i.matrixWorld),this.camera=i):console.error("THREE.Raycaster: Unsupported camera type: "+i.type)}intersectObject(e,i=!0,n=[]){return qc(e,this,n,i),n.sort(Kd),n}intersectObjects(e,i=!0,n=[]){for(let r=0,s=e.length;r<s;r++)qc(e[r],this,n,i);return n.sort(Kd),n}}function Kd(t,e){return t.distance-e.distance}function qc(t,e,i,n){if(t.layers.test(e.layers)&&t.raycast(e,i),n===!0){const r=t.children;for(let s=0,o=r.length;s<o;s++)qc(r[s],e,i,!0)}}const Qd=new Z;class Zw{constructor(e=new Z(1/0,1/0),i=new Z(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=i}set(e,i){return this.min.copy(e),this.max.copy(i),this}setFromPoints(e){this.makeEmpty();for(let i=0,n=e.length;i<n;i++)this.expandByPoint(e[i]);return this}setFromCenterAndSize(e,i){const n=Qd.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}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=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(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}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}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}getParameter(e,i){return i.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}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)}clampPoint(e,i){return i.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Qd.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),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)}}const ef=new E,pa=new E;class Jw{constructor(e=new E,i=new E){this.start=e,this.end=i}set(e,i){return this.start.copy(e),this.end.copy(i),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,i){return this.delta(i).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,i){ef.subVectors(e,this.start),pa.subVectors(this.end,this.start);const n=pa.dot(pa);let s=pa.dot(ef)/n;return i&&(s=Ht(s,0,1)),s}closestPointToPoint(e,i,n){const r=this.closestPointToPointParameter(e,i);return this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const tf=new E;class Kw extends gt{constructor(e,i){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i;const n=new We,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){const h=o/l*Math.PI*2,f=a/l*Math.PI*2;r.push(Math.cos(h),Math.sin(h),1,Math.cos(f),Math.sin(f),1)}n.setAttribute("position",new Pe(r,3));const s=new kr({fog:!1,toneMapped:!1});this.cone=new Io(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,i=e*Math.tan(this.light.angle);this.cone.scale.set(i,i,e),tf.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(tf),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}class Qw extends Di{constructor(e,i,n){const r=new cl(i,4,2),s=new Nh({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const nf=new E,ma=new E,rf=new E;class eS extends gt{constructor(e,i,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,i===void 0&&(i=1);let r=new We;r.setAttribute("position",new Pe([-i,i,0,i,i,0,i,-i,0,-i,-i,0,-i,i,0],3));const s=new kr({fog:!1,toneMapped:!1});this.lightPlane=new Gc(r,s),this.add(this.lightPlane),r=new We,r.setAttribute("position",new Pe([0,0,0,0,0,1],3)),this.targetLine=new Gc(r,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){nf.setFromMatrixPosition(this.light.matrixWorld),ma.setFromMatrixPosition(this.light.target.matrixWorld),rf.subVectors(ma,nf),this.lightPlane.lookAt(ma),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(ma),this.targetLine.scale.z=rf.length()}}const ga=new E,Pt=new Oo;class $n extends Io{constructor(e){const i=new We,n=new kr({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(m,g){l(m),l(g)}function l(m){r.push(0,0,0),s.push(0,0,0),o[m]===void 0&&(o[m]=[]),o[m].push(r.length/3-1)}i.setAttribute("position",new Pe(r,3)),i.setAttribute("color",new Pe(s,3)),super(i,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const h=new Xe(16755200),f=new Xe(16711680),c=new Xe(43775),u=new Xe(16777215),d=new Xe(3355443);this.setColors(h,f,c,u,d)}setColors(e,i,n,r,s){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,i.r,i.g,i.b),a.setXYZ(25,i.r,i.g,i.b),a.setXYZ(26,i.r,i.g,i.b),a.setXYZ(27,i.r,i.g,i.b),a.setXYZ(28,i.r,i.g,i.b),a.setXYZ(29,i.r,i.g,i.b),a.setXYZ(30,i.r,i.g,i.b),a.setXYZ(31,i.r,i.g,i.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){const e=this.geometry,i=this.pointMap,n=1,r=1;Pt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),It("c",
3112i,e,Pt,0,0,-1),It("t",i,e,Pt,0,0,1),It("n1",i,e,Pt,-n,-r,-1),It("n2",i,e,Pt,n,-r,-1),It("n3",i,e,Pt,-n,r,-1),It("n4",i,e,Pt,n,r,-1),It("f1",i,e,Pt,-n,-r,1),It("f2",i,e,Pt,n,-r,1),It("f3",i,e,Pt,-n,r,1),It("f4",i,e,Pt,n,r,1),It("u1",i,e,Pt,n*.7,r*1.1,-1),It("u2",i,e,Pt,-n*.7,r*1.1,-1),It("u3",i,e,Pt,0,r*2,-1),It("cf1",i,e,Pt,-n,0,1),It("cf2",i,e,Pt,n,0,1),It("cf3",i,e,Pt,0,-r,1),It("cf4",i,e,Pt,0,r,1),It("cn1",i,e,Pt,-n,0,-1),It("cn2",i,e,Pt,n,0,-1),It("cn3",i,e,Pt,0,-r,-1),It("cn4",i,e,Pt,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function It(t,e,i,n,r,s,o){ga.set(r,s,o).unproject(n);const a=e[t];if(a!==void 0){const l=i.getAttribute("position");for(let h=0,f=a.length;h<f;h++)l.setXYZ(a[h],ga.x,ga.y,ga.z)}}class va extends Io{constructor(e,i=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new We;s.setIndex(new it(n,1)),s.setAttribute("position",new Pe(r,3)),super(s,new kr({color:i,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const i=this.box;i.isEmpty()||(i.getCenter(this.position),i.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}}class tS extends Io{constructor(e=1){const i=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new We;r.setAttribute("position",new Pe(i,3)),r.setAttribute("color",new Pe(n,3));const s=new kr({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,i,n){const r=new Xe,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(i),r.toArray(s,6),r.toArray(s,9),r.set(n),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Oh}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Oh);const iS="modulepreload",nS=function(t){return"/"+t},sf={},rS=function(e,i,n){return!i||i.length===0?e():Promise.all(i.map(r=>{if(r=nS(r),r in sf)return;sf[r]=!0;const s=r.endsWith(".css"),o=s?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${o}`))return;const a=document.createElement("link");if(a.rel=s?"stylesheet":iS,s||(a.as="script",a.crossOrigin=""),a.href=r,document.head.appendChild(a),s)return new Promise((l,h)=>{a.addEventListener("load",l),a.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>e())};function Em(t,e=!1){const i=t[0].index!==null,n=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),s={},o={},a=t[0].morphTargetsRelative,l=new We;let h=0;for(let f=0;f<t.length;++f){const c=t[f];let u=0;if(i!==(c.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const d in c.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(c.attributes[d]),u++}if(u!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". Make sure all geometries have the same number of attributes."),null;if(a!==c.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const d in c.morphAttributes){if(!r.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+".  .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(c.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(c.userData),e){let d;if(i)d=c.index.count;else if(c.attributes.position!==void 0)d=c.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". The geometry must have either an index or a position attribute"),null;l.addGroup(h,d,f),h+=d}}if(i){let f=0;const c=[];for(let u=0;u<t.length;++u){const d=t[u].index;for(let m=0;m<d.count;++m)c.push(d.getX(m)+f);f+=t[u].attributes.position.count}l.setIndex(c)}for(const f in s){const c=of(s[f]);if(!c)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+f+" attribute."),null;l.setAttribute(f,c)}for(const f in o){const c=o[f][0].length;if(c===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[f]=[];for(let u=0;u<c;++u){const d=[];for(let g=0;g<o[f].length;++g)d.push(o[f][g][u]);const m=of(d);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+f+" morphAttribute."),null;l.morphAttributes[f].push(m)}}return l}function of(t){let e,i,n,r=0;for(let a=0;a<t.length;++a){const l=t[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(i===void 0&&(i=l.itemSize),i!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=l.normalized),n!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;r+=l.array.length}const s=new e(r);let o=0;for(let a=0;a<t.length;++a)s.set(t[a].array,o),o+=t[a].array.length;return new it(s,i,n)}const cc=new WeakMap;class sS extends hl{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,i,n,r){const s=new Fa(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{this.decodeDracoFile(o,i).catch(r)},n,r)}decodeDracoFile(e,i,n,r){const s={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n};return this.decodeGeometry(e,s).then(i)}decodeGeometry(e,i){const n=JSON.stringify(i);if(cc.has(e)){const l=cc.get(e);if(l.key===n)return l.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 r;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(r=l,new Promise((h,f)=>{r._callbacks[s]={resolve:h,reject:f},r.postMessage({type:"decode",id:s,taskConfig:i,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),cc.set(e,{key:n,promise:a}),a}_createGeometry(e){const i=new We;
vendor: 4,350 bytes, lines 3112-3113
3112e.index&&i.setIndex(new it(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const r=e.attributes[n],s=r.name,o=r.array,a=r.itemSize;i.setAttribute(s,new it(o,a))}return i}_loadLibrary(e,i){const n=new Fa(this.manager);return n.setPath(this.decoderPath),n.setResponseType(i),n.setWithCredentials(this.withCredentials),new Promise((r,s)=>{n.load(e,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",i=[];return e?i.push(this._loadLibrary("draco_decoder.js","text")):(i.push(this._loadLibrary("draco_wasm_wrapper.js","text")),i.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(i).then(n=>{const r=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const s=oS.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
3113`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,i){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(s){const o=s.data;switch(o.type){case"decode":r._callbacks[o.id].resolve(o);break;case"error":r._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,s){return r._taskLoad>s._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=i,n._taskLoad+=i,n})}_releaseTask(e,i){e._taskLoad-=e._taskCosts[i],delete e._callbacks[i],delete e._taskCosts[i]}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}}function oS(){let t,e;onmessage=function(o){const a=o.data;switch(a.type){case"init":t=a.decoderConfig,e=new Promise(function(f){t.onModuleLoaded=function(c){f({draco:c})},DracoDecoderModule(t)});break;case"decode":const l=a.buffer,h=a.taskConfig;e.then(f=>{const c=f.draco,u=new c.Decoder,d=new c.DecoderBuffer;d.Init(new Int8Array(l),l.byteLength);try{const m=i(c,u,d,h),g=m.attributes.map(p=>p.array.buffer);m.index&&g.push(m.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:m},g)}catch(m){console.error(m),self.postMessage({type:"error",id:a.id,error:m.message})}finally{c.destroy(d),c.destroy(u)}});break}};function i(o,a,l,h){const f=h.attributeIDs,c=h.attributeTypes;let u,d;const m=a.GetEncodedGeometryType(l);if(m===o.TRIANGULAR_MESH)u=new o.Mesh,d=a.DecodeBufferToMesh(l,u);else if(m===o.POINT_CLOUD)u=new o.PointCloud,d=a.DecodeBufferToPointCloud(l,u);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||u.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());const g={index:null,attributes:[]};for(const p in f){const v=self[c[p]];let y,b;if(h.useUniqueIDs)b=f[p],y=a.GetAttributeByUniqueId(u,b);else{if(b=a.GetAttributeId(u,o[f[p]]),b===-1)continue;y=a.GetAttribute(u,b)}g.attributes.push(r(o,a,u,p,v,y))}return m===o.TRIANGULAR_MESH&&(g.index=n(o,a,u)),o.destroy(u),g}function n(o,a,l){const f=l.num_faces()*3,c=f*4,u=o._malloc(c);a.GetTrianglesUInt32Array(l,c,u);const d=new Uint32Array(o.HEAPF32.buffer,u,f).slice();return o._free(u),{array:d,itemSize:1}}function r(o,a,l,h,f,c){const u=c.num_components(),m=l.num_points()*u,g=m*f.BYTES_PER_ELEMENT,p=s(o,f),v=o._malloc(g);a.GetAttributeDataArrayForAllPoints(l,c,p,g,v);const y=new f(o.HEAPF32.buffer,v,m).slice();return o._free(v),{name:h,array:y,itemSize:u}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}var aS=Object.create,Zh=Object.defineProperty,lS=Object.getOwnPropertyDescriptor,cS=Object.getOwnPropertyNames,hS=Object.getPrototypeOf,uS=Object.prototype.hasOwnProperty,Cm=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),dS=(t,e)=>{for(var i in e)Zh(t,i,{get:e[i],enumerable:!0})}
3113,fS=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of cS(e))!uS.call(t,r)&&r!==i&&Zh(t,r,{get:()=>e[r],enumerable:!(n=lS(e,r))||n.enumerable});return t},Lm=(t,e,i)=>(i=t!=null?aS(hS(t)):{},fS(e||!t||!t.__esModule?Zh(i,"default",{value:t,enumerable:!0}):i,t)),pS=Cm((t,e)=>{(function(i,n){typeof t=="object"&&typeof e<"u"?n(t):typeof define=="function"&&define.amd?define(["exports"],n):n((i=typeof globalThis<"u"?globalThis:i||self).SVDJS={})})(t,function(i){i.SVD=function(n,r,s,o,a){if(r=r===void 0||r,s=s===void 0||s,a=1e-64/(o=o||Math.pow(2,-52)),!n)throw new TypeError("Matrix a is not defined");var l,h,f,c,u,d,m,g,p,v,y,b,x=n[0].length,M=n.length;if(M<x)throw new TypeError("Invalid matrix: m < n");for(var w=[],T=[],_=[],A=r==="f"?M:x,S=v=m=0;S<M;S++)T[S]=new Array(A).fill(0);for(S=0;S<x;S++)_[S]=new Array(x).fill(0);var D,O=new Array(x).fill(0);for(S=0;S<M;S++)for(l=0;l<x;l++)T[S][l]=n[S][l];for(S=0;S<x;S++){for(w[S]=m,p=0,f=S+1,l=S;l<M;l++)p+=Math.pow(T[l][S],2);if(p<a)m=0;else for(g=(d=T[S][S])*(m=d<0?Math.sqrt(p):-Math.sqrt(p))-p,T[S][S]=d-m,l=f;l<x;l++){for(p=0,h=S;h<M;h++)p+=T[h][S]*T[h][l];for(d=p/g,h=S;h<M;h++)T[h][l]=T[h][l]+d*T[h][S]}for(O[S]=m,p=0,l=f;l<x;l++)p+=Math.pow(T[S][l],2);if(p<a)m=0;else{for(g=(d=T[S][S+1])*(m=d<0?Math.sqrt(p):-Math.sqrt(p))-p,T[S][S+1]=d-m,l=f;l<x;l++)w[l]=T[S][l]/g;for(l=f;l<M;l++){for(p=0,h=f;h<x;h++)p+=T[l][h]*T[S][h];for(h=f;h<x;h++)T[l][h]=T[l][h]+p*w[h]}}v<(y=Math.abs(O[S])+Math.abs(w[S]))&&(v=y)}if(s)for(S=x-1;0<=S;S--){if(m!==0){for(g=T[S][S+1]*m,l=f;l<x;l++)_[l][S]=T[S][l]/g;for(l=f;l<x;l++){for(p=0,h=f;h<x;h++)p+=T[S][h]*_[h][l];for(h=f;h<x;h++)_[h][l]=_[h][l]+p*_[h][S]}}for(l=f;l<x;l++)_[S][l]=0,_[l][S]=0;_[S][S]=1,m=w[S],f=S}if(r){if(r==="f")for(S=x;S<M;S++){for(l=x;l<M;l++)T[S][l]=0;T[S][S]=1}for(S=x-1;0<=S;S--){for(f=S+1,m=O[S],l=f;l<A;l++)T[S][l]=0;if(m!==0){for(g=T[S][S]*m,l=f;l<A;l++){for(p=0,h=f;h<M;h++)p+=T[h][S]*T[h][l];for(d=p/g,h=S;h<M;h++)T[h][l]=T[h][l]+d*T[h][S]}for(l=S;l<M;l++)T[l][S]=T[l][S]/m}else for(l=S;l<M;l++)T[l][S]=0;T[S][S]=T[S][S]+1}}for(o*=v,h=x-1;0<=h;h--)for(var z=0;z<50;z++){for(D=!1,f=h;0<=f;f--){if(Math.abs(w[f])<=o){D=!0;break}if(Math.abs(O[f-1])<=o)break}if(!D){for(u=0,c=f-(p=1),S=f;S<h+1&&(d=p*w[S],w[S]=u*w[S],!(Math.abs(d)<=o));S++)if(m=O[S],O[S]=Math.sqrt(d*d+m*m),u=m/(g=O[S]),p=-d/g,r)for(l=0;l<M;l++)y=T[l][c],b=T[l][S],T[l][c]=y*u+b*p,T[l][S]=-y*p+b*u}if(b=O[h],f===h){if(b<0&&(O[h]=-b,s))for(l=0;l<x;l++)_[l][h]=-_[l][h];break}for(v=O[f],d=(((y=O[h-1])-b)*(y+b)+((m=w[h-1])-(g=w[h]))*(m+g))/(2*g*y),m=Math.sqrt(d*d+1),d=((v-b)*(v+b)+g*(y/(d<0?d-m:d+m)-g))/v,S=f+(p=u=1);S<h+1;S++){if(m=w[S],y=O[S],g=p*m,m*=u,b=Math.sqrt(d*d+g*g),d=v*(u=d/(w[S-1]=b))+m*(p=g/b),m=-v*p+m*u,g=y*p,y*=u,s)for(l=0;l<x;l++)v=_[l][S-1],b=_[l][S],_[l][S-1]=v*u+b*p,_[l][S]=-v*p+b*u;if(b=Math.sqrt(d*d+g*g),d=(u=d/(O[S-1]=b))*m+(p=g/b)*y,v=-p*m+u*y,r)for(l=0;l<M;l++)y=T[l][S-1],b=T[l][S],T[l][S-1]=y*u+b*p,T[l][S]=-y*p+b*u}w[f]=0,w[h]=d,O[h]=v}for(S=0;S<x;S++)O[S]<o&&(O[S]=0);return{u:T,q:O,v:_}},i.VERSION="1.1.1",Object.defineProperty(i,"__esModule",{value:!0})})}),mS=Cm(t=>{(function(){var e=function(){this.init()};e.prototype={init:function(){var c=this||i;
vendor: 29,970 bytes, line 3113
3113return c._counter=1e3,c._html5AudioPool=[],c.html5PoolSize=10,c._codecs={},c._howls=[],c._muted=!1,c._volume=1,c._canPlayEvent="canplaythrough",c._navigator=typeof window<"u"&&window.navigator?window.navigator:null,c.masterGain=null,c.noAudio=!1,c.usingWebAudio=!0,c.autoSuspend=!0,c.ctx=null,c.autoUnlock=!0,c._setup(),c},volume:function(c){var u=this||i;if(c=parseFloat(c),u.ctx||f(),typeof c<"u"&&c>=0&&c<=1){if(u._volume=c,u._muted)return u;u.usingWebAudio&&u.masterGain.gain.setValueAtTime(c,i.ctx.currentTime);for(var d=0;d<u._howls.length;d++)if(!u._howls[d]._webAudio)for(var m=u._howls[d]._getSoundIds(),g=0;g<m.length;g++){var p=u._howls[d]._soundById(m[g]);p&&p._node&&(p._node.volume=p._volume*c)}return u}return u._volume},mute:function(c){var u=this||i;u.ctx||f(),u._muted=c,u.usingWebAudio&&u.masterGain.gain.setValueAtTime(c?0:u._volume,i.ctx.currentTime);for(var d=0;d<u._howls.length;d++)if(!u._howls[d]._webAudio)for(var m=u._howls[d]._getSoundIds(),g=0;g<m.length;g++){var p=u._howls[d]._soundById(m[g]);p&&p._node&&(p._node.muted=c?!0:p._muted)}return u},stop:function(){for(var c=this||i,u=0;u<c._howls.length;u++)c._howls[u].stop();return c},unload:function(){for(var c=this||i,u=c._howls.length-1;u>=0;u--)c._howls[u].unload();return c.usingWebAudio&&c.ctx&&typeof c.ctx.close<"u"&&(c.ctx.close(),c.ctx=null,f()),c},codecs:function(c){return(this||i)._codecs[c.replace(/^x-/,"")]},_setup:function(){var c=this||i;if(c.state=c.ctx&&c.ctx.state||"suspended",c._autoSuspend(),!c.usingWebAudio)if(typeof Audio<"u")try{var u=new Audio;typeof u.oncanplaythrough>"u"&&(c._canPlayEvent="canplay")}catch{c.noAudio=!0}else c.noAudio=!0;try{var u=new Audio;u.muted&&(c.noAudio=!0)}catch{}return c.noAudio||c._setupCodecs(),c},_setupCodecs:function(){var c=this||i,u=null;try{u=typeof Audio<"u"?new Audio:null}catch{return c}if(!u||typeof u.canPlayType!="function")return c;var d=u.canPlayType("audio/mpeg;").replace(/^no$/,""),m=c._navigator?c._navigator.userAgent:"",g=m.match(/OPR\/([0-6].)/g),p=g&&parseInt(g[0].split("/")[1],10)<33,v=m.indexOf("Safari")!==-1&&m.indexOf("Chrome")===-1,y=m.match(/Version\/(.*?) /),b=v&&y&&parseInt(y[1],10)<15;return c._codecs={mp3:!!(!p&&(d||u.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!d,opus:!!u.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!u.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!u.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(u.canPlayType('audio/wav; codecs="1"')||u.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!u.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!u.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(u.canPlayType("audio/x-m4a;")||u.canPlayType("audio/m4a;")||u.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(u.canPlayType("audio/x-m4b;")||u.canPlayType("audio/m4b;")||u.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(u.canPlayType("audio/x-mp4;")||u.canPlayType("audio/mp4;")||u.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!b&&u.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!b&&u.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!u.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(u.canPlayType("audio/x-flac;")||u.canPlayType("audio/flac;")).replace(/^no$/,"")},c},_unlockAudio:function(){var c=this||i;if(!(c._audioUnlocked||!c.ctx)){c._audioUnlocked=!1,c.autoUnlock=!1,!c._mobileUnloaded&&c.ctx.sampleRate!==44100&&(c._mobileUnloaded=!0,c.unload()),c._scratchBuffer=c.ctx.createBuffer(1,1,22050);var u=function(d){for(;c._html5AudioPool.length<c.html5PoolSize;)try{var m=new Audio;m._unlocked=!0,c._releaseHtml5Audio(m)}catch{c.noAudio=!0;break}for(var g=0;g<c._howls.length;g++)if(!c._howls[g]._webAudio)for(var p=c._howls[g]._getSoundIds(),v=0;v<p.length;v++){var y=c._howls[g]._soundById(p[v]);y&&y._node&&!y._node._unlocked&&(y._node._unlocked=!0,y._node.load())}c._autoResume();var b=c.ctx.createBufferSource();b.buffer=c._scratchBuffer,b.connect(c.ctx.destination),typeof b.start>"u"?b.noteOn(0):b.start(0),typeof c.ctx.resume=="function"&&c.ctx.resume(),b.onended=function(){b.disconnect(0),c._audioUnlocked=!0,document.removeEventListener("touchstart",u,!0),document.removeEventListener("touchend",u,!0),document.removeEventListener("click",u,!0),document.removeEventListener("keydown",u,!0);for(var x=0;x<c._howls.length;x++)c._howls[x]._emit("unlock")}};return document.addEventListener("touchstart",u,!0),document.addEventListener("touchend",u,!0),document.addEventListener("click",u,!0),document.addEventListener("keydown",u,!0),c}},_obtainHtml5Audio:function(){var c=this||i;if(c._html5AudioPool.length)return c._html5AudioPool.pop();var u=new Audio().play();return u&&typeof Promise<"u"&&(u instanceof Promise||typeof u.then=="function")&&u.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(c){var u=this||i;return c._unlocked&&u._html5AudioPool.push(c),u},_autoSuspend:function(){var c=this;if(!(!c.autoSuspend||!c.ctx||typeof c.ctx.suspend>"u"||!i.usingWebAudio)){for(var u=0;u<c._howls.length;u++)if(c._howls[u]._webAudio){for(var d=0;d<c._howls[u]._sounds.length;d++)if(!c._howls[u]._sounds[d]._paused)return c}return c._suspendTimer&&clearTimeout(c._suspendTimer),c._suspendTimer=setTimeout(function(){if(c.autoSuspend){c._suspendTimer=null,c.state="suspending";var m=function(){c.state="suspended",c._resumeAfterSuspend&&(delete c._resumeAfterSuspend,c._autoResume())};c.ctx.suspend().then(m,m)}},3e4),c}},_autoResume:function(){var c=this;if(!(!c.ctx||typeof c.ctx.resume>"u"||!i.usingWebAudio))return c.state==="running"&&c.ctx.state!=="interrupted"&&c._suspendTimer?(clearTimeout(c._suspendTimer),c._suspendTimer=null):c.state==="suspended"||c.state==="running"&&c.ctx.state==="interrupted"?(c.ctx.resume().then(function(){c.state="running";for(var u=0;u<c._howls.length;u++)c._howls[u]._emit("resume")}),c._suspendTimer&&(clearTimeout(c._suspendTimer),c._suspendTimer=null)):c.state==="suspending"&&(c._resumeAfterSuspend=!0),c}};var i=new e,n=function(c){var u=this;if(!c.src||c.src.length===0){console.error("An array of source files must be passed with any new Howl.");return}u.init(c)};n.prototype={init:function(c){var u=this;return i.ctx||f(),u._autoplay=c.autoplay||!1,u._format=typeof c.format!="string"?c.format:[c.format],u._html5=c.html5||!1,u._muted=c.mute||!1,u._loop=c.loop||!1,u._pool=c.pool||5,u._preload=typeof c.preload=="boolean"||c.preload==="metadata"?c.preload:!0,u._rate=c.rate||1,u._sprite=c.sprite||{},u._src=typeof c.src!="string"?c.src:[c.src],u._volume=c.volume!==void 0?c.volume:1,u._xhr={method:c.xhr&&c.xhr.method?c.xhr.method:"GET",headers:c.xhr&&c.xhr.headers?c.xhr.headers:null,withCredentials:c.xhr&&c.xhr.withCredentials?c.xhr.withCredentials:!1},u._duration=0,u._state="unloaded",u._sounds=[],u._endTimers={},u._queue=[],u._playLock=!1,u._onend=c.onend?[{fn:c.onend}]:[],u._onfade=c.onfade?[{fn:c.onfade}]:[],u._onload=c.onload?[{fn:c.onload}]:[],u._onloaderror=c.onloaderror?[{fn:c.onloaderror}]:[],u._onplayerror=c.onplayerror?[{fn:c.onplayerror}]:[],u._onpause=c.onpause?[{fn:c.onpause}]:[],u._onplay=c.onplay?[{fn:c.onplay}]:[],u._onstop=c.onstop?[{fn:c.onstop}]:[],u._onmute=c.onmute?[{fn:c.onmute}]:[],u._onvolume=c.onvolume?[{fn:c.onvolume}]:[],u._onrate=c.onrate?[{fn:c.onrate}]:[],u._onseek=c.onseek?[{fn:c.onseek}]:[],u._onunlock=c.onunlock?[{fn:c.onunlock}]:[],u._onresume=[],u._webAudio=i.usingWebAudio&&!u._html5,typeof i.ctx<"u"&&i.ctx&&i.autoUnlock&&i._unlockAudio(),i._howls.push(u),u._autoplay&&u._queue.push({event:"play",action:function(){u.play()}}),u._preload&&u._preload!=="none"&&u.load(),u},load:function(){var c=this,u=null;if(i.noAudio){c._emit("loaderror",null,"No audio support.");return}typeof c._src=="string"&&(c._src=[c._src]);for(var d=0;d<c._src.length;d++){var m,g;if(c._format&&c._format[d])m=c._format[d];else{if(g=c._src[d],typeof g!="string"){c._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}m=/^data:audio\/([^;,]+);/i.exec(g),m||(m=/\.([^.]+)$/.exec(g.split("?",1)[0])),m&&(m=m[1].toLowerCase())}if(m||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),m&&i.codecs(m)){u=c._src[d];break}}if(!u){c._emit("loaderror",null,"No codec support for selected audio sources.");return}return c._src=u,c._state="loading",window.location.protocol==="https:"&&u.slice(0,5)==="http:"&&(c._html5=!0,c._webAudio=!1),new r(c),c._webAudio&&o(c),c},play:function(c,u){var d=this,m=null;if(typeof c=="number")m=c,c=null;else{if(typeof c=="string"&&d._state==="loaded"&&!d._sprite[c])return null;if(typeof c>"u"&&(c="__default",!d._playLock)){for(var g=0,p=0;p<d._sounds.length;p++)d._sounds[p]._paused&&!d._sounds[p]._ended&&(g++,m=d._sounds[p]._id);g===1?c=null:m=null}}var v=m?d._soundById(m):d._inactiveSound();if(!v)return null;if(m&&!c&&(c=v._sprite||"__default"),d._state!=="loaded"){v._sprite=c,v._ended=!1;var y=v._id;return d._queue.push({event:"play",action:function(){d.play(y)}}),y}if(m&&!v._paused)return u||d._loadQueue("play"),v._id;d._webAudio&&i._autoResume();var b=Math.max(0,v._seek>0?v._seek:d._sprite[c][0]/1e3),x=Math.max(0,(d._sprite[c][0]+d._sprite[c][1])/1e3-b),M=x*1e3/Math.abs(v._rate),w=d._sprite[c][0]/1e3,T=(d._sprite[c][0]+d._sprite[c][1])/1e3;v._sprite=c,v._ended=!1;var _=function(){v._paused=!1,v._seek=b,v._start=w,v._stop=T,v._loop=!!(v._loop||d._sprite[c][2])};if(b>=T){d._ended(v);return}var A=v._node;if(d._webAudio){var S=function(){d._playLock=!1,_(),d._refreshBuffer(v);var I=v._muted||d._muted?0:v._volume;A.gain.setValueAtTime(I,i.ctx.currentTime),v._playStart=i.ctx.currentTime,typeof A.bufferSource.start>"u"?v._loop?A.bufferSource.noteGrainOn(0,b,86400):A.bufferSource.noteGrainOn(0,b,x):v._loop?A.bufferSource.start(0,b,86400):A.bufferSource.start(0,b,x),M!==1/0&&(d._endTimers[v._id]=setTimeout(d._ended.bind(d,v),M)),u||setTimeout(function(){d._emit("play",v._id),d._loadQueue()},0)};i.state==="running"&&i.ctx.state!=="interrupted"?S():(d._playLock=!0,d.once("resume",S),d._clearTimer(v._id))}else{var D=function(){A.currentTime=b,A.muted=v._muted||d._muted||i._muted||A.muted,A.volume=v._volume*i.volume(),A.playbackRate=v._rate;try{var I=A.play();if(I&&typeof Promise<"u"&&(I instanceof Promise||typeof I.then=="function")?(d._playLock=!0,_(),I.then(function(){d._playLock=!1,A._unlocked=!0,u?d._loadQueue():d._emit("play",v._id)}).catch(function(){d._playLock=!1,d._emit("playerror",v._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),v._ended=!0,v._paused=!0})):u||(d._playLock=!1,_(),d._emit("play",v._id)),A.playbackRate=v._rate,A.paused){d._emit("playerror",v._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");return}c!=="__default"||v._loop?d._endTimers[v._id]=setTimeout(d._ended.bind(d,v),M):(d._endTimers[v._id]=function(){d._ended(v),A.removeEventListener("ended",d._endTimers[v._id],!1)},A.addEventListener("ended",d._endTimers[v._id],!1))}catch(H){d._emit("playerror",v._id,H)}};A.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(A.src=d._src,A.load());var O=window&&window.ejecta||!A.readyState&&i._navigator.isCocoonJS;if(A.readyState>=3||O)D();else{d._playLock=!0,d._state="loading";var z=function(){d._state="loaded",D(),A.removeEventListener(i._canPlayEvent,z,!1)};A.addEventListener(i._canPlayEvent,z,!1),d._clearTimer(v._id)}}return v._id},pause:function(c){var u=this;if(u._state!=="loaded"||u._playLock)return u._queue.push({event:"pause",action:function(){u.pause(c)}}),u;for(var d=u._getSoundIds(c),m=0;m<d.length;m++){u._clearTimer(d[m]);var g=u._soundById(d[m]);if(g&&!g._paused&&(g._seek=u.seek(d[m]),g._rateSeek=0,g._paused=!0,u._stopFade(d[m]),g._node))if(u._webAudio){if(!g._node.bufferSource)continue;typeof g._node.bufferSource.stop>"u"?g._node.bufferSource.noteOff(0):g._node.bufferSource.stop(0),u._cleanBuffer(g._node)}else(!isNaN(g._node.duration)||g._node.duration===1/0)&&g._node.pause();arguments[1]||u._emit("pause",g?g._id:null)}return u},stop:function(c,u){var d=this;if(d._state!=="loaded"||d._playLock)return d._queue.push({event:"stop",action:function(){d.stop(c)}}),d;for(var m=d._getSoundIds(c),g=0;g<m.length;g++){d._clearTimer(m[g]);var p=d._soundById(m[g]);p&&(p._seek=p._start||0,p._rateSeek=0,p._paused=!0,p._ended=!0,d._stopFade(m[g]),p._node&&(d._webAudio?p._node.bufferSource&&(typeof p._node.bufferSource.stop>"u"?p._node.bufferSource.noteOff(0):p._node.bufferSource.stop(0),d._cleanBuffer(p._node)):(!isNaN(p._node.duration)||p._node.duration===1/0)&&(p._node.currentTime=p._start||0,p._node.pause(),p._node.duration===1/0&&d._clearSound(p._node))),u||d._emit("stop",p._id))}return d},mute:function(c,u){var d=this;if(d._state!=="loaded"||d._playLock)return d._queue.push({event:"mute",action:function(){d.mute(c,u)}}),d;if(typeof u>"u")if(typeof c=="boolean")d._muted=c;else return d._muted;for(var m=d._getSoundIds(u),g=0;g<m.length;g++){var p=d._soundById(m[g]);p&&(p._muted=c,p._interval&&d._stopFade(p._id),d._webAudio&&p._node?p._node.gain.setValueAtTime(c?0:p._volume,i.ctx.currentTime):p._node&&(p._node.muted=i._muted?!0:c),d._emit("mute",p._id))}return d},volume:function(){var c=this,u=arguments,d,m;if(u.length===0)return c._volume;if(u.length===1||u.length===2&&typeof u[1]>"u"){var g=c._getSoundIds(),p=g.indexOf(u[0]);p>=0?m=parseInt(u[0],10):d=parseFloat(u[0])}else u.length>=2&&(d=parseFloat(u[0]),m=parseInt(u[1],10));var v;if(typeof d<"u"&&d>=0&&d<=1){if(c._state!=="loaded"||c._playLock)return c._queue.push({event:"volume",action:function(){c.volume.apply(c,u)}}),c;typeof m>"u"&&(c._volume=d),m=c._getSoundIds(m);for(var y=0;y<m.length;y++)v=c._soundById(m[y]),v&&(v._volume=d,u[2]||c._stopFade(m[y]),c._webAudio&&v._node&&!v._muted?v._node.gain.setValueAtTime(d,i.ctx.currentTime):v._node&&!v._muted&&(v._node.volume=d*i.volume()),c._emit("volume",v._id))}else return v=m?c._soundById(m):c._sounds[0],v?v._volume:0;return c},fade:function(c,u,d,m){var g=this;if(g._state!=="loaded"||g._playLock)return g._queue.push({event:"fade",action:function(){g.fade(c,u,d,m)}}),g;c=Math.min(Math.max(0,parseFloat(c)),1),u=Math.min(Math.max(0,parseFloat(u)),1),d=parseFloat(d),g.volume(c,m);for(var p=g._getSoundIds(m),v=0;v<p.length;v++){var y=g._soundById(p[v]);if(y){if(m||g._stopFade(p[v]),g._webAudio&&!y._muted){var b=i.ctx.currentTime,x=b+d/1e3;y._volume=c,y._node.gain.setValueAtTime(c,b),y._node.gain.linearRampToValueAtTime(u,x)}g._startFadeInterval(y,c,u,d,p[v],typeof m>"u")}}return g},_startFadeInterval:function(c,u,d,m,g,p){var v=this,y=u,b=d-u,x=Math.abs(b/.01),M=Math.max(4,x>0?m/x:m),w=Date.now();c._fadeTo=d,c._interval=setInterval(function(){var T=(Date.now()-w)/m;w=Date.now(),y+=b*T,y=Math.round(y*100)/100,b<0?y=Math.max(d,y):y=Math.min(d,y),v._webAudio?c._volume=y:v.volume(y,c._id,!0),p&&(v._volume=y),(d<u&&y<=d||d>u&&y>=d)&&(clearInterval(c._interval),c._interval=null,c._fadeTo=null,v.volume(d,c._id),v._emit("fade",c._id))},M)},_stopFade:function(c){var u=this,d=u._soundById(c);return d&&d._interval&&(u._webAudio&&d._node.gain.cancelScheduledValues(i.ctx.currentTime),clearInterval(d._interval),d._interval=null,u.volume(d._fadeTo,c),d._fadeTo=null,u._emit("fade",c)),u},loop:function(){var c=this,u=arguments,d,m,g;if(u.length===0)return c._loop;if(u.length===1)if(typeof u[0]=="boolean")d=u[0],c._loop=d;else return g=c._soundById(parseInt(u[0],10)),g?g._loop:!1;else u.length===2&&(d=u[0],m=parseInt(u[1],10));for(var p=c._getSoundIds(m),v=0;v<p.length;v++)g=c._soundById(p[v]),g&&(g._loop=d,c._webAudio&&g._node&&g._node.bufferSource&&(g._node.bufferSource.loop=d,d&&(g._node.bufferSource.loopStart=g._start||0,g._node.bufferSource.loopEnd=g._stop,c.playing(p[v])&&(c.pause(p[v],!0),c.play(p[v],!0)))));return c},rate:function(){var c=this,u=arguments,d,m;if(u.length===0)m=c._sounds[0]._id;else if(u.length===1){var g=c._getSoundIds(),p=g.indexOf(u[0]);p>=0?m=parseInt(u[0],10):d=parseFloat(u[0])}else u.length===2&&(d=parseFloat(u[0]),m=parseInt(u[1],10));var v;if(typeof d=="number"){if(c._state!=="loaded"||c._playLock)return c._queue.push({event:"rate",action:function(){c.rate.apply(c,u)}}),c;typeof m>"u"&&(c._rate=d),m=c._getSoundIds(m);for(var y=0;y<m.length;y++)if(v=c._soundById(m[y]),v){c.playing(m[y])&&(v._rateSeek=c.seek(m[y]),v._playStart=c._webAudio?i.ctx.currentTime:v._playStart),v._rate=d,c._webAudio&&v._node&&v._node.bufferSource?v._node.bufferSource.playbackRate.setValueAtTime(d,i.ctx.currentTime):v._node&&(v._node.playbackRate=d);var b=c.seek(m[y]),x=(c._sprite[v._sprite][0]+c._sprite[v._sprite][1])/1e3-b,M=x*1e3/Math.abs(v._rate);(c._endTimers[m[y]]||!v._paused)&&(c._clearTimer(m[y]),c._endTimers[m[y]]=setTimeout(c._ended.bind(c,v),M)),c._emit("rate",v._id)}}else return v=c._soundById(m),v?v._rate:c._rate;return c},seek:function(){var c=this,u=arguments,d,m;if(u.length===0)c._sounds.length&&(m=c._sounds[0]._id);else if(u.length===1){var g=c._getSoundIds(),p=g.indexOf(u[0]);p>=0?m=parseInt(u[0],10):c._sounds.length&&(m=c._sounds[0]._id,d=parseFloat(u[0]))}else u.length===2&&(d=parseFloat(u[0]),m=parseInt(u[1],10));if(typeof m>"u")return 0;if(typeof d=="number"&&(c._state!=="loaded"||c._playLock))return c._queue.push({event:"seek",action:function(){c.seek.apply(c,u)}}),c;var v=c._soundById(m);if(v)if(typeof d=="number"&&d>=0){var y=c.playing(m);y&&c.pause(m,!0),v._seek=d,v._ended=!1,c._clearTimer(m),!c._webAudio&&v._node&&!isNaN(v._node.duration)&&(v._node.currentTime=d);var b=function(){y&&c.play(m,!0),c._emit("seek",m)};if(y&&!c._webAudio){var x=function(){c._playLock?setTimeout(x,0):b()};setTimeout(x,0)}else b()}else if(c._webAudio){var M=c.playing(m)?i.ctx.currentTime-v._playStart:0,w=v._rateSeek?v._rateSeek-v._seek:0;return v._seek+(w+M*Math.abs(v._rate))}else return v._node.currentTime;return c},playing:function(c){var u=this;if(typeof c=="number"){var d=u._soundById(c);return d?!d._paused:!1}for(var m=0;m<u._sounds.length;m++)if(!u._sounds[m]._paused)return!0;return!1},duration:function(c){var u=this,d=u._duration,m=u._soundById(c);return m&&(d=u._sprite[m._sprite][1]/1e3),d},state:function(){return this._state},unload:function(){for(var c=this,u=c._sounds,d=0;d<u.length;d++)u[d]._paused||c.stop(u[d]._id),c._webAudio||(c._clearSound(u[d]._node),u[d]._node.removeEventListener("error",u[d]._errorFn,!1),u[d]._node.removeEventListener(i._canPlayEvent,u[d]._loadFn,!1),u[d]._node.removeEventListener("ended",u[d]._endFn,!1),i._releaseHtml5Audio(u[d]._node)),delete u[d]._node,c._clearTimer(u[d]._id);var m=i._howls.indexOf(c);m>=0&&i._howls.splice(m,1);var g=!0;for(d=0;d<i._howls.length;d++)if(i._howls[d]._src===c._src||c._src.indexOf(i._howls[d]._src)>=0){g=!1;break}return s&&g&&delete s[c._src],i.noAudio=!1,c._state="unloaded",c._sounds=[],c=null,null},on:function(c,u,d,m){var g=this,p=g["_on"+c];return typeof u=="function"&&p.push(m?{id:d,fn:u,once:m}:{id:d,fn:u}),g},off:function(c,u,d){var m=this,g=m["_on"+c],p=0;if(typeof u=="number"&&(d=u,u=null),u||d)for(p=0;p<g.length;p++){var v=d===g[p].id;if(u===g[p].fn&&v||!u&&v){g.splice(p,1);break}}else if(c)m["_on"+c]=[];else{var y=Object.keys(m);for(p=0;p<y.length;p++)y[p].indexOf("_on")===0&&Array.isArray(m[y[p]])&&(m[y[p]]=[])}return m},once:function(c,u,d){var m=this;return m.on(c,u,d,1),m},_emit:function(c,u,d){for(var m=this,g=m["_on"+c],p=g.length-1;p>=0;p--)(!g[p].id||g[p].id===u||c==="load")&&(setTimeout(function(v){v.call(this,u,d)}.bind(m,g[p].fn),0),g[p].once&&m.off(c,g[p].fn,g[p].id));return m._loadQueue(c),m},_loadQueue:function(c){var u=this;if(u._queue.length>0){var d=u._queue[0];d.event===c&&(u._queue.shift(),u._loadQueue()),c||d.action()}return u},_ended:function(c){var u=this,d=c._sprite;if(!u._webAudio&&c._node&&!c._node.paused&&!c._node.ended&&c._node.currentTime<c._stop)return setTimeout(u._ended.bind(u,c),100),u;var m=!!(c._loop||u._sprite[d][2]);if(u._emit("end",c._id),!u._webAudio&&m&&u.stop(c._id,!0).play(c._id),u._webAudio&&m){u._emit("play",c._id),c._seek=c._start||0,c._rateSeek=0,c._playStart=i.ctx.currentTime;var g=(c._stop-c._start)*1e3/Math.abs(c._rate);u._endTimers[c._id]=setTimeout(u._ended.bind(u,c),g)}return u._webAudio&&!m&&(c._paused=!0,c._ended=!0,c._seek=c._start||0,c._rateSeek=0,u._clearTimer(c._id),u._cleanBuffer(c._node),i._autoSuspend()),!u._webAudio&&!m&&u.stop(c._id,!0),u},_clearTimer:function(c){var u=this;if(u._endTimers[c]){if(typeof u._endTimers[c]!="function")clearTimeout(u._endTimers[c]);else{var d=u._soundById(c);d&&d._node&&d._node.removeEventListener("ended",u._endTimers[c],!1)}delete u._endTimers[c]}return u},_soundById:function(c){for(var u=this,d=0;d<u._sounds.length;d++)if(c===u._sounds[d]._id)return u._sounds[d];return null},_inactiveSound:function(){var c=this;c._drain();for(var u=0;u<c._sounds.length;u++)if(c._sounds[u]._ended)return c._sounds[u].reset();return new r(c)},_drain:function(){var c=this,u=c._pool,d=0,m=0;if(!(c._sounds.length<u)){for(m=0;m<c._sounds.length;m++)c._sounds[m]._ended&&d++;for(m=c._sounds.length-1;m>=0;m--){if(d<=u)return;c._sounds[m]._ended&&(c._webAudio&&c._sounds[m]._node&&c._sounds[m]._node.disconnect(0),c._sounds.splice(m,1),d--)}}},_getSoundIds:function(c){var u=this;if(typeof c>"u"){for(var d=[],m=0;m<u._sounds.length;m++)d.push(u._sounds[m]._id);return d}else return[c]},_refreshBuffer:function(c){var u=this;return c._node.bufferSource=i.ctx.createBufferSource(),c._node.bufferSource.buffer=s[u._src],c._panner?c._node.bufferSource.connect(c._panner):c._node.bufferSource.connect(c._node),c._node.bufferSource.loop=c._loop,c._loop&&(c._node.bufferSource.loopStart=c._start||0,c._node.bufferSource.loopEnd=c._stop||0),c._node.bufferSource.playbackRate.setValueAtTime(c._rate,i.ctx.currentTime),u},_cleanBuffer:function(c){var u=this,d=i._navigator&&i._navigator.vendor.indexOf("Apple")>=0;if(i._scratchBuffer&&c.bufferSource&&(c.bufferSource.onended=null,c.bufferSource.disconnect(0),d))try{c.bufferSource.buffer=i._scratchBuffer}catch{}return c.bufferSource=null,u},_clearSound:function(c){var u=/MSIE |Trident\//.test(i._navigator&&i._navigator.userAgent);u||(c.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var r=function(c){this._parent=c,this.init()};r.prototype={init:function(){var c=this,u=c._parent;return c._muted=u._muted,c._loop=u._loop,c._volume=u._volume,c._rate=u._rate,c._seek=0,c._paused=!0,c._ended=!0,c._sprite="__default",c._id=++i._counter,u._sounds.push(c),c.create(),c},create:function(){var c=this,u=c._parent,d=i._muted||c._muted||c._parent._muted?0:c._volume;return u._webAudio?(c._node=typeof i.ctx.createGain>"u"?i.ctx.createGainNode():i.ctx.createGain(),c._node.gain.setValueAtTime(d,i.ctx.currentTime),c._node.paused=!0,c._node.connect(i.masterGain)):i.noAudio||(c._node=i._obtainHtml5Audio(),c._errorFn=c._errorListener.bind(c),c._node.addEventListener("error",c._errorFn,!1),c._loadFn=c._loadListener.bind(c),c._node.addEventListener(i._canPlayEvent,c._loadFn,!1),c._endFn=c._endListener.bind(c),c._node.addEventListener("ended",c._endFn,!1),c._node.src=u._src,c._node.preload=u._preload===!0?"auto":u._preload,c._node.volume=d*i.volume(),c._node.load()),c},reset:function(){var c=this,u=c._parent;return c._muted=u._muted,c._loop=u._loop,c._volume=u._volume,c._rate=u._rate,c._seek=0,c._rateSeek=0,c._paused=!0,c._ended=!0,c._sprite="__default",c._id=++i._counter,c},_errorListener:function(){var c=this;c._parent._emit("loaderror",c._id,c._node.error?c._node.error.code:0),c._node.removeEventListener("error",c._errorFn,!1)},_loadListener:function(){var c=this,u=c._parent;u._duration=Math.ceil(c._node.duration*10)/10,Object.keys(u._sprite).length===0&&(u._sprite={__default:[0,u._duration*1e3]}),u._state!=="loaded"&&(u._state="loaded",u._emit("load"),u._loadQueue()),c._node.removeEventListener(i._canPlayEvent,c._loadFn,!1)},_endListener:function(){var c=this,u=c._parent;u._duration===1/0&&(u._duration=Math.ceil(c._node.duration*10)/10,u._sprite.__default[1]===1/0&&(u._sprite.__default[1]=u._duration*1e3),u._ended(c)),c._node.removeEventListener("ended",c._endFn,!1)}};var s={},o=function(c){var u=c._src;if(s[u]){c._duration=s[u].duration,h(c);return}if(/^data:[^;]+;base64,/.test(u)){for(var d=atob(u.split(",")[1]),m=new Uint8Array(d.length),g=0;g<d.length;++g)m[g]=d.charCodeAt(g);l(m.buffer,c)}else{var p=new XMLHttpRequest;p.open(c._xhr.method,u,!0),p.withCredentials=c._xhr.withCredentials,p.responseType="arraybuffer",c._xhr.headers&&Object.keys(c._xhr.headers).forEach(function(v){p.setRequestHeader(v,c._xhr.headers[v])}),p.onload=function(){var v=(p.status+"")[0];if(v!=="0"&&v!=="2"&&v!=="3"){c._emit("loaderror",null,"Failed loading audio file with status: "+p.status+".");return}l(p.response,c)},p.onerror=function(){c._webAudio&&(c._html5=!0,c._webAudio=!1,c._sounds=[],delete s[u],c.load())},a(p)}},a=function(c){try{c.send()}catch{c.onerror()}},l=function(c,u){var d=function(){u._emit("loaderror",null,"Decoding audio data failed.")},m=function(g){g&&u._sounds.length>0?(s[u._src]=g,h(u,g)):d()};typeof Promise<"u"&&i.ctx.decodeAudioData.length===1?i.ctx.decodeAudioData(c).then(m).catch(d):i.ctx.decodeAudioData(c,m,d)},h=function(c,u){u&&!c._duration&&(c._duration=u.duration),Object.keys(c._sprite).length===0&&(c._sprite={__default:[0,c._duration*1e3]}),c._state!=="loaded"&&(c._state="loaded",c._emit("load"),c._loadQueue())},f=function(){if(i.usingWebAudio){try{typeof AudioContext<"u"?i.ctx=new AudioContext:typeof webkitAudioContext<"u"?i.ctx=new webkitAudioContext:i.usingWebAudio=!1}catch{i.usingWebAudio=!1}i.ctx||(i.usingWebAudio=!1);var c=/iP(hone|od|ad)/.test(i._navigator&&i._navigator.platform),u=i._navigator&&i._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),d=u?parseInt(u[1],10):null;if(c&&d&&d<9){var m=/safari/.test(i._navigator&&i._navigator.userAgent.toLowerCase());i._navigator&&!m&&(i.usingWebAudio=!1)}i.usingWebAudio&&(i.masterGain=typeof i.ctx.createGain>"u"?i.ctx.createGainNode():i.ctx.createGain(),i.masterGain.gain.setValueAtTime(i._muted?0:i._volume,i.ctx.currentTime),i.masterGain.connect(i.ctx.destination)),i._setup()}};typeof define=="function"&&define.amd&&define([],function(){return{Howler:i,Howl:n}}),typeof t<"u"&&(t.Howler=i,t.Howl=n),typeof global<"u"?(global.HowlerGlobal=e,global.Howler=i,global.Howl=n,global.Sound=r):typeof window<"u"&&(window.HowlerGlobal=e,window.Howler=i,window.Howl=n,window.Sound=r)})(),function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(i){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var r=n._howls.length-1;r>=0;r--)n._howls[r].stereo(i);return n},HowlerGlobal.prototype.pos=function(i,n,r){var s=this;if(!s.ctx||!s.ctx.listener)return s;if(n=typeof n!="number"?s._pos[1]:n,r=typeof r!="number"?s._pos[2]:r,typeof i=="number")s._pos=[i,n,r],typeof s.ctx.listener.positionX<"u"?(s.ctx.listener.positionX.setTargetAtTime(s._pos[0],Howler.ctx.currentTime,.1),s.ctx.listener.positionY.setTargetAtTime(s._pos[1],Howler.ctx.currentTime,.1),s.ctx.listener.positionZ.setTargetAtTime(s._pos[2],Howler.ctx.currentTime,.1)):s.ctx.listener.setPosition(s._pos[0],s._pos[1],s._pos[2]);else return s._pos;return s},HowlerGlobal.prototype.orientation=function(i,n,r,s,o,a){var l=this;if(!l.ctx||!l.ctx.listener)return l;var h=l._orientation;if(n=typeof n!="number"?h[1]:n,r=typeof r!="number"?h[2]:r,s=typeof s!="number"?h[3]:s,o=typeof o!="number"?h[4]:o,a=typeof a!="number"?h[5]:a,typeof i=="number")l._orientation=[i,n,r,s,o,a],typeof l.ctx.listener.forwardX<"u"?(l.ctx.listener.forwardX.setTargetAtTime(i,Howler.ctx.currentTime,.1),l.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),l.ctx.listener.forwardZ.setTargetAtTime(r,Howler.ctx.currentTime,.1),l.ctx.listener.upX.setTargetAtTime(s,Howler.ctx.currentTime,.1),l.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),l.ctx.listener.upZ.setTargetAtTime(a,Howler.ctx.currentTime,.1)):l.ctx.listener.setOrientation(i,n,r,s,o,a);else return h;return l},Howl.prototype.init=function(i){return function(n){var r=this;return r._orientation=n.orientation||[1,0,0],r._stereo=n.stereo||null,r._pos=n.pos||null,r._pannerAttr={coneInnerAngle:typeof n.coneInnerAngle<"u"?n.coneInnerAngle:360,coneOuterAngle:typeof n.coneOuterAngle<"u"?n.coneOuterAngle:360,coneOuterGain:typeof n.coneOuterGain<"u"?n.coneOuterGain:0,distanceModel:typeof n.distanceModel<"u"?n.distanceModel:"inverse",maxDistance:typeof n.maxDistance<"u"?n.maxDistance:1e4,panningModel:typeof n.panningModel<"u"?n.panningModel:"HRTF",refDistance:typeof n.refDistance<"u"?n.refDistance:1,rolloffFactor:typeof n.rolloffFactor<"u"?n.rolloffFactor:1},r._onstereo=n.onstereo?[{fn:n.onstereo}]:[],r._onpos=n.onpos?[{fn:n.onpos}]:[],r._onorientation=n.onorientation?[{fn:n.onorientation}]:[],i.call(this,n)}}(Howl.prototype.init),Howl.prototype.stereo=function(i,n){var r=this;if(!r._webAudio)return r;if(r._state!=="loaded")return r._queue.push({event:"stereo",action:function(){r.stereo(i,n)}}),r;var s=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof n>"u")if(typeof i=="number")r._stereo=i,r._pos=[i,0,0];else return r._stereo;for(var o=r._getSoundIds(n),a=0;a<o.length;a++){var l=r._soundById(o[a]);if(l)if(typeof i=="number")l._stereo=i,l._pos=[i,0,0],l._node&&(l._pannerAttr.panningModel="equalpower",(!l._panner||!l._panner.pan)&&e(l,s),s==="spatial"?typeof l._panner.positionX<"u"?(l._panner.positionX.setValueAtTime(i,Howler.ctx.currentTime),l._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),l._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):l._panner.setPosition(i,0,0):l._panner.pan.setValueAtTime(i,Howler.ctx.currentTime)),r._emit
vendor: 6,187 bytes, line 3113
3113("stereo",l._id);else return l._stereo}return r},Howl.prototype.pos=function(i,n,r,s){var o=this;if(!o._webAudio)return o;if(o._state!=="loaded")return o._queue.push({event:"pos",action:function(){o.pos(i,n,r,s)}}),o;if(n=typeof n!="number"?0:n,r=typeof r!="number"?-.5:r,typeof s>"u")if(typeof i=="number")o._pos=[i,n,r];else return o._pos;for(var a=o._getSoundIds(s),l=0;l<a.length;l++){var h=o._soundById(a[l]);if(h)if(typeof i=="number")h._pos=[i,n,r],h._node&&((!h._panner||h._panner.pan)&&e(h,"spatial"),typeof h._panner.positionX<"u"?(h._panner.positionX.setValueAtTime(i,Howler.ctx.currentTime),h._panner.positionY.setValueAtTime(n,Howler.ctx.currentTime),h._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):h._panner.setPosition(i,n,r)),o._emit("pos",h._id);else return h._pos}return o},Howl.prototype.orientation=function(i,n,r,s){var o=this;if(!o._webAudio)return o;if(o._state!=="loaded")return o._queue.push({event:"orientation",action:function(){o.orientation(i,n,r,s)}}),o;if(n=typeof n!="number"?o._orientation[1]:n,r=typeof r!="number"?o._orientation[2]:r,typeof s>"u")if(typeof i=="number")o._orientation=[i,n,r];else return o._orientation;for(var a=o._getSoundIds(s),l=0;l<a.length;l++){var h=o._soundById(a[l]);if(h)if(typeof i=="number")h._orientation=[i,n,r],h._node&&(h._panner||(h._pos||(h._pos=o._pos||[0,0,-.5]),e(h,"spatial")),typeof h._panner.orientationX<"u"?(h._panner.orientationX.setValueAtTime(i,Howler.ctx.currentTime),h._panner.orientationY.setValueAtTime(n,Howler.ctx.currentTime),h._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):h._panner.setOrientation(i,n,r)),o._emit("orientation",h._id);else return h._orientation}return o},Howl.prototype.pannerAttr=function(){var i=this,n=arguments,r,s,o;if(!i._webAudio)return i;if(n.length===0)return i._pannerAttr;if(n.length===1)if(typeof n[0]=="object")r=n[0],typeof s>"u"&&(r.pannerAttr||(r.pannerAttr={coneInnerAngle:r.coneInnerAngle,coneOuterAngle:r.coneOuterAngle,coneOuterGain:r.coneOuterGain,distanceModel:r.distanceModel,maxDistance:r.maxDistance,refDistance:r.refDistance,rolloffFactor:r.rolloffFactor,panningModel:r.panningModel}),i._pannerAttr={coneInnerAngle:typeof r.pannerAttr.coneInnerAngle<"u"?r.pannerAttr.coneInnerAngle:i._coneInnerAngle,coneOuterAngle:typeof r.pannerAttr.coneOuterAngle<"u"?r.pannerAttr.coneOuterAngle:i._coneOuterAngle,coneOuterGain:typeof r.pannerAttr.coneOuterGain<"u"?r.pannerAttr.coneOuterGain:i._coneOuterGain,distanceModel:typeof r.pannerAttr.distanceModel<"u"?r.pannerAttr.distanceModel:i._distanceModel,maxDistance:typeof r.pannerAttr.maxDistance<"u"?r.pannerAttr.maxDistance:i._maxDistance,refDistance:typeof r.pannerAttr.refDistance<"u"?r.pannerAttr.refDistance:i._refDistance,rolloffFactor:typeof r.pannerAttr.rolloffFactor<"u"?r.pannerAttr.rolloffFactor:i._rolloffFactor,panningModel:typeof r.pannerAttr.panningModel<"u"?r.pannerAttr.panningModel:i._panningModel});else return o=i._soundById(parseInt(n[0],10)),o?o._pannerAttr:i._pannerAttr;else n.length===2&&(r=n[0],s=parseInt(n[1],10));for(var a=i._getSoundIds(s),l=0;l<a.length;l++)if(o=i._soundById(a[l]),o){var h=o._pannerAttr;h={coneInnerAngle:typeof r.coneInnerAngle<"u"?r.coneInnerAngle:h.coneInnerAngle,coneOuterAngle:typeof r.coneOuterAngle<"u"?r.coneOuterAngle:h.coneOuterAngle,coneOuterGain:typeof r.coneOuterGain<"u"?r.coneOuterGain:h.coneOuterGain,distanceModel:typeof r.distanceModel<"u"?r.distanceModel:h.distanceModel,maxDistance:typeof r.maxDistance<"u"?r.maxDistance:h.maxDistance,refDistance:typeof r.refDistance<"u"?r.refDistance:h.refDistance,rolloffFactor:typeof r.rolloffFactor<"u"?r.rolloffFactor:h.rolloffFactor,panningModel:typeof r.panningModel<"u"?r.panningModel:h.panningModel};var f=o._panner;f?(f.coneInnerAngle=h.coneInnerAngle,f.coneOuterAngle=h.coneOuterAngle,f.coneOuterGain=h.coneOuterGain,f.distanceModel=h.distanceModel,f.maxDistance=h.maxDistance,f.refDistance=h.refDistance,f.rolloffFactor=h.rolloffFactor,f.panningModel=h.panningModel):(o._pos||(o._pos=i._pos||[0,0,-.5]),e(o,"spatial"))}return i},Sound.prototype.init=function(i){return function(){var n=this,r=n._parent;n._orientation=r._orientation,n._stereo=r._stereo,n._pos=r._pos,n._pannerAttr=r._pannerAttr,i.call(this),n._stereo?r.stereo(n._stereo):n._pos&&r.pos(n._pos[0],n._pos[1],n._pos[2],n._id)}}(Sound.prototype.init),Sound.prototype.reset=function(i){return function(){var n=this,r=n._parent;return n._orientation=r._orientation,n._stereo=r._stereo,n._pos=r._pos,n._pannerAttr=r._pannerAttr,n._stereo?r.stereo(n._stereo):n._pos?r.pos(n._pos[0],n._pos[1],n._pos[2],n._id):n._panner&&(n._panner.disconnect(0),n._panner=void 0,r._refreshBuffer(n)),i.call(this)}}(Sound.prototype.reset);var e=function(i,n){n=n||"spatial",n==="spatial"?(i._panner=Howler.ctx.createPanner(),i._panner.coneInnerAngle=i._pannerAttr.coneInnerAngle,i._panner.coneOuterAngle=i._pannerAttr.coneOuterAngle,i._panner.coneOuterGain=i._pannerAttr.coneOuterGain,i._panner.distanceModel=i._pannerAttr.distanceModel,i._panner.maxDistance=i._pannerAttr.maxDistance,i._panner.refDistance=i._pannerAttr.refDistance,i._panner.rolloffFactor=i._pannerAttr.rolloffFactor,i._panner.panningModel=i._pannerAttr.panningModel,typeof i._panner.positionX<"u"?(i._panner.positionX.setValueAtTime(i._pos[0],Howler.ctx.currentTime),i._panner.positionY.setValueAtTime(i._pos[1],Howler.ctx.currentTime),i._panner.positionZ.setValueAtTime(i._pos[2],Howler.ctx.currentTime)):i._panner.setPosition(i._pos[0],i._pos[1],i._pos[2]),typeof i._panner.orientationX<"u"?(i._panner.orientationX.setValueAtTime(i._orientation[0],Howler.ctx.currentTime),i._panner.orientationY.setValueAtTime(i._orientation[1],Howler.ctx.currentTime),i._panner.orientationZ.setValueAtTime(i._orientation[2],Howler.ctx.currentTime)):i._panner.setOrientation(i._orientation[0],i._orientation[1],i._orientation[2])):(i._panner=Howler.ctx.createStereoPanner(),i._panner.pan.setValueAtTime(i._stereo,Howler.ctx.currentTime)),i._panner.connect(i._node),i._paused||i._parent.pause(i._id,!0).play(i._id,!0)}}()}),Wt=class{modifyById(t,e){let i=this;if(i[t]===void 0)throw new Error("not expected");{let n={...i,[t]:e};return Object.setPrototypeOf(n,Wt.prototype),n}}
3113add(t,e){var i,n;return(n=(i=this.runOp({type:1,id:t,data:e}))==null?void 0:i.data)!=null?n:this}runOp(t){let e=this;if(t.type===1){let i=e[t.id],n;i===void 0?n={type:2,id:t.id}:n={type:1,id:t.id,data:i};let{id:r,data:s}=t,o={...e,[r]:s};return Object.setPrototypeOf(o,Wt.prototype),{data:o,actual:t,reverse:n}}else if(t.type===2){let{id:i}=t,n=e[i];if(n===void 0)return null;{let r={...e};return Object.setPrototypeOf(r,Wt.prototype),delete r[i],{data:r,actual:t,reverse:{type:1,id:i,data:n}}}}throw new Error("illegal arg")}};function Jh(t){if(t.deepFreeze!==void 0){t.deepFreeze(t);return}let e=Object.getOwnPropertyNames(t);for(let i of e){let n=t[i];n&&typeof n=="object"&&Jh(n)}return Object.freeze(t)}function gS(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}var Pm=class extends Error{};function Zn(t,e,i){if(t===void 0?e===void 0?(t=0,e=10):t=e-10:e===void 0&&(e=t+10),t>e){let s=t;t=e,e=s}let n=[],r=1/(i+1);for(let s=0;s<i;s++){let o=t+(e-t)*(s+.75+Math.random()*.5)*r;n.push(o)}return n}function ka(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array}function vS(){return typeof process<"u"}function Dm(t,e){for(let i of t)e(i.id,i.data),Dm(i.children,e)}function Om(t,e){e(t.id,t.data);for(let i of t.children)Om(i,e)}var ci=class extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ci.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Jh(this[t]),t++}fillCaches0(t,e){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,e);for(let i of t.children)this.fillCaches0(i,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}isDescendantOf(t,e){for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}data(t){var e;return(e=this.get(t))==null?void 0:e.data}has(t){return this.childrenOf(t)!==void 0}get(t){return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){var e;return t===null?this:(e=this.get(t))==null?void 0:e.children}traverseFrom(t,e){if(t===null)this.traverse(e);else{let i=this.get(t);i&&Om(i,e)}}traverse(t){Dm(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this.parent(t),n=this.childrenArray(i),r=n.findIndex(o=>o.id===t);if(r<0)throw new Error("not expected");let s=n[r];return n=[...n],n[r]={...s,data:e},this.modifyArrayBy(i,n)}}modifyArrayBy(t,e){let i=t,n=e;for(;i!==null;){let s=n,o=i;if(i=this.parent(i),i===void 0)throw new Error;n=this.childrenArray(i);let a=n.findIndex(l=>l.id===o);if(a<0)throw new Error;n=[...n],n[a]={...n[a],children:s}}Object.setPrototypeOf(n,ci.prototype);let r=n;return r.fillCaches(),r}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}}checkDuplicatedIdRec({id:t,children:e}){if(this.get(t)!==void 0)return!0;for(let i of e)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(t){let{parent:e,fi:i,id:n,data:r,children:s}=t;if(e!==null&&this.get(e)===void 0||this.checkDuplicatedIdRec(t))return null;{let o=e,a=this.childrenArray(o),l={fi:i,id:n,data:r,children:s};return a=[...a,l],a.sort((h,f)=>h.fi-f.fi),t.localIndex=a.indexOf(l),{data:this.modifyArrayBy(o,a),actual:t,reverse:{type:8,id:n}}}}deleteOp(t){let{id:e}=t;if(this.get(e)===null)return null;{let i=this.parent(e);if(i===void 0)return null;let n=this.childrenArray(i),r=n.findIndex(o=>o.id===e);t.localIndex=r,n=[...n];let s=n.splice(r,1)[0];return{data:this.modifyArrayBy(i,n),actual:t,reverse:{type:7,...s,parent:i}}}}moveOp(t){let{parent:e,fi:i,id:n}=t;if(e!==null&&this.get(e)===void 0)return this.deleteOp({type:8,id:n});if(e!==null){let c=e;for(;c!==null;){if(c===void 0)throw new Error;if(c===n)throw new Pm("cyclic tree");c=this.parent(c)}}let r=this.parent(n);if(r===void 0)return null;let s=r,o=this.childrenArray(r),a=o.findIndex(c=>c.id===n);o=[...o];let l=o.splice(a,1)[0],h=this.modifyArrayBy(r,o);r=e,o=h.childrenArray(r);let f=l.fi;return l={...l,fi:i},o=[...o,l],o.sort((c,u)=>c.fi-u.fi),t.localIndex=o.indexOf(l),h=h.modifyArrayBy(r,o),{data:h,actual:t,reverse:{type:9,parent:s,fi:f,id:n}}}previous(t,e){if(e===null){let n=this.childrenArray(t);return n.length===0?null:n[n.length-1].id}let i=null;for(let n of this.childrenArray(t)){if(n.id===e)return i;i=n.id}return null}traverseSortNext(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>
3113r.id===t)+1;if(n<i.length)return i[n].id;if(e)return this.traverseSortNext(e)}}sortNext(t){let e=this.childrenArray(t);return e.length>0?e[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let e=this.childrenArray(t);return e.length>0?this.traverseSortPrevious(e[e.length-1].id):t}sortPrevious(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)-1;return n>=0?this.traverseSortPrevious(i[n].id):e}}getAllSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i.id);n!==void 0&&e.push({...i,...n})}e.sort((i,n)=>gS(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e}getWithSortKey(t){var e=t;let i=[],n=this.get(e),r=n;if(n!==void 0){for(;e;)i.splice(0,0,n.fi),e=this.parent(e),e!==null&&(n=this.get(e));return{...r,sortKey:i}}}insertBeforeHelper(t,e,i){return this.insertAfterHelper(t,this.previous(t,e),i)}insertAfterHelper(t,e,i){let n=this.childrenArray(t);if(e===null){if(n.length===0)return Zn(0,i,i);{let r=n[0].fi;return Zn(r-i,r,i)}}else{let r=this.get(e);if(r===void 0||this.parent(e)!==t)throw new Error("illegal args");let s=n.find(o=>o.fi>r.fi);if(s===void 0){let o=n[n.length-1].fi;return Zn(o,o+i,i)}else return Zn(r.fi,s.fi,i)}}},Va;(t=>{function e(i,n){if(Array.isArray(i)){let r=n.props,s={},o=[...i],a=!1;if(r)for(let l of Object.keys(r)){let h=parseInt(l);if(isNaN(h))throw new Error("wrong index");s[l]=o[h],o[h]=r[l],a=!0}return a?{data:o,actual:n,reverse:{type:0,props:s}}:null}else{let r=n.props,s={},o={...i},a=!1;if(r)for(let l of Object.keys(r)){s[l]=o[l];let h=r[l];h===void 0?delete o[l]:o[l]=h,a=!0}return a?{data:o,actual:n,reverse:{type:0,props:s}}:null}}t.runOp=e})(Va||(Va={}));var mt=class extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,mt.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Jh(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){var e;return(e=this.get(t))==null?void 0:e.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this,n=i.findIndex(s=>s.id===t);if(n<0)throw new Error("not expected");let r=i[n];return i=[...i],i[n]={...r,data:e},this.modifyArrayBy(i)}}modifyArrayBy(t){Object.setPrototypeOf(t,mt.prototype);let e=t;return vS()||e.fillCaches(),e}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}}addOp(t){let{fi:e,id:i,data:n}=t,r=this,s={fi:e,id:i,data:n};return r=[...r,s],r.sort((o,a)=>o.fi-a.fi),t.localIndex=r.indexOf(s),{data:this.modifyArrayBy(r),actual:t,reverse:{type:5,id:i}}}deleteOp(t){let{id:e}=t,i=this,n=i.findIndex(s=>s.id===e);if(n===-1)return null;t.localIndex=n,i=[...i];let r=i.splice(n,1)[0];return{data:this.modifyArrayBy(i),actual:t,reverse:{type:4,...r}}}moveOp(t){let{fi:e,id:i}=t,n=this;n=[...n];let r=n.findIndex(a=>a.id===i);if(r===-1)return null;let s=n[r].fi,o={...n[r],fi:e};return n[r]=o,n.sort((a,l)=>a.fi-l.fi),t.localIndex=n.indexOf(o),{data:this.modifyArrayBy(n),actual:t,reverse:{type:6,fi:s,id:i}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let e=null;for(let i of this){if(i.id===t)return e;e=i.id}return null}insertBeforeHelper(t,e){return this.insertAfterHelper(this.previous(t),e)}insertAfterHelper(t,e){let i=this;if(t===null){if(i.length===0)return Zn(0,e,e);{let n=i[0].fi;return Zn(n-e,n,e)}}else{let n=this.get(t);if(n===void 0)throw new Error("illegal args");let r=i.find(s=>s.fi>n.fi);if(r===void 0){let s=i[i.length-1].fi;return Zn(s,s+e,e)}else return Zn(n.fi,r.fi,e)}}},Lr=class{unusedFun(t){}runOp(t){let e=[],i=this,n=0,r={};for(;n<t.path.length;){if(e.push(i),i=i===void 0?void 0:i[t.path[n]],i instanceof ci||i instanceof mt)return null;n+=1}i={...i};for(let[a,l]of Object.entries(t.props)){let h=i[a];r[a]=h,l===void 0?delete i[a]:i[a]=l}for(;n>0;)Object.keys(i).length===0?(i={...e[n-1]},delete i[t.path[n-1]]):i={...e[n-1],[t.path[n-1]]:i},n-=1;
3113let s=Object.setPrototypeOf(i,Lr.prototype),o={...t,props:r};return{data:s,actual:t,reverse:o}}},af;(t=>{function e(n,r){var s;return(s=So(n,r))!=null?s:n}t.apply=e;function i(n,r){if(r.type===0){let s=0,o=r.path,a=n;for(;s<o.length&&a!==void 0;){if(a=Ur.zoomOnce(a,o[s]),a instanceof ci||a instanceof mt)return;s+=1}if(a===void 0)return r;if(typeof a=="string"||typeof a=="number"||ka(a))return;if(a&&typeof a=="object"){let l={...r.props};for(let h of Object.keys(a))delete l[h];return{...r,props:l}}else return}else if(r.type===1||r.type===4||r.type===7){let s=Ur.zoom(n,[...r.path,r.id]);if(s===void 0)return r;if(typeof s=="string"||typeof s=="number"||ka(s))return;if(s&&typeof s=="object"){let o={...r.data,...s};return{...r,data:o}}else return}else return r}t.filterOp=i})(af||(af={}));function Rm(t,e){if(e===void 0)return;let i=!1,n=t.map(r=>{let s=r.id,o=So(r.data,e[s]);i=i||o!==void 0,o===void 0&&(o=r.data);let a=Rm(r.children,e);return a!==void 0?i=!0:a=r.children,{...r,id:s,data:o,children:a}});if(i)return n}function yS(t,e){if(e===void 0)return;let i=!1,n=t.map(r=>{let s=r.id,o=So(r.data,e[s]);return i=i||o!==void 0,o===void 0&&(o=r.data),{...r,id:s,data:o}});if(i)return Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}function So(t,e){if(e!==void 0){if(e instanceof mt||e instanceof ci||typeof e=="string"||typeof e=="number"||e===null)return e;if(t instanceof ci){let i=Rm(t,e);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}else{if(t instanceof mt)return yS(t,e);if(Array.isArray(t)){let i=!1,n=t.map((r,s)=>{let o=So(r,e[s]);return i=i||o!==void 0,o===void 0&&(o=r),o});return i?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}else if(t&&typeof t=="object"){let i={},n=!1;for(let[r,s]of Object.entries(t)){let o=So(s,e[r]);n=n||o!==void 0,o===void 0&&(o=s),i[r]=o}return n?(Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i):void 0}else return e!=null?e:t}}}function xS(t,e){var n;let i={cur:[],result:[],len:0};return t=(n=Mo(t,e,i))!=null?n:t,[t,i.result]}function Ga(t,e){return t===null?null:(t.cur[t.len]=e,t.len+=1,t)}function Ha(t){t&&(t.len-=1)}function _S(t){if(t===null)return null;t.result.push(t.cur.slice(0,t.len))}function Im(t,e,i){let n=!1,r=t.map(s=>{let o=s.id,a=e[o];if(a!==void 0&&typeof a=="string"&&(n=!0,o=a,i!==null))throw new Error("not supported");let l=Mo(s.data,e,Ga(i,o));Ha(i),n=n||l!==void 0,l===void 0&&(l=s.data);let h=Im(s.children,e,i);return h!==void 0?n=!0:h=s.children,{...s,id:o,data:l,children:h}});if(n)return r}function bS(t,e,i){let n=!1,r=t.map(s=>{let o=s.id,a=e[o];if(a!==void 0&&typeof a=="string"&&(n=!0,o=a,i!==null))throw new Error("not supported");let l=Mo(s.data,e,Ga(i,o));return Ha(i),n=n||l!==void 0,l===void 0&&(l=s.data),{...s,id:o,data:l}});if(n)return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r}function Mo(t,e,i){if(t instanceof ci){let n=Im(t,e,i);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}else{if(t instanceof mt)return bS(t,e,i);if(Array.isArray(t)){let n=!1,r=t.map((s,o)=>{let a=Mo(s,e,Ga(i,o));return Ha(i),n=n||a!==void 0,a===void 0&&(a=s),a});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}else if(t&&typeof t=="object"){let n={},r=!1;for(let[s,o]of Object.entries(t))if(s!=="name"&&s!=="text"){let a=e[s];if(typeof a=="string"){if(i!==null)throw new Error("not supported");r=!0,s=a}let l=Mo(o,e,Ga(i,s));Ha(i),r=r||l!==void 0,l===void 0&&(l=o),n[s]=l}else n[s]=o;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}else if(typeof t=="string"){let n=e[t];if(n!==void 0){if(t.length!==36)throw new Error("for now you should only call this method when the key is a uuid");_S(i)}return n}else return}}var lf;(t=>{function e(i,n){let r=Ur.zoom(n,i.path);if(typeof r=="object"){let s={};for(let o of Object.keys(i.props))s[o]=r[o];return{...i,props:s}}else return{...i,props:{}}}t.replaceProps=e})(lf||(lf={}));var Ar;(t=>{function e(l,h){return{...l,path:l.path.slice(h)}}t.drop=e;function i(l,h){var f,c;return(c=(f=n(l,h))==null?void 0:f.data)!=null?c:l}t.applySimple=i;function n(l,h){var u,d;let f=h.path;for(var c=[];;){let m;if(l instanceof Lr&&h.type===0&&(m=l.runOp({...h,path:f.slice(c.length)}),m===null&&(m=void 0)),c.length===f.length&&(l instanceof ci||l instanceof mt||l instanceof Wt?m=l.runOp(h):m=Va.runOp(l,h)),m!==void 0)if(m!==null){let v=m.data;for(let y=c.length-1;y>=0;y--){let b=f[y],x=c[y];if(x instanceof ci){if(typeof b=="number")throw new Error("illegal arg");v=x.modifyById(b,v)}else if(x instanceof mt){if(typeof b=="number")throw new Error("illegal arg");v=x.modifyById(b,v)}else if(x instanceof Wt){if(typeof b=="number")throw new Error("illegal arg");v=x.modifyById(b,v)}else if(x instanceof Lr){let M={...x,[b]:v};v=Object.setPrototypeOf(M,Lr.prototype)}else if(typeof x=="object")if(Array.isArray(x)){if(typeof b=="string"&&(b=parseInt(b),isNaN(b)))throw new Error("Invalid path");let M=v;v=[...x],v[b]=M}else v={...x,[b]:v};else return null}return{data:v,actual:{...m.actual,path:f},reverse:{...m.reverse,path:f}}}else return null;let g=f[c.length],p;if(l instanceof ci){if(typeof g=="number")throw new Error("");p=(u=l.get(g))==null?void 0:u.data}else if(l instanceof mt){if(typeof g=="number")throw new Error("");p=(d=l.get(g))==null?void 0:d.data}else l!==null&&(p=l[g]);if(p!==void 0)c.push(l),l=p;else return null}}t.apply=n;function r(l,h){for(let f=0;f<l.length&&f<h.length;f++)if(l[f]!==h[f])return!0;return!1}t.pathDisjoint=r;function s(l,h){if(l.length!==h.length)return!1;for(let f=0;f<l.length;f++)if(l[f]!==h[f])return!1;return!0}t.pathEq=s;function o(l,h){return r(l.path,h.path)}t.commutative=o;function a(l,h){return l.type===0&&h.type===0&&s(l.path,h.path)?Object.keys(l.props).every(f=>h.props[f]!==void 0):!1}t.subsumed=a})(Ar||(Ar={}));var cf;(t=>{function e(){return[]}t.empty=e;function i(h,f){let c=[];for(let u of h){let[d,...m]=u.path;d===f&&c.push({...u,path:m})}return c}t.removePrefix=i;function n(h,f){return h.map(c=>({...c,path:[f,...c.path]}))}t.addPrefix=n;function r(h,f){return[...h,...f]}
3113t.concat=r;function s(h,f){return[...h.filter(c=>!f.some(u=>Ar.subsumed(c,u))),...f]}t.compress=s;function o(h,f){return h.every(c=>f.every(u=>Ar.commutative(c,u)))}t.commutative=o;function a(h,f){for(let c of f){let u=l(h,c);u!==null&&(h=u.data)}return h}t.applyAll=a;function l(h,f){var c=h;let u=[],d=[];for(let m of f)try{if(m.type===3){let g=Ur.zoom(c,[...m.path,m.id]),p=Ar.apply(c,{...m,type:2});if(p!==null){c=p.data;let[v,y]=xS(c,{[m.id]:g});c=v;for(let b of y){let x=b[b.length-1];b.splice(b.length-1,1),u.push({type:0,path:b,props:{[x]:g}}),d.push({type:0,path:b,props:{[x]:m.id}})}d.push(p.reverse),u.push(p.actual)}}else{let g=Ar.apply(c,m);g!==null&&(u.push(g.actual),c=g.data,d.push(g.reverse))}}catch(g){if(g instanceof Pm)return null;throw g}return{data:c,actual:u,reverse:d.reverse()}}t.apply=l})(cf||(cf={}));var zm=Symbol(),zo=Symbol(),No=class{reportOp(t,e,i=[]){let n=this;if(e===null)return;n._current=e.data;let r=i;for(;!(n instanceof Bm);){let s=n._path,o=n._current;if(s!==""&&r.splice(0,0,s),n=n._parent,n===null)return;n.update(s,o)}n.push(r,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let i=e[zo];i&&i(),delete this._children[t]}}}},wS=class extends No{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current={...this._current,[t]:e}}runOp(t){this.reportOp(t,Va.runOp(this._current,t),t.path)}},SS=class extends No{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,Wt.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},Nm={get(t,e){if(e===zo)return()=>{t._parent=null};if(e===zm)return t._current;let{_current:i,_children:n}=t;if(e==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[e];if(r!==void 0)return r;let s=i[e],o=dl(t,e,s);return o!==s?(n===void 0&&(n={},t._children=n),n[e]=o,o):s},has(t,e){return e in t._current},ownKeys(t){return Reflect.ownKeys(t._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(t){return Object.getPrototypeOf(t._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(t,e){let i=t._current,n=Reflect.getOwnPropertyDescriptor(i,e);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:i[e]}}},MS={...Nm,set(t,e,i){var r;let n={type:0,props:{[e]:(r=Oi(i))!=null?r:i}};return t.deleteChildren(e),t.runOp(n),!0},deleteProperty(t,e){let i={type:0,props:{[e]:void 0}};return t.deleteChildren(e),t.runOp(i),!0}},AS={...Nm,set(t,e,i){return i===void 0?this.deleteProperty(t,e):(t.deleteChildren(e),t.runOp({type:1,id:e,data:i})),!0},deleteProperty(t,e){return t.runOp({type:2,id:e}),!0}},Kh=class extends No{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[zo]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}traverse(t){return this._current.traverse(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,i)=>{t(e,this.data(e))})}data(t){var o;let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=(o=e.get(t))==null?void 0:o.data,s=dl(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}add(t,e,i,n,r){this.runOp({type:7,parent:t,fi:e,id:i,data:n,children:r})}move(t,e,i){this.runOp({type:9,parent:t,fi:e,id:i})}insertAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}insertBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}moveAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}moveBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},Um=class extends No{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i,this[zo]=()=>{this._parent=null}}feedOp(t){let{path:e,...i}=t;this.reportOp(i,Ar.apply(this._current,t),e)}},Qh=class extends No{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[zo]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id,r=this._current[i].fi;t(this.data(this._current[i].id),n,r)}}find(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id;if(t(this.data(n),n))return this.get(n)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}data(t){var o;let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=(o=e.get(t))==null?void 0:o.data,s=dl(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}runOp(t){this.reportOp(t,this._current.runOp(t))}
3113add(t,e,i){this.runOp({type:4,fi:t,id:e,data:i})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}insertBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}moveAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}moveBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}};function hc(t,e,i){if(t.length>0){let n=t[t.length-1];if(n.type===0&&e.type===0&&Ur.equal(n.path,i)){Object.assign(n.props,e.props);return}}t.push({...e,path:i})}var Bm=class{constructor(t){this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,i,n){hc(this.ts,e,t),hc(this.actual,i,t),hc(this.reverse,n,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function dl(t,e,i){return i instanceof ci?new Kh(t,e,i):i instanceof mt?new Qh(t,e,i):i instanceof Lr?new Um(t,e,i):i instanceof Wt?new Proxy(new SS(t,e,i),AS):i!==null&&typeof i=="object"?ka(i)?i:new Proxy(new wS(t,e,i),MS):i}function Fm(t){let e=new Bm(t);return[dl(e,"",t),e]}function hf(t,e){let[i,n]=Fm(t);return e(i),n.result()}function Oi(t){return t instanceof Kh||t instanceof Qh||t instanceof Um?t._current:t!==null&&typeof t=="object"?t[zm]:t}var Ur;(t=>{function e(s,o){if(o.length===s.length)for(var a=0;a<s.length;){if(s[a]!==o[a])return!1;a+=1}else return!1;return!0}t.equal=e;function i(s,o,a){let l=r(a,s);if(l!==void 0&&typeof l=="object"&&l!==null){let h={...o};return Object.keys(l).forEach(f=>{delete h[f]}),h}else return o}t.removeOverridden=i;function n(s,o){if((s instanceof ci||s instanceof Kh)&&typeof o=="string"||(s instanceof mt||s instanceof Qh)&&typeof o=="string")return s.data(o);if(typeof o=="number"&&Array.isArray(s)||typeof o=="string"&&typeof s=="object")return s[o]}t.zoomOnce=n;function r(s,o,a=0){for(;a<o.length&&s!==void 0;)s=n(s,o[a]),a+=1;return s}t.zoom=r})(Ur||(Ur={}));var km=class{},uf=class extends km{constructor(t){super(),this.id=t}},df=class extends km{constructor(t){super(),this.data=t}},Xc;try{Xc=new TextDecoder}catch{}var Ee,ir,q=0,si={},at,Jn,Ai=0,tn=0,pi,Ln,ii=[],ct,ff={useRecords:!1,mapsAsObjects:!0},Vm=class{},Gm=new Vm;Gm.name="MessagePack 0xC1";var Cs=!1,Wa=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0)),Object.assign(this,t)}unpack(t,e){if(Ee)return Ym(()=>($c(),this?this.unpack(t,e):Wa.prototype.unpack.call(ff,t,e)));ir=e>-1?e:t.length,q=0,tn=0,Jn=null,pi=null,Ee=t;try{ct=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw Ee=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof Wa){if(si=this,this.structures)return at=this.structures,ya();(!at||at.length>0)&&(at=[])}else si=ff,(!at||at.length>0)&&(at=[]);return ya()}unpackMultiple(t,e){let i,n=0;try{Cs=!0;let r=t.length,s=this?this.unpack(t,r):pl.unpack(t,r);if(e){for(e(s);q<r;)if(n=q,e(ya())===!1)return}else{for(i=[s];q<r;)n=q,i.push(ya());return i}}catch(r){throw r.lastPosition=n,r.values=i,r}finally{Cs=!1,$c()}}_mergeStructures(t,e){t=t||[];for(let i=0,n=t.length;i<n;i++){let r=t[i];r&&(r.isShared=!0,i>=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in e||[])if(i>=0){let n=t[i],r=e[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,e){return this.unpack(t,e)}};function ya(){try{if(!si.trusted&&!Cs){let e=at.sharedLength||0;e<at.length&&(at.length=e)}let t=Dt();if(q==ir)at.restoreStructures&&pf(),at=null,Ee=null,Ln&&(Ln=null);else if(q>ir){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!Cs)throw new Error("Data read, but end of buffer not reached");return t}catch(t){throw at.restoreStructures&&pf(),$c(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer"))&&(t.incomplete=!0),t}}function pf(){for(let t in at.restoreStructures)at[t]=at.restoreStructures[t];at.restoreStructures=null}function Dt(){let t=Ee[q++];if(t<160)if(t<128){if(t<64)return t;{let e=at[t&63]||si.getStructures&&Hm()[t&63];return e?(e.read||(e.read=eu(e,t&63)),e.read()):t}}else if(t<144)if(t-=128,si.mapsAsObjects){let e={};for(let i=0;i<t;i++)e[jm()]=Dt();return e}else{let e=new Map;for(let i=0;i<t;i++)e.set(Dt(),Dt());return e}else{t-=144;let e=new Array(t);for(let i=0;i<t;i++)e[i]=Dt();return e}else if(t<192){let e=t-160;if(tn>=q)return Jn.slice(q-Ai,(q+=e)-Ai);if(tn==0&&ir<140){let i=e<16?tu(e):Wm(e);if(i!=null)return i}return Yc(e)}else{let e;switch(t){case 192:return null;case 193:return pi?(e=Dt(),e>0?pi[1].slice(pi.position1,pi.position1+=e):pi[0].slice(pi.position0,pi.position0-=e)):Gm;case 194:return!1;case 195:return!0;case 196:return uc(Ee[q++]);case 197:return e=ct.getUint16(q),q+=2,uc(e);case 198:return e=ct.getUint32(q),q+=4,uc(e);case 199:return mr(Ee[q++]);case 200:return e=ct.getUint16(q),q+=2,mr(e);case 201:return e=ct.getUint32(q),q+=4,mr(e);case 202:if(e=ct.getFloat32(q),si.useFloat32>2){let i=iu[(Ee[q]&127)<<1|Ee[q+1]>>7];return q+=4,(i*e+(e>0?.5:-.5)>>0)/i}return q+=4,e;case 203:return e=ct.getFloat64(q),q+=8,e;case 204:return Ee[q++];case 205:return e=ct.getUint16(q),q+=2,e;case 206:return e=ct.getUint32(q),q+=4,e;case 207:return si.int64AsNumber?(e=ct.getUint32(q)*4294967296,e+=ct.getUint32(q+4)):e=ct.getBigUint64(q),q+=8,e;case 208:return ct.getInt8(q++);case 209:return e=ct.getInt16(q),q+=2,e;case 210:return e=ct.getInt32(q),q+=4,e;case 211:return si.int64AsNumber?(e=ct.getInt32(q)*4294967296,e+=ct.getUint32(q+4)):e=ct.getBigInt64(q),q+=8,e;case 212:if(e=Ee[q++],e==114)return xf(Ee[q++]&63);{let i=ii[e];if(i)return i.read?(q++,i.read(Dt())):i.noBuffer?(q++,i()):i(Ee.subarray(q,++q));throw new Error("Unknown extension "+e)}case 213:return e=Ee[q],e==114?(q++,xf(Ee[q++]&63,Ee[q++])):mr(2);case 214:return mr(4);case 215:return mr(8);case 216:return mr(16);case 217:return e=Ee[q++],tn>=q?Jn.slice(q-Ai,(q+=e)-Ai):ES(e);case 218:return e=ct.getUint16(q),q+=2,tn>=q?Jn.slice(q-Ai,(q+=e)-Ai):CS(e);case 219:return e=ct.getUint32(q),q+=4,tn>=q?Jn.slice(q-Ai,(q+=e)-Ai):LS(e);case 220:return e=ct.getUint16(q),q+=2,gf(e);case 221:return e=ct.getUint32(q),q+=4,gf(e);case 222:return e=ct.getUint16(q),q+=2,vf(e);case 223:return e=ct.getUint32(q),q+=4,vf(e);default:if(t>=224)return t-256;if(t===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+t)}}}var TS=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function eu(t,e){function i(){if(i.count++>2){let r=t.read=new Function("r","return function(){return {"+t.map(s=>TS.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"}}")(Dt);return t.highByte===0&&(t.read=mf(e,t.read)),r()}let n={};for(let r=0,s=t.length;r<s;r++){let o=t[r];n[o]=Dt()}return n}return i.count=0,t.highByte===0?mf(e,i):i}var mf=(t,e)=>function(){let i=Ee[q++];if(i===0)return e();let n=t<32?-(t+(i<<5)):t+(i<<5),r=at[n]||Hm()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=eu(r,t)),r.read()};function Hm(){let t=Ym(()=>(Ee=null,si.getStructures()));return at=si._mergeStructures(t,at)}var Yc=fl,ES=fl,CS=fl,LS=fl;function fl(t){let e;if(t<16&&(e=tu(t)))return e;if(t>64&&Xc)return Xc.decode(Ee.subarray(q,q+=t));let i=q+t,n=[];for(e="";q<i;){let r=Ee[q++];if((r&128)===0)n.push(r);else if((r&224)===192){let s=Ee[q++]&63;n.push((r&31)<<6|s)}else if((r&240)===224){let s=Ee[q++]&63,o=Ee[q++]&63;n.push((r&31)<<12|s<<6|o)}else if((r&248)===240){let s=Ee[q++]&63,o=Ee[q++]&63,a=Ee[q++]&63,l=(r&7)<<18|s<<12|o<<6|a;l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|l&1023),n.push(l)}else n.push(r);n.length>=4096&&(e+=Gt.apply(String,n),n.length=0)}return n.length>0&&(e+=Gt.apply(String,n)),e}function gf(t){let e=new Array(t);for(let i=0;i<t;i++)e[i]=Dt();return e}function vf(t){if(si.mapsAsObjects){let e={};for(let i=0;i<t;i++)e[jm()]=Dt();return e}else{let e=new Map;for(let i=0;i<t;i++)e.set(Dt(),Dt());return e}}var Gt=String.fromCharCode;function Wm(t){let e=q,i=new Array(t);for(let n=0;n<t;n++){let r=Ee[q++];if((r&128)>0){q=e;return}i[n]=r}return Gt.apply(String,i)}function tu(t){if(t<4)if(t<2){if(t===0)return"";{let e=Ee[q++];if((e&128)>1){q-=1;return}return Gt(e)}}else{let e=Ee[q++],i=Ee[q++];if((e&128)>0||(i&128)>0){q-=2;return}
3113if(t<3)return Gt(e,i);let n=Ee[q++];if((n&128)>0){q-=3;return}return Gt(e,i,n)}else{let e=Ee[q++],i=Ee[q++],n=Ee[q++],r=Ee[q++];if((e&128)>0||(i&128)>0||(n&128)>0||(r&128)>0){q-=4;return}if(t<6){if(t===4)return Gt(e,i,n,r);{let s=Ee[q++];if((s&128)>0){q-=5;return}return Gt(e,i,n,r,s)}}else if(t<8){let s=Ee[q++],o=Ee[q++];if((s&128)>0||(o&128)>0){q-=6;return}if(t<7)return Gt(e,i,n,r,s,o);let a=Ee[q++];if((a&128)>0){q-=7;return}return Gt(e,i,n,r,s,o,a)}else{let s=Ee[q++],o=Ee[q++],a=Ee[q++],l=Ee[q++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){q-=8;return}if(t<10){if(t===8)return Gt(e,i,n,r,s,o,a,l);{let h=Ee[q++];if((h&128)>0){q-=9;return}return Gt(e,i,n,r,s,o,a,l,h)}}else if(t<12){let h=Ee[q++],f=Ee[q++];if((h&128)>0||(f&128)>0){q-=10;return}if(t<11)return Gt(e,i,n,r,s,o,a,l,h,f);let c=Ee[q++];if((c&128)>0){q-=11;return}return Gt(e,i,n,r,s,o,a,l,h,f,c)}else{let h=Ee[q++],f=Ee[q++],c=Ee[q++],u=Ee[q++];if((h&128)>0||(f&128)>0||(c&128)>0||(u&128)>0){q-=12;return}if(t<14){if(t===12)return Gt(e,i,n,r,s,o,a,l,h,f,c,u);{let d=Ee[q++];if((d&128)>0){q-=13;return}return Gt(e,i,n,r,s,o,a,l,h,f,c,u,d)}}else{let d=Ee[q++],m=Ee[q++];if((d&128)>0||(m&128)>0){q-=14;return}if(t<15)return Gt(e,i,n,r,s,o,a,l,h,f,c,u,d,m);let g=Ee[q++];if((g&128)>0){q-=15;return}return Gt(e,i,n,r,s,o,a,l,h,f,c,u,d,m,g)}}}}}function uc(t){return si.copyBuffers?Uint8Array.prototype.slice.call(Ee,q,q+=t):Ee.subarray(q,q+=t)}function mr(t){let e=Ee[q++];if(ii[e])return ii[e](Ee.subarray(q,q+=t));throw new Error("Unknown extension type "+e)}var yf=new Array(4096);function jm(){let t=Ee[q++];if(t>=160&&t<192){if(t=t-160,tn>=q)return Jn.slice(q-Ai,(q+=t)-Ai);if(!(tn==0&&ir<180))return Yc(t)}else return q--,Dt();let e=(t<<5^(t>1?ct.getUint16(q):t>0?Ee[q]:0))&4095,i=yf[e],n=q,r=q+t-3,s,o=0;if(i&&i.bytes==t){for(;n<r;){if(s=ct.getUint32(n),s!=i[o++]){n=1879048192;break}n+=4}for(r+=3;n<r;)if(s=Ee[n++],s!=i[o++]){n=1879048192;break}if(n===r)return q=n,i.string;r-=3,n=q}for(i=[],yf[e]=i,i.bytes=t;n<r;)s=ct.getUint32(n),i.push(s),n+=4;for(r+=3;n<r;)s=Ee[n++],i.push(s);let a=t<16?tu(t):Wm(t);return a!=null?i.string=a:i.string=Yc(t)}var xf=(t,e)=>{var i=Dt();let n=t;e!==void 0&&(t=t<32?-((e<<5)+t):(e<<5)+t,i.highByte=e);let r=at[t];return r&&r.isShared&&((at.restoreStructures||(at.restoreStructures=[]))[t]=r),at[t]=i,i.read=eu(i,n),i.read()},qm=typeof self=="object"?self:global;ii[0]=()=>{};ii[0].noBuffer=!0;ii[101]=()=>{let t=Dt();return(qm[t[0]]||Error)(t[1])};ii[105]=t=>{let e=ct.getUint32(q-4);Ln||(Ln=new Map);let i=Ee[q],n;i>=144&&i<160||i==220||i==221?n=[]:n={};let r={target:n};Ln.set(e,r);let s=Dt();return r.used?Object.assign(n,s):(r.target=s,s)};ii[112]=t=>{let e=ct.getUint32(q-4),i=Ln.get(e);return i.used=!0,i.target};ii[115]=()=>new Set(Dt());var Xm=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(t=>t+"Array");ii[116]=t=>{let e=t[0],i=Xm[e];if(!i)throw new Error("Could not find typed array for code "+e);return new qm[i](Uint8Array.prototype.slice.call(t,1).buffer)};ii[120]=()=>{let t=Dt();return new RegExp(t[0],t[1])};ii[98]=t=>{let e=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3],i=q;q+=e-4,pi=[Dt(),Dt()],pi.position0=0,pi.position1=0;let n=q;q=i;try{return Dt()}finally{q=n}};ii[255]=t=>t.length==4?new Date((t[0]*16777216+(t[1]<<16)+(t[2]<<8)+t[3])*1e3):t.length==8?new Date(((t[0]<<22)+(t[1]<<14)+(t[2]<<6)+(t[3]>>2))/1e6+((t[3]&3)*4294967296+t[4]*16777216+(t[5]<<16)+(t[6]<<8)+t[7])*1e3):t.length==12?new Date(((t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3])/1e6+((t[4]&128?-281474976710656:0)+t[6]*1099511627776+t[7]*4294967296+t[8]*16777216+(t[9]<<16)+(t[10]<<8)+t[11])*1e3):new Date("invalid");function Ym(t){let e=ir,i=q,n=Ai,r=tn,s=Jn,o=Ln,a=pi,l=new Uint8Array(Ee.slice(0,ir)),h=at,f=at.slice(0,at.length),c=si,u=Cs,d=t();return ir=e,q=i,Ai=n,tn=r,Jn=s,Ln=o,pi=a,Ee=l,Cs=u,at=h,at.splice(0,at.length,...f),si=c,ct=new DataView(Ee.buffer,Ee.byteOffset,Ee.byteLength),d}function $c(){Ee=null,Ln=null,at=null}function PS(t){t.unpack?ii[t.type]=t.unpack:ii[t.type]=t}var iu=new Array(147);for(let t=0;t<256;t++)iu[t]=+("1e"+Math.floor(45.15-t*.30103));var pl=new Wa({useRecords:!1});pl.unpack;pl.unpackMultiple;pl.unpack;var DS=new Float32Array(1);new Uint8Array(DS.buffer,0,4);var La;try{La=new TextEncoder}catch{}var ja,nu,ml=typeof Buffer<"u",dc=ml?Buffer.allocUnsafeSlow:Uint8Array,$m=ml?Buffer:Uint8Array,_f=ml?4294967296:2144337920,le,zt,te=0,$i,Zi=null,OS=/[\u0080-\uFFFF]/,Zs=Symbol("record-id"),Zm=class extends Wa{constructor(t){super(t),this.offset=0;let e,i,n,r,s,o=0,a=$m.prototype.utf8Write?function(w,T,_){return le.utf8Write(w,T,_)}:La&&La.encodeInto?function(w,T){return La.encodeInto(w,le.subarray(T)).written}:!1,l=this;t||(t={});let h=t&&t.sequential,f=t.structures||t.saveStructures,c=t.maxSharedStructures;if(c==null&&(c=f?32:0),c>8160)throw new Error("Maximum maxSharedStructure is 8160");let u=t.maxOwnStructures;u==null&&(u=f?32:64),h&&!t.saveStructures&&(this.structures=[]);let d=c>32||u+c>64,m=c+64,g=c+u+64;if(g>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let p=[],v=0,y=0;this.pack=this.encode=function(w,T){if(le||(le=new dc(8192),zt=new DataView(le.buffer,0,8192),te=0),$i=le.length-10,$i-te<2048?(le=new dc(le.length),zt=new DataView(le.buffer,0,le.length),$i=le.length-10,te=0):te=te+7&2147483640,e=te,s=l.structuredClone?new Map:null,l.bundleStrings?(Zi=["",""],le[te++]=214,le[te++]=98,Zi.position=te-e,te+=4):Zi=null,i=l.structures,i){i.uninitialized&&(i=l._mergeStructures(l.getStructures()));let _=i.sharedLength||0;if(_>c)throw new Error("Shared structures is larger than maximum shared structures, tr
3113y increasing maxSharedStructures to "+i.sharedLength);if(!i.transitions){i.transitions=Object.create(null);for(let A=0;A<_;A++){let S=i[A];if(!S)continue;let D,O=i.transitions;for(let z=0,I=S.length;z<I;z++){let H=S[z];D=O[H],D||(D=O[H]=Object.create(null)),O=D}O[Zs]=A+64}o=_}h||(i.nextId=_+64)}n&&(n=!1),r=i||[];try{if(b(w),Zi){zt.setUint32(Zi.position+e,te-Zi.position-e);let _=Zi;Zi=null,b(_[0]),b(_[1])}if(l.offset=te,s&&s.idsToInsert){te+=s.idsToInsert.length*6,te>$i&&M(te),l.offset=te;let _=IS(le.subarray(e,te),s.idsToInsert);return s=null,_}return T&zS?(le.start=e,le.end=te,le):le.subarray(e,te)}finally{if(i){if(y<10&&y++,v>1e4)i.transitions=null,y=0,v=0,p.length>0&&(p=[]);else if(p.length>0&&!h){for(let _=0,A=p.length;_<A;_++)p[_][Zs]=0;p=[]}if(n&&l.saveStructures){let _=i.sharedLength||c;i.length>_&&(i=i.slice(0,_));let A=le.subarray(e,te);return l.saveStructures(i,o)===!1?(l._mergeStructures(l.getStructures()),l.pack(w)):(o=_,A)}}T&NS&&(te=e)}};let b=w=>{te>$i&&(le=M(te));var T=typeof w,_;if(T==="string"){let A=w.length;if(Zi&&A>=8&&A<4096){let O=OS.test(w);Zi[O?0:1]+=w,le[te++]=193,b(O?-A:A);return}let S;A<32?S=1:A<256?S=2:A<65536?S=3:S=5;let D=A*3;if(te+D>$i&&(le=M(te+D)),A<64||!a){let O,z,I,H=te+S;for(O=0;O<A;O++)z=w.charCodeAt(O),z<128?le[H++]=z:z<2048?(le[H++]=z>>6|192,le[H++]=z&63|128):(z&64512)===55296&&((I=w.charCodeAt(O+1))&64512)===56320?(z=65536+((z&1023)<<10)+(I&1023),O++,le[H++]=z>>18|240,le[H++]=z>>12&63|128,le[H++]=z>>6&63|128,le[H++]=z&63|128):(le[H++]=z>>12|224,le[H++]=z>>6&63|128,le[H++]=z&63|128);_=H-te-S}else _=a(w,te+S,D);_<32?le[te++]=160|_:_<256?(S<2&&le.copyWithin(te+2,te+1,te+1+_),le[te++]=217,le[te++]=_):_<65536?(S<3&&le.copyWithin(te+3,te+2,te+2+_),le[te++]=218,le[te++]=_>>8,le[te++]=_&255):(S<5&&le.copyWithin(te+5,te+3,te+3+_),le[te++]=219,zt.setUint32(te,_),te+=4),te+=_}else if(T==="number")if(w>>>0===w)w<64?le[te++]=w:w<256?(le[te++]=204,le[te++]=w):w<65536?(le[te++]=205,le[te++]=w>>8,le[te++]=w&255):(le[te++]=206,zt.setUint32(te,w),te+=4);else if(w>>0===w)w>=-32?le[te++]=256+w:w>=-128?(le[te++]=208,le[te++]=w+256):w>=-32768?(le[te++]=209,zt.setInt16(te,w),te+=2):(le[te++]=210,zt.setInt32(te,w),te+=4);else{let A;if((A=this.useFloat32)>0&&w<4294967296&&w>=-2147483648){le[te++]=202,zt.setFloat32(te,w);let S;if(A<4||(S=w*iu[(le[te]&127)<<1|le[te+1]>>7])>>0===S){te+=4;return}else te--}le[te++]=203,zt.setFloat64(te,w),te+=8}else if(T==="object")if(!w)le[te++]=192;else{if(s){let S=s.get(w);if(S){if(!S.id){let D=s.idsToInsert||(s.idsToInsert=[]);S.id=D.push(S)}le[te++]=214,le[te++]=112,zt.setUint32(te,S.id),te+=4;return}else s.set(w,{offset:te-e})}let A=w.constructor;if(A===Object)x(w,!0);else if(A===Array){_=w.length,_<16?le[te++]=144|_:_<65536?(le[te++]=220,le[te++]=_>>8,le[te++]=_&255):(le[te++]=221,zt.setUint32(te,_),te+=4);for(let S=0;S<_;S++)b(w[S])}else if(A===Map){_=w.size,_<16?le[te++]=128|_:_<65536?(le[te++]=222,le[te++]=_>>8,le[te++]=_&255):(le[te++]=223,zt.setUint32(te,_),te+=4);for(let[S,D]of w)b(S),b(D)}else{for(let S=0,D=ja.length;S<D;S++){let O=nu[S];if(w instanceof O){let z=ja[S];if(z.write){z.type&&(le[te++]=212,le[te++]=z.type,le[te++]=0),b(z.write.call(this,w));return}let I=le,H=zt,ee=te;le=null;let G;try{G=z.pack.call(this,w,B=>(le=I,I=null,te+=B,te>$i&&M(te),{target:le,targetView:zt,position:te-B}),b)}finally{I&&(le=I,zt=H,te=ee,$i=le.length-10)}G&&(G.length+te>$i&&M(G.length+te),te=RS(G,le,te,z.type));return}}x(w,!w.hasOwnProperty)}}else if(T==="boolean")le[te++]=w?195:194;else if(T==="bigint"){if(w<BigInt(1)<<BigInt(63)&&w>=-(BigInt(1)<<BigInt(63)))le[te++]=211,zt.setBigInt64(te,w);else if(w<BigInt(1)<<BigInt(64)&&w>0)le[te++]=207,zt.setBigUint64(te,w);else if(this.largeBigIntToFloat)le[te++]=203,zt.setFloat64(te,Number(w));else throw new RangeError(w+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");te+=8}else if(T==="undefined")this.encodeUndefinedAsNil?le[te++]=192:(le[te++]=212,le[te++]=0,le[te++]=0);else if(T==="function")b(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+T)},x=this.useRecords===!1?this.variableMapSize?w=>{let T=Object.keys(w),_=T.length;_<16?le[te++]=128|_:_<65536?(le[te++]=222,le[te++]=_>>8,le[te++]=_&255):(le[te++]=223,zt.setUint32(te,_),te+=4);let A;for(let S=0;S<_;S++)b(A=T[S]),b(w[A])}:(w,T)=>{le[te++]=222;let _=te-e;te+=2;let A=0;for(let S in w)(T||w.hasOwnProperty(S))&&(b(S),b(w[S]),A++);le[_+++e]=A>>8,le[_+e]=A&255}:w=>{let T=Object.keys(w),_,A=r.transitions||(r.transitions=Object.create(null)),S=0;for(let O=0,z=T.length;O<z;O++){let I=T[O];_=A[I],_||(_=A[I]=Object.create(null),S++),A=_}let D=A[Zs];if(D)D>=96&&d?(le[te++]=((D-=96)&31)+96,le[te++]=D>>5):le[te++]=D;else{D=r.nextId,D||(D=64),D<m&&this.shouldShareStructure&&!this.shouldShareStructure(T)?(D=r.nextOwnId,D<g||(D=m),r.nextOwnId=D+1):(D>=g&&(D=m),r.nextId=D+1);let O=T.highByte=D>=96&&d?D-96>>5:-1;A[Zs]=D,r[D-64]=T,D<m?(T.isShared=!0,r.sharedLength=D-63,n=!0,O>=0?(le[te++]=(D&31)+96,le[te++]=O):le[te++]=D):(O>=0?(le[te++]=213,le[te++]=114,le[te++]=(D&31)+96,le[te++]=O):(le[te++]=212,le[te++]=114,le[te++]=D),S&&(v+=y*S),p.length>=u&&(p.shift()[Zs]=0),p.push(A),b(T))}for(let O=0,z=T.length;O<z;O++)b(w[T[O]])},M=w=>{let T;if(w>
311316777216){if(w-e>_f)throw new Error("Packed buffer would be larger than maximum buffer size");T=Math.min(_f,Math.round(Math.max((w-e)*(w>67108864?1.25:2),4194304)/4096)*4096)}else T=(Math.max(w-e<<2,le.length-1)>>12)+1<<12;let _=new dc(T);return zt=new DataView(_.buffer,0,T),le.copy?le.copy(_,0,e,w):_.set(le.slice(e,w)),te-=e,e=0,$i=_.length-10,le=_}}useBuffer(t){le=t,zt=new DataView(le.buffer,le.byteOffset,le.byteLength),te=0}};nu=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Vm];ja=[{pack(t,e,i){let n=t.getTime()/1e3;if((this.useTimestamp32||t.getMilliseconds()===0)&&n>=0&&n<4294967296){let{target:r,targetView:s,position:o}=e(6);r[o++]=214,r[o++]=255,s.setUint32(o,n)}else if(n>0&&n<17179869184){let{target:r,targetView:s,position:o}=e(10);r[o++]=215,r[o++]=255,s.setUint32(o,t.getMilliseconds()*4e6+(n/1e3/4294967296>>0)),s.setUint32(o+4,n)}else if(isNaN(n)){if(this.onInvalidDate)return e(0),i(this.onInvalidDate());let{target:r,targetView:s,position:o}=e(3);r[o++]=212,r[o++]=255,r[o++]=255}else{let{target:r,targetView:s,position:o}=e(15);r[o++]=199,r[o++]=12,r[o++]=255,s.setUint32(o,t.getMilliseconds()*1e6),s.setBigInt64(o+4,BigInt(Math.floor(n)))}}},{pack(t,e,i){let n=Array.from(t),{target:r,position:s}=e(this.structuredClone?3:0);this.structuredClone&&(r[s++]=212,r[s++]=115,r[s++]=0),i(n)}},{pack(t,e,i){let{target:n,position:r}=e(this.structuredClone?3:0);this.structuredClone&&(n[r++]=212,n[r++]=101,n[r++]=0),i([t.name,t.message])}},{pack(t,e,i){let{target:n,position:r}=e(this.structuredClone?3:0);this.structuredClone&&(n[r++]=212,n[r++]=120,n[r++]=0),i([t.source,t.flags])}},{pack(t,e){this.structuredClone?bf(t,16,e):wf(ml?Buffer.from(t):new Uint8Array(t),e)}},{pack(t,e){let i=t.constructor;i!==$m&&this.structuredClone?bf(t,Xm.indexOf(i.name),e):wf(t,e)}},{pack(t,e){let{target:i,position:n}=e(1);i[n]=193}}];function bf(t,e,i,n){let r=t.byteLength;if(r+1<256){var{target:s,position:o}=i(4+r);s[o++]=199,s[o++]=r+1}else if(r+1<65536){var{target:s,position:o}=i(5+r);s[o++]=200,s[o++]=r+1>>8,s[o++]=r+1&255}else{var{target:s,position:o,targetView:a}=i(7+r);s[o++]=201,a.setUint32(o,r+1),o+=4}s[o++]=116,s[o++]=e,s.set(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o)}function wf(t,e){let i=t.byteLength;var n,r;if(i<256){var{target:n,position:r}=e(i+2);n[r++]=196,n[r++]=i}else if(i<65536){var{target:n,position:r}=e(i+3);n[r++]=197,n[r++]=i>>8,n[r++]=i&255}else{var{target:n,position:r,targetView:s}=e(i+5);n[r++]=198,s.setUint32(r,i),r+=4}n.set(t,r)}function RS(t,e,i,n){let r=t.length;switch(r){case 1:e[i++]=212;break;case 2:e[i++]=213;break;case 4:e[i++]=214;break;case 8:e[i++]=215;break;case 16:e[i++]=216;break;default:r<256?(e[i++]=199,e[i++]=r):r<65536?(e[i++]=200,e[i++]=r>>8,e[i++]=r&255):(e[i++]=201,e[i++]=r>>24,e[i++]=r>>16&255,e[i++]=r>>8&255,e[i++]=r&255)}return e[i++]=n,e.set(t,i),i+=r,i}function IS(t,e){let i,n=e.length*6,r=t.length-n;for(e.sort((s,o)=>s.offset>o.offset?1:-1);i=e.pop();){let s=i.offset,o=i.id;t.copyWithin(s+n,s,r),n-=6;let a=s+n;t[a++]=214,t[a++]=105,t[a++]=o>>24,t[a++]=o>>16&255,t[a++]=o>>8&255,t[a++]=o&255,r=s}return t}function Ns(t){if(t.Class){if(!t.pack&&!t.write)throw new Error("Extension has no pack or write function");if(t.pack&&!t.type)throw new Error("Extension has no type (numeric code to identify the extension)");nu.unshift(t.Class),ja.unshift(t)}PS(t)}var Jm=new Zm({useRecords:!1});Jm.pack;Jm.pack;var zS=512,NS=1024,Sf=new Zm({structuredClone:!0});Ns({Class:Wt.prototype.constructor,type:1,write(t){return{...t}},read(t){return Object.setPrototypeOf(t,Wt.prototype),t}});Ns({Class:mt.prototype.constructor,type:2,write(t){return[...t]},read(t){return Object.setPrototypeOf(t,mt.prototype),t}});Ns({Class:ci.prototype.constructor,type:3,write(t){return[...t]},read(t){return Object.setPrototypeOf(t,ci.prototype),t}});Ns({Class:uf.prototype.constructor,type:4,write(t){return t.id},read(t){return new uf(t)}});Ns({Class:df.prototype.constructor,type:5,write(t){return t.data},read(t){return new df(t)}});Ns({Class:Lr.prototype.constructor,type:6,write(t){return{...t}},read(t){return Object.setPrototypeOf(t,Lr.prototype),t}});function US(t){var e=0;if(t.length===0)return e;for(let i=0;i<t.length;i++){let n=t[i];e=(e<<5)-e+n,e=e&e}return e}function Zc(t){if(ka(t))return t;if(Array.isArray(t))return t.map(Zc);if(typeof t=="object"&&t!==null){let e={};for(let i of Object.keys(t).sort())e[i]=Zc(t[i]);return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}else return t}var Jc;(t=>{function e(r){return Sf.pack(r)}t.serialize=e;function i(r){return Sf.unpack(r)}
3113t.deserialize=i;function n(r){return US(e(Zc(r))).toString()}t.checksum=n})(Jc||(Jc={}));var Mf;(t=>{function e(n,r){return n[0]===r[0]&&n[1]===r[1]}t.isEqual=e;function i(n,r,s){return[n[0]+(r[0]-n[0])*s,n[1]+(r[1]-n[1])*s]}t.lerp=i})(Mf||(Mf={}));var mo;(t=>{function e(s,o){return s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]}t.isEqual=e;function i(s,o){return[s[0]+o[0],s[1]+o[1],s[2]+o[2]]}t.add=i;function n(s,o){return[s[0]-o[0],s[1]-o[1],s[2]-o[2]]}t.sub=n;function r(s,o,a){return[s[0]+(o[0]-s[0])*a,s[1]+(o[1]-s[1])*a,s[2]+(o[2]-s[2])*a]}t.lerp=r})(mo||(mo={}));var Af;(t=>{function e(n,r){return n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3]}t.isEqual=e;function i(n,r,s){return[n[0]+(r[0]-n[0])*s,n[1]+(r[1]-n[1])*s,n[2]+(r[2]-n[2])*s,n[3]+(r[3]-n[3])*s]}t.lerp=i})(Af||(Af={}));var Ls;(t=>{t.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function e(r,s){for(let o=0;o<16;o++)if(r[o]!==s[o])return!1;return!0}t.isEqual=e;function i(r){return r!=null?r:t.identity}t.simplify=i;function n(r,s){let o=s.slice(0);for(var a=0,l=s.length;a<l;a+=3){let h=r[3]*s[a]+r[7]*s[a+1]+r[11]*s[a+2]+r[15];o[a]=(r[0]*s[a]+r[4]*s[a+1]+r[8]*s[a+2]+r[12])/h,o[a+1]=(r[1]*s[a]+r[5]*s[a+1]+r[9]*s[a+2]+r[13])/h,o[a+2]=(r[2]*s[a]+r[6]*s[a+1]+r[10]*s[a+2]+r[14])/h}return o}t.applyMatrix4=n})(Ls||(Ls={}));var Li;(t=>{t.white={r:1,g:1,b:1},t.red={r:1,g:0,b:0},t.black={r:0,g:0,b:0};function e(o){return{r:Math.round(o.r*255),g:Math.round(o.g*255),b:Math.round(o.b*255),a:1}}t.toRgb255a1=e;function i(o){return{r:o.r,g:o.g,b:o.b}}t.clone=i;function n(o){return o=Math.floor(o),{r:(o>>16&255)/255,g:(o>>8&255)/255,b:(o&255)/255}}t.fromHex=n;function r(o,a){return o.r===a.r&&o.g===a.g&&o.b===a.b}t.equals=r;function s(o,a,l){return{r:o.r+(a.r-o.r)*l,g:o.g+(a.g-o.g)*l,b:o.b+(a.b-o.b)*l}}t.lerp=s})(Li||(Li={}));var En;(t=>{t.white={...Li.white,a:1},t.transparent={...Li.white,a:0};function e(o){return{r:o[0],g:o[1],b:o[2],a:o[3]}}t.from0to1=e;function i(o,a){return{...Li.fromHex(o),a}}t.fromHexAndA=i;function n(o){return{r:Math.round(o.r*255),g:Math.round(o.g*255),b:Math.round(o.b*255),a:o.a}}t.toRgb255a1=n;function r(o,a){return Li.equals(o,a)&&o.a===a.a}t.equals=r;function s(o,a,l){return{r:o.r+(a.r-o.r)*l,g:o.g+(a.g-o.g)*l,b:o.b+(a.b-o.b)*l,a:o.a+(a.a-o.a)*l}}t.lerp=s})(En||(En={}));var Kc;(t=>t.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]})(Kc||(Kc={}));var Tf;(t=>t.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(Tf||(Tf={}));var Ef;(t=>t.defaultData={control1:[.5,.05],control2:[.1,.3]})(Ef||(Ef={}));var qa;(t=>{t.all=["PerspectiveCamera","OrthographicCamera"];function e(i){return t.all.includes(i)}t.is=e})(qa||(qa={}));var Ao;(t=>{t.DefaultUp=[0,1,0],t.DefaultTargetOffset=1e3,t.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:5,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:t.DefaultUp,isUpVectorFlipped:!1,targetOffset:t.DefaultTargetOffset};function e(i){return i.type==="PerspectiveCamera"?i.perspective.zoom:i.orthographic.zoom}t.getZoom=e})(Ao||(Ao={}));var Qc;(t=>{function e(i,n=.1){return{type:"radial",hideBase:!1,count:3,radial:{radius:Math.max(i[0],i[1])*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[i[0]+i[0]*n,0,0]},grid:{count:[2,2,2],size:i.map(r=>r*(1+n)),useCenter:!0}}}t.defaultData=e})(Qc||(Qc={}));var eh;(t=>{t.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function e(i){return t.all.includes(i)}t.is=e})(eh||(eh={}));var th;(t=>{function e(n){return i(n)}t.defaultData=e;function i(n){if(n==="PointLight")return{type:n,color:En.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,depth:1e5};if(n==="SpotLight")return{type:n,color:En.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,shadowResolution:1024,shadowRadius:1};if(n==="DirectionalLight")return{type:n,color:En.white,intensity:1,shadows:!0,size:1e3,depth:1e5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}})(th||(th={}));var ih;(t=>{t.defaultData={castShadow:!0,receiveShadow:!0}
3113;function e(i,n){return i.castShadow===n.castShadow&&i.receiveShadow===n.receiveShadow}t.equals=e})(ih||(ih={}));var nh;(t=>{t.defaultData={flatShading:!1,wireframe:!1,side:0};function e(i,n){return i.flatShading===n.flatShading&&i.side===n.side&&i.wireframe===n.wireframe}t.equals=e})(nh||(nh={}));var rh;(t=>t.defaultData={...nh.defaultData,...ih.defaultData,cloner:null,booleanExclude:null})(rh||(rh={}));var BS=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis","side"],FS=["wrapping","image"],Kn;(t=>{function e(r,s){return r==="light"&&s?i(s):n(r)}t.defaultData=e;function i(r){switch(r){case"phong":return{category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",alpha:.6,visible:!0,mode:0};case"toon":return{category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"lambert":return{category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0};case"physical":return{category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0}}}function n(r){switch(r){case"texture":return{alpha:1,visible:!0,size:[128,128],mode:0,axis:"x",side:2,type:"texture",projection:0,texture:{image:"image_0",wrapping:1001,repeat:[1,1],offset:[0,0]},crop:!0};case"color":return{type:"color",alpha:1,visible:!0,mode:0,color:Li.fromHex(4737101)};case"depth":return{type:"depth",alpha:1,visible:!0,mode:0,gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{type:"normal",alpha:1,visible:!0,mode:0,cnormal:[1,1,1]};case"gradient":return{type:"gradient",alpha:1,visible:!0,mode:0,gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{type:"noise",alpha:1,visible:!0,mode:0,size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...Li.fromHex(6710886),a:1},colorB:{...Li.fromHex(6710886),a:1},colorC:{...Li.fromHex(16777215),a:1},colorD:{...Li.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8]};case"fresnel":return{type:"fresnel",alpha:1,visible:!0,mode:0,color:En.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{type:"rainbow",alpha:1,visible:!0,mode:0,filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{type:"toon",alpha:1,visible:!0,mode:0,positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:En.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{type:"outline",alpha:1,visible:!0,mode:0,outlineColor:En.fromHexAndA(0,1),contourColor:En.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{type:"matcap",alpha:1,visible:!0,mode:0,texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0]}};case"transmission":return{type:"transmission",alpha:1,visible:!0,mode:0,thickness:10,ior:1.5,roughness:1};case"displace":return{type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,visible:!0}}}})(Kn||(Kn={}));var Pn;(t=>{function e(l){return!l.layers.some(h=>h.data.type==="texture"&&h.data.projection!==0||h.data.type==="depth"&&!h.data.isWorldSpace||h.data.type==="noise"||h.data.type==="displace")&&!n(l)}t.isMergable=e;function i(l){let h="";return l.layers.forEach(f=>{Object.entries(f.data).forEach(([c,u])=>{h+=`${c}${u}`,Array.isArray(u)?u.forEach(d=>h+=`${d}`):typeof u=="object"?Object.values(u).forEach(d=>{typeof d=="number"?h+=`${d.toFixed(4)}`:h+=`${d}`}):h+=`${u}`})}),h}t.getHash=i;function n(l){let h=0;for(let f of l.layers)"alpha"in f.data&&f.data.type!=="light"&&f.data.type!=="fresnel"&&(h+=(1-h)*f.data.alpha);return h<1}t.isTransparent=n;function r(){return{layers:new mt}}t.defaultEmptyData=r;function s(l="layer1",h="layer2"){return o("phong",l,h)}t.defaultData=s;function o(l,h="layer1",f="layer2"){let c=new mt;
3113return c.push({fi:0,data:Kn.defaultData("light",l),id:h}),c.push({fi:1,data:Kn.defaultData("color"),id:f}),{layers:c}}t.defaultTwoLayerData=o;function a(l,h="phong",f="layer1",c="layer2"){let u=Kn.defaultData("texture");Object.assign(u.texture,{image:l});let d=new mt;return d.push({fi:0,data:u,id:f}),d.push({fi:1,data:Kn.defaultData("light",h),id:c}),{layers:d}}t.defaultTwoLayerTextureData=a})(Pn||(Pn={}));var Xa;(t=>{function e(){return{points:new mt,roundness:0,shapeHoles:[],isClosed:!1}}t.defaultData=e})(Xa||(Xa={}));var Ya;(t=>{function e(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"}t.is2DParametricMesh=e})(Ya||(Ya={}));var xs;(t=>{function e(i){if(i==="RectangleGeometry")return{width:320,height:320,type:i,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:Xa.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:"",textTransform:1,font:"Roboto_regular",extrudeBevelSize:0,extrudeBevelSegments:1};throw new Error("not implemented")}t.defaultData=e})(xs||(xs={}));var kS=typeof global=="object"&&global&&global.Object===Object&&global,Km=kS,VS=typeof self=="object"&&self&&self.Object===Object&&self,GS=Km||VS||Function("return this")(),fn=GS,HS=fn.Symbol,hn=HS,Qm=Object.prototype,WS=Qm.hasOwnProperty,jS=Qm.toString,Js=hn?hn.toStringTag:void 0;function qS(t){var e=WS.call(t,Js),i=t[Js];try{t[Js]=void 0;var n=!0}catch{}var r=jS.call(t);return n&&(e?t[Js]=i:delete t[Js]),r}var XS=qS,YS=Object.prototype,$S=YS.toString;function ZS(t){return $S.call(t)}var JS=ZS,KS="[object Null]",QS="[object Undefined]",Cf=hn?hn.toStringTag:void 0;
3113function eM(t){return t==null?t===void 0?QS:KS:Cf&&Cf in Object(t)?XS(t):JS(t)}var Vr=eM;function tM(t){return t!=null&&typeof t=="object"}var lr=tM,iM="[object Symbol]";function nM(t){return typeof t=="symbol"||lr(t)&&Vr(t)==iM}var ru=nM;function rM(t,e){for(var i=-1,n=t==null?0:t.length,r=Array(n);++i<n;)r[i]=e(t[i],i,t);return r}var eg=rM,sM=Array.isArray,qi=sM,oM=1/0,Lf=hn?hn.prototype:void 0,Pf=Lf?Lf.toString:void 0;function tg(t){if(typeof t=="string")return t;if(qi(t))return eg(t,tg)+"";if(ru(t))return Pf?Pf.call(t):"";var e=t+"";return e=="0"&&1/t==-oM?"-0":e}var aM=tg;function lM(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var un=lM;function cM(t){return t}var ig=cM,hM="[object AsyncFunction]",uM="[object Function]",dM="[object GeneratorFunction]",fM="[object Proxy]";function pM(t){if(!un(t))return!1;var e=Vr(t);return e==uM||e==dM||e==hM||e==fM}var su=pM,mM=fn["__core-js_shared__"],fc=mM,Df=function(){var t=/[^.]+$/.exec(fc&&fc.keys&&fc.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function gM(t){return!!Df&&Df in t}var vM=gM,yM=Function.prototype,xM=yM.toString;function _M(t){if(t!=null){try{return xM.call(t)}catch{}try{return t+""}catch{}}return""}var Gr=_M,bM=/[\\^$.*+?()[\]{}|]/g,wM=/^\[object .+?Constructor\]$/,SM=Function.prototype,MM=Object.prototype,AM=SM.toString,TM=MM.hasOwnProperty,EM=RegExp("^"+AM.call(TM).replace(bM,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function CM(t){if(!un(t)||vM(t))return!1;var e=su(t)?EM:wM;return e.test(Gr(t))}var LM=CM;function PM(t,e){return t==null?void 0:t[e]}var DM=PM;function OM(t,e){var i=DM(t,e);return LM(i)?i:void 0}var Hr=OM,RM=Hr(fn,"WeakMap"),sh=RM,Of=Object.create,IM=function(){function t(){}return function(e){if(!un(e))return{};if(Of)return Of(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}(),zM=IM;function NM(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}var UM=NM;function BM(t,e){var i=-1,n=t.length;for(e||(e=Array(n));++i<n;)e[i]=t[i];return e}var ng=BM,FM=800,kM=16,VM=Date.now;function GM(t){var e=0,i=0;return function(){var n=VM(),r=kM-(n-i);if(i=n,r>0){if(++e>=FM)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var HM=GM;function WM(t){return function(){return t}}var jM=WM,qM=function(){try{var t=Hr(Object,"defineProperty");return t({},"",{}),t}catch{}}(),$a=qM,XM=$a?function(t,e){return $a(t,"toString",{configurable:!0,enumerable:!1,value:jM(e),writable:!0})}:ig,YM=XM,$M=HM(YM),rg=$M;function ZM(t,e){for(var i=-1,n=t==null?0:t.length;++i<n&&e(t[i],i,t)!==!1;);return t}var JM=ZM,KM=9007199254740991,QM=/^(?:0|[1-9]\d*)$/;function e2(t,e){var i=typeof t;return e=e!=null?e:KM,!!e&&(i=="number"||i!="symbol"&&QM.test(t))&&t>-1&&t%1==0&&t<e}var gl=e2;function t2(t,e,i){e=="__proto__"&&$a?$a(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}var ou=t2;function i2(t,e){return t===e||t!==t&&e!==e}var vl=i2,n2=Object.prototype,r2=n2.hasOwnProperty;function s2(t,e,i){var n=t[e];(!(r2.call(t,e)&&vl(n,i))||i===void 0&&!(e in t))&&ou(t,e,i)}var au=s2;function o2(t,e,i,n){var r=!i;i||(i={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=n?n(i[a],t[a],a,i,t):void 0;l===void 0&&(l=t[a]),r?ou(i,a,l):au(i,a,l)}return i}var Us=o2,Rf=Math.max;function a2(t,e,i){return e=Rf(e===void 0?t.length-1:e,0),function(){for(var n=arguments,r=-1,s=Rf(n.length-e,0),o=Array(s);++r<s;)o[r]=n[e+r];r=-1;for(var a=Array(e+1);++r<e;)a[r]=n[r];return a[e]=i(o),UM(t,this,a)}}var sg=a2;function l2(t,e){return rg(sg(t,e,ig),t+"")}var c2=l2,h2=9007199254740991;function u2(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=h2}var lu=u2;function d2(t){return t!=null&&lu(t.length)&&!su(t)}var yl=d2;function f2(t,e,i){if(!un(i))return!1;var n=typeof e;return(n=="number"?yl(i)&&gl(e,i.length):n=="string"&&e in i)?vl(i[e],t):!1}var p2=f2;function m2(t){return c2(function(e,i){var n=-1,r=i.length,s=r>1?i[r-1]:void 0,o=r>2?i[2]:void 0;for(s=t.length>3&&typeof s=="function"?(r--,s):void 0,o&&p2(i[0],i[1],o)&&(s=r<3?void 0:s,r=1),e=Object(e);++n<r;){var a=i[n];a&&t(e,a,n,s)}return e})}var g2=m2,v2=Object.prototype;function y2(t){var e=t&&t.constructor,i=typeof e=="function"&&e.prototype||v2;return t===i}var cu=y2;function x2(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n}var _2=x2,b2="[object Arguments]";function w2(t){return lr(t)&&Vr(t)==b2}var If=w2,og=Object.prototype,S2=og.hasOwnProperty,M2=og.propertyIsEnumerable,A2=If(function(){return arguments}())?If:function(t){return lr(t)&&S2.call(t,"callee")&&!M2.call(t,"callee")},To=A2;function T2(){return!1}var E2=T2,ag=typeof mi=="object"&&mi&&!mi.nodeType&&mi,zf=ag&&typeof gi=="object"&&gi&&!gi.nodeType&&gi,C2=zf&&zf.exports===ag,Nf=C2?fn.Buffer:void 0,L2=Nf?Nf.isBuffer:void 0,P2
3113=L2||E2,hu=P2,D2="[object Arguments]",O2="[object Array]",R2="[object Boolean]",I2="[object Date]",z2="[object Error]",N2="[object Function]",U2="[object Map]",B2="[object Number]",F2="[object Object]",k2="[object RegExp]",V2="[object Set]",G2="[object String]",H2="[object WeakMap]",W2="[object ArrayBuffer]",j2="[object DataView]",q2="[object Float32Array]",X2="[object Float64Array]",Y2="[object Int8Array]",$2="[object Int16Array]",Z2="[object Int32Array]",J2="[object Uint8Array]",K2="[object Uint8ClampedArray]",Q2="[object Uint16Array]",e3="[object Uint32Array]",St={};St[q2]=St[X2]=St[Y2]=St[$2]=St[Z2]=St[J2]=St[K2]=St[Q2]=St[e3]=!0;St[D2]=St[O2]=St[W2]=St[R2]=St[j2]=St[I2]=St[z2]=St[N2]=St[U2]=St[B2]=St[F2]=St[k2]=St[V2]=St[G2]=St[H2]=!1;function t3(t){return lr(t)&&lu(t.length)&&!!St[Vr(t)]}var i3=t3;function n3(t){return function(e){return t(e)}}var uu=n3,lg=typeof mi=="object"&&mi&&!mi.nodeType&&mi,go=lg&&typeof gi=="object"&&gi&&!gi.nodeType&&gi,r3=go&&go.exports===lg,pc=r3&&Km.process,s3=function(){try{var t=go&&go.require&&go.require("util").types;return t||pc&&pc.binding&&pc.binding("util")}catch{}}(),Ps=s3,Uf=Ps&&Ps.isTypedArray,o3=Uf?uu(Uf):i3,cg=o3,a3=Object.prototype,l3=a3.hasOwnProperty;function c3(t,e){var i=qi(t),n=!i&&To(t),r=!i&&!n&&hu(t),s=!i&&!n&&!r&&cg(t),o=i||n||r||s,a=o?_2(t.length,String):[],l=a.length;for(var h in t)(e||l3.call(t,h))&&!(o&&(h=="length"||r&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||gl(h,l)))&&a.push(h);return a}var hg=c3;function h3(t,e){return function(i){return t(e(i))}}var ug=h3,u3=ug(Object.keys,Object),d3=u3,f3=Object.prototype,p3=f3.hasOwnProperty;function m3(t){if(!cu(t))return d3(t);var e=[];for(var i in Object(t))p3.call(t,i)&&i!="constructor"&&e.push(i);return e}var g3=m3;function v3(t){return yl(t)?hg(t):g3(t)}var du=v3;function y3(t){var e=[];if(t!=null)for(var i in Object(t))e.push(i);return e}var x3=y3,_3=Object.prototype,b3=_3.hasOwnProperty;function w3(t){if(!un(t))return x3(t);var e=cu(t),i=[];for(var n in t)n=="constructor"&&(e||!b3.call(t,n))||i.push(n);return i}var S3=w3;function M3(t){return yl(t)?hg(t,!0):S3(t)}var Uo=M3,A3=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,T3=/^\w*$/;function E3(t,e){if(qi(t))return!1;var i=typeof t;return i=="number"||i=="symbol"||i=="boolean"||t==null||ru(t)?!0:T3.test(t)||!A3.test(t)||e!=null&&t in Object(e)}var C3=E3,L3=Hr(Object,"create"),Eo=L3;function P3(){this.__data__=Eo?Eo(null):{},this.size=0}var D3=P3;function O3(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var R3=O3,I3="__lodash_hash_undefined__",z3=Object.prototype,N3=z3.hasOwnProperty;function U3(t){var e=this.__data__;if(Eo){var i=e[t];return i===I3?void 0:i}return N3.call(e,t)?e[t]:void 0}var B3=U3,F3=Object.prototype,k3=F3.hasOwnProperty;function V3(t){var e=this.__data__;return Eo?e[t]!==void 0:k3.call(e,t)}var G3=V3,H3="__lodash_hash_undefined__";function W3(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Eo&&e===void 0?H3:e,this}var j3=W3;function Bs(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Bs.prototype.clear=D3;Bs.prototype.delete=R3;Bs.prototype.get=B3;Bs.prototype.has=G3;Bs.prototype.set=j3;var Bf=Bs;function q3(){this.__data__=[],this.size=0}var X3=q3;function Y3(t,e){for(var i=t.length;i--;)if(vl(t[i][0],e))return i;return-1}var xl=Y3,$3=Array.prototype,Z3=$3.splice;function J3(t){var e=this.__data__,i=xl(e,t);if(i<0)return!1;var n=e.length-1;return i==n?e.pop():Z3.call(e,i,1),--this.size,!0}var K3=J3;function Q3(t){var e=this.__data__,i=xl(e,t);return i<0?void 0:e[i][1]}var eA=Q3;function tA(t){return xl(this.__data__,t)>-1}var iA=tA;function nA(t,e){var i=this.__data__,n=xl(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this}var rA=nA;function Fs(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Fs.prototype.clear=X3;Fs.prototype.delete=K3;Fs.prototype.get=eA;Fs.prototype.has=iA;Fs.prototype.set=rA;var _l=Fs,sA=Hr(fn,"Map"),Co=sA;function oA(){this.size=0,this.__data__={hash:new Bf,map:new(Co||_l),string:new Bf}}var aA=oA;function lA(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var cA=lA;function hA(t,e){var i=t.__data__;return cA(e)?i[typeof e=="string"?"string":"hash"]:i.map}var bl=hA;function uA(t){var e=bl(this,t).delete(t);return this.size-=e?1:0,e}var dA=uA;function fA(t){return bl(this,t).get(t)}var pA=fA;function mA(t){return bl(this,t).has(t)}var gA=mA;function vA(t,e){var i=bl(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this}var yA=vA;function ks(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}ks.prototype.clear=aA;ks.prototype.delete=dA;ks.prototype.get=pA;ks.prototype.has=gA;ks.prototype.set=yA;var fu=ks,xA="Expected a function";function pu(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(xA);var i=function(){var n=arguments,r=e?e.apply(this,n):n[0],s=i.cache;if(s.has(r))return s.get(r);
3113var o=t.apply(this,n);return i.cache=s.set(r,o)||s,o};return i.cache=new(pu.Cache||fu),i}pu.Cache=fu;var _A=pu,bA=500;function wA(t){var e=_A(t,function(n){return i.size===bA&&i.clear(),n}),i=e.cache;return e}var SA=wA,MA=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,AA=/\\(\\)?/g,TA=SA(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(MA,function(i,n,r,s){e.push(r?s.replace(AA,"$1"):n||i)}),e}),EA=TA;function CA(t){return t==null?"":aM(t)}var LA=CA;function PA(t,e){return qi(t)?t:C3(t,e)?[t]:EA(LA(t))}var Vs=PA,DA=1/0;function OA(t){if(typeof t=="string"||ru(t))return t;var e=t+"";return e=="0"&&1/t==-DA?"-0":e}var wl=OA;function RA(t,e){e=Vs(e,t);for(var i=0,n=e.length;t!=null&&i<n;)t=t[wl(e[i++])];return i&&i==n?t:void 0}var dg=RA;function IA(t,e){for(var i=-1,n=e.length,r=t.length;++i<n;)t[r+i]=e[i];return t}var mu=IA,Ff=hn?hn.isConcatSpreadable:void 0;function zA(t){return qi(t)||To(t)||!!(Ff&&t&&t[Ff])}var NA=zA;function fg(t,e,i,n,r){var s=-1,o=t.length;for(i||(i=NA),r||(r=[]);++s<o;){var a=t[s];e>0&&i(a)?e>1?fg(a,e-1,i,n,r):mu(r,a):n||(r[r.length]=a)}return r}var UA=fg;function BA(t){var e=t==null?0:t.length;return e?UA(t,1):[]}var FA=BA;function kA(t){return rg(sg(t,void 0,FA),t+"")}var pg=kA,VA=ug(Object.getPrototypeOf,Object),gu=VA,GA="[object Object]",HA=Function.prototype,WA=Object.prototype,mg=HA.toString,jA=WA.hasOwnProperty,qA=mg.call(Object);function XA(t){if(!lr(t)||Vr(t)!=GA)return!1;var e=gu(t);if(e===null)return!0;var i=jA.call(e,"constructor")&&e.constructor;return typeof i=="function"&&i instanceof i&&mg.call(i)==qA}var gg=XA;function YA(t,e,i){var n=-1,r=t.length;e<0&&(e=-e>r?0:r+e),i=i>r?r:i,i<0&&(i+=r),r=e>i?0:i-e>>>0,e>>>=0;for(var s=Array(r);++n<r;)s[n]=t[n+e];return s}var $A=YA;function ZA(){this.__data__=new _l,this.size=0}var JA=ZA;function KA(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}var QA=KA;function eT(t){return this.__data__.get(t)}var tT=eT;function iT(t){return this.__data__.has(t)}var nT=iT,rT=200;function sT(t,e){var i=this.__data__;if(i instanceof _l){var n=i.__data__;if(!Co||n.length<rT-1)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new fu(n)}return i.set(t,e),this.size=i.size,this}var oT=sT;function Gs(t){var e=this.__data__=new _l(t);this.size=e.size}Gs.prototype.clear=JA;Gs.prototype.delete=QA;Gs.prototype.get=tT;Gs.prototype.has=nT;Gs.prototype.set=oT;var vg=Gs;function aT(t,e){return t&&Us(e,du(e),t)}var lT=aT;function cT(t,e){return t&&Us(e,Uo(e),t)}var hT=cT,yg=typeof mi=="object"&&mi&&!mi.nodeType&&mi,kf=yg&&typeof gi=="object"&&gi&&!gi.nodeType&&gi,uT=kf&&kf.exports===yg,Vf=uT?fn.Buffer:void 0,Gf=Vf?Vf.allocUnsafe:void 0;function dT(t,e){if(e)return t.slice();var i=t.length,n=Gf?Gf(i):new t.constructor(i);return t.copy(n),n}var xg=dT;function fT(t,e){for(var i=-1,n=t==null?0:t.length,r=0,s=[];++i<n;){var o=t[i];e(o,i,t)&&(s[r++]=o)}return s}var pT=fT;function mT(){return[]}var _g=mT,gT=Object.prototype,vT=gT.propertyIsEnumerable,Hf=Object.getOwnPropertySymbols,yT=Hf?function(t){return t==null?[]:(t=Object(t),pT(Hf(t),function(e){return vT.call(t,e)}))}:_g,vu=yT;function xT(t,e){return Us(t,vu(t),e)}var _T=xT,bT=Object.getOwnPropertySymbols,wT=bT?function(t){for(var e=[];t;)mu(e,vu(t)),t=gu(t);return e}:_g,bg=wT;function ST(t,e){return Us(t,bg(t),e)}var MT=ST;function AT(t,e,i){var n=e(t);return qi(t)?n:mu(n,i(t))}var wg=AT;function TT(t){return wg(t,du,vu)}var ET=TT;function CT(t){return wg(t,Uo,bg)}var Sg=CT,LT=Hr(fn,"DataView"),oh=LT,PT=Hr(fn,"Promise"),ah=PT,DT=Hr(fn,"Set"),lh=DT,Wf="[object Map]",OT="[object Object]",jf="[object Promise]",qf="[object Set]",Xf="[object WeakMap]",Yf="[object DataView]",RT=Gr(oh),IT=Gr(Co),zT=Gr(ah),NT=Gr(lh),UT=Gr(sh),vr=Vr;(oh&&vr(new oh(new ArrayBuffer(1)))!=Yf||Co&&vr(new Co)!=Wf||ah&&vr(ah.resolve())!=jf||lh&&vr(new lh)!=qf||sh&&vr(new sh)!=Xf)&&(vr=function(t){var e=Vr(t),i=e==OT?t.constructor:void 0,n=i?Gr(i):"";if(n)switch(n){case RT:return Yf;case IT:return Wf;case zT:return jf;case NT:return qf;case UT:return Xf}return e});var yu=vr,BT=Object.prototype,FT=BT.hasOwnProperty;function kT(t){var e=t.length,i=new t.constructor(e);return e&&typeof t[0]=="string"&&FT.call(t,"index")&&(i.index=t.index,i.input=t.input),i}var VT=kT,GT=fn.Uint8Array,$f=GT;function HT(t){var e=new t.constructor(t.byteLength);return new $f(e).set(new $f(t)),e}var xu=HT;function WT(t,e){var i=e?xu(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}var jT=WT,qT=/\w*$/;function XT(t){var e=new t.constructor(t.source,qT.exec(t));return e.lastIndex=t.lastIndex,e}var YT=XT,Zf=hn?hn.prototype:void 0,Jf=Zf?Zf.valueOf:void 0;function $T(t){return Jf?Object(Jf.call(t)):{}}var ZT=$T;function JT(t,e){var i=e?xu(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}var Mg=JT,KT="[object Boolean]",QT="[object Date]",eE="[object Map]",tE="[object Number]",iE="[object RegExp]",nE="[object Set]",rE="[object String]",sE="[object Symbol]",oE="[object ArrayBuffer]",aE="[object DataView]",lE="[object Float32Array]",cE="[object Float64Array
3113]",hE="[object Int8Array]",uE="[object Int16Array]",dE="[object Int32Array]",fE="[object Uint8Array]",pE="[object Uint8ClampedArray]",mE="[object Uint16Array]",gE="[object Uint32Array]";function vE(t,e,i){var n=t.constructor;switch(e){case oE:return xu(t);case KT:case QT:return new n(+t);case aE:return jT(t,i);case lE:case cE:case hE:case uE:case dE:case fE:case pE:case mE:case gE:return Mg(t,i);case eE:return new n;case tE:case rE:return new n(t);case iE:return YT(t);case nE:return new n;case sE:return ZT(t)}}var yE=vE;function xE(t){return typeof t.constructor=="function"&&!cu(t)?zM(gu(t)):{}}var Ag=xE,_E="[object Map]";function bE(t){return lr(t)&&yu(t)==_E}var wE=bE,Kf=Ps&&Ps.isMap,SE=Kf?uu(Kf):wE,ME=SE,AE="[object Set]";function TE(t){return lr(t)&&yu(t)==AE}var EE=TE,Qf=Ps&&Ps.isSet,CE=Qf?uu(Qf):EE,LE=CE,PE=1,DE=2,OE=4,Tg="[object Arguments]",RE="[object Array]",IE="[object Boolean]",zE="[object Date]",NE="[object Error]",Eg="[object Function]",UE="[object GeneratorFunction]",BE="[object Map]",FE="[object Number]",Cg="[object Object]",kE="[object RegExp]",VE="[object Set]",GE="[object String]",HE="[object Symbol]",WE="[object WeakMap]",jE="[object ArrayBuffer]",qE="[object DataView]",XE="[object Float32Array]",YE="[object Float64Array]",$E="[object Int8Array]",ZE="[object Int16Array]",JE="[object Int32Array]",KE="[object Uint8Array]",QE="[object Uint8ClampedArray]",eC="[object Uint16Array]",tC="[object Uint32Array]",wt={};wt[Tg]=wt[RE]=wt[jE]=wt[qE]=wt[IE]=wt[zE]=wt[XE]=wt[YE]=wt[$E]=wt[ZE]=wt[JE]=wt[BE]=wt[FE]=wt[Cg]=wt[kE]=wt[VE]=wt[GE]=wt[HE]=wt[KE]=wt[QE]=wt[eC]=wt[tC]=!0;wt[NE]=wt[Eg]=wt[WE]=!1;function Pa(t,e,i,n,r,s){var o,a=e&PE,l=e&DE,h=e&OE;if(i&&(o=r?i(t,n,r,s):i(t)),o!==void 0)return o;if(!un(t))return t;var f=qi(t);if(f){if(o=VT(t),!a)return ng(t,o)}else{var c=yu(t),u=c==Eg||c==UE;if(hu(t))return xg(t,a);if(c==Cg||c==Tg||u&&!r){if(o=l||u?{}:Ag(t),!a)return l?MT(t,hT(o,t)):_T(t,lT(o,t))}else{if(!wt[c])return r?t:{};o=yE(t,c,a)}}s||(s=new vg);var d=s.get(t);if(d)return d;s.set(t,o),LE(t)?t.forEach(function(p){o.add(Pa(p,e,i,p,t,s))}):ME(t)&&t.forEach(function(p,v){o.set(v,Pa(p,e,i,v,t,s))});var m=h?l?Sg:ET:l?Uo:du,g=f?void 0:m(t);return JM(g||t,function(p,v){g&&(v=p,p=t[v]),au(o,v,Pa(p,e,i,v,t,s))}),o}var Lg=Pa,iC=1,nC=4;function rC(t){return Lg(t,iC|nC)}var Pg=rC;function sC(t,e){return t!=null&&e in Object(t)}var oC=sC;function aC(t,e,i){e=Vs(e,t);for(var n=-1,r=e.length,s=!1;++n<r;){var o=wl(e[n]);if(!(s=t!=null&&i(t,o)))break;t=t[o]}return s||++n!=r?s:(r=t==null?0:t.length,!!r&&lu(r)&&gl(o,r)&&(qi(t)||To(t)))}var lC=aC;function cC(t,e){return t!=null&&lC(t,e,oC)}var hC=cC;function uC(t){return function(e,i,n){for(var r=-1,s=Object(e),o=n(e),a=o.length;a--;){var l=o[t?a:++r];if(i(s[l],l,s)===!1)break}return e}}var dC=uC,fC=dC(),pC=fC;function mC(t,e,i){(i!==void 0&&!vl(t[e],i)||i===void 0&&!(e in t))&&ou(t,e,i)}var ch=mC;function gC(t){return lr(t)&&yl(t)}var vC=gC;function yC(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var hh=yC;function xC(t){return Us(t,Uo(t))}var _C=xC;function bC(t,e,i,n,r,s,o){var a=hh(t,i),l=hh(e,i),h=o.get(l);if(h){ch(t,i,h);return}var f=s?s(a,l,i+"",t,e,o):void 0,c=f===void 0;if(c){var u=qi(l),d=!u&&hu(l),m=!u&&!d&&cg(l);f=l,u||d||m?qi(a)?f=a:vC(a)?f=ng(a):d?(c=!1,f=xg(l,!0)):m?(c=!1,f=Mg(l,!0)):f=[]:gg(l)||To(l)?(f=a,To(a)?f=_C(a):(!un(a)||su(a))&&(f=Ag(l))):c=!1}c&&(o.set(l,f),r(f,l,n,s,o),o.delete(l)),ch(t,i,f)}var wC=bC;function Dg(t,e,i,n,r){t!==e&&pC(e,function(s,o){if(r||(r=new vg),un(s))wC(t,e,o,i,Dg,n,r);else{var a=n?n(hh(t,o),s,o+"",t,e,r):void 0;a===void 0&&(a=s),ch(t,o,a)}},Uo)}var SC=Dg;function MC(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var AC=MC;function TC(t,e){return e.length<2?t:dg(t,$A(e,0,-1))}var EC=TC,CC=g2(function(t,e,i){SC(t,e,i)}),Za=CC;function LC(t,e){return e=Vs(e,t),t=EC(t,e),t==null||delete t[wl(AC(e))]}var PC=LC;function DC(t){return gg(t)?void 0:t}var OC=DC,RC=1,IC=2,zC=4,NC=pg(function(t,e){var i={};if(t==null)return i;var n=!1;e=eg(e,function(s){return s=Vs(s,t),n||(n=s.length>1),s}),Us(t,Sg(t),i),n&&(i=Lg(i,RC|IC|zC,OC));for(var r=e.length;r--;)PC(i,e[r]);return i}),uh=NC;function UC(t,e,i,n){if(!un(t))return t;e=Vs(e,t);for(var r=-1,s=e.length,o=s-1,a=t;a!=null&&++r<s;){var l=wl(e[r]),h=i;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(r!=o){var f=a[l];
3113h=n?n(f,l,a):void 0,h===void 0&&(h=un(f)?f:gl(e[r+1])?[]:{})}au(a,l,h),a=a[l]}return t}var BC=UC;function FC(t,e,i){for(var n=-1,r=e.length,s={};++n<r;){var o=e[n],a=dg(t,o);i(a,o)&&BC(s,Vs(o,t),a)}return s}var kC=FC;function VC(t,e){return kC(t,e,function(i,n){return hC(t,n)})}var GC=VC,HC=pg(function(t,e){return t==null?{}:GC(t,e)}),Ja=HC,Lo;(t=>{t.identity={...Kc.identity,hiddenMatrix:Ls.identity};function e(r){return{position:r.position,rotation:r.rotation,scale:r.scale,hiddenMatrix:r.hiddenMatrix}}t.fromObject=e;function i(r,s){return{position:(s==null?void 0:s.position)||r.position,rotation:(s==null?void 0:s.rotation)||r.rotation,scale:(s==null?void 0:s.scale)||r.scale,hiddenMatrix:(s==null?void 0:s.hiddenMatrix)||r.hiddenMatrix}}t.merge=i;function n(r,s){return{position:mo.isEqual(r.position,s.position)?null:s.position,rotation:mo.isEqual(r.rotation,s.rotation)?null:s.rotation,scale:mo.isEqual(r.scale,s.scale)?null:s.scale,hiddenMatrix:Ls.isEqual(r.hiddenMatrix,s.hiddenMatrix)?null:s.hiddenMatrix}}t.diff=n})(Lo||(Lo={}));var dh;(t=>t.defaultData={fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]})(dh||(dh={}));var an;(t=>t.defaultData={states:new mt,events:new mt,visible:!0,raycastLock:!1,physics:null,...Lo.identity})(an||(an={}));var ep;(t=>t.defaultData={type:"Empty",...an.defaultData})(ep||(ep={}));var _s;(t=>t.defaultData={type:"Mesh",...an.defaultData,...rh.defaultData})(_s||(_s={}));var fh;(t=>t.defaultData={...an.defaultData,...Lo.identity,...Ao.defaultData})(fh||(fh={}));var tp;(t=>{function e(i){return{...an.defaultData,...th.defaultData(i)}}t.defaultData=e})(tp||(tp={}));var ip;(t=>(t.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:Ls.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:dh.defaultData,states:new mt,events:new mt,...Ao.defaultData},t.defaultMeshObject={name:"Rectangle",...an.defaultData,..._s.defaultData,geometry:xs.defaultData("RectangleGeometry"),material:Pn.defaultTwoLayerData("phong","layer1","layer2")},t.defaultBooleanObject={name:"Boolean",...an.defaultData,..._s.defaultData,geometry:xs.defaultData("BooleanGeometry"),material:Pn.defaultTwoLayerData("phong","layer1","layer2")},t.defaultTextObject={name:"Text",...an.defaultData,..._s.defaultData,geometry:xs.defaultData("TextGeometry"),material:Pn.defaultTwoLayerData("phong","layer1","layer2")}))(ip||(ip={}));var np;(t=>{function e(n,r){if(r===void 0)return n;let s={...n};return"material"in s&&"material"in r&&r.material&&(s.material=hf(s.material,o=>{if(typeof o!="string")for(let[a,l]of Object.entries(r.material.layers)){let h=o.layers.data(a);h&&Za(h,l)}}).data),s.materials&&r.materials&&(s.materials=hf(s.materials,o=>{var a,l;for(let h=0;h<s.materials.length;h++){let f=r.materials[h];if(typeof f!="string")for(let[c,u]of Object.entries(f.layers)){let d=(l=(a=o[h])==null?void 0:a.layers)==null?void 0:l.data(c);d&&Za(d,u)}}}).data),s}t.patchMaterialState=e;function i(n,r){var o,a;if(r===void 0)return n;let s={...n};if(Object.assign(s,Lo.merge(s,r)),qa.is(n.type)){s.orthographic={...s.orthographic},s.perspective={...s.perspective};let l=r;((o=l.orthographic)==null?void 0:o.zoom)!==void 0&&(s.orthographic.zoom=l.orthographic.zoom),((a=l.perspective)==null?void 0:a.zoom)!==void 0&&(s.perspective.zoom=l.perspective.zoom),l.isUpVectorFlipped!==void 0&&(s.isUpVectorFlipped=l.isUpVectorFlipped),l.targetOffset!==void 0&&(s.targetOffset=l.targetOffset)}else if(n.type==="Mesh")s.geometry={...s.geometry},Object.assign(s.geometry,r.geometry),s=e(s,r);else if(eh.is(n.type)){let l=r;l.intensity!==void 0&&(s.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?s.color=l.color:s.color=Li.clone(l.color))}return s}t.patch=i})(np||(np={}));var Ka;(t=>t.defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,isTouchZoom:!0,orbitTouches:2,panTouches:3})(Ka||(Ka={}));var ph;(t=>t.defaultData={orbitControls:Ka.defaultData,playCamera:null,withBackgroun
3113d:!0,preventScroll:!1,settings:{image:{format:"jpg",ratio:1},video:{format:"mp4",imageFormat:"jpg",fps:30,mbps:80,ratio:1,stopMode:"manual",duration:5e3},web:{compress:!0,preset:1,preload:!0}},stopRaycast:!0,joystickSizeAndXYOffset:Array(12).fill(0).map((e,i)=>{let n=0,r=0;return i<5?r=-30:i<10&&(r=30),i===0||i===10||i===5?n=30:(i===4||i===11||i===9)&&(n=-30),[120,[n,r],"show"]}),gameControlObject:null})(ph||(ph={}));function Sl(t,e){return Object.setPrototypeOf(t,e),t}function WC(t){return Array.isArray(t)?t:[t]}var mh;(t=>{function e(){let n={};return n["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},Sl(n,Wt.prototype)}t.defaultColors=e;function i(){return{materials:new Wt,images:new Wt,colors:new Wt,audios:new Wt,fonts:new Wt,penumbraSize:[.5,.5,.5]}}t.emptyData=i})(mh||(mh={}));function rp(t){t.layers.forEach(e=>{if(e.type==="depth"&&e.colorA!==void 0){let i=e.colorA,n=e.colorB,r=[[i.r,i.g,i.b,i.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let a=2;a<10;a++)r.push(r[1]),s.push(1);let o={...Ja(Oi(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:r,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,o)}else if(e.type==="depth"&&e.gradientType===1&&(e.near<0||e.far<0)){let i={...Oi(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,i)}})}function Da(t,e){Object.values(t.shared.materials).forEach(i=>e(i))}function Oa(t,e){t.scene.objects.traverse((i,n)=>{"materials"in n?n.materials.forEach(r=>{typeof r!="string"&&e(r)}):"material"in n&&typeof n.material!="string"&&e(n.material)})}function jC(t){Object.assign(t.scene.publish,{orbitControls:{...Ka.defaultData,...Oi(t.scene.publish.orbitControls)}})}function qC(t){Object.assign(t.scene.publish.settings,{video:{...ph.defaultData.settings.video,...Oi(t.scene.publish.settings.video)}})}function XC(t){function e(i){if(i.layers){for(let n of Object.values(i.layers))if(n){for(let[r,s]of Object.entries(n))if((BS.includes(r)||typeof s=="boolean")&&delete n[r],r==="texture")for(let[o,a]of Object.entries(s))(FS.includes(o)||typeof a=="boolean")&&delete s[o]}}}t.scene.objects.traverse((i,n)=>{n.states.forEach(r=>{let s=r;s.material?e(s.material):s.materials&&s.materials.forEach(o=>{e(o)})})})}function YC(t){t.scene.publish.withBackground=!0}function $C(t){t.scene.publish.settings.web={compress:!0,preload:!0,preset:1}}function ZC(t){t.scene.objects.traverse((e,i)=>{let n=i.cloner;n&&(n.radial.scale=n.radial.scale.map(r=>r+1),n.linear.scale=n.linear.scale.map(r=>r+1))})}function JC(t){t.scene.objects.traverse((e,i)=>{let n=i.geometry;n&&(n.type==="DodecahedronGeometry"||n.type==="IcosahedronGeometry")&&(n.detail=Math.round(n.detail))})}function KC(t){t.scene.objects.traverse((e,i)=>{var r;let n=t.scene.objects.parent(e);i.type==="Mesh"&&(!n||((r=t.scene.objects.data(n).geometry)==null?void 0:r.type)!=="BooleanGeometry")&&(i.booleanExclude=null)})}function sp(t){t.layers===void 0&&Object.assign(t,Pn.defaultTwoLayerData("lambert"))}function mc(t){!t.layers||t.layers.forEach(e=>{if(e.type==="depth"&&e.colors.length===10){let i=[...e.colors];i.push(e.colors[9]);let n=[...e.steps];n.push(e.steps[9]);let r={...Oi(e),colors:i,steps:n};Object.assign(e,r)}})}function QC(t){t.scene.objects.traverse((e,i)=>{i.type==="Mesh"&&(i.geometry.type==="BooleanGeometry"||i.geometry.type==="SubdivGeometry")&&(i.geometry.phongAngle=35)})}function op(t){t.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach(n=>{typeof n!="string"&&mc(n)}):"material"in i&&typeof i.material!="string"&&mc(i.material)}),Object.values(t.shared.materials).forEach(e=>mc(e))}function eL(t){t.scene.environment.ambientLight.softShadows=!1,t.scene.environment.ambientLight.softShadowQuality="low",t.scene.objects.traverse((e,i)=>{(i.type==="DirectionalLight"||i.type==="SpotLight")&&(i.shadowResolution=1024,i.shadowRadius=1,i.depth=1e5)}),t.shared.penumbraSize=new Array(5).fill(.5)}function tL(t){t.shared.audios=Sl({},Wt.prototype)}function iL(t){let e=t.shared.materials;Object.entries(e).forEach(([i,n])=>{if(!n.layers){let r={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(e,{[i]:r})}})}function nL(t){Object.entries(Oi(t.shared.images)).filter(e=>e[1].asset===!1).map(e=>
vendor: 3,500 bytes, line 3113
3113e[0]).forEach(e=>{delete t.shared.images[e]}),Object.entries(Oi(t.shared.audios)).filter(e=>e[1].asset===!1).map(e=>e[0]).forEach(e=>{delete t.shared.audios[e]})}function rL(t){t.scene.publish.settings.web.preload=!1}function ap(t){t.layers&&t.layers.forEach(e=>{e.type==="depth"&&e.num!==void 0&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function sL(t){t.shared.fonts=Sl({},Wt.prototype)}function oL(t){return t.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function aL(t){let e=[];t.scene.objects.traverse((i,n)=>{let r=n;if(r.type==="TextFrame"){let s=Pn.defaultTwoLayerData("phong"),o=typeof r.color=="string"?t.shared.colors[r.color]:r.color;s.layers[1].data.color={r:o.r,g:o.g,b:o.b},s.layers[1].data.alpha=r.alpha;let a=oL(r.font);t.shared.fonts[a]===void 0&&(t.shared.fonts[a]={name:a});let l={name:r.name,...an.defaultData,..._s.defaultData,flatShading:!1,wireframe:!1,geometry:{...xs.defaultData("TextGeometry"),width:r.width,height:r.height,font:a,depth:0,horizontalAlign:r.horizontalAlign,verticalAlign:r.verticalAlign,fontSize:r.fontSize*1.40625,lineHeight:r.lineHeight/1.40625,letterSpacing:r.letterSpacing-1,text:r.text,textTransform:r.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:s,states:Oi(r.states),events:Oi(r.events),visible:r.visible,raycastLock:r.raycastLock,position:r.position,rotation:r.rotation,scale:r.scale,hiddenMatrix:r.hiddenMatrix},h=Oi(t.scene.objects).parent(i);t.scene.objects.insertAfter(h!=null?h:null,i,[{id:i+"new",data:l,children:[]}]),e.push(i)}}),e.forEach(i=>{t.scene.objects.delete(i)})}function lL(t){let e={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};t.scene.objects.traverse((i,n)=>{n.events.forEach(r=>{if(e[Number(r.type)])if(Object.assign(r,{type:e[Number(r.type)]}),r.type==="Audio"&&"audioEvent"in r&&(Object.assign(r,{playAudio:r.audioEvent}),delete r.audioEvent),r.type==="GameControl")Object.assign(r,{gameActions:{idle:new mt,move:new mt,jump:new mt}});else{let s=new mt;Object.assign(r,{actions:s}),(r.type==="MouseDown"||r.type==="MouseUp"||r.type==="KeyDown"||r.type==="KeyUp")&&"url"in r&&s.push({f
3113i:0,id:At.generateUUID(),data:{type:"Link",url:r.url,delay:0}}),"targets"in r&&(r.targets.forEach((o,a,l)=>{let h={state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4},f={easing:o.easing,duration:o.duration};o.easing===6?Object.assign(f,Ja(o,"mass","stiffness","damping","velocity")):o.easing===5&&Object.assign(f,{control1:{...o.control1},control2:{...o.control2}});let c={repeat:o.repeat?-1:0,delay:o.delay,delayDirection:o.delayDirection,direction:o.cycle&&o.rewind?"pingpong-rewind":o.cycle?"pingpong":"normal"},u={state:o.state,...c,...f},d={allowSlerp:!0,type:"Transition",object:o.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new mt({fi:0,id:At.generateUUID(),data:h},{fi:1,id:At.generateUUID(),data:u})};s.push({fi:l,id:a,data:d})}),delete r.targets)}})})}function cL(t){t.scene.objects.traverse((e,i)=>{function n(r,s){var l;let o=new mt,a=[];if(i.events.forEach((h,f,c)=>{if(h.type==="Audio"&&h.trigger===s){let u;a.push(f),h.interaction==="play"?u={...Ja(h,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in h?h.after:void 0,toggle:"after"in h?h.toggle:void 0,type:"Audio"}:(h.interaction==="pause"||h.interaction==="stop")&&(u={...Ja(h,"interaction","delay","object","playAudio"),type:"Audio"}),u&&o.push({fi:c,id:f,data:u})}}),a.forEach(h=>i.events.delete(h)),o.length){let h=(l=i.events.find(f=>f.type===r))==null?void 0:l.data;h?"actions"in h&&h.actions.insertBefore(null,o):i.events.insertBefore(null,[{id:At.generateUUID(),data:{type:r,actions:o}}])}}n("Start","start"),n("MouseDown","mouseDown"),n("MouseUp","mouseUp"),n("KeyDown","keyDown"),n("KeyUp","keyUp")})}function lp(t){var i;let e=(i=t.layers.find(n=>n.type==="light"))==null?void 0:i.data;if((e==null?void 0:e.category)==="basic"){let n=Kn.defaultData("light","phong"),r=e;Object.assign(r,n),r.visible=!1}}function hL(t){Da(t,lp),Oa(t,lp)}var cp=22;function uL(t){var i;let e=(i=t.schema)!=null?i:0;e!==cp&&(console.warn("updating from ",e,"to ",cp),e<1&&(Oa(t,rp),Da(t,rp),t.schema=1),e<2&&(jC(t),t.schema=2),e<3&&(XC(t),t.schema=3),e<4&&(YC(t),t.schema=4),e<5&&($C(t),t.schema=5),e<6&&(ZC(t),t.schema=6),e<7&&(JC(t),t.schema=7),e<8&&(KC(t),t.schema=8),e<9&&(op(t),t.schema=9),e<10&&(QC(t),t.schema=10),e<11&&(eL(t),t.schema=11),e<12&&(op(t),t.schema=12),e<13&&(tL(t),t.schema=13),e<14&&(iL(t),t.schema=14),e<15&&(nL(t),t.schema=15),e<16&&(rL(t),t.schema=16),e<17&&(Oa(t,ap),Da(t,ap),t.schema=17),e<18&&(Oa(t,sp),Da(t,sp),t.schema=18),e<19&&(qC(t),t.schema=19),e<20&&(sL(t),aL(t),t.schema=20),e<21&&(lL(t),cL(t),t.schema=21),e<22&&(hL(t),t.schema=22))}var gh;(t=>t.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII="})(gh||(gh={}));var dL=class extends gt{},fL=class extends dL{constructor(t){super(),this.object=t,this.matrixAutoUpdate=!0}get castShadow(){return this.object.castShadow}set castShadow(t){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(t){}get isMesh(){return!0}get isLight(){return!1}get layers(){return this.object.layers}set layers(t){}get isCamera(){return!1}get geometry(){return this.object.geometry}get material(){return this.object.material}},vh=class extends gt{constructor(t,e={}){super(),this.object=t;let i=t.recursiveBBox.getSize(new E),n=.1;this.parameters=Qc.defaultData(i.toArray(),n),Za(this.parameters,e),this.update(),this.setHideBase(this.parameters.hideBase)}setHideBase(t){this.parameters.hideBase=t}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}this.children.forEach(t=>t.updateMatrix())}_updateCount(){let t=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==t)if(this.children.length<t)for(let e=0,i=t-this.children.length;e<i;++e){let n=new fL(this.object);n.visible=!0,this.add(n),this.parameters.hideBase&&this.setHideBase(!0)}else for(let e=0,i=this.children.length-t;e<i;++e)this.remove(this.children[0])}_updateRadial(t){let e=t.radial,i=e.start*At.DEG2RAD,n=e.end*At.DEG2RAD,r=i-n,s=new nr(e.rotation[0]*At.DEG2RAD,e.rotation[1]*At.DEG2RAD,e.rotation[2]*At.DEG2RAD),o;switch(e.axis){case"z":o=new E(0,0,1);break;case"y":o=new E(0,1,0);break;default:case"x":o=new E(1,0,0);break}for(let[a,l]of this.children.entries()){l.scale.x=e.scale[0],l.scale.y=e.scale[1],l.scale.z
3113=e.scale[2],l.position.setScalar(0);let h=r/t.count*a-i;switch(e.axis){case"x":l.rotation.set(0,h,0);break;case"y":l.rotation.set(0,0,h);break;case"z":l.rotation.set(h,0,0);break}l.translateOnAxis(o,e.radius),l.position.x+=e.position[0],l.position.y+=e.position[1],l.position.z+=e.position[2],e.alignment===!0?(l.rotation.x+=s.x,l.rotation.y+=s.y,l.rotation.z+=s.z):l.rotation.copy(s)}}_updateLinear(t){if(t.type!=="linear")throw new Error;let e=t.linear,i=new nr(e.rotation[0]*At.DEG2RAD,e.rotation[1]*At.DEG2RAD,e.rotation[2]*At.DEG2RAD);for(let[n,r]of this.children.entries())r.scale.x=1+(e.scale[0]-1)*n,r.scale.y=1+(e.scale[1]-1)*n,r.scale.z=1+(e.scale[2]-1)*n,r.rotation.x=i.x*n,r.rotation.y=i.y*n,r.rotation.z=i.z*n,r.position.x=e.position[0]*n,r.position.y=e.position[1]*n,r.position.z=e.position[2]*n}_updateGrid(t){let e=0,i=t.grid;if(i.useCenter===!0){let n={x:i.count[0]%2===0?2:1,y:i.count[1]%2===0?2:1,z:i.count[2]%2===0?2:1},r=new E(i.size[0]*(i.count[0]-n.x)*.5,i.size[1]*(i.count[1]-n.y)*.5,i.size[2]*(i.count[2]-n.z)*.5);for(let s=0;s<i.count[0];s++)for(let o=0;o<i.count[1];o++)for(let a=0;a<i.count[2];a++){let l=this.children[e++];l.scale.setScalar(1),l.rotation.set(0,0,0),l.position.x=i.size[0]*s-r.x,l.position.y=i.size[1]*o-r.y,l.position.z=i.size[2]*a-r.z}}else for(let n=0;n<i.count[0];n++)for(let r=0;r<i.count[1];r++)for(let s=0;s<i.count[2];s++){let o=this.children[e++];o.scale.setScalar(1),o.rotation.set(0,0,0),o.position.x=i.size[0]*n,o.position.y=-i.size[1]*r,o.position.z=-i.size[2]*s}}fromClonerState(t){return t.hideBase!==void 0&&this.setHideBase(t.hideBase),Za(this.parameters,t),this.update(),this}},Bo=t=>{var e;return e=class extends t{constructor(){super(...arguments),this.isObjectHelper=!0}},e.geometryHelper=new Dn(30,30,30),e},xa=new Rs,gc=new cn,hp=new Ye,Fo=(t,e,i,n,r=!1)=>{let s=e,o=t.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),gc.copy(s.boundingSphere),gc.applyMatrix4(o),i.ray.intersectsSphere(gc)===!1||(hp.copy(o).invert(),xa.copy(i.ray).applyMatrix4(hp),s.boundingBox!==null&&xa.intersectsBox(s.boundingBox)===!1))return;let a,l,h,f,c=s.index,u=s.attributes.position,d=s.drawRange,m,g;if(r===!1){let v=Math.max(0,d.start),y=Math.min(c.count,d.start+d.count);for(m=v,g=y;m<g;m+=3)if(l=c.getX(m),h=c.getX(m+1),f=c.getX(m+2),a=p(t,i,xa,u,l,h,f),a){a.faceIndex=Math.floor(m/3),n.push(a);return}}else{let v=s.attributes.position,y=new E,b=new E,x=new E,M=new E,w=2,T=1/((t.scale.x+t.scale.y+t.scale.z)/3),_=T*T,A=Math.max(0,d.start),S=Math.min(v.count,d.start+d.count);for(let D=A,O=S-1;D<O;D+=w){if(y.fromBufferAttribute(v,D),b.fromBufferAttribute(v,D+1),xa.distanceSqToSegment(y,b,M,x)>_)continue;M.applyMatrix4(t.matrixWorld);let z=i.ray.origin.distanceTo(M);z<i.near||z>i.far||n.push({distance:z,point:x.clone().applyMatrix4(t.matrixWorld),object:t})}}function p(v,y,b,x,M,w,T){let _=new E,A=new E,S=new E,D=new E,O=new E;if(_.fromBufferAttribute(x,M),A.fromBufferAttribute(x,w),S.fromBufferAttribute(x,T),b.intersectTriangle(_,A,S,!1,D)===null)return null;O.copy(D),O.applyMatrix4(v.matrixWorld);let z=y.ray.origin.distanceTo(O);return z<y.near||z>y.far?null:{faceIndex:1,distance:z,point:O.clone(),object:v}}},_a=new E,wi=new Oo,pL=class extends Io{constructor(t){let e=new We,i=new kr({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],s={},o=new Xe(15711266),a=new Xe(15711266),l=new Xe(2857471);h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",a),h("p","n2",a),h("p","n3",a),h("p","n4",a),h("u1","u2",l),h("u2","u3",l),h("u3","u1",l);function h(c,u,d){f(c,d),f(u,d)}function f(c,u){n.push(0,0,0),r.push(u.r,u.g,u.b),s[c]===void 0&&(s[c]=[]),s[c].push(n.length/3-1)}e.setAttribute("position",new Pe(n,3)),e.setAttribute("color",new Pe(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let t=this.geometry,e=this.pointMap;wi.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=1,n=1,r=.8;Ui("n1",e,t,wi,-i,-n,r),Ui("n2",e,t,wi,i,-n,r),Ui("n3",e,t,wi,-i,n,r),Ui("n4",e,t,wi,i,n,r);let s=r;Ui("f1",e,t,wi,-i,-n,s),Ui("f2",e,t,wi,i,-n,s),Ui("f3",e,t,wi,-i,n,s),Ui("f4",e,t,wi,i,n,s);let o=s,a=.5;Ui("u1",e,t,wi,i*.7*a,n*1.1,o),Ui("u2",e,t,wi,-i*.7*a,n*1.1,o),Ui("u3",e,t,wi,0,n*(1.1+.9*a),o),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};
3113function Ui(t,e,i,n,r,s,o){_a.set(r,s,o).unproject(n);let a=e[t];if(a!==void 0){let l=i.getAttribute("position");for(let h=0,f=a.length;h<f;h++)l.setXYZ(a[h],_a.x,_a.y,_a.z)}}var mL=class extends Bo(pL){constructor(t){super(t),this.object=t,this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,e){Fo(this.object,this.geometry,t,e,!0)}},Og=class extends Bo(eS){constructor(t,e=15,i=10066329){super(t,e,i),this.object=t,this.added=!1,this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,e){Fo(this.object,Og.geometryHelper,t,e)}},Rg=class extends Bo(tS){constructor(t,e=15){super(e),this.object=t,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}raycast(t,e){Fo(this.object,Rg.geometryHelper,t,e)}update(){}},Ig=class extends Bo(Qw){constructor(t,e=15,i=6710886){super(t,e,i),this.object=t,this.name=`PointLightHelper: ${t.uuid}`}raycast(t,e){Fo(this.object,Ig.geometryHelper,t,e)}},yh=class extends Bo(Kw){constructor(t,e=6710886){super(t,e),this.object=t,this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,e){Fo(this.object,yh.geometryHelper,t,e)}update(){if(this.object!==void 0){let t=yh._vector,e=this.object.distance?this.object.distance:1e3,i=e*Math.tan(this.object.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let n=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let r=0,s=this.cone.material.length;r<s;r++)this.cone.material[r].color.set(n);else this.cone.material.color.set(n)}}},zg=yh;zg._vector=new E;var Ks=1e-12,_u=class{constructor(t){this.position=new Z,this.startPosition=new Z,this.uuid=At.generateUUID(),this.position=t.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(t){this.position.copy(this.startPosition).add(t)}copy(t){return this.position.copy(t.position),this.startPosition.copy(t.startPosition),this}clone(){return new _u(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},xh=class extends _u{constructor(t){super(t.position),this.parent=t}copy(t){return super.copy(t),this}clone(){return new xh(this.parent).copy(this)}},bs=class extends _u{constructor(t,e){super(e),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=t,this.controls.push(new xh(this),new xh(this))}static create(t,e){let i=new bs(t,new Z(...e.position));return i.controls[0].position.set(...e.controlPrevious.position),i.controls[1].position.set(...e.controlNext.position),i.roundness=e.roundness,i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored,i}getOppositeControl(t){let e=this.controls.indexOf(t);return e===0?this.controls[1]:e===1?this.controls[0]:null}applyOffsetToControls(t,e=1){for(let i=0,n=this.controls.length;i<n;i++){let r=this.controls[i];this.position.distanceTo(r.position)<=e?r.position.copy(this.position):r.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new bs(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){var i,n;let t=(i=this.curveBefore)==null?void 0:i.getTangentAt(1),e=(n=this.curveAfter)==null?void 0:n.getTangentAt(0);return[t,e]}computeNormals(t=new Z,e=new Z){let[i,n]=this.computeTangents();return i&&n&&(up(i,t),up(n,e)),[t,e]}computeTangent(t=new Z){let[e,i]=this.computeTangents();return e&&i&&t.copy(e).add(i).normalize(),t}computeNormal(t=new Z){let[e,i]=this.computeNormals();return t.copy(e).add(i).normalize(),t}};function up(t,e=new Z){let i=t.length();return e.set(-t.y/i,t.x/i)}var bu=t=>t,Hs=new Z,Ml=new Z,gL=new Z,vL=new Z,yL=new Z,xL=new Z,Ng=new E,Ug=new E;function _L(t){let e=new Z;e.addVectors(t.v0,Hs.subVectors(t.v1,t.v0).multiplyScalar(2/3));let i=new Z;return i.addVectors(t.v2,Ml.subVectors(t.v1,t.v2).multiplyScalar(2/3)),new Gi(t.v0,e,i,t.v2)}function so(t,e,i=Number.EPSILON){return Math.abs(t-e)<i}function bL(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}
vendor: 7,631 bytes, line 3113
3113function wL(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function Bg(t,e,i){let n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),s=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2));return Math.acos((r*r+n*n-s*s)/(2*r*n))}function SL(t,e,i){return fp(t,e)&&fp(e,i)&&_h(t.position,e.position,i.position)}function _h(t,e,i){return Hs.copy(e).sub(t).cross(Ml.copy(i).sub(t))===0}function ML(t,e,i,n,r){let s=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),o=(t.y+e.y)/2,a=(t.x+e.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(t.y-e.y)/s,h=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(e.x-t.x)/s;return n.set(a+l,o+h),r.set(a-l,o-h),[n,r]}function AL(t,e,i){let n=t.distanceTo(i),r=e.distanceTo(i);return n<r?e:t}function TL(t,e,i,n,r,s){let o=e.x-t.x,a=e.y-t.y,l=i.x-t.x,h=i.y-t.y,f=Math.sqrt((o+l)*(o+l)+(a+h)*(a+h)),c;return Bg(e,t,i)>Math.PI&&(f*=-1),so(h,a)?c=(a+h)*(n/f-.5)*8/3/(o-l):c=(o+l)*(n/f-.5)*8/3/(h-a),r.set(e.x-c*a,e.y+c*o),s.set(i.x+c*h,i.y-c*l),[r,s]}function dp(t,e){return t.position.equals(t.controls[1].position)&&e.position.equals(e.controls[0].position)}function fp(t,e){return _h(t.position,t.controls[1].position,e.position)&&_h(t.position,e.controls[0].position,e.position)}function EL(t,e,i,n,r=.5){let s=Hs.subVectors(e,t).multiplyScalar(r).add(t),o=Ml.subVectors(i,e).multiplyScalar(r).add(e),a=gL.subVectors(n,i).multiplyScalar(r).add(i),l=s,h=vL.subVectors(o,s).multiplyScalar(r).add(s),f=yL.subVectors(a,o).multiplyScalar(r).add(o),c=a,u=xL.subVectors(f,h).multiplyScalar(r).add(h);return[t.x,t.y,l.x,l.y,h.x,h.y,u.x,u.y,f.x,f.y,c.x,c.y,n.x,n.y]}function CL(t,e,i=12,n=!0){let r=Ug.set(0,0,0),s,o=0;for(let a=0;a<e.length;a++){let l=bu(e[a]),h=Hs,f=Pr(l,i);for(let c=0;c<=f;c++)if(l instanceof Gi||l instanceof sr||l instanceof Wi){if(l.getPoint(c/f,h),r.set(h.x,h.y,0),s!==void 0&&wL(s,r))continue;s===void 0&&(s=Ng),s.copy(r),t.setXYZ(o,r.x,r.y,r.z),o++}}return n&&o>1&&!(t.getX(o-1)===t.getX(0)&&t.getY(o-1)===t.getY(0)&&t.getZ(o-1)===t.getZ(0))&&(t.setXYZ(o,t.getX(0),t.getY(0),t.getZ(0)),o++),t}function LL(t,e,i,n=12,r=!0){let s=Ug.set(0,0,0),o=0,a=[];for(let l=0;l<e.length;l++){if(i[l]===!1)continue;let h,f=bu(e[l]),c=Hs,u=Pr(f,n);a.push(u);for(let d=0;d<=u;d++)if(f instanceof Gi||f instanceof sr||f instanceof Wi){if(f.getPoint(d/u,c),s.set(c.x,c.y,0),h==null?void 0:h.equals(s))continue;h===void 0?h=Ng:(t.setXYZ(o,h.x,h.y,h.z),o++,t.setXYZ(o,s.x,s.y,s.z),o++),h.copy(s)}}return r&&o>1&&!(t.getX(o-1)===t.getX(0)&&t.getY(o-1)===t.getY(0)&&t.getZ(o-1)===t.getZ(0))&&(t.setXYZ(o,t.getX(0),t.getY(0),t.getZ(0)),o++),a}function pp(t,e=12,i=!1){let n=[];for(let r=0,s=t.length;r<s;r++){let o=t[r],a=0;if(i&&o.roundedCurveCorner!==void 0){let l=Pr(o.roundedCurveCorner,e)*.5;r>0&&(n[r-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=Pr(o.curveAfter,e)),n.push(a)}return t.length>0&&i&&t[0].roundedCurveCorner!==void 0&&(n[t.length-1]+=Pr(t[0].roundedCurveCorner,e)*.5),n}function Pr(t,e=12){return t&&t instanceof sl?e*2:t&&(t instanceof Wi||t instanceof wm)?1:t&&t instanceof Gh?e*t.points.length:e}function PL(t,e,i=12,n=!0){let r,s=0;for(let o=0;o<e.length;o++){let a=bu(e[o]),l=Pr(a,i),h=Hs;for(let f=0;f<=l;f++)if(a instanceof Gi||a instanceof sr||a instanceof Wi){if(a.getPoint(f/l,h),r!==void 0&&bL(r,h,Ks))continue;r===void 0&&(r=Ml),r.copy(h),t.push(h.x,h.y),s++}}return so(t[0],t[t.length-2],Ks)&&so(t[1],t[t.length-1],Ks)&&(t.pop(),t.pop()),n&&s>1&&!(so(t[s-1],t[1],Ks)&&so(t[s-2],t[0],Ks))&&(t.push(t[0],t[1]),s++),t}var vc=new Z,DL=new Z,OL=new Z,RL=new Z,IL=new Z,zL=new Z,Ot=class extends Ba{constructor(t=100,e=100){super(),this.points=[],this.shapeHoles=[],this.eventDispatcher=new In,this.plane=new qn(new E(0,0,-1)),this.subdivision=0,this.controlSnapDistance=4,this.pointIDs=0,this.isMesh2D=!1,this._roundness=0,this.isClosed=!1,this.useCubicForRoundedCorners=!0,this.uuid=At.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=t,this._height=e}static createFromState(t,e,i){let n=new Ot;return n.isClosed=t.isClosed,n.points=t.points.map(r=>bs.create(r.id,r.data)),typeof t.roundness=="number"&&(n.roundness=t.roundness),n.shapeHoles=t.shapeHoles.map(r=>Ot.createFromState(r)),e!==void 0&&i!==void 0&&n.applySize(e,i),n.update(),n}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let e=0,i=this.points.length;e<i;e++)this.points[e].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(e=>this.getPointIndexById(e)).filter(e=>e>=0)}getPointIndexById(t){let e=this.points.length,i=this.points.findIndex(n=>n.uuid===t);if(i<0){let n=e;for(let r=0,s=this.shapeHoles.length;r<s;r++){let o=this.shapeHoles[r],a=o.points.length,l=o.getPointIndexById(t);if(l<0)n+=a;else return l+n}}return i}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0){let e=this.points.length;for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],s=t-e;if(s<=r.points.length-1)return r.points[s];e+=r.points.length}}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let e=this.points.indexOf(t);if(e>=0)return e;if(e=this.points.length,this.shapeHoles.length>0)for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],s=r.points.indexOf(t);if(s>=0)return e+s;e+=r.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(e=>e.points));return[...this.points,...t]}applySize(t,e){t===0&&(t=.001),e===0&&(e=.001),this._width=t,this._height=e}applyScale(t,e){let i=vc.set(t,e);for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];s.position.multiply(i),s.controls[0].position.multiply(i),s.controls[1].position.multiply(i)}for(let n=0,r=this.shapeHoles.length;n<r;n++)this.shapeHoles[n].applyScale(t,e);this._update(!1)}createPoint(t,e=0,i=At.generateUUID()){let n;t instanceof Z?n=t:n=new Z(t,e);let r=new bs(i,n);return r.roundness=this.roundness,r}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,e){this.points.splice(e,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(n.uuid===t)return n}for(let e=0,i=this.shapeHoles.length;e<i;e++){let n=this.shapeHoles[e].getPointByUuid(t);if(n)return n}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let e=this.points.indexOf(t);e>=0&&this.points.splice(e,1),this.needsUpdate=!0}removePointById(t){let e=this.points.find(i=>i.uuid===t);e&&this.removePoint(e)}update(t=!0){for(let e=0,i=this.shapeHoles.length;e<i;e++)this.shapeHoles[e].update(!1);this._update(t)}extractShapePointsToBuffer(t,e=12,i=!1){this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e);let n=i?this.roundedCurveDivisions:this.curveDivisions;return CL(t,i?this.roundedCurves:this.curves,e,this.autoClose),n.reduce((r,s)=>r+s,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=pp(this.points,t,!1),this.roundedCurveDivisions=pp(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,e,i=12){return LL(t,this.curves,e,i,this.autoClose).reduce((n,r)=>n+r,0)*2}extractShapePointsToFlatArray(t,e=12){return this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e),PL(t,this.roundedCurves,e,this.autoClose)}getCurveIndexFromVertexId(t,e=!1){let i=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let n=e?this.roundedCurveDivisions:this.curveDivisions,r=0;
3113e&&this.points[0].roundedCurveCorner!==void 0&&(r=Pr(this.points[0].roundedCurveCorner,this.subdivision)*.5);let s=t-r;s<0&&(s+=n.reduce((o,a)=>o+a,0));for(let o=0,a=n.length;o<a;o++){let l=n[o];if(s<i+l)return[o,(s-i+1)/l];i+=l}return[0,1]}getCurveT(t,e,i){let n=this.points[t],r=this.points[t>=this.points.length-1?0:t+1],s=this.curveDivisions,o=s[t];if(dp(n,r)){let l=n.position.distanceTo(r.position);return n.position.distanceTo(vc.set(i.x,i.y))/l}let a=0;for(let l=0;l<t;l++)a+=s[l];return(e-a)/o}dispose(){this.eventDispatcher=null}_applyCurveForPoint(t,e){dp(e,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(e.controls[1].position.x,e.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let i=this.curves[this.curves.length-1];t.curveBefore=i,e.curveAfter=i;let n=i.clone();t.roundedCurveBefore=n,e.roundedCurveAfter=n,t.roundedCurveCorner=void 0,this.roundedCurves.push(n)}_update(t=!0){var i,n,r;if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];if(s===0)this.moveTo(a.position.x,a.position.y);else{let l=this.points[s-1];this._applyCurveForPoint(a,l)}}let e=this.getLastPoint();if(e!=null&&e.curveAfter&&(e.curveAfter=void 0),this.isClosed){let s=this.points[0],o=this.points[this.points.length-1];this._applyCurveForPoint(s,o)}if(this.points.length>2){let s=0;for(let o=0,a=this.points.length;o<a;o++){let l=this.points[o],h=(i=this.points[o-1])!=null?i:this.points[this.points.length-1],f=(n=this.points[o+1])!=null?n:this.points[0],c=l.roundness,u=h&&f&&SL(h,l,f);if(!l.controlsMoved()&&c>0&&!u){let d=l.curveBefore,m=l.curveAfter;if(d===void 0||m===void 0)continue;let g=l.roundedCurveBefore,p=l.roundedCurveAfter,v=d.getLength(),y=m.getLength(),b=Math.min(c,v*.499),x=Math.min(c,y*.499),M=Math.min(b,x),w=1-M/v,T=M/y,_=d.getPointAt(w,vc),A=m.getPointAt(T,DL);this._subSplitCurve(d,g,w,_,void 0),this._subSplitCurve(m,p,T,void 0,A);let S;if(this.useCubicForRoundedCorners){let D=Bg(_,l.position,A)/2,O=Math.tan(D)*_.distanceTo(l.position),[z,I]=ML(_,A,O,OL,RL),H=AL(z,I,l.position),[ee,G]=TL(H,_,A,O,IL,zL);S=new Gi(_.clone(),ee.clone(),G.clone(),A.clone())}else S=new sr(_.clone(),l.position.clone(),A.clone());l.roundedCurveCorner=S,this.roundedCurves.splice(o+s,0,S),s++}}}t&&((r=this.eventDispatcher)==null||r.dispatchEvent({type:"update"}))}_subSplitCurve(t,e,i,n,r){if(t instanceof Wi)n!==void 0&&e.v2.copy(n),r!==void 0&&e.v1.copy(r);else{let s=t,o=e,a=s.getUtoTmapping(i,0),l=EL(s.v0,s.v1,s.v2,s.v3,a);return n!==void 0&&(o.v0.set(l[0],l[1]),o.v1.set(l[2],l[3]),o.v2.set(l[4],l[5]),o.v3.set(l[6],l[7])),r!==void 0&&(o.v0.set(l[6],l[7]),o.v1.set(l[8],l[9]),o.v2.set(l[10],l[11]),o.v3.set(l[12],l[13])),o}return e}clone(){let t=new Ot(this._width,this._height);return t.points=this.points.map(e=>e.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(e=>e.clone()),t}toJSON(){return{points:this.points.reduce((t,e)=>t.concat(e.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){var i;this.points=[],this.pointIDs=0;let e=t.points.length/7;for(let n=0;n<e;n++){let r=n*7,s=t.points[r+0],o=t.points[r+1],a=t.points[r+2],l=t.points[r+3],h=t.points[r+4],f=t.points[r+5],c=t.points[r+6],u=new bs(At.generateUUID(),new Z(s,o));u.controls[0].position.set(a,l),u.controls[1].position.set(h,f),u.roundness=c,this.points.push(u)}return this.shapeHoles=(i=t.shapeHoles)!=null&&i.length?t.shapeHoles.map(n=>{let r=new Ot;return r.fromJSON(n),r}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t){let e=(n,r)=>{r instanceof Gi&&r.v3.equals(n.position)&&n.controls[0].position.copy(r.v2)},i=n=>{let r=[],s,o;for(s=0,o=n.length;s<o;s++)n[s]instanceof sr&&(n[s]=_L(n[s]));for(s=0,o=n.length;s<o;s++){let h=n[s],f=s>0?n[s-1]:null,c;h instanceof Gi?(c=this.createPoint(h.v0),c.controls[1].position.copy(h.v1)):h instanceof Wi&&(c=this.createPoint(h.v1)),c!==void 0&&(f!==null&&e(c,f),r.push(c))}let a=n[n.length-1],l=!1;return a instanceof Gi?a.v3.equals(r[0].position)&&(r[0].controls[0].position.copy(a.v2),l=!0):a instanceof Wi&&a.v2.equals(r[0].position)&&(l=!0),this.isClosed=l,r};return this.points=i(t.curves),t instanceof Ba&&(this.shapeHoles=t.holes.map(n=>{let r=new Ot;return r.fromShape(n),r})),this.update(),this}},Tt;(function(t){t[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Tt||(Tt={}));var jt;(function(t){t[t.POLYGONS=0]="POLYGONS",t[t.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",t[t.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(jt||(jt={}));function Be(t,e){if(!t)throw e||"Assertion Failed!"}var Ne=function(){function t(){}
vendor: 24,595 bytes, line 3113
3113return t.vertEq=function(e,i){return e.s===i.s&&e.t===i.t},t.vertLeq=function(e,i){return e.s<i.s||e.s===i.s&&e.t<=i.t},t.transLeq=function(e,i){return e.t<i.t||e.t===i.t&&e.s<=i.s},t.edgeGoesLeft=function(e){return t.vertLeq(e.Dst,e.Org)},t.edgeGoesRight=function(e){return t.vertLeq(e.Org,e.Dst)},t.vertL1dist=function(e,i){return Math.abs(e.s-i.s)+Math.abs(e.t-i.t)},t.edgeEval=function(e,i,n){Be(t.vertLeq(e,i)&&t.vertLeq(i,n));var r=i.s-e.s,s=n.s-i.s;return r+s>0?r<s?i.t-e.t+(e.t-n.t)*(r/(r+s)):i.t-n.t+(n.t-e.t)*(s/(r+s)):0},t.edgeSign=function(e,i,n){Be(t.vertLeq(e,i)&&t.vertLeq(i,n));var r=i.s-e.s,s=n.s-i.s;return r+s>0?(i.t-n.t)*r+(i.t-e.t)*s:0},t.transEval=function(e,i,n){Be(t.transLeq(e,i)&&t.transLeq(i,n));var r=i.t-e.t,s=n.t-i.t;return r+s>0?r<s?i.s-e.s+(e.s-n.s)*(r/(r+s)):i.s-n.s+(n.s-e.s)*(s/(r+s)):0},t.transSign=function(e,i,n){Be(t.transLeq(e,i)&&t.transLeq(i,n));var r=i.t-e.t,s=n.t-i.t;return r+s>0?(i.s-n.s)*r+(i.s-e.s)*s:0},t.vertCCW=function(e,i,n){return e.s*(i.t-n.t)+i.s*(n.t-e.t)+n.s*(e.t-i.t)>=0},t.interpolate=function(e,i,n,r){return e=e<0?0:e,n=n<0?0:n,e<=n?n===0?(i+r)/2:i+(r-i)*(e/(e+n)):r+(i-r)*(n/(e+n))},t.intersect=function(e,i,n,r,s){var o,a,l;t.vertLeq(e,i)||(l=e,e=i,i=l),t.vertLeq(n,r)||(l=n,n=r,r=l),t.vertLeq(e,n)||(l=e,e=n,n=l,l=i,i=r,r=l),t.vertLeq(n,i)?t.vertLeq(i,r)?(o=t.edgeEval(e,n,i),a=t.edgeEval(n,i,r),o+a<0&&(o=-o,a=-a),s.s=t.interpolate(o,n.s,a,i.s)):(o=t.edgeSign(e,n,i),a=-t.edgeSign(e,r,i),o+a<0&&(o=-o,a=-a),s.s=t.interpolate(o,n.s,a,r.s)):s.s=(n.s+i.s)/2,t.transLeq(e,i)||(l=e,e=i,i=l),t.transLeq(n,r)||(l=n,n=r,r=l),t.transLeq(e,n)||(l=e,e=n,n=l,l=i,i=r,r=l),t.transLeq(n,i)?t.transLeq(i,r)?(o=t.transEval(e,n,i),a=t.transEval(n,i,r),o+a<0&&(o=-o,a=-a),s.t=t.interpolate(o,n.t,a,i.t)):(o=t.transSign(e,n,i),a=-t.transSign(e,r,i),o+a<0&&(o=-o,a=-a),s.t=t.interpolate(o,n.t,a,r.t)):s.t=(n.t+i.t)/2},t}(),Qs=function(){function t(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return t}(),ba=function(){function t(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(t.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),t}(),us=function(){function t(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}return t}(),mp=function(){function t(){var e=new us,i=new Qs,n=new ba(0),r=new ba(1);e.next=e.prev=e,e.anEdge=null,i.next=i.prev=i,n.next=n,n.Sym=r,r.next=r,r.Sym=n,this.vHead=e,this.fHead=i,this.eHead=n,this.eHeadSym=r}return t.prototype.makeEdge_=function(e){var i=new ba(0),n=new ba(1);e.Sym.side<e.side&&(e=e.Sym);var r=e.Sym.next;return n.next=r,r.Sym.next=i,i.next=e,e.Sym.next=n,i.Sym=n,i.Onext=i,i.Lnext=n,i.Org=null,i.Lface=null,i.winding=0,i.activeRegion=null,n.Sym=i,n.Onext=n,n.Lnext=i,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,i},t.prototype.splice_=function(e,i){var n=e.Onext,r=i.Onext;n.Sym.Lnext=i,r.Sym.Lnext=e,e.Onext=r,i.Onext=n},t.prototype.makeVertex_=function(e,i,n){var r=e;Be(r,"Vertex can't be null!");var s=n.prev;r.prev=s,s.next=r,r.next=n,n.prev=r,r.anEdge=i;var o=i;do o.Org=r,o=o.Onext;while(o!==i)},t.prototype.makeFace_=function(e,i,n){var r=e;Be(r,"Face can't be null");var s=n.prev;r.prev=s,s.next=r,r.next=n,n.prev=r,r.anEdge=i,r.trail=null,r.marked=!1,r.inside=n.inside;var o=i;do o.Lface=r,o=o.Lnext;while(o!==i)},t.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var i=e.next,n=e.Sym.next;i.Sym.next=n,n.Sym.next=i},t.prototype.killVertex_=function(e,i){var n=e.anEdge,r=n;do r.Org=i,r=r.Onext;while(r!==n);var s=e.prev,o=e.next;o.prev=s,s.next=o},t.prototype.killFace_=function(e,i){var n=e.anEdge,r=n;do r.Lface=i,r=r.Lnext;while(r!==n);var s=e.prev,o=e.next;o.prev=s,s.next=o},t.prototype.makeEdge=function(){var e=new us,i=new us,n=new Qs,r=this.makeEdge_(this.eHead);return this.makeVertex_(e,r,this.vHead),this.makeVertex_(i,r.Sym,this.vHead),this.makeFace_(n,r,this.fHead),r},t.prototype.splice=function(e,i){var n=!1,r=!1;if(e!==i){if(i.Org!==e.Org&&(r=!0,this.killVertex_(i.Org,e.Org)),i.Lface!==e.Lface&&(n=!0,this.killFace_(i.Lface,e.Lface)),this.splice_(i,e),!r){var s=new us;this.makeVertex_(s,i,e.Org),e.Org.anEdge=e}if(!n){var o=new Qs;this.makeFace_(o,i,e.Lface),e.Lface.anEdge=e}}},t.prototype.delete=function(e){var i=e.Sym,n=!1;if(e.Lface!==e.Rface&&(n=!0,this.killFace_(e.Lface,e.Rface)),e.Onext===e)this.killVertex_(e.Org,null);else if(e.Rface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev),!n){var r=new Qs;this.makeFace_(r,e,e.Lface)}i.Onext===i?(this.killVertex_(i.Org,null),this.killFace_(i.Lface,null)):(e.Lface.anEdge=i.Oprev,i.Org.anEdge=i.Onext,this.splice_(i,i.Oprev)),this.killEdge_(e)},t.prototype.addEdgeVertex=function(e){var i=this.makeEdge_(e),n=i.Sym;this.splice_(i,e.Lnext),i.Org=e.Dst;var r=new us;return this.makeVertex_(r,n,i.Org),i.Lface=n.Lface=e.Lface,i},t.prototype.splitEdge=function(e){var i=this.addEdgeVertex(e),n=i.Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,n),e.Dst=n.Org,n.Dst.anEdge=n.Sym,n.Rface=e.Rface,n.winding=e.winding,n.Sym.winding=e.Sym.winding,n.idx=e.idx,n.Sym.idx=e.Sym.idx,n},t.prototype.connect=function(e,i){var n=!1,r=this.makeEdge_(e),s=r.Sym;if(i.Lface!==e.Lface&&(n=!0,this.killFace_(i.Lface,e.Lface)),this.splice_(r,e.Lnext),this.splice_(s,i),r.Org=e.Dst,s.Org=i.Org,r.Lface=s.Lface=e.Lface,e.Lface.anEdge=s,!n){var o=new Qs;this.makeFace_(o,r,e.Lface)}return r},t.prototype.zapFace=function(e){var i=e.anEdge,n,r,s,o,a;r=i.Lnext;do n=r,r=n.Lnext,n.Lface=null,n.Rface===null&&(n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),s=n.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(n));while(n!=i);o=e.prev,a=e.next,a.prev=o,o.next=a},t.prototype.countFaceVerts_=function(e){var i=e.anEdge,n=0;do n++,i=i.Lnext;while(i!==e.anEdge);return n},t.prototype.mergeConvexFaces=function(e){var i,n,r,s,o,a,l;for(i=this.fHead.next;i!==this.fHead;i=i.next)if(i.inside)for(n=i.anEdge,o=n.Org;r=n.Lnext,s=n.Sym,s&&s.Lface&&s.Lface.inside&&(a=this.countFaceVerts_(i),l=this.countFaceVerts_(s.Lface),a+l-2<=e&&Ne.vertCCW(n.Lprev.Org,n.Org,s.Lnext.Lnext.Org)&&Ne.vertCCW(s.Lprev.Org,s.Org,n.Lnext.Lnext.Org)&&(r=s.Lnext,this.delete(s),n=null,s=null)),!(n&&n.Lnext.Org===o);)n=r;return!0},t.prototype.check=function(){var e=this.fHead,i=this.vHead,n=this.eHead,r,s,o,a,l,h;for(s=e,s=e;(r=s.next)!==e;s=r){Be(r.prev===s),l=r.anEdge;do Be(l.Sym!==l),Be(l.Sym.Sym===l),Be(l.Lnext.Onext.Sym===l),Be(l.Onext.Sym.Lnext===l),Be(l.Lface===r),l=l.Lnext;while(l!==r.anEdge)}for(Be(r.prev===s&&r.anEdge===null),a=i,a=i;(o=a.next)!==i;a=o){Be(o.prev===a),l=o.anEdge;do Be(l.Sym!==l),Be(l.Sym.Sym===l),Be(l.Lnext.Onext.Sym===l),Be(l.Onext.Sym.Lnext===l),Be(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(Be(o.prev===a&&o.anEdge===null),h=n,h=n;(l=h.next)!==n;h=l)Be(l.Sym.next===h.Sym),Be(l.Sym!==l),Be(l.Sym.Sym===l),Be(l.Org!==null),Be(l.Dst!==null),Be(l.Lnext.Onext.Sym===l),Be(l.Onext.Sym.Lnext===l);Be(l.Sym.next===h.Sym&&l.Sym===this.eHeadSym&&l.Sym.Sym===l&&l.Org===null&&l.Dst===null&&l.Lface===null&&l.Rface===null)},t}(),gp=function(){function t(){this.handle=null}return t}(),vp=function(){function t(){this.key=null,this.node=0}return t}(),NL=function(){function t(e,i){this.leq=i,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=e,this.nodes=[],this.handles=[];for(var n=0;n<e+1;n++)this.nodes[n]=new gp,this.handles[n]=new vp;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return t.prototype.floatDown_=function(e){var i=this.nodes,n=this.handles,r,s,o;for(r=i[e].handle;;){if(o=e<<1,o<this.size&&this.leq(n[i[o+1].handle].key,n[i[o].handle].key)&&++o,Be(o<=this.max),s=i[o].handle,o>this.size||this.leq(n[r].key,n[s].key)){i[e].handle=r,n[r].node=e;break}i[e].handle=s,n[s].node=e,e=o}},t.prototype.floatUp_=function(e){var i=this.nodes,n=this.handles,r,s,o;for(r=i[e].handle;;){if(o=e>>1,s=i[o].handle,o===0||this.leq(n[s].key,n[r].key)){i[e].handle=r,n[r].node=e;break}i[e].handle=s,n[s].node=e,e=o}},t.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},t.prototype.min=function(){return this.handles[this.nodes[1].handle].key},t.prototype.insert=function(e){var i,n;if(i=++this.size,i*2>this.max){this.max*=2;var r,s;for(s=this.nodes.length,this.nodes.length=this.max+1,r=s;r<this.nodes.length;r++)this.nodes[r]=new gp;for(s=this.handles.length,this.handles.length=this.max+1,r=s;r<this.handles.length;r++)this.handles[r]=new vp}return this.freeList===0?n=i:(n=this.freeList,this.freeList=this.handles[n].node),this.nodes[i].handle=n,this.handles[n].node=i,this.handles[n].key=e,this.initialized&&this.floatUp_(i),n},t.prototype.extractMin=function(){var e=this.nodes,i=this.handles,n=e[1].handle,r=i[n].key;return this.size>0&&(e[1].handle=e[this.size].handle,i[e[1].handle].node=1,i[n].key=null,i[n].node=this.freeList,this.freeList=n,--this.size,this.size>0&&this.floatDown_(1)),r},t.prototype.delete=function(e){var i=this.nodes,n=this.handles,r;Be(e>=1&&e<=this.max&&n[e].key!==null),r=n[e].node,i[r].handle=i[this.size].handle,n[i[r].handle].node=r,--this.size,r<=this.size&&(r<=1||this.leq(n[i[r>>1].handle].key,n[i[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),n[e].key=null,n[e].node=this.freeList,this.freeList=e},t}(),yc=function(){function t(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return t}(),yp=function(){function t(){this.key=null,this.next=null,this.prev=null}return t}(),UL=function(){function t(e,i){this.frame=e,this.leq=i,this.head=new yp,this.head.next=this.head,this.head.prev=this.head}return t.prototype.min=function(){return this.head.next},t.prototype.max=function(){return this.head.prev},t.prototype.insert=function(e){return this.insertBefore(this.head,e)},t.prototype.search=function(e){var i=this.head;do i=i.next;while(i.key!==null&&!this.leq(this.frame,e,i.key));return i},t.prototype.insertBefore=function(e,i){do e=e.prev;while(e.key!==null&&!this.leq(this.frame,e.key,i));var n=new yp;return n.key=i,n.next=e.next,e.next.prev=n,n.prev=e,e.next=n,n},t.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},t}(),BL=function(){function t(){}return t.regionBelow=function(e){return e.nodeUp.prev.key},t.regionAbove=function(e){return e.nodeUp.next.key},t.debugEvent=function(e){},t.addWinding=function(e,i){e.winding+=i.winding,e.Sym.winding+=i.Sym.winding},t.edgeLeq=function(e,i,n){var r=e.event,s=i.eUp,o=n.eUp;if(s.Dst===r)return o.Dst===r?Ne.vertLeq(s.Org,o.Org)?Ne.edgeSign(o.Dst,s.Org,o.Org)<=0:Ne.edgeSign(s.Dst,o.Org,s.Org)>=0:Ne.edgeSign(o.Dst,r,o.Org)<=0;if(o.Dst===r)return Ne.edgeSign(s.Dst,r,s.Org)>=0;var a=Ne.edgeEval(s.Dst,r,s.Org),l=Ne.edgeEval(o.Dst,r,o.Org);return a>=l},t.deleteRegion=function(e,i){i.fixUpperEdge&&Be(i.eUp.winding===0),i.eUp.activeRegion=null,e.dict.delete(i.nodeUp)},t.fixUpperEdge=function(e,i,n){Be(i.fixUpperEdge),e.mesh.delete(i.eUp),i.fixUpperEdge=!1,i.eUp=n,n.activeRegion=i},t.topLeftRegion=function(e,i){var n=i.eUp.Org,r;do i=t.regionAbove(i);while(i.eUp.Org===n);if(i.fixUpperEdge){if(r=e.mesh.connect(t.regionBelow(i).eUp.Sym,i.eUp.Lnext),r===null)return null;t.fixUpperEdge(e,i,r),i=t.regionAbove(i)}return i},t.topRightRegion=function(e){var i=e.eUp.Dst;do e=t.regionAbove(e);while(e.eUp.Dst===i);return e},t.addRegionBelow=function(e,i,n){var r=new yc;return r.eUp=n,r.nodeUp=e.dict.insertBefore(i.nodeUp,r),r.fixUpperEdge=!1,r.sentinel=!1,r.dirty=!1,n.activeRegion=r,r},t.isWindingInside=function(e,i){switch(e.windingRule){case Tt.ODD:return(i&1)!==0;case Tt.NONZERO:return i!==0;case Tt.POSITIVE:return i>0;case Tt.NEGATIVE:return i<0;case Tt.ABS_GEQ_TWO:return i>=2||i<=-2}throw new Error("Invalid winding rulle")},t.computeWinding=function(e,i){i.windingNumber=t.regionAbove(i).windingNumber+i.eUp.winding,i.inside=t.isWindingInside(e,i.windingNumber)},t.finishRegion=function(e,i){var n=i.eUp,r=n.Lface;r.inside=i.inside,r.anEdge=n,t.deleteRegion(e,i)},t.finishLeftRegions=function(e,i,n){for(var r,s=null,o=i,a=i.eUp;o!==n;){if(o.fixUpperEdge=!1,s=t.regionBelow(o),r=s.eUp,r.Org!=a.Org){if(!s.fixUpperEdge){t.finishRegion(e,o);break}r=e.mesh.connect(a.Lprev,r.Sym),t.fixUpperEdge(e,s,r)}a.Onext!==r&&(e.mesh.splice(r.Oprev,r),e.mesh.splice(a,r)),t.finishRegion(e,o),a=s.eUp,o=s}return a},t.addRightEdges=function(e,i,n,r,s,o){var a,l,h,f,c=!0;h=n;do Be(Ne.vertLeq(h.Org,h.Dst)),t.addRegionBelow(e,i,h.Sym),h=h.Onext;while(h!==r);for(s===null&&(s=t.regionBelow(i).eUp.Rprev),l=i,f=s;a=t.regionBelow(l),h=a.eUp.Sym,h.Org===f.Org;)h.Onext!==f&&(e.mesh.splice(h.Oprev,h),e.mesh.splice(f.Oprev,h)),a.windingNumber=l.windingNumber-h.winding,a.inside=t.isWindingInside(e,a.windingNumber),l.dirty=!0,!c&&t.checkForRightSplice(e,l)&&(t.addWinding(h,f),t.deleteRegion(e,l),e.mesh.delete(f)),c=!1,l=a,f=h;l.dirty=!0,Be(l.windingNumber-h.winding===a.windingNumber),o&&t.walkDirtyRegions(e,l)},t.spliceMergeVertices=function(e,i,n){e.mesh.splice(i,n)},t.vertexWeights=function(e,i,n){var r=Ne.vertL1dist(i,e),s=Ne.vertL1dist(n,e),o=.5*s/(r+s),a=.5*r/(r+s);e.coords[0]+=o*i.coords[0]+a*n.coords[0],e.coords[1]+=o*i.coords[1]+a*n.coords[1],e.coords[2]+=o*i.coords[2]+a*n.coords[2]},t.getIntersectData=function(e,i,n,r,s,o){i.coords[0]=i.coords[1]=i.coords[2]=0,i.idx=-1,t.vertexWeights(i,n,r),t.vertexWeights(i,s,o)},t.checkForRightSplice=function(e,i){var n=t.regionBelow(i),r=i.eUp,s=n.eUp;if(Ne.vertLeq(r.Org,s.Org)){if(Ne.edgeSign(s.Dst,r.Org,s.Org)>0)return!1;Ne.vertEq(r.Org,s.Org)?r.Org!==s.Org&&(e.pq.delete(r.Org.pqHandle),t.spliceMergeVertices(e,s.Oprev,r)):(e.mesh.splitEdge(s.Sym),e.mesh.splice(r,s.Oprev),i.dirty=n.dirty=!0)}else{if(Ne.edgeSign(r.Dst,s.Org,r.Org)<0)return!1;t.regionAbove(i).dirty=i.dirty=!0,e.mesh.splitEdge(r.Sym),e.mesh.splice(s.Oprev,r)}return!0},t.checkForLeftSplice=function(e,i){var n=t.regionBelow(i),r=i.eUp,s=n.eUp,o;if(Be(!Ne.vertEq(r.Dst,s.Dst)),Ne.vertLeq(r.Dst,s.Dst)){if(Ne.edgeSign(r.Dst,s.Dst,r.Org)<0)return!1;t.regionAbove(i).dirty=i.dirty=!0,o=e.mesh.splitEdge(r),e.mesh.splice(s.Sym,o),o.Lface.inside=i.inside}else{if(Ne.edgeSign(s.Dst,r.Dst,s.Org)>0)return!1;i.dirty=n.dirty=!0,o=e.mesh.splitEdge(s),e.mesh.splice(r.Lnext,s.Sym),o.Rface.inside=i.inside}return!0},t.checkForIntersect=function(e,i){var n=t.regionBelow(i),r=i.eUp,s=n.eUp,o=r.Org,a=s.Org,l=r.Dst,h=s.Dst,f,c,u=new us,d,m;if(Be(!Ne.vertEq(h,l)),Be(Ne.edgeSign(l,e.event,o)<=0),Be(Ne.edgeSign(h,e.event,a)>=0),Be(o!==e.event&&a!==e.event),Be(!i.fixUpperEdge&&!n.fixUpperEdge),o===a||(f=Math.min(o.t,l.t),c=Math.max(a.t,h.t),f>c))return!1;if(Ne.vertLeq(o,a)){if(Ne.edgeSign(h,o,a)>0)return!1}else if(Ne.edgeSign(l,a,o)<0)return!1;return t.debugEvent(e),Ne.intersect(l,o,h,a,u),Be(Math.min(o.t,l.t)<=u.t),Be(u.t<=Math.max(a.t,h.t)),Be(Math.min(h.s,l.s)<=u.s),Be(u.s<=Math.max(a.s,o.s)),Ne.vertLeq(u,e.event)&&(u.s=e.event.s,u.t=e.event.t),d=Ne.vertLeq(o,a)?o:a,Ne.vertLeq(d,u)&&(u.s=d.s,u.t=d.t),Ne.vertEq(u,o)||Ne.vertEq(u,a)?(t.checkForRightSplice(e,i),!1):!Ne.vertEq(l,e.event)&&Ne.edgeSign(l,e.event,u)>=0||!Ne.vertEq(h,e.event)&&Ne.edgeSign(h,e.event,u)<=0?h===e.event?(e.mesh.splitEdge(r.Sym),e.mesh.splice(s.Sym,r),i=t.topLeftRegion(e,i),r=t.regionBelow(i).eUp,t.finishLeftRegions(e,t.regionBelow(i),n),t.addRightEdges(e,i,r.Oprev,r,r,!0),!0):l===e.event?(e.mesh.splitEdge(s.Sym),e.mesh.splice(r.Lnext,s.Oprev),n=i,i=t.topRightRegion(i),m=t.regionBelow(i).eUp.Rprev,n.eUp=s.Oprev,s=t.finishLeftRegions(e,n,null),t.addRightEdges(e,i,s.Onext,r.Rprev,m,!0),!0):(Ne.edgeSign(l,e.event,u)>=0&&(t.regionAbove(i).dirty=i.dirty=!0,e.mesh.splitEdge(r.Sym),r.Org.s=e.event.s,r.Org.t=e.event.t),Ne.edgeSign(h,e.event,u)<=0&&(i.dirty=n.dirty=!0,e.mesh.splitEdge(s.Sym),s.Org.s=e.event.s,s.Org.t=e.event.t),!1):(e.mesh.splitEdge(r.Sym),e.mesh.splitEdge(s.Sym),e.mesh.splice(s.Oprev,r),r.Org.s=u.s,r.Org.t=u.t,r.Org.pqHandle=e.pq.insert(r.Org),t.getIntersectData(e,r.Org,o,l,a,h),t.regionAbove(i).dirty=i.dirty=n.dirty=!0,!1)},t.walkDirtyRegions=function(e,i){for(var n=t.regionBelow(i),r,s;;){for(;n.dirty;)i=n,n=t.regionBelow(n);if(!i.dirty&&(n=i,i=t.regionAbove(i),i===null||!i.dirty))return;if(i.dirty=!1,r=i.eUp,s=n.eUp,r.Dst!==s.Dst&&t.checkForLeftSplice(e,i)&&(n.fixUpperEdge?(t.deleteRegion(e,n),e.mesh.delete(s),n=t.regionBelow(i),s=n.eUp):i.fixUpperEdge&&(t.deleteRegion(e,i),e.mesh.delete(r),i=t.regionAbove(n),r=i.eUp)),r.Org!==s.Org)if(r.Dst!==s.Dst&&!i.fixUpperEdge&&!n.fixUpperEdge&&(r.Dst===e.event||s.Dst===e.event)){if(t.checkForIntersect(e,i))return}else t.checkForRightSplice(e,i);r.Org===s.Org&&r.Dst===s.Dst&&(t.addWinding(s,r),t.deleteRegion(e,i),e.mesh.delete(r),i=t.regionAbove(n))}},t.connectRightVertex=function(e,i,n){var r,s=n.Onext,o=t.regionBelow(i),a=i.eUp,l=o.eUp,h=!1;if(a.Dst!==l.Dst&&t.checkForIntersect(e,i),Ne.vertEq(a.Org,e.event)&&(e.mesh.splice(s.Oprev,a),i=t.topLeftRegion(e,i),s=t.regionBelow(i).eUp,t.finishLeftRegions(e,t.regionBelow(i),o),h=!0),Ne.vertEq(l.Org,e.event)&&(e.mesh.splice(n,l.Oprev),n=t.finishLeftRegions(e,o,null),h=!0),h){t.addRightEdges(e,i,n.Onext,s,s,!0);return}Ne.vertLeq(l.Org,a.Org)?r=l.Oprev:r=a,r=e.mesh.connect(n.Lprev,r),t.addRightEdges(e,i,r,r.Onext,r.Onext,!1),r.Sym.activeRegion.fixUpperEdge=!0,t.walkDirtyRegions(e,i)},t.connectLeftDegenerate=function(e,i,n){var r,s,o,a,l;if(r=i.eUp,Ne.vertEq(r.Org,n)){Be(!1),t.spliceMergeVertices(e,r,n.anEdge);return}if(!Ne.vertEq(r.Dst,n)){e.mesh.splitEdge(r.Sym),i.fixUpperEdge&&(e.mesh.delete(r.Onext),i.fixUpperEdge=!1),e.mesh.splice(n.anEdge,r),t.sweepEvent(e,n);return}Be(!1),i=t.topRightRegion(i),l=t.regionBelow(i),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(Be(s!==o),t.deleteRegion(e,l),e.mesh.delete(o),o=s.Oprev),e.mesh.splice(n.anEdge,o),Ne.edgeGoesLeft(s)||(s=null),t.addRightEdges(e,i,o.Onext,a,s,!0)},t.connectLeftVertex=function(e,i){var n,r,s,o,a,l,h=new yc;if(h.eUp=i.anEdge.Sym,n=e.dict.search(h).key,r=t.regionBelow(n),!!r){if(o=n.eUp,a=r.eUp,Ne.edgeSign(o.Dst,i,o.Org)===0){t.connectLeftDegenerate(e,n,i);return}if(s=Ne.vertLeq(a.Dst,o.Dst)?n:r,n.inside||s.fixUpperEdge){if(s===n)l=e.mesh.connect(i.anEdge.Sym,o.Lnext);else{var f=e.mesh.connect(a.Dnext,i.anEdge);l=f.Sym}s.fixUpperEdge?t.fixUpperEdge(e,s,l):t.computeWinding(e,t.addRegionBelow(e,n,l)),t.sweepEvent(e,i)}else t.addRightEdges(e,n,i.anEdge,i.anEdge,null,!0)}},t.sweepEvent=function(e,i){e.event=i,t.debugEvent(e);for(var n=i.anEdge;n.activeRegion===null;)if(n=n.Onext,n===i.anEdge){t.connectLeftVertex(e,i);return}var r=t.topLeftRegion(e,n.activeRegion);Be(r!==null);var s=t.regionBelow(r),o=s.eUp,a=t.finishLeftRegions(e,s,null);a.Onext===o?t.connectRightVertex(e,r,a):t.addRightEdges(e,r,a.Onext,o,o,!0)},t.addSentinel=function(e,i,n,r){var s=new yc,o=e.mesh.makeEdge();o.Org.s=n,o.Org.t=r,o.Dst.s=i,o.Dst.t=r,e.event=o.Dst,s.eUp=o,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=e.dict.insert(s)},t.initEdgeDict=function(e){e.dict=new UL(e,t.edgeLeq);var i=e.bmax[0]-e.bmin[0],n=e.bmax[1]-e.bmin[1],r=e.bmin[0]-i,s=e.bmax[0]+i,o=e.bmin[1]-n,a=e.bmax[1]+n;t.addSentinel(e,r,s,o),t.addSentinel(e,r,s,a)},t.doneEdgeDict=function(e){for(var i,n=0;(i=e.dict.min().key)!==null;)i.sentinel||(Be(i.fixUpperEdge),Be(++n===1)),Be(i.windingNumber===0),t.deleteRegion(e,i)},t.removeDegenerateEdges=function(e){var i,n,r,s=e.mesh.eHead;for(i=s.next;i!==s;i=n)n=i.next,r=i.Lnext,Ne.vertEq(i.Org,i.Dst)&&i.Lnext.Lnext!==i&&(t.spliceMergeVertices(e,r,i),e.mesh.delete(i),i=r,r=i.Lnext),r.Lnext===i&&(r!==i&&((r===n||r===n.Sym)&&(n=n.next),e.mesh.delete(r)),(i===n||i===n.Sym)&&(n=n.next),e.mesh.delete(i))},t.initPriorityQ=function(e){var i,n,r,s=0;for(r=e.mesh.vHead,n=r.next;n!==r;n=n.next)s++;for(s+=8,i=e.pq=new NL(s,Ne.vertLeq),r=e.mesh.vHead,n=r.next;n!==r;n=n.next)n.pqHandle=i.insert(n);return n!==r?!1:(i.init(),!0)},t.donePriorityQ=function(e){e.pq=null},t.removeDegenerateFaces=function(e,i){var n,r,s;for(n=i.fHead.next;n!==i.fHead;n=r)r=n.next,s=n.anEdge,Be(s.Lnext!==s),s.Lnext.Lnext===s&&(t.addWinding(s.Onext,s),e.mesh.delete(s));return!0},t.computeInterior=function(e,i){i===void 0&&(i=!0);var n,r;if(t.removeDegenerateEdges(e),!t.initPriorityQ(e))return!1;for(t.initEdgeDict(e);(n=e.pq.extractMin())!==null;){for(;r=e.pq.min(),!(r===null||!Ne.vertEq(r,n));)r=e.pq.extractMin(),t.spliceMergeVertices(e,n.anEdge,r.anEdge);t.sweepEvent(e,n)}return e.event=e.dict.min().key.eUp.Org,t.debugEvent(e),t.doneEdgeDict(e),t.donePriorityQ(e),t.removeDegenerateFaces(e,e.mesh)?(i&&e.mesh.check(),!0):!1},t}(),FL=function(){function t(){this.mesh=new mp,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Tt.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return t.prototype.dot_=function(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]},t.prototype.normalize_=function(e){var i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!i)throw"Zero-size vector!";i=Math.sqrt(i),e[0]/=i,e[1]/=i,e[2]/=i},t.prototype.longAxis_=function(e){var i=0;return Math.abs(e[1])>Math.abs(e[0])&&(i=1),Math.abs(e[2])>Math.abs(e[i])&&(i=2),i},t.prototype.computeNormal_=function(e){var i,n,r,s,o,a,l=[0,0,0],h=[0,0,0],f=[0,0,0],c=[0,0,0],u=[0,0,0],d=[null,null,null],m=[null,null,null],g=this.mesh.vHead;i=g.next;for(var p=0;p<3;++p)s=i.coords[p],h[p]=s,m[p]=i,l[p]=s,d[p]=i;for(i=g.next;i!==g;i=i.next)for(var v=0;v<3;++v)s=i.coords[v],s<h[v]&&(h[v]=s,m[v]=i),s>l[v]&&(l[v]=s,d[v]=i);var y=0;if(l[1]-h[1]>l[0]-h[0]&&(y=1),l[2]-h[2]>l[y]-h[y]&&(y=2),h[y]>=l[y]){e[0]=0,e[1]=0,e[2]=1;return}for(a=0,n=m[y],r=d[y],f[0]=n.coords[0]-r.coords[0],f[1]=n.coords[1]-r.coords[1],f[2]=n.coords[2]-r.coords[2],i=g.next;i!==g;i=i.next)c[0]=i.coords[0]-r.coords[0],c[1]=i.coords[1]-r.coords[1],c[2]=i.coords[2]-r.coords[2],u[0]=f[1]*c[2]-f[2]*c[1],u[1]=f[2]*c[0]-f[0]*c[2],u[2]=f[0]*c[1]-f[1]*c[0],o=u[0]*u[0]+u[1]*u[1]+u[2]*u[2],o>a&&(a=o,e[0]=u[0],e[1]=u[1],e[2]=u[2]);a<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(f)]=1)},t.prototype.checkOrientation_=function(){for(var e=this.mesh.fHead,i,n=this.mesh.vHead,r,s=0,o=e.next;o!==e;o=o.next)if(r=o.anEdge,!(r.winding<=0))do s+=(r.Org.s-r.Dst.s)*(r.Org.t+r.Dst.t),r=r.Lnext;while(r!==o.anEdge);if(s<0){for(i=n.next;i!==n;i=i.next)i.t=-i.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},t.prototype.projectPolygon_=function(){var e=this.mesh.vHead,i=[0,0,0],n,r,s=!1;i[0]=this.normal[0],i[1]=this.normal[1],i[2]=this.normal[2],!i[0]&&!i[1]&&!i[2]&&(this.computeNormal_(i),s=!0),n=this.sUnit,r=this.tUnit;var o=this.longAxis_(i);n[o]=0,n[(o+1)%3]=1,n[(o+2)%3]=0,r[o]=0,r[(o+1)%3]=0,r[(o+2)%3]=i[o]>0?1:-1;for(var a=e.next;a!==e;a=a.next)a.s=this.dot_(a.coords,n),a.t=this.dot_(a.coords,r);s&&this.checkOrientation_();for(var l=!0,h=e.next;h!==e;h=h.next)l?(this.bmin[0]=this.bmax[0]=h.s,this.bmin[1]=this.bmax[1]=h.t,l=!1):(h.s<this.bmin[0]&&(this.bmin[0]=h.s),h.s>this.bmax[0]&&(this.bmax[0]=h.s),h.t<this.bmin[1]&&(this.bmin[1]=h.t),h.t>this.bmax[1]&&(this.bmax[1]=h.t))},t.prototype.addWinding_=function(e,i){e.winding+=i.winding,e.Sym.winding+=i.Sym.winding},t.prototype.tessellateMonoRegion_=function(e,i){var n,r;if(n=i.anEdge,!(n.Lnext!==n&&n.Lnext.Lnext!==n))throw"Mono region invali
3113d";for(;Ne.vertLeq(n.Dst,n.Org);n=n.Lprev);for(;Ne.vertLeq(n.Org,n.Dst);n=n.Lnext);r=n.Lprev;for(var s=void 0;n.Lnext!==r;)if(Ne.vertLeq(n.Dst,r.Org)){for(;r.Lnext!==n&&(Ne.edgeGoesLeft(r.Lnext)||Ne.edgeSign(r.Org,r.Dst,r.Lnext.Dst)<=0);)s=e.connect(r.Lnext,r),r=s.Sym;r=r.Lprev}else{for(;r.Lnext!==n&&(Ne.edgeGoesRight(n.Lprev)||Ne.edgeSign(n.Dst,n.Org,n.Lprev.Org)>=0);)s=e.connect(n,n.Lprev),n=s.Sym;n=n.Lnext}if(r.Lnext===n)throw"Mono region invalid";for(;r.Lnext.Lnext!==n;)s=e.connect(r.Lnext,r),r=s.Sym;return!0},t.prototype.tessellateInterior_=function(e){for(var i,n=e.fHead.next;n!==e.fHead;n=i)if(i=n.next,n.inside&&!this.tessellateMonoRegion_(e,n))return!1;return!0},t.prototype.discardExterior_=function(e){for(var i,n=e.fHead.next;n!==e.fHead;n=i)i=n.next,n.inside||e.zapFace(n)},t.prototype.setWindingNumber_=function(e,i,n){for(var r,s=e.eHead.next;s!==e.eHead;s=r)r=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?i:-i:n?e.delete(s):s.winding=0},t.prototype.getNeighbourFace_=function(e){return!e.Rface||!e.Rface.inside?-1:e.Rface.n},t.prototype.outputPolymesh_=function(e,i,n,r){var s,o=0,a=0,l;n>3&&e.mergeConvexFaces(n);for(var h=e.vHead.next;h!==e.vHead;h=h.next)h.n=-1;for(var f=e.fHead.next;f!==e.fHead;f=f.next)if(f.n=-1,!!f.inside){s=f.anEdge,l=0;do{var h=s.Org;h.n===-1&&(h.n=a,a++),l++,s=s.Lnext}while(s!==f.anEdge);if(l>n)throw"Face vertex greater that support polygon";f.n=o,++o}this.elementCount=o,i===jt.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*n,this.vertexCount=a,this.vertices=[],this.vertices.length=a*r,this.vertexIndices=[],this.vertexIndices.length=a;for(var h=e.vHead.next;h!==e.vHead;h=h.next)if(h.n!==-1){var c=h.n*r;this.vertices[c+0]=h.coords[0],this.vertices[c+1]=h.coords[1],r>2&&(this.vertices[c+2]=h.coords[2]),this.vertexIndices[h.n]=h.idx}for(var u=0,f=e.fHead.next;f!==e.fHead;f=f.next)if(f.inside){s=f.anEdge,l=0;do{var h=s.Org;this.elements[u++]=h.n,l++,s=s.Lnext}while(s!==f.anEdge);for(var d=l;d<n;++d)this.elements[u++]=-1;if(i===jt.CONNECTED_POLYGONS){s=f.anEdge;do this.elements[u++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==f.anEdge);for(var m=l;m<n;++m)this.elements[u++]=-1}}},t.prototype.outputContours_=function(e,i){var n,r,s=0,o=0;this.vertexCount=0,this.elementCount=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(a.inside){r=n=a.anEdge;do this.vertexCount++,n=n.Lnext;while(n!==r);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*i,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,h=0,f=0;s=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(a.inside){o=0,r=n=a.anEdge;do this.vertices[l++]=n.Org.coords[0],this.vertices[l++]=n.Org.coords[1],i>2&&(this.vertices[l++]=n.Org.coords[2]),this.vertexIndices[h++]=this.vertexIdCallback?this.vertexIdCallback(n):n.Org.idx,o++,n=n.Lnext;while(n!==r);this.elements[f++]=s,this.elements[f++]=o,s+=o}},t.prototype.addContour=function(e,i){this.mesh===null&&(this.mesh=new mp),e<2&&(e=2),e>3&&(e=3);for(var n=null,r=0;r<i.length;r+=e)n===null?(n=this.mesh.makeEdge(),this.mesh.splice(n,n.Sym)):(this.mesh.splitEdge(n),n=n.Lnext),n.Org.coords[0]=i[r+0],n.Org.coords[1]=i[r+1],e>2?n.Org.coords[2]=i[r+2]:n.Org.coords[2]=0,n.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(n),n.winding=1,n.Sym.winding=-1},t.prototype.tesselate=function(e,i,n,r,s,o){if(e===void 0&&(e=Tt.ODD),i===void 0&&(i=jt.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=e,r<2&&(r=2),r>3&&(r=3),!this.mesh)return!1;this.projectPolygon_(),BL.computeInterior(this,o);var a=this.mesh;return i===jt.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),i===jt.BOUNDARY_CONTOURS?this.outputContours_(a,r):this.outputPolymesh_(a,i,n,r),!0},t}();function oo(t){var e=t.windingRule,i=e===void 0?Tt.ODD:e,n=t.elementType,r=n===void 0?jt.POLYGONS:n,s=t.polySize,o=s===void 0?3:s,a=t.vertexSize,l=a===void 0?2:a,h=t.normal,f=h===void 0?[0,0,1]:h,c=t.contours,u=c===void 0?[]:c,d=t.strict,m=d===void 0?!0:d,g=t.debug,p=g===void 0?!1:g;if(!u&&m)throw new Error("Contours can't be empty");if(u){var v=new FL;t.edgeCreateCallback&&(v.edgeCreateCallback=t.edgeCreateCallback),t.vertexIdCallback&&(v.vertexIdCallback=t.vertexIdCallback);for(var y=0;y<u.length;y++)v.addContour(l||2,u[y]);return v.tesselate(i,r,o,l,f,m),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:p?v.mesh:void 0}}}Tt.ODD;Tt.NONZERO;Tt.POSITIVE;Tt.NEGATIVE;Tt.ABS_GEQ_TWO;jt.POLYGONS;jt.CONNECTED_POLYGONS;jt.BOUNDARY_CONTOURS;var Fg=class extends We{constructor(t,e=12,i={}){var u,d,m;super(),this.type="ShapeGeometry",this.windingRule=Tt.ODD,this.elementType=jt.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=t,this._curveSegments=e,this._triangulationOptions=Object.assign({windingRule:Tt.ODD,elementType:jt.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let n=this._shape.extractShapePointsToFlatArray([],this._curveSegments),r=this._shape.shapeHoles.map(g=>g.extractShapePointsToFlatArray([],this._curveSegments)),s,o=!0,a=!0,l,h;for(let g=0,p=n.length/2;g<p;
3113g++){let v=g*2,y=n[v+0],b=n[v+1];if(l!==void 0&&y!==l&&(o=!1),h!==void 0&&b!==h&&(a=!1),l=y,h=b,!o&&!a)break}!o&&!a&&(s=oo({contours:[n,...r],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict}));let f=(u=s==null?void 0:s.vertexCount)!=null?u:1,c=(d=s==null?void 0:s.elementCount)!=null?d:1;if(this._positionAttribute=new it(new Float32Array(f*3),3),this._normalAttribute=new it(new Float32Array(f*3),3),this._uvAttribute=new it(new Float32Array(f*2),2),this._indexAttribute=new it(new Uint32Array(c*3),1),s){let g=1/0,p=-1/0,v=1/0,y=-1/0;for(let M=0,w=f;M<w;M++){let T=M*2,_=s.vertices[T+0],A=s.vertices[T+1];_<g&&(g=_),_>p&&(p=_),A<v&&(v=A),A>y&&(y=A)}let b=p-g,x=y-v;for(let M=0,w=f;M<w;M++){let T=M*2,_=s.vertices[T+0],A=s.vertices[T+1],S=(_-g)/b,D=(A-v)/x;this._positionAttribute.setXYZ(M,_,A,0),this._normalAttribute.setXYZ(M,0,0,1),this._uvAttribute.setXY(M,S,D)}for(let M=0,w=c;M<w;M++){let T=M*3,_=s.elements[T+0],A=s.elements[T+1],S=s.elements[T+2];this._indexAttribute.setX(T+0,_),this._indexAttribute.setX(T+1,A),this._indexAttribute.setX(T+2,S)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,((m=s==null?void 0:s.elementCount)!=null?m:1)*3)}clone(){let t=new Fg(this._shape,this._curveSegments);return t.userData=Pg(this.userData),t}},bh=class{constructor(t=256,e=!1){this.capacity=t,this.size=0,this.debug=e,this.debug&&console.log(`allocating with cap ${t}`);let i=t*bh.eSize;this.buffer=new ArrayBuffer(i);let n=Float32Array.BYTES_PER_ELEMENT,r=0;this.positions=new Float32Array(this.buffer,r*n,3*t),r+=3*t,this.normals=new Float32Array(this.buffer,r*n,3*t),r+=3*t,this.uvs=new Float32Array(this.buffer,r*n,2*t)}realloc(t,e=!1){if(t<this.size)throw Error("cannot shrink buffer");if(t<=this.capacity&&!e)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${t}`);let i=t*bh.eSize,n=new ArrayBuffer(i),r=Float32Array.BYTES_PER_ELEMENT,s=0,o=new Float32Array(n,s*r,3*t);s+=3*t;let a=new Float32Array(n,s*r,3*t);s+=3*t;let l=new Float32Array(n,s*r,2*t);o.set(this.positions.slice(0,this.size*3)),a.set(this.normals.slice(0,this.size*3)),l.set(this.uvs.slice(0,this.size*2)),this.buffer=n,this.positions=o,this.normals=a,this.uvs=l,this.capacity=t}get(t=1){let e=this.size+t;if(e>this.capacity){let n=this.capacity;for(;e>n;)n*=2;this.realloc(n)}let i=this.size;return this.size=e,i}reserve(t){let e=this.size+t;e>this.capacity&&this.realloc(e)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}},kg=bh;kg.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var xc=(t,e)=>([i,n])=>(n<i&&(n+=e),(t>=i?t:t+e)<=n),Vg=class extends We{constructor(t,e,i=0,n=12,r=3,s=Tt.ODD){super(),this.type="ShapeGeometry",this.vertexCache={},this._shape=t,this._depth=e,this._bevel=i,this._curveSegments=n,this._bevelSegmentsInput=r,i<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(i,e/2-1e-12),this._bevelSegments=Math.floor(r));let o=this._shape.extractShapePointsToFlatArray([],n),a=this._shape.shapeHoles.map(w=>{let T=w.extractShapePointsToFlatArray([],n),_=[];for(let A=T.length-1;A>=1;A-=2){let S=T[A-1],D=T[A-0];_.push(S,D)}return _}),l=oo({windingRule:s,elementType:jt.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[o]}),h=oo({windingRule:Tt.ODD,elementType:jt.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]});if(!l)throw new Error("error generating geometry");let f=l.elementCount;if(h){l.elementCount+=h.elementCount;for(let w=0;w<h.elements.length;w++){let T=h.elements[w],_=w%2===0?l.vertexCount:0;l.elements.push(T+_)}for(let w=0;w<h.vertexIndices.length;w++){let T=h.vertexIndices[w],_=l.vertexCount;l.vertexIndices.push(T+_)}for(let w=0;w<h.vertices.length;w++){let T=h.vertices[w];l.vertices.push(T)}}let c=1/0,u=-1/0,d=1/0,m=-1/0;for(let w=0,T=l.vertexCount;w<T;w++){let _=w*2,A=l.vertices[_+0],S=l.vertices[_+1];A<c&&(c=A),A>u&&(u=A),S<d&&(d=S),S>m&&(m=S)}this._minX=c,this._minY=d,this._width=u-c,this._height=m-d;let g=l.vertexCount*2*(2+this._bevelSegments);this._buffer=new kg(g);let p=[],v=[];for(let w=l.elementCount-1;w>=0;w--){let T=w>=f,_=w*2,A=l.elements[_+0],S=l.elements[_+1],D=A+S,O={start:A,count:S,normals:[],continuous:[],concave:[]},z=A,I=D-1,H=A+1,ee=this._shape.roundedCurves.length;do{let R=z-A,k=l.vertices[I*2+0],F=l.vertices[I*2+1],U=l.vertices[z*2+0],W=l.vertices[z*2+1],ie=l.vertices[H*2+0],V=l.vertices[H*2+1],K=U-k,Y=W-F,J=Math.sqrt(K*K+Y*Y);K/=J,Y/=J;let Q=U-ie,he=W-V,de=Math.sqrt(Q*Q+he*he);Q/=de,he/=de,O.normals[R*2+0]=-he,O.normals[R*2+1]=Q,O.concave[R
3113]=K*he-Y*Q>0;let ae=l.vertexIndices[z];if(Array.isArray(ae))O.continuous[R]=!1;else{let[ve,pe]=this._shape.getCurveIndexFromVertexId(ae-1,!0);if(pe>0&&pe<1)O.continuous[R]=!0;else{let me=pe===1?ve+1:ve-1;me=(me+ee)%ee;let De=pe===1?0:1,Se=this._shape.roundedCurves[ve].getTangent(pe),Me=this._shape.roundedCurves[me].getTangent(De);O.continuous[R]=Se.dot(Me)>.95}}T&&(O.normals[R*2+0]*=-1,O.normals[R*2+1]*=-1),[I,z,H]=[z,H,H+1],H>=D&&(H-=S)}while(H!==A+1);let G=[];G.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(A*2,D*2),vertexCount:S,vertexIndices:new Array(S).fill(!0).map((R,k)=>[k,k]),elements:[0,S],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(A*2,D*2)});for(let R=1;R<=this._bevelSegments;R++){let k=R/this._bevelSegments*Math.PI/2,F=(1-Math.cos(k))*this._bevelSize,U=[],W=[],ie=0;for(let K=0;K<S;K++){let Y=K*2,J=(K-1+S)%S*2,Q=l.vertices[O.start*2+Y+0],he=l.vertices[O.start*2+Y+1],de=-O.normals[J+0]*F,ae=-O.normals[J+1]*F,ve=-O.normals[Y+0]*F,pe=-O.normals[Y+1]*F;if(O.concave[K]||!O.concave[K]&&T){let me=Math.atan2(ae,de),De=Math.atan2(pe,ve);De>me&&(De-=Math.PI*2);let Se=De-me;if(O.continuous[K]||T){let Me=me+Se/2,vt=Math.cos(Me)*F,Ue=Math.sin(Me)*F;U[2*ie+0]=Q+vt*(T?-1:1),U[2*ie+1]=he+Ue*(T?-1:1),W[ie]=K,ie++}else{let Me=Math.max(1,Math.floor(n/4*Math.abs(Se)/Math.PI));for(let vt=0;vt<=Me;vt++){let Ue=me+Se*(vt/Me),P=Math.cos(Ue)*F,C=Math.sin(Ue)*F;U[2*ie+0]=Q+P,U[2*ie+1]=he+C,W[ie]=K,ie++}}}else U[2*ie+0]=Q+de,U[2*ie+1]=he+ae,W[ie]=K,ie++,U[2*ie+0]=Q,U[2*ie+1]=he,W[ie]=K,ie++,U[2*ie+0]=Q+ve,U[2*ie+1]=he+pe,W[ie]=K,ie++}let V=oo({windingRule:Tt.POSITIVE,elementType:jt.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[U],edgeCreateCallback:K=>{let Y=K.Org.idx,J=W[Y],Q=W[(Y+1)%W.length];K.idx=[J,Q],K.Sym.idx=[Q,J]},vertexIdCallback:K=>{let Y=K.Lprev.idx;return[Y?Y[1]:0,K.idx[0]]}});if(!V)throw console.log("Error"),new Error(`error generating bevel geometry for ${R}'th loop`);if(!V.vertexCount)break;for(let K=0;K<V.vertexIndices.length;K++){let[Y,J]=V.vertexIndices[K];if(Y===J)continue;let Q=J;J<Y&&(Q+=S);for(let he=Y;he<Q;he++){let de=he%S,ae=(he+1)%S;if(!O.continuous[de]||!O.continuous[ae]){V.vertexIndices[K]=[Y,de],V.vertexIndices.splice(K+1,0,[ae,J]),V.vertices.splice((K+1)*2,0,V.vertices[K*2],V.vertices[K*2+1]);break}}}G.push({bevelI:R,angle:k,size:F,boundary:V,reverseMap:W,insetPoints:U})}let B=(R,k,F)=>{let U=0,W=R.boundary.vertexIndices.length;for(;U<W&&F(R.boundary.vertexIndices[k]);)k=(k+1)%W,U++;return U},N=p.length;for(let R=1;R<G.length;R++){let k=G[R-1],F=G[R],U=k.boundary.vertexIndices.length,W=F.boundary.vertexIndices.length;if(!U||!W)break;let ie=O.concave.length,V=0,K=xc(V,S);for(;!k.boundary.vertexIndices.filter(K).length||!F.boundary.vertexIndices.filter(K).length;)V++,K=xc(V,S);let Y=k.boundary.vertexIndices.findIndex(K),J=F.boundary.vertexIndices.findIndex(K);do Y=(Y+1)%U;while(K(k.boundary.vertexIndices[Y]));do J=(J+1)%W;while(K(F.boundary.vertexIndices[J]));V=(V+1)%S;let Q=V,he=this.buildBevelVert(O,k,(Y-1+U)%U),de=this.buildBevelVert(O,F,(J-1+W)%W),ae=he,ve=de,pe,me,De=!1;do{K=xc(V,S);let Se=B(k,Y,K),Me=B(F,J,K),vt=De;if(De=!1,Se&&!Me){for(let Ue=0;Ue<Se;Ue++)pe=this.buildBevelVert(O,k,(Y+Ue)%U,Ue/(Se-1)),p.push(ae.topN,pe.topP,ve.topN),p.push(pe.bottomP,ae.bottomN,ve.bottomN
3113),ae=pe;De=!0}else if(!Se&&Me)for(let Ue=0;Ue<Me;Ue++)me=this.buildBevelVert(O,F,(J+Ue)%W,Ue/(Me-1)),p.push(ve.topN,ae.topP,me.topP),p.push(ae.bottomP,ve.bottomN,me.bottomP),ve=me;else if(Se&&Me)if(pe=this.buildBevelVert(O,k,Y,0),me=this.buildBevelVert(O,F,J,0),vt?(p.push(ae.topN,me.topP,ve.topN),p.push(ae.topN,pe.topP,me.topP),p.push(me.bottomP,ae.bottomN,ve.bottomN),p.push(me.bottomP,pe.bottomP,ae.bottomN)):(p.push(ve.topN,ae.topN,pe.topP),p.push(ve.topN,pe.topP,me.topP),p.push(pe.bottomP,ae.bottomN,ve.bottomN),p.push(pe.bottomP,ve.bottomN,me.bottomP)),ae=pe,ve=me,Se===Me)for(let Ue=1;Ue<Se;Ue++)pe=this.buildBevelVert(O,k,(Y+Ue)%U,Ue/(Se-1)),me=this.buildBevelVert(O,F,(J+Ue)%W,Ue/(Me-1)),p.push(ae.topN,pe.topP,ve.topN),p.push(ve.topN,pe.topP,me.topP),p.push(pe.bottomP,ae.bottomN,ve.bottomN),p.push(pe.bottomP,ve.bottomN,me.bottomP),ae=pe,ve=me;else if(Se>Me){let Ue=Se/Me,P=0;for(let C=1;C<Se;C++)pe=this.buildBevelVert(O,k,(Y+C)%U,C/(Se-1)),p.push(ae.topN,pe.topP,ve.topN),p.push(pe.bottomP,ae.bottomN,ve.bottomN),ae=pe,C>(P+1)*Ue&&(P++,me=this.buildBevelVert(O,F,(J+P)%W,P/(Me-1)),p.push(ve.topN,pe.topP,me.topP),p.push(pe.bottomP,ve.bottomN,me.bottomP),ve=me)}else{let Ue=Me/Se,P=0;for(let C=1;C<Me;C++)me=this.buildBevelVert(O,F,(J+C)%W,C/(Me-1)),p.push(ve.topN,pe.topP,me.topP),p.push(pe.bottomP,ve.bottomN,me.bottomP),ve=me,C>(P+1)*Ue&&(P++,pe=this.buildBevelVert(O,k,(Y+P)%U,P/(Se-1)),p.push(ae.topN,pe.topP,ve.topN),p.push(pe.bottomP,ae.bottomN,ve.bottomN
3113),ae=pe)}Y=(Y+Se)%U,J=(J+Me)%W,V=(V+1)%ie}while(V!==Q)}{let R=G[0];for(let k=0,F=R.boundary.vertexCount;k<F;k++){let U=this.buildBevelVert(O,R,k),W=this.buildBevelVert(O,R,(k+1)%F);p.push(W.topP,U.topN,U.bottomN),p.push(W.topP,U.bottomN,W.bottomP)}}if(T){let R=[];for(let k=p.length-1;k>=N+2;k-=3){let F=p[k-2],U=p[k-1],W=p[k-0];R.push(W,U,F)}p.splice(N,p.length-N,...R)}if(T){let R=[];for(let k=G[G.length-1].boundary.vertices.length-1;k>=1;k-=2){let F=G[G.length-1].boundary.vertices[k-1],U=G[G.length-1].boundary.vertices[k-0];R.push(F,U)}v.push(R)}if(!T){let R=G[G.length-1],k=oo({windingRule:G.length>1?Tt.POSITIVE:Tt.ODD,elementType:jt.POLYGONS,vertexSize:2,strict:!0,contours:[R.insetPoints,...v]});if(!k)throw new Error("Error generating geometry for surface");a.length===0&&Object.assign(this,{capStartIndex:p.length});for(let F=0;F<k.elementCount*3;F+=3){let U=this.buildSurfaceVert(k,k.elements[F+0]),W=this.buildSurfaceVert(k,k.elements[F+1]),ie=this.buildSurfaceVert(k,k.elements[F+2]);p.push(U.top,W.top,ie.top),p.push(ie.bottom,W.bottom,U.bottom)}}this.vertexCache={}}this._buffer.shrink();let y=new it(Uint32Array.from(p),1),b=new it(this._buffer.positions,3),x=new it(this._buffer.normals,3),M=new it(this._buffer.uvs,2);b.needsUpdate=!0,x.needsUpdate=!0,M.needsUpdate=!0,y.needsUpdate=!0,this.setAttribute("position",b),this.setAttribute("normal",x),this.setAttribute("uv",M),this.setIndex(y)}buildSurfaceVert(t,e){let i=e.toString();if(i in this.vertexCache)return this.vertexCache[i];let n=t.vertices[e*2+0],r=t.vertices[e*2+1],s=(n-this._minX)/this._width,o=(r-this._minY)/this._height,a=this._buffer.get(2),l=a*3,h=a*2,f={top:a+0,bottom:a+1};return this._buffer.positions[l+0]=n,this._buffer.positions[l+1]=r,this._buffer.positions[l+2]=this._depth,this._buffer.normals[l+0]=0,this._buffer.normals[l+1]=0,this._buffer.normals[l+2]=1,this._buffer.uvs[h+0]=s,this._buffer.uvs[h+1]=o,this._buffer.positions[l+3]=n,this._buffer.positions[l+4]=r,this._buffer.positions[l+5]=0,this._buffer.normals[l+3]=0,this._buffer.normals[l+4]=0,this._buffer.normals[l+5]=-1,this._buffer.uvs[h+2]=s,this._buffer.uvs[h+3]=o,this.vertexCache[i]=f,f}buildBevelVert(t,e,i,n=1){let r=`${e.bevelI}:${i}`;if(r in this.vertexCache)return this.vertexCache[r];let[s,o]=e.boundary.vertexIndices[i],a,l,h,f;s!==o?(l=s,a=o,f=!1,h=t.continuous[l]&&t.continuous[a]):(a=s,l=(a-1+t.count)%t.count,f=t.concave[a]&&e.bevelI>0,h=t.continuous[a]||f);let c=Math.cos(e.angle),u=Math.sin(e.angle),d=i*2,m=a*2,g=l*2,p=e.boundary.vertices[d+0],v=e.boundary.vertices[d+1],y=(1-u)*this._bevelSize,b=(p-this._minX)/this._width,x=(v-this._minY)/this._height,M=t.normals[m+0],w=t.normals[m+1],T=t.normals[g+0],_=t.normals[g+1];if(f){let z=T-M,I=_-w;M=M+z*(1-n),w=w+I*(1-n);let H=Math.sqrt(M*M+w*w);M/=H,w/=H}let A=this._buffer.get(h?2:4),S=A*3,D=A*2,O={i,fi:a,topP:A+0,topN:A+0,bottomP:A+1,bottomN:A+1};return this._buffer.positions[S+0]=p,this._buffer.positions[S+1]=v,this._buffer.positions[S+2]=this._depth-y,this._buffer.normals[S+0]=M*c,this._buffer.normals[S+1]=w*c,this._buffer.normals[S+2]=u,this._buffer.uvs[D+0]=b,this._buffer.uvs[D+1]=x,this._buffer.positions[S+3]=p,this._buffer.positions[S+4]=v,this._buffer.positions[S+5]=y,this._buffer.normals[S+3]=M*c,this._buffer.normals[S+4]=w*c,this._buffer.normals[S+5]=-u,this._buffer.uvs[D+2]=x,this._buffer.uvs[D+3]=b,h||(A+=2,S+=6,D+=4,O.topP=A+0,O.bottomP=A+1,this._buffer.positions[S+0]=p,this._buffer.positions[S+1]=v,this._buffer.positions[S+2]=this._depth-y,this._buffer.normals[S+0]=T*c,this._buffer.normals[S+1]=_*c,this._buffer.normals[S+2]=u,this._buffer.uvs[D+0]=b,this._buffer.uvs[D+1]=x,this._buffer.positions[S+3]=p,this._buffer.positions[S+4]=v,this._buffer.positions[S+5]=y,this._buffer.normals[S+3]=T*c,this._buffer.normals[S+4]=_*c,this._buffer.normals[S+5]=-u,this._buffer.uvs[D+2]=x,this._buffer.uvs[D+3]=b),this.vertexCache[r]=O,O}clone(){let t=new Vg(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Pg(this.userData),t}},On=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var h,f,c,u,d,m,g;let i=Object.assign({},(h=e==null?void 0:e.parameters)!=null?h:{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Tt.ODD},t.parameters),n=Math.abs(i.width),r=Math.abs((f=i.height)!=null?f:i.width),s=Math.abs((c=i.depth)!=null?c:0),o=(u=t.shape)!=null?u:e==null?void 0:e.shape,a=(d=o==null?void 0:o.roun
3113dness)!=null?d:i.roundness;o!==void 0&&(o instanceof Ot?(o.width!==n||o.height!==r)&&o.applySize(n,r):o=new Ot(n,r).fromJSON(o),((m=t.parameters)==null?void 0:m.roundness)!==void 0&&((g=t.parameters)==null?void 0:g.roundness)>0&&o.update(!1));let l=o!=null?o:new Ot(n,r);return{parameters:Object.assign(i,{width:n,height:r,depth:s,roundness:a}),shape:l}}static build(t){let{depth:e,extrudeBevelSize:i,extrudeBevelSegments:n,subdivisions:r,roundness:s,windingRule:o}=t.parameters;t.shape.roundness=s;let a;return e<=0?a=new Fg(t.shape,r,{windingRule:o}):a=new Vg(t.shape,e,i,r,n,o),Object.assign(a,{userData:{...t,type:"VectorGeometry"}})}},kL=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var o,a,l,h,f;let i=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:0,cornerSegments:8,hollow:0},t.parameters),n=i.width/2,r=(a=i.radiusTop)!=null?a:n,s=(l=i.radiusBottom)!=null?l:n;return r===s?(r=n,s=n):r>s?(r=n,s=s*n/r):(r=r*n/s,s=n),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((h=i.height)!=null?h:i.width),depth:Math.abs((f=i.depth)!=null?f:i.width),radiusTop:r,radiusBottom:s})}}static build(t){let{width:e,depth:i,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,radiusTop:h,radiusBottom:f,cornerRadius:c,cornerSegments:u,hollow:d}=t.parameters,m;return c||d?m=new Gg(h,f,n,r,s,o,a,l*Math.PI/180,c,c,u,d):m=new ol(h,f,n,r,s,o,a,l*Math.PI/180),m.scale(1,1,i/e),Object.assign(m,{userData:{...t,type:"CylinderGeometry"}})}};function Wn(t,e,i){i.x=t.x*e.x,i.y=t.y,i.z=t.x*e.y}function xp(t){return new Z(t.y,-t.x)}var Gg=class extends We{constructor(t,e,i,n,r,s,o,a,l,h,f,c,u=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,i=i||1,n=Math.floor(n)||8,r=Math.floor(r)||1,s=s!==void 0?s:!1,o=o!==void 0?o:0,a=a!==void 0?a:Math.PI*2,s&&(l=0,h=0);let d=[],m=[],g=[],p=[],v=0,y=i/2,b=new E,x=new E;u&&t==0&&(t=l),u&&e==0&&(e=h);let M=new Z(t,y),w=new Z(e,-y),T=null,_=null,A=null,S=null,D=M.clone().sub(w),O=0,z=0,I=0;c>0&&(O=Math.min(t,e)*(1-c),z=t-O,I=e-O);let H=M.clone();H.x-=O;let ee=Math.PI-D.angle(),G=D.angle(),B=Math.tan(G/2),N=Math.tan(ee/2),R=B+N,k=c?R:N,F=c?R:B;if(l=Math.min(l,(t-z)/k,D.length()/R),h=Math.min(h,(e-I)/F,D.length()/R),l>0){let Y=l/B;T=M.clone().sub(new Z(Y,l)),c&&(A=T.clone(),A.x-=O-R*l),M.sub(D.clone().setLength(Y))}if(h>0){let Y=h/N;_=w.clone().sub(new Z(Y,-h)),w.add(D.clone().setLength(Y)),c&&(S=_.clone(),S.x-=O-R*h,H.sub(D.clone().setLength(Y)))}D=M.clone().sub(w);let U=D.length()<.5,W=[];for(let Y=0;Y<=n;Y++){let J=[],Q=Y/n,he=Q*a+o,de=new Z(Math.sin(he),Math.cos(he));S&&_?(ie(J,Q,de,ee,h,S,-1,!0),ie(J,Q,de,G,h,_,-1,!1)):_?(V(J,de,_.x,0,-1),ie(J,Q,de,G,h,_,-1,!1)):s||V(J,de,e,I,-1);let ae=xp(D).normalize();if(Wn(ae,de,b),!U)for(let ve=0;ve<=r;ve++){let pe=ve/r,me=D.clone().multiplyScalar(pe).add(w);Wn(me,de,x),m.push(x.x,x.y,x.z),g.push(b.x,b.y,b.z),p.push(Q,.5+x.y/i),J.push(v++)}if(A&&T?(ie(J,Q,de,ee,l,T,1,!1),ie(J,Q,de,G,l,A,1,!0)):T?(ie(J,Q,de,ee,l,T,1,!1),V(J,de,T.x,0,1)):s||V(J,de,t,z,1),c&&!U){let ve=xp(D).multiplyScalar(-1).normalize();Wn(ve,de,b);for(let pe=0;pe<=r;pe++){let me=pe/r,De=D.clone().multiplyScalar(-me).add(H);Wn(De,de,x),m.push(x.x,x.y,x.z),g.push(b.x,b.y,b.z),p.push(Q,.5+x.y/i),J.push(v++)}}c&&!s&&J.push(J[0]),W.push(J)}for(let Y=0;Y<W.length-1;Y++)for(let J=0;J<W[0].length-1;J++){if(s&&c&&J==r)continue;let Q=W[Y][J],he=W[Y+1][J],de=W[Y+1][J+1],ae=W[Y][J+1],ve=m[de*3+0],pe=m[de*3+2];d.push(Q,he,ae),(ve!=0||pe!=0)&&d.push(he,de,ae)}a<Math.PI*2&&(K(-1,W[0],o),K(1,W[W.length-1],o+a)),this.setIndex(d),this.setAttribute("position",new Pe(m,3)),this.setAttribute("normal",new Pe(g,3)),this.setAttribute("uv",new Pe(p,2));function ie(Y,J,Q,he,de,ae,ve,pe){for(let me=0;me<f+1;me++){let De=me/f,Se=ve<0?De:1-De;pe&&(Se-=1),Se*=he;let Me=new Z(Math.sin(Se),Math.cos(Se)*ve),vt=Me.clone().multiplyScalar(de).add(ae);Wn(vt,Q,x),m.push(x.x,x.y,x.z),Wn(Me,Q,b),g.push(b.x,b.y,b.z),p.push(J,.5+x.y/i),Y.push(v++)}}function V(Y,J,Q,he,de){let ae=new E,ve=new Z,pe=[Q,he];de<0&&pe.reverse();for(let me of pe)ve.set(me,y*de),Wn(ve,J,ae),m.push(ae.x,ae.y,ae.z),g.push(0,de,0),p.push(.5,.5),Y.push(v++)}function K(Y,J,Q){let he=new Z(Math.sin(Q),Math.cos(Q)),de=new Z(-Math.cos(Q),Math.sin(Q)),ae=new E,ve=Y<0?(De,Se,Me)=>d.push(De,Se,Me):(De,Se,Me)=>d.push(De,Me,Se),pe=new Z((t+e+z+I)/4,0);Wn(pe,he,ae),m.push(ae.x,ae.y,ae.z),g.push(de.x,0,de.y),p.push(.5,.5);let me=v++;for(let De of J){let Se=m.slice(De*3,De*3+3);m.push(...Se),g.push(de.x,0,de.y);let Me=p.slice(De*2,De*2+2);p.push(...Me),v++}for(let De=me+1;De<v-1;De++)ve(me,De,De+1);ve(me,v-1,me+1)}}},VL=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:0,cornerRadiusBottom:0,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:Math.abs((s=i.depth)!=null?s:i.width)})}}static build(t){let{width:e,depth:i,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,cornerRadiusTop:h,cornerRadiusBottom:f,cornerSegments:c}=t.parameters,u;return h>0||f>0||l<360?u=new Gg(0,e/2,n,r,s,o,a,l*Math.PI/180,h,f,c,0,!0):u=new Wh(e/2,n,r,s,o),u.scale(1,1,i/e),Object.assign(u,{userData:{...t,type:"ConeGeometry"}})}},GL=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:0,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:Math.abs((s=i.depth)!=null?s:i.width)})}}static build(t){let{width:e,height:i,depth:n,widthSegments:r,heightSegments:s,depthSegments:o,cornerRadius:a,cornerSegments:l}=t.parameters,h;return a==0?h=new Dn(e,i,n,r,s,o):h=new HL(e,i,n,r,s,o,a,l),Object.assign(h,{userData:{...t,type:"CubeGeometry"}})}},_c=Math.PI/2,HL=class extends We{constructor(t=1,e=1,i=1,n=1,r=1,s=1,o=0,a=4){super(),this.type="BoxGeometry";let l=this;n=Math.floor(n),r=Math.floor(r),s=Math.floor(s),a=Math.floor(a),o=Math.min(o,t/2,e/2,i/2);let h=[],f=[],c=[],u=[],d=0,m=0;g("z","y","x",-1,-1,i,e,t,s,r,0),g("z","y","x",1,-1,i,e,-t,s,r,1),g("x","z","y",1,1,t,i,e,n,s,2),g("x","z","y",1,-1,t,i,-e,n,s,3),g("x","y","z",1,-1,t,e,i,n,r,4),g("x","y","z",-1,-1,t,e,-i,n,r,5),o>0&&(p("z","y","x",-1,-1,1,i,e,t,s,0),p("z","y","x",1,-1,-1,i,e,t,s,1),p("z","y","x",-1,1,-1,i,e,t,s,1),p("z","y","x",1,1,1,i,e,t,s,0),p("x","y","z",-1,-1,-1,t,e,i,n,0
3113),p("x","y","z",1,-1,1,t,e,i,n,1),p("x","y","z",-1,1,1,t,e,i,n,0),p("x","y","z",1,1,-1,t,e,i,n,1),p("y","x","z",-1,-1,1,e,t,i,r,0),p("y","x","z",1,-1,-1,e,t,i,r,1),p("y","x","z",1,1,1,e,t,i,r,1),p("y","x","z",-1,1,-1,e,t,i,r,0),v(1,1,1),v(-1,1,1),v(1,-1,1),v(-1,-1,1),v(1,1,-1),v(-1,1,-1),v(1,-1,-1),v(-1,-1,-1)),this.setIndex(h),this.setAttribute("position",new Pe(f,3)),this.setAttribute("normal",new Pe(c,3)),this.setAttribute("uv",new Pe(u,2));function g(y,b,x,M,w,T,_,A,S,D,O){let z=(T-2*o)/S,I=(_-2*o)/D,H=T/2-o,ee=_/2-o,G=A/2,B=S+1,N=D+1,R=0,k=0,F=new E;for(let U=0;U<N;U++){let W=U*I-ee;for(let ie=0;ie<B;ie++){let V=ie*z-H;F[y]=V*M,F[b]=W*w,F[x]=G,f.push(F.x,F.y,F.z),F[y]=0,F[b]=0,F[x]=A>0?1:-1,c.push(F.x,F.y,F.z),u.push(ie/S),u.push(1-U/D),R+=1}}for(let U=0;U<D;U++)for(let W=0;W<S;W++){let ie=d+W+B*U,V=d+W+B*(U+1),K=d+(W+1)+B*(U+1),Y=d+(W+1)+B*U;h.push(ie,V,Y),h.push(V,K,Y),k+=6}l.addGroup(m,k,O),m+=k,d+=R}function p(y,b,x,M,w,T,_,A,S,D,O){let z=(_-2*o)/D,I=_/2-o,H=A/2-o,ee=S/2,G=D+1,B=0,N=0,R=new E,k=new E;for(let F=0;F<a+1;F++){let U=F/a*_c,W=Math.sin(U)*o,ie=(1-Math.cos(U))*o,V=Math.sin(U),K=Math.cos(U);R[b]=(H+W)*w,R[x]=(ee-ie)*T,k[y]=0,k[b]=V*Math.sign(R[b]),k[x]=K*Math.sign(R[x]);for(let Y=0;Y<G;Y++){let J=Y*z-I;R[y]=J*M,f.push(R.x,R.y,R.z),c.push(k.x,k.y,k.z),u.push(Y/D),u.push(0),B+=1}}for(let F=0;F<a;F++)for(let U=0;U<D;U++){let W=d+U+G*F,ie=d+U+G*(F+1),V=d+(U+1)+G*(F+1),K=d+(U+1)+G*F;h.push(W,ie,K),h.push(ie,V,K),N+=6}l.addGroup(m,N,O),m+=N,d+=B}function v(y,b,x){let M=new E,w=new E(t/2,e/2,i/2);w.subScalar(o);let T=[],_=y*b*x>0?(S,D,O)=>h.push(S,D,O):(S,D,O)=>h.push(S,O,D);for(let S=0;S<=a;S++){let D=[],O=_c*(1-S/a),z=Math.cos(O),I=Math.sin(O),H=0;for(let ee=0;ee<=S;ee++){let G=Math.cos(H),B=Math.sin(H);M.x=z*G,M.y=I,M.z=z*B;let N=w.clone().addScaledVector(M,o);f.push(y*N.x,b*N.y,x*N.z),c.push(y*M.x,b*M.y,x*M.z),u.push(0,0),D.push(d++),H+=_c/S}T.push(D)}let A=T.length-1;for(let S=0;S<A;S++){let D=T[S],O=T[S+1],z=D.length-1;_(D[0],O[1],O[0]);for(let I=1;I<=z;I++)_(D[I-1],D[I],O[I]),_(D[I],O[I+1],O[I])}}}},wu=class extends We{constructor(t=[],e=[],i="",n=1,r=.2,s=4){super(),this.type="PolyhedronGeometryRound";let o=[],a=[],l=[];h(),f(),this.setAttribute("position",new Pe(o,3)),this.setAttribute("normal",new Pe(l,3)),this.setAttribute("uv",new Pe(a,2));return;function h(){var G;r=Math.min(1-1e-5,r),r==0&&(s=0);let c={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],u=new E,d=u.clone(),m=new en,g=r*n,p=n-g,v=s+1,y=new E,b=(B,N)=>y.subVectors(B,N).normalize(),x=(B,N)=>Array(B).fill(void 0).map(N),M=x(t.length/3,(B,N)=>new E().fromArray(t,N*3).setLength(n)),w=[],T=1e6;for(let B=0;B<M.length;B++){let N=M[B],R=[],k,F,U,W=1e10,ie=-1;for(;(ie=e.indexOf(B,ie+1))!=-1;){let J=ie-ie%3;k=e[J+(ie+1)%3],F=e[J+(ie+2)%3],U=N.distanceToSquared(M[k]),W=Math.min(W,U),R.push([k,F,U])}W+=1e-6;let V=[],K=0,Y=R.length;for(let J=0;J<Y;J++){[k,F,U]=R[K];let Q=((G=w[k])==null?void 0:G.includes(B))==!0;U<=W&&V.push(k+ +Q*T),K=R.findIndex(he=>he[0]==F)}w.push(V)}let _=[];{let B=0,N=0,R,k,F=c==3;for(let U=0;U<=s;U++){R=U*(U+1)/2,k=(U+1)*(U+2)/2;for(let W=0;W<s-U;W++)[B,N]=[R+W+U+2,k+W+U+3],_.push(R,k,...F?[N,R]:[B,k],N,B),[R,k]=[B,N];_.push(R,k,R+s+2)}}let A=u.clone(),S=u.clone(),D=u.clone(),O=u.clone(),z=u.clone(),I=[],H=x(M.length,()=>x(c,()=>u.clone()));for(let B=0;B<M.length;B++){u.copy(M[B]).normalize(),A.copy(u).multiplyScalar(p);let N=w[B];for(let V=0;V<N.length;V++){let K=N[V],Y=N[(V+1)%c];m.setFromPointsAndIndices(M,B,K%T,Y%T),m.b.sub(m.a).setLength(1e10).add(m.a),m.c.sub(m.a).setLength(1e10).add(m.a),m.closestPointToPoint(A,H[B][V])}let R=[],k=[],F=[],U=new E;s==0&&[...H[B]].reduce((V,K)=>V.add(K),U).multiplyScalar(1/c);for(let V=0;V<c;V++){let K=[],Y=(V-1+c)%c,J=H[B][Y],Q=H[B][V];u.copy(J).sub(A),d.copy(Q).sub(A);let he=A.angleTo(u),de=u.angleTo(d),ae=Math.cos(he)*g;s==0?S.copy(U):S.copy(A).setLength(p+ae),k.push(ae);let ve=[S,J,Q];for(let pe=0;pe<2;pe++){let me=ve[pe],De=ve[pe+1];O.subVectors(me,A),z.subVectors(De,A),D.crossVectors(O,z).normalize();for(let Se=0;Se<v;Se++){let Me=[he,de][pe]*Se/v;u.copy(O).applyAxisAngle(D,Me).add(A),R.push(u.clone()),pe&&(b(u,A),K.push([Se==0?me:u.clone(),y.clone()]))}pe&&(b(De,A),K.push([De,y.clone()]))}F.push(K)}I.push(F);let W=2*v,ie=2;for(let V=0;V<c;V++){let K=W*V,Y=W*((V+1)%c),J=[R[K]];for(let he=1;he<v;he++){O=R[K+he],z=R[Y+he],J.push(O);for(let de=1,ae=he-ie+1;de<=ae;de++)u.lerpVectors(O,z,de/(ae+1)),u.sub(A).setLength(k[V]).add(A),J.push(u.clone());J.push(z)}for(let he=0;he<v;he++)J.push(R[he+v+K]);J.push(R[Y+v]);let Q=_.map(he=>J[he]);o.push(...Q.map(he=>
3113[he.x,he.y,he.z]).flat()),l.push(...Q.map(he=>(b(he,A),[y.x,y.y,y.z])).flat())}}let ee=[];for(let B=0;B<w.length;B++)for(let N=0;N<c;N++){let R=w[B][N];if(R<T){let k=w[R].findIndex(W=>W%T==B),F=I[B][N],U=I[R][k];for(let W=0;W<v;W++){let ie=F[W],V=U[v-W],K=F[W+1],Y=U[v-(W+1)];[ie,V,K,K,V,Y].forEach(J=>{o.push(J[0].x,J[0].y,J[0].z),l.push(J[1].x,J[1].y,J[1].z)})}ee.push(F[0][0],U[v][0],F[v][0],U[0][0])}}for(;ee.length;){let B,N,R,k;[B,N]=ee.splice(0,2);let F=[B];for(;B!=N;)F.push(N),R=ee.indexOf(N),k=R%2,N=ee.splice(R-k,2)[1-k];y.subVectors(F[0],F[1]).cross(u.subVectors(F[0],F[2])).normalize();let U=y.dot(F[0])<0;U&&y.negate();for(let W=1;W<=F.length-2;W++)[F[W+ +U],F[W+1-+U],F[0]].forEach(ie=>{o.push(ie.x,ie.y,ie.z),l.push(y.x,y.y,y.z)})}}function f(){let c=new E;for(let w=0;w<o.length;w+=3){c.x=o[w+0],c.y=o[w+1],c.z=o[w+2];let T=x(c)/2/Math.PI+.5,_=M(c)/Math.PI+.5;a.push(T,1-_)}let u=new E,d=new E,m=new E,g=new E,p=new Z,v=new Z,y=new Z,b=(w,T,_,A)=>{A<0&&w.x===1&&(a[T]=w.x-1),_.x===0&&_.z===0&&(a[T]=A/2/Math.PI+.5)};for(let w=0,T=0;w<o.length;w+=9,T+=6){u.set(o[w+0],o[w+1],o[w+2]),d.set(o[w+3],o[w+4],o[w+5]),m.set(o[w+6],o[w+7],o[w+8]),p.set(a[T+0],a[T+1]),v.set(a[T+2],a[T+3]),y.set(a[T+4],a[T+5]),g.copy(u).add(d).add(m).divideScalar(3);let _=x(g);b(p,T+0,u,_),b(v,T+2,d,_),b(y,T+4,m,_)}for(let w=0;w<a.length;w+=6){let T=a[w+0],_=a[w+2],A=a[w+4],S=Math.max(T,_,A),D=Math.min(T,_,A);S>.9&&D<.1&&(T<.2&&(a[w+0]+=1),_<.2&&(a[w+2]+=1),A<.2&&(a[w+4]+=1))}function x(w){return Math.atan2(w.z,-w.x)}function M(w){return Math.atan2(-w.y,Math.sqrt(w.x*w.x+w.z*w.z))}}}static fromJSON(t){return new wu(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}},WL=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:Math.abs((s=i.depth)!=null?s:i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:o}=t.parameters,a=r===0&&s!==0?new Hg(e*.5,s,o):new jh(e*.5,r);return a.scale(1,i/e,n/e),Object.assign(a,{userData:{...t,type:"DodecahedronGeometry"}})}},Hg=class extends wu{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
vendor: 5,696 bytes, line 3113
311319,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a="DodecahedronGeometry";super(s,o,a,t,e,i),this.type=a}static fromJSON(t){return new Hg(t.radius,t.corner,t.cornerSides)}},wh=Math.PI*2;function bc({x:t,y:e},i,n,r,s){return{x:t*i+r,y:e*n+s}}function jL(t,e){let i=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),n=Math.cos(t),r=Math.sin(t),s=Math.cos(t+e),o=Math.sin(t+e);return[{x:n-r*i,y:r+n*i},{x:s+o*i,y:o-s*i},{x:s,y:o}]}function _p(t,e,i,n){let r=t*n-e*i<0?-1:1,s=Math.min(1,Math.max(-1,t*i+e*n));return r*Math.acos(s)}function qL(t,e,i,n,r,s,o,a,l,h){let f=Math.pow(r,2),c=Math.pow(s,2),u=Math.pow(o,2),d=Math.pow(a,2),m=f*c-f*d-c*u;m<0&&(m=0),m/=f*d+c*u,m=Math.sqrt(m)*(l===h?-1:1);let g=m*r/s*a,p=m*-s/r*o,v=g+(t+i)/2,y=p+(e+n)/2,b=(o-g)/r,x=(a-p)/s,M=(-o-g)/r,w=(-a-p)/s,T=_p(1,0,b,x),_=_p(b,x,M,w);return!h&&_>0&&(_-=wh),h&&_<0&&(_+=wh),{centerx:v,centery:y,ang1:T,ang2:_}}function XL({px:t,py:e,cx:i,cy:n,rx:r,ry:s,largeArcFlag:o,sweepFlag:a}){let l=[];if(r===0||s===0)return[];let h=(t-i)/2,f=(e-n)/2;if(h===0&&f===0)return[];r=Math.abs(r),s=Math.abs(s);let c=Math.pow(h,2)/Math.pow(r,2)+Math.pow(f,2)/Math.pow(s,2);c>1&&(r*=Math.sqrt(c),s*=Math.sqrt(c));let u=qL(t,e,i,n,r,s,h,f,o,a),{ang1:d,ang2:m}=u,{centerx:g,centery:p}=u,v=Math.abs(m)/(wh/4);Math.abs(1-v)<1e-7&&(v=1);let y=Math.max(Math.ceil(v),1);m/=y;for(let b=0;b<y;b++)l.push(jL(d,m)),d+=m;return l.map(b=>{let{x,y:M}=bc(b[0],r,s,g,p),{x:w,y:T}=bc(b[1],r,s,g,p),{x:_,y:A}=bc(b[2],r,s,g,p);return{x1:x,y1:M,x2:w,y2:T,x:_,y:A}})}var Wg=Math.PI*2,YL=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return{shape:t.shape&&t.shape instanceof Ot?t.shape:new Ot,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:Math.abs((s=i.depth)!=null?s:0)})}}static build(t){let{width:e,height:i,spikes:n,angle:r,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}=t.parameters,h=t.shape,f=e*.5,c=i*.5,u=$L(h,f,c,r*Math.PI/180,n,s);h.isClosed=!0,h.update();let d=On.create({shape:h,parameters:{subdivisions:u,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(d,{userData:{...t,type:"EllipseGeometry"}})}};function $L(t,e,i,n,r,s){if(n>=Wg)return r>30||r%4===0?(JL(t,e,i,s),Math.round(r/4)):bp(t,n,r,e,i,s);let o={x:0,y:i},a=n+Math.PI*.5,l={x:Math.cos(a)*e,y:Math.sin(a)*i},h=XL({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:e,ry:i,largeArcFlag:n>Math.PI,sweepFlag:!0});return r>30||r%h.length===0?ZL(t,o.x,o.y,h,r,e,i,s):bp(t,n,r,e,i,s)}function ZL(t,e,i,n,r,s,o,a){let l=Math.round(r/n.length);t.addPoint(ws(e,i));for(let h=0,f=n.length;h<f;h++){let c=n[h],u=t.points[h],d=ws(c.x,c.y);u.controls[1].position.set(c.x1,c.y1),d.controls[0].position.set(c.x2,c.y2),t.addPoint(d)}return a>0?jg(t,s,o,a):t.addPoint(ws(0,0)),l}function bp(t,e,i,n,r,s){let o=-e/i;for(let a=0;a<=i;a++){let l=o*a,h=Math.sin(l)*n,f=Math.cos(l)*r;t.addPoint(ws(h,f))}return e<Wg?s>0?jg(t,n,r,s):t.addPoint(ws(0,0)):(t.removePoint(t.points[t.points.length-1]),s>0&&qg(t,n,r,s)),1}function JL(t,e,i,n=0,r=0,s=0){let o=.5522847498,a=e*o,l=i*o;t.addPoint(wa(r-e,s,r-e,s-l,r-e,s+l)),t.addPoint(wa(r,s+i,r-a,s+i,r+a,s+i)),t.addPoint(wa(r+e,s,r+e,s+l,r+e,s-l)),t.addPoint(wa(r,s-i,r+a,s-i,r-a,s-i)),n>0&&qg(t,e,i,n)}function ws(t,e){return new bs(At.generateUUID(),new Z(t,e))}function wa(t,e,i,n,r,s){let o=ws(t,e);return o.controls[0].position.set(i,n),o.controls[1].position.set(r,s),o}function jg(t,e,i,n){Xg(t,e,i,n).forEach(r=>t.addPoint(r))}function qg(t,e,i,n){let r=Xg(t,e,i,n),s=new Ot;r.forEach(o=>s.addPoint(o)),s.isClosed=!0,t.shapeHoles.push(s)}function Xg(t,e,i,n){let r=n*e/100,s=r*(Math.abs(i)/Math.abs(e)),o=new Z(r/e,s/i),a=t.points.map(l=>{let h=l.clone();return h.uuid=At.generateUUID(),h}).reverse();return a.forEach(l=>{l.position.multiply(o);let h=l.controls[0].position.clone().multiply(o),f=l.controls[1].position.clone().multiply(o);l.controls[0].position.copy(f),l.controls[1].position.copy(h)}),a}var KL=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var a,l,h;let i=Object.assign({},(a=e==null?void 0:e.parameters)!=null?a:{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),n=Math.abs(i.width),r=Math.abs((l=i.height)!=null?l:n),s=Math.abs((h=i.depth)!=null?h:n),o=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(i,{width:n,height:r,depth:s,radius:o,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:n,radius:r,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:h,cornerRadius:f,cornerSegments:c}=t.parameters,u=new Yg(!1,e,i,n,r,s,o,a,l,h,f,c);return Object.assign(u,{userData:{...t,type:"HelixGeometry"}})}},Yg=class extends We{constructor(t=!0,e=1,i=1,n=1,r=1,s=1,o=1,a=1,l=1,h=1,f=1,c=1){super();let u=t&&s===1;u&&(c=0),f>100&&(f=100);let d=()=>new E,m=new E,g=d(),p=d(),v=d(),y,b,x,M,w,T,_,A,S=d(),D=d(),O=d(),z=d(),I=d(),H=d(),ee=d(),G=d(),B=i-2*a+.001,N=B/s,R=Math.ceil(o*s),k=R+1,F=B/R,U=-B/2,W=h+1,ie=2*Math.PI/h,V=Math.PI/2/c,K=.01,Y=Math.min((1-f/100)*a,a-K),J=a-Y,Q=0,he=2,de=c*he+he,ae=W*de/he,ve=ae+W*k,pe=W*(k+de),[me,De,Se]=[3,3,2].map(_e=>Array(pe*_e).fill(0)),Me=[],vt=r-a;function Ue(_e,Ce){let Ae=Math.PI/2;T=Ce*F,A=2*Math.PI*(T%N)/N+Ae,T+=U,_=Math.sin(A)*vt,w=Math.cos(A)*vt,t?_e.set(w,_,T):_e.set(w,T,_)}
3113Ue(m,-1e-10),Ue(g,0),S.copy(m),Ue(m,1);let P=m.distanceTo(g),C=J+Y,re=P*R+2*C,fe=Y,ye=re-C;for(let _e=0;_e<=R;_e++){Ue(p,_e),G.subVectors(p,S).normalize(),S.copy(p),H.copy(p).setComponent(+t+1,0).normalize(),ee.crossVectors(G,H).normalize();let Ce=_e===0,Ae=_e===R,je=Ce?3*Math.PI/2:V,nt=Ce?fe:ye,_t=Ce?W:ve,j=Ce?0:pe-W,Te=G.clone().multiplyScalar(Ce?-J:J).add(p),se=G.clone().multiplyScalar(Ce?-1:1).normalize();for(let be=0;be<W;be++){let ue=be*ie;if(D.addVectors(m.copy(H).multiplyScalar(a*Math.cos(ue)),g.copy(ee).multiplyScalar(a*Math.sin(ue))),O.copy(D).normalize(),Ce||Ae){u||(Q=j+be,[0,1,2].forEach(xe=>{me[Q*3+xe]=Te.getComponent(xe),De[Q*3+xe]=se.getComponent(xe)}),Se[Q*2]=+Ae,Se[Q*2+1]=be/h),g.copy(O).multiplyScalar(Y),v.addVectors(p,g);for(let xe=0;xe<c;xe++){let Oe=xe*V+je;z.addVectors(m.copy(G).multiplyScalar(J*Math.sin(Oe)),g.copy(O).multiplyScalar(J*Math.cos(Oe))),I.copy(z).normalize(),g.addVectors(v,z),z.normalize(),Q=_t+xe*W+be,[0,1,2].forEach(Ze=>{me[Q*3+Ze]=g.getComponent(Ze),De[Q*3+Ze]=I.getComponent(Ze)});let ze=+Ce+Math.sin(Oe);Se[Q*2]=(nt+J*ze)/re,Se[Q*2+1]=be/h}}g.addVectors(p,D),Q=ae+_e*W+be,[0,1,2].forEach(xe=>{me[Q*3+xe]=g.getComponent(xe),De[Q*3+xe]=O.getComponent(xe)}),Se[Q*2]=(C+_e*P)/re,Se[Q*2+1]=be/h}}let we=k+2*c+he,Ve=1,[ne,Ie]=u?[Ve,Ve+k-1]:[0,we-1];for(let _e=ne;_e<=Ie-1;_e++){let Ce=u&&_e===Ie-1;for(let Ae=0;Ae<W-1;Ae++)y=_e*W+Ae,b=y+1,x=(Ce?Ae:y)+W,M=(Ce?Ae+1:b)+W,_e===0?Me.push(b,M,x):_e===we-2?Me.push(y,b,x):Me.push(y,b,x,b,M,x)}this.setIndex(Me),this.setAttribute("position",new Pe(me,3)),this.setAttribute("normal",new Pe(De,3)),this.setAttribute("uv",new Pe(Se,2))}},QL=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:Math.abs((s=i.depth)!=null?s:i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:o}=t.parameters,a=r===0&&s!==0?new $g(e*.5,s,o):new Xh(e*.5,r);return a.scale(1,i/e,n/e),Object.assign(a,{userData:{...t,type:"IcosahedronGeometry"}})}},$g=class extends wu{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],o="IcosahedronGeometry";super(r,s,o,t,e,i),this.type=o}static fromJSON(t){return new $g(t.radius,t.corner,t.cornerSides)}},eP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s,o,a;((r=(n=t.parameters)==null?void 0:n.points)!=null?r:[]).forEach(l=>{Array.isArray(l)&&(l.x=l[0],l.y=l[1])});let i=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((o=i.height)!=null?o:i.width),depth:Math.abs((a=i.depth)!=null?a:i.width)})}}static build(t){let{points:e,segments:i,verticalSegments:n}=t.parameters,r=new Ba;r.moveTo(e[0].x,e[0].y),r.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new Hh(r.extractPoints(n).shape,i);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...t,type:"LatheGeometry"}})}},Ji=new Ye,wc=new gt,Sa=new E,Qa=class extends In{constructor(){super(),this.uuid=At.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}applyMatrix4(t){let e=new qt().getNormalMatrix(t);for(let i=0,n=this.vertices.length;i<n;i++)this.vertices[i].applyMatrix4(t);for(let i=0,n=this.faces.length;i<n;i++){let r=this.faces[i];
3113r.normal.applyMatrix3(e).normalize();for(let s=0,o=r.vertexNormals.length;s<o;s++)r.vertexNormals[s].applyMatrix3(e).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this}rotateX(t){return Ji.makeRotationX(t),this.applyMatrix4(Ji),this}rotateY(t){return Ji.makeRotationY(t),this.applyMatrix4(Ji),this}rotateZ(t){return Ji.makeRotationZ(t),this.applyMatrix4(Ji),this}translate(t,e,i){return Ji.makeTranslation(t,e,i),this.applyMatrix4(Ji),this}scale(t,e,i){return Ji.makeScale(t,e,i),this.applyMatrix4(Ji),this}lookAt(t){return wc.lookAt(t),wc.updateMatrix(),this.applyMatrix4(wc.matrix),this}fromBufferGeometry(t){let e=this,i=t.index!==null?t.index:void 0,n=t.attributes;if(n.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;let r=n.position,s=n.normal,o=n.color,a=n.uv,l=n.uv2;l!==void 0&&(this.faceVertexUvs[1]=[]);for(let c=0;c<r.count;c++)e.vertices.push(new E().fromBufferAttribute(r,c)),o!==void 0&&e.colors.push(new Xe().fromBufferAttribute(o,c));function h(c,u,d,m){let g=o===void 0?[]:[e.colors[c].clone(),e.colors[u].clone(),e.colors[d].clone()],p=s===void 0?[]:[new E().fromBufferAttribute(s,c),new E().fromBufferAttribute(s,u),new E().fromBufferAttribute(s,d)],v=new Sh(c,u,d,p,g,m);e.faces.push(v),a!==void 0&&e.faceVertexUvs[0].push([new Z().fromBufferAttribute(a,c),new Z().fromBufferAttribute(a,u),new Z().fromBufferAttribute(a,d)]),l!==void 0&&e.faceVertexUvs[1].push([new Z().fromBufferAttribute(l,c),new Z().fromBufferAttribute(l,u),new Z().fromBufferAttribute(l,d)])}let f=t.groups;if(f.length>0)for(let c=0;c<f.length;c++){let u=f[c],d=u.start,m=u.count;for(let g=d,p=d+m;g<p;g+=3)i!==void 0?h(i.getX(g),i.getX(g+1),i.getX(g+2),u.materialIndex):h(g,g+1,g+2,u.materialIndex)}else if(i!==void 0)for(let c=0;c<i.count;c+=3)h(i.getX(c),i.getX(c+1),i.getX(c+2));else for(let c=0;c<r.count;c+=3)h(c,c+1,c+2);return this.computeFaceNormals(),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Sa).negate(),this.translate(Sa.x,Sa.y,Sa.z),this}normalize(){this.computeBoundingSphere();let t=this.boundingSphere.center,e=this.boundingSphere.radius,i=e===0?1:1/e,n=new Ye;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix4(n),this}computeFaceNormals(){let t=new E,e=new E;for(let i=0,n=this.faces.length;i<n;i++){let r=this.faces[i],s=this.vertices[r.a],o=this.vertices[r.b],a=this.vertices[r.c];t.subVectors(a,o),e.subVectors(s,o),t.cross(e),t.normalize(),r.normal.copy(t)}}computeVertexNormals(t=!0){let e=new Array(this.vertices.length);for(let i=0,n=this.vertices.length;i<n;i++)e[i]=new E;if(t){let i=new E,n=new E;for(let r=0,s=this.faces.length;r<s;r++){let o=this.faces[r],a=this.vertices[o.a],l=this.vertices[o.b],h=this.vertices[o.c];i.subVectors(h,l),n.subVectors(a,l),i.cross(n),e[o.a].add(i),e[o.b].add(i),e[o.c].add(i)}}else{this.computeFaceNormals();for(let i=0,n=this.faces.length;i<n;i++){let r=this.faces[i];e[r.a].add(r.normal),e[r.b].add(r.normal),e[r.c].add(r.normal)}}for(let i=0,n=this.vertices.length;i<n;i++)e[i].normalize();for(let i=0,n=this.faces.length;i<n;i++){let r=this.faces[i],s=r.vertexNormals;s.length===3?(s[0].copy(e[r.a]),s[1].copy(e[r.b]),s[2].copy(e[r.c])):(s[0]=e[r.a].clone(),s[1]=e[r.b].clone(),s[2]=e[r.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let t=0,e=this.faces.length;t<e;t++){let i=this.faces[t],n=i.vertexNormals;n.length===3?(n[0].copy(i.normal),n[1].copy(i.normal),n[2].copy(i.normal)):(n[0]=i.normal.clone(),n[1]=i.normal.clone(),n[2]=i.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let e=0,i=this.faces.length;e<i;e++){let n=this.faces[e];
3113n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]);for(let r=0,s=n.vertexNormals.length;r<s;r++)n.__originalVertexNormals[r]?n.__originalVertexNormals[r].copy(n.vertexNormals[r]):n.__originalVertexNormals[r]=n.vertexNormals[r].clone()}let t=new Qa;t.faces=this.faces;for(let e=0,i=this.morphTargets.length;e<i;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];let r=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(let o=0,a=this.faces.length;o<a;o++){let l=new E,h={a:new E,b:new E,c:new E};r.push(l),s.push(h)}}let n=this.morphNormals[e];t.vertices=this.morphTargets[e].vertices,t.computeFaceNormals(),t.computeVertexNormals();for(let r=0,s=this.faces.length;r<s;r++){let o=this.faces[r],a=n.faceNormals[r],l=n.vertexNormals[r];a.copy(o.normal),l.a.copy(o.vertexNormals[0]),l.b.copy(o.vertexNormals[1]),l.c.copy(o.vertexNormals[2])}}for(let e=0,i=this.faces.length;e<i;e++){let n=this.faces[e];
3113n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Xi),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new cn),this.boundingSphere.setFromPoints(this.vertices)}merge(t,e,i=0){if(!(t&&t.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);return}let n,r=this.vertices.length,s=this.vertices,o=t.vertices,a=this.faces,l=t.faces,h=this.colors,f=t.colors;e!==void 0&&(n=new qt().getNormalMatrix(e));for(let c=0,u=o.length;c<u;c++){let d=o[c].clone();e!==void 0&&d.applyMatrix4(e),s.push(d)}for(let c=0,u=f.length;c<u;c++)h.push(f[c].clone());for(let c=0,u=l.length;c<u;c++){let d=l[c],m,g,p=d.vertexNormals,v=d.vertexColors,y=new Sh(d.a+r,d.b+r,d.c+r);y.normal.copy(d.normal),n!==void 0&&y.normal.applyMatrix3(n).normalize();for(let b=0,x=p.length;b<x;b++)m=p[b].clone(),n!==void 0&&m.applyMatrix3(n).normalize(),y.vertexNormals.push(m);y.color.copy(d.color);for(let b=0,x=v.length;b<x;b++)g=v[b],y.vertexColors.push(g.clone());y.materialIndex=d.materialIndex+i,a.push(y)}for(let c=0,u=t.faceVertexUvs.length;c<u;c++){let d=t.faceVertexUvs[c];this.faceVertexUvs[c]===void 0&&(this.faceVertexUvs[c]=[]);for(let m=0,g=d.length;m<g;m++){let p=d[m],v=[];for(let y=0,b=p.length;y<b;
3113y++)v.push(p[y].clone());this.faceVertexUvs[c].push(v)}}}mergeMesh(t){if(!(t&&t.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t);return}t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)}mergeVertices(t=4){let e={},i=[],n=[],r=Math.pow(10,t);for(let a=0,l=this.vertices.length;a<l;a++){let h=this.vertices[a],f=Math.round(h.x*r)+"_"+Math.round(h.y*r)+"_"+Math.round(h.z*r);e[f]===void 0?(e[f]=a,i.push(this.vertices[a]),n[a]=i.length-1):n[a]=n[e[f]]}let s=[];for(let a=0,l=this.faces.length;a<l;a++){let h=this.faces[a];h.a=n[h.a],h.b=n[h.b],h.c=n[h.c];let f=[h.a,h.b,h.c];for(let c=0;c<3;c++)if(f[c]===f[(c+1)%3]){s.push(a);break}}for(let a=s.length-1;a>=0;a--){let l=s[a];this.faces.splice(l,1);for(let h=0,f=this.faceVertexUvs.length;h<f;h++)this.faceVertexUvs[h].splice(l,1)}let o=this.vertices.length-i.length;return this.vertices=i,o}setFromPoints(t){this.vertices=[];for(let e=0,i=t.length;e<i;e++){let n=t[e];this.vertices.push(new E(n.x,n.y,n.z||0))}return this}sortFacesByMaterialIndex(){let t=this.faces,e=t.length;for(let a=0;a<e;a++)t[a]._id=a;function i(a,l){return a.materialIndex-l.materialIndex}t.sort(i);let n=this.faceVertexUvs[0],r=this.faceVertexUvs[1],s,o;n&&n.length===e&&(s=[]),r&&r.length===e&&(o=[]);for(let a=0;a<e;a++){let l=t[a]._id;s&&s.push(n[l]),o&&o.push(r[l])}s&&(this.faceVertexUvs[0]=s),o&&(this.faceVertexUvs[1]=o)}toJSON(){let t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),this.parameters!==void 0){let d=this.parameters;for(let m in d)d[m]!==void 0&&(t[m]=d[m]);return t}let e=[];for(let d=0;d<this.vertices.length;d++){let m=this.vertices[d];e.push(m.x,m.y,m.z)}let i=[],n=[],r={},s=[],o={},a=[],l={};for(let d=0;d<this.faces.length;d++){let m=this.faces[d],g=!0,p=!1,v=this.faceVertexUvs[0][d]!==void 0,y=m.normal.length()>0,b=m.vertexNormals.length>0,x=m.color.r!==1||m.color.g!==1||m.color.b!==1,M=m.vertexColors.length>0,w=0;if(w=h(w,0,0),w=h(w,1,g),w=h(w,2,p),w=h(w,3,v),w=h(w,4,y),w=h(w,5,b),w=h(w,6,x),w=h(w,7,M),i.push(w),i.push(m.a,m.b,m.c),i.push(m.materialIndex),v){let T=this.faceVertexUvs[0][d];i.push(u(T[0]),u(T[1]),u(T[2]))}if(y&&i.push(f(m.normal)),b){let T=m.vertexNormals;i.push(f(T[0]),f(T[1]),f(T[2]))}if(x&&i.push(c(m.color)),M){let T=m.vertexColors;i.push(c(T[0]),c(T[1]),c(T[2]))}}function h(d,m,g){return g?d|1<<m:d&~(1<<m)}function f(d){let m=d.x.toString()+d.y.toString()+d.z.toString();return r[m]!==void 0||(r[m]=n.length/3,n.push(d.x,d.y,d.z)),r[m]}function c(d){let m=d.r.toString()+d.g.toString()+d.b.toString();return o[m]!==void 0||(o[m]=s.length,s.push(d.getHex())),o[m]}function u(d){let m=d.x.toString()+d.y.toString();return l[m]!==void 0||(l[m]=a.length/2,a.push(d.x,d.y)),l[m]}return t.data={},t.data.vertices=e,t.data.normals=n,s.length>0&&(t.data.colors=s),a.length>0&&(t.data.uvs=[a]),t.data.faces=i,t}clone(){return new Qa().copy(this)}copy(t){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;let e=t.vertices;for(let c=0,u=e.length;c<u;c++)this.vertices.push(e[c].clone());let i=t.colors;for(let c=0,u=i.length;c<u;c++)this.colors.push(i[c].clone());let n=t.faces;for(let c=0,u=n.length;c<u;c++)this.faces.push(n[c].clone());for(let c=0,u=t.faceVertexUvs.length;c<u;c++){let d=t.faceVertexUvs[c];this.faceVertexUvs[c]===void 0&&(this.faceVertexUvs[c]=[]);for(let m=0,g=d.length;m<g;m++){let p=d[m],v=[];for(let y=0,b=p.length;y<b;y++){let x=p[y];v.push(x.clone())}this.faceVertexUvs[c].push(v)}}let r=t.morphTargets;for(let c=0,u=r.length;c<u;c++){let d={};if(d.name=r[c].name,r[c].vertices!==void 0){d.vertices=[];for(let m=0,g=r[c].vertices.length;m<g;m++)d.vertices.push(r[c].vertices[m].clone())}if(r[c].normals!==void 0){d.normals=[];for(let m=0,g=r[c].normals.length;m<g;m++)d.normals.push(r[c].normals[m].clone())}this.morphTargets.push(d)}let s=t.morphNormals;for(let c=0,u=s.length;c<u;c++){let d={};if(s[c].vertexNormals!==void 0){d.vertexNormals=[];for(let m=0,g=s[c].vertexNormals.length;m<g;m++){let p=s[c].vertexNormals[m],v={};v.a=p.a.clone(),v.b=p.b.clone(),v.c=p.c.clone(),d.vertexNormals.push(v)}}if(s[c].faceNormals!==void 0){d.faceNormals=[];for(let m=0,g=s[c].faceNormals.length;m<g;m++)d.faceNormals.push(s[c].faceNormals[m].clone())}this.morphNormals.push(d)}let o=t.skinWeights;for(let c=0,u=o.length;c<u;c++)this.skinWeights.push(o[c].clone());let a=t.skinIndices;for(let c=0,u=a.length;c<u;c++)this.skinIndices.push(a[c].clone());let l=t.lineDistances;for(let c=0,u=l.length;c<u;c++)this.lineDistances.push(l[c]);let h=t.boundingBox;h!==null&&(this.boundingBox=h.clone());
3113let f=t.boundingSphere;return f!==null&&(this.boundingSphere=f.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}toBufferGeometry(){let t=new tP().fromGeometry(this),e=new We,i=new Float32Array(t.vertices.length*3);if(e.setAttribute("position",new it(i,3).copyVector3sArray(t.vertices)),t.normals.length>0){let n=new Float32Array(t.normals.length*3);e.setAttribute("normal",new it(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){let n=new Float32Array(t.colors.length*3);e.setAttribute("color",new it(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){let n=new Float32Array(t.uvs.length*2);e.setAttribute("uv",new it(n,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){let n=new Float32Array(t.uvs2.length*2);e.setAttribute("uv2",new it(n,2).copyVector2sArray(t.uvs2))}e.groups=t.groups;for(let n in t.morphTargets){let r=[],s=t.morphTargets[n];for(let o=0,a=s.length;o<a;
3113o++){let l=s[o],h=new Pe(l.data.length*3,3);h.name=l.name,r.push(h.copyVector3sArray(l.data))}e.morphAttributes[n]=r}if(t.skinIndices.length>0){let n=new Pe(t.skinIndices.length*4,4);e.setAttribute("skinIndex",n.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){let n=new Pe(t.skinWeights.length*4,4);e.setAttribute("skinWeight",n.copyVector4sArray(t.skinWeights))}return t.boundingSphere!==null&&(e.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(e.boundingBox=t.boundingBox.clone()),e}computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")}computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}applyMatrix(t){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)}dispose(){this.dispatchEvent({type:"dispose"})}static createBufferGeometryFromObject(t){let e=new We,i=t.geometry;if(t.isPoints||t.isLine){let n=new Pe(i.vertices.length*3,3),r=new Pe(i.colors.length*3,3);if(e.setAttribute("position",n.copyVector3sArray(i.vertices)),e.setAttribute("color",r.copyColorsArray(i.colors)),i.lineDistances&&i.lineDistances.length===i.vertices.length){let s=new Pe(i.lineDistances.length,1);e.setAttribute("lineDistance",s.copyArray(i.lineDistances))}i.boundingSphere!==null&&(e.boundingSphere=i.boundingSphere.clone()),i.boundingBox!==null&&(e.boundingBox=i.boundingBox.clone())}else t.isMesh&&(e=i.toBufferGeometry());return e}};Qa.prototype.isGeometry=!0;var tP=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(t){let e=[],i,n,r,s=t.faces;for(n=0;n<s.length;n++){let o=s[n];o.materialIndex!==r&&(r=o.materialIndex,i!==void 0&&(i.count=n*3-i.start,e.push(i)),i={start:n*3,materialIndex:r})}i!==void 0&&(i.count=n*3-i.start,e.push(i)),this.groups=e}fromGeometry(t){let e=t.faces,i=t.vertices,n=t.faceVertexUvs,r=n[0]&&n[0].length>0,s=n[1]&&n[1].length>0,o=t.morphTargets,a=o.length,l;if(a>0){l=[];for(let p=0;p<a;p++)l[p]={name:o[p].name,data:[]};this.morphTargets.position=l}let h=t.morphNormals,f=h.length,c;if(f>0){c=[];for(let p=0;p<f;p++)c[p]={name:h[p].name,data:[]};this.morphTargets.normal=c}let u=t.skinIndices,d=t.skinWeights,m=u.length===i.length,g=d.length===i.length;i.length>0&&e.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let p=0;p<e.length;p++){let v=e[p];this.vertices.push(i[v.a],i[v.b],i[v.c]);let y=v.vertexNormals;if(y.length===3)this.normals.push(y[0],y[1],y[2]);else{let x=v.normal;this.normals.push(x,x,x)}let b=v.vertexColors;if(b.length===3)this.colors.push(b[0],b[1],b[2]);else{let x=v.color;this.colors.push(x,x,x)}if(r===!0){let x=n[0][p];x!==void 0?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",p),this.uvs.push(new Z,new Z,new Z))}if(s===!0){let x=n[1][p];x!==void 0?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",p),this.uvs2.push(new Z,new Z,new Z))}for(let x=0;x<a;x++){let M=o[x].vertices;l[x].data.push(M[v.a],M[v.b],M[v.c])}for(let x=0;x<f;x++){let M=h[x].vertexNormals[p];c[x].data.push(M.a,M.b,M.c)}m&&this.skinIndices.push(u[v.a],u[v.b],u[v.c]),g&&this.skinWeights.push(d[v.a],d[v.b],d[v.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),this}},Sh=class{constructor(t,e,i,n,r,s=0){this.a=t,this.b=e,this.c=i,this.normal=n&&n.isVector3?n:new E,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new Xe,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=s}clone(){return new this.constructor().copy(this)}copy(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(let e=0,i=t.vertexNormals.length;e<i;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(let e=0,i=t.vertexColors.length;e<i;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}},iP=["a","b","c"];function nP(t,e){switch(e){case"c":return t.c;case"b":return t.b;case"a":default:return t.a}}function Sc(t,e,i){let n=Math.min(t,e),r=Math.max(t,e),s=n+"_"+r;return i.get(s)}function Mc(t,e,i,n,r,s){let o=Math.min(t,e),a=Math.max(t,e),l=o+"_"+a,h;if(n.has(l))h=n.get(l);else{let f=i[o],c=i[a];h={a:f,b:c,newEdge:null,faces:[]},n.set(l,h)}h.faces.push(r),s[t].edges.push(h),s[e].edges.push(h)}function rP(t,e,i,n){let r,s,o;for(r=0,s=t.length;r<s;r++)i[r]={edges:[]};for(r=0,s=e.length;r<s;r++)o=e[r],Mc(o.a,o.b,t,n,o,i),Mc(o.b,o.c,t,n,o,i),Mc(o.c,o.a,t,n,o,i)}function Ma(t,e,i,n,r){t.push(new Sh(e,i,n,void 0,void 0,r))}function as(t,e){return Math.abs(e-t)/2+Math.min(t,e)}
3113function Aa(t,e,i,n){t.push([e.clone(),i.clone(),n.clone()])}var sP=class{constructor(t=1){this.subdivisions=t}modify(t){t instanceof We?t=new Qa().fromBufferGeometry(t):t=t.clone(),t.mergeVertices();let e=this.subdivisions;for(;e-- >0;)this._smooth(t);return t.computeFaceNormals(),t.computeVertexNormals(),t}_smooth(t){let e=new E,i,n,r,s,o,a=t.vertices,l=t.faces,h=t.faceVertexUvs[0],f=h!==void 0&&h.length>0,c=[],u=new Map;rP(a,l,c,u);let d=[],m,g,p,v,y,b,x;for(let K of Array.from(u.keys())){for(g=u.get(K),p=new E,y=3/8,b=1/8,x=g.faces.length,x!=2&&(y=.5,b=0,x!=1),p.addVectors(g.a,g.b).multiplyScalar(y),e.set(0,0,0),s=0;s<x;s++){for(v=g.faces[s],o=0;o<3&&(m=a[nP(v,iP[o])],!(m!==g.a&&m!==g.b));o++);m&&e.add(m)}e.multiplyScalar(b),p.add(e),g.newEdge=d.length,d.push(p)}let M,w,T,_,A,S,D,O=[];for(n=0,r=a.length;n<r;n++){for(S=a[n],A=c[n].edges,i=A.length,i==3?M=3/16:i>3&&(M=3/(8*i)),w=1-i*Number(M),T=M,i<=2&&(i==2?(w=3/4,T=1/8):i==1||i==0),D=S.clone().multiplyScalar(w),e.set(0,0,0),s=0;s<i;s++)_=A[s],m=_.a!==S?_.a:_.b,e.add(m);e.multiplyScalar(Number(T)),D.add(e),O.push(D)}let z=O.concat(d),I=O.length,H,ee,G,B=[],N=[],R,k,F,U,W=new Z,ie=new Z,V=new Z;for(n=0,r=l.length;n<r;n++)v=l[n],H=Number(Sc(v.a,v.b,u).newEdge)+I,ee=Number(Sc(v.b,v.c,u).newEdge)+I,G=Number(Sc(v.c,v.a,u).newEdge)+I,Ma(B,H,ee,G,v.materialIndex),Ma(B,v.a,H,G,v.materialIndex),Ma(B,v.b,ee,H,v.materialIndex),Ma(B,v.c,G,ee,v.materialIndex),f&&(R=h[n],k=R[0],F=R[1],U=R[2],W.set(as(k.x,F.x),as(k.y,F.y)),ie.set(as(F.x,U.x),as(F.y,U.y)),V.set(as(k.x,U.x),as(k.y,U.y)),Aa(N,W,ie,V),Aa(N,k,W,V),Aa(N,F,ie,W),Aa(N,U,V,ie));t.vertices=z,t.faces=B,f&&(t.faceVertexUvs[0]=N)}},kt=new E,oP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var s,o;let i=(o=(s=t.geometry)!=null?s:e==null?void 0:e.geometry)!=null?o:new We().copy(new Dn(100,100,100)),n;e===void 0?(i.computeBoundingBox(),i.boundingBox.getSize(kt),n={width:kt.x,height:kt.y,depth:kt.z,subdivisions:0}):n=e.parameters;let r={...n,...t.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:i}}static build(t){var l;let{width:e,height:i,depth:n,subdivisions:r}=t.parameters,s=(l=t.geometry)!=null?l:new We().copy(new Dn(100,100,100)),o=s.userData.parameters;o===void 0?(s.computeBoundingBox(),s.boundingBox.getSize(kt)):kt.set(o.width,o.height,o.depth),(e!==kt.x||i!==kt.y||n!==kt.z)&&s.scale(kt.x===0?1:e/kt.x,kt.y===0?1:i/kt.y,kt.z===0?1:n/kt.z);let a=s.originalGeometry;return r>0?(a===void 0||(o==null?void 0:o.subdivisions)!==r)&&(a===void 0&&(a=s),s=new sP(r).modify(a).toBufferGeometry()):(a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()),a!==void 0&&Object.assign(s,{originalGeometry:a}),delete t.geometry,Object.assign(s,{userData:{...t,type:"NonParametricGeometry"}})}static loadFromUrl(t,e,i){new Tm(i).load(t,n=>{let r=this.normalizeInputs({geometry:n});n.boundingBox.getSize(kt);let s=100/kt.x;Object.assign(r.parameters,{width:100,height:kt.y*s,depth:kt.z*s}),e(this.build(r))})}},aP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},t.parameters);return{shape:t.shape&&t.shape instanceof Ot?t.shape:new Ot,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:Math.abs((s=i.depth)!=null?s:0)})}}static build(t){let{width:e,height:i,spikes:n,cornerRadius:r,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}=t.parameters,l=t.shape,h=e*.5,f=i*.5,c=0,u=0,d=2*Math.PI/n;for(let g=0;g<n;g++){let p=d*g,v=c+Math.sin(p)*h,y=u+Math.cos(p)*f;l.addPoint(l.createPoint(v,y))}l.isClosed=!0;for(let g=0,p=l.points.length;g<p;g++)l.points[g].roundness=r;l.roundness=r,l.update();let m=On.create({shape:l,parameters:{roundness:r,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}});return Object.assign(m,{userData:{...t,type:"PolygonGeometry"}})}},lP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:Math.abs((s=i.depth)!=null?s:i.width)})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,heightSegments:s,openEnded:o,cornerRadius:a,cornerSegments:l}=t.parameters,h=new hP(e*.5,i,r,s,o,a,l);return h.scale(1,1,n/e),Object.assign(h,{userData:{...t,type:"PyramidGeometry"}})}};
vendor: 10,110 bytes, line 3113
3113function eo(t,e,i){i.x=t.x*e.x,i.y=t.y,i.z=t.x*e.y}function Ac(t,e,i,n,r,s){let o=e.clone().sub(t),a=i.clone().sub(t),l=o.angleTo(a);if(o.normalize(),a.normalize(),n===r){let h=o.add(a).normalize();s.copy(t).addScaledVector(h,n/Math.sin(l/2))}else{let h=o.angleTo(a);s.copy(t),s.addScaledVector(o,r/Math.sin(h)),s.addScaledVector(a,n/Math.sin(h))}}function cP(t,e,i){let n=t.clone().sub(e),r=i.clone().sub(e);return n.projectOnVector(r),n.add(e)}var hP=class extends We{constructor(t=.5,e=1,i=4,n=1,r=!1,s=0,o=4){super(),i=Math.floor(Math.max(3,i)),n=Math.floor(n),o=Math.floor(o);let a=[],l=[],h=[],f=[],c=0,u=e/2,d=Math.PI/i,m=t*Math.cos(Math.PI/i),g=2*Math.PI/i,p=(i-2)*Math.PI/i,v=Math.PI-p,y=new E(0,-u,0),b=new E(0,u,0),x=new Z(t,-u),M=new Z(m,-u),w=new Z(0,b.y).sub(M),T=new Z(0,b.y).sub(x),_=new Z(w.y,-w.x).normalize(),A=new Z(T.y,-T.x).normalize(),S=t*Math.cos(Math.PI/i)*Math.tan((Math.PI-w.angle())/2)-1e-8;s=Math.min(s,S);let D;{let G=new E(_.x,_.y,0),B=new E(Math.cos(g)*G.x,G.y,Math.sin(g)*G.x);D=G.angleTo(B)}let O=s/Math.tan((Math.PI-w.angle())/2),z=s/Math.tan((Math.PI-D)/2),I=new E;if(!r){l.push(y.x,y.y,y.z),h.push(0,-1,0),f.push(0,0);let G=c++,B=[],N=x.clone(),R=O/Math.cos(Math.PI/i);N.x-=R;for(let k=0;k<i;k++){let F=k/i*Math.PI*2+d,U=new Z(Math.sin(F),Math.cos(F));eo(N,U,I),l.push(I.x,I.y,I.z),h.push(0,-1,0),f.push(0,0),B.push(c++)}for(let k=0;k<B.length;k++)a.push(B[k],G,B[(k+1)%B.length])}{let G=new E,B=new E,N=new E,R=new E,k=new E,F=new E;for(let U=0;U<i;U++){let W=U/i*Math.PI*2+d,ie=(U+.5)/i*Math.PI*2+d,V=(U+1)/i*Math.PI*2+d,K=new Z(Math.sin(W),Math.cos(W)),Y=new Z(Math.sin(ie),Math.cos(ie)),J=new Z(Math.sin(V),Math.cos(V));eo(x,K,B),eo(x,J,N),eo(_,Y,G),Ac(b,B,N,z,z,R),l.push(R.x,R.y,R.z),Ac(B,b,N,z,O,k),l.push(k.x,k.y,k.z),Ac(N,B,b,O,z,F),l.push(F.x,F.y,F.z),h.push(G.x,G.y,G.z),h.push(G.x,G.y,G.z),h.push(G.x,G.y,G.z),f.push(0,0),f.push(0,0),f.push(0,0);let Q=c++,he=c++,de=c++;if(a.push(Q,he,de),s>0){{let pe=B.clone().add(N).multiplyScalar(.5),me=b.clone().sub(pe).normalize(),De=y.clone().sub(pe).normalize().add(me).normalize().multiplyScalar(-1),Se=F.clone().sub(k);H(pe,Se,De,w.angle())}let ae,ve;{let pe=new E;eo(A,J,pe);let me=F.clone().add(R).multiplyScalar(.5);me=cP(me,N,b);let De=F.clone().sub(R);[ae,ve]=H(me,De,pe,D,R.y)}{let pe=ae,me=pe.clone().setY(0).normalize(),De=new E(0,-1,0),Se=me.clone().cross(De);ee(pe,me,De,Se)}{let pe=w.angle(),me=Math.PI-pe,De=b.clone();De.y-=s/Math.sin(pe-Math.PI/2);let Se=new E,Me=[];for(let Ue=0;Ue<o;Ue++){let P=[],C=Math.PI/2-me*Ue/o,re=Math.cos(C),fe=Math.sin(C),ye=ie;for(let we=0;we<=Ue;we++){let Ve=Math.cos(ye),ne=Math.sin(ye);G.x=re*ne,G.y=fe,G.z=re*Ve,Se.copy(De).addScaledVector(G,s),l.push(Se.x,Se.y,Se.z),h.push(G.x,G.y,G.z),f.push(0,0),P.push(c++),ye+=Math.PI*2/Ue/i}Me.push(P)}ve.reverse(),Me.push(ve);let vt=Me.length-1;for(let Ue=0;Ue<vt;Ue++){let P=Me[Ue],C=Me[Ue+1],re=P.length-1;a.push(C[1],P[0],C[0]);for(let fe=1;fe<=re;fe++)a.push(P[fe],P[fe-1],C[fe]),a.push(C[fe+1],P[fe],C[fe])}}}}}this.setIndex(a),this.setAttribute("position",new Pe(l,3)),this.setAttribute("normal",new Pe(h,3)),this.setAttribute("uv",new Pe(f,2));function H(G,B,N,R,k){let F=-R/2,U=(Math.PI-R)/2,W=B.clone().normalize().cross(N);G.addScaledVector(N,-s/Math.sin(U));let ie=new E,V=new E,K=1,Y=c,J=[];for(let Q=0;Q<=o;Q++){let he=F+Q/o*R;V.set(0,0,0),V.addScaledVector(W,Math.sin(he)),V.addScaledVector(N,Math.cos(he));for(let de=0;de<=K;de++){let ae=de/K-.5;if(ie.copy(G),ie.addScaledVector(B,ae),ie.addScaledVector(V,s),k!=null){let ve=Math.max(0,ie.y-k);ie.addScaledVector(B,-ve/B.y)}l.push(ie.x,ie.y,ie.z),h.push(V.x,V.y,V.z),f.push(0,0),de===0&&J.push(c),c++}}for(let Q=0;Q<o;Q++)for(let he=0;he<K;he++){let de=Y+he+(K+1)*Q,ae=de+(K+1),ve=ae+1,pe=de+1;a.push(de,ae,pe),a.push(ae,ve,pe)}return[G.clone().addScaledVector(B,.5),J]}function ee(G,B,N,R){let k=Math.PI/2,F=T.angle()-k,U=[],W=new E,ie=new E;for(let K=0;K<=o;K++){let Y=[],J=K/o;for(let Q=0;Q<=K;Q++){let he=((K?Q/K:0)-.5)*v,de=Math.cos(he),ae=Math.sin(he),ve=Math.atan(Math.tan(F)*de),pe=(k+ve)*J,me=Math.cos(pe),De=Math.sin(pe);W.set(0,0,0),W.addScaledVector(B,De*de),W.addScaledVector(N,me),W.addScaledVector(R,De*ae),ie.copy(G).addScaledVector(W,s),l.push(ie.x,ie.y,ie.z),h.push(W.x,W.y,W.z),f.push(0,0),Y.push(c++)}U.push(Y)}let V=U.length-1;for(let K=0;K<V;K++){let Y=U[K],J=U[K+1],Q=Y.length-1;a.push(Y[0],J[1],J[0]);for(let he=1;he<=Q;he++)a.push(Y[he-1],Y[he],J[he]),a.push(Y[he],J[he+1],J[he])}}}},uP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var r,s,o,a;let i=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters),n=Object.assign((s=e==null?void 0:e.ui)!=null?s:{enabledIndieCorners:!1},t.ui);return{shape:t.shape&&t.shape instanceof Ot?t.shape:new Ot,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((o=i.height)!=null?o:i.width),depth:Math.abs((a=i.depth)!=null?a:0)}),ui:n}}static build(t){let e=t.shape,{width:i,height:n,cornerRadius:r,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}=t.parameters,h={x:i*.5,y:n*.5},f={x:-h.x,y:-h.y},c={x:h.x,y:h.y};function u(x,M,w){return M>i&&w>n?Math.min(x*i/M,x*n/w):M>i?x*i/M:w>n?x*n/w:x}let d=[];d[0]=r[0]===0?0:u(r[0],r[0]+r[3],r[0]+r[1]),d[1]=r[1]===0?0:u(r[1],r[1]+r[2],r[1]+r[0]),d[2]=r[2]===0?0:u(r[2],r[2]+r[1],r[2]+r[3]),d[3]=r[3]===0?0:u(r[3],r[3]+r[0],r[3]+r[2]);let m=f.x,g=c.x,p=c.y,v=f.y;e.addPoint(e.createPoint(m,p)),e.addPoint(e.createPoint(g,p)),e.addPoint(e.createPoint(g,v)),e.addPoint(e.createPoint(m,v)),e.isClosed=!0;let y=!0;for(let x=0,M=e.points.length;x<M;x++)e.points[x].roundness=d[x],x>0&&d[x]!==d[x-1]&&(y=!1);y&&(e.roundness=d[0]),e.useCubicForRoundedCorners=s!==1,e.update();let b=On.create({shape:e,parameters:{depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(b,{userData:{...t,type:"RectangleGeometry"}})}},dP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:Math.PI},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:Math.abs((s=i.depth)!=null?s:i.width)})}}static build(t){let{width:e=100,height:i=e,depth:n=e,widthSegments:r=64,heightSegments:s=64,phiStart:o,phiLength:a,thetaStart:l,thetaLength:h}=t.parameters,f=new cl(.5*e,r,s,o,a,l,h);return f.scale(1,i/e,n/e),Object.assign(f,{userData:{...t,type:"SphereGeometry"}})}},fP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,widthSegments:8,heightSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:0})}}static build(t){let{width:e=100,height:i=e,widthSegments:n=8,heightSegments:r=8}=t.parameters,s=new Ro(e,i,n,r);return s.scale(1,1,1),Object.assign(s,{userData:{...t,type:"PlaneGeometry"}})}},pP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,angle:90,cornerRadius:24,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:Math.abs((s=i.depth)!=null?s:i.width)})}}static build(t){let{width:e,height:i,depth:n,angle:r,cornerRadius:s,cornerSegments:o}=t.parameters,a=new mP(e,i,n,r,s,o);return Object.assign(a,{userData:{...t,type:"BackdropGeometry"}})}},mP=class extends We{constructor(t=1,e=1,i=1,n=90,r=10,s=24){super(),this.type="BackdropGeometry";let o=[],a=[],l=[],h=.001;r==0&&(s=1),s=Math.max(1,Math.floor(s)),r=Math.min(r,100),n=Math.min(180-h,n),n*=Math.PI/180;let f=[],c=Math.PI/2,u=(K=0,Y=0,J=0)=>new E(K,Y,J),d=u(),m=u(),[g,p,v]=[e/2,t/2,i/2],y=-p,b=+p,[x,M,w]=[u(y,-g,+v),u(y,-g,-v),u(y,+g,-v)],T=(K,Y=!1)=>Math.sin(K-Math.PI/(1+ +Y)),_=(K,Y=!1)=>Math.cos(K-Math.PI/(1+ +Y));w.y=Math.sin(n)*e-g;let A=Math.cos(n)*e-v,S=x.z-h;n<=c?(w.z=Math.min(A,S),w.z==S&&(w.y-=(A-S)/Math.tan(c-n))):M.z=Math.min(M.z-A-v,x.z-h),d.subVectors(x,M),m.subVectors(w,M);let D=Math.min(d.length(),m.length())*r/100,O=D*Math.tan(n/2),z=D/Math.cos(n/2),I=d.clone().normalize().add(m.normalize()).setLength(z).add(M);d.set(0,T(n,!0),_(n,!0)),f.push([w,d.clone()]);let H=(Math.PI-n)/s;for(let K=0;K<=s;K++){let Y=c+n+K*H;d.set(0,Math.sin(Y)*O,Math.cos(Y)*O),d.add(I),m.set(0,T(Y),_(Y)),f.push([d.clone(),m.clone()])}f.push([x,u(0,1,0)]);let ee=Math.sin(H/2)*O*2,G=f.length-1,B=f[0][0].distanceTo(f[1][0]),N=f[G-1][0].distanceTo(f[G][0]),R=B+ee*s+N;f[0].push(1);for(let K=0;K<=s;K++)f[K+1].push(1-(B+K*ee)/R);f[G].push(0);let[k,F,U]=f[0],W,ie,V;for(let K=1;K<f.length;K++)[W,ie,V]=f[K],o.push(y,k.y,k.z,y,W.y,W.z,b,k.y,k.z,b,k.y,k.z,y,W.y,W.z,b,W.y,W.z),a.push(0,F.y,F.z,0,ie.y,ie.z,0,F.y,F.z,0,F.y,F.z,0,ie.y,ie.z,0,ie.y,ie.z),l.push(0,U,0,V,1,U,1,U,0,V,1,V),[k,F,U]=[W,ie,V];this.setAttribute("position",new Pe(o,3)),this.setAttribute("normal",new Pe(a,3)),this.setAttribute("uv",new Pe(l,2))}},gP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return{shape:t.shape&&t.shape instanceof Ot?t.shape:new Ot,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:Math.abs((s=i.depth)!=null?s:0)})}}static build(t){let{width:e,height:i,innerRadiusPercent:n,spikes:r,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:h}=t.parameters,f=t.shape,c=e*.5,u=i*.5,d=0,m=0,g=o*Math.PI/360/r,p=Math.PI/2*3*-1,v=c*n/100,y=u*n/100;if(r===3&&n===50){g=2*Math.PI/r;
3113for(let x=0;x<r;x++){let M=g*x,w=d+Math.sin(M)*c,T=m+Math.cos(M)*u;f.addPoint(f.createPoint(w,T))}}else for(let x=0;x<r;x++){let M=d+Math.cos(p)*c,w=m+Math.sin(p)*u;f.addPoint(f.createPoint(M,w)),p+=g,M=d+Math.cos(p)*v,w=m+Math.sin(p)*y,f.addPoint(f.createPoint(M,w)),p+=g}f.isClosed=!0;for(let x=0,M=f.points.length;x<M;x++)f.points[x].roundness=s;f.roundness=s,f.update();let b=On.create({shape:f,parameters:{roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:h}});return Object.assign(b,{userData:{...t,type:"StarGeometry"}})}},vP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:Math.abs((s=i.depth)!=null?s:0)})}}static build(t){let{width:e,height:i}=t.parameters,n=new Ro(e,i);return Object.assign(n,{userData:{...t,type:"TextFrameGeometry"}})}},yP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var o,a,l;let i=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,radialSegments:32,tubularSegments:64,arc:Math.PI*2,cornerRadius:30,cornerSegments:8},t.parameters),n=Math.abs(i.width),r=Math.abs((a=i.height)!=null?a:i.width),s=Math.abs((l=i.depth)!=null?l:i.width*.25);return{parameters:Object.assign(i,{width:n,height:r,depth:s})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,tubularSegments:s,arc:o,cornerRadius:a,cornerSegments:l}=t.parameters,h=xP(e,i,n,e*.5,o,s,0,0,r,a,l);return h.scale(1,i/e,1),Object.assign(h,{userData:{...t,type:"TorusGeometry"}})}};function xP(t,e,i,n,r,s,o,a,l,h,f){return[e,i]=[i,e],o=e/2,r/=2*Math.PI,r==1&&(h=0),new Yg(!0,t,e,i,n,r,s,o,a,l,h,f)}var _P=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s,o;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width),depth:Math.abs((s=i.depth)!=null?s:i.width),tube:(o=i.tube)!=null?o:i.width*.125})}}static build(t){let{width:e,tube:i,tubularSegments:n,radialSegments:r,p:s,q:o}=t.parameters,a=e*.5;a!==i&&(a-=i);let l=new Yh(a,i,n,r,s,o);return Object.assign(l,{userData:{...t,type:"TorusKnotGeometry"}})}},bP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){var n,r,s;let i=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},t.parameters);return{shape:t.shape&&t.shape instanceof Ot?t.shape:new Ot,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs((r=i.height)!=null?r:i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs((s=i.depth)!=null?s:0)})}}static build(t){let{width:e=100,height:i,cornerRadius:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a}=t.parameters,l=t.shape,h=e*.5,f=i*.5;a?(l.addPoint(l.createPoint(-h,f)),l.addPoint(l.createPoint(h,-f)),l.addPoint(l.createPoint(-h,-f))):(l.addPoint(l.createPoint(0,f)),l.addPoint(l.createPoint(h,-f)),l.addPoint(l.createPoint(-h,-f))),l.isClosed=!0;for(let u=0,d=l.points.length;u<d;u++)l.points[u].roundness=n;l.roundness=n,l.update();let c=On.create({shape:l,parameters:{roundness:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(c,{userData:{...t,type:"TriangleGeometry"}})}};function wp(){let t=new We;return t.setAttribute("position",new it(new Float32Array([]),3)),t.setIndex(new it(new Uint16Array([]),1)),t}var wP=12,Zg=class extends We{constructor(t,e){super(),this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.vectorShapes=[];let i=wp();Object.entries(i.attributes).forEach(([n,r])=>{this.setAttribute(n,r)}),this.setIndex(i.index),this.updateFont(t.font,e),this.update(t)}async updateFont(t,e){let i=e.getFont(t);i&&(this.font=i,await i.loadingPromise)}async update(t){let e=this.font;if(this.userData={parameters:t,type:"TextGeometry"},!e||!e.isLoaded){console.warn("Cannot update text because its font is not loaded");return}let{width:i,height:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:o,text:a,textTransform:l,subdivisions:h}=t;await e.loadingPromise;let f=l===2?a.toUpperCase():l===3?a.toLowerCase():a,c=SP(t,e,f),{shapes:u,charWidths:d,charCoords:m}=await e.generateShapes(c,t),g=i*.5,p=n*.5,v=u.map(x=>new Ot().fromShape(x));this.vectorShapes=v;let y=v.map(x=>On.create({shape:x,parameters:{depth:r,extrudeBevelSegments:o,extrudeBevelSize:s,windingRule:r<=0?Tt.NONZERO:Tt.ODD,subdivisions:h!=null?h:wP}})),b=y.length?Em(y):wp();b.translate(-g,p,0),this.dispose(),this.wrappedText=c,this.charCoords=m,this.charWidths=d,Object.entries(b.attributes).forEac
3113h(([x,M])=>{this.setAttribute(x,M)}),this.setIndex(b.index),this.computeBoundingSphere()}clone(){let t=Sl(new We,Zg.prototype);return t.copy(this),t}copy(t){return Object.entries(t.attributes).forEach(([e,i])=>{this.setAttribute(e,i)}),this.setIndex(t.index),this.userData={parameters:{...t.userData.parameters},type:"TextGeometry"},this}async setText(t){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:t})}get text(){var t;return(t=this.userData.parameters.text)!=null?t:""}};function SP(t,e,i){i=i!=null?i:t.text;let n=[""],r="";for(let s of i)r+=s,s===" "||s===`
3114`?(n[n.length-1]+=r,r="",s===`
3115`&&n.push("")):e.getTextWidth(n[n.length-1]+r,t)>t.width&&(n[n.length-1].length&&n.push(""),e.getTextWidth(n[n.length-1]+r,t)>t.width&&(r.length===1?(n[n.length-1]+=r,r=""):(n[n.length-1]+=r.slice(0,-1),r=r[r.length-1],n.push(""))));return n[n.length-1]+=r,n}var Jg=new Promise(t=>{});function Kg(t,e){return MP(t)}function MP(t){let e={parameters:t,type:t.type};if(t.type==="VectorGeometry"){let n=Ot.createFromState(t.shape,t.width,t.height);e.shape=n}else t.type==="NonParametricGeometry"&&(t.data.groups&&t.data.groups.forEach(n=>{var r;return n.materialIndex=Math.max((r=n.materialIndex)!=null?r:0,0)}),e.geometry=new Tm().parse(t));let i;try{i=Mh(e)}catch(n){console.error(n)}if(!i){let n=Ot.createFromState(Xa.defaultData(),100,100);e.shape=n,i=Mh(e)}return i}var ke;Jg.then(t=>{ke=t});var Sp=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),Mp=new Uint32Array([0,1,2,3]),Ap=new Uint8Array([4]),ki=class{static build(t,e,i,n,r){var h,f;let s,o,a,l=(f=(h=t==null?void 0:t.phongAngle)!=null?h:e==null?void 0:e.phongAngle)!=null?f:35;if(n===!1&&(l=-1),t.positionWASM!==void 0){i&&i!==0&&(ke.free_bvh(i),ke.free_subdivision_surface(i));try{s=ki.allocate(t,r)}catch(c){console.error(c,t),s=ki.allocate({positionWASM:Sp,indexWASM:Mp,verticesPerFaceWASM:Ap},r)}ke.set_destination_refinement_level(s,0),o=ki.buildLevel(s,!0,l)}else s=i,t.phongAngle!==void 0&&(o=ki.buildLevel(s,!0,l));return t.subdivisions!==void 0&&(ke.set_destination_refinement_level(s,t.subdivisions),t.subdivisions>0?a=ki.buildLevel(s,!1,l):a=null),{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static primitiveToQuads(t,e){t.widthSegments>16&&(t.widthSegments=16),t.heightSegments>16&&(t.heightSegments=16),t.depthSegments>16&&(t.depthSegments=16),t.radialSegments>16&&(t.radialSegments=16),t.type==="DodecahedronGeometry"&&(t.detail=0);let i=t.shape!==void 0?e.geometry:Kg(t),n,r,s,o;({positions:n,triIndices:o}=Qg(i.getAttribute("position"),i.getIndex()));let a;if(t.type==="CylinderGeometry"&&t.cornerRadius===0&&t.hollow===0&&t.openEnded===!1){let l=t.radialSegments*t.heightSegments*3*2,h=l+t.radialSegments*3;a=[l,h]}return{indices:r,verticesPerFace:s}=e0(n,o,i,a),{positions:n,indices:r,verticesPerFace:s}}static allocate(t,e){var b;let i,n,r,s=[],o=[];t.positionWASM&&t.positionWASM.length>0?(i=t.positionWASM,n=t.indexWASM,r=t.verticesPerFaceWASM):(i=Sp,n=Mp,r=Ap);let a=i.length,l=n.length,h=r.length,f=i.length+s.length+o.length,c=n.length+r.length,u=f*Float32Array.BYTES_PER_ELEMENT+c*Uint32Array.BYTES_PER_ELEMENT,d=f*Float32Array.BYTES_PER_ELEMENT,m=ke._malloc(u),g=new Float32Array(ke.HEAPF32.buffer,m,f),p=new Uint32Array(ke.HEAPU32.buffer,m+d,c);g.set(i,0),g.set(s,i.length),g.set(o,i.length+s.length),p.set(n,0),p.set(r,n.length);let v;(b=t==null?void 0:t.scaleBaked)!=null&&b.some(x=>x!==1)&&(v=new Ye().makeScale(...t.scaleBaked)),e&&(v?v.premultiply(e):v=e);let y=v?ke.alloc_subdivision_surface2(m,a,m+d,l,m+d+n.length*Uint32Array.BYTES_PER_ELEMENT,h,v.elements):ke.alloc_subdivision_surface(m,a,m+d,l,m+d+n.length*Uint32Array.BYTES_PER_ELEMENT,h);return ke._free(m),y}static buildLevel(t,e,i,n,r){let s=r?ke.get_mesh_data2(t,e?ke.Level.CONTROL:ke.Level.REFINED,i,r.elements):ke.get_mesh_data(t,e?ke.Level.CONTROL:ke.Level.REFINED,i),o=8,a=ke.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),h=0,f=ke.HEAPU32[a[h]>>2],c=ke.HEAPF32.subarray(f>>2,(f>>2)+l[h]);h++;let u=ke.HEAPU32[a[h]>>2],d=ke.HEAPF32.subarray(u>>2,(u>>2)+l[h]);h++;let m=ke.HEAPU32[a[h]>>2],g=ke.HEAPU32.subarray(m>>2,(m>>2)+l[h]);h++;let p=ke.HEAPU32[a[h]>>2],v=ke.HEAPU32.subarray(p>>2,(p>>2)+l[h]);if(h++,n===void 0){let y=new We;if(y.setIndex(new uo(v,1)),y.setAttribute("position",new Pe(c,3)),y.setAttribute("normal",new Pe(d,3)),e){y.setAttribute("faceMap",new uo(g,1));let b=new Float32Array(d.length/3*4).fill(0);y.setAttribute("color",new it(b,4))}return ke.free_mesh_data(s),y.userData.type="SubdivGeometry",y}n.getAttribute("position").copyArray(c),n.getAttribute("normal").copyArray(d),n.attributes.position.needsUpdate=!0,n.attributes.normal.needsUpdate=!0,ke.free_mesh_data(s)}static buildControlCageWireframe(t,e,i){let n=ke.get_wireframe_data_for_base_level(t),r=4,s=ke.HEAPU32.subarray(n>>2,(n>>2)+r),o=s.subarray(2,2+2),a=0,l=ke.HEAPU32[s[a]>>2],h=ke.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let f=ke.HEAPU32[s[a]>>2],c=ke.HEAPU32.subarray(f>>2,(f>>2)+o[a]);if(e===void 0){let u=new We;u.setAttribute("position",new Pe(h,3));let d=new Float32Array(h.length);for(let m=0,g=h.length;m<g;)d[m++]=i.r,d[m++]=i.g,d[m++]=i.b;return u.setAttribute("color",new it(d,3)),u.setIndex(new uo(c,1)),ke.free_wireframe_data_for_base_level(n),u}e.getAttribute("position").copyArray(h),e.attributes.position.needsUpdate=!0,ke.free_wireframe_data_for_base_level(n)}static updateCollabMesh(t,e,i){let n=e===0;n||ke.set_destination_refinement_level(t,e);let r=i?ke.get_topological_data2(t,n?ke.Level.CONTROL:ke.Level.REFINED,i.elements):ke.get_topological_data(t,n?ke.Level.CONTROL:ke.Level.REFINED),s=6,o=ke.HEAPU32.subarray(r>>2,(r>>2)+s),a=o.subarray(3,3+3),l=0,h=ke.HEAPU32[o[l]>>2],f=new Float32Array(ke.HEAPF32.subarray(h>>2,(h>>2)+a[l]));l++;let c=ke.HEAPU32[o[l]>>2],u=new Uint32Array(ke.HEAPU32.subarray(c>>2,(c>>2)+a[l]));l++;let d=ke.HEAPU32[o[l]>>2],m=new Uint8Array(ke.HEAPU32.subarray(d>>2,(d>>2)+a[l]));return ke.free_topological_data(r),{positions:f,indices:u,verticesPerFace:m}}},Tp=["getX","getY","getZ"];function Qg(t,e){let i={},n=e?e.count:t.count,r=0,s=[],o=[],a=1e4;for(let h=0;h<n;h++){let f=e?e.getX(h):h,c="";for(let u=0;u<3;u++)c+=`${~~(t[Tp[u]](f)*a)},`;if(c in i)s.push(i[c]);else{for(let u=0;u<3;u++)o.push(t[Tp[u]](f));i[c]=r,s.push(r),r++}}let l=[];for(let h=0;h<s.length;h+=3)s[h]===s[h+1]||s[h]===s[h+2]||s[h+1]===s[h+2]||l.push(s[h],s[h+1],s[h+2]);return{positions:o,triIndices:l}}var Ta=new E,Tc=new E,Ec=new E,Cc=new E;function e0(t,e,i,n){var o;let r=[],s=[];if(i.userData.shape!==void 0&&i.userData.parameters.depth===0&&i.userData.shape.shapeHoles.length===0){let a=i.userData.shape.extractShapePointsToFlatArray([]),l=i.userData.parameters.spikes;if(i.userData.type==="EllipseGeometry"&&l<=24&&l%4===0&&i.userData.parameters.angle>=360){let c=a.length/2/l;a=a.filter((u,d)=>Math.floor(d/2)%c===0)}let h=0;for(let c=0;c<a.length;c+=2)h+=(a[c]-a[(c===0?a.length:c)-2])*(a[c+1]+a[(c===0?a.length:c)-1]);t.length=0;let f=0;if(h<0)for(let c=0;c<a.length;c+=2)t.push(a[c],a[c+1],0),r.push(f++);else for(let c=a.length-2;c>=0;c-=2)t.push(a[c],a[c+1],0),r.push(f++);return s.push(f),{indices:r,verticesPerFace:s}}for(let a=0,l=(o=i.capStartIndex)!=null?o:e.length;a<l;)if(e[a+1]===e[a+3]&&e[a+2]===e[a+5]||e[a+0]===e[a+3]&&e[a+2]===e[a+4]){Ta.set(t[e[a]*3],t[e[a]*3+1],t[e[a]*3+2]),Tc.set(t[e[a+1]*3],t[e[a+1]*3+1],t[e[a+1]*3+2]),Ec.set(t[e[a+4]*3],t[e[a+4]*3+1],t[e[a+4]*3+2]),Cc.set(t[e[a+5]
3115*3],t[e[a+5]*3+1],t[e[a+5]*3+2]),Tc.sub(Ta).normalize(),Ec.sub(Ta).normalize(),Cc.sub(Ta).normalize();let h=Tc.cross(Ec).dot(Cc);Math.abs(h)>.005||n&&n.some((f,c)=>c%2===1?!1:a>=n[c]&&a<n[c+1])?(r.push(e[a],e[a+1],e[a+2]),s.push(3),a+=3):(r.push(e[a],e[a+1],e[a+4],e[a+5]),s.push(4),a+=6)}else r.push(e[a],e[a+1],e[a+2]),s.push(3),a+=3;if(i.capStartIndex!==void 0){let a=[],l=[],h=0,f=new Float32Array([i.userData.parameters.depth])[0];for(let c=0,u=0;c<t.length;c+=3,u++)t[c+2]===0&&(a.push(u),h++),t[c+2]===f&&l.push(u);if(i.userData.parameters.extrudeBevelSize===0){let c=l[0];l[0]=l[1],l[1]=c}a.reverse(),r.push(...a,...l),s.push(h,h)}return{indices:r,verticesPerFace:s}}var Xn={};dS(Xn,{calcBoolean:()=>CP,calcBooleanTopological:()=>EP,freeMeshSet:()=>DP,getMeshSet:()=>LP,transformMeshSet:()=>PP});var AP=new Promise(t=>{}),Ke,Ss;AP.then(t=>Ke=t);function TP(t,e,i){let n,{positions:r,triIndices:s}=Qg(t.getAttribute("position"),t.getIndex()),o;if(e&&i){let{indices:a,verticesPerFace:l}=e0(r,s,t);o=l.length,n=[];for(let h=0,f=0;h<o;h++){n.push(l[h]);for(let c=0;c<l[h];c++)n.push(a[f++])}}else{let a=s.length;n=Array(a+a/3),o=0;for(let l=0,h=0;h<n.length;)n[h++]=3,o++,n[h++]=s[l++],n[h++]=s[l++],n[h++]=s[l++]}return{positions:r,faceIndices:n,nFaces:o}}function t0(t){let e=t.length,i=e*Uint32Array.BYTES_PER_ELEMENT,n=e*Float32Array.BYTES_PER_ELEMENT,r=Number.isInteger(t[0])?i:n,s=Ke._malloc(r);return(Number.isInteger(t[0])?new Uint32Array(Ke.HEAPU32.buffer,s,e):new Float32Array(Ke.HEAPF32.buffer,s,e)).set(t,0),s}function i0(t){switch(t){case 0:return Ke.OP.UNION;case 1:return Ke.OP.INTERSECTION;case 2:return Ke.OP.A_MINUS_B;case 3:return Ke.OP.B_MINUS_A;case 4:return Ke.OP.SYMMETRIC_DIFFERENCE;case 5:return Ke.OP.ALL;default:throw new Error("Unknown boolean operation "+t)}}function EP(t,e){Ss===void 0&&(Ss=Ke.init_csg());let i=t0(t),n=Ke.csg_calc_topological(Ss,i,t.length,i0(e));Ke._free(i);let r=6,s=Ke.HEAPU32.subarray(n>>2,(n>>2)+r),o=s.subarray(3,3+3),a=0,l=Ke.HEAPU32[s[a]>>2],h=new Float32Array(Ke.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let f=Ke.HEAPU32[s[a]>>2],c=new Uint32Array(Ke.HEAPU32.subarray(f>>2,(f>>2)+o[a]));a++;let u=Ke.HEAPU32[s[a]>>2],d=new Uint8Array(Ke.HEAPU32.subarray(u>>2,(u>>2)+o[a]));return Ke.free_mesh_data(n),{positions:h,indices:c,verticesPerFace:d}}function CP(t,e,i,n){Ss===void 0&&(Ss=Ke.init_csg());let r=t0(t),s=Ke.csg_calc(Ss,r,t.length,n,i0(e));Ke._free(r);let o=5,a=Ke.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(2,2+3),h=0,f=Ke.HEAPU32[a[h]>>2],c=Ke.HEAPF32.subarray(f>>2,(f>>2)+l[h]);h++;let u=Ke.HEAPU32[a[h]>>2],d=Ke.HEAPF32.subarray(u>>2,(u>>2)+l[h]);h++;let m=l[h];i.setAttribute("position",new Pe(c,3)),i.setAttribute("normal",new Pe(d,3));let g=Ke.HEAPF32.subarray((s>>2)+5,(s>>2)+5+6);return i.boundingSphere===null&&(i.boundingSphere=new cn),i.boundingSphere.center.set(g[0],g[1],g[2]),i.boundingSphere.radius=(g[3]**2+g[4]**2+g[5]**2)**.5,i.userData.parameters={width:g[3]*2,height:g[4]*2,depth:g[5]*2},Ke.free_mesh_data(s),m}function LP(t,e,i){if(Ke===void 0)return-1;let n,r,s;if(e&&t.userData.positions!==void 0){let g=t.userData;s=g.verticesPerFace.length,n=g.positions,r=Array(g.verticesPerFace.reduce((p,v)=>p+v,0)+s);for(let p=0,v=0,y=0;p<g.verticesPerFace.length;p++){r[y++]=g.verticesPerFace[p];for(let b=0;b<g.verticesPerFace[p];b++)r[y++]=g.indices[v++]}}else({positions:n,faceIndices:r,nFaces:s}=TP(t,e,i));let o=n.length,a=r.length,l=n.length,h=r.length,f=l*Float32Array.BYTES_PER_ELEMENT+h*Uint32Array.BYTES_PER_ELEMENT,c=l*Float32Array.BYTES_PER_ELEMENT,u=Ke._malloc(f),d=new Float32Array(Ke.HEAPF32.buffer,u,l),m=new Uint32Array(Ke.HEAPU32.buffer,u+c,h);return d.set(n,0),m.set(r,0),Ke.get_csg_mesh(u,o,u+c,a,s)}function PP(t,e){Ke.transform_csg_mesh(t,e.elements)}function DP(t){Ke.free_csg_mesh(t)}var n0={ConeGeometry:VL,CubeGeometry:GL,CylinderGeometry:kL,DodecahedronGeometry:WL,EllipseGeometry:YL,HelixGeometry:KL,IcosahedronGeometry:QL,LatheGeometry:eP,NonParametricGeometry:oP,PolygonGeometry:aP,PyramidGeometry:lP,RectangleGeometry:uP,SphereGeometry:dP,PlaneGeometry:fP,BackdropGeometry:pP,StarGeometry:gP,TextFrameGeometry:vP,TorusGeometry:yP,TorusKnotGeometry:_P,TriangleGeometry:bP,VectorGeometry:On},Mh=t=>n0[t.type].create(t);function ai(t,e){return e.color(t)}var Ep=t=>"isEntity"in t,Ds=t=>"isAbstractMesh"in t,Br=t=>t!==null&&t.objectType==="BooleanObject",OP=t=>t.objectType==="CombinedCamera",r0=t=>"objectHelper"in t;function RP(t,e){var n;let i=!1;e.position&&(t.position.fromArray(e.position),i=!0),e.rotation&&(t.rotation.fromArray(e.rotation),i=!0),e.scale&&(i=!0,t.scale.fromArray(e.scale)),e.hiddenMatrix!==void 0&&"hiddenMatrix"in t&&(i=!0,t.hiddenMatrix.fromArray((n=e.hiddenMatrix)!=null?n:Ls.identity)),i&&(t.updateMatrix(),Br(t.parent)&&Ds(t)&&t.invalidateDownstreamBooleanData(!0).recomputeBoolean()),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&t.updateWorldMatrix(!1,!0),t.objectType==="CombinedCamera"&&(e.isUpVectorFlipped!==void 0&&(t.isUpVectorFlipped=e.isUpVectorFlipped),t.updateUp())}function IP(t,e){RP(t,e),e.name!==void 0&&(t.name=e.name),e.visible!==void 0&&(t.visible=e.visible)}function zP(t,e,i){IP(t,e),e.color!==void 0&&(t.color=ai(e.color,
3115i)),e.intensity!==void 0&&(t.intensity=e.intensity),e.shadows!==void 0&&!(t instanceof jc)&&(t.castShadow=e.shadows),t.shadow&&!(t instanceof jc)&&e.depth!==void 0&&(t.shadow.camera.far=e.depth,t.shadow.needsUpdate=!0)}function NP(t,e){t.shadow.camera.right=e/2,t.shadow.camera.left=-e/2,t.shadow.camera.top=e/2,t.shadow.camera.bottom=-e/2,t.shadow.needsUpdate=!0}var s0=t=>class extends t{hasEntityChild(){return this.children.some(e=>Ep(e))}isDescendantOf(e){e instanceof gt&&(e=e.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===e)return!0;i=i.parent}return!1}attach(e,i){this.updateWorldMatrix(!0,!1);let n=new Ye().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),n.multiply(e.parent.matrixWorld)),Ep(e)?e.hiddenMatrix.premultiply(n):e.applyMatrix4(n),e.updateWorldMatrix(!1,!1),this.add(e),i!==void 0&&(this.children.pop(),this.children.splice(i,0,e)),this}copy(e,i=!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.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.userData=JSON.parse(JSON.stringify(e.userData)),i===!0)for(let n=0;n<e.children.length;n++){let r=e.children[n];this.add(r.clone())}return this}},ls=new Xi,Si=new E,Qi=new E,Ms=new Ye,o0=[new E(-1,1,1),new E(-1,-1,1),new E(1,-1,1),new E(1,1,1),new E(-1,1,-1),new E(-1,-1,-1),new E(1,-1,-1),new E(1,1,-1)],UP=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],BP=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]];function FP(t,e,i=0,n=e.count){let r=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,h=-1/0;for(let f=i;f<n;f++){let c=e.getX(f),u=e.getY(f),d=e.getZ(f);c<r&&(r=c),u<s&&(s=u),d<o&&(o=d),c>a&&(a=c),u>l&&(l=u),d>h&&(h=d)}return t.min.set(r,s,o),t.max.set(a,l,h),t}var Cp=(t,e,i)=>{var n;if(Ds(t)){let r=t.geometry.userData.parameters,s=t.geometry.getAttribute("position"),o=t.geometry.userData.type;o==="SubdivGeometry"?Si.copy(t.originalGeometry.boundingSphere.center):o==="TextGeometry"||Ya.is2DParametricMesh(o)?Si.set(0,0,r.depth*.5):o==="ConeGeometry"||o==="CubeGeometry"||o==="CylinderGeometry"||o==="DodecahedronGeometry"||o==="HelixGeometry"||o==="IcosahedronGeometry"||o==="PyramidGeometry"||o==="SphereGeometry"||o==="PlaneGeometry"||o==="BackdropGeometry"||o==="TorusGeometry"||o==="TorusKnotGeometry"?Si.set(0,0,0):s!==void 0&&(FP(ls,s,t.geometry.drawRange.start,t.geometry.drawRange.count<1/0?t.geometry.drawRange.count:s.count),ls.getCenter(Si)),t.forceComputeSize?ls.getSize(Qi).multiplyScalar(.5):Qi.set(r.width,r.height,(n=r.depth)!=null?n:0).multiplyScalar(.5)}else if(r0(t)&&t.objectHelper.visible){let r=t.geometryHelper.getAttribute("position");ls.setFromArray(r.array),ls.getCenter(Si),ls.getSize(Qi).multiplyScalar(.5)}else Si.setScalar(0),Qi.setScalar(0);Ms.copy(e).multiply(t.matrixWorld),Qi.x===0&&Qi.y===0&&Qi.z===0?i.push(new E(Si.x,Si.y,Si.z).applyMatrix4(Ms)):o0.forEach(r=>{i.push(r.clone().multiply(Qi).add(Si).applyMatrix4(Ms))})},Lp=class extends Xi{constructor(){super(...arguments),this.matrix=new Ye,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(e=>e.clone()),this.faces=t.faces.map(e=>e.clone()),this.edges=t.edges.map(e=>e.clone()),this.centerEdges=t.centerEdges.map(e=>e.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new Ye().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let n=[];return i===!0?t.traverseEntity(r=>{r.visible&&Cp(r,e,n)}):Cp(t,e,n),this.setFromPoints(n)}getCenter(t){return t=super.getCenter(t),t.applyMatrix4(this.matrix),t}
3115getPositionToCenter(t){return t=super.getCenter(t),t.applyMatrix4(Ms.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Qi).multiplyScalar(.5),this.getCenter(Si),Ms.copy(this.matrix).setPosition(Si),this.vertices=o0.map(t=>t.clone().multiply(Qi).applyMatrix4(Ms))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=UP.map(([t,e])=>new Jw(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new E))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=BP.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}},Mn=t=>"isEntity"in t,kP=t=>"isAbstractMesh"in t,Ws=t=>class extends s0(t){constructor(){super(...arguments),this.objectType="",this.isEntity=!0,this.raycastLock=!1,this.scaleLock=!1,this.hiddenMatrix=new Ye,this._singleBBox=new Lp,this._recursiveBBox=new Lp,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.forceComputeSize=!1,this.states={},this.currentState=null,this.currentTransitionAction=null}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(e=>{Mn(e)&&(e.singleBBoxNeedsUpdate=!0,e.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(e=>{e.singleBBoxNeedsUpdate=!0,e.recursiveBBoxNeedsUpdate=!0})}traverseEntity(e){e(this);for(let i of this.children)Mn(i)&&i.traverseEntity(e)}traverseVisibleEntity(e){e(this);for(let i of this.children)Mn(i)&&i.visible&&i.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);for(let i of this.children)i.updateMatrixWorld(e)}updateWorldMatrix(e,i){let n=this.parent;if(e&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),i)for(let r of this.children)r.updateWorldMatrix(!1,!0)}clone(e){return new this.constructor().copy(this,e)}copy(e,i=!0){if(super.copy(e,!1),this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),i===!0)for(let n of e.children)Mn(n)&&this.add(n.clone());return this}keepChildrenMatrixWorld(){let e=new Ye,i=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),e.copy(this.matrixWorld).invert(),e.multiply(i);for(let n of this.children)Mn(n)&&n.hiddenMatrix.premultiply(e)}toObjectTransformState(e=[]){this.updateWorldMatrix(!0,!1);let i={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return uh(i,e)}fromObjectTransformState(e){return e.position&&this.position.fromArray(e.position),e.rotation&&this.rotation.fromArray(e.rotation),e.scale&&this.scale.fromArray(e.scale),e.hiddenMatrix&&this.hiddenMatrix.fromArray(e.hiddenMatrix),this.updateMatrix(),this}toState(e=[]){let i={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)};return uh(i,e)}fromState(e,i){return e.name&&(this.name=e.name),e.raycastLock!==void 0&&(this.raycastLock=e.raycastLock),e.type!=="Orthogra
3115phicCamera"&&e.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),e.visible!==void 0&&(this.visible=e.visible),this.fromObjectTransformState(e),this}},Pp=class{constructor(t){t=t!=null?t:{},this.name=t.name,this.type=t.type,this.node=t.node,this.size=t.size,this.needsUpdate=t.needsUpdate}get value(){return this.node.value}set value(t){this.node.value=t}},cr=class{constructor(t){this.hashProperties=void 0,this.isNode=!0,this.shortcuts={},this.uuid=At.generateUUID(),this.type=t,this.name=""}analyze(t,e){e=e!=null?e:{},t.analyzing=!0,this.build(t.addFlow(e.slot,e.cache,e.context),"v4"),t.clearVertexNodeCode(),t.clearFragmentNodeCode(),t.removeFlow(),t.analyzing=!1}analyzeAndFlow(t,e,i){return i=i!=null?i:{},this.analyze(t,i),this.flow(t,e,i)}flow(t,e,i){i=i!=null?i:{},t.addFlow(i.slot,i.cache,i.context);let n={result:this.build(t,e),code:t.clearNodeCode(),extra:t.context.extra};return t.removeFlow(),n}build(t,e,i){e=e!=null?e:this.getType(t,e);let n=t.getNodeData(i!=null?i:this);return t.analyzing&&this.appendDepsNode(t,n,e),t.nodes.indexOf(this)===-1&&t.nodes.push(this),this.updateFrame!==void 0&&t.updaters.indexOf(this)===-1&&t.updaters.push(this),this.generate(t,e,i)}updateFrame(t){}generateReadonly(t,e,i,n,r,s){return""}generate(t,e,i,n,r){return""}parse(t,e,i,n){}appendDepsNode(t,e,i){e.deps=(e.deps||0)+1;let n=t.getTypeLength(i);(n>(e.outputMax||0)||this.getType(t,i))&&(e.outputMax=n,e.output=i)}setName(t){this.name=t}getName(){return this.name}getType(t,e){return e==="sampler2D"||e==="samplerCube"?e:this.type}getHash(){let t="{",e,i;for(e in this)i=this[e],i instanceof cr&&(t+='"'+e+'":'+i.getHash()+",");if(this.hashProperties)for(let n=0;n<this.hashProperties.length;n++)e=this.hashProperties[n],i=this[e],t+='"'+e+'":"'+String(i)+'",';return t+='"id":"'+this.uuid+'"}',t}},VP=class{constructor(){this.nodes={},this.keywords={}}add(t){this.nodes[t.name]=t}addKeyword(t,e,i){i=i!==void 0?i:!0,this.keywords[t]={callback:e,cache:i}}remove(t){delete this.nodes[t.name]}removeKeyword(t){delete this.keywords[t]}get(t){return this.nodes[t]}getKeyword(t,e){return this.keywords[t].callback(e)}getKeywordData(t){return this.keywords[t]}contains(t){return this.nodes[t]!==void 0}containsKeyword(t){return this.keywords[t]!==void 0}},oi=new VP,xt=class extends cr{constructor(t,e){super(t),this.scope="",e=e!=null?e:{},this.shared=e.shared!==void 0?e.shared:!0,this.unique=e.unique!==void 0?e.unique:!1}build(t,e,i,n){if(e=e!=null?e:this.getType(t),this.getShared(t,e)){let r=this.getUnique(t,e);r&&this.uuid===void 0&&(this.uuid=At.generateUUID()),i=t.getUUID(i!=null?i:this.getUUID(),!r);let s=t.getNodeData(i),o=s.output||this.getType(t);if(t.analyzing)return(s.deps||0)>0||this.getLabel()?(this.appendDepsNode(t,s,e),this.generate(t,e,i)):super.build(t,e,i);if(r)return s.name=s.name||super.build(t,e,i),s.name;if(!this.getLabel()&&(!this.getShared(t,o)||t.context.ignoreCache||s.deps===1))return super.build(t,e,i);i=this.getUUID(!1);let a=this.getTemp(t,i);if(a)return t.format(a,o,e);{a=super.generate(t,e,i,s.output,n);let l=this.generate(t,o,i);return t.addNodeCode(a+" = "+l+";"),t.format(a,o,e)}}return super.build(t,e,i)}getShared(t,e){return e!=="sampler2D"&&e!=="samplerCube"&&this.shared}getUnique(t,e){return this.unique}setLabel(t){return this.label=t,this}getLabel(){return this.label}getUUID(t){let e=this.uuid;return typeof this.scope=="string"&&(e=this.scope+"-"+e),e}getTemp(t,e){e=e||this.uuid;let i=t.getVars()[e];return i?i.name:void 0}generate(t,e,i,n,r){return this.getShared(t,e)||console.error("TempNode is not shared"),i=i!=null?i:this.uuid,t.getTempVar(i,n!=null?n:this.getType(t),r,this.getLabel()).name}},xi=class extends xt{constructor(t,e){e=e!=null?e:{},e.shared=e.shared!==void 0?e.shared:!1,super(t,e),this.readonly=!1}setReadonly(t){return this.readonly=t,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}generate(t,e,i,n,r,s){i=t.getUUID(i!=null?i:this.getUUID()),n=n!=null?n:this.getType(t);let o=t.getNodeData(i);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(t,e,i,n,r,s):t.isShader("vertex")?(o.vertex||(o.vertex=t.createVertexUniform(n,this,r,s,this.getLabel())),t.format(o.vertex.name,n,e)):(o.fragment||(o.fragment=t.createFragmentUniform(n,this,r,s,this.getLabel())),t.format(o.fragment.name,n,e))}},Ti=class extends xi{constructor(t=0,e){super("v2"),this.nodeType="Vector2",this.value=t instanceof Z?t:new Z(t,e)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}generateReadonly(t,e,i,n,r,s){return t.format("vec2("+this.value.x+", "+this.value.y+")",n,e)}}
3115,Mi=class extends xi{constructor(t=0,e,i){super("v3"),this.nodeType="Vector3",this.value=t instanceof E?t:new E(t,e,i)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}get z(){return this.value.z}set z(t){this.value.z=t}generateReadonly(t,e,i,n,r,s){return t.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",n,e)}},ji=class extends Xe{constructor(t,e,i,n){super(t,e,i),this.isColorA=!0,this.a=n}setRGBA(t,e,i,n){super.setRGB(t,e,i),this.a=n}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}},br=class extends xi{constructor(t){super("v4"),this.nodeType="Vector4",this.value=t instanceof ji?t:new ji(t.r,t.g,t.b,t.a)}generateReadonly(t,e,i,n,r,s){return t.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",n,e)}},GP=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,Dp=/[a-z_0-9]+/gi,Re=class extends xt{constructor(t,e,i,n,r){super(r),this.src="",this.nodeType="Function",this.useKeywords=!0,this.includes=[],this.extensions={},this.keywords={},this.isMethod=r===void 0,this.isInterface=!1,this.parse(t,e,i,n)}getShared(t,e){return!this.isMethod}getType(t){return t.getTypeByFormat(this.type)}getInputByName(t){if(this.inputs){let e=this.inputs.length;for(;e--;)if(this.inputs[e].name===t)return this.inputs[e]}}getIncludeByName(t){if(this.includes){let e=this.includes.length;for(;e--;)if(this.includes[e].name===t)return this.includes[e]}}generate(t,e,i,n,r){let s,o=0,a=this.src;if(this.includes)for(let h=0;h<this.includes.length;h++)t.include(this.includes[h],this);for(let h in this.extensions)t.extensions[h]=!0;let l=[];for(;s=Dp.exec(this.src);)l.push(s);for(let h=0;h<l.length;h++){let f=l[h],c=f[0],u=this.isMethod?!this.getInputByName(c):!0,d=c;if(this.keywords[c]||this.useKeywords&&u&&oi.containsKeyword(c)){let m=this.keywords[c];if(!m){let g=oi.getKeywordData(c);g.cache&&(m=t.keywords[c]),m=m||oi.getKeyword(c,t),g.cache&&(t.keywords[c]=m)}d=m.build(t)}c!==d&&a[f.index+o-1]!=="."&&(a=a.substring(0,f.index+o)+d+a.substring(f.index+c.length+o),o+=d.length-c.length),this.getIncludeByName(d)===void 0&&oi.contains(d)&&t.include(oi.get(d))}return e==="source"?a:this.isMethod?(this.isInterface||t.include(this,void 0,a),this.name):t.format("( "+a+" )",this.getType(t),e)}parse(t,e,i,n){if(this.src=t||"",this.includes=e!=null?e:[],this.extensions=i!=null?i:{},this.keywords=n!=null?n:{},this.isMethod){let r=GP.exec(this.src);if(this.inputs=[],r&&r.length==4){this.type=r[1],this.name=r[2];let s=r[3].match(Dp);if(s){let o=0;for(;o<s.length;){let a=s[o++],l;a==="in"||a==="out"||a==="inout"?l=s[o++]:(l=a,a="");let h=s[o++];this.inputs.push({name:h,type:l,qualifier:a})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}},HP=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,a0=class extends xt{constructor(t="",e){super(),this.src="",this.useDefine=!1,this.nodeType="Const",this.parse(t||a0.PI,void 0,void 0,void 0,e)}getType(t){return t.getTypeByFormat(this.type)}parse(t,e,i,n,r){this.src=t||"";let s,o,a="",l=HP.exec(t);this.useDefine=r!=null?r:this.src.charAt(0)==="#",l&&l.length>1?(o=l[1],s=l[2],a=l[3]):(s=this.src,o="f"),this.name=s,this.type=o,this.value=a}build(t,e){if(e==="source"){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return t.include(this),t.format(this.name,this.getType(t),e)}generate(t,e,i,n,r){return t.format(this.name,this.getType(t),e)}},dt=a0;dt.PI="PI",dt.PI2="PI2",dt.RECIPROCAL_PI="RECIPROCAL_PI",dt.RECIPROCAL_PI2="RECIPROCAL_PI2",dt.LOG2="LOG2",dt.EPSILON="EPSILON";var WP=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
3116)*?)}`,"gim"),jP=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),l0=class extends xt{constructor(t=""){super(),this.inputs=[],this.src="",this.nodeType="Struct",this.parse(t)}getType(t){return t.getTypeByFormat(this.name)}getInputByName(t){let e=this.inputs.length;for(;e--;)if(this.inputs[e].name===t)return this.inputs[e]}generate(t,e,i,n,r){return e==="source"?this.src+";":t.format("( "+this.src+" )",this.getType(t),e)}parse(t=""){this.src=t,this.inputs=[];let e=WP.exec(t);if(e){let i=e[2],n;for(;n=jP.exec(i);)this.inputs.push({type:n[1],name:n[2]});this.name=e[1]}else this.name="";this.type=this.name}},Su=class extends xt{constructor(t){super("v2",{shared:!1}),this.nodeType="UV",this.index=t!=null?t:0}generate(t,e){t.requires.uv[this.index]=!0;let i=this.index>0?this.index+1:"",n=t.isShader("vertex")?"uv"+i:"vUv"+i;return t.format(n,this.getType(t),e)}};oi.addKeyword("uv",function(){return new Su});oi.addKeyword("uv2",function(){return new Su(1)});var ds=class extends xt{constructor(t,e){super("v4"),this.nodeType="ColorSpace",this.input=t,this.method=e!=null?e:ds.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(t){switch(t){case ln:return["Linear"];case Et:return["sRGB"];default:return[]}}generate(t,e){var o;let i=this.input.build(t,"v4"),n=this.getType(t),r=ds.Nodes[this.method],s=t.include(r);
3116if(s===ds.LINEAR_TO_LINEAR)return t.format(i,n,e);if(((o=r.inputs)==null?void 0:o.length)===2){let a=this.factor.build(t,"f");return t.format(s+"( "+i+", "+a+" )",n,e)}else return t.format(s+"( "+i+" )",n,e)}fromEncoding(t){let e=ds.getEncodingComponents(t);this.method="LinearTo"+e[0],this.factor=e[1]}fromDecoding(t){let e=ds.getEncodingComponents(t);this.method=e[0]+"ToLinear",this.factor=e[1]}},rn=ds;rn.Nodes={LinearToLinear:new Re(["vec4 LinearToLinear( in vec4 value ) {","	return value;","}"].join(`
3117`)),sRGBToLinear:new Re(["vec4 sRGBToLinear( in vec4 value ) {","	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.w );","}"].join(`
3118`)),LinearTosRGB:new Re(["vec4 LinearTosRGB( in vec4 value ) {","	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );","}"].join(`
3119`))},rn.LINEAR_TO_LINEAR="LinearToLinear",rn.SRGB_TO_LINEAR="sRGBToLinear",rn.LINEAR_TO_SRGB="LinearTosRGB";var Mt=class extends Re{constructor(t="",e,i,n,r){super(t,r,n,i,e),this.nodeType="Expression"}},Qn=class extends xi{constructor(t=new yi,e,i,n){super("v4",{shared:!0}),this.nodeType="Texture",this.value=t,this.uv=e!=null?e:new Su,this.bias=i,this.project=n!==void 0?n:!1}getTexture(t,e){return super.generate(t,e,this.value.uuid,"t")}generate(t,e){var h;if(e==="sampler2D")return this.getTexture(t,e);let i=this.getTexture(t,e),n=this.uv.build(t,this.project?"v4":"v2"),r=this.bias?this.bias.build(t,"f"):void 0;r===void 0&&t.context.bias&&(r=t.context.bias.setTexture(this).build(t,"f"));let s,o;this.project?s="texture2DProj":s=r?"tex2DBias":"tex2D",r?o=s+"( "+i+", "+n+", "+r+" )":o=s+"( "+i+", "+n+" )";let a={include:t.isShader("vertex"),ignoreCache:!0},l=this.getType(t);return t.addContext(a),this.colorSpace=(h=this.colorSpace)!=null?h:new rn(new Mt("",l)),this.colorSpace.fromDecoding(t.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(o),o=this.colorSpace.build(t,l),t.removeContext(),t.format(o,l,e)}},Le=class extends xi{constructor(t){super("f"),this.nodeType="Float",this.value=t!=null?t:0}generateReadonly(t,e,i,n,r,s){return t.format(this.value+(this.value%1?"":".0"),n,e)}},Op=class extends xt{constructor(t,e){super(),this.inputs=[],this.nodeType="FunctionCall",this.value=t,this.inputs=e!=null?e:[]}getFunction(){return this.value}getType(t){return this.value.getType(t)}generate(t,e,i,n,r){n=this.getType(t);let s=this.value,o=s.build(t,e)+"( ",a=[];if(s.inputs){for(let l=0;l<s.inputs.length;l++){let h=s.inputs[l],f=this.inputs[l]||this.inputs[h.name];a.push(f.build(t,t.getTypeByFormat(h.type)))}o+=a.join(", ")+" )"}return t.format(o,n,e)}},c0=class extends xt{constructor(t,e,i=c0.ADD){super(),this.nodeType="Operator",this.type=t.type,this.a=t,this.b=e,this.op=i}getType(t){let e=this.a.getType(t),i=this.b.getType(t);return t.isTypeMatrix(e)?"v4":t.getTypeLength(i)>t.getTypeLength(e)?i:e}generate(t,e){let i=this.getType(t);this.type=i;let n=this.a.build(t,i),r=this.b.build(t,i);return t.format("( "+n+" "+this.op+" "+r+" )",i,e)}},sn=c0;sn.ADD="+",sn.SUB="-",sn.MUL="*",sn.DIV="/";var ut=class extends xt{constructor(t,e=ut.ABS,i,n){super(),this.nodeType="Math",this.a=t,typeof e!="string"?this.b=e:n=e,typeof i!="string"?this.c=i:n=i,this.method=n,this.hashProperties=["method"]}getNumInputs(t){switch(this.method){case ut.MIX:case ut.CLAMP:case ut.REFRACT:case ut.SMOOTHSTEP:case ut.FACEFORWARD:return 3;case ut.MIN:case ut.MAX:case ut.MOD:case ut.STEP:case ut.REFLECT:case ut.DISTANCE:case ut.DOT:case ut.CROSS:case ut.POW:return 2;default:return 1}}getInputType(t){let e=t.getTypeLength(this.a.getType(t)),i=this.b?t.getTypeLength(this.b.getType(t)):0,n=this.c?t.getTypeLength(this.c.getType(t)):0;return e>i&&e>n?this.a.getType(t):i>n?this.b.getType(t):this.c.getType(t)}getType(t){switch(this.method){case ut.LENGTH:case ut.DISTANCE:case ut.DOT:return"f";case ut.CROSS:return"v3"}return this.getInputType(t)}generate(t,e){let i,n,r,s=this.a?t.getTypeLength(this.a.getType(t)):0,o=this.b?t.getTypeLength(this.b.getType(t)):0,a=this.c?t.getTypeLength(this.c.getType(t)):0,l=this.getInputType(t),h=this.getType(t);switch(this.type=h,this.method){case ut.NEGATE:return t.format("( -"+this.a.build(t,l)+" )",l,e);case ut.INVERT:return t.format("( 1.0 - "+this.a.build(t,l)+" )",l,e);case ut.CROSS:i=this.a.build(t,"v3"),n=this.b.build(t,"v3");break;case ut.STEP:i=this.a.build(t,s===1?"f":l),n=this.b.build(t,l);break;case ut.MIN:case ut.MAX:case ut.MOD:i=this.a.build(t,l),n=this.b.build(t,o===1?"f":l);break;case ut.REFRACT:i=this.a.build(t,l),n=this.b.build(t,l),r=this.c.build(t,"f");break;case ut.MIX:i=this.a.build(t,l),n=this.b.build(t,l),r=this.c.build(t,a===1?"f":l);break;default:i=this.a.build(t,l),this.b&&(n=this.b.build(t,l)),this.c&&(r=this.c.build(t,l));break}let f=[];f.push(i),n&&f.push(n),r&&f.push(r);let c=this.getNumInputs(t);if(f.length!==c)throw Error(`Arguments not match used in "${this.method}". Require ${c}, currently ${f.length}.`);return t.format(this.method+"( "+f.join(", ")+" )",h,e)}},Ge=ut;Ge.RAD="radians",Ge.DEG="degrees",Ge.EXP="exp",Ge.EXP2="exp2",Ge.LOG="log",Ge.LOG2
vendor: 6,211 bytes, lines 3119-3194
3119="log2",Ge.SQRT="sqrt",Ge.INV_SQRT="inversesqrt",Ge.FLOOR="floor",Ge.CEIL="ceil",Ge.NORMALIZE="normalize",Ge.FRACT="fract",Ge.SATURATE="saturate",Ge.SIN="sin",Ge.COS="cos",Ge.TAN="tan",Ge.ASIN="asin",Ge.ACOS="acos",Ge.ARCTAN="atan",Ge.ABS="abs",Ge.SIGN="sign",Ge.LENGTH="length",Ge.NEGATE="negate",Ge.INVERT="invert",Ge.MIN="min",Ge.MAX="max",Ge.MOD="mod",Ge.STEP="step",Ge.REFLECT="reflect",Ge.DISTANCE="distance",Ge.DOT="dot",Ge.CROSS="cross",Ge.POW="pow",Ge.MIX="mix",Ge.CLAMP="clamp",Ge.REFRACT="refract",Ge.SMOOTHSTEP="smoothstep",Ge.FACEFORWARD="faceforward";var ao=class extends xt{constructor(t,e,i){super("v4"),this.nodeType="TextureCubeUV",this.value=t,this.uv=e,this.bias=i}bilinearCubeUV(t,e,i,n){var a,l,h,f;let r=new Op(ao.Nodes.bilinearCubeUV,[e,i,n]);this.colorSpaceTL=(a=this.colorSpaceTL)!=null?a:new rn(new Mt("","v4")),this.colorSpaceTL.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(r.build(t)+".tl"),this.colorSpaceTR=(l=this.colorSpaceTR)!=null?l:new rn(new Mt("","v4")),this.colorSpaceTR.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(r.build(t)+".tr"),this.colorSpaceBL=(h=this.colorSpaceBL)!=null?h:new rn(new Mt("","v4")),this.colorSpaceBL.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(r.build(t)+".bl"),this.colorSpaceBR=(f=this.colorSpaceBR)!=null?f:new rn(new Mt("","v4")),this.colorSpaceBR.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBR.input.parse(r.build(t)+".br");let s={include:t.isShader("vertex"),ignoreCache:!0};t.addContext(s),this.colorSpaceTLExp=new Mt(this.colorSpaceTL.build(t,"v4"),"v4"),this.colorSpaceTRExp=new Mt(this.colorSpaceTR.build(t,"v4"),"v4"),this.colorSpaceBLExp=new Mt(this.colorSpaceBL.build(t,"v4"),"v4"),this.colorSpaceBRExp=new Mt(this.colorSpaceBR.build(t,"v4"),"v4"),t.removeContext();let o=new Mt("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return o.keywords.cubeUV_TL=this.colorSpaceTLExp,o.keywords.cubeUV_TR=this.colorSpaceTRExp,o.keywords.cubeUV_BL=this.colorSpaceBLExp,o.keywords.cubeUV_BR=this.colorSpaceBRExp,o.keywords.cubeUV=r,o}generate(t,e){if(t.isShader("fragment")){let i=this.uv,n=this.bias||t.context.roughness,r=new Op(ao.Nodes.roughnessToMip,[n]),s=new Ge(r,ao.Nodes.m0,ao.Nodes.cubeUV_maxMipLevel,Ge.CLAMP),o=new Ge(s,Ge.FLOOR),a=new Ge(s,Ge.FRACT),l=this.bilinearCubeUV(t,this.value,i,o),h=this.bilinearCubeUV(t,this.value,i,new sn(o,new Le(1).setReadonly(!0),sn.ADD)),f=new Ge(l,h,a,Ge.MIX);return t.format(f.build(t),"v4",e)}else return console.warn("TextureCubeUVNode is not compatible with "+t.shader+" shader."),t.format("vec4( 0.0 )",this.getType(t),e)}},Ah=ao;Ah.Nodes=function(){let t=new l0(`struct TextureCubeUVData {
3120			vec4 tl;
3121			vec4 tr;
3122			vec4 br;
3123			vec4 bl;
3124			vec2 f;
3125		}`),e=new dt("float cubeUV_maxMipLevel 8.0",!0),i=new dt("float cubeUV_minMipLevel 4.0",!0),n=new dt("float cubeUV_maxTileSize 256.0",!0),r=new dt("float cubeUV_minTileSize 16.0",!0),s=new Re(`float getFace(vec3 direction) {
3126				vec3 absDirection = abs(direction);
3127				float face = -1.0;
3128				if (absDirection.x > absDirection.z) {
3129					if (absDirection.x > absDirection.y)
3130						face = direction.x > 0.0 ? 0.0 : 3.0;
3131					else
3132						face = direction.y > 0.0 ? 1.0 : 4.0;
3133				} else {
3134					if (absDirection.z > absDirection.y)
3135						face = direction.z > 0.0 ? 2.0 : 5.0;
3136					else
3137						face = direction.y > 0.0 ? 1.0 : 4.0;
3138				}
3139				return face;
3140		}`);s.useKeywords=!1;let o=new Re(`vec2 getUV(vec3 direction, float face) {
3141				vec2 uv;
3142				if (face == 0.0) {
3143					uv = vec2(direction.z, direction.y) / abs(direction.x); // pos x
3144				} else if (face == 1.0) {
3145					uv = vec2(-direction.x, -direction.z) / abs(direction.y); // pos y
3146				} else if (face == 2.0) {
3147					uv = vec2(-direction.x, direction.y) / abs(direction.z); // pos z
3148				} else if (face == 3.0) {
3149					uv = vec2(-direction.z, direction.y) / abs(direction.x); // neg x
3150				} else if (face == 4.0) {
3151					uv = vec2(-direction.x, direction.z) / abs(direction.y); // neg y
3152				} else {
3153					uv = vec2(direction.x, direction.y) / abs(direction.z); // neg z
3154				}
3155				return 0.5 * (uv + 1.0);
3156		}`);o.useKeywords=!1;let a=new Re(`TextureCubeUVData bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {
3157			float face = getFace(direction);
3158			float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);
3159			mipInt = max(mipInt, cubeUV_minMipLevel);
3160			float faceSize = exp2(mipInt);
3161			float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);
3162			vec2 uv = getUV(direction, face) * (faceSize - 1.0);
3163			vec2 f = fract(uv);
3164			uv += 0.5 - f;
3165			if (face > 2.0) {
3166				uv.y += faceSize;
3167				face -= 3.0;
3168			}
3169			uv.x += face * faceSize;
3170			if(mipInt < cubeUV_maxMipLevel){
3171				uv.y += 2.0 * cubeUV_maxTileSize;
3172			}
3173			uv.y += filterInt * 2.0 * cubeUV_minTileSize;
3174			uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);
3175			uv *= texelSize;
3176			vec4 tl = texture2D(envMap, uv);
3177			uv.x += texelSize;
3178			vec4 tr = texture2D(envMap, uv);
3179			uv.y += texelSize;
3180			vec4 br = texture2D(envMap, uv);
3181			uv.x -= texelSize;
3182			vec4 bl = texture2D(envMap, uv);
3183			return TextureCubeUVData( tl, tr, br, bl, f );
3184		}`,[t,s,o,e,i,n,r]);a.useKeywords=!1;let l=new dt("float r0 1.0",!0),h=new dt("float v0 0.339",!0),f=new dt("float m0 -2.0",!0),c=new dt("float r1 0.8",!0),u=new dt("float v1 0.276",!0),d=new dt("float m1 -1.0",!0),m=new dt("float r4 0.4",!0),g=new dt("float v4 0.046",!0),p=new dt("float m4 2.0",!0),v=new dt("float r5 0.305",!0),y=new dt("float v5 0.016",!0),b=new dt("float m5 3.0",!0),x=new dt("float r6 0.21",!0),M=new dt("float v6 0.0038",!0),w=new dt("float m6 4.0",!0),T=[l,h,f,c,u,d,m,g,p,v,y,b,x,M,w],_=new Re(`float roughnessToMip(float roughness) {
3185			float mip = 0.0;
3186			if (roughness >= r1) {
3187				mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;
3188			} else if (roughness >= r4) {
3189				mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;
3190			} else if (roughness >= r5) {
3191				mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;
3192			} else if (roughness >= r6) {
3193				mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;
3194			} else {
3195				mip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25
3196			}
3197			return mip;
3198		}`,T);return{bilinearCubeUV:a,roughnessToMip:_,m0:f,cubeUV_maxMipLevel:e}}();var fs=class extends xt{constructor(t){super("v3"),this.nodeType="Normal",this.scope=t!=null?t:fs.VIEW}getShared(){return this.scope===fs.WORLD}build(t,e,i,n){let r=t.context[this.scope+"Normal"];return r?r.build(t,e,i,n):super.build(t,e,i)}generate(t,e,i,n,r){let s;switch(this.scope){case fs.VIEW:t.isShader("vertex")?s="transformedNormal":s="geometryNormal";break;case fs.LOCAL:t.isShader("vertex")?s="objectNormal":(t.requires.normal=!0,s="vObjectNormal");break;case fs.WORLD:t.isShader("vertex")?s="inverseTransformDirection( transformedNormal, viewMatrix ).xyz":(t.requires.worldNormal=!0,s="vWNormal");break}return t.format(s,this.getType(t),e)}},li=fs;li.LOCAL="local",li.WORLD="world",li.VIEW="view",li.NORMAL="normal";oi.addKeyword("viewNormal",function(){return new li(li.VIEW)});oi.addKeyword("localNormal",function(){return new li(li.NORMAL)});oi.addKeyword("worldNormal",function(){return new li(li.WORLD)});var bn=class extends xt{constructor(t){super("v3"),this.nodeType="Position",this.scope=t!=null?t:bn.LOCAL}getType(){switch(this.scope){case bn.PROJECTION:return"v4"}return this.type}getShader(){switch(this.scope){case bn.LOCAL:case bn.WORLD:return!1}return!0}generate(t,e,i,n,r){let s;switch(this.scope){case bn.LOCAL:t.isShader("vertex")?s="transformed":(t.requires.position=!0,s="vPosition");break;case bn.WORLD:if(t.isShader("vertex"))return"( modelMatrix * vec4( transformed, 1.0 ) ).xyz";t.requires.worldPosition=!0,s="vWPosition";break;case bn.VIEW:s=t.isShader("vertex")?"-mvPosition.xyz":"vViewPosition";break;case bn.PROJECTION:s=t.isShader("vertex")?"( projectionMatrix * modelViewMatrix * vec4( position, 1.0 ) )":"vec4( 0.0 )";break}return t.format(s,this.getType(),e)}},Hi=bn;Hi.LOCAL="local",Hi.WORLD="world",Hi.VIEW="view",Hi.PROJECTION="projection";oi.addKeyword("position",function(){return new Hi});oi.addKeyword("worldPosition",function(){return new Hi(Hi.WORLD)});oi.addKeyword("viewPosition",function(){return new Hi(Hi.VIEW)});var Ki=class extends xt{constructor(t){super("v3"),this.nodeType="Reflect",this.scope=t!=null?t:Ki.CUBE}getUnique(t){return!t.context.viewNormal}getType(){switch(this.scope){case Ki.SPHERE:return"v2"}return this.type}generate(t,e){let i=this.getUnique(t);if(t.isShader("fragment")){let n;switch(this.scope){case Ki.VECTOR:{let r=new li(li.VIEW),s=t.context.roughness,o=r.build(t,"v3"),a=new Hi(Hi.VIEW).build(t,"v3"),l=s?s.build(t,"f"):void 0,h=`reflect( -normalize( ${a} ), ${o} )`;l&&(h=`normalize( mix( ${h}, ${o}, ${l} * ${l} ) )`);let f=`inverseTransformDirection( ${h}, viewMatrix )`;i?(t.addNodeCode(`vec3 reflectVec = ${f};`),n="reflectVec"):n=f;break}case Ki.CUBE:{let r=new Ki(Ki.VECTOR).build(t,"v3"),s="vec3( -"+r+".x, "+r+".yz )";i?(t.addNodeCode(`vec3 reflectCubeVec = ${s};`),n="reflectCubeVec"):n=s;break}case Ki.SPHERE:{let r=new Ki(Ki.VECTOR).build(t,"v3"),s="normalize( ( viewMatrix * vec4( "+r+", 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) ).xy * 0.5 + 0.5";i?(t.addNodeCode(`vec2 reflectSphereVec = ${s};`),n="reflectSphereVec"):n=s;break}}return t.format(n,this.getType(),e)}else return console.warn("ReflectNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.type,e)}},As=Ki;As.CUBE="cube",As.SPHERE="sphere",As.VECTOR="vector";var qP=class extends xt{constructor(t=new Qn,e,i){super("v4"),this.nodeType="TextureCube",this.value=t,this.radianceNode=new Ah(this.value,e!=null?e:new As(As.VECTOR),i),this.irradianceNode=new Ah(this.value,new li(li.WORLD),new Le(1).setReadonly(!0))}generate(t,e){return t.isShader("fragment")?(t.require("irradiance"),t.context.bias&&t.context.bias.setTexture(this.value),(t.slot==="irradiance"?this.irradianceNode:this.radianceNode).build(t,e)):(console.warn("TextureCubeNode is not compatible with "+t.shader+" shader."),t.format("vec4( 0.0 )",this.getType(t),e))}},XP=class extends xi{constructor(t=new Uh,e,i){super("v4",{shared:!0}),this.nodeType="CubeTexture",this.value=t,this.uv=e!=null?e:new As,this.bias=i}getTexture(t,e){return super.generate(t,e,this.value.uuid,"tc")}generate(t,e){var l,h;if(e==="samplerCube")return this.getTexture(t,e);let i=this.getTexture(t,e),n=(l=this.uv)==null?void 0:l.build(t,"v3"),r=this.bias?this.bias.build(t,"f"):void 0;r===void 0&&t.context.bias&&(r=t.context.bias.setTexture(this).build(t,"f"));let s;
vendor: 5,349 bytes, lines 3198-3236
3198r?s="texCubeBias( "+i+", "+n+", "+r+" )":s="texCube( "+i+", "+n+" )";let o={include:t.isShader("vertex"),ignoreCache:!0},a=this.getType(t);return t.addContext(o),this.colorSpace=(h=this.colorSpace)!=null?h:new rn(new Mt("",a)),this.colorSpace.fromDecoding(t.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(s),s=this.colorSpace.build(t,a),t.removeContext(),t.format(s,a,e)}},Rp=["x","y","z","w"],YP=["float","vec2","vec3","vec4"],$P={float:"f",vec2:"v2",vec3:"v3",vec4:"v4",mat4:"v4",int:"i",bool:"b","float[]":"f[]","vec4[]":"v4[]"},ZP={t:"sampler2D",tc:"samplerCube",b:"bool",i:"int",f:"float",c:"vec3",v2:"vec2",v3:"vec3",v4:"vec4",m3:"mat3",m4:"mat4","f[]":"float[]","v4[]":"vec4[]"},JP=class{constructor(){this.includes={consts:{},functions:{},structs:{}},this.cache="",this.slot="",this.shader="",this.context={},this.getIncludesCode=function(){function t(e,i){return e.deps.length-i.deps.length}return function(e,i){let n=this.getIncludes(e,i);if(!n)return"";let r="";n=n.sort(t);for(let s=0;s<n.length;s++)n[s].src&&(r+=n[s].src+`
3199`);return r}}(),this.slots=[],this.caches=[],this.contexts=[],this.keywords={},this.nodeData={},this.fragmentVariables={},this.fragmentParsVariables={},this.vertexParsVariables={},this.requires={uv:[],color:[],transparent:!1,irradiance:!1,position:!1,worldPosition:!1,normal:!1,worldNormal:!1,vWorldViewDir:!1,modelMatrix:!1,viewMatrix:!1,projectionMatrix:!1},this.includes={consts:[],functions:[],structs:[]},this.attributes={},this.prefixCode=["#ifdef TEXTURE_LOD_EXT","	#define texCube(a, b) textureCube(a, b)","	#define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)","	#define tex2D(a, b) texture2D(a, b)","	#define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)","#else","	#define texCube(a, b) textureCube(a, b)","	#define texCubeBias(a, b, c) textureCube(a, b, c)","	#define tex2D(a, b) texture2D(a, b)","	#define tex2DBias(a, b, c) texture2D(a, b, c)","#endif",`
3200			// NOTE: Include Spline's blending modes. This could be part of BlendNode
3201			#define SPE_BLENDING_NORMAL 0
3202			#define SPE_BLENDING_MULTIPLY 1
3203			#define SPE_BLENDING_SCREEN 2
3204			#define SPE_BLENDING_OVERLAY 3
3205
3206			vec3 spe_normalBlend( vec3 a, vec3 b, float alpha ) {
3207				return mix( a, b, alpha );
3208			}
3209
3210			vec3 spe_multiplyBlend( vec3 a, vec3 b, float alpha ) {
3211				return mix( a, a * b, alpha );
3212			}
3213
3214			vec3 spe_screenBlend( vec3 a, vec3 b, float alpha ) {
3215				vec3 tmp = 1.0 - ( 1.0 - a ) * ( 1.0 - b );
3216				return mix( a, tmp, alpha );
3217			}
3218
3219			vec3 spe_overlayBlend( vec3 a, vec3 b, float alpha ) {
3220				vec3 tmp = mix( 1. - 2. * (1. - a) * (1. - b), 2. * a * b, step( a, vec3(.5) ) );
3221				return clamp( mix( a, tmp, alpha ), 0.0, 1.0 );
3222			}
3223
3224			vec3 spe_blend( vec3 a, vec3 b, float alpha, int mode ) {
3225				if ( mode == SPE_BLENDING_NORMAL ) return spe_normalBlend( a, b, alpha );
3226				else if ( mode == SPE_BLENDING_MULTIPLY ) return spe_multiplyBlend( a, b, alpha );
3227				else if ( mode == SPE_BLENDING_SCREEN ) return spe_screenBlend( a, b, alpha );
3228				else if ( mode == SPE_BLENDING_OVERLAY ) return spe_overlayBlend( a, b, alpha );
3229				return vec3( 1.0 );
3230			}
3231			`,"#include <packing>","#include <common>"].join(`
3232`),this.parsCode={vertex:["float neighbor_offset = 0.0001;",""].join(`
3233`),fragment:["float accumAlpha = 0.0;",`void accumulateAlpha(float alpha) {
3234					accumAlpha += (1.0 - accumAlpha) * alpha;
3235				}`,""].join(`
3236`)},this.code={vertex:"",fragment:""},this.nodeCode={vertex:"",fragment:""},this.resultCode={vertex:"",fragment:""},this.finalCode={vertex:"",fragment:""},this.inputs={uniforms:{list:[],vertex:[],fragment:[]},arrayUniforms:{list:[],vertex:[],fragment:[]},vars:{varying:[],vertex:[],fragment:[]}},this.defines={},this.uniforms={},this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.updaters=[],this.nodes=[],this.analyzing=!1}build(t,e){this.buildShader("vertex",t),this.buildShader("fragment",e);for(let i=0;i<this.requires.uv.length;i++)if(this.requires.uv[i]){let n=i>0?i+1:"";this.addVaryCode("varying vec2 vUv"+n+";"),i>0&&this.addVertexParsCode("attribute vec2 uv"+n+";"),this.addVertexFinalCode("vUv"+n+" = uv"+n+";")}return this.requires.color[0]&&(this.addVaryCode("varying vec4 vColor;"),this.addVertexParsCode("attribute vec4 color;"),this.addVertexFinalCode("vColor = color;")),this.requires.color[1]&&(this.addVaryCode("varying vec4 vColor2;"),this.addVertexParsCode("attribute vec4 color2;"),this.addVertexFinalCode("vColor2 = color2;")),this.requires.position&&(this.addVaryCode("varying vec3 vPosition;"),this.addVertexFinalCode("vPosition = transformed;")),this.requires.worldPosition,this.requires.normal&&(this.addVaryCode("varying vec3 vObjectNormal;"),this.addVertexFinalCode("vObjectNormal = normal;")),this.requires.modelMatrix&&this.addFragmentParsCode("uniform mat4 modelMatrix;"),this.requires.viewMatrix&&this.addFragmentParsCode("uniform mat4 viewMatrix;"),this.requires.projectionMatrix&&this.addFragmentParsCode("uniform mat4 projectionMatrix;"),this.requires.worldNormal&&(this.addVaryCode("varying vec3 vWNormal;"),this.addVertexFinalCode("vWNormal = inverseTransformDirection( transformedNormal, viewMatrix ).xyz;")),this.requires.vWorldViewDir&&(this.addVaryCode("varying vec3 vWorldViewDir;"),this.addVertexFinalCode("vWorldViewDir = isPerspectiveMatrix( projectionMatrix ) ?  ( (modelMatrix * vec4(position, 1.0
3236)).xyz - cameraPosition ) : vec3( -viewMatrix[0][2], -viewMatrix[1][2], -viewMatrix[2][2] );")),this}buildShader(t,e){this.resultCode[t]=e.build(this.setShader(t),"v4")}setMaterial(t,e){return this.material=t,this.renderer=e,this.defines={},this}addFlow(t,e,i){return this.addSlot(t).addCache(e).addContext(i)}removeFlow(){return this.removeSlot().removeCache().removeContext()}addCache(t){return this.cache=t!=null?t:"",this.caches.push(this.cache),this}removeCache(){return this.caches.pop(),this.cache=this.caches[this.caches.length-1]||"",this}addContext(t){return this.context=Object.assign({},this.context,t),this.context.extra=this.context.extra||{},this.contexts.push(this.context),this}removeContext(){return this.contexts.pop(),this.context=this.contexts[this.contexts.length-1]||{},this}addSlot(t){return this.slot=t||"",this.slots.push(this.slot),this}removeSlot(){return this.slots.pop(),this.slot=this.slots[this.slots.length-1]||"",this}addFragmentVariable(t,e){this.fragmentVariables[t]===void 0&&(this.addFragmentCode(`${e} ${t};`),this.fragmentVariables[t]="")}addFragmentParsVariable(t,e){this.fragmentParsVariables[t]===void 0&&(this.addFragmentParsCode(`${e} ${t};`),this.fragmentParsVariables[t]="")}addVertexParsVariable(t,e){this.vertexParsVariables[t]===void 0&&(this.addVertexParsCode(`${e} ${t};`),this.vertexParsVariables[t]="")}addVertexCode(t){this.addCode(t,"vertex")}addFragmentCode(t){this.addCode(t,"fragment")}addCode(t,e){this.code[e!=null?e:this.shader]+=t+`
3237`}addVertexNodeCode(t){this.addNodeCode(t,"vertex")}addFragmentNodeCode(t){this.addNodeCode(t,"fragment")}addNodeCode(t,e){this.nodeCode[e!=null?e:this.shader]+=t+`
3238`}clearNodeCode(t){t=t!=null?t:this.shader;let e=this.nodeCode[t];return this.nodeCode[t]="",e}clearVertexNodeCode(){return this.clearNodeCode("vertex")}clearFragmentNodeCode(){return this.clearNodeCode("fragment")}addVertexFinalCode(t){this.addFinalCode(t,"vertex")}addFragmentFinalCode(t){this.addFinalCode(t,"fragment")}addFinalCode(t,e){this.finalCode[e!=null?e:this.shader]+=t+`
3239`}addVertexParsCode(t){this.addParsCode(t,"vertex")}addFragmentParsCode(t){this.addParsCode(t,"fragment")}addParsCode(t,e){this.parsCode[e!=null?e:this.shader]+=t+`
3240`}addVaryCode(t){this.addVertexParsCode(t),this.addFragmentParsCode(t)}isCache(t){return this.caches.indexOf(t)!==-1}isSlot(t){return this.slots.indexOf(t)!==-1}define(t,e){this.defines[t]=e===void 0?1:e}require(t){this.requires[t]=!0}isDefined(t){return this.defines[t]!==void 0}getVar(t,e,i,n="varying",r="V",s=""){let o=this.getVars(n),a=o[t];if(!a){let l=o.length;a={name:i||"node"+r+l+(s?"_"+s:""),type:e},o.push(a),o[t]=a}return a}getTempVar(t,e,i,n){return this.getVar(t,e,i,this.shader,"T",n)}getAttribute(t,e){if(!this.attributes[t]){let i=this.getVar(t,e);this.addVertexParsCode("attribute "+e+" "+t+";"),this.addVertexFinalCode(i.name+" = "+t+";"),this.attributes[t]={varying:i,name:t,type:e}}return this.attributes[t]}getCode(t){return[this.prefixCode,this.parsCode[t],this.getVarListCode(this.getVars("varying"),"varying"),this.getVarListCode(this.inputs.uniforms[t],"uniform"),this.getVarListCode(this.inputs.arrayUniforms[t],"uniform"),this.getIncludesCode("consts",t),this.getIncludesCode("structs",t),this.getIncludesCode("functions",t),"void main() {",this.getVarListCode(this.getVars(t)),this.code[t],this.resultCode[t],this.finalCode[t],"}"].join(`
3241`)}getVarListCode(t,e){e=e!=null?e:"";let i="";for(let n=0,r=t.length;n<r;++n){let s=t[n],o=s.type,a=s.name,l=s.size,h=this.getFormatByType(o);if(h===void 0)throw new Error("Node pars "+h+" not found.");h.includes("[]")?i+=e+" "+h.substring(0,h.length-2)+" "+a+`[${l}];
3242`:i+=e+" "+h+" "+a+`;
3243`}return i}getVars(t){return this.inputs.vars[t!=null?t:this.shader]}getNodeData(t){let e=t instanceof cr?t.uuid:t;return this.nodeData[e]=this.nodeData[e]||{}}createUniform(t,e,i,n,r,s){if(e.includes("[]")){let o=this.inputs.arrayUniforms,a=o.list.length,l=new Pp({type:e,size:i.size,name:n||"nodeUA"+a+(s?"_"+s:""),node:i,needsUpdate:r});return o.list.push(l),o[t].push(l),o[t][l.name]=l,this.uniforms[l.name]=l,l}else{let o=this.inputs.uniforms,a=o.list.length,l=new Pp({type:e,name:n||"nodeU"+a+(s?"_"+s:""),node:i,needsUpdate:r});return o.list.push(l),o[t].push(l),o[t][l.name]=l,this.uniforms[l.name]=l,l}}createVertexUniform(t,e,i,n,r){return this.createUniform("vertex",t,e,i,n,r)}createFragmentUniform(t,e,i,n,r){return this.createUniform("fragment",t,e,i,n,r)}include(t,e,i){var s;let n;
3243if(t=typeof t=="string"?oi.get(t):t,this.context.include===!1)return t.name;t instanceof Re?n=this.includes.functions:t instanceof dt?n=this.includes.consts:t instanceof l0&&(n=this.includes.structs);let r=n[this.shader]=n[this.shader]||[];if(t){let o=r[t.name];if(o||(o=r[t.name]={node:t,deps:[]},r.push(o),o.src=t.build(this,"source")),t instanceof Re&&e&&r[e.name]&&r[e.name].deps.indexOf(t)===-1&&(r[e.name].deps.push(t),(s=t.includes)==null?void 0:s.length)){let a=0;do this.include(t.includes[a++],e);while(a<t.includes.length)}return i&&(o.src=i),t.name}else throw new Error("Include not found.")}colorToVectorProperties(t){return t.replace("r","x").replace("g","y").replace("b","z").replace("a","w")}colorToVector(t){return t.replace(/c/g,"v3")}getIncludes(t,e){return this.includes[t][e||this.shader]}getConstructorFromLength(t){return YP[t-1]}isTypeMatrix(t){return/^m/.test(t)}getTypeLength(t){return t==="f"?1:parseInt(this.colorToVector(t).substr(1))}getTypeFromLength(t){return t===1?"f":"v"+t}findNode(...t){for(let e=0;e<arguments.length;e++){let i=t[e];if(i!=null&&i.isNode)return i}}resolve(...t){for(let e=0;e<arguments.length;e++){let i=t[e];if(i!==void 0){if(i.isNode)return i;if(i.isTexture)switch(i.mapping){case Rr:case Ir:return new XP(i);case Po:return new qP(new Qn(i));default:return new Qn(i)}else{if(i.isVector2)return new Ti(i);if(i.isVector3)return new Mi(i);if(i.isVector4)return new br(i)}}}}format(t,e,i){switch(this.colorToVector(i+" <- "+e)){case"f <- v2":return t+".x";case"f <- v3":return t+".x";case"f <- v4":return t+".x";case"f <- i":case"f <- b":return"float( "+t+" )";case"v2 <- f":return"vec2( "+t+" )";case"v2 <- v3":return t+".xy";case"v2 <- v4":return t+".xy";case"v2 <- i":case"v2 <- b":return"vec2( float( "+t+" ) )";case"v3 <- f":return"vec3( "+t+" )";case"v3 <- v2":return"vec3( "+t+", 0.0 )";case"v3 <- v4":return t+".xyz";case"v3 <- i":case"v3 <- b":return"vec2( float( "+t+" ) )";case"v4 <- f":return"vec4( "+t+" )";case"v4 <- v2":return"vec4( "+t+", 0.0, 1.0 )";case"v4 <- v3":return"vec4( "+t+", 1.0 )";case"v4 <- i":case"v4 <- b":return"vec4( float( "+t+" ) )";case"i <- f":case"i <- b":return"int( "+t+" )";case"i <- v2":return"int( "+t+".x )";case"i <- v3":return"int( "+t+".x )";case"i <- v4":return"int( "+t+".x )";case"b <- f":return"( "+t+" != 0.0 )";case"b <- v2":return"( "+t+" != vec2( 0.0 ) )";case"b <- v3":return"( "+t+" != vec3( 0.0 ) )";case"b <- v4":return"( "+t+" != vec4( 0.0 ) )";case"b <- i":return"( "+t+" != 0 )"}return t}getTypeByFormat(t){return $P[t]||t}getFormatByType(t){return ZP[t]||t}getUUID(t,e){return e=e!==void 0?e:!0,e&&this.cache&&(t=this.cache+"-"+t),t}getElementByIndex(t){return Rp[t]}getIndexByElement(t){return Rp.indexOf(t)}isShader(t){return this.shader===t}setShader(t){return this.shader=t,this}mergeDefines(t){for(let e in t)this.defines[e]=t[e];return this.defines}mergeUniform(t){for(let e in t)this.uniforms[e]=t[e];return this.uniforms}getTextureEncodingFromMap(t){let e;return t?t.isTexture&&(e=t.encoding):e=ln,e===ln&&this.context.gamma&&(e=Et),e}},Rt=class extends xi{constructor(t=0,e,i,n){super("c"),this.nodeType="Color",this.value=t instanceof ji?t:new ji(t||0,e,i,n)}setRGBA(t){this.value.setRGBA(t.r,t.g,t.b,t.a)}generate(t,e,i,n,r,s){i=t.getUUID(i!=null?i:this.getUUID()),n=n!=null?n:this.getType(t);let o=t.getNodeData(i),a=this.getReadonly()&&this.generateReadonly!==void 0;if(this.alpha){let l=this.alpha.build(t,"f");t.addFragmentNodeCode(`accumAlpha += ( 1.0 - accumAlpha ) * ${l};`)}return a?this.generateReadonly(t,e,i,n,r,s):t.isShader("vertex")?(o.vertex||(o.vertex=t.createVertexUniform(n,this,r,s,this.getLabel())),t.format(o.vertex.name,n,e)):(o.fragment||(o.fragment=t.createFragmentUniform(n,this,r,s,this.getLabel())),t.format(o.fragment.name,n,e))}generateReadonly(t,e,i,n,r,s){return t.format("vec3("+this.value.r+", "+this.value.g+", "+this.value.b+")",n,e)}},pt=class extends xi{constructor(t){super("i"),this.nodeType="Int",this.value=Math.floor(t!=null?t:0)}generateReadonly(t,e,i,n,r,s){return t.format(this.value.toString(),n,e)}},h0=class extends cr{constructor(){super("basic"),this.nodeType="Basic",this.color=new Rt(5855577),this.shadingAlp
3243ha=new Le(1),this.shadingBlend=new pt(0)}generate(t){let e;if(t.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(t,"v3",{cache:"position"}):void 0;t.mergeUniform(Is.merge([ge.fog])),t.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <normal_pars_vertex>"].join(`
3244`));let n=["#include <beginnormal_vertex>",`
3245				#if !defined( USE_LAYER_DISPLACE )
3246					#include <defaultnormal_vertex>
3247				#endif
3248
3249				vec3 displaced_position = position;
3250				vec3 displaced_normal = normal;
3251
3252				#if defined( USE_LAYER_DISPLACE )
3253					vec3 transformed;
3254					vec3 transformedNormal;
3255				#endif
3256				`,"#include <normal_vertex>",`
3257				#if !defined( USE_LAYER_DISPLACE )
3258					#include <begin_vertex>
3259				#endif /* !USE_LAYER_DISPLACE */
3260				`];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","	vNormal = transformedNormal;","#endif"),n.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>","	vViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>"),n.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),e=n.join(`
3261`)}else{this.color===void 0&&(this.color=new Rt(5855577)),this.color.analyze(t,{slot:"color"}),this.alpha&&this.alpha.analyze(t),this.afterColor&&this.afterColor.analyze(t,{slot:"afterColor"});let i=this.color.flow(t,"c",{slot:"color"}),n=this.alpha?this.alpha.flow(t,"f"):void 0,r=this.afterColor?this.afterColor.flow(t,"c",{slot:"afterColor"}):void 0;t.requires.transparent=n!==void 0,t.addParsCode(["varying vec3 vWPosition;","#include <fog_pars_fragment>","#include <dithering_pars_fragment>","varying vec3 vViewPosition;","#include <normal_pars_fragment>"].join(`
3262`));let s=["#include <normal_fragment_begin>",i.code];n&&s.push(n.code,"#ifdef ALPHATEST"," if ( "+n.result+" <= ALPHATEST ) discard;","#endif"),r?s.push(r.code,`vec3 outgoingLight = ${i.result};`,`vec3 finalColor = spe_blend(outgoingLight, ${r.result}, 1.0, SPE_BLENDING_NORMAL);`):s.push(`vec3 finalColor = ${i.result};`),n?s.push(`gl_FragColor = vec4( finalColor, accumAlpha * ${n.result} );`):s.push("gl_FragColor = vec4("+i.result+", 1.0 );"),s.push("#include <fog_fragment>","#include <dithering_fragment>"),e=s.join(`
3263`)}return e}},to=class extends xi{constructor(t){super("b"),this.nodeType="Bool",this.value=t!=null?t:!1}generateReadonly(t,e,i,n){return t.format(this.value?"true":"false",n,e)}},u0=class extends xi{constructor(t){super("m3"),this.nodeType="Matrix3",this.value=t!=null?t:new qt}generateReadonly(t,e,i,n,r,s){return t.format("mat3("+this.value.elements.join(", ")+")",n,e)}get elements(){return this.value.elements}set elements(t){this.value.fromArray(t)}},yr=class extends xi{constructor(t=1,e){super("f[]"),this.nodeType="FloatArray",this.size=t,this.value=Array.isArray(e)?e:typeof e=="number"?new Array(t).fill(e):new Array(t).fill(0)}},xr=class extends xi{constructor(t=1,e){super("v4[]"),this.nodeType="Vector4Array",this.size=t,this.value=Array.isArray(e)?e:e instanceof tt?new Array(t).fill(e):new Array(t).fill(new tt(0))}},Mu=(t=>(t.SIMPLEX="simplex3d",t.SIMPLEX_FRACTAL="simplex3dFractal",t.ASHIMA="simplexAshima",t.FBM="fbm",t.PERLIN="perlin",t))(Mu||{}
3263),Pi=function(){let t=new Re(`vec3 random3(vec3 c) {
3264			float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));
3265			vec3 r;
3266			r.z = fract(512.0*j);
3267			j *= .125;
3268			r.x = fract(512.0*j);
3269			j *= .125;
3270			r.y = fract(512.0*j);
3271			return r-0.5;
3272		}`),e=new Re(`float simplex3d(vec3 p) {
3273			 vec3 s = floor(p + dot(p, vec3(F3)));
3274			 vec3 x = p - s + dot(s, vec3(G3));
3275			 
3276			 vec3 e = step(vec3(0.0), x - x.yzx);
3277			 vec3 i1 = e*(1.0 - e.zxy);
3278			 vec3 i2 = 1.0 - e.zxy*(1.0 - e);
3279				
3280			 vec3 x1 = x - i1 + G3;
3281			 vec3 x2 = x - i2 + 2.0*G3;
3282			 vec3 x3 = x - 1.0 + 3.0*G3;
3283			 
3284			 vec4 w, d;
3285			 
3286			 w.x = dot(x, x);
3287			 w.y = dot(x1, x1);
3288			 w.z = dot(x2, x2);
3289			 w.w = dot(x3, x3);
3290			 
3291			 w = max(0.6 - w, 0.0);
3292			 
3293			 d.x = dot(random3(s), x);
3294			 d.y = dot(random3(s + i1), x1);
3295			 d.z = dot(random3(s + i2), x2);
3296			 d.w = dot(random3(s + 1.0), x3);
3297			 
3298			 w *= w;
3299			 w *= w;
3300			 d *= w;
3301			 
3302			 return dot(d, vec4(52.0));
3303		}`,[t]);e.keywords.F3=new dt("float F3 0.3333333"),e.keywords.G3=new dt("float G3 0.1666667");let i=new Re(`float simplex3dFractal(vec3 m) {
3304			mat3 rot1 = mat3(-0.37, 0.36, 0.85,-0.14,-0.93, 0.34,0.92, 0.01,0.4);
3305			mat3 rot2 = mat3(-0.55,-0.39, 0.74, 0.33,-0.91,-0.24,0.77, 0.12,0.63);
3306			mat3 rot3 = mat3(-0.71, 0.52,-0.47,-0.08,-0.72,-0.68,-0.7,-0.45,0.56);
3307			return 0.5333333 * simplex3d(m * rot1)
3308				 + 0.2666667 * simplex3d(2.0 * m * rot2)
3309				 + 0.1333333 * simplex3d(4.0 * m * rot3)
3310				 + 0.0666667 * simplex3d(8.0 * m);
3311		}`,[e]),n=new Re("vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}"),r=new Re("vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}"),s=new Re(`float simplexAshima(vec3 v) {
3312		  const vec2  C = vec2(1.0/6.0, 1.0/3.0) ;
3313		  const vec4  D = vec4(0.0, 0.5, 1.0, 2.0);
3314		  vec3 i  = floor(v + dot(v, C.yyy) );
3315		  vec3 x0 =   v - i + dot(i, C.xxx) ;
3316		  vec3 g = step(x0.yzx, x0.xyz);
3317		  vec3 l = 1.0 - g;
3318		  vec3 i1 = min( g.xyz, l.zxy );
3319		  vec3 i2 = max( g.xyz, l.zxy );
3320		  vec3 x1 = x0 - i1 + 1.0 * C.xxx;
3321		  vec3 x2 = x0 - i2 + 2.0 * C.xxx;
3322		  vec3 x3 = x0 - 1. + 3.0 * C.xxx;
3323		  i = mod(i, 289.0 ); 
3324		  vec4 p = permute( permute( permute( 
3325					 i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
3326				   + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) 
3327				   + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
3328		  float n_ = 1.0/7.0; // N=7
3329		  vec3  ns = n_ * D.wyz - D.xzx;
3330		  vec4 j = p - 49.0 * floor(p * ns.z *ns.z);  //  mod(p,N*N)
3331		  vec4 x_ = floor(j * ns.z);
3332		  vec4 y_ = floor(j - 7.0 * x_ );    // mod(j,N)
3333		  vec4 x = x_ *ns.x + ns.yyyy;
3334		  vec4 y = y_ *ns.x + ns.yyyy;
3335		  vec4 h = 1.0 - abs(x) - abs(y);
3336		  vec4 b0 = vec4( x.xy, y.xy );
3337		  vec4 b1 = vec4( x.zw, y.zw );
3338		  vec4 s0 = floor(b0)*2.0 + 1.0;
3339		  vec4 s1 = floor(b1)*2.0 + 1.0;
3340		  vec4 sh = -step(h, vec4(0.0));
3341		  vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
3342		  vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
3343		  vec3 p0 = vec3(a0.xy,h.x);
3344		  vec3 p1 = vec3(a0.zw,h.y);
3345		  vec3 p2 = vec3(a1.xy,h.z);
3346		  vec3 p3 = vec3(a1.zw,h.w);
3347		  vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
3348		  p0 *= norm.x;
3349		  p1 *= norm.y;
3350		  p2 *= norm.z;
3351		  p3 *= norm.w;
3352		  vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
3353		  m = m * m;
3354		  return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), 
3355										dot(p2,x2), dot(p3,x3) ) );
3356		}`,[n,r]),o=new Re("vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}"),a=new Re("vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}",[o]),l=new Re(`float noise(vec3 p){
3357			vec3 a = floor(p);
3358			vec3 d = p - a;
3359			d = d * d * (3.0 - 2.0 * d);
3360			vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);
3361			vec4 k1 = perm(b.xyxy);
3362			vec4 k2 = perm(k1.xyxy + b.zzww);
3363			vec4 c = k2 + a.zzzz;
3364			vec4 k3 = perm(c);
3365			vec4 k4 = perm(c + 1.0);
3366			vec4 o1 = fract(k3 * (1.0 / 41.0));
3367			vec4 o2 = fract(k4 * (1.0 / 41.0));
3368			vec4 o3 = o2 * d.z + o1 * (1.0 - d.z);
3369			vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);
3370			return o4.y * d.y + o4.x * (1.0 - d.y);
3371		}`,[a]),h=new Re(`float fbm(vec3 x) {
3372			float v = 0.0;
3373			float a = 0.5;
3374			vec3 shift = vec3(100);
3375			for (int i = 0; i < NUM_OCTAVES; ++i) {
3376				v += a * noise(x);
3377				x = x * 2.0 + shift;
3378				a *= 0.5;
3379			}
3380			return v;
3381		}`,[l]);h.keywords.NUM_OCTAVES=new dt(`int NUM_OCTAVES ${5}`);let f=new Re("vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}"),c=new Re(`float perlin(vec3 P){
3382		  vec3 Pi0 = floor(P);
3383		  vec3 Pi1 = Pi0 + vec3(1.0);
3384		  Pi0 = mod(Pi0, 289.0);
3385		  Pi1 = mod(Pi1, 289.0);
3386		  vec3 Pf0 = fract(P);
3387		  vec3 Pf1 = Pf0 - vec3(1.0);
3388		  vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
3389		  vec4 iy = vec4(Pi0.yy, Pi1.yy);
3390		  vec4 iz0 = Pi0.zzzz;
3391		  vec4 iz1 = Pi1.zzzz;
3392		  vec4 ixy = permute(permute(ix) + iy);
3393		  vec4 ixy0 = permute(ixy + iz0);
3394		  vec4 ixy1 = permute(ixy + iz1);
3395		  vec4 gx0 = ixy0 / 7.0;
3396		  vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5;
3397		  gx0 = fract(gx0);
3398		  vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
3399		  vec4 sz0 = step(gz0, vec4(0.0));
3400		  gx0 -= sz0 * (step(0.0, gx0) - 0.5);
3401		  gy0 -= sz0 * (step(0.0, gy0) - 0.5);
3402		  vec4 gx1 = ixy1 / 7.0;
3403		  vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5;
3404		  gx1 = fract(gx1);
3405		  vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
3406		  vec4 sz1 = step(gz1, vec4(0.0));
3407		  gx1 -= sz1 * (step(0.0, gx1) - 0.5);
3408		  gy1 -= sz1 * (step(0.0, gy1) - 0.5);
3409		  vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);
3410		  vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);
3411		  vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);
3412		  vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);
3413		  vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);
3414		  vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);
3415		  vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);
3416		  vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);
3417		  vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
3418		  g000 *= norm0.x;
3419		  g010 *= norm0.y;
3420		  g100 *= norm0.z;
3421		  g110 *= norm0.w;
3422		  vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
3423		  g001 *= norm1.x;
3424		  g011 *= norm1.y;
3425		  g101 *= norm1.z;
3426		  g111 *= norm1.w;
3427		  float n000 = dot(g000, Pf0);
3428		  float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));
3429		  float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));
3430		  float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));
3431		  float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));
3432		  float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));
3433		  float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));
3434		  float n111 = dot(g111, Pf1);
3435		  vec3 fade_xyz = fade(Pf0);
3436		  vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
3437		  vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
3438		  float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); 
3439		  return 2.2 * n_xyz;
3440		}`,[n,r,f]);
3440return{simplex:e,simplexFractal:i,simplexAshima:s,fbm:h,perlin:c}}(),d0=class extends xt{constructor(t,e,i,n,r,s,o,a,l,h,f,c){super("v3"),this.nodeType="Noise",this.scale=t,this.size=e,this.move=i,this.fA=n,this.fB=r,this.distortion=s,this.colorA=o,this.colorB=a,this.colorC=l,this.colorD=h,this.alpha=f,this.noiseType=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e,i,n,r){t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let s=Object.values(Mu)[this.noiseType.value],o=new Re(`vec3 ${s}customNoise(float scale, vec3 size, float move, vec2 fA, vec2 fB, vec2 distortion, vec4 colorA, vec4 colorB, vec4 colorC, vec4 colorD, float alpha, out float calpha) {
3441                vec3 st = position / size;
3442				st /= scale;
3443				vec3 q = vec3(${s}(st),
3444							  ${s}(st + vec3(1.0)),
3445							  ${s}(st + vec3(1.0)));
3446				vec3 r = vec3(${s}(st + vec3(distortion, 1.0) * q + vec3(fA, 1.0) + move),
3447							  ${s}(st + vec3(distortion, 1.0) * q + vec3(fB, 1.0) + move), 
3448							  ${s}(st * q));
3449				float f = ${s}(st + r);
3450				vec4 color;
3451				color = mix(colorA, colorB, clamp((f * f) * 4.0, 0.0, 1.0));
3452				color = mix(color, colorC, clamp(length(q), 0.0, 1.0));
3453				color = mix(color, colorD, clamp(length(r.x), 0.0, 1.0));
3454
3455                float lalpha = alpha * color.a;
3456                calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3457
3458			    accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
3459				return clamp(color, 0.0, 1.0).rgb;
3460			}`,[Pi.simplex,Pi.simplexFractal,Pi.simplexAshima,Pi.fbm,Pi.perlin]),a=t.include(o),l=[];return l.push(this.scale.build(t,"f")),l.push(this.size.build(t,"v3")),l.push(this.move.build(t,"f")),l.push(this.fA.build(t,"v2")),l.push(this.fB.build(t,"v2")),l.push(this.distortion.build(t,"v2")),l.push(this.colorA.build(t,"v4")),l.push(this.colorB.build(t,"v4")),l.push(this.colorC.build(t,"v4")),l.push(this.colorD.build(t,"v4")),l.push(this.alpha.build(t,"f")),l.push(this.calpha),t.format(a+"("+l.join(",")+")",this.getType(t),e)}};d0.numOctaves=5;var KP=class extends cr{constructor(){super("phong"),this.nodeType="Phong",this.color=new Rt(5855577),this.specular=new Rt(1118481),this.shininess=new Le(30),this.shadingAlpha=new Le(1),this.shadingBlend=new pt(0)}build(t){let e;if(t.define("PHONG"),t.requires.lights=!0,t.extensions.derivatives=!0,t.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(t,"v3",{cache:"position"}):void 0;t.mergeUniform(Is.merge([ge.fog,ge.lights])),t.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <normal_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
3461`));let n=["#include <beginnormal_vertex>",`
3462				#ifndef USE_LAYER_DISPLACE
3463					#include <defaultnormal_vertex>
3464				#endif
3465
3466
3467				vec3 displaced_position = position;
3468				vec3 displaced_normal = normal;
3469
3470				#ifdef USE_LAYER_DISPLACE
3471					vec3 transformed;
3472					vec3 transformedNormal;
3473				#endif
3474				`,"#include <normal_vertex>",`
3475				#ifndef USE_LAYER_DISPLACE
3476					#include <begin_vertex>
3477				#endif
3478				`];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";
3478":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","    vNormal = transformedNormal;","#endif"),n.push("	#include <project_vertex>","	#include <clipping_planes_vertex>","	vViewPosition = - mvPosition.xyz;","	#include <worldpos_vertex>","	#include <shadowmap_vertex>","	#include <fog_vertex>"),n.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),e=n.join(`
3479`)}else{t.mergeUniform({penumbraSize:Ei.penumbraSize}),this.color===void 0&&(this.color=new Rt(5855577)),this.color.analyze(t,{slot:"color"}),this.specular.analyze(t),this.shininess.analyze(t),this.shadingAlpha.analyze(t),this.shadingBlend.analyze(t),this.afterColor&&this.afterColor.analyze(t,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(t);let i=this.color.flow(t,"c",{slot:"color"}),n=this.specular.flow(t,"c"),r=this.shininess.flow(t,"f"),s=this.shadingAlpha.flow(t,"f"),o=this.shadingBlend.flow(t,"i"),a=this.afterColor?this.afterColor.flow(t,"c",{slot:"afterColor"}):void 0,l=this.alpha?this.alpha.flow(t,"f"):void 0;t.requires.transparent=l!==void 0,t.addParsCode(["varying vec3 vWPosition;","uniform vec3 emissive;",`uniform float penumbraSize[${5}];`,"#include <normal_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <lights_phong_pars_fragment>","#include <shadowmap_pars_fragment>","#include <dithering_pars_fragment>"].join(`
3480`));let h=["#include <normal_fragment_begin>",`
3481				// NOTE: gl_FrontFacing alternative using face normal estimation.
3482				vec3 viewdx = dFdx(vViewPosition);
3483				vec3 viewdy = dFdy(vViewPosition);
3484				vec3 faceNormal = normalize(cross(viewdx,viewdy));
3485				if (dot(normal, faceNormal) < 0.0) {
3486					normal *= -1.0;
3487				}
3488				`,"	BlinnPhongMaterial material;"];h.push(i.code,"	vec3 diffuseColor = "+i.result+";","	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );","	vec3 totalEmissiveRadiance = emissive;",n.code,"	vec3 specular = "+n.result+";",r.code,"	float shininess = max( 0.0001, "+r.result+" );","	float specularStrength = 1.0;"),l&&h.push(l.code,"#ifdef ALPHATEST","if ( "+l.result+" <= ALPHATEST ) discard;","#endif"),h.push("material.diffuseColor = diffuseColor;"),h.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),h.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;"),h.push(`
3489				if (outgoingLight != diffuseColor) {
3490					float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
3491					accumAlpha += ( 1.0 - accumAlpha ) * ${s.result} * lightAccu;
3492					outgoingLight = spe_blend( diffuseColor, outgoingLight, ${s.result}, ${o.result} );
3493				}
3494				`),a&&h.push(a.code,`outgoingLight = spe_blend(outgoingLight, ${a.result}, 1.0, SPE_BLENDING_NORMAL);`),l?h.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${l.result} );`):h.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),h.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),e=h.join(`
3495`)}return e}},f0=class extends xt{constructor(t,e,i,n,r,s,o){super("v3"),this.nodeType="Fresnel",this.color=t,this.bias=e,this.scale=i,this.intensity=n,this.factor=r,this.alpha=s,this.mode=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.require("vWorldViewDir"),t.require("worldNormal"),t.isShader("fragment")){t.addFragmentVariable(this.calpha,"float");let i=t.include(f0.Nodes.fresnel),n=[];return n.push(this.color.build(t,"c")),n.push(this.bias.build(t,"f")),n.push(this.scale.build(t,"f")),n.push(this.intensity.build(t,"f")),n.push(this.factor.build(t,"f")),n.push(this.alpha.build(t,"f")),n.push(this.mode.build(t,"i")),n.push(this.calpha),t.format(i+"("+n.join(",")+")",this.getType(t),e)}else return console.warn("FresnelNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),e)}},p0=f0;
3495p0.Nodes=function(){return{fresnel:new Re(`vec3 fresnel(vec3 color, float bias, float scale, float intensity, float factor, float alpha, int mode, out float calpha) {
3496				float fresnel = bias + scale * pow( abs( factor + dot( normalize( vWorldViewDir ), normalize( vWNormal ) ) ), intensity );
3497
3498				float lalpha = clamp( fresnel, 0.0, 1.0 ) * alpha;
3499				calpha = lalpha / clamp(lalpha + accumAlpha, 0.001, 1.0);
3500				accumAlpha += (1.0 - accumAlpha) * lalpha;
3501				return color;
3502			}`)}}();var m0=class extends xt{constructor(t,e,i,n,r,s,o){super("v3"),this.nodeType="Rainbow",this.filmThickness=t,this.movement=e,this.wavelengths=i,this.noiseStrength=n,this.noiseScale=r,this.offset=s,this.alpha=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.require("vWorldViewDir"),t.require("worldNormal"),t.isShader("fragment")){t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let i=t.include(m0.Nodes.rainbow),n=[];return n.push(this.filmThickness.build(t,"f")),n.push(this.movement.build(t,"f")),n.push(this.wavelengths.build(t,"v3")),n.push(this.noiseStrength.build(t,"f")),n.push(this.noiseScale.build(t,"f")),n.push(this.offset.build(t,"v3")),n.push(this.alpha.build(t,"f")),n.push(this.calpha),t.format(i+"("+n.join(",")+")",this.getType(t),e)}else return console.warn("RainbowNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),e)}},g0=m0;g0.Nodes=function(){let t=new Re(`vec3 attenuation(vec3 wavelengths, float filmThickness, float movement, float noiseStrength, float noiseScale, vec3 offset) {
3503                 vec3 st = position / noiseScale;
3504				 vec3 q = vec3(simplex3d(st),
3505							  simplex3d(st + vec3(1.0)),
3506							  simplex3d(st + vec3(1.0)));
3507
3508				 vec3 r = vec3(simplex3d(st + vec3(1.4, 1.3, 1.0) * q + vec3(1.7, 9.2, 1.0)),
3509							  simplex3d(st + vec3(2.0, 1.2, 1.0) * q + vec3(8.3, 2.8, 1.0)),
3510							  simplex3d(st * q));
3511
3512                 float noise = simplex3d(st + r);
3513
3514                 return .5 + .5 * cos((((filmThickness + (noise * noiseStrength)) / (vec3(wavelengths.r * 1.0, wavelengths.g * 0.8, wavelengths.b * 0.6) + 1.0)) * dot(normalize(vWorldViewDir + (offset * -0.001)), normalize(vWNormal))) + movement);
3515             }`,[Pi.simplex]);return{rainbow:new Re(`vec3 rainbow(float filmThickness, float movement, vec3 wavelengths, float noiseStrength, float noiseScale, vec3 offset, float alpha, out float calpha) {
3516                 vec3 res = clamp(attenuation(wavelengths, filmThickness, movement, noiseStrength, noiseScale, offset), 0.0, 2.0);
3517
3518                 float rainbowContribution = clamp(res.r + res.g + res.b, 0.0, 1.0);
3519                 float lalpha = alpha * rainbowContribution;
3520                 calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3521                 accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
3522
3523                 return res;
3524             }`,[t])}}();var v0=class extends xt{constructor(t,e,i,n,r,s,o,a,l,h,f,c,u,d,m,g){super("v3"),this.nodeType="Outline",this.firstTime=!0,this.outlineColor=t,this.contourColor=e,this.outlineWidth=i,this.contourWidth=n,this.contourThreshold=r,this.outlineThreshold=s,this.contourFrequency=o,this.outlineSmoothing=a,this.contourDirection=l,this.positionalLines=h,this.compensation=f,this.resolution=c,this.normalMap=u,this.depthMap=d,this.pixelRatio=m,this.alpha=g,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.require("vWorldViewDir"),t.require("worldNormal"),t.extensions.derivatives=!0,this.firstTime){let i=this.outlineWidth.build(t,"f"),n=this.resolution.build(t,"v2"),r=this.compensation.build(t,"b"),s=this.pixelRatio.build(t,"f");t.addVertexParsVariable("randomColor","attribute vec3"),t.addVertexParsVariable("extrudeNormal","attribute vec3"),t.addVertexParsVariable(i,"uniform float"),t.addVertexParsVariable(n,"uniform vec2"),t.addVertexParsVariable(r,"uniform bool"),t.addVertexParsVariable(s,"uniform float"),t.addVertexParsVariable("vID","flat out float"),t.addFragmentParsVariable("vID","flat in float");let o=`g${this.uuid.toString().replace(/-/g,"")}`;t.addVertexFinalCode(`
3525                vID = randomColor.r;
3526                if (${r}) {
3527                    vec4 ${o}_clipPosition = projectionMatrix * (modelViewMatrix * vec4(position, 1.0
3527));
3528                    // NOTE: For certain shapes, like spheres, we get incorrect extrusion when the
3529                    // normals face the camera directly. So we hackily fix this by offsetting the normal
3530                    // by a tiny amount.
3531                    vec3 ${o}_clipNormal = mat3(projectionMatrix) * (mat3(modelViewMatrix) * extrudeNormal) + 0.0000001;
3532                    vec2 ${o}_offset = normalize(${o}_clipNormal.xy) / ${n} * (${i} / 2.0) * ${o}_clipPosition.w * 2.0 * ${s};
3533                    ${o}_clipPosition.xy += ${o}_offset;
3534                    // TODO(MAX): To handle multiple outline layers, we only want to extrude
3535                    // if this offset is the biggest of all the potential offsets
3536                    gl_Position = ${o}_clipPosition;
3537                }
3538            `)}if(t.isShader("fragment")){t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let i=t.include(v0.Nodes.outline),n=[];return n.push(this.outlineColor.build(t,"c")),n.push(this.contourColor.build(t,"c")),n.push(this.outlineWidth.build(t,"f")),n.push(this.contourWidth.build(t,"f")),n.push(this.contourThreshold.build(t,"f")),n.push(this.outlineThreshold.build(t,"f")),n.push(this.contourFrequency.build(t,"f")),n.push(this.outlineSmoothing.build(t,"f")),n.push(this.contourDirection.build(t,"v3")),n.push(this.positionalLines.build(t,"b")),n.push(this.resolution.build(t,"v2")),n.push(this.normalMap.getTexture(t,"t")),n.push(this.depthMap.getTexture(t,"t")),n.push(this.pixelRatio.build(t,"f")),n.push(this.compensation.build(t,"b")),n.push(this.alpha.build(t,"f")),n.push(this.calpha),this.firstTime=!this.firstTime,t.format(i+"("+n.join(",")+")",this.getType(t),e)}else return console.warn("OutlineNode is not compatible with "+t.shader+" shader."),""}},y0=v0;y0.Nodes=function(){let t=new Re(`
3539float sobelSample(sampler2D t, sampler2D d, vec2 uv, vec2 resolution, float outlineWidth, float pixelRatio)
3540{
3541    vec2 texelSize = (vec2(1.0) / resolution) * outlineWidth * pixelRatio;
3542
3543    vec2 uvSamples[9];
3544    vec4 normalSamples[9];
3545
3546	uvSamples[0] = uv + vec2( -texelSize.x, -texelSize.y);
3547	uvSamples[1] = uv + vec2(0.0, -texelSize.y);
3548	uvSamples[2] = uv + vec2(  texelSize.x, -texelSize.y);
3549	uvSamples[3] = uv + vec2( -texelSize.x, 0.0);
3550	uvSamples[4] = uv;
3551	uvSamples[5] = uv + vec2(  texelSize.x, 0.0);
3552	uvSamples[6] = uv + vec2( -texelSize.x, texelSize.y);
3553	uvSamples[7] = uv + vec2(0.0, texelSize.y);
3554	uvSamples[8] = uv + vec2(  texelSize.x, texelSize.y);
3555
3556
3557    normalSamples[0] = texture2D(t, uvSamples[0]);
3558    normalSamples[1] = texture2D(t, uvSamples[1]);
3559    normalSamples[2] = texture2D(t, uvSamples[2]);
3560    normalSamples[3] = texture2D(t, uvSamples[3]);
3561    normalSamples[4] = texture2D(t, uvSamples[4]);
3562    normalSamples[5] = texture2D(t, uvSamples[5]);
3563    normalSamples[6] = texture2D(t, uvSamples[6]);
3564    normalSamples[7] = texture2D(t, uvSamples[7]);
3565    normalSamples[8] = texture2D(t, uvSamples[8]);
3566
3567    float depthBias = 0.0001;
3568    // TODO(MAX): Can we somehow reduce the number of conditionals here with MATH?!
3569    if (normalSamples[0].a != vID && normalSamples[0].a != 0.0) {
3570        float depthAtSample = texture2D(d, uvSamples[0]).r + depthBias;
3571        if (gl_FragCoord.z > depthAtSample) {
3572           return 0.0;
3573        }
3574    }
3575
3576    if (normalSamples[1].a != vID && normalSamples[1].a != 0.0) {
3577        float depthAtSample = texture2D(d, uvSamples[1]).r + depthBias;
3578        if (gl_FragCoord.z > depthAtSample) {
3579           return 0.0;
3580        }
3581    }
3582
3583    if (normalSamples[2].a != vID && normalSamples[2].a != 0.0) {
3584        float depthAtSample = texture2D(d, uvSamples[2]).r + depthBias;
3585        if (gl_FragCoord.z > depthAtSample) {
3586           return 0.0;
3587        }
3588    }
3589
3590    if (normalSamples[3].a != vID && normalSamples[3].a != 0.0) {
3591        float depthAtSample = texture2D(d, uvSamples[3]).r + depthBias;
3592        if (gl_FragCoord.z > depthAtSample) {
3593           return 0.0;
3594        }
3595    }
3596
3597
3598    if (normalSamples[4].a != vID && normalSamples[4].a != 0.0) {
3599        float depthAtSample = texture2D(d, uvSamples[4]).r + depthBias;
3600        if (gl_FragCoord.z > depthAtSample) {
3601           return 0.0;
3602        }
3603    }
3604
3605    if (normalSamples[5].a != vID && normalSamples[5].a != 0.0) {
3606        float depthAtSample = texture2D(d, uvSamples[5]).r + depthBias;
3607        if (gl_FragCoord.z > depthAtSample) {
3608           return 0.0;
3609        }
3610    }
3611
3612    if (normalSamples[6].a != vID && normalSamples[6].a != 0.0) {
3613        float depthAtSample = texture2D(d, uvSamples[6]).r + depthBias;
3614        if (gl_FragCoord.z > depthAtSample) {
3615           return 0.0;
3616        }
3617    }
3618
3619    if (normalSamples[7].a != vID && normalSamples[7].a != 0.0) {
3620        float depthAtSample = texture2D(d, uvSamples[7]).r + depthBias;
3621        if (gl_FragCoord.z > depthAtSample) {
3622           return 0.0;
3623        }
3624    }
3625
3626    if (normalSamples[8].a != vID && normalSamples[8].a != 0.0) {
3627        float depthAtSample = texture2D(d, uvSamples[8]).r + depthBias;
3628        if (gl_FragCoord.z > depthAtSample) {
3629           return 0.0;
3630        }
3631    }
3632
3633    vec4 sobel_edge_h = normalSamples[2] + (2.0*normalSamples[5]) + normalSamples[8] - (normalSamples[0] + (2.0*normalSamples[3]) + normalSamples[6]);
3634  	vec4 sobel_edge_v = normalSamples[0] + (2.0*normalSamples[1]) + n
3634ormalSamples[2] - (normalSamples[6] + (2.0*normalSamples[7]) + normalSamples[8]);
3635
3636    float edgeNormal = sqrt(dot(sobel_edge_h, sobel_edge_h) + dot(sobel_edge_v, sobel_edge_v));
3637    return edgeNormal;
3638}
3639`);return{outline:new Re(`vec3 outline(vec3 outlineColor, vec3 contourColor, float outlineWidth, float contourWidth, float outlineThreshold, float contourThreshold, float outlineSmoothing, float contourFrequency, vec3 contourDirection, bool positionalLines, vec2 resolution, sampler2D normalMap, sampler2D depthMap, float pixelRatio, bool compensation, float alpha, out float calpha) {
3640                vec3 result = outlineColor;
3641                float resultAlpha = 0.0;
3642
3643                vec3 N = normalize(vWNormal);
3644                vec2 nuv = (gl_FragCoord.xy / resolution);
3645                float sobelSample = compensation ? sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth / 2., pixelRatio) : sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth, pixelRatio);
3646                resultAlpha = smoothstep(outlineThreshold - outlineSmoothing, outlineThreshold + outlineSmoothing, sobelSample);
3647
3648                float t = 1.0 - contourThreshold;
3649                if(positionalLines) {
3650                    vec3 NDir = position * contourDirection;
3651                    float NT = NDir.x + NDir.y + NDir.z;
3652                    float f  = fract(NT * contourFrequency * 0.01);
3653                    float df = fwidth(NT * contourFrequency);
3654
3655                    float g = smoothstep(df * (contourWidth * 0.01), df * (contourWidth * 0.01 * 2.0), f);
3656                    if (g < 1.0 && resultAlpha == 0.0) {
3657                        result = contourColor;
3658                        resultAlpha = 1.0;
3659                    }
3660                 }
3661                 else {
3662                    vec3 NDir = N * contourDirection;
3663                    float NT = NDir.x + NDir.y + NDir.z;
3664                    float df = fwidth(NT * contourThreshold);
3665                    float f = sin(NT * 1.0 * contourFrequency);
3666                    float g = smoothstep(0.0, df * contourWidth, 1.0 - f);
3667
3668                    if (df > (t * 0.5) && g < 1.0 && resultAlpha == 0.0) {
3669                        result = contourColor;
3670                        resultAlpha = 1.0 - g;
3671                    }
3672                 }
3673
3674                 float lalpha = alpha * resultAlpha;
3675                 calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3676                 accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
3677                 return result;
3678             }`,[t])}}();var x0=class extends xt{constructor(t,e,i,n,r,s,o,a){super("v3"),this.nodeType="Transmission",this.thickness=t,this.ior=e,this.roughness=i,this.transmissionSamplerSize=n,this.transmissionSamplerMap=r,this.transmissionDepthMap=s,this.aspectRatio=o,this.alpha=a,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.extensions.shaderTextureLOD=!0,t.extensions.derivatives=!0,t.isShader("fragment")){t.define("NUM_SAMPLES",30),t.require("worldPosition"),t.requires.worldNormal=!0,t.requires.modelMatrix=!0,t.requires.projectionMatrix=!0,t.addFragmentVariable(this.calpha,"float");let i=t.include(x0.Nodes.transmission),n=[];return n.push(this.thickness.build(t,"f")),n.push(this.ior.build(t,"f")),n.push(this.roughness.build(t,"f")),n.push(this.transmissionSamplerSize.build(t,"v2")),n.push(this.transmissionSamplerMap.getTexture(t,"t")),n.push(this.transmissionDepthMap.getTexture(t,"t")),n.push(this.aspectRatio.build(t,"v2")),n.push("normal"),n.push(this.alpha.build(t,"f")),n.push(this.calpha),t.format(i+"("+n.join(",")+")",this.getType(t),e)}else return console.warn("TransmissionNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),e)}},_0=x0;_0.Nodes=function(){let t=new Re(`
3679            float gaussian(vec2 i) {
3680                const float sigma = float(NUM_SAMPLES) * .25;
3681                return exp( -.5* dot(i/=sigma,i) ) / ( 6.28 * sigma*sigma );
3682            }`),e=new Re(`
3683            vec3 blur(sampler2D sp, vec2 U, vec2 scale, float lod, sampler2D dm, vec2 unrefractedU, vec2 aspectRatio) {
3684                // Slightly modified version of this:
3685                // https://www.shadertoy.com/view/ltScRG
3686
3687                const int LOD = 2;
3688                const int sLOD = 4; // tile size = 2^LOD
3689
3690                vec3 O = vec3(0);
3691                float a = 0.0;
3692                const int s = NUM_SAMPLES/sLOD;
3693                for ( int i = 0; i < s*s; i++ ) {
3694                    int modulo = (i)-((i)/(s))*(s);
3695                    vec2 d = vec2(float(modulo), float(i/s))*float(sLOD) - float(NUM_SAMPLES)/2.;
3696                    vec2 uv = U + (scale * aspectRatio) * d;
3697                    // What is the depth of the opaque object we're trying to sample
3698                    float opaqueDepth = unpackRGBAToDepth(texture2D(dm, uv));
3699                    if (opaqueDepth != 0.0 && opaqueDepth < gl_FragCoord.z) {
3700                        uv = unrefractedU + ((scale * min(lod / 2., 1.)) * aspectRatio) * d;
3701                        lod = lod > 4.0 ? lod : lod / 2.0;
3702                    }
3703                    float gaussian = gaussian(d);
3704		            #ifdef TEXTURE_LOD_EXT
3705                    O += gaussian * texture2DLodEXT( sp, uv, lod).rgb;
3706                    #else
3707                    O += gaussian * textureLod( sp, uv, lod).rgb;
3708                    #endif
3709                    a += gaussian;
3710                }
3711                return O / a;
3712            }`,[t]),i=new Re(`
3713            vec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {
3714		        // Direction of refracted light.
3715		        vec3 refractionVector = refract( -v,  n, 1.0 / ior );
3716		        // Compute rotation-independant scaling of the model matrix.
3717		        vec3 modelScale;
3718		        modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
3719		        modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
3720		        modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
3721		        // The thickness is specified in local space.
3722		        return normalize( refractionVector ) * thickness * modelScale;
3723	        }`),n=new Re(`
3724float applyIorToRoughness( float roughness, float ior ) {
3725		// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
3726		// an IOR of 1.5 results in the default amount of microfacet refraction.
3727		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
3728	} `),r=new Re(`
3729vec3 getTransmissionSample( vec2 fragCoord, float roughness, float ior, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 unrefractedCoords, vec2 aspectRatio) {
3730		float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
3731        float lod = applyIorToRoughness(roughness, ior);
3732
3733        return blur(transmissionSamplerMap, fragCoord, vec2(lod / (transmissionSamplerSize.x / 2.)), min(framebufferLod / 5.5, 8.5), transmissionDepthMap, unrefractedCoords, aspectRatio);
3734	}`,[n,e]),s=new Re(`
3735vec3 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio ) {
3736        vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
3737        vec3 refractedRayExit = position + transmissionRay;
3738
3739        // Project refracted vector on the framebuffer, while mapping to normalized device coordinates.
3740        vec4 ndcPos = projMatrix * viewMatrix *  vec4( refractedRayExit, 1.0 );
3741        vec2 refractionCoords = ndcPos.xy / ndcPos.w;
3742        refractionCoords += 1.0;
3743        refractionCoords /= 2.0;
3744
3745        vec4 ndcPosUnrefracted = projMatrix * viewMatrix * vec4(position, 1.0 );
3746        vec2 unrefractedCoords = ndcPosUnrefracted.xy / ndcPosUnrefracted.w;
3747        unrefractedCoords += 1.0;
3748        unrefractedCoords /= 2.0;
3749
3750        // Sample framebuffer to get pixel the refracted ray hits.
3751        return getTransmissionSample( refractionCoords, roughness, ior, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, unrefractedCoords, aspectRatio );
3752    }`,[r,i]);return{transmission:new Re(`
3753            vec3 transmission(float thickness, float ior, float roughness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio, vec3 normal, float alpha, out float calpha) {
3754                vec3 v = vec3(0.);
3755                if (isOrthographic) {
3756                    v = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
3757                } else {
3758                    v = normalize(vWPosition - cameraPosition);
3759                }
3760                vec3 transmission = getIBLVolumeRefraction(vWNormal, -v, roughness,  vWPosition, modelMatrix, viewMatrix, projectionMatrix, ior, thickness, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, aspectRatio );
3761                float lalpha = alpha;
3762
3763                 calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3764                 accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
3765                 return transmission;
3766            }`,[s])}}();var lo=class extends xt{constructor(t,e,i,n,r,s,o,a,l,h,f){super("v3"),this.nodeType="Depth",this.gradientType=t,this.smooth=e,this.near=i,this.far=n,this.isVector=r,this.isWorldSpace=s,this.origin=o,this.direction=a,this.colors=l,this.steps=h,this.alpha=f,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){let i=`g${this.uuid.toString().replace(/-/g,"")}`,n=new Re(`vec3 ${i}_sdepth(float near, float far, vec3 origin, vec3 direction, vec4 colors[${i}_MAX_COLORS], float steps[${i}_MAX_COLORS], float alpha, out float calpha) {
3767               vec4 color = colors[0];
3768               #ifdef ${i}_IS_VECTOR
3769                   #ifdef ${i}_LINEAR
3770                       #ifdef ${i}_WORLDSPACE
3771                       float depth = vectorLinearWorldSpaceDepth(direction, origin, near, far);
3772                       #else
3773                       float depth = vectorLinearObjectSpaceDepth(direction, origin, near, far);
3774                       #endif
3775                   #else
3776                       #ifdef ${i}_WORLDSPACE
3777                           float depth = vectorSphericalWorldSpaceDepth(origin, near, far);
3778                       #else
3779                           float depth = vectorSphericalObjectSpaceDepth(origin, near, far);
3780                       #endif
3781                   #endif
3782               #else
3783                   float dist = length(vWPosition - cameraPosition);
3784			       float depth = ( dist - near ) / ( far - near );
3785               #endif
3786
3787
3788              float p;
3789              #ifdef ${i}_SMOOTH
3790				for ( int i = 1; i < ${i}_MAX_COLORS; i++ ) {
3791						p = clamp( ( depth - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );
3792						color = mix(color, colors[i], smoothstep(0.0, 1.0, p));
3793					}
3794              #else
3795                for ( int i = 1; i < ${i}_MAX_COLORS; i++ ) {
3796                   p = clamp(( depth - steps[i - 1] ) / ( steps[i] - steps[i - 1] ), 0.0, 1.0);
3797                   color = mix(color, colors[i], p);
3798                 }
3799              #endif
3800
3801               float lalpha = alpha * color.a;
3802               calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3803
3804			   accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
3805               return color.rgb;
3806			}`,[lo.Nodes.vectorLinearWorldSpaceDepth,lo.Nodes.vectorLinearObjectSpaceDepth,lo.Nodes.vectorSphericalObjectSpaceDepth,lo.Nodes.vectorSphericalWorldSpaceDepth]);if(t.isShader("fragment")){t.define(`${i}_MAX_COLORS`,this.colors.value.length),this.smooth.value&&t.define(`${i}_SMOOTH`),this.isVector.value>.5&&t.define(`${i}_IS_VECTOR`),this.gradientType.value===0&&t.define(`${i}_LINEAR`),this.isWorldSpace.value>.5&&t.define(`${i}_WORLDSPACE`),t.require("worldPosition"),t.addFragmentVariable(this.calpha,"float");let r=t.include(n),s=[];return s.push(this.near.build(t,"f")),s.push(this.far.build(t,"f")),s.push(this.origin.build(t,"v3")),s.push(this.direction.build(t,"v3")),s.push(this.colors.build(t,"v4[]")),s.push(this.steps.build(t,"f[]")),s.push(this.alpha.build(t,"f")),s.push(this.calpha),t.format(r+"("+s.join(",")+")",this.getType(t),e)}else return console.warn("DepthNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),e)}},b0=lo;b0.Nodes=function(){let t=new Re(`float vectorLinearWorldSpaceDepth(vec3 direction, vec3 origin, float near, float far) {
3807               vec3 n = normalize(direction);
3808               float dist = (n.x*(vWPosition.x - origin.x) + n.y*(vWPosition.y - origin.y) + n.z*(vWPosition.z - origin.z));
3809               return ( dist - near ) / ( far - near );
3810            }`),e=new Re(`float vectorLinearObjectSpaceDepth(vec3 direction, vec3 origin, float near, float far) {
3811               vec3 n = normalize(direction);
3812               float dist = (n.x*(position.x - origin.x) + n.y*(position.y - origin.y) + n.z*(position.z - origin.z));
3813               return ( dist - near ) / ( far - near );
3814            }`),i=new Re(`float vectorSphericalWorldSpaceDepth(vec3 origin, float near, float far) {
3815               float dist = length(vWPosition - origin);
3816               return ( dist - near ) / ( far - near );
3817            }`),n=new Re(`float vectorSphericalObjectSpaceDepth(vec3 origin, float near, float far) {
3818               float dist = length(position - origin);
3819               return ( dist - near ) / ( far - near );
3820            }`);return{vectorLinearWorldSpaceDepth:t,vectorLinearObjectSpaceDepth:e,vectorSphericalWorldSpaceDepth:i,vectorSphericalObjectSpaceDepth:n}}();var Ip=class extends xt{constructor(t,e,i,n){super("v3"),this.nodeType="Blend",this.a=t,this.b=e,this.alpha=i,this.mode=n}generate(t,e){if(t.isShader("fragment")){let i=[];return i.push(this.a.build(t,"c")),i.push(this.b.build(t,"c")),i.push(this.alpha.build(t,"f")),i.push(this.mode.build(t,"i")),t.format("spe_blend("
3820+i.join(",")+")",this.getType(t),e)}else return console.warn("BlendNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),e)}},Th=(t=>(t.NOISE="noise",t.MAP="map",t))(Th||{}),w0=class extends xt{constructor(t,e,i,n,r){super("v3"),this.displacementTypeIndex=new pt(0),this.nodeType="VertexDisplacement",this.intensity=t,this.movementOrTexture=e,Object.values(Th)[this.displacementTypeIndex.value]==="map"&&(this.mat=new u0(this.movementOrTexture.value.matrix)),this.cropOrOffset=i,this.scale=n,this.noiseFunctionIndex=r}generate(t,e){if(t.isShader("vertex")){t.define("USE_LAYER_DISPLACE");let i,n=[];switch(n.push("displaced_position"),n.push("displaced_normal"),Object.values(Th)[this.displacementTypeIndex.value]){case"map":{i=t.include(w0.Nodes.map),n.push(this.movementOrTexture.getTexture(t,"t")),n.push("uv"),n.push(this.cropOrOffset.build(t,"f")),this.mat&&n.push(this.mat.build(t,"mat3"));break}case"noise":{let r=Object.values(Mu)[this.noiseFunctionIndex.value],s=new Re(`vec3 orthogonal(vec3 v) {
3821							return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));
3822						}`),o=new Re(`vec3 distorted(vec3 p, vec3 n, float scale, float intensity, vec3 offset, float neighbour_offset, float movement) {
3823							return p + n * ${r}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1)) * intensity;
3824						}`,[Pi.simplex,Pi.simplexFractal,Pi.simplexAshima,Pi.fbm,Pi.perlin]),a=new Re(`vec3 vertexDisplacementNoise(vec3 position, vec3 normal, float scale, vec3 offset, float movement, float intensity, out vec3 displaced_normal) {
3825							vec3 displaced_position = distorted(position, normal, scale, intensity, offset, neighbor_offset, movement);
3826							vec3 tangent1 = orthogonal(normal);
3827							vec3 tangent2 = normalize(cross(normal, tangent1));
3828
3829                            // TODO(Max): The distance to the neighbors was originally scaled by 0.1.
3830                            // This caused some small oval/circular visual artifacts in the lighting.
3831                            // For now, simply using neighbors further away betters the problem,
3832                            // but we should figure out the underlying cause when we have some time.
3833                            // Maybe its related to how we calculate the tangent and bitangent?
3834							vec3 nearby1 = position + tangent1;
3835							vec3 nearby2 = position + tangent2;
3836							vec3 distorted1 = distorted(nearby1, normal, scale, intensity, offset, neighbor_offset, movement);
3837							vec3 distorted2 = distorted(nearby2, normal, scale, intensity, offset, neighbor_offset, movement);
3838							displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
3839							return displaced_position;
3840						}`,[o,s]);i=t.include(a),n.push(this.scale.build(t,"f")),n.push(this.cropOrOffset.build(t,"v3")),n.push(this.movementOrTexture.build(t,"f"));break}}return n.push(this.intensity.build(t,"f")),n.push("displaced_normal"),t.format(i+"("+n.join(",")+")",this.getType(t),e)}else return console.warn("VertexDisplacementNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),e)}},S0=w0;S0.Nodes=function(){let t=new Re(`vec3 orthogonal(vec3 v) {
3841				return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));
3842			}`),e=new Re(`float displacementMapTexture(sampler2D tex, float crop, vec2 uv, mat3 mat, vec2 offset) {
3843				vec2 uvs = (mat * vec3(uv * 2.0 - 1.0, 1.0) / 2.0 + 0.5).xy + offset;
3844				vec4 tmp = texture2D(tex, uvs);
3845				vec3 col = tmp.rgb;
3846				if (crop > 0.5) {
3847					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3848						return 0.0;
3849					}
3850				}
3851				return col.r;
3852			}`);return{map:new Re(`vec3 vertexDisplacementMap(vec3 position, vec3 normal, sampler2D tex, vec2 uv, float crop, mat3 mat, float intensity, out vec3 displaced_normal) {
3853				vec3 displaced_position = position + normal * displacementMapTexture(tex, crop, uv, mat, vec2(0.0)) * intensity;
3854				vec3 tangent1 = normalize(orthogonal(normal));
3855				vec3 tangent2 = normalize(cross(normal, tangent1));
3856				vec3 nearby1 = position + tangent1 * 0.1;
3857				vec3 nearby2 = position + tangent2 * 0.1;
3858				vec3 distorted1 = nearby1 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;
3859				vec3 distorted2 = nearby2 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;
3860				displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
3861				return displaced_position;
3862			}`,[t,e])}}();var M0=class extends xt{constructor(t,e,i,n,r,s,o,a){super("v3"),this.nodeType="Gradient",this.gradientType=t,this.smooth=e,this.colors=i,this.steps=n,this.offset=r,this.morph=s,this.angle=o,this.alpha=a,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.isShader("fragment")){t.define("GRAD_MAX",10),t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let i=t.include(M0.Nodes.gradient),n=[];return n.push(this.gradientType.build(t,"i")),n.push(this.smooth.build(t,"b")),n.push(this.colors.build(t,"v4[]")),n.push(this.steps.build(t,"f[]")),n.push(this.offset.build(t,"v2")),n.push(this.morph.build(t,"v2")),n.push(this.angle.build(t,"f")),n.push(this.alpha.build(t,"f")),n.push(this.calpha),t.format(i+"("+n.join(",")+")",this.getType(t),e)}else return console.warn("GradientNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),e)}},A0=M0;A0.Nodes=function(){return{gradient:new Re(`vec3 gradient(int gradientType, bool smoothed, vec4 colors[GRAD_MAX], float steps[GRAD_MAX], vec2 offset, vec2 morph, float angle, float alpha, out float calpha) {
3863				vec4 color = colors[0];
3864				vec2 m = morph / vUv.xy;
3865				vec2 rot = vec2( 0.5 + m.x, m.y );
3866				vec2 dt = vec2(
3867					cos( angle ) * rot.x - sin( angle ) * rot.y,
3868					sin( angle ) * rot.x + cos( angle ) * rot.y
3869				);
3870				vec2 pt = ( vUv - 0.5 + offset ) / 2.0 + dt / 2.0;
3871				float t = dot( pt, dt ) / dot( dt, dt );
3872				if ( gradientType == 1 ) {
3873					t = distance (
3874						( vUv + morph ) * 3.0,
3875						( vUv + offset ) + 1.0
3876					) + angle;
3877				} else if ( gradientType == 2 ) {
3878					float polar = atan(
3879						vUv.x + morph.x - 0.5 + offset.x,
3880						vUv.y + morph.y - 0.5 + offset.y
3881					) * -1.0;
3882					t = fract( ( angle / PI / -2.0 ) + 0.5 * ( polar / PI ) );
3883				}
3884
3885				float p;
3886				if (smoothed) {
3887					for ( int i = 1; i < GRAD_MAX; i++ ) {
3888						p = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );
3889						color = mix(color, colors[i], smoothstep(0.0, 1.0, p));
3890					}
3891
3892				} else {
3893					for ( int i = 1; i < GRAD_MAX; i++ ) {
3894						p = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );
3895						color = mix(color, colors[i], p);
3896					}
3897				}
3898
3899				float lalpha = alpha * color.a;
3900				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3901				accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
3902
3903				return color.xyz;
3904			}`)}}();var Ra=class extends xt{constructor(t,e,i,n,r,s,o,a,l,h){super("v3"),this.nodeType="CustomTexture",this.firstTime=!0,this.texture=t,this.textureSize=e,this.crop=i,this.projection=n,this.axis=r,this.side=s,this.size=o,this.mat=a,this.alpha=l,this.mode=h,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){t.require("position"),t.require("normal"),t.require("uv"),t.requires.uv=[!0],t.extensions.shaderTextureLOD=!0,t.extensions.derivatives=!0;let i=`g${this.uuid.toString().replace(/-/g,"")}`,n;switch(this.projection.value){case 3:n=t.include(Ra.Nodes.cylindrical);break;case 2:n=t.include(Ra.Nodes.spherical);break;case 1:let s=["vec3(1.0, 0.0, 0.0)","vec3(0.0, 1.0, 0.0)","vec3(0.0, 0.0, 1.0)"][this.axis.value],o=new Re(`
3905		vec3 ${i}_planarTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
3906
3907				vec2 uvs = ( mat * vec3( (${i}_vCustomUv * 2. - 1.) / (size * .5), 1. ) / 2. + 0.5 ).xy;
3908
3909				vec4 tmp = texture2D( tex, uvs );
3910
3911				vec3 col = tmp.rgb;
3912				float lalpha = alpha * tmp.a;
3913				${this.side.value===2?"":`lalpha *= step(0.0, ${this.side.value===1?"-1.0 * ":""}dot(vObjectNormal, mat * ${s}));`}
3914
3915				if ( crop > 0.5 ) {
3916					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3917						lalpha = 0.0;
3918					}
3919				}
3920				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3921				accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
3922				return col;
3923			}`);n=t.include(o);break;default:n=t.include(Ra.Nodes.uv);break}if(this.projection.value===1&&this.firstTime){t.addVertexParsCode(`varying vec2 ${i}_vCustomUv;`),t.addFragmentParsCode(`varying vec2 ${i}_vCustomUv;`);let s=["zy","xz","xy"][this.axis.value];t.addVertexFinalCode(`${i}_vCustomUv = (1. + (transformed.${s})) / 2.;`)}t.addFragmentVariable(this.calpha,"float");let r=[];return r.push(this.texture.generate(t,"t")),r.push(this.textureSize.build(t,"v2")),r.push(this.crop.build(t,"f")),r.push(this.mat.build(t,"mat3")),r.push(this.size.build(t,"v2")),r.push(this.alpha.build(t,"f")),r.push(this.mode.build(t,"i")),r.push(this.calpha),this.firstTime=!this.firstTime,t.format(n+"("+r.join(",")+")",this.getType(t),e)}},T0=Ra;T0.Nodes=function(){let t=new Re(`
3924vec3 cylindricalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
3925                vec3 posN = normalize(position);
3926                float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);
3927                float scaledHeight = position.y / (size.y * 0.5);
3928                float v =  (scaledHeight / 2.) + .5;
3929
3930                vec2 calculatedUv = vec2(u,v);
3931				vec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
3932
3933                vec2 df = fwidth(uvs);
3934               	if(df.x > 0.5) df.x = 0.;
3935
3936				#ifdef GL_EXT_shader_texture_lod
3937                vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
3938				#else
3939                vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
3940				#endif
3941
3942				vec3 col = tmp.rgb;
3943				float lalpha = alpha * tmp.a;
3944				if ( crop > 0.5 ) {
3945					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3946						lalpha = 0.0;
3947					}
3948				}
3949				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3950				accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
3951				return col;
3952			}
3953`),e=new Re(`
3954vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
3955                vec3 posN = normalize(vPosition);
3956                float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);
3957                float v = 0.5 + asin(posN.y) / 3.1415;
3958
3959                vec2 calculatedUv = vec2(u,v);
3960				vec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
3961
3962                vec2 df = fwidth(uvs);
3963               	if(df.x > 0.5) df.x = 0.;
3964				#ifdef GL_EXT_shader_texture_lod
3965                vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
3966				#else
3967                vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
3968				#endif
3969
3970				vec3 col = tmp.rgb;
3971				float lalpha = alpha * tmp.a;
3972				if ( crop > 0.5 ) {
3973					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3974						lalpha = 0.0;
3975					}
3976				}
3977				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3978				accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
3979				return col;
3980			}
3981`),i=new Re(`vec3 uvTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
3982
3983				vec2 uvs = ( mat * vec3( vUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
3984				vec4 tmp = texture2D( tex, uvs );
3985
3986				vec3 col = tmp.rgb;
3987
3988				float lalpha = alpha * tmp.a;
3989				if ( crop > 0.5 ) {
3990					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3991						lalpha = 0.0;
3992					}
3993				}
3994				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3995				accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
3996				return col;
3997			}`);return{cylindrical:t,spherical:e,uv:i}}();var E0=class extends xt{constructor(t,e){super("v3"),this.nodeType="CustomNormal",this.cnormal=t,this.alpha=e}generate(t,e){if(t.isShader("fragment")){let i=t.include(E0.Nodes.customNormal),n=[];return n.push(this.cnormal.build(t,"v3")),n.push("normal"),n.push(this.alpha.build(t,"f")),t.format(i+"("+n.join(",")+")",this.getType(t),e)}else return console.warn("CustomNormalNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),e)}},C0=E0;C0.Nodes=function(){return{customNormal:new Re(`vec3 customNormal(vec3 cnormal, vec3 norm, float alpha) {
3998				vec3 normal = packNormalToRGB( norm ).rgb;
3999				normal *= step( vec3(0.5), cnormal );
4000
4001				accumAlpha += ( 1.0 - accumAlpha ) * alpha;
4002
4003				return normal;
4004			}`)}}();var Ei={normalRenderTarget:new Qn,normalRenderTargetDepth:new Qn,transmissionRenderTarget:new Qn,transmissionSize:new Ti(2048,2048),transmissionRenderTargetDepth:new Qn,pixelRatioNode:new Le(1),resolution:new Ti,penumbraSize:new yr(5,.5)};for(let t of Object.values(Ei))t.isRenderGlobal=!0;var QP=class extends cr{constructor(){super("lambert"),this.nodeType="Lambert",this.color=new Rt(5855577),this.emissive=new Rt(0),this.emissiveIntensity=new Le(1),this.shadingAlpha=new Le(1),this.shadingBlend=new pt(0)}build(t){let e;if(t.define("LAMBERT"),t.requires.lights=!0,t.extensions.derivatives=!0,t.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(t,"v3",{cache:"position"}):void 0;t.mergeUniform(Is.merge([ge.fog,ge.lights])),t.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED","   #define DOUBLE_SIDED","#endif","#ifdef DOUBLE_SIDED","	varying vec3 vLightBack;","	varying vec3 vIndirectBack;","#endif","#include <bsdfs>","#include <lights_pars_begin>","#include <color_pars_vertex>","#include <fog_pars_vertex>","#include <normal_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
4005`));let n=["#include <beginnormal_vertex>",`
4006				#ifndef USE_LAYER_DISPLACE
4007					#include <defaultnormal_vertex>
4008				#endif
4009
4010				vec3 displaced_position = position;
4011				vec3 displaced_normal = normal;
4012
4013				#ifdef USE_LAYER_DISPLACE
4014					vec3 transformed;
4015					vec3 transformedNormal;
4016				#endif
4017				`,"#include <normal_vertex>",`
4018				#ifndef USE_LAYER_DISPLACE
4019					#include <begin_vertex>
4020				#endif
4021				`];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";
4021":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","    vNormal = transformedNormal;","#endif"),n.push("	#include <project_vertex>","	#include <clipping_planes_vertex>","	vViewPosition = - mvPosition.xyz;","	#include <worldpos_vertex>",`
4022					vec3 diffuse = vec3( 1.0 );
4023					GeometricContext geometry;
4024					geometry.position = mvPosition.xyz;
4025					geometry.normal = normalize( transformedNormal );
4026					geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
4027					GeometricContext backGeometry;
4028					backGeometry.position = geometry.position;
4029					backGeometry.normal = -geometry.normal;
4030					backGeometry.viewDir = geometry.viewDir;
4031					vLightFront = vec3( 0.0 );
4032					vIndirectFront = vec3( 0.0 );
4033					#ifdef DOUBLE_SIDED
4034						vLightBack = vec3( 0.0 );
4035						vIndirectBack = vec3( 0.0 );
4036					#endif
4037					IncidentLight directLight;
4038					float dotNL;
4039					vec3 directLightColor_Diffuse;
4040					vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
4041					vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );
4042					#ifdef DOUBLE_SIDED
4043						vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
4044						vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );
4045					#endif
4046					#if NUM_POINT_LIGHTS > 0
4047						#pragma unroll_loop_start
4048						for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
4049							getPointLightInfo( pointLights[ i ], geometry, directLight );
4050							dotNL = dot( geometry.normal, directLight.direction );
4051							directLightColor_Diffuse = directLight.color;
4052							vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
4053							#ifdef DOUBLE_SIDED
4054								vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
4055							#endif
4056						}
4057						#pragma unroll_loop_end
4058					#endif
4059					#if NUM_SPOT_LIGHTS > 0
4060						#pragma unroll_loop_start
4061						for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
4062							getSpotLightInfo( spotLights[ i ], geometry, directLight );
4063							dotNL = dot( geometry.normal, directLight.direction );
4064							directLightColor_Diffuse = directLight.color;
4065							vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
4066							#ifdef DOUBLE_SIDED
4067								vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
4068							#endif
4069						}
4070						#pragma unroll_loop_end
4071					#endif
4072					#if NUM_DIR_LIGHTS > 0
4073						#pragma unroll_loop_start
4074						for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
4075							getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );
4076							dotNL = dot( geometry.normal, directLight.direction );
4077							directLightColor_Diffuse = directLight.color;
4078							vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
4079							#ifdef DOUBLE_SIDED
4080								vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
4081							#endif
4082						}
4083						#pragma unroll_loop_end
4084					#endif
4085					#if NUM_HEMI_LIGHTS > 0
4086						#pragma unroll_loop_start
4087						for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
4088							vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
4089							#ifdef DOUBLE_SIDED
4090								vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );
4091							#endif
4092						}
4093						#pragma unroll_loop_end
4094					#endif
4095				`,"	#include <shadowmap_vertex>","	#include <fog_vertex>"),n.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),e=n.join(`
4096`)}else{t.mergeUniform({penumbraSize:Ei.penumbraSize}),this.color===void 0&&(this.color=new Rt(5855577)),this.color.analyze(t,{slot:"color"}),this.shadingAlpha.analyze(t),this.shadingBlend.analyze(t),this.afterColor&&this.afterColor.analyze(t,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(t);let i=this.color.flow(t,"c",{slot:"color"}),n=this.emissive.flow(t,"c",{slot:"emissive"}),r=this.emissiveIntensity.flow(t,"f",{slot:"emissive"}),s=this.shadingAlpha.flow(t,"f"),o=this.shadingBlend.flow(t,"i"),a=this.afterColor?this.afterColor.flow(t,"c",{slot:"afterColor"}):void 0,l=this.alpha?this.alpha.flow(t,"f"):void 0;t.requires.transparent=l!==void 0,t.addParsCode([`uniform float penumbraSize[${5}];`,"varying vec3 vViewPosition;","varying vec3 vWPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED","   #define DOUBLE_SIDED","#endif","#include <normal_pars_fragment>","#ifdef DOUBLE_SIDED","	varying vec3 vLightBack;","	varying vec3 vIndirectBack;","#endif","#include <bsdfs>","#include <lights_pars_begin>","#include <fog_pars_fragment>","#include <shadowmap_pars_fragment>","#include <shadowmask_pars_fragment>","#include <clipping_planes_pars_fragment>","#include <dithering_pars_fragment>"].join(`
4097`));let h=["#include <normal_fragment_begin>",`
4098				// NOTE: gl_FrontFacing alternative using face normal estimation.
4099				vec3 viewdx = dFdx(vViewPosition);
4100				vec3 viewdy = dFdy(vViewPosition);
4101				vec3 faceNormal = normalize(cross(viewdx, viewdy));
4102				bool isFrontFacing = (dot(normal, faceNormal) >= 0.0);
4103				`,"#include <clipping_planes_fragment>"];h.push(i.code,"vec3 diffuseColor = "+i.result+";","ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"),l&&h.push(l.code,"#ifdef ALPHATEST","if ( "+l.result+" <= ALPHATEST ) discard;","#endif"),h.push("#ifdef DOUBLE_SIDED","	reflectedLight.indirectDiffuse += ( isFrontFacing ) ? vIndirectFront : vIndirectBack;","#else","	reflectedLight.indirectDiffuse += vIndirectFront;","#endif","#include <lightmap_fragment>","reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );","#ifdef DOUBLE_SIDED","	reflectedLight.directDiffuse = ( isFrontFacing ) ? vLightFront : vLightBack;","#else","	reflectedLight.directDiffuse = vLightFront;","#endif","reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();"),n&&h.push(n.code,"reflectedLight.directDiffuse += "+n.result+" * "+r.result+";"),h.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;"),h.push(`
4104				if (outgoingLight != diffuseColor) {
4105					float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
4106					accumAlpha += ( 1.0 - accumAlpha ) * ${s.result} * lightAccu;
4107					outgoingLight = spe_blend( diffuseColor, outgoingLight, ${s.result}, ${o.result} );
4108				}
4109				`),a&&h.push(a.code,`outgoingLight = spe_blend(outgoingLight, ${a.result}, 1.0, SPE_BLENDING_NORMAL);`),l?h.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${l.result} );`):h.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),h.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),e=h.join(`
4110`)}return e}},eD=class extends cr{constructor(){super("standard"),this.nodeType="Standard",this.color=new Rt(5855577),this.roughness=new Le(.3),this.metalness=new Le(0),this.reflectivity=new Le(.5),this.shadingAlpha=new Le(1),this.shadingBlend=new pt(0)}build(t){let e;if(t.define("STANDARD"),t.requires.lights=!0,t.extensions.derivatives=!0,t.extensions.shaderTextureLOD=!0,t.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(t,"v3",{cache:"position"}):void 0;t.mergeUniform(Is.merge([ge.fog,ge.lights])),ge.LTC_1&&(t.uniforms.ltc_1={value:void 0},t.uniforms.ltc_2={value:void 0}),t.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <normal_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
4111`));let n=["#include <beginnormal_vertex>",`
4112				#if !defined( USE_LAYER_DISPLACE )
4113					#include <defaultnormal_vertex>
4114				#endif
4115
4116				vec3 displaced_position = position;
4117				vec3 displaced_normal = normal;
4118
4119				#if defined( USE_LAYER_DISPLACE )
4120					vec3 transformed;
4121					vec3 transformedNormal;
4122				#endif
4123				`,"#include <normal_vertex>",`
4124				#if !defined( USE_LAYER_DISPLACE )
4125					#include <begin_vertex>
4126				#endif /* !USE_LAYER_DISPLACE */
4127				`];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";
4127":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","    vNormal = transformedNormal;","#endif"),n.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>","	vViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>","#include <shadowmap_vertex>"),n.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),e=n.join(`
4128`)}else{t.mergeUniform({penumbraSize:Ei.penumbraSize});let i={gamma:!0};this.color===void 0&&(this.color=new Rt(5855577)),this.color.analyze(t,{slot:"color",context:i}),this.roughness.analyze(t),this.metalness.analyze(t),this.shadingAlpha.analyze(t),this.shadingBlend.analyze(t),this.afterColor&&this.afterColor.analyze(t,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(t),this.reflectivity&&this.reflectivity.analyze(t);let n=this.color.flow(t,"c",{slot:"color",context:i}),r=this.roughness.flow(t,"f"),s=this.metalness.flow(t,"f"),o=this.shadingAlpha.flow(t,"f"),a=this.shadingBlend.flow(t,"i"),l=this.afterColor?this.afterColor.flow(t,"c",{slot:"afterColor"}):void 0,h=this.alpha?this.alpha.flow(t,"f"):void 0,f=this.reflectivity?this.reflectivity.flow(t,"f"):void 0;t.requires.transparent=h!==void 0,t.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;",`uniform float penumbraSize[${5}];`,"#include <normal_pars_fragment>","#include <dithering_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <lights_physical_pars_fragment>","#include <shadowmap_pars_fragment>"].join(`
4129`));let c=["#include <clipping_planes_fragment>","	#include <normal_fragment_begin>",`
4130				// NOTE: gl_FrontFacing alternative using face normal estimation.
4131				vec3 viewdx = dFdx(vViewPosition);
4132				vec3 viewdy = dFdy(vViewPosition);
4133				vec3 faceNormal = normalize(cross(viewdx,viewdy));
4134				if (dot(normal, faceNormal) < 0.0) {
4135					normal *= -1.0;
4136				}
4137				`,"	PhysicalMaterial material;","	material.diffuseColor = vec3( 1.0 );"];c.push(n.code,"	vec3 diffuseColor = "+n.result+";","	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",r.code,"	float roughnessFactor = "+r.result+";",s.code,"	float metalnessFactor = "+s.result+";"),h&&c.push(h.code,"#ifdef ALPHATEST","	if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),c.push("vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );"),c.push("material.diffuseColor = diffuseColor * ( 1.0 - metalnessFactor );","material.roughness = max( roughnessFactor, 0.0525 );","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.roughness = clamp( roughnessFactor, 0.04, 1.0 );"),f?c.push(f.code,"material.specularColor = mix( vec3( 0.16 * pow2( "+f.result+" ) ), diffuseColor, metalnessFactor );"):c.push("material.specularColor = mix( vec3( 0.04 ), diffuseColor, metalnessFactor );"),c.push("#include <lights_fragment_begin>"),c.push("#include <lights_fragment_end>"),c.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular;"),c.push(`
4138				if (outgoingLight != diffuseColor) {
4139					float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
4140					accumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * lightAccu;
4141					outgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result}, ${a.result} );
4142				}
4143				`),l&&c.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),h?c.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result} );`):c.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),c.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),e=c.join(`
4144`)}return e}},tD=class extends cr{constructor(){super("toon"),this.nodeType="Toon",this.color=new Rt(5855577),this.specular=new Rt(1118481),this.shininess=new Le(30),this.shadingAlp
4144ha=new Le(1),this.shadingBlend=new pt(0)}build(t){let e;if(t.define("TOON"),t.requires.lights=!0,t.extensions.derivatives=!0,t.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(t,"v3",{cache:"position"}):void 0;t.mergeUniform(Is.merge([ge.fog,ge.lights])),t.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <normal_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
4145`));let n=["#include <beginnormal_vertex>",`
4146				#ifndef USE_LAYER_DISPLACE
4147					#include <defaultnormal_vertex>
4148				#endif
4149
4150				vec3 displaced_position = position;
4151				vec3 displaced_normal = normal;
4152
4153				#ifdef USE_LAYER_DISPLACE
4154					vec3 transformed;
4155					vec3 transformedNormal;
4156				#endif
4157				`,"#include <normal_vertex>",`
4158				#ifndef USE_LAYER_DISPLACE
4159					#include <begin_vertex>
4160				#endif
4161				`];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","    vNormal = transformedNormal;","#endif"),n.push("	#include <project_vertex>","	#include <fog_vertex>","	#include <clipping_planes_vertex>","	vViewPosition = - mvPosition.xyz;","	#include <worldpos_vertex>","	#include <shadowmap_vertex>","	#include <fog_vertex>"),n.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),e=n.join(`
4162`)}else{t.mergeUniform({penumbraSize:Ei.penumbraSize}),this.color===void 0&&(this.color=new Rt(5855577)),this.color.analyze(t,{slot:"color"}),this.specular.analyze(t),this.shininess.analyze(t),this.shadingAlpha.analyze(t),this.shadingBlend.analyze(t),this.afterColor&&this.afterColor.analyze(t,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(t);let i=this.color.flow(t,"c",{slot:"color"}),n=this.specular.flow(t,"c"),r=this.shininess.flow(t,"f"),s=this.shadingAlpha.flow(t,"f"),o=this.shadingBlend.flow(t,"i"),a=this.afterColor?this.afterColor.flow(t,"c",{slot:"afterColor"}):void 0,l=this.alpha?this.alpha.flow(t,"f"):void 0;t.requires.transparent=l!==void 0,t.addParsCode([`uniform float penumbraSize[${5}];`,"varying vec3 vWPosition;","#include <normal_pars_fragment>","#include <gradientmap_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <dithering_pars_fragment>",`
4163					varying vec3 vViewPosition;
4164					struct ToonMaterial {
4165						vec3	diffuseColor;
4166						vec3	specularColor;
4167						float	specularShininess;
4168						float	specularStrength;
4169					};
4170					void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
4171						vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
4172			
4173						reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
4174						reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
4175					}
4176					void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
4177						reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
4178					}
4179					#define RE_Direct				RE_Direct_Toon
4180					#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon
4181					#define Material_LightProbeLOD( material )	(0)
4182					`,"#include <shadowmap_pars_fragment>","#include <bumpmap_pars_fragment>","#include <normalmap_pars_fragment>"].join(`
4183`));let h=["#include <normal_fragment_begin>",`
4184				// NOTE: gl_FrontFacing alternative using face normal estimation.
4185				vec3 viewdx = dFdx(vViewPosition);
4186				vec3 viewdy = dFdy(vViewPosition);
4187				vec3 faceNormal = normalize(cross(viewdx,viewdy));
4188				if (dot(normal, faceNormal) < 0.0) {
4189					normal *= -1.0;
4190				}
4191				`,"	ToonMaterial material;"];h.push(i.code,"	vec3 diffuseColor = "+i.result+";","	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",n.code,"	vec3 specular = "+n.result+";",r.code,"	float shininess = max( 0.0001, "+r.result+" );","	float specularStrength = 1.0;"),l&&h.push(l.code,"#ifdef ALPHATEST","if ( "+l.result+" <= ALPHATEST ) discard;","#endif"),h.push("material.diffuseColor = diffuseColor;"),h.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),h.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular;"),h.push(`
4192				if (outgoingLight != diffuseColor) {
4193					float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
4194					accumAlpha += ( 1.0 - accumAlpha ) * ${s.result} * lightAccu;
4195					outgoingLight = spe_blend( diffuseColor, outgoingLight, ${s.result}, ${o.result} );
4196				}
4197				`),a&&h.push(a.code,`outgoingLight = spe_blend(outgoingLight, ${a.result}, 1.0, SPE_BLENDING_NORMAL);`),l?h.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${l.result} );`):h.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),h.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),e=h.join(`
4198`)}return e}};function iD(t,e){switch(t.type){case"fresnel":return sD(t,e);case"gradient":return oD(t);case"depth":return aD(t);case"normal":return lD(t);case"noise":return cD(t,e);case"rainbow":return hD(t);case"toon":return uD(t,e);case"outline":return dD(t,e);case"transmission":return fD(t);case"color":return rD(t,e)}}function nD(t){return{type:t.type}}function pn(t){let{alpha:e,mode:i}=t;return{...nD(t),alpha:e,mode:i}}function rD(t,e){return{...pn(t),color:ai(t.color,e)}}function sD(t,e){let{bias:i,scale:n,intensity:r,factor:s,color:o}=t;return{...pn(t),color:ai(o,e),bias:i,scale:n,intensity:r,factor:s}}function oD(t){let{gradientType:e,smooth:i,colors:n,steps:r,angle:s,offset:o,morph:a}=t;return{...pn(t),gradientType:e,smooth:i,colors:n.map(l=>new tt(l[0],l[1],l[2],l[3])),num:n.length,steps:r,offset:new Z(...o),morph:new Z(...a),angle:s}}function aD(t){let{gradientType:e,near:i,far:n,isVector:r,isWorldSpace:s,origin:o,direction:a,colors:l,steps:h,smooth:f}=t;return{...pn(t),gradientType:e,near:i,far:n,isVector:r,isWorldSpace:s,origin:new E(...o),direction:a?new E(...a):new E(1,0,0),colors:l.map(c=>c!==void 0?new tt(c[0],c[1],c[2],c[3]):new tt(0,0,0,0)),steps:h.slice(0,l.length),smooth:f}}function lD(t){let{cnormal:e}=t;return{...pn(t),cnormal:new E(e[0],e[1],e[2])}}function cD(t,e){return{...pn(t),scale:t.scale,move:t.move,fA:new Z(...t.fA),fB:new Z(...t.fB),size:new E(...t.size),distortion:new Z(...t.distortion),colorA:ai(t.colorA,e),colorB:ai(t.colorB,e),colorC:ai(t.colorC,e),colorD:ai(t.colorD,e),noiseType:t.noiseType}}function hD(t){return{...pn(t),filmThickness:t.filmThickness,movement:t.movement,wavelengths:new E(...t.wavelengths),noiseStrength:t.noiseStrength,noiseScale:t.noiseScale,offset:new E(...t.offset)}}function uD(t,e){return{...pn(t),positioning:t.positioning,colors:t.colors.map(i=>new tt(i[0],i[1],i[2],i[3])),num:t.colors.length,steps:t.steps,source:new E(...t.s
4198ource),isWorldSpace:t.isWorldSpace,noiseStrength:t.noiseStrength,noiseScale:t.noiseScale,shadowColor:ai(t.shadowColor,e),offset:new E(...t.offset)}}function dD(t,e){return{...pn(t),outlineColor:ai(t.outlineColor,e),contourColor:ai(t.contourColor,e),outlineWidth:t.outlineWidth,contourWidth:t.contourWidth,outlineThreshold:t.outlineThreshold,contourThreshold:t.contourThreshold,outlineSmoothing:t.outlineSmoothing,contourFrequency:t.contourFrequency,contourDirection:t.contourDirection,positionalLines:t.positionalLines,compensation:t.compensation}}function fD(t,e){return{...pn(t),thickness:t.thickness,ior:t.ior,roughness:t.roughness}}var el=class extends ji{},Lc=new Map,vo={url:"head",time:0,data:null,next:null,prev:null},gs={url:"tail",time:1/0,data:null,next:null,prev:null};vo.next=gs;gs.prev=vo;var zp=0;function pD(t){if(typeof t=="string")return t;let e=Date.now(),i=Lc.get(t);return i===void 0?(i={url:URL.createObjectURL(new Blob([t])),data:t,time:e,next:null,prev:null},Lc.set(t,i)):(i.time=e,i.prev.next=i.next,i.next.prev=i.prev),i.prev=gs.prev,i.next=gs,gs.prev.next=i,gs.prev=i,e-zp>1e3*10&&(zp=e+1e3,setTimeout(()=>{let n=Date.now(),r=vo.next;for(;r.time<n-1e3*10;)URL.revokeObjectURL(r.url),Lc.delete(r.data),r=r.next,r.prev=vo,vo.next=r},900)),i.url}var L0=class{constructor(t,e){this.data=t,this.onImageLoad=e,this.loaded=!1,this.updateSrc(t.data)}updateSrc(t){typeof document>"u"||(this.dispose(),this.loaded=!1,this.img=new Image,this.img.src=pD(t),this.img.onload=()=>{this.loaded=!0;let e=[1e3,1001,1002];for(let i of e){let n=this[i];n&&(n.image=this.img,n.needsUpdate=!0)}this.onImageLoad&&this.onImageLoad()})}getTexture(t){let e=this[t];if(e)return e;{let i=new yi(this.img,void 0,t,t);return this.loaded&&(i.needsUpdate=!0),this[t]=i,i}}dispose(){var t,e,i;(t=this[1e3])==null||t.dispose(),this[1e3]=void 0,(e=this[1001])==null||e.dispose(),this[1001]=void 0,(i=this[1002])==null||i.dispose(),this[1002]=void 0}},Eh=class extends L0{},Au=class extends xi{},P0={noise:["noiseType"],texture:["projection","axis","side"],displace:["noiseType"],depth:["smooth","isWorldSpace","gradientType","isVector"]},D0={depth:["colors"]};function mD(t,e,i){var s,o;let n=P0[t.type],r=D0[t.type];if(r!==void 0){let a=t.color;if(r.includes(e)){let l=(o=(s=a[e])==null?void 0:s.value)==null?void 0:o.length;if(l!==void 0&&l!==i.length)return!0}}return n!==void 0?n.includes(e):!1}function O0(t,e,i){let n=i.uniforms[`f${i.id}_texture`];if(!n)return!1;let r=!1,s=t;if("image"in s){let o=s.image,a=e.image(o),l=n;l instanceof Eh||l.image.dispose(),l.image=a}if("wrapping"in s){let o=n;o.wrap=s.wrapping}if("repeat"in s||"offset"in s){let o="mat",a=i.uniforms[`f${i.id}_${o}`];"repeat"in s&&(a.repeat=s.repeat),"offset"in s&&(a.offset=s.offset),a.updateMatrix()}return r}function gD(t,e,i,n){let r=!1;for(let[s,o]of Object.entries(t)){if(!s||o===void 0)continue;if(B0(s,i,n)){s==="visible"&&i.type==="light"&&(r=!0);continue}i.visible=n.visible;let a=i.uniforms[`f${i.id}_${s}`];if(!!a&&!(a instanceof Au))switch(r=r||mD(i,s,o),a.constructor){case Rt:if(typeof o=="string"){let l=e.getColor(o);l&&(a.value=l);break}else{let l=o;a.value instanceof el?a.value=new ji(l.r,l.g,l.b,l.a):a.setRGBA(l);break}case br:if(typeof o=="string"){let l=e.getColor(o);l&&(a.value=l);break}else{let l=o;a.value instanceof el?a.value=new ji(l.r,l.g,l.b,l.a):a.value.setRGBA(l.r,l.g,l.b,l.a);break}case Ti:{let l=o;a.value.setX(l[0]),a.value.setY(l[1]);break}case Mi:{let l=o;a.value.setX(l[0]),a.value.setY(l[1]),a.value.setZ(l[2]);break}case Qn:{O0(o,e,i);break}case xr:{a.value=o.map(l=>new tt(...l));break}default:{a.value=o;break}}}return r}var R0=class extends xt{constructor(t,e,i){super("v3"),this.nodeType="Matcap",this.texture=t,this.alpha=e,this.mode=i,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.isShader("fragment")){t.addFragmentVariable(this.calpha,"float");let i=t.include(R0.Nodes.matcap);t.require("normal"),t.requires.normal=!0;let n=[];return n.push(this.texture.generate(t,"t")),n.push("normal"),n.push(this.alpha.build(t,"f")),n.push(this.mode.build(t,"i")),n.push(this.calpha),t.format(i+"("+n.join(",")+")",this.getType(t),e)}else return console.warn("MatcapNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),e)}},I0=R0;I0.Nodes=function(){return{matcap:new Re(`vec3 matcap(sampler2D matcapTex, vec3 normal, float alpha, int mode, out float calpha) {
4199                vec3 viewDir = normalize( vViewPosition );
4200                vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
4201                vec3 y = cross( viewDir, x );
4202                vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks
4203                vec4 matcapColor = texture2D( matcapTex, uv );
4204
4205                calpha =  alpha / clamp( alpha + accumAlpha, 0.00001, 1.0 );
4206				accumAlpha += ( 1.0 - accumAlpha ) * alpha;
4207                
4208                return matcapColor.rgb;
4209            }
4210            `)}}();var Np=class extends Au{constructor(t,e){super("t"),this.image=t,this.wrap=e}get value(){return this.image.getTexture(this.wrap)}},vD=class extends Au{constructor(t){super("v3"),this.image=t,this._value=new E}get value(){return this._value.x=this.image.img.width,this._value.y=this.image.img.height,this._value}},z0=class extends xt{constructor(t,e,i,n,r,s,o,a,l,h){super("v3"),this.nodeType="Toon",this.positioning=t,this.colors=e,this.steps=i,this.source=n,this.isWorldSpace=r,this.noiseStrength=s,this.noiseScale=o,this.shadowColor=a,this.offset=l,this.alpha=h,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.require("worldNormal"),t.require("worldPosition"),t.isShader("fragment")){t.define("COLORS_MAX",10),t.addFragmentVariable(this.calpha,"float");let i=t.include(z0.Nodes.toon),n=[];return n.push(this.positioning.build(t,"i")),n.push(this.colors.build(t,"v4[]")),n.push(this.steps.build(t,"f[]")),n.push(this.source.build(t,"v3")),n.push(this.isWorldSpace.build(t,"b")),n.push(this.noiseStrength.build(t,"f")),n.push(this.noiseScale.build(t,"f")),n.push(this.shadowColor.build(t,"v4")),n.push(this.offset.build(t,"v3")),n.push(this.alpha.build(t,"f")),n.push(this.calpha),t.format(i+"("+n.join(",")+")",this.getType(t),e)}else return console.warn("ToonNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),e)}},N0=z0;N0.Nodes=function(){let t=new Re(`float rand(float n) {
4211				return fract(sin(n) * 43758.5453123);
4212			}`),e=new Re(`float hash1(float p) { 
4213				p = fract(p * 0.011); 
4214				p *= p + 7.5; 
4215				p *= p + p; 
4216				return fract(p); 
4217			}`),i=new Re(`float valueNoise(vec3 x) {
4218				const vec3 step = vec3(110, 241, 171);
4219			
4220				vec3 i = floor(x);
4221				vec3 f = fract(x);
4222			 
4223				// For performance, compute the base input to a 1D hash from the integer part of the argument and the 
4224				// incremental change to the 1D based on the 3D -> 1D wrapping
4225				float n = dot(i, step);
4226			
4227				vec3 u = f * f * (3.0 - 2.0 * f);
4228				return mix(mix(mix( hash1(n + dot(step, vec3(0, 0, 0))), hash1(n + dot(step, vec3(1, 0, 0))), u.x),
4229							   mix( hash1(n + dot(step, vec3(0, 1, 0))), hash1(n + dot(step, vec3(1, 1, 0))), u.x), u.y),
4230						   mix(mix( hash1(n + dot(step, vec3(0, 0, 1))), hash1(n + dot(step, vec3(1, 0, 1))), u.x),
4231							   mix( hash1(n + dot(step, vec3(0, 1, 1))), hash1(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z);
4232			}`,[e]),n=new Re(`vec3 hash3(vec3 x) {
4233				x = vec3(dot(x,vec3(127.1, 311.7, 74.7)),
4234						 dot(x,vec3(269.5, 183.3, 246.1)),
4235						 dot(x,vec3(113.5, 271.9, 124.6)));
4236			
4237				return fract(sin(x)*43758.5453123);
4238			}`),r=new Re(`vec3 voronoiNoise(in vec3 x)
4239			{
4240				vec3 p = floor(x);
4241				vec3 f = fract(x);
4242
4243				float id = 0.0;
4244				vec2 res = vec2(100.0);
4245
4246				for(int k=-1; k<=1; k++)
4247				for(int j=-1; j<=1; j++)
4248				for(int i=-1; i<=1; i++)
4249				{
4250					vec3 b = vec3(float(i), float(j), float(k));
4251
4252					// Comment out the "+ hash(p + b);" part below to get "square" cells
4253					vec3 r = vec3(b) - f + hash3(p + b);
4254					float d = dot(r, r);
4255
4256					if (d < res.x)
4257					{
4258						id = dot(p + b, vec3(1.0, 57.0, 113.0));
4259						res = vec2(d, res.x);			
4260					}
4261					else if (d < res.y)
4262					{
4263						res.y = d;
4264					}
4265				}
4266
4267				return vec3(sqrt(res), abs(id));
4268			}
4269			`,[n]);return{toon:new Re(`vec3 toon(int positioning, vec4 colors[COLORS_MAX], float steps[COLORS_MAX], vec3 source, bool isWorldSpace, float noiseStrength, float noiseScale, vec4 shadowColor, vec3 offset, float alpha, out float calpha) {
4270				float t = 0.0;
4271				float shadow = 1.0;
4272
4273				if (positioning == 0) {
4274
4275					// Can't do this mode if lighting is "none"
4276					#if (defined(PHONG) || defined(LAMBERT) || defined(STANDARD))
4277
4278						// Algorithm from Chapter 10 of Graphics Shaders
4279						const vec3 weights = vec3(0.2125, 0.7154, 0.0721);
4280						vec3 lpos;
4281						vec3 l;
4282						float dproduct;
4283
4284						#if (NUM_POINT_LIGHTS > 0)
4285
4286							#if defined(USE_SHADOWMAP) && (NUM_POINT_LIGHT_SHADOWS > 0)
4287								PointLightShadow pointLightShadow;
4288							#endif 
4289
4290							#pragma unroll_loop_start
4291							for (int i = 0; i < NUM_POINT_LIGHTS; i++) {
4292								// Light positions are in view-space for some reason?
4293								lpos = (inverse(viewMatrix) * vec4(pointLights[UNROLLED_LOOP_INDEX].position, 1.0
4293)).xyz;
4294								l = normalize(lpos - worldPosition);
4295								
4296								dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;
4297								
4298								// TODO: we want to use "intensity" but it isn't available in the shader code
4299								//dproduct += dot(pointLights[UNROLLED_LOOP_INDEX].color, weights);
4300
4301								t = max(t, dproduct);
4302
4303								// Accumulate shadow contribution
4304								#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS)
4305									pointLightShadow = pointLightShadows[UNROLLED_LOOP_INDEX];
4306									shadow *= getPointShadow( 
4307											pointShadowMap[UNROLLED_LOOP_INDEX], 
4308											pointLightShadow.shadowMapSize, 
4309											pointLightShadow.shadowBias, 
4310											pointLightShadow.shadowRadius,
4311											vPointShadowCoord[UNROLLED_LOOP_INDEX], 
4312											pointLightShadow.shadowCameraNear, 
4313											pointLightShadow.shadowCameraFar);
4314								#endif
4315							}
4316							#pragma unroll_loop_end
4317
4318						#endif
4319
4320						#if NUM_DIR_LIGHTS > 0 
4321							
4322							#if defined(USE_SHADOWMAP) && (NUM_DIR_LIGHT_SHADOWS > 0)
4323								DirectionalLightShadow directionalLightShadow;
4324							#endif 
4325
4326							#pragma unroll_loop_start
4327							for (int i = 0; i < NUM_DIR_LIGHTS; i++) {
4328								// Use the direction vector for directional lights instead
4329								l = (inverse(viewMatrix) * vec4(directionalLights[UNROLLED_LOOP_INDEX].direction, 0.0)).xyz;
4330		
4331								dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;
4332								t = max(t, dproduct);
4333
4334								// Accumulate shadow contribution
4335								#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS)
4336									directionalLightShadow = directionalLightShadows[UNROLLED_LOOP_INDEX];
4337									shadow *= getShadow( 
4338										UNROLLED_LOOP_INDEX,
4339										directionalShadowMap[UNROLLED_LOOP_INDEX], 
4340										directionalLightShadow.shadowMapSize, 
4341										directionalLightShadow.shadowBias, 
4342										directionalLightShadow.shadowRadius, 
4343										vDirectionalShadowCoord[UNROLLED_LOOP_INDEX]);
4344								#endif
4345							}
4346							#pragma unroll_loop_end
4347
4348						#endif
4349
4350						#if NUM_SPOT_LIGHTS > 0 
4351							
4352							#if defined(USE_SHADOWMAP) && (NUM_SPOT_LIGHT_SHADOWS > 0)
4353								SpotLightShadow spotLightShadow;
4354							#endif 
4355
4356							#pragma unroll_loop_start
4357							for (int i = 0; i < NUM_SPOT_LIGHTS; i++) {
4358								lpos = (inverse(viewMatrix) * vec4(spotLights[UNROLLED_LOOP_INDEX].position, 1.0)).xyz;
4359								l = normalize(lpos - worldPosition);
4360								
4361								dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;
4362								t = max(t, dproduct);
4363
4364								// Accumulate shadow contribution
4365								#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS)
4366									spotLightShadow = spotLightShadows[UNROLLED_LOOP_INDEX];
4367									shadow *= getShadow(
4368										UNROLLED_LOOP_INDEX,
4369										spotShadowMap[UNROLLED_LOOP_INDEX], 
4370										spotLightShadow.shadowMapSize, 
4371										spotLightShadow.shadowBias, 
4372										spotLightShadow.shadowRadius, 
4373										vSpotShadowCoord[UNROLLED_LOOP_INDEX]);
4374								#endif
4375							}
4376							#pragma unroll_loop_end
4377
4378						#endif
4379
4380						t = clamp(t, 0.0, 1.0);
4381				
4382					#endif
4383
4384				} else if (positioning == 1) {
4385					
4386					vec3 origin = mix(position, worldPosition, float(isWorldSpace));
4387					vec3 direction = normalize(source - origin);
4388					t = dot(direction, normalize(worldNormal)) * 0.5 + 0.5;	
4389
4390				} else {
4391
4392					vec3 origin = worldPosition;
4393					vec3 source = cameraPosition - offset;
4394					vec3 direction = normalize(source - origin);
4395					t = dot(direction, normalize(worldNormal)) * 0.5 + 0.5;	
4396					
4397				}
4398
4399				if (noiseStrength > 0.0) {
4400					// Distort with noise
4401					vec3 st = position / noiseScale;
4402					
4403					// Voronoi "smooth" noise
4404					float noise = 1.0 - voronoiNoise(st).x;
4405
4406					// Voronoi cellular noise
4407					//float noise = 1.0 - rand(voronoiNoise(st).z);
4408
4409					// Position warp noise
4410					// vec3 offset = vec3(
4411					// 	simplex3d(st),
4412					// 	simplex3d(st + vec3(111.1, 143.89, 217.19)),
4413					// 	simplex3d(st + vec3(171.1, 247.89, 117.23))
4414					// );
4415					// st += offset;
4416					// float noise = valueNoise(st);
4417
4418					t += noise * noiseStrength;
4419				}
4420
4421				t = clamp(t, 0.0, 1.0);
4422
4423				// Compute ramp color
4424				float p;
4425				vec4 color = colors[0];
4426				for (int i = 1; i < COLORS_MAX; i++) {
4427					p = clamp((t - steps[i-1]) / (steps[i] - steps[i-1]), 0.0, 1.0);
4428					color = mix(color, colors[i], smoothstep(0.0, 1.0, p));
4429				}
4430
4431				// Incorporate custom shadow color
4432				if (positioning == 0) {
4433
4434					vec3 blendedShadow = mix(color.rgb, shadowColor.rgb, shadowColor.a);
4435					color.rgb = mix(blendedShadow, color.rgb, shadow);
4436				
4437				}
4438
4439				// Accumulate alpha as usual
4440				float lalpha = alpha * color.a;
4441				calpha =  lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0);
4442				accumAlpha += (1.0 - accumAlpha) * lalpha;
4443
4444				return color.xyz;
4445
4446            }`,[Pi.simplex,t,i,r])}}();function Up(t,e,i){t.setUvTransform(i[0],i[1],e[0],e[1],0,0,0)}var yD=class extends u0{constructor(t,e){super(new qt),this.repeat=t,this.offset=e,Up(this.value,t,e)}updateMatrix(){Up(this.value,this.repeat,this.offset)}},Dr=class{constructor(t,e,i,n){this.id=t,this.uuid=e,this.data=i,this.uniforms={};for(let r in n)this.uniforms[`f${this.id}_${r}`]=n[r];for(let r in i)B0(r,this,i)}get type(){return this.data.type}static create(t,e,i,n){var r,s,o,a,l,h,f,c,u,d,m;if(i.type==="light")return vs.createLigherLayer(t,e,i,n);if(i.type==="texture"){let g=n.image(i.texture.image),p=new Np(g,i.texture.wrapping),v=new vD(g),y=new yD(i.texture.repeat,i.texture.offset),b=new Le(i.crop?1:0),x=new pt((r=i.projection)!=null?r:0),M=new pt((s=["x","y","z"].indexOf(i.axis))!=null?s:0),w=new pt((o=i.side)!=null?o:0),T=new Ti(i.size?new Z(i.size[0],i.size[1]):new Z(100,100)),_=new Le((a=i.alpha)!=null?a:1),A=new pt((l=i.mode)!=null?l:0),S=new T0(p,v,b,x,M,w,T,y,_,A),D=new Mt(S.calpha,"f");return new $t(t,e,i,{texture:p,textureSize:v,crop:b,projection:x,axis:M,side:w,size:T,mat:y,alpha:_,mode:A},S,A,D)}else if(i.type==="matcap"){let g=n.image(i.texture.image),p=new Np(g,i.texture.wrapping),v=new Le((h=i.alpha)!=null?h:1),y=new pt((f=i.mode)!=null?f:0),b=new I0(p,v,y),x=new Mt(b.calpha,"f");return new $t(t,e,i,{texture:p,alpha:v,mode:y},b,y,x)}else if(i.type==="displace")if(i.displacementType==="noise"){let g=new Mi(new E(...i.offset)),p=new Le((c=i.scale)!=null?c:10),v=new Le((u=i.intensity)!=null?u:8),y=new Le((d=i.movement)!=null?d:1),b=new pt((m=i.noiseType)!=null?m:0),x=new S0(v,y,g,p,b);return new U0(t,e,i,{offset:g,scale:p,intensity:v,movement:y,noiseType:b},x)}else throw new Error;else return bD(t,e,i,n)}updateByOp(t,e,i){let n=t;if(n.path[0]===void 0){if(n.type===0)return"type"in n.props||"category"in n.props?!0:gD(n.props,i,this,e)}else if(n.path[0]==="texture")return"texture"in e?O0(n.props,i,this):!0;return!1}dispose(){}hasValueByKey(t){return this.uniforms[t]!==void 0}hasValue(t){return this.hasValueByKey(`f${this.id}_${t}`)}setValue(t,e){let i=`f${this.id}_${t}`;this.hasValueByKey(i)&&e!==void 0&&(this.uniforms[i].value=e)}getNode(t){let e=`f${this.id}_${t}`;if(this.hasValueByKey(e))return this.uniforms[e]}getValue(t){let e=`f${this.id}_${t}`;if(this.hasValueByKey(e))return this.uniforms[e].value}getName(t){let e=/f\d+_(.*)/.exec(t);if(e&&e.length>1)return e[1];console.log(`Layer.getName: error ${t}`)}getNames(){let t=[];for(let e in this.uniforms){let i=this.getName(e);i&&t.push(i)}return t}},$t=class extends Dr{constructor(t,e,i,n,r,s,o){super(t,e,i,n),this.color=r,this.mode=s,this.alpha=o}},U0=class extends Dr{constructor(t,e,i,n,r){super(t,e,i,n),this.position=r}},vs=class extends Dr{constructor(t,e,i,n,r){super(t,e,i,r),this.data=i,this.node=n}static createLigherLayer(t,e,i,n){var l,h,f,c,u,d,m,g;let r,s=new Le(i.alpha),o=new pt(i.mode),a;if(!i.visible)r=new h0,a={};else if(i.category==="lambert"){r=new QP;let p=new Rt((l=n.color(i.emissive))!=null?l:0);a={emissive:p},r.emissive=p}else if(i.category==="toon"){r=new tD;let p=new Le((h=i.shininess)!=null?h:30),v=new Rt((f=n.color(i.specular))!=null?f:1118481);a={shininess:p,specular:v},r.shininess=p,r.specular=v}else if(i.category==="physical"){r=new eD;let p=new Le((c=i.roughness)!=null?c:.3),v=new Le((u=i.metalness)!=null?u:0),y=new Le((d=i.reflectivity)!=null?d:.5);a={roughness:p,metalness:v,reflectivity:y},r.roughness=p,r.metalness=v,r.reflectivity=y}else{r=new KP;let p=new Le((m=i.shininess)!=null?m:30),v=new Rt((g=n.color(i.specular))!=null?g:1118481);a={shininess:p,specular:v},r.shininess=p,r.specular=v}return r.alpha=new Le(1),r.shadingAlpha=s,r.shadingBlend=o,a.alpha=r.shadingAlpha,a.mode=r.shadingBlend,new vs(t,e,i,r,a)}};function xD(t){let e=t instanceof Dr?t.type:t;return e==="texture"||e==="displace_map"||e==="matcap"}function _D(t,e,i,n){var r,s,o,a,l,h,f,c,u,d,m,g,p,v,y,b,x,M,w,T,_,A,S,D,O,z,I,H,ee,G,B,N,R,k,F,U,W,ie,V,K,Y,J,Q,he,de,ae,ve,pe,me,De,Se,Me,vt,Ue,P,C,re,fe,ye,we,Ve,ne,Ie,_e,Ce,Ae,je,nt,_t,j,Te,se,be;switch(t.type){case"color":{let ue=new Rt((r=n.color)!=null?r:5855577),xe=new Le((s=n.alpha)!=null?s:1),Oe=new Mt("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");Oe.keywords.alpha=xe;let ze=new pt((o=n.mode)!=null?o:0);return ue.alpha=xe,new $t(e,i,t,{color:ue,alpha:xe,mode:ze},ue,ze,Oe)}case"fresnel":{let ue=new Rt((a=n.color)!=null?a:16777215),xe=new Le((l=n.bias)!=null?l:.1),Oe=new Le((h=n.scale)!=null?h:1),ze=new Le((f=n.intensity)!=null?f:2),Ze=new Le((c=n.factor)!=null?c:1),He=new Le((u=n.alpha)!=null?u:1),rt=new pt((d=n.mode)!=null?d:0),Qe=new p0(ue,xe,Oe,ze,Ze,He,rt),bt=new Mt(Qe.calpha,"f");return new $t(e,i,t,{color:ue,bias:xe,scale:Oe,intensity:ze,factor:Ze,alpha:He,mode:rt},Qe,rt,bt)}case"rainbow":{let ue=new Le((m=n.filmThickness)!=null?m:30),xe=new Le((g=n.movement)!=null?g:0),Oe=new Mi((p=n.wavelengths)!=null?p:new E(0,0,0)),ze=new Le((v=n.noiseStrength)!=null?v:0),Ze=new Le((y=n.noiseScale)!=null?y:1),He=new Mi((b=n.offset)!=null?b:new E(0,0,0)),rt=new Le((x=n.alpha)!=null?x:1),Qe=new g0(ue,xe,Oe,ze,Ze,He,rt),bt=new Mt(Qe.calpha,"f"),ft=new pt((M=n.mode)!=null?M:0);return new $t(e,i,t,{filmThickness:ue,movement:xe,wavelengths:Oe,noiseStrength:ze,noiseScale:Ze,offset:He,alpha:rt,mode:ft},Qe,ft,bt)}case"transmission":{let ue=new Le((w=n.thickness)!=null?w:10),xe=new Le((T=n.ior)!=null?T:1.5),Oe=new Le((_=n.roughness)!=null?_:.5),ze=Ei.transmissionSize,Ze=Ei.transmissionRenderTarget,He=Ei.transmissionRenderTargetDepth,rt=window.innerWidth,Qe=window.innerHeight,bt=rt>=Qe?new Ti(Qe/rt,1):new Ti(1,rt/Qe),ft=new Le((A=n.alpha)!=null?A:1),Bt=new _0(ue,xe,Oe,ze,Ze,He,bt,ft),hi=new Mt(Bt.calpha,"f"),Zt=new pt((S=n.mode)!=null?S:0);return new $t(e,i,t,{thickness:ue,ior:xe,roughness:Oe,aspectRatio:bt,alpha:ft,mode:Zt},Bt,Zt,hi)}case"toon":{let ue=new pt((D=n.positioning)!=null?D:0),xe;n.colors?xe=new xr(n.colors.length,n.colors):(xe=new xr(10,new tt(0,0,0,1)),xe.value[1]=new tt(1,1,1,1));let Oe;n.steps?Oe=new yr(n.steps.length,n.steps):(Oe=new yr(10,1),Oe.value[0]=0);let ze=new Mi((O=n.source)!=null?O:new E(0,0,0)),Ze=new to((z=n.isWorldSpace)!=null?z:!0),He=new Le((I=n.noiseStrength)!=null?I:0),rt=new Le((H=n.noiseScale)!=null?H:1),Qe=new br(n.shadowColor),bt=new Mi((ee=n.offset)!=null?ee:new E(0,0,0)),ft=new Le((G=n.alpha)!=null?G:1),Bt=new N0(ue,xe,Oe,ze,Ze,He,rt,Qe,bt,ft),hi=new Mt(Bt.calpha,"f"),Zt=new pt((B=n.mode)!=null?B:0);return new $t(e,i,t,{positioning:ue,colors:xe,steps:Oe,source:ze,isWorldSpace:Ze,noiseStrength:He,noiseScale:rt,shadowColor:Qe,offset:bt,alpha:ft,mode:Zt},Bt,Zt,hi)}case"outline":{let ue=new Rt((N=n.outlineColor)!=null?N:16777215),xe=new Rt((R=n.contourColor)!=null?R:16777215),Oe=new Le((k=n.outlineWidth)!=null?k:.1),ze=new Le((F=n.contourWidth)!=null?F:.1),Ze=new Le((U=n.outlineThreshold)!=null?U:.1),He=new Le((W=n.contourThreshold)!=null?W:.1),rt=new Le((ie=n.outlineSmoothing)!=null?ie:.1),Qe=new Le((V=n.contourFrequency)!=null?V:.1),bt=new Mi((K=n.contourDirections)!=null?K:new E(0,1,0)),ft=new to((Y=n.positionalLines)!=null?Y:!1),Bt=new to((J=n.compensation)!=null?J:!0),hi=Ei.normalRenderTarget,Zt=Ei.normalRenderTargetDepth,zn=Ei.pixelRatioNode,L=Ei.resolution,$=new Le((Q=n.alpha)!=null?Q:1),oe=new y0(ue,xe,Oe,ze,Ze,He,rt,Qe,bt,ft,Bt,L,hi,Zt,zn,$),X=new Mt(oe.calpha,"f"),ce=new pt((he=n.mode)!=null?he:0);return new $t(e,i,t,{outlineColor:ue,contourColor:xe,outlineWidth:Oe,contourWidth:ze,outlineThreshold:Ze,contourThreshold:He,outlineSmoothing:rt,contourFrequency:Qe,contourDirection:bt,positionalLines:ft,compensation:Bt,alpha:$,mode:ce},oe,ce,X)}case"depth":{let ue=new pt((de=n.gradientType)!=null?de:0),xe=new to((ae=n.smooth)!=null?ae:!1),Oe=new Le((ve=n.near)!=null?ve:50),ze=new Le((pe=n.far)!=null?pe
4446:200),Ze=new Le((me=n.isVector)!=null?me:1),He=new Le((De=n.isWorldSpace)!=null?De:0),rt=new Mi((Se=n.origin)!=null?Se:new E),Qe=new Mi((Me=n.direction)!=null?Me:new E),bt;n.colors?bt=new xr(n.colors.length,n.colors):(bt=new xr(2,new tt(0,0,0,1)),bt.value[1]=new tt(1,1,1,1));let ft;n.steps?ft=new yr(n.steps.length,n.steps):(ft=new yr(2,1),ft.value[0]=0);let Bt=new Le((vt=n.alpha)!=null?vt:1),hi=new pt((Ue=n.mode)!=null?Ue:0),Zt=new b0(ue,xe,Oe,ze,Ze,He,rt,Qe,bt,ft,Bt),zn=new Mt(Zt.calpha,"f");return new $t(e,i,t,{gradientType:ue,smooth:xe,near:Oe,far:ze,isVector:Ze,isWorldSpace:He,origin:rt,direction:Qe,colors:bt,steps:ft,alpha:Bt,mode:hi},Zt,hi,zn)}case"noise":{let ue=new Le((P=n.scale)!=null?P:1),xe=new Mi((C=n.size)!=null?C:new E(100,100,100)),Oe=new Le((re=n.move)!=null?re:1),ze=new Ti((fe=n.fA)!=null?fe:new Z(1.7,9.2)),Ze=new Ti((ye=n.fB)!=null?ye:new Z(8.3,2.8)),He=new Ti((we=n.distortion)!=null?we:new Z(1,1)),rt=new br(n.colorA),Qe=new br(n.colorB),bt=new br(n.colorC),ft=new br(n.colorD),Bt=new Le((Ve=n.alpha)!=null?Ve:1),hi=new pt((ne=n.mode)!=null?ne:0),Zt=new pt((Ie=n.noiseType)!=null?Ie:0),zn=new d0(ue,xe,Oe,ze,Ze,He,rt,Qe,bt,ft,Bt,Zt),L=new Mt(zn.calpha,"f");return new $t(e,i,t,{scale:ue,size:xe,move:Oe,fA:ze,fB:Ze,distortion:He,colorA:rt,colorB:Qe,colorC:bt,colorD:ft,alpha:Bt,mode:hi,noiseType:Zt},zn,hi,L)}case"normal":{let ue=new Mi((_e=n.cnormal)!=null?_e:new E(1,1,1)),xe=new Le((Ce=n.alpha)!=null?Ce:1),Oe=new pt((Ae=n.mode)!=null?Ae:0),ze=new C0(ue,xe),Ze=new Mt("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");return Ze.keywords.alpha=xe,new $t(e,i,t,{cnormal:ue,alpha:xe,mode:Oe},ze,Oe,Ze)}case"gradient":{let ue=new pt((je=n.gradientType)!=null?je:0),xe=new to((nt=n.smooth)!=null?nt:!1),Oe;n.colors?Oe=new xr(n.colors.length,n.colors):(Oe=new xr(10,new tt(0,0,0,1)),Oe.value[1]=new tt(1,1,1,1));let ze;n.steps?ze=new yr(n.steps.length,n.steps):(ze=new yr(10,1),ze.value[0]=0);let Ze=new Ti((_t=n.offset)!=null?_t:new Z(0,0)),He=new Ti((j=n.morph)!=null?j:new Z(0,0)),rt=new Le((Te=n.angle)!=null?Te:0),Qe=new Le((se=n.alpha)!=null?se:1),bt=new pt((be=n.mode)!=null?be:0),ft=new A0(ue,xe,Oe,ze,Ze,He,rt,Qe),Bt=new Mt(ft.calpha,"f");return new $t(e,i,t,{gradientType:ue,smooth:xe,colors:Oe,steps:ze,offset:Ze,morph:He,angle:rt,alpha:Qe,mode:bt},ft,bt,Bt)}default:{let ue=new Rt(1,0,0,1),xe=new Le(1),Oe=new Mt("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");Oe.keywords.alpha=xe;let ze=new pt(0);return ue.alpha=xe,new $t(e,i,t,{color:ue,alpha:xe,mode:ze},ue,ze,Oe)}}}function bD(t,e,i,n){let r=iD(i,n);return _D(i,t,e,r)}function B0(t,e,i){if(i.type==="displace"&&(t==="intensity"||t==="visible")){let n=e.uniforms[`f${e.id}_intensity`];return n?(n.value=i.intensity*(i.visible?1:0),n):void 0}if(i.type!=="displace"&&(t==="alpha"||t==="visible")){let n=e.uniforms[`f${e.id}_alpha`];if(!n)return;if(n.value=i.alpha*(i.visible?1:0),i.type==="outline"&&t==="visible"){let r=e.uniforms[`f${e.id}_compensation`];r&&(r.value=i.compensation&&i.visible)}return n}}var Os=class extends rr{constructor(t,e){super(void 0),this.data=t,this.layerIdGen=0,this.type="NodeMaterial",this.uniformsBackup={},this.fog=!0,this.updaters=[],this.dithering=!0,this.vertexColors=!0,this.onBeforeCompile=this._onBeforeCompile,this.transparent=!0,this.reset(t,e)}get fragment(){return this.lightLayer.node}get category(){return this.lightLayer.data.category}reset(t,e){var n,r;let i=(n=t.layers)!=null?n:Pn.defaultTwoLayerData("phong").layers;this.layers=i.map(s=>Dr.create(this.layerIdGen++,s.id,s.data,e)),this.layers.reverse(),this.name=(r=t.name)!=null?r:"Untitled Material",this.onUpdate(e)}getLayersOfType(t){return this.layers.filter(e=>e.type===t)}getLayerByUuid(t){return this.layers.find(e=>e.uuid===t)}onUpdate(t){this.lightLayer=this.layers.find(e=>e instanceof vs),this.lightLayer===void 0&&(this.lightLayer=new vs(0,"",{...Kn.defaultData("light","phong"),visible:!1},new h0,{})),this.dispose(),this.needsUpdate=!0,this.blendColors(),this.blendAfterColors(),this.blendPositions()}updateByOp(t,e,i){if(this.data=e,t.path[0]==="layers"){let n=t.path[1];if(n===void 0){if(this.layers.reverse(),t.type===4){let r=Dr.create(this.layerIdGen++,t.id,t.data,i);this.layers.splice(t.localIndex,0,r)}else if(t.type===5)this.layers.splice(t.localIndex,1)[0].dispose();else if(t.type===6){let r=this.layers.findIndex(o=>o.uuid===t.id),s=this.layers[r];this.layers.splice(r,1),this.layers.splice(t.localIndex,0,s)}this.layers.reverse(),this.onUpdate(i)}else{let r=this.layers.find(s=>s.uuid===n);if(r){let s=e.layers.data(n);if(r.updateByOp({...t,path:t.path.slice(2)},s,i)){let o=Dr.create(this.layerIdGen++,n,s,i);this.layers.splice(this.layers.findIndex(a=>a.uuid===n),1,o),this.onUpdate(i)}}}}}blendColors(){let t=this.layers.findIndex(i=>i instanceof $t),e=this.layers.findIndex(i=>i instanceof vs);if(t!==-1&&t<e){let i=this.layers[t].color;
4446for(let n=t+1;n<e;++n){let r=this.layers[n];r instanceof $t&&(i=new Ip(i,r.color,r.alpha,r.mode))}this.fragment.color=i}else this.fragment.color=void 0}blendAfterColors(){let t=new Mt("outgoingLight","f"),e=this.layers.findIndex(i=>i instanceof vs);if(this.layers.length>e+1){for(let i=e+1;i<this.layers.length;++i){let n=this.layers[i];n instanceof $t&&(t=new Ip(t,n.color,n.alpha,n.mode))}this.fragment.afterColor=t}else this.fragment.afterColor=void 0}blendPositions(){let t=this.layers.filter(e=>e instanceof U0);if(t.length>0){let e=t[0].position;for(let i=1;i<t.length;++i)t[i]&&(e=new sn(e,t[i].position,sn.ADD),e=new sn(e,new Le(.5).setReadonly(!0),sn.MUL));this.fragment.position=e}else this.fragment.position=void 0}getDefines(){return this.defines}getUniforms(){return this.uniforms}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}_onBeforeCompile(t,e){this.build({renderer:e}),t.defines=this.defines,t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.extensionDerivatives=this.extensions.derivatives===!0,t.extensionFragDepth=this.extensions.fragDepth===!0,t.extensionDrawBuffers=this.extensions.drawBuffers===!0,t.extensionShaderTextureLOD=this.extensions.shaderTextureLOD===!0}clampUniformsForPreview(t,e){let i=(n,r,s)=>Math.min(Math.max(n,r),s);for(let n of this.layers)if(n.type==="displace"){this.uniformsBackup[`f${n.id}_intensity`]=n.uniforms[`f${n.id}_intensity`].value;let r=i(n.uniforms[`f${n.id}_intensity`].value,t,e);n.uniforms[`f${n.id}_intensity`].value=r}}restoreClampedUniforms(){for(let t of this.layers)t.type==="displace"&&(t.uniforms[`f${t.id}_intensity`].value=this.uniformsBackup[`f${t.id}_intensity`])}customProgramCacheKey(){var e,i;let t="[";for(let{data:n}of this.data.layers)if(n.type==="light")t+=`"${n.visible?n.category.toUpperCase():"Basic"}"`;else{let r=((e=P0[n.type])!=null?e:[]).map(a=>n[a]),s=((i=D0[n.type])!=null?i:[]).map(a=>{var l,h;return(h=(l=n[a])==null?void 0:l.length)!=null?h:0}),o=[...r,...s];o.length?t+=`["${n.type}", "${o.join('","')}"],`:t+=`"${n.type}",`}return t=t.slice(0,-1)+"]",t}updateFrame(t){for(let e=0;e<this.updaters.length;++e)t.updateNode(this.updaters[e])}build(t){var i;t=t!=null?t:{};let e=(i=t.builder)!=null?i:new JP;return this.lights=this.lightLayer.data.visible,e.setMaterial(this,t.renderer),e.build(this.fragment,this.fragment),this.vertexShader=e.getCode("vertex"),this.fragmentShader=e.getCode("fragment"),this.defines=e.defines,this.uniforms=e.uniforms,this.extensions=e.extensions,this.updaters=e.updaters,this.transparent=e.requires.transparent||this.blending>Tr,this}dispose(){this.layers.forEach(t=>t.dispose()),super.dispose()}getHash(){let t="{";return t+='"fragment":'+this.fragment.getHash(),t+="}",t}};Object.defineProperties(Os.prototype,{properties:{get:function(){return this.fragment.properties}},needsUpdate:{set:function(t){t===!0&&this.version++,this.needsCompile=t},get:function(){return this.needsCompile}}});function wD(t){var s,o;if(t.geometry.attributes.extrudeNormal||!t.geometry.attributes.position||!t.geometry.attributes.normal)return;let e=new Map,i=t.geometry.attributes.position.array,n=t.geometry.attributes.normal.array,r=new Float32Array(i.length);for(let a=0;a<i.length;a+=3){let l=`${i[a]}_${i[a+1]}_${i[a+2]}`,h=new E(n[a],n[a+1],n[a+2]);e.has(l)?(s=e.get(l))==null||s.normals.push(h):e.set(l,{normals:[h],result:new E})}e.forEach((a,l)=>{for(let h of a.normals)a.result.add(h);a.result.divideScalar(a.normals.length)});for(let a=0;a<i.length;a+=3){let l=`${i[a]}_${i[a+1]}_${i[a+2]}`,h=(o=e.get(l))==null?void 0:o.result;h&&(r[a]=h.x,r[a+1]=h.y,r[a+2]=h.z)}t.geometry.setAttribute("extrudeNormal",new Pe(r,3))}function SD(t){if(t.geometry.attributes.extrudeNormals||!t.geometry.attributes.position)return;let e=t.geometry.attributes.position.array,i=new Float32Array(e.length),n=new E;for(let r=0;r<e.length;r+=3)n.set(e[r],e[r+1],e[r+2]).normalize(),i[r]=n.x,i[r+1]=n.y,i[r+2]=n.z;t.geometry.setAttribute("extrudeNormal",new Pe(i,3))}function ko(t){var e,i;if(Array.isArray(t.material)){for(let n of t.material)if(n.getLayersOfType("outline").length===0)return}else if(!(t.material instanceof Os)||t.material.getLayersOfType("outline").length===0)return;t.objectType==="Mesh2D"||t.objectType==="TextFrame"&&((i=(e=t.data)==null?void 0:e.geometry)==null?void 0:i.depth)===0?SD(t):wD(t)}function Vo(t){if(!t.geometry.attributes.position)return;let e=t.geometry.attributes.position.array,i=new Float32Array(e.length),n=parseInt(t.uuid.replace(/\D/g,"")),r=[At.seededRandom(n),At.seededRandom(n+1e4),At.seededRandom(n+2e4)];for(let s=0;s<e.length;s++)i[s]=r[s%3];t.geometry.setAttribute("randomColor",new it(i,3))}var Rn=class extends Ws(Di){constructor(t,e){var i,n;super(t,e),this.isAbstractMesh=!0,this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new Ye,this.booleanExclude=null,Array.isArray(e)&&t.groups.length===0&&t.addGroup(0,Math.max((n=(i=t.getIndex())==null?void 0:i.count)!=null?n:0,t.getAttribute("position").count),0)}get isGroup(){var t;return((t=this._cloner)==null?void 0:t.parameters.hideBase)===!0}get isMesh(){return!this.isGroup}set isMesh(t){}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}updateGeometry(t,e){let i=this.geometry,n=n0[i.userData.type],r=this.objectType==="NonParametric"?Object.assign({},i.userData,{geometry:i}):i.userData,s=n.build(n.normalizeInputs(t,r)),o=i.uuid;this.geometry.dispose(),this.geometry=s,this.geometry.uuid=o,this.geometry.computeBoundingSphere(),ko(this),i.getAttribute("randomColor")&&Vo(this)}clone(t){let e=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,i=Mh(e),n=this.material;return new this.constructor(i,n).copy(this,t)}copy(t,e=!0){return super.copy(t,e),t.cloner&&(this.cloner=new vh(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new vh(this)),this.cloner.fromClonerState(t))}fromState(t,e){var i,n,r;return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=(i=t.castShadow)!=null?i:!0,this.receiveShadow=(n=t.receiveShadow)!=null?n:!0,this.booleanExclude=(r=t.booleanExclude)!=null?r:null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Xn.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Br(this.parent)?this.parent.invali
4446dateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)Ds(t)&&(t.freeBooleanPointer(),Br(t)&&t.invalidateUpstreamBooleanData())}},MD=new E(0,0,1),Bp=new E,Fp=new E,kp=new qt,F0=class extends Rn{constructor(t=On.create({}),e){var i;super(t,e),this.recursiveSelection=!1,this.objectType="VectorObject",this.eventDispatcher=new In,this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()},this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=t.userData.shape,(i=this.shape.eventDispatcher)==null||i.addEventListener("update",this._onShapeUpdate)}fromState(t){return super.fromState(t),this.shape.update(),this}setHelperVisibility(){}updateGeometry(t,e){if(super.updateGeometry(t,e),"userData"in this.geometry){let i=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:i})}}setShape(t){var e,i;this.shape&&((e=this.shape.eventDispatcher)==null||e.removeEventListener("update",this._onShapeUpdate)),this.shape=t,(i=this.shape.eventDispatcher)==null||i.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),kp.getNormalMatrix(this.matrixWorld),Bp.copy(MD).applyMatrix3(kp).normalize(),Fp.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(Bp,Fp)}clone(t){let e=this.shape.clone(),i=this.material,n=this.geometry.userData,r=On.create(Object.assign({},n,{shape:e})),s=new F0(r,i).copy(this,t);return s.shape=e,e.update(),s}raycast(t,e){Rn.prototype.raycast.call(this,t,e)}},Go=(t,e)=>class extends t{constructor(){super(...arguments),this.objectHelper=new e(this)}get geometryHelper(){return e.geometryHelper}raycast(i,n){this.objectHelper.raycast(i,n)}fromLightState(i,n){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let r=this;i.color!==void 0&&(r.color=ai(i.color,n)),i.intensity!==void 0&&(r.intensity=i.intensity),i.depth!==void 0&&(r.shadow.camera.far=i.depth,r.shadow.needsUpdate=!0),i.shadows!==void 0&&(this.castShadow=i.shadows)}return this}},cs=new E,Pc=new E,tl=class extends Go(Ws(Oo),mL){constructor(t=window.innerWidth,e=window.innerHeight,i=45,n,r=1e5){super(),this.objectType="CombinedCamera",this._cameraType="OrthographicCamera",this.targetOffset=Ao.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.width=t,this.height=e,this.orthoCamera=new nl(t*-.5,t*.5,e*.5,e*-.5,n!=null?n:-5e4,r),this.perspCamera=new ri(i,t/e,n!=null?n:50,r),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic()}static createFromState(t,e){let i=new tl().fromState(e);return i.objectHelper.update(),i.uuid=t,i}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(t,e){t==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t){super.lookAt(t),this.getWorldPosition(cs),this.targetOffset=cs.distanceTo(t)}
4446getTarget(t=new E){return this.getWorldDirection(Pc),this.getWorldPosition(cs),Pc.multiplyScalar(this.targetOffset),t.copy(cs).add(Pc),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(cs),cs.distanceTo(t)}updateUp(){let t=this.getWorldQuaternion(new Fr),e=new E(0,0,1).applyQuaternion(t),i=new E().copy(gt.DefaultUp);this.isUpVectorFlipped&&i.negate(),i.applyQuaternion(t);let n=new E().copy(gt.DefaultUp).projectOnPlane(e),r=new E().crossVectors(n,i).dot(e)>=0?1:-1;this.angleOffsetFromUp=n.angleTo(i)*r}getViewFrontToObject(t){let e=t.getWorldPosition(new E),i=t.getWorldDirection(new E).multiplyScalar(this.targetOffset);return{position:e.clone().add(i),target:e}}getViewToObject(t){let e=t.getWorldPosition(new E),i=this.getWorldDirection(new E).multiplyScalar(this.targetOffset);return{position:e.clone().sub(i),target:e}}setViewplaneSize(t,e){this.left=-t*.5,this.right=t*.5,this.top=e*.5,this.bottom=-e*.5,this.aspect=t/e,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,e,i,n,r,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,e,i,n,r,s):this.orthoCamera.setViewOffset(t,e,i,n,r,s)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=t.targetOffset,this.updateProjectionMatrix(),this}toCameraState(t=[]){let e={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return uh(e,t)}fromCameraState(t){let{orthographic:e,perspective:i}=t;return t.type!==void 0&&(this.cameraType=t.type),t.far!==void 0&&(this.far=t.far),e!==void 0&&(e.near!==void 0&&(this.orthoCamera.near=e.near),e.zoom!==void 0&&(this.orthoCamera.zoom=e.zoom)),i!==void 0&&(i.near!==void 0&&(this.perspCamera.near=i.near),i.fov!==void 0&&(this.perspCamera.fov=i.fov),i.zoom!==void 0&&(this.perspCamera.zoom=i.zoom)),t.type==="PerspectiveCamera"?(this.zoom=this.perspCamera.zoom,this.fov=this.perspCamera.fov,this.near=this.perspCamera.near):(this.near=this.orthoCamera.near,this.zoom=this.orthoCamera.zoom),t.up!==void 0&&this.up.fromArray(t.up),t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isU
4446pVectorFlipped),this.updateProjectionMatrix(),this}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}fromState(t){return super.fromState(t),this.fromCameraState(t),this}},Vp=new Ye,AD=class extends Rn{constructor(t=new We,e){super(t,e),this.booleanOp=2,this.phongAngle=35,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.objectType="BooleanObject",this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.objectType="BooleanObject",this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(t,e=!0){var n,r;if(this.booleanMeshSetAddress!==-1)return;for(let s=0;s<this.children.length;s++){let o=this.children[s];Br(o)&&o.recomputeBoolean(t===!0,e)}this.meshSetAddresses=[];for(let s=0;s<this.children.length;s++){let o=this.children[s];if(kP(o)&&o.booleanExclude===!1&&((n=o.geometry.attributes.position)==null?void 0:n.count)>0&&o.geometry.drawRange.count>0){if(o.booleanMeshSetAddress===-1){if(((r=o.geometry.index)!=null?r:o.geometry.getAttribute("position")).count/3<15e5&&(o.booleanMeshSetAddress=Xn.getMeshSet(o.geometry,t===!0,e)),o.booleanMeshSetAddress===-1)return;Xn.transformMeshSet(o.booleanMeshSetAddress,o.matrix),o.booleanMatrixInvOld.copy(o.matrix).invert(),o.booleanWasTransformed=!1}else Br(o)&&o.needsTransformForDownstream===!0?(Xn.transformMeshSet(o.booleanMeshSetAddress,o.matrix),o.needsTransformForDownstream=!1):o.booleanWasTransformed===!0&&(Vp.multiplyMatrices(o.matrix,o.booleanMatrixInvOld),Xn.transformMeshSet(o.booleanMeshSetAddress,Vp),o.booleanMatrixInvOld.copy(o.matrix).invert(),o.booleanWasTransformed=!1);this.meshSetAddresses.push(o.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(t===!0)return Xn.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new We,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=Xn.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(s){this.booleanMeshSetAddress=0,console.error(s)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,ko(this),Vo(this)}updateGeometry(t,e){let i=t.parameters;i.operation!==void 0&&(this.booleanOp=i.operation),i.phongAngle!==void 0&&(this.phongAngle=i.phongAngle),this.invalidateDownstreamBooleanData().recomputeBoolean()}},Ch=class extends Go(Ws(ro),Rg){constructor(){super(...arguments),this.objectType="EmptyObject"}static createFromState(t,e){let i=new Ch().fromState(e);return i.uuid=t,i.objectHelper.update(),i}},k0=class extends Go(Ws(Xw),Og){constructor(...t){super(...t),this.objectType="LightDirectional",this._gizmos={},this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let e=this.shadow.camera;e.top=1250,e.bottom=-1250,e.right=1250,e.left=-1250,e.near=-1e4,e.far=2500;let i=new $n(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(t,e,i){let n=new k0().fromState(e,i);return n.uuid=t,n}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let e=this._gizmos[t];e instanceof $n&&(e.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let e=this._gizmos[t];e instanceof $n&&(e.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let e=this._gizmos[t];e instanceof $n&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}fromDirectionalLightState(t,e){let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;return super.fromLightState(t,e),t.size!==void 0&&NP(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),i&&this.update(),this}fromState(t,e){return super.fromState(t),this.fromDirectionalLightState(t,e),this}},V0=class extends Go(Ws(jw),Ig){constructor(...t){super(...t),this.objectType="LightPoint",this._gizmos={},this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let e=this.shadow.camera;
4446e.fov=90,e.aspect=1,e.near=100,e.far=2500;let i=new E(-e.far+this.position.x,-e.far+this.position.y,-e.far+this.position.z),n=new E(e.far+this.position.x,e.far+this.position.y,e.far+this.position.z),r=new Xi(i,n),s=new va(r,new Xe(16755200));s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,e,i){let n=new V0().fromState(e,i);return n.uuid=t,n}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let e=this._gizmos[t];e instanceof va&&(e.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let e=this._gizmos[t];e instanceof va&&(e.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let t in this._gizmos){let e=this._gizmos[t];if(e instanceof va){let i=this.shadow.camera,n=new E(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),r=new E(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z);e.box.set(n,r),e.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}fromPointLightState(t,e){return super.fromLightState(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,e){return super.fromState(t),this.fromPointLightState(t,e),this}},Gp=new E,Hp=new E,Wp=new Fr,G0=class extends Go(Ws(Hw),zg){constructor(...t){super(...t),this.objectType="LightSpot",this._gizmos={},this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let e=this.shadow.camera;e.fov=At.RAD2DEG*2*this.angle,e.aspect=1,e.near=100,e.far=2500;let i=new $n(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(t,e,i){let n=new G0().fromState(e,i);return n.uuid=t,n}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let e=this._gizmos[t];e instanceof $n&&(e.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let e=this._gizmos[t];e instanceof $n&&(e.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let e=this._gizmos[t];e instanceof $n&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),Hp.setFromMatrixPosition(this.matrixWorld),Wp.setFromRotationMatrix(this.matrixWorld),Gp.copy(this.up).applyQuaternion(Wp).negate().multiplyScalar(this.distance),this.target.position.copy(Hp).add(Gp),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}fromSpotLightState(t,e){return super.fromLightState(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,e){return super.fromState(t),this.fromSpotLightState(t,e),this}},jp=t=>t.tagName==="VIDEO",H0=class{static resize(t,e,i){let n=t/e,r;if(!i.image)return;let s=i.image;jp(s)?r=s.videoWidth/s.videoHeight:r=s.width/s.height,n>r&&(i.imageType=="WEBCAM"?i.repeat.set(-1,1*r/n):i.repeat.set(1,1*r/n)),n<r&&(i.imageType=="WEBCAM"?i.repeat.set(1*n/r*-1,1):i.repeat.set(1*n/r,1)),n==r&&(i.imageType=="WEBCAM"?i.repeat.set(-1,1):i.repeat.set(1,1))}static resizeTextureLayer(t,e,i){let n=t/e,r=i.image!==void 0?i.image.width/i.image.height:1,s;n>r?s={x:1,y:r/n}:n<r?s={x:n/r,y:1}:s={x:1,y:1},i.repeat.set(s.x,s.y),i.updateMatrix()}static resizeTextureLayers(t,e,i){let n=i.layers;for(let r=0;r<n.length;r++){let s=n[r];xD(s)&&H0.resizeTextureLayer(t,e,s.uniforms[`f${s.id}_texture`].value)}}static resizeComplex(t,e,i,n){let r=t/e,s,o=i.image;jp(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,n.geometry.type.includes("Shape")?(r>
4446s&&(i.imageType=="WEBCAM"?i.repeat.set(1/t*-1,1/e*s/r):i.repeat.set(1/t,1/e*s/r)),r<s&&(i.imageType=="WEBCAM"?i.repeat.set(1/t*r/s*-1,1/e):i.repeat.set(1/t*r/s,1/e)),r==s&&(i.imageType=="WEBCAM"?i.repeat.set(1/t*-1,1/e):i.repeat.set(1/t,1/e))):(r>s&&(i.imageType=="WEBCAM"?i.repeat.set(-1,1*s/r):i.repeat.set(1,1*s/r)),r<s&&(i.imageType=="WEBCAM"?i.repeat.set(1*r/s*-1,1):i.repeat.set(1*r/s,1)),r==s&&(i.imageType=="WEBCAM"?i.repeat.set(-1,1):i.repeat.set(1,1)))}},TD=class extends Rn{constructor(t,e){super(t,e),this.objectType="Mesh2D",this.castShadow=!0,this.receiveShadow=!0}updateGeometry(t,e){super.updateGeometry(t,e),this.material.layers&&H0.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}},W0=class extends Rn{constructor(t,e){super(t,e),this.objectType="Mesh3D",this.castShadow=!0,this.receiveShadow=!0}},ED=class extends W0{constructor(t,e){super(t,e),this.objectType="NonParametric"}},j0,Lh=new Promise(t=>{j0=t}),qp=!1;async function CD(){if(qp)return;let t=await rS(()=>import("./opentype.b764fcf5.js"),[]);j0(t),qp=!0}var LD=class{async load(t,e,i=()=>{}){let{load:n}=await Lh;n(t,(r,s)=>{r||!s?i(r!=null?r:"Something went wrong"):e(s)})}async parse(t){let{parse:e}=await Lh;try{return e(t)}catch(i){console.error(i)}}};async function PD(t){return await(await fetch(t)).arrayBuffer()}var DD=new LD;async function Xp(t){let e,i,n=!1;if(t.url?(e=await PD(t.url),i=t.url,n=t.url.startsWith("/")):t.data&&(e=t.data.buffer),e){let r=await DD.parse(e);if(r)return{font:r,url:i,intercepted:n,arr:e}}}var Yp=new E,$p=new Ye,Zp=new Rs;function OD(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&n.geometry.type==="TextGeometry"&&(e=!0)}),e}var RD=class extends Rn{constructor(t,e,i){super(new Zg(e.geometry,i),i.material(e.material)),this.data=e,this.objectType="TextFrame",this.wrappedText=[""],this.charWidths=[],this.charCoords=[],this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.name=e.name,this.uuid=t,this.updateState(e,i)}async updateGeometry(t,e){var a;let i=t.parameters,n={...this.geometry.userData.parameters,...i};this.geometry.userData={parameters:n,type:"TextGeometry"},e&&(i.font||!this.geometry.font&&e.getFont(n.font))&&await this.geometry.updateFont((a=i.font)!=null?a:n.font,e),await this.geometry.update(n),ko(this),Vo(this);let{wrappedText:r,charCoords:s,charWidths:o}=this.geometry;this.wrappedText=r,this.charWidths=o,this.charCoords=s,this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateState(t,e){this.data=t,this.material=e.material(t.material),this.fromState(t,e),this.updateGeometry({parameters:t.geometry},e)}get font(){return this.geometry.font}get initialOffsetY(){var t,e;return(e=(t=this.font)==null?void 0:t.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,this.geometry.userData.parameters.height,this.fontScale,this.geometry.userData.parameters.verticalAlign))!=null?e:0}get fontScale(){return this.font?this.geometry.userData.parameters.fontSize/this.font.unitsPerEm:1}get AD(){return Math.abs(this.ascender-this.descender)}get ascender(){var t,e;return((e=(t=this.font)==null?void 0:t.ascender)!=null?e:1)*this.fontScale}get descender(){var t,e;return((e=(t=this.font)==null?void 0:t.descender)!=null?e:1)*this.fontScale}get lineHeight(){return this.geometry.userData.parameters.fontSize*this.geometry.userData.parameters.lineHeight}raycast(t,e){let{matrixWorld:i}=this;if($p.copy(i).invert(),Zp.copy(t.ray).applyMatrix4($p),Zp.intersectBox(this.singleBBox,Yp)){let n=Yp.applyMatrix4(i),r=t.ray.origin.distanceTo(n);e.push({distance:r,point:n.clone(),object:this})}}},ID=Lm(pS()),Ph;Jg.then(t=>{Ph=t});var q0=new Ye,zD=new Ye,ND=new Ye,Bi=new Xi,jn=new E,UD=new Ye,BD=new Ye,X0=class extends Rn{constructor(t,e,i,n){super(i!=null?i:e,n),this.subdivPointer=t,this.originalGeometry=e,this.subdividedGeometry=i,this.objectType="SubdivObject",this.hiddenMatrixOld=new Ye,this.smoothShading=!0,this.phongAngle=35,this.matrixWorldRigid=new Ye,this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(t,e,i){let{subdivPointer:n,originalGeometry:r,subdividedGeometry:s}=ki.build(e.geometry,void 0,void 0,!e.flatShading),o=i.material(e.material),a=new X0(n,r,s||void 0,o);return e.geometry.phongAngle!==void 0&&(a.phongAngle=e.geometry.phongAngle),a.calcBoundingBox(),a.freeSubdivPointer(),a.uuid=t,a.fromState(e),a}buildFromStore(t,e){var s,o,a;let{originalGeometry:i,subdividedGeometry:n,subdivPointer:r}=ki.build(t,e,this.subdivPointer,this.smoothShading,this.shearScale);t.phongAngle!==void 0&&(this.phongAngle=t.phongAngle),this.subdivPointer=r,i!==void 0&&((s=this.originalGeometry)==null||s.dispose(),this.originalGeometry=i),n!==void 0&&((o=this.subdividedGeometry)==null||o.dispose(),this.subdividedGeometry=n!=null?n:void 0),this.geometry=(a=this.subdividedGeometry)!=null?a:this.originalGeometry,ko(this),Vo(this),t.width&&(this.geometry.userData.parameters={width:t.width,height:t.height,depth:t.depth})}updateMesh(t=!1){ki.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t?this.shearScaleInv:void 0),this.subdividedGeometry&&ki.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t?this.shearScaleInv:void 0)}updateTopology(){var t;this.originalGeometry.dispose(),this.originalGeometry=ki.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=ki.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.geometry=(t=this.subdividedGeometry)!=null?t:this.originalGeometry}raycast(t,e){var i;this.geometry=this.originalGeometry,Rn.prototype.raycast.call(this,t,e),this.geometry=(i=this.subdividedGeometry)!=null?i:this.originalGeometry}updateMatrixWorldSVD(){let t=this.matrixWorld.elements,e=[[t[0],t[4],t[8]],[t[1],t[5],t[9]],[t[2],t[6],t[10]]],{u:i,v:n,q:r}=(0,ID.SVD)(e),s=q0.set(i[0][0],i[0][1],i[0][2],0,i[1][0],i[1][1],i[1][2],0,i[2][0],i[2][1],i[2][2],0,0,0,0,1),o=zD.set(n[0][0],n[0][1],n[0][2],0,n[1][0],n[1][1],n[1][2],0,n[2][0],n[2][1],n[2][2],0,0,0,0,1),a=ND.copy(o).transpose();this.shearScale=UD.makeScale(r[0],r[1],r[2]).multiply(a).premultiply(o),this.shearScaleInv=BD.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(s,a),r.every(l=>Math.abs(r[0]-l)<.01)&&(this.shearScale=void 0,this.shearScaleInv=void 0)}activateSVDCompensation(){this.shearScale!==void 0&&(this.matrixAutoUpdate=!1,this.matrix.copy(this.matrixWorldRigid).copyPosition(this.matrixWorld),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.shearScale!==void 0&&(this.shearScale=void 0,this.shearScaleInv=void 0,this.matrixAutoUpdate=!0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let t=this.originalGeometry;
4446t.boundingSphere===null&&(t.boundingSphere=new cn);let e=t.attributes.position,i=t.boundingSphere.center;Bi.setFromBufferAttribute(e),Bi.getCenter(i),t.boundingSphere.radius=i.distanceTo(Bi.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Bi.getSize(jn);let n={width:jn.x,height:jn.y,depth:jn.z};return this.geometry.userData.parameters=n,n}updateBoundingBox(t){let e=this.originalGeometry;Bi.min.set(t[0],t[2],t[4]),Bi.max.set(t[1],t[3],t[5]),this.shearScaleInv&&(Bi.min.applyMatrix4(this.shearScaleInv),Bi.max.applyMatrix4(this.shearScaleInv)),e.boundingSphere===null&&(e.boundingSphere=new cn);let i=e.boundingSphere.center;Bi.getCenter(i),e.boundingSphere.radius=i.distanceTo(Bi.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Bi.getSize(jn);let n={width:jn.x,height:jn.y,depth:jn.z};return this.geometry.userData.parameters=n,n}freeSubdivPointer(){this.subdivPointer&&(Ph.free_bvh(this.subdivPointer),Ph.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(t,e){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:t.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:t.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:t.parameters.depth/this.geometry.userData.parameters.depth,Jp(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(Jp(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters={...t.parameters}}};function Jp(t,e,i,n){let r=t.position.array,s=t.normal.array,o=q0.makeScale(e,i,n).invert().elements,a,l,h;for(var f=0,c=r.length;f<c;f+=3)r[f]*=e,r[f+1]*=i,r[f+2]*=n,a=s[f],l=s[f+1],h=s[f+2],s[f]=o[0]*a+o[4]*l+o[8]*h,s[f+1]=o[1]*a+o[5]*l+o[9]*h,s[f+2]=o[2]*a+o[6]*l+o[10]*h}function Kp(t,e){e.flatShading!==void 0&&(t.flatShading=e.flatShading,t.needsUpdate=!0),e.wireframe!==void 0&&(t.wireframe=e.wireframe),e.side!==void 0&&(e.side===0?t.side=Or:e.side===1?t.side=vi:t.side=An)}function FD(t,e){if(Array.isArray(t.material))for(let i of t.material)Kp(i,e);else{let i=t.material;Kp(i,e)}t.objectType==="SubdivObject"&&e.flatShading!==void 0&&(t.material.flatShading=!1,t.smoothShading=!e.flatShading,t.updateMesh())}function kD(t,e,i){let n;if(e.geometry.type==="SubdivGeometry")n=X0.createFromState(t,e,i);else{let r=e.geometry.type==="BooleanGeometry"?new We:Kg(e.geometry),s="materials"in e?e.materials.map(o=>i.material(o)):i.material(e.material);Ya.is2DParametricMesh(r.userData.type)?n=new TD(r,s):(r==null?void 0:r.userData.type)==="VectorGeometry"?n=new F0(r,s):e.geometry.type==="NonParametricGeometry"?n=new ED(r,s):e.geometry.type==="BooleanGeometry"?(n=new AD(void 0,s),n.booleanOp=e.geometry.operation,e.geometry.phongAngle!==void 0&&(n.phongAngle=e.geometry.phongAngle)):n=new W0(r,s),n.uuid=t,n.fromState(e,i)}return FD(n,e),n}function VD(t,e,i){return e.type==="Mesh"?e.geometry.type==="TextGeometry"?new RD(t,e,i):kD(t,e,i):e.type==="Empty"?Ch.createFromState(t,e):e.type==="PointLight"?V0.createFromState(t,e,i):e.type==="SpotLight"?G0.createFromState(t,e,i):e.type==="DirectionalLight"?k0.createFromState(t,e,i):qa.is(e.type)?tl.createFromState(t,e):(console.error(e),new Ch)}var Dh=class extends Os{};function Qp(t,e){let i=!1,n=e.getLayersOfType("transmission"),r=e.getLayersOfType("outline");return r.length>0&&(t.layers.set(8),n.length>0&&t.layers.enable(3),i=!0,Vo(t),ko(t)),n.length===0&&r.length===0&&t.layers.set(0),i}
4446function em(t,e){if(!e.layers)return!1;let i=!1,n=e.getLayersOfType("transmission"),r=e.getLayersOfType("outline");return n.length>0&&(t.layers.set(3),r.length>0&&t.layers.enable(8),i=!0),n.length===0&&r.length===0&&t.layers.set(0),i}function GD(t){let e=!1;return t.traverseEntity(i=>{if(i instanceof Di)if(Array.isArray(i.material))for(let n=0;n<i.material.length;n++)Qp(i,i.material[n])&&(e=!0);else Qp(i,i.material)&&(e=!0)}),e}function HD(t){let e=!1;return t.traverseEntity(i=>{if(i instanceof Di)if(Array.isArray(i.material))for(let n=0;n<i.material.length;n++)em(i,i.material[n])&&(e=!0);else em(i,i.material)&&(e=!0)}),e}function WD(t){"material"in t&&jD(t.material),"geometry"in t&&t.geometry.dispose()}function jD(t){WC(t).forEach(e=>{e instanceof Dh||e.dispose()})}var qD=new $w,XD=new Ye,YD=new Rs;function $D(t,e,i){let n=t.cloner;if(n)for(let r of n.children){let s=XD.copy(r.matrixWorld).invert(),o=YD.copy(e.ray).applyMatrix4(s),a=t.matrixWorld;o.applyMatrix4(a);let l=qD;l.set(o.origin,o.direction),l.near=e.near,l.far=e.far,l.intersectObject(t,!1).length>0&&i.push({object:t})}}var tm=new E,Y0=class extends s0(bm){constructor(t,e){super(),this.objectType="Scene",this.backupFog=new kh(16777215,.1,2e3),this.fogUseBGColor=!1,this.enableHelpers=!1,this.wireframeState=!1,this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this._needsTransmission=!1,this._needsNormal=!1,this.bgColor=new ji(1,1,1,1),this.entityByUuid={},this.ambientLight=new jc(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.postprocessing=t.postprocessing,this.init(t,e),this.matrixAutoUpdate=!1}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=HD(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=GD(this),this.needsNormalDirty=!1),this._needsNormal}find(t){if(t===""||t===void 0)return;let e=this.entityByUuid[t];return e===void 0?this.getObjectByProperty("uuid",t):e}get enableFog(){return this.fog!==null}set enableFog(t){this.fog=t===!0?this.backupFog:null}init(t,e){if(this.createChildrenObjects(t.objects,this,e),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(ai(t.backgroundColor,e)),this.updateFog(t.fog,e),this.updateAmbientLight(t.environment.ambientLight,e),this.activeCamera=this.personalCamera,t.publish.playCamera!==null){let i=this.find(t.publish.playCamera);i instanceof tl&&this.switchActiveCamera(i)}this.traverse(i=>{Br(i)&&i.recomputeBoolean()})}clearScene(){this.traverseEntity(t=>{WD(t)});for(let t of this.children)Mn(t)&&t.removeFromParent()}resetAfterClear(t,e){this.init(t,e)}createPersonalCamera(){let t=tl.createFromState(Y0.PERSONAL_CAMERA_ID,{...fh.defaultData,name:"Personal Camera"});return t.objectHelper.visible=!1,delete t.isEntity,this.registerObjectCreatedInLegacy(t),t}raycast(t){let e=[],i=n=>{for(let r of n.children)Mn(r)&&!r.raycastLock&&r.visible&&((Ds(r)||r0(r)&&this.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),$D(r,t,e)),i(r))};return i(this),e}traverseEntity(t){for(let e of this.children)Mn(e)&&e.traverseEntity(t)}traverseVisibleEntity(t){for(let e of this.children)Mn(e)&&e.visible&&e.traverseVisibleEntity(t)}updateFog(t,e){this.enableFog=t.enabled,this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=ai(t.color,e),this.backupFog.near=t.near,this.backupFog.far=t.far}dispose(){this.clearScene()}updateAmbientLight(t,e){zP(this.ambientLight,t,e),t.groundColor!==void 0&&(this.ambientLight.groundColor=ai(t.groundColor,e)),t.enabled!==void 0&&(this.ambientLight.visible=t.enabled)}switchActiveCamera(t){this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}createChildrenObjects(t,e,i){for(let n of t)this.createChildObject(n.id,n.data,n.children,e,i)}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let e of t.children)this.unregisterObject(e)}createChildObject(t,e,i,n,r){let s=VD(t,e,r);return s&&(this.entityByUuid[t]=s,n.add(s),Br(n)&&Ds(s)&&(s.prevBooleanObjectParent=n),this.createChildrenObjects(i,s,r)),s}getCenter(t){let e=[];for(let n=0,r=t.length;n<r;++n){let{id:s,recursive:o}=t[n],a=this.find(s),l=o?a.recursiveBBox:a.singleBBox;e.push(...l.vertices)}let i=new Xi;return i.setFromPoints(e),i.getCenter(tm),tm}copyMatrixWorld(t,e){if(t===null){e.identity();return}let i=this.find(t);i?e.copy(i.matrixWorld):e.identity()}copyParentMatrixWorld(t,e){var n;if(t===null){e.identity();return}let i=(n=this.find(t))==null?void 0:n.parent;i?e.copy(i.matrixWorld):e.identity()}traverseMaterial(t){this.traverseEntity(e=>{if(e instanceof Rn)if(Array.isArray(e.material))for(let i=0;i<e.material.length;i++)e.material[i]instanceof Os&&t(e.material[i]);else e.material instanceof Os&&t(e.material)})}updateCanvasSize(t,e){this.activeCamera.setViewplaneSize(t,e);let i,n;t>=e?(i=e/t,n=1):(i=1,n=t/e),this.traverseMaterial(r=>{r.getLayersOfType("transmission").forEach(s=>{s.uniforms[`f${s.id}_aspectRatio`].value.x=i,s.uniforms[`f${s.id}_aspectRatio`].value.y=n})})}},$0=Y0;$0.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var ZD=Lm(mS()),im=new Map;function JD(t){if(typeof t=="string")return t;let e=im.get(t);return e||(e={url:URL.createObjectURL(new Blob([t]))},im.set(t,e)),e.url}var Dc=class{constructor({src:t,volume:e,delay:i,loop:n}){this._volume=1,this.delay=0,this._loop=1,this.loopsRemaining=0,this._status="stopped",this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)};let r;typeof t=="string"?r={src:t}:r={src:JD(t),format:"wav"},this.sound=new ZD.Howl(r),this.sound.on("end",this.onEnd),this.src=t,e!==void 0&&(this.volume=e),i!==void 0&&(this.delay=i),n!==void 0&&(this.loop=n)}get status(){return this._status}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}
vendor: 4,615 bytes, line 4446
4446on(t,e,i){this.sound.on(t,e,i)}off(t,e,i){this.sound.off(t,e,i)}play(){this._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}},KD=class{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Ua,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){var i;return(i=this.currentPath)==null||i.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){var r;return(r=this.currentPath)==null||r.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,s){var o;return(o=this.currentPath)==null||o.bezierCurveTo(t,e,i,n,r,s),this}splineThru(t){var e;return(e=this.currentPath)==null||e.splineThru(t),this}toShapes(){let t={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},e={loc:t.ORIGIN,t:0};function i(d,m,g,p){let v=d.x,y=m.x,b=g.x,x=p.x,M=d.y,w=m.y,T=g.y,_=p.y,A=(x-b)*(M-T)-(_-T)*(v-b),S=(y-v)*(M-T)-(w-M)*(v-b),D=(_-T)*(y-v)-(x-b)*(w-M),O=A/D,z=S/D;if(D===0&&A!==0||O<=0||O>=1||z<0||z>1)return null;if(A===0&&D===0){for(let I=0;I<2;I++)if(n(I===0?g:p,d,m),e.loc===t.ORIGIN){let H=I===0?g:p;return{x:H.x,y:H.y,t:e.t}}else if(e.loc===t.BETWEEN){let H=+(v+e.t*(y-v)).toPrecision(10),ee=+(M+e.t*(w-M)).toPrecision(10);return{x:H,y:ee,t:e.t}}return null}else{for(let ee=0;ee<2;ee++)if(n(ee===0?g:p,d,m),e.loc===t.ORIGIN){let G=ee===0?g:p;return{x:G.x,y:G.y,t:e.t}}let I=+(v+O*(y-v)).toPrecision(10),H=+(M+O*(w-M)).toPrecision(10);return{x:I,y:H,t:O}}}function n(d,m,g){let p=g.x-m.x,v=g.y-m.y,y=d.x-m.x,b=d.y-m.y,x=p*b-y*v;if(d.x===m.x&&d.y===m.y){e.loc=t.ORIGIN,e.t=0;return}if(d.x===g.x&&d.y===g.y){e.loc=t.DESTINATION,e.t=1;return}if(x<-Number.EPSILON){e.loc=t.LEFT;return}if(x>Number.EPSILON){e.loc=t.RIGHT;return}if(p*y<0||v*b<0){e.loc=t.BEHIND;return}if(Math.sqrt(p*p+v*v)<Math.sqrt(y*y+b*b)){e.loc=t.BEYOND;return}let M;p!==0?M=y/p:M=b/v,e.loc=t.BETWEEN,e.t=M}function r(d,m){let g=[],p=[];for(let v=1;v<d.length;v++){let y=d[v-1],b=d[v];for(let x=1;x<m.length;x++){let M=m[x-1],w=m[x],T=i(y,b,M,w);T!==null&&g.find(_=>_.t<=T.t+Number.EPSILON&&_.t>=T.t-Number.EPSILON)===void 0&&(g.push(T),p.push(new Z(T.x,T.y)))}}return p}function s(d,m,g){let p=new Z;m.getCenter(p);let v=[];return g.forEach(y=>{y.boundingBox.containsPoint(p)&&r(d,y.points).forEach(b=>{v.push({identifier:y.identifier,isCW:y.isCW,point:b})})}),v.sort((y,b)=>y.point.x-b.point.x),v}function o(d,m,g,p,v){(v==null||v==="")&&(v="nonzero");let y=new Z;d.boundingBox.getCenter(y);let b=[new Z(g,y.y),new Z(p,y.y)],x=s(b,d.boundingBox,m);x.sort((S,D)=>S.point.x-D.point.x);let M=[],w=[];x.forEach(S=>{S.identifier===d.identifier?M.push(S):w.push(S)});let T=M[0].point.x,_=[],A=0;for(;A<w.length&&w[A].point.x<T;)_.length>0&&_[_.length-1]===w[A].identifier?_.pop():_.push(w[A].identifier),A++;if(_.push(d.identifier),v==="evenodd"){let S=_.length%2===0,D=_[_.length-2];return{identifier:d.identifier,isHole:S,for:D}}else if(v==="nonzero"){let S=!0,D=null,O=null;for(let z=0;z<_.length;z++){let I=_[z];m[I]&&(S?(O=m[I].isCW,S=!1,D=I):O!==m[I].isCW&&(O=m[I].isCW,S=!0))}return{identifier:d.identifier,isHole:S,for:D}}else console.warn('fill-rule: "'+v+'" is currently not implemented.')}let a=0,l=999999999,h=-999999999,f=[];this.subPaths.forEach(d=>{let m=d.getPoints(),g=-999999999,p=999999999,v=-999999999,y=999999999;for(let b=0;b<m.length;b++){let x=m[b];x.y>g&&(g=x.y),x.y<p&&(p=x.y),x.x>v&&(v=x.x),x.x<y&&(y=x.x)}h<=v&&(h=v+1),l>=y&&(l=y-1),m.length&&f.push({curves:d.curves,points:m,isCW:qh.isClockWise(m),identifier:a++,boundingBox:new Zw(new Z(y,p),new Z(v,g))})});let c=f.map(d=>{var m;return o(d,f,l,h,(m=this.userData)==null?void 0:m.style.fillRule)}),u=[];return f.forEach(d=>{let m=c[d.identifier];if(m&&!m.isHole){let g=new Ba;g.curves=d.curves,c.filter(p=>(p==null?void 0:p.isHole)&&p.for===d.identifier).forEach(p=>{if(p){let v=f[p.identifier],y=new Ua;y.curves=v.curves,g.holes.push(y)}}),u.push(g)}}),u}},er;function QD(){return er||(er=new sS,er.setDecoderPath("https://www.gstatic.
4446com/draco/versioned/decoders/1.5.2/").preload()),er.decoderPending}async function eO(t){if(er){let e={attributeIDs:er.defaultAttributeIDs,attributeTypes:er.defaultAttributeTypes,useUniqueIDs:!1},i;try{i=await er.decodeGeometry(new Int8Array(t).buffer,e)}catch(n){console.error(n)}if(i)return{index:i.index?{array:i.index.array}:void 0,attributes:Object.entries(i.attributes).map(([n,r])=>({name:n,itemSize:r.itemSize,array:r.array}))}}return null}async function tO(t,e){let[i,n]=Fm(Jc.deserialize(new Uint8Array(t)));uL(i);let r=[];i.scene.objects.traverse((s,o)=>{o.type==="Mesh"&&o.geometry.type==="NonParametricGeometry"&&o.geometry.data.draco!==void 0&&r.push(o)}),r.length&&await QD();for(let s of r){let o=await eO(Oi(s.geometry.data.draco));if(o){o.index&&(s.geometry.data.index={array:o.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let a={};o.attributes.forEach(({name:l,array:h,itemSize:f})=>{a[l]={array:h,itemSize:f,type:"Float32Array",normalized:!1}}),s.geometry.data.attributes=a,s.geometry.data.draco=void 0}}return e&&e(i),n.result().data}function iO(t,e){return e.state.glyphIndex===t||e.state.fina===t||e.state.medi===t||e.state.init===t}var nO=class{constructor(t,e){var i;this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._isUserFont=(i=t.isUserFont)!=null?i:!1,this._loadingPromise=Xp(t).then(n=>{n&&(this._arrayBuffer=n.arr,this._url=n.url,this.font=n.font,this._intercepted=n.intercepted,this._isLoaded=!0,e())})}update(t,e){var i;this._isLoaded=!1,this._isUserFont=(i=t.isUserFont)!=null?i:!1,this._loadingPromise=Xp(t).then(n=>{n&&(this._arrayBuffer=n.arr,this._url=n.url,this.font=n.font,this._intercepted=n.intercepted,this._isLoaded=!0,e())})}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}async reverseLigaturesTable(t,e,i){let{Bidi:n}=await Lh,r=new n,s=f=>t.charToGlyphIndex(f.char);r.registerModifier("glyphIndex",null,s),r.applyFeatures(t,t.defaultRenderOptions.features),r.getTextGlyphs(e);let o=r.tokenizer.tokens,a=[],l=0,h=i.length===o.length;for(let f=0;f<i.length;f++){let c=i[f].index,u=String.fromCharCode(i[f].unicode),d=o[l];if(iO(c,d)||h)a.push({char:u,index:c,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),l++;else{let m=d.char,g="",p=[d.state.glyphIndex],v=[],y=!1;for(;!y;)l++,g=e.charAt(l),m+=g,p.push(t.charToGlyphIndex(g)),v=t.stringToGlyphs(m),v.length===1&&v[0].index===c&&(y=!0),l>e.length&&(y=!0);a.push({char:u,index:c,replacements:p,replacementChars:Array.from(m)}),l++}}return a}async generateShapes(t,e){await this._loadingPromise;let i=this.font,n=e.fontSize/this.unitsPerEm,r=e.fontSize*e.lineHeight,s=t.map(v=>this.getTextWidth(v,e)),o=e.width,a=this.getCharWidth(`
4447`,e),l=e.horizontalAlign===1?a:0,h=this.computeSpaceWidthForLine(t,0,e),f=this.getLineInitialOffsetX(s[0],o,e.horizontalAlign,t[0],a),c=this.getLineInitialOffsetY(r,t.length,e.height,n,e.verticalAlign),u=[],d=t.map(v=>[]),m=t.map(v=>[]),g;for(let v=0;v<t.length;v++){let y=t[v],b={features:{liga:!0}},x=[];try{x=i.stringToGlyphs(y,b)}catch(w){console.warn(w)}f=this.getLineInitialOffsetX(s[v],o,e.horizontalAlign,y,a);let M=[];try{M=await this.reverseLigaturesTable(i,y,x)}catch(w){console.warn(w)}h=this.computeSpaceWidthForLine(t,v,e);for(let w=0;w<x.length;w++){let T=x[w],_=T.index===0?`
4448`:T.unicode?String.fromCharCode(T.unicode):void 0,A=M[w],S=0,D=0;w===0&&e.horizontalAlign===2&&T.leftSideBearing!==void 0&&(D=-T.leftSideBearing*n),g&&(S=i.getKerningValue(T,g)*n),f+=D+S;let O=0;if(_===`
4449`)O=l;else if(_===" ")O=h;else{let z=this.createPath(T,n,f,c,e);z&&(O=z.offsetX-(S+D),u.push(z.path))}if(A.replacements.length===1)m[v].push([f,c]),d[v].push(O);else{let z=A.replacements.map(G=>{var B;return((B=i.glyphs.get(G).advanceWidth)!=null?B:0)*n}),I=z.reduce((G,B)=>G+=B,0),H=z.map(G=>G/I),ee=f;for(let G=0;G<H.length;G++){let B=O*H[G];m[v].push([ee,c]),d[v].push(B),ee+=B}}f+=O,g=T}c-=r}let p=[];for(let v=0,y=u.length;v<y;v++)p.push(...u[v].toShapes());return{shapes:p,charWidths:d,lineWidths:s,charCoords:m}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){var t,e;return(e=(t=this.font)==null?void 0:t.ascender)!=null?e:0}get descender(){var t,e;return(e=(t=this.font)==null?void 0:t.descender)!=null?e:0}get familyName(){var t,e;return(e=(t=this.font)==null?void 0:t.names.fontFamily)!=null?e:""}
4449get subfamilyName(){var t,e;return(e=(t=this.font)==null?void 0:t.names.fontSubfamily)!=null?e:""}get unitsPerEm(){var t,e;return(e=(t=this.font)==null?void 0:t.unitsPerEm)!=null?e:1}getLineInitialOffsetX(t,e,i,n,r){return(i===3||i===2)&&n.indexOf(`
4450`)>=0&&(t-=r),i===3?e*.5-t*.5:i===2?e-t:0}getLineInitialOffsetY(t,e,i,n,r){let s=e*t,o=Math.abs(this.ascender-this.descender)*n,a=t-o,l=-this.ascender*n-a/2;return r===3?-(i-s-l):r===2?-(i*.5-s*.5-l):l}createPath(t,e,i,n,r){var l,h;let s=t.getPath(i,-n,r.fontSize,{kerning:!1,letterSpacing:r.letterSpacing});if(!s){console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");return}let o=new KD,a=((l=t.advanceWidth)!=null?l:1)*e;if(t)for(let f of s.commands){let c=(h=o.currentPath)==null?void 0:h.currentPoint;if(!(c&&f.type!=="Z"&&c.x===f.x&&-c.y===f.y))switch(f.type){case"M":o.moveTo(f.x,-f.y);break;case"L":o.lineTo(f.x,-f.y);break;case"Q":o.quadraticCurveTo(f.x1,-f.y1,f.x,-f.y);break;case"C":o.bezierCurveTo(f.x1,-f.y1,f.x2,-f.y2,f.x,-f.y);break}}return o.subPaths.forEach(f=>{let c=rO(f.curves);c!==void 0&&f.currentPoint.distanceTo(c)>0&&f.lineTo(c.x,c.y)}),{offsetX:a+r.fontSize*r.letterSpacing,path:o}}getCharWidth(t,e){var i,n;return(n=(i=this.font)==null?void 0:i.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing}))!=null?n:0}getTextWidth(t,e){var i,n;return(n=(i=this.font)==null?void 0:i.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing}))!=null?n:0}computeSpaceWidthForLine(t,e,i){let n=this.getCharWidth(" ",i),r=t[e];if(r){let s=this.countSpaces(r.trimEnd());if(i.horizontalAlign===4&&e<t.length-1&&s){let o=i.width,a=this.getTextWidth(r,i);return(o-(a-s*n))/s}}return n}countSpaces(t){return(t.match(/ /g)||[]).length}};function rO(t){if(t.length){let e=t[0];if(e instanceof Wi)return e.v1;if(e instanceof Gi||e instanceof sr)return e.v0}}var Z0=class{constructor(t,e={}){if(this.deletedMaterial=new Dh(Pn.defaultTwoLayerData("phong"),this),this.deletedImage=new Eh(gh.emptyImage),this.materials={},this.images={},this.colors={},this.audios={},this.fonts={},this.penumbraSize=[],this.onImageLoad=()=>{this._onImageLoad&&this._onImageLoad()},this.onFontLoad=()=>{this._onFontLoad&&this._onFontLoad()},e.images)for(let[i,n]of Object.entries(e.images))this.addImage(i,n);if(e.audios)for(let[i,n]of Object.entries(e.audios))this.addAudio(i,n.data);this.reset(t)}setOnImageLoad(t){this._onImageLoad=t}setOnFontLoad(t){this._onFontLoad=t}reset(t){for(let[e,i]of Object.entries(t.images))this.addImage(e,i);for(let[e,i]of Object.entries(t.colors))this.addColor(e,i);for(let[e,i]of Object.entries(t.materials))this.addMaterial(e,new Dh(i,this));for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i.data);for(let[e,i]of Object.entries(t.fonts))this.addFont(e,i);this.penumbraSize=t.penumbraSize}addMaterial(t,e){e.uuid=t,this.materials[t]=e}deleteMaterial(t){this.materials[t]&&(this.materials[t].dispose(),delete this.materials[t])}getMaterial(t){return this.materials[t]}getMaterialOrDeletedPlaceholder(t){var e;return(e=this.materials[t])!=null?e:this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):new Os(t,this)}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.images[t].updateSrc(e.data),!0):(this.images[t]=new Eh(e,this.onImageLoad),!1)}deleteImage(t){this.images[t]&&delete this.images[t]}getDefaultImage(){return this.images.image_0}getImage(t){var e;return(e=this.images[t])!=null?e:this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):new L0(t,this.onImageLoad)}getImages(){return this.images}addColor(t,e){return this.colors[t]?("a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):("a"in e?this.colors[t]=new el(e.r,e.g,e.b,e.a):this.colors[t]=new el(e.r,e.g,e.b,1),!1)}updateColor(t,e){var i,n,r,s;if(this.colors[t]){let o=this.colors[t];return this.colors[t].r=(i=e.r)!=null?i:o.r,this.colors[t].g=(n=e.g)!=null?n:o.g,this.colors[t].b=(r=e.b)!=null?r:o.b,this.colors[t].a=(s=e.a)!=null?s:o.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}color(t){let e;if(typeof t=="string"){let i=this.getColor(t);i?e=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new ji(0,0,0,0))}else return"a"in t?new ji(t.r,t.g,t.b,t.a):new ji(t.r,t.g,t.b,1);return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof Dc)return e;{let i=new Dc({src:e});return this.audios[t]=i,i}}deleteAudio(t){this.audios[t]&&delete this.audios[t]}addFont(t,e){this.fonts[t]=new nO(e,this.onFontLoad)}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}
4450dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._onImageLoad=void 0,Object.values(this.audios).forEach(t=>{t instanceof Dc&&t.dispose()}),this.audios={}}};new Z0(mh.emptyData());function sO(t){let e;if(t.index)for(let i=0;i<t.index.array.length;i+=3)e=t.index.array[i],t.index.array[i]=t.index.array[i+2],t.index.array[i+2]=e}function oO(t){let e=new Set;return t.traverse(i=>{if(Ds(i))if(qi(i.material))i.material.forEach(n=>{let r=n;e.has(r)||e.add(r)});else{let n=i.material;e.has(n)||e.add(n)}}),e.forEach(i=>{if(i instanceof Array)return;let n=i.onBeforeCompile.bind(i);if(aO(i)){Object.assign(i,{isMeshStandardMaterial:!0,isMeshPhysicalMaterial:!0,transmission:1,attenuationColor:new Xe,specularColor:new Xe});let r=0;i.onBeforeCompile=(s,o)=>{n&&n(s,o),s.uniforms=Object.assign({},Fi.physical.uniforms,s.uniforms),i.getLayersOfType("transmission").forEach(a=>{if(s.uniforms.transmissionSamplerMap.value){let l=a.color;l&&(l.transmissionSamplerMap.value=s.uniforms.transmissionSamplerMap.value,l.transmissionSamplerSize.value=s.uniforms.transmissionSamplerSize.value)}else r++,r<2&&(i.needsUpdate=!0)})}}else lO(i)||(i.onBeforeCompile=(r,s)=>{n&&n(r,s),i.transparent=!1})}),t}function aO(t){return t.getLayersOfType("transmission").length>0}function lO(t){let e=0;return t.layers.forEach(i=>{if(i.type!=="light"&&i.type!=="fresnel"){let n=i.uniforms["f"+i.id+"_alpha"];n&&(e+=(1-e)*n.value)}}),e<1}function cO(t){return t.traverse(e=>{if(e.type==="Camera"){let i=e;i.type=i.cameraType}}),t}function hO(t){let e=[],i=(n,r=0)=>{let s=r>0?n+r:n;return e.includes(s)?i(n,r+1):s};return t.traverse(n=>{if(e.includes(n.name)){let r=n.name,s=i(n.name);if(n.name=s,n.isMesh){let o=n;o.material instanceof Array?o.material.forEach(a=>{a.name=a.name.replace(r,s)}):o.material.isAsset||(o.material.name=o.material.name.replace(r,s))}}e.push(n.name)}),t}function uO(t){let e=[];return t.traverse(i=>{i instanceof vh&&e.push(i)}),e.forEach(i=>{let n=i.object,r=i.children.map(o=>{o.updateMatrix();let a=o.geometry.clone().applyMatrix4(o.matrix);return o.matrix.determinant()<0&&sO(a),a}),s=Em(i.parameters.hideBase?r:[n.geometry,...r]);n.geometry=s,n.remove(i),n.cloner=void 0}),t}function dO(t){return t.traverse(e=>{e.matrixAutoUpdate=!0}),t}function fO(t){Object.values(t.shared.materials).forEach(e=>{Oc(e)}),t.scene.objects.traverse((e,i)=>{"material"in i?Oc(i.material):"materials"in i&&i.materials.forEach(n=>{Oc(n)})})}function Oc(t){if(typeof t=="string")return;let e=[];t.layers.forEach((i,n)=>{i.type==="outline"&&e.push(n)}),e.reverse().forEach(i=>{t.layers.delete(i)}),e.length&&console.warn("The Spline Loader currently does not support the outline layer.")}var nm="The SplineLoader only accepts .splinecode files that are generated from Spline export panel.",pO=class extends hl{load(t,e,i,n=console.error){let r=new Fa(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),t.endsWith(".spline")?console.warn(nm+" The .spline files are only meant to be used by the Editor."):t.endsWith(".splinecode")||console.warn(nm),r.load(t,async s=>{try{if(typeof s=="string")throw new Error("The .spline file is not binary!");let o=await this.parse(s);e(o)}catch(o){n(o)}},i,n)}async parse(t){let e=await tO(t,fO);OD(e)&&await CD();let i=new Z0(e.shared);Object.values(i.getMaterials()).forEach(s=>Object.assign(s,{isAsset:!0}));let n=new $0(e.scene,i);n.remove(n.personalCamera),e.scene.environment.ambientLight.enabled||n.remove(n.ambientLight);let r=e.scene.publish.playCamera;if(r){let s=n.find(r);s&&OP(s)&&Object.assign(s,{makeDefault:!0})}return n=uO(n),n=oO(n),n=cO(n),n=hO(n),n=dO(n),n}};const mO=document.querySelector("#hat-canvas"),Tu=new bm,Yn={width:window.innerWidth,height:window.innerHeight};window.addEventListener("resize",()=>{Yn.width=window.innerWidth,Yn.height=window.innerHeight,Qt.aspect=Yn.width/Yn.height,Qt.left=window.innerWidth/-2,Qt.right=window.innerWidth/2,Qt.top=window.innerHeight/2,Qt.bottom=window.innerHeight/-2,Qt.updateProjectionMatrix(),ar.setSize(Yn.width,Yn.height),ar.setPixelRatio(Math.min(window.devicePixelRatio,2))});const Qt=new nl(window.innerWidth/-2,window.innerWidth/2,window.innerHeight/2,window.innerHeight/-2,-100089,1e5);Qt.position.set(0,0,0);Qt.quaternion.setFromEuler(new nr(0,0,0));Qt.zoom=1;Qt.updateProjectionMatrix();Tu.add(Qt);const gO=new pO;let Sn;gO.load("https://cs-weglot.vercel.app/scene.splinecode",t=>{Tu.add(t),Sn=t.children[4],Sn.position.set(0,-350.4,0),Sn.rotation.set(-.25,-.58,0),J0(),vO()});const ar=new _m({canvas:mO,antialias:!0,alpha:!0});ar.setSize(Yn.width,Yn.height);ar.setPixelRatio(Math.min(window.devicePixelRatio,2));ar.shadowMap.enabled=!0;
4450ar.shadowMap.type=Rh;ar.setClearColor(0,0);function vO(){const t=gsap.timeline({scrollTrigger:{trigger:"[hat-animation='wrapper']",start:"top top",end:"bottom top",scrub:0,onUpdate:()=>{J0()}}}),e=gsap.timeline();e.to('[hat-animation="circle-scale"]',{duration:.4,scaleX:5,scaleY:5}),e.to('[hat-animation="circle-rotate"]',{duration:1,rotateZ:"630deg"},"<");const i=gsap.timeline();i.to(Sn.rotation,{duration:.2,x:.182,y:.182,z:-3.069},"0"),i.to(Sn.position,{duration:.1,y:-150},"<"),i.to(Sn.position,{duration:.1,y:-285.4},">");const n=gsap.timeline();n.to(Qt,{zoom:1.5,duration:.08}),n.to(Sn.position,{y:-285.4,duration:.08});const r=gsap.timeline();r.to(Sn.rotation,{x:1.482,duration:.1},0),r.to(Sn.position,{y:-3.6,duration:.1},"0"),r.to(Qt,{zoom:20,duration:.4},"<+0.05"),r.to('[hat-animation="circle-rotate"]',{opacity:0,duration:.01},"<+0.08"),r.to(".c-hat-canvas",{opacity:0,duration:.1},"<+0.01"),r.to('[hat-animation="circle-rotate"]',{opacity:0,duration:.01},"<+0.08"),t.add(e,"0"),t.add(i,"0"),t.add(n,">"),t.add(r,">+0.02")}const J0=()=>{Qt.updateProjectionMatrix(),ar.render(Tu,Qt)}});export default yO();

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.