three-low-poly 0.9.28 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,359 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("three");c=s(c,1);let l=require("three/addons/utils/BufferGeometryUtils.js"),u=require("three/addons/geometries/ParametricGeometry.js");function d(e,t){let n=t?.target.clone()??new c.Vector3;if(!t){let t=new c.Vector3;e.getWorldDirection(t),n.copy(e.position).add(t)}return{position:e.position.clone(),quaternion:e.quaternion.clone(),fov:e.fov,target:n}}function f(e,t,n){e.position.copy(n.position),e.quaternion.copy(n.quaternion),e.fov=n.fov,e.updateProjectionMatrix(),t&&(t.target.copy(n.target),t.update())}function p(e,t){return t(Math.min(1,e.elapsed/e.duration))}var m=class{camera;controls;active=null;elapsed=0;focus=new c.Vector3;rest;constructor(e,t){this.camera=e,this.controls=t;let n=d(e,t);this.focus.copy(n.target),this.rest=n}get isPlaying(){return this.active!==null}setRest(){this.rest=d(this.camera,this.controls)}setRestSnapshot(e){this.rest={position:e.position.clone(),quaternion:e.quaternion.clone(),fov:e.fov,target:e.target.clone()}}play(e){this.cancelActive(),f(this.camera,this.controls,this.rest),this.active=e,this.elapsed=0,this.controls&&(this.controls.enabled=!1),e.start(this.runtime())}stop(){this.cancelActive(),f(this.camera,this.controls,this.rest),this.controls&&(this.controls.enabled=!0,this.controls.update())}reset(){this.stop()}update(e){this.active&&(this.elapsed+=e,this.active.update(this.runtime(),e)===`complete`&&(this.active=null,this.elapsed=0,this.controls&&(this.controls.target.copy(this.focus),this.controls.enabled=!0,this.controls.update())))}dispose(){this.stop()}cancelActive(){this.active&&(this.active.cancel?.(this.runtime()),this.active=null,this.elapsed=0)}runtime(){return{camera:this.camera,controls:this.controls??null,elapsed:this.elapsed,duration:this.active?.duration??0,focus:this.focus}}},h={sineIn:e=>1-Math.cos(e*Math.PI/2),sineOut:e=>Math.sin(e*Math.PI/2),sineInOut:e=>-.5*(Math.cos(Math.PI*e)-1),quadIn:e=>e*e,quadOut:e=>1-(1-e)**2,quadInOut:e=>e<.5?2*e*e:1-(-2*e+2)**2/2,cubicIn:e=>e*e*e,cubicOut:e=>1-(1-e)**3,cubicInOut:e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,quartIn:e=>e*e*e*e,quartOut:e=>1-(1-e)**4,quartInOut:e=>e<.5?8*e*e*e*e:1-(-2*e+2)**4/2,quintIn:e=>e*e*e*e*e,quintOut:e=>1-(1-e)**5,quintInOut:e=>e<.5?16*e*e*e*e*e:1-(-2*e+2)**5/2,expoIn:e=>e===0?0:2**(10*e-10),expoOut:e=>e===1?1:1-2**(-10*e),expoInOut:e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2,circIn:e=>1-Math.sqrt(1-e**2),circOut:e=>Math.sqrt(1-(e-1)**2),circInOut:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2,linear:e=>e,smoothstep:e=>e*e*(3-2*e),concave:e=>1-(1-e)**.3,convex:e=>e**.3,logarithmic:e=>Math.log(Math.max(.01,e))/Math.log(2),squareRoot:e=>Math.sqrt(e),inverse:e=>1-e,gaussian:e=>Math.exp(-((e-.5)**2)/(2*.5))},g=new c.Vector3;new c.Vector3;function _(e){let{target:t,duration:n,ease:r=h.smoothstep,revolutions:i=1}=e,a={value:0},o={value:e.radius??10},s={value:e.elevation??.4};return{label:`Orbit`,duration:n,start(n){n.focus.copy(t),g.subVectors(n.camera.position,t),o.value=e.radius??g.length(),s.value=e.elevation??Math.asin(c.MathUtils.clamp(g.y/o.value,-1,1)),a.value=Math.atan2(g.z,g.x)},update(e){let n=p(e,r);if(n>=1)return`complete`;let c=a.value+n*Math.PI*2*i,l=o.value*Math.cos(s.value);return e.camera.position.set(t.x+l*Math.cos(c),t.y+o.value*Math.sin(s.value),t.z+l*Math.sin(c)),e.camera.lookAt(e.focus),`running`}}}function v(e){let{target:t,duration:n,azimuthAmplitude:r=.14,oscillations:i=2,ease:a=h.linear}=e,o={value:0},s={value:e.distance??8},l={value:.35};return{label:`Pendulum`,duration:n,start(n){n.focus.copy(t),g.subVectors(n.camera.position,t),s.value=e.distance??g.length(),l.value=Math.asin(c.MathUtils.clamp(g.y/s.value,-1,1)),o.value=Math.atan2(g.z,g.x)},update(e){let n=p(e,a);if(n>=1)return`complete`;let c=Math.sin(n*Math.PI*2*i)*r,u=o.value+c,d=s.value*Math.cos(l.value);return e.camera.position.set(t.x+d*Math.cos(u),t.y+s.value*Math.sin(l.value),t.z+d*Math.sin(u)),e.camera.lookAt(e.focus),`running`}}}function y(e){let{waypoints:t,duration:n,ease:r=h.cubicInOut}=e;if(t.length<2)throw Error(`Flythrough clip requires at least two waypoints`);let i=e.lookAt??t.slice(1).concat(t[t.length-1]),a=t.length-1;return{label:`Flythrough`,duration:n,start(e){e.focus.copy(i[0]??t[0]),e.camera.position.copy(t[0]),e.camera.lookAt(e.focus)},update(e){let n=p(e,h.linear);if(n>=1)return e.camera.position.copy(t[t.length-1]),e.focus.copy(i[i.length-1]??t[t.length-1]),e.camera.lookAt(e.focus),`complete`;let o=n*a,s=Math.min(a-1,Math.floor(o)),c=r(o-s);e.camera.position.lerpVectors(t[s],t[s+1],c);let l=i[s]??t[s+1],u=i[s+1]??t[s+1];return e.focus.lerpVectors(l,u,c),e.camera.lookAt(e.focus),`running`}}}function b(e){let{distance:t,duration:n,ease:r=h.cubicInOut}=e,i=new c.Vector3,a=new c.Vector3,o=new c.Vector3;return{label:`Dolly`,duration:n,start(e){i.copy(e.camera.position),e.camera.getWorldDirection(o),a.copy(i).addScaledVector(o,t),e.focus.copy(e.controls?.target??i).addScaledVector(o,10)},update(e){let t=p(e,r);return t>=1?(e.camera.position.copy(a),`complete`):(e.camera.position.lerpVectors(i,a,t),e.camera.lookAt(e.focus),`running`)}}}function x(e){let{target:t,radius:n,endRadius:r=n,height:i,revolutions:a,duration:o,ease:s=h.smoothstep}=e,l={value:0},u={value:0};return{label:`Spiral`,duration:o,start(e){e.focus.copy(t),l.value=e.camera.position.y,g.subVectors(e.camera.position,t),u.value=Math.atan2(g.z,g.x)},update(e){let o=p(e,s);if(o>=1)return`complete`;let d=u.value+o*Math.PI*2*a,f=c.MathUtils.lerp(n,r,o);return e.camera.position.set(t.x+f*Math.cos(d),l.value+i*o,t.z+f*Math.sin(d)),e.camera.lookAt(e.focus),`running`}}}function S(e){let{target:t,endFov:n,duration:r,ease:i=h.cubicInOut}=e,a={value:75};return{label:`Zoom`,duration:r,start(e){e.focus.copy(t),a.value=e.camera.fov},update(e){let t=p(e,i);return e.camera.fov=c.MathUtils.lerp(a.value,n,Math.min(1,t)),e.camera.updateProjectionMatrix(),e.camera.lookAt(e.focus),t>=1?`complete`:`running`},cancel(e){e.camera.fov=a.value,e.camera.updateProjectionMatrix()}}}function C(e){let{intensity:t,duration:n,ease:r=h.linear}=e,i=new c.Vector3,a={value:0};return{label:`Wobble`,duration:n,start(e){i.copy(e.camera.position),a.value=e.camera.position.x*17.3+e.camera.position.z*9.1},update(e){let n=p(e,r);if(n>=1)return e.camera.position.copy(i),`complete`;let o=1-n,s=e.elapsed*28+a.value;return e.camera.position.set(i.x+Math.sin(s*1.7)*t*o,i.y+Math.sin(s*2.3)*t*.6*o,i.z+Math.cos(s*1.9)*t*o),`running`},cancel(e){e.camera.position.copy(i)}}}var w={UP:new c.Vector3(0,1,0),DOWN:new c.Vector3(0,-1,0),LEFT:new c.Vector3(-1,0,0),RIGHT:new c.Vector3(1,0,0),FORWARD:new c.Vector3(0,0,1),BACKWARD:new c.Vector3(0,0,-1)},T={linear:(e,t)=>1-e/t,quadratic:(e,t)=>(1-e/t)**2,squareRoot:(e,t)=>(1-e/t)**.5,logarithmic:(e,t)=>Math.log(1+(t-e))/Math.log(1+t),sine:(e,t)=>Math.cos(e/t*Math.PI/2),exponential:(e,t)=>Math.exp(-e/t),cubic:(e,t)=>(1-e/t)**3,gaussian:(e,t)=>Math.exp(-(e**2)/(2*(t/3)**2)),inverse:(e,t)=>t/(t+e),smoothstep:(e,t)=>{let n=Math.max(0,Math.min(1,1-e/t));return n*n*(3-2*n)}},E=(e,t,n,r,i=w.UP,a=T.linear)=>{let o=e.attributes.position;for(let e=0;e<o.count;e++){let s=new c.Vector3;s.fromBufferAttribute(o,e);let l=s.distanceTo(t);if(l<n){let t=a(l,n)*r;s.add(i.clone().multiplyScalar(t)),o.setXYZ(e,s.x,s.y,s.z)}}o.needsUpdate=!0},D=(e,t,n,r,i,a=w.UP,o=T.linear)=>{let s=e.attributes.position;for(let e=0;e<s.count;e++){let l=new c.Vector3;l.fromBufferAttribute(s,e);let u=l.distanceTo(t);if(u<n){let t=o(u,n)*i,c=r-l.dot(a.normalize());l.add(a.clone().multiplyScalar(c*t)),s.setXYZ(e,l.x,l.y,l.z)}}s.needsUpdate=!0},O=(e,t,n,r,i=w.UP,a=T.linear)=>{let o=e.attributes.position;for(let e=0;e<o.count;e++){let s=new c.Vector3;s.fromBufferAttribute(o,e);let l=s.distanceTo(t);if(l<n){let t=r*a(l,n),u=i.clone().normalize();s.x+=c.MathUtils.randFloatSpread(t)*u.x,s.y+=c.MathUtils.randFloatSpread(t)*u.y,s.z+=c.MathUtils.randFloatSpread(t)*u.z,o.setXYZ(e,s.x,s.y,s.z)}}o.needsUpdate=!0},k=(e,t,n,r)=>{let i=e.attributes.position,a=new c.Vector3;for(let e=0;e<i.count;e++){let o=new c.Vector3;if(o.fromBufferAttribute(i,e),o.distanceTo(t)<n){let t=new c.Vector3,s=0;for(let e=0;e<i.count;e++)a.fromBufferAttribute(i,e),a.distanceTo(o)<n&&(t.add(a),s++);s>0&&(t.divideScalar(s),o.lerp(t,r),i.setXYZ(e,o.x,o.y,o.z))}}i.needsUpdate=!0},ee=(e,t,n,r,i=!1,a=T.linear)=>{let o=e.attributes.position;for(let e=0;e<o.count;e++){let s=new c.Vector3;s.fromBufferAttribute(o,e);let l=s.distanceTo(t);if(l<n){let c=a(l,n)*r*(i?-1:1),u=s.clone().sub(t).normalize();s.add(u.multiplyScalar(c)),o.setXYZ(e,s.x,s.y,s.z)}}o.needsUpdate=!0},te=(e,t,n,r,i=w.UP,a=T.linear)=>{let o=e.attributes.position,s=new c.Quaternion;for(let e=0;e<o.count;e++){let l=new c.Vector3;l.fromBufferAttribute(o,e);let u=l.distanceTo(t);if(u<n){let c=a(u,n)*r;s.setFromAxisAngle(i,c),l.sub(t).applyQuaternion(s).add(t),o.setXYZ(e,l.x,l.y,l.z)}}o.needsUpdate=!0},A={X:new c.Vector3(1,0,0),Y:new c.Vector3(0,1,0),Z:new c.Vector3(0,0,1),XY:new c.Vector3(1,1,0).normalize(),XZ:new c.Vector3(1,0,1).normalize(),YZ:new c.Vector3(0,1,1).normalize(),XYZ:new c.Vector3(1,1,1).normalize()},j=function(e){return e.LEFT=`left`,e.RIGHT=`right`,e.TOP=`top`,e.BOTTOM=`bottom`,e.FRONT=`front`,e.BACK=`back`,e}({}),ne={CADMIUM_RED:15073318,CARDINAL_RED:12981270,CHERRY_RED:14165028,CRIMSON:12986408,ALIZARIN_CRIMSON:11674146,DARK_RED:9109504,RUST:12731693,CORAL_ORANGE:16734003,TANGERINE:16733440,ORANGE_PEEL:16737792,CADMIUM_ORANGE:16744228,ORANGE:16753920,AMBER:16755200,CADMIUM_YELLOW:16766720,GOLD:16766720,YELLOW:16776960,LIME_GREEN:10798080,SPRING_GREEN:8965205,MOSS_GREEN:8956467,FERN_GREEN:4950843,FOREST_GREEN:2263842,SAP_GREEN:5274922,OLIVE_DRAB:5597999,VIRIDIAN_GREEN:43115,MINT_GREEN:8965290,AQUAMARINE:65450,PHTHALO_BLUE:3977,AETHER_BLUE:3447003,SKY_BLUE:8965375,CERULEAN_BLUE:6139362,AZURE:30719,OCEAN_BLUE:30654,ROYAL_BLUE:5592575,MIDNIGHT_BLUE:51,ULTRAMARINE_BLUE:4149685,COBALT_VIOLET:6950317,DEEP_VIOLET:11141375,CORAL_PINK:16724838,VIVID_MAGENTA:16720639,MAGENTA:16711935,HOT_PINK:16711850,PINK_SHERBET:16751052,SOFT_PINK:16762823,BURNT_SIENNA:15299665,BURNT_UMBER:9057060,SIENNA:9132587,SADDLE_BROWN:9127187,COFFEE_BROWN:6045747,DARK_UMBER:4929057,RAW_UMBER:8545860,YELLOW_OCHRE:12951919,RAW_SIENNA:13808780,TAUPE:9141627,ONYX:197379,CARBON:3026478,CHARCOAL:3355443,SLATE_GRAY:4210752,ASH_GRAY:4473924,GRAPHITE:5263440,STEEL_GRAY:5592405,DIM_GRAY:6908265,IRON:7829367,GRAY:8421504,STONE:8947848,SILVER:11184810,LIGHT_GRAY:13421772,PALE_GRAY:15658734,WHITE_SMOKE:16119285,TITANIUM_WHITE:16777215},M={cubic:(e,t,n,r,i)=>{let a=Math.max(0,Math.min(1,e)),o=1-a;return o*o*o*t+3*o*o*a*n+3*o*a*a*r+a*a*a*i},damped:(e,t=1)=>{let n=Math.max(.001,t);return(1-Math.exp(-n*e))/(1-Math.exp(-n))},exponential:(e,t=1,n=1)=>t*Math.max(0,Math.min(1,e))**+n,logarithmic:(e,t=1,n=1)=>t*Math.log(n*Math.max(.001,Math.min(1,e))+1),parabolic:(e,t=1,n=0,r=0)=>{let i=Math.max(0,Math.min(1,e));return t*i*i+n*i+r},quadratic:(e,t,n,r)=>{let i=Math.max(0,Math.min(1,e)),a=1-i;return a*a*t+2*a*i*n+i*i*r},sigmoid:(e,t=10)=>{let n=Math.max(0,Math.min(1,e));return 1/(1+Math.exp(-t*(n-.5)))},sinusoidal:e=>Math.sin(e*Math.PI*.5)};function re(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function ie(e){let t=(e>>>0)+2654435769;return t=Math.imul(t^t>>>16,2246822507),t^=t>>>13,t=Math.imul(t^t>>>16,3266489909),(t^t>>>16)>>>0}function ae(e,t){return ie(e>>>0^t>>>0)}function oe(e,t){return{seeded:t,next:e,float(t=0,n=1){return t+(n-t)*e()},int(e=0,t=1){return Math.floor(this.float(e,t+1))},pick(e){if(!e.length)throw Error(`RandomSource.pick() requires a non-empty array`);return e[this.int(0,e.length-1)]},boolean(t=.5){return e()<t},skewMax(t=.5,n=0,r=1){return n+(r-n)*e()**+t},skewMin(t=.5,n=0,r=1){return n+(r-n)*(1-e())**t}}}function N(e){return e===void 0?oe(Math.random,!1):oe(re(e>>>0),!0)}function se(e,t,n){return t+(n-t)*e()}function ce(e,t){if(!t.length)throw Error(`randomPick() requires a non-empty array`);return t[Math.floor(e()*t.length)]}var le={create:N,mulberry32:re,splitmix32:ie,deriveSubSeed:ae,range:se,pick:ce},P=N();function F(e=0,t=1,n=P){return n.float(e,t)}function ue(e=0,t=1,n=P){return n.int(e,t)}function de(e=.5,t=0,n=1,r=P){return r.skewMax(e,t,n)}function fe(e=.5,t=0,n=1,r=P){return r.skewMin(e,t,n)}var pe=class extends c.InstancedMesh{width;height;depth;floorY;waft;scaleMin;scaleMax;px;py;pz;settle;twinkle;phase;dummy=new c.Object3D;clock=0;constructor(e={}){let{count:t=150,width:n=12,height:r=8,depth:i=12,floorY:a=0,color:o=`#aebfe6`,radius:s=.02,opacity:l=.9,material:u,settleMin:d=.1,settleMax:f=.35,waft:p=.08,scaleMin:m=.6,scaleMax:h=1.2,twinkleMin:g=.7,twinkleMax:_=1.6}=e,v=u??new c.MeshBasicMaterial({color:new c.Color(o),transparent:!0,opacity:l,blending:c.AdditiveBlending,depthWrite:!1,toneMapped:!1});super(new c.SphereGeometry(s,5,5),v,t),this.instanceMatrix.setUsage(c.DynamicDrawUsage),this.frustumCulled=!1,this.width=n,this.height=r,this.depth=i,this.floorY=a,this.waft=p,this.scaleMin=m,this.scaleMax=h,this.px=new Float32Array(t),this.py=new Float32Array(t),this.pz=new Float32Array(t),this.settle=new Float32Array(t),this.twinkle=new Float32Array(t),this.phase=new Float32Array(t);for(let e=0;e<t;e++)this.respawn(e,!0),this.settle[e]=F(d,f),this.twinkle[e]=F(g,_),this.phase[e]=F(0,Math.PI*2);this.writeMatrices()}update(e){this.clock+=e;for(let t=0;t<this.count;t++)this.py[t]-=this.settle[t]*e,this.px[t]+=Math.sin(this.clock*.3+this.phase[t])*this.waft*e,this.pz[t]+=Math.cos(this.clock*.24+this.phase[t])*this.waft*e,this.py[t]<this.floorY&&this.respawn(t,!1);this.writeMatrices()}dispose(){this.geometry.dispose();let e=Array.isArray(this.material)?this.material:[this.material];for(let t of e)t.dispose();return this}respawn(e,t){this.px[e]=F(-this.width*.5,this.width*.5),this.pz[e]=F(-this.depth*.5,this.depth*.5),this.py[e]=t?this.floorY+F(0,this.height):this.floorY+this.height}writeMatrices(){let e=this.dummy;for(let t=0;t<this.count;t++){let n=Math.abs(Math.sin(this.clock*this.twinkle[t]+this.phase[t])),r=this.scaleMin+(this.scaleMax-this.scaleMin)*n;e.position.set(this.px[t],this.py[t],this.pz[t]),e.scale.setScalar(r),e.updateMatrix(),this.setMatrixAt(t,e.matrix)}this.instanceMatrix.needsUpdate=!0}},me=class extends c.InstancedMesh{width;height;depth;baseY;spread;px;py;pz;speed;dummy=new c.Object3D;constructor(e={}){let{count:t=24,width:n=1.5,height:r=3,depth:i=1.5,spread:a=.88,baseY:o=0,speedMin:s=.35,speedMax:l=.85,color:u=16777215,opacity:d=.6,emissiveIntensity:f=0,geometry:p=new c.SphereGeometry(.08,6,6),material:m}=e,h=m??new c.MeshStandardMaterial({color:u,emissive:u,emissiveIntensity:f,transparent:!0,opacity:d,roughness:.3,metalness:.1});super(p,h,t),this.instanceMatrix.setUsage(c.DynamicDrawUsage),this.frustumCulled=!1,this.width=n,this.height=r,this.depth=i,this.baseY=o,this.spread=Math.min(1,Math.max(0,a)),this.px=new Float32Array(t),this.py=new Float32Array(t),this.pz=new Float32Array(t),this.speed=new Float32Array(t);for(let e=0;e<t;e++)this.respawn(e,!0),this.speed[e]=F(s,l);this.writeMatrices()}update(e){let t=this.baseY+this.height;for(let n=0;n<this.count;n++)this.py[n]+=this.speed[n]*e,this.py[n]>t&&this.respawn(n,!1);this.writeMatrices()}dispose(){this.geometry.dispose();let e=Array.isArray(this.material)?this.material:[this.material];for(let t of e)t.dispose();return this}respawn(e,t){let n=this.width*.5*this.spread,r=this.depth*.5*this.spread;this.px[e]=F(-n,n),this.pz[e]=F(-r,r),this.py[e]=t?this.baseY+Math.random()*this.height:this.baseY+F(0,this.height*.15)}writeMatrices(){let e=this.dummy;for(let t=0;t<this.count;t++)e.position.set(this.px[t],this.py[t],this.pz[t]),e.updateMatrix(),this.setMatrixAt(t,e.matrix);this.instanceMatrix.needsUpdate=!0}},he=class{speed;minIntensity;maxIntensity;material;elapsed=0;constructor({material:e,speed:t=2,maxIntensity:n=.8,minIntensity:r=.2}){this.material=e,this.speed=t,this.maxIntensity=n,this.minIntensity=r}update(e){this.elapsed+=e;let t=Math.abs(Math.sin(this.elapsed*this.speed));this.material.emissiveIntensity=this.minIntensity+t*(this.maxIntensity-this.minIntensity)}},ge=class e{seed;light;lightIntensity;flame;halo;haloOpacity;flameColor=new c.Color;elapsed=0;constructor({seed:e=Math.random()*100,light:t,lightIntensity:n=4,flame:r,flameColor:i=16755268,halo:a,haloOpacity:o=.75}={}){this.seed=e,this.light=t,this.lightIntensity=n,this.flame=r,this.flameColor.set(i),this.halo=a,this.haloOpacity=o}static factor(e,t){return .8+.2*Math.sin(e*9+t)+.08*Math.sin(e*23+t*2)}get level(){return e.factor(this.elapsed,this.seed)}update(t){this.elapsed+=t;let n=e.factor(this.elapsed,this.seed);this.light&&(this.light.intensity=this.lightIntensity*n),this.flame&&this.flame.color.copy(this.flameColor).multiplyScalar(.8+.4*n),this.halo&&this.halo.setOpacity(this.haloOpacity*n)}faceCamera(e){this.halo?.faceCamera(e)}};function _e(e){let t=document.createElement(`canvas`);t.width=t.height=128;let n=t.getContext(`2d`),r=`#${e.getHexString()}`,i=n.createRadialGradient(64,64,2,64,64,64);i.addColorStop(0,`${r}ff`),i.addColorStop(.25,`${r}aa`),i.addColorStop(1,`${r}00`),n.fillStyle=i,n.fillRect(0,0,128,128);let a=new c.CanvasTexture(t);return a.colorSpace=c.SRGBColorSpace,a}var ve=class extends c.Object3D{mesh;texture;baseColor;constructor({color:e=16755268,size:t=1.2,opacity:n=.75}={}){super(),this.baseColor=new c.Color(e),this.texture=_e(this.baseColor);let r=new c.MeshBasicMaterial({map:this.texture,color:this.baseColor,transparent:!0,opacity:n,blending:c.AdditiveBlending,depthWrite:!1,toneMapped:!1});this.mesh=new c.Mesh(new c.PlaneGeometry(t,t),r),this.add(this.mesh)}faceCamera(e){this.mesh.lookAt(e)}setOpacity(e){this.mesh.material.opacity=e}get opacity(){return this.mesh.material.opacity}setColor(e){this.baseColor.set(e),this.mesh.material.color.copy(this.baseColor),this.texture.dispose(),this.texture=_e(this.baseColor),this.mesh.material.map=this.texture}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.texture.dispose()}},ye=class extends c.Object3D{patches=[];area;heightAt;texture;elapsed=0;constructor({count:e=14,area:t=16,perimeterCount:n=0,plotHalf:r=12,terrainHalf:i=16,cameraFacing:a={x:1,z:1},color:o=`#9fb0c8`,heightAt:s=()=>0}={}){super(),this.area=t,this.heightAt=s,this.texture=be(o);let c=xe(a);for(let t=0;t<e;t++)this.patches.push(this.makeInteriorPatch());for(let e=0;e<n;e++)this.patches.push(this.makePerimeterPatch(r,i,c))}update(e){this.elapsed+=e;for(let t of this.patches){let n=t.mesh;n.position.x+=t.driftX*e,n.position.z+=t.driftZ*e,n.rotation.z+=t.spin*e,t.perimeter?(we(n,t.perimeter.edge,t.perimeter.plotHalf,t.perimeter.terrainHalf),n.position.y=this.heightAt(n.position.x,n.position.z)+.15+.35*(.5+.5*Math.sin(this.elapsed*.22+t.phase))):(n.position.x>this.area&&(n.position.x-=this.area*2),n.position.x<-this.area&&(n.position.x+=this.area*2),n.position.z>this.area&&(n.position.z-=this.area*2),n.position.z<-this.area&&(n.position.z+=this.area*2)),n.material.opacity=t.baseOpacity*(.6+.4*Math.sin(this.elapsed*.3+t.phase))}}dispose(){this.texture.dispose();for(let e of this.patches)e.mesh.geometry.dispose(),e.mesh.material.dispose();this.patches.length=0,this.clear()}makeInteriorPatch(){let e=F(8,16),t=F(.05,.16),n=F(-this.area,this.area),r=F(-this.area,this.area),i=this.makeMesh(e,t);return i.position.set(n,this.heightAt(n,r)+F(.3,1.2),r),this.add(i),{mesh:i,driftX:F(-.15,.15),driftZ:F(-.15,.15),spin:F(-.03,.03),baseOpacity:t,phase:F(0,Math.PI*2)}}makePerimeterPatch(e,t,n){let r=Se(n),{x:i,z:a,driftX:o,driftZ:s}=Ce(r,e,t),c=F(18,30),l=F(.1,.26),u=this.makeMesh(c,l);return u.position.set(i,this.heightAt(i,a)+F(.15,.55),a),this.add(u),{mesh:u,driftX:o,driftZ:s,spin:F(-.012,.012),baseOpacity:l,phase:F(0,Math.PI*2),perimeter:{edge:r,plotHalf:e,terrainHalf:t}}}makeMesh(e,t){let n=new c.Mesh(new c.PlaneGeometry(e,e),new c.MeshBasicMaterial({map:this.texture,transparent:!0,depthWrite:!1,opacity:t,toneMapped:!1}));return n.rotation.x=-Math.PI/2,n.rotation.z=F(0,Math.PI*2),n}};function be(e){let t=`#${new c.Color(e).getHexString()}`,n=document.createElement(`canvas`);n.width=n.height=256;let r=n.getContext(`2d`),i=r.createRadialGradient(128,128,8,128,128,128);i.addColorStop(0,`${t}dd`),i.addColorStop(.45,`${t}66`),i.addColorStop(1,`${t}00`),r.fillStyle=i,r.fillRect(0,0,256,256);let a=new c.CanvasTexture(n);return a.colorSpace=c.SRGBColorSpace,a}function xe(e){let t=[];return e.z>0&&t.push(`n`),e.z<0&&t.push(`s`),e.x>0&&t.push(`w`),e.x<0&&t.push(`e`),t.length?t:[`n`,`w`]}function Se(e){if(e.length===1)return e[0];let t=Math.random(),n=e.includes(`n`),r=e.includes(`w`);return n&&r?t<.58?`n`:`w`:e[Math.floor(Math.random()*e.length)]}function Ce(e,t,n){let r=F(.6,n-t-1.5),i=F(-n+3,n-3),a=F(.03,.09)*(Math.random()<.5?-1:1),o=F(.01,.04);switch(e){case`n`:return{x:i,z:-t-r,driftX:a,driftZ:-o};case`s`:return{x:i,z:t+r,driftX:-a,driftZ:o};case`e`:return{x:t+r,z:i,driftX:o,driftZ:-a};case`w`:return{x:-t-r,z:i,driftX:-o,driftZ:a}}}function we(e,t,n,r){let i=r-1,{x:a,z:o}=e.position;switch(t){case`n`:e.position.z=I(o,-i,-n+.8),a<-i+3&&(e.position.x=i-3),a>i-3&&(e.position.x=-i+3);break;case`s`:e.position.z=I(o,n-.8,i),a<-i+3&&(e.position.x=i-3),a>i-3&&(e.position.x=-i+3);break;case`e`:e.position.x=I(a,n-.8,i),o<-i+3&&(e.position.z=i-3),o>i-3&&(e.position.z=-i+3);break;case`w`:e.position.x=I(a,-i,-n+.8),o<-i+3&&(e.position.z=i-3),o>i-3&&(e.position.z=-i+3);break}}function I(e,t,n){return Math.max(t,Math.min(n,e))}var Te=class{level=0;light;peak;minGap;maxGap;spikes=[];clock=0;nextStrike;constructor({light:e,peak:t=12,minGap:n=3,maxGap:r=9}){this.light=e,this.peak=t,this.minGap=n,this.maxGap=r,this.nextStrike=F(n*.3,r)}update(e){this.clock+=e,this.clock>=this.nextStrike&&this.strike();let t=0;for(let e=this.spikes.length-1;e>=0;e--){let n=this.spikes[e],r=this.clock-n.at;if(r<0)continue;let i=n.amp*Math.exp(-r*9);i<.002&&r>0?this.spikes.splice(e,1):t+=i}this.level=Math.min(1.2,t),this.light.intensity=this.level*this.peak}quiet(){this.level=0,this.light.intensity=0}strike(){let e=Math.random()<.5?2:3;for(let t=0;t<e;t++)this.spikes.push({at:this.clock+t*F(.04,.12),amp:F(.5,1)});this.nextStrike=this.clock+F(this.minGap,this.maxGap)}},Ee=class extends c.BufferGeometry{constructor(e=.1){super();let t=[],n=[],r=[[0,1],[.5,.75],[.75,.25],[.5,-.5],[0,-1],[-.5,-.5],[-.75,.25],[-.5,.75]];for(let n=0;n<r.length;n++){let[i,a]=r[n];t.push(i*e,a*e,0)}for(let e=1;e<r.length-1;e++)n.push(0,e,e+1);n.push(0,r.length-1,1);let i=new c.Float32BufferAttribute(t,3);this.setAttribute(`position`,i),this.setIndex(n),this.computeVertexNormals()}},De=class extends c.InstancedMesh{width;height;depth;floorY;flutter;px;py;pz;fallSpeed;driftX;driftZ;rotX;rotY;rotZ;phase;dummy=new c.Object3D;clock=0;constructor(e={}){let{count:t=120,width:n=16,height:r=8,depth:i=16,floorY:a=0,fallSpeedMin:o=.12,fallSpeedMax:s=.28,driftMin:l=.04,driftMax:u=.14,flutter:d=.35,color:f=[16766704,16774650,15775952],geometry:p=new Ee,material:m}=e,h=(Array.isArray(f)?f:[f]).map(e=>new c.Color(e)),g=m??new c.MeshStandardMaterial({color:h.length===1?h[0].getHex():16777215,metalness:.05,roughness:.85,flatShading:!0,side:c.DoubleSide});super(p,g,t),this.instanceMatrix.setUsage(c.DynamicDrawUsage),this.frustumCulled=!1,this.width=n,this.height=r,this.depth=i,this.floorY=a,this.flutter=d,this.px=new Float32Array(t),this.py=new Float32Array(t),this.pz=new Float32Array(t),this.fallSpeed=new Float32Array(t),this.driftX=new Float32Array(t),this.driftZ=new Float32Array(t),this.rotX=new Float32Array(t),this.rotY=new Float32Array(t),this.rotZ=new Float32Array(t),this.phase=new Float32Array(t);for(let e=0;e<t;e++){this.respawn(e,!0),this.fallSpeed[e]=F(o,s);let t=F(l,u),n=F(0,Math.PI*2);this.driftX[e]=Math.cos(n)*t,this.driftZ[e]=Math.sin(n)*t,this.phase[e]=F(0,Math.PI*2),h.length>1&&this.setColorAt(e,h[Math.floor(Math.random()*h.length)])}this.instanceColor&&(this.instanceColor.needsUpdate=!0),this.writeMatrices()}update(e){this.clock+=e;for(let t=0;t<this.count;t++){let n=Math.sin(this.clock*1.6+this.phase[t])*this.flutter*.12;this.px[t]+=(this.driftX[t]+n)*e,this.py[t]-=this.fallSpeed[t]*e,this.pz[t]+=(this.driftZ[t]+Math.cos(this.clock*1.3+this.phase[t])*this.flutter*.08)*e,this.py[t]<this.floorY&&this.respawn(t,!1)}this.writeMatrices()}dispose(){this.geometry.dispose();let e=Array.isArray(this.material)?this.material:[this.material];for(let t of e)t.dispose();return this}respawn(e,t){this.px[e]=F(-this.width*.5,this.width*.5),this.pz[e]=F(-this.depth*.5,this.depth*.5),this.py[e]=t?this.floorY+F(0,this.height*1.25):this.floorY+this.height+F(0,this.height*.25),this.rotX[e]=F(-.6,.6),this.rotY[e]=F(-Math.PI,Math.PI),this.rotZ[e]=F(-.8,.8)}writeMatrices(){let e=this.dummy;for(let t=0;t<this.count;t++){let n=Math.sin(this.clock*2.1+this.phase[t])*this.flutter,r=Math.cos(this.clock*1.7+this.phase[t])*this.flutter*.6;e.position.set(this.px[t],this.py[t],this.pz[t]),e.rotation.set(this.rotX[t]+n,this.rotY[t],this.rotZ[t]+r),e.updateMatrix(),this.setMatrixAt(t,e.matrix)}this.instanceMatrix.needsUpdate=!0}};function Oe(){let e=document.createElement(`canvas`);e.width=8,e.height=64;let t=e.getContext(`2d`),n=t.createLinearGradient(0,0,0,64);n.addColorStop(0,`rgba(255,255,255,0)`),n.addColorStop(.42,`rgba(255,255,255,0.55)`),n.addColorStop(.58,`rgba(255,255,255,0.55)`),n.addColorStop(1,`rgba(255,255,255,0)`),t.fillStyle=n,t.fillRect(0,0,8,64);let r=new c.CanvasTexture(e);return r.colorSpace=c.SRGBColorSpace,r}var ke=class extends c.InstancedMesh{intensity;maxCount;area;height;groundY;baseOpacity;windDirection;windStrength;fallDirection=new c.Vector3(0,-1,0);streakOrientation=new c.Quaternion;sx;sz;topY;len;speed;streakTexture;dummy=new c.Object3D;clock=0;constructor(e={}){let{count:t=1400,area:n=26,height:r=22,groundY:i=0,width:a=.009,color:o=`#aebfd6`,opacity:s=.16,lengthMin:l=.18,lengthMax:u=.42,speedMin:d=11,speedMax:f=19,windDirection:p=0,windStrength:m=0,intensity:h=.5,geometry:g=new c.PlaneGeometry(a,1),material:_}=e,v=_?void 0:Oe(),y=_??new c.MeshBasicMaterial({color:new c.Color(o),map:v,transparent:!0,opacity:s,depthWrite:!1,toneMapped:!1,fog:!0,side:c.DoubleSide});super(g,y,t),this.instanceMatrix.setUsage(c.DynamicDrawUsage),this.frustumCulled=!1,this.maxCount=t,this.area=n,this.height=r,this.groundY=i,this.baseOpacity=s,this.windDirection=p,this.windStrength=Math.max(0,m),this.updateFallDirection(0),this.intensity=h,this.streakTexture=v,this.sx=new Float32Array(t),this.sz=new Float32Array(t),this.topY=new Float32Array(t),this.len=new Float32Array(t),this.speed=new Float32Array(t);for(let e=0;e<t;e++)this.sx[e]=F(-n,n),this.sz[e]=F(-n,n),this.topY[e]=F(i,i+r),this.len[e]=F(l,u),this.speed[e]=F(d,f);this.writeMatrices(),this.applyIntensity()}update(e){this.clock+=e;let t=this.windStrength>0?Math.sin(this.clock*.18)*.04*this.windStrength:0;this.updateFallDirection(t);let n=.85+this.intensity*.7,r=this.groundY+this.height,i=this.fallDirection.x,a=this.fallDirection.z,o=-this.fallDirection.y;for(let t=0;t<this.maxCount;t++){let s=this.speed[t]*n*e;this.sx[t]+=i*s,this.sz[t]+=a*s,this.topY[t]-=o*s,this.topY[t]<this.groundY-this.len[t]&&(this.topY[t]+=this.height),this.topY[t]>r&&(this.topY[t]-=this.height),this.sx[t]<-this.area?this.sx[t]+=this.area*2:this.sx[t]>this.area&&(this.sx[t]-=this.area*2),this.sz[t]<-this.area?this.sz[t]+=this.area*2:this.sz[t]>this.area&&(this.sz[t]-=this.area*2)}this.writeMatrices(),this.applyIntensity()}dispose(){this.geometry.dispose();let e=Array.isArray(this.material)?this.material:[this.material];for(let t of e)t.dispose();return this.streakTexture?.dispose(),this}applyIntensity(){this.count=Math.round(this.maxCount*Math.min(1,Math.max(0,.38+this.intensity*.62)));let e=this.material;e.opacity=this.baseOpacity*(.55+.65*this.intensity)}updateFallDirection(e){let t=this.windStrength+e;if(t<=0){this.fallDirection.set(0,-1,0),this.streakOrientation.identity();return}let n=t,r=1/Math.hypot(n,1);this.fallDirection.set(Math.cos(this.windDirection)*n*r,-1*r,Math.sin(this.windDirection)*n*r),this.streakOrientation.setFromUnitVectors(new c.Vector3(0,1,0),this.fallDirection)}writeMatrices(){let e=this.dummy;for(let t=0;t<this.maxCount;t++){let n=this.len[t];e.position.set(this.sx[t],this.topY[t]-n/2,this.sz[t]),e.quaternion.copy(this.streakOrientation),e.scale.set(1,n,1),e.updateMatrix(),this.setMatrixAt(t,e.matrix)}this.instanceMatrix.needsUpdate=!0}},Ae=class extends c.Shape{constructor(e=5,t=.5,n=1){super();let r=Math.PI*2/e,i=r/2,a=r/4;this.moveTo(Math.cos(0)*n,-Math.sin(0)*n);for(let o=1;o<=e;++o){let e=Math.cos(r*o-a*3)*(t/Math.cos(a)),s=-Math.sin(r*o-a*3)*(t/Math.cos(a)),c=Math.cos(r*o-i)*t,l=-Math.sin(r*o-i)*t;this.quadraticCurveTo(e,s,c,l),e=Math.cos(r*o-a)*(t/Math.cos(a)),s=-Math.sin(r*o-a)*(t/Math.cos(a)),c=Math.cos(r*o)*n,l=-Math.sin(r*o)*n,this.quadraticCurveTo(e,s,c,l)}this.closePath()}},je=class extends c.ExtrudeGeometry{constructor({sides:e=5,innerRadius:t=.5,outerRadius:n=1,depth:r=.25}={}){super(new Ae(e,t,n),{depth:r,bevelEnabled:!1})}},Me=new c.Vector3(0,0,0);function Ne(e,t,n,r=128){let i=document.createElement(`canvas`);i.width=r,i.height=r;let a=i.getContext(`2d`),o=r*.46,s=t/n*o;a.translate(r/2,r/2),a.fillStyle=`#ffffff`,a.beginPath();for(let t=0;t<e*2;t++){let n=t%2==0?o:s,r=t/(e*2)*Math.PI*2-Math.PI/2,i=Math.cos(r)*n,c=Math.sin(r)*n;t===0?a.moveTo(i,c):a.lineTo(i,c)}a.closePath(),a.fill();let l=new c.CanvasTexture(i);return l.needsUpdate=!0,l}function Pe(e){let t=Math.random(),n=Math.random(),r=Math.PI*2*t,i=Math.acos(2*n-1),a=Math.sin(i);return e.set(a*Math.cos(r),Math.cos(i),a*Math.sin(r))}function Fe(e){return(Array.isArray(e)?e:[e]).map(e=>new c.Color(e))}var Ie=class extends c.Object3D{style;field;twinkle;baseSize;baseScales;twinklePhases;baseColors;spriteTexture;dummy=new c.Object3D;constructor(e={}){super(),this.style=e.style??`points`;let{count:t=1500,radius:n=500,minRadius:r=n,maxRadius:i=n,sizeMin:a=.008,sizeMax:o=.025,color:s=[16777215,13293567,16774368],twinkle:c=!1,material:l,burst:u={},geometry:d}=e;this.frustumCulled=!1,this.twinkle=c;let f=r+Math.max(i-r,0)*.5,p=(a+o)*.5;this.baseSize=f*p;let m={sides:u.sides??4,innerRadius:u.innerRadius??.6,outerRadius:u.outerRadius??1.9,depth:u.depth??.05};if(c&&(this.twinklePhases=new Float32Array(t)),this.style===`burst`){c&&(this.baseScales=new Float32Array(t));let e=d??new je({sides:m.sides,innerRadius:m.innerRadius,outerRadius:m.outerRadius,depth:m.depth});this.field=this.createBurstField({count:t,minRadius:r,maxRadius:i,sizeMin:a,sizeMax:o,color:s,material:l,geometry:e})}else this.field=this.createPointsField({count:t,minRadius:r,maxRadius:i,sizeMin:a,sizeMax:o,color:s,material:l,burstShape:m});this.add(this.field)}get drawable(){return this.field}get geometry(){return this.field.geometry}get material(){return this.field.material}dispose(){this.geometry.dispose();let e=Array.isArray(this.material)?this.material:[this.material];for(let t of e)t.dispose();this.spriteTexture?.dispose()}update(e=performance.now()*.001){if(!this.twinkle)return;if(this.field instanceof c.Points){if(this.twinklePhases&&this.baseColors){let t=this.field.geometry.getAttribute(`color`),n=t.array,r=this.baseColors;for(let t=0;t<this.twinklePhases.length;t++){let i=.65+.35*Math.sin(e*2.5+this.twinklePhases[t]);n[t*3]=r[t*3]*i,n[t*3+1]=r[t*3+1]*i,n[t*3+2]=r[t*3+2]*i}t.needsUpdate=!0}else this.field.material.size=this.baseSize*(.8+.2*Math.sin(e*2.5));return}if(!this.baseScales||!this.twinklePhases)return;let t=new c.Matrix4,n=new c.Vector3,r=new c.Quaternion,i=new c.Vector3;for(let a=0;a<this.field.count;a++){this.field.getMatrixAt(a,t),t.decompose(n,r,i);let o=.75+.25*Math.sin(e*2.5+this.twinklePhases[a]),s=this.baseScales[a]*o;this.dummy.position.copy(n),this.dummy.quaternion.copy(r),this.dummy.scale.setScalar(s),this.dummy.updateMatrix(),this.field.setMatrixAt(a,this.dummy.matrix)}this.field.instanceMatrix.needsUpdate=!0}createPointsField({count:e,minRadius:t,maxRadius:n,sizeMin:r,sizeMax:i,color:a,material:o,burstShape:s}){let l=Fe(a),u=new c.Vector3,d=Math.max(n-t,0),f=(t+d*.5)*((r+i)/2),p=new Float32Array(e*3),m=l.length>1||this.twinkle?new Float32Array(e*3):null;for(let n=0;n<e;n++){let e=t+Math.random()*d;if(Pe(u).multiplyScalar(e),p[n*3]=u.x,p[n*3+1]=u.y,p[n*3+2]=u.z,m){let e=l[Math.floor(Math.random()*l.length)];m[n*3]=e.r,m[n*3+1]=e.g,m[n*3+2]=e.b}this.twinklePhases&&(this.twinklePhases[n]=Math.random()*Math.PI*2)}let h=new c.BufferGeometry;if(h.setAttribute(`position`,new c.BufferAttribute(p,3)),m){let e=new c.BufferAttribute(m,3);this.twinkle&&(this.baseColors=m.slice(),e.setUsage(c.DynamicDrawUsage)),h.setAttribute(`color`,e)}this.spriteTexture=Ne(s.sides,s.innerRadius,s.outerRadius);let g=new c.Points(h,o??new c.PointsMaterial({map:this.spriteTexture,color:m?16777215:l[0].getHex(),size:f,sizeAttenuation:!0,transparent:!0,alphaTest:.05,vertexColors:m!==null,depthWrite:!1,toneMapped:!1}));return g.frustumCulled=!1,g.renderOrder=1,g}createBurstField({count:e,minRadius:t,maxRadius:n,sizeMin:r,sizeMax:i,color:a,material:o,geometry:s}){let l=Fe(a),u=new c.Vector3,d=Math.max(n-t,0),f=s.clone();f.center(),f.computeBoundingSphere();let p=f.boundingSphere?.radius??1,m=new c.InstancedMesh(f,o??new c.MeshBasicMaterial({color:l.length===1?l[0].getHex():16777215,side:c.DoubleSide,depthWrite:!1,toneMapped:!1}),e);m.frustumCulled=!1,m.renderOrder=1;for(let n=0;n<e;n++){let e=t+Math.random()*d;Pe(u).multiplyScalar(e);let a=e*(r+Math.random()*(i-r))/p;this.baseScales&&(this.baseScales[n]=a),this.twinklePhases&&(this.twinklePhases[n]=Math.random()*Math.PI*2),this.dummy.position.copy(u),this.dummy.lookAt(Me),this.dummy.rotateZ(Math.random()*Math.PI*2),this.dummy.scale.setScalar(a),this.dummy.updateMatrix(),m.setMatrixAt(n,this.dummy.matrix),l.length>1&&m.setColorAt(n,l[Math.floor(Math.random()*l.length)])}return m.instanceMatrix.needsUpdate=!0,m.instanceColor&&(m.instanceColor.needsUpdate=!0),m}},Le=class extends c.Object3D{wisps=[];orbGeometry;orbMaterial;halfWidth;depth;heightMin;heightMax;driftX;driftY;driftZ;speedMin;speedMax;castLight;lightDistance;lightDecay;lightIntensity;lightPulseAmplitude;lightPulseSpeed;elapsed=0;constructor({count:e=3,width:t=16,depth:n=8,heightMin:r=1,heightMax:i=2,color:a=7208880,orbRadius:o=.08,driftX:s=1.6,driftY:l=.3,driftZ:u=1.6,speedMin:d=.3,speedMax:f=.7,castLight:p=!0,lightDistance:m=6,lightDecay:h=2,lightIntensity:g=2.5,lightPulseAmplitude:_=1.2,lightPulseSpeed:v=3}={}){super(),this.halfWidth=t/2,this.depth=n,this.heightMin=r,this.heightMax=i,this.driftX=s,this.driftY=l,this.driftZ=u,this.speedMin=d,this.speedMax=f,this.castLight=p,this.lightDistance=m,this.lightDecay=h,this.lightIntensity=g,this.lightPulseAmplitude=_,this.lightPulseSpeed=v,this.orbGeometry=new c.SphereGeometry(o,8,8),this.orbMaterial=new c.MeshBasicMaterial({color:new c.Color(a),toneMapped:!1});for(let t=0;t<e;t++){let e=new c.Vector3(F(-this.halfWidth,this.halfWidth),F(this.heightMin,this.heightMax),F(0,this.depth)),t=new c.Mesh(this.orbGeometry,this.orbMaterial);t.position.copy(e),this.add(t);let n;p&&(n=new c.PointLight(a,3,this.lightDistance,this.lightDecay),t.add(n)),this.wisps.push({orb:t,home:e,phase:F(0,Math.PI*2),speed:F(this.speedMin,this.speedMax),light:n})}}update(e){this.elapsed+=e;for(let e of this.wisps){let t=this.elapsed*e.speed+e.phase;e.orb.position.set(e.home.x+Math.sin(t)*this.driftX,e.home.y+Math.sin(t*1.7)*this.driftY,e.home.z+Math.cos(t*.8)*this.driftZ),e.light&&(e.light.intensity=this.lightIntensity+Math.sin(t*this.lightPulseSpeed)*this.lightPulseAmplitude)}}dispose(){this.orbGeometry.dispose(),this.orbMaterial.dispose();for(let e of this.wisps)e.light?.dispose();this.clear(),this.wisps.length=0}},L=class extends c.BufferGeometry{width;height;depth;coverThickness;pageIndent;constructor({width:e=1,height:t=1.5,depth:n=.5,coverThickness:r=.05,pageIndent:i=.05}={}){super(),this.width=e,this.height=t,this.depth=n,this.coverThickness=r,this.pageIndent=i;let a=e,o=t,s=n,u=r,d=i,f=[0,0,0,a,0,0,a,o,0,0,o,0,a,0,-s,0,0,-s,0,o,-s,a,o,-s,0,0,-s,0,0,0,0,o,0,0,o,-s,a,0,-u,u,0,-u,u,o,-u,a,o,-u,u,0,-s+u,a,0,-s+u,a,o,-s+u,u,o,-s+u,u,0,-u,u,0,-s+u,u,o,-s+u,u,o,-u,0,o,0,a,o,0,a,o,-u,u,o,-u,0,o,-s,u,o,-s+u,a,o,-s+u,a,o,-s,0,o,0,u,o,-u,u,o,-s+u,0,o,-s,0,0,0,u,0,-u,a,0,-u,a,0,0,0,0,-s,a,0,-s,a,0,-s+u,u,0,-s+u,0,0,0,0,0,-s,u,0,-s+u,u,0,-u,a,0,0,a,0,-u,a,o,-u,a,o,0,a,0,-s,a,o,-s,a,o,-s+u,a,0,-s+u],p=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0],m=e/(e*2+n),h=(e+n)/(e*2+n),g=[h,0,1,0,1,1,h,1,0,0,m,0,m,1,0,1,m,0,h,0,h,1,m,1,1,0,h,0,h,1,1,1,m,0,0,0,0,1,m,1,h,0,m,0,m,1,h,1,h,0,1,0,1,1,h,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1],_=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23,24,25,26,24,26,27,28,29,30,28,30,31,32,33,34,32,34,35,36,37,38,36,38,39,40,41,42,40,42,43,44,45,46,44,46,47,48,49,50,48,50,51,52,53,54,52,54,55],v=new Float32Array(f),y=new Float32Array(p),b=new Float32Array(g),x=new Uint16Array(_),S=new c.BufferGeometry;S.setAttribute(`position`,new c.BufferAttribute(v,3)),S.setAttribute(`normal`,new c.BufferAttribute(y,3)),S.setAttribute(`uv`,new c.BufferAttribute(b,2)),S.setIndex(new c.BufferAttribute(x,1));let C=new c.BoxGeometry(e-u-d,o-d*2,s-u*2);C.translate((e-u-d)/2+u,o/2,-s/2),this.copy((0,l.mergeGeometries)([S,C],!0))}},Re=.5,ze=Math.PI/2;function Be({scaleXMin:e=.4,scaleXMax:t=.7,scaleYMin:n=.3,scaleYMax:r=.95,scaleZMin:i=.1,scaleZMax:a=.5,source:o}){return new c.Vector3(F(e,t,o),de(.25,n,r,o),fe(.8,i,a,o))}function Ve({coverMaterial:e,pagesMaterial:t,scales:n,source:r}){let i=new c.InstancedMesh(new L,[e,t],n.length),a=new c.Matrix4,o=0;for(let e=0;e<n.length;e++){let t=n[e],s=new c.Matrix4;s.makeScale(t.x,t.y,t.z),a.identity(),a.multiply(s),a.setPosition(.01+r.float(0,.1),0,o+t.z*.5),i.setMatrixAt(e,a),o+=t.z*.5}return i}function He({coverMaterial:e,pagesMaterial:t,count:n=10,scaleXMin:r=.4,scaleXMax:i=.7,scaleYMin:a=.3,scaleYMax:o=.95,scaleZMin:s=.1,scaleZMax:c=.5,seed:l}){let u=N(l);return Ve({coverMaterial:e,pagesMaterial:t,scales:Array.from({length:n},()=>Be({scaleXMin:r,scaleXMax:i,scaleYMin:a,scaleYMax:o,scaleZMin:s,scaleZMax:c,source:u})),source:u})}function Ue({coverMaterial:e,pagesMaterial:t,length:n=10,scaleXMin:r=.4,scaleXMax:i=.7,scaleYMin:a=.3,scaleYMax:o=.95,scaleZMin:s=.1,scaleZMax:c=.5,seed:l}){let u=N(l),d=[],f=n;for(;f>0;){let e=Be({scaleXMin:r,scaleXMax:i,scaleYMin:a,scaleYMax:o,scaleZMin:s,scaleZMax:c,source:u});e.z=Math.min(e.z,f),d.push(e),f-=e.z}return Ve({coverMaterial:e,pagesMaterial:t,scales:d,source:u})}function We({coverMaterial:e,pagesMaterial:t,count:n=6,scaleXMin:r=.4,scaleXMax:i=.7,scaleYMin:a=.3,scaleYMax:o=.95,scaleZMin:s=.1,scaleZMax:l=.5,yawMax:u=.55,offsetMax:d=.06,seed:f}){let p=N(f),m=new L,h=new c.InstancedMesh(m,[e,t],n),g=new c.Matrix4,_=new c.Vector3,v=new c.Quaternion,y=new c.Quaternion().setFromAxisAngle(new c.Vector3(1,0,0),ze),b=new c.Quaternion,x=new c.Vector3,S=new c.Vector3(m.width*.5,m.height*.5,-m.depth*.5),C=new c.Vector3,w=new c.Vector3,T=0;for(let e=0;e<n;e++){let t=Be({scaleXMin:r,scaleXMax:i,scaleYMin:a,scaleYMax:o,scaleZMin:s,scaleZMax:l,source:p});x.copy(t);let n=Re*t.z;b.setFromAxisAngle(new c.Vector3(0,1,0),p.float(-u,u)),v.copy(y).premultiply(b),C.copy(S).multiply(x),w.copy(C).applyQuaternion(v),_.set(p.float(-d,d),T+n*.5,p.float(-d,d)),_.sub(w),g.compose(_,v,x),h.setMatrixAt(e,g),T+=n}return h.instanceMatrix.needsUpdate=!0,h}function R(e,t,n){let r=Math.imul(e|0,374761393)^Math.imul(t|0,668265263)^Math.imul(n|0,362437);return r=Math.imul(r^r>>>13,1274126177),r^=r>>>16,(r>>>0)/4294967296}function z(e,t,n,r){let i=Math.imul(e|0,374761393)^Math.imul(t|0,668265263)^Math.imul(n|0,1274126177)^Math.imul(r|0,362437);return i=Math.imul(i^i>>>13,1274126177),i^=i>>>16,(i>>>0)/4294967296}var B=e=>e*e*(3-2*e);function Ge(e,t,n){let r=Math.floor(e),i=Math.floor(t),a=B(e-r),o=B(t-i),s=R(r,i,n),c=R(r+1,i,n),l=R(r,i+1,n),u=R(r+1,i+1,n),d=s+(c-s)*a;return d+(l+(u-l)*a-d)*o}function Ke(e,t,n,r){let i=Math.floor(e),a=Math.floor(t),o=Math.floor(n),s=B(e-i),c=B(t-a),l=B(n-o),u=z(i,a,o,r),d=z(i+1,a,o,r),f=z(i,a+1,o,r),p=z(i+1,a+1,o,r),m=z(i,a,o+1,r),h=z(i+1,a,o+1,r),g=z(i,a+1,o+1,r),_=z(i+1,a+1,o+1,r),v=u+(d-u)*s,y=f+(p-f)*s,b=m+(h-m)*s,x=g+(_-g)*s,S=v+(y-v)*c;return S+(b+(x-b)*c-S)*l}function qe(e,t,n,r,i){let a=0,o=1,s=1,c=0;for(let l=0;l<r;l++)a+=(Ge(e*s,t*s,n+l*101)*2-1)*o,c+=o,o*=i,s*=2;return c>0?a/c:0}function Je(e,t,n,r,i,a){let o=0,s=1,c=1,l=0;for(let u=0;u<i;u++)o+=(Ke(e*c,t*c,n*c,r+u*101)*2-1)*s,l+=s,s*=a,c*=2;return l>0?o/l:0}var Ye=class extends c.BufferGeometry{radius;constructor({radius:e=1,detail:t=2,noiseHeight:n=.35,noiseScale:r=1.6,octaves:i=3,persistence:a=.5,seed:o=1}={}){super(),this.radius=e;let s=new c.IcosahedronGeometry(e,t);s.deleteAttribute(`uv`),s.deleteAttribute(`normal`);let u=(0,l.mergeVertices)(s);s.dispose();let d=u.getAttribute(`position`),f=new c.Vector3,p=r/e;for(let e=0;e<d.count;e++){f.fromBufferAttribute(d,e);let t=Je(f.x*p,f.y*p,f.z*p,o,i,a),r=f.length()||1,s=(r+t*n)/r;d.setXYZ(e,f.x*s,f.y*s,f.z*s)}d.needsUpdate=!0,u.computeVertexNormals(),u.center(),this.copy(u),u.dispose()}};function Xe({count:e=8,width:t=6,depth:n=6,heightJitter:r=0,scaleMin:i=.8,scaleMax:a=1.2,seed:o,radius:s=1,detail:l=2,noiseHeight:u=.35,noiseScale:d=1.6,octaves:f=3,persistence:p=.5,variants:m=4,material:h,color:g=`#6f6f6f`}={}){let _=N(o),v=Math.max(1,Math.min(Math.round(m),Math.max(1,e))),y=h??new c.MeshStandardMaterial({color:new c.Color(g),roughness:1,metalness:0,flatShading:!0}),b=[];for(let e=0;e<v;e++)b.push(new Ye({radius:s,detail:l,noiseHeight:u,noiseScale:d,octaves:f,persistence:p,seed:_.int(0,1e6)}));let x=Array(v).fill(0);for(let t=0;t<e;t++)x[t%v]++;let S=b.map((e,t)=>new c.InstancedMesh(e,y,x[t])),C=Array(v).fill(0),w=new c.Matrix4,T=new c.Vector3,E=new c.Quaternion,D=new c.Vector3,O=new c.Euler;for(let o=0;o<e;o++){let e=_.float(i,a);D.set(e,e,e),O.set(_.float(0,Math.PI*2),_.float(0,Math.PI*2),_.float(0,Math.PI*2)),E.setFromEuler(O),T.set(_.float(-t/2,t/2),_.float(0,r),_.float(-n/2,n/2)),w.compose(T,E,D);let s=o%v;S[s].setMatrixAt(C[s]++,w)}let k=new c.Group;for(let e of S)e.instanceMatrix.needsUpdate=!0,e.castShadow=!0,e.receiveShadow=!0,k.add(e);return k}var Ze=class extends c.Shape{constructor(e=1){super();for(let t=0;t<6;t++){let n=Math.PI/3*t,r=Math.cos(n)*e,i=Math.sin(n)*e;t===0?this.moveTo(r,i):this.lineTo(r,i)}this.closePath()}},V=class extends c.ExtrudeGeometry{radius;depth;constructor({radius:e=1,depth:t=.01}={}){super(new Ze(e),{depth:t,bevelEnabled:!1}),this.radius=e,this.depth=t}};function Qe(e){let{width:t,depth:n,height:r,count:i,gap:a,material:o}=e,s=o||new c.MeshStandardMaterial({color:16777215}),l=t/i,u=(l-a)*2/3,d=Math.sqrt(3)*u+a,f=Math.floor(n/d),p=i*f,m=new V({radius:u,depth:r});m.rotateX(-Math.PI/2);let h=new c.InstancedMesh(m,s,p),g=new c.Object3D,_=0;for(let e=0;e<i;e++)for(let t=0;t<f;t++){let n=e*l,r=t*d+e%2*(d/2),a=n-i*l/2+l/2,o=r-f*d/2+d/2;g.position.set(a,0,o),g.updateMatrix(),h.setMatrixAt(_++,g.matrix)}return h.instanceMatrix.needsUpdate=!0,h}function $e(e){let{width:t,depth:n,height:r,radius:i,gap:a,material:o}=e,s=o||new c.MeshStandardMaterial({color:16777215}),l=i*3/2+a,u=Math.sqrt(3)*i+a,d=Math.floor(t/l),f=Math.floor(n/u),p=d*f,m=new V({radius:i,depth:r});m.rotateX(-Math.PI/2);let h=new c.InstancedMesh(m,s,p),g=new c.Object3D,_=0;for(let e=0;e<d;e++)for(let t=0;t<f;t++){let n=e*l,r=t*u+e%2*(u/2),i=n-d*l/2+l/2,a=r-f*u/2+u/2;g.position.set(i,0,a),g.updateMatrix(),h.setMatrixAt(_++,g.matrix)}return h.instanceMatrix.needsUpdate=!0,h}var et=class extends c.BufferGeometry{radius;detail;constructor({radius:e=1,detail:t=0,mossScaleXZ:n=.9,mossScaleY:r=.5,mossOffsetY:i=.3}={}){super(),this.radius=e,this.detail=t;let a=new c.DodecahedronGeometry(e,t),o=new c.DodecahedronGeometry(e,t);o.scale(n,r,n),o.translate(0,i,0),this.copy((0,l.mergeGeometries)([a,o],!0)),this.computeVertexNormals()}};function tt(e,t=A.XYZ,n=.5,r=2){e.deleteAttribute(`uv`),e.deleteAttribute(`normal`),e=(0,l.mergeVertices)(e),e.computeVertexNormals();let i=e.getAttribute(`position`);for(let e=0;e<i.count;e++){let a=new c.Vector3().fromBufferAttribute(i,e),o=Math.random()*(r-n)+n,s=t.clone().multiplyScalar(o);a.add(s),i.setXYZ(e,a.x,a.y,a.z)}return i.needsUpdate=!0,e.computeVertexNormals(),e}var nt=class extends c.BufferGeometry{radius;widthSegments;heightSegments;constructor({radius:e=1,widthSegments:t=4,heightSegments:n=4}={}){super(),this.radius=e,this.widthSegments=t,this.heightSegments=n;let r=new c.SphereGeometry(e,t,n);this.copy(tt(r,A.XYZ,.5,1)),this.computeVertexNormals(),this.center()}};function rt(e,{count:t=5,width:n=4,depth:r=4,heightJitter:i=0,scaleMin:a=.8,scaleMax:o=1.2,seed:s}){let l=N(s),u=new c.Matrix4,d=new c.Vector3,f=new c.Quaternion,p=new c.Vector3,m=new c.Euler;for(let s=0;s<t;s++)p.set(l.float(a,o),l.float(a,o),l.float(a,o)),m.set(l.float(0,Math.PI),l.float(0,Math.PI),l.float(0,Math.PI)),f.setFromEuler(m),d.set(l.float(-n/2,n/2),l.float(0,i),l.float(-r/2,r/2)),u.compose(d,f,p),e.setMatrixAt(s,u);e.instanceMatrix.needsUpdate=!0}function it({count:e=5,width:t=4,depth:n=4,heightJitter:r=0,scaleMin:i=.8,scaleMax:a=1.2,seed:o,radius:s=1,widthSegments:l=4,heightSegments:u=4,material:d,color:f=`#808080`}={}){let p=d??new c.MeshStandardMaterial({color:new c.Color(f),flatShading:!0}),m=new c.InstancedMesh(new nt({radius:s,widthSegments:l,heightSegments:u}),p,e);return rt(m,{count:e,width:t,depth:n,heightJitter:r,scaleMin:i,scaleMax:a,seed:o}),m}function at({count:e=5,width:t=4,depth:n=4,heightJitter:r=0,scaleMin:i=.8,scaleMax:a=1.2,seed:o,radius:s=1,detail:l=0,mossScaleXZ:u=.9,mossScaleY:d=.5,mossOffsetY:f=.3,rockMaterial:p,mossMaterial:m,rockColor:h=`#808080`,mossColor:g=`#4b8b3b`,mossOpacity:_=.8}={}){let v=[p??new c.MeshStandardMaterial({color:new c.Color(h),flatShading:!0}),m??new c.MeshStandardMaterial({color:new c.Color(g),flatShading:!0,opacity:_,transparent:_<1})],y=new c.InstancedMesh(new et({radius:s,detail:l,mossScaleXZ:u,mossScaleY:d,mossOffsetY:f}),v,e);return rt(y,{count:e,width:t,depth:n,heightJitter:r,scaleMin:i,scaleMax:a,seed:o}),y}function ot(e,t){return(e/2+t/2)/Math.SQRT2}function st(e,t,n,r){let i=Math.max(1,Math.round(n)),a=Math.max(1,Math.round(r)),o=e/(2*i),s=t/(2*a);return{a:o,b:s,angle:Math.atan2(s,o),spacing:2*o*s/Math.hypot(o,s)}}function ct(e,t,n){let r=ot(e,t);return r/Math.max(2,Math.round(r/n))}function lt(e,t,n){return ot(e,t)/Math.max(2,n)}function ut({width:e,height:t,centerY:n=0,grid:r,leadThickness:i,leadDepth:a}){let o=e/2,s=t/2,l=[new c.BoxGeometry(e+i,i,a).translate(0,n-s,0),new c.BoxGeometry(e+i,i,a).translate(0,n+s,0),new c.BoxGeometry(i,t+i,a).translate(-o,n,0),new c.BoxGeometry(i,t+i,a).translate(o,n,0)];return H(l,e,t,n,r.spacing,i,a,r.angle),H(l,e,t,n,r.spacing,i,a,-r.angle),l}function dt(e){let{width:t,height:n,centerY:r=0,grid:i,leadThickness:a,leadDepth:o}=e,s=[];return H(s,t,n,r,i.spacing,a,o,i.angle),H(s,t,n,r,i.spacing,a,o,-i.angle),s}function H(e,t,n,r,i,a,o,s){let l=t/2,u=n/2,d=-l,f=l,p=r-u,m=r+u,h=Math.hypot(t,n)+a,g=-Math.sin(s),_=Math.cos(s),v=Math.ceil(Math.hypot(t,n)/i)+2;for(let t=-v;t<=v;t++){let n=g*t*i,l=r+_*t*i,u=Math.cos(s)*h*.5,v=Math.sin(s)*h*.5,y=ft(n-u,l-v,n+u,l+v,d,p,f,m);if(!y)continue;let[b,x,S,C]=y,w=Math.hypot(S-b,C-x);if(w<1e-6)continue;let T=new c.BoxGeometry(w,a,o);T.rotateZ(s),T.translate((b+S)/2,(x+C)/2,0),e.push(T)}}function ft(e,t,n,r,i,a,o,s){let c=n-e,l=r-t,u=0,d=1,f=[[e,c,i,o],[t,l,a,s]];for(let[e,t,n,r]of f)if(Math.abs(t)<1e-9){if(e<n||e>r)return null}else{let i=(n-e)/t,a=(r-e)/t;if(u=Math.max(u,Math.min(i,a)),d=Math.min(d,Math.max(i,a)),u>d)return null}return[e+c*u,t+l*u,e+c*d,t+l*d]}function U({width:e,rectHeight:t,archHeight:n=e/2,centerY:r=0}){let i=Math.max(n,1e-6),a=(e*e+4*i*i)/(8*i),o=t+i,s=r-o/2,c=s+t,l=c+i-a;return{hw:e/2,ymin:s,ymax:c+i,rectTopY:c,archCy:l,archRadius:a,archHeight:i,totalHeight:o,centerY:r}}function W(e,t,{hole:n=!1}={}){let{hw:r,ymin:i,rectTopY:a,archCy:o,archRadius:s}=t,c=Math.atan2(a-o,-r),l=Math.atan2(a-o,r);if(!n){e.moveTo(-r,i),e.lineTo(r,i),e.lineTo(r,a),e.absarc(0,o,s,l,c,!1),e.lineTo(-r,a),e.closePath();return}e.moveTo(-r,i),e.lineTo(-r,a),e.absarc(0,o,s,c,l,!0),e.lineTo(r,a),e.lineTo(r,i),e.closePath()}function pt(e,t){let n=Math.max(e.hw-t,t),r=e.ymin+t,i=e.rectTopY-t,a=Math.max(e.archHeight-t,t),o=(n*n+a*a)/(2*a),s=i+a-o,c=i+a;return{hw:n,ymin:r,ymax:c,rectTopY:i,archCy:s,archRadius:o,archHeight:a,totalHeight:c-r,centerY:(r+c)/2}}var mt=48;function ht(e,t,n){let r=new c.Shape;W(r,e);let i=new c.Path;W(i,pt(e,t),{hole:!0}),r.holes.push(i);let a=new c.ExtrudeGeometry(r,{depth:n,bevelEnabled:!1,curveSegments:mt});return a.translate(0,0,-n/2),a}function gt(e,t,n){let r=2*n.b,i=t-e;return Math.round(i/r)*r-i}function _t(e,t,{hw:n,ymin:r,ymax:i,rectTopY:a,archCy:o,archRadius:s},c=1e-6){if(t<r-c||t>i+c)return!1;if(t<=a+c)return Math.abs(e)<=n+c;let l=e,u=t-o;return l*l+u*u<=s*s+c}function vt(e,t,n,r,i){let a=new Set([0,1]),o=n-e,s=r-t,{hw:c,ymin:l,ymax:u,rectTopY:d,archCy:f,archRadius:p}=i,m=e=>{e>1e-9&&e<.999999999&&a.add(e)};Math.abs(o)>1e-9&&(m((-c-e)/o),m((c-e)/o)),Math.abs(s)>1e-9&&(m((l-t)/s),m((d-t)/s),m((u-t)/s));let h=e,g=t-f,_=o*o+s*s,v=2*(h*o+g*s),y=h*h+g*g-p*p,b=v*v-4*_*y;if(b>=0&&_>1e-12){let e=Math.sqrt(b);m((-v-e)/(2*_)),m((-v+e)/(2*_))}return[...a].sort((e,t)=>e-t)}function yt(e,t,n,r,i){let a=U(i),o=vt(e,t,n,r,a),s=n-e,c=r-t,l=[],u=null,d=0;for(let n=0;n<o.length-1;n++){let r=o[n],i=o[n+1],f=(r+i)*.5;_t(e+s*f,t+c*f,a)?(u===null&&(u=r),d=i):u!==null&&(l.push([u,d]),u=null)}u!==null&&l.push([u,d]);let f=null,p=0;for(let e of l){let t=e[1]-e[0];t>p&&(p=t,f=e)}if(!f||p<1e-9)return null;let[m,h]=f;return[e+s*m,t+c*m,e+s*h,t+c*h]}function bt(e){return{width:2*e.hw,rectHeight:e.rectTopY-e.ymin,archHeight:e.archHeight,centerY:e.centerY}}function xt(e,t,n,r){let{hw:i,rectTopY:a,archCy:o,archRadius:s}=t,l=Math.atan2(a-o,-i),u=Math.atan2(a-o,i)-l,d=Math.max(12,Math.ceil(Math.abs(u)*s/(n*1.8)));for(let t=0;t<d;t++){let i=t/d,a=(t+1)/d,f=l+u*i,p=l+u*a,m=(f+p)/2,h=new c.BoxGeometry(2*s*Math.sin((p-f)/2),n,r);h.rotateZ(m-Math.PI/2),h.translate(s*Math.cos(m),o+s*Math.sin(m),0),e.push(h)}}function St({width:e,rectHeight:t,archHeight:n,centerY:r=0,grid:i,leadThickness:a,leadDepth:o,clipInset:s=0}){let c={width:e,rectHeight:t,archHeight:n,centerY:r},l=U(c),u=s>0?bt(pt(l,s)):c,d=[],f=gt(l.ymin,l.rectTopY,i);return wt(d,u,l,i,f,a,o,i.angle),wt(d,u,l,i,f,a,o,-i.angle),d}function Ct(e){let{width:t,rectHeight:n,archHeight:r,centerY:i=0,leadThickness:a,leadDepth:o}=e,s=U({width:t,rectHeight:n,archHeight:r,centerY:i}),{hw:l,ymin:u,rectTopY:d}=s,f=d-u,p=[new c.BoxGeometry(t+a,a,o).translate(0,u,0),new c.BoxGeometry(a,f+a,o).translate(-l,u+f/2,0),new c.BoxGeometry(a,f+a,o).translate(l,u+f/2,0)];return xt(p,s,a,o),p.push(...St(e)),p}function wt(e,t,n,r,i,a,o,s){let{totalHeight:l,centerY:u}=n,d=r.spacing,f=Math.hypot(t.width,l)+a,p=-Math.sin(s),m=Math.cos(s),h=Math.ceil(Math.hypot(t.width,l)/d)+2,g=u+i;for(let n=-h;n<=h;n++){let r=p*n*d,i=g+m*n*d,l=Math.cos(s)*f*.5,u=Math.sin(s)*f*.5,h=yt(r-l,i-u,r+l,i+u,t);if(!h)continue;let[_,v,y,b]=h,x=Math.hypot(y-_,b-v);if(x<1e-6)continue;let S=new c.BoxGeometry(x,a,o);S.rotateZ(s),S.translate((_+y)/2,(v+b)/2,0),e.push(S)}}var Tt=class extends c.BufferGeometry{cellsX;cellsY;fittedGrid;opening;constructor({width:e=4.5,rectHeight:t=4,archHeight:n,leadThickness:r=.055,leadDepth:i=.11,cellsX:a=10,cellsY:o=12,centerY:s=0}={}){super(),this.cellsX=Math.max(1,Math.round(a)),this.cellsY=Math.max(1,Math.round(o)),this.opening=U({width:e,rectHeight:t,archHeight:n,centerY:s}),this.fittedGrid=st(e,this.opening.totalHeight,this.cellsX,this.cellsY);let c=St({width:e,rectHeight:t,archHeight:n,centerY:s,grid:this.fittedGrid,leadThickness:r,leadDepth:i,clipInset:r*.5}),u=(0,l.mergeGeometries)(c);if(!u)throw Error(`ArchedDiamondLatticeWindowGeometry: merge failed`);this.copy(u),u.dispose();for(let e of c)e.dispose()}},Et=class extends c.BufferGeometry{cellsX;cellsY;fittedGrid;constructor({width:e=4.5,height:t=5.5,leadThickness:n=.055,leadDepth:r=.11,cellsX:i=10,cellsY:a=10,centerY:o=0}={}){super(),this.cellsX=Math.max(1,Math.round(i)),this.cellsY=Math.max(1,Math.round(a)),this.fittedGrid=st(e,t,this.cellsX,this.cellsY);let s=ut({width:e,height:t,centerY:o,grid:this.fittedGrid,leadThickness:n,leadDepth:r}),c=(0,l.mergeGeometries)(s);if(!c)throw Error(`DiamondLatticeWindowGeometry: merge failed`);this.copy(c),c.dispose();for(let e of s)e.dispose()}};function Dt(e,t,n,r){let i=Math.max(1,Math.round(n)),a=Math.max(1,Math.round(r));return{paneWidth:e/i,paneHeight:t/a}}function Ot({width:e,height:t,centerY:n=0,cellsX:r,cellsY:i,mullionThickness:a,mullionDepth:o}){let s=e/2,l=t/2,u=[new c.BoxGeometry(e+a,a,o).translate(0,n-l,0),new c.BoxGeometry(e+a,a,o).translate(0,n+l,0),new c.BoxGeometry(a,t+a,o).translate(-s,n,0),new c.BoxGeometry(a,t+a,o).translate(s,n,0)],{paneWidth:d,paneHeight:f}=Dt(e,t,r,i);for(let e=1;e<r;e++){let r=-s+d*e;u.push(new c.BoxGeometry(a,t+a,o).translate(r,n,0))}for(let t=1;t<i;t++){let r=n-l+f*t;u.push(new c.BoxGeometry(e+a,a,o).translate(0,r,0))}return u}var kt=class extends c.BufferGeometry{cellsX;cellsY;fittedGrid;constructor({width:e=4.5,height:t=5.5,mullionThickness:n=.055,mullionDepth:r=.11,cellsX:i=4,cellsY:a=6,centerY:o=0}={}){super(),this.cellsX=Math.max(1,Math.round(i)),this.cellsY=Math.max(1,Math.round(a)),this.fittedGrid=Dt(e,t,this.cellsX,this.cellsY);let s=Ot({width:e,height:t,centerY:o,cellsX:this.cellsX,cellsY:this.cellsY,mullionThickness:n,mullionDepth:r}),c=(0,l.mergeGeometries)(s);if(!c)throw Error(`GregorianLatticeWindowGeometry: merge failed`);this.copy(c),c.dispose();for(let e of s)e.dispose()}},At=.96;function jt(e,t,n=0){let r=e/2,i=t/2;return[new c.Plane(new c.Vector3(1,0,0),r),new c.Plane(new c.Vector3(-1,0,0),r),new c.Plane(new c.Vector3(0,1,0),n+i),new c.Plane(new c.Vector3(0,-1,0),-n+i)]}function Mt(e,t,n,r){return n===void 0?r===void 0?.55:e/Math.max(1,Math.round(r)):n}function Nt({width:e,height:t,centerY:n=0,cell:r}){let i=r*At,a=i*.6,o=t/2,s=e/2+a,c=Math.ceil(2*s/i)+1,l=(c-1)*i,u=Array.from({length:c},(e,t)=>-l/2+t*i),d=[],f=n-o+i*.5-a,p=n+o-i*.5+a;for(let e=f;e<=p+1e-9;e+=i)for(let t of u)d.push([t,e]);return{spots:d,grid:{cell:r,latticeCell:i,ringOuter:i*.5,count:d.length}}}function Pt(e,t,n){let r=Math.max(e-t,e*.5),i=new c.Shape;i.moveTo(-e,-e),i.lineTo(e,-e),i.lineTo(e,e),i.lineTo(-e,e),i.closePath();let a=new c.Path;return a.moveTo(-r,-r),a.lineTo(-r,r),a.lineTo(r,r),a.lineTo(r,-r),a.closePath(),i.holes.push(a),new c.ExtrudeGeometry(i,{depth:n,bevelEnabled:!1})}function Ft({width:e,height:t,centerY:n=0,frameThickness:r,frameDepth:i}){let a=e/2,o=t/2;return[new c.BoxGeometry(e+r,r,i).translate(0,n-o,0),new c.BoxGeometry(e+r,r,i).translate(0,n+o,0),new c.BoxGeometry(r,t+r,i).translate(-a,n,0),new c.BoxGeometry(r,t+r,i).translate(a,n,0)]}function G(e,t,n,r,i,a,o){let s=e.length/3;for(let[n,r,o]of i)e.push(n,r,o),t.push(...a);for(let[e,t]of o)n.push(e,t);r.push(s,s+1,s+2,s,s+2,s+3)}var It=[[0,0],[0,1],[1,1],[1,0]];function Lt(e,t,n,r,i){G(e.positions,e.normals,e.uvs,e.indices,[[-t,n,i],[-t,r,i],[t,r,i],[t,n,i]],[0,0,1],[[0,0],[0,1],[1,1],[1,0]])}function Rt(e,t,n,r,i){G(e.positions,e.normals,e.uvs,e.indices,[[-t,n,r],[-t,n,i],[t,n,i],[t,n,r]],[0,1,0],It)}function zt(e,t,n,r,i,a){G(e.positions,e.normals,e.uvs,e.indices,[[r,t,a],[r,t,i],[r,n,i],[r,n,a]],[1,0,0],[[0,0],[0,1],[1,1],[1,0]])}function Bt(e,t,n,r,i,a){G(e.positions,e.normals,e.uvs,e.indices,[[n,t,i],[n,t,a],[r,t,a],[r,t,i]],[0,1,0],It)}function K(e,t){return[e*Math.cos(t),e*Math.sin(t)]}function Vt(e){return[-Math.sin(e),0,Math.cos(e)]}function Ht(e,t,n,r,i,a){let[o,s]=K(t,a),[c,l]=K(n,a),u=Vt(a);G(e.positions,e.normals,e.uvs,e.indices,[[o,r,s],[o,i,s],[c,i,l],[c,r,l]],u,[[0,0],[0,1],[1,1],[1,0]])}function Ut(e,t,n,r,i,a){let[o,s]=K(t,i),[c,l]=K(t,a),[u,d]=K(n,a),[f,p]=K(n,i);G(e.positions,e.normals,e.uvs,e.indices,[[o,r,s],[c,r,l],[u,r,d],[f,r,p]],[0,1,0],[[0,0],[1,0],[1,1],[0,1]])}function Wt(e,t,n,r,i){G(e.positions,e.normals,e.uvs,e.indices,[[-t,n,r],[-t,n,i],[t,n,i],[t,n,r]],[0,1,0],It)}var Gt=class extends c.BufferGeometry{width;riserHeight;treadDepth;stepsPerFlight;landingSize;flightRun;totalHeight;constructor({width:e=2,riserHeight:t=.3,treadDepth:n=.5,stepsPerFlight:r=5}={}){super(),this.width=e,this.riserHeight=t,this.treadDepth=n,this.stepsPerFlight=Math.max(1,Math.round(r)),this.landingSize=e,this.flightRun=this.stepsPerFlight*this.treadDepth,this.totalHeight=this.stepsPerFlight*2*this.riserHeight;let i=e/2,a=[],o=[],s=[],l=[],u={positions:a,normals:o,uvs:s,indices:l};for(let e=0;e<this.stepsPerFlight;e++){let t=e*this.riserHeight,n=t+this.riserHeight,r=e*this.treadDepth,a=r+this.treadDepth;Lt(u,i,t,n,r),Rt(u,i,n,r,a)}let d=this.stepsPerFlight*this.riserHeight,f=(this.stepsPerFlight-1)*this.treadDepth,p=f+this.landingSize;Wt(u,i,d,f,p);let m=-i;for(let e=0;e<this.stepsPerFlight;e++){let t=d+e*this.riserHeight,n=t+this.riserHeight,r=m-e*this.treadDepth,i=r-this.treadDepth;zt(u,t,n,r,f,p),Bt(u,n,r,i,f,p)}this.setIndex(l),this.setAttribute(`position`,new c.BufferAttribute(new Float32Array(a),3)),this.setAttribute(`normal`,new c.BufferAttribute(new Float32Array(o),3)),this.setAttribute(`uv`,new c.BufferAttribute(new Float32Array(s),2)),this.computeBoundingSphere()}},Kt=class extends c.BufferGeometry{innerRadius;width;outerRadius;treadDepth;riserHeight;stepCount;startAngle;stepAngle;totalHeight;totalTurn;constructor({innerRadius:e=.45,width:t=1.95,treadDepth:n=.45,riserHeight:r=.2,stepCount:i=20,startAngle:a=0,stepAngle:o}={}){super(),this.innerRadius=Math.max(.01,e),this.width=Math.max(.05,t),this.outerRadius=this.innerRadius+this.width,this.treadDepth=n,this.riserHeight=r,this.stepCount=Math.max(1,Math.round(i)),this.startAngle=a;let s=(this.innerRadius+this.outerRadius)*.5;this.stepAngle=o??Math.max(n/s,Math.PI/180),this.totalHeight=this.stepCount*this.riserHeight,this.totalTurn=this.stepCount*this.stepAngle;let l=[],u=[],d=[],f=[],p={positions:l,normals:u,uvs:d,indices:f};for(let e=0;e<this.stepCount;e++){let t=this.startAngle+e*this.stepAngle,n=t+this.stepAngle,r=e*this.riserHeight,i=r+this.riserHeight;Ht(p,this.innerRadius,this.outerRadius,r,i,t),Ut(p,this.innerRadius,this.outerRadius,i,t,n)}this.setIndex(f),this.setAttribute(`position`,new c.BufferAttribute(new Float32Array(l),3)),this.setAttribute(`normal`,new c.BufferAttribute(new Float32Array(u),3)),this.setAttribute(`uv`,new c.BufferAttribute(new Float32Array(d),2)),this.computeBoundingSphere()}},qt=class extends c.BufferGeometry{width;riserHeight;treadDepth;stepCount;totalHeight;totalDepth;constructor({width:e=2,riserHeight:t=.3,treadDepth:n=.5,stepCount:r=10}={}){super(),this.width=e,this.riserHeight=t,this.treadDepth=n,this.stepCount=Math.max(1,Math.round(r)),this.totalHeight=this.stepCount*this.riserHeight,this.totalDepth=this.stepCount*this.treadDepth;let i=e/2,a=[],o=[],s=[],l=[],u={positions:a,normals:o,uvs:s,indices:l};for(let e=0;e<this.stepCount;e++){let t=e*this.riserHeight,n=t+this.riserHeight,r=e*this.treadDepth,a=r+this.treadDepth;Lt(u,i,t,n,r),Rt(u,i,n,r,a)}this.setIndex(l),this.setAttribute(`position`,new c.BufferAttribute(new Float32Array(a),3)),this.setAttribute(`normal`,new c.BufferAttribute(new Float32Array(o),3)),this.setAttribute(`uv`,new c.BufferAttribute(new Float32Array(s),2)),this.computeBoundingSphere()}},Jt=class extends c.BufferGeometry{constructor(){super();let e=new c.LatheGeometry([new c.Vector2(0,0),new c.Vector2(1.2,0),new c.Vector2(1.5,1.5),new c.Vector2(1,3),new c.Vector2(.6,3.5),new c.Vector2(.5,3.5)],10),t=new c.CylinderGeometry(.6,.5,.3,10);t.translate(0,3.5,0),this.copy((0,l.mergeGeometries)([e,t],!0))}};function Yt(e,t,n,r,i){let a=(r-t)/(n-e);return e+(i-t)/a}function Xt(e,t,n,r,i){return t+(r-t)/(n-e)*(i-e)}var Zt={calculateXFromSlopeIntercept:Yt,calculateYFromSlopeIntercept:Xt},Qt=class extends c.BufferGeometry{constructor(){super();let e=new c.LatheGeometry([new c.Vector2(0,0),new c.Vector2(.8,0),new c.Vector2(1,1.5),new c.Vector2(.5,2.2),new c.Vector2(.6,2.5),new c.Vector2(.5,2.5)],10),t=new c.CylinderGeometry(.55,.45,.2,10);t.translate(0,2.5,0);let n=new c.LatheGeometry([new c.Vector2(0,0),new c.Vector2(.8,0),new c.Vector2(Yt(.8,0,1,1.5,1),1),new c.Vector2(0,1)],10);n.translate(0,.1,0),n.scale(.9,.9,.9),this.copy((0,l.mergeGeometries)([e,t,n],!0))}},$t=class extends c.BufferGeometry{radius;height;constructor({radius:e=.5,neckRadius:t=.2,height:n=3,neckHeight:r=1,segments:i=16}={}){super(),this.radius=e,this.height=n;let a=n-r,o=new c.CylinderGeometry(e,e,a,i);o.translate(0,a/2,0);let s=.3,u=new c.CylinderGeometry(t,e,s,i);u.translate(0,a+s/2,0);let d=new c.CylinderGeometry(t,t,r,i);d.translate(0,a+s+r/2,0),this.copy((0,l.mergeGeometries)([o,u,d],!1))}},en=class extends c.BufferGeometry{width;height;depth;constructor({width:e=.4,height:t=1.2,depth:n=.2}={}){super(),this.width=e,this.height=t,this.depth=n;let r=t*.6,i=new c.BoxGeometry(e/2,r,n);i.translate(0,r/2,0);let a=new c.BoxGeometry(e*1.5,e/4,n);a.translate(0,r*.75,0),this.copy((0,l.mergeGeometries)([i,a],!1)),this.computeVertexNormals()}},tn=class extends c.BufferGeometry{constructor(){super();let e=new c.BoxGeometry(5,1,5);e.translate(0,.5,0);let t=new c.BoxGeometry(4,3,4);t.translate(0,2.5,0);let n=[[-1.8,2.3,-2.2],[1.8,2.3,-2.2],[-1.8,2.3,2.2],[1.8,2.3,2.2]],r=[];n.forEach(e=>{let t=new c.CylinderGeometry(.2,.2,3.5,16);t.translate(e[0],e[1],e[2]),r.push(t)});let i=new c.ConeGeometry(3.5,2,4);i.rotateY(Math.PI/4),i.translate(0,5,0);let a=new c.Shape;a.moveTo(-1,0),a.lineTo(-1,2),a.absarc(0,2,1,Math.PI,0,!0),a.lineTo(1,0);let o=new c.ExtrudeGeometry(a,{depth:.5,bevelEnabled:!1});o.translate(0,.5,1.7),o.setIndex([...Array(o.attributes.position.count).keys()]),this.copy((0,l.mergeGeometries)([e,(0,l.mergeGeometries)([t,...r],!1),i,o],!0)),this.computeVertexNormals()}},nn=class extends c.BufferGeometry{totalHeight;baseWidth;constructor({totalHeight:e=1.75,baseWidth:t=.75}={}){super(),this.totalHeight=e,this.baseWidth=t;let n=e*.05,r=e*.15,i=e*.15,a=e*.75,o=0,s=new c.BoxGeometry(t,n,t);s.translate(0,o+n/2,0),o+=n;let u=new c.BoxGeometry(t*.8,r,t*.8);u.translate(0,o+r/2,0),o+=r;let d=new c.BoxGeometry(t*.6,i,t*.6);d.translate(0,o+i/2,0),o+=i;let f=new c.BoxGeometry(t*.4,a,t*.4);f.translate(0,o+a/2,0),o+=a;let p=new c.ConeGeometry(t*.4/Math.sqrt(2),.1,4,1,!1,Math.PI/4);p.translate(0,o+.1/2,0),this.copy((0,l.mergeGeometries)([s,u,d,f,p],!1)),this.computeVertexNormals()}},rn=class extends c.BufferGeometry{constructor(e=.6,t=1,n=.2,r=.6){super();let i=t-r/2,a=new c.BoxGeometry(e,i,n);a.translate(0,i/2,0);let o=new c.CylinderGeometry(r/2,r/2,n,16,1,!1,0,Math.PI);o.rotateY(Math.PI/2),o.rotateX(Math.PI/2),o.translate(0,i,0),this.copy((0,l.mergeGeometries)([a,o],!1)),this.computeVertexNormals()}},an=class extends c.BufferGeometry{constructor(e=.5,t=.8,n=.15){super();let r=new c.BoxGeometry(e,t,n);r.translate(0,t/2,0),this.copy(r)}},on=class extends c.BufferGeometry{height;constructor({height:e=2.25}={}){super(),this.height=e;let t=new c.BoxGeometry(1.2,.5,1.2);t.translate(0,.25,0);let n=new c.BoxGeometry(1,e,1);n.translate(0,.5+e/2,0);let r=new c.BoxGeometry(1.4,.3,1.4);r.translate(0,.5+e+.15,0),this.copy((0,l.mergeGeometries)([t,n,r],!1))}},sn=class extends c.BufferGeometry{barHeight;constructor({barHeight:e=2,barRadius:t=.05,spikeHeight:n=.3,spikeRadius:r=.075,spikeScaleZ:i=1,radialSegments:a=8}={}){super(),this.barHeight=e;let o=new c.CylinderGeometry(t,t,e,a);o.translate(0,e/2,0);let s=new c.ConeGeometry(r,n,a);s.translate(0,e+n/2,0),s.scale(1,1,i),this.copy((0,l.mergeGeometries)([o,s],!1))}},cn=class extends c.BufferGeometry{count;spacing;constructor({count:e=20,spacing:t=.4,barHeight:n=2,barRadius:r=.05,spikeHeight:i=.3,spikeRadius:a=.075,spikeScaleZ:o=1,railHeight:s=.1,railDepth:u=.05,railOffset:d=0,radialSegments:f=8}={}){super(),this.count=e,this.spacing=t;let p=[],m=new sn({barHeight:n,barRadius:r,spikeHeight:i,spikeRadius:a,spikeScaleZ:o,radialSegments:f}),h=new c.BoxGeometry(e*t,s,u);for(let n=0;n<e;n++){let e=m.clone();e.translate(n*t,0,0),p.push(e)}let g=h.clone();g.translate(t*(e-1)/2,n-d-s/2,0),p.push(g);let _=h.clone();_.translate(t*(e-1)/2,s/2,0),p.push(_),this.copy((0,l.mergeGeometries)(p))}},ln=class extends c.BufferGeometry{width;height;depth;shelves;constructor({width:e=5,height:t=8,depth:n=1,shelves:r=4,frameThickness:i=.1,open:a=!1}={}){super(),this.width=e,this.height=t,this.depth=n,this.shelves=r;let o=new c.BoxGeometry(i,t,n),s=new c.BoxGeometry(e-2*i,i,n),u=o.clone();u.translate(-e/2+i/2,t/2,0);let d=o.clone();d.translate(e/2-i/2,t/2,0);let f=s.clone();f.translate(0,t-i/2,0);let p=s.clone();p.translate(0,i/2,0);let m=new c.BoxGeometry(e,t,i);m.translate(0,t/2,-n/2+i/2);let h=[],g=(t-i)/(r+1);for(let e=1;e<=r;e++){let t=s.clone();t.translate(0,i/2+e*g,0),h.push(t)}this.copy((0,l.mergeGeometries)([u,d,f,p,...a?[]:[m],...h],!1))}},un=class extends c.BufferGeometry{constructor(){super();let e=new c.BoxGeometry(5,.3,3);e.translate(0,3.15,0);let t=new c.LatheGeometry([new c.Vector2(.2,0),new c.Vector2(.25,.5),new c.Vector2(.15,1.5),new c.Vector2(.3,3)],32),n=(0,l.mergeGeometries)([[2.1,0,1.1],[-2.1,0,1.1],[2.1,0,-1.1],[-2.1,0,-1.1]].map(e=>{let n=t.clone();return n.translate(e[0],e[1],e[2]),n}));this.copy((0,l.mergeGeometries)([e,n],!0))}},dn=class extends c.BufferGeometry{size;lift;constructor({size:e=.13,lift:t=.22}={}){super(),this.size=e,this.lift=t;let n=[[0,1],[.34,.55],[.42,.05],[.3,-.45],[0,-1]],r=[],i=[],a=[];for(let i=0;i<n.length;i++){let[,o]=n[i];a.push(r.length/3),r.push(0,o*e,t*e*(1-Math.abs(o)))}let o=[],s=[];for(let t=0;t<n.length;t++){let[i,a]=n[t];s.push(r.length/3),r.push(i*e,a*e,0),o.push(r.length/3),r.push(-i*e,a*e,0)}for(let e=0;e<n.length-1;e++)i.push(a[e],s[e],s[e+1],a[e],s[e+1],a[e+1]),i.push(a[e],a[e+1],o[e+1],a[e],o[e+1],o[e]);this.setAttribute(`position`,new c.Float32BufferAttribute(r,3)),this.setIndex(i),this.computeVertexNormals(),this.computeBoundingSphere()}},fn=class extends u.ParametricGeometry{height;radius;segmentsU;segmentsV;constructor({height:e=.25,radius:t=.05,segmentsU:n=16,segmentsV:r=16}={}){super((n,r,i)=>{let a=n*Math.PI*2,o=Math.sin(r*Math.PI),s=t*o*Math.cos(a),c=r*e,l=t*o*Math.sin(a);i.set(s,c,-l)},n,r),this.height=e,this.radius=t,this.segmentsU=n,this.segmentsV=r}},pn=class extends c.BufferGeometry{radiusTop;radiusBottom;height;flameHeight;flameRadius;segments;constructor({radiusTop:e=.2,radiusBottom:t=.2,height:n=1,flameHeight:r=.25,flameRadius:i=.05,segments:a=16}={}){super(),this.radiusTop=e,this.radiusBottom=t,this.height=n,this.flameHeight=r,this.flameRadius=i,this.segments=a;let o=new c.CylinderGeometry(e,t,n,a);o.translate(0,n/2,0);let s=new fn({segmentsU:a,segmentsV:a,height:r,radius:i});s.translate(0,n,0),this.copy((0,l.mergeGeometries)([o,s],!0))}},mn=class extends c.BufferGeometry{baseWidth;bodyHeight;baseHeight;innerScale;inner;lampCenterY;constructor({baseWidth:e=.5,bodyHeight:t=1.3,baseHeight:n=.2,roofHeight:r=.5,roofRadius:i=e*1.1,glassRadiusScale:a=.9,innerScale:o=.96,handleRadius:s=e*.8,handleTubeRadius:u=.05,handleLift:d=.35,segments:f=8,inner:p=!0}={}){super(),this.baseWidth=e,this.bodyHeight=t,this.baseHeight=n,this.innerScale=o,this.inner=p,this.lampCenterY=n+t/2;let m=[],h=new c.CylinderGeometry(e,e,n,f);h.translate(0,n/2,0),m.push(h);let g=n+t,_=new c.ConeGeometry(i,r,f);_.translate(0,g+r/2,0),m.push(_);let v=g+r,y=new c.TorusGeometry(s,u,f,f*2);y.translate(0,v+d,0),m.push(y);let b=[(0,l.mergeGeometries)(m.map(e=>e.toNonIndexed()),!1)];if(p){let n=new c.CylinderGeometry(e*a*o,e*a*o,t*o,f);n.translate(0,this.lampCenterY,0),b.push(n.toNonIndexed())}this.copy((0,l.mergeGeometries)(b,!0)),this.computeBoundingSphere()}},hn=new c.Vector3(0,1,0);function gn(e,t,n){let r=t.clone().sub(e),i=new c.BoxGeometry(n,r.length(),n);i.applyQuaternion(new c.Quaternion().setFromUnitVectors(hn,r.normalize()));let a=e.clone().add(t).multiplyScalar(.5);return i.translate(a.x,a.y,a.z),i}var _n=class extends c.BufferGeometry{drop;chainWidth;capWidth;capHeight;capDepth;capOffset;cageRadius;cageStretch;cageGap;cageBarWidth;innerScale;inner;cageCenterY;constructor({drop:e=3,chainWidth:t=.05,capWidth:n=.18,capHeight:r=.16,capDepth:i=.18,capOffset:a=.02,cageRadius:o=.42,cageStretch:s=1.4,cageGap:u=0,cageBarWidth:d=.03,innerScale:f=.96,inner:p=!0}={}){super(),this.drop=e,this.chainWidth=t,this.capWidth=n,this.capHeight=r,this.capDepth=i,this.capOffset=a,this.cageRadius=o,this.cageStretch=s,this.cageGap=u,this.cageBarWidth=d,this.innerScale=f,this.inner=p;let m=-e+a;this.cageCenterY=m-o*s-u;let h=[],g=new c.BoxGeometry(t,e,t);g.translate(0,-e/2,0),h.push(g);let _=new c.BoxGeometry(n,r,i);_.translate(0,-e+a,0),h.push(_);let v=this.cageCenterY,y=o,b=new c.Vector3(0,v+y*s,0),x=new c.Vector3(0,v-y*s,0),S=new c.Vector3(y,v,0),C=new c.Vector3(-y,v,0),w=new c.Vector3(0,v,y),T=new c.Vector3(0,v,-y),E=[[b,S],[b,C],[b,w],[b,T],[x,S],[x,C],[x,w],[x,T],[S,w],[w,C],[C,T],[T,S]].map(([e,t])=>gn(e,t,d)),D=[(0,l.mergeGeometries)(h.map(e=>e.toNonIndexed()),!1),(0,l.mergeGeometries)(E.map(e=>e.toNonIndexed()),!1)];if(p){let e=new c.OctahedronGeometry(o*f,0);e.scale(1,s,1),e.translate(0,v,0),D.push(e.toNonIndexed())}this.copy((0,l.mergeGeometries)(D,!0)),this.computeBoundingSphere()}},vn=class extends c.BufferGeometry{bodyOffsetX;chimneyCenterY;innerScale;inner;lightCenterX;lightCenterY;lightCenterZ;constructor({plateThickness:e=.05,plateHeight:t=.22,plateDepth:n=.28,plateOffsetX:r=-.055,bracketLength:i=.1,bracketHeight:a=.05,bracketDepth:o=.07,bracketOffsetX:s=-.005,bracketOffsetY:u=.1,bodyOffsetX:d=.06,chimneyHeight:f=.3,chimneyTopRadius:p=.1,chimneyBottomRadius:m=.105,chimneyCenterY:h=-.05,capRadius:g=.115,capHeight:_=.05,capCenterY:v=.12,bowlTopRadius:y=.09,bowlBottomRadius:b=.11,bowlHeight:x=.05,bowlCenterY:S=-.22,radialSegments:C=8,innerScale:w=.96,inner:T=!0}={}){super(),this.bodyOffsetX=d,this.chimneyCenterY=h,this.innerScale=w,this.inner=T,this.lightCenterX=d,this.lightCenterY=h,this.lightCenterZ=0;let E=[],D=new c.BoxGeometry(e,t,n);D.translate(r,0,0),E.push(D);let O=new c.BoxGeometry(i,a,o);O.translate(s,u,0),E.push(O);let k=[],ee=new c.CylinderGeometry(g,g,_,C);ee.translate(d,v,0),k.push(ee);let te=new c.CylinderGeometry(y,b,x,C);te.translate(d,S,0),k.push(te);let A=[(0,l.mergeGeometries)(E.map(e=>e.toNonIndexed()),!1),(0,l.mergeGeometries)(k.map(e=>e.toNonIndexed()),!1)];if(T){let e=new c.CylinderGeometry(p*w,m*w,f*w,C);e.translate(d,h,0),A.push(e.toNonIndexed())}this.copy((0,l.mergeGeometries)(A,!0)),this.computeBoundingSphere()}},yn=class extends c.BufferGeometry{constructor(e=1,t=2,n=.5,r=Math.PI/4){super();let i=t*Math.tan(r),a=e,o=t,s=n,l=[0,0,0,a,0,0,a+i,o,0,i,o,0,a,0,-s,0,0,-s,i,o,-s,a+i,o,-s,0,0,-s,0,0,0,i,o,0,i,o,-s,a,0,0,a,0,-s,a+i,o,-s,a+i,o,0,i,o,0,a+i,o,0,a+i,o,-s,i,o,-s,0,0,-s,a,0,-s,a,0,0,0,0,0],u=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],d=[0,1,2,2,3,0,4,5,6,6,7,4,8,9,10,10,11,8,12,13,14,14,15,12,16,17,18,18,19,16,20,21,22,22,23,20],f=new Float32Array([0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1]),p=new Float32Array(l),m=new Float32Array(u),h=new Float32Array(f),g=new Uint16Array(d);this.setAttribute(`position`,new c.BufferAttribute(p,3)),this.setAttribute(`normal`,new c.BufferAttribute(m,3)),this.setAttribute(`uv`,new c.BufferAttribute(h,2)),this.setIndex(new c.BufferAttribute(g,1)),this.center()}},bn=class extends c.Shape{constructor(e=5,t=.5,n=1,r=5,i=.25){super();let a=Math.PI*2/e,o=a/4;this.moveTo(Math.cos(0)*n,-Math.sin(0)*n);for(let r=1;r<=e;++r)this.lineTo(Math.cos(a*r-o*3)*t,-Math.sin(a*r-o*3)*t),this.lineTo(Math.cos(a*r-o*2)*t,-Math.sin(a*r-o*2)*t),this.lineTo(Math.cos(a*r-o)*n,-Math.sin(a*r-o)*n),this.lineTo(Math.cos(a*r)*n,-Math.sin(a*r)*n);if(this.closePath(),i>0&&r>2){let e=new c.Path,t=Math.PI*2/r;e.moveTo(Math.cos(0)*i,-Math.sin(0)*i);for(let n=1;n<r;++n)e.lineTo(Math.cos(t*n)*i,-Math.sin(t*n)*i);e.lineTo(Math.cos(0)*i,-Math.sin(0)*i),this.holes.push(e)}}},xn=class extends c.ExtrudeGeometry{constructor({sides:e=5,innerRadius:t=.5,outerRadius:n=1,holeSides:r=5,holeRadius:i=.25,depth:a=.25}={}){super(new bn(e,t,n,r,i),{depth:a,bevelEnabled:!1})}},Sn=class extends c.Shape{constructor(e=1,t=2.1,n=1.4,r=1.6){super(),this.moveTo(0,n*e/3),this.bezierCurveTo(-t*.375*e,n*e,-t*e,n*e/3,0,-r*e),this.bezierCurveTo(t*e,n*e/3,t*.375*e,n*e,0,n*e/3)}},Cn=class extends c.ExtrudeGeometry{constructor({size:e=1,width:t=2.1,height:n=1.4,tipDepth:r=1.6,depth:i=.25}={}){super(new Sn(e,t,n,r),{depth:i,bevelEnabled:!1})}},wn=class extends c.Shape{constructor(e=5,t=.5,n=1){super();let r=Math.PI*2/e,i=r/2;this.moveTo(Math.cos(0)*n,Math.sin(0)*n);for(let a=1;a<=e;++a)this.lineTo(Math.cos(r*a-i)*t,Math.sin(r*a-i)*t),this.lineTo(Math.cos(r*a)*n,Math.sin(r*a)*n);this.closePath()}},Tn=class extends c.ExtrudeGeometry{constructor({points:e=5,innerRadius:t=.5,outerRadius:n=1,depth:r=.25}={}){super(new wn(e,t,n),{depth:r,bevelEnabled:!1})}},En=class extends c.BufferGeometry{constructor(e=.1,t=.1,n=.4,r=8){super();let i=new c.CylinderGeometry(e*.6,t*.6,n,r);i.translate(0,0,0);let a=new c.SphereGeometry(e,r,r),o=a.clone(),s=a.clone(),u=a.clone(),d=a.clone();o.translate(0,n/2+e*.6,-e*.6),s.translate(0,n/2+e*.6,e*.6),u.translate(0,-n/2-t*.6,-t*.6),d.translate(0,-n/2-t*.6,t*.6),this.copy((0,l.mergeGeometries)([i,o,s,u,d],!1))}},Dn=class extends c.BufferGeometry{flaskRadius;height;constructor({flaskRadius:e=1,neckRadius:t=.3,height:n=2.5,neckHeight:r=1,radialSegments:i=16}={}){super(),this.flaskRadius=e,this.height=n;let a=new c.LatheGeometry([new c.Vector2(0,0),new c.Vector2(e*.875,0),new c.Vector2(e,.1),new c.Vector2(t,n),new c.Vector2(t,n+r),new c.Vector2(t*1.1,n+r+.3)],i);this.copy((0,l.mergeGeometries)([a],!1))}},On=(e,t)=>e/(1-Math.cos(t)),kn=(e,t)=>e/(2*Math.sin(t)),An=(e,t)=>e*(1-Math.cos(t)),jn=(e,t)=>2*e*Math.sin(t),Mn=(e,t)=>{let n=2*t;return Math.asin(n/(2*e))},Nn=(e,t,n)=>({x:e*Math.sin(n)*Math.cos(t),y:e*Math.sin(n)*Math.sin(t),z:e*Math.cos(n)}),Pn=(e,t,n)=>{let r=Math.sqrt(e*e+t*t+n*n);return{radius:r,theta:Math.atan2(t,e),phi:Math.acos(n/r)}};function Fn(e,t,n,r=0,i=0,a=32){let o=r?Mn(e,r):0,s=i?Math.PI-Mn(e,i):Math.PI,l=[];for(let r=0;r<=a;r++){let i=s-(s-o)/a*r,u=e*Math.sin(i),d=t*Math.cos(i)+n;l.push(new c.Vector2(u,d))}return[...l]}var In=class extends c.BufferGeometry{constructor(){super();let e=new c.LatheGeometry([...Fn(1,1,.5,.2,0,32),new c.Vector2(.2,3)],32);this.copy(e)}},Ln=class extends c.BufferGeometry{constructor(){super();let e=new c.LatheGeometry([new c.Vector2(1,0),new c.Vector2(1.2,.5),new c.Vector2(1.4,1.5),new c.Vector2(1.3,1.8),new c.Vector2(.8,1.8)],12),t=new c.CircleGeometry(1,12);t.rotateX(-Math.PI/2),t.translate(0,0,0),this.copy((0,l.mergeGeometries)([e,t],!1))}},Rn=class extends c.BufferGeometry{radius;height;count;constructor({radius:e=.3,height:t=.4,count:n=3,thickness:r=.03,radialSegments:i=16}={}){super(),this.radius=e,this.height=t,this.count=n;let a=new c.TorusGeometry(e,r,8,i);a.rotateX(Math.PI/2),a.translate(0,t,0);let o=new c.CylinderGeometry(r*.6,r*.6,t,i),s=[];for(let r=0;r<n;r++){let i=r/n*Math.PI*2,a=o.clone();a.translate(Math.cos(i)*e,t/2,Math.sin(i)*e),s.push(a)}this.copy((0,l.mergeGeometries)([a,...s],!1))}},zn=class extends c.BufferGeometry{constructor(){super();let e=new c.CylinderGeometry(.5,.6,.3,16);e.translate(0,.15,0);let t=new c.CylinderGeometry(.15,.15,2,12,1,!0);t.translate(0,1.3,0);let n=new c.SphereGeometry(.3,16,16);n.translate(0,2.4,0),this.copy((0,l.mergeGeometries)([e,(0,l.mergeGeometries)([t,n])],!0))}},q=class extends c.BufferGeometry{constructor(e=.2,t=.2,n=3,r=32,i=!0){super();let a=new c.CylinderGeometry(e,t,n,r,1,i),o=new c.SphereGeometry(t,r,r/2,0,Math.PI*2,Math.PI/2,Math.PI/2);o.translate(0,-(n/2),0),this.copy((0,l.mergeGeometries)([a,o],!1))}},Bn=class extends c.BufferGeometry{radius;height;constructor({radius:e=8,height:t=1.2,radialSegments:n=40,angularSegments:r=64,noiseHeight:i=.5,noiseScale:a=.35,octaves:o=4,persistence:s=.5,rim:l=.82,seed:u=1}={}){super(),this.radius=e,this.height=t;let d=Math.max(1,Math.round(n)),f=Math.max(3,Math.round(r)),p=e=>.5+.5*Math.cos(Math.PI*e),m=e=>{if(e<=l)return 1;let t=(e-l)/(1-l);return 1-t*t*(3-2*t)},h=(e,n,r)=>p(e)*t+qe(n*a,r*a,u,o,s)*i*m(e),g=1+d*f,_=new Float32Array(g*3),v=new Float32Array(g*2);_[1]=h(0,0,0),v[0]=.5,v[1]=.5;for(let t=1;t<=d;t++){let n=t/d,r=n*e;for(let i=0;i<f;i++){let a=i/f*Math.PI*2,o=Math.cos(a)*r,s=Math.sin(a)*r,c=1+(t-1)*f+i;_[c*3]=o,_[c*3+1]=h(n,o,s),_[c*3+2]=s,v[c*2]=o/(2*e)+.5,v[c*2+1]=s/(2*e)+.5}}let y=(e,t)=>1+(e-1)*f+t%f,b=[];for(let e=0;e<f;e++)b.push(0,y(1,e+1),y(1,e));for(let e=1;e<d;e++)for(let t=0;t<f;t++){let n=y(e,t),r=y(e,t+1),i=y(e+1,t),a=y(e+1,t+1);b.push(n,a,i),b.push(n,r,a)}this.setAttribute(`position`,new c.BufferAttribute(_,3)),this.setAttribute(`uv`,new c.BufferAttribute(v,2)),this.setIndex(b),this.computeVertexNormals()}},Vn=class extends c.BufferGeometry{width;depth;constructor({width:e=16,depth:t=16,widthSegments:n=48,depthSegments:r=48,noiseHeight:i=.8,noiseScale:a=.35,octaves:o=4,persistence:s=.5,edgeFalloff:l=0,seed:u=1}={}){super(),this.width=e,this.depth=t;let d=Math.max(1,Math.round(n)),f=Math.max(1,Math.round(r)),p=e/2,m=t/2,h=Math.min(Math.max(l,0),1),g=(e,t)=>{if(h<=0)return 1;let n=Math.min(e+p,p-e)/p,r=Math.min(t+m,m-t)/m,i=Math.min(n,r);if(i>=h)return 1;let a=i/h;return a*a*(3-2*a)},_=(d+1)*(f+1),v=new Float32Array(_*3),y=new Float32Array(_*2);for(let n=0;n<=f;n++){let r=-m+n/f*t;for(let t=0;t<=d;t++){let c=-p+t/d*e,l=qe(c*a,r*a,u,o,s)*i*g(c,r),m=n*(d+1)+t;v[m*3]=c,v[m*3+1]=l,v[m*3+2]=r,y[m*2]=t/d,y[m*2+1]=n/f}}let b=[],x=(e,t)=>t*(d+1)+e;for(let e=0;e<f;e++)for(let t=0;t<d;t++){let n=x(t,e),r=x(t+1,e),i=x(t,e+1),a=x(t+1,e+1);b.push(n,i,r),b.push(r,i,a)}this.setAttribute(`position`,new c.BufferAttribute(v,3)),this.setAttribute(`uv`,new c.BufferAttribute(y,2)),this.setIndex(b),this.computeVertexNormals()}},Hn=class extends c.BufferGeometry{trunkRadiusTop;trunkRadiusBottom;trunkHeight;trunkSegments;leafSize;leafCount;leafDetail;leafSpreadRadius;constructor({trunkRadiusTop:e=.25,trunkRadiusBottom:t=.4,trunkHeight:n=2.5,trunkSegments:r=14,leafSize:i=.8,leafCount:a=6,leafDetail:o=0,leafSpreadRadius:s=1.5}={}){super(),this.trunkRadiusTop=e,this.trunkRadiusBottom=t,this.trunkHeight=n,this.trunkSegments=r,this.leafSize=i,this.leafCount=a,this.leafDetail=o,this.leafSpreadRadius=s;let u=new c.CylinderGeometry(e,t,n,r);u.translate(0,n/2,0);let d=[];for(let e=0;e<a;e++){let e=new c.DodecahedronGeometry(i,o);e.translate((Math.random()-.5)*s,(Math.random()-.5)*i+n,(Math.random()-.5)*s),d.push(e)}this.copy((0,l.mergeGeometries)([u.toNonIndexed(),(0,l.mergeGeometries)(d,!1)],!0)),this.computeVertexNormals()}},Un=class extends c.Mesh{width;riserHeight;treadDepth;stepsPerFlight;landingSize;flightRun;totalHeight;constructor({color:e=`#8b4513`,...t}={}){let n=new Gt(t);super(n,new c.MeshStandardMaterial({color:new c.Color(e),roughness:.85,metalness:.04,side:c.DoubleSide})),this.width=n.width,this.riserHeight=n.riserHeight,this.treadDepth=n.treadDepth,this.stepsPerFlight=n.stepsPerFlight,this.landingSize=n.landingSize,this.flightRun=n.flightRun,this.totalHeight=n.totalHeight}},Wn=class extends c.Mesh{innerRadius;width;outerRadius;treadDepth;riserHeight;stepCount;stepAngle;totalHeight;totalTurn;constructor({color:e=`#8b4513`,...t}={}){let n=new Kt(t);super(n,new c.MeshStandardMaterial({color:new c.Color(e),roughness:.85,metalness:.04,side:c.DoubleSide})),this.innerRadius=n.innerRadius,this.width=n.width,this.outerRadius=n.outerRadius,this.treadDepth=n.treadDepth,this.riserHeight=n.riserHeight,this.stepCount=n.stepCount,this.stepAngle=n.stepAngle,this.totalHeight=n.totalHeight,this.totalTurn=n.totalTurn}},Gn=class extends c.Mesh{width;riserHeight;treadDepth;stepCount;totalHeight;totalDepth;constructor({color:e=`#8b4513`,...t}={}){let n=new qt(t);super(n,new c.MeshStandardMaterial({color:new c.Color(e),roughness:.85,metalness:.04,side:c.DoubleSide})),this.width=n.width,this.riserHeight=n.riserHeight,this.treadDepth=n.treadDepth,this.stepCount=n.stepCount,this.totalHeight=n.totalHeight,this.totalDepth=n.totalDepth}},Kn=48,qn=class extends c.Group{lattice;frame;glass;cellsX;cellsY;fittedGrid;opening;constructor({leadColor:e=`#0c0f14`,glass:t=!1,glassColor:n=`#6a7d8c`,glassEmissive:r,glassEmissiveIntensity:i=0,width:a=4.5,rectHeight:o=4,archHeight:s,centerY:l=0,leadThickness:u=.055,leadDepth:d=.11,...f}={}){super(),this.opening=U({width:a,rectHeight:o,archHeight:s,centerY:l});let p=new Tt({width:a,rectHeight:o,archHeight:s,centerY:l,leadThickness:u,leadDepth:d,...f});this.cellsX=p.cellsX,this.cellsY=p.cellsY,this.fittedGrid=p.fittedGrid;let m=new c.Color(e);if(t){let e=new c.Shape;W(e,this.opening);let t=new c.ShapeGeometry(e,Kn),a=new c.MeshPhysicalMaterial({color:new c.Color(n),emissive:r?new c.Color(r):new c.Color(0),emissiveIntensity:i,transparent:!0,depthWrite:!1,roughness:.08,metalness:0,transmission:r?.5:.88,thickness:d*.5,side:c.DoubleSide});this.glass=new c.Mesh(t,a),this.glass.renderOrder=0,this.glass.castShadow=!1,this.glass.receiveShadow=!1,this.add(this.glass)}let h=new c.MeshStandardMaterial({color:m,roughness:.7,metalness:.35,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1});this.lattice=new c.Mesh(p,h),this.lattice.castShadow=!0,this.lattice.renderOrder=1,this.add(this.lattice);let g=ht(this.opening,u,d);this.frame=new c.Mesh(g,new c.MeshStandardMaterial({color:m,roughness:.7,metalness:.35})),this.frame.castShadow=!0,this.frame.renderOrder=2,this.add(this.frame)}},Jn=class extends c.Group{lattice;glass;cellsX;cellsY;fittedGrid;constructor({leadColor:e=`#0c0f14`,glass:t=!1,glassColor:n=`#6a7d8c`,glassEmissive:r,glassEmissiveIntensity:i=0,centerY:a=0,leadDepth:o=.11,...s}={}){super();let l=new Et({centerY:a,leadDepth:o,...s});this.cellsX=l.cellsX,this.cellsY=l.cellsY,this.fittedGrid=l.fittedGrid;let u=new c.MeshStandardMaterial({color:new c.Color(e),roughness:.7,metalness:.35,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1});if(this.lattice=new c.Mesh(l,u),this.lattice.castShadow=!0,this.lattice.renderOrder=1,this.add(this.lattice),t){let e=s.width??4.5,t=s.height??5.5,l=new c.MeshPhysicalMaterial({color:new c.Color(n),emissive:r?new c.Color(r):new c.Color(0),emissiveIntensity:i,transparent:!0,depthWrite:!1,roughness:.08,metalness:0,transmission:r?.5:.88,thickness:o*.5,side:c.DoubleSide});this.glass=new c.Mesh(new c.PlaneGeometry(e,t),l),this.glass.position.y=a,this.glass.renderOrder=0,this.glass.castShadow=!1,this.glass.receiveShadow=!1,this.add(this.glass)}}},Yn=class extends c.Group{mullions;glass;cellsX;cellsY;fittedGrid;constructor({mullionColor:e=`#5c4033`,glass:t=!1,glassColor:n=`#6a7d8c`,glassEmissive:r,glassEmissiveIntensity:i=0,...a}={}){super();let o=new kt(a);this.cellsX=o.cellsX,this.cellsY=o.cellsY,this.fittedGrid=o.fittedGrid;let s=new c.MeshStandardMaterial({color:new c.Color(e),roughness:.85,metalness:.05});if(this.mullions=new c.Mesh(o,s),this.mullions.castShadow=!0,this.mullions.renderOrder=1,this.add(this.mullions),t){let e=a.width??4.5,t=a.height??5.5,o=new c.MeshPhysicalMaterial({color:new c.Color(n),emissive:r?new c.Color(r):new c.Color(0),emissiveIntensity:i,transparent:!0,depthWrite:!1,roughness:.08,metalness:0,transmission:r?.5:.88,thickness:.02,side:c.DoubleSide});this.glass=new c.Mesh(new c.PlaneGeometry(e,t),o),this.glass.renderOrder=0,this.glass.castShadow=!1,this.glass.receiveShadow=!1,this.add(this.glass)}}},Xn=1,Zn=class extends c.Group{lattice;frame;glass;cell;fittedGrid;clipPlanesLocal;clipPlanesWorld;constructor({width:e=4.5,height:t=5.5,cell:n,cellsX:r,centerY:i=0,ringThickness:a=.05,ringDepth:o=.06,frameThickness:s=.055,frameDepth:u=.11,latticeColor:d=`#0c0f14`,glass:f=!1,glassColor:p=`#6a7d8c`,glassEmissive:m,glassEmissiveIntensity:h=0}={}){super(),this.cell=Mt(e,t,n,r);let{spots:g,grid:_}=Nt({width:e,height:t,centerY:i,cell:this.cell});if(this.fittedGrid=_,this.clipPlanesLocal=jt(e,t,i),this.clipPlanesWorld=this.clipPlanesLocal.map(e=>e.clone()),f){let n=new c.MeshPhysicalMaterial({color:new c.Color(p),emissive:m?new c.Color(m):new c.Color(0),emissiveIntensity:h,transparent:!0,depthWrite:!1,roughness:.08,metalness:0,transmission:m?.5:.88,thickness:.02,side:c.DoubleSide});this.glass=new c.Mesh(new c.PlaneGeometry(e,t),n),this.glass.position.y=i,this.glass.position.z=-o*.5,this.glass.renderOrder=0,this.add(this.glass)}let v=new c.Mesh(new c.PlaneGeometry(e,t),new c.MeshBasicMaterial({colorWrite:!1,depthWrite:!1,depthTest:!1,stencilWrite:!0,stencilRef:Xn,stencilFunc:c.AlwaysStencilFunc,stencilFail:c.KeepStencilOp,stencilZPass:c.ReplaceStencilOp,stencilZFail:c.KeepStencilOp}));v.position.y=i,v.renderOrder=1,this.add(v);let y=Pt(_.ringOuter,a,o),b=new c.MeshStandardMaterial({color:new c.Color(d),roughness:.7,metalness:.35,clippingPlanes:this.clipPlanesWorld,clipShadows:!0,stencilWrite:!0,stencilWriteMask:0,stencilRef:Xn,stencilFunc:c.EqualStencilFunc,stencilFail:c.KeepStencilOp,stencilZPass:c.KeepStencilOp,stencilZFail:c.KeepStencilOp});this.lattice=new c.InstancedMesh(y,b,g.length),this.lattice.castShadow=!0,this.lattice.renderOrder=2;let x=new c.Object3D;for(let e=0;e<g.length;e++)x.position.set(g[e][0],g[e][1],0),x.rotation.set(0,0,Math.PI/4),x.updateMatrix(),this.lattice.setMatrixAt(e,x.matrix);this.lattice.instanceMatrix.needsUpdate=!0,this.lattice.onBeforeRender=()=>{this.updateWorldMatrix(!0,!1);for(let e=0;e<this.clipPlanesLocal.length;e++)this.clipPlanesWorld[e].copy(this.clipPlanesLocal[e]).applyMatrix4(this.matrixWorld)},this.add(this.lattice);let S=Ft({width:e,height:t,centerY:i,frameThickness:s,frameDepth:u}),C=(0,l.mergeGeometries)(S);if(!C)throw Error(`RingLatticeWindow: frame merge failed`);for(let e of S)e.dispose();this.frame=new c.Mesh(C,new c.MeshStandardMaterial({color:new c.Color(d),roughness:.7,metalness:.35})),this.frame.castShadow=!0,this.frame.renderOrder=3,this.add(this.frame)}},Qn=class extends c.Mesh{width;height;depth;coverThickness;pageIndent;constructor({coverColor:e=`#8b0000`,pageColor:t=`#ffffff`,...n}={}){let r=new L(n);super(r,[new c.MeshStandardMaterial({color:new c.Color(e),metalness:.1,roughness:.7,flatShading:!0}),new c.MeshStandardMaterial({color:new c.Color(t),flatShading:!0})]),this.width=r.width,this.height=r.height,this.depth=r.depth,this.coverThickness=r.coverThickness,this.pageIndent=r.pageIndent}},$n=class extends c.Mesh{constructor(){super(new Jt,[new c.MeshStandardMaterial({color:8965290,transparent:!0,depthWrite:!1,opacity:.4,roughness:.1,metalness:.5,side:c.DoubleSide}),new c.MeshStandardMaterial({color:9127187,roughness:1})])}},er=class extends c.Mesh{constructor(){super(new Qt,[new c.MeshStandardMaterial({color:8965375,transparent:!0,depthWrite:!1,opacity:.5,roughness:.1,metalness:.3}),new c.MeshStandardMaterial({color:9127187,roughness:1}),new c.MeshStandardMaterial({color:ne.PINK_SHERBET,transparent:!0,depthWrite:!1,opacity:.5})])}},tr=class extends c.Mesh{constructor({color:e=`#556b2f`,...t}={}){super(new $t(t),new c.MeshPhysicalMaterial({color:new c.Color(e),roughness:.1,transmission:.9,thickness:.2,metalness:0,clearcoat:1,clearcoatRoughness:.1}))}},nr=class extends c.Mesh{width;height;constructor({color:e=`#777777`,roughness:t=.8,...n}={}){let r=new en(n);super(r,new c.MeshStandardMaterial({color:new c.Color(e),roughness:t})),this.width=r.width,this.height=r.height}},rr=class extends c.Mesh{constructor(){super(new tn,[new c.MeshStandardMaterial({color:8421504,flatShading:!0}),new c.MeshStandardMaterial({color:6908265,flatShading:!0}),new c.MeshStandardMaterial({color:5263440,flatShading:!0}),new c.MeshStandardMaterial({color:4210752,flatShading:!0})])}},ir=class extends c.Mesh{totalHeight;constructor({color:e=`#777777`,roughness:t=.8,...n}={}){let r=new nn(n);super(r,new c.MeshStandardMaterial({color:new c.Color(e),roughness:t})),this.totalHeight=r.totalHeight}},ar=class extends c.Mesh{constructor(e=.6,t=1,n=.2,r=.6){super(new rn(e,t,n,r),new c.MeshStandardMaterial({color:7829367,roughness:.8}))}},or=class extends c.Mesh{constructor(e=.5,t=.8,n=.15){super(new an(e,t,n),new c.MeshStandardMaterial({color:7829367,roughness:.8}))}},sr=class extends c.Mesh{height;constructor({color:e=`#8b7d7b`,...t}={}){let n=new on(t);super(n,new c.MeshStandardMaterial({color:new c.Color(e),flatShading:!0})),this.height=n.height}},cr=class extends c.Mesh{barHeight;constructor({color:e=`#333333`,...t}={}){let n=new sn(t);super(n,new c.MeshStandardMaterial({color:new c.Color(e),metalness:.8,roughness:.4})),this.barHeight=n.barHeight}},lr=class extends c.Mesh{count;constructor({color:e=`#333333`,...t}={}){let n=new cn(t);super(n,new c.MeshStandardMaterial({color:new c.Color(e),metalness:.8,roughness:.4})),this.count=n.count}},ur=class extends c.Mesh{width;height;constructor({color:e=`#8b4513`,...t}={}){let n=new ln(t);super(n,new c.MeshStandardMaterial({color:new c.Color(e)})),this.width=n.width,this.height=n.height}},dr=class extends c.Mesh{constructor(){super(new un,[new c.MeshStandardMaterial({color:9132587}),new c.MeshStandardMaterial({color:4929057})])}},fr=class extends c.Mesh{size;lift;constructor({color:e=`#a8702c`,...t}={}){let n=new dn(t);super(n,new c.MeshStandardMaterial({color:new c.Color(e),roughness:.85,metalness:.05,flatShading:!0,side:c.DoubleSide})),this.size=n.size,this.lift=n.lift}},pr=class extends c.Mesh{height;constructor({stickColor:e=`#ffffff`,flameColor:t=`#ffd700`,flameEmissive:n=`#ffa500`,flameEmissiveIntensity:r=.35,...i}={}){let a=new pn(i);super(a,[new c.MeshStandardMaterial({color:new c.Color(e),flatShading:!0}),new c.MeshStandardMaterial({color:new c.Color(t),emissive:new c.Color(n),emissiveIntensity:r,flatShading:!0,toneMapped:!1})]),this.height=a.height}},mr=class extends c.Mesh{height;radius;segmentsU;segmentsV;constructor({color:e=`#ffd700`,emissive:t=`#ffa500`,emissiveIntensity:n=.35,...r}={}){let i=new fn(r);super(i,new c.MeshStandardMaterial({color:new c.Color(e),emissive:new c.Color(t),emissiveIntensity:n,flatShading:!0,toneMapped:!1})),this.height=i.height,this.radius=i.radius,this.segmentsU=i.segmentsU,this.segmentsV=i.segmentsV}},hr=class extends c.Mesh{drop;cageCenterY;constructor({color:e=`#171a1f`,mountColor:t,cageColor:n,lampColor:r=`#ffb45a`,lampEmissiveIntensity:i=1.4,lampOpacity:a=.88,inner:o=!0,...s}={}){let l=new _n({inner:o,...s}),u=new c.Color(r),d=[new c.MeshStandardMaterial({color:new c.Color(t??e),metalness:.7,roughness:.5,flatShading:!0}),new c.MeshStandardMaterial({color:new c.Color(n??e),metalness:.7,roughness:.5,flatShading:!0})];o&&d.push(new c.MeshStandardMaterial({color:u,emissive:u,emissiveIntensity:i,transparent:a<1,opacity:a,roughness:.35,metalness:0,flatShading:!0,side:c.DoubleSide,toneMapped:!1})),super(l,d),this.drop=l.drop,this.cageCenterY=l.cageCenterY}},gr=class extends c.Mesh{lightCenterX;lightCenterY;lightCenterZ;constructor({color:e=`#1c1e24`,mountColor:t,frameColor:n,lampColor:r=`#e8a058`,lampEmissiveIntensity:i=1.4,lampOpacity:a=.88,inner:o=!0,...s}={}){let l=new vn({inner:o,...s}),u=new c.Color(r),d=[new c.MeshStandardMaterial({color:new c.Color(t??e),metalness:.65,roughness:.55,flatShading:!0}),new c.MeshStandardMaterial({color:new c.Color(n??e),metalness:.65,roughness:.55,flatShading:!0})];o&&d.push(new c.MeshStandardMaterial({color:u,emissive:u,emissiveIntensity:i,transparent:a<1,opacity:a,roughness:.35,metalness:0,flatShading:!0,side:c.DoubleSide,toneMapped:!1})),super(l,d),this.lightCenterX=l.lightCenterX,this.lightCenterY=l.lightCenterY,this.lightCenterZ=l.lightCenterZ}},_r=class extends c.Mesh{lampCenterY;constructor({color:e=`#8b4513`,lampColor:t=`#ffd700`,lampEmissiveIntensity:n=1.2,lampOpacity:r=.75,inner:i=!0,...a}={}){let o=new mn({inner:i,...a}),s=new c.Color(t),l=[new c.MeshStandardMaterial({color:new c.Color(e),roughness:.85,metalness:.04,flatShading:!0})];i&&l.push(new c.MeshStandardMaterial({color:s,emissive:s,emissiveIntensity:n,transparent:r<1,opacity:r,roughness:.35,metalness:0,flatShading:!0,side:c.DoubleSide,toneMapped:!1})),super(o,l),this.lampCenterY=o.lampCenterY}},vr=class extends c.Mesh{radius;constructor({color:e=`#6f6f6f`,flatShading:t=!0,...n}={}){let r=new Ye(n);super(r,new c.MeshStandardMaterial({color:new c.Color(e),roughness:1,metalness:0,flatShading:t})),this.radius=r.radius,this.castShadow=!0,this.receiveShadow=!0}},yr=class extends c.Mesh{constructor({rockColor:e=`#808080`,mossColor:t=`#4b8b3b`,mossOpacity:n=.8,...r}={}){super(new et(r),[new c.MeshStandardMaterial({color:new c.Color(e),flatShading:!0}),new c.MeshStandardMaterial({color:new c.Color(t),flatShading:!0,opacity:n,transparent:n<1})])}},br=class extends c.Mesh{constructor({color:e=`#808080`,...t}={}){super(new nt(t),new c.MeshStandardMaterial({color:new c.Color(e),flatShading:!0}))}},xr=class extends c.Group{constructor(){super();let e=new c.Mesh(new c.CylinderGeometry(.3,.4,.1,16),new c.MeshStandardMaterial({color:3355443,roughness:.6,metalness:.3}));e.position.y=.05;let t=new c.Mesh(new c.CylinderGeometry(.1,.1,.7,16),new c.MeshStandardMaterial({color:5592405,roughness:.5,metalness:.4}));t.position.y=.4;let n=new c.Mesh(new c.ConeGeometry(.075,.2,16),new c.MeshStandardMaterial({color:16733440,emissive:16733440,emissiveIntensity:.6,transparent:!0,opacity:.8}));n.position.y=.8,this.add(e,t,n)}},Sr=class extends c.Group{constructor(){super();let e=new c.BoxGeometry(3,4,.1),t=new c.MeshStandardMaterial({color:3026478,roughness:.8,metalness:.6}),n=new c.BoxGeometry(.2,.5,.2),r=new c.MeshStandardMaterial({color:11184810,roughness:.5,metalness:.7}),i=new c.CylinderGeometry(.3,.3,.1,16),a=new c.MeshStandardMaterial({color:5592405,roughness:.7,metalness:.5}),o=new c.Mesh(e,t);for(let e=-1;e<=1;e++){let t=new c.Mesh(n,r);t.position.set(e,1.5,.1),o.add(t)}let s=new c.Mesh(i,a);s.rotation.x=Math.PI/2,s.position.set(0,.5,.15),o.add(s);let l=new c.Mesh(new c.SphereGeometry(.15,8,8),new c.MeshStandardMaterial({color:16711680,emissive:16711680,emissiveIntensity:.5}));l.position.set(0,-1,.1),o.add(l),this.add(o)}},Cr=class extends c.Mesh{constructor({color:e=`#88ccff`,opacity:t=.4,...n}={}){super(new Dn(n),new c.MeshPhysicalMaterial({color:new c.Color(e),transparent:!0,opacity:t,roughness:.1,metalness:.1,reflectivity:.8,transmission:.9,side:c.DoubleSide}))}},wr=class extends c.Mesh{constructor(){super(new In,new c.MeshPhysicalMaterial({color:8965375,transparent:!0,depthWrite:!1,opacity:.4,roughness:.1,metalness:.1,reflectivity:.8,transmission:.9,side:c.DoubleSide}))}},Tr=class extends c.Group{constructor(){super();let e=new c.Mesh(new c.BoxGeometry(2,3,.1),new c.MeshStandardMaterial({color:3355443,roughness:.8,metalness:.5})),t=new c.CylinderGeometry(.1,.1,.2,8),n=new c.CylinderGeometry(.05,.05,1,8),r=new c.MeshStandardMaterial({color:11184810,roughness:.5,metalness:.7}),i=[];for(let e=-.5;e<=.5;e+=.5){let a=new c.Mesh(t,r);a.position.set(e,1,.1);let o=new c.Mesh(n,r);o.position.y=.5,a.add(o),i.push(o),this.add(a)}this.add(e)}},Er=class extends c.Group{constructor(){super();let e=new c.BoxGeometry(1,.2,.5),t=new c.MeshStandardMaterial({color:4473924,roughness:.6,metalness:.3}),n=new c.Mesh(e,t);n.position.y=.1;let r=new c.Mesh(new c.BoxGeometry(.2,1,.2),t);r.position.set(0,.6,-.2);let i=new c.Mesh(new c.CylinderGeometry(.1,.1,.4,8),new c.MeshStandardMaterial({color:3355443,roughness:.5,metalness:.6}));i.position.set(0,1.1,-.35),i.rotation.x=-Math.PI/4;let a=new c.Mesh(new c.BoxGeometry(.6,.1,.6),new c.MeshStandardMaterial({color:5592405,roughness:.8,metalness:.2}));a.position.set(0,.6,0),this.add(n,r,i,a)}},Dr=class extends c.Group{constructor(){super();let e=new Ln,t=new c.CylinderGeometry(.2,.3,1.5,8);t.translate(0,.75,0);let n=new c.MeshStandardMaterial({color:6045747,roughness:1,metalness:0,side:c.DoubleSide}),r=new c.MeshStandardMaterial({color:9132587,roughness:.8,metalness:.1}),i=new c.Mesh(e,n);i.castShadow=!0;let a=new c.Mesh(t,r);a.castShadow=!0,a.position.set(.3,1.3,0),a.rotation.z=Math.PI/4,this.add(i,a)}},Or=class extends c.Mesh{geometry;material;constructor({width:e=3,height:t=4,depth:n=.1}={}){super(),this.geometry=new c.BoxGeometry(e,t,n),this.material=new c.MeshStandardMaterial({color:3026478,roughness:.8,metalness:.6})}},kr=class extends c.Mesh{geometry;material;constructor({radius:e=.15,color:t=16762823,emissive:n=16711680,emissiveIntensity:r=.5}={}){super(),this.geometry=new c.SphereGeometry(e,8,8),this.material=new c.MeshStandardMaterial({color:t,emissive:n,emissiveIntensity:r})}},Ar=class extends c.Group{constructor(){super();let e=new c.Mesh(new c.TubeGeometry(new c.CatmullRomCurve3(Array.from({length:100},(e,t)=>{let n=t*.2;return new c.Vector3(Math.cos(n)*.4,t*.05,Math.sin(n)*.4)})),200,.1,8,!1),new c.MeshStandardMaterial({color:8965375,transparent:!0,opacity:.3,roughness:.1,metalness:.2,emissive:8965375,emissiveIntensity:.2}));this.add(e)}},jr=class extends c.Mesh{constructor({color:e=`#888888`,...t}={}){super(new Rn(t),new c.MeshStandardMaterial({color:new c.Color(e),roughness:.7,metalness:.3}))}},Mr=class extends c.Mesh{constructor(){super(new zn,[new c.MeshStandardMaterial({color:3355443,roughness:.6,metalness:.5}),new c.MeshStandardMaterial({color:16737792,roughness:.5,metalness:.8,side:c.DoubleSide})])}},Nr=class extends c.Mesh{constructor(e=.2,t=.2,n=3,r=32){super(new q(e,t,n,r),new c.MeshPhysicalMaterial({color:8965375,transparent:!0,opacity:.4,roughness:.1,metalness:.1,reflectivity:.8,transmission:.9,depthWrite:!1,side:c.DoubleSide}))}},Pr=class extends c.Group{count;constructor({count:e=3,colors:t=[`#00ffaa`,`#ff00aa`,`#aa00ff`]}={}){super(),this.count=e;let n=new c.Mesh(new c.BoxGeometry(3,.2,1),new c.MeshStandardMaterial({color:9127187,roughness:.7,metalness:.3}));n.position.y=.5,n.castShadow=!0;let r=new q(.1,.1,1,16),i=new c.MeshStandardMaterial({color:11184810,transparent:!0,opacity:.4,roughness:.1,metalness:.5,depthWrite:!1,side:c.DoubleSide});for(let a=0;a<e;a++){let o=new c.Mesh(r,i),s=(a-(e-1)/2)*.8;o.position.set(s,1,0),o.castShadow=!0,o.renderOrder=2;let l=new q(.099,.099,.5,16,!1),u=t[a%t.length],d=new c.Mesh(l,new c.MeshStandardMaterial({color:new c.Color(u),emissive:new c.Color(u),emissiveIntensity:.5,transparent:!0,opacity:.6,depthWrite:!1,side:c.DoubleSide}));d.position.set(0,-.25,0),d.renderOrder=1,o.add(d),n.add(o)}this.add(n)}},Fr=class extends c.Mesh{constructor({color:e=`#ffff00`,emissive:t=`#ffd700`,emissiveIntensity:n=.25,...r}={}){super(new je(r),new c.MeshStandardMaterial({color:new c.Color(e),emissive:new c.Color(t),emissiveIntensity:n,metalness:.1,roughness:.3,flatShading:!0}))}},Ir=class extends c.Mesh{constructor({color:e=`#aaaaaa`,...t}={}){super(new xn(t),new c.MeshStandardMaterial({color:new c.Color(e),metalness:.8,roughness:.2}))}},Lr=class extends c.Mesh{constructor({color:e=`#c62828`,emissive:t=`#c61416`,emissiveIntensity:n=.25,...r}={}){super(new Cn(r),new c.MeshStandardMaterial({color:new c.Color(e),emissive:new c.Color(t),emissiveIntensity:n,metalness:.1,roughness:.3,flatShading:!0}))}},Rr=class extends c.Mesh{constructor({color:e=`#ffffff`,emissive:t=`#ffffff`,emissiveIntensity:n=.1,...r}={}){super(new V(r),new c.MeshStandardMaterial({color:new c.Color(e),emissive:new c.Color(t),emissiveIntensity:n,metalness:.1,roughness:.3,flatShading:!0}))}},zr=class extends c.Mesh{constructor({color:e=`#ffff00`,emissive:t=`#ffd700`,emissiveIntensity:n=.25,...r}={}){super(new Tn(r),new c.MeshStandardMaterial({color:new c.Color(e),emissive:new c.Color(t),emissiveIntensity:n,metalness:.1,roughness:.3,flatShading:!0}))}},Br=class extends c.Mesh{constructor(){super(new En,new c.MeshStandardMaterial({color:16777215}))}},Vr=class extends c.Mesh{trunkHeight;constructor({trunkColor:e=`#8b4513`,leafColor:t=`#228b22`,...n}={}){let r=new Hn(n);super(r,[new c.MeshStandardMaterial({color:new c.Color(e),roughness:.9,metalness:0,flatShading:!0}),new c.MeshStandardMaterial({color:new c.Color(t),roughness:.8,metalness:0,flatShading:!0})]),this.trunkHeight=r.trunkHeight}},Hr=class extends c.Mesh{radius;height;constructor({color:e=`#3a5a3a`,flatShading:t=!0,...n}={}){let r=new Bn(n);super(r,new c.MeshStandardMaterial({color:new c.Color(e),roughness:1,metalness:0,flatShading:t,side:c.DoubleSide})),this.radius=r.radius,this.height=r.height,this.castShadow=!0,this.receiveShadow=!0}},Ur=class extends c.Mesh{width;depth;constructor({color:e=`#3a5a3a`,flatShading:t=!0,...n}={}){let r=new Vn(n);super(r,new c.MeshStandardMaterial({color:new c.Color(e),roughness:1,metalness:0,flatShading:t,side:c.DoubleSide})),this.width=r.width,this.depth=r.depth,this.castShadow=!0,this.receiveShadow=!0}};function Wr(e){if(!e)throw Error(`A material must be provided to add instance color support.`);return e.onBeforeCompile=e=>{e.vertexShader=e.vertexShader.replace(`void main() {`,`attribute vec3 instanceColor;
2
- varying vec3 vColor;
3
- void main() {`),e.vertexShader=e.vertexShader.replace(`#include <begin_vertex>`,`#include <begin_vertex>
4
- vColor = instanceColor;`),e.fragmentShader=e.fragmentShader.replace(`void main() {`,`varying vec3 vColor;
5
- void main() {`),e.fragmentShader=e.fragmentShader.replace(`#include <dithering_fragment>`,`#include <dithering_fragment>
6
- gl_FragColor.rgb = vColor * gl_FragColor.rgb;`)},e}function Gr(e,{time:t=0,waveFrequency:n=.2,waveAmplitude:r=.5}={}){e.onBeforeCompile=i=>{i.uniforms.time={value:t},i.uniforms.waveFrequency={value:n},i.uniforms.waveAmplitude={value:r},i.vertexShader=`
7
- uniform float time;
8
- uniform float waveFrequency;
9
- uniform float waveAmplitude;
10
-
11
- vec3 waterDisplacement(vec3 position, vec3 normal) {
12
- vec3 displaced = position;
13
-
14
- // Displace along the normal direction instead of local y-axis
15
- displaced += normal * (sin(position.x * waveFrequency + time) * waveAmplitude);
16
- displaced += normal * (cos(position.z * waveFrequency + time) * waveAmplitude);
17
-
18
- return displaced;
19
- }
20
- `+i.vertexShader,i.vertexShader=i.vertexShader.replace(`#include <begin_vertex>`,`
21
- vec3 transformed = waterDisplacement(position, normal);
22
- `),e.userData.shader=i}}function Kr(e,t){e.userData.shader&&(e.userData.shader.uniforms.time.value+=t)}function qr(e,{time:t=0,intensity:n=1,axis:r=A.XYZ,scale:i=10}={}){e.onBeforeCompile=a=>{a.uniforms.time={value:t},a.uniforms.axis={value:r},a.uniforms.intensity={value:n},a.uniforms.scale={value:i},a.vertexShader=`
23
- uniform float time;
24
- uniform vec3 axis;
25
- uniform float intensity;
26
- uniform float scale;
27
-
28
- float mod289(float x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
29
- vec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
30
- vec4 perm(vec4 x) { return mod289(((x * 34.0) + 1.0) * x); }
31
-
32
- float noise(vec3 p) {
33
- vec3 a = floor(p);
34
- vec3 d = p - a;
35
- d = d * d * (3.0 - 2.0 * d);
36
-
37
- vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);
38
- vec4 k1 = perm(b.xyxy);
39
- vec4 k2 = perm(k1.xyxy + b.zzww);
40
-
41
- vec4 c = k2 + a.zzzz;
42
- vec4 k3 = perm(c);
43
- vec4 k4 = perm(c + 1.0);
44
-
45
- vec4 o1 = fract(k3 * (1.0 / 41.0));
46
- vec4 o2 = fract(k4 * (1.0 / 41.0));
47
-
48
- vec4 o3 = o2 * d.z + o1 * (1.0 - d.z);
49
- vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);
50
-
51
- return o4.y * d.y + o4.x * (1.0 - d.y);
52
- }
53
- `+a.vertexShader,a.vertexShader=a.vertexShader.replace(`#include <begin_vertex>`,`
54
- vec3 transformed = vec3(position);
55
- float n = noise(transformed * scale + time);
56
- transformed += normalize(axis) * n * intensity;
57
- vec3 transformedNormal = normal;
58
- `),e.userData.shader=a}}function Jr(e,t){e.userData.shader&&(e.userData.shader.uniforms.time.value+=t)}var J={uniforms:{turbidity:{value:10},rayleigh:{value:2},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new c.Vector3().setFromSphericalCoords(1,c.MathUtils.degToRad(90),c.MathUtils.degToRad(180))},up:{value:new c.Vector3(0,1,0)}},vertexShader:`
59
- uniform vec3 sunPosition;
60
- uniform float rayleigh;
61
- uniform float turbidity;
62
- uniform float mieCoefficient;
63
- uniform vec3 up;
64
-
65
- varying vec3 vWorldPosition;
66
- varying vec3 vSunDirection;
67
- varying float vSunfade;
68
- varying vec3 vBetaR;
69
- varying vec3 vBetaM;
70
- varying float vSunE;
71
-
72
- // constants for atmospheric scattering
73
- const float e = 2.71828182845904523536028747135266249775724709369995957;
74
- const float pi = 3.141592653589793238462643383279502884197169;
75
-
76
- // wavelength of used primaries, according to preetham
77
- const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );
78
- // this pre-calculation replaces older TotalRayleigh(vec3 lambda) function:
79
- // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))
80
- const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );
81
-
82
- // mie stuff
83
- // K coefficient for the primaries
84
- const float v = 4.0;
85
- const vec3 K = vec3( 0.686, 0.678, 0.666 );
86
- // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K
87
- const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );
88
-
89
- // earth shadow hack
90
- // cutoffAngle = pi / 1.95;
91
- const float cutoffAngle = 1.6110731556870734;
92
- const float steepness = 1.5;
93
- const float EE = 1000.0;
94
-
95
- float sunIntensity( float zenithAngleCos ) {
96
- zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );
97
- return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );
98
- }
99
-
100
- vec3 totalMie( float T ) {
101
- float c = ( 0.2 * T ) * 10E-18;
102
- return 0.434 * c * MieConst;
103
- }
104
-
105
- void main() {
106
- vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
107
- vWorldPosition = worldPosition.xyz;
108
-
109
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
110
- gl_Position.z = gl_Position.w; // set z to camera.far
111
-
112
- vSunDirection = normalize( sunPosition );
113
-
114
- vSunE = sunIntensity( dot( vSunDirection, up ) );
115
-
116
- vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );
117
-
118
- float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );
119
-
120
- // extinction (absorption + out scattering)
121
- // rayleigh coefficients
122
- vBetaR = totalRayleigh * rayleighCoefficient;
123
-
124
- // mie coefficients
125
- vBetaM = totalMie( turbidity ) * mieCoefficient;
126
- }
127
- `,fragmentShader:`
128
- varying vec3 vWorldPosition;
129
- varying vec3 vSunDirection;
130
- varying float vSunfade;
131
- varying vec3 vBetaR;
132
- varying vec3 vBetaM;
133
- varying float vSunE;
134
-
135
- uniform float mieDirectionalG;
136
- uniform vec3 up;
137
-
138
- // constants for atmospheric scattering
139
- const float pi = 3.141592653589793238462643383279502884197169;
140
-
141
- const float n = 1.0003; // refractive index of air
142
- const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)
143
-
144
- // optical length at zenith for molecules
145
- const float rayleighZenithLength = 8.4E3;
146
- const float mieZenithLength = 1.25E3;
147
- // 66 arc seconds -> degrees, and the cosine of that
148
- const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;
149
-
150
- // 3.0 / ( 16.0 * pi )
151
- const float THREE_OVER_SIXTEENPI = 0.05968310365946075;
152
- // 1.0 / ( 4.0 * pi )
153
- const float ONE_OVER_FOURPI = 0.07957747154594767;
154
-
155
- float rayleighPhase( float cosTheta ) {
156
- return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );
157
- }
158
-
159
- float hgPhase( float cosTheta, float g ) {
160
- float g2 = pow( g, 2.0 );
161
- float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );
162
- return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );
163
- }
164
-
165
- void main() {
166
- vec3 direction = normalize( vWorldPosition - cameraPosition );
167
-
168
- // optical length
169
- // cutoff angle at 90 to avoid singularity in next formula.
170
- float zenithAngle = acos( max( 0.0, dot( up, direction ) ) );
171
- float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );
172
- float sR = rayleighZenithLength * inverse;
173
- float sM = mieZenithLength * inverse;
174
-
175
- // combined extinction factor
176
- vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );
177
-
178
- // in scattering
179
- float cosTheta = dot( direction, vSunDirection );
180
-
181
- float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );
182
- vec3 betaRTheta = vBetaR * rPhase;
183
-
184
- float mPhase = hgPhase( cosTheta, mieDirectionalG );
185
- vec3 betaMTheta = vBetaM * mPhase;
186
-
187
- vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );
188
- Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );
189
-
190
- // night sky
191
- float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]
192
- float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]
193
- vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );
194
- vec3 L0 = vec3( 0.1 ) * Fex;
195
-
196
- // composition + solar disc
197
- float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );
198
- L0 += ( vSunE * 19000.0 * Fex ) * sundisk;
199
-
200
- vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );
201
-
202
- vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );
203
-
204
- gl_FragColor = vec4( retColor, 1.0 );
205
-
206
- #include <tonemapping_fragment>
207
- #include <colorspace_fragment>
208
- }
209
- `},Yr={uniforms:{tDiffuse:{value:null},kernelSize:{value:0},resolution:{value:null}},vertexShader:`
210
- varying vec2 vUv;
211
- void main() {
212
- vUv = uv;
213
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
214
- }
215
- `,fragmentShader:`
216
- uniform sampler2D tDiffuse;
217
- uniform float kernelSize;
218
- uniform vec2 resolution;
219
- varying vec2 vUv;
220
-
221
- void main() {
222
- vec2 texelSize = 1.0 / resolution;
223
- vec4 color = vec4(0.0);
224
- float total = 0.0;
225
-
226
- // Box blur with dynamic kernel size
227
- float radius = kernelSize;
228
- for (float x = -10.0; x <= 10.0; x += 1.0) {
229
- for (float y = -10.0; y <= 10.0; y += 1.0) {
230
- float weight = 1.0 - (abs(x) + abs(y)) / (radius * 2.0 + 1.0);
231
- if (weight > 0.0 && abs(x) <= radius && abs(y) <= radius) {
232
- vec2 offset = vec2(x, y) * texelSize * 2.0;
233
- color += texture2D(tDiffuse, vUv + offset) * weight;
234
- total += weight;
235
- }
236
- }
237
- }
238
-
239
- gl_FragColor = total > 0.0 ? color / total : texture2D(tDiffuse, vUv);
240
- }
241
- `},Y={uniforms:{tDiffuseA:{value:null},tDiffuseB:{value:null},mixRatio:{value:0}},vertexShader:`
242
- varying vec2 vUv;
243
- void main() {
244
- vUv = uv;
245
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
246
- }
247
- `,fragmentShader:`
248
- uniform sampler2D tDiffuseA;
249
- uniform sampler2D tDiffuseB;
250
- uniform float mixRatio;
251
- varying vec2 vUv;
252
-
253
- vec3 linearTosRGB(vec3 color) {
254
- return mix(
255
- color * 12.92,
256
- 1.055 * pow(color, vec3(1.0 / 2.4)) - 0.055,
257
- step(0.0031308, color)
258
- );
259
- }
260
-
261
- void main() {
262
- vec4 texelA = texture2D(tDiffuseA, vUv);
263
- vec4 texelB = texture2D(tDiffuseB, vUv);
264
- vec3 blendedColor = mix(texelA.rgb, texelB.rgb, mixRatio);
265
- gl_FragColor = vec4(linearTosRGB(blendedColor), max(texelA.a, texelB.a));
266
- }
267
- `},X={uniforms:{topColor:{value:new c.Color(.5,.8,1)},bottomColor:{value:new c.Color(1,1,1)}},vertexShader:`
268
- varying vec3 vPosition;
269
- void main() {
270
- vPosition = position;
271
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
272
- }
273
- `,fragmentShader:`
274
- uniform vec3 topColor;
275
- uniform vec3 bottomColor;
276
- varying vec3 vPosition;
277
- void main() {
278
- float y = normalize(vPosition).y * 0.5 + 0.5; // Normalizing y to range 0 to 1
279
- gl_FragColor = vec4(mix(bottomColor, topColor, y), 1.0);
280
- }
281
- `},Z={uniforms:{tDiffuse:{value:null},fadeAmount:{value:0},fadeColor:{value:null}},vertexShader:`
282
- varying vec2 vUv;
283
- void main() {
284
- vUv = uv;
285
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
286
- }
287
- `,fragmentShader:`
288
- uniform sampler2D tDiffuse;
289
- uniform float fadeAmount;
290
- uniform vec3 fadeColor;
291
- varying vec2 vUv;
292
-
293
- vec3 linearTosRGB(vec3 color) {
294
- return mix(
295
- color * 12.92,
296
- 1.055 * pow(color, vec3(1.0 / 2.4)) - 0.055,
297
- step(0.0031308, color)
298
- );
299
- }
300
-
301
- void main() {
302
- vec4 texel = texture2D(tDiffuse, vUv);
303
- vec3 blendedColor = mix(texel.rgb, fadeColor, fadeAmount);
304
- gl_FragColor = vec4(linearTosRGB(blendedColor), 1.0);
305
- }
306
- `},Xr={uniforms:{tDiffuseA:{value:null},tDiffuseB:{value:null},mixRatio:{value:0},fadeColor:{value:null}},vertexShader:`
307
- varying vec2 vUv;
308
- void main() {
309
- vUv = uv;
310
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
311
- }
312
- `,fragmentShader:`
313
- uniform sampler2D tDiffuseA;
314
- uniform sampler2D tDiffuseB;
315
- uniform float mixRatio;
316
- uniform vec3 fadeColor;
317
- varying vec2 vUv;
318
-
319
- vec3 linearTosRGB(vec3 color) {
320
- return mix(
321
- color * 12.92,
322
- 1.055 * pow(color, vec3(1.0 / 2.4)) - 0.055,
323
- step(0.0031308, color)
324
- );
325
- }
326
-
327
- void main() {
328
- vec4 texelA = texture2D(tDiffuseA, vUv);
329
- vec4 texelB = texture2D(tDiffuseB, vUv);
330
-
331
- // Fade out to color, then fade in from color
332
- float fadeOut = smoothstep(0.0, 0.5, mixRatio) * 2.0;
333
- float fadeIn = smoothstep(0.5, 1.0, mixRatio) * 2.0 - 1.0;
334
-
335
- vec3 colorA = mix(texelA.rgb, fadeColor, clamp(fadeOut, 0.0, 1.0));
336
- vec3 colorB = mix(fadeColor, texelB.rgb, clamp(fadeIn, 0.0, 1.0));
337
-
338
- vec3 blendedColor = mix(colorA, colorB, step(0.5, mixRatio));
339
- gl_FragColor = vec4(linearTosRGB(blendedColor), 1.0);
340
- }
341
- `},Q={uniforms:{topColor:{value:new c.Color(51)},bottomColor:{value:new c.Color(17)},offset:{value:33},exponent:{value:.6}},vertexShader:`
342
- varying vec3 vWorldPosition;
343
- void main() {
344
- vec4 worldPosition = modelMatrix * vec4(position, 1.0);
345
- vWorldPosition = worldPosition.xyz;
346
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
347
- }
348
- `,fragmentShader:`
349
- uniform vec3 topColor;
350
- uniform vec3 bottomColor;
351
- uniform float offset;
352
- uniform float exponent;
353
- varying vec3 vWorldPosition;
354
- void main() {
355
- float h = normalize(vWorldPosition + offset).y;
356
- gl_FragColor = vec4(mix(bottomColor, topColor, max(pow(max(h, 0.0), exponent), 0.0)), 1.0);
357
- }
358
- `},Zr=class extends c.Mesh{geometry;material;constructor(){super(),this.geometry=new c.BoxGeometry(1,1,1),this.material=new c.ShaderMaterial({uniforms:J.uniforms,vertexShader:J.vertexShader,fragmentShader:J.fragmentShader,depthWrite:!1,side:c.BackSide}),this.scale.setScalar(45e4);let e=c.MathUtils.degToRad(89),t=c.MathUtils.degToRad(180),n=new c.Vector3().setFromSphericalCoords(1,e,t);this.material.uniforms.sunPosition.value=n}sunPosition(e,t){let n=new c.Vector3;n.setFromSphericalCoords(1,e,t),this.material.uniforms.sunPosition.value=n}},Qr=class extends c.Mesh{geometry;material;constructor(e=1e3){super(),this.geometry=new c.BoxGeometry(e,e,e),this.material=new c.ShaderMaterial({uniforms:X.uniforms,vertexShader:X.vertexShader,fragmentShader:X.fragmentShader,side:c.BackSide})}},$r=class extends c.Mesh{geometry;material;constructor(e=1e3){super(),this.geometry=new c.SphereGeometry(e,32,15),this.material=new c.ShaderMaterial({vertexShader:Q.vertexShader,fragmentShader:Q.fragmentShader,uniforms:Q.uniforms,side:c.BackSide})}},ei=e=>{let t=new Uint8Array(4*e*e);for(let n=0;n<e*e;n++){let r=n*4,i=(n%e^Math.floor(n/e))&1?255:0;t[r]=i,t[r+1]=i,t[r+2]=i,t[r+3]=255}let n=new c.DataTexture(t,e,e,c.RGBAFormat,c.UnsignedByteType);return n.wrapS=c.RepeatWrapping,n.wrapT=c.RepeatWrapping,n.minFilter=c.NearestFilter,n.needsUpdate=!0,n},ti=class{perspectiveCamera;orthographicCamera;renderer;scene=null;currentCamera;targetCamera=null;transitionProgress=0;transitionDuration=1e3;transitionStartTime=0;isTransitioning=!1;easingFunction;renderTargetA;renderTargetB;blendScene;blendCamera;blendMaterial;onUpdateCallback;onCompleteCallback;constructor(e,t,n){this.perspectiveCamera=e,this.orthographicCamera=t,this.renderer=n,this.currentCamera=e,this.easingFunction=h.cubicInOut;let r=n.getSize(new c.Vector2);this.renderTargetA=new c.WebGLRenderTarget(r.x,r.y),this.renderTargetB=new c.WebGLRenderTarget(r.x,r.y),this.blendScene=new c.Scene,this.blendCamera=new c.OrthographicCamera(-1,1,1,-1,0,1),this.blendMaterial=new c.ShaderMaterial({uniforms:{tDiffuseA:{value:this.renderTargetA.texture},tDiffuseB:{value:this.renderTargetB.texture},mixRatio:{value:0}},vertexShader:Y.vertexShader,fragmentShader:Y.fragmentShader});let i=new c.PlaneGeometry(2,2),a=new c.Mesh(i,this.blendMaterial);this.blendScene.add(a)}transitionTo(e,t={}){this.currentCamera!==e&&(this.targetCamera=e,this.transitionDuration=t.duration??1e3,this.transitionStartTime=performance.now(),this.transitionProgress=0,this.isTransitioning=!0,this.onUpdateCallback=t.onUpdate,this.onCompleteCallback=t.onComplete,t.easing&&(typeof t.easing==`string`?this.easingFunction=h[t.easing]:this.easingFunction=t.easing))}update(e){if(this.scene=e,!this.isTransitioning)return this.currentCamera;let t=performance.now()-this.transitionStartTime,n=Math.min(t/this.transitionDuration,1);return this.transitionProgress=this.easingFunction(n),this.onUpdateCallback&&this.onUpdateCallback(this.transitionProgress),n>=1?(this.isTransitioning=!1,this.currentCamera=this.targetCamera,this.targetCamera=null,this.onCompleteCallback&&this.onCompleteCallback(),this.currentCamera):this.currentCamera}render(e){if(!this.isTransitioning||!this.targetCamera){this.renderer.render(e,this.currentCamera);return}this.renderer.setRenderTarget(this.renderTargetA),this.renderer.render(e,this.currentCamera),this.renderer.setRenderTarget(this.renderTargetB),this.renderer.render(e,this.targetCamera),this.blendMaterial.uniforms.mixRatio.value=this.transitionProgress,this.renderer.setRenderTarget(null),this.renderer.render(this.blendScene,this.blendCamera)}getCurrentCamera(){return this.currentCamera}getIsTransitioning(){return this.isTransitioning}getProgress(){return this.transitionProgress}setSize(e,t){this.renderTargetA.setSize(e,t),this.renderTargetB.setSize(e,t)}dispose(){this.renderTargetA.dispose(),this.renderTargetB.dispose(),this.blendMaterial.dispose()}},ni=class{renderer;currentScene=null;targetScene=null;camera=null;transitionProgress=0;transitionDuration=1e3;transitionStartTime=0;isTransitioning=!1;transitionType=null;easingFunction;renderTargetA;renderTargetB;blendScene;blendCamera;fadeMaterial;crossfadeMaterial;fadeColor=new c.Color(0);onUpdateCallback;onCompleteCallback;constructor(e){this.renderer=e,this.easingFunction=h.cubicInOut;let t=e.getSize(new c.Vector2);this.renderTargetA=new c.WebGLRenderTarget(t.x,t.y),this.renderTargetB=new c.WebGLRenderTarget(t.x,t.y),this.blendScene=new c.Scene,this.blendCamera=new c.OrthographicCamera(-1,1,1,-1,0,1),this.fadeMaterial=new c.ShaderMaterial({uniforms:{tDiffuseA:{value:this.renderTargetA.texture},tDiffuseB:{value:this.renderTargetB.texture},mixRatio:{value:0},fadeColor:{value:new c.Color(0)}},vertexShader:Xr.vertexShader,fragmentShader:Xr.fragmentShader}),this.crossfadeMaterial=new c.ShaderMaterial({uniforms:{tDiffuseA:{value:this.renderTargetA.texture},tDiffuseB:{value:this.renderTargetB.texture},mixRatio:{value:0}},vertexShader:Y.vertexShader,fragmentShader:Y.fragmentShader});let n=new c.PlaneGeometry(2,2),r=new c.Mesh(n,this.fadeMaterial);this.blendScene.add(r)}fade(e,t,n,r={}){this.startTransition(e,t,n,`fade`,r),r.color!==void 0&&(this.fadeColor.set(r.color),this.fadeMaterial.uniforms.fadeColor.value.copy(this.fadeColor));let i=this.blendScene.children[0];i.material=this.fadeMaterial}crossfade(e,t,n,r={}){this.startTransition(e,t,n,`crossfade`,r);let i=this.blendScene.children[0];i.material=this.crossfadeMaterial}blur(e,t,n,r={}){this.fade(e,t,n,{...r,color:8421504})}startTransition(e,t,n,r,i){this.currentScene=e,this.targetScene=t,this.camera=n,this.transitionType=r,this.transitionDuration=i.duration??1e3,this.transitionStartTime=performance.now(),this.transitionProgress=0,this.isTransitioning=!0,this.onUpdateCallback=i.onUpdate,this.onCompleteCallback=i.onComplete,i.easing&&(typeof i.easing==`string`?this.easingFunction=h[i.easing]:this.easingFunction=i.easing)}update(){if(!this.isTransitioning)return;let e=performance.now()-this.transitionStartTime,t=Math.min(e/this.transitionDuration,1);this.transitionProgress=this.easingFunction(t),this.onUpdateCallback&&this.onUpdateCallback(this.transitionProgress),t>=1&&(this.isTransitioning=!1,this.currentScene=this.targetScene,this.targetScene=null,this.onCompleteCallback&&this.onCompleteCallback())}render(){if(!this.isTransitioning||!this.currentScene||!this.targetScene||!this.camera){this.currentScene&&this.camera&&(this.renderer.setRenderTarget(null),this.renderer.render(this.currentScene,this.camera));return}this.renderer.setRenderTarget(this.renderTargetA),this.renderer.render(this.currentScene,this.camera),this.renderer.setRenderTarget(this.renderTargetB),this.renderer.render(this.targetScene,this.camera),this.transitionType===`fade`?this.fadeMaterial.uniforms.mixRatio.value=this.transitionProgress:this.transitionType===`crossfade`&&(this.crossfadeMaterial.uniforms.mixRatio.value=this.transitionProgress),this.renderer.setRenderTarget(null),this.renderer.render(this.blendScene,this.blendCamera)}getCurrentScene(){return this.currentScene}getIsTransitioning(){return this.isTransitioning}getProgress(){return this.transitionProgress}setCurrentScene(e){this.currentScene=e}setSize(e,t){this.renderTargetA.setSize(e,t),this.renderTargetB.setSize(e,t)}dispose(){this.renderTargetA.dispose(),this.renderTargetB.dispose(),this.fadeMaterial.dispose(),this.crossfadeMaterial.dispose()}},ri=class{renderer;composer;currentScene=null;targetScene=null;camera=null;transitionProgress=0;transitionDuration=1e3;transitionStartTime=0;isTransitioning=!1;transitionType=null;easingFunction;renderPass;bloomPass;glitchPass;blurPass;fadePass;maxBloomStrength=3;maxBlurAmount=10;maxGlitchIntensity=1;fadeColor=new c.Color(0);onUpdateCallback;onCompleteCallback;constructor(e,t,n){this.renderer=e,this.composer=t,this.easingFunction=h.cubicInOut,this.renderPass=t.passes.find(e=>e.constructor.name===`RenderPass`),n&&this.createDefaultPasses(n)}createDefaultPasses(e){try{let t={uniforms:{tDiffuse:{value:null},kernelSize:{value:0},resolution:{value:new c.Vector2(this.renderer.domElement.width,this.renderer.domElement.height)}},vertexShader:Yr.vertexShader,fragmentShader:Yr.fragmentShader};this.blurPass=new e(t),this.blurPass.enabled=!1,this.composer.addPass(this.blurPass);let n={uniforms:{tDiffuse:{value:null},fadeAmount:{value:0},fadeColor:{value:new c.Color(0)}},vertexShader:Z.vertexShader,fragmentShader:Z.fragmentShader};this.fadePass=new e(n),this.fadePass.enabled=!1,this.composer.addPass(this.fadePass)}catch(e){console.warn(`SceneTransitionFX: Could not create default passes:`,e)}}setBloomPass(e){this.bloomPass=e}setGlitchPass(e){this.glitchPass=e}setBlurPass(e){this.blurPass=e}setFadePass(e){this.fadePass=e}bloom(e,t,n,r={}){if(!this.bloomPass){console.warn(`SceneTransitionFX: Bloom pass not set. Call setBloomPass() first.`);return}this.maxBloomStrength=r.maxBloom??3,this.startTransition(e,t,n,`bloom`,r),this.bloomPass.enabled=!0}blur(e,t,n,r={}){if(!this.blurPass){console.warn(`SceneTransitionFX: Blur pass not set. Call setBlurPass() first.`);return}this.maxBlurAmount=r.maxBlur??10,this.startTransition(e,t,n,`blur`,r),this.blurPass.enabled=!0}fade(e,t,n,r={}){if(!this.fadePass){console.warn(`SceneTransitionFX: Fade pass not set. Call setFadePass() first.`);return}r.color!==void 0&&(this.fadeColor.set(r.color),this.fadePass.uniforms.fadeColor.value.copy(this.fadeColor)),this.startTransition(e,t,n,`fade`,r),this.fadePass.enabled=!0}glitch(e,t,n,r={}){if(!this.glitchPass){console.warn(`SceneTransitionFX: Glitch pass not set. Call setGlitchPass() first.`);return}this.maxGlitchIntensity=r.maxIntensity??1,this.startTransition(e,t,n,`glitch`,r),this.glitchPass.enabled=!0}startTransition(e,t,n,r,i){this.currentScene=e,this.targetScene=t,this.camera=n,this.transitionType=r,this.transitionDuration=i.duration??1e3,this.transitionStartTime=performance.now(),this.transitionProgress=0,this.isTransitioning=!0,this.onUpdateCallback=i.onUpdate,this.onCompleteCallback=i.onComplete,i.easing&&(typeof i.easing==`string`?this.easingFunction=h[i.easing]:this.easingFunction=i.easing),this.renderPass&&(this.renderPass.scene=e,this.renderPass.camera=n)}update(){if(!this.isTransitioning)return;let e=performance.now()-this.transitionStartTime,t=Math.min(e/this.transitionDuration,1);if(this.transitionProgress=this.easingFunction(t),this.transitionType===`bloom`&&this.bloomPass){let e=1-Math.abs(this.transitionProgress*2-1);this.bloomPass.strength=e*this.maxBloomStrength}else if(this.transitionType===`blur`&&this.blurPass){let e=1-Math.abs(this.transitionProgress*2-1);this.blurPass.uniforms.kernelSize.value=e*this.maxBlurAmount}else if(this.transitionType===`fade`&&this.fadePass){let e=this.transitionProgress<.5?this.transitionProgress*2:2-this.transitionProgress*2;this.fadePass.uniforms.fadeAmount.value=e}else if(this.transitionType===`glitch`&&this.glitchPass){let e=1-Math.abs(this.transitionProgress*2-1);this.glitchPass.enabled=e>.3}this.transitionProgress>=.5&&this.renderPass&&this.renderPass.scene===this.currentScene&&(this.renderPass.scene=this.targetScene),this.onUpdateCallback&&this.onUpdateCallback(this.transitionProgress),t>=1&&(this.isTransitioning=!1,this.currentScene=this.targetScene,this.targetScene=null,this.renderPass&&this.currentScene&&(this.renderPass.scene=this.currentScene),this.bloomPass&&(this.bloomPass.enabled=!1,this.bloomPass.strength=0),this.blurPass&&(this.blurPass.enabled=!1,this.blurPass.uniforms.kernelSize.value=0),this.fadePass&&(this.fadePass.enabled=!1,this.fadePass.uniforms.fadeAmount.value=0),this.glitchPass&&(this.glitchPass.enabled=!1),this.onCompleteCallback&&this.onCompleteCallback())}render(){this.composer.render()}getCurrentScene(){return this.currentScene}getIsTransitioning(){return this.isTransitioning}getProgress(){return this.transitionProgress}setCurrentScene(e){this.currentScene=e,this.renderPass&&(this.renderPass.scene=e)}setSize(e,t){this.composer.setSize(e,t),this.blurPass&&this.blurPass.uniforms&&this.blurPass.uniforms.resolution&&this.blurPass.uniforms.resolution.value.set(e,t)}dispose(){}};function ii(e,t){if(e.length===0)throw Error(`No objects provided for alignment.`);let n=new c.Box3,r=new c.Vector3,i=e.map(e=>(n.setFromObject(e),e.getWorldPosition(r),{object:e,boundingBox:n.clone(),worldPosition:r.clone()})),a=i.reduce((e,{boundingBox:n})=>{switch(t){case j.LEFT:return Math.min(e,n.min.x);case j.RIGHT:return Math.max(e,n.max.x);case j.BOTTOM:return Math.min(e,n.min.y);case j.TOP:return Math.max(e,n.max.y);case j.BACK:return Math.min(e,n.min.z);case j.FRONT:return Math.max(e,n.max.z);default:throw Error(`Unsupported side type: ${t}`)}},t===j.RIGHT||t===j.TOP||t===j.FRONT?-1/0:1/0);i.forEach(({object:e,boundingBox:n})=>{switch(t){case j.LEFT:e.position.x+=a-n.min.x;break;case j.RIGHT:e.position.x+=a-n.max.x;break;case j.BOTTOM:e.position.y+=a-n.min.y;break;case j.TOP:e.position.y+=a-n.max.y;break;case j.BACK:e.position.z+=a-n.min.z;break;case j.FRONT:e.position.z+=a-n.max.z;break}})}function ai(e,t=w.RIGHT,n=0){let r=t.clone().normalize(),i=new c.Vector3,a=new c.Box3;e.forEach(e=>{a.setFromObject(e);let t=new c.Vector3(a.max.x-a.min.x,a.max.y-a.min.y,a.max.z-a.min.z).dot(r),o=new c.Vector3;a.getCenter(o);let s=r.clone().multiplyScalar(t/2);e.position.copy(i.clone().add(s).sub(o).add(e.position)),i.add(r.clone().multiplyScalar(t+n))})}function oi(e,t,n=new c.Vector3(0,0,0)){let r=new c.Box3().setFromObject(e);if(r.isEmpty())console.warn(`The object has no geometry or is not visible.`);else{let i=r.min,a=new c.Vector3((i.x+r.max.x)/2,i.y,(i.z+r.max.z)/2);e.localToWorld(a);let o=t.clone().sub(a).add(n),s=e.worldToLocal(o.clone());e.position.add(s)}}function si(e,t){let n=new c.Box3().setFromBufferAttribute(new c.Float32BufferAttribute(e.attributes.position.array,3));if(n.isEmpty())console.warn(`The geometry is empty or invalid.`);else{let r=n.min.y;e.translate(0,t-r,0)}}function ci(e,t,n=new c.Vector3(0,0,0)){let r=new c.Box3().setFromObject(e);if(r.isEmpty())console.warn(`The InstancedMesh has no geometry or is not visible.`);else{let i=r.min.y,a=new c.Vector3(0,t.y-i,0).add(n),o=e.worldToLocal(a.clone());e.position.add(o)}}function li(e,t,n,r=new c.Vector3(0,0,0)){let i=new c.Box3().setFromObject(e);if(i.isEmpty())console.warn(`The instanced mesh has invalid geometry.`);else{let a=i.min.y,o=new c.Matrix4;e.getMatrixAt(n,o);let s=new c.Vector3,l=new c.Quaternion,u=new c.Vector3;o.decompose(s,l,u),s.y=e.worldToLocal(t.clone()).y-a+r.y,o.compose(s,l,u),e.setMatrixAt(n,o),e.instanceMatrix.needsUpdate=!0}}function ui(e,t=new c.Vector3(0,0,0),n=new c.Vector3(0,0,0)){let r=new c.Box3().setFromObject(e).getCenter(new c.Vector3),i=new c.Vector3().addVectors(t,n),a=new c.Vector3().subVectors(i,r);e.position.add(a)}function di(e,t=new c.Vector3(0,0,0),n=new c.Vector3(0,0,0)){let r=new c.Box3().setFromObject(e).getCenter(new c.Vector3),i=new c.Vector3().addVectors(t,n);e.translateX(i.x-r.x),e.translateY(i.y-r.y),e.translateZ(i.z-r.z),e.updateMatrixWorld(!0)}function fi(e,t=new c.Vector3(0,0,0),n=new c.Vector3(0,0,0)){e.geometry.computeBoundingBox();let r=e.geometry.boundingBox;if(r){let i=r.getCenter(new c.Vector3),a=new c.Vector3().addVectors(t,n),o=new c.Vector3().subVectors(a,i);e.geometry.translate(o.x,o.y,o.z)}}var pi={object:ui,objectGeometry:di,meshGeometry:fi};function mi(e){let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]}function hi(e){let[t,n,r]=$(e);return bi(t,n,r)}function $(e){return[e>>16&255,e>>8&255,e&255]}function gi(e,t,n){t/=100,n/=100;function r(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}let i,a,o;if(t===0)i=a=o=n;else{let s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;i=r(c,s,e/360+1/3),a=r(c,s,e/360),o=r(c,s,e/360-1/3)}let s=e=>Math.round(e*255);return[s(i),s(a),s(o)]}function _i(e,t,n){t/=100,n/=100;let r=t=>(t+e/30)%12,i=t*Math.min(n,1-n),a=e=>n-i*Math.max(-1,Math.min(r(e)-3,Math.min(9-r(e),1)));return[a(0)*255,a(8)*255,a(4)*255]}function vi(e,t,n){return[e/255,t/255,n/255]}function yi(e,t,n){return e=Math.round(e),t=Math.round(t),n=Math.round(n),(e<<16)+(t<<8)+n}function bi(e,t,n){e/=255,t/=255,n/=255;let r=Math.max(e,t,n),i=Math.min(e,t,n),a=r-i,o=0,s=0,c=(r+i)/2;a!==0&&(r===e?o=((t-n)/a+(t<n?6:0))*60:r===t?o=((n-e)/a+2)*60:r===n&&(o=((e-t)/a+4)*60)),a!==0&&(s=a/(1-Math.abs(2*c-1))),o=Math.round(o),s=Math.round(s*100);let l=Math.round(c*100);return[o,s,l]}function xi(e,t){return Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2)}function Si(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])+Math.abs(e[2]-t[2])}function Ci(e,t){let n=$(e),r=null,i=1/0;for(let e of t){let t=xi(n,$(e));t<i&&(i=t,r=e)}return r}function wi(e,t){let n=$(e),r=null,i=1/0;for(let e of t){let t=Si(n,$(e));t<i&&(i=t,r=e)}return r}function Ti(e){return _i((e+Math.floor(-30+Math.random()*61))%360,Math.floor(60+Math.random()*21),Math.floor(50+Math.random()*21))}function Ei(e,t){if(!t.geometry.isBufferGeometry)throw Error(`Mesh must have a BufferGeometry.`);let n=t.geometry.getAttribute(`position`),r=new c.Vector3,i=new c.Vector3,a=1/0;for(let t=0;t<n.count;t++){i.fromBufferAttribute(n,t);let o=i.distanceTo(e);o<a&&(a=o,r.copy(i))}return t.localToWorld(r),r}function Di(e,t,n){return Math.max(0,Math.min(1,(e-t)/(n-t)))}function Oi(e,t,n,r,i,a=20,o=0,s=1){let l=[];for(let u=0;u<=a;u++){let d=u/a,f=t+e(Di(d,o,s))*(n-t),p=r+d*(i-r);l.push(new c.Vector2(f,p))}return l}var ki=(e,t,n,r,i=24)=>{let a=[];for(let o=0;o<=i;o++){let s=o/i,l=M.cubic(s,e.x,t.x,n.x,r.x),u=M.cubic(s,e.y,t.y,n.y,r.y);a.push(new c.Vector2(l,u))}return a},Ai=(e,t,n,r=24)=>{let i=[];for(let a=0;a<=r;a++){let o=a/r,s=M.damped(o,n)*(t.x-e.x)+e.x,l=e.y+o*(t.y-e.y);i.push(new c.Vector2(s,l))}return i},ji=(e,t,n,r,i=24)=>{let a=[];for(let o=0;o<=i;o++){let s=o/i,l=M.exponential(s,n,r)*(t.x-e.x)+e.x,u=e.y+s*(t.y-e.y);a.push(new c.Vector2(l,u))}return a},Mi=(e,t,n,r,i=24)=>{let a=[];for(let o=0;o<=i;o++){let s=o/i,l=M.logarithmic(s,n,r)*(t.x-e.x)+e.x,u=e.y+s*(t.y-e.y);a.push(new c.Vector2(l,u))}return a},Ni=(e,t,n,r,i,a=24)=>{let o=[];for(let s=0;s<=a;s++){let l=s/a,u=n*l*l+r*l+i+e.x,d=e.y+l*(t.y-e.y);o.push(new c.Vector2(u,d))}return o},Pi=(e,t,n,r=24)=>{let i=[];for(let a=0;a<=r;a++){let o=a/r,s=M.quadratic(o,e.x,t.x,n.x),l=M.quadratic(o,e.y,t.y,n.y);i.push(new c.Vector2(s,l))}return i},Fi=(e,t,n,r=24)=>{let i=[];for(let a=0;a<=r;a++){let o=a/r,s=M.sigmoid(o,n)*(t.x-e.x)+e.x,l=e.y+o*(t.y-e.y);i.push(new c.Vector2(s,l))}return i},Ii={createCubicCurvePoints:ki,createDampedCurvePoints:Ai,createExponentialCurvePoints:ji,createLogarithmicCurvePoints:Mi,createParabolicCurvePoints:Ni,createQuadraticCurvePoints:Pi,createSigmoidCurvePoints:Fi};function Li(e,t,n,r,i,a=[0,0],o=[1,0],s=[0,1],c=[1,1]){let l=i||Ri(e,t,n);return[{pos:e,norm:l,uv:a},{pos:t,norm:l,uv:o},{pos:r,norm:l,uv:c},{pos:e,norm:l,uv:a},{pos:r,norm:l,uv:c},{pos:n,norm:l,uv:s}]}function Ri(e,t,n){let r=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],i=[n[0]-e[0],n[1]-e[1],n[2]-e[2]],a=[r[1]*i[2]-r[2]*i[1],r[2]*i[0]-r[0]*i[2],r[0]*i[1]-r[1]*i[0]],o=Math.sqrt(a[0]**2+a[1]**2+a[2]**2);return a.map(e=>e/o)}function zi(e,t,n){let r=t+Math.random()*(n-t);return setTimeout(e,r)}function Bi(e,t,n){let r;function i(){let a=t+Math.random()*(n-t);r=setTimeout(()=>{e(),i()},a)}return i(),()=>clearTimeout(r)}function Vi(e,t){return e.map(([e,n,r])=>{switch(t){case`x`:return[n,r];case`y`:return[e,r];case`z`:return[e,n];default:throw Error(`Invalid axis: ${t}`)}})}function Hi(e){let[t,n,r]=e,i=Math.abs(t),a=Math.abs(n),o=Math.abs(r);return i>=a&&i>=o?[r>0?r:-r,n]:a>=i&&a>=o?[t,r>0?r:-r]:[t,n]}function Ui(e){return e.map(e=>Hi(e))}function Wi(e){return e.map(([e,t,n])=>{let r=Math.atan2(n,e),i=Math.acos(t/Math.sqrt(e**2+t**2+n**2));return[r/(2*Math.PI)+.5,1-i/Math.PI]})}function Gi(e){return e.map(([e,t,n])=>[Math.atan2(n,e)/(2*Math.PI)+.5,t])}function Ki(e){return e.map(([e,t,n])=>{let r=Math.sqrt(e**2+n**2);return[Math.atan2(n,e)/(2*Math.PI)+.5,r]})}function qi(e,t,n,r,i){return[(e[0]-t)/(n-t),(e[1]-r)/(i-r)]}function Ji(e,t,n){let[r,i]=t,[a,o]=n;return e.map(e=>qi(e,r,a,i,o))}function Yi(e){let t=Math.min(...e.map(e=>e[0])),n=Math.max(...e.map(e=>e[0])),r=Math.min(...e.map(e=>e[1])),i=Math.max(...e.map(e=>e[1]));return{minBounds:[t,r],maxBounds:[n,i]}}exports.ArchedDiamondLatticeWindow=qn,exports.ArchedDiamondLatticeWindowGeometry=Tt,exports.AtmosphericSkybox=Zr,exports.Axis=A,exports.Bone=Br,exports.BoneGeometry=En,exports.Book=Qn,exports.BookGeometry=L,exports.Bookshelf=ur,exports.BookshelfGeometry=ln,exports.Boulder=vr,exports.BoulderGeometry=Ye,exports.BoxSide=j,exports.BunsenBurner=xr,exports.Burst=Fr,exports.BurstGeometry=je,exports.BurstShape=Ae,exports.CameraPlayback=m,exports.CameraTransition=ti,exports.Candle=pr,exports.CandleGeometry=pn,exports.Center=pi,exports.ColorPalette=ne,exports.CrossHeadstone=nr,exports.CrossHeadstoneGeometry=en,exports.DaySkybox=Qr,exports.Desk=dr,exports.DeskGeometry=un,exports.DiamondLatticeWindow=Jn,exports.DiamondLatticeWindowGeometry=Et,exports.Direction=w,exports.DustMotesEffect=pe,exports.Easing=h,exports.EffervescenceEffect=me,exports.ElectricPanel=Sr,exports.EllipticLeafGeometry=Ee,exports.EmissivePulseEffect=he,exports.ErlenmeyerFlask=Cr,exports.ErlenmeyerFlaskGeometry=Dn,exports.Falloff=T,exports.Flame=mr,exports.FlameFlickerEffect=ge,exports.FlameGeometry=fn,exports.FlorenceFlask=wr,exports.FlorenceFlaskGeometry=In,exports.Gear=Ir,exports.GearGeometry=xn,exports.GearShape=bn,exports.GlowHalo=ve,exports.GregorianLatticeWindow=Yn,exports.GregorianLatticeWindowGeometry=kt,exports.GroundFogEffect=ye,exports.HangingLantern=hr,exports.HangingLanternGeometry=_n,exports.Heart=Lr,exports.HeartGeometry=Cn,exports.HeartShape=Sn,exports.Hexagon=Rr,exports.HexagonGeometry=V,exports.HexagonShape=Ze,exports.Jar=$n,exports.JarGeometry=Jt,exports.LShapedStaircase=Un,exports.LShapedStaircaseGeometry=Gt,exports.Lantern=_r,exports.LanternGeometry=mn,exports.Leaf=fr,exports.LeafGeometry=dn,exports.LeverPanel=Tr,exports.LightningEffect=Te,exports.LineEquations=Zt,exports.Mausoleum=rr,exports.MausoleumGeometry=tn,exports.Microscope=Er,exports.MortarAndPestle=Dr,exports.MortarGeometry=Ln,exports.MossyRock=yr,exports.MossyRockGeometry=et,exports.NightSkybox=$r,exports.ObeliskHeadstone=ir,exports.ObeliskHeadstoneGeometry=nn,exports.Panel=Or,exports.PanelLight=kr,exports.ParallelogramBoxGeometry=yn,exports.ParametricCurve=M,exports.ParametricCurveUtils=Ii,exports.PetalDriftEffect=De,exports.PotionBottle=er,exports.PotionBottleGeometry=Qt,exports.RING_LATTICE_SPACING_FACTOR=At,exports.RainEffect=ke,exports.Random=le,exports.RingLatticeWindow=Zn,exports.Rock=br,exports.RockGeometry=nt,exports.RoundedHeadstone=ar,exports.RoundedHeadstoneGeometry=rn,exports.SceneTransition=ni,exports.SceneTransitionFX=ri,exports.SpiralStaircase=Wn,exports.SpiralStaircaseGeometry=Kt,exports.SpiralTube=Ar,exports.SquareHeadstone=or,exports.SquareHeadstoneGeometry=an,exports.Staircase=Gn,exports.StaircaseGeometry=qt,exports.Stand=jr,exports.StandGeometry=Rn,exports.Star=zr,exports.StarFieldEffect=Ie,exports.StarGeometry=Tn,exports.StarShape=wn,exports.StoneFencePost=sr,exports.StoneFencePostGeometry=on,exports.TerrainMound=Hr,exports.TerrainMoundGeometry=Bn,exports.TerrainPlane=Ur,exports.TerrainPlaneGeometry=Vn,exports.TeslaCoil=Mr,exports.TeslaCoilGeometry=zn,exports.TestTube=Nr,exports.TestTubeGeometry=q,exports.TestTubeRack=Pr,exports.Tree=Vr,exports.TreeGeometry=Hn,exports.WallSconce=gr,exports.WallSconceGeometry=vn,exports.WineBottle=tr,exports.WineBottleGeometry=$t,exports.WispEffect=Le,exports.WroughtIronBar=cr,exports.WroughtIronBarGeometry=sn,exports.WroughtIronFence=lr,exports.WroughtIronFenceGeometry=cn,exports.addInstanceColor=Wr,exports.addNoiseDisplacement=qr,exports.addWaterDisplacement=Gr,exports.alignBufferGeometryToSurface=si,exports.alignInstancedMeshIndexToSurface=li,exports.alignInstancedMeshToSurface=ci,exports.alignObjectToSurface=oi,exports.alignToEdge=ii,exports.alignToRow=ai,exports.appendSphericalCurve=Fn,exports.applySnapshot=f,exports.archedOpeningMetrics=U,exports.atmosphericShader=J,exports.blurTransitionShader=Yr,exports.buildArchedDiamondLatticeCameParts=St,exports.buildArchedDiamondLatticeFrameGeometry=ht,exports.buildArchedDiamondLatticeParts=Ct,exports.buildDiamondLatticeCameParts=dt,exports.buildDiamondLatticeParts=ut,exports.buildGregorianLatticeParts=Ot,exports.buildRingLatticeFrameParts=Ft,exports.calculateChannelDifference=Si,exports.calculateDistance=xi,exports.calculateNormal=Ri,exports.calculateUVBounds=Yi,exports.calculateXFromSlopeIntercept=Yt,exports.calculateYFromSlopeIntercept=Xt,exports.capHeightFromRadius=An,exports.capWidthFromRadius=jn,exports.captureSnapshot=d,exports.cartesianToSpherical=Pn,exports.centerMeshGeometry=fi,exports.centerObject=ui,exports.centerObjectGeometry=di,exports.checkerboardTexture=ei,exports.clipSegmentToAabb=ft,exports.clipSegmentToArchedOpening=yt,exports.createCubicCurvePoints=ki,exports.createDampedCurvePoints=Ai,exports.createDollyClip=b,exports.createExponentialCurvePoints=ji,exports.createFlythroughClip=y,exports.createHexagonalTilesByCount=Qe,exports.createHexagonalTilesByRadius=$e,exports.createLogarithmicCurvePoints=Mi,exports.createOpeningClippingPlanes=jt,exports.createOrbitClip=_,exports.createParabolicCurvePoints=Ni,exports.createPendulumClip=v,exports.createQuad=Li,exports.createQuadraticCurvePoints=Pi,exports.createRandom=N,exports.createRingLatticeGeometry=Pt,exports.createSigmoidCurvePoints=Fi,exports.createSpiralClip=x,exports.createWobbleClip=C,exports.createZoomClip=S,exports.crossfadeShader=Y,exports.cubicUVMapping=Hi,exports.cubicUVMappingBatch=Ui,exports.cylindricalUVMapping=Gi,exports.daySkyShader=X,exports.deriveSubSeed=ae,exports.diamondLatticeCellFromCount=lt,exports.diamondLatticeCornerSpan=ot,exports.diamondLatticeGridFromCells=st,exports.diamondLatticeSpringPhaseShift=gt,exports.displacementBrush=E,exports.fadeShader=Z,exports.fadeTransitionSceneShader=Xr,exports.findClosestColor=Ci,exports.findClosestColorChannelWise=wi,exports.findClosestPoint=Ei,exports.fitDiamondLatticeCell=ct,exports.flattenBrush=D,exports.getAnalogousColors=Ti,exports.gregorianLatticeGridFromCells=Dt,exports.hexToHsl=hi,exports.hexToRgb=$,exports.hslToHex=gi,exports.hslToRgb=_i,exports.insetArchedOpeningMetrics=pt,exports.interpolateCurve=Oi,exports.logarithmicRandomMax=de,exports.logarithmicRandomMin=fe,exports.mulberry32=re,exports.nightSkyShader=Q,exports.noiseBrush=O,exports.normalizeRgb=vi,exports.normalizeUV=qi,exports.normalizeUVBatch=Ji,exports.parseHexCode=mi,exports.planarUVMapping=Vi,exports.polarUVMapping=Ki,exports.radiusFromCapHeight=On,exports.radiusFromCapWidth=kn,exports.randomFloat=F,exports.randomInteger=ue,exports.randomPick=ce,exports.randomRange=se,exports.randomTransformVertices=tt,exports.resolveRingLatticeCell=Mt,exports.rgbToHex=yi,exports.rgbToHsl=bi,exports.ringLatticeSpots=Nt,exports.rowOfBooksByCount=He,exports.rowOfBooksByLength=Ue,exports.rowOfBooksByScales=Ve,exports.scatterBoulders=Xe,exports.scatterMossyRocks=at,exports.scatterRocks=it,exports.setRandomInterval=Bi,exports.setRandomTimeout=zi,exports.smoothBrush=k,exports.sphericalToCartesian=Nn,exports.sphericalUVMapping=Wi,exports.spikeBrush=ee,exports.splitmix32=ie,exports.stackOfBooks=We,exports.thetaLengthForRadius=Mn,exports.traceArchedOpeningOutline=W,exports.twistBrush=te,exports.updateNoiseDisplacementTime=Jr,exports.updateWaterDisplacementTime=Kr;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("three"),t=require("three/tsl"),n=require("three/webgpu"),r=require("three/addons/utils/BufferGeometryUtils.js"),i=require("three/addons/geometries/ParametricGeometry.js");function a(t,n){let r=n?.target.clone()??new e.Vector3;if(!n){let n=new e.Vector3;t.getWorldDirection(n),r.copy(t.position).add(n)}return{position:t.position.clone(),quaternion:t.quaternion.clone(),fov:t.fov,target:r}}function o(e,t,n){e.position.copy(n.position),e.quaternion.copy(n.quaternion),e.fov=n.fov,e.updateProjectionMatrix(),t&&(t.target.copy(n.target),t.update())}function s(e,t){return t(Math.min(1,e.elapsed/e.duration))}var c=class{camera;controls;active=null;elapsed=0;focus=new e.Vector3;rest;constructor(e,t){this.camera=e,this.controls=t;let n=a(e,t);this.focus.copy(n.target),this.rest=n}get isPlaying(){return this.active!==null}setRest(){this.rest=a(this.camera,this.controls)}setRestSnapshot(e){this.rest={position:e.position.clone(),quaternion:e.quaternion.clone(),fov:e.fov,target:e.target.clone()}}play(e){this.cancelActive(),o(this.camera,this.controls,this.rest),this.active=e,this.elapsed=0,this.controls&&(this.controls.enabled=!1),e.start(this.runtime())}stop(){this.cancelActive(),o(this.camera,this.controls,this.rest),this.controls&&(this.controls.enabled=!0,this.controls.update())}reset(){this.stop()}update(e){this.active&&(this.elapsed+=e,this.active.update(this.runtime(),e)===`complete`&&(this.active=null,this.elapsed=0,this.controls&&(this.controls.target.copy(this.focus),this.controls.enabled=!0,this.controls.update())))}dispose(){this.stop()}cancelActive(){this.active&&(this.active.cancel?.(this.runtime()),this.active=null,this.elapsed=0)}runtime(){return{camera:this.camera,controls:this.controls??null,elapsed:this.elapsed,duration:this.active?.duration??0,focus:this.focus}}},l={sineIn:e=>1-Math.cos(e*Math.PI/2),sineOut:e=>Math.sin(e*Math.PI/2),sineInOut:e=>-.5*(Math.cos(Math.PI*e)-1),quadIn:e=>e*e,quadOut:e=>1-(1-e)**2,quadInOut:e=>e<.5?2*e*e:1-(-2*e+2)**2/2,cubicIn:e=>e*e*e,cubicOut:e=>1-(1-e)**3,cubicInOut:e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,quartIn:e=>e*e*e*e,quartOut:e=>1-(1-e)**4,quartInOut:e=>e<.5?8*e*e*e*e:1-(-2*e+2)**4/2,quintIn:e=>e*e*e*e*e,quintOut:e=>1-(1-e)**5,quintInOut:e=>e<.5?16*e*e*e*e*e:1-(-2*e+2)**5/2,expoIn:e=>e===0?0:2**(10*e-10),expoOut:e=>e===1?1:1-2**(-10*e),expoInOut:e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2,circIn:e=>1-Math.sqrt(1-e**2),circOut:e=>Math.sqrt(1-(e-1)**2),circInOut:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2,linear:e=>e,smoothstep:e=>e*e*(3-2*e),concave:e=>1-(1-e)**.3,convex:e=>e**.3,logarithmic:e=>Math.log(Math.max(.01,e))/Math.log(2),squareRoot:e=>Math.sqrt(e),inverse:e=>1-e,gaussian:e=>Math.exp(-((e-.5)**2)/(2*.5))},u=new e.Vector3;new e.Vector3;function d(t){let{target:n,duration:r,ease:i=l.smoothstep,revolutions:a=1}=t,o={value:0},c={value:t.radius??10},d={value:t.elevation??.4};return{label:`Orbit`,duration:r,start(r){r.focus.copy(n),u.subVectors(r.camera.position,n),c.value=t.radius??u.length(),d.value=t.elevation??Math.asin(e.MathUtils.clamp(u.y/c.value,-1,1)),o.value=Math.atan2(u.z,u.x)},update(e){let t=s(e,i);if(t>=1)return`complete`;let r=o.value+t*Math.PI*2*a,l=c.value*Math.cos(d.value);return e.camera.position.set(n.x+l*Math.cos(r),n.y+c.value*Math.sin(d.value),n.z+l*Math.sin(r)),e.camera.lookAt(e.focus),`running`}}}function f(t){let{target:n,duration:r,azimuthAmplitude:i=.14,oscillations:a=2,ease:o=l.linear}=t,c={value:0},d={value:t.distance??8},f={value:.35};return{label:`Pendulum`,duration:r,start(r){r.focus.copy(n),u.subVectors(r.camera.position,n),d.value=t.distance??u.length(),f.value=Math.asin(e.MathUtils.clamp(u.y/d.value,-1,1)),c.value=Math.atan2(u.z,u.x)},update(e){let t=s(e,o);if(t>=1)return`complete`;let r=Math.sin(t*Math.PI*2*a)*i,l=c.value+r,u=d.value*Math.cos(f.value);return e.camera.position.set(n.x+u*Math.cos(l),n.y+d.value*Math.sin(f.value),n.z+u*Math.sin(l)),e.camera.lookAt(e.focus),`running`}}}function p(e){let{waypoints:t,duration:n,ease:r=l.cubicInOut}=e;if(t.length<2)throw Error(`Flythrough clip requires at least two waypoints`);let i=e.lookAt??t.slice(1).concat(t[t.length-1]),a=t.length-1;return{label:`Flythrough`,duration:n,start(e){e.focus.copy(i[0]??t[0]),e.camera.position.copy(t[0]),e.camera.lookAt(e.focus)},update(e){let n=s(e,l.linear);if(n>=1)return e.camera.position.copy(t[t.length-1]),e.focus.copy(i[i.length-1]??t[t.length-1]),e.camera.lookAt(e.focus),`complete`;let o=n*a,c=Math.min(a-1,Math.floor(o)),u=r(o-c);e.camera.position.lerpVectors(t[c],t[c+1],u);let d=i[c]??t[c+1],f=i[c+1]??t[c+1];return e.focus.lerpVectors(d,f,u),e.camera.lookAt(e.focus),`running`}}}function m(t){let{distance:n,duration:r,ease:i=l.cubicInOut}=t,a=new e.Vector3,o=new e.Vector3,c=new e.Vector3;return{label:`Dolly`,duration:r,start(e){a.copy(e.camera.position),e.camera.getWorldDirection(c),o.copy(a).addScaledVector(c,n),e.focus.copy(e.controls?.target??a).addScaledVector(c,10)},update(e){let t=s(e,i);return t>=1?(e.camera.position.copy(o),`complete`):(e.camera.position.lerpVectors(a,o,t),e.camera.lookAt(e.focus),`running`)}}}function h(t){let{target:n,radius:r,endRadius:i=r,height:a,revolutions:o,duration:c,ease:d=l.smoothstep}=t,f={value:0},p={value:0};return{label:`Spiral`,duration:c,start(e){e.focus.copy(n),f.value=e.camera.position.y,u.subVectors(e.camera.position,n),p.value=Math.atan2(u.z,u.x)},update(t){let c=s(t,d);if(c>=1)return`complete`;let l=p.value+c*Math.PI*2*o,u=e.MathUtils.lerp(r,i,c);return t.camera.position.set(n.x+u*Math.cos(l),f.value+a*c,n.z+u*Math.sin(l)),t.camera.lookAt(t.focus),`running`}}}function g(t){let{target:n,endFov:r,duration:i,ease:a=l.cubicInOut}=t,o={value:75};return{label:`Zoom`,duration:i,start(e){e.focus.copy(n),o.value=e.camera.fov},update(t){let n=s(t,a);return t.camera.fov=e.MathUtils.lerp(o.value,r,Math.min(1,n)),t.camera.updateProjectionMatrix(),t.camera.lookAt(t.focus),n>=1?`complete`:`running`},cancel(e){e.camera.fov=o.value,e.camera.updateProjectionMatrix()}}}function _(t){let{intensity:n,duration:r,ease:i=l.linear}=t,a=new e.Vector3,o={value:0};return{label:`Wobble`,duration:r,start(e){a.copy(e.camera.position),o.value=e.camera.position.x*17.3+e.camera.position.z*9.1},update(e){let t=s(e,i);if(t>=1)return e.camera.position.copy(a),`complete`;let r=1-t,c=e.elapsed*28+o.value;return e.camera.position.set(a.x+Math.sin(c*1.7)*n*r,a.y+Math.sin(c*2.3)*n*.6*r,a.z+Math.cos(c*1.9)*n*r),`running`},cancel(e){e.camera.position.copy(a)}}}var v={UP:new e.Vector3(0,1,0),DOWN:new e.Vector3(0,-1,0),LEFT:new e.Vector3(-1,0,0),RIGHT:new e.Vector3(1,0,0),FORWARD:new e.Vector3(0,0,1),BACKWARD:new e.Vector3(0,0,-1)},y={linear:(e,t)=>1-e/t,quadratic:(e,t)=>(1-e/t)**2,squareRoot:(e,t)=>(1-e/t)**.5,logarithmic:(e,t)=>Math.log(1+(t-e))/Math.log(1+t),sine:(e,t)=>Math.cos(e/t*Math.PI/2),exponential:(e,t)=>Math.exp(-e/t),cubic:(e,t)=>(1-e/t)**3,gaussian:(e,t)=>Math.exp(-(e**2)/(2*(t/3)**2)),inverse:(e,t)=>t/(t+e),smoothstep:(e,t)=>{let n=Math.max(0,Math.min(1,1-e/t));return n*n*(3-2*n)}},b=(t,n,r,i,a=v.UP,o=y.linear)=>{let s=t.attributes.position;for(let t=0;t<s.count;t++){let c=new e.Vector3;c.fromBufferAttribute(s,t);let l=c.distanceTo(n);if(l<r){let e=o(l,r)*i;c.add(a.clone().multiplyScalar(e)),s.setXYZ(t,c.x,c.y,c.z)}}s.needsUpdate=!0},x=(t,n,r,i,a,o=v.UP,s=y.linear)=>{let c=t.attributes.position;for(let t=0;t<c.count;t++){let l=new e.Vector3;l.fromBufferAttribute(c,t);let u=l.distanceTo(n);if(u<r){let e=s(u,r)*a,n=i-l.dot(o.normalize());l.add(o.clone().multiplyScalar(n*e)),c.setXYZ(t,l.x,l.y,l.z)}}c.needsUpdate=!0},S=(t,n,r,i,a=v.UP,o=y.linear)=>{let s=t.attributes.position;for(let t=0;t<s.count;t++){let c=new e.Vector3;c.fromBufferAttribute(s,t);let l=c.distanceTo(n);if(l<r){let n=i*o(l,r),u=a.clone().normalize();c.x+=e.MathUtils.randFloatSpread(n)*u.x,c.y+=e.MathUtils.randFloatSpread(n)*u.y,c.z+=e.MathUtils.randFloatSpread(n)*u.z,s.setXYZ(t,c.x,c.y,c.z)}}s.needsUpdate=!0},C=(t,n,r,i)=>{let a=t.attributes.position,o=new e.Vector3;for(let t=0;t<a.count;t++){let s=new e.Vector3;if(s.fromBufferAttribute(a,t),s.distanceTo(n)<r){let n=new e.Vector3,c=0;for(let e=0;e<a.count;e++)o.fromBufferAttribute(a,e),o.distanceTo(s)<r&&(n.add(o),c++);c>0&&(n.divideScalar(c),s.lerp(n,i),a.setXYZ(t,s.x,s.y,s.z))}}a.needsUpdate=!0},w=(t,n,r,i,a=!1,o=y.linear)=>{let s=t.attributes.position;for(let t=0;t<s.count;t++){let c=new e.Vector3;c.fromBufferAttribute(s,t);let l=c.distanceTo(n);if(l<r){let e=o(l,r)*i*(a?-1:1),u=c.clone().sub(n).normalize();c.add(u.multiplyScalar(e)),s.setXYZ(t,c.x,c.y,c.z)}}s.needsUpdate=!0},T=(t,n,r,i,a=v.UP,o=y.linear)=>{let s=t.attributes.position,c=new e.Quaternion;for(let t=0;t<s.count;t++){let l=new e.Vector3;l.fromBufferAttribute(s,t);let u=l.distanceTo(n);if(u<r){let e=o(u,r)*i;c.setFromAxisAngle(a,e),l.sub(n).applyQuaternion(c).add(n),s.setXYZ(t,l.x,l.y,l.z)}}s.needsUpdate=!0},E={X:new e.Vector3(1,0,0),Y:new e.Vector3(0,1,0),Z:new e.Vector3(0,0,1),XY:new e.Vector3(1,1,0).normalize(),XZ:new e.Vector3(1,0,1).normalize(),YZ:new e.Vector3(0,1,1).normalize(),XYZ:new e.Vector3(1,1,1).normalize()},D=function(e){return e.LEFT=`left`,e.RIGHT=`right`,e.TOP=`top`,e.BOTTOM=`bottom`,e.FRONT=`front`,e.BACK=`back`,e}({}),O={CADMIUM_RED:15073318,CARDINAL_RED:12981270,CHERRY_RED:14165028,CRIMSON:12986408,ALIZARIN_CRIMSON:11674146,DARK_RED:9109504,RUST:12731693,CORAL_ORANGE:16734003,TANGERINE:16733440,ORANGE_PEEL:16737792,CADMIUM_ORANGE:16744228,ORANGE:16753920,AMBER:16755200,CADMIUM_YELLOW:16766720,GOLD:16766720,YELLOW:16776960,LIME_GREEN:10798080,SPRING_GREEN:8965205,MOSS_GREEN:8956467,FERN_GREEN:4950843,FOREST_GREEN:2263842,SAP_GREEN:5274922,OLIVE_DRAB:5597999,VIRIDIAN_GREEN:43115,MINT_GREEN:8965290,AQUAMARINE:65450,PHTHALO_BLUE:3977,AETHER_BLUE:3447003,SKY_BLUE:8965375,CERULEAN_BLUE:6139362,AZURE:30719,OCEAN_BLUE:30654,ROYAL_BLUE:5592575,MIDNIGHT_BLUE:51,ULTRAMARINE_BLUE:4149685,COBALT_VIOLET:6950317,DEEP_VIOLET:11141375,CORAL_PINK:16724838,VIVID_MAGENTA:16720639,MAGENTA:16711935,HOT_PINK:16711850,PINK_SHERBET:16751052,SOFT_PINK:16762823,BURNT_SIENNA:15299665,BURNT_UMBER:9057060,SIENNA:9132587,SADDLE_BROWN:9127187,COFFEE_BROWN:6045747,DARK_UMBER:4929057,RAW_UMBER:8545860,YELLOW_OCHRE:12951919,RAW_SIENNA:13808780,TAUPE:9141627,ONYX:197379,CARBON:3026478,CHARCOAL:3355443,SLATE_GRAY:4210752,ASH_GRAY:4473924,GRAPHITE:5263440,STEEL_GRAY:5592405,DIM_GRAY:6908265,IRON:7829367,GRAY:8421504,STONE:8947848,SILVER:11184810,LIGHT_GRAY:13421772,PALE_GRAY:15658734,WHITE_SMOKE:16119285,TITANIUM_WHITE:16777215},k={cubic:(e,t,n,r,i)=>{let a=Math.max(0,Math.min(1,e)),o=1-a;return o*o*o*t+3*o*o*a*n+3*o*a*a*r+a*a*a*i},damped:(e,t=1)=>{let n=Math.max(.001,t);return(1-Math.exp(-n*e))/(1-Math.exp(-n))},exponential:(e,t=1,n=1)=>t*Math.max(0,Math.min(1,e))**+n,logarithmic:(e,t=1,n=1)=>t*Math.log(n*Math.max(.001,Math.min(1,e))+1),parabolic:(e,t=1,n=0,r=0)=>{let i=Math.max(0,Math.min(1,e));return t*i*i+n*i+r},quadratic:(e,t,n,r)=>{let i=Math.max(0,Math.min(1,e)),a=1-i;return a*a*t+2*a*i*n+i*i*r},sigmoid:(e,t=10)=>{let n=Math.max(0,Math.min(1,e));return 1/(1+Math.exp(-t*(n-.5)))},sinusoidal:e=>Math.sin(e*Math.PI*.5)};function A(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function j(e){let t=(e>>>0)+2654435769;return t=Math.imul(t^t>>>16,2246822507),t^=t>>>13,t=Math.imul(t^t>>>16,3266489909),(t^t>>>16)>>>0}function M(e,t){return j(e>>>0^t>>>0)}function ee(e,t){return{seeded:t,next:e,float(t=0,n=1){return t+(n-t)*e()},int(e=0,t=1){return Math.floor(this.float(e,t+1))},pick(e){if(!e.length)throw Error(`RandomSource.pick() requires a non-empty array`);return e[this.int(0,e.length-1)]},boolean(t=.5){return e()<t},skewMax(t=.5,n=0,r=1){return n+(r-n)*e()**+t},skewMin(t=.5,n=0,r=1){return n+(r-n)*(1-e())**t}}}function N(e){return e===void 0?ee(Math.random,!1):ee(A(e>>>0),!0)}function te(e,t,n){return t+(n-t)*e()}function ne(e,t){if(!t.length)throw Error(`randomPick() requires a non-empty array`);return t[Math.floor(e()*t.length)]}var re={create:N,mulberry32:A,splitmix32:j,deriveSubSeed:M,range:te,pick:ne},P=N();function F(e=0,t=1,n=P){return n.float(e,t)}function ie(e=0,t=1,n=P){return n.int(e,t)}function ae(e=.5,t=0,n=1,r=P){return r.skewMax(e,t,n)}function oe(e=.5,t=0,n=1,r=P){return r.skewMin(e,t,n)}var se=class extends e.InstancedMesh{width;height;depth;floorY;waft;scaleMin;scaleMax;px;py;pz;settle;twinkle;phase;dummy=new e.Object3D;clock=0;constructor(t={}){let{count:n=150,width:r=12,height:i=8,depth:a=12,floorY:o=0,color:s=`#aebfe6`,radius:c=.02,opacity:l=.9,material:u,settleMin:d=.1,settleMax:f=.35,waft:p=.08,scaleMin:m=.6,scaleMax:h=1.2,twinkleMin:g=.7,twinkleMax:_=1.6}=t,v=u??new e.MeshBasicMaterial({color:new e.Color(s),transparent:!0,opacity:l,blending:e.AdditiveBlending,depthWrite:!1,toneMapped:!1});super(new e.SphereGeometry(c,5,5),v,n),this.instanceMatrix.setUsage(e.DynamicDrawUsage),this.frustumCulled=!1,this.width=r,this.height=i,this.depth=a,this.floorY=o,this.waft=p,this.scaleMin=m,this.scaleMax=h,this.px=new Float32Array(n),this.py=new Float32Array(n),this.pz=new Float32Array(n),this.settle=new Float32Array(n),this.twinkle=new Float32Array(n),this.phase=new Float32Array(n);for(let e=0;e<n;e++)this.respawn(e,!0),this.settle[e]=F(d,f),this.twinkle[e]=F(g,_),this.phase[e]=F(0,Math.PI*2);this.writeMatrices()}update(e){this.clock+=e;for(let t=0;t<this.count;t++)this.py[t]-=this.settle[t]*e,this.px[t]+=Math.sin(this.clock*.3+this.phase[t])*this.waft*e,this.pz[t]+=Math.cos(this.clock*.24+this.phase[t])*this.waft*e,this.py[t]<this.floorY&&this.respawn(t,!1);this.writeMatrices()}dispose(){this.geometry.dispose();let e=Array.isArray(this.material)?this.material:[this.material];for(let t of e)t.dispose();return this}respawn(e,t){this.px[e]=F(-this.width*.5,this.width*.5),this.pz[e]=F(-this.depth*.5,this.depth*.5),this.py[e]=t?this.floorY+F(0,this.height):this.floorY+this.height}writeMatrices(){let e=this.dummy;for(let t=0;t<this.count;t++){let n=Math.abs(Math.sin(this.clock*this.twinkle[t]+this.phase[t])),r=this.scaleMin+(this.scaleMax-this.scaleMin)*n;e.position.set(this.px[t],this.py[t],this.pz[t]),e.scale.setScalar(r),e.updateMatrix(),this.setMatrixAt(t,e.matrix)}this.instanceMatrix.needsUpdate=!0}},ce=class extends e.InstancedMesh{width;height;depth;baseY;spread;px;py;pz;speed;dummy=new e.Object3D;constructor(t={}){let{count:n=24,width:r=1.5,height:i=3,depth:a=1.5,spread:o=.88,baseY:s=0,speedMin:c=.35,speedMax:l=.85,color:u=16777215,opacity:d=.6,emissiveIntensity:f=0,geometry:p=new e.SphereGeometry(.08,6,6),material:m}=t,h=m??new e.MeshStandardMaterial({color:u,emissive:u,emissiveIntensity:f,transparent:!0,opacity:d,roughness:.3,metalness:.1});super(p,h,n),this.instanceMatrix.setUsage(e.DynamicDrawUsage),this.frustumCulled=!1,this.width=r,this.height=i,this.depth=a,this.baseY=s,this.spread=Math.min(1,Math.max(0,o)),this.px=new Float32Array(n),this.py=new Float32Array(n),this.pz=new Float32Array(n),this.speed=new Float32Array(n);for(let e=0;e<n;e++)this.respawn(e,!0),this.speed[e]=F(c,l);this.writeMatrices()}update(e){let t=this.baseY+this.height;for(let n=0;n<this.count;n++)this.py[n]+=this.speed[n]*e,this.py[n]>t&&this.respawn(n,!1);this.writeMatrices()}dispose(){this.geometry.dispose();let e=Array.isArray(this.material)?this.material:[this.material];for(let t of e)t.dispose();return this}respawn(e,t){let n=this.width*.5*this.spread,r=this.depth*.5*this.spread;this.px[e]=F(-n,n),this.pz[e]=F(-r,r),this.py[e]=t?this.baseY+Math.random()*this.height:this.baseY+F(0,this.height*.15)}writeMatrices(){let e=this.dummy;for(let t=0;t<this.count;t++)e.position.set(this.px[t],this.py[t],this.pz[t]),e.updateMatrix(),this.setMatrixAt(t,e.matrix);this.instanceMatrix.needsUpdate=!0}},le=class{speed;minIntensity;maxIntensity;material;elapsed=0;constructor({material:e,speed:t=2,maxIntensity:n=.8,minIntensity:r=.2}){this.material=e,this.speed=t,this.maxIntensity=n,this.minIntensity=r}update(e){this.elapsed+=e;let t=Math.abs(Math.sin(this.elapsed*this.speed));this.material.emissiveIntensity=this.minIntensity+t*(this.maxIntensity-this.minIntensity)}},ue=class t{seed;light;lightIntensity;flame;halo;haloOpacity;flameColor=new e.Color;elapsed=0;constructor({seed:e=Math.random()*100,light:t,lightIntensity:n=4,flame:r,flameColor:i=16755268,halo:a,haloOpacity:o=.75}={}){this.seed=e,this.light=t,this.lightIntensity=n,this.flame=r,this.flameColor.set(i),this.halo=a,this.haloOpacity=o}static factor(e,t){return .8+.2*Math.sin(e*9+t)+.08*Math.sin(e*23+t*2)}get level(){return t.factor(this.elapsed,this.seed)}update(e){this.elapsed+=e;let n=t.factor(this.elapsed,this.seed);this.light&&(this.light.intensity=this.lightIntensity*n),this.flame&&this.flame.color.copy(this.flameColor).multiplyScalar(.8+.4*n),this.halo&&this.halo.setOpacity(this.haloOpacity*n)}faceCamera(e){this.halo?.faceCamera(e)}};function de(t){let n=document.createElement(`canvas`);n.width=n.height=128;let r=n.getContext(`2d`),i=`#${t.getHexString()}`,a=r.createRadialGradient(64,64,2,64,64,64);a.addColorStop(0,`${i}ff`),a.addColorStop(.25,`${i}aa`),a.addColorStop(1,`${i}00`),r.fillStyle=a,r.fillRect(0,0,128,128);let o=new e.CanvasTexture(n);return o.colorSpace=e.SRGBColorSpace,o}var fe=class extends e.Object3D{mesh;texture;baseColor;constructor({color:t=16755268,size:n=1.2,opacity:r=.75}={}){super(),this.baseColor=new e.Color(t),this.texture=de(this.baseColor);let i=new e.MeshBasicMaterial({map:this.texture,color:this.baseColor,transparent:!0,opacity:r,blending:e.AdditiveBlending,depthWrite:!1,toneMapped:!1});this.mesh=new e.Mesh(new e.PlaneGeometry(n,n),i),this.add(this.mesh)}faceCamera(e){this.mesh.lookAt(e)}setOpacity(e){this.mesh.material.opacity=e}get opacity(){return this.mesh.material.opacity}setColor(e){this.baseColor.set(e),this.mesh.material.color.copy(this.baseColor),this.texture.dispose(),this.texture=de(this.baseColor),this.mesh.material.map=this.texture}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.texture.dispose()}},pe=class extends e.Object3D{patches=[];area;heightAt;texture;elapsed=0;constructor({count:e=14,area:t=16,perimeterCount:n=0,plotHalf:r=12,terrainHalf:i=16,cameraFacing:a={x:1,z:1},color:o=`#9fb0c8`,heightAt:s=()=>0}={}){super(),this.area=t,this.heightAt=s,this.texture=me(o);let c=he(a);for(let t=0;t<e;t++)this.patches.push(this.makeInteriorPatch());for(let e=0;e<n;e++)this.patches.push(this.makePerimeterPatch(r,i,c))}update(e){this.elapsed+=e;for(let t of this.patches){let n=t.mesh;n.position.x+=t.driftX*e,n.position.z+=t.driftZ*e,n.rotation.z+=t.spin*e,t.perimeter?(ve(n,t.perimeter.edge,t.perimeter.plotHalf,t.perimeter.terrainHalf),n.position.y=this.heightAt(n.position.x,n.position.z)+.15+.35*(.5+.5*Math.sin(this.elapsed*.22+t.phase))):(n.position.x>this.area&&(n.position.x-=this.area*2),n.position.x<-this.area&&(n.position.x+=this.area*2),n.position.z>this.area&&(n.position.z-=this.area*2),n.position.z<-this.area&&(n.position.z+=this.area*2)),n.material.opacity=t.baseOpacity*(.6+.4*Math.sin(this.elapsed*.3+t.phase))}}dispose(){this.texture.dispose();for(let e of this.patches)e.mesh.geometry.dispose(),e.mesh.material.dispose();this.patches.length=0,this.clear()}makeInteriorPatch(){let e=F(8,16),t=F(.05,.16),n=F(-this.area,this.area),r=F(-this.area,this.area),i=this.makeMesh(e,t);return i.position.set(n,this.heightAt(n,r)+F(.3,1.2),r),this.add(i),{mesh:i,driftX:F(-.15,.15),driftZ:F(-.15,.15),spin:F(-.03,.03),baseOpacity:t,phase:F(0,Math.PI*2)}}makePerimeterPatch(e,t,n){let r=ge(n),{x:i,z:a,driftX:o,driftZ:s}=_e(r,e,t),c=F(18,30),l=F(.1,.26),u=this.makeMesh(c,l);return u.position.set(i,this.heightAt(i,a)+F(.15,.55),a),this.add(u),{mesh:u,driftX:o,driftZ:s,spin:F(-.012,.012),baseOpacity:l,phase:F(0,Math.PI*2),perimeter:{edge:r,plotHalf:e,terrainHalf:t}}}makeMesh(t,n){let r=new e.Mesh(new e.PlaneGeometry(t,t),new e.MeshBasicMaterial({map:this.texture,transparent:!0,depthWrite:!1,opacity:n,toneMapped:!1}));return r.rotation.x=-Math.PI/2,r.rotation.z=F(0,Math.PI*2),r}};function me(t){let n=`#${new e.Color(t).getHexString()}`,r=document.createElement(`canvas`);r.width=r.height=256;let i=r.getContext(`2d`),a=i.createRadialGradient(128,128,8,128,128,128);a.addColorStop(0,`${n}dd`),a.addColorStop(.45,`${n}66`),a.addColorStop(1,`${n}00`),i.fillStyle=a,i.fillRect(0,0,256,256);let o=new e.CanvasTexture(r);return o.colorSpace=e.SRGBColorSpace,o}function he(e){let t=[];return e.z>0&&t.push(`n`),e.z<0&&t.push(`s`),e.x>0&&t.push(`w`),e.x<0&&t.push(`e`),t.length?t:[`n`,`w`]}function ge(e){if(e.length===1)return e[0];let t=Math.random(),n=e.includes(`n`),r=e.includes(`w`);return n&&r?t<.58?`n`:`w`:e[Math.floor(Math.random()*e.length)]}function _e(e,t,n){let r=F(.6,n-t-1.5),i=F(-n+3,n-3),a=F(.03,.09)*(Math.random()<.5?-1:1),o=F(.01,.04);switch(e){case`n`:return{x:i,z:-t-r,driftX:a,driftZ:-o};case`s`:return{x:i,z:t+r,driftX:-a,driftZ:o};case`e`:return{x:t+r,z:i,driftX:o,driftZ:-a};case`w`:return{x:-t-r,z:i,driftX:-o,driftZ:a}}}function ve(e,t,n,r){let i=r-1,{x:a,z:o}=e.position;switch(t){case`n`:e.position.z=I(o,-i,-n+.8),a<-i+3&&(e.position.x=i-3),a>i-3&&(e.position.x=-i+3);break;case`s`:e.position.z=I(o,n-.8,i),a<-i+3&&(e.position.x=i-3),a>i-3&&(e.position.x=-i+3);break;case`e`:e.position.x=I(a,n-.8,i),o<-i+3&&(e.position.z=i-3),o>i-3&&(e.position.z=-i+3);break;case`w`:e.position.x=I(a,-i,-n+.8),o<-i+3&&(e.position.z=i-3),o>i-3&&(e.position.z=-i+3);break}}function I(e,t,n){return Math.max(t,Math.min(n,e))}var ye=class{level=0;light;peak;minGap;maxGap;spikes=[];clock=0;nextStrike;constructor({light:e,peak:t=12,minGap:n=3,maxGap:r=9}){this.light=e,this.peak=t,this.minGap=n,this.maxGap=r,this.nextStrike=F(n*.3,r)}update(e){this.clock+=e,this.clock>=this.nextStrike&&this.strike();let t=0;for(let e=this.spikes.length-1;e>=0;e--){let n=this.spikes[e],r=this.clock-n.at;if(r<0)continue;let i=n.amp*Math.exp(-r*9);i<.002&&r>0?this.spikes.splice(e,1):t+=i}this.level=Math.min(1.2,t),this.light.intensity=this.level*this.peak}quiet(){this.level=0,this.light.intensity=0}strike(){let e=Math.random()<.5?2:3;for(let t=0;t<e;t++)this.spikes.push({at:this.clock+t*F(.04,.12),amp:F(.5,1)});this.nextStrike=this.clock+F(this.minGap,this.maxGap)}},be=class extends e.BufferGeometry{constructor(t=.1){super();let n=[],r=[],i=[[0,1],[.5,.75],[.75,.25],[.5,-.5],[0,-1],[-.5,-.5],[-.75,.25],[-.5,.75]];for(let e=0;e<i.length;e++){let[r,a]=i[e];n.push(r*t,a*t,0)}for(let e=1;e<i.length-1;e++)r.push(0,e,e+1);r.push(0,i.length-1,1);let a=new e.Float32BufferAttribute(n,3);this.setAttribute(`position`,a),this.setIndex(r),this.computeVertexNormals()}},xe=class extends e.InstancedMesh{width;height;depth;floorY;flutter;px;py;pz;fallSpeed;driftX;driftZ;rotX;rotY;rotZ;phase;dummy=new e.Object3D;clock=0;constructor(t={}){let{count:n=120,width:r=16,height:i=8,depth:a=16,floorY:o=0,fallSpeedMin:s=.12,fallSpeedMax:c=.28,driftMin:l=.04,driftMax:u=.14,flutter:d=.35,color:f=[16766704,16774650,15775952],geometry:p=new be,material:m}=t,h=(Array.isArray(f)?f:[f]).map(t=>new e.Color(t)),g=m??new e.MeshStandardMaterial({color:h.length===1?h[0].getHex():16777215,metalness:.05,roughness:.85,flatShading:!0,side:e.DoubleSide});super(p,g,n),this.instanceMatrix.setUsage(e.DynamicDrawUsage),this.frustumCulled=!1,this.width=r,this.height=i,this.depth=a,this.floorY=o,this.flutter=d,this.px=new Float32Array(n),this.py=new Float32Array(n),this.pz=new Float32Array(n),this.fallSpeed=new Float32Array(n),this.driftX=new Float32Array(n),this.driftZ=new Float32Array(n),this.rotX=new Float32Array(n),this.rotY=new Float32Array(n),this.rotZ=new Float32Array(n),this.phase=new Float32Array(n);for(let e=0;e<n;e++){this.respawn(e,!0),this.fallSpeed[e]=F(s,c);let t=F(l,u),n=F(0,Math.PI*2);this.driftX[e]=Math.cos(n)*t,this.driftZ[e]=Math.sin(n)*t,this.phase[e]=F(0,Math.PI*2),h.length>1&&this.setColorAt(e,h[Math.floor(Math.random()*h.length)])}this.instanceColor&&(this.instanceColor.needsUpdate=!0),this.writeMatrices()}update(e){this.clock+=e;for(let t=0;t<this.count;t++){let n=Math.sin(this.clock*1.6+this.phase[t])*this.flutter*.12;this.px[t]+=(this.driftX[t]+n)*e,this.py[t]-=this.fallSpeed[t]*e,this.pz[t]+=(this.driftZ[t]+Math.cos(this.clock*1.3+this.phase[t])*this.flutter*.08)*e,this.py[t]<this.floorY&&this.respawn(t,!1)}this.writeMatrices()}dispose(){this.geometry.dispose();let e=Array.isArray(this.material)?this.material:[this.material];for(let t of e)t.dispose();return this}respawn(e,t){this.px[e]=F(-this.width*.5,this.width*.5),this.pz[e]=F(-this.depth*.5,this.depth*.5),this.py[e]=t?this.floorY+F(0,this.height*1.25):this.floorY+this.height+F(0,this.height*.25),this.rotX[e]=F(-.6,.6),this.rotY[e]=F(-Math.PI,Math.PI),this.rotZ[e]=F(-.8,.8)}writeMatrices(){let e=this.dummy;for(let t=0;t<this.count;t++){let n=Math.sin(this.clock*2.1+this.phase[t])*this.flutter,r=Math.cos(this.clock*1.7+this.phase[t])*this.flutter*.6;e.position.set(this.px[t],this.py[t],this.pz[t]),e.rotation.set(this.rotX[t]+n,this.rotY[t],this.rotZ[t]+r),e.updateMatrix(),this.setMatrixAt(t,e.matrix)}this.instanceMatrix.needsUpdate=!0}};function Se(){let t=document.createElement(`canvas`);t.width=8,t.height=64;let n=t.getContext(`2d`),r=n.createLinearGradient(0,0,0,64);r.addColorStop(0,`rgba(255,255,255,0)`),r.addColorStop(.42,`rgba(255,255,255,0.55)`),r.addColorStop(.58,`rgba(255,255,255,0.55)`),r.addColorStop(1,`rgba(255,255,255,0)`),n.fillStyle=r,n.fillRect(0,0,8,64);let i=new e.CanvasTexture(t);return i.colorSpace=e.SRGBColorSpace,i}var Ce=class extends e.InstancedMesh{intensity;maxCount;area;height;groundY;baseOpacity;windDirection;windStrength;fallDirection=new e.Vector3(0,-1,0);streakOrientation=new e.Quaternion;sx;sz;topY;len;speed;streakTexture;dummy=new e.Object3D;clock=0;constructor(t={}){let{count:n=1400,area:r=26,height:i=22,groundY:a=0,width:o=.009,color:s=`#aebfd6`,opacity:c=.16,lengthMin:l=.18,lengthMax:u=.42,speedMin:d=11,speedMax:f=19,windDirection:p=0,windStrength:m=0,intensity:h=.5,geometry:g=new e.PlaneGeometry(o,1),material:_}=t,v=_?void 0:Se(),y=_??new e.MeshBasicMaterial({color:new e.Color(s),map:v,transparent:!0,opacity:c,depthWrite:!1,toneMapped:!1,fog:!0,side:e.DoubleSide});super(g,y,n),this.instanceMatrix.setUsage(e.DynamicDrawUsage),this.frustumCulled=!1,this.maxCount=n,this.area=r,this.height=i,this.groundY=a,this.baseOpacity=c,this.windDirection=p,this.windStrength=Math.max(0,m),this.updateFallDirection(0),this.intensity=h,this.streakTexture=v,this.sx=new Float32Array(n),this.sz=new Float32Array(n),this.topY=new Float32Array(n),this.len=new Float32Array(n),this.speed=new Float32Array(n);for(let e=0;e<n;e++)this.sx[e]=F(-r,r),this.sz[e]=F(-r,r),this.topY[e]=F(a,a+i),this.len[e]=F(l,u),this.speed[e]=F(d,f);this.writeMatrices(),this.applyIntensity()}update(e){this.clock+=e;let t=this.windStrength>0?Math.sin(this.clock*.18)*.04*this.windStrength:0;this.updateFallDirection(t);let n=.85+this.intensity*.7,r=this.groundY+this.height,i=this.fallDirection.x,a=this.fallDirection.z,o=-this.fallDirection.y;for(let t=0;t<this.maxCount;t++){let s=this.speed[t]*n*e;this.sx[t]+=i*s,this.sz[t]+=a*s,this.topY[t]-=o*s,this.topY[t]<this.groundY-this.len[t]&&(this.topY[t]+=this.height),this.topY[t]>r&&(this.topY[t]-=this.height),this.sx[t]<-this.area?this.sx[t]+=this.area*2:this.sx[t]>this.area&&(this.sx[t]-=this.area*2),this.sz[t]<-this.area?this.sz[t]+=this.area*2:this.sz[t]>this.area&&(this.sz[t]-=this.area*2)}this.writeMatrices(),this.applyIntensity()}dispose(){this.geometry.dispose();let e=Array.isArray(this.material)?this.material:[this.material];for(let t of e)t.dispose();return this.streakTexture?.dispose(),this}applyIntensity(){this.count=Math.round(this.maxCount*Math.min(1,Math.max(0,.38+this.intensity*.62)));let e=this.material;e.opacity=this.baseOpacity*(.55+.65*this.intensity)}updateFallDirection(t){let n=this.windStrength+t;if(n<=0){this.fallDirection.set(0,-1,0),this.streakOrientation.identity();return}let r=n,i=1/Math.hypot(r,1);this.fallDirection.set(Math.cos(this.windDirection)*r*i,-1*i,Math.sin(this.windDirection)*r*i),this.streakOrientation.setFromUnitVectors(new e.Vector3(0,1,0),this.fallDirection)}writeMatrices(){let e=this.dummy;for(let t=0;t<this.maxCount;t++){let n=this.len[t];e.position.set(this.sx[t],this.topY[t]-n/2,this.sz[t]),e.quaternion.copy(this.streakOrientation),e.scale.set(1,n,1),e.updateMatrix(),this.setMatrixAt(t,e.matrix)}this.instanceMatrix.needsUpdate=!0}},we=class extends e.Shape{constructor(e=5,t=.5,n=1){super();let r=Math.PI*2/e,i=r/2,a=r/4;this.moveTo(Math.cos(0)*n,-Math.sin(0)*n);for(let o=1;o<=e;++o){let e=Math.cos(r*o-a*3)*(t/Math.cos(a)),s=-Math.sin(r*o-a*3)*(t/Math.cos(a)),c=Math.cos(r*o-i)*t,l=-Math.sin(r*o-i)*t;this.quadraticCurveTo(e,s,c,l),e=Math.cos(r*o-a)*(t/Math.cos(a)),s=-Math.sin(r*o-a)*(t/Math.cos(a)),c=Math.cos(r*o)*n,l=-Math.sin(r*o)*n,this.quadraticCurveTo(e,s,c,l)}this.closePath()}},Te=class extends e.ExtrudeGeometry{constructor({sides:e=5,innerRadius:t=.5,outerRadius:n=1,depth:r=.25}={}){super(new we(e,t,n),{depth:r,bevelEnabled:!1})}},Ee=new e.Vector3(0,0,0);function De(e){let t=Math.random(),n=Math.random(),r=Math.PI*2*t,i=Math.acos(2*n-1),a=Math.sin(i);return e.set(a*Math.cos(r),Math.cos(i),a*Math.sin(r))}function Oe(t){return(Array.isArray(t)?t:[t]).map(t=>new e.Color(t))}function ke(e){let t=e.getAttribute(`position`),n=0;for(let e=0;e<t.count;e++){let r=t.getX(e),i=t.getY(e),a=r*r+i*i;a>n&&(n=a)}return Math.sqrt(n)||1}var Ae=class extends e.Object3D{orientation;field;twinkle;baseScales;twinklePhases;scaleAttribute;dummy=new e.Object3D;constructor(e={}){super();let{orientation:t=`billboard`,count:n=1500,radius:r=500,minRadius:i=r,maxRadius:a=r,sizeMin:o=.008,sizeMax:s=.025,color:c=[16777215,13293567,16774368],twinkle:l=!1,rotation:u=0,rotationJitter:d=Math.PI*2,material:f,burst:p={},geometry:m}=e;this.orientation=t,this.frustumCulled=!1,this.twinkle=l,l&&(this.twinklePhases=new Float32Array(n),this.baseScales=new Float32Array(n));let h={count:n,minRadius:i,maxRadius:a,sizeMin:o,sizeMax:s,color:c,material:f,geometry:m??new Te({sides:p.sides??4,innerRadius:p.innerRadius??.6,outerRadius:p.outerRadius??1.9,depth:p.depth??.05}),rotation:u,rotationJitter:d};this.field=t===`billboard`?this.createBillboardField(h):this.createRadialField(h),this.add(this.field)}get mesh(){return this.field}get geometry(){return this.field.geometry}get material(){return this.field.material}dispose(){this.geometry.dispose();let e=Array.isArray(this.material)?this.material:[this.material];for(let t of e)t.dispose()}update(t=performance.now()*.001){if(!this.twinkle||!this.baseScales||!this.twinklePhases)return;if(this.orientation===`billboard`){let e=this.scaleAttribute;if(!e)return;let n=e.array;for(let e=0;e<this.baseScales.length;e++){let r=.75+.25*Math.sin(t*2.5+this.twinklePhases[e]);n[e]=this.baseScales[e]*r}e.needsUpdate=!0;return}let n=new e.Matrix4,r=new e.Vector3,i=new e.Quaternion,a=new e.Vector3;for(let e=0;e<this.field.count;e++){this.field.getMatrixAt(e,n),n.decompose(r,i,a);let o=.75+.25*Math.sin(t*2.5+this.twinklePhases[e]),s=this.baseScales[e]*o;this.dummy.position.copy(r),this.dummy.quaternion.copy(i),this.dummy.scale.setScalar(s),this.dummy.updateMatrix(),this.field.setMatrixAt(e,this.dummy.matrix)}this.field.instanceMatrix.needsUpdate=!0}createBillboardField({count:r,minRadius:i,maxRadius:a,sizeMin:o,sizeMax:s,color:c,material:l,geometry:u,rotation:d,rotationJitter:f}){let p=Oe(c),m=new e.Vector3,h=Math.max(a-i,0),g=u.clone();g.center();let _=ke(g),v=new Float32Array(r*3),y=new Float32Array(r),b=new Float32Array(r),x=p.length>1,S=x?new Float32Array(r*3):null;for(let e=0;e<r;e++){let t=i+Math.random()*h;if(De(m).multiplyScalar(t),v[e*3]=m.x,v[e*3+1]=m.y,v[e*3+2]=m.z,y[e]=t*(o+Math.random()*(s-o))/_,b[e]=d+Math.random()*f,this.baseScales&&(this.baseScales[e]=y[e]),this.twinklePhases&&(this.twinklePhases[e]=Math.random()*Math.PI*2),S){let t=p[Math.floor(Math.random()*p.length)];S[e*3]=t.r,S[e*3+1]=t.g,S[e*3+2]=t.b}}let C=new e.InstancedBufferAttribute(v,3),w=new e.InstancedBufferAttribute(y,1),T=new e.InstancedBufferAttribute(b,1);this.scaleAttribute=w;let E=l??new n.SpriteNodeMaterial({color:x?16777215:p[0].getHex(),side:e.DoubleSide,depthWrite:!1,toneMapped:!1});E.positionNode=(0,t.instancedBufferAttribute)(C,`vec3`),E.rotationNode=(0,t.instancedBufferAttribute)(T,`float`),this.twinkle?(w.setUsage(e.DynamicDrawUsage),E.scaleNode=(0,t.instancedDynamicBufferAttribute)(w,`float`)):E.scaleNode=(0,t.instancedBufferAttribute)(w,`float`),S&&(E.colorNode=(0,t.instancedBufferAttribute)(new e.InstancedBufferAttribute(S,3),`vec3`));let D=new e.InstancedMesh(g,E,r);D.frustumCulled=!1,D.renderOrder=1;let O=new e.Matrix4;for(let e=0;e<r;e++)D.setMatrixAt(e,O);return D.instanceMatrix.needsUpdate=!0,D}createRadialField({count:t,minRadius:n,maxRadius:r,sizeMin:i,sizeMax:a,color:o,material:s,geometry:c,rotation:l,rotationJitter:u}){let d=Oe(o),f=new e.Vector3,p=Math.max(r-n,0),m=c.clone();m.center(),m.computeBoundingSphere();let h=m.boundingSphere?.radius??1,g=new e.InstancedMesh(m,s??new e.MeshBasicMaterial({color:d.length===1?d[0].getHex():16777215,side:e.DoubleSide,depthWrite:!1,toneMapped:!1}),t);g.frustumCulled=!1,g.renderOrder=1;for(let e=0;e<t;e++){let t=n+Math.random()*p;De(f).multiplyScalar(t);let r=t*(i+Math.random()*(a-i))/h;this.baseScales&&(this.baseScales[e]=r),this.twinklePhases&&(this.twinklePhases[e]=Math.random()*Math.PI*2),this.dummy.position.copy(f),this.dummy.lookAt(Ee),this.dummy.rotateZ(l+Math.random()*u),this.dummy.scale.setScalar(r),this.dummy.updateMatrix(),g.setMatrixAt(e,this.dummy.matrix),d.length>1&&g.setColorAt(e,d[Math.floor(Math.random()*d.length)])}return g.instanceMatrix.needsUpdate=!0,g.instanceColor&&(g.instanceColor.needsUpdate=!0),g}},je=class extends e.Object3D{wisps=[];orbGeometry;orbMaterial;halfWidth;depth;heightMin;heightMax;driftX;driftY;driftZ;speedMin;speedMax;castLight;lightDistance;lightDecay;lightIntensity;lightPulseAmplitude;lightPulseSpeed;elapsed=0;constructor({count:t=3,width:n=16,depth:r=8,heightMin:i=1,heightMax:a=2,color:o=7208880,orbRadius:s=.08,driftX:c=1.6,driftY:l=.3,driftZ:u=1.6,speedMin:d=.3,speedMax:f=.7,castLight:p=!0,lightDistance:m=6,lightDecay:h=2,lightIntensity:g=2.5,lightPulseAmplitude:_=1.2,lightPulseSpeed:v=3}={}){super(),this.halfWidth=n/2,this.depth=r,this.heightMin=i,this.heightMax=a,this.driftX=c,this.driftY=l,this.driftZ=u,this.speedMin=d,this.speedMax=f,this.castLight=p,this.lightDistance=m,this.lightDecay=h,this.lightIntensity=g,this.lightPulseAmplitude=_,this.lightPulseSpeed=v,this.orbGeometry=new e.SphereGeometry(s,8,8),this.orbMaterial=new e.MeshBasicMaterial({color:new e.Color(o),toneMapped:!1});for(let n=0;n<t;n++){let t=new e.Vector3(F(-this.halfWidth,this.halfWidth),F(this.heightMin,this.heightMax),F(0,this.depth)),n=new e.Mesh(this.orbGeometry,this.orbMaterial);n.position.copy(t),this.add(n);let r;p&&(r=new e.PointLight(o,3,this.lightDistance,this.lightDecay),n.add(r)),this.wisps.push({orb:n,home:t,phase:F(0,Math.PI*2),speed:F(this.speedMin,this.speedMax),light:r})}}update(e){this.elapsed+=e;for(let e of this.wisps){let t=this.elapsed*e.speed+e.phase;e.orb.position.set(e.home.x+Math.sin(t)*this.driftX,e.home.y+Math.sin(t*1.7)*this.driftY,e.home.z+Math.cos(t*.8)*this.driftZ),e.light&&(e.light.intensity=this.lightIntensity+Math.sin(t*this.lightPulseSpeed)*this.lightPulseAmplitude)}}dispose(){this.orbGeometry.dispose(),this.orbMaterial.dispose();for(let e of this.wisps)e.light?.dispose();this.clear(),this.wisps.length=0}},L=class extends e.BufferGeometry{width;height;depth;coverThickness;pageIndent;constructor({width:t=1,height:n=1.5,depth:i=.5,coverThickness:a=.05,pageIndent:o=.05}={}){super(),this.width=t,this.height=n,this.depth=i,this.coverThickness=a,this.pageIndent=o;let s=t,c=n,l=i,u=a,d=o,f=[0,0,0,s,0,0,s,c,0,0,c,0,s,0,-l,0,0,-l,0,c,-l,s,c,-l,0,0,-l,0,0,0,0,c,0,0,c,-l,s,0,-u,u,0,-u,u,c,-u,s,c,-u,u,0,-l+u,s,0,-l+u,s,c,-l+u,u,c,-l+u,u,0,-u,u,0,-l+u,u,c,-l+u,u,c,-u,0,c,0,s,c,0,s,c,-u,u,c,-u,0,c,-l,u,c,-l+u,s,c,-l+u,s,c,-l,0,c,0,u,c,-u,u,c,-l+u,0,c,-l,0,0,0,u,0,-u,s,0,-u,s,0,0,0,0,-l,s,0,-l,s,0,-l+u,u,0,-l+u,0,0,0,0,0,-l,u,0,-l+u,u,0,-u,s,0,0,s,0,-u,s,c,-u,s,c,0,s,0,-l,s,c,-l,s,c,-l+u,s,0,-l+u],p=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0],m=t/(t*2+i),h=(t+i)/(t*2+i),g=[h,0,1,0,1,1,h,1,0,0,m,0,m,1,0,1,m,0,h,0,h,1,m,1,1,0,h,0,h,1,1,1,m,0,0,0,0,1,m,1,h,0,m,0,m,1,h,1,h,0,1,0,1,1,h,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1],_=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23,24,25,26,24,26,27,28,29,30,28,30,31,32,33,34,32,34,35,36,37,38,36,38,39,40,41,42,40,42,43,44,45,46,44,46,47,48,49,50,48,50,51,52,53,54,52,54,55],v=new Float32Array(f),y=new Float32Array(p),b=new Float32Array(g),x=new Uint16Array(_),S=new e.BufferGeometry;S.setAttribute(`position`,new e.BufferAttribute(v,3)),S.setAttribute(`normal`,new e.BufferAttribute(y,3)),S.setAttribute(`uv`,new e.BufferAttribute(b,2)),S.setIndex(new e.BufferAttribute(x,1));let C=new e.BoxGeometry(t-u-d,c-d*2,l-u*2);C.translate((t-u-d)/2+u,c/2,-l/2),this.copy((0,r.mergeGeometries)([S,C],!0))}},Me=.5,Ne=Math.PI/2;function Pe({scaleXMin:t=.4,scaleXMax:n=.7,scaleYMin:r=.3,scaleYMax:i=.95,scaleZMin:a=.1,scaleZMax:o=.5,source:s}){return new e.Vector3(F(t,n,s),ae(.25,r,i,s),oe(.8,a,o,s))}function R({coverMaterial:t,pagesMaterial:n,scales:r,source:i}){let a=new e.InstancedMesh(new L,[t,n],r.length),o=new e.Matrix4,s=0;for(let t=0;t<r.length;t++){let n=r[t],c=new e.Matrix4;c.makeScale(n.x,n.y,n.z),o.identity(),o.multiply(c),o.setPosition(.01+i.float(0,.1),0,s+n.z*.5),a.setMatrixAt(t,o),s+=n.z*.5}return a}function Fe({coverMaterial:e,pagesMaterial:t,count:n=10,scaleXMin:r=.4,scaleXMax:i=.7,scaleYMin:a=.3,scaleYMax:o=.95,scaleZMin:s=.1,scaleZMax:c=.5,seed:l}){let u=N(l);return R({coverMaterial:e,pagesMaterial:t,scales:Array.from({length:n},()=>Pe({scaleXMin:r,scaleXMax:i,scaleYMin:a,scaleYMax:o,scaleZMin:s,scaleZMax:c,source:u})),source:u})}function Ie({coverMaterial:e,pagesMaterial:t,length:n=10,scaleXMin:r=.4,scaleXMax:i=.7,scaleYMin:a=.3,scaleYMax:o=.95,scaleZMin:s=.1,scaleZMax:c=.5,seed:l}){let u=N(l),d=[],f=n;for(;f>0;){let e=Pe({scaleXMin:r,scaleXMax:i,scaleYMin:a,scaleYMax:o,scaleZMin:s,scaleZMax:c,source:u});e.z=Math.min(e.z,f),d.push(e),f-=e.z}return R({coverMaterial:e,pagesMaterial:t,scales:d,source:u})}function Le({coverMaterial:t,pagesMaterial:n,count:r=6,scaleXMin:i=.4,scaleXMax:a=.7,scaleYMin:o=.3,scaleYMax:s=.95,scaleZMin:c=.1,scaleZMax:l=.5,yawMax:u=.55,offsetMax:d=.06,seed:f}){let p=N(f),m=new L,h=new e.InstancedMesh(m,[t,n],r),g=new e.Matrix4,_=new e.Vector3,v=new e.Quaternion,y=new e.Quaternion().setFromAxisAngle(new e.Vector3(1,0,0),Ne),b=new e.Quaternion,x=new e.Vector3,S=new e.Vector3(m.width*.5,m.height*.5,-m.depth*.5),C=new e.Vector3,w=new e.Vector3,T=0;for(let t=0;t<r;t++){let n=Pe({scaleXMin:i,scaleXMax:a,scaleYMin:o,scaleYMax:s,scaleZMin:c,scaleZMax:l,source:p});x.copy(n);let r=Me*n.z;b.setFromAxisAngle(new e.Vector3(0,1,0),p.float(-u,u)),v.copy(y).premultiply(b),C.copy(S).multiply(x),w.copy(C).applyQuaternion(v),_.set(p.float(-d,d),T+r*.5,p.float(-d,d)),_.sub(w),g.compose(_,v,x),h.setMatrixAt(t,g),T+=r}return h.instanceMatrix.needsUpdate=!0,h}function z(e,t,n){let r=Math.imul(e|0,374761393)^Math.imul(t|0,668265263)^Math.imul(n|0,362437);return r=Math.imul(r^r>>>13,1274126177),r^=r>>>16,(r>>>0)/4294967296}function B(e,t,n,r){let i=Math.imul(e|0,374761393)^Math.imul(t|0,668265263)^Math.imul(n|0,1274126177)^Math.imul(r|0,362437);return i=Math.imul(i^i>>>13,1274126177),i^=i>>>16,(i>>>0)/4294967296}var V=e=>e*e*(3-2*e);function Re(e,t,n){let r=Math.floor(e),i=Math.floor(t),a=V(e-r),o=V(t-i),s=z(r,i,n),c=z(r+1,i,n),l=z(r,i+1,n),u=z(r+1,i+1,n),d=s+(c-s)*a;return d+(l+(u-l)*a-d)*o}function ze(e,t,n,r){let i=Math.floor(e),a=Math.floor(t),o=Math.floor(n),s=V(e-i),c=V(t-a),l=V(n-o),u=B(i,a,o,r),d=B(i+1,a,o,r),f=B(i,a+1,o,r),p=B(i+1,a+1,o,r),m=B(i,a,o+1,r),h=B(i+1,a,o+1,r),g=B(i,a+1,o+1,r),_=B(i+1,a+1,o+1,r),v=u+(d-u)*s,y=f+(p-f)*s,b=m+(h-m)*s,x=g+(_-g)*s,S=v+(y-v)*c;return S+(b+(x-b)*c-S)*l}function Be(e,t,n,r,i){let a=0,o=1,s=1,c=0;for(let l=0;l<r;l++)a+=(Re(e*s,t*s,n+l*101)*2-1)*o,c+=o,o*=i,s*=2;return c>0?a/c:0}function Ve(e,t,n,r,i,a){let o=0,s=1,c=1,l=0;for(let u=0;u<i;u++)o+=(ze(e*c,t*c,n*c,r+u*101)*2-1)*s,l+=s,s*=a,c*=2;return l>0?o/l:0}var H=class extends e.BufferGeometry{radius;constructor({radius:t=1,detail:n=2,noiseHeight:i=.35,noiseScale:a=1.6,octaves:o=3,persistence:s=.5,seed:c=1}={}){super(),this.radius=t;let l=new e.IcosahedronGeometry(t,n);l.deleteAttribute(`uv`),l.deleteAttribute(`normal`);let u=(0,r.mergeVertices)(l);l.dispose();let d=u.getAttribute(`position`),f=new e.Vector3,p=a/t;for(let e=0;e<d.count;e++){f.fromBufferAttribute(d,e);let t=Ve(f.x*p,f.y*p,f.z*p,c,o,s),n=f.length()||1,r=(n+t*i)/n;d.setXYZ(e,f.x*r,f.y*r,f.z*r)}d.needsUpdate=!0,u.computeVertexNormals(),u.center(),this.copy(u),u.dispose()}};function He({count:t=8,width:n=6,depth:r=6,heightJitter:i=0,scaleMin:a=.8,scaleMax:o=1.2,seed:s,radius:c=1,detail:l=2,noiseHeight:u=.35,noiseScale:d=1.6,octaves:f=3,persistence:p=.5,variants:m=4,material:h,color:g=`#6f6f6f`}={}){let _=N(s),v=Math.max(1,Math.min(Math.round(m),Math.max(1,t))),y=h??new e.MeshStandardMaterial({color:new e.Color(g),roughness:1,metalness:0,flatShading:!0}),b=[];for(let e=0;e<v;e++)b.push(new H({radius:c,detail:l,noiseHeight:u,noiseScale:d,octaves:f,persistence:p,seed:_.int(0,1e6)}));let x=Array(v).fill(0);for(let e=0;e<t;e++)x[e%v]++;let S=b.map((t,n)=>new e.InstancedMesh(t,y,x[n])),C=Array(v).fill(0),w=new e.Matrix4,T=new e.Vector3,E=new e.Quaternion,D=new e.Vector3,O=new e.Euler;for(let e=0;e<t;e++){let t=_.float(a,o);D.set(t,t,t),O.set(_.float(0,Math.PI*2),_.float(0,Math.PI*2),_.float(0,Math.PI*2)),E.setFromEuler(O),T.set(_.float(-n/2,n/2),_.float(0,i),_.float(-r/2,r/2)),w.compose(T,E,D);let s=e%v;S[s].setMatrixAt(C[s]++,w)}let k=new e.Group;for(let e of S)e.instanceMatrix.needsUpdate=!0,e.castShadow=!0,e.receiveShadow=!0,k.add(e);return k}var Ue=class extends e.Shape{constructor(e=1){super();for(let t=0;t<6;t++){let n=Math.PI/3*t,r=Math.cos(n)*e,i=Math.sin(n)*e;t===0?this.moveTo(r,i):this.lineTo(r,i)}this.closePath()}},U=class extends e.ExtrudeGeometry{radius;depth;constructor({radius:e=1,depth:t=.01}={}){super(new Ue(e),{depth:t,bevelEnabled:!1}),this.radius=e,this.depth=t}};function We(t){let{width:n,depth:r,height:i,count:a,gap:o,material:s}=t,c=s||new e.MeshStandardMaterial({color:16777215}),l=n/a,u=(l-o)*2/3,d=Math.sqrt(3)*u+o,f=Math.floor(r/d),p=a*f,m=new U({radius:u,depth:i});m.rotateX(-Math.PI/2);let h=new e.InstancedMesh(m,c,p),g=new e.Object3D,_=0;for(let e=0;e<a;e++)for(let t=0;t<f;t++){let n=e*l,r=t*d+e%2*(d/2),i=n-a*l/2+l/2,o=r-f*d/2+d/2;g.position.set(i,0,o),g.updateMatrix(),h.setMatrixAt(_++,g.matrix)}return h.instanceMatrix.needsUpdate=!0,h}function Ge(t){let{width:n,depth:r,height:i,radius:a,gap:o,material:s}=t,c=s||new e.MeshStandardMaterial({color:16777215}),l=a*3/2+o,u=Math.sqrt(3)*a+o,d=Math.floor(n/l),f=Math.floor(r/u),p=d*f,m=new U({radius:a,depth:i});m.rotateX(-Math.PI/2);let h=new e.InstancedMesh(m,c,p),g=new e.Object3D,_=0;for(let e=0;e<d;e++)for(let t=0;t<f;t++){let n=e*l,r=t*u+e%2*(u/2),i=n-d*l/2+l/2,a=r-f*u/2+u/2;g.position.set(i,0,a),g.updateMatrix(),h.setMatrixAt(_++,g.matrix)}return h.instanceMatrix.needsUpdate=!0,h}var Ke=class extends e.BufferGeometry{radius;detail;constructor({radius:t=1,detail:n=0,mossScaleXZ:i=.9,mossScaleY:a=.5,mossOffsetY:o=.3}={}){super(),this.radius=t,this.detail=n;let s=new e.DodecahedronGeometry(t,n),c=new e.DodecahedronGeometry(t,n);c.scale(i,a,i),c.translate(0,o,0),this.copy((0,r.mergeGeometries)([s,c],!0)),this.computeVertexNormals()}};function qe(t,n=E.XYZ,i=.5,a=2){t.deleteAttribute(`uv`),t.deleteAttribute(`normal`),t=(0,r.mergeVertices)(t),t.computeVertexNormals();let o=t.getAttribute(`position`);for(let t=0;t<o.count;t++){let r=new e.Vector3().fromBufferAttribute(o,t),s=Math.random()*(a-i)+i,c=n.clone().multiplyScalar(s);r.add(c),o.setXYZ(t,r.x,r.y,r.z)}return o.needsUpdate=!0,t.computeVertexNormals(),t}var Je=class extends e.BufferGeometry{radius;widthSegments;heightSegments;constructor({radius:t=1,widthSegments:n=4,heightSegments:r=4}={}){super(),this.radius=t,this.widthSegments=n,this.heightSegments=r;let i=new e.SphereGeometry(t,n,r);this.copy(qe(i,E.XYZ,.5,1)),this.computeVertexNormals(),this.center()}};function Ye(t,{count:n=5,width:r=4,depth:i=4,heightJitter:a=0,scaleMin:o=.8,scaleMax:s=1.2,seed:c}){let l=N(c),u=new e.Matrix4,d=new e.Vector3,f=new e.Quaternion,p=new e.Vector3,m=new e.Euler;for(let e=0;e<n;e++)p.set(l.float(o,s),l.float(o,s),l.float(o,s)),m.set(l.float(0,Math.PI),l.float(0,Math.PI),l.float(0,Math.PI)),f.setFromEuler(m),d.set(l.float(-r/2,r/2),l.float(0,a),l.float(-i/2,i/2)),u.compose(d,f,p),t.setMatrixAt(e,u);t.instanceMatrix.needsUpdate=!0}function Xe({count:t=5,width:n=4,depth:r=4,heightJitter:i=0,scaleMin:a=.8,scaleMax:o=1.2,seed:s,radius:c=1,widthSegments:l=4,heightSegments:u=4,material:d,color:f=`#808080`}={}){let p=d??new e.MeshStandardMaterial({color:new e.Color(f),flatShading:!0}),m=new e.InstancedMesh(new Je({radius:c,widthSegments:l,heightSegments:u}),p,t);return Ye(m,{count:t,width:n,depth:r,heightJitter:i,scaleMin:a,scaleMax:o,seed:s}),m}function Ze({count:t=5,width:n=4,depth:r=4,heightJitter:i=0,scaleMin:a=.8,scaleMax:o=1.2,seed:s,radius:c=1,detail:l=0,mossScaleXZ:u=.9,mossScaleY:d=.5,mossOffsetY:f=.3,rockMaterial:p,mossMaterial:m,rockColor:h=`#808080`,mossColor:g=`#4b8b3b`,mossOpacity:_=.8}={}){let v=[p??new e.MeshStandardMaterial({color:new e.Color(h),flatShading:!0}),m??new e.MeshStandardMaterial({color:new e.Color(g),flatShading:!0,opacity:_,transparent:_<1})],y=new e.InstancedMesh(new Ke({radius:c,detail:l,mossScaleXZ:u,mossScaleY:d,mossOffsetY:f}),v,t);return Ye(y,{count:t,width:n,depth:r,heightJitter:i,scaleMin:a,scaleMax:o,seed:s}),y}function Qe(e,t){return(e/2+t/2)/Math.SQRT2}function $e(e,t,n,r){let i=Math.max(1,Math.round(n)),a=Math.max(1,Math.round(r)),o=e/(2*i),s=t/(2*a);return{a:o,b:s,angle:Math.atan2(s,o),spacing:2*o*s/Math.hypot(o,s)}}function et(e,t,n){let r=Qe(e,t);return r/Math.max(2,Math.round(r/n))}function tt(e,t,n){return Qe(e,t)/Math.max(2,n)}function nt({width:t,height:n,centerY:r=0,grid:i,leadThickness:a,leadDepth:o}){let s=t/2,c=n/2,l=[new e.BoxGeometry(t+a,a,o).translate(0,r-c,0),new e.BoxGeometry(t+a,a,o).translate(0,r+c,0),new e.BoxGeometry(a,n+a,o).translate(-s,r,0),new e.BoxGeometry(a,n+a,o).translate(s,r,0)];return W(l,t,n,r,i.spacing,a,o,i.angle),W(l,t,n,r,i.spacing,a,o,-i.angle),l}function rt(e){let{width:t,height:n,centerY:r=0,grid:i,leadThickness:a,leadDepth:o}=e,s=[];return W(s,t,n,r,i.spacing,a,o,i.angle),W(s,t,n,r,i.spacing,a,o,-i.angle),s}function W(t,n,r,i,a,o,s,c){let l=n/2,u=r/2,d=-l,f=l,p=i-u,m=i+u,h=Math.hypot(n,r)+o,g=-Math.sin(c),_=Math.cos(c),v=Math.ceil(Math.hypot(n,r)/a)+2;for(let n=-v;n<=v;n++){let r=g*n*a,l=i+_*n*a,u=Math.cos(c)*h*.5,v=Math.sin(c)*h*.5,y=it(r-u,l-v,r+u,l+v,d,p,f,m);if(!y)continue;let[b,x,S,C]=y,w=Math.hypot(S-b,C-x);if(w<1e-6)continue;let T=new e.BoxGeometry(w,o,s);T.rotateZ(c),T.translate((b+S)/2,(x+C)/2,0),t.push(T)}}function it(e,t,n,r,i,a,o,s){let c=n-e,l=r-t,u=0,d=1,f=[[e,c,i,o],[t,l,a,s]];for(let[e,t,n,r]of f)if(Math.abs(t)<1e-9){if(e<n||e>r)return null}else{let i=(n-e)/t,a=(r-e)/t;if(u=Math.max(u,Math.min(i,a)),d=Math.min(d,Math.max(i,a)),u>d)return null}return[e+c*u,t+l*u,e+c*d,t+l*d]}function G({width:e,rectHeight:t,archHeight:n=e/2,centerY:r=0}){let i=Math.max(n,1e-6),a=(e*e+4*i*i)/(8*i),o=t+i,s=r-o/2,c=s+t,l=c+i-a;return{hw:e/2,ymin:s,ymax:c+i,rectTopY:c,archCy:l,archRadius:a,archHeight:i,totalHeight:o,centerY:r}}function K(e,t,{hole:n=!1}={}){let{hw:r,ymin:i,rectTopY:a,archCy:o,archRadius:s}=t,c=Math.atan2(a-o,-r),l=Math.atan2(a-o,r);if(!n){e.moveTo(-r,i),e.lineTo(r,i),e.lineTo(r,a),e.absarc(0,o,s,l,c,!1),e.lineTo(-r,a),e.closePath();return}e.moveTo(-r,i),e.lineTo(-r,a),e.absarc(0,o,s,c,l,!0),e.lineTo(r,a),e.lineTo(r,i),e.closePath()}function q(e,t){let n=Math.max(e.hw-t,t),r=e.ymin+t,i=e.rectTopY-t,a=Math.max(e.archHeight-t,t),o=(n*n+a*a)/(2*a),s=i+a-o,c=i+a;return{hw:n,ymin:r,ymax:c,rectTopY:i,archCy:s,archRadius:o,archHeight:a,totalHeight:c-r,centerY:(r+c)/2}}var at=48;function ot(t,n,r){let i=new e.Shape;K(i,t);let a=new e.Path;K(a,q(t,n),{hole:!0}),i.holes.push(a);let o=new e.ExtrudeGeometry(i,{depth:r,bevelEnabled:!1,curveSegments:at});return o.translate(0,0,-r/2),o}function st(e,t,n){let r=2*n.b,i=t-e;return Math.round(i/r)*r-i}function ct(e,t,{hw:n,ymin:r,ymax:i,rectTopY:a,archCy:o,archRadius:s},c=1e-6){if(t<r-c||t>i+c)return!1;if(t<=a+c)return Math.abs(e)<=n+c;let l=e,u=t-o;return l*l+u*u<=s*s+c}function lt(e,t,n,r,i){let a=new Set([0,1]),o=n-e,s=r-t,{hw:c,ymin:l,ymax:u,rectTopY:d,archCy:f,archRadius:p}=i,m=e=>{e>1e-9&&e<.999999999&&a.add(e)};Math.abs(o)>1e-9&&(m((-c-e)/o),m((c-e)/o)),Math.abs(s)>1e-9&&(m((l-t)/s),m((d-t)/s),m((u-t)/s));let h=e,g=t-f,_=o*o+s*s,v=2*(h*o+g*s),y=h*h+g*g-p*p,b=v*v-4*_*y;if(b>=0&&_>1e-12){let e=Math.sqrt(b);m((-v-e)/(2*_)),m((-v+e)/(2*_))}return[...a].sort((e,t)=>e-t)}function ut(e,t,n,r,i){let a=G(i),o=lt(e,t,n,r,a),s=n-e,c=r-t,l=[],u=null,d=0;for(let n=0;n<o.length-1;n++){let r=o[n],i=o[n+1],f=(r+i)*.5;ct(e+s*f,t+c*f,a)?(u===null&&(u=r),d=i):u!==null&&(l.push([u,d]),u=null)}u!==null&&l.push([u,d]);let f=null,p=0;for(let e of l){let t=e[1]-e[0];t>p&&(p=t,f=e)}if(!f||p<1e-9)return null;let[m,h]=f;return[e+s*m,t+c*m,e+s*h,t+c*h]}function dt(e){return{width:2*e.hw,rectHeight:e.rectTopY-e.ymin,archHeight:e.archHeight,centerY:e.centerY}}function ft(t,n,r,i){let{hw:a,rectTopY:o,archCy:s,archRadius:c}=n,l=Math.atan2(o-s,-a),u=Math.atan2(o-s,a)-l,d=Math.max(12,Math.ceil(Math.abs(u)*c/(r*1.8)));for(let n=0;n<d;n++){let a=n/d,o=(n+1)/d,f=l+u*a,p=l+u*o,m=(f+p)/2,h=new e.BoxGeometry(2*c*Math.sin((p-f)/2),r,i);h.rotateZ(m-Math.PI/2),h.translate(c*Math.cos(m),s+c*Math.sin(m),0),t.push(h)}}function J({width:e,rectHeight:t,archHeight:n,centerY:r=0,grid:i,leadThickness:a,leadDepth:o,clipInset:s=0}){let c={width:e,rectHeight:t,archHeight:n,centerY:r},l=G(c),u=s>0?dt(q(l,s)):c,d=[],f=st(l.ymin,l.rectTopY,i);return mt(d,u,l,i,f,a,o,i.angle),mt(d,u,l,i,f,a,o,-i.angle),d}function pt(t){let{width:n,rectHeight:r,archHeight:i,centerY:a=0,leadThickness:o,leadDepth:s}=t,c=G({width:n,rectHeight:r,archHeight:i,centerY:a}),{hw:l,ymin:u,rectTopY:d}=c,f=d-u,p=[new e.BoxGeometry(n+o,o,s).translate(0,u,0),new e.BoxGeometry(o,f+o,s).translate(-l,u+f/2,0),new e.BoxGeometry(o,f+o,s).translate(l,u+f/2,0)];return ft(p,c,o,s),p.push(...J(t)),p}function mt(t,n,r,i,a,o,s,c){let{totalHeight:l,centerY:u}=r,d=i.spacing,f=Math.hypot(n.width,l)+o,p=-Math.sin(c),m=Math.cos(c),h=Math.ceil(Math.hypot(n.width,l)/d)+2,g=u+a;for(let r=-h;r<=h;r++){let i=p*r*d,a=g+m*r*d,l=Math.cos(c)*f*.5,u=Math.sin(c)*f*.5,h=ut(i-l,a-u,i+l,a+u,n);if(!h)continue;let[_,v,y,b]=h,x=Math.hypot(y-_,b-v);if(x<1e-6)continue;let S=new e.BoxGeometry(x,o,s);S.rotateZ(c),S.translate((_+y)/2,(v+b)/2,0),t.push(S)}}var ht=class extends e.BufferGeometry{cellsX;cellsY;fittedGrid;opening;constructor({width:e=4.5,rectHeight:t=4,archHeight:n,leadThickness:i=.055,leadDepth:a=.11,cellsX:o=10,cellsY:s=12,centerY:c=0}={}){super(),this.cellsX=Math.max(1,Math.round(o)),this.cellsY=Math.max(1,Math.round(s)),this.opening=G({width:e,rectHeight:t,archHeight:n,centerY:c}),this.fittedGrid=$e(e,this.opening.totalHeight,this.cellsX,this.cellsY);let l=J({width:e,rectHeight:t,archHeight:n,centerY:c,grid:this.fittedGrid,leadThickness:i,leadDepth:a,clipInset:i*.5}),u=(0,r.mergeGeometries)(l);if(!u)throw Error(`ArchedDiamondLatticeWindowGeometry: merge failed`);this.copy(u),u.dispose();for(let e of l)e.dispose()}},gt=class extends e.BufferGeometry{cellsX;cellsY;fittedGrid;constructor({width:e=4.5,height:t=5.5,leadThickness:n=.055,leadDepth:i=.11,cellsX:a=10,cellsY:o=10,centerY:s=0}={}){super(),this.cellsX=Math.max(1,Math.round(a)),this.cellsY=Math.max(1,Math.round(o)),this.fittedGrid=$e(e,t,this.cellsX,this.cellsY);let c=nt({width:e,height:t,centerY:s,grid:this.fittedGrid,leadThickness:n,leadDepth:i}),l=(0,r.mergeGeometries)(c);if(!l)throw Error(`DiamondLatticeWindowGeometry: merge failed`);this.copy(l),l.dispose();for(let e of c)e.dispose()}};function _t(e,t,n,r){let i=Math.max(1,Math.round(n)),a=Math.max(1,Math.round(r));return{paneWidth:e/i,paneHeight:t/a}}function vt({width:t,height:n,centerY:r=0,cellsX:i,cellsY:a,mullionThickness:o,mullionDepth:s}){let c=t/2,l=n/2,u=[new e.BoxGeometry(t+o,o,s).translate(0,r-l,0),new e.BoxGeometry(t+o,o,s).translate(0,r+l,0),new e.BoxGeometry(o,n+o,s).translate(-c,r,0),new e.BoxGeometry(o,n+o,s).translate(c,r,0)],{paneWidth:d,paneHeight:f}=_t(t,n,i,a);for(let t=1;t<i;t++){let i=-c+d*t;u.push(new e.BoxGeometry(o,n+o,s).translate(i,r,0))}for(let n=1;n<a;n++){let i=r-l+f*n;u.push(new e.BoxGeometry(t+o,o,s).translate(0,i,0))}return u}var yt=class extends e.BufferGeometry{cellsX;cellsY;fittedGrid;constructor({width:e=4.5,height:t=5.5,mullionThickness:n=.055,mullionDepth:i=.11,cellsX:a=4,cellsY:o=6,centerY:s=0}={}){super(),this.cellsX=Math.max(1,Math.round(a)),this.cellsY=Math.max(1,Math.round(o)),this.fittedGrid=_t(e,t,this.cellsX,this.cellsY);let c=vt({width:e,height:t,centerY:s,cellsX:this.cellsX,cellsY:this.cellsY,mullionThickness:n,mullionDepth:i}),l=(0,r.mergeGeometries)(c);if(!l)throw Error(`GregorianLatticeWindowGeometry: merge failed`);this.copy(l),l.dispose();for(let e of c)e.dispose()}};function Y(e,t,n,r,i,a,o){let s=e.length/3;for(let[n,r,o]of i)e.push(n,r,o),t.push(...a);for(let[e,t]of o)n.push(e,t);r.push(s,s+1,s+2,s,s+2,s+3)}var bt=[[0,0],[0,1],[1,1],[1,0]];function xt(e,t,n,r,i){Y(e.positions,e.normals,e.uvs,e.indices,[[-t,n,i],[-t,r,i],[t,r,i],[t,n,i]],[0,0,1],[[0,0],[0,1],[1,1],[1,0]])}function St(e,t,n,r,i){Y(e.positions,e.normals,e.uvs,e.indices,[[-t,n,r],[-t,n,i],[t,n,i],[t,n,r]],[0,1,0],bt)}function Ct(e,t,n,r,i,a){Y(e.positions,e.normals,e.uvs,e.indices,[[r,t,a],[r,t,i],[r,n,i],[r,n,a]],[1,0,0],[[0,0],[0,1],[1,1],[1,0]])}function wt(e,t,n,r,i,a){Y(e.positions,e.normals,e.uvs,e.indices,[[n,t,i],[n,t,a],[r,t,a],[r,t,i]],[0,1,0],bt)}function X(e,t){return[e*Math.cos(t),e*Math.sin(t)]}function Tt(e){return[-Math.sin(e),0,Math.cos(e)]}function Et(e,t,n,r,i,a){let[o,s]=X(t,a),[c,l]=X(n,a),u=Tt(a);Y(e.positions,e.normals,e.uvs,e.indices,[[o,r,s],[o,i,s],[c,i,l],[c,r,l]],u,[[0,0],[0,1],[1,1],[1,0]])}function Dt(e,t,n,r,i,a){let[o,s]=X(t,i),[c,l]=X(t,a),[u,d]=X(n,a),[f,p]=X(n,i);Y(e.positions,e.normals,e.uvs,e.indices,[[o,r,s],[c,r,l],[u,r,d],[f,r,p]],[0,1,0],[[0,0],[1,0],[1,1],[0,1]])}function Ot(e,t,n,r,i){Y(e.positions,e.normals,e.uvs,e.indices,[[-t,n,r],[-t,n,i],[t,n,i],[t,n,r]],[0,1,0],bt)}var kt=class extends e.BufferGeometry{width;riserHeight;treadDepth;stepsPerFlight;landingSize;flightRun;totalHeight;constructor({width:t=2,riserHeight:n=.3,treadDepth:r=.5,stepsPerFlight:i=5}={}){super(),this.width=t,this.riserHeight=n,this.treadDepth=r,this.stepsPerFlight=Math.max(1,Math.round(i)),this.landingSize=t,this.flightRun=this.stepsPerFlight*this.treadDepth,this.totalHeight=this.stepsPerFlight*2*this.riserHeight;let a=t/2,o=[],s=[],c=[],l=[],u={positions:o,normals:s,uvs:c,indices:l};for(let e=0;e<this.stepsPerFlight;e++){let t=e*this.riserHeight,n=t+this.riserHeight,r=e*this.treadDepth,i=r+this.treadDepth;xt(u,a,t,n,r),St(u,a,n,r,i)}let d=this.stepsPerFlight*this.riserHeight,f=(this.stepsPerFlight-1)*this.treadDepth,p=f+this.landingSize;Ot(u,a,d,f,p);let m=-a;for(let e=0;e<this.stepsPerFlight;e++){let t=d+e*this.riserHeight,n=t+this.riserHeight,r=m-e*this.treadDepth,i=r-this.treadDepth;Ct(u,t,n,r,f,p),wt(u,n,r,i,f,p)}this.setIndex(l),this.setAttribute(`position`,new e.BufferAttribute(new Float32Array(o),3)),this.setAttribute(`normal`,new e.BufferAttribute(new Float32Array(s),3)),this.setAttribute(`uv`,new e.BufferAttribute(new Float32Array(c),2)),this.computeBoundingSphere()}},At=class extends e.BufferGeometry{innerRadius;width;outerRadius;treadDepth;riserHeight;stepCount;startAngle;stepAngle;totalHeight;totalTurn;constructor({innerRadius:t=.45,width:n=1.95,treadDepth:r=.45,riserHeight:i=.2,stepCount:a=20,startAngle:o=0,stepAngle:s}={}){super(),this.innerRadius=Math.max(.01,t),this.width=Math.max(.05,n),this.outerRadius=this.innerRadius+this.width,this.treadDepth=r,this.riserHeight=i,this.stepCount=Math.max(1,Math.round(a)),this.startAngle=o;let c=(this.innerRadius+this.outerRadius)*.5;this.stepAngle=s??Math.max(r/c,Math.PI/180),this.totalHeight=this.stepCount*this.riserHeight,this.totalTurn=this.stepCount*this.stepAngle;let l=[],u=[],d=[],f=[],p={positions:l,normals:u,uvs:d,indices:f};for(let e=0;e<this.stepCount;e++){let t=this.startAngle+e*this.stepAngle,n=t+this.stepAngle,r=e*this.riserHeight,i=r+this.riserHeight;Et(p,this.innerRadius,this.outerRadius,r,i,t),Dt(p,this.innerRadius,this.outerRadius,i,t,n)}this.setIndex(f),this.setAttribute(`position`,new e.BufferAttribute(new Float32Array(l),3)),this.setAttribute(`normal`,new e.BufferAttribute(new Float32Array(u),3)),this.setAttribute(`uv`,new e.BufferAttribute(new Float32Array(d),2)),this.computeBoundingSphere()}},jt=class extends e.BufferGeometry{width;riserHeight;treadDepth;stepCount;totalHeight;totalDepth;constructor({width:t=2,riserHeight:n=.3,treadDepth:r=.5,stepCount:i=10}={}){super(),this.width=t,this.riserHeight=n,this.treadDepth=r,this.stepCount=Math.max(1,Math.round(i)),this.totalHeight=this.stepCount*this.riserHeight,this.totalDepth=this.stepCount*this.treadDepth;let a=t/2,o=[],s=[],c=[],l=[],u={positions:o,normals:s,uvs:c,indices:l};for(let e=0;e<this.stepCount;e++){let t=e*this.riserHeight,n=t+this.riserHeight,r=e*this.treadDepth,i=r+this.treadDepth;xt(u,a,t,n,r),St(u,a,n,r,i)}this.setIndex(l),this.setAttribute(`position`,new e.BufferAttribute(new Float32Array(o),3)),this.setAttribute(`normal`,new e.BufferAttribute(new Float32Array(s),3)),this.setAttribute(`uv`,new e.BufferAttribute(new Float32Array(c),2)),this.computeBoundingSphere()}},Mt=class extends e.BufferGeometry{constructor(){super();let t=new e.LatheGeometry([new e.Vector2(0,0),new e.Vector2(1.2,0),new e.Vector2(1.5,1.5),new e.Vector2(1,3),new e.Vector2(.6,3.5),new e.Vector2(.5,3.5)],10),n=new e.CylinderGeometry(.6,.5,.3,10);n.translate(0,3.5,0),this.copy((0,r.mergeGeometries)([t,n],!0))}};function Nt(e,t,n,r,i){let a=(r-t)/(n-e);return e+(i-t)/a}function Pt(e,t,n,r,i){return t+(r-t)/(n-e)*(i-e)}var Ft={calculateXFromSlopeIntercept:Nt,calculateYFromSlopeIntercept:Pt},It=class extends e.BufferGeometry{constructor(){super();let t=new e.LatheGeometry([new e.Vector2(0,0),new e.Vector2(.8,0),new e.Vector2(1,1.5),new e.Vector2(.5,2.2),new e.Vector2(.6,2.5),new e.Vector2(.5,2.5)],10),n=new e.CylinderGeometry(.55,.45,.2,10);n.translate(0,2.5,0);let i=new e.LatheGeometry([new e.Vector2(0,0),new e.Vector2(.8,0),new e.Vector2(Nt(.8,0,1,1.5,1),1),new e.Vector2(0,1)],10);i.translate(0,.1,0),i.scale(.9,.9,.9),this.copy((0,r.mergeGeometries)([t,n,i],!0))}},Lt=class extends e.BufferGeometry{radius;height;constructor({radius:t=.5,neckRadius:n=.2,height:i=3,neckHeight:a=1,segments:o=16}={}){super(),this.radius=t,this.height=i;let s=i-a,c=new e.CylinderGeometry(t,t,s,o);c.translate(0,s/2,0);let l=.3,u=new e.CylinderGeometry(n,t,l,o);u.translate(0,s+l/2,0);let d=new e.CylinderGeometry(n,n,a,o);d.translate(0,s+l+a/2,0),this.copy((0,r.mergeGeometries)([c,u,d],!1))}},Rt=class extends e.BufferGeometry{width;height;depth;constructor({width:t=.4,height:n=1.2,depth:i=.2}={}){super(),this.width=t,this.height=n,this.depth=i;let a=n*.6,o=new e.BoxGeometry(t/2,a,i);o.translate(0,a/2,0);let s=new e.BoxGeometry(t*1.5,t/4,i);s.translate(0,a*.75,0),this.copy((0,r.mergeGeometries)([o,s],!1)),this.computeVertexNormals()}},zt=class extends e.BufferGeometry{constructor(){super();let t=new e.BoxGeometry(5,1,5);t.translate(0,.5,0);let n=new e.BoxGeometry(4,3,4);n.translate(0,2.5,0);let i=[[-1.8,2.3,-2.2],[1.8,2.3,-2.2],[-1.8,2.3,2.2],[1.8,2.3,2.2]],a=[];i.forEach(t=>{let n=new e.CylinderGeometry(.2,.2,3.5,16);n.translate(t[0],t[1],t[2]),a.push(n)});let o=new e.ConeGeometry(3.5,2,4);o.rotateY(Math.PI/4),o.translate(0,5,0);let s=new e.Shape;s.moveTo(-1,0),s.lineTo(-1,2),s.absarc(0,2,1,Math.PI,0,!0),s.lineTo(1,0);let c=new e.ExtrudeGeometry(s,{depth:.5,bevelEnabled:!1});c.translate(0,.5,1.7),c.setIndex([...Array(c.attributes.position.count).keys()]),this.copy((0,r.mergeGeometries)([t,(0,r.mergeGeometries)([n,...a],!1),o,c],!0)),this.computeVertexNormals()}},Bt=class extends e.BufferGeometry{totalHeight;baseWidth;constructor({totalHeight:t=1.75,baseWidth:n=.75}={}){super(),this.totalHeight=t,this.baseWidth=n;let i=t*.05,a=t*.15,o=t*.15,s=t*.75,c=0,l=new e.BoxGeometry(n,i,n);l.translate(0,c+i/2,0),c+=i;let u=new e.BoxGeometry(n*.8,a,n*.8);u.translate(0,c+a/2,0),c+=a;let d=new e.BoxGeometry(n*.6,o,n*.6);d.translate(0,c+o/2,0),c+=o;let f=new e.BoxGeometry(n*.4,s,n*.4);f.translate(0,c+s/2,0),c+=s;let p=new e.ConeGeometry(n*.4/Math.sqrt(2),.1,4,1,!1,Math.PI/4);p.translate(0,c+.1/2,0),this.copy((0,r.mergeGeometries)([l,u,d,f,p],!1)),this.computeVertexNormals()}},Vt=class extends e.BufferGeometry{constructor(t=.6,n=1,i=.2,a=.6){super();let o=n-a/2,s=new e.BoxGeometry(t,o,i);s.translate(0,o/2,0);let c=new e.CylinderGeometry(a/2,a/2,i,16,1,!1,0,Math.PI);c.rotateY(Math.PI/2),c.rotateX(Math.PI/2),c.translate(0,o,0),this.copy((0,r.mergeGeometries)([s,c],!1)),this.computeVertexNormals()}},Ht=class extends e.BufferGeometry{constructor(t=.5,n=.8,r=.15){super();let i=new e.BoxGeometry(t,n,r);i.translate(0,n/2,0),this.copy(i)}},Ut=class extends e.BufferGeometry{height;constructor({height:t=2.25}={}){super(),this.height=t;let n=new e.BoxGeometry(1.2,.5,1.2);n.translate(0,.25,0);let i=new e.BoxGeometry(1,t,1);i.translate(0,.5+t/2,0);let a=new e.BoxGeometry(1.4,.3,1.4);a.translate(0,.5+t+.15,0),this.copy((0,r.mergeGeometries)([n,i,a],!1))}},Wt=class extends e.BufferGeometry{barHeight;constructor({barHeight:t=2,barRadius:n=.05,spikeHeight:i=.3,spikeRadius:a=.075,spikeScaleZ:o=1,radialSegments:s=8}={}){super(),this.barHeight=t;let c=new e.CylinderGeometry(n,n,t,s);c.translate(0,t/2,0);let l=new e.ConeGeometry(a,i,s);l.translate(0,t+i/2,0),l.scale(1,1,o),this.copy((0,r.mergeGeometries)([c,l],!1))}},Gt=class extends e.BufferGeometry{count;spacing;constructor({count:t=20,spacing:n=.4,barHeight:i=2,barRadius:a=.05,spikeHeight:o=.3,spikeRadius:s=.075,spikeScaleZ:c=1,railHeight:l=.1,railDepth:u=.05,railOffset:d=0,radialSegments:f=8}={}){super(),this.count=t,this.spacing=n;let p=[],m=new Wt({barHeight:i,barRadius:a,spikeHeight:o,spikeRadius:s,spikeScaleZ:c,radialSegments:f}),h=new e.BoxGeometry(t*n,l,u);for(let e=0;e<t;e++){let t=m.clone();t.translate(e*n,0,0),p.push(t)}let g=h.clone();g.translate(n*(t-1)/2,i-d-l/2,0),p.push(g);let _=h.clone();_.translate(n*(t-1)/2,l/2,0),p.push(_),this.copy((0,r.mergeGeometries)(p))}},Kt=class extends e.BufferGeometry{width;height;depth;shelves;constructor({width:t=5,height:n=8,depth:i=1,shelves:a=4,frameThickness:o=.1,open:s=!1}={}){super(),this.width=t,this.height=n,this.depth=i,this.shelves=a;let c=new e.BoxGeometry(o,n,i),l=new e.BoxGeometry(t-2*o,o,i),u=c.clone();u.translate(-t/2+o/2,n/2,0);let d=c.clone();d.translate(t/2-o/2,n/2,0);let f=l.clone();f.translate(0,n-o/2,0);let p=l.clone();p.translate(0,o/2,0);let m=new e.BoxGeometry(t,n,o);m.translate(0,n/2,-i/2+o/2);let h=[],g=(n-o)/(a+1);for(let e=1;e<=a;e++){let t=l.clone();t.translate(0,o/2+e*g,0),h.push(t)}this.copy((0,r.mergeGeometries)([u,d,f,p,...s?[]:[m],...h],!1))}},qt=class extends e.BufferGeometry{constructor(){super();let t=new e.BoxGeometry(5,.3,3);t.translate(0,3.15,0);let n=new e.LatheGeometry([new e.Vector2(.2,0),new e.Vector2(.25,.5),new e.Vector2(.15,1.5),new e.Vector2(.3,3)],32),i=(0,r.mergeGeometries)([[2.1,0,1.1],[-2.1,0,1.1],[2.1,0,-1.1],[-2.1,0,-1.1]].map(e=>{let t=n.clone();return t.translate(e[0],e[1],e[2]),t}));this.copy((0,r.mergeGeometries)([t,i],!0))}},Jt=class extends e.BufferGeometry{size;lift;constructor({size:t=.13,lift:n=.22}={}){super(),this.size=t,this.lift=n;let r=[[0,1],[.34,.55],[.42,.05],[.3,-.45],[0,-1]],i=[],a=[],o=[];for(let e=0;e<r.length;e++){let[,a]=r[e];o.push(i.length/3),i.push(0,a*t,n*t*(1-Math.abs(a)))}let s=[],c=[];for(let e=0;e<r.length;e++){let[n,a]=r[e];c.push(i.length/3),i.push(n*t,a*t,0),s.push(i.length/3),i.push(-n*t,a*t,0)}for(let e=0;e<r.length-1;e++)a.push(o[e],c[e],c[e+1],o[e],c[e+1],o[e+1]),a.push(o[e],o[e+1],s[e+1],o[e],s[e+1],s[e]);this.setAttribute(`position`,new e.Float32BufferAttribute(i,3)),this.setIndex(a),this.computeVertexNormals(),this.computeBoundingSphere()}},Z=class extends i.ParametricGeometry{height;radius;segmentsU;segmentsV;constructor({height:e=.25,radius:t=.05,segmentsU:n=16,segmentsV:r=16}={}){super((n,r,i)=>{let a=n*Math.PI*2,o=Math.sin(r*Math.PI),s=t*o*Math.cos(a),c=r*e,l=t*o*Math.sin(a);i.set(s,c,-l)},n,r),this.height=e,this.radius=t,this.segmentsU=n,this.segmentsV=r}},Yt=class extends e.BufferGeometry{radiusTop;radiusBottom;height;flameHeight;flameRadius;segments;constructor({radiusTop:t=.2,radiusBottom:n=.2,height:i=1,flameHeight:a=.25,flameRadius:o=.05,segments:s=16}={}){super(),this.radiusTop=t,this.radiusBottom=n,this.height=i,this.flameHeight=a,this.flameRadius=o,this.segments=s;let c=new e.CylinderGeometry(t,n,i,s);c.translate(0,i/2,0);let l=new Z({segmentsU:s,segmentsV:s,height:a,radius:o});l.translate(0,i,0),this.copy((0,r.mergeGeometries)([c,l],!0))}},Xt=class extends e.BufferGeometry{baseWidth;bodyHeight;baseHeight;innerScale;inner;lampCenterY;constructor({baseWidth:t=.5,bodyHeight:n=1.3,baseHeight:i=.2,roofHeight:a=.5,roofRadius:o=t*1.1,glassRadiusScale:s=.9,innerScale:c=.96,handleRadius:l=t*.8,handleTubeRadius:u=.05,handleLift:d=.35,segments:f=8,inner:p=!0}={}){super(),this.baseWidth=t,this.bodyHeight=n,this.baseHeight=i,this.innerScale=c,this.inner=p,this.lampCenterY=i+n/2;let m=[],h=new e.CylinderGeometry(t,t,i,f);h.translate(0,i/2,0),m.push(h);let g=i+n,_=new e.ConeGeometry(o,a,f);_.translate(0,g+a/2,0),m.push(_);let v=g+a,y=new e.TorusGeometry(l,u,f,f*2);y.translate(0,v+d,0),m.push(y);let b=[(0,r.mergeGeometries)(m.map(e=>e.toNonIndexed()),!1)];if(p){let r=new e.CylinderGeometry(t*s*c,t*s*c,n*c,f);r.translate(0,this.lampCenterY,0),b.push(r.toNonIndexed())}this.copy((0,r.mergeGeometries)(b,!0)),this.computeBoundingSphere()}},Zt=new e.Vector3(0,1,0);function Qt(t,n,r){let i=n.clone().sub(t),a=new e.BoxGeometry(r,i.length(),r);a.applyQuaternion(new e.Quaternion().setFromUnitVectors(Zt,i.normalize()));let o=t.clone().add(n).multiplyScalar(.5);return a.translate(o.x,o.y,o.z),a}var $t=class extends e.BufferGeometry{drop;chainWidth;capWidth;capHeight;capDepth;capOffset;cageRadius;cageStretch;cageGap;cageBarWidth;innerScale;inner;cageCenterY;constructor({drop:t=3,chainWidth:n=.05,capWidth:i=.18,capHeight:a=.16,capDepth:o=.18,capOffset:s=.02,cageRadius:c=.42,cageStretch:l=1.4,cageGap:u=0,cageBarWidth:d=.03,innerScale:f=.96,inner:p=!0}={}){super(),this.drop=t,this.chainWidth=n,this.capWidth=i,this.capHeight=a,this.capDepth=o,this.capOffset=s,this.cageRadius=c,this.cageStretch=l,this.cageGap=u,this.cageBarWidth=d,this.innerScale=f,this.inner=p;let m=-t+s;this.cageCenterY=m-c*l-u;let h=[],g=new e.BoxGeometry(n,t,n);g.translate(0,-t/2,0),h.push(g);let _=new e.BoxGeometry(i,a,o);_.translate(0,-t+s,0),h.push(_);let v=this.cageCenterY,y=c,b=new e.Vector3(0,v+y*l,0),x=new e.Vector3(0,v-y*l,0),S=new e.Vector3(y,v,0),C=new e.Vector3(-y,v,0),w=new e.Vector3(0,v,y),T=new e.Vector3(0,v,-y),E=[[b,S],[b,C],[b,w],[b,T],[x,S],[x,C],[x,w],[x,T],[S,w],[w,C],[C,T],[T,S]].map(([e,t])=>Qt(e,t,d)),D=[(0,r.mergeGeometries)(h.map(e=>e.toNonIndexed()),!1),(0,r.mergeGeometries)(E.map(e=>e.toNonIndexed()),!1)];if(p){let t=new e.OctahedronGeometry(c*f,0);t.scale(1,l,1),t.translate(0,v,0),D.push(t.toNonIndexed())}this.copy((0,r.mergeGeometries)(D,!0)),this.computeBoundingSphere()}},en=class extends e.BufferGeometry{bodyOffsetX;chimneyCenterY;innerScale;inner;lightCenterX;lightCenterY;lightCenterZ;constructor({plateThickness:t=.05,plateHeight:n=.22,plateDepth:i=.28,plateOffsetX:a=-.055,bracketLength:o=.1,bracketHeight:s=.05,bracketDepth:c=.07,bracketOffsetX:l=-.005,bracketOffsetY:u=.1,bodyOffsetX:d=.06,chimneyHeight:f=.3,chimneyTopRadius:p=.1,chimneyBottomRadius:m=.105,chimneyCenterY:h=-.05,capRadius:g=.115,capHeight:_=.05,capCenterY:v=.12,bowlTopRadius:y=.09,bowlBottomRadius:b=.11,bowlHeight:x=.05,bowlCenterY:S=-.22,radialSegments:C=8,innerScale:w=.96,inner:T=!0}={}){super(),this.bodyOffsetX=d,this.chimneyCenterY=h,this.innerScale=w,this.inner=T,this.lightCenterX=d,this.lightCenterY=h,this.lightCenterZ=0;let E=[],D=new e.BoxGeometry(t,n,i);D.translate(a,0,0),E.push(D);let O=new e.BoxGeometry(o,s,c);O.translate(l,u,0),E.push(O);let k=[],A=new e.CylinderGeometry(g,g,_,C);A.translate(d,v,0),k.push(A);let j=new e.CylinderGeometry(y,b,x,C);j.translate(d,S,0),k.push(j);let M=[(0,r.mergeGeometries)(E.map(e=>e.toNonIndexed()),!1),(0,r.mergeGeometries)(k.map(e=>e.toNonIndexed()),!1)];if(T){let t=new e.CylinderGeometry(p*w,m*w,f*w,C);t.translate(d,h,0),M.push(t.toNonIndexed())}this.copy((0,r.mergeGeometries)(M,!0)),this.computeBoundingSphere()}},tn=class extends e.BufferGeometry{constructor(t=1,n=2,r=.5,i=Math.PI/4){super();let a=n*Math.tan(i),o=t,s=n,c=r,l=[0,0,0,o,0,0,o+a,s,0,a,s,0,o,0,-c,0,0,-c,a,s,-c,o+a,s,-c,0,0,-c,0,0,0,a,s,0,a,s,-c,o,0,0,o,0,-c,o+a,s,-c,o+a,s,0,a,s,0,o+a,s,0,o+a,s,-c,a,s,-c,0,0,-c,o,0,-c,o,0,0,0,0,0],u=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],d=[0,1,2,2,3,0,4,5,6,6,7,4,8,9,10,10,11,8,12,13,14,14,15,12,16,17,18,18,19,16,20,21,22,22,23,20],f=new Float32Array([0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1]),p=new Float32Array(l),m=new Float32Array(u),h=new Float32Array(f),g=new Uint16Array(d);this.setAttribute(`position`,new e.BufferAttribute(p,3)),this.setAttribute(`normal`,new e.BufferAttribute(m,3)),this.setAttribute(`uv`,new e.BufferAttribute(h,2)),this.setIndex(new e.BufferAttribute(g,1)),this.center()}},nn=class extends e.Shape{constructor(t=5,n=.5,r=1,i=5,a=.25){super();let o=Math.PI*2/t,s=o/4;this.moveTo(Math.cos(0)*r,-Math.sin(0)*r);for(let e=1;e<=t;++e)this.lineTo(Math.cos(o*e-s*3)*n,-Math.sin(o*e-s*3)*n),this.lineTo(Math.cos(o*e-s*2)*n,-Math.sin(o*e-s*2)*n),this.lineTo(Math.cos(o*e-s)*r,-Math.sin(o*e-s)*r),this.lineTo(Math.cos(o*e)*r,-Math.sin(o*e)*r);if(this.closePath(),a>0&&i>2){let t=new e.Path,n=Math.PI*2/i;t.moveTo(Math.cos(0)*a,-Math.sin(0)*a);for(let e=1;e<i;++e)t.lineTo(Math.cos(n*e)*a,-Math.sin(n*e)*a);t.lineTo(Math.cos(0)*a,-Math.sin(0)*a),this.holes.push(t)}}},rn=class extends e.ExtrudeGeometry{constructor({sides:e=5,innerRadius:t=.5,outerRadius:n=1,holeSides:r=5,holeRadius:i=.25,depth:a=.25}={}){super(new nn(e,t,n,r,i),{depth:a,bevelEnabled:!1})}},an=class extends e.Shape{constructor(e=1,t=2.1,n=1.4,r=1.6){super(),this.moveTo(0,n*e/3),this.bezierCurveTo(-t*.375*e,n*e,-t*e,n*e/3,0,-r*e),this.bezierCurveTo(t*e,n*e/3,t*.375*e,n*e,0,n*e/3)}},on=class extends e.ExtrudeGeometry{constructor({size:e=1,width:t=2.1,height:n=1.4,tipDepth:r=1.6,depth:i=.25}={}){super(new an(e,t,n,r),{depth:i,bevelEnabled:!1})}},sn=class extends e.Shape{constructor(e=5,t=.5,n=1){super();let r=Math.PI*2/e,i=r/2;this.moveTo(Math.cos(0)*n,Math.sin(0)*n);for(let a=1;a<=e;++a)this.lineTo(Math.cos(r*a-i)*t,Math.sin(r*a-i)*t),this.lineTo(Math.cos(r*a)*n,Math.sin(r*a)*n);this.closePath()}},cn=class extends e.ExtrudeGeometry{constructor({points:e=5,innerRadius:t=.5,outerRadius:n=1,depth:r=.25}={}){super(new sn(e,t,n),{depth:r,bevelEnabled:!1})}},ln=class extends e.BufferGeometry{constructor(t=.1,n=.1,i=.4,a=8){super();let o=new e.CylinderGeometry(t*.6,n*.6,i,a);o.translate(0,0,0);let s=new e.SphereGeometry(t,a,a),c=s.clone(),l=s.clone(),u=s.clone(),d=s.clone();c.translate(0,i/2+t*.6,-t*.6),l.translate(0,i/2+t*.6,t*.6),u.translate(0,-i/2-n*.6,-n*.6),d.translate(0,-i/2-n*.6,n*.6),this.copy((0,r.mergeGeometries)([o,c,l,u,d],!1))}},un=class extends e.BufferGeometry{flaskRadius;height;constructor({flaskRadius:t=1,neckRadius:n=.3,height:i=2.5,neckHeight:a=1,radialSegments:o=16}={}){super(),this.flaskRadius=t,this.height=i;let s=new e.LatheGeometry([new e.Vector2(0,0),new e.Vector2(t*.875,0),new e.Vector2(t,.1),new e.Vector2(n,i),new e.Vector2(n,i+a),new e.Vector2(n*1.1,i+a+.3)],o);this.copy((0,r.mergeGeometries)([s],!1))}},dn=(e,t)=>e/(1-Math.cos(t)),fn=(e,t)=>e/(2*Math.sin(t)),pn=(e,t)=>e*(1-Math.cos(t)),mn=(e,t)=>2*e*Math.sin(t),hn=(e,t)=>{let n=2*t;return Math.asin(n/(2*e))},gn=(e,t,n)=>({x:e*Math.sin(n)*Math.cos(t),y:e*Math.sin(n)*Math.sin(t),z:e*Math.cos(n)}),_n=(e,t,n)=>{let r=Math.sqrt(e*e+t*t+n*n);return{radius:r,theta:Math.atan2(t,e),phi:Math.acos(n/r)}};function vn(t,n,r,i=0,a=0,o=32){let s=i?hn(t,i):0,c=a?Math.PI-hn(t,a):Math.PI,l=[];for(let i=0;i<=o;i++){let a=c-(c-s)/o*i,u=t*Math.sin(a),d=n*Math.cos(a)+r;l.push(new e.Vector2(u,d))}return[...l]}var yn=class extends e.BufferGeometry{constructor(){super();let t=new e.LatheGeometry([...vn(1,1,.5,.2,0,32),new e.Vector2(.2,3)],32);this.copy(t)}},bn=class extends e.BufferGeometry{constructor(){super();let t=new e.LatheGeometry([new e.Vector2(1,0),new e.Vector2(1.2,.5),new e.Vector2(1.4,1.5),new e.Vector2(1.3,1.8),new e.Vector2(.8,1.8)],12),n=new e.CircleGeometry(1,12);n.rotateX(-Math.PI/2),n.translate(0,0,0),this.copy((0,r.mergeGeometries)([t,n],!1))}},xn=class extends e.BufferGeometry{radius;height;count;constructor({radius:t=.3,height:n=.4,count:i=3,thickness:a=.03,radialSegments:o=16}={}){super(),this.radius=t,this.height=n,this.count=i;let s=new e.TorusGeometry(t,a,8,o);s.rotateX(Math.PI/2),s.translate(0,n,0);let c=new e.CylinderGeometry(a*.6,a*.6,n,o),l=[];for(let e=0;e<i;e++){let r=e/i*Math.PI*2,a=c.clone();a.translate(Math.cos(r)*t,n/2,Math.sin(r)*t),l.push(a)}this.copy((0,r.mergeGeometries)([s,...l],!1))}},Sn=class extends e.BufferGeometry{constructor(){super();let t=new e.CylinderGeometry(.5,.6,.3,16);t.translate(0,.15,0);let n=new e.CylinderGeometry(.15,.15,2,12,1,!0);n.translate(0,1.3,0);let i=new e.SphereGeometry(.3,16,16);i.translate(0,2.4,0),this.copy((0,r.mergeGeometries)([t,(0,r.mergeGeometries)([n,i])],!0))}},Q=class extends e.BufferGeometry{constructor(t=.2,n=.2,i=3,a=32,o=!0){super();let s=new e.CylinderGeometry(t,n,i,a,1,o),c=new e.SphereGeometry(n,a,a/2,0,Math.PI*2,Math.PI/2,Math.PI/2);c.translate(0,-(i/2),0),this.copy((0,r.mergeGeometries)([s,c],!1))}},Cn=class extends e.BufferGeometry{radius;height;constructor({radius:t=8,height:n=1.2,radialSegments:r=40,angularSegments:i=64,noiseHeight:a=.5,noiseScale:o=.35,octaves:s=4,persistence:c=.5,rim:l=.82,seed:u=1}={}){super(),this.radius=t,this.height=n;let d=Math.max(1,Math.round(r)),f=Math.max(3,Math.round(i)),p=e=>.5+.5*Math.cos(Math.PI*e),m=e=>{if(e<=l)return 1;let t=(e-l)/(1-l);return 1-t*t*(3-2*t)},h=(e,t,r)=>p(e)*n+Be(t*o,r*o,u,s,c)*a*m(e),g=1+d*f,_=new Float32Array(g*3),v=new Float32Array(g*2);_[1]=h(0,0,0),v[0]=.5,v[1]=.5;for(let e=1;e<=d;e++){let n=e/d,r=n*t;for(let i=0;i<f;i++){let a=i/f*Math.PI*2,o=Math.cos(a)*r,s=Math.sin(a)*r,c=1+(e-1)*f+i;_[c*3]=o,_[c*3+1]=h(n,o,s),_[c*3+2]=s,v[c*2]=o/(2*t)+.5,v[c*2+1]=s/(2*t)+.5}}let y=(e,t)=>1+(e-1)*f+t%f,b=[];for(let e=0;e<f;e++)b.push(0,y(1,e+1),y(1,e));for(let e=1;e<d;e++)for(let t=0;t<f;t++){let n=y(e,t),r=y(e,t+1),i=y(e+1,t),a=y(e+1,t+1);b.push(n,a,i),b.push(n,r,a)}this.setAttribute(`position`,new e.BufferAttribute(_,3)),this.setAttribute(`uv`,new e.BufferAttribute(v,2)),this.setIndex(b),this.computeVertexNormals()}},wn=class extends e.BufferGeometry{width;depth;constructor({width:t=16,depth:n=16,widthSegments:r=48,depthSegments:i=48,noiseHeight:a=.8,noiseScale:o=.35,octaves:s=4,persistence:c=.5,edgeFalloff:l=0,seed:u=1}={}){super(),this.width=t,this.depth=n;let d=Math.max(1,Math.round(r)),f=Math.max(1,Math.round(i)),p=t/2,m=n/2,h=Math.min(Math.max(l,0),1),g=(e,t)=>{if(h<=0)return 1;let n=Math.min(e+p,p-e)/p,r=Math.min(t+m,m-t)/m,i=Math.min(n,r);if(i>=h)return 1;let a=i/h;return a*a*(3-2*a)},_=(d+1)*(f+1),v=new Float32Array(_*3),y=new Float32Array(_*2);for(let e=0;e<=f;e++){let r=-m+e/f*n;for(let n=0;n<=d;n++){let i=-p+n/d*t,l=Be(i*o,r*o,u,s,c)*a*g(i,r),m=e*(d+1)+n;v[m*3]=i,v[m*3+1]=l,v[m*3+2]=r,y[m*2]=n/d,y[m*2+1]=e/f}}let b=[],x=(e,t)=>t*(d+1)+e;for(let e=0;e<f;e++)for(let t=0;t<d;t++){let n=x(t,e),r=x(t+1,e),i=x(t,e+1),a=x(t+1,e+1);b.push(n,i,r),b.push(r,i,a)}this.setAttribute(`position`,new e.BufferAttribute(v,3)),this.setAttribute(`uv`,new e.BufferAttribute(y,2)),this.setIndex(b),this.computeVertexNormals()}},Tn=class extends e.BufferGeometry{trunkRadiusTop;trunkRadiusBottom;trunkHeight;trunkSegments;leafSize;leafCount;leafDetail;leafSpreadRadius;constructor({trunkRadiusTop:t=.25,trunkRadiusBottom:n=.4,trunkHeight:i=2.5,trunkSegments:a=14,leafSize:o=.8,leafCount:s=6,leafDetail:c=0,leafSpreadRadius:l=1.5}={}){super(),this.trunkRadiusTop=t,this.trunkRadiusBottom=n,this.trunkHeight=i,this.trunkSegments=a,this.leafSize=o,this.leafCount=s,this.leafDetail=c,this.leafSpreadRadius=l;let u=new e.CylinderGeometry(t,n,i,a);u.translate(0,i/2,0);let d=[];for(let t=0;t<s;t++){let t=new e.DodecahedronGeometry(o,c);t.translate((Math.random()-.5)*l,(Math.random()-.5)*o+i,(Math.random()-.5)*l),d.push(t)}this.copy((0,r.mergeGeometries)([u.toNonIndexed(),(0,r.mergeGeometries)(d,!1)],!0)),this.computeVertexNormals()}},En=class extends e.Mesh{width;riserHeight;treadDepth;stepsPerFlight;landingSize;flightRun;totalHeight;constructor({color:t=`#8b4513`,...n}={}){let r=new kt(n);super(r,new e.MeshStandardMaterial({color:new e.Color(t),roughness:.85,metalness:.04,side:e.DoubleSide})),this.width=r.width,this.riserHeight=r.riserHeight,this.treadDepth=r.treadDepth,this.stepsPerFlight=r.stepsPerFlight,this.landingSize=r.landingSize,this.flightRun=r.flightRun,this.totalHeight=r.totalHeight}},Dn=class extends e.Mesh{innerRadius;width;outerRadius;treadDepth;riserHeight;stepCount;stepAngle;totalHeight;totalTurn;constructor({color:t=`#8b4513`,...n}={}){let r=new At(n);super(r,new e.MeshStandardMaterial({color:new e.Color(t),roughness:.85,metalness:.04,side:e.DoubleSide})),this.innerRadius=r.innerRadius,this.width=r.width,this.outerRadius=r.outerRadius,this.treadDepth=r.treadDepth,this.riserHeight=r.riserHeight,this.stepCount=r.stepCount,this.stepAngle=r.stepAngle,this.totalHeight=r.totalHeight,this.totalTurn=r.totalTurn}},On=class extends e.Mesh{width;riserHeight;treadDepth;stepCount;totalHeight;totalDepth;constructor({color:t=`#8b4513`,...n}={}){let r=new jt(n);super(r,new e.MeshStandardMaterial({color:new e.Color(t),roughness:.85,metalness:.04,side:e.DoubleSide})),this.width=r.width,this.riserHeight=r.riserHeight,this.treadDepth=r.treadDepth,this.stepCount=r.stepCount,this.totalHeight=r.totalHeight,this.totalDepth=r.totalDepth}},kn=48,An=class extends e.Group{lattice;frame;glass;cellsX;cellsY;fittedGrid;opening;constructor({leadColor:t=`#0c0f14`,glass:n=!1,glassColor:r=`#6a7d8c`,glassEmissive:i,glassEmissiveIntensity:a=0,width:o=4.5,rectHeight:s=4,archHeight:c,centerY:l=0,leadThickness:u=.055,leadDepth:d=.11,...f}={}){super(),this.opening=G({width:o,rectHeight:s,archHeight:c,centerY:l});let p=new ht({width:o,rectHeight:s,archHeight:c,centerY:l,leadThickness:u,leadDepth:d,...f});this.cellsX=p.cellsX,this.cellsY=p.cellsY,this.fittedGrid=p.fittedGrid;let m=new e.Color(t);if(n){let t=new e.Shape;K(t,this.opening);let n=new e.ShapeGeometry(t,kn),o=new e.MeshPhysicalMaterial({color:new e.Color(r),emissive:i?new e.Color(i):new e.Color(0),emissiveIntensity:a,transparent:!0,depthWrite:!1,roughness:.08,metalness:0,transmission:i?.5:.88,thickness:d*.5,side:e.DoubleSide});this.glass=new e.Mesh(n,o),this.glass.renderOrder=0,this.glass.castShadow=!1,this.glass.receiveShadow=!1,this.add(this.glass)}let h=new e.MeshStandardMaterial({color:m,roughness:.7,metalness:.35,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1});this.lattice=new e.Mesh(p,h),this.lattice.castShadow=!0,this.lattice.renderOrder=1,this.add(this.lattice);let g=ot(this.opening,u,d);this.frame=new e.Mesh(g,new e.MeshStandardMaterial({color:m,roughness:.7,metalness:.35})),this.frame.castShadow=!0,this.frame.renderOrder=2,this.add(this.frame)}},jn=class extends e.Group{lattice;glass;cellsX;cellsY;fittedGrid;constructor({leadColor:t=`#0c0f14`,glass:n=!1,glassColor:r=`#6a7d8c`,glassEmissive:i,glassEmissiveIntensity:a=0,centerY:o=0,leadDepth:s=.11,...c}={}){super();let l=new gt({centerY:o,leadDepth:s,...c});this.cellsX=l.cellsX,this.cellsY=l.cellsY,this.fittedGrid=l.fittedGrid;let u=new e.MeshStandardMaterial({color:new e.Color(t),roughness:.7,metalness:.35,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1});if(this.lattice=new e.Mesh(l,u),this.lattice.castShadow=!0,this.lattice.renderOrder=1,this.add(this.lattice),n){let t=c.width??4.5,n=c.height??5.5,l=new e.MeshPhysicalMaterial({color:new e.Color(r),emissive:i?new e.Color(i):new e.Color(0),emissiveIntensity:a,transparent:!0,depthWrite:!1,roughness:.08,metalness:0,transmission:i?.5:.88,thickness:s*.5,side:e.DoubleSide});this.glass=new e.Mesh(new e.PlaneGeometry(t,n),l),this.glass.position.y=o,this.glass.renderOrder=0,this.glass.castShadow=!1,this.glass.receiveShadow=!1,this.add(this.glass)}}},Mn=class extends e.Group{mullions;glass;cellsX;cellsY;fittedGrid;constructor({mullionColor:t=`#5c4033`,glass:n=!1,glassColor:r=`#6a7d8c`,glassEmissive:i,glassEmissiveIntensity:a=0,...o}={}){super();let s=new yt(o);this.cellsX=s.cellsX,this.cellsY=s.cellsY,this.fittedGrid=s.fittedGrid;let c=new e.MeshStandardMaterial({color:new e.Color(t),roughness:.85,metalness:.05});if(this.mullions=new e.Mesh(s,c),this.mullions.castShadow=!0,this.mullions.renderOrder=1,this.add(this.mullions),n){let t=o.width??4.5,n=o.height??5.5,s=new e.MeshPhysicalMaterial({color:new e.Color(r),emissive:i?new e.Color(i):new e.Color(0),emissiveIntensity:a,transparent:!0,depthWrite:!1,roughness:.08,metalness:0,transmission:i?.5:.88,thickness:.02,side:e.DoubleSide});this.glass=new e.Mesh(new e.PlaneGeometry(t,n),s),this.glass.renderOrder=0,this.glass.castShadow=!1,this.glass.receiveShadow=!1,this.add(this.glass)}}},Nn=class extends e.Mesh{width;height;depth;coverThickness;pageIndent;constructor({coverColor:t=`#8b0000`,pageColor:n=`#ffffff`,...r}={}){let i=new L(r);super(i,[new e.MeshStandardMaterial({color:new e.Color(t),metalness:.1,roughness:.7,flatShading:!0}),new e.MeshStandardMaterial({color:new e.Color(n),flatShading:!0})]),this.width=i.width,this.height=i.height,this.depth=i.depth,this.coverThickness=i.coverThickness,this.pageIndent=i.pageIndent}},Pn=class extends e.Mesh{constructor(){super(new Mt,[new e.MeshStandardMaterial({color:8965290,transparent:!0,depthWrite:!1,opacity:.4,roughness:.1,metalness:.5,side:e.DoubleSide}),new e.MeshStandardMaterial({color:9127187,roughness:1})])}},Fn=class extends e.Mesh{constructor(){super(new It,[new e.MeshStandardMaterial({color:8965375,transparent:!0,depthWrite:!1,opacity:.5,roughness:.1,metalness:.3}),new e.MeshStandardMaterial({color:9127187,roughness:1}),new e.MeshStandardMaterial({color:O.PINK_SHERBET,transparent:!0,depthWrite:!1,opacity:.5})])}},In=class extends e.Mesh{constructor({color:t=`#556b2f`,...n}={}){super(new Lt(n),new e.MeshPhysicalMaterial({color:new e.Color(t),roughness:.1,transmission:.9,thickness:.2,metalness:0,clearcoat:1,clearcoatRoughness:.1}))}},Ln=class extends e.Mesh{width;height;constructor({color:t=`#777777`,roughness:n=.8,...r}={}){let i=new Rt(r);super(i,new e.MeshStandardMaterial({color:new e.Color(t),roughness:n})),this.width=i.width,this.height=i.height}},Rn=class extends e.Mesh{constructor(){super(new zt,[new e.MeshStandardMaterial({color:8421504,flatShading:!0}),new e.MeshStandardMaterial({color:6908265,flatShading:!0}),new e.MeshStandardMaterial({color:5263440,flatShading:!0}),new e.MeshStandardMaterial({color:4210752,flatShading:!0})])}},zn=class extends e.Mesh{totalHeight;constructor({color:t=`#777777`,roughness:n=.8,...r}={}){let i=new Bt(r);super(i,new e.MeshStandardMaterial({color:new e.Color(t),roughness:n})),this.totalHeight=i.totalHeight}},Bn=class extends e.Mesh{constructor(t=.6,n=1,r=.2,i=.6){super(new Vt(t,n,r,i),new e.MeshStandardMaterial({color:7829367,roughness:.8}))}},Vn=class extends e.Mesh{constructor(t=.5,n=.8,r=.15){super(new Ht(t,n,r),new e.MeshStandardMaterial({color:7829367,roughness:.8}))}},Hn=class extends e.Mesh{height;constructor({color:t=`#8b7d7b`,...n}={}){let r=new Ut(n);super(r,new e.MeshStandardMaterial({color:new e.Color(t),flatShading:!0})),this.height=r.height}},Un=class extends e.Mesh{barHeight;constructor({color:t=`#333333`,...n}={}){let r=new Wt(n);super(r,new e.MeshStandardMaterial({color:new e.Color(t),metalness:.8,roughness:.4})),this.barHeight=r.barHeight}},Wn=class extends e.Mesh{count;constructor({color:t=`#333333`,...n}={}){let r=new Gt(n);super(r,new e.MeshStandardMaterial({color:new e.Color(t),metalness:.8,roughness:.4})),this.count=r.count}},Gn=class extends e.Mesh{width;height;constructor({color:t=`#8b4513`,...n}={}){let r=new Kt(n);super(r,new e.MeshStandardMaterial({color:new e.Color(t)})),this.width=r.width,this.height=r.height}},Kn=class extends e.Mesh{constructor(){super(new qt,[new e.MeshStandardMaterial({color:9132587}),new e.MeshStandardMaterial({color:4929057})])}},qn=class extends e.Mesh{size;lift;constructor({color:t=`#a8702c`,...n}={}){let r=new Jt(n);super(r,new e.MeshStandardMaterial({color:new e.Color(t),roughness:.85,metalness:.05,flatShading:!0,side:e.DoubleSide})),this.size=r.size,this.lift=r.lift}},Jn=class extends e.Mesh{height;constructor({stickColor:t=`#ffffff`,flameColor:n=`#ffd700`,flameEmissive:r=`#ffa500`,flameEmissiveIntensity:i=.35,...a}={}){let o=new Yt(a);super(o,[new e.MeshStandardMaterial({color:new e.Color(t),flatShading:!0}),new e.MeshStandardMaterial({color:new e.Color(n),emissive:new e.Color(r),emissiveIntensity:i,flatShading:!0,toneMapped:!1})]),this.height=o.height}},Yn=class extends e.Mesh{height;radius;segmentsU;segmentsV;constructor({color:t=`#ffd700`,emissive:n=`#ffa500`,emissiveIntensity:r=.35,...i}={}){let a=new Z(i);super(a,new e.MeshStandardMaterial({color:new e.Color(t),emissive:new e.Color(n),emissiveIntensity:r,flatShading:!0,toneMapped:!1})),this.height=a.height,this.radius=a.radius,this.segmentsU=a.segmentsU,this.segmentsV=a.segmentsV}},Xn=class extends e.Mesh{drop;cageCenterY;constructor({color:t=`#171a1f`,mountColor:n,cageColor:r,lampColor:i=`#ffb45a`,lampEmissiveIntensity:a=1.4,lampOpacity:o=.88,inner:s=!0,...c}={}){let l=new $t({inner:s,...c}),u=new e.Color(i),d=[new e.MeshStandardMaterial({color:new e.Color(n??t),metalness:.7,roughness:.5,flatShading:!0}),new e.MeshStandardMaterial({color:new e.Color(r??t),metalness:.7,roughness:.5,flatShading:!0})];s&&d.push(new e.MeshStandardMaterial({color:u,emissive:u,emissiveIntensity:a,transparent:o<1,opacity:o,roughness:.35,metalness:0,flatShading:!0,side:e.DoubleSide,toneMapped:!1})),super(l,d),this.drop=l.drop,this.cageCenterY=l.cageCenterY}},Zn=class extends e.Mesh{lightCenterX;lightCenterY;lightCenterZ;constructor({color:t=`#1c1e24`,mountColor:n,frameColor:r,lampColor:i=`#e8a058`,lampEmissiveIntensity:a=1.4,lampOpacity:o=.88,inner:s=!0,...c}={}){let l=new en({inner:s,...c}),u=new e.Color(i),d=[new e.MeshStandardMaterial({color:new e.Color(n??t),metalness:.65,roughness:.55,flatShading:!0}),new e.MeshStandardMaterial({color:new e.Color(r??t),metalness:.65,roughness:.55,flatShading:!0})];s&&d.push(new e.MeshStandardMaterial({color:u,emissive:u,emissiveIntensity:a,transparent:o<1,opacity:o,roughness:.35,metalness:0,flatShading:!0,side:e.DoubleSide,toneMapped:!1})),super(l,d),this.lightCenterX=l.lightCenterX,this.lightCenterY=l.lightCenterY,this.lightCenterZ=l.lightCenterZ}},Qn=class extends e.Mesh{lampCenterY;constructor({color:t=`#8b4513`,lampColor:n=`#ffd700`,lampEmissiveIntensity:r=1.2,lampOpacity:i=.75,inner:a=!0,...o}={}){let s=new Xt({inner:a,...o}),c=new e.Color(n),l=[new e.MeshStandardMaterial({color:new e.Color(t),roughness:.85,metalness:.04,flatShading:!0})];a&&l.push(new e.MeshStandardMaterial({color:c,emissive:c,emissiveIntensity:r,transparent:i<1,opacity:i,roughness:.35,metalness:0,flatShading:!0,side:e.DoubleSide,toneMapped:!1})),super(s,l),this.lampCenterY=s.lampCenterY}},$n=class extends e.Mesh{radius;constructor({color:t=`#6f6f6f`,flatShading:n=!0,...r}={}){let i=new H(r);super(i,new e.MeshStandardMaterial({color:new e.Color(t),roughness:1,metalness:0,flatShading:n})),this.radius=i.radius,this.castShadow=!0,this.receiveShadow=!0}},er=class extends e.Mesh{constructor({rockColor:t=`#808080`,mossColor:n=`#4b8b3b`,mossOpacity:r=.8,...i}={}){super(new Ke(i),[new e.MeshStandardMaterial({color:new e.Color(t),flatShading:!0}),new e.MeshStandardMaterial({color:new e.Color(n),flatShading:!0,opacity:r,transparent:r<1})])}},tr=class extends e.Mesh{constructor({color:t=`#808080`,...n}={}){super(new Je(n),new e.MeshStandardMaterial({color:new e.Color(t),flatShading:!0}))}},nr=class extends e.Group{constructor(){super();let t=new e.Mesh(new e.CylinderGeometry(.3,.4,.1,16),new e.MeshStandardMaterial({color:3355443,roughness:.6,metalness:.3}));t.position.y=.05;let n=new e.Mesh(new e.CylinderGeometry(.1,.1,.7,16),new e.MeshStandardMaterial({color:5592405,roughness:.5,metalness:.4}));n.position.y=.4;let r=new e.Mesh(new e.ConeGeometry(.075,.2,16),new e.MeshStandardMaterial({color:16733440,emissive:16733440,emissiveIntensity:.6,transparent:!0,opacity:.8}));r.position.y=.8,this.add(t,n,r)}},rr=class extends e.Group{constructor(){super();let t=new e.BoxGeometry(3,4,.1),n=new e.MeshStandardMaterial({color:3026478,roughness:.8,metalness:.6}),r=new e.BoxGeometry(.2,.5,.2),i=new e.MeshStandardMaterial({color:11184810,roughness:.5,metalness:.7}),a=new e.CylinderGeometry(.3,.3,.1,16),o=new e.MeshStandardMaterial({color:5592405,roughness:.7,metalness:.5}),s=new e.Mesh(t,n);for(let t=-1;t<=1;t++){let n=new e.Mesh(r,i);n.position.set(t,1.5,.1),s.add(n)}let c=new e.Mesh(a,o);c.rotation.x=Math.PI/2,c.position.set(0,.5,.15),s.add(c);let l=new e.Mesh(new e.SphereGeometry(.15,8,8),new e.MeshStandardMaterial({color:16711680,emissive:16711680,emissiveIntensity:.5}));l.position.set(0,-1,.1),s.add(l),this.add(s)}},ir=class extends e.Mesh{constructor({color:t=`#88ccff`,opacity:n=.4,...r}={}){super(new un(r),new e.MeshPhysicalMaterial({color:new e.Color(t),transparent:!0,opacity:n,roughness:.1,metalness:.1,reflectivity:.8,transmission:.9,side:e.DoubleSide}))}},ar=class extends e.Mesh{constructor(){super(new yn,new e.MeshPhysicalMaterial({color:8965375,transparent:!0,depthWrite:!1,opacity:.4,roughness:.1,metalness:.1,reflectivity:.8,transmission:.9,side:e.DoubleSide}))}},or=class extends e.Group{constructor(){super();let t=new e.Mesh(new e.BoxGeometry(2,3,.1),new e.MeshStandardMaterial({color:3355443,roughness:.8,metalness:.5})),n=new e.CylinderGeometry(.1,.1,.2,8),r=new e.CylinderGeometry(.05,.05,1,8),i=new e.MeshStandardMaterial({color:11184810,roughness:.5,metalness:.7}),a=[];for(let t=-.5;t<=.5;t+=.5){let o=new e.Mesh(n,i);o.position.set(t,1,.1);let s=new e.Mesh(r,i);s.position.y=.5,o.add(s),a.push(s),this.add(o)}this.add(t)}},sr=class extends e.Group{constructor(){super();let t=new e.BoxGeometry(1,.2,.5),n=new e.MeshStandardMaterial({color:4473924,roughness:.6,metalness:.3}),r=new e.Mesh(t,n);r.position.y=.1;let i=new e.Mesh(new e.BoxGeometry(.2,1,.2),n);i.position.set(0,.6,-.2);let a=new e.Mesh(new e.CylinderGeometry(.1,.1,.4,8),new e.MeshStandardMaterial({color:3355443,roughness:.5,metalness:.6}));a.position.set(0,1.1,-.35),a.rotation.x=-Math.PI/4;let o=new e.Mesh(new e.BoxGeometry(.6,.1,.6),new e.MeshStandardMaterial({color:5592405,roughness:.8,metalness:.2}));o.position.set(0,.6,0),this.add(r,i,a,o)}},cr=class extends e.Group{constructor(){super();let t=new bn,n=new e.CylinderGeometry(.2,.3,1.5,8);n.translate(0,.75,0);let r=new e.MeshStandardMaterial({color:6045747,roughness:1,metalness:0,side:e.DoubleSide}),i=new e.MeshStandardMaterial({color:9132587,roughness:.8,metalness:.1}),a=new e.Mesh(t,r);a.castShadow=!0;let o=new e.Mesh(n,i);o.castShadow=!0,o.position.set(.3,1.3,0),o.rotation.z=Math.PI/4,this.add(a,o)}},lr=class extends e.Mesh{geometry;material;constructor({width:t=3,height:n=4,depth:r=.1}={}){super(),this.geometry=new e.BoxGeometry(t,n,r),this.material=new e.MeshStandardMaterial({color:3026478,roughness:.8,metalness:.6})}},ur=class extends e.Mesh{geometry;material;constructor({radius:t=.15,color:n=16762823,emissive:r=16711680,emissiveIntensity:i=.5}={}){super(),this.geometry=new e.SphereGeometry(t,8,8),this.material=new e.MeshStandardMaterial({color:n,emissive:r,emissiveIntensity:i})}},dr=class extends e.Group{constructor(){super();let t=new e.Mesh(new e.TubeGeometry(new e.CatmullRomCurve3(Array.from({length:100},(t,n)=>{let r=n*.2;return new e.Vector3(Math.cos(r)*.4,n*.05,Math.sin(r)*.4)})),200,.1,8,!1),new e.MeshStandardMaterial({color:8965375,transparent:!0,opacity:.3,roughness:.1,metalness:.2,emissive:8965375,emissiveIntensity:.2}));this.add(t)}},fr=class extends e.Mesh{constructor({color:t=`#888888`,...n}={}){super(new xn(n),new e.MeshStandardMaterial({color:new e.Color(t),roughness:.7,metalness:.3}))}},pr=class extends e.Mesh{constructor(){super(new Sn,[new e.MeshStandardMaterial({color:3355443,roughness:.6,metalness:.5}),new e.MeshStandardMaterial({color:16737792,roughness:.5,metalness:.8,side:e.DoubleSide})])}},mr=class extends e.Mesh{constructor(t=.2,n=.2,r=3,i=32){super(new Q(t,n,r,i),new e.MeshPhysicalMaterial({color:8965375,transparent:!0,opacity:.4,roughness:.1,metalness:.1,reflectivity:.8,transmission:.9,depthWrite:!1,side:e.DoubleSide}))}},hr=class extends e.Group{count;constructor({count:t=3,colors:n=[`#00ffaa`,`#ff00aa`,`#aa00ff`]}={}){super(),this.count=t;let r=new e.Mesh(new e.BoxGeometry(3,.2,1),new e.MeshStandardMaterial({color:9127187,roughness:.7,metalness:.3}));r.position.y=.5,r.castShadow=!0;let i=new Q(.1,.1,1,16),a=new e.MeshStandardMaterial({color:11184810,transparent:!0,opacity:.4,roughness:.1,metalness:.5,depthWrite:!1,side:e.DoubleSide});for(let o=0;o<t;o++){let s=new e.Mesh(i,a),c=(o-(t-1)/2)*.8;s.position.set(c,1,0),s.castShadow=!0,s.renderOrder=2;let l=new Q(.099,.099,.5,16,!1),u=n[o%n.length],d=new e.Mesh(l,new e.MeshStandardMaterial({color:new e.Color(u),emissive:new e.Color(u),emissiveIntensity:.5,transparent:!0,opacity:.6,depthWrite:!1,side:e.DoubleSide}));d.position.set(0,-.25,0),d.renderOrder=1,s.add(d),r.add(s)}this.add(r)}},gr=class extends e.Mesh{constructor({color:t=`#ffff00`,emissive:n=`#ffd700`,emissiveIntensity:r=.25,...i}={}){super(new Te(i),new e.MeshStandardMaterial({color:new e.Color(t),emissive:new e.Color(n),emissiveIntensity:r,metalness:.1,roughness:.3,flatShading:!0}))}},_r=class extends e.Mesh{constructor({color:t=`#aaaaaa`,...n}={}){super(new rn(n),new e.MeshStandardMaterial({color:new e.Color(t),metalness:.8,roughness:.2}))}},vr=class extends e.Mesh{constructor({color:t=`#c62828`,emissive:n=`#c61416`,emissiveIntensity:r=.25,...i}={}){super(new on(i),new e.MeshStandardMaterial({color:new e.Color(t),emissive:new e.Color(n),emissiveIntensity:r,metalness:.1,roughness:.3,flatShading:!0}))}},yr=class extends e.Mesh{constructor({color:t=`#ffffff`,emissive:n=`#ffffff`,emissiveIntensity:r=.1,...i}={}){super(new U(i),new e.MeshStandardMaterial({color:new e.Color(t),emissive:new e.Color(n),emissiveIntensity:r,metalness:.1,roughness:.3,flatShading:!0}))}},br=class extends e.Mesh{constructor({color:t=`#ffff00`,emissive:n=`#ffd700`,emissiveIntensity:r=.25,...i}={}){super(new cn(i),new e.MeshStandardMaterial({color:new e.Color(t),emissive:new e.Color(n),emissiveIntensity:r,metalness:.1,roughness:.3,flatShading:!0}))}},xr=class extends e.Mesh{constructor(){super(new ln,new e.MeshStandardMaterial({color:16777215}))}},Sr=class extends e.Mesh{trunkHeight;constructor({trunkColor:t=`#8b4513`,leafColor:n=`#228b22`,...r}={}){let i=new Tn(r);super(i,[new e.MeshStandardMaterial({color:new e.Color(t),roughness:.9,metalness:0,flatShading:!0}),new e.MeshStandardMaterial({color:new e.Color(n),roughness:.8,metalness:0,flatShading:!0})]),this.trunkHeight=i.trunkHeight}},Cr=class extends e.Mesh{radius;height;constructor({color:t=`#3a5a3a`,flatShading:n=!0,...r}={}){let i=new Cn(r);super(i,new e.MeshStandardMaterial({color:new e.Color(t),roughness:1,metalness:0,flatShading:n,side:e.DoubleSide})),this.radius=i.radius,this.height=i.height,this.castShadow=!0,this.receiveShadow=!0}},wr=class extends e.Mesh{width;depth;constructor({color:t=`#3a5a3a`,flatShading:n=!0,...r}={}){let i=new wn(r);super(i,new e.MeshStandardMaterial({color:new e.Color(t),roughness:1,metalness:0,flatShading:n,side:e.DoubleSide})),this.width=i.width,this.depth=i.depth,this.castShadow=!0,this.receiveShadow=!0}},Tr=t=>{let n=new Uint8Array(4*t*t);for(let e=0;e<t*t;e++){let r=e*4,i=(e%t^Math.floor(e/t))&1?255:0;n[r]=i,n[r+1]=i,n[r+2]=i,n[r+3]=255}let r=new e.DataTexture(n,t,t,e.RGBAFormat,e.UnsignedByteType);return r.wrapS=e.RepeatWrapping,r.wrapT=e.RepeatWrapping,r.minFilter=e.NearestFilter,r.needsUpdate=!0,r};function Er(t,n){if(t.length===0)throw Error(`No objects provided for alignment.`);let r=new e.Box3,i=new e.Vector3,a=t.map(e=>(r.setFromObject(e),e.getWorldPosition(i),{object:e,boundingBox:r.clone(),worldPosition:i.clone()})),o=a.reduce((e,{boundingBox:t})=>{switch(n){case D.LEFT:return Math.min(e,t.min.x);case D.RIGHT:return Math.max(e,t.max.x);case D.BOTTOM:return Math.min(e,t.min.y);case D.TOP:return Math.max(e,t.max.y);case D.BACK:return Math.min(e,t.min.z);case D.FRONT:return Math.max(e,t.max.z);default:throw Error(`Unsupported side type: ${n}`)}},n===D.RIGHT||n===D.TOP||n===D.FRONT?-1/0:1/0);a.forEach(({object:e,boundingBox:t})=>{switch(n){case D.LEFT:e.position.x+=o-t.min.x;break;case D.RIGHT:e.position.x+=o-t.max.x;break;case D.BOTTOM:e.position.y+=o-t.min.y;break;case D.TOP:e.position.y+=o-t.max.y;break;case D.BACK:e.position.z+=o-t.min.z;break;case D.FRONT:e.position.z+=o-t.max.z;break}})}function Dr(t,n=v.RIGHT,r=0){let i=n.clone().normalize(),a=new e.Vector3,o=new e.Box3;t.forEach(t=>{o.setFromObject(t);let n=new e.Vector3(o.max.x-o.min.x,o.max.y-o.min.y,o.max.z-o.min.z).dot(i),s=new e.Vector3;o.getCenter(s);let c=i.clone().multiplyScalar(n/2);t.position.copy(a.clone().add(c).sub(s).add(t.position)),a.add(i.clone().multiplyScalar(n+r))})}function Or(t,n,r=new e.Vector3(0,0,0)){let i=new e.Box3().setFromObject(t);if(i.isEmpty())console.warn(`The object has no geometry or is not visible.`);else{let a=i.min,o=new e.Vector3((a.x+i.max.x)/2,a.y,(a.z+i.max.z)/2);t.localToWorld(o);let s=n.clone().sub(o).add(r),c=t.worldToLocal(s.clone());t.position.add(c)}}function kr(t,n){let r=new e.Box3().setFromBufferAttribute(new e.Float32BufferAttribute(t.attributes.position.array,3));if(r.isEmpty())console.warn(`The geometry is empty or invalid.`);else{let e=r.min.y;t.translate(0,n-e,0)}}function Ar(t,n,r=new e.Vector3(0,0,0)){let i=new e.Box3().setFromObject(t);if(i.isEmpty())console.warn(`The InstancedMesh has no geometry or is not visible.`);else{let a=i.min.y,o=new e.Vector3(0,n.y-a,0).add(r),s=t.worldToLocal(o.clone());t.position.add(s)}}function jr(t,n,r,i=new e.Vector3(0,0,0)){let a=new e.Box3().setFromObject(t);if(a.isEmpty())console.warn(`The instanced mesh has invalid geometry.`);else{let o=a.min.y,s=new e.Matrix4;t.getMatrixAt(r,s);let c=new e.Vector3,l=new e.Quaternion,u=new e.Vector3;s.decompose(c,l,u),c.y=t.worldToLocal(n.clone()).y-o+i.y,s.compose(c,l,u),t.setMatrixAt(r,s),t.instanceMatrix.needsUpdate=!0}}function Mr(t,n=new e.Vector3(0,0,0),r=new e.Vector3(0,0,0)){let i=new e.Box3().setFromObject(t).getCenter(new e.Vector3),a=new e.Vector3().addVectors(n,r),o=new e.Vector3().subVectors(a,i);t.position.add(o)}function Nr(t,n=new e.Vector3(0,0,0),r=new e.Vector3(0,0,0)){let i=new e.Box3().setFromObject(t).getCenter(new e.Vector3),a=new e.Vector3().addVectors(n,r);t.translateX(a.x-i.x),t.translateY(a.y-i.y),t.translateZ(a.z-i.z),t.updateMatrixWorld(!0)}function Pr(t,n=new e.Vector3(0,0,0),r=new e.Vector3(0,0,0)){t.geometry.computeBoundingBox();let i=t.geometry.boundingBox;if(i){let a=i.getCenter(new e.Vector3),o=new e.Vector3().addVectors(n,r),s=new e.Vector3().subVectors(o,a);t.geometry.translate(s.x,s.y,s.z)}}var Fr={object:Mr,objectGeometry:Nr,meshGeometry:Pr};function Ir(e){let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]}function Lr(e){let[t,n,r]=$(e);return Hr(t,n,r)}function $(e){return[e>>16&255,e>>8&255,e&255]}function Rr(e,t,n){t/=100,n/=100;function r(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}let i,a,o;if(t===0)i=a=o=n;else{let s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;i=r(c,s,e/360+1/3),a=r(c,s,e/360),o=r(c,s,e/360-1/3)}let s=e=>Math.round(e*255);return[s(i),s(a),s(o)]}function zr(e,t,n){t/=100,n/=100;let r=t=>(t+e/30)%12,i=t*Math.min(n,1-n),a=e=>n-i*Math.max(-1,Math.min(r(e)-3,Math.min(9-r(e),1)));return[a(0)*255,a(8)*255,a(4)*255]}function Br(e,t,n){return[e/255,t/255,n/255]}function Vr(e,t,n){return e=Math.round(e),t=Math.round(t),n=Math.round(n),(e<<16)+(t<<8)+n}function Hr(e,t,n){e/=255,t/=255,n/=255;let r=Math.max(e,t,n),i=Math.min(e,t,n),a=r-i,o=0,s=0,c=(r+i)/2;a!==0&&(r===e?o=((t-n)/a+(t<n?6:0))*60:r===t?o=((n-e)/a+2)*60:r===n&&(o=((e-t)/a+4)*60)),a!==0&&(s=a/(1-Math.abs(2*c-1))),o=Math.round(o),s=Math.round(s*100);let l=Math.round(c*100);return[o,s,l]}function Ur(e,t){return Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2)}function Wr(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])+Math.abs(e[2]-t[2])}function Gr(e,t){let n=$(e),r=null,i=1/0;for(let e of t){let t=Ur(n,$(e));t<i&&(i=t,r=e)}return r}function Kr(e,t){let n=$(e),r=null,i=1/0;for(let e of t){let t=Wr(n,$(e));t<i&&(i=t,r=e)}return r}function qr(e){return zr((e+Math.floor(-30+Math.random()*61))%360,Math.floor(60+Math.random()*21),Math.floor(50+Math.random()*21))}function Jr(t,n){if(!n.geometry.isBufferGeometry)throw Error(`Mesh must have a BufferGeometry.`);let r=n.geometry.getAttribute(`position`),i=new e.Vector3,a=new e.Vector3,o=1/0;for(let e=0;e<r.count;e++){a.fromBufferAttribute(r,e);let n=a.distanceTo(t);n<o&&(o=n,i.copy(a))}return n.localToWorld(i),i}function Yr(e,t,n){return Math.max(0,Math.min(1,(e-t)/(n-t)))}function Xr(t,n,r,i,a,o=20,s=0,c=1){let l=[];for(let u=0;u<=o;u++){let d=u/o,f=n+t(Yr(d,s,c))*(r-n),p=i+d*(a-i);l.push(new e.Vector2(f,p))}return l}var Zr=(t,n,r,i,a=24)=>{let o=[];for(let s=0;s<=a;s++){let c=s/a,l=k.cubic(c,t.x,n.x,r.x,i.x),u=k.cubic(c,t.y,n.y,r.y,i.y);o.push(new e.Vector2(l,u))}return o},Qr=(t,n,r,i=24)=>{let a=[];for(let o=0;o<=i;o++){let s=o/i,c=k.damped(s,r)*(n.x-t.x)+t.x,l=t.y+s*(n.y-t.y);a.push(new e.Vector2(c,l))}return a},$r=(t,n,r,i,a=24)=>{let o=[];for(let s=0;s<=a;s++){let c=s/a,l=k.exponential(c,r,i)*(n.x-t.x)+t.x,u=t.y+c*(n.y-t.y);o.push(new e.Vector2(l,u))}return o},ei=(t,n,r,i,a=24)=>{let o=[];for(let s=0;s<=a;s++){let c=s/a,l=k.logarithmic(c,r,i)*(n.x-t.x)+t.x,u=t.y+c*(n.y-t.y);o.push(new e.Vector2(l,u))}return o},ti=(t,n,r,i,a,o=24)=>{let s=[];for(let c=0;c<=o;c++){let l=c/o,u=r*l*l+i*l+a+t.x,d=t.y+l*(n.y-t.y);s.push(new e.Vector2(u,d))}return s},ni=(t,n,r,i=24)=>{let a=[];for(let o=0;o<=i;o++){let s=o/i,c=k.quadratic(s,t.x,n.x,r.x),l=k.quadratic(s,t.y,n.y,r.y);a.push(new e.Vector2(c,l))}return a},ri=(t,n,r,i=24)=>{let a=[];for(let o=0;o<=i;o++){let s=o/i,c=k.sigmoid(s,r)*(n.x-t.x)+t.x,l=t.y+s*(n.y-t.y);a.push(new e.Vector2(c,l))}return a},ii={createCubicCurvePoints:Zr,createDampedCurvePoints:Qr,createExponentialCurvePoints:$r,createLogarithmicCurvePoints:ei,createParabolicCurvePoints:ti,createQuadraticCurvePoints:ni,createSigmoidCurvePoints:ri};function ai(e,t,n,r,i,a=[0,0],o=[1,0],s=[0,1],c=[1,1]){let l=i||oi(e,t,n);return[{pos:e,norm:l,uv:a},{pos:t,norm:l,uv:o},{pos:r,norm:l,uv:c},{pos:e,norm:l,uv:a},{pos:r,norm:l,uv:c},{pos:n,norm:l,uv:s}]}function oi(e,t,n){let r=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],i=[n[0]-e[0],n[1]-e[1],n[2]-e[2]],a=[r[1]*i[2]-r[2]*i[1],r[2]*i[0]-r[0]*i[2],r[0]*i[1]-r[1]*i[0]],o=Math.sqrt(a[0]**2+a[1]**2+a[2]**2);return a.map(e=>e/o)}function si(e,t,n){let r=t+Math.random()*(n-t);return setTimeout(e,r)}function ci(e,t,n){let r;function i(){let a=t+Math.random()*(n-t);r=setTimeout(()=>{e(),i()},a)}return i(),()=>clearTimeout(r)}function li(e,t){return e.map(([e,n,r])=>{switch(t){case`x`:return[n,r];case`y`:return[e,r];case`z`:return[e,n];default:throw Error(`Invalid axis: ${t}`)}})}function ui(e){let[t,n,r]=e,i=Math.abs(t),a=Math.abs(n),o=Math.abs(r);return i>=a&&i>=o?[r>0?r:-r,n]:a>=i&&a>=o?[t,r>0?r:-r]:[t,n]}function di(e){return e.map(e=>ui(e))}function fi(e){return e.map(([e,t,n])=>{let r=Math.atan2(n,e),i=Math.acos(t/Math.sqrt(e**2+t**2+n**2));return[r/(2*Math.PI)+.5,1-i/Math.PI]})}function pi(e){return e.map(([e,t,n])=>[Math.atan2(n,e)/(2*Math.PI)+.5,t])}function mi(e){return e.map(([e,t,n])=>{let r=Math.sqrt(e**2+n**2);return[Math.atan2(n,e)/(2*Math.PI)+.5,r]})}function hi(e,t,n,r,i){return[(e[0]-t)/(n-t),(e[1]-r)/(i-r)]}function gi(e,t,n){let[r,i]=t,[a,o]=n;return e.map(e=>hi(e,r,a,i,o))}function _i(e){let t=Math.min(...e.map(e=>e[0])),n=Math.max(...e.map(e=>e[0])),r=Math.min(...e.map(e=>e[1])),i=Math.max(...e.map(e=>e[1]));return{minBounds:[t,r],maxBounds:[n,i]}}exports.ArchedDiamondLatticeWindow=An,exports.ArchedDiamondLatticeWindowGeometry=ht,exports.Axis=E,exports.Bone=xr,exports.BoneGeometry=ln,exports.Book=Nn,exports.BookGeometry=L,exports.Bookshelf=Gn,exports.BookshelfGeometry=Kt,exports.Boulder=$n,exports.BoulderGeometry=H,exports.BoxSide=D,exports.BunsenBurner=nr,exports.Burst=gr,exports.BurstGeometry=Te,exports.BurstShape=we,exports.CameraPlayback=c,exports.Candle=Jn,exports.CandleGeometry=Yt,exports.Center=Fr,exports.ColorPalette=O,exports.CrossHeadstone=Ln,exports.CrossHeadstoneGeometry=Rt,exports.Desk=Kn,exports.DeskGeometry=qt,exports.DiamondLatticeWindow=jn,exports.DiamondLatticeWindowGeometry=gt,exports.Direction=v,exports.DustMotesEffect=se,exports.Easing=l,exports.EffervescenceEffect=ce,exports.ElectricPanel=rr,exports.EllipticLeafGeometry=be,exports.EmissivePulseEffect=le,exports.ErlenmeyerFlask=ir,exports.ErlenmeyerFlaskGeometry=un,exports.Falloff=y,exports.Flame=Yn,exports.FlameFlickerEffect=ue,exports.FlameGeometry=Z,exports.FlorenceFlask=ar,exports.FlorenceFlaskGeometry=yn,exports.Gear=_r,exports.GearGeometry=rn,exports.GearShape=nn,exports.GlowHalo=fe,exports.GregorianLatticeWindow=Mn,exports.GregorianLatticeWindowGeometry=yt,exports.GroundFogEffect=pe,exports.HangingLantern=Xn,exports.HangingLanternGeometry=$t,exports.Heart=vr,exports.HeartGeometry=on,exports.HeartShape=an,exports.Hexagon=yr,exports.HexagonGeometry=U,exports.HexagonShape=Ue,exports.Jar=Pn,exports.JarGeometry=Mt,exports.LShapedStaircase=En,exports.LShapedStaircaseGeometry=kt,exports.Lantern=Qn,exports.LanternGeometry=Xt,exports.Leaf=qn,exports.LeafGeometry=Jt,exports.LeverPanel=or,exports.LightningEffect=ye,exports.LineEquations=Ft,exports.Mausoleum=Rn,exports.MausoleumGeometry=zt,exports.Microscope=sr,exports.MortarAndPestle=cr,exports.MortarGeometry=bn,exports.MossyRock=er,exports.MossyRockGeometry=Ke,exports.ObeliskHeadstone=zn,exports.ObeliskHeadstoneGeometry=Bt,exports.Panel=lr,exports.PanelLight=ur,exports.ParallelogramBoxGeometry=tn,exports.ParametricCurve=k,exports.ParametricCurveUtils=ii,exports.PetalDriftEffect=xe,exports.PotionBottle=Fn,exports.PotionBottleGeometry=It,exports.RainEffect=Ce,exports.Random=re,exports.Rock=tr,exports.RockGeometry=Je,exports.RoundedHeadstone=Bn,exports.RoundedHeadstoneGeometry=Vt,exports.SpiralStaircase=Dn,exports.SpiralStaircaseGeometry=At,exports.SpiralTube=dr,exports.SquareHeadstone=Vn,exports.SquareHeadstoneGeometry=Ht,exports.Staircase=On,exports.StaircaseGeometry=jt,exports.Stand=fr,exports.StandGeometry=xn,exports.Star=br,exports.StarFieldEffect=Ae,exports.StarGeometry=cn,exports.StarShape=sn,exports.StoneFencePost=Hn,exports.StoneFencePostGeometry=Ut,exports.TerrainMound=Cr,exports.TerrainMoundGeometry=Cn,exports.TerrainPlane=wr,exports.TerrainPlaneGeometry=wn,exports.TeslaCoil=pr,exports.TeslaCoilGeometry=Sn,exports.TestTube=mr,exports.TestTubeGeometry=Q,exports.TestTubeRack=hr,exports.Tree=Sr,exports.TreeGeometry=Tn,exports.WallSconce=Zn,exports.WallSconceGeometry=en,exports.WineBottle=In,exports.WineBottleGeometry=Lt,exports.WispEffect=je,exports.WroughtIronBar=Un,exports.WroughtIronBarGeometry=Wt,exports.WroughtIronFence=Wn,exports.WroughtIronFenceGeometry=Gt,exports.alignBufferGeometryToSurface=kr,exports.alignInstancedMeshIndexToSurface=jr,exports.alignInstancedMeshToSurface=Ar,exports.alignObjectToSurface=Or,exports.alignToEdge=Er,exports.alignToRow=Dr,exports.appendSphericalCurve=vn,exports.applySnapshot=o,exports.archedOpeningMetrics=G,exports.buildArchedDiamondLatticeCameParts=J,exports.buildArchedDiamondLatticeFrameGeometry=ot,exports.buildArchedDiamondLatticeParts=pt,exports.buildDiamondLatticeCameParts=rt,exports.buildDiamondLatticeParts=nt,exports.buildGregorianLatticeParts=vt,exports.calculateChannelDifference=Wr,exports.calculateDistance=Ur,exports.calculateNormal=oi,exports.calculateUVBounds=_i,exports.calculateXFromSlopeIntercept=Nt,exports.calculateYFromSlopeIntercept=Pt,exports.capHeightFromRadius=pn,exports.capWidthFromRadius=mn,exports.captureSnapshot=a,exports.cartesianToSpherical=_n,exports.centerMeshGeometry=Pr,exports.centerObject=Mr,exports.centerObjectGeometry=Nr,exports.checkerboardTexture=Tr,exports.clipSegmentToAabb=it,exports.clipSegmentToArchedOpening=ut,exports.createCubicCurvePoints=Zr,exports.createDampedCurvePoints=Qr,exports.createDollyClip=m,exports.createExponentialCurvePoints=$r,exports.createFlythroughClip=p,exports.createHexagonalTilesByCount=We,exports.createHexagonalTilesByRadius=Ge,exports.createLogarithmicCurvePoints=ei,exports.createOrbitClip=d,exports.createParabolicCurvePoints=ti,exports.createPendulumClip=f,exports.createQuad=ai,exports.createQuadraticCurvePoints=ni,exports.createRandom=N,exports.createSigmoidCurvePoints=ri,exports.createSpiralClip=h,exports.createWobbleClip=_,exports.createZoomClip=g,exports.cubicUVMapping=ui,exports.cubicUVMappingBatch=di,exports.cylindricalUVMapping=pi,exports.deriveSubSeed=M,exports.diamondLatticeCellFromCount=tt,exports.diamondLatticeCornerSpan=Qe,exports.diamondLatticeGridFromCells=$e,exports.diamondLatticeSpringPhaseShift=st,exports.displacementBrush=b,exports.findClosestColor=Gr,exports.findClosestColorChannelWise=Kr,exports.findClosestPoint=Jr,exports.fitDiamondLatticeCell=et,exports.flattenBrush=x,exports.getAnalogousColors=qr,exports.gregorianLatticeGridFromCells=_t,exports.hexToHsl=Lr,exports.hexToRgb=$,exports.hslToHex=Rr,exports.hslToRgb=zr,exports.insetArchedOpeningMetrics=q,exports.interpolateCurve=Xr,exports.logarithmicRandomMax=ae,exports.logarithmicRandomMin=oe,exports.mulberry32=A,exports.noiseBrush=S,exports.normalizeRgb=Br,exports.normalizeUV=hi,exports.normalizeUVBatch=gi,exports.parseHexCode=Ir,exports.planarUVMapping=li,exports.polarUVMapping=mi,exports.radiusFromCapHeight=dn,exports.radiusFromCapWidth=fn,exports.randomFloat=F,exports.randomInteger=ie,exports.randomPick=ne,exports.randomRange=te,exports.randomTransformVertices=qe,exports.rgbToHex=Vr,exports.rgbToHsl=Hr,exports.rowOfBooksByCount=Fe,exports.rowOfBooksByLength=Ie,exports.rowOfBooksByScales=R,exports.scatterBoulders=He,exports.scatterMossyRocks=Ze,exports.scatterRocks=Xe,exports.setRandomInterval=ci,exports.setRandomTimeout=si,exports.smoothBrush=C,exports.sphericalToCartesian=gn,exports.sphericalUVMapping=fi,exports.spikeBrush=w,exports.splitmix32=j,exports.stackOfBooks=Le,exports.thetaLengthForRadius=hn,exports.traceArchedOpeningOutline=K,exports.twistBrush=T;
359
2
  //# sourceMappingURL=index.cjs.map