-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsliceBlendFrag.glsl
More file actions
307 lines (307 loc) · 302 KB
/
Copy pathsliceBlendFrag.glsl
File metadata and controls
307 lines (307 loc) · 302 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
`#define GLSLIFY 1
uniform sampler2D u_prevSliceTexture;uniform sampler2D u_drawnSliceTexture;varying vec2 v_uv;
#include <lightFieldSlice>
vec4 sampleSlice4(vec3 gridPos){vec3 sliceOffset=vec3(-.5,.5,0.);return(texture2D(u_drawnSliceTexture,lightFieldGridToUv(clampLightFieldGrid(gridPos+sliceOffset.xxz)))+texture2D(u_drawnSliceTexture,lightFieldGridToUv(clampLightFieldGrid(gridPos+sliceOffset.xyz)))+texture2D(u_drawnSliceTexture,lightFieldGridToUv(clampLightFieldGrid(gridPos+sliceOffset.yxz)))+texture2D(u_drawnSliceTexture,lightFieldGridToUv(clampLightFieldGrid(gridPos+sliceOffset.yyz))))/4.;}void main(){vec3 gridPos=vec3(mod(gl_FragCoord.xy,u_lightFieldGridCount.xy),dot(floor(gl_FragCoord.xy/u_lightFieldGridCount.xy),vec2(1.,u_lightFieldSliceColRowCount.x))+.5);vec4 prev=texture2D(u_prevSliceTexture,v_uv);vec4 curr=(sampleSlice4(gridPos+vec3(0.,0.,-1.))+sampleSlice4(gridPos)*2.+sampleSlice4(gridPos+vec3(0.,0.,1.)))*.25;prev+=(curr-prev)*mix(0.15,0.08,clamp(prev.r,0.,1.));gl_FragColor=prev;}`;class AboutHeroLightField{GRID_COUNT=new Vector3(64,64,64);VOLUME_SIZE=new Vector3(8,0,0);container=new Object3D;prevSliceRenderTarget=null;currSliceRenderTarget=null;drawnSliceRenderTarget=null;sliceTo3DMesh=null;sliceBlendMaterial;sliceColumnCount=0;sliceRowCount=0;gridSize=0;SHOW_TEST_VOXELS=!1;sharedUniforms={u_lightFieldTexture3D:{value:null},u_lightFieldMaxLod:{value:0},u_lightFieldSlicedTexture:{value:null},u_lightFieldSlicedTextureSize:{value:new Vector2},u_lightFieldSliceColRowCount:{value:new Vector2},u_lightFieldGridSize:{value:0},u_lightFieldGridCount:{value:this.GRID_COUNT},u_lightFieldVolumeOffset:{value:new Vector3},u_lightFieldVolumeSize:{value:new Vector3}};preInit(){}init(){shaderHelper.addChunk("lightFieldSlice",sliceShader),this.gridSize=this.VOLUME_SIZE.x/(this.GRID_COUNT.x-1),this.sharedUniforms.u_lightFieldGridSize.value=this.gridSize,this.VOLUME_SIZE.y=this.gridSize*(this.GRID_COUNT.y-1),this.VOLUME_SIZE.z=this.gridSize*(this.GRID_COUNT.z-1),this.sharedUniforms.u_lightFieldVolumeSize.value.setScalar(this.gridSize).add(this.VOLUME_SIZE),this.sharedUniforms.u_lightFieldMaxLod.value=Math.log2(Math.min(this.GRID_COUNT.x,this.GRID_COUNT.y,this.GRID_COUNT.z));let e=this.GRID_COUNT.x*this.GRID_COUNT.y*this.GRID_COUNT.z,t=this.sliceColumnCount=Math.ceil(Math.sqrt(e)/this.GRID_COUNT.x),r=this.sliceRowCount=Math.ceil(this.GRID_COUNT.z/t);this.sharedUniforms.u_lightFieldSliceColRowCount.value.set(t,r);let n=this.GRID_COUNT.x*t,a=this.GRID_COUNT.y*r;this.sharedUniforms.u_lightFieldSlicedTextureSize.value.set(n,a),this.currSliceRenderTarget=fboHelper.createRenderTarget(n,a),this.prevSliceRenderTarget=this.currSliceRenderTarget.clone(),this.drawnSliceRenderTarget=this.currSliceRenderTarget.clone(),fboHelper.clearColor(0,0,0,0,this.currSliceRenderTarget),this.sliceBlendMaterial=fboHelper.createRawShaderMaterial({uniforms:{u_lightFieldSlicedTextureSize:this.sharedUniforms.u_lightFieldSlicedTextureSize,u_lightFieldSliceColRowCount:this.sharedUniforms.u_lightFieldSliceColRowCount,u_lightFieldGridCount:this.sharedUniforms.u_lightFieldGridCount,u_lightFieldVolumeOffset:this.sharedUniforms.u_lightFieldVolumeOffset,u_lightFieldVolumeSize:this.sharedUniforms.u_lightFieldVolumeSize,u_prevSliceTexture:{value:null},u_drawnSliceTexture:{value:this.drawnSliceRenderTarget.texture}},fragmentShader:sliceBlendFrag})}update(e){let t=this.VOLUME_SIZE.clone().multiplyScalar(.5).sub(light.position).multiplyScalar(-1);this.sharedUniforms.u_lightFieldVolumeOffset.value.setScalar(-this.gridSize/2).add(t);let r=properties.renderer,n=fboHelper.getColorState(),a=r.getRenderTarget();r.setRenderTarget(this.drawnSliceRenderTarget),r.setClearColor(0,0),r.clear(),r.setRenderTarget(a),fboHelper.setColorState(n)}renderMesh(e){let t=properties.renderer,r=fboHelper.getColorState(),n=t.getRenderTarget();t.autoClearColor=!1,fboHelper.renderMesh(e,this.drawnSliceRenderTarget),t.setRenderTarget(n),fboHelper.setColorState(r)}postUpdate(e){let t=properties.renderer,r=fboHelper.getColorState(),n=t.getRenderTarget();properties.gl,t.autoClear=!1;let a=this.prevSliceRenderTarget;this.prevSliceRenderTarget=this.currSliceRenderTarget,this.currSliceRenderTarget=a,this.sharedUniforms.u_lightFieldSlicedTexture.value=this.currSliceRenderTarget.texture,this.sliceBlendMaterial.uniforms.u_prevSliceTexture.value=this.prevSliceRenderTarget.texture,fboHelper.render(this.sliceBlendMaterial,this.currSliceRenderTarget),t.setRenderTarget(n),fboHelper.setColorState(r)}}const lightField=new AboutHeroLightField,fragSim=`#define GLSLIFY 1
uniform sampler2D u_simPrevPosLifeTexture;uniform sampler2D u_simDefaultPosLifeTexture;uniform float u_introDeltaTime;uniform float u_noiseTime;uniform float u_noiseScale;uniform float u_noiseStableFactor;uniform vec3 u_lightPosition;varying vec2 v_uv;
#define PI2 6.283185307179586
vec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}float mod289(float x){return x-floor(x*(1.0/289.0))*289.0;}vec4 permute(vec4 x){return mod289(((x*34.0)+1.0)*x);}float permute(float x){return mod289(((x*34.0)+1.0)*x);}vec4 taylorInvSqrt(vec4 r){return 1.79284291400159-0.85373472095314*r;}float taylorInvSqrt(float r){return 1.79284291400159-0.85373472095314*r;}vec4 grad4(float j,vec4 ip){const vec4 ones=vec4(1.0,1.0,1.0,-1.0);vec4 p,s;p.xyz=floor(fract(vec3(j)*ip.xyz)*7.0)*ip.z-1.0;p.w=1.5-dot(abs(p.xyz),ones.xyz);s=vec4(lessThan(p,vec4(0.0)));p.xyz=p.xyz+(s.xyz*2.0-1.0)*s.www;return p;}
#define F4 0.309016994374947451
vec4 simplexNoiseDerivatives(vec4 v){const vec4 C=vec4(0.138196601125011,0.276393202250021,0.414589803375032,-0.447213595499958);vec4 i=floor(v+dot(v,vec4(F4)));vec4 x0=v-i+dot(i,C.xxxx);vec4 i0;vec3 isX=step(x0.yzw,x0.xxx);vec3 isYZ=step(x0.zww,x0.yyz);i0.x=isX.x+isX.y+isX.z;i0.yzw=1.0-isX;i0.y+=isYZ.x+isYZ.y;i0.zw+=1.0-isYZ.xy;i0.z+=isYZ.z;i0.w+=1.0-isYZ.z;vec4 i3=clamp(i0,0.0,1.0);vec4 i2=clamp(i0-1.0,0.0,1.0);vec4 i1=clamp(i0-2.0,0.0,1.0);vec4 x1=x0-i1+C.xxxx;vec4 x2=x0-i2+C.yyyy;vec4 x3=x0-i3+C.zzzz;vec4 x4=x0+C.wwww;i=mod289(i);float j0=permute(permute(permute(permute(i.w)+i.z)+i.y)+i.x);vec4 j1=permute(permute(permute(permute(i.w+vec4(i1.w,i2.w,i3.w,1.0))+i.z+vec4(i1.z,i2.z,i3.z,1.0))+i.y+vec4(i1.y,i2.y,i3.y,1.0))+i.x+vec4(i1.x,i2.x,i3.x,1.0));vec4 ip=vec4(1.0/294.0,1.0/49.0,1.0/7.0,0.0);vec4 p0=grad4(j0,ip);vec4 p1=grad4(j1.x,ip);vec4 p2=grad4(j1.y,ip);vec4 p3=grad4(j1.z,ip);vec4 p4=grad4(j1.w,ip);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;p4*=taylorInvSqrt(dot(p4,p4));vec3 values0=vec3(dot(p0,x0),dot(p1,x1),dot(p2,x2));vec2 values1=vec2(dot(p3,x3),dot(p4,x4));vec3 m0=max(0.5-vec3(dot(x0,x0),dot(x1,x1),dot(x2,x2)),0.0);vec2 m1=max(0.5-vec2(dot(x3,x3),dot(x4,x4)),0.0);vec3 temp0=-6.0*m0*m0*values0;vec2 temp1=-6.0*m1*m1*values1;vec3 mmm0=m0*m0*m0;vec2 mmm1=m1*m1*m1;float dx=temp0[0]*x0.x+temp0[1]*x1.x+temp0[2]*x2.x+temp1[0]*x3.x+temp1[1]*x4.x+mmm0[0]*p0.x+mmm0[1]*p1.x+mmm0[2]*p2.x+mmm1[0]*p3.x+mmm1[1]*p4.x;float dy=temp0[0]*x0.y+temp0[1]*x1.y+temp0[2]*x2.y+temp1[0]*x3.y+temp1[1]*x4.y+mmm0[0]*p0.y+mmm0[1]*p1.y+mmm0[2]*p2.y+mmm1[0]*p3.y+mmm1[1]*p4.y;float dz=temp0[0]*x0.z+temp0[1]*x1.z+temp0[2]*x2.z+temp1[0]*x3.z+temp1[1]*x4.z+mmm0[0]*p0.z+mmm0[1]*p1.z+mmm0[2]*p2.z+mmm1[0]*p3.z+mmm1[1]*p4.z;float dw=temp0[0]*x0.w+temp0[1]*x1.w+temp0[2]*x2.w+temp1[0]*x3.w+temp1[1]*x4.w+mmm0[0]*p0.w+mmm0[1]*p1.w+mmm0[2]*p2.w+mmm1[0]*p3.w+mmm1[1]*p4.w;return vec4(dx,dy,dz,dw)*49.0;}vec3 curl(in vec3 p,in float noiseTime,in float persistence){vec4 xNoisePotentialDerivatives=vec4(0.0);vec4 yNoisePotentialDerivatives=vec4(0.0);vec4 zNoisePotentialDerivatives=vec4(0.0);for(int i=0;i<2;++i){float twoPowI=pow(2.0,float(i));float scale=0.5*twoPowI*pow(persistence,float(i));xNoisePotentialDerivatives+=simplexNoiseDerivatives(vec4(p*twoPowI,noiseTime))*scale;yNoisePotentialDerivatives+=simplexNoiseDerivatives(vec4((p+vec3(123.4,129845.6,-1239.1))*twoPowI,noiseTime))*scale;zNoisePotentialDerivatives+=simplexNoiseDerivatives(vec4((p+vec3(-9519.0,9051.0,-123.0))*twoPowI,noiseTime))*scale;}return vec3(xNoisePotentialDerivatives[3]-zNoisePotentialDerivatives[1],zNoisePotentialDerivatives[2]-yNoisePotentialDerivatives[3],yNoisePotentialDerivatives[1]-xNoisePotentialDerivatives[2]);}void main(){vec4 posLife=texture2D(u_simPrevPosLifeTexture,v_uv);vec3 posLifeOrigin=posLife.xyz-u_lightPosition;posLife.w-=(0.5+u_noiseStableFactor)*u_introDeltaTime;if(posLife.w<0.0){vec3 defPosOrigin=texture2D(u_simDefaultPosLifeTexture,v_uv).xyz;vec3 defPos=defPosOrigin*(1.25+sin(u_noiseTime*2.5+v_uv.x*21.)*0.25)+u_lightPosition;posLife.w+=1.;posLife.xyz=defPos;}vec3 toLight=posLife.xyz-u_lightPosition;vec3 axis=vec3(sin(u_noiseTime),cos(u_noiseTime*2.+v_uv.y*6.283185),0.0);vec3 spinDir=cross(axis,toLight);float dist=length(toLight);if(dist>0.01){float spinStrength=u_introDeltaTime*(0.1+smoothstep(0.5,2.0,dist-v_uv.x*0.5)*(v_uv.y<0.5 ? 1. :-1.)*mix(2.,4.,v_uv.x))*mix(0.75,1.5,u_noiseStableFactor);posLife.xyz+=spinDir*spinStrength;}posLife.xyz+=(1.25+0.5*u_noiseScale)*curl((posLife.xyz-u_lightPosition)*(0.4+0.3*u_noiseStableFactor),u_noiseTime,0.2)*u_introDeltaTime*mix(0.4,1.5,posLife.w*posLife.w)*mix(0.75,1.25,v_uv.x);gl_FragColor=posLife;}`;new Vector3;class AboutHeroParticlesSimulation{SIM_TEXTURE_WIDTH=128;SIM_TEXTURE_HEIGHT=browser$1.isMobile?128:192;currPositionRenderTarget=null;prevPositionRenderTarget=null;ORIGIN=new Vector3(0,8,0);isPlaying=!0;isFirstSim=!0;noiseSpeed=.4;_noise=new Simple1DNoise;noiseScaleTime=Math.random();noiseStableFactorTime=Math.random();noiseStableFactor=Math.random();sharedUniforms={u_simCurrPosLifeTexture:{value:null},u_simPrevPosLifeTexture:{value:null},u_simDefaultPosLifeTexture:{value:null},u_simTextureSize:{value:new Vector2(this.SIM_TEXTURE_WIDTH,this.SIM_TEXTURE_HEIGHT)},u_noiseStableFactor:{value:0}};preInit(){this.currPositionRenderTarget=fboHelper.createRenderTarget(this.SIM_TEXTURE_WIDTH,this.SIM_TEXTURE_HEIGHT,!0,FloatType),this.prevPositionRenderTarget=this.currPositionRenderTarget.clone(),this.positionMaterial=fboHelper.createRawShaderMaterial({uniforms:{u_lightPosition:light.sharedUniforms.u_lightPosition,u_simPrevPosLifeTexture:this.sharedUniforms.u_simPrevPosLifeTexture,u_simDefaultPosLifeTexture:this.sharedUniforms.u_simDefaultPosLifeTexture,u_introDeltaTime:aboutHero.sharedUniforms.u_introDeltaTime,u_noiseTime:{value:0},u_noiseScale:{value:0},u_noiseStableFactor:this.sharedUniforms.u_noiseStableFactor},fragmentShader:fragSim});let e=this.SIM_TEXTURE_WIDTH*this.SIM_TEXTURE_HEIGHT,t=new Float32Array(e*4);for(let n=0,a=0;n<e;n++,a+=4){let l=Math.random(),c=Math.random(),u=l*2*Math.PI,f=Math.acos(2*c-1),p=.25+Math.cbrt(Math.random())*.5,g=Math.sin(u),v=Math.cos(u),_=Math.sin(f),T=Math.cos(f);t[a+0]=p*_*v,t[a+1]=p*_*g,t[a+2]=p*T,t[a+3]=n/e-1}let r=this.sharedUniforms.u_simDefaultPosLifeTexture.value=fboHelper.createDataTexture(t,this.SIM_TEXTURE_WIDTH,this.SIM_TEXTURE_HEIGHT,!0,!0);fboHelper.copy(r,this.currPositionRenderTarget)}init(){}update(e){if(this.isPlaying){let t=this.currPositionRenderTarget;this.currPositionRenderTarget=this.prevPositionRenderTarget,this.prevPositionRenderTarget=t,this.sharedUniforms.u_simCurrPosLifeTexture.value=this.currPositionRenderTarget.texture,this.sharedUniforms.u_simPrevPosLifeTexture.value=this.prevPositionRenderTarget.texture,this.positionMaterial.uniforms.u_noiseTime.value+=e*this.noiseSpeed,this.noiseScaleTime+=e;const r=this._noise.getFbm(this.noiseScaleTime,3);this.positionMaterial.uniforms.u_noiseScale.value=10*Math.abs(r),this.noiseStableFactorTime+=.5*e,this.noiseStableFactor+=.05*Math.abs(this._noise.getFbm(this.noiseStableFactorTime,3)),this.sharedUniforms.u_noiseStableFactor.value=math.fit(aboutHero.introRatio,0,.4,0,1)*math.smoothstep(.9,.95,.5+.5*Math.sin(this.noiseStableFactor)),fboHelper.render(this.positionMaterial,this.currPositionRenderTarget)}}}const sim=new AboutHeroParticlesSimulation,vert$9=`#define GLSLIFY 1
attribute vec3 simUv;uniform sampler2D u_simCurrPosLifeTexture;uniform vec2 u_simTextureSize;uniform float u_sceneHideRatio;uniform float u_isEmissive;uniform float u_noiseStableFactor;uniform sampler2D u_lightFieldSlicedTexture;
#include <lightFieldSlice>
varying vec3 v_worldPosition;varying vec3 v_viewNormal;varying vec3 v_worldNormal;varying float v_depth;varying float v_diff;varying float v_ao;varying float v_emission;float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}vec4 hash43(vec3 p){vec4 p4=fract(vec4(p.xyzx)*vec4(.1031,.1030,.0973,.1099));p4+=dot(p4,p4.wzxy+33.33);return fract((p4.xxyz+p4.yzzw)*p4.zywx);}void main(){vec4 currPositionInfo=texture2D(u_simCurrPosLifeTexture,simUv.xy);vec4 rands=hash43(simUv);float particleSize=mix(0.06,0.175,u_isEmissive)*(0.5+rands.x*0.5);float particleSizeScale=linearStep(0.0,0.1,currPositionInfo.w)*linearStep(1.0,0.9,currPositionInfo.w);particleSize*=particleSizeScale*(1.0-u_sceneHideRatio);vec3 pos=position*particleSize+currPositionInfo.xyz;gl_Position=projectionMatrix*modelViewMatrix*vec4(pos,1.0);v_worldPosition=(modelMatrix*vec4(pos,1.0)).xyz;v_viewNormal=normalMatrix*normal;v_worldNormal=normalize((vec4(v_viewNormal,0.)*viewMatrix).xyz);vec3 rayGridDir=v_worldNormal;vec3 rayGridPos=lightFieldPosToGrid(v_worldPosition);vec4 indirectDiffuse=sampleLightField(u_lightFieldSlicedTexture,rayGridPos+rayGridDir);float lifeFalloff=mix(0.5,1.,particleSizeScale);v_emission=(indirectDiffuse.a*0.55*lifeFalloff+0.45)*u_isEmissive;v_diff=(1.-indirectDiffuse.a)*lifeFalloff;v_diff*=linearStep(5.,1.5,length(v_worldPosition-vec3(0.,8.,0.)));v_ao=1.0-indirectDiffuse.a;
#include <aboutHeroVisualFinal_vert>
}`,frag$d=`#define GLSLIFY 1
uniform sampler2D u_lightFieldSlicedTexture;uniform float u_noiseStableFactor;uniform float u_emissiveRatio;uniform float u_contrast;varying vec3 v_worldPosition;varying vec3 v_worldNormal;varying vec3 v_viewNormal;varying float v_depth;varying float v_diff;varying float v_emission;varying float v_ao;
#include <lightFieldSlice>
#include <getScatter>
#include <getBlueNoise>
float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main(){vec3 noise=getBlueNoise(gl_FragCoord.xy);vec3 viewNormal=normalize(v_viewNormal);vec3 worldNormal=normalize(v_worldNormal);vec3 rayGridPos=lightFieldPosToGrid(v_worldPosition);vec3 rayGridDir=worldNormal;vec3 rayGridSpecDir=reflect(normalize(v_worldPosition-cameraPosition),worldNormal);vec4 indirectSpecular=sampleLightField(u_lightFieldSlicedTexture,rayGridPos+normalize(rayGridSpecDir+(noise-.5)*0.25)*(1.+noise.z));float specular=indirectSpecular.r;vec3 rayGridRefractDir=refract(normalize(v_worldPosition-cameraPosition),worldNormal,1./1.4);vec4 refractionInfo=sampleLightField(u_lightFieldSlicedTexture,rayGridPos+normalize(rayGridRefractDir+(noise-.5)*0.25)*(1.5+noise.z));float refraction=refractionInfo.r*(1.-refractionInfo.a*0.75);float shade=v_diff*0.45+specular+refraction;shade+=getScatter(cameraPosition,v_worldPosition)*1.35;float viewShade=linearStep(-1.,1.,dot(viewNormal,vec3(.5773)));shade=mix(shade,viewShade,v_emission*v_ao)*(.4+v_ao*.6);gl_FragColor=vec4(mix(shade,smoothstep(0.,1.,shade),0.5),v_depth,1.,mix(v_diff*v_diff+v_emission,1.,u_emissiveRatio));}`,lightFieldVert=`#define GLSLIFY 1
attribute vec3 position;uniform sampler2D u_simCurrPosLifeTexture;uniform float u_noiseStableFactor;
#include <lightFieldSlice>
varying vec4 v_color;float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}vec4 hash43(vec3 p){vec4 p4=fract(vec4(p.xyzx)*vec4(.1031,.1030,.0973,.1099));p4+=dot(p4,p4.wzxy+33.33);return fract((p4.xxyz+p4.yzzw)*p4.zywx);}void main(){vec4 rands=hash43(position);vec4 currPositionInfo=texture2D(u_simCurrPosLifeTexture,position.xy);float scale=linearStep(1.0,0.9,currPositionInfo.w);vec3 pos=currPositionInfo.xyz;vec3 lightFieldGrid=clampedLightFieldPosToGrid(pos);vec2 lightFieldUv=lightFieldGridToUv(lightFieldGrid);gl_Position=vec4(lightFieldUv*2.0-1.0,0.0,1.0);gl_PointSize=1.0;vec3 color=position.x<0.005 ? vec3(1.): vec3(0.1);v_color=vec4(color,1.)*scale;}`,lightFieldFrag=`#define GLSLIFY 1
varying vec4 v_color;void main(){gl_FragColor=v_color;}`,motionVert=`#define GLSLIFY 1
attribute vec2 simUv;uniform sampler2D u_simPrevPosLifeTexture;uniform sampler2D u_simCurrPosLifeTexture;uniform vec2 u_simTextureSize;uniform float u_strength;uniform float u_aspect;varying vec2 v_delta;varying float v_headTail;float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}vec4 hash43(vec3 p){vec4 p4=fract(vec4(p.xyzx)*vec4(.1031,.1030,.0973,.1099));p4+=dot(p4,p4.wzxy+33.33);return fract((p4.xxyz+p4.yzzw)*p4.zywx);}vec2 rotate(vec2 v,float a){float s=sin(a);float c=cos(a);mat2 m=mat2(c,s,-s,c);return m*v;}void main(){vec4 currPositionInfo=texture2D(u_simCurrPosLifeTexture,simUv);vec4 prevPositionInfo=texture2D(u_simPrevPosLifeTexture,simUv);vec4 rands=hash43(vec3(simUv.xy,0.));float particleSize=(simUv.x<0.005 ? 0.175 : 0.06)*(0.5+rands.x*0.5);mat4 mvp=projectionMatrix*modelViewMatrix;vec4 currScreenPos=mvp*vec4(currPositionInfo.xyz,1.0);vec4 prevScreenPos=mvp*vec4(prevPositionInfo.xyz,1.0);currScreenPos/=currScreenPos.w;prevScreenPos/=prevScreenPos.w;vec2 screenPosDelta=currScreenPos.xy-prevScreenPos.xy;float screenPosDist=length(screenPosDelta);float angle=screenPosDist>0.001 ? atan(screenPosDelta.y,screenPosDelta.x*u_aspect): 0.;vec4 screenPos=position.x>-0.0001 ? currScreenPos : prevScreenPos;vec4 offsetScreenPos=modelViewMatrix*vec4((position.x>0. ? currPositionInfo.xyz : prevPositionInfo.xyz),1.0);offsetScreenPos.xy+=particleSize;offsetScreenPos=projectionMatrix*offsetScreenPos;offsetScreenPos/=offsetScreenPos.w;offsetScreenPos=offsetScreenPos-screenPos;v_delta=screenPosDelta;v_headTail=position.x;vec4 pos=vec4(position,0.);pos.xy=rotate(pos.xy,angle)*length(offsetScreenPos.xy*vec2(u_aspect,1.));pos.xy*=vec2(1./u_aspect,1.);pos+=screenPos;pos.xy+=v_delta*.5;v_delta=v_delta*2.+.5;gl_Position=pos;if(currPositionInfo.w>prevPositionInfo.w){gl_Position=vec4(2.,0.,0.,1.);}}`,motionFrag=`#define GLSLIFY 1
varying vec2 v_delta;varying float v_headTail;void main(){float ratio=sqrt(abs(v_headTail)*2.);float strength=sign(v_headTail)*ratio*-.5;gl_FragColor=vec4(v_delta,strength+.5,v_headTail+0.5);}`,getScatter=`#define GLSLIFY 1
uniform vec2 u_lightScatterDivider;uniform float u_lightScatterPowInv;uniform vec3 u_lightScatterPos0;uniform vec3 u_lightScatterPos1;uniform float u_lightScatterRatio;float getScatterCoff(vec3 start,vec3 dir,vec3 lightPos,float d){vec3 q=start-lightPos;float b=dot(dir,q);float c=dot(q,q);float t=c-b*b;float s=1.0/(2.5+pow(0.001+t,0.8));return s*(atan((d+b)*s)-atan(b*s));}vec2 getScatterLine(vec3 start,vec3 dir,vec3 lightPos0,vec3 lightPos1,float d){vec3 segCenter=(lightPos0+lightPos1)*0.5;vec3 segDir=normalize(lightPos1-lightPos0);vec3 diff=start-segCenter;float segExtent=distance(lightPos0,lightPos1)*0.5;float a01=-dot(dir,segDir);float b0=dot(diff,dir);float b1=-dot(diff,segDir);float det=abs(1.0-a01*a01);float s=clamp((a01*b0-b1)/max(0.0001,det),-segExtent,segExtent);vec3 lightPos=segDir*s+segCenter;return vec2(getScatterCoff(start,dir,segExtent>0.0 ? lightPos : lightPos0,d),s/segExtent*0.5+0.5);}float getScatter(vec3 cameraPosition,vec3 worldPos,vec2 lightScatterDivider,float lightScatterPowInv){vec3 worldToCamera=worldPos-cameraPosition;float d=length(worldToCamera);vec3 dir=worldToCamera/d;vec2 val=getScatterLine(cameraPosition,dir,u_lightScatterPos0,u_lightScatterPos1,d);return pow(max(0.0,val.x/mix(lightScatterDivider.x,lightScatterDivider.y,val.y)),lightScatterPowInv)*u_lightScatterRatio;}float getScatter(vec3 cameraPosition,vec3 worldPos){return getScatter(cameraPosition,worldPos,u_lightScatterDivider,u_lightScatterPowInv);}`;class AboutHeroScatter{sharedUniforms={u_lightScatterDivider:{value:new Vector2(1.1,5.5)},u_lightScatterPowInv:{value:0},u_lightScatterRatio:{value:0},u_lightScatterPos0:{value:new Vector3(0,18,0)},u_lightScatterPos1:{value:new Vector3(0,0,0)}};constructor(){this._brownianMotion0=new BrownianMotion,this._brownianMotion1=new BrownianMotion}init(){shaderHelper.addChunk("getScatter",getScatter)}update(e){let t=math.fit(aboutHero.introRatio,0,.2,2,.7);t=math.fit(aboutHero.introRatio,.7,.85,t,.4),this.sharedUniforms.u_lightScatterPowInv.value=t,this.sharedUniforms.u_lightScatterRatio.value=math.fit(aboutHero.introRatio,.7,.85,1,0,ease.cubicIn)}}const aboutHeroScatter=new AboutHeroScatter,fragmentShader$2=`#define GLSLIFY 1
varying vec2 v_uv;uniform sampler2D u_texture;void main(){gl_FragColor=texture2D(u_texture,v_uv).rrra;}`,motionBlurFragmentShader=`#define GLSLIFY 1
varying vec2 v_uv;uniform sampler2D u_texture;uniform sampler2D u_motionTexture;uniform float u_blurRatio;
#include <getBlueNoise>
void main(){vec3 noise=getBlueNoise(gl_FragCoord.xy+vec2(41.,25.));vec4 motion=texture2D(u_motionTexture,v_uv);motion.xy-=0.5;motion.xy*=(motion.z-.5)/16.*u_blurRatio*0.25;vec4 c=vec4(0.);vec2 offset=motion.xy*noise.xy;for(int i=0;i<16;i++){offset+=motion.xy;c+=texture2D(u_texture,v_uv+offset);}c/=16.;gl_FragColor=vec4(c.rrr,c.a);vec4 color=texture2D(u_texture,v_uv).rrra;gl_FragColor=max(color,gl_FragColor);}`,blurFragmentShader=`#define GLSLIFY 1
varying vec2 v_uv;uniform sampler2D u_texture;uniform float u_aspect;uniform float u_blurRatio;
#include <getBlueNoise>
void main(){vec3 noise=getBlueNoise(gl_FragCoord.xy);vec4 tex=texture2D(u_texture,v_uv);vec2 ra=vec2(0.);float fi=0.;float theta=noise.x*6.283185307179586;vec2 strength=vec2(1.,1.*u_aspect)*.006*tex.b*u_blurRatio;for(int i=0;i<8;i++){theta+=10.166407384630519;ra+=texture2D(u_texture,v_uv+vec2(cos(theta),sin(theta))*sqrt((fi+.5)/8.)*strength).ra;fi+=1.;}ra/=8.;gl_FragColor=ra.xxxy;}`;class AboutPageHeroEfxPrepass extends PostEffect{isActive=!0;cacheRT=null;motionBlurRatio=1;motionRT;motionTmpRT;useMotionBlur=!1;blurRatio=0;scene=new Scene;needsRenderScene=!0;renderOrder=5;init(e){Object.assign(this,e),super.init(),this.cacheRT=fboHelper.createRenderTarget(1,1),this.motionRT=fboHelper.createRenderTarget(1,1),this.motionRT.depthBuffer=!0,this.motionTmpRT=fboHelper.createRenderTarget(1,1),this._material=fboHelper.createRawShaderMaterial({uniforms:Object.assign({u_texture:{value:null},u_motionTexture:{value:this.motionRT.texture},u_aspect:{value:1},u_blurRatio:{value:0}},blueNoise.sharedUniforms),fragmentShader:fragmentShader$2}),this._motionBlurMaterial=fboHelper.createRawShaderMaterial({uniforms:this._material.uniforms,fragmentShader:motionBlurFragmentShader}),this._blurMaterial=fboHelper.createRawShaderMaterial({uniforms:this._material.uniforms,fragmentShader:blurFragmentShader})}needsRender(){return this.isActive}setPostprocessing(e){const t=e.width,r=e.height;this.cacheRT.setSize(t,r),this._material.uniforms.u_aspect.value=t/r}renderMotion(e,t,r,n){let a=properties.renderer,l=fboHelper.getColorState(),c=a.getRenderTarget();this.motionRT.setSize(r,n),a.setRenderTarget(this.motionRT),a.setClearColor(8355711,0),a.clear(),fboHelper.renderMesh(e,this.motionRT,t),blur.blur(2,1,this.motionRT,this.motionTmpRT,this.motionRT),a.setRenderTarget(c),fboHelper.setColorState(l),this.useMotionBlur=!0}render(e,t=!1){if(fboHelper.copy(e.fromTexture,this.cacheRT),this.useMotionBlur?(this.useMotionBlur=!1,this.material=this._motionBlurMaterial,this.material.uniforms.u_blurRatio.value=this.motionBlurRatio):(this.material=this.blurRatio>0?this._blurMaterial:this._material,this.material.uniforms.u_blurRatio.value=this.blurRatio),this.needsRenderScene){this.material.uniforms.u_texture.value=e.fromTexture,fboHelper.render(this.material,e.toRenderTarget);let r=fboHelper.getColorState();fboHelper.renderer.autoClear=!1,fboHelper.renderer.setRenderTarget(e.toRenderTarget),fboHelper.renderer.render(this.scene,e.camera),fboHelper.setColorState(r),e.swap()}else super.render(e,t)}}const aboutPageHeroEfxPrepass=new AboutPageHeroEfxPrepass;class AboutHeroParticles{container=new Object3D;emissiveMesh=null;nonEmissiveMesh=null;lightFieldMesh=null;lodIds=["l","m","s","xs"];lodRefGeometries=[];preInit(){for(let p=settings.IS_SMALL_SCREEN?1:0;p<4;p++)properties.loader.add(settings.MODEL_PATH+"about/sphere_"+this.lodIds[p]+".buf",{onLoad:this._onGeometryLoad.bind(this,p)});let e=sim.SIM_TEXTURE_WIDTH*sim.SIM_TEXTURE_HEIGHT,t=new Float32Array(e*3),r=new InstancedBufferGeometry,n=new InstancedBufferGeometry,a=new Float32Array((sim.SIM_TEXTURE_WIDTH-1)*sim.SIM_TEXTURE_HEIGHT*2),l=new Float32Array(sim.SIM_TEXTURE_HEIGHT*2);for(let p=0,g=0,v=0,_=0;p<e;p++,g+=3){let T=t[g+0]=(p%sim.SIM_TEXTURE_WIDTH+.5)/sim.SIM_TEXTURE_WIDTH,M=t[g+1]=(~~(p/sim.SIM_TEXTURE_WIDTH)+.5)/sim.SIM_TEXTURE_HEIGHT;p%sim.SIM_TEXTURE_WIDTH==0?(l[v+0]=T,l[v+1]=M,v+=2):(a[_+0]=T,a[_+1]=M,_+=2)}r.setAttribute("simUv",new InstancedBufferAttribute(a,2)),this.nonEmissiveMesh=new Mesh(r,new ShaderMaterial({uniforms:Object.assign({u_simCurrPosLifeTexture:sim.sharedUniforms.u_simCurrPosLifeTexture,u_simTextureSize:sim.sharedUniforms.u_simTextureSize,u_noiseStableFactor:sim.sharedUniforms.u_noiseStableFactor,u_isEmissive:{value:0},u_emissiveRatio:{value:0}},lightField.sharedUniforms,aboutHeroScatter.sharedUniforms,aboutHero.sharedUniforms,blueNoise.sharedUniforms),vertexShader:vert$9,fragmentShader:frag$d})),this.nonEmissiveMesh.renderOrder=5,this.nonEmissiveMesh.frustumCulled=!1,this.container.add(this.nonEmissiveMesh),n.setAttribute("simUv",new InstancedBufferAttribute(l,2)),this.emissiveMesh=new Mesh(n,new ShaderMaterial({uniforms:Object.assign({},this.nonEmissiveMesh.material.uniforms,{u_isEmissive:{value:1},u_emissiveRatio:{value:0}}),vertexShader:vert$9,fragmentShader:frag$d})),this.emissiveMesh.renderOrder=5,this.emissiveMesh.frustumCulled=!1,this.container.add(this.emissiveMesh);let c=new PlaneGeometry(1,1),u=new InstancedBufferGeometry;for(let p in c.attributes)u.attributes[p]=c.attributes[p];u.setIndex(c.getIndex()),u.setAttribute("simUv",new InstancedBufferAttribute(t,3)),this.motionMesh=new Mesh(u,new ShaderMaterial({uniforms:{u_simPrevPosLifeTexture:sim.sharedUniforms.u_simPrevPosLifeTexture,u_simCurrPosLifeTexture:sim.sharedUniforms.u_simCurrPosLifeTexture,u_aspect:properties.sharedUniforms.u_aspect},vertexShader:motionVert,fragmentShader:motionFrag})),this.motionMesh.frustumCulled=!1;let f=new BufferGeometry;f.name="lightFieldGeometry",f.setAttribute("position",new BufferAttribute(t,3)),this.lightFieldMesh=new Points(f,fboHelper.createRawShaderMaterial({uniforms:Object.assign({u_simCurrPosLifeTexture:sim.sharedUniforms.u_simCurrPosLifeTexture,u_noiseStableFactor:sim.sharedUniforms.u_noiseStableFactor},lightField.sharedUniforms),vertexShader:lightFieldVert,fragmentShader:lightFieldFrag,blending:CustomBlending,blendEquation:MaxEquation,blendSrc:OneFactor,blendDst:OneFactor,blendEquationAlpha:MaxEquation,blendSrcAlpha:OneFactor,blendDstAlpha:OneFactor})),this.lightFieldMesh.frustumCulled=!1}_onGeometryLoad(e,t){this.lodRefGeometries[e]=t}init(){}update(e){this.nonEmissiveMesh.material.uniforms.u_emissiveRatio.value=math.fit(aboutHero.introRatio,0,.2,0,.75),this.emissiveMesh.material.uniforms.u_emissiveRatio.value=math.fit(aboutHero.introRatio,0,.2,0,.75);let t,r=aboutHero.introRatio<.3,n=!r&&aboutHero.introRatio<.7,a=0,l=0;settings.IS_SMALL_SCREEN?(a=r?2:3,l=r?1:n?2:3):(a=r?1:n?2:3,l=r?0:n?1:3),t=this.lodRefGeometries[a];for(let u in t.attributes)this.nonEmissiveMesh.geometry.attributes[u]=t.attributes[u];this.nonEmissiveMesh.geometry.setIndex(t.getIndex()),t=this.lodRefGeometries[l];for(let u in t.attributes)this.emissiveMesh.geometry.attributes[u]=t.attributes[u];this.emissiveMesh.geometry.setIndex(t.getIndex()),lightField.renderMesh(this.lightFieldMesh);let c=math.fit(aboutHero.introRatio,0,.1,1,1.5);c=math.fit(aboutHero.introRatio,.1,.15,c,0),aboutPageHeroEfxPrepass.motionBlurRatio=c,aboutPageHeroEfxPrepass.motionBlurRatio>0&&aboutPageHeroEfxPrepass.renderMotion(this.motionMesh,properties.camera,properties.width>>2,properties.height>>2)}}const aboutHeroParticles=new AboutHeroParticles,vert$8=`#define GLSLIFY 1
attribute float piece;attribute float instanceId;attribute vec4 instanceRands;uniform sampler2D u_posRandTexture;uniform sampler2D u_orientTexture;uniform vec2 u_animationTextureSize;uniform float u_time;uniform float u_globalTime;uniform float u_scale;uniform float u_noiseStableFactor;uniform float u_hudRatio;
#ifdef IS_SHADOW
uniform vec3 u_lightPosition;uniform float u_lightShadowMaxDistance;varying float v_distToLight;
#include <getLightUv>
#else
varying vec3 v_worldPosition;varying vec3 v_viewNormal;varying vec2 v_uv;varying float v_depth;
#endif
float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}vec3 qrotate(vec4 q,vec3 v){return v+2.0*cross(q.xyz,cross(q.xyz,v)+q.w*v);}vec4 quaternion(vec3 axis,float halfAngle){return vec4(axis*sin(halfAngle),cos(halfAngle));}vec4 hash42(vec2 p){vec4 p4=fract(vec4(p.xyxy)*vec4(.1031,.1030,.0973,.1099));p4+=dot(p4,p4.wzxy+33.33);return fract((p4.xxyz+p4.yzzw)*p4.zywx);}vec2 rotate(vec2 v,float a){float s=sin(a);float c=cos(a);mat2 m=mat2(c,s,-s,c);return m*v;}void main(){float duration=0.25+2.+4.;float time=duration*instanceRands.x+u_time;float cycle=floor(time/duration);time=time-duration*cycle;vec4 cycleRands=hash42(vec2(cycle,instanceId));float flyUpRatio=pow(linearStep(2.25,6.25,time),1.5);float appearRatio=linearStep(0.,0.25,time-instanceRands.y)*(1.0-u_hudRatio);vec4 selfSpin=quaternion(normalize(instanceRands.xyz-0.5),flyUpRatio*mix(5.0,30.,cycleRands.z));float pieceScale=appearRatio;vec3 origin=vec3(0.0,1.9+instanceRands.w*0.4,0.0);float angle=cycleRands.x*6.2832;float radius=4.+cycleRands.w*4.;float rollRatio=1.0-linearStep(0.,3.25,time+instanceRands.x);radius-=(rollRatio*rollRatio)*5.;vec2 dir=vec2(cos(angle),sin(angle));vec3 instanceOffset=vec3(dir.x*radius,flyUpRatio*mix(30.0,40.,cycleRands.z)+u_noiseStableFactor*(0.5+0.5*sin(u_globalTime+instanceId*0.1))*0.1,dir.y*radius);instanceOffset.xz=rotate(instanceOffset.xz,flyUpRatio*flyUpRatio*mix(-1.,1.,instanceRands.z))*smoothstep(1.5,0.35,flyUpRatio);float frame=linearStep(0.25,2.25,time)*119.;float frameFloor=floor(frame);float frameCeil=min(frameFloor+1.,119.);float frameFract=frame-frameFloor;vec4 simUvs=(vec3(piece,frameFloor,frameCeil).xyxz+.5)/u_animationTextureSize.xyxy;vec4 posRand1=texture2D(u_posRandTexture,simUvs.xy);vec4 orient1=texture2D(u_orientTexture,simUvs.xy);vec4 posRand2=texture2D(u_posRandTexture,simUvs.zw);vec4 orient2=texture2D(u_orientTexture,simUvs.zw);
#ifdef IS_SHADOW
pieceScale*=1.5;
#endif
vec3 pos1=qrotate(orient1,position)*pieceScale+posRand1.xyz;vec3 pos2=qrotate(orient2,position)*pieceScale+posRand2.xyz;vec3 pos=u_scale*0.75*mix(0.5,1.5,instanceRands.z*instanceRands.z)*linearStep(1.,0.9,flyUpRatio)*(qrotate(selfSpin,mix(pos1,pos2,frameFract)-origin)+origin)*mix(0.3,0.7,cycleRands.w)+instanceOffset;
#ifdef IS_SHADOW
pos=(modelMatrix*vec4(pos,1.0)).xyz;vec3 center=instanceOffset+origin-u_lightPosition;pos-=u_lightPosition;v_distToLight=length(pos)/u_lightShadowMaxDistance;if(center.y>0.0){pos.y=max(0.001,pos.y);}else{pos.y=min(-0.001,pos.y);}gl_Position=vec4(getLightUv(pos)*2.0-1.0,1.-v_distToLight,1.0);
#else
vec3 nor1=qrotate(selfSpin,qrotate(orient1,normal));vec3 nor2=qrotate(selfSpin,qrotate(orient2,normal));vec3 nor=normalize(mix(nor1,nor2,frameFract));gl_Position=projectionMatrix*modelViewMatrix*vec4(pos,1.0);v_worldPosition=(modelMatrix*vec4(pos,1.0)).xyz;v_viewNormal=normalMatrix*nor;v_uv=uv;vec4 viewPosition=modelViewMatrix*vec4(pos,1.0);
#include <aboutHeroVisualFinal_vert>
#endif
}`,frag$c=`#define GLSLIFY 1
uniform sampler2D u_texture;uniform vec4 u_textureChannelMixer;uniform vec3 u_lightColor;uniform vec3 u_lightPosition;uniform float u_noiseStableFactor;varying vec3 v_worldPosition;varying vec3 v_viewNormal;varying vec2 v_uv;varying float v_depth;vec3 inverseTransformDirection(in vec3 dir,in mat4 matrix){return normalize((vec4(dir,0.0)*matrix).xyz);}float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}
#include <getScatter>
void main(){float pattern=dot(u_textureChannelMixer,texture2D(u_texture,v_uv));vec3 viewNormal=normalize(v_viewNormal);vec3 worldNormal=inverseTransformDirection(viewNormal,viewMatrix);vec3 worldToLight=u_lightPosition-v_worldPosition;float worldToLightDist=length(worldToLight);float attenutation=1.0/(0.05+(0.02-0.005*u_noiseStableFactor)*worldToLightDist*worldToLightDist);worldToLight/=worldToLightDist;vec3 cameraToWorld=normalize(v_worldPosition-cameraPosition);float diff=0.25+0.75*dot(worldNormal,worldToLight);float spec=0.8*dot(reflect(cameraToWorld,worldNormal),worldToLight);vec3 color=vec3(pattern);color*=attenutation*(0.05+diff+spec*diff);gl_FragColor=vec4(color*0.85+0.15,spec*(0.3+u_noiseStableFactor));gl_FragColor.rgb+=getScatter(cameraPosition,v_worldPosition);
#include <aboutHeroVisualFinal_frag>
}`,lightShadowMapFrag=`#define GLSLIFY 1
varying float v_distToLight;void main(){gl_FragColor=vec4(v_distToLight);}`;class AboutHeroRocks{ROCK_PIECE_COUNT=16;FRAME_COUNT=120;FPS=60;COUNT=browser$1.isMobile?48:64;container=new Object3D;meshList=[];shadowMeshList=[];meshAnimationUniformList=[];meshInstanceUniformsList=[];meshInstanceAttributesList=[];time=0;sharedUniforms={u_texture:{value:null},u_animationTextureSize:{value:new Vector2(this.ROCK_PIECE_COUNT,this.FRAME_COUNT)},u_time:{value:0},u_globalTime:{value:0},u_scale:{value:0},u_lightPosition:light.sharedUniforms.u_lightPosition,u_noiseStableFactor:sim.sharedUniforms.u_noiseStableFactor};preInit(){properties.loader.add(settings.TEXTURE_PATH+"about/rocks.webp",{type:"texture",onLoad:e=>{let t=fboHelper.createRawShaderMaterial({uniforms:Object.assign({u_texture:{value:e}},aboutHeroScatter.sharedUniforms),fragmentShader:`
uniform sampler2D u_texture;
varying vec2 v_uv;
void main () {
vec2 uv = v_uv * 0.5;
gl_FragColor = vec4(
texture2D(u_texture, uv).g,
texture2D(u_texture, uv + vec2(.5, 0.)).g,
texture2D(u_texture, uv + vec2(0., .5)).g,
texture2D(u_texture, uv + vec2(.5, .5)).g
);
}`}),r=fboHelper.createRenderTarget(512,512);r.texture.minFitler=LinearMipmapLinearFilter,r.texture.generateMipmaps=!0,fboHelper.render(t,r),this.sharedUniforms.u_texture.value=r.texture,t.dispose(),e.dispose()}}).content;for(let e=0;e<4;e++){this.meshAnimationUniformList[e]={u_posRandTexture:{value:null},u_orientTexture:{value:null}},this.meshInstanceUniformsList[e]=Object.assign({u_textureChannelMixer:{value:new Vector4(+(e==0),+(e==1),+(e==2),+(e==3))}},this.meshAnimationUniformList[e],this.sharedUniforms,aboutHero.sharedUniforms,light.sharedUniforms,aboutHeroScatter.sharedUniforms);let t=new Float32Array(this.COUNT),r=new Float32Array(this.COUNT*4);for(let n=0;n<this.COUNT;n++)t[n]=e+n*4,r[n*4+0]=Math.random(),r[n*4+1]=Math.random(),r[n*4+2]=Math.random(),r[n*4+3]=Math.random();this.meshInstanceAttributesList[e]={instanceId:new InstancedBufferAttribute(t,1),instanceRands:new InstancedBufferAttribute(r,4)},properties.loader.add(settings.MODEL_PATH+"about/rock_"+e+".buf",{onLoad:this._onRockLoad.bind(this,e,!1)}),properties.loader.add(settings.MODEL_PATH+"about/rock_"+e+"_low.buf",{onLoad:this._onRockLoad.bind(this,e,!0)}),properties.loader.add(settings.MODEL_PATH+"about/rock_animation_"+e+".buf",{onLoad:this._onRockAnimationLoad.bind(this,e)})}}loadRock(e){}_onRockLoad(e,t,r){let n=new InstancedBufferGeometry;for(let c in r.attributes)n.setAttribute(c,r.attributes[c]);n.index=r.index;let a=this.meshInstanceAttributesList[e];n.setAttribute("instanceId",a.instanceId),n.setAttribute("instanceRands",a.instanceRands);let l=new Mesh(n,new ShaderMaterial({uniforms:this.meshInstanceUniformsList[e],vertexShader:vert$8,fragmentShader:frag$c}));l.frustumCulled=!1,t?(this.shadowMeshList[e]=l,l.material.defines.IS_SHADOW=!0,l.material.fragmentShader=lightShadowMapFrag,l.material.side=DoubleSide):this.meshList[e]=l}_onRockAnimationLoad(e,t){let r=t.attributes.position.array,n=t.attributes.orient.array,a=new Float32Array(r.length/3*4),l=[];for(let c=0,u=0,f=0;u<r.length;c++,u+=3,f+=4)a[f]=r[u],a[f+1]=r[u+1],a[f+2]=r[u+2],c<this.ROCK_PIECE_COUNT&&(l[c]=Math.random()),a[f+3]=l[c%this.ROCK_PIECE_COUNT];this.meshAnimationUniformList[e].u_posRandTexture.value=fboHelper.createDataTexture(a,this.ROCK_PIECE_COUNT,this.FRAME_COUNT,!0,!0),this.meshAnimationUniformList[e].u_orientTexture.value=fboHelper.createDataTexture(n,this.ROCK_PIECE_COUNT,this.FRAME_COUNT,!0,!0)}init(){for(let e=0;e<4;e++)this.container.add(this.meshList[e])}update(e){if(properties.hasInitialized){sim.sharedUniforms.u_noiseStableFactor.value,this.time+=e,this.sharedUniforms.u_time.value=this.time,this.sharedUniforms.u_globalTime.value=properties.time,this.sharedUniforms.u_scale.value=math.fit(aboutHero.introRatio,0,.2,0,1);for(let t=0;t<4;t++)light.renderMesh(this.shadowMeshList[t])}}}const aboutHeroRocks=new AboutHeroRocks,frag$b=`#define GLSLIFY 1
uniform sampler2D u_prevTexture;uniform sampler2D u_lightShadowTexture;uniform vec3 u_lightPosition;uniform vec2 u_blueNoiseOffset;uniform float u_lightShadowMaxDistance;uniform float u_radius;uniform float u_texelSize;varying vec2 v_uv;
#include <getLightUv>
#include <getBlueNoise>
float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main(){vec3 blueNoise=getBlueNoise(gl_FragCoord.xy+u_blueNoiseOffset);vec2 uvDir=normalize(v_uv-0.5);vec2 uv=v_uv-uvDir*u_texelSize;vec3 worldPosition=vec3(uv*2.0-1.0,0.0).xzy*u_radius;worldPosition.z*=-1.0;vec3 lightToWorld=worldPosition-u_lightPosition;float distToLight=length(lightToWorld);float expandRatio=linearStep(u_lightPosition.y,14.,distToLight);vec3 lightSampleStep=((vec3(lightToWorld.x,0.0,lightToWorld.z)*(1.0-expandRatio*0.75)+(blueNoise-0.5)*expandRatio*4.)*25.0*expandRatio*expandRatio)/float(LIGHT_SHADOW_SAMPLE_COUNT)*-mix(0.06,0.1,expandRatio);vec3 lightToWorldPos=lightToWorld+lightSampleStep*blueNoise.y;float accum=0.0;for(int i=0;i<LIGHT_SHADOW_SAMPLE_COUNT;i++){float selfDist=min(1.0,length(lightToWorldPos)/u_lightShadowMaxDistance);vec2 lightShadowUv=getLightUv(lightToWorldPos);float dist=texture2D(u_lightShadowTexture,lightShadowUv).r;float delta=selfDist-dist;accum+=delta>0. ? min(delta*delta*20.,1.): 1.0;lightToWorldPos+=lightSampleStep;}float shadowMask=accum/float(LIGHT_SHADOW_SAMPLE_COUNT);shadowMask=mix(shadowMask,1.0,expandRatio);shadowMask=pow(shadowMask,6.);float prevShadowMask=texture2D(u_prevTexture,v_uv).r;gl_FragColor=vec4(mix(prevShadowMask,shadowMask,shadowMask>prevShadowMask ? 0.5 : 0.2));}`,groundVert=`#define GLSLIFY 1
varying vec3 v_viewPosition;varying vec3 v_worldPosition;varying vec3 v_viewNormal;varying vec2 v_uv;varying vec3 v_localPosition;varying float v_depth;void main(){vec3 pos=position;vec4 mvPosition=modelViewMatrix*vec4(position,1.);gl_Position=projectionMatrix*mvPosition;v_worldPosition=(modelMatrix*vec4(position,1.)).xyz;v_viewNormal=normalMatrix*normal;v_viewPosition=-mvPosition.xyz;v_uv=uv;v_localPosition=position;
#include <aboutHeroVisualFinal_vert>
}`,groundFrag=`#define GLSLIFY 1
varying vec3 v_viewPosition;varying vec3 v_worldPosition;varying vec3 v_viewNormal;varying vec2 v_uv;varying vec3 v_localPosition;varying float v_depth;uniform sampler2D u_texture;uniform sampler2D u_groundShadowTexture;uniform vec3 u_color;uniform vec3 u_bgColor;uniform vec3 u_lightPosition;uniform float u_fogA;uniform float u_fogB;uniform float u_sceneRatio;uniform float u_hudRatio;uniform float u_noiseStableFactor;
#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define saturate( a ) clamp( a, 0.0, 1.0 )
float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}vec3 inverseTransformDirection(in vec3 dir,in mat4 matrix){return normalize((vec4(dir,0.0)*matrix).xyz);}vec3 applyFog(in vec3 rgb,in float distance,in vec3 rayOri,in vec3 rayDir){float a=u_fogA;float b=u_fogB;float fogAmount=(a/b)*exp(-rayOri.y*b)*(1.0-exp(-distance*rayDir.y*b))/rayDir.y;return mix(rgb,u_bgColor,fogAmount);}vec2 dHdxy_fwd(){vec2 dSTdx=dFdx(v_uv);vec2 dSTdy=dFdy(v_uv);float scale=0.1;float Hll=scale*texture2D(u_texture,v_uv).b;float dBx=scale*texture2D(u_texture,v_uv+dSTdx).b-Hll;float dBy=scale*texture2D(u_texture,v_uv+dSTdy).b-Hll;return vec2(dBx,dBy);}vec3 perturbNormalArb(vec3 surf_pos,vec3 surf_norm,vec2 dHdxy,float faceDirection){vec3 vSigmaX=dFdx(surf_pos.xyz);vec3 vSigmaY=dFdy(surf_pos.xyz);vec3 vN=surf_norm;vec3 R1=cross(vSigmaY,vN);vec3 R2=cross(vN,vSigmaX);float fDet=dot(vSigmaX,R1)*faceDirection;vec3 vGrad=sign(fDet)*(dHdxy.x*R1+dHdxy.y*R2);return normalize(abs(fDet)*surf_norm-vGrad);}
#include <getScatter>
#include <getBlueNoise>
void main(){vec3 blueNoise=getBlueNoise(gl_FragCoord.xy+vec2(48.,31.));vec3 mixedTexture=texture2D(u_texture,v_uv).rgb;float shadow=mixedTexture.r;float light=clamp(mixedTexture.g,0.1,1.0);float faceDirection=gl_FrontFacing ? 1.0 :-1.0;vec3 normal=normalize(v_viewNormal)*faceDirection;normal=perturbNormalArb(-v_viewPosition,normal,dHdxy_fwd(),faceDirection);vec3 N=inverseTransformDirection(normal,viewMatrix);vec3 L=normalize(u_lightPosition-v_worldPosition);vec3 V=normalize(cameraPosition-v_worldPosition);vec3 reflection=normalize(reflect(-V,N));float NdL=clamp(dot(N,L),0.001,1.0);float NdV=clamp(abs(dot(N,V)),0.001,1.0);vec3 lightToWorld=v_worldPosition-u_lightPosition;float distToLight=length(lightToWorld);float attenutation=1.0/(0.05+(0.025-0.005*u_noiseStableFactor)*distToLight*distToLight);float dist=1.0-pow(2.0*length(v_uv-0.5),2.0);float rockShadows=texture2D(u_groundShadowTexture,(vec2(v_localPosition.x,-v_localPosition.z)+(blueNoise.xy-.5)*0.1)*0.0425+0.5).r;float spec=dot(reflect(V,N),L)*linearStep(0.9,0.0,N.y)*4.;gl_FragColor.rgb=vec3(light+attenutation*spec);gl_FragColor.rgb*=shadow*(0.5+rockShadows*0.5)*(1.+spec);gl_FragColor.rgb=applyFog(gl_FragColor.rgb,length(cameraPosition-v_worldPosition),cameraPosition,-V);gl_FragColor.rgb+=getScatter(cameraPosition,v_worldPosition);
#include <aboutHeroVisualFinal_frag>
gl_FragColor.r=mix(gl_FragColor.r,shadow*(1.-abs(N.y)),u_hudRatio);gl_FragColor.r*=u_sceneRatio;gl_FragColor.g-=blueNoise.z*0.004;gl_FragColor.b=linearStep(15.,66.,v_worldPosition.z);gl_FragColor.a=spec*shadow;}`;class AboutHeroGround{container=new Object3D;geometry=null;mesh=null;texture=null;RADIUS=12;SIZE=768;sharedUniforms={u_groundShadowTexture:{value:null}};prevRenderTarget=null;currRenderTarget=null;blurCacheRenderTarget=null;preInit(){properties.loader.add(settings.MODEL_PATH+"about/terrain.buf",{onLoad:e=>this.geometry=e}),this.texture=properties.loader.load(settings.TEXTURE_PATH+"about/terrain_shadow_light_height.webp",{type:"texture",flipY:!0,minFilter:LinearFilter}).content}init(){this.prevRenderTarget=fboHelper.createRenderTarget(this.SIZE,this.SIZE),this.currRenderTarget=this.prevRenderTarget.clone(),this.blurCacheRenderTarget=this.prevRenderTarget.clone(),this.mesh=new Mesh(new CircleGeometry(1.1,128),fboHelper.createRawShaderMaterial({uniforms:Object.assign({u_prevTexture:{value:null},u_radius:{value:this.RADIUS},u_texelSize:{value:1/this.SIZE},u_blueNoiseOffset:{value:new Vector2}},light.sharedUniforms,blueNoise.sharedUniforms),fragmentShader:frag$b})),this.mesh.material.defines.LIGHT_SHADOW_SAMPLE_COUNT=8,this.groundMesh=new Mesh(this.geometry,new ShaderMaterial({uniforms:Object.assign({u_texture:{value:this.texture},u_groundShadowTexture:{value:this.currRenderTarget.texture},u_color:{value:new Color},u_bgColor:{value:new Color},u_noiseStableFactor:sim.sharedUniforms.u_noiseStableFactor,u_fogA:{value:.03},u_fogB:{value:.285}},light.sharedUniforms,aboutHeroScatter.sharedUniforms,blueNoise.sharedUniforms,aboutHero.sharedUniforms),vertexShader:groundVert,fragmentShader:groundFrag})),this.groundMesh.material.extensions.derivatives=!0,this.container.add(this.groundMesh),fboHelper.clearColor(1,1,1,1,this.currRenderTarget)}update(e){let t=this.prevRenderTarget;this.prevRenderTarget=this.currRenderTarget,this.currRenderTarget=t;let r=properties.renderer,n=fboHelper.getColorState(),a=r.getRenderTarget();r.setRenderTarget(this.currRenderTarget),r.setClearColor(16777215,1),this.mesh.material.uniforms.u_blueNoiseOffset.value.set(~~(Math.random()*128),~~(Math.random()*128)),this.mesh.material.uniforms.u_prevTexture.value=this.prevRenderTarget.texture,fboHelper.renderMesh(this.mesh,this.currRenderTarget),r.setRenderTarget(a),fboHelper.setColorState(n),sim.sharedUniforms.u_noiseStableFactor.value,this.groundMesh.material.uniforms.u_groundShadowTexture.value=this.currRenderTarget.texture,this.groundMesh.material.uniforms.u_bgColor.value.copy(properties.bgColor),this.groundMesh.material.uniforms.u_color.value.set("#fff")}}const aboutHeroGround=new AboutHeroGround,vert$7=`#define GLSLIFY 1
attribute float t;attribute float totalLength;attribute float lineId;varying float v_t;varying float v_totalLength;varying float v_thicknessRatio;varying vec3 v_viewNormal;varying vec3 v_worldNormal;varying vec3 v_worldPosition;vec3 inverseTransformDirection(in vec3 dir,in mat4 matrix){return normalize((vec4(dir,0.0)*matrix).xyz);}void main(){v_t=t;v_totalLength=totalLength;float yIndex=floor(position.y+.5);v_thicknessRatio=step(mod(yIndex,4.),0.5);vec3 pos=position+normal*mix(0.04,0.1,v_thicknessRatio);vec3 nor=normalize(normalMatrix*normal);v_viewNormal=nor;v_worldNormal=inverseTransformDirection(nor,viewMatrix);v_worldPosition=(modelMatrix*vec4(pos,1.0)).xyz;gl_Position=projectionMatrix*modelViewMatrix*vec4(pos,1.0);gl_Position.z-=0.1/gl_Position.w;}`,frag$a=`#define GLSLIFY 1
uniform float u_time;uniform float u_hudRatio;varying float v_t;varying float v_totalLength;varying float v_thicknessRatio;varying vec3 v_viewNormal;varying vec3 v_worldNormal;varying vec3 v_worldPosition;vec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 permute(vec4 x){return mod289(((x*34.0)+1.0)*x);}vec4 taylorInvSqrt(vec4 r){return 1.79284291400159-0.85373472095314*r;}vec2 fade(vec2 t){return t*t*t*(t*(t*6.0-15.0)+10.0);}float pnoise(vec2 P,vec2 rep){vec4 Pi=floor(P.xyxy)+vec4(0.0,0.0,1.0,1.0);vec4 Pf=fract(P.xyxy)-vec4(0.0,0.0,1.0,1.0);Pi=mod(Pi,rep.xyxy);Pi=mod289(Pi);vec4 ix=Pi.xzxz;vec4 iy=Pi.yyww;vec4 fx=Pf.xzxz;vec4 fy=Pf.yyww;vec4 i=permute(permute(ix)+iy);vec4 gx=fract(i*(1.0/41.0))*2.0-1.0;vec4 gy=abs(gx)-0.5;vec4 tx=floor(gx+0.5);gx=gx-tx;vec2 g00=vec2(gx.x,gy.x);vec2 g10=vec2(gx.y,gy.y);vec2 g01=vec2(gx.z,gy.z);vec2 g11=vec2(gx.w,gy.w);vec4 norm=taylorInvSqrt(vec4(dot(g00,g00),dot(g01,g01),dot(g10,g10),dot(g11,g11)));g00*=norm.x;g01*=norm.y;g10*=norm.z;g11*=norm.w;float n00=dot(g00,vec2(fx.x,fy.x));float n10=dot(g10,vec2(fx.y,fy.y));float n01=dot(g01,vec2(fx.z,fy.z));float n11=dot(g11,vec2(fx.w,fy.w));vec2 fade_xy=fade(Pf.xy);vec2 n_x=mix(vec2(n00,n01),vec2(n10,n11),fade_xy.x);float n_xy=mix(n_x.x,n_x.y,fade_xy.y);return 2.3*n_xy;}float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main(){float t=mod(v_t-u_time*2.,v_totalLength);float noiseScale=0.25;float n=pnoise(vec2(t*noiseScale,0.),vec2(v_totalLength*noiseScale,100.));float shade=mix(0.3+smoothstep(0.,0.-fwidth(n),n)*0.6,1.,v_thicknessRatio);shade*=linearStep(50.,-20.,v_worldPosition.z);gl_FragColor=vec4(shade,0.,0.,1.)*step(v_totalLength-v_t,v_totalLength*u_hudRatio);gl_FragColor.b=linearStep(15.,66.,v_worldPosition.z);gl_FragColor.r*=.85;}`;let SEGMENT_COUNT=3,THREHSOLDS=[60,245,806,966,991,1026,1191,1853,2061,3111,4279,4309,4338,5265,5316,5447,5475,6407,6445,7116,7235,7349,7934,8555,8583,8614,9154,9640,9688,10163,10420,10645,10895,11074,11286,11453,11596,11628,11740,11799,11832],v0=new Vector3;new Vector3;new Vector3;class AboutHeroLines{container=new Object3D;time=0;sharedUniforms={};preInit(){properties.loader.add(settings.MODEL_PATH+"about/terrain_lines.buf",{onLoad:this._onLineLoad.bind(this)})}_onLineLoad(e){let t=e.attributes.position.array,r=THREHSOLDS.length,n=t.length/3,a=new Float32Array(n*SEGMENT_COUNT*3),l=new Float32Array(n*SEGMENT_COUNT*3),c=new Float32Array(n*SEGMENT_COUNT),u=new Float32Array(n*SEGMENT_COUNT),f=new Uint8Array(n*SEGMENT_COUNT),p=new Uint16Array((n-r)*6*SEGMENT_COUNT),g=new Vector3,v=new Vector3,_=new Vector3,T=new Vector3,M=new Vector3,S=new Vector3,b=new Quaternion,C=new Vector3,w=0,R=0,E=0;for(let k=0;k<THREHSOLDS.length;k++){let L=k==0?0:THREHSOLDS[k-1],D=THREHSOLDS[k];_.fromArray(t,L*3),v.copy(_),M.set(0,1,0);let ne=0;for(let z=L;z<D;z++){let j=z*3;g.copy(v),v.copy(_),z<D-1&&_.fromArray(t,j+3),T.subVectors(_,g).normalize(),S.crossVectors(M,T).normalize(),b.setFromAxisAngle(T,Math.PI*2/SEGMENT_COUNT),C.copy(M),ne+=v0.copy(v).sub(g).length();for(let X=0;X<SEGMENT_COUNT;X++){if(C.applyQuaternion(b),a[R+0]=v.x,a[R+1]=v.y,a[R+2]=v.z,l[R+0]=C.x,l[R+1]=C.y,l[R+2]=C.z,c[w]=ne,f[w]=k,z<D-1){let Z=X==SEGMENT_COUNT-1?1-SEGMENT_COUNT:1;p[E++]=w,p[E++]=w+Z,p[E++]=w+SEGMENT_COUNT,p[E++]=w+Z,p[E++]=w+SEGMENT_COUNT+Z,p[E++]=w+SEGMENT_COUNT}w++,R+=3}}let re=SEGMENT_COUNT*(D-L);w-=re;let ce=w+re;for(;w<ce;w++)u[w]=ne}let I=new BufferGeometry;I.setAttribute("position",new BufferAttribute(a,3)),I.setAttribute("normal",new BufferAttribute(l,3)),I.setAttribute("t",new BufferAttribute(c,1)),I.setAttribute("totalLength",new BufferAttribute(u,1)),I.setAttribute("lineId",new BufferAttribute(f,1)),I.setIndex(new BufferAttribute(p,1));let F=new ShaderMaterial({uniforms:Object.assign({u_time:properties.sharedUniforms.u_time},aboutHero.sharedUniforms),vertexShader:vert$7,fragmentShader:frag$a,blending:CustomBlending,blendEquation:MaxEquation,blendSrc:OneFactor,blendDst:OneFactor,blendEquationAlpha:AddEquation,blendSrcAlpha:OneFactor,blendDstAlpha:OneFactor});F.extensions.derivatives=!0,this.mesh=new Mesh(I,F),this.mesh.renderOrder=15,this.container.add(this.mesh)}init(){}update(e){}}const aboutHeroLines=new AboutHeroLines,vert$6=`#define GLSLIFY 1
attribute vec2 boneIndices;attribute vec2 boneWeights;uniform vec3 u_bonePoses[BONE_COUNT];uniform vec4 u_boneOrients[BONE_COUNT];varying vec3 v_worldPosition;varying vec3 v_worldNormal;varying vec2 v_uv;varying float v_depth;vec3 inverseTransformDirection(in vec3 dir,in mat4 matrix){return normalize((vec4(dir,0.0)*matrix).xyz);}vec3 qrotate(vec4 q,vec3 v){return v+2.0*cross(q.xyz,cross(q.xyz,v)+q.w*v);}void main(){vec3 pos=vec3(0.0);vec3 nor=vec3(0.0);vec3 bonePos;vec4 boneOrient;bonePos=u_bonePoses[int(boneIndices.x)];boneOrient=u_boneOrients[int(boneIndices.x)];pos+=(qrotate(boneOrient,position)+bonePos)*boneWeights.x;nor+=qrotate(boneOrient,normal)*boneWeights.x;bonePos=u_bonePoses[int(boneIndices.y)];boneOrient=u_boneOrients[int(boneIndices.y)];pos+=(qrotate(boneOrient,position)+bonePos)*boneWeights.y;nor+=qrotate(boneOrient,normal)*boneWeights.y;vec4 mvPosition=modelViewMatrix*vec4(pos,1.0);gl_Position=projectionMatrix*mvPosition;v_worldPosition=(modelMatrix*vec4(pos,1.0)).xyz;v_worldNormal=inverseTransformDirection(nor,viewMatrix);v_uv=uv;
#include <aboutHeroVisualFinal_vert>
}`,frag$9=`#define GLSLIFY 1
uniform sampler2D u_texture;uniform vec3 u_lightPosition;uniform vec3 u_lightMixer;uniform float u_sceneRatio;uniform float u_hudRatio;varying vec3 v_worldPosition;varying vec3 v_worldNormal;varying vec2 v_uv;varying float v_depth;float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}
#include <getScatter>
void main(){vec3 worldNormal=normalize(v_worldNormal);vec3 worldToLight=u_lightPosition-v_worldPosition;float worldToLightDist=length(worldToLight);worldToLight/=worldToLightDist;vec3 cameraToWorld=normalize(v_worldPosition-cameraPosition);vec4 map=texture2D(u_texture,v_uv);float light=dot(u_lightMixer,map.rgb);light=pow(light,1.25);float baseShade=map.a;vec3 color=vec3(baseShade*light);gl_FragColor=vec4(color,0.);gl_FragColor.rgb+=getScatter(cameraPosition,v_worldPosition);
#include <aboutHeroVisualFinal_frag>
gl_FragColor.r*=u_sceneRatio*(1.-u_hudRatio);}`,shadowVert=`#define GLSLIFY 1
varying vec2 v_uv;void main(){v_uv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}`,shadowFrag=`#define GLSLIFY 1
uniform sampler2D u_texture;uniform vec3 u_lightMixer;varying vec2 v_uv;
#include <getBlueNoise>
void main(){vec3 blueNoises=getBlueNoise(gl_FragCoord.xy+vec2(3.,36.));vec3 map3=texture2D(u_texture,v_uv).xyz;float light1=dot(u_lightMixer,map3);float light2=dot(u_lightMixer.gbr,map3);float light=mix(light1,light2,blueNoises.x);light=light*light*.3+.7;gl_FragColor=vec4(light,1.,1.,0.);}`;let _v1$2=new Vector3,_v2$1=new Vector3,_q1$1=new Quaternion,_q2=new Quaternion;class aboutHeroPerson{BONE_COUNT=54;FPS=60;container=new Object3D;geometry=null;mesh=null;texture=null;shadowMesh=null;shadowTexture=null;time=0;frameCount=0;bonePosAnimationData;boneOrientAnimationData;bonePoses=new Float32Array(this.BONE_COUNT*3);boneOrients=new Float32Array(this.BONE_COUNT*4);sharedUniforms={u_texture:{value:null},u_lightMixer:{value:new Vector3(1,0,0)}};preInit(){properties.loader.load(settings.TEXTURE_PATH+"about/person_light.webp",{type:"texture",onLoad:e=>{this.lightTexture=e,this._onTextureLoad(e)}}).content,properties.loader.load(settings.TEXTURE_PATH+"about/person.webp",{type:"texture",onLoad:e=>{this.texture=e,this._onTextureLoad(e)}}).content,this.shadowTexture=properties.loader.load(settings.TEXTURE_PATH+"about/ground_person_shadow.webp",{type:"texture"}).content,properties.loader.add(settings.MODEL_PATH+"about/person.buf",{onLoad:e=>{this._onModelLoad(e)}}),properties.loader.add(settings.MODEL_PATH+"about/person_idle.buf",{onLoad:e=>{this._onAnimationLoad(e)}})}_onTextureLoad(){if(this.lightTexture&&this.texture){let e=fboHelper.createRenderTarget(this.lightTexture.image.width,this.lightTexture.image.height);e.texture.minFilter=LinearMipMapNearestFilter,e.texture.generateMipmaps=!1,this.sharedUniforms.u_texture.value=e.texture,fboHelper.copy(textureHelper.transparentTexture,e),textureHelper.mixChannels(this.lightTexture,e,0,1,2,-1),e.texture.generateMipmaps=!0,textureHelper.mixChannels(this.texture,e,-1,-1,-1,0),this.texture.dispose(),this.lightTexture.dispose(),this.texture=null,this.lightTexture=null}}_onModelLoad(e){this.mesh=new Mesh(e,new ShaderMaterial({uniforms:Object.assign({u_texture:this.sharedUniforms.u_texture,u_lightMixer:this.sharedUniforms.u_lightMixer,u_bonePoses:{value:this.bonePoses},u_boneOrients:{value:this.boneOrients}},light.sharedUniforms,aboutHeroScatter.sharedUniforms,aboutHero.sharedUniforms),vertexShader:vert$6,fragmentShader:frag$9})),this.mesh.material.defines.BONE_COUNT=this.BONE_COUNT,this.container.add(this.mesh)}_onAnimationLoad(e){this.bonePosAnimationData=e.attributes.position.array,this.boneOrientAnimationData=e.attributes.orient.array,this.frameCount=this.bonePosAnimationData.length/(this.BONE_COUNT*3)}init(){this.shadowMesh=new Mesh(new PlaneGeometry(1.5,1.5),new ShaderMaterial({uniforms:Object.assign({u_texture:{value:this.shadowTexture},u_lightMixer:this.sharedUniforms.u_lightMixer},blueNoise.sharedUniforms),vertexShader:shadowVert,fragmentShader:shadowFrag,blending:MultiplyBlending})),this.shadowMesh.renderOrder=10,this.shadowMesh.position.y=.01,this.shadowMesh.rotation.x=-Math.PI/2,this.container.add(this.shadowMesh)}update(e){if(this.mesh&&this.frameCount){this.time+=e*.5;let t=this.time*this.FPS%this.frameCount,r=Math.floor(t),n=Math.ceil(t)%this.frameCount,a=t-r,l=r*this.BONE_COUNT,c=n*this.BONE_COUNT,u=this.frameCount/3;this.sharedUniforms.u_lightMixer.value.set(math.fit(t,u*2,this.frameCount,0,1)+math.fit(t,0,u,1,0),math.fit(t,0,u,0,1)*math.fit(t,u,u*2,1,0),math.fit(t,u,u*2,0,1)*math.fit(t,u*2,this.frameCount,1,0));for(let f=0;f<this.BONE_COUNT;f++)_v1$2.fromArray(this.bonePosAnimationData,(l+f)*3).lerp(_v2$1.fromArray(this.bonePosAnimationData,(c+f)*3),a).toArray(this.bonePoses,f*3),_q1$1.fromArray(this.boneOrientAnimationData,(l+f)*4).slerp(_q2.fromArray(this.boneOrientAnimationData,(c+f)*4),a).toArray(this.boneOrients,f*4)}}}const aboutHeroPerson$1=new aboutHeroPerson,aboutHeroVisualFinalVert=`#define GLSLIFY 1
float viewZ=(modelViewMatrix*vec4(pos,1.0)).z;float near=1.;float far=100.0;v_depth=1.0-(viewZ+near)/(near-far);`,aboutHeroVisualFinalFrag=`#define GLSLIFY 1
gl_FragColor.r=gl_FragColor.r;gl_FragColor.g=v_depth;gl_FragColor.b=1.0;`,vert$5=`#define GLSLIFY 1
varying vec3 v_worldPosition;varying vec2 v_uv;varying float v_depth;varying float v_instanceId;varying float v_opacity;attribute float a_instanceId;attribute vec3 a_instancePos;attribute vec3 a_instanceRands;uniform float u_introTime;uniform float u_sceneRatio;uniform float u_hudRatio;vec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}float mod289(float x){return x-floor(x*(1.0/289.0))*289.0;}vec4 permute(vec4 x){return mod289(((x*34.0)+1.0)*x);}float permute(float x){return mod289(((x*34.0)+1.0)*x);}vec4 taylorInvSqrt(vec4 r){return 1.79284291400159-0.85373472095314*r;}float taylorInvSqrt(float r){return 1.79284291400159-0.85373472095314*r;}vec4 grad4(float j,vec4 ip){const vec4 ones=vec4(1.0,1.0,1.0,-1.0);vec4 p,s;p.xyz=floor(fract(vec3(j)*ip.xyz)*7.0)*ip.z-1.0;p.w=1.5-dot(abs(p.xyz),ones.xyz);s=vec4(lessThan(p,vec4(0.0)));p.xyz=p.xyz+(s.xyz*2.0-1.0)*s.www;return p;}
#define F4 0.309016994374947451
vec4 simplexNoiseDerivatives(vec4 v_0){const vec4 C=vec4(0.138196601125011,0.276393202250021,0.414589803375032,-0.447213595499958);vec4 i=floor(v_0+dot(v_0,vec4(F4)));vec4 x0=v_0-i+dot(i,C.xxxx);vec4 i0;vec3 isX=step(x0.yzw,x0.xxx);vec3 isYZ=step(x0.zww,x0.yyz);i0.x=isX.x+isX.y+isX.z;i0.yzw=1.0-isX;i0.y+=isYZ.x+isYZ.y;i0.zw+=1.0-isYZ.xy;i0.z+=isYZ.z;i0.w+=1.0-isYZ.z;vec4 i3=clamp(i0,0.0,1.0);vec4 i2=clamp(i0-1.0,0.0,1.0);vec4 i1=clamp(i0-2.0,0.0,1.0);vec4 x1=x0-i1+C.xxxx;vec4 x2=x0-i2+C.yyyy;vec4 x3=x0-i3+C.zzzz;vec4 x4=x0+C.wwww;i=mod289(i);float j0=permute(permute(permute(permute(i.w)+i.z)+i.y)+i.x);vec4 j1=permute(permute(permute(permute(i.w+vec4(i1.w,i2.w,i3.w,1.0))+i.z+vec4(i1.z,i2.z,i3.z,1.0))+i.y+vec4(i1.y,i2.y,i3.y,1.0))+i.x+vec4(i1.x,i2.x,i3.x,1.0));vec4 ip=vec4(1.0/294.0,1.0/49.0,1.0/7.0,0.0);vec4 p0=grad4(j0,ip);vec4 p1=grad4(j1.x,ip);vec4 p2=grad4(j1.y,ip);vec4 p3=grad4(j1.z,ip);vec4 p4=grad4(j1.w,ip);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;p4*=taylorInvSqrt(dot(p4,p4));vec3 values0=vec3(dot(p0,x0),dot(p1,x1),dot(p2,x2));vec2 values1=vec2(dot(p3,x3),dot(p4,x4));vec3 m0=max(0.5-vec3(dot(x0,x0),dot(x1,x1),dot(x2,x2)),0.0);vec2 m1=max(0.5-vec2(dot(x3,x3),dot(x4,x4)),0.0);vec3 temp0=-6.0*m0*m0*values0;vec2 temp1=-6.0*m1*m1*values1;vec3 mmm0=m0*m0*m0;vec2 mmm1=m1*m1*m1;float dx=temp0[0]*x0.x+temp0[1]*x1.x+temp0[2]*x2.x+temp1[0]*x3.x+temp1[1]*x4.x+mmm0[0]*p0.x+mmm0[1]*p1.x+mmm0[2]*p2.x+mmm1[0]*p3.x+mmm1[1]*p4.x;float dy=temp0[0]*x0.y+temp0[1]*x1.y+temp0[2]*x2.y+temp1[0]*x3.y+temp1[1]*x4.y+mmm0[0]*p0.y+mmm0[1]*p1.y+mmm0[2]*p2.y+mmm1[0]*p3.y+mmm1[1]*p4.y;float dz=temp0[0]*x0.z+temp0[1]*x1.z+temp0[2]*x2.z+temp1[0]*x3.z+temp1[1]*x4.z+mmm0[0]*p0.z+mmm0[1]*p1.z+mmm0[2]*p2.z+mmm1[0]*p3.z+mmm1[1]*p4.z;float dw=temp0[0]*x0.w+temp0[1]*x1.w+temp0[2]*x2.w+temp1[0]*x3.w+temp1[1]*x4.w+mmm0[0]*p0.w+mmm0[1]*p1.w+mmm0[2]*p2.w+mmm1[0]*p3.w+mmm1[1]*p4.w;return vec4(dx,dy,dz,dw)*49.0;}vec2 rotate(vec2 v,float a){float s=sin(a);float c=cos(a);mat2 m=mat2(c,s,-s,c);return m*v;}float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main(){vec3 localPos=position;localPos.xy=rotate(localPos.xy,a_instanceRands.y*6.28+sign(-a_instancePos.x)*u_introTime*mix(0.03,0.15,a_instanceRands.z));vec3 pos=(9.0+2.0*a_instanceRands.x)*localPos;vec3 noise=simplexNoiseDerivatives(vec4((a_instancePos+pos)*0.5,u_introTime*0.075)).yzw;float cycle=fract((0.08+0.08*a_instanceRands.x)*u_introTime+a_instanceRands.z);vec3 instancePos=a_instancePos+vec3(cycle*(a_instancePos.x*0.75+sign(a_instancePos.x)*0.25),0.0,0.0)+noise*vec3(0.35,0.2,0.1);instancePos.y-=linearStep(4.,1.,abs(instancePos.x))*1.+0.5;pos+=instancePos;vec4 mvPosition=modelViewMatrix*vec4(pos,1.);gl_Position=projectionMatrix*mvPosition;v_worldPosition=(modelMatrix*vec4(pos,1.)).xyz;v_uv=uv;v_instanceId=a_instanceId;float d=(modelViewMatrix*vec4(instancePos,1.0)).z;v_opacity=smoothstep(1.,3.,-d)*u_sceneRatio*(1.-u_hudRatio)*linearStep(0.,0.25,cycle)*linearStep(1.,0.75,cycle)*mix(1.,0.75,a_instanceRands.x);if(v_opacity<0.004){gl_Position.z=2.*gl_Position.w;}
#include <aboutHeroVisualFinal_vert>
}`,frag$8=`#define GLSLIFY 1
varying vec3 v_worldPosition;varying vec2 v_uv;varying float v_depth;varying float v_instanceId;varying float v_opacity;uniform sampler2D u_currSceneTexture;uniform sampler2D u_fogTexture;uniform vec2 u_resolution;uniform vec3 u_lightPosition;uniform float u_noiseStableFactor;uniform float u_time;
#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define saturate( a ) clamp( a, 0.0, 1.0 )
#include <getBlueNoise>
#include <getScatter>
float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main(){float faceDirection=gl_FrontFacing ? 1.0 :-1.0;vec2 screenPaintUv=gl_FragCoord.xy/u_resolution;vec2 fogMap=texture2D(u_fogTexture,v_uv).rg;vec4 currScene=texture2D(u_currSceneTexture,screenPaintUv);float depth=v_depth-fogMap.y*0.02;float depthMask=fogMap.x*1.35-fogMap.y*0.15;gl_FragColor.r=depthMask*v_opacity;gl_FragColor.gb=currScene.gb;gl_FragColor.a=exp(-length(v_worldPosition+vec3(0.,0.,-max(0.,fogMap.y-0.25)*10.+5.)-vec3(0.,0.,0.))*(0.22-fogMap.x*0.2))*fogMap.y*linearStep(0.0,0.035,depth-currScene.g)*v_opacity*0.45;}`;class AboutHeroFog{container=new Object3D;geometry=null;material=null;mesh=null;texture=null;cacheRT=null;INSTANCES_COUNT=32;preInit(){this.texture=properties.loader.add(settings.TEXTURE_PATH+"about/fog.png",{type:"texture"}).content}init(){let e=math.getSeedRandomFn("fog96");this.cacheRT=fboHelper.createRenderTarget(1,1);const t=new PlaneGeometry(1,1,3,3);this.geometry=new InstancedBufferGeometry;for(let l in t.attributes)this.geometry.setAttribute(l,t.attributes[l]);this.geometry.setIndex(t.index);const r=new Float32Array(this.INSTANCES_COUNT),n=new Float32Array(this.INSTANCES_COUNT*3),a=new Float32Array(this.INSTANCES_COUNT*3);for(let l=0,c=0;l<this.INSTANCES_COUNT;l++)r[l]=l,n[c]=12*(e()*2-1),n[c+1]=-.25+.5*e(),n[c+2]=12*(1-l/(this.INSTANCES_COUNT-1)*2),a[c]=e()*2-1,a[c+1]=e()*2-1,a[c+2]=e()*2-1,c+=3;this.geometry.setAttribute("a_instanceId",new InstancedBufferAttribute(r,1)),this.geometry.setAttribute("a_instancePos",new InstancedBufferAttribute(n,3)),this.geometry.setAttribute("a_instanceRands",new InstancedBufferAttribute(a,3)),this.material=new ShaderMaterial({uniforms:Object.assign({u_fogTexture:{value:this.texture},u_currSceneTexture:{value:this.cacheRT.texture},u_lightPosition:light.sharedUniforms.u_lightPosition,u_resolution:properties.sharedUniforms.u_resolution},blueNoise.sharedUniforms,aboutHeroScatter.sharedUniforms,aboutHero.sharedUniforms),vertexShader:vert$5,fragmentShader:frag$8,side:DoubleSide,depthWrite:!1,blending:CustomBlending,blendEquation:AddEquation,blendSrc:SrcAlphaFactor,blendDst:OneMinusSrcAlphaFactor,blendEquationAlpha:AddEquation,blendSrcAlpha:ZeroFactor,blendDstAlpha:OneFactor}),this.mesh=new Mesh(this.geometry,this.material),this.mesh.renderOrder=20,this.mesh.frustumCulled=!1,this.mesh.onBeforeRender=this.onBeforeRender.bind(this),this.container.add(this.mesh)}onBeforeRender(){let e=fboHelper.renderer,t=e.getRenderTarget();fboHelper.clearMultisampleRenderTargetState(),fboHelper.copy(t.texture,this.cacheRT),e.setRenderTarget(t)}resize(e,t){this.cacheRT.setSize(e,t)}update(e){}}const aboutHeroFog=new AboutHeroFog,vert$4=`#define GLSLIFY 1
varying vec3 v_viewPosition;varying vec3 v_worldPosition;varying vec3 v_viewNormal;varying vec2 v_uv;varying vec3 v_localPosition;varying float v_depth;uniform vec3 u_lightPosition;void main(){vec3 pos=position;vec4 mvPosition=modelViewMatrix*vec4(pos,1.);gl_Position=projectionMatrix*mvPosition;v_worldPosition=(modelMatrix*vec4(pos,1.)).xyz;v_viewNormal=normalMatrix*normal;v_viewPosition=-mvPosition.xyz;v_uv=uv;v_localPosition=position;gl_Position.z=1.*(gl_Position.w);}`,frag$7=`#define GLSLIFY 1
varying vec3 v_viewPosition;varying vec3 v_worldPosition;varying vec3 v_viewNormal;varying vec2 v_uv;varying vec3 v_localPosition;varying float v_depth;uniform vec3 u_bgColor;uniform vec3 u_lightPosition;uniform vec2 u_resolution;uniform sampler2D u_currSceneTexture;uniform float u_sceneRatio;uniform float u_hudRatio;
#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define saturate( a ) clamp( a, 0.0, 1.0 )
float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}
#include <getScatter>
#include <getBlueNoise>
void main(){vec3 noise=getBlueNoise(gl_FragCoord.xy+vec2(57.,27.));gl_FragColor.r=getScatter(cameraPosition,v_worldPosition);gl_FragColor.r*=u_sceneRatio*(1.-u_hudRatio);gl_FragColor.g=1.;gl_FragColor.b=linearStep(15.,66.,v_worldPosition.z);gl_FragColor.a=0.;gl_FragColor.r+=noise.r*0.004;}`;class AboutHeroHalo{container=new Object3D;mesh=null;preInit(){properties.loader.add(settings.MODEL_PATH+"about/bg_box.buf",{onLoad:this._onGeometryLoad.bind(this)})}_onGeometryLoad(e){this.mesh=new Mesh(e,new ShaderMaterial({uniforms:Object.assign({u_resolution:properties.sharedUniforms.u_resolution},light.sharedUniforms,blueNoise.sharedUniforms,aboutHeroScatter.sharedUniforms,aboutHero.sharedUniforms),vertexShader:vert$4,fragmentShader:frag$7})),this.mesh.renderOrder=10,this.container.add(this.mesh)}init(){}resize(e,t){}update(e){}}const aboutHeroHalo=new AboutHeroHalo,vert$3=`#define GLSLIFY 1
uniform sampler2D u_positionTexture;uniform sampler2D u_norShadeTexture;uniform float u_activeRatio;uniform float u_showRatio;uniform vec3 u_mouse;uniform vec2 u_resolution;uniform float u_time;uniform float u_isForward;uniform float u_glitchOffset;uniform float u_glitchStrength;uniform float u_glitchThreshold;attribute vec2 a_simUv;attribute vec4 a_rands1;attribute vec4 a_rands2;varying float v_shade;varying float v_showRatio;varying float v_blurriness;varying vec2 v_toCenter;varying vec2 v_uv;varying vec3 v_color;vec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}float mod289(float x){return x-floor(x*(1.0/289.0))*289.0;}vec4 permute(vec4 x){return mod289(((x*34.0)+1.0)*x);}float permute(float x){return mod289(((x*34.0)+1.0)*x);}vec4 taylorInvSqrt(vec4 r){return 1.79284291400159-0.85373472095314*r;}float taylorInvSqrt(float r){return 1.79284291400159-0.85373472095314*r;}vec4 grad4(float j,vec4 ip){const vec4 ones=vec4(1.0,1.0,1.0,-1.0);vec4 p,s;p.xyz=floor(fract(vec3(j)*ip.xyz)*7.0)*ip.z-1.0;p.w=1.5-dot(abs(p.xyz),ones.xyz);s=vec4(lessThan(p,vec4(0.0)));p.xyz=p.xyz+(s.xyz*2.0-1.0)*s.www;return p;}
#define F4 0.309016994374947451
vec4 simplexNoiseDerivatives(vec4 v){const vec4 C=vec4(0.138196601125011,0.276393202250021,0.414589803375032,-0.447213595499958);vec4 i=floor(v+dot(v,vec4(F4)));vec4 x0=v-i+dot(i,C.xxxx);vec4 i0;vec3 isX=step(x0.yzw,x0.xxx);vec3 isYZ=step(x0.zww,x0.yyz);i0.x=isX.x+isX.y+isX.z;i0.yzw=1.0-isX;i0.y+=isYZ.x+isYZ.y;i0.zw+=1.0-isYZ.xy;i0.z+=isYZ.z;i0.w+=1.0-isYZ.z;vec4 i3=clamp(i0,0.0,1.0);vec4 i2=clamp(i0-1.0,0.0,1.0);vec4 i1=clamp(i0-2.0,0.0,1.0);vec4 x1=x0-i1+C.xxxx;vec4 x2=x0-i2+C.yyyy;vec4 x3=x0-i3+C.zzzz;vec4 x4=x0+C.wwww;i=mod289(i);float j0=permute(permute(permute(permute(i.w)+i.z)+i.y)+i.x);vec4 j1=permute(permute(permute(permute(i.w+vec4(i1.w,i2.w,i3.w,1.0))+i.z+vec4(i1.z,i2.z,i3.z,1.0))+i.y+vec4(i1.y,i2.y,i3.y,1.0))+i.x+vec4(i1.x,i2.x,i3.x,1.0));vec4 ip=vec4(1.0/294.0,1.0/49.0,1.0/7.0,0.0);vec4 p0=grad4(j0,ip);vec4 p1=grad4(j1.x,ip);vec4 p2=grad4(j1.y,ip);vec4 p3=grad4(j1.z,ip);vec4 p4=grad4(j1.w,ip);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;p4*=taylorInvSqrt(dot(p4,p4));vec3 values0=vec3(dot(p0,x0),dot(p1,x1),dot(p2,x2));vec2 values1=vec2(dot(p3,x3),dot(p4,x4));vec3 m0=max(0.5-vec3(dot(x0,x0),dot(x1,x1),dot(x2,x2)),0.0);vec2 m1=max(0.5-vec2(dot(x3,x3),dot(x4,x4)),0.0);vec3 temp0=-6.0*m0*m0*values0;vec2 temp1=-6.0*m1*m1*values1;vec3 mmm0=m0*m0*m0;vec2 mmm1=m1*m1*m1;float dx=temp0[0]*x0.x+temp0[1]*x1.x+temp0[2]*x2.x+temp1[0]*x3.x+temp1[1]*x4.x+mmm0[0]*p0.x+mmm0[1]*p1.x+mmm0[2]*p2.x+mmm1[0]*p3.x+mmm1[1]*p4.x;float dy=temp0[0]*x0.y+temp0[1]*x1.y+temp0[2]*x2.y+temp1[0]*x3.y+temp1[1]*x4.y+mmm0[0]*p0.y+mmm0[1]*p1.y+mmm0[2]*p2.y+mmm1[0]*p3.y+mmm1[1]*p4.y;float dz=temp0[0]*x0.z+temp0[1]*x1.z+temp0[2]*x2.z+temp1[0]*x3.z+temp1[1]*x4.z+mmm0[0]*p0.z+mmm0[1]*p1.z+mmm0[2]*p2.z+mmm1[0]*p3.z+mmm1[1]*p4.z;float dw=temp0[0]*x0.w+temp0[1]*x1.w+temp0[2]*x2.w+temp1[0]*x3.w+temp1[1]*x4.w+mmm0[0]*p0.w+mmm0[1]*p1.w+mmm0[2]*p2.w+mmm1[0]*p3.w+mmm1[1]*p4.w;return vec4(dx,dy,dz,dw)*49.0;}vec4 hash42(vec2 p){vec4 p4=fract(vec4(p.xyxy)*vec4(.1031,.1030,.0973,.1099));p4+=dot(p4,p4.wzxy+33.33);return fract((p4.xxyz+p4.yzzw)*p4.zywx);}float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}vec3 inverseTransformDirection(in vec3 dir,in mat4 matrix){return normalize((vec4(dir,0.0)*matrix).xyz);}void main(){vec3 basePos=texture2D(u_positionTexture,a_simUv).xyz;vec3 pos=basePos;float yRatio=basePos.y*0.5+0.5;float showRatio=smoothstep(a_rands1.x*0.2+yRatio*0.4,0.4+a_rands1.y*0.2+yRatio*0.4,u_showRatio);pos*=1.3;pos+=(simplexNoiseDerivatives(vec4(basePos*8.,u_time)).yzw*0.2+vec3(1.*yRatio,0.0,-1.))*(1.-showRatio);v_showRatio=showRatio;vec4 norShade=texture2D(u_norShadeTexture,a_simUv);float depth=clamp(1.-pos.z,0.0,1.0);vec3 nor=norShade.xyz*2.-1.;vec3 worldPosition=(modelMatrix*vec4(pos,1.0)).xyz;vec3 viewNormal=normalMatrix*normalize(nor);vec3 worldNormal=inverseTransformDirection(viewNormal,viewMatrix);vec3 lightDir=normalize(u_mouse-worldPosition);float distToLight=distance(u_mouse,worldPosition);float light=norShade.w*1.25;float diff=linearStep(0.35,1.0,dot(worldNormal,lightDir))/sqrt(distToLight*0.1);light*=diff+0.6;light+=(0.05+diff*0.15)*smoothstep(0.0,0.005,norShade.w);float frontFaceMultiplier=linearStep(-0.2,0.0,viewNormal.z);light*=frontFaceMultiplier;v_blurriness=min(1.0,(abs(depth-(1.-u_activeRatio*showRatio)*0.5))*2.5)*(2.-showRatio);float basePointSize=0.009*(1.+pow(v_blurriness,1.5)*8.)*frontFaceMultiplier;float pointSize=max(basePointSize,12./u_resolution.y);float subpixelMultiplier=pow(basePointSize/pointSize,1.5);pos.xy+=position.xy*pointSize*step(0.003,light)*linearStep(0.0,0.75,u_activeRatio);vec4 verticalRands=hash42(vec2(floor(basePos.y*3.+cos(basePos.y*3.+u_glitchOffset)*2.+u_glitchOffset),0.))*u_glitchStrength;float glitchWeight=verticalRands.x*step(u_glitchThreshold,verticalRands.y);pos.x+=(verticalRands.z*verticalRands.z)*glitchWeight*0.35*cos(basePos.y+u_glitchOffset);gl_Position=projectionMatrix*modelViewMatrix*vec4(pos,1.0);v_color=mix(vec3(1.0),(viewNormal.xzy*0.5+0.5)*vec3(1.0,0.5,2.0),glitchWeight);light*=(1.+glitchWeight*1.5);light+=0.1*glitchWeight;float scanline=smoothstep(0.04,0.,abs(fract(u_time*-0.3-basePos.y*.5+.5)));light+=scanline*(0.25*norShade.w*(1.0-light)+smoothstep(0.03,0.,abs(viewNormal.z)));v_shade=min(1.0,light*(1.-v_blurriness*0.5))*subpixelMultiplier*showRatio;v_toCenter=(uv-.5)*2.;v_uv=uv;}`,frag$6=`#define GLSLIFY 1
varying float v_shade;varying float v_showRatio;varying vec2 v_toCenter;varying float v_blurriness;varying vec2 v_uv;varying vec3 v_color;float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}vec3 linearStep(vec3 edge0,vec3 edge1,vec3 x){return clamp((x-edge0)/(edge1-edge0),vec3(0.),vec3(1.));}void main(){float shade=v_shade;float d=length(v_toCenter);float range=v_blurriness*5.;float brightness=linearStep(1.,1.-range-fwidth(d),d);shade*=brightness*(1.25-v_blurriness*v_shade);gl_FragColor=vec4(shade)*v_showRatio*v_showRatio;gl_FragColor.a*=pow(1.-v_blurriness,3.)*0.8*linearStep(0.8,1.0,v_showRatio*v_showRatio);}`,PARTICLE_COUNT=8192,SIM_TEXTURE_WIDTH=128,SIM_TEXTURE_HEIGHT=64,MAX_FACE_NUM=2;let _v1$1=new Vector3;new Vector3;let _m=new Matrix4;class AboutHeroFaces{container=new Object3D;faceContainer=new Object3D;isActive=!1;hasStartedLoads={};teamPosDataTextures={};teamNShadeDataTextures={};sharedUniforms={u_mouse:{value:new Vector3},u_glitchOffset:{value:0},u_glitchStrength:{value:0},u_showRatio:{value:0}};currId="";nextId="";transitionRatio=0;showRatio=0;activeRatio=1;hideRatio=0;meshArray=[];preInit(){}load(e){this.hasStartedLoads[e]||(this.hasStartedLoads[e]=!0,properties.loader[properties.hasInitialized?"load":"add"](settings.TEAM_PATH+e+".buf",{onLoad:t=>{this._onModelLoaded(e,t)}}))}_onModelLoaded(e,t){let r=t.attributes.position.array,n=new Float32Array(PARTICLE_COUNT*4);for(let a=0,l=0,c=0;a<PARTICLE_COUNT;a++,l+=3,c+=4)n[c]=r[l],n[c+1]=r[l+1],n[c+2]=r[l+2],n[c+3]=1/PARTICLE_COUNT;this.teamPosDataTextures[e]=fboHelper.createDataTexture(n,SIM_TEXTURE_WIDTH,SIM_TEXTURE_HEIGHT,!0,!0),this.teamNShadeDataTextures[e]=fboHelper.createDataTexture(t.attributes.nShade.array,SIM_TEXTURE_WIDTH,SIM_TEXTURE_HEIGHT,!1,!0)}init(){this.container.add(this.faceContainer),this.container.scale.set(27.5,27.5,16),this.container.rotation.y=Math.PI+.2,this.container.rotation.x=.1,this.container.position.y=34,this.container.position.z=25,this.container.updateMatrixWorld(!0);let e=new PlaneGeometry(1,1),t=new InstancedBufferGeometry;for(let l in e.attributes)t.attributes[l]=e.attributes[l];t.index=e.index;let r=new Float32Array(PARTICLE_COUNT*2),n=new Float32Array(PARTICLE_COUNT*4),a=new Float32Array(PARTICLE_COUNT*4);for(let l=0,c=0,u=0;l<PARTICLE_COUNT;l++,c+=2,u+=4)r[c]=(l%SIM_TEXTURE_WIDTH+.5)/SIM_TEXTURE_WIDTH,r[c+1]=(~~(l/SIM_TEXTURE_WIDTH)+.5)/SIM_TEXTURE_HEIGHT,n[u]=Math.random(),n[u+1]=Math.random(),n[u+2]=Math.random(),n[u+3]=Math.random(),a[u]=Math.random(),a[u+1]=Math.random(),a[u+2]=Math.random(),a[u+3]=Math.random();t.setAttribute("a_simUv",new InstancedBufferAttribute(r,2)),t.setAttribute("a_rands1",new InstancedBufferAttribute(n,4)),t.setAttribute("a_rands2",new InstancedBufferAttribute(a,4));for(let l=0;l<MAX_FACE_NUM;l++){const c=new ShaderMaterial({uniforms:{u_time:properties.sharedUniforms.u_time,u_resolution:properties.sharedUniforms.u_resolution,u_mouse:this.sharedUniforms.u_mouse,u_glitchOffset:this.sharedUniforms.u_glitchOffset,u_glitchStrength:this.sharedUniforms.u_glitchStrength,u_glitchThreshold:{value:0},u_activeRatio:{value:0},u_showRatio:this.sharedUniforms.u_showRatio,u_positionTexture:{value:null},u_norShadeTexture:{value:null}},vertexShader:vert$3,fragmentShader:frag$6,depthTest:!1,depthWrite:!1,transparent:!0,blending:CustomBlending,blendEquation:AddEquation,blendSrc:OneFactor,blendDst:OneFactor,blendEquationAlpha:AddEquation,blendSrcAlpha:OneFactor,blendDstAlpha:OneFactor});c.extensions.derivatives=!0;const u=new Mesh(t,c);u.frustumCulled=!1,u.visible=!1,this.meshArray.push(u),this.faceContainer.add(u)}}resize(e,t){}update(e){if(this.meshArray.length>0){let t=this.transitionRatio;this.sharedUniforms.u_showRatio.value=this.showRatio;let r=input.easedMouseDynamics.default.value;_v1$1.set(r.x,r.y,.5).unproject(cameraControls._camera).sub(cameraControls._camera.position).normalize(),_v1$1.multiplyScalar(75/_v1$1.z).add(cameraControls._camera.position),_m.copy(this.faceContainer.matrixWorld).invert(),_v1$1.applyMatrix4(_m);let n=math.clamp(_v1$1.y*.03,-.05,.05),a=math.clamp(_v1$1.x*.03,-.05,.05);_v1$1.applyMatrix4(this.faceContainer.matrixWorld),this.sharedUniforms.u_mouse.value.copy(_v1$1);let l=this.meshArray[0];l.material.uniforms.u_positionTexture.value=this.teamPosDataTextures[this.currId],l.material.uniforms.u_norShadeTexture.value=this.teamNShadeDataTextures[this.currId],l.material.uniforms.u_activeRatio.value=1-t,l.material.uniforms.u_glitchThreshold.value=math.fit(l.material.uniforms.u_activeRatio.value,.4,1,0,.9),l.material.uniforms.u_activeRatio.value*=this.activeRatio,l.position.x=t*-1.5,l.position.z=-t*2-(1-this.activeRatio)*2,l.rotation.y=t*-.3+a,l.rotation.x=t*.4+n,l.visible=!0;let c=this.meshArray[1];c.material.uniforms.u_positionTexture.value=this.teamPosDataTextures[this.nextId],c.material.uniforms.u_norShadeTexture.value=this.teamNShadeDataTextures[this.nextId],c.material.uniforms.u_activeRatio.value=t,c.material.uniforms.u_glitchThreshold.value=math.fit(c.material.uniforms.u_activeRatio.value,.4,1,0,.9),c.material.uniforms.u_activeRatio.value*=this.activeRatio,c.position.x=(t-1)*-1.5,c.position.z=(t-1)*2-(1-this.activeRatio)*2,c.rotation.y=(t-1)*-.3+a,c.rotation.x=(t-1)*-.4+n,c.visible=!0,this.sharedUniforms.u_glitchOffset.value=Math.random()*1e3,this.sharedUniforms.u_glitchStrength.value=Math.random(),this.container.visible=this.isActive}}}const aboutHeroFaces=new AboutHeroFaces,fragmentShader$1=`#define GLSLIFY 1
uniform sampler2D u_texture;uniform vec3 u_colorBurn;uniform float u_colorBurnAlpha;uniform vec3 u_colorDodge;uniform float u_colorDodgeAlpha;varying vec2 v_uv;vec3 colorDodge(in vec3 src,in vec3 dst){return mix(step(0.,src)*(min(vec3(1.),dst/(1.-src))),vec3(1.),step(1.,dst));}vec3 colorBurn(in vec3 src,in vec3 dst){return mix(step(0.,src)*(1.-min(vec3(1.),(1.-dst)/src)),vec3(1.),step(1.,dst));}void main(){vec4 texture=texture2D(u_texture,v_uv);vec3 colorBurn=mix(texture.rgb,colorBurn(u_colorBurn,texture.rgb),u_colorBurnAlpha);vec3 colorDodge=mix(texture.rgb,colorDodge(u_colorDodge,texture.rgb),u_colorDodgeAlpha);texture.rgb=mix(colorBurn,colorDodge,texture.rgb);gl_FragColor=texture;}`;let _sceneColorBurn=new Color("#00f0ff"),_sceneColorDodge=new Color("#005aff"),_sceneColorBurnAlpha=.15,_sceneColorDodgeAlpha=.12,_hudColorBurn=new Color("#79a8ff"),_hudColorDodge=new Color("#a5ff44"),_hudColorBurnAlpha=1,_hudColorDodgeAlpha=.7;class AboutPageHeroEfx extends PostEffect{colorBurn=new Color("#000");colorDodge=new Color("#000");hudRatio=1;isActive=!0;renderOrder=20;randSimplex1Ds=[];init(e){Object.assign(this,e),super.init(),this.material=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:null},u_colorBurn:{value:this.colorBurn},u_colorBurnAlpha:{value:1},u_colorDodge:{value:this.colorDodge},u_colorDodgeAlpha:{value:1}},fragmentShader:fragmentShader$1})}needsRender(){return this.isActive}render(e,t=!1){let r=this.material.uniforms;this.colorBurn.copy(_sceneColorBurn).lerp(_hudColorBurn,this.hudRatio),this.colorDodge.copy(_sceneColorDodge).lerp(_hudColorDodge,this.hudRatio),r.u_colorBurnAlpha.value=math.mix(_sceneColorBurnAlpha,_hudColorBurnAlpha,this.hudRatio*this.hudRatio),r.u_colorDodgeAlpha.value=math.mix(_sceneColorDodgeAlpha,_hudColorDodgeAlpha,this.hudRatio*this.hudRatio),super.render(e,t)}}const aboutPageHeroEfx=new AboutPageHeroEfx,vert$2=`#define GLSLIFY 1
attribute vec3 instancePos;attribute vec4 instanceRands;attribute float instanceDensity;uniform float u_time;uniform float u_showRatio;varying vec2 v_uv;varying vec2 v_charUv;varying vec3 v_worldPosition;varying vec4 v_instanceRands;varying float v_opacity;void main(){float charCount=mix(50.,100.,instanceRands.y);vec3 pos=position;v_uv=uv;pos.xy*=vec2(1.,6./5.*charCount);v_charUv=vec2(1.-position.x,position.y*charCount)+vec2(.5,0.);v_charUv.y-=u_time*mix(2.,10.,instanceRands.x);pos=pos*0.75+instancePos;gl_Position=projectionMatrix*modelViewMatrix*vec4(pos,1.);v_worldPosition=(modelMatrix*vec4(pos,1.)).xyz;v_instanceRands=instanceRands;v_opacity=mix(.5,1.,instanceDensity)*u_showRatio;}`,frag$5=`#define GLSLIFY 1
uniform sampler2D u_letterTexture;uniform float u_time;varying vec2 v_charUv;varying vec2 v_uv;varying vec3 v_worldPosition;varying vec4 v_instanceRands;varying float v_opacity;float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}vec4 hash43(vec3 p){vec4 p4=fract(vec4(p.xyzx)*vec4(.1031,.1030,.0973,.1099));p4+=dot(p4,p4.wzxy+33.33);return fract((p4.xxyz+p4.yzzw)*p4.zywx);}void main(){float fade=1.-linearStep(15.,66.,v_worldPosition.z);float MAX_CHAR=42.;float charIdx=floor(mod(v_charUv.y,MAX_CHAR));float charTime=u_time*mix(1.,2.,v_instanceRands.y+hash43(vec3(charIdx,-100.,v_instanceRands.z)).x);vec4 charRands=hash43(vec3(charIdx,v_instanceRands.w,floor(charTime*-2.)));charIdx=mod(charIdx+floor(charRands.x*MAX_CHAR),MAX_CHAR);vec2 charUv=vec2((v_charUv.x+charIdx)/MAX_CHAR,mod(v_charUv.y,1.));float shade=texture2D(u_letterTexture,charUv).r;gl_FragColor=vec4(shade)*charRands.w*charRands.y*v_opacity;gl_FragColor*=smoothstep(0.5,0.35,abs(v_uv.y-.5))*(0.5+fade*0.5)*(0.3+v_instanceRands.z*1.25)*smoothstep(100.,150.,mod(v_charUv.y-200.*v_instanceRands.y,200.));gl_FragColor.a*=3.;}`;class AboutHeroLetters{container=new Object3D;rt;blurRt;sharedUniforms={};mesh;meshList=[];preInit(){properties.loader.add(settings.MODEL_PATH+"about/letter_placements.buf",{onLoad:this._onGeometryLoad.bind(this)})}_onGeometryLoad(e){let t=new PlaneGeometry(1,1).translate(0,.5,0).rotateY(Math.PI),r=e.attributes.position.count,n=Math.floor(r/4),a=new ShaderMaterial({uniforms:Object.assign({u_time:properties.sharedUniforms.u_time,u_showRatio:aboutHeroFaces.sharedUniforms.u_showRatio},aboutHero.sharedUniforms),depthTest:!1,depthWrite:!1,vertexShader:vert$2,fragmentShader:frag$5,transparent:!0,blending:CustomBlending,blendEquation:AddEquation,blendSrc:OneFactor,blendDst:OneFactor,blendEquationAlpha:AddEquation,blendSrcAlpha:OneFactor,blendDstAlpha:OneFactor});for(let l=0;l<4;l++){let c=new InstancedBufferGeometry;for(let p in t.attributes)c.setAttribute(p,t.attributes[p]);c.setIndex(t.index);let u=new Float32Array(r*4);for(let p=0;p<n;p++)u[p*4+0]=Math.random(),u[p*4+1]=Math.random(),u[p*4+2]=Math.random(),u[p*4+3]=Math.random();c.setAttribute("instanceRands",new InstancedBufferAttribute(u,4));let f=n*l;c.setAttribute("instancePos",new InstancedBufferAttribute(e.attributes.position.array.slice(f*3,(f+n)*3),3)),c.setAttribute("instanceDensity",new InstancedBufferAttribute(e.attributes.density.array.slice(f,f+n),1)),this.meshList[l]=new Mesh(c,a)}this.rt=fboHelper.createRenderTarget(1,1),this.blurRt=fboHelper.createRenderTarget(1,1),this.mesh=new Mesh(new PlaneGeometry(2,2),fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:this.rt.texture}},depthTest:!1,depthWrite:!1,transparent:!0,blending:CustomBlending,blendEquation:AddEquation,blendSrc:OneFactor,blendDst:OneFactor,blendEquationAlpha:AddEquation,blendSrcAlpha:OneFactor,blendDstAlpha:OneFactor})),this.mesh.frustumCulled=!1,this.mesh.renderOrder=10,this.container.add(this.mesh),this.mesh.onBeforeRender=this._onBeforeRender.bind(this)}init(){}_onBeforeRender(){(properties.width!=this.rt.width||properties.height!=this.rt.height)&&this.rt.setSize(properties.width,properties.height);let e=properties.renderer,t=e.getRenderTarget(),r=fboHelper.getColorState();e.setClearColor(0,0),e.setRenderTarget(this.rt),e.clear(),e.autoClear=!1,fboHelper.renderMesh(this.meshList[0],this.rt,properties.camera),blur.blur(16,.5,this.rt,this.blurRt,this.rt),fboHelper.renderMesh(this.meshList[1],this.rt,properties.camera),blur.blur(8,.5,this.rt,this.blurRt,this.rt),fboHelper.renderMesh(this.meshList[2],this.rt,properties.camera),blur.blur(4,.5,this.rt,this.blurRt,this.rt),fboHelper.renderMesh(this.meshList[3],this.rt,properties.camera),e.setRenderTarget(t),fboHelper.setColorState(r)}update(e){}}const aboutHeroLetters=new AboutHeroLetters,_v=new Vector3,_q0=new Quaternion,_q1=new Quaternion;class AboutHero extends Stage3D{container=new Object3D;sceneContainer=new Object3D;hudContainer=new Object3D;cameraSplineGeo=null;cameraSplinePositions=null;cameraSplineOrientation=null;sceneRatio=0;sceneHideRatio=0;initialSplineRatio=0;hudRatio=0;introRatio=0;outSectionRatio=0;freezeRatio=1;introTime=0;scrollYRatio=0;panningSplineRaito=0;sharedUniforms={u_sceneRatio:{value:0},u_sceneHideRatio:{value:0},u_hudRatio:{value:0},u_introRatio:{value:0},u_introTime:{value:0},u_introDeltaTime:{value:0},u_letterTexture:{value:null}};constructor(){super({properties:{defaultCameraPosition:new Vector3(0,5,5),defaultLookAtPosition:new Vector3(0,5,0),cameraDollyZoomFovOffset:0,cameraFov:60,bloomAmount:4,bloomRadius:.25,bloomThreshold:.8,bloomSmoothWidth:.3,haloStrength:0,clearAlpha:0,cameraLookStrength:.1,screenPaintOffsetRatio:0,screenPaintDistortionRGBShift:.1}})}preInit(){aboutPageHeroEfxPrepass.init(),properties.postprocessing.queue.push(aboutPageHeroEfxPrepass),aboutPageHeroEfx.init(),properties.postprocessing.queue.push(aboutPageHeroEfx),this.sharedUniforms.u_letterTexture.value=properties.loader.add(settings.TEXTURE_PATH+"font.png",{minFilter:LinearFilter,type:"texture"}).content,shaderHelper.addChunk("aboutHeroVisualFinal_vert",aboutHeroVisualFinalVert),shaderHelper.addChunk("aboutHeroVisualFinal_frag",aboutHeroVisualFinalFrag),properties.loader.add(settings.MODEL_PATH+"about/camera_spline.buf",{onLoad:e=>this.cameraSplineGeo=e}),light.preInit(),sim.preInit(),lightField.preInit(),aboutHeroParticles.preInit(),aboutHeroRocks.preInit(),aboutHeroGround.preInit(),aboutHeroLines.preInit(),aboutHeroPerson$1.preInit(),aboutHeroFog.preInit(),aboutHeroHalo.preInit(),aboutHeroFaces.preInit(),aboutHeroLetters.preInit()}init(){light.init(),sim.init(),lightField.init(),aboutHeroParticles.init(),aboutHeroRocks.init(),aboutHeroGround.init(),aboutHeroLines.init(),aboutHeroPerson$1.init(),aboutHeroFog.init(),aboutHeroScatter.init(),aboutHeroHalo.init(),aboutHeroFaces.init(),aboutHeroLetters.init(),this.add(aboutHeroParticles.container),this.sceneContainer.add(aboutHeroRocks.container),this.sceneContainer.add(aboutHeroPerson$1.container),this.sceneContainer.add(aboutHeroFog.container),this.add(this.sceneContainer),this.add(aboutHeroGround.container),this.add(aboutHeroHalo.container),this.hudContainer.add(aboutHeroLines.container),this.add(this.hudContainer),aboutPageHeroEfxPrepass.scene.add(aboutHeroFaces.container),aboutPageHeroEfxPrepass.scene.add(aboutHeroLetters.container),this.cameraSplinePositions=this.cameraSplineGeo.attributes.position,this.cameraSplineOrientation=this.cameraSplineGeo.attributes.orient,taskManager.add(this),taskManager.add(aboutPageHeroEfxPrepass.scene)}resize(e,t){aboutHeroFog.resize(e,t),aboutHeroHalo.resize(e,t),aboutHeroFaces.resize(e,t)}syncProperties(e){this.sharedUniforms.u_introRatio.value=this.introRatio;const t=math.saturate(this.initialSplineRatio)*149+math.saturate(this.panningSplineRaito)*50,r=Math.floor(t),n=Math.min(this.cameraSplinePositions.count-1,Math.ceil(t)),a=t-r;this.sceneRatio=this.sharedUniforms.u_sceneRatio.value=math.fit(this.introRatio,.01,.1,0,1,ease.cubicOut),this.sceneHideRatio=this.sharedUniforms.u_sceneHideRatio.value=math.fit(this.introRatio,.85,1,0,1),this.sharedUniforms.u_hudRatio.value=this.hudRatio,this.properties.bloomAmount=3,this.properties.bloomAmount=math.fit(this.introRatio,.1,.85,this.properties.bloomAmount,1.5,ease.sineOut),this.properties.bloomAmount=math.fit(this.introRatio,.85,1,this.properties.bloomAmount,10),this.properties.bloomAmount=math.fit(this.hudRatio,0,.5,this.properties.bloomAmount,12.5),this.properties.haloStrength=.08,this.properties.haloStrength=math.fit(this.introRatio,.1,.4,this.properties.haloStrength,.15),this.properties.haloStrength=math.fit(this.hudRatio,0,.5,this.properties.haloStrength,0),this.properties.screenPaintDistortionRGBShift=math.mix(0,properties.defaults.screenPaintDistortionRGBShift,this.outSectionRatio),this.properties.cameraLookStrength=math.fit(this.initialSplineRatio,0,1,.1,.035),_v.fromArray(this.cameraSplinePositions.array,n*3),this.properties.defaultCameraPosition.fromArray(this.cameraSplinePositions.array,r*3),this.properties.defaultCameraPosition.lerp(_v,a),_q0.fromArray(this.cameraSplineOrientation.array,r*4),_q1.fromArray(this.cameraSplineOrientation.array,n*4),_q0.slerp(_q1,a),_v.set(0,0,1).applyQuaternion(_q0).add(this.properties.defaultCameraPosition),this.properties.defaultLookAtPosition.copy(_v),this.properties.cameraDollyZoomFovOffset=math.fit(this.initialSplineRatio,.4,.8,0,-10,ease.sineInOut),this.properties.defaultCameraPosition.y+=math.fit(this.scrollYRatio,0,1,0,-10,ease.sineOut),this.properties.defaultLookAtPosition.y+=math.fit(this.scrollYRatio,0,1,0,-10.1,ease.sineOut),this.freezeRatio+=((input.isDown?1-this.hudRatio:0)-this.freezeRatio)*.1}update(e){let t=e*math.mix(1,.1,this.freezeRatio);this.introTime+=t,this.sharedUniforms.u_introTime.value=this.introTime,this.sharedUniforms.u_introDeltaTime.value=t,aboutHeroScatter.update(),this.hudRatio<1?(sim.update(e),lightField.update(t),aboutHeroParticles.update(t),aboutHeroParticles.container.visible=!0):aboutHeroParticles.container.visible=!1,this.sceneRatio>0&&this.hudRatio<1?(light.update(t),aboutHeroRocks.update(t),aboutHeroPerson$1.update(t),aboutHeroFog.update(t),aboutHeroHalo.update(t),this.sceneContainer.visible=!0):this.sceneContainer.visible=!1,this.sceneRatio>0&&aboutHeroGround.update(t),this.hudRatio>0?(aboutHeroLines.update(e),this.hudContainer.visible=!0):this.hudContainer.visible=!1,aboutHeroFaces.update(e),aboutHeroLetters.update(e),aboutPageHeroEfxPrepass.blurRatio=this.hudRatio,aboutPageHeroEfxPrepass.needsRenderScene=aboutHeroFaces.isActive,aboutPageHeroEfx.hudRatio=aboutHeroFaces.showRatio,this.hudRatio<1&&lightField.postUpdate(e),this.sceneRatio>0&&this.hudRatio<1&&light.postUpdate(e)}}const aboutHero=new AboutHero,vert$1=`#define GLSLIFY 1
attribute float char;uniform float u_time;uniform float u_showRatio;uniform float u_hideRatio;uniform float u_aspect;uniform vec2 u_toDomXY;uniform vec2 u_toDomWH;uniform vec2 u_toDomPivot;varying float v_dist;
#include <ufxVert>
float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}float cubicInOut(float t){return t<0.5? 4.0*t*t*t: 0.5*pow(2.0*t-2.0,3.0)+1.0;}float cubicBezier(float p0,float p1,float p2,float p3,float t){float c=(p1-p0)*3.;float b=(p2-p1)*3.-c;float a=p3-p0-c-b;float t2=t*t;float t3=t2*t;return a*t3+b*t2+c*t+p0;}float easeOutBack(float t){return cubicBezier(0.,1.3,1.1,1.,t);}void main(){vec3 pos=vec3(position.xy,0.);vec3 aspectCorrectedPos=pos*vec3(1.,u_aspect,1.);v_dist=position.z;vec3 basePos=getBasePosition(aspectCorrectedPos);basePos.y=1.-basePos.y;vec3 screenPos=getScreenPosition(basePos);float vertexShowRatio=easeOutBack(linearStep(0.,1.,u_showRatio*2.2-aspectCorrectedPos.x-(aspectCorrectedPos.y)*0.2));screenPos.y-=(1.0-vertexShowRatio)*(u_domWH.y+min(u_domWH.y*1.1,100.));pos.x-=char/5.*0.08;vec3 aspectCorrectedToPos=pos*vec3(1.,u_aspect,1.);vec3 toBasePos=vec3((aspectCorrectedToPos.xy)*u_toDomWH-u_toDomPivot,aspectCorrectedToPos.z);toBasePos.y=1.-toBasePos.y;vec3 toScreenPos=toBasePos+vec3(u_toDomPivot.xy,0.);toScreenPos=(toScreenPos+vec3(u_toDomXY.xy,0.))*vec3(1.,-1.,1.);float vertexHideRatio=cubicInOut(linearStep(0.,1.,u_hideRatio*2.2-aspectCorrectedPos.x-pow(aspectCorrectedPos.y,1.+u_hideRatio)*0.2));screenPos=mix(screenPos,toScreenPos,vertexHideRatio);gl_Position=projectionMatrix*modelViewMatrix*vec4(screenPos,1.0);}`,frag$4=`#define GLSLIFY 1
varying float v_dist;void main(){float alpha=smoothstep(0.,0.+fwidth(v_dist),v_dist);gl_FragColor=vec4(1.,1.,1.,alpha);}`;let _needsSync=!1;class AboutWhoLogo{container=new Object3D;fromDom;toDom;mesh;toMesh;containerWidth=0;hideRatio=0;preInit(e){this.fromDom=e.querySelector("#about-who-title-main-logo"),this.toDom=e.querySelector("#about-who-title-left-2"),aboutPage.postUfxContainer.add(this.container),this.toMesh=new UfxMesh({refDom:this.toDom}),properties.loader.add(settings.MODEL_PATH+"about/logo_text.buf",{onLoad:this._onGeometryLoad.bind(this)})}_onGeometryLoad(e){let t=this.toMesh.material.uniforms;this.mesh=new UfxMesh({refDom:this.fromDom,geometry:e,uniforms:{u_showRatio:{value:1},u_hideRatio:{value:0},u_aspect:{value:1/.200957},u_toDomXY:t.u_domXY,u_toDomWH:t.u_domWH,u_toDomPivot:t.u_domPivot,u_time:properties.sharedUniforms.u_time},vertexShader:vert$1,fragmentShader:frag$4}),this.container.add(this.mesh)}init(){}resize(e,t){_needsSync=!0}update(e,t,r,n,a){this.mesh&&(_needsSync&&(_needsSync=!1,this.mesh.syncDom(r,t-n),this.toMesh.syncDom(r,t-a)),this.mesh.material.uniforms.u_showRatio.value=math.fit(aboutPage.time,.5,1.5,0,1),properties.useMobileLayout?(this.mesh.material.uniforms.u_showRatio.value*=1-this.hideRatio,this.mesh.material.uniforms.u_hideRatio.value=0):this.mesh.material.uniforms.u_hideRatio.value=this.hideRatio,this.mesh.update(r,t),this.toMesh.update(r,t))}}const aboutWhoLogo=new AboutWhoLogo;class WhoSubsectionWeAre{domContainer;domScroll;domLeftTexts;logoHideRatio=0;preInit(e){this.domContainer=e.querySelector("#about-who-subsection-we-are"),this.domScroll=e.querySelector("#about-who-title-main-scroll"),this.domLeftTexts=e.querySelectorAll("#about-who-title-left-1, #about-who-title-left-2 svg, #about-who-title-left-3, #about-who-title-left-4 span"),this.domRightTexts=e.querySelectorAll(".about-who-title-right-text"),aboutWhoLogo.preInit(e)}init(){aboutWhoLogo.init()}show(){}hide(){}resize(e,t){this.offsetUnitSize=Math.max(60,properties.viewportWidth*.08),aboutWhoLogo.resize(e,t)}update(e,t,r,n,a){if(this.domContainer.style.visibility=t?"visible":"hidden",this.domContainer.style.opacity=t?1:0,aboutWhoLogo.container.visible=t,t){let l=properties.useMobileLayout?properties.viewportWidth*-r:0;this.domContainer.style.transform="translate3d("+l+"px, 0, 0)";let c=aboutHero.introRatio<.05;this.logoHideRatio=math.saturate(this.logoHideRatio+e*(c?-1:1));let u=this.offsetUnitSize;aboutWhoLogo._pageScrollOffsetXRatio=0;for(let p=0;p<this.domLeftTexts.length;p++){let g=this.domLeftTexts[p],_=(!properties.useMobileLayout&&p==5?4:p)/(this.domLeftTexts.length-1),T=math.fit(this.logoHideRatio,_*.2,_*.2+.8,0,1),M=math.fit(r,0,_*.5+.3,0,-10,ease.cubicOut);g._pageScrollOffsetXRatio=M,properties.useMobileLayout||p!=1?(T=math.fit(T,.35,1,0,1,ease.cubicOut),g.style.opacity=T,g.style.transform="translate3d("+((1-T)*1+M)*u+"px, 0, 0)",p==1&&(aboutWhoLogo.hideRatio=this.logoHideRatio)):(aboutWhoLogo.hideRatio=T,aboutWhoLogo._pageScrollOffsetXRatio=M)}for(let p=0;p<this.domRightTexts.length;p++){let g=this.domRightTexts[p],v=p/(this.domRightTexts.length-1),_=math.fit(this.logoHideRatio,.5+v*.1,v*.1+.9,0,1,ease.cubicOut),T=math.fit(r,.35,v*.5+1.35,0,-5,ease.cubicOut);g.style.opacity=_,g.style.transform="translate3d("+((1-_)*1+T)*u+"px, 0, 0)"}let f=math.fit(this.logoHideRatio,0,.35,1,0,ease.cubicInOut);this.domScroll.style.opacity=f,properties.useMobileLayout?this.domScroll.style.transform="translate3d(50%, "+(1-f)*120+"%, 0)":this.domScroll.style.transform="translate3d(0, "+(1-f)*120+"%, 0)",aboutWhoLogo.update(e,-r*properties.viewportWidth+aboutWhoLogo._pageScrollOffsetXRatio*u,-scrollManager.scrollPixel+a,aboutWhoLogo._pageScrollOffsetXRatio*u,this.domLeftTexts[1]._pageScrollOffsetXRatio*u)}}}const whoSubsectionWeAre=new WhoSubsectionWeAre;class WhoSubsectionDetails{domContainer;activeFaceId=-1;domTopWords;domBottomWords;preInit(e){this.domContainer=e.querySelector("#about-who-subsection-details");let t=this.domContainer.querySelector("#about-who-desc-top"),r=this.domContainer.querySelector("#about-who-desc-bottom");this.domTopWords=this._parseDomText(t),this.domBottomWords=this._parseDomText(r)}_parseDomText(e){let t=e.querySelectorAll("span");for(let r=0;r<t.length;r++){let n=t[r],a=t[r].innerHTML.split(" ");n.innerHTML="<span>"+a.join("</span><span>")+"</span>"}return e.querySelectorAll("span span")}init(){}show(){}hide(){}resize(e,t){let r;r=this.domTopWords;let n=1/0,a=-1;for(let l=0;l<r.length;l++){let c=r[l];c.style.transform="translateZ(0)",c.style.opacity=1;let u=c.getBoundingClientRect().left;u<=n&&a++,n=u+1,c._line=a}this.domTopWords._lineCount=a+1,r=this.domBottomWords,n=1/0,a=-1;for(let l=0;l<r.length;l++){let c=r[l];c.style.transform="translateZ(0)",c.style.opacity=1;let u=c.getBoundingClientRect().right;u<=n&&a++,n=u+1,c._line=a}this.domBottomWords._lineCount=a+1}update(e,t,r){if(this.domContainer.style.visibility=t?"visible":"hidden",t){let n=0;if(properties.useMobileLayout)n=math.fit(r,-.75,-.25,0,1)*math.fit(r,.25,.5,1,0);else{n=1;let a,l;a=this.domTopWords,l=a._lineCount;for(let c=0;c<a.length;c++){let u=a[c],f=u._line/l,p=c/a.length,g=math.fit(r,-1+f*.5,-.1,0,1),v=math.fit(r,-1+p*.5,-.1,0,1),_=math.fit(r,.1,.5+f*.5,0,1),T=math.fit(r,.1,.5+p*.5,0,1);u.style.transform="translate3d("+(math.fit(g,0,1,10,0)+math.fit(_,0,1,0,-10))+"em, 0, 0) translate3d("+(math.fit(r,-1,0,-50,0)+math.fit(r,.1,1,0,20))+"vw, 0, 0)",u.style.opacity=v*(1-T)}a=this.domBottomWords,l=a._lineCount;for(let c=0;c<a.length;c++){let u=a[c],f=u._line/l,p=c/a.length,g=math.fit(r,-.6+f*.5,-.1,0,1),v=math.fit(r,-.6+p*.5,-.1,0,1),_=math.fit(r,.2,.5+f*.5,0,1),T=math.fit(r,.2,.5+p*.5,0,1);u.style.transform="translate3d("+(math.fit(g,0,1,10,0)+math.fit(_,0,1,0,-10))+"em, 0, 0) translate3d("+(math.fit(r,-1,0,-20,0)+math.fit(r,0,1,0,50))+"vw, 0, 0)",u.style.opacity=v*(1-T)}}this.domContainer.style.opacity=n}}}const whoSubsectionDetails=new WhoSubsectionDetails;class TextAnimationHelper{setMatrixText(e,t,r=0,n=40,a=2,l=1/15){e._rawTime=0,e._time=0,e._direction=1,e._prevRefreshTime=-1/0,e._refreshRate=l,e._delay=r,t=t.replace("<br>",`
`),e._text=t,e._letterPerSecond=n,e._maxRandLetterCount=a,e.textContent=""}resetMatrixTextTime(e){e._rawTime=0,e._time=0,e._prevRefreshTime=-1/0}updateMatrixText(e,t=properties.deltaTime){if(e._rawTime+=t,e._time+=t*e._direction,e._time=math.clamp(e._time,0,e._delay+(e._text.length+e._maxRandLetterCount)/e._letterPerSecond),e._rawTime>=e._prevRefreshTime+e._refreshRate){e._prevRefreshTime=e._rawTime;let r=e._text,n=Math.max(0,Math.floor(e._letterPerSecond*(e._time-e._delay))),a=Math.min(r.length,n-e._maxRandLetterCount),l=Math.min(r.length,n),c="";if(n>0){c=r.substr(0,a);for(let u=0;u<l-a;u++)c+=String.fromCharCode(33+~~(Math.random()*93));c=c.replace(`
`,"<br>")}e._str!=c&&(e._str=c,e.innerHTML=c)}}}const textAnimationHelper=new TextAnimationHelper,letterVert=`#define GLSLIFY 1
#include <ufxVert>
uniform float u_letterIdx;varying vec2 v_pixel;void main(){vec3 basePos=getBasePosition(position);vec3 screenPos=getScreenPosition(basePos);gl_Position=projectionMatrix*modelViewMatrix*vec4(screenPos,1.0);v_pixel=vec2(u_letterIdx*5.+1.,1.)+vec2(uv.x,1.-uv.y)*vec2(3.,4.);}`,letterFrag=`#define GLSLIFY 1
uniform sampler2D u_texture;uniform float u_opacity;uniform float u_time;varying vec2 v_pixel;vec4 hash43(vec3 p){vec4 p4=fract(vec4(p.xyzx)*vec4(.1031,.1030,.0973,.1099));p4+=dot(p4,p4.wzxy+33.33);return fract((p4.xxyz+p4.yzzw)*p4.zywx);}void main(){vec4 rands=hash43(vec3(floor(v_pixel),floor(u_opacity*3.)+floor(u_time+sin(u_time*3.)*1.5)));float opacity=mix(pow(rands.x,5.),0.95+rands.y*0.05,smoothstep(.75,1.,u_opacity))*u_opacity;vec2 uv=(floor(v_pixel)+.5)/vec2(210.,6.);float mask=texture2D(u_texture,uv).r;vec2 dd=abs(fract(v_pixel)-.5);float dotMask=step(max(dd.x,dd.y),.05);gl_FragColor=vec4(1.,1.,1.,max(dotMask*.3*(opacity*0.5+u_opacity*0.5),mask*opacity));}`;class WhoSubsectionTeam{domContainer;domProgress;domLeftTexts;domLeftNamePlaceholder;domLeftNameText;domLeftJobPlaceholder;domLeftJobText;domRight;domIndicator;domIndicatorInner;teamDataMap={};teamDataList=[];faceId="edan";targetActiveFaceIndex=0;faceIndex=0;_faceIndexTween;facesCount=0;faceIndexTimer=0;containerOffsetX=0;itemActiveRatio=0;isForward=!0;wasActive=null;isChangable=!1;canSwipe=!0;hasSwiped=!1;hasSwipedOnce=!1;_isAnimating=!1;timeBaseChangeSpeed=.2;lastSwipeTime=-1;domCursorDirection=-1;domCursorActive=!1;domCursorActiveRatio=0;domCursorRotateRatio=0;domCursorExtraRotationMotion=new SecondOrderDynamics(0,1,.8,1.2);faceRect={x:0,y:0,width:0,height:0,offsetX:0,offsetY:0};letterRect={x:0,y:0,width:0,height:0,offsetX:0,offsetY:0};domRightWidth=0;preInit(e){this.domContainer=e.querySelector("#about-who-subsection-team"),this.domProgress=e.querySelector("#about-who-team-progress"),this.domLeft=e.querySelector("#about-who-team-left"),this.domLeftInfo=e.querySelector("#about-who-team-info"),this.domLeftNameIcon=e.querySelector("#about-who-team-name-icon"),this.domLeftNamePlaceholder=e.querySelector("#about-who-team-name-placeholder"),this.domLeftNameText=e.querySelector("#about-who-team-name-text"),this.domLeftJobPlaceholder=e.querySelector("#about-who-team-job-placeholder"),this.domLeftJobText=e.querySelector("#about-who-team-job-text"),this.domNumber=e.querySelector("#about-who-team-number"),this.domTopCompass=e.querySelector("#about-who-team-top-compass"),this.domBottomCompass=e.querySelector("#about-who-team-bottom-compass"),this.domDots=e.querySelector("#about-who-team-dots"),this.domLetterContainer=e.querySelector("#about-who-team-letter-container"),this.domIndicator=this.domProgress.querySelector("#about-who-team-indicator"),this.domIndicatorInner=this.domProgress.querySelector("#about-who-team-indicator-inner"),this.domIndicator._prevActiveRatio=-1,this.domRight=e.querySelector("#about-who-team-right"),this.domTitle=e.querySelector("#about-who-team-title"),this.domDesc=e.querySelector("#about-who-team-desc"),this.domDescText=e.querySelector("#about-who-team-desc-text"),this.domDescSquare=e.querySelector("#about-who-team-square"),this.domCursor=e.querySelector("#about-who-face-cursor"),this.domCursorArrow=e.querySelector("#about-who-face-cursor-arrow"),this.domFaces=e.querySelector("#about-who-team-faces"),this.domMobileSwipe=e.querySelector("#about-who-team-left-mobile-tips"),this.domTeamNumber=e.querySelector("#about-who-team-number-center-item"),properties.loader.add(settings.TEAM_PATH+"team.json",{onLoad:t=>{this.teamDataList=t,this._createUIElements();for(let r=0;r<t.length;r++)t[r].index=r,this.teamDataMap[t[r].id]=t[r]}}),aboutHeroFaces.load(this.faceId),this.letterMesh=new UfxMesh({uniforms:{u_texture:{value:properties.loader.add(settings.TEXTURE_PATH+"font.png",{minFilter:LinearFilter,type:"texture"}).content},u_letterIdx:{value:0},u_opacity:{value:1},u_time:properties.sharedUniforms.u_time},vertexShader:letterVert,fragmentShader:letterFrag}),this.letterMesh.visible=!1,aboutPage.postUfxContainer.add(this.letterMesh),this._faceIndexTween=new Tween(this,()=>{this.onTweenComplete()})}init(){input.onXScrolled.add(()=>{properties.useMobileLayout&&this.canSwipe&&this.wasActive&&properties.time-this.lastSwipeTime>.5&&(this.hasSwiped=!0,this.canSwipe=!1,this.domCursorDirection=input.lastScrollXDirection,this.lastSwipeTime=properties.time)},this),input.onUped.add(()=>{this.canSwipe=!0},this)}onPageShow(){aboutHeroFaces.showRatio=0;for(let e=0;e<this.teamDataList.length;e++){let t=this.teamDataList[e].id;aboutHeroFaces.load(t)}this.facesCount=this.teamDataList.length,this.updateTeamNumberUI()}prev(){this.targetActiveFaceIndex--,this.isForward=!1,this._clearTween(),this._isAnimating=!0,this._faceIndexTween.to(1.25+Math.abs(this.targetActiveFaceIndex-this.faceIndex)*.25,{faceIndex:this.targetActiveFaceIndex},ease.cubicInOut),this.updateTeamNumberUI()}next(){this.targetActiveFaceIndex++,this.isForward=!0,this._clearTween(),this._isAnimating=!0,this._faceIndexTween.to(1.25+Math.abs(this.targetActiveFaceIndex-this.faceIndex)*.25,{faceIndex:this.targetActiveFaceIndex},ease.cubicInOut),this.updateTeamNumberUI()}_clearTween(){this._isAnimating=!1,this._faceIndexTween.kill()}updateTeamNumberUI(){const t=`${(math.mod(this.targetActiveFaceIndex,this.facesCount)+1001).toString().substring(1)}`;this.domTeamNumber.innerHTML=t}onTweenComplete(){this._clearTween(),this.faceIndexTimer=0,this._changeFaceUIByIndex(math.mod(this.targetActiveFaceIndex,this.teamDataList.length))}reset(){this._clearTween(),this.faceIndexTimer=0,this.targetActiveFaceIndex=0,this.faceIndex=0,this.canSwipe=!0,this.isForward=!0,this._changeFaceUIByIndex(0)}resize(e,t){this._splitText(),this.syncContainerOffset(),this.domRightWidth=this.domRight.offsetWidth;let r=this.domContainer.getBoundingClientRect(),n=this.domFaces.getBoundingClientRect();this._updateRect(this.faceRect,n,r);let a=this.domLetterContainer.getBoundingClientRect();this._updateRect(this.letterRect,a,r),this._splitText()}_updateRect(e,t,r){e.x=t.left-aboutWhoSection.subsectionContainerOffsetX-this.containerOffsetX,e.y=t.top-aboutWhoSection.subsectionContainerOffsetY+scrollManager.scrollPixel,e.width=t.width,e.height=t.height,e.offsetX=t.left-r.left,e.offsetY=t.top-r.top}_changeFaceUIByIndex(e){e=math.mod(e,this.teamDataList.length);let t=this.faceId=this.teamDataList[e].id,r=this.teamDataMap[t].name,n=this.teamDataMap[t].role;this.domLeftNamePlaceholder.innerHTML=r,textAnimationHelper.setMatrixText(this.domLeftNameText,r,0,1,3,1/30),this.domLeftJobPlaceholder.innerHTML=n,textAnimationHelper.setMatrixText(this.domLeftJobText,n,0,1,3,1/30)}_createUIElements(){let e=document.createElement("div");e.id="about-who-team-top-compass-inner",this.topCompassInnerDiv=e;for(let r=0;r<this.teamDataList.length-4;r++)for(let n=0;n<4;n++){let a=document.createElement("div");a.classList.add("about-who-team-top-compass-long"),e.append(a);for(let l=0;l<4;l++){let c=document.createElement("div");c.classList.add("about-who-team-top-compass-small"),e.append(c)}}this.domTopCompass.append(e);let t=document.createElement("div");t.id="about-who-team-bottom-compass-inner",this.bottomCompassInnerDiv=t;for(let r=0;r<this.teamDataList.length-4;r++)for(let n=0;n<4;n++){let a=document.createElement("div");a.classList.add("about-who-team-bottom-compass-long"),t.append(a);for(let l=0;l<4;l++){let c=document.createElement("div");c.classList.add("about-who-team-bottom-compass-small"),t.append(c)}}this.domBottomCompass.append(t);for(let r=0;r<11;r++){let n=document.createElement("div");n.classList.add("about-who-team-dots-col");for(let a=0;a<3;a++){let l=document.createElement("div");l.classList.add("about-who-team-dot"),n.append(l)}this.domDots.append(n)}this.topCompassInnerDiv._width=this.topCompassInnerDiv.getBoundingClientRect().width-this.domTopCompass.getBoundingClientRect().width,this.bottomCompassInnerDiv._width=this.bottomCompassInnerDiv.getBoundingClientRect().width-this.domBottomCompass.getBoundingClientRect().width}syncContainerOffset(){this.containerOffsetX=properties.useMobileLayout?0:(aboutWhoSection.scrollRatio*aboutWhoSection.PAGE_DISTANCE-aboutWhoSection.PAGE_DISTANCE*2)*properties.viewportWidth,this.domContainer.style.transform="translate3d("+this.containerOffsetX+"px,0,0)"}_splitText(){}preUpdate(){this.domCursor.style.display="none",this.letterMesh.visible=!1}onSwipe(){this.hasSwipedOnce=!0}update(e,t,r,n,a,l){let c=l>.5;aboutHeroFaces.showRatio=math.saturate(aboutHeroFaces.showRatio+(c?e:-e)/1.5),aboutHeroFaces.isActive=aboutHeroFaces.showRatio>0,this.itemActiveRatio=math.saturate(this.itemActiveRatio+(aboutHeroFaces.isActive?this._isAnimating?-2:2:0)*e),t&&this.syncContainerOffset(),c&&!this.hasSwipedOnce?this.domMobileSwipe.classList.add("--is-active"):this.domMobileSwipe.classList.remove("--is-active");let u=this.faceRect.x+aboutWhoSection.subsectionContainerOffsetX+this.containerOffsetX,f=this.faceRect.y+aboutWhoSection.subsectionContainerOffsetY-scrollManager.scrollPixel,p=this.faceRect.width,g=this.faceRect.height,v=input.easedMouseDynamics.default.value.x,_=input.easedMouseDynamics.default.value.y,T=(v*.5+.5)*properties.viewportWidth,M=(.5-_*.5)*properties.viewportHeight,S=!1;if(properties.useMobileLayout)this.domCursor.style.display="none";else if(this.wasActive||(this.domCursorActiveRatio=0),S=c&&T>u&&T<u+p&&M>f&&M<f+g,this.domCursorActiveRatio=math.saturate(this.domCursorActiveRatio+(S?e:-e)*1.5),S=this.domCursorActiveRatio>0,this.domCursorDirection=T-u-p*.5>0?1:-1,S){this.domCursor.style.display="flex";let R=T-u,E=M+this.faceRect.offsetY-f,I=Math.min(2.5,input.easedMouseDynamics.default.valueVel.length()/5+1)*ease.backOut(this.domCursorActiveRatio)*math.fit(n,0,properties.viewportHeight,1,0);this.domCursor.style.transform=`translate3d(${R}px, ${E}px,0) translate3d(-50%, -50%, 0) scale(${I})`,this.domCursorRotateRatio=math.saturate(this.domCursorRotateRatio+(this.domCursorDirection>0?e*3:e*-3)),this.domCursorExtraRotationMotion.update(e,math.clamp(input.easedMouseDynamics.default.valueVel.y*-this.domCursorDirection,-1,1));let F=ease.backInOut(this.domCursorRotateRatio);this.domCursorArrow.style.transform=`rotate(${F*180+this.domCursorExtraRotationMotion.value*75}deg)`}else this.domCursor.style.display="none";let b=0,C=0,w=0;if(t?(properties.useMobileLayout?(b=math.fit(r,-.5,0,0,1),C=math.fit(r,-.5,0,0,1)*math.fit(r,.5,1,1,0),w=l):(b=math.fit(r,-.5,-.2,0,1),C=math.fit(r,-.4,-.1,0,1),w=math.fit(r,-.3,0,0,1)),this.domTitle.style.opacity=b,this.domDesc.style.opacity=C,this.domLeft.style.opacity=w,this.domLeft.style.visibility="visible",this.domTitle.style.visibility="visible",this.domDesc.style.visibility="visible",this.letterMesh.syncRect(this.letterRect.x+aboutWhoSection.subsectionContainerOffsetX+this.containerOffsetX,this.letterRect.y+aboutWhoSection.subsectionContainerOffsetY-scrollManager.scrollPixel,this.letterRect.width,this.letterRect.height),this.letterMesh.update(),this.letterMesh.visible=!0):(this.domLeft.style.visibility="hidden",this.domTitle.style.visibility="hidden",this.domDesc.style.visibility="hidden"),this.teamDataList.length)if(t){this.wasActive||this.reset(),properties.useMobileLayout||(aboutHero.properties.cameraViewportOffsetX=(properties.viewportWidth/2-(properties.viewportWidth-this.domRightWidth)/2)*math.fit(r,-aboutWhoSection.PAGE_DISTANCE,0,0,1,ease.cubicInOut));let R=this.hasSwiped&&c;(R||S&&input.justClicked)&&(audios.countPlay("click"),this.domCursorDirection==1?this.next():this.prev()),R&&this.onSwipe();let E=this.faceIndexTimer;this.faceIndexTimer=Math.min(1,this.faceIndexTimer+e*this.timeBaseChangeSpeed*(this._isAnimating?0:1)),E<1&&this.faceIndexTimer>=1&&(this.isForward?this.next():this.prev());let I=Math.floor(math.mod(this.faceIndex,this.teamDataList.length)),F=math.mod(I+1,this.teamDataList.length),k=this.faceIndex-Math.floor(this.faceIndex);aboutHeroFaces.currId=this.teamDataList[I].id,aboutHeroFaces.nextId=this.teamDataList[F].id,aboutHeroFaces.transitionRatio=k;let L=this.domIndicatorInner;L.style.transform="scaleX("+this.faceIndexTimer+")",this.domIndicator.style.transform="scaleX("+ease.expoInOut(this.itemActiveRatio)+")";let D=this.itemActiveRatio>.95?1:(Math.cos(this.itemActiveRatio*17.213)*.5+.5)*Math.pow(this.itemActiveRatio,.25);this.domLeftNameIcon.style.opacity=D,this.domLeftNameText._direction=this.domLeftJobText._direction=this._isAnimating?-1:1,this.domLeftNameText._letterPerSecond=this.domLeftJobText._letterPerSecond=this._isAnimating?60:30,textAnimationHelper.updateMatrixText(this.domLeftNameText),textAnimationHelper.updateMatrixText(this.domLeftJobText),this.letterMesh.material.uniforms.u_letterIdx.value=aboutHeroFaces.currId.substring(0,1).toUpperCase().charCodeAt(0)-65,this.letterMesh.material.uniforms.u_opacity.value=w*D}else this._clearTween();this.wasActive=t,this.hasSwiped=!1}}const whoSubsectionTeam=new WhoSubsectionTeam;class AboutWhoSection{domContainer;activeFaceId=-1;scrollRatio=0;subsectionContainerOffsetY=0;subsectionContainerOffsetX=0;RANGE_START_WAIT=3.5;RANGE_PAGE_12=1.75;RANGE_PAGE_23=1.75;RANGE_PAGE_34=1.75;RANGE_END_WAIT=2.5;PAGE_DISTANCE=1.25;THRESHOLDS=[];MOBILE_THRESHOLDS=[];preInit(e){this.domContainer=e.querySelector("#about-who"),this.domSubsectionContainer=e.querySelector("#about-who-subsection-container"),this.domCrosses=e.querySelector("#about-crosses ");let t=0,r=0;this.THRESHOLDS.push(t+=this.RANGE_START_WAIT),this.THRESHOLDS.push(t+=this.RANGE_PAGE_12),this.THRESHOLDS.push(t+=this.RANGE_PAGE_23),r=t,this.MOBILE_THRESHOLDS.push.apply(this.MOBILE_THRESHOLDS,this.THRESHOLDS),this.THRESHOLDS.push(t+=this.RANGE_END_WAIT),this.MOBILE_THRESHOLDS.push(r+=this.RANGE_PAGE_34),this.MOBILE_THRESHOLDS.push(r+=this.RANGE_END_WAIT),whoSubsectionWeAre.preInit(e),whoSubsectionDetails.preInit(e),whoSubsectionTeam.preInit(e),aboutHero.preInit(),visuals.stage3DList.push(aboutHero)}init(){whoSubsectionWeAre.init(),whoSubsectionDetails.init(),whoSubsectionTeam.init(),aboutHero.init()}resize(e,t){this.syncSubsectionContainerTransform(),whoSubsectionWeAre.resize(e,t),whoSubsectionDetails.resize(e,t),whoSubsectionTeam.resize(e,t),aboutHero.resize(properties.width,properties.height)}show(){aboutWhoLogo.hideRatio=0,whoSubsectionTeam.onPageShow()}getMoveRatio(){return-scrollManager.getDomRange(this.domContainer).screenY/(properties.useMobileLayout?properties.viewportHeight:properties.viewportWidth)}getScrollRatio(){let e=properties.useMobileLayout?this.MOBILE_THRESHOLDS:this.THRESHOLDS,t=this.getMoveRatio(),r=0;return t<e[0]?r=0:t<e[1]?r=math.fit(t,e[0],e[1],0,1,ease.cubicInOut):properties.useMobileLayout?t<e[2]?r=math.fit(t,e[1],e[2],1,2,ease.cubicInOut):r=math.fit(t,e[2],e[3],2,3,ease.cubicInOut):r=math.fit(t,e[1],e[2],1,2,ease.cubicInOut),this.scrollRatio=r}syncSubsectionContainerTransform(){let e=properties.useMobileLayout?this.MOBILE_THRESHOLDS:this.THRESHOLDS,t=properties.useMobileLayout?properties.viewportHeight:properties.viewportWidth;this.scrollableSize=e[e.length-1]*t;let n=scrollManager.getDomRange(this.domContainer).isActive,a=scrollManager.getDomRange(this.domContainer),l=this.getScrollRatio()*this.PAGE_DISTANCE;this.subsectionContainerOffsetY=math.fit(a.screenY,0,-this.scrollableSize,0,this.scrollableSize),properties.useMobileLayout?this.subsectionContainerOffsetX=0:this.subsectionContainerOffsetX=l*-properties.viewportWidth,this.domSubsectionContainer.style.transform="translate3d("+this.subsectionContainerOffsetX+"px,"+this.subsectionContainerOffsetY+"px, 0)",this.domCrosses.style.transform="translate3d("+-this.subsectionContainerOffsetX+"px,0, 0)",n||(aboutHero.isActive=!1)}update(e){let t=properties.useMobileLayout?this.MOBILE_THRESHOLDS:this.THRESHOLDS,r=properties.useMobileLayout?properties.viewportHeight:properties.viewportWidth;this.scrollableSize=t[t.length-1]*r;let a=scrollManager.getDomRange(this.domContainer).isActive,l=scrollManager.getDomRange(this.domContainer);if(this.syncSubsectionContainerTransform(),whoSubsectionTeam.preUpdate(),a){let c=this.getScrollRatio()*this.PAGE_DISTANCE,u=-l.screenY/(properties.useMobileLayout?properties.viewportHeight:properties.viewportWidth);aboutHero.initialSplineRatio=math.fit(u,0,t[1],0,1),aboutHero.hudRatio=math.fit(u,t[1],t[1]+this.RANGE_PAGE_23*.5,0,1),aboutHero.outSectionRatio=math.fit(u/t[3],.9,1,0,1),aboutHero.properties.cameraViewportOffsetX=0,aboutHero.properties.cameraViewportOffsetY=0,aboutHero.scrollYRatio=0,aboutHero.faceShowRatio=0,c<this.PAGE_DISTANCE?(aboutHero.introRatio=u/(this.RANGE_START_WAIT+this.RANGE_PAGE_12),whoSubsectionWeAre.update(e,!0,c,u,this.subsectionContainerOffsetY)):(aboutHero.introRatio=1,whoSubsectionWeAre.update(e,!1,c,u,this.subsectionContainerOffsetY)),c>0&&c<this.PAGE_DISTANCE*2?whoSubsectionDetails.update(e,!0,c-this.PAGE_DISTANCE,this.subsectionContainerOffsetY):whoSubsectionDetails.update(e,!1,c-this.PAGE_DISTANCE,this.subsectionContainerOffsetY);let f=this.getMoveRatio();properties.useMobileLayout?aboutHero.panningSplineRaito=math.fit(f,t[2],t[4],0,1):aboutHero.panningSplineRaito=math.fit(f,t[1],t[3],0,1);let p=math.fit(c-this.PAGE_DISTANCE*2-(properties.useMobileLayout?this.PAGE_DISTANCE:0),-1,0,0,1),g=Math.max(0,scrollManager.scrollPixel-l.top-t[t.length-1]*r);c>=this.PAGE_DISTANCE?(aboutHero.properties.cameraViewportOffsetY=g,aboutHero.scrollYRatio=g/r,whoSubsectionTeam.update(e,!0,c-this.PAGE_DISTANCE*2,g,this.subsectionContainerOffsetY,p)):whoSubsectionTeam.update(e,!1,c-this.PAGE_DISTANCE*2,g,this.subsectionContainerOffsetY,p),aboutHero.isActive=!0}else aboutHero.isActive=!1,whoSubsectionTeam.wasActive=!1}}const aboutWhoSection=new AboutWhoSection,TITLE_STAGGER=20,DESCRIPTION_STAGGER=50;class AboutClientSection{_needsReset=!0;isSectionWasActive=!1;preInit(e){this.domContainer=e.querySelector("#about-clients"),this.domTitle=e.querySelector("#about-clients-title"),this.domTitle._time=0,this.domTitle._animating=!1,this.domTitle._words=[],this.domDesc=e.querySelector("#about-clients-desc"),this.domDesc._time=0,this.domDesc._animating=!1,this.domCarousel=e.querySelector("#about-clients-carousel"),this.domCarouselLines=Array.from(this.domCarousel.querySelectorAll(".about-clients-carousel-line")),this.domCarouselLinesWrapper=[]}init(){this._createCarousel()}resize(e,t){this._splitText();for(let r=0;r<this.domCarouselLines.length;r++){let n=this.domCarouselLines[r],a=this.domCarouselLinesWrapper[r];a._width=n.getBoundingClientRect().width}}update(e){let r=scrollManager.getDomRange(this.domContainer).isActive,n=scrollManager.scrollViewDelta,a=scrollManager.getDomRange(this.domTitle),l=scrollManager.getDomRange(this.domDesc);if(r){this._needsReset&&this._reset(),this.domTitle._time=math.clamp(this.domTitle._time+(this.domTitle._animating?e:-e),0,1+this.domTitle._words.length/TITLE_STAGGER),this.domDesc._time=math.clamp(this.domDesc._time+(this.domDesc._animating?e:-e),0,1+this.domDesc._splitted.words.length/DESCRIPTION_STAGGER),a.screenRatio>-1&&(this.domTitle._animating=!0,properties.useMobileLayout?this.domTitle._words.forEach(c=>{c.forEach(u=>{u.style.transform="translate3d(0, 0, 0)"})}):this.domTitle._words.forEach((c,u)=>{c.forEach((f,p)=>{let g=math.saturate(this.domTitle._time-u/20),v=ease.expoOut(g);f.style.transform=`translate3d(0, ${100*(1-v)-(4-p)*100*v}%, 0)`})})),l.screenRatio>-1&&(this.domDesc._animating=!0,this.domDesc._splitted.words.forEach((c,u)=>{let f=properties.viewportWidth>=settings.MOBILE_WIDTH?ease.lusion(this.domDesc._time-u/DESCRIPTION_STAGGER):1,p=properties.viewportWidth>=settings.MOBILE_WIDTH?math.fit(this.domDesc._time-u/DESCRIPTION_STAGGER,0,1,100,0,ease.lusion):0;c.style.transform=`translate3d(0, ${p}%, 0)`,c.style.opacity=f}));for(let c=0;c<this.domCarouselLinesWrapper.length;c++){let u=this.domCarouselLinesWrapper[c],f=c%2;u._time+=e*input.lastScrollYDirection*(100+f*35)+n*(100+f*35);let p=-math.loop(u._time,0,u._width);u.style.transform=`translateX(${p}px)`}}else this._needsReset=!0;this.isSectionWasActive=r}_createCarousel(){this.domCarouselLines.forEach(e=>{const t=document.createElement("div");t.classList.add("about-clients-carousel-line-wrapper");const r=e.cloneNode(!0),n=e.cloneNode(!0);t.append(r,n,e),this.domCarousel.append(t),t._time=0,this.domCarouselLinesWrapper.push(t)})}_splitText(){this.domTitleWordList=[],this.domTitle._splitted=new SplitType(this.domTitle,{types:"words",wordClass:"about-clients-title-word"}),this.domTitle._splitted.words.forEach((e,t)=>{const r=[],n=e.parentNode,a=document.createElement("div");a.style.position="relative",a.style.overflow="hidden",a.classList.add("about-clients-title-word-wrapper"),a.style.display="flex",a.style.flexDirection="column",e.remove(),this.domTitleWordList.push(a);for(let l=0;l<3;l++){const c=e.cloneNode(!0);c.style.transform="translate3d(0, 100%, 0)",a.append(c),r.push(c),this.domTitle._words[t]=r}n.append(a),e.remove()}),this.domDesc._splitted=new SplitType(this.domDesc,{types:"words",wordClass:"about-clients-desc-text-word"})}_reset(){this.domTitle._splitted&&(this._needsReset=!1,this.domTitle._time=0,this.domTitle._animating=!1,this.domTitle._splitted.words.forEach(e=>{e.style.transform="translate3d(0, 100%, 0)"}),this.domDesc._time=0,this.domDesc._animating=!1,this.domDesc._splitted.words.forEach(e=>{e.style.transform="translate3d(0, 100%, 0)",e.style.opacity=0}))}}const aboutClientSection=new AboutClientSection;class SVGParser{parse(e){const t=this;function r(K,G){if(K.nodeType!==1)return;const U=R(K);let N=!1,he=null;switch(K.nodeName){case"svg":G=T(K,G);break;case"style":a(K);break;case"g":G=T(K,G);break;case"path":G=T(K,G),K.hasAttribute("d")&&(he=n(K));break;case"rect":G=T(K,G),he=u(K);break;case"polygon":G=T(K,G),he=f(K);break;case"polyline":G=T(K,G),he=p(K);break;case"circle":G=T(K,G),he=g(K);break;case"ellipse":G=T(K,G),he=v(K);break;case"line":G=T(K,G),he=_(K);break;case"defs":N=!0;break;case"use":G=T(K,G);const xe=(K.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),ee=K.viewportElement.getElementById(xe);ee?r(ee,G):console.warn("SVGLoader: 'use node' references non-existent node id: "+xe);break}he&&(G.fill!==void 0&&G.fill!=="none"&&he.color.setStyle(G.fill),I(he,te),re.push(he),he.userData={node:K,style:G});const ve=K.childNodes;for(let de=0;de<ve.length;de++){const xe=ve[de];N&&xe.nodeName!=="style"&&xe.nodeName!=="defs"||r(xe,G)}U&&(z.pop(),z.length>0?te.copy(z[z.length-1]):te.identity())}function n(K){const G=new ShapePath,U=new Vector2,N=new Vector2,he=new Vector2;let ve=!0,de=!1;const xe=K.getAttribute("d");if(xe===""||xe==="none")return null;const ee=xe.match(/[a-df-z][^a-df-z]*/gi);for(let Ue=0,fe=ee.length;Ue<fe;Ue++){const Se=ee[Ue],Me=Se.charAt(0),Be=Se.slice(1).trim();ve===!0&&(de=!0,ve=!1);let se;switch(Me){case"M":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$+=2)U.x=se[$+0],U.y=se[$+1],N.x=U.x,N.y=U.y,$===0?G.moveTo(U.x,U.y):G.lineTo(U.x,U.y),$===0&&he.copy(U);break;case"H":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$++)U.x=se[$],N.x=U.x,N.y=U.y,G.lineTo(U.x,U.y),$===0&&de===!0&&he.copy(U);break;case"V":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$++)U.y=se[$],N.x=U.x,N.y=U.y,G.lineTo(U.x,U.y),$===0&&de===!0&&he.copy(U);break;case"L":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$+=2)U.x=se[$+0],U.y=se[$+1],N.x=U.x,N.y=U.y,G.lineTo(U.x,U.y),$===0&&de===!0&&he.copy(U);break;case"C":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$+=6)G.bezierCurveTo(se[$+0],se[$+1],se[$+2],se[$+3],se[$+4],se[$+5]),N.x=se[$+2],N.y=se[$+3],U.x=se[$+4],U.y=se[$+5],$===0&&de===!0&&he.copy(U);break;case"S":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$+=4)G.bezierCurveTo(M(U.x,N.x),M(U.y,N.y),se[$+0],se[$+1],se[$+2],se[$+3]),N.x=se[$+0],N.y=se[$+1],U.x=se[$+2],U.y=se[$+3],$===0&&de===!0&&he.copy(U);break;case"Q":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$+=4)G.quadraticCurveTo(se[$+0],se[$+1],se[$+2],se[$+3]),N.x=se[$+0],N.y=se[$+1],U.x=se[$+2],U.y=se[$+3],$===0&&de===!0&&he.copy(U);break;case"T":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$+=2){const Ye=M(U.x,N.x),st=M(U.y,N.y);G.quadraticCurveTo(Ye,st,se[$+0],se[$+1]),N.x=Ye,N.y=st,U.x=se[$+0],U.y=se[$+1],$===0&&de===!0&&he.copy(U)}break;case"A":se=S(Be,[3,4],7);for(let $=0,Oe=se.length;$<Oe;$+=7){if(se[$+5]==U.x&&se[$+6]==U.y)continue;const Ye=U.clone();U.x=se[$+5],U.y=se[$+6],N.x=U.x,N.y=U.y,l(G,se[$],se[$+1],se[$+2],se[$+3],se[$+4],Ye,U),$===0&&de===!0&&he.copy(U)}break;case"m":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$+=2)U.x+=se[$+0],U.y+=se[$+1],N.x=U.x,N.y=U.y,$===0?G.moveTo(U.x,U.y):G.lineTo(U.x,U.y),$===0&&he.copy(U);break;case"h":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$++)U.x+=se[$],N.x=U.x,N.y=U.y,G.lineTo(U.x,U.y),$===0&&de===!0&&he.copy(U);break;case"v":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$++)U.y+=se[$],N.x=U.x,N.y=U.y,G.lineTo(U.x,U.y),$===0&&de===!0&&he.copy(U);break;case"l":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$+=2)U.x+=se[$+0],U.y+=se[$+1],N.x=U.x,N.y=U.y,G.lineTo(U.x,U.y),$===0&&de===!0&&he.copy(U);break;case"c":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$+=6)G.bezierCurveTo(U.x+se[$+0],U.y+se[$+1],U.x+se[$+2],U.y+se[$+3],U.x+se[$+4],U.y+se[$+5]),N.x=U.x+se[$+2],N.y=U.y+se[$+3],U.x+=se[$+4],U.y+=se[$+5],$===0&&de===!0&&he.copy(U);break;case"s":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$+=4)G.bezierCurveTo(M(U.x,N.x),M(U.y,N.y),U.x+se[$+0],U.y+se[$+1],U.x+se[$+2],U.y+se[$+3]),N.x=U.x+se[$+0],N.y=U.y+se[$+1],U.x+=se[$+2],U.y+=se[$+3],$===0&&de===!0&&he.copy(U);break;case"q":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$+=4)G.quadraticCurveTo(U.x+se[$+0],U.y+se[$+1],U.x+se[$+2],U.y+se[$+3]),N.x=U.x+se[$+0],N.y=U.y+se[$+1],U.x+=se[$+2],U.y+=se[$+3],$===0&&de===!0&&he.copy(U);break;case"t":se=S(Be);for(let $=0,Oe=se.length;$<Oe;$+=2){const Ye=M(U.x,N.x),st=M(U.y,N.y);G.quadraticCurveTo(Ye,st,U.x+se[$+0],U.y+se[$+1]),N.x=Ye,N.y=st,U.x=U.x+se[$+0],U.y=U.y+se[$+1],$===0&&de===!0&&he.copy(U)}break;case"a":se=S(Be,[3,4],7);for(let $=0,Oe=se.length;$<Oe;$+=7){if(se[$+5]==0&&se[$+6]==0)continue;const Ye=U.clone();U.x+=se[$+5],U.y+=se[$+6],N.x=U.x,N.y=U.y,l(G,se[$],se[$+1],se[$+2],se[$+3],se[$+4],Ye,U),$===0&&de===!0&&he.copy(U)}break;case"Z":case"z":G.currentPath.autoClose=!0,G.currentPath.curves.length>0&&(U.copy(he),G.currentPath.currentPoint.copy(U),ve=!0);break;default:console.warn(Se)}de=!1}return G}function a(K){if(!(!K.sheet||!K.sheet.cssRules||!K.sheet.cssRules.length))for(let G=0;G<K.sheet.cssRules.length;G++){const U=K.sheet.cssRules[G];if(U.type!==1)continue;const N=U.selectorText.split(/,/gm).filter(Boolean).map(he=>he.trim());for(let he=0;he<N.length;he++){const ve=Object.fromEntries(Object.entries(U.style).filter(([,de])=>de!==""));ce[N[he]]=Object.assign(ce[N[he]]||{},ve)}}}function l(K,G,U,N,he,ve,de,xe){if(G==0||U==0){K.lineTo(xe.x,xe.y);return}N=N*Math.PI/180,G=Math.abs(G),U=Math.abs(U);const ee=(de.x-xe.x)/2,Ue=(de.y-xe.y)/2,fe=Math.cos(N)*ee+Math.sin(N)*Ue,Se=-Math.sin(N)*ee+Math.cos(N)*Ue;let Me=G*G,Be=U*U;const se=fe*fe,$=Se*Se,Oe=se/Me+$/Be;if(Oe>1){const Ee=Math.sqrt(Oe);G=Ee*G,U=Ee*U,Me=G*G,Be=U*U}const Ye=Me*$+Be*se,st=(Me*Be-Ye)/Ye;let W=Math.sqrt(Math.max(0,st));he===ve&&(W=-W);const O=W*G*Se/U,me=-W*U*fe/G,Ie=Math.cos(N)*O-Math.sin(N)*me+(de.x+xe.x)/2,Le=Math.sin(N)*O+Math.cos(N)*me+(de.y+xe.y)/2,Y=c(1,0,(fe-O)/G,(Se-me)/U),we=c((fe-O)/G,(Se-me)/U,(-fe-O)/G,(-Se-me)/U)%(Math.PI*2);K.currentPath.absellipse(Ie,Le,G,U,Y,Y+we,ve===0,N)}function c(K,G,U,N){const he=K*U+G*N,ve=Math.sqrt(K*K+G*G)*Math.sqrt(U*U+N*N);let de=Math.acos(Math.max(-1,Math.min(1,he/ve)));return K*N-G*U<0&&(de=-de),de}function u(K){const G=w(K.getAttribute("x")||0),U=w(K.getAttribute("y")||0),N=w(K.getAttribute("rx")||K.getAttribute("ry")||0),he=w(K.getAttribute("ry")||K.getAttribute("rx")||0),ve=w(K.getAttribute("width")),de=w(K.getAttribute("height")),xe=1-.551915024494,ee=new ShapePath;return ee.moveTo(G+N,U),ee.lineTo(G+ve-N,U),(N!==0||he!==0)&&ee.bezierCurveTo(G+ve-N*xe,U,G+ve,U+he*xe,G+ve,U+he),ee.lineTo(G+ve,U+de-he),(N!==0||he!==0)&&ee.bezierCurveTo(G+ve,U+de-he*xe,G+ve-N*xe,U+de,G+ve-N,U+de),ee.lineTo(G+N,U+de),(N!==0||he!==0)&&ee.bezierCurveTo(G+N*xe,U+de,G,U+de-he*xe,G,U+de-he),ee.lineTo(G,U+he),(N!==0||he!==0)&&ee.bezierCurveTo(G,U+he*xe,G+N*xe,U,G+N,U),ee}function f(K){function G(ve,de,xe){const ee=w(de),Ue=w(xe);he===0?N.moveTo(ee,Ue):N.lineTo(ee,Ue),he++}const U=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,N=new ShapePath;let he=0;return K.getAttribute("points").replace(U,G),N.currentPath.autoClose=!0,N}function p(K){function G(ve,de,xe){const ee=w(de),Ue=w(xe);he===0?N.moveTo(ee,Ue):N.lineTo(ee,Ue),he++}const U=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,N=new ShapePath;let he=0;return K.getAttribute("points").replace(U,G),N.currentPath.autoClose=!1,N}function g(K){const G=w(K.getAttribute("cx")||0),U=w(K.getAttribute("cy")||0),N=w(K.getAttribute("r")||0),he=new Path;he.absarc(G,U,N,0,Math.PI*2);const ve=new ShapePath;return ve.subPaths.push(he),ve}function v(K){const G=w(K.getAttribute("cx")||0),U=w(K.getAttribute("cy")||0),N=w(K.getAttribute("rx")||0),he=w(K.getAttribute("ry")||0),ve=new Path;ve.absellipse(G,U,N,he,0,Math.PI*2);const de=new ShapePath;return de.subPaths.push(ve),de}function _(K){const G=w(K.getAttribute("x1")||0),U=w(K.getAttribute("y1")||0),N=w(K.getAttribute("x2")||0),he=w(K.getAttribute("y2")||0),ve=new ShapePath;return ve.moveTo(G,U),ve.lineTo(N,he),ve.currentPath.autoClose=!1,ve}function T(K,G){G=Object.assign({},G);let U={};if(K.hasAttribute("class")){const de=K.getAttribute("class").split(/\s/).filter(Boolean).map(xe=>xe.trim());for(let xe=0;xe<de.length;xe++)U=Object.assign(U,ce["."+de[xe]])}K.hasAttribute("id")&&(U=Object.assign(U,ce["#"+K.getAttribute("id")]));function N(de,xe,ee){ee===void 0&&(ee=function(fe){return fe.startsWith("url")&&console.warn("SVGLoader: url access in attributes is not implemented."),fe}),K.hasAttribute(de)&&(G[xe]=ee(K.getAttribute(de))),U[de]&&(G[xe]=ee(U[de])),K.style&&K.style[de]!==""&&(G[xe]=ee(K.style[de]))}function he(de){return Math.max(0,Math.min(1,w(de)))}function ve(de){return Math.max(0,w(de))}return N("fill","fill"),N("fill-opacity","fillOpacity",he),N("fill-rule","fillRule"),N("opacity","opacity",he),N("stroke","stroke"),N("stroke-opacity","strokeOpacity",he),N("stroke-width","strokeWidth",ve),N("stroke-linejoin","strokeLineJoin"),N("stroke-linecap","strokeLineCap"),N("stroke-miterlimit","strokeMiterLimit",ve),N("visibility","visibility"),G}function M(K,G){return K-(G-K)}function S(K,G,U){if(typeof K!="string")throw new TypeError("Invalid input: "+typeof K);const N={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},he=0,ve=1,de=2,xe=3;let ee=he,Ue=!0,fe="",Se="";const Me=[];function Be(Ye,st,W){const O=new SyntaxError('Unexpected character "'+Ye+'" at index '+st+".");throw O.partial=W,O}function se(){fe!==""&&(Se===""?Me.push(Number(fe)):Me.push(Number(fe)*Math.pow(10,Number(Se)))),fe="",Se=""}let $;const Oe=K.length;for(let Ye=0;Ye<Oe;Ye++){if($=K[Ye],Array.isArray(G)&&G.includes(Me.length%U)&&N.FLAGS.test($)){ee=ve,fe=$,se();continue}if(ee===he){if(N.WHITESPACE.test($))continue;if(N.DIGIT.test($)||N.SIGN.test($)){ee=ve,fe=$;continue}if(N.POINT.test($)){ee=de,fe=$;continue}N.COMMA.test($)&&(Ue&&Be($,Ye,Me),Ue=!0)}if(ee===ve){if(N.DIGIT.test($)){fe+=$;continue}if(N.POINT.test($)){fe+=$,ee=de;continue}if(N.EXP.test($)){ee=xe;continue}N.SIGN.test($)&&fe.length===1&&N.SIGN.test(fe[0])&&Be($,Ye,Me)}if(ee===de){if(N.DIGIT.test($)){fe+=$;continue}if(N.EXP.test($)){ee=xe;continue}N.POINT.test($)&&fe[fe.length-1]==="."&&Be($,Ye,Me)}if(ee===xe){if(N.DIGIT.test($)){Se+=$;continue}if(N.SIGN.test($)){if(Se===""){Se+=$;continue}Se.length===1&&N.SIGN.test(Se)&&Be($,Ye,Me)}}N.WHITESPACE.test($)?(se(),ee=he,Ue=!1):N.COMMA.test($)?(se(),ee=he,Ue=!0):N.SIGN.test($)?(se(),ee=ve,fe=$):N.POINT.test($)?(se(),ee=de,fe=$):Be($,Ye,Me)}return se(),Me}const b=["mm","cm","in","pt","pc","px"],C={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function w(K){let G="px";if(typeof K=="string"||K instanceof String)for(let N=0,he=b.length;N<he;N++){const ve=b[N];if(K.endsWith(ve)){G=ve,K=K.substring(0,K.length-ve.length);break}}let U;return G==="px"&&t.defaultUnit!=="px"?U=C.in[t.defaultUnit]/t.defaultDPI:(U=C[G][t.defaultUnit],U<0&&(U=C[G].in*t.defaultDPI)),U*parseFloat(K)}function R(K){if(!(K.hasAttribute("transform")||K.nodeName==="use"&&(K.hasAttribute("x")||K.hasAttribute("y"))))return null;const G=E(K);return z.length>0&&G.premultiply(z[z.length-1]),te.copy(G),z.push(G),G}function E(K){const G=new Matrix3,U=j;if(K.nodeName==="use"&&(K.hasAttribute("x")||K.hasAttribute("y"))){const N=w(K.getAttribute("x")),he=w(K.getAttribute("y"));G.translate(N,he)}if(K.hasAttribute("transform")){const N=K.getAttribute("transform").split(")");for(let he=N.length-1;he>=0;he--){const ve=N[he].trim();if(ve==="")continue;const de=ve.indexOf("("),xe=ve.length;if(de>0&&de<xe){const ee=ve.slice(0,de),Ue=S(ve.slice(de+1));switch(U.identity(),ee){case"translate":if(Ue.length>=1){const fe=Ue[0];let Se=0;Ue.length>=2&&(Se=Ue[1]),U.translate(fe,Se)}break;case"rotate":if(Ue.length>=1){let fe=0,Se=0,Me=0;fe=Ue[0]*Math.PI/180,Ue.length>=3&&(Se=Ue[1],Me=Ue[2]),X.makeTranslation(-Se,-Me),Z.makeRotation(fe),q.multiplyMatrices(Z,X),X.makeTranslation(Se,Me),U.multiplyMatrices(X,q)}break;case"scale":if(Ue.length>=1){const fe=Ue[0];let Se=fe;Ue.length>=2&&(Se=Ue[1]),U.scale(fe,Se)}break;case"skewX":Ue.length===1&&U.set(1,Math.tan(Ue[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":Ue.length===1&&U.set(1,0,0,Math.tan(Ue[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":Ue.length===6&&U.set(Ue[0],Ue[2],Ue[4],Ue[1],Ue[3],Ue[5],0,0,1);break}}G.premultiply(U)}}return G}function I(K,G){function U(de){oe.set(de.x,de.y,1).applyMatrix3(G),de.set(oe.x,oe.y)}function N(de){const xe=de.xRadius,ee=de.yRadius,Ue=Math.cos(de.aRotation),fe=Math.sin(de.aRotation),Se=new Vector3(xe*Ue,xe*fe,0),Me=new Vector3(-ee*fe,ee*Ue,0),Be=Se.applyMatrix3(G),se=Me.applyMatrix3(G),$=j.set(Be.x,se.x,0,Be.y,se.y,0,0,0,1),Oe=X.copy($).invert(),W=Z.copy(Oe).transpose().multiply(Oe).elements,O=ne(W[0],W[1],W[4]),me=Math.sqrt(O.rt1),Ie=Math.sqrt(O.rt2);if(de.xRadius=1/me,de.yRadius=1/Ie,de.aRotation=Math.atan2(O.sn,O.cs),!((de.aEndAngle-de.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const Y=X.set(me,0,0,0,Ie,0,0,0,1),we=Z.set(O.cs,O.sn,0,-O.sn,O.cs,0,0,0,1),Ee=Y.multiply(we).multiply($),Fe=Xe=>{const{x:tt,y:Re}=new Vector3(Math.cos(Xe),Math.sin(Xe),0).applyMatrix3(Ee);return Math.atan2(Re,tt)};de.aStartAngle=Fe(de.aStartAngle),de.aEndAngle=Fe(de.aEndAngle),F(G)&&(de.aClockwise=!de.aClockwise)}}function he(de){const xe=L(G),ee=D(G);de.xRadius*=xe,de.yRadius*=ee;const Ue=xe>Number.EPSILON?Math.atan2(G.elements[1],G.elements[0]):Math.atan2(-G.elements[3],G.elements[4]);de.aRotation+=Ue,F(G)&&(de.aStartAngle*=-1,de.aEndAngle*=-1,de.aClockwise=!de.aClockwise)}const ve=K.subPaths;for(let de=0,xe=ve.length;de<xe;de++){const Ue=ve[de].curves;for(let fe=0;fe<Ue.length;fe++){const Se=Ue[fe];Se.isLineCurve?(U(Se.v1),U(Se.v2)):Se.isCubicBezierCurve?(U(Se.v0),U(Se.v1),U(Se.v2),U(Se.v3)):Se.isQuadraticBezierCurve?(U(Se.v0),U(Se.v1),U(Se.v2)):Se.isEllipseCurve&&(ue.set(Se.aX,Se.aY),U(ue),Se.aX=ue.x,Se.aY=ue.y,k(G)?N(Se):he(Se))}}}function F(K){const G=K.elements;return G[0]*G[4]-G[1]*G[3]<0}function k(K){const G=K.elements,U=G[0]*G[3]+G[1]*G[4];if(U===0)return!1;const N=L(K),he=D(K);return Math.abs(U/(N*he))>Number.EPSILON}function L(K){const G=K.elements;return Math.sqrt(G[0]*G[0]+G[1]*G[1])}function D(K){const G=K.elements;return Math.sqrt(G[3]*G[3]+G[4]*G[4])}function ne(K,G,U){let N,he,ve,de,xe;const ee=K+U,Ue=K-U,fe=Math.sqrt(Ue*Ue+4*G*G);return ee>0?(N=.5*(ee+fe),xe=1/N,he=K*xe*U-G*xe*G):ee<0?he=.5*(ee-fe):(N=.5*fe,he=-.5*fe),Ue>0?ve=Ue+fe:ve=Ue-fe,Math.abs(ve)>2*Math.abs(G)?(xe=-2*G/ve,de=1/Math.sqrt(1+xe*xe),ve=xe*de):Math.abs(G)===0?(ve=1,de=0):(xe=-.5*ve/G,ve=1/Math.sqrt(1+xe*xe),de=xe*ve),Ue>0&&(xe=ve,ve=-de,de=xe),{rt1:N,rt2:he,cs:ve,sn:de}}const re=[],ce={},z=[],j=new Matrix3,X=new Matrix3,Z=new Matrix3,q=new Matrix3,ue=new Vector2,oe=new Vector3,te=new Matrix3,le=new DOMParser().parseFromString(e,"image/svg+xml");return r(le.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:re,xml:le.documentElement}}createShapes(e){const r={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},n={loc:r.ORIGIN,t:0};function a(M,S,b,C){const w=M.x,R=S.x,E=b.x,I=C.x,F=M.y,k=S.y,L=b.y,D=C.y,ne=(I-E)*(F-L)-(D-L)*(w-E),re=(R-w)*(F-L)-(k-F)*(w-E),ce=(D-L)*(R-w)-(I-E)*(k-F),z=ne/ce,j=re/ce;if(ce===0&&ne!==0||z<=0||z>=1||j<0||j>1)return null;if(ne===0&&ce===0){for(let X=0;X<2;X++)if(l(X===0?b:C,M,S),n.loc==r.ORIGIN){const Z=X===0?b:C;return{x:Z.x,y:Z.y,t:n.t}}else if(n.loc==r.BETWEEN){const Z=+(w+n.t*(R-w)).toPrecision(10),q=+(F+n.t*(k-F)).toPrecision(10);return{x:Z,y:q,t:n.t}}return null}else{for(let q=0;q<2;q++)if(l(q===0?b:C,M,S),n.loc==r.ORIGIN){const ue=q===0?b:C;return{x:ue.x,y:ue.y,t:n.t}}const X=+(w+z*(R-w)).toPrecision(10),Z=+(F+z*(k-F)).toPrecision(10);return{x:X,y:Z,t:z}}}function l(M,S,b){const C=b.x-S.x,w=b.y-S.y,R=M.x-S.x,E=M.y-S.y,I=C*E-R*w;if(M.x===S.x&&M.y===S.y){n.loc=r.ORIGIN,n.t=0;return}if(M.x===b.x&&M.y===b.y){n.loc=r.DESTINATION,n.t=1;return}if(I<-Number.EPSILON){n.loc=r.LEFT;return}if(I>Number.EPSILON){n.loc=r.RIGHT;return}if(C*R<0||w*E<0){n.loc=r.BEHIND;return}if(Math.sqrt(C*C+w*w)<Math.sqrt(R*R+E*E)){n.loc=r.BEYOND;return}let F;C!==0?F=R/C:F=E/w,n.loc=r.BETWEEN,n.t=F}function c(M,S){const b=[],C=[];for(let w=1;w<M.length;w++){const R=M[w-1],E=M[w];for(let I=1;I<S.length;I++){const F=S[I-1],k=S[I],L=a(R,E,F,k);L!==null&&b.find(D=>D.t<=L.t+Number.EPSILON&&D.t>=L.t-Number.EPSILON)===void 0&&(b.push(L),C.push(new Vector2(L.x,L.y)))}}return C}function u(M,S,b){const C=new Vector2;S.getCenter(C);const w=[];return b.forEach(R=>{R.boundingBox.containsPoint(C)&&c(M,R.points).forEach(I=>{w.push({identifier:R.identifier,isCW:R.isCW,point:I})})}),w.sort((R,E)=>R.point.x-E.point.x),w}function f(M,S,b,C,w){(w==null||w==="")&&(w="nonzero");const R=new Vector2;M.boundingBox.getCenter(R);const E=[new Vector2(b,R.y),new Vector2(C,R.y)],I=u(E,M.boundingBox,S);I.sort((re,ce)=>re.point.x-ce.point.x);const F=[],k=[];I.forEach(re=>{re.identifier===M.identifier?F.push(re):k.push(re)});const L=F[0].point.x,D=[];let ne=0;for(;ne<k.length&&k[ne].point.x<L;)D.length>0&&D[D.length-1]===k[ne].identifier?D.pop():D.push(k[ne].identifier),ne++;if(D.push(M.identifier),w==="evenodd"){const re=D.length%2===0,ce=D[D.length-2];return{identifier:M.identifier,isHole:re,for:ce}}else if(w==="nonzero"){let re=!0,ce=null,z=null;for(let j=0;j<D.length;j++){const X=D[j];re?(z=S[X].isCW,re=!1,ce=X):z!==S[X].isCW&&(z=S[X].isCW,re=!0)}return{identifier:M.identifier,isHole:re,for:ce}}else console.warn('fill-rule: "'+w+'" is currently not implemented.')}let p=999999999,g=-999999999,v=e.subPaths.map(M=>{const S=M.getPoints();let b=-999999999,C=999999999,w=-999999999,R=999999999;for(let E=0;E<S.length;E++){const I=S[E];I.y>b&&(b=I.y),I.y<C&&(C=I.y),I.x>w&&(w=I.x),I.x<R&&(R=I.x)}return g<=w&&(g=w+1),p>=R&&(p=R-1),{curves:M.curves,points:S,isCW:ShapeUtils.isClockWise(S),identifier:-1,boundingBox:new Box2(new Vector2(R,C),new Vector2(w,b))}});v=v.filter(M=>M.points.length>1);for(let M=0;M<v.length;M++)v[M].identifier=M;const _=v.map(M=>f(M,v,p,g,e.userData?e.userData.style.fillRule:void 0)),T=[];return v.forEach(M=>{if(!_[M.identifier].isHole){const b=new Shape;b.curves=M.curves,_.filter(w=>w.isHole&&w.for===M.identifier).forEach(w=>{const R=v[w.identifier],E=new Path;E.curves=R.curves,b.holes.push(E)}),T.push(b)}}),T}getStrokeStyle(e,t,r,n,a){return e=e!==void 0?e:1,t=t!==void 0?t:"#000",r=r!==void 0?r:"miter",n=n!==void 0?n:"butt",a=a!==void 0?a:4,{strokeColor:t,strokeWidth:e,strokeLineJoin:r,strokeLineCap:n,strokeMiterLimit:a}}pointsToStroke(e,t,r,n){const a=[],l=[],c=[];if(SVGLoader.pointsToStrokeWithBuffers(e,t,r,n,a,l,c)===0)return null;const u=new BufferGeometry;return u.setAttribute("position",new Float32BufferAttribute(a,3)),u.setAttribute("normal",new Float32BufferAttribute(l,3)),u.setAttribute("uv",new Float32BufferAttribute(c,2)),u}pointsToStrokeWithBuffers(e,t,r,n,a,l,c,u){const f=new Vector2,p=new Vector2,g=new Vector2,v=new Vector2,_=new Vector2,T=new Vector2,M=new Vector2,S=new Vector2,b=new Vector2,C=new Vector2,w=new Vector2,R=new Vector2,E=new Vector2,I=new Vector2,F=new Vector2,k=new Vector2,L=new Vector2;r=r!==void 0?r:12,n=n!==void 0?n:.001,u=u!==void 0?u:0,e=Ue(e);const D=e.length;if(D<2)return 0;const ne=e[0].equals(e[D-1]);let re,ce=e[0],z;const j=t.strokeWidth/2,X=1/(D-1);let Z=0,q,ue,oe,te,le=!1,Te=0,K=u*3,G=u*2;U(e[0],e[1],f).multiplyScalar(j),S.copy(e[0]).sub(f),b.copy(e[0]).add(f),C.copy(S),w.copy(b);for(let fe=1;fe<D;fe++){re=e[fe],fe===D-1?ne?z=e[1]:z=void 0:z=e[fe+1];const Se=f;if(U(ce,re,Se),g.copy(Se).multiplyScalar(j),R.copy(re).sub(g),E.copy(re).add(g),q=Z+X,ue=!1,z!==void 0){U(re,z,p),g.copy(p).multiplyScalar(j),I.copy(re).sub(g),F.copy(re).add(g),oe=!0,g.subVectors(z,ce),Se.dot(g)<0&&(oe=!1),fe===1&&(le=oe),g.subVectors(z,re),g.normalize();const Me=Math.abs(Se.dot(g));if(Me>Number.EPSILON){const Be=j/Me;g.multiplyScalar(-Be),v.subVectors(re,ce),_.copy(v).setLength(Be).add(g),k.copy(_).negate();const se=_.length(),$=v.length();v.divideScalar($),T.subVectors(z,re);const Oe=T.length();switch(T.divideScalar(Oe),v.dot(k)<$&&T.dot(k)<Oe&&(ue=!0),L.copy(_).add(re),k.add(re),te=!1,ue?oe?(F.copy(k),E.copy(k)):(I.copy(k),R.copy(k)):ve(),t.strokeLineJoin){case"bevel":de(oe,ue,q);break;case"round":xe(oe,ue),oe?he(re,R,I,q,0):he(re,F,E,q,1);break;case"miter":case"miter-clip":default:const Ye=j*t.strokeMiterLimit/se;if(Ye<1)if(t.strokeLineJoin!=="miter-clip"){de(oe,ue,q);break}else xe(oe,ue),oe?(T.subVectors(L,R).multiplyScalar(Ye).add(R),M.subVectors(L,I).multiplyScalar(Ye).add(I),N(R,q,0),N(T,q,0),N(re,q,.5),N(re,q,.5),N(T,q,0),N(M,q,0),N(re,q,.5),N(M,q,0),N(I,q,0)):(T.subVectors(L,E).multiplyScalar(Ye).add(E),M.subVectors(L,F).multiplyScalar(Ye).add(F),N(E,q,1),N(T,q,1),N(re,q,.5),N(re,q,.5),N(T,q,1),N(M,q,1),N(re,q,.5),N(M,q,1),N(F,q,1));else ue?(oe?(N(b,Z,1),N(S,Z,0),N(L,q,0),N(b,Z,1),N(L,q,0),N(k,q,1)):(N(b,Z,1),N(S,Z,0),N(L,q,1),N(S,Z,0),N(k,q,0),N(L,q,1)),oe?I.copy(L):F.copy(L)):oe?(N(R,q,0),N(L,q,0),N(re,q,.5),N(re,q,.5),N(L,q,0),N(I,q,0)):(N(E,q,1),N(L,q,1),N(re,q,.5),N(re,q,.5),N(L,q,1),N(F,q,1)),te=!0;break}}else ve()}else ve();!ne&&fe===D-1&&ee(e[0],C,w,oe,!0,Z),Z=q,ce=re,S.copy(I),b.copy(F)}if(!ne)ee(re,R,E,oe,!1,q);else if(ue&&a){let fe=L,Se=k;le!==oe&&(fe=k,Se=L),oe?(te||le)&&(Se.toArray(a,0*3),Se.toArray(a,3*3),te&&fe.toArray(a,1*3)):(te||!le)&&(Se.toArray(a,1*3),Se.toArray(a,3*3),te&&fe.toArray(a,0*3))}return Te;function U(fe,Se,Me){return Me.subVectors(Se,fe),Me.set(-Me.y,Me.x).normalize()}function N(fe,Se,Me){a&&(a[K]=fe.x,a[K+1]=fe.y,a[K+2]=0,l&&(l[K]=0,l[K+1]=0,l[K+2]=1),K+=3,c&&(c[G]=Se,c[G+1]=Me,G+=2)),Te+=3}function he(fe,Se,Me,Be,se){f.copy(Se).sub(fe).normalize(),p.copy(Me).sub(fe).normalize();let $=Math.PI;const Oe=f.dot(p);Math.abs(Oe)<1&&($=Math.abs(Math.acos(Oe))),$/=r,g.copy(Se);for(let Ye=0,st=r-1;Ye<st;Ye++)v.copy(g).rotateAround(fe,$),N(g,Be,se),N(v,Be,se),N(fe,Be,.5),g.copy(v);N(v,Be,se),N(Me,Be,se),N(fe,Be,.5)}function ve(){N(b,Z,1),N(S,Z,0),N(R,q,0),N(b,Z,1),N(R,q,1),N(E,q,0)}function de(fe,Se,Me){Se?fe?(N(b,Z,1),N(S,Z,0),N(R,q,0),N(b,Z,1),N(R,q,0),N(k,q,1),N(R,Me,0),N(I,Me,0),N(k,Me,.5)):(N(b,Z,1),N(S,Z,0),N(E,q,1),N(S,Z,0),N(k,q,0),N(E,q,1),N(E,Me,1),N(F,Me,0),N(k,Me,.5)):fe?(N(R,Me,0),N(I,Me,0),N(re,Me,.5)):(N(E,Me,1),N(F,Me,0),N(re,Me,.5))}function xe(fe,Se){Se&&(fe?(N(b,Z,1),N(S,Z,0),N(R,q,0),N(b,Z,1),N(R,q,0),N(k,q,1),N(R,Z,0),N(re,q,.5),N(k,q,1),N(re,q,.5),N(I,Z,0),N(k,q,1)):(N(b,Z,1),N(S,Z,0),N(E,q,1),N(S,Z,0),N(k,q,0),N(E,q,1),N(E,Z,1),N(k,q,0),N(re,q,.5),N(re,q,.5),N(k,q,0),N(F,Z,1)))}function ee(fe,Se,Me,Be,se,$){switch(t.strokeLineCap){case"round":se?he(fe,Me,Se,$,.5):he(fe,Se,Me,$,.5);break;case"square":if(se)f.subVectors(Se,fe),p.set(f.y,-f.x),g.addVectors(f,p).add(fe),v.subVectors(p,f).add(fe),Be?(g.toArray(a,1*3),v.toArray(a,0*3),v.toArray(a,3*3)):(g.toArray(a,1*3),g.toArray(a,3*3),v.toArray(a,0*3));else{f.subVectors(Me,fe),p.set(f.y,-f.x),g.addVectors(f,p).add(fe),v.subVectors(p,f).add(fe);const Oe=a.length;Be?(g.toArray(a,Oe-1*3),v.toArray(a,Oe-2*3),v.toArray(a,Oe-4*3)):(g.toArray(a,Oe-2*3),v.toArray(a,Oe-1*3),v.toArray(a,Oe-4*3))}break}}function Ue(fe){let Se=!1;for(let Be=1,se=fe.length-1;Be<se;Be++)if(fe[Be].distanceTo(fe[Be+1])<n){Se=!0;break}if(!Se)return fe;const Me=[];Me.push(fe[0]);for(let Be=1,se=fe.length-1;Be<se;Be++)fe[Be].distanceTo(fe[Be+1])>=n&&Me.push(fe[Be]);return Me.push(fe[fe.length-1]),Me}}}const svgParser=new SVGParser,titleVert=`#define GLSLIFY 1
#ifdef IS_EDGE
attribute vec2 instancedPositionA;attribute vec2 instancedPositionB;varying vec2 v_toNode;uniform float u_radius;
#endif
uniform float u_scrollRatio;
#include <ufxVert>
varying vec2 v_uv;varying float v_ddd;float linearStep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main(){
#ifdef IS_EDGE
bool isTop=position.y>0.;vec3 pos=vec3(isTop ? instancedPositionA : instancedPositionB,0.0);
#else
vec3 pos=position;
#endif
float lineRatio=floor(pos.y*6.)/6.;pos*=1.5;pos.x-=linearStep(lineRatio*0.4,0.56+lineRatio*0.4,u_scrollRatio)*0.5;vec3 basePos=getBasePosition(pos);vec3 screenPos=getScreenPosition(basePos);
#ifdef IS_EDGE
vec2 vAB=(instancedPositionA-instancedPositionB)*u_domWH;float angle=atan(vAB.y,vAB.x)+3.1415926*0.5;float s=sin(angle);float c=cos(angle);mat2 m=mat2(c,-s,s,c);v_toNode=m*(position.xy*vec2(1.,step(0.5,abs(position.y))));screenPos.xy+=v_toNode*u_radius;
#endif
gl_Position=projectionMatrix*modelViewMatrix*vec4(screenPos,1.0);v_uv=padUv(uv*0.002);}`,titleFrag=`#define GLSLIFY 1
uniform sampler2D u_screenPaintTexture;uniform sampler2D u_gradientTexture;uniform vec2 u_screenPaintTextureSize;uniform vec2 u_resolution;uniform float u_time;uniform float u_invertRatio;uniform sampler2D u_texture;varying vec2 v_uv;
#ifdef IS_EDGE
varying vec2 v_toNode;
#endif
#include <getBlueNoise>
#include <textureBicubic>
void main(){vec3 noise=getBlueNoise(gl_FragCoord.xy+vec2(38.,27.));vec2 screenPaintUv=gl_FragCoord.xy/u_resolution;vec4 screenPaintData=textureBicubic(u_screenPaintTexture,screenPaintUv,u_screenPaintTextureSize);float timeOffset=u_time;
#ifdef IS_EDGE
timeOffset+=3.1415926;
#endif
float d=cos((screenPaintUv.x+screenPaintUv.y)*4.+timeOffset)*0.5+0.5;float screenPaintStrength=1.;float constantStrength=0.;float alpha=1.0;
#ifdef IS_EDGE
vec2 toNode=v_toNode;float toNodeDist=length(toNode);alpha=smoothstep(1.0+fwidth(toNodeDist),1.0,toNodeDist);screenPaintStrength=4.;vec3 baseColor=vec3(0.004+d*d*0.15);constantStrength=max(0.,d*2.-1.)*0.15;
#else
vec3 baseColor=vec3(0.004+d*d*0.015);
#endif
float hue=(screenPaintData.x+screenPaintData.y)*1.5+d*2.;vec3 color=mix(baseColor,texture2D(u_gradientTexture,vec2(hue,0.0)).rgb,max(screenPaintData.z,screenPaintData.w)*screenPaintStrength+constantStrength)+noise.x*0.004;gl_FragColor=vec4(mix(color,1.-color,u_invertRatio),alpha);}`;class PostUfx extends Ufx{renderOrder=100}const postUfx=new PostUfx;class AboutAwardSection{domContainer;domTitle;domCapabilitySectionContainer;offsetY=0;showItemPerSecond=10;_needsReset=!0;isSectionWasActive=!1;preInit(e){this.domContainer=e.querySelector("#about-award"),this.domTitle=e.querySelector("#about-award-title"),this.domHeaders=Array.from(e.querySelectorAll(".about-award-header")),this.domItems=Array.from(e.querySelectorAll(".about-award-item"));for(let l=0;l<this.domHeaders.length;l++){let c=this.domHeaders[l],u=c.querySelector(".about-award-header-title"),f=c.querySelector(".about-award-header-svg"),p=c.querySelector(".about-award-header-text");u._splitted=new SplitType(u,{types:"chars"}),p._splitted=new SplitType(p,{types:"chars"}),c._title=u,c._svg=f,c._number=p,c._animating=!1,c._time=0}for(let l=0;l<this.domItems.length;l++){let c=this.domItems[l],u=c.querySelector(".about-award-line"),f=Array.from(c.querySelectorAll(".about-award-item-wrapper"));c._animating=!1,c._time=0;for(let p=0;p<f.length;p++){let g=f[p],v=Array.from(g.querySelectorAll(".about-award-item-wrapper-text"));for(let _=0;_<v.length;_++){let T=v[_];T._splitted=new SplitType(T,{types:"words"})}g._texts=v}c._line=u,c._wrappers=f}this.domCapabilitySectionContainer=e.querySelector("#about-capability");let t=svgParser.createShapes(svgParser.parse(this.domTitle.outerHTML).paths[0]),r=new ShapeGeometry(t);r.scale(1/1438,1/1252,1);let n=this._generateEdgeIndices(r),a=properties.loader.add(settings.TEXTURE_PATH+"award_gradient.png",{type:"texture",minFilter:LinearFilter}).content;a.wrapS=a.wrapT=RepeatWrapping,this.titleEdgeMesh=new UfxMesh({refDom:this.domTitle,geometry:n,uniforms:Object.assign({u_screenPaintTexture:screenPaint.sharedUniforms.u_currPaintTexture,u_screenPaintTextureSize:screenPaint.sharedUniforms.u_paintTextureSize,u_time:properties.sharedUniforms.u_time,u_gradientTexture:{value:a},u_radius:{value:2},u_invertRatio:{value:0},u_scrollRatio:{value:0}},blueNoise.sharedUniforms),vertexShader:titleVert,fragmentShader:titleFrag}),this.titleEdgeMesh.material.defines.IS_EDGE=!0,aboutPage.postUfxContainer.add(this.titleEdgeMesh),this.titleMesh=new UfxMesh({refDom:this.domTitle,geometry:r,uniforms:this.titleEdgeMesh.material.uniforms,vertexShader:titleVert,fragmentShader:titleFrag}),this.titleMesh.renderOrder=1,aboutPage.postUfxContainer.add(this.titleMesh)}_generateEdgeIndices(e){let t={},r=[],n=[],a=e.attributes.position.array,l=e.index.array;for(let p=0;p<l.length;p+=3){let g=l[p],v=l[p+1],_=l[p+2],T=g<v?`${g}_${v}`:`${v}_${g}`,M=v<_?`${v}_${_}`:`${_}_${v}`,S=_<g?`${_}_${g}`:`${g}_${_}`;t[T]?t[T].count++:t[T]={count:1,p0:g,p1:v},t[M]?t[M].count++:t[M]={count:1,p0:v,p1:_},t[S]?t[S].count++:t[S]={count:1,p0:_,p1:g}}let c=0;for(let p in t){let g=t[p];g.count===1&&(r[c]=a[g.p0*3],n[c]=a[g.p1*3],c++,r[c]=a[g.p0*3+1],n[c]=a[g.p1*3+1],c++)}let u=new PlaneGeometry(2,2,1,3),f=new InstancedBufferGeometry;return f.index=u.index,f.attributes.position=u.attributes.position,f.attributes.instancedPositionA=new InstancedBufferAttribute(new Float32Array(r),2),f.attributes.instancedPositionB=new InstancedBufferAttribute(new Float32Array(n),2),f}init(){}show(){}hide(){}resize(e,t){this._splitText(),this.titleMesh.syncDom(-scrollManager.scrollPixel),this.titleEdgeMesh.syncDom(-scrollManager.scrollPixel),this.titleEdgeMesh.material.uniforms.u_radius.value=Math.max(1,properties.viewportWidth/1200)}update(e){let t=scrollManager.getDomRange(this.domContainer),r=t.isActive;if(this.titleMesh.visible=r,this.titleEdgeMesh.visible=r,this.titleMesh.visible){this.titleMesh.material.uniforms.u_scrollRatio.value=math.fit(t.ratio,-.75,.75,0,1),this.titleMesh.update(-scrollManager.scrollPixel),this.titleEdgeMesh.update(-scrollManager.scrollPixel);let n=scrollManager.getDomRange(this.domCapabilitySectionContainer);this.titleMesh.material.uniforms.u_invertRatio.value=math.fit(n.screenRatio,-1,-.75,0,1)}if(r){for(let n=0;n<this.domHeaders.length;n++){let a=this.domHeaders[n],l=scrollManager.getDomRange(a);l.screenRatio>-1?a._animating=!0:a._animating=!1,a._time=math.clamp(a._time+(a._animating?e:-e),0,1.5),a._svg.style.transform=`scale(${math.fit(a._time,.2,.6,0,1,ease.backOut)}) rotate(${math.fit(l.screenRatio-n/10,-1,1,n%2===0?-360:360,0)}deg)`;for(let c=0;c<a._title._splitted.chars.length;c++){let u=a._title._splitted.chars[c],f=math.fit(a._time-c/25,0,.7,30,0,ease.expoOut),p=math.fit(a._time-c/25,0,.7,100,0,ease.expoOut);properties.viewportWidth<settings.MOBILE_WIDTH&&(p=0,f=0),u.style.transform=`translate3d(0, ${p}%, 0) rotate(${f}deg)`}for(let c=0;c<a._number._splitted.chars.length;c++){let u=a._number._splitted.chars[c],f=math.fit(a._time-c/20,.2,.9,100,0,ease.expoOut);properties.viewportWidth<settings.MOBILE_WIDTH&&(f=0),u.style.transform=`translate3d(0, ${f}%, 0)`}}for(let n=0;n<this.domItems.length;n++){let a=this.domItems[n];scrollManager.getDomRange(a).screenRatio>-1?a._animating=!0:a._animating=!1,a._time=math.clamp(a._time+(a._animating?e:-e),0,1.5),a._line.style.transform=`scale3d(${math.fit(a._time,.2,1,0,1,ease.expoOut)} ,1 ,1)`;for(let c=0;c<a._wrappers.length;c++){let u=a._wrappers[c];for(let f=0;f<u._texts.length;f++){let p=u._texts[f];for(let g=0;g<p._splitted.words.length;g++){let v=p._splitted.words[g],_=math.fit(a._time-c/10-f/20-g/50,0,.8,100,0,ease.expoOut);properties.viewportWidth<settings.MOBILE_WIDTH&&(_=0),v.style.transform=`translate3d(0, ${_}%, 0)`}}}}this._needsReset&&this._reset()}else this._needsReset=!0;this.isSectionWasActive=r}_splitText(){}_reset(){this._needsReset=!1;for(let e=0;e<this.domHeaders.length;e++){let t=this.domHeaders[e];t._animating=!1,t._time=0}for(let e=0;e<this.domItems.length;e++){let t=this.domItems[e],r=Array.from(t.querySelectorAll(".about-award-item-wrapper"));t._animating=!1,t._time=0;for(let n=0;n<r.length;n++){let a=r[n],l=Array.from(a.querySelectorAll(".about-award-item-wrapper-text"));for(let c=0;c<l.length;c++){let u=l[c];u._splitted=new SplitType(u,{types:"words"})}a._texts=l}}}}const aboutAwardSection=new AboutAwardSection,NUMBER_OF_CARDS=4;class AboutCapabilitySection{domContainer;domList;domLine1;domLine2;domCards;showItemPerSecond=10;time=0;_needsReset=!0;preInit(e){this.domContainer=e.querySelector("#about-capability"),this.domTitle=e.querySelector("#about-capability-title"),this.domSubheader=e.querySelector("#about-capability-subheader"),this.domSubheaderText=e.querySelector("#about-capability-subheader-text"),this.domSubhheaderCards=Array.from(e.querySelectorAll(".about-capability-subheader-card")),this.domLine1=e.querySelector("#about-capability-title-line-1"),this.domLine2=e.querySelector("#about-capability-title-line-2"),this.domCardsWrapper=e.querySelector("#about-capability-cards-wrapper"),this.domCards=e.querySelector("#about-capability-cards"),this.domCardsArray=Array.from(this.domContainer.querySelectorAll(".about-capability-card")),this.titleTime=0,browser$1.isMobile||(this.lineVisual=new Line(2),this.lineVisual.preInit(),this.lineVisual2=new Line(3),this.lineVisual2.preInit())}init(){browser$1.isMobile||(this.lineVisual.init(),aboutPage.postUfxContainer.add(this.lineVisual.container),this.lineVisual2.init(),aboutPage.postUfxContainer.add(this.lineVisual2.container))}resize(e,t){this._splitText(),this.domCards.style.transform="translateZ(0)";for(let u=0,f=this.domCardsArray.length;u<f;u++)this.domCardsArray[u].style="translateZ(0)";let r=this.domCardsArray[0].getBoundingClientRect();this.domCards.style.height=properties.viewportWidth<812?"auto":r.height+"px";for(let u=0,f=this.domCardsArray.length;u<f;u++);browser$1.isMobile||(this.lineVisual.resize(e,t),this.lineVisual2.resize(e,t));let n=this.domCardsWrapper.getBoundingClientRect(),a=this.domCards.getBoundingClientRect(),l=this.domLine1.getBoundingClientRect(),c=this.domLine2.getBoundingClientRect();for(let u=0,f=this.domCardsArray.length;u<f;u++){let p=this.domCardsArray[u];p._width=r.width,p._height=r.height,p._offsetY=u%2===0?30:-30}this.domCardsWrapper._height=this.domCardsWrapper.offsetHeight-this.domCardsArray[0]._height,this.domCardsWrapper._width=n.width,this.domCardsWrapper._cardOffset=this.domCardsWrapper._width-this.domCardsArray[0]._width*NUMBER_OF_CARDS,this.domCards._screenRatio=a.height/properties.viewportHeight,this.domLine2._translateX=c.left-l.left,this.domTitle._height=this.domTitle.getBoundingClientRect().height,scrollManager.resize(properties.viewportWidth,properties.viewportHeight)}update(e){let t=scrollManager.getDomRange(this.domContainer);this.isSectionActive=t.isActive,browser$1.isMobile||(this.lineVisual.update(e,t),this.lineVisual2.update(e,t));let r=scrollManager.getDomRange(this.domTitle);if(this.domTitle.style.visibility=this.isSectionActive?"visible":"hidden",this.domCards.style.transform="translateZ(0)",properties.screenPaintOffsetRatio*=math.fit(t.screenRatio,-.5,0,1,0)+math.fit(t.screenRatio,.8,1,0,1),this.isSectionActive){this._needsReset&&this._reset();let n=math.fit(t.screenRatio,-.6,.2,0,1),a=math.fit(t.screenRatio,-.5,.7,0,1),l=math.fit(t.screenRatio,-.5,.7,-Math.PI/2,Math.PI-Math.PI/2);if(this.time+=e,properties.viewportWidth>812){let u=scrollManager.getDomRange(this.domCardsWrapper),f=scrollManager.getEaseInOutOffset(scrollManager.scrollPixel-u.top+(properties.viewportHeight-u.height)*.5,properties.viewportHeight*3,5,1);this.domCards.style.transform=`translate3d(0, ${f}px, 0)`;for(let p=0,g=this.domCardsArray.length;p<g;p++){let v=this.domCardsArray[p],_=this.domCardsWrapper._width/2-v._width/2,T=p/NUMBER_OF_CARDS*(this.domCardsWrapper._width+this.domCardsWrapper._cardOffset/(NUMBER_OF_CARDS-1)),M=math.fit(n,.2,1,_,T,ease.expoOut),S=math.fit(a,0,.7-Math.abs(g-1-p)/20,180,0,ease.backInOut),b=math.fit(Math.abs(math.fit(n,0,.75,0,1)*2-1),1,0,0,(p-1.5)*9,ease.expoInOut),C=Math.cos(this.time*3+p)*Math.cos(l);v.style.transform=`translate3d(${M}px, ${C*10}px, 0) rotateZ(${b}deg) rotate3d(0, 1, 0, ${S}deg)`}}else{let u=scrollManager.getDomRange(this.domCards),f=math.fit(u.showScreenOffset,0,this.domCards._screenRatio,0,1);this.domCards.style.perspectiveOrigin=`center ${f*100}%`;for(let p=0,g=this.domCardsArray.length;p<g;p++){let v=this.domCardsArray[p],_=scrollManager.getDomRange(v),T=math.fit(_.screenRatio,-.85-p%2/10,0,180,0,ease.cubicInOut);v.style.transform=`rotateY(${T}deg)`}}let c=r.screenRatio>-1;this.titleTime+=e*(c?1:0),this.domTitle._splitted.words.forEach((u,f)=>{if(properties.useMobileLayout)u.style.transform="translate3d(0px, 0, 0)";else if(f<2){let p=math.fit(this.titleTime-f/10,0,1,100,0,ease.lusion);u.style.transform=`translate3d(0, ${p}%, 0)`}else{let p=math.fit(this.titleTime-f/10,1,2,-this.domLine2._translateX,0,ease.lusion),g=math.fit(this.titleTime-f/10,.1,1.1,-100,0,ease.lusion);u.style.transform=`translate3d(${p}px, ${g}%, 0)`}}),this.domSubheaderText._splitted.lines.forEach((u,f)=>{let p=c?math.saturate(this.titleTime-f/10-.25):0,g=properties.viewportWidth>=settings.MOBILE_WIDTH?Math.round(ease.expoOut(p)*1e3)/1e3:1;u.style.transform=`translate3d(0, ${math.fit(g,0,1,110,0)}%, 0)`});for(let u=0,f=this.domSubhheaderCards.length;u<f;u++){let p=this.domSubhheaderCards[u],g=c?math.saturate(this.titleTime-u/10-.25):0,v=properties.viewportWidth>=settings.MOBILE_WIDTH?Math.round(ease.expoOut(g)*1e3)/1e3:1;p.style.transform=`translate3d(0, ${math.fit(v,0,1,110,0)}%, 0)`}}else this._needsReset=!0}_splitText(){this.domTitle._splitted=new SplitType(this.domTitle,{types:"words, lines",charClass:"about-capability-title-char"}),this.domTitle._splitted.lines.forEach(e=>{const t=document.createElement("div");t.style.position="relative",t.style.overflow="hidden",t.append(e),this.domTitle.append(t)}),this.domSubheaderText._splitted=new SplitType(this.domSubheaderText,{types:"lines"}),this.domSubheaderText._splitted.lines.forEach(e=>{const t=document.createElement("div");t.style.position="relative",t.style.overflow="hidden",t.append(e),this.domSubheaderText.append(t)})}_reset(){if(this.domTitle._splitted){this._needsReset=!1,this.titleTime=0,this.domTitle._splitted.words.forEach(e=>{e.style.transform="translate3d(0, 100%, 0)"}),this.domSubheaderText._splitted.chars.forEach(e=>{e.style.transform="translate3d(0, 100%, 0)"});for(let e=0,t=this.domSubhheaderCards.length;e<t;e++){let r=this.domSubhheaderCards[e];r.style.transform="translate3d(0, 110%, 0)"}}}}const aboutCapabilitySection=new AboutCapabilitySection;class AboutPageAudios{hasInit=!1;bgFilterActive=!1;bgTrackName="cinematic_0";constructor(){}init(){settings.USE_AUDIO&&(this.hasInit||(this.hasInit=!0))}update(e){if(!settings.USE_AUDIO)return;e?audios.fadeBgMusic(this.bgTrackName,1):audios.fadeBgMusic("generic",1),audios.items[this.bgTrackName].setFilterFrequencyViaRatio(math.fit(aboutHero.freezeRatio,.25,1,0,.75))}}const aboutPageAudios=new AboutPageAudios;let _c=new Color;class AboutPage extends Page{path="about";id="about";endVisualColor=properties.offWhiteColorHex;preInit(){let e=this.domContainer;aboutWhoSection.preInit(e),aboutClientSection.preInit(e),aboutAwardSection.preInit(e),aboutCapabilitySection.preInit(e)}init(){aboutWhoSection.init(),aboutClientSection.init(),aboutAwardSection.init(),aboutCapabilitySection.init(),super.init()}resize(e,t){aboutWhoSection.resize(e,t),aboutClientSection.resize(e,t),aboutAwardSection.resize(e,t),aboutCapabilitySection.resize(e,t)}show(e,t,r){aboutWhoSection.show(),aboutPageAudios.init(),super.show(e,t,r)}update(e){super.update(e);let t=!1,r=!0,n=!1;if(pagesManager.scrollTargetPage==this){properties.bgColor.setStyle(properties.blackColorHex);let a=scrollManager.getDomRange(aboutCapabilitySection.domContainer);properties.bgColor.lerp(_c.setStyle(properties.blueColorHex),math.fit(a.screenRatio,-1,-.5,0,1)),a.screenRatio>-.75?(n=!0,r=!1):(n=!1,r=!0),footerSection.getDomRange().ratio>-.1&&(t=!0,r=!1,n=!1),document.documentElement.classList.toggle("is-black-bg",r),document.documentElement.classList.toggle("is-white-bg",t),document.documentElement.classList.toggle("is-blue-bg",n)}aboutWhoSection.update(e),aboutClientSection.update(e),aboutAwardSection.update(e),aboutCapabilitySection.update(e),aboutPageAudios.update(r)}}const aboutPage=new AboutPage;class ProjectsMainSection{domContainer;domTitle;projectItemList;time=0;_needsReset=!0;preInit(e){this.domContainer=e.querySelector("#projects-main"),this.projectItemList=new ProjectItemList(projectsPage,e.querySelector(".project-list")),this.domItems=e.querySelectorAll(".project-item"),this.domTitle=e.querySelector("#projects-main-title"),this.domTitle._time=0,this.domTitle._animating=!1,this.domTitleProjectNumber=e.querySelector("#projects-main-title-project-number"),this.domTitleProjectArrow=e.querySelector("#projects-main-title-project-arrow")}init(){}hasProject(e){return this.projectItemList.hasProject(e)}resize(e,t){this._splitText(),this.projectItemList.resize(e,t)}update(e){if(scrollManager.getDomRange(this.domContainer).isActive){this._needsReset&&this._reset();let r=scrollManager.getDomRange(this.domTitle);if(this.domTitle._time=math.clamp(this.domTitle._time+(this.domTitle._animating?e:-e),0,2),r.screenRatio>-1&&(this.domTitle._animating=!0),properties.useMobileLayout)this.domTitleProjectArrow.style.transform="scale(1)";else{this.domTitle._splitted.chars.forEach((a,l)=>{let c=math.fit(this.domTitle._time*1.5-l/20-.2,0,1,100,0,ease.lusion),u=math.fit(this.domTitle._time*1.5-l/20-.2,0,1,30,0,ease.lusion);a.style.transform=`translate3d(0, ${c}%, 0) rotate(${u}deg)`}),this.domTitleProjectNumber._splitted.chars.forEach((a,l)=>{let c=math.fit(this.domTitle._time-l/20-.5,0,1,100,0,ease.lusion);a.style.transform=`translate3d(0, ${c}%, 0)`});let n=ease.elasticOut(math.saturate(this.domTitle._time-.6));this.domTitleProjectArrow.style.transform=`scale(${n})`}}else this._needsReset=!0;this.projectItemList.zoomRatio=math.fit(projectsPage.activeRatio,0,.75,1,0),this.projectItemList.update(e)}_reset(){this.domTitle._splitted&&(this._needsReset=!1,this.domTitle._time=0,this.domTitle._animating=!1,properties.useMobileLayout?(this.domTitle._splitted.chars&&this.domTitle._splitted.chars.forEach(e=>{e.style.transform="translate3d(0, 0, 0)"}),this.domTitleProjectNumber._splitted.chars&&this.domTitleProjectNumber._splitted.chars.forEach(e=>{e.style.transform="translate3d(0, 0, 0)"}),this.domTitleProjectArrow.style.transform="scale(1)"):(this.domTitle._splitted.chars.forEach(e=>{e.style.transform="translate3d(0, 100%, 0)"}),this.domTitleProjectNumber._splitted.chars.forEach(e=>{e.style.transform="translate3d(0, 100%, 0)"}),this.domTitleProjectArrow.style.transform="scale(0)"))}_splitText(){properties.useMobileLayout?(this.domTitle._splitted&&this.domTitle._splitted.revert(),this.domTitleProjectNumber._splitted&&this.domTitleProjectNumber._splitted.revert()):(this.domTitle._splitted=new SplitType(this.domTitle,{types:"chars"}),this.domTitleProjectNumber._splitted=new SplitType(this.domTitleProjectNumber,{types:"chars"}))}}const projectsMainSection=new ProjectsMainSection;class ProjectsPageAudios{hasInit=!1;constructor(){}init(){settings.USE_AUDIO&&(audios.fadeBgMusic("generic",1),!this.hasInit&&(this.domProjectItems=Array.from(document.querySelectorAll("#projects .project-item")),this.domProjectItems.forEach(e=>{audios.addHoverClickEvents(e)}),this.hasInit=!0))}update(){settings.USE_AUDIO}}const projectsPageAudios=new ProjectsPageAudios;class ProjectsPage extends Page{path="projects";id="projects";endVisualUseTextured=!0;preInit(){let e=this.domContainer;projectsMainSection.preInit(e)}init(){projectsMainSection.init()}hasProject(e){return projectsMainSection.projectItemList.hasProject(e)}show(e,t,r){this.useGenericTransition=!0,projectsMainSection.projectItemList.selectedId=null;let n=e.pathNodes[1];e.target===projectPage&&this.hasProject(n)&&this.isFirstShown?(this.useGenericTransition=!1,this.showDuration=1.5,scrollManager.scrollToPixel(projectsMainSection.projectItemList.getProjectItemTop(n)-properties.viewportHeight*.25,!0),projectsMainSection.projectItemList.selectedId=n):this.showDuration=1,projectsPageAudios.init(),super.show(e,t,r)}hide(e,t,r){this.useGenericTransition=!0,projectsMainSection.projectItemList.selectedId=null,t.target===projectPage&&this.hasProject(t.pathNodes[1])?(this.useGenericTransition=!1,this.hideDuration=1.5,projectsMainSection.projectItemList.selectedId=t.pathNodes[1]):this.hideDuration=1,super.hide(e,t,r)}resize(e,t){projectsMainSection.resize(e,t)}update(e){if(super.update(e),!!this.hasInitialized){if(projectsMainSection.update(e),pagesManager.scrollTargetPage==this){properties.bgColor.setStyle(properties.offWhiteColorHex);let t=!0,r=!1,n=!1;document.documentElement.classList.toggle("is-black-bg",r),document.documentElement.classList.toggle("is-white-bg",t),document.documentElement.classList.toggle("is-blue-bg",n)}projectsPageAudios.update(e)}}}const projectsPage=new ProjectsPage;var dayjs_min={exports:{}};(function(o,e){(function(t,r){o.exports=r()})(commonjsGlobal$1,function(){var t=1e3,r=6e4,n=36e5,a="millisecond",l="second",c="minute",u="hour",f="day",p="week",g="month",v="quarter",_="year",T="date",M="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(z){var j=["th","st","nd","rd"],X=z%100;return"["+z+(j[(X-20)%10]||j[X]||j[0])+"]"}},w=function(z,j,X){var Z=String(z);return!Z||Z.length>=j?z:""+Array(j+1-Z.length).join(X)+z},R={s:w,z:function(z){var j=-z.utcOffset(),X=Math.abs(j),Z=Math.floor(X/60),q=X%60;return(j<=0?"+":"-")+w(Z,2,"0")+":"+w(q,2,"0")},m:function z(j,X){if(j.date()<X.date())return-z(X,j);var Z=12*(X.year()-j.year())+(X.month()-j.month()),q=j.clone().add(Z,g),ue=X-q<0,oe=j.clone().add(Z+(ue?-1:1),g);return+(-(Z+(X-q)/(ue?q-oe:oe-q))||0)},a:function(z){return z<0?Math.ceil(z)||0:Math.floor(z)},p:function(z){return{M:g,y:_,w:p,d:f,D:T,h:u,m:c,s:l,ms:a,Q:v}[z]||String(z||"").toLowerCase().replace(/s$/,"")},u:function(z){return z===void 0}},E="en",I={};I[E]=C;var F="$isDayjsObject",k=function(z){return z instanceof re||!(!z||!z[F])},L=function z(j,X,Z){var q;if(!j)return E;if(typeof j=="string"){var ue=j.toLowerCase();I[ue]&&(q=ue),X&&(I[ue]=X,q=ue);var oe=j.split("-");if(!q&&oe.length>1)return z(oe[0])}else{var te=j.name;I[te]=j,q=te}return!Z&&q&&(E=q),q||!Z&&E},D=function(z,j){if(k(z))return z.clone();var X=typeof j=="object"?j:{};return X.date=z,X.args=arguments,new re(X)},ne=R;ne.l=L,ne.i=k,ne.w=function(z,j){return D(z,{locale:j.$L,utc:j.$u,x:j.$x,$offset:j.$offset})};var re=function(){function z(X){this.$L=L(X.locale,null,!0),this.parse(X),this.$x=this.$x||X.x||{},this[F]=!0}var j=z.prototype;return j.parse=function(X){this.$d=function(Z){var q=Z.date,ue=Z.utc;if(q===null)return new Date(NaN);if(ne.u(q))return new Date;if(q instanceof Date)return new Date(q);if(typeof q=="string"&&!/Z$/i.test(q)){var oe=q.match(S);if(oe){var te=oe[2]-1||0,le=(oe[7]||"0").substring(0,3);return ue?new Date(Date.UTC(oe[1],te,oe[3]||1,oe[4]||0,oe[5]||0,oe[6]||0,le)):new Date(oe[1],te,oe[3]||1,oe[4]||0,oe[5]||0,oe[6]||0,le)}}return new Date(q)}(X),this.init()},j.init=function(){var X=this.$d;this.$y=X.getFullYear(),this.$M=X.getMonth(),this.$D=X.getDate(),this.$W=X.getDay(),this.$H=X.getHours(),this.$m=X.getMinutes(),this.$s=X.getSeconds(),this.$ms=X.getMilliseconds()},j.$utils=function(){return ne},j.isValid=function(){return this.$d.toString()!==M},j.isSame=function(X,Z){var q=D(X);return this.startOf(Z)<=q&&q<=this.endOf(Z)},j.isAfter=function(X,Z){return D(X)<this.startOf(Z)},j.isBefore=function(X,Z){return this.endOf(Z)<D(X)},j.$g=function(X,Z,q){return ne.u(X)?this[Z]:this.set(q,X)},j.unix=function(){return Math.floor(this.valueOf()/1e3)},j.valueOf=function(){return this.$d.getTime()},j.startOf=function(X,Z){var q=this,ue=!!ne.u(Z)||Z,oe=ne.p(X),te=function(ve,de){var xe=ne.w(q.$u?Date.UTC(q.$y,de,ve):new Date(q.$y,de,ve),q);return ue?xe:xe.endOf(f)},le=function(ve,de){return ne.w(q.toDate()[ve].apply(q.toDate("s"),(ue?[0,0,0,0]:[23,59,59,999]).slice(de)),q)},Te=this.$W,K=this.$M,G=this.$D,U="set"+(this.$u?"UTC":"");switch(oe){case _:return ue?te(1,0):te(31,11);case g:return ue?te(1,K):te(0,K+1);case p:var N=this.$locale().weekStart||0,he=(Te<N?Te+7:Te)-N;return te(ue?G-he:G+(6-he),K);case f:case T:return le(U+"Hours",0);case u:return le(U+"Minutes",1);case c:return le(U+"Seconds",2);case l:return le(U+"Milliseconds",3);default:return this.clone()}},j.endOf=function(X){return this.startOf(X,!1)},j.$set=function(X,Z){var q,ue=ne.p(X),oe="set"+(this.$u?"UTC":""),te=(q={},q[f]=oe+"Date",q[T]=oe+"Date",q[g]=oe+"Month",q[_]=oe+"FullYear",q[u]=oe+"Hours",q[c]=oe+"Minutes",q[l]=oe+"Seconds",q[a]=oe+"Milliseconds",q)[ue],le=ue===f?this.$D+(Z-this.$W):Z;if(ue===g||ue===_){var Te=this.clone().set(T,1);Te.$d[te](le),Te.init(),this.$d=Te.set(T,Math.min(this.$D,Te.daysInMonth())).$d}else te&&this.$d[te](le);return this.init(),this},j.set=function(X,Z){return this.clone().$set(X,Z)},j.get=function(X){return this[ne.p(X)]()},j.add=function(X,Z){var q,ue=this;X=Number(X);var oe=ne.p(Z),te=function(K){var G=D(ue);return ne.w(G.date(G.date()+Math.round(K*X)),ue)};if(oe===g)return this.set(g,this.$M+X);if(oe===_)return this.set(_,this.$y+X);if(oe===f)return te(1);if(oe===p)return te(7);var le=(q={},q[c]=r,q[u]=n,q[l]=t,q)[oe]||1,Te=this.$d.getTime()+X*le;return ne.w(Te,this)},j.subtract=function(X,Z){return this.add(-1*X,Z)},j.format=function(X){var Z=this,q=this.$locale();if(!this.isValid())return q.invalidDate||M;var ue=X||"YYYY-MM-DDTHH:mm:ssZ",oe=ne.z(this),te=this.$H,le=this.$m,Te=this.$M,K=q.weekdays,G=q.months,U=q.meridiem,N=function(de,xe,ee,Ue){return de&&(de[xe]||de(Z,ue))||ee[xe].slice(0,Ue)},he=function(de){return ne.s(te%12||12,de,"0")},ve=U||function(de,xe,ee){var Ue=de<12?"AM":"PM";return ee?Ue.toLowerCase():Ue};return ue.replace(b,function(de,xe){return xe||function(ee){switch(ee){case"YY":return String(Z.$y).slice(-2);case"YYYY":return ne.s(Z.$y,4,"0");case"M":return Te+1;case"MM":return ne.s(Te+1,2,"0");case"MMM":return N(q.monthsShort,Te,G,3);case"MMMM":return N(G,Te);case"D":return Z.$D;case"DD":return ne.s(Z.$D,2,"0");case"d":return String(Z.$W);case"dd":return N(q.weekdaysMin,Z.$W,K,2);case"ddd":return N(q.weekdaysShort,Z.$W,K,3);case"dddd":return K[Z.$W];case"H":return String(te);case"HH":return ne.s(te,2,"0");case"h":return he(1);case"hh":return he(2);case"a":return ve(te,le,!0);case"A":return ve(te,le,!1);case"m":return String(le);case"mm":return ne.s(le,2,"0");case"s":return String(Z.$s);case"ss":return ne.s(Z.$s,2,"0");case"SSS":return ne.s(Z.$ms,3,"0");case"Z":return oe}return null}(de)||oe.replace(":","")})},j.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},j.diff=function(X,Z,q){var ue,oe=this,te=ne.p(Z),le=D(X),Te=(le.utcOffset()-this.utcOffset())*r,K=this-le,G=function(){return ne.m(oe,le)};switch(te){case _:ue=G()/12;break;case g:ue=G();break;case v:ue=G()/3;break;case p:ue=(K-Te)/6048e5;break;case f:ue=(K-Te)/864e5;break;case u:ue=K/n;break;case c:ue=K/r;break;case l:ue=K/t;break;default:ue=K}return q?ue:ne.a(ue)},j.daysInMonth=function(){return this.endOf(g).$D},j.$locale=function(){return I[this.$L]},j.locale=function(X,Z){if(!X)return this.$L;var q=this.clone(),ue=L(X,Z,!0);return ue&&(q.$L=ue),q},j.clone=function(){return ne.w(this.$d,this)},j.toDate=function(){return new Date(this.valueOf())},j.toJSON=function(){return this.isValid()?this.toISOString():null},j.toISOString=function(){return this.$d.toISOString()},j.toString=function(){return this.$d.toUTCString()},z}(),ce=re.prototype;return D.prototype=ce,[["$ms",a],["$s",l],["$m",c],["$H",u],["$W",f],["$M",g],["$y",_],["$D",T]].forEach(function(z){ce[z[1]]=function(j){return this.$g(j,z[0],z[1])}}),D.extend=function(z,j){return z.$i||(z(j,re,D),z.$i=!0),D},D.locale=L,D.isDayjs=k,D.unix=function(z){return D(1e3*z)},D.en=I[E],D.Ls=I,D.p={},D})})(dayjs_min);var dayjs_minExports=dayjs_min.exports;const dayjs=getDefaultExportFromCjs(dayjs_minExports);class PlaygroundPage extends Page{path="playground";id="playground";mesh=null;container=new Object3D;events=[{date:dayjs("2019-01-25")},{date:dayjs("2019-09-25")},{date:dayjs("2022-04-25")}];domEvents=[];preInit(){let e=this.domContainer;this.domMain=e.querySelector("#playground-main"),this.domInner=e.querySelector("#playground-main-inner"),this.domTimeline=e.querySelector("#playground-main-timeline"),this.domTimelineLine=e.querySelector("#playground-main-timeline-line"),this.domTimelineLineProgress=e.querySelector("#playground-main-timeline-line-progress");for(let t=0;t<this.events.length;t++){let r=document.createElement("div");r.classList.add("playground-main-timeline-event");let n=document.createElement("div");n.classList.add("playground-main-timeline-dot"),n.addEventListener("mouseenter",this._onDomDotMouseenter.bind(this)),n.addEventListener("mouseleave",this._onDomDotMouseleave.bind(this));let a=document.createElement("div");a.classList.add("playground-main-timeline-text"),a.innerHTML=this.events[t].date.format("YY MMMM'DD"),r.append(a),r.append(n),this.domTimeline.append(r),this.domEvents[t]=r}properties.loader.add(settings.MODEL_PATH+"playground/tunnel.buf",{onLoad:t=>{this._onTunnelLoad(t)}})}init(){this.domTimeline.addEventListener("click",this._onDomTimelineClick.bind(this))}resize(e,t){let r=Number(getComputedStyle(this.domMain).getPropertyValue("padding-left").split("px")[0]),n=this.events[this.events.length-1].date.diff(this.events[0].date,"day"),a=properties.viewportWidth-2*r;this.offsetRatio=r/properties.viewportWidth,this.domMain._height=this.domMain.getBoundingClientRect().height-properties.viewportHeight;for(let l=0;l<this.domEvents.length;l++){let c=this.domEvents[l],p=this.events[l].date.diff(this.events[0].date,"day")/n;c._ratio=math.fit(p,0,1,this.offsetRatio,1-this.offsetRatio),c.style.left=p*a+r+"px"}}update(e){super.update(e);let t=scrollManager.getDomRange(this.domContainer),r=math.fit(t.screenRatio,-.5,.5,0,1);if(r<1){this.domInner.style.transform=`translate3d(0, ${-scrollManager.y}px, 0)`,this.domTimelineLineProgress.style.transform=`scale3d(${r}, 1, 1)`;for(let n=0;n<this.domEvents.length;n++){let a=this.domEvents[n];r>=a._ratio?a.classList.add("--active"):a.classList.remove("--active")}}}_onTunnelLoad(e){this.mesh=new Mesh(e,new MeshNormalMaterial),this.container.add(this.mesh)}_onDomTimelineClick(e){let t=e.clientX/properties.viewportWidth;scrollManager.scrollToPixel(t*this.domMain._height)}_onDomDotMouseenter(e){e.target.closest(".playground-main-timeline-event").classList.add("--hover")}_onDomDotMouseleave(e){e.target.closest(".playground-main-timeline-event").classList.remove("--hover")}}const playgroundPage=new PlaygroundPage;var FLUID_CELL=0,AIR_CELL=1,SOLID_CELL=2,EMIT_RATE=2e3;let _v0=new Vector2,_v1=new Vector2,_v2=new Vector2;function clamp(o,e,t){return o<e?e:o>t?t:o}class FlipSim{constructor(){this.isFlushing=!1,this.hasInitialized=!1,this.emitterPosA=new Vector2(1,1),this.emitterPosB=new Vector2(1,1),this.colliderRectList=[]}addColliderRect=(e,t=0,r=0,n=0,a=0)=>{let l=this.fInvSpacing,c=this.fNumY,u=clamp(Math.round(e.x*l)-t,0,this.fNumX-1),f=clamp(Math.round(e.y*l)-a,0,this.fNumY-1),p=clamp(Math.round((e.x+e.w)*l)+r,0,this.fNumX-1),g=clamp(Math.round((e.y+e.h)*l)+n,0,this.fNumY-1);p=Math.max(u,p),g=Math.max(f,g),this.colliderRectList.push(e);for(let _=u;_<=p;_++)for(let T=f;T<=g;T++){var v=_*c+T;this.s[v]=0}e.x=u/l,e.y=f/l,e.w=Math.max(1,p-u)/l,e.h=Math.max(1,g-f)/l,e.l=e.x,e.r=e.x+e.w,e.b=e.y,e.t=e.y+e.h,e.hw=e.w/2,e.hh=e.h/2,e.cx=e.x+e.hw,e.cy=e.y+e.hh};init(e,t,r,n,a,l){let c=this.hasInitialized;this.colliderRectList.length=0,this.density=e,this.fNumX=Math.ceil(t/n)+1,this.fNumY=Math.ceil(r/n)+1,this.h=Math.max(t/this.fNumX,r/this.fNumY),this.fInvSpacing=1/this.h;var u=this.fNumX*this.fNumY;this.tankInnerWidth=(this.fNumX-2)*this.h,this.tankInnerHeight=(this.fNumY-2)*this.h,(!c||u>this.cellType.length)&&(this.u=new Float32Array(u),this.v=new Float32Array(u),this.du=new Float32Array(u),this.dv=new Float32Array(u),this.prevU=new Float32Array(u),this.prevV=new Float32Array(u),this.p=new Int8Array(u),this.s=new Int8Array(u),this.cellType=new Int8Array(u),this.particleDensity=new Float32Array(u)),this.fNumCells=u;for(var f=0;f<u;f++)this.u[f]=this.v[f]=this.du[f]=this.dv[f]=this.prevU[f]=this.prevV[f]=this.p[f]=this.s[f]=this.cellType[f]=this.particleDensity[f]=0;this.particleRadius=a,this.pInvSpacing=1/(2.2*a),this.pNumX=Math.floor(t*this.pInvSpacing)+1,this.pNumY=Math.floor(r*this.pInvSpacing)+1,this.particleRestDensity=0;let p=this.pNumX*this.pNumY;if(!c||p>this.numCellParticles.length)this.numCellParticles=new Uint32Array(p),this.firstCellParticle=new Uint32Array(p+1);else{for(var f=0;f<p;f++)this.numCellParticles[f]=0,this.firstCellParticle[f]=0;this.firstCellParticle[p]=0}this.pNumCells=p,this.particlePosOut=new Float32Array(2*l),this.particlePos=new Float32Array(2*l),this.particleInfo=new Float32Array(2*l),(!c||l>this.particleDir.length/2)&&(this.particleDir=new Float32Array(2*l),this.particlePrevPos=new Float32Array(2*l),this.particleVel=new Float32Array(2*l),this.cellParticleIds=new Uint32Array(l),this.particleStatuses=new Uint8Array(l));for(var f=0;f<l;f++)this.particlePos[f*2+0]=-1e4,this.particlePos[f*2+1]=0,this.particlePosOut[f*2+0]=-1e4,this.particlePosOut[f*2+1]=0,this.particleInfo[f*2+0]=0,this.particleInfo[f*2+1]=0,this.particleDir[f*2+0]=0,this.particleDir[f*2+1]=0,this.particlePrevPos[f*2+0]=-1e4,this.particlePrevPos[f*2+1]=0,this.particleVel[f*2+0]=0,this.particleVel[f*2+1]=0,this.cellParticleIds[f]=0,this.particleStatuses[f]=0;this.numParticles=l;for(var g=this.fNumY,f=0;f<this.fNumX;f++)for(var v=0;v<this.fNumY;v++){var _=0;f>0&&f<this.fNumX-1&&v>0&&v<this.fNumY-1&&(_=1),this.s[f*g+v]=_}this.hasInitialized=!0}integrateParticles(e,t){for(var r=0;r<this.numParticles;r++)this.particleStatuses[r]&&(this.particleVel[2*r+1]+=e*t,this.particlePos[2*r]+=this.particleVel[2*r]*e,this.particlePos[2*r+1]+=this.particleVel[2*r+1]*e)}pushParticlesApart(e){this.numCellParticles.fill(0);for(var t=0;t<this.numParticles;t++)if(this.particleStatuses[t]){var r=this.particlePos[2*t],n=this.particlePos[2*t+1],a=clamp(Math.floor(r*this.pInvSpacing),0,this.pNumX-1),l=clamp(Math.floor(n*this.pInvSpacing),0,this.pNumY-1),c=a*this.pNumY+l;this.numCellParticles[c]++}for(var u=0,t=0;t<this.pNumCells;t++)u+=this.numCellParticles[t],this.firstCellParticle[t]=u;this.firstCellParticle[this.pNumCells]=u;for(var t=0;t<this.numParticles;t++)if(this.particleStatuses[t]){var r=this.particlePos[2*t],n=this.particlePos[2*t+1],a=clamp(Math.floor(r*this.pInvSpacing),0,this.pNumX-1),l=clamp(Math.floor(n*this.pInvSpacing),0,this.pNumY-1),c=a*this.pNumY+l;this.firstCellParticle[c]--,this.cellParticleIds[this.firstCellParticle[c]]=t}for(var f=3*this.particleRadius,p=f*f,g=0;g<e;g++)for(var t=0;t<this.numParticles;t++)if(this.particleStatuses[t])for(var v=this.particlePos[2*t],_=this.particlePos[2*t+1],T=Math.floor(v*this.pInvSpacing),M=Math.floor(_*this.pInvSpacing),S=Math.max(T-1,0),b=Math.max(M-1,0),C=Math.min(T+1,this.pNumX-1),w=Math.min(M+1,this.pNumY-1),a=S;a<=C;a++)for(var l=b;l<=w;l++)for(var c=a*this.pNumY+l,u=this.firstCellParticle[c],R=this.firstCellParticle[c+1],E=u;E<R;E++){var I=this.cellParticleIds[E];if(I!=t&&this.particleStatuses[I]){var F=this.particlePos[2*I],k=this.particlePos[2*I+1],L=F-v,D=k-_,ne=L*L+D*D;if(!(ne>p||ne==0)){var re=Math.sqrt(ne),ce=.5*(f-re)/re;L*=ce,D*=ce,this.particlePos[2*t]-=L,this.particlePos[2*t+1]-=D,this.particlePos[2*I]+=L,this.particlePos[2*I+1]+=D}}}}handleParticleCollisions(e,t,r,n,a,l){for(var c=1/this.fInvSpacing,u=this.particleRadius,f=n+u,p=f*f,g=c+u,v=(this.fNumX-1)*c-u,_=c+u,T=(this.fNumY-1)*c-u,M=this.isFlushing,S=0;S<this.numParticles;S++)if(this.particleStatuses[S]){var b=this.particlePos[2*S],C=this.particlePos[2*S+1],w=b-t,R=C-r,E=w*w+R*R;if(E<p){var I=Math.sqrt(E),F=(f-I)/I;b+=w*F,C+=R*F,this.particleVel[2*S]=a*2,this.particleVel[2*S+1]=l*2}let k=b-this.particlePrevPos[2*S],L=C-this.particlePrevPos[2*S+1],D=Math.sqrt(k*k+L*L);if(D>0){let ne=k/D,re=L/D,ce=1/(Math.abs(ne)>1e-4?ne:1e-4),z=1/(Math.abs(re)>1e-4?re:1e-4);for(let j=0;j<this.colliderRectList.length;j++){let X=this.colliderRectList[j];if(b>X.l&&b<X.r&&C>X.b&&C<X.t){let Z=b-X.cx,q=C-X.cy,ue=Z*ce,oe=q*z,te=Math.abs(ce)*X.hw,le=Math.abs(z)*X.hh,Te=Math.max(-ue-te,-oe-le);b=b+ne*Te,C=C+re*Te}}}b<g&&(b=g,this.particleVel[2*S]=0),b>v&&(b=v,this.particleVel[2*S]=0),C<_&&(M?(b=-1e4,C=0,this.particleStatuses[S]=0):(C=_,this.particleVel[2*S+1]=0)),C>T&&(C=T,this.particleVel[2*S+1]=0),this.particlePos[2*S]=b,this.particlePos[2*S+1]=C}for(var S=0;S<this.numParticles;S++){_v0.fromArray(this.particleVel,2*S);let L=_v0.length();if(L>1e-5){_v2.fromArray(this.particleDir,2*S),_v1.fromArray(this.particleInfo,2*S),_v1.y=math.mix(_v1.y,0,1-Math.exp(-4*e)),_v0.multiplyScalar(1/L);let D=Math.atan2(_v0.y,_v0.x),ne=Math.atan2(_v2.y,_v2.x);_v1.y+=L*math.normalizeAngle(D-ne),_v1.x+=_v1.y*e,_v1.toArray(this.particleInfo,2*S),_v2.toArray(this.particleDir,2*S)}this.particlePrevPos[2*S]=this.particlePos[2*S],this.particlePrevPos[2*S+1]=this.particlePos[2*S+1]}}updateParticleDensity(){var e=this.fNumY,t=this.h,r=this.fInvSpacing,n=.5*t,a=this.particleDensity;a.fill(0);for(var l=0;l<this.numParticles;l++)if(this.particleStatuses[l]){var c=this.particlePos[2*l],u=this.particlePos[2*l+1];c=clamp(c,t,(this.fNumX-1)*t),u=clamp(u,t,(this.fNumY-1)*t);var f=Math.floor((c-n)*r),p=(c-n-f*t)*r,g=Math.min(f+1,this.fNumX-2),v=Math.floor((u-n)*r),_=(u-n-v*t)*r,T=Math.min(v+1,this.fNumY-2),M=1-p,S=1-_;f<this.fNumX&&v<this.fNumY&&(a[f*e+v]+=M*S),g<this.fNumX&&v<this.fNumY&&(a[g*e+v]+=p*S),g<this.fNumX&&T<this.fNumY&&(a[g*e+T]+=p*_),f<this.fNumX&&T<this.fNumY&&(a[f*e+T]+=M*_)}if(this.particleRestDensity==0){for(var b=0,C=0,l=0;l<this.fNumCells;l++)this.cellType[l]==FLUID_CELL&&(b+=a[l],C++);C>0&&(this.particleRestDensity=b/C)}}transferVelocities(e,t){var r=this.fNumY,n=this.h,a=this.fInvSpacing,l=.5*n;if(e){this.prevU.set(this.u),this.prevV.set(this.v),this.du.fill(0),this.dv.fill(0),this.u.fill(0),this.v.fill(0);for(var c=0;c<this.fNumCells;c++)this.cellType[c]=this.s[c]==0?SOLID_CELL:AIR_CELL;for(var c=0;c<this.numParticles;c++)if(this.particleStatuses[c]){var u=this.particlePos[2*c],f=this.particlePos[2*c+1],p=clamp(Math.floor(u*a),0,this.fNumX-1),g=clamp(Math.floor(f*a),0,this.fNumY-1),v=p*r+g;this.cellType[v]==AIR_CELL&&(this.cellType[v]=FLUID_CELL)}}for(var _=0;_<2;_++){for(var T=_==0?0:l,M=_==0?l:0,S=_==0?this.u:this.v,b=_==0?this.prevU:this.prevV,C=_==0?this.du:this.dv,c=0;c<this.numParticles;c++)if(this.particleStatuses[c]){var u=this.particlePos[2*c],f=this.particlePos[2*c+1];u=clamp(u,n,(this.fNumX-1)*n),f=clamp(f,n,(this.fNumY-1)*n);var w=Math.min(Math.floor((u-T)*a),this.fNumX-2),R=(u-T-w*n)*a,E=Math.min(w+1,this.fNumX-2),I=Math.min(Math.floor((f-M)*a),this.fNumY-2),F=(f-M-I*n)*a,k=Math.min(I+1,this.fNumY-2),L=1-R,D=1-F,ne=L*D,re=R*D,ce=R*F,z=L*F,j=w*r+I,X=E*r+I,Z=E*r+k,q=w*r+k;if(e){var ue=this.particleVel[2*c+_];S[j]+=ue*ne,C[j]+=ne,S[X]+=ue*re,C[X]+=re,S[Z]+=ue*ce,C[Z]+=ce,S[q]+=ue*z,C[q]+=z}else{var oe=_==0?r:1,te=this.cellType[j]!=AIR_CELL||this.cellType[j-oe]!=AIR_CELL?1:0,le=this.cellType[X]!=AIR_CELL||this.cellType[X-oe]!=AIR_CELL?1:0,Te=this.cellType[Z]!=AIR_CELL||this.cellType[Z-oe]!=AIR_CELL?1:0,K=this.cellType[q]!=AIR_CELL||this.cellType[q-oe]!=AIR_CELL?1:0,G=this.particleVel[2*c+_],C=te*ne+le*re+Te*ce+K*z;if(C>0){var U=(te*ne*S[j]+le*re*S[X]+Te*ce*S[Z]+K*z*S[q])/C,N=(te*ne*(S[j]-b[j])+le*re*(S[X]-b[X])+Te*ce*(S[Z]-b[Z])+K*z*(S[q]-b[q]))/C,he=G+N;this.particleVel[2*c+_]=(1-t)*U+t*he}}}if(e){for(var c=0;c<S.length;c++)C[c]>0&&(S[c]/=C[c]);for(var c=0;c<this.fNumX;c++)for(var ve=0;ve<this.fNumY;ve++){var de=this.cellType[c*r+ve]==SOLID_CELL;(de||c>0&&this.cellType[(c-1)*r+ve]==SOLID_CELL)&&(this.u[c*r+ve]=this.prevU[c*r+ve]),(de||ve>0&&this.cellType[c*r+ve-1]==SOLID_CELL)&&(this.v[c*r+ve]=this.prevV[c*r+ve])}}}}solveIncompressibility(e,t,r,n=!0){this.p.fill(0),this.prevU.set(this.u),this.prevV.set(this.v);for(var a=this.fNumY,l=this.density*this.h/t,c=0;c<this.fNumCells;c++)this.u[c],this.v[c];for(var u=0;u<e;u++)for(var c=1;c<this.fNumX-1;c++)for(var f=1;f<this.fNumY-1;f++)if(this.cellType[c*a+f]==FLUID_CELL){var p=c*a+f,g=(c-1)*a+f,v=(c+1)*a+f,_=c*a+f-1,T=c*a+f+1,w=this.s[p],M=this.s[g],S=this.s[v],b=this.s[_],C=this.s[T],w=M+S+b+C;if(w!=0){var R=this.u[v]-this.u[p]+this.v[T]-this.v[p];if(this.particleRestDensity>0&&n){var E=.5,I=this.particleDensity[c*a+f]-this.particleRestDensity;I>0&&(R=R-E*I)}var F=-R/w;F*=r,this.p[p]+=l*F,this.u[p]-=M*F,this.u[v]+=S*F,this.v[p]-=b*F,this.v[T]+=C*F}}}resetParticles(){}simulate(e,t,r,n,a,l,c,u,f,p,g,v,_){e=Math.min(e,1/60);var T=1,M=e/T;let S=Math.ceil(EMIT_RATE*e),b=0;for(var C=0;C<T;C++){for(let R=0;R<this.numParticles&&!(b/T>=S);R++)if(this.particleStatuses[R]==0){let E=Math.random();this.particlePos[2*R+0]=this.particlePrevPos[2*R+0]=this.particlePosOut[2*R+0]=math.mix(this.emitterPosA.x,this.emitterPosB.x,E)+(Math.random()-.5)*.01,this.particlePos[2*R+1]=this.particlePrevPos[2*R+1]=this.particlePosOut[2*R+1]=math.mix(this.emitterPosA.y,this.emitterPosB.y,E)+(Math.random()-.5)*.01,this.particleInfo[2*R+0]=Math.random()*Math.PI*2,this.particleInfo[2*R+1]=0,this.particleDir[2*R+0]=0,this.particleDir[2*R+1]=-1;let I=(2+Math.pow(Math.random(),2)*3)*t*.1;this.particleVel[R*2+0]=0,this.particleVel[R*2+1]=I,this.particleStatuses[R]=1,b++}this.integrateParticles(M,t),u&&this.pushParticlesApart(a),this.handleParticleCollisions(M,f,p,g,v,_),this.transferVelocities(!0),this.updateParticleDensity(),this.solveIncompressibility(n,M,l,c),this.transferVelocities(!1,r);for(var w=0;w<this.numParticles;w++)this.particlePosOut[2*w]=this.particlePos[2*w]+(this.particlePosOut[2*w]-this.particlePrevPos[2*w])*.5,this.particlePosOut[2*w+1]=this.particlePos[2*w+1]+(this.particlePosOut[2*w+1]-this.particlePrevPos[2*w+1])*.5}}}const flipSim=new FlipSim,vert=`#define GLSLIFY 1
attribute vec2 instancedPos;attribute vec2 instancedInfo;uniform vec2 u_tankOffset;uniform vec2 u_tankSize;uniform vec2 u_tankActualSize;uniform vec2 u_renderScale;uniform float u_radius;uniform float u_opacity;
#include <ufxVert>
#ifdef IS_TEXTURE
attribute vec4 instanceColorShape;varying vec3 v_color;varying vec3 v_colorMix;varying vec2 v_uv;
#endif
void main(){float angle=instancedInfo.x;float s=sin(angle);float c=cos(angle);mat2 m=mat2(c,-s,s,c);vec3 basePos=vec3((instancedPos-u_tankOffset)/u_tankActualSize-vec2(.5),0.0);basePos.y=-basePos.y;basePos.xy*=u_renderScale*2.;float particleSize=1.;
#ifdef IS_TEXTURE
float colorFract=fract(instanceColorShape.w/3.);v_color=instanceColorShape.rgb;v_colorMix=vec3(colorFract<0.25 ? 1. : 0.,abs(colorFract-.5)<0.25 ? 1. : 0.,colorFract>0.75 ? 1. : 0.);v_uv=uv;v_uv.x=(v_uv.x+floor(instanceColorShape.w/3.))/8.;
#else
particleSize+=min(1.,abs(instancedInfo.y)*0.01);
#endif
vec3 screenPos=getScreenPosition(basePos);screenPos.xy+=(m*position.xy)*u_radius*particleSize*u_renderScale.x*2.*u_opacity;gl_Position=projectionMatrix*modelViewMatrix*vec4(screenPos,1.0);}`,frag$3=`#define GLSLIFY 1
#ifdef IS_TEXTURE
uniform sampler2D u_texture;varying vec3 v_color;varying vec3 v_colorMix;varying vec2 v_uv;
#else
uniform vec3 u_color;
#endif
void main(){
#ifdef IS_TEXTURE
float a=dot(v_colorMix,texture2D(u_texture,v_uv).rgb);gl_FragColor=vec4(v_color,a);
#else
gl_FragColor=vec4(u_color,1.);
#endif
}`;let COLORS=["#ff383c","#0029ff","#bb2bff","#1eff5d","#cfff0f","#d6e4ec","#bbcbda","#7a8d9b","#262229"];class FlipAnimation{PRESSURE_ITERATION=60;NUM_PARTICLES_ITERS=4;OVER_RELAXATION=1;FLIP_RATIO=0;mesh;meshList=[];top=0;height=0;gravity=0;isActive=!1;needsReset=!1;hasDown=!1;prevViewportWidth=0;prevViewportHeight=0;opacity=1;colorHex;container=new Object3D;shapedContainer=new Object3D;texturedContainer=new Object3D;prevUseTextured=null;useTextured=!0;sharedUniforms={u_tankOffset:{value:new Vector2},u_tankSize:{value:new Vector2},u_tankActualSize:{value:new Vector2},u_radius:{value:0},u_opacity:{value:0},u_renderScale:{value:new Vector2},u_color:{value:new Color("#1A2FFB")},u_texture:{value:null}};preInit(){let e=[];for(let n=0;n<COLORS.length;n++)COLORS[n]=new Color(COLORS[n]);let t=new BufferGeometry;t.setAttribute("position",new BufferAttribute(new Float32Array([.0714286,-.5,0,-.0714286,-.5,0,.5,-.0714286,0,.0714286,-.0714286,0,-.0714286,-.0714286,0,-.5,-.0714286,0,.5,.0714286,0,.0714286,.0714286,0,-.0714286,.0714286,0,-.5,.0714286,0,.0714286,.5,0,-.0714286,.5,0]),3)),t.setIndex(new BufferAttribute(new Uint8Array([4,5,9,0,4,3,8,7,3,7,2,3,7,6,2,11,10,7,7,8,11,3,4,8,0,1,4,4,9,8]),1)),e.push(t),e.push(new PlaneGeometry(.8,.8)),e.push(new CircleGeometry(.4,10)),e.push(new CircleGeometry(.5,3)),e.push(new PlaneGeometry(1.6,1.6));let r=properties.loader.add(settings.TEXTURE_PATH+"flip_texture.png",{type:"texture"}).content;this.sharedUniforms.u_texture.value=r;for(let n=0;n<e.length;n++){let a=e[n],l=new InstancedBufferGeometry;for(let u in a.attributes)l.setAttribute(u,a.attributes[u]);l.index=a.index;let c=new UfxMesh({geometry:l,material:new ShaderMaterial({uniforms:this.sharedUniforms,vertexShader:vert,fragmentShader:frag$3,depthWrite:!1,depthTest:!1,side:DoubleSide})});c.material.extensions.derivatives=!0,c.frustumCulled=!1,n<e.length-1?this.shapedContainer.add(c):(this.texturedContainer.add(c),c.material.defines.IS_TEXTURE=!0,c.material.transparent=!0),this.meshList.push(c)}this.container.add(this.shapedContainer),this.container.add(this.texturedContainer),pageExtraSections.postUfxContainer.add(this.container)}init(){}reInitTank(){let e=properties.viewportWidth,t=properties.viewportHeight;scrollManager.syncDom(),this.capturedOffsetY=-scrollManager.scrollPixel+endSection.offsetY;let r=document.querySelector("#end-section-outer").getBoundingClientRect().top-this.capturedOffsetY,n=document.querySelector("#end-section-outer").getBoundingClientRect().bottom-this.capturedOffsetY,a=this.prevViewportWidth!=e||this.prevViewportHeight!=t||!flipSim.hasInitialized||this.prevUseTextured!==this.useTextured;this.prevUseTextured=this.useTextured,a&&(this.prevViewportWidth=properties.viewportWidth,this.prevViewportHeight=properties.viewportHeight);var l=2,c=l*t/e;let u=this.useTextured?.4:1;var f=Math.ceil(math.fit(e,320,2560,20,90)*u),p=this.tankWidth=1*l,g=this.tankHeight=1*c,v=p/f,_=1;this.gravity=Math.ceil(math.fit(e,320,2560,-15,-3))*(this.useTextured?1.5:1);var T=.2*v,M=Math.ceil(math.fit(e,320,2560,20,80)*u),S=Math.ceil(M*t/e),b=Math.ceil(M*S/(this.meshList.length-1))*(this.meshList.length-1);a&&flipSim.init(_,p,g,v,T,b),this.sharedUniforms.u_tankOffset.value.set(flipSim.h,flipSim.h),this.sharedUniforms.u_tankSize.value.set(p,g),this.sharedUniforms.u_tankActualSize.value.set(flipSim.tankInnerWidth,flipSim.tankInnerHeight),this.sharedUniforms.u_radius.value=T,this.sharedUniforms.u_renderScale.value.set(e/p,e/p*flipSim.tankInnerHeight/flipSim.tankInnerWidth);let C=r+n>>1,w=e,R=flipSim.tankInnerHeight/flipSim.tankInnerWidth*w;r=C-R/2,n=C+R/2,this.top=r,this.height=R;let E=flipSim.particlePosOut.length/2,I=Math.floor(E/(this.meshList.length-1)),F=0;for(let k=0;k<this.meshList.length;k++){let L=this.meshList[k];if(a){let D;if(k<this.meshList.length-1)D=new InstancedInterleavedBuffer(flipSim.particlePosOut,2,4),L.geometry.setAttribute("instancedPos",new InterleavedBufferAttribute(D,2,F*2)),L.geometry.attributes.instancedPos.usage=DynamicDrawUsage,D.count/=4,D=new InstancedInterleavedBuffer(flipSim.particleInfo,2,4),L.geometry.setAttribute("instancedInfo",new InterleavedBufferAttribute(D,2,F*2)),L.geometry.attributes.instancedInfo.usage=DynamicDrawUsage,D.count/=4,F+=I;else{L.geometry.setAttribute("instancedPos",new InstancedBufferAttribute(flipSim.particlePosOut,2)),L.geometry.attributes.instancedPos.usage=DynamicDrawUsage,L.geometry.setAttribute("instancedInfo",new InstancedBufferAttribute(flipSim.particleInfo,2)),L.geometry.attributes.instancedInfo.usage=DynamicDrawUsage;let ne=flipSim.particlePosOut.length/2,re=new Float32Array(ne*4);for(let ce=0,z=0;ce<ne;ce++,z+=4){let j=ce%45;j=j<5?j:5+(j-5)%4;let X=COLORS[j];re[z+0]=X.r,re[z+1]=X.g,re[z+2]=X.b,re[z+3]=~~(ce/23)%23}L.geometry.setAttribute("instanceColorShape",new InstancedBufferAttribute(re,4))}L.geometry._maxInstanceCount=flipSim.maxParticles}L.syncRect(0,r+this.capturedOffsetY,e,R,this.capturedOffsetY)}if(a&&!this.useTextured){let k=document.querySelector("#end-bottom");flipSim.addColliderRect(this.convertDomRectToTankRect(k.getBoundingClientRect()),-1,-1,-1,-1)}this.hasDown=!1}resize(){this.isActive&&this.meshList.length>0?this.reInitTank():this.needsReset=!0,this.hasDown=!1}convertDomRectToTankRect(e){let t=this.convertPixelXYToTankXY(e.left,e.bottom),r=this.convertPixelSizeToTankSize(e.width,e.height);return{x:t.x,y:t.y,w:r.w,h:r.h}}convertPixelSizeToTankSize(e,t){return{w:e/properties.viewportWidth*flipSim.tankInnerWidth,h:t/this.height*flipSim.tankInnerHeight}}convertPixelXYToTankXY(e,t){let r=this.convertPixelSizeToTankSize(math.clamp(e,0,properties.viewportWidth-1),math.clamp(this.top+this.height-t-scrollManager.scrollPixel+endSection.offsetY,0,properties.viewportHeight-1));return{x:r.w+flipSim.h,y:r.h+flipSim.h}}update(e){if(this.isActive){if((this.needsReset||this.prevUseTextured!==this.useTextured)&&(this.needsReset=!1,this.reInitTank()),properties.hasInitialized){this.useTextured?(this.shapedContainer.visible=!1,this.texturedContainer.visible=!0):(this.shapedContainer.visible=!0,this.texturedContainer.visible=!1);let t=-scrollManager.scrollPixel+endSection.offsetY;if(this.sharedUniforms.u_color.value.setStyle(this.colorHex),this.sharedUniforms.u_opacity.value=this.opacity,this.meshList[0].testViewport(t)){e=Math.max(1/120,e);let r=!0,n=!0,a=this.convertPixelXYToTankXY(input.prevMousePixelXY.x,input.prevMousePixelXY.y),l=this.convertPixelXYToTankXY(input.mousePixelXY.x,input.mousePixelXY.y),c=l.x,u=l.y,f=(l.x-a.x)/e,p=(l.y-a.y)/e,g=150/properties.viewportWidth*(properties.useMobileLayout?input.isDown?.35:0:math.fit(Math.sqrt(f*f+p*p),0,2,.2,1));input.isDown&&!properties.useMobileLayout?(c=-1e3,u=-1e3,this.hasDown=!0,flipSim.isFlushing=!0,flipSim.emitterPosA.copy(this.convertPixelXYToTankXY(input.prevMousePixelXY.x,input.prevMousePixelXY.y)),flipSim.emitterPosB.copy(this.convertPixelXYToTankXY(input.mousePixelXY.x,input.mousePixelXY.y))):(this.hasDown||flipSim.emitterPosA.copy(flipSim.emitterPosB.set(1,this.tankHeight*.5,0)),flipSim.isFlushing=!1),flipSim.simulate(e,this.gravity,this.FLIP_RATIO,this.PRESSURE_ITERATION,this.NUM_PARTICLES_ITERS,this.OVER_RELAXATION,r,n,c,u,g,f,p);for(let v=0;v<this.meshList.length;v++){let _=this.meshList[v];_.geometry.attributes.instancedPos.needsUpdate=!0,_.geometry.attributes.instancedInfo.needsUpdate=!0,_.update(t),_.visible=!0}}else for(let r=0;r<this.meshList.length;r++){let n=this.meshList[r];n.visible=!1}}}else{this.needsReset=!0;for(let t=0;t<this.meshList.length;t++){let r=this.meshList[t];r.visible=!1}}}}const flipAnimation=new FlipAnimation;class EndSection{domContainer;offsetY=0;_needsReset=!0;ROLLUP_ANIMATION_DURATION=1;ROLLUP_ANIMATION_INTERVAL=2;activeRatio=0;hoverRatio=0;time=0;isHover=!1;preInit(){this.domContainer=document.getElementById("end-section"),this.outerContainer=document.getElementById("end-section-outer"),this.domContent=document.getElementById("end-section-content"),this.domTitle=document.getElementById("end-section-title"),this.domTitleLink=document.getElementById("end-section-title-link"),this.domTitleTopDecoration=document.getElementById("end-section-title-top-decoration"),this.domTitleBottomLeftDecoration=document.getElementById("end-section-title-bottom-left-decoration"),this.domTitleBottomRightDecoration=document.getElementById("end-section-title-bottom-right-decoration"),this.domSubtitle=document.getElementById("end-section-subtitle-text"),this.domButton=document.getElementById("end-bottom"),this.domCrosses=Array.from(document.querySelectorAll(".end-section-content-cross")),flipAnimation.preInit()}init(){flipAnimation.init(),properties.useMobileLayout||(this.domTitle.addEventListener("mouseenter",this._onDomTitleMouseenter.bind(this)),this.domTitle.addEventListener("mouseleave",this._onDomTitleMouseleave.bind(this)))}resize(e,t){this.domContent.style.transform="translate3d(-50%,-50%,0) scale3d(1,1,1)",this._splitText(),this._needsReset=!0}update(e){let t=scrollManager.getDomRange(this.domContainer),r=t.isActive;pagesManager.scrollTargetPage&&(flipAnimation.isActive=pagesManager.scrollTargetPage.hasEndVisual,flipAnimation.colorHex=pagesManager.scrollTargetPage.endVisualColor,flipAnimation.useTextured=pagesManager.scrollTargetPage.endVisualUseTextured,flipAnimation.container.visible=flipAnimation.isActive,flipAnimation.opacity=math.fit(pagesManager.scrollTargetPage.hideRatio,0,.3,1,0));let n=math.fit(t.hideScreenOffset,-.75,0,0,1),a=math.mix(1,.9,n);if(this.offsetY=Math.max(0,-t.screenY),this.outerContainer.style.transform=`translate3d(0, ${this.offsetY-Math.max(0,t.hideScreenOffset)*properties.viewportHeight}px, 0)`,this.domContent.style.transform=`translate3d(-50%,-50%,0) scale3d(${a}, ${a}, ${a})`,r){this._needsReset&&this._reset();let l=pagesManager.scrollTargetPage?pagesManager.scrollTargetPage.endSectionActiveThreshold:1,c=t.showScreenOffset>l,u=this.time;this.activeRatio=math.saturate(this.activeRatio+(c?e:-e)),this.hoverRatio=math.saturate(this.hoverRatio+(this.isHover&&this.activeRatio==1?e:-e)),this.time+=e;let f=u%this.ROLLUP_ANIMATION_INTERVAL,p=this.time%this.ROLLUP_ANIMATION_INTERVAL;this.domTitle.style.pointerEvents=c&&this.activeRatio>.75?"auto":"none";for(let v=0;v<this.domCrosses.length;v++){let _=v/(this.domCrosses.length-1),T=math.fit(this.activeRatio,_*.2,_*.2+.7,0,1,ease.lusion),M=this.domCrosses[v],S=math.fit(T,0,1,0,1,ease.lusion),b=math.fit(T,0,1,0,180,ease.lusion);M.style.transform=`scale(${S}) rotate(${b}deg)`}if(!properties.useMobileLayout)for(let v=0;v<this.domSubtitle._splitted.words.length;v++){let _=this.domSubtitle._splitted.words[v],T=v/(this.domSubtitle._splitted.words.length-1),M=math.fit(this.activeRatio,T*.15,T*.15+.75,200,0,ease.lusion),S=math.fit(this.activeRatio,T*.1,T*.1+.8,30,0,ease.lusion);_.style.transform=`translate3d(0, ${M}%, 0) rotate(${S}deg)`}for(let v=0;v<this.domTitleLink._splitted.words.length;v++){let _=this.domTitleLink._splitted.words[v],T=v/(this.domTitleLink._splitted.words.length-1);f>p&&(_._randCharIndex=Math.floor(Math.random()*_._chars.length),_._ratio==0&&(_._ratio=.001)),_._ratio>0&&(_._ratio=math.saturate(_._ratio+(c?e/this.ROLLUP_ANIMATION_DURATION:-e*2)),_._ratio==1&&(_._ratio=0));for(let M=0;M<_._chars.length;M++){let S=_._chars[M],b=M/(_._chars.length-1),C=properties.viewportWidth>=settings.MOBILE_WIDTH?math.fit(this.activeRatio,T*.15+b*.15,T*.15+b*.15+.7,100,0,ease.lusion):0;M===_._randCharIndex?S._wrapper.style.transform=`translate3d(0, ${math.fit(_._ratio,T*.2,T*.2+.8,0,-100,ease.lusion)}%, 0)`:S._wrapper.style.transform="translateZ(0)",S.style.transform=`translate3d(0, ${C}%, 0)`}}this.domTitleTopDecoration.style.transform=`scale3d(${math.fit(this.hoverRatio,0,.7,0,1,ease.cubicInOut)}, 1, 1)`;let g=math.fit(this.hoverRatio,.2,1,0,1,ease.cubicInOut);this.domTitleBottomLeftDecoration.style.transform=`scale3d(${math.fit(g,0,.35,0,1)}, 1, 1)`,this.domTitleBottomRightDecoration.style.transform=`scale3d(${math.fit(g,.4,1,0,1)}, 1, 1)`}else this._needsReset=!0,flipAnimation.isActive=!1;flipAnimation.update(e)}_splitText(){if(properties.useMobileLayout)this.domSubtitle._splitted&&this.domSubtitle._splitted.revert();else{this.domSubtitle._splitted=new SplitType(this.domSubtitle,{types:"lines, words"});for(let e=0;e<this.domSubtitle._splitted.lines.length;e++){let t=this.domSubtitle._splitted.lines[e],r=document.createElement("div");r.style.position="relative",r.style.overflow="hidden",r.append(t),this.domSubtitle.append(r)}}this.domTitleLink._splitted=new SplitType(this.domTitleLink,{types:"lines, words",lineClass:"end-section-title-link-line",wordClass:"end-section-title-link-word"});for(let e=0;e<this.domTitleLink._splitted.lines.length;e++){let t=this.domTitleLink._splitted.lines[e];e===0?t.append(this.domTitleTopDecoration):(t.append(this.domTitleBottomLeftDecoration),t.append(this.domTitleBottomRightDecoration))}for(let e=0;e<this.domTitleLink._splitted.words.length;e++){let t=this.domTitleLink._splitted.words[e],r=new SplitType(t,{types:"chars"});t._chars=r.chars,t._ratio=0;for(let n=0;n<t._chars.length;n++){let a=t._chars[n],l=a.cloneNode(!0),c=document.createElement("div");c.classList.add("char-wrapper"),c.style.display="inline-block",a._wrapper=c,c.append(a),c.append(l),t.append(c)}}}_reset(){this._needsReset=!1,this.time=0,this.hoverRatio=0,this.activeRatio=0;for(let e=0;e<this.domTitleLink._splitted.words.length;e++){let t=this.domTitleLink._splitted.words[e];for(let r=0;r<t._chars.length;r++){let n=t._chars[r];n._wrapper.style.transform="translate3d(0, 0, 0)",n.style.transform="translate3d(0, 0, 0)"}}flipAnimation.needsReset=!0}_onDomTitleMouseenter(){this.isHover=!0}_onDomTitleMouseleave(){this.isHover=!1}}const endSection=new EndSection;class ScrollNavSection{domContainer;domText;overScrollRatio=0;downWaitTime=0;_needsReset=!0;path="";preInit(){this.domContainer=document.getElementById("scroll-nav-section"),this.domText=document.getElementById("scroll-nav-text"),this.barInner=document.getElementById("scroll-nav-next-bar-inner")}init(){}resize(e,t){}update(e){let r=scrollManager.getDomRange(this.domContainer).isActive,n=scrollManager.scrollPixel>=scrollManager.contentSize*scrollManager.viewSizePixel-5,a=(input.deltaDragScrollY+input.deltaWheel)*(scrollManager.isActive&&pagesManager.isIdle?1:0);if(this.downWaitTime=a>0?.3:Math.max(0,this.downWaitTime-e),this.overScrollRatio=r?math.saturate(this.overScrollRatio+e*(n&&a>0?2:this.downWaitTime>0?0:a<0?-5:-.2)*(pagesManager.isIdle?1:0)):0,r){let l=pagesManager.currRoute;this.barInner.style.transform=`scaleX(${this.overScrollRatio})`,scrollManager.isActive&&pagesManager.isIdle&&(this.path!==l.scrollNavPath&&(this.path=l.scrollNavPath,this.domText.innerHTML=l.scrollNavText),this.overScrollRatio==1&&routeManager.setPath(this.path))}}}const scrollNavSection=new ScrollNavSection;class PageExtraSections{isActive=!0;domContainer;_needsResize=!1;preUfxContainer=new Object3D;postUfxContainer=new Object3D;preInit(){preUfx.scene.add(this.preUfxContainer),postUfx.scene.add(this.postUfxContainer),this.domContainer=document.querySelector("#page-extra-sections"),endSection.preInit(),footerSection.preInit(),scrollNavSection.preInit()}init(){endSection.init(),footerSection.init(),scrollNavSection.init()}resize(e,t){this.preUfxContainer.visible=this.postUfxContainer.visible=!1,pagesManager.scrollTargetPage&&(pagesManager.scrollTargetPage.hasExtraPages?(this.preUfxContainer.visible=this.postUfxContainer.visible=!0,this._needsResize=!1,this.domContainer.style.display="block",endSection.resize(e,t),footerSection.resize(e,t),scrollNavSection.resize(e,t)):(this.domContainer.style.display="none",this._needsResize=!0))}update(e){this.preUfxContainer.visible=this.postUfxContainer.visible=!1,pagesManager.scrollTargetPage&&(pagesManager.scrollTargetPage.hasExtraPages?(this.preUfxContainer.visible=this.postUfxContainer.visible=!0,this._needsResize&&this.resize(properties.viewportWidth,properties.viewportHeight),this.domContainer.style.display="block",endSection.update(e),footerSection.update(e),scrollNavSection.update(e)):(this.domContainer.style.display="none",this._needsResize=!0))}}const pageExtraSections=new PageExtraSections;let LOADING_RECTS=[1,1,1,3,2,4,2,1,6,2,1,2,7,1,1,1,7,4,1,1,8,2,1,2,11,2,1,3,13,2,1,3,12,1,1,1,16,1,2,1,18,2,1,2,16,4,2,1,22,1,1,4,26,1,1,4,27,1,1,1,28,2,1,3,32,1,1,1,33,3,1,1,31,1,1,3,32,4,2,1];class TransitionOverlay{contentShowRatio=0;contentHideRatio=1;loadBarRatio=0;lineTransformRatio=0;showTextRatio=0;waitTextRatio=0;hideTextRatio=1;pixelWidth=0;needsShowText=!1;needsHideText=!1;loadingTextAnimation=0;onShowTextCompleted=new MinSignal$2;onHideTextCompleted=new MinSignal$2;init(){this.canvas=document.getElementById("transition-overlay"),this.ctx=this.canvas.getContext("2d")}resize(e,t){e+=2,t+=2,this.canvas.width=e*settings.DPR,this.canvas.height=t*settings.DPR,this.canvas.style.width=e+"px",this.canvas.style.height=t+"px",this.pixelWidth=~~Math.min(42,properties.viewportWidth/30)}isReadyToHide(){}get activeRatio(){return Math.min(1-this.contentShowRatio,this.contentHideRatio)}update(e){if(this.activeRatio>0){let t=properties.viewportWidth+2,r=properties.viewportHeight+2,n=this.pixelWidth,a=this.loadBarRatio,l=this.lineTransformRatio,c=Math.sqrt(t*t+r*r)/n,u=this.ctx;u.save(),u.scale(settings.DPR,settings.DPR),u.fillStyle="#000",u.fillRect(0,0,t,r);let f=ease.expoInOut(1-this.activeRatio),p=(1+f*c)*n;if(u.translate(t*.5,r*.5),u.rotate(f*(this.contentShowRatio==0?-1:1)),u.translate(n*f*c,-n*.5*f*c),u.scale(p,p),l==0)u.fillStyle="#333",u.fillRect(-2.5,-.5,5,1),u.fillStyle="#fff",u.fillRect(-2.5,-.5,5*a,1);else{u.fillStyle="#fff",this.needsShowText&&(this.showTextRatio=this.showTextRatio+e*1.25,this.showTextRatio>=1&&(this.showTextRatio=1,this.needsShowText=!1,this.onShowTextCompleted.dispatch())),this.showTextRatio==1&&(this.waitTextRatio=Math.min(1,this.waitTextRatio+e*3),this.waitTextRatio==1&&this.needsHideText&&taskManager.percent==1&&(this.hideTextRatio=this.hideTextRatio+e*1.25,this.hideTextRatio>=1&&(this.hideTextRatio=1,this.needsHideText=!1,this.onHideTextCompleted.dispatch())));let g=this.showTextRatio,v=this.hideTextRatio,_=math.fit(Math.min(g,1-v),0,.5,1,.2,ease.expoInOut),T=(ease.expoInOut(g)+ease.expoInOut(v))*-15;if(g>0&&v<1){u.scale(_,_),u.translate(-l,1.5*l),u.translate(T,0),u.save(),u.translate(-1.5,-4.5),u.beginPath();for(let M=0,S=LOADING_RECTS.length/4,b=0;M<S;M++,b+=4){u.fillStyle="#fff";let C=LOADING_RECTS[b+0],w=LOADING_RECTS[b+1],R=LOADING_RECTS[b+2],E=LOADING_RECTS[b+3],I=M/(S-1),F=math.fit(g,I*.5,.5+I*.5,0,1,ease.expoIn)*math.fit(v,I*.5,.5+I*.5,1,0,ease.expoOut);g<1?M<2&&(F=1):M>=S-2&&(F=1),u.rect(C+(1-F)*R*.5,w+(1-F)*E*.5,R*F,E*F)}u.closePath(),u.fill(),u.restore()}else u.translate(-l,1.5*l),u.save(),u.translate(.5,-.5),u.rotate(l*Math.PI*.5),u.globalCompositeOperation="xor",u.fillRect(-3,0,3,1),u.globalCompositeOperation="source-over",u.globalAlpha=1-f,u.fillRect(-3,0,3,1),u.restore(),u.save(),u.translate(.5,-.5),u.globalCompositeOperation="xor",u.fillRect(0,0,2,1),u.globalCompositeOperation="source-over",u.globalAlpha=1-f,u.fillRect(0,0,2,1),u.restore()}u.restore(),this.canvas.style.display="block"}else this.canvas.style.display="none"}}const transitionOverlay=new TransitionOverlay;class PageManager{pages={};pageList=[homePage,aboutPage,projectPage,projectsPage,playgroundPage];scrollTargetPage=null;domContainer=null;domInner=null;prevRoute=null;currRoute=null;_defaultRoute;_pendingRoute;_isHiding=!1;_isShowing=!1;_hasPreloaded=!0;isFirstRoute=!0;_needsShowLoading=!1;onIdled=new MinSignal$2;onScrollTargetChanged=new MinSignal$2;NEEDS_LOG=!1;constructor(){this._defaultRoute=new Route(void 0),this.prevRoute=this.currRoute=this._defaultRoute;for(let e=0;e<this.pageList.length;e++){let t=this.pageList[e];this.pages[t.id]=t,routeManager.addPath(t.path,t),preUfx.scene.add(t.preUfxContainer),postUfx.scene.add(t.postUfxContainer)}transitionOverlay.onShowTextCompleted.add(this._onShowTextComplete,this),transitionOverlay.onHideTextCompleted.add(this._onHideTextComplete,this),taskManager.onCompleted.add(this._onTaskComplete,this)}preInit(){this.domContainer=document.getElementById("page-container"),this.domContainerInner=document.getElementById("page-container-inner"),routeManager.onRouteChanged.add(this._onRouteChanged,this),this._onRouteChanged(routeManager.currRoute)}get isIdle(){return!this._isHiding&&this._hasPreloaded&&!this._isShowing&&!this._needsShowLoading}_onRouteChanged(e){if(!this.isIdle)this._pendingRoute=e;else if(this.currRoute!==e){this.prevRoute=this.currRoute,this.currRoute=e;let t=this.currRoute.target;if(t.domContainer||(t.domContainer=this.currRoute.dom,this._log("preInit: "+this.currRoute.path),t.preInit(this.currRoute),properties.hasInitialized&&!t.bypassShowingLoading&&(this._needsShowLoading=!0)),properties.hasInitialized?this._hasPreloaded=!1:(this.scrollTargetPage=t,this.onScrollTargetChanged.dispatch(t)),this.currRoute.hasContentPreloaded||(this._log("preInitContent: "+this.currRoute.path),t.preInitContent(this.currRoute)),properties.hasInitialized){transitionOverlay.showTextRatio=0,transitionOverlay.waitTextRatio=0,transitionOverlay.hideTextRatio=0,transitionOverlay.needsShowText=!1,transitionOverlay.needsHideText=!1;let r=this.prevRoute.target;this._isHiding=!0,this._log("hide page",r.id),r.onHideStarted.dispatch(),r.hide(this.prevRoute,this.currRoute,()=>{this._isHiding=!1,this._needsShowLoading?transitionOverlay.needsShowText=!0:this._hasPreloaded&&this._onHideComplete()}),r.useGenericTransition&&audios.countPlay("page"),properties.loader.start(n=>{n==1&&(this._hasPreloaded=!0,this._isHiding||(this._needsShowLoading?transitionOverlay.showTextRatio==1&&this._onHideComplete():this._onHideComplete()))})}}}_onShowTextComplete(){this._hasPreloaded&&this._onHideComplete()}_onHideTextComplete(){this._showPage()}_onTaskComplete(){this.isFirstRoute}init(){this._initPage()}_initPage(){let e=this.currRoute.target;e.hasInitialized||(this._log("init: "+this.currRoute.path),e.init(this.currRoute),e.hasInitialized=!0),this.currRoute.hasContentPreloaded||(this.currRoute.hasContentPreloaded=!0,this._log("initContent: "+this.currRoute.path),e.initContent(this.currRoute)),taskManager.start()}_onHideComplete(){if(this._initPage(),this.prevRoute.target){let e=this.prevRoute.target;e.onHideCompleted.dispatch(),this._log("hide page complete: "+this.prevRoute.path),e.isActive=!1,e!==this.currRoute.target&&(e.domContainer.remove(),e.preUfxContainer.visible=!1,e.postUfxContainer.visible=!1)}this._needsShowLoading?transitionOverlay.needsHideText=!0:this._showPage()}resize(e,t){this.prevRoute.target&&this.prevRoute.target.isActive&&this.prevRoute.target!==this.currRoute.target&&this.prevRoute.target.hasInitialized&&this.prevRoute.target.resize(e,t),this.currRoute&&this.currRoute.target.isActive&&this.currRoute.target.resize(e,t)}start(){this._showPage()}_showPage(){this._isShowing=!0,this._needsShowLoading=!1;let e=this.currRoute.target;e.isActive=!0,properties.hasInitialized&&e!==this.prevRoute.target&&(this.domContainerInner.prepend(e.domContainer),e.time=0),document.title=this.currRoute.title,this.scrollTargetPage=e,e.preUfxContainer.visible=!0,e.postUfxContainer.visible=!0,this.onScrollTargetChanged.dispatch(e),this._log("show page: "+this.currRoute.path),pageExtraSections.resize(properties.viewportWidth,properties.viewportHeight),scrollManager.resize(properties.viewportWidth,properties.viewportHeight),scrollManager.scrollToPixel(0,!0),e.resize(properties.viewportWidth,properties.viewportHeight),e.onShowStarted.dispatch(),e.show(this.prevRoute,this.currRoute,this._onShowComplete.bind(this)),e.useGenericTransition&&audios.countPlay("page")}_onShowComplete(){if(transitionOverlay.contentShowRatio=1,this._isShowing=!1,this.isFirstRoute=!1,this.currRoute.target.isFirstShown=!0,this.currRoute.target.onShowCompleted.dispatch(),this._log("==============="),this._pendingRoute){let e=this._pendingRoute;this._pendingRoute=null,this._onRouteChanged(e)}else this.onIdled.dispatch();properties.isContactFromProjectPage&&(properties.isContactFromProjectPage=!1,scrollManager.scrollTo("footer-section",0,!1))}update(e){if(this.prevRoute.target&&this.prevRoute.target.isActive&&this.prevRoute.target!==this.currRoute.target&&this.prevRoute.target.hasInitialized){let t=this.prevRoute.target;t.time+=e,t.update(e)}if(this.currRoute&&this.currRoute.target.isActive){let t=this.currRoute.target;t.time+=e,t.update(e)}if(!this.isFirstRoute){(this._isHiding||!this._hasPreloaded)&&!this._isShowing&&this.prevRoute.target.useGenericTransition&&(transitionOverlay.contentHideRatio=this.prevRoute.target.hideRatio,transitionOverlay.contentShowRatio=0),this._isShowing&&this.currRoute.target&&this.currRoute.target.useGenericTransition&&(transitionOverlay.contentHideRatio=1,transitionOverlay.contentShowRatio=this.currRoute.target.showRatio);let t=1;this.prevRoute!=this.currRoute&&(this._isHiding&&!this.prevRoute.target.useGenericTransition&&(t*=math.fit(this.prevRoute.target.hideRatio,0,.5,1,0)),this._isShowing&&!this.currRoute.target.useGenericTransition&&(t*=math.fit(this.currRoute.target.showRatio,.5,1,0,1))),this.domContainer.style.opacity=t}}_log(e){}}const pagesManager=new PageManager;class ScrollPane{lockOnDirection=!0;isActive=!1;x;y;viewDom;contentDom;isVertical=!0;targetScrollPixel=0;scrollViewDelta=0;viewWidthPixel=0;viewHeightPixel=0;contentSize=0;contentSizePixel=0;scrollView=0;progress=0;minScrollPixel=.1;viewSizePixel=1;scrollMultiplier=(browser$1.isMobile,1);domRanges=new Map;useResizeObserver=!0;tick=-1;lastResizeTick=-1;resizeObserveTick=-1;hasResizeObserved=!1;autoScrollSpeed=0;autoScrollRatio=0;skipAutoScroll=!1;dragHistory=[];dragHistoryMaxTime=.1;isWheelScrolling=!1;frictionCoeffFrom=2.1;frictionCoeffTo=1.9;frictionCoeffWeightDivisor=5;minVelocity=-1;wheelEaseCoeff=12;scrollPixel=0;init(e={}){Object.assign(this,e),this.contentDom&&this.useResizeObserver&&window.ResizeObserver&&new ResizeObserver(this._onResizeObserve.bind(this)).observe(this.contentDom),document.documentElement.addEventListener("keydown",t=>{this.isMoveable&&(this.isVertical?t.key==="ArrowUp"?this.scrollToPixel(this.scrollPixel-100):t.key==="ArrowDown"&&this.scrollToPixel(this.scrollPixel+100):t.key==="ArrowLeft"?this.scrollToPixel(this.scrollPixel-100):t.key==="ArrowRight"&&this.scrollToPixel(this.scrollPixel+100),t.key==="PageUp"?this.scrollToPixel(this.scrollPixel-this.viewSizePixel):t.key==="PageDown"&&this.scrollToPixel(this.scrollPixel+this.viewSizePixel))})}_onResizeObserve(){this.hasResizeObserved=!0,this.resizeObserveTick=this.tick}getDomRange(e,t=0,r=!1){let n=this.domRanges.get(e);return n||this.domRanges.set(e,n=new ScrollDomRange(e,this.isVertical)),n.update(this.scrollPixel,this.viewSizePixel,t,r),n}scrollTo(e,t=0,r=!1){if(e=typeof e=="string"?document.getElementById(e):e,e){let n=this.getDomRange(e);this.scrollToPixel(n.top+t*this.viewSizePixel,r)}}scrollToPixel(e=0,t=!1){e=this._clampScrollPixel(e),t?(this.resetScroll(e),this.progress=this.contentSize>0?e/this.contentSizePixel:0):(this.resetScroll(this.scrollPixel),this.targetScrollPixel=e,this.isWheelScrolling=!0,this.skipAutoScroll=!0),this.syncDom()}getEaseInOutOffset(e,t,r=0,n=.5){let a=1.5+n,l=(a-1)*2+r,c=0,u=a,f=u+r,p=f+a,g=t*p/l,v=e+g*.5-t*.5,_=Math.min(1,v/g);if(_>0){let M=_*p;var T=M;if(M>c&&M<=u){let S=(M-c)/(u-c);T=math.cubicBezier(c,(u-c)/3+c,1,1,S)}else if(M>u&&M<=f)T=1;else if(M>f&&M<=p){let S=(M-f)/(p-f);T=math.cubicBezier(1,1,-(p-f)/3+2,2,S)}else M>p&&(T=M-l);return(M-T)/l*t}return 0}resize(e,t){if(this.domRanges.forEach(n=>{n.needsUpdate=!0}),this.viewDom){let n=this.viewDom.getBoundingClientRect();e=n.width,t=n.height}this.viewWidthPixel=e,this.viewHeightPixel=t;let r=this.isVertical?t:e;if(this.contentDom){let n=this.contentDom.getBoundingClientRect();this.contentSize=Math.max(0,(this.isVertical?n.height:n.width)/r-1)}this.contentSizePixel=Math.floor(this.contentSize*r),this.targetScrollPixel=this.contentSizePixel*this.progress,this.resetScroll(this.targetScrollPixel),this.viewSizePixel=r,this.lastResizeTick=this.tick,this.syncDom()}_clampScrollPixel(e){return math.clamp(e,0,this.contentSizePixel)}resetScroll(e){this.targetScrollPixel=this.scrollPixel=e,this.velocityPixel=0,this.dragHistory.length=0}update(e,t){this.hasResizeObserved&&(this.hasResizeObserved=!1,this.resizeObserveTick!==this.lastResizeTick&&this.resize(this.viewWidthPixel,this.viewHeightPixel));let r=this.scrollView,n=input.isDown&&(!this.lockOnDirection&&(input.isDragScrollingY||input.isDragScrollingX)||this.isVertical&&input.isDragScrollingY||!this.isVertical&&input.isDragScrollingX),a=0;if(input.isDown&&!input.wasDown&&(this.dragHistory.length=0),this.isMoveable){let l=0;this.isVertical?input.isWheelScrolling||input.isDragScrollingY?l=input.deltaScrollY:!this.lockOnDirection&&input.isDragScrollingX&&(l=-input.deltaPixelXY.y+input.deltaWheel):input.isWheelScrolling||input.isDragScrollingX?l=input.deltaScrollX:!this.lockOnDirection&&input.isDragScrollingY&&(l=-input.deltaPixelXY.x+input.deltaWheel),input.isWheelScrolling&&(this.isWheelScrolling=!0),l!==0&&(this.skipAutoScroll=!1),this.autoScrollRatio=math.saturate(this.autoScrollRatio+(Math.abs(this.autoScrollSpeed)>0&&l==0?e:-1));let c=this.autoScrollSpeed*this.viewSizePixel*e*(this.skipAutoScroll?0:this.autoScrollRatio),u=properties.time;if(n){for(this.dragHistory.push({time:u,deltaTime:e,deltaPixel:l});this.dragHistory.length>0&&u-this.dragHistory[0].time>this.dragHistoryMaxTime;)this.dragHistory.shift();this.targetScrollPixel=this.scrollPixel,this.isWheelScrolling=!1,a=l}else if(input.isDown&&this.resetScroll(this.scrollPixel),this.isWheelScrolling){this.dragHistory.length=0,this.velocityPixel=0,this.targetScrollPixel+=l,this.targetScrollPixel=this._clampScrollPixel(this.targetScrollPixel);let f=this.targetScrollPixel-this.scrollPixel;a=f*(1-Math.exp(-this.wheelEaseCoeff*e)),Math.abs(f)<this.minScrollPixel&&(a=f,this.isWheelScrolling=!1)}else{if(this.dragHistory.length>0){let g=0,v=0;for(let _=0;_<this.dragHistory.length;_++){let T=this.dragHistory[_];if(T.time>0){let M=T.deltaPixel/T.deltaTime,S=T.deltaTime,b=this.dragHistory.length==1?1:(T.time-this.dragHistory[0].time)/this.dragHistoryMaxTime,C=S*b;v+=M*C,g+=C}}this.velocityPixel=v/g,this.dragHistory.length=0}let p=-math.mix(this.frictionCoeffFrom,this.frictionCoeffTo,math.clamp(Math.abs(this.velocityPixel/this.viewSizePixel/this.frictionCoeffWeightDivisor),0,1))*this.velocityPixel;this.velocityPixel+=p*e,a=this.velocityPixel*e}this.targetScrollPixel+=c,this.scrollPixel+=c}this.scrollPixel=this._clampScrollPixel(this.scrollPixel+a),this.scrollView=this.scrollPixel/this.viewSizePixel,this.scrollViewDelta=this.scrollView-r,this.progress=this.contentSize>0?this.scrollPixel/this.contentSizePixel:0,Math.abs(this.targetScrollPixel-this.scrollPixel)<this.minScrollPixel&&(this.scrollPixel=this.targetScrollPixel),Math.abs(this.velocityPixel)<=this.minVelocity&&(this.velocityPixel=0),this.isScrolling=this.targetScrollPixel!==this.scrollPixel||Math.abs(this.velocityPixel)>0,this.syncDom(),this.tick++}syncDom(){this.contentDom&&(this.x=0,this.y=0,this.isVertical?this.y=-this.scrollPixel:this.x=-this.scrollPixel,this.contentDom.style.transform=`translate3d(${this.x}px, ${this.y}px, 0px)`)}get isMoveable(){return this.isActive&&!videoOverlay.isOpened&&pagesManager.isIdle&&!header.menu.opened&&this.contentSize>0&&(!this.viewDom||input.hasThroughElem(this.viewDom,"down"))}}class ScrollManager extends ScrollPane{domScrollIndicator;domScrollIndicatorHeight=1;domScrollIndicatorBar;scrollIndicatorActiveRatio=0;lastMouseInteractiveTime=-1/0;isIndicatorActive=void 0;easedScrollStrength=0;frameIdx=-1;MIN_BAR_SCALE_Y=2/10;init(){super.init({contentDom:document.getElementById("page-container"),domScrollIndicator:document.getElementById("scroll-indicator"),domScrollIndicatorBar:document.getElementById("scroll-indicator-bar")})}resize(e,t){super.resize(e,t),this.domScrollIndicatorHeight=this.domScrollIndicator.getBoundingClientRect().height}update(e){super.update(e,this.scrollValue),this.easedScrollStrength+=Math.abs(this.scrollViewDelta),this.easedScrollStrength+=(0-this.easedScrollStrength)*(1-Math.exp(-10*e)),this.easedScrollStrength=Math.min(this.easedScrollStrength,1),Math.abs(this.scrollViewDelta)>0?(this.lastMouseInteractiveTime=properties.time,this.isIndicatorActive=!0):properties.time>this.lastMouseInteractiveTime+.5&&(this.isIndicatorActive=!1),this.scrollIndicatorActiveRatio=math.clamp(this.scrollIndicatorActiveRatio+(this.isIndicatorActive?2:-2)*e,0,1),this.domScrollIndicator.style.opacity=this.scrollIndicatorActiveRatio;let r=1,n=0;this.contentSize>0&&(r=Math.max(this.MIN_BAR_SCALE_Y,1/(1+this.contentSize)),n=this.scrollView/this.contentSize*(1-r)),this.domScrollIndicatorBar.style.height=this.domScrollIndicatorHeight*r+"px",this.domScrollIndicatorBar.style.transform="translate3d(0,"+this.domScrollIndicatorHeight*n+"px,0)",this.frameIdx++}get isMoveable(){return super.isMoveable}}const scrollManager=new ScrollManager;let _geom;class Postprocessing{width=1;height=1;scene=null;camera=null;resolution=new Vector2(0,0);texelSize=new Vector2(0,0);aspect=new Vector2(1,1);onBeforeSceneRendered=new MinSignal$2;onAfterSceneRendered=new MinSignal$2;onAfterRendered=new MinSignal$2;sceneRenderTarget=null;fromRenderTarget=null;toRenderTarget=null;useDepthTexture=!0;depthTexture=null;fromTexture=null;toTexture=null;sceneTexture=null;mesh=null;queue=[];sharedUniforms={};geom;hasSizeChanged=!0;init(e){if(Object.assign(this,e),_geom?this.geom=_geom:(this.geom=_geom=new BufferGeometry,this.geom.setAttribute("position",new BufferAttribute(new Float32Array([-1,-1,0,4,-1,0,-1,4,0]),3)),this.geom.setAttribute("a_uvClamp",new BufferAttribute(new Float32Array([0,0,1,1,0,0,1,1,0,0,1,1]),4))),this.sceneFlatRenderTarget=fboHelper.createRenderTarget(1,1),this.sceneFlatRenderTarget.depthBuffer=!0,this.sceneMsRenderTarget=fboHelper.createMultisampleRenderTarget(1,1),this.sceneMsRenderTarget.depthBuffer=!0,this.fromRenderTarget=fboHelper.createRenderTarget(1,1),this.toRenderTarget=this.fromRenderTarget.clone(),this.useDepthTexture=!!this.useDepthTexture&&fboHelper.renderer&&(fboHelper.renderer.capabilities.isWebGL2||fboHelper.renderer.extensions.get("WEBGL_depth_texture")),this.fromTexture=this.fromRenderTarget.texture,this.toTexture=this.toRenderTarget.texture,this.sceneRenderTarget=this.sceneMsRenderTarget,this.sceneTexture=this.sceneMsRenderTarget.texture,this.mesh=new Mesh,this.sharedUniforms=Object.assign(this.sharedUniforms,{u_sceneTexture:{value:this.sceneTexture},u_fromTexture:{value:null},u_toTexture:{value:null},u_sceneDepthTexture:{value:null},u_cameraNear:{value:0},u_cameraFar:{value:1},u_cameraFovRad:{value:1},u_resolution:{value:this.resolution},u_texelSize:{value:this.texelSize},u_aspect:{value:this.aspect}}),this.useDepthTexture&&fboHelper.renderer){const t=new DepthTexture(this.resolution.width,this.resolution.height);fboHelper.renderer.capabilities.isWebGL2?t.type=UnsignedIntType:(t.format=DepthStencilFormat,t.type=UnsignedInt248Type),t.minFilter=NearestFilter,t.magFilter=NearestFilter,this.sceneFlatRenderTarget.depthTexture=t,this.sceneMsRenderTarget.depthTexture=t,this.depthTexture=this.sharedUniforms.u_sceneDepthTexture.value=t}}swap(){const e=this.fromRenderTarget;this.fromRenderTarget=this.toRenderTarget,this.toRenderTarget=e,this.fromTexture=this.fromRenderTarget.texture,this.toTexture=this.toRenderTarget.texture,this.sharedUniforms.u_fromTexture.value=this.fromTexture,this.sharedUniforms.u_toTexture.value=this.toTexture}setSize(e,t){if(this.width!==e||this.height!==t){this.hasSizeChanged=!0,this.width=e,this.height=t,this.resolution.set(e,t),this.texelSize.set(1/e,1/t);const r=t/Math.sqrt(e*e+t*t)*2;this.aspect.set(e/t*r,r),this.sceneFlatRenderTarget.setSize(e,t),this.sceneMsRenderTarget.setSize(e,t),this.fromRenderTarget.setSize(e,t),this.toRenderTarget.setSize(e,t)}}dispose(){this.fromRenderTarget&&this.fromRenderTarget.dispose(),this.toRenderTarget&&this.toRenderTarget.dispose(),this.sceneMsRenderTarget&&this.sceneMsRenderTarget.dispose(),this.sceneFlatRenderTarget&&this.sceneFlatRenderTarget.dispose()}_filterQueue(e){return e.enabled&&e.needsRender()}renderMaterial(e,t){this.mesh.material=e,fboHelper.renderMesh(this.mesh,t)}checkSceneRt(){this.sceneRenderTarget=properties.isSmaaEnabled?this.sceneFlatRenderTarget:this.sceneMsRenderTarget,this.sceneTexture=this.sceneRenderTarget.texture,this.sharedUniforms.u_sceneTexture.value=this.sceneTexture}render(e,t,r){if(!fboHelper.renderer)return;this.scene=e,this.camera=t,this.mesh.geometry=this.geom;const n=this.queue.filter(this._filterQueue),a=this.sharedUniforms;if(n.sort((l,c)=>l.renderOrder==c.renderOrder?0:l.renderOrder-c.renderOrder),this.checkSceneRt(),a.u_cameraNear.value=t.near,a.u_cameraFar.value=t.far,a.u_cameraFovRad.value=t.fov/180*Math.PI,this.onBeforeSceneRendered.dispatch(),n.length){fboHelper.renderer.setRenderTarget(this.sceneRenderTarget),fboHelper.renderer.render(e,t),fboHelper.renderer.setRenderTarget(null),fboHelper.copy(this.sceneRenderTarget.texture,this.fromRenderTarget),this.onAfterSceneRendered.dispatch(this.sceneRenderTarget);const l=fboHelper.getColorState();fboHelper.renderer.autoClear=!1;for(let c=0,u=n.length;c<u;c++){const f=c===u-1&&r,p=n[c];p.setPostprocessing(this),p.render(this,f)}fboHelper.setColorState(l)}else fboHelper.renderer.render(e,t),this.onAfterSceneRendered.dispatch();this.onAfterRendered.dispatch(),this.hasSizeChanged=!1}}const smaaBlendVert=`#define GLSLIFY 1
attribute vec3 position;uniform vec2 u_texelSize;varying vec2 v_uv;varying vec4 v_offsets[2];void SMAANeighborhoodBlendingVS(vec2 texcoord){v_offsets[0]=texcoord.xyxy+u_texelSize.xyxy*vec4(-1.0,0.0,0.0,1.0);v_offsets[1]=texcoord.xyxy+u_texelSize.xyxy*vec4(1.0,0.0,0.0,-1.0);}void main(){v_uv=position.xy*0.5+0.5;SMAANeighborhoodBlendingVS(v_uv);gl_Position=vec4(position,1.0);}`,smaaBlendFrag=`#define GLSLIFY 1
uniform sampler2D u_weightsTexture;uniform sampler2D u_texture;uniform vec2 u_texelSize;varying vec2 v_uv;varying vec4 v_offsets[2];vec4 SMAANeighborhoodBlendingPS(vec2 texcoord,vec4 offset[2],sampler2D colorTex,sampler2D blendTex){vec4 a;a.xz=texture2D(blendTex,texcoord).xz;a.y=texture2D(blendTex,offset[1].zw).g;a.w=texture2D(blendTex,offset[1].xy).a;if(dot(a,vec4(1.0,1.0,1.0,1.0))<1e-5){return texture2D(colorTex,texcoord,0.0);}else{vec2 offset;offset.x=a.a>a.b ? a.a :-a.b;offset.y=a.g>a.r ?-a.g : a.r;if(abs(offset.x)>abs(offset.y)){offset.y=0.0;}else{offset.x=0.0;}vec4 C=texture2D(colorTex,texcoord,0.0);texcoord+=sign(offset)*u_texelSize;vec4 Cop=texture2D(colorTex,texcoord,0.0);float s=abs(offset.x)>abs(offset.y)? abs(offset.x): abs(offset.y);C.xyz=pow(abs(C.xyz),vec3(2.2));Cop.xyz=pow(abs(Cop.xyz),vec3(2.2));vec4 mixed=mix(C,Cop,s);mixed.xyz=pow(abs(mixed.xyz),vec3(1.0/2.2));return mixed;}}void main(){gl_FragColor=SMAANeighborhoodBlendingPS(v_uv,v_offsets,u_texture,u_weightsTexture);}`,smaaEdgesVert=`#define GLSLIFY 1
attribute vec3 position;uniform vec2 u_texelSize;varying vec2 v_uv;varying vec4 v_offsets[3];void SMAAEdgeDetectionVS(vec2 texcoord){v_offsets[0]=texcoord.xyxy+u_texelSize.xyxy*vec4(-1.0,0.0,0.0,1.0);v_offsets[1]=texcoord.xyxy+u_texelSize.xyxy*vec4(1.0,0.0,0.0,-1.0);v_offsets[2]=texcoord.xyxy+u_texelSize.xyxy*vec4(-2.0,0.0,0.0,2.0);}void main(){v_uv=position.xy*0.5+0.5;SMAAEdgeDetectionVS(v_uv);gl_Position=vec4(position,1.0);}`,smaaEdgesFrag=`#define GLSLIFY 1
uniform sampler2D u_texture;varying vec2 v_uv;varying vec4 v_offsets[3];vec4 SMAAColorEdgeDetectionPS(vec2 texcoord,vec4 offset[3],sampler2D colorTex){vec2 threshold=vec2(SMAA_THRESHOLD,SMAA_THRESHOLD);vec4 delta;vec3 C=texture2D(colorTex,texcoord).rgb;vec3 Cleft=texture2D(colorTex,offset[0].xy).rgb;vec3 t=abs(C-Cleft);delta.x=max(max(t.r,t.g),t.b);vec3 Ctop=texture2D(colorTex,offset[0].zw).rgb;t=abs(C-Ctop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0,1.0))==0.0)discard;vec3 Cright=texture2D(colorTex,offset[1].xy).rgb;t=abs(C-Cright);delta.z=max(max(t.r,t.g),t.b);vec3 Cbottom=texture2D(colorTex,offset[1].zw).rgb;t=abs(C-Cbottom);delta.w=max(max(t.r,t.g),t.b);float maxDelta=max(max(max(delta.x,delta.y),delta.z),delta.w);vec3 Cleftleft=texture2D(colorTex,offset[2].xy).rgb;t=abs(C-Cleftleft);delta.z=max(max(t.r,t.g),t.b);vec3 Ctoptop=texture2D(colorTex,offset[2].zw).rgb;t=abs(C-Ctoptop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(max(maxDelta,delta.z),delta.w);edges.xy*=step(0.5*maxDelta,delta.xy);return vec4(edges,0.0,0.0);}void main(){gl_FragColor=SMAAColorEdgeDetectionPS(v_uv,v_offsets,u_texture);}`,smaaWeightsVert=`#define GLSLIFY 1
attribute vec3 position;uniform vec2 u_texelSize;varying vec2 v_uv;varying vec4 v_offsets[3];varying vec2 v_pixcoord;void SMAABlendingWeightCalculationVS(vec2 texcoord){v_pixcoord=texcoord/u_texelSize;v_offsets[0]=texcoord.xyxy+u_texelSize.xyxy*vec4(-0.25,0.125,1.25,0.125);v_offsets[1]=texcoord.xyxy+u_texelSize.xyxy*vec4(-0.125,0.25,-0.125,-1.25);v_offsets[2]=vec4(v_offsets[0].xz,v_offsets[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*u_texelSize.xxyy*float(SMAA_MAX_SEARCH_STEPS);}void main(){v_uv=position.xy*0.5+0.5;SMAABlendingWeightCalculationVS(v_uv);gl_Position=vec4(position,1.0);}`,smaaWeightsFrag=`#define GLSLIFY 1
#define SMAASampleLevelZeroOffset( tex, coord, offset ) texture2D( tex, coord + float( offset ) * u_texelSize, 0.0 )
uniform sampler2D u_edgesTexture;uniform sampler2D u_areaTexture;uniform sampler2D u_searchTexture;uniform vec2 u_texelSize;varying vec2 v_uv;varying vec4 v_offsets[3];varying vec2 v_pixcoord;vec2 round2(vec2 x){return sign(x)*floor(abs(x)+0.5);}float SMAASearchLength(sampler2D searchTex,vec2 e,float bias,float scale){e.r=bias+e.r*scale;return 255.0*texture2D(searchTex,e,0.0).r;}float SMAASearchXLeft(sampler2D edgesTex,sampler2D searchTex,vec2 texcoord,float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<SMAA_MAX_SEARCH_STEPS;i++){e=texture2D(edgesTex,texcoord,0.0).rg;texcoord-=vec2(2.0,0.0)*u_texelSize;if(!(texcoord.x>end&&e.g>0.8281&&e.r==0.0))break;}texcoord.x+=0.25*u_texelSize.x;texcoord.x+=u_texelSize.x;texcoord.x+=2.0*u_texelSize.x;texcoord.x-=u_texelSize.x*SMAASearchLength(searchTex,e,0.0,0.5);return texcoord.x;}float SMAASearchXRight(sampler2D edgesTex,sampler2D searchTex,vec2 texcoord,float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<SMAA_MAX_SEARCH_STEPS;i++){e=texture2D(edgesTex,texcoord,0.0).rg;texcoord+=vec2(2.0,0.0)*u_texelSize;if(!(texcoord.x<end&&e.g>0.8281&&e.r==0.0))break;}texcoord.x-=0.25*u_texelSize.x;texcoord.x-=u_texelSize.x;texcoord.x-=2.0*u_texelSize.x;texcoord.x+=u_texelSize.x*SMAASearchLength(searchTex,e,0.5,0.5);return texcoord.x;}float SMAASearchYUp(sampler2D edgesTex,sampler2D searchTex,vec2 texcoord,float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<SMAA_MAX_SEARCH_STEPS;i++){e=texture2D(edgesTex,texcoord,0.0).rg;texcoord+=vec2(0.0,2.0)*u_texelSize;if(!(texcoord.y>end&&e.r>0.8281&&e.g==0.0))break;}texcoord.y-=0.25*u_texelSize.y;texcoord.y-=u_texelSize.y;texcoord.y-=2.0*u_texelSize.y;texcoord.y+=u_texelSize.y*SMAASearchLength(searchTex,e.gr,0.0,0.5);return texcoord.y;}float SMAASearchYDown(sampler2D edgesTex,sampler2D searchTex,vec2 texcoord,float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<SMAA_MAX_SEARCH_STEPS;i++){e=texture2D(edgesTex,texcoord,0.0).rg;texcoord-=vec2(0.0,2.0)*u_texelSize;if(!(texcoord.y<end&&e.r>0.8281&&e.g==0.0))break;}texcoord.y+=0.25*u_texelSize.y;texcoord.y+=u_texelSize.y;texcoord.y+=2.0*u_texelSize.y;texcoord.y-=u_texelSize.y*SMAASearchLength(searchTex,e.gr,0.5,0.5);return texcoord.y;}vec2 SMAAArea(sampler2D areaTex,vec2 dist,float e1,float e2,float offset){vec2 texcoord=float(SMAA_AREATEX_MAX_DISTANCE)*round2(4.0*vec2(e1,e2))+dist;texcoord=SMAA_AREATEX_PIXEL_SIZE*texcoord+(0.5*SMAA_AREATEX_PIXEL_SIZE);texcoord.y+=SMAA_AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTex,texcoord,0.0).rg;}vec4 SMAABlendingWeightCalculationPS(vec2 texcoord,vec2 pixcoord,vec4 offset[3],sampler2D edgesTex,sampler2D areaTex,sampler2D searchTex,ivec4 subsampleIndices){vec4 weights=vec4(0.0,0.0,0.0,0.0);vec2 e=texture2D(edgesTex,texcoord).rg;if(e.g>0.0){vec2 d;vec2 coords;coords.x=SMAASearchXLeft(edgesTex,searchTex,offset[0].xy,offset[2].x);coords.y=offset[1].y;d.x=coords.x;float e1=texture2D(edgesTex,coords,0.0).r;coords.x=SMAASearchXRight(edgesTex,searchTex,offset[0].zw,offset[2].y);d.y=coords.x;d=d/u_texelSize.x-pixcoord.x;vec2 sqrt_d=sqrt(abs(d));coords.y-=1.0*u_texelSize.y;float e2=SMAASampleLevelZeroOffset(edgesTex,coords,ivec2(1,0)).r;weights.rg=SMAAArea(areaTex,sqrt_d,e1,e2,float(subsampleIndices.y));}if(e.r>0.0){vec2 d;vec2 coords;coords.y=SMAASearchYUp(edgesTex,searchTex,offset[1].xy,offset[2].z);coords.x=offset[0].x;d.x=coords.y;float e1=texture2D(edgesTex,coords,0.0).g;coords.y=SMAASearchYDown(edgesTex,searchTex,offset[1].zw,offset[2].w);d.y=coords.y;d=d/u_texelSize.y-pixcoord.y;vec2 sqrt_d=sqrt(abs(d));coords.y-=1.0*u_texelSize.y;float e2=SMAASampleLevelZeroOffset(edgesTex,coords,ivec2(0,1)).g;weights.ba=SMAAArea(areaTex,sqrt_d,e1,e2,float(subsampleIndices.x));}return weights;}void main(){gl_FragColor=SMAABlendingWeightCalculationPS(v_uv,v_pixcoord,v_offsets,u_edgesTexture,u_areaTexture,u_searchTexture,ivec4(0.0));}`;class Smaa extends PostEffect{edgesRenderTarget=null;weightsRenderTarget=null;edgesMaterial=null;weightsMaterial=null;renderOrder=500;init(e){Object.assign(this,{sharedUniforms:{u_areaTexture:{value:null},u_searchTexture:{value:null}}},e),super.init(),this.weightsRenderTarget=fboHelper.createRenderTarget(1,1),this.edgesRenderTarget=fboHelper.createRenderTarget(1,1),this.edgesMaterial=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:null},u_texelSize:null},vertexShader:smaaEdgesVert,fragmentShader:smaaEdgesFrag,defines:{SMAA_THRESHOLD:"0.1"},blending:NoBlending,depthTest:!1,depthWrite:!1}),this.weightsMaterial=fboHelper.createRawShaderMaterial({uniforms:{u_edgesTexture:{value:this.edgesRenderTarget.texture},u_areaTexture:this.sharedUniforms.u_areaTexture,u_searchTexture:this.sharedUniforms.u_searchTexture,u_texelSize:null},vertexShader:smaaWeightsVert,fragmentShader:smaaWeightsFrag,defines:{SMAA_MAX_SEARCH_STEPS:"8",SMAA_AREATEX_MAX_DISTANCE:"16",SMAA_AREATEX_PIXEL_SIZE:"( 1.0 / vec2( 160.0, 560.0 ) )",SMAA_AREATEX_SUBTEX_SIZE:"( 1.0 / 7.0 )"},transparent:!0,blending:NoBlending,depthTest:!1,depthWrite:!1}),this.material=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:null},u_weightsTexture:{value:this.weightsRenderTarget.texture},u_texelSize:null},vertexShader:smaaBlendVert,fragmentShader:smaaBlendFrag})}setTextures(e,t){const r=this.sharedUniforms.u_areaTexture.value=this._createTexture(e);r.minFilter=LinearFilter;const n=this.sharedUniforms.u_searchTexture.value=this._createTexture(t);n.magFilter=NearestFilter,n.minFilter=NearestFilter}updateTextures(){this.sharedUniforms.u_areaTexture.value.needsUpdate=!0,this.sharedUniforms.u_searchTexture.value.needsUpdate=!0}setPostprocessing(e){super.setPostprocessing(e);const t=e.width,r=e.height;this.edgesRenderTarget.setSize(t,r),this.weightsRenderTarget.setSize(t,r)}dispose(){this.edgesRenderTarget&&this.edgesRenderTarget.dispose(),this.weightsRenderTarget&&this.weightsRenderTarget.dispose()}needsRender(){return this.enabled&&!this.sharedUniforms.u_areaTexture.value.needsUpdate&&properties.isSmaaEnabled}render(e,t){const r=fboHelper.getColorState();this.sharedUniforms.u_searchTexture.value||console.warn("You need to use Smaa.setImages() to set the smaa textures manually and assign to this class.");const n=fboHelper.renderer;n&&(n.autoClear=!0,n.setClearColor(0,0)),this.edgesMaterial.uniforms.u_texelSize=this.weightsMaterial.uniforms.u_texelSize=this.material.uniforms.u_texelSize=e.sharedUniforms.u_texelSize,this.edgesMaterial.uniforms.u_texture.value=e.fromTexture,e.renderMaterial(this.edgesMaterial,this.edgesRenderTarget),e.renderMaterial(this.weightsMaterial,this.weightsRenderTarget),fboHelper.setColorState(r),this.material.uniforms.u_texture.value=e.fromTexture,super.render(e,t)}_createTexture(e){const t=new Texture(e);return t.generateMipmaps=!1,t.flipY=!1,t}}const frag$2=`#define GLSLIFY 1
varying vec2 v_uv;uniform sampler2D u_texture;uniform float u_saturation;uniform sampler2D u_blurTexture0;
#if ITERATION > 1
uniform sampler2D u_blurTexture1;
#endif
#if ITERATION > 2
uniform sampler2D u_blurTexture2;
#endif
#if ITERATION > 3
uniform sampler2D u_blurTexture3;
#endif
#if ITERATION > 4
uniform sampler2D u_blurTexture4;
#endif
uniform float u_bloomWeights[ITERATION];
#include <common>
vec3 dithering(vec3 color){float grid_position=rand(gl_FragCoord.xy);vec3 dither_shift_RGB=vec3(0.25/255.0,-0.25/255.0,0.25/255.0);dither_shift_RGB=mix(2.0*dither_shift_RGB,-2.0*dither_shift_RGB,grid_position);return color+dither_shift_RGB;}void main(){vec4 c=texture2D(u_texture,v_uv);gl_FragColor=c+(u_bloomWeights[0]*texture2D(u_blurTexture0,v_uv)
#if ITERATION > 1
+u_bloomWeights[1]*texture2D(u_blurTexture1,v_uv)
#endif
#if ITERATION > 2
+u_bloomWeights[2]*texture2D(u_blurTexture2,v_uv)
#endif
#if ITERATION > 3
+u_bloomWeights[3]*texture2D(u_blurTexture3,v_uv)
#endif
#if ITERATION > 4
+u_bloomWeights[4]*texture2D(u_blurTexture4,v_uv)
#endif
);gl_FragColor.rgb=mix(vec3(dot(gl_FragColor.rgb,vec3(0.299,0.587,0.114))),gl_FragColor.rgb,u_saturation);gl_FragColor.rgb=dithering(gl_FragColor.rgb);gl_FragColor.a=1.0;}`,highPassFrag=`#define GLSLIFY 1
uniform sampler2D u_texture;uniform float u_luminosityThreshold;uniform float u_smoothWidth;uniform float u_amount;
#ifdef USE_HALO
uniform vec2 u_texelSize;uniform vec2 u_aspect;uniform float u_haloWidth;uniform float u_haloRGBShift;uniform float u_haloStrength;uniform float u_haloMaskInner;uniform float u_haloMaskOuter;
#ifdef USE_LENS_DIRT
uniform sampler2D u_dirtTexture;uniform vec2 u_dirtAspect;
#endif
#endif
#ifdef USE_CONVOLUTION
uniform float u_convolutionBuffer;
#endif
varying vec2 v_uv;void main(){vec2 uv=v_uv;
#ifdef USE_CONVOLUTION
uv=(uv-0.5)*(1.0+u_convolutionBuffer)+0.5;
#endif
vec4 texel=texture2D(u_texture,uv);vec3 luma=vec3(0.299,0.587,0.114);float v=dot(texel.xyz,luma);float alpha=texel.a*u_amount;gl_FragColor=vec4(texel.rgb*alpha,1.0);
#ifdef USE_HALO
vec2 toCenter=(uv-0.5)*u_aspect;vec2 ghostUv=1.0-(toCenter+0.5);vec2 ghostVec=(vec2(0.5)-ghostUv);vec2 direction=normalize(ghostVec);vec2 haloVec=direction*u_haloWidth;float weight=length(vec2(0.5)-fract(ghostUv+haloVec));weight=pow(1.0-weight,3.0);vec3 distortion=vec3(-u_texelSize.x,0.0,u_texelSize.x)*u_haloRGBShift;float zoomBlurRatio=fract(atan(toCenter.y,toCenter.x)*40.0)*0.05+0.95;ghostUv*=zoomBlurRatio;vec2 haloUv=ghostUv+haloVec;vec3 halo=vec3(texture2D(u_texture,haloUv+direction*distortion.r).r,texture2D(u_texture,haloUv+direction*distortion.g).g,texture2D(u_texture,haloUv+direction*distortion.b).b)*u_haloStrength*smoothstep(u_haloMaskInner,u_haloMaskOuter,length(toCenter));
#ifdef USE_LENS_DIRT
vec2 dirtUv=(uv-0.5)*u_dirtAspect+0.5;vec3 dirt=texture2D(u_dirtTexture,dirtUv).rgb;gl_FragColor.rgb+=(halo+alpha+0.05*dirt)*dirt;
#else
gl_FragColor.rgb+=halo;
#endif
#endif
#ifdef USE_CONVOLUTION
gl_FragColor.rgb*=max(abs(uv.x-0.5),abs(uv.y-0.5))>0.5 ? 0. : 1.;
#endif
}`,blurFrag=`#define GLSLIFY 1
varying vec2 v_uv;uniform sampler2D u_texture;uniform vec2 u_resolution;uniform vec2 u_direction;float gaussianPdf(in float x,in float sigma){return 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma;}void main(){vec2 invSize=1.0/u_resolution;float fSigma=float(SIGMA);float weightSum=gaussianPdf(0.0,fSigma);vec3 diffuseSum=texture2D(u_texture,v_uv).rgb*weightSum;for(int i=1;i<KERNEL_RADIUS;i++){float x=float(i);float w=gaussianPdf(x,fSigma);vec2 uvOffset=u_direction*invSize*x;vec3 sample1=texture2D(u_texture,v_uv+uvOffset).rgb;vec3 sample2=texture2D(u_texture,v_uv-uvOffset).rgb;diffuseSum+=(sample1+sample2)*w;weightSum+=2.0*w;}gl_FragColor=vec4(diffuseSum/weightSum,1.0);}`,fftFrag=`#define GLSLIFY 1
uniform sampler2D u_texture;uniform vec2 u_texelSize;uniform float u_subtransformSize;uniform float u_normalization;uniform bool u_isForward;const float TWOPI=6.283185307179586;void main(){
#ifdef HORIZTONAL
float index=gl_FragCoord.x-.5;
#else
float index=gl_FragCoord.y-.5;
#endif
float evenIndex=floor(index/u_subtransformSize)*(u_subtransformSize*0.5)+mod(index,u_subtransformSize*0.5);
#ifdef HORIZTONAL
vec2 evenPos=vec2(evenIndex,gl_FragCoord.y)*u_texelSize;vec2 oddPos=evenPos+vec2(.5,0.);
#else
vec2 evenPos=vec2(gl_FragCoord.x,evenIndex)*u_texelSize;vec2 oddPos=evenPos+vec2(0.,.5);
#endif
vec4 even=texture2D(u_texture,evenPos);vec4 odd=texture2D(u_texture,oddPos);float twiddleArgument=(u_isForward ? TWOPI :-TWOPI)*(index/u_subtransformSize);vec2 twiddle=vec2(cos(twiddleArgument),sin(twiddleArgument));gl_FragColor=(even+vec4(twiddle.x*odd.xy-twiddle.y*odd.zw,twiddle.y*odd.xy+twiddle.x*odd.zw))*u_normalization;}`,convolutionSrcFrag=`#define GLSLIFY 1
uniform vec2 u_aspect;uniform sampler2D u_texture;varying vec2 v_uv;void main(){vec2 toCenter=(fract(v_uv+0.5)-0.5)*u_aspect;vec2 rotToCenter=mat2(0.7071067811865476,-0.7071067811865476,0.7071067811865476,0.7071067811865476)*toCenter;float res=exp(-length(toCenter)*1.0)*0.05+exp(-length(toCenter)*7.5)*0.5+exp(-length(toCenter)*25.0)*1.+exp(-length(toCenter*vec2(1.0,10.0))*30.0)*20.+exp(-length(toCenter*vec2(1.0,20.0))*60.0)*300.+exp(-length(toCenter*vec2(10.0,1.0))*30.0)*20.+exp(-length(toCenter*vec2(20.0,1.0))*60.0)*300.+exp(-length(rotToCenter*vec2(1.0,8.0))*37.5)*12.+exp(-length(rotToCenter*vec2(1.0,20.0))*75.0)*300.+exp(-length(rotToCenter*vec2(20.0,1.0))*75.0)*300.;gl_FragColor=vec4(res,res,0.,0.);}`,convolutionMixFrag=`#define GLSLIFY 1
varying vec2 v_uv;uniform sampler2D u_texture;uniform sampler2D u_kernelTexture;void main(){vec4 a=texture2D(u_texture,v_uv);vec4 b=texture2D(u_kernelTexture,v_uv);gl_FragColor=vec4(a.xy*b.xy-a.zw*b.zw,a.xy*b.zw+a.zw*b.xy);}`,convolutionCacheFrag=`#define GLSLIFY 1
uniform sampler2D u_texture;uniform float u_amount;uniform float u_saturation;varying vec2 v_uv;void main(){gl_FragColor=texture2D(u_texture,v_uv)*u_amount;gl_FragColor.rgb=mix(vec3(dot(gl_FragColor.rgb,vec3(0.299,0.587,0.114))),gl_FragColor.rgb,u_saturation);}`,convolutionFrag=`#define GLSLIFY 1
varying vec2 v_uv;uniform sampler2D u_texture;uniform sampler2D u_bloomTexture;uniform float u_convolutionBuffer;
#include <common>
vec3 dithering(vec3 color){float grid_position=rand(gl_FragCoord.xy);vec3 dither_shift_RGB=vec3(0.25/255.0,-0.25/255.0,0.25/255.0);dither_shift_RGB=mix(2.0*dither_shift_RGB,-2.0*dither_shift_RGB,grid_position);return color+dither_shift_RGB;}void main(){vec4 c=texture2D(u_texture,v_uv);vec2 bloomUv=(v_uv-0.5)/(1.0+u_convolutionBuffer)+0.5;gl_FragColor=c+texture2D(u_bloomTexture,bloomUv);gl_FragColor.rgb=dithering(gl_FragColor.rgb);gl_FragColor.a=1.0;}`;class Bloom extends PostEffect{ITERATION=5;USE_CONVOLUTION=!0;USE_HD=!0;USE_LENS_DIRT=!1;amount=1;radius=0;threshold=.1;smoothWidth=1;highPassMultiplier=1;haloWidth=.8;haloRGBShift=.03;haloStrength=.21;haloMaskInner=.3;haloMaskOuter=.5;highPassMaterial;highPassRenderTarget;fftHMaterial;fftVMaterial;srcMaterial;convolutionSrcFrag=convolutionSrcFrag;srcSize=256;srcRT;fftCacheRT1;fftCacheRT2;fftSrcRT;fftBloomOutCacheMaterial;fftBloomOutCacheRT;convolutionMixMaterial;convolutionMixDownScale=1;convolutionBuffer=.1;renderTargetsHorizontal=[];renderTargetsVertical=[];blurMaterials=[];saturation=1;renderOrder=10;directionX=new Vector2(1,0);directionY=new Vector2(0,1);fftSrcRT;init(e){Object.assign(this,e),super.init();let t=HalfFloatType;if(this.highPassRenderTarget=fboHelper.createRenderTarget(1,1,!this.USE_HD,t),this.highPassMaterial=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:null},u_luminosityThreshold:{value:1},u_smoothWidth:{value:1},u_amount:{value:1},u_haloWidth:{value:1},u_haloRGBShift:{value:1},u_haloStrength:{value:1},u_haloMaskInner:{value:1},u_haloMaskOuter:{value:1},u_texelSize:null,u_aspect:{value:new Vector2},u_dirtTexture:{value:null},u_dirtAspect:{value:new Vector2}},fragmentShader:highPassFrag}),this.highPassMaterial.defines.USE_LENS_DIRT=this.USE_LENS_DIRT,this.USE_CONVOLUTION)this.highPassMaterial.defines.USE_CONVOLUTION=!0,this.highPassMaterial.uniforms.u_convolutionBuffer={value:.15},this.fftSrcRT=fboHelper.createRenderTarget(1,1,!0,t),this.fftCacheRT1=fboHelper.createRenderTarget(1,1,!0,t),this.fftCacheRT2=this.fftCacheRT1.clone(),this.fftBloomOutCacheRT=fboHelper.createRenderTarget(1,1),this.srcMaterial=fboHelper.createRawShaderMaterial({uniforms:{u_aspect:{value:new Vector2}},fragmentShader:this.convolutionSrcFrag}),this.fftHMaterial=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:null},u_texelSize:{value:new Vector2},u_subtransformSize:{value:0},u_normalization:{value:0},u_isForward:{value:0}},fragmentShader:fftFrag}),this.fftHMaterial.defines.HORIZTONAL=!0,this.fftVMaterial=fboHelper.createRawShaderMaterial({uniforms:this.fftHMaterial.uniforms,fragmentShader:fftFrag}),this.convolutionMixMaterial=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:null},u_kernelTexture:{value:this.fftSrcRT.texture}},fragmentShader:convolutionMixFrag}),this.fftBloomOutCacheMaterial=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:null},u_amount:{value:0},u_saturation:{value:0}},fragmentShader:convolutionCacheFrag}),this.material=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:null},u_bloomTexture:{value:this.fftBloomOutCacheRT.texture},u_convolutionBuffer:this.highPassMaterial.uniforms.u_convolutionBuffer},fragmentShader:convolutionFrag,blending:NoBlending});else{for(let r=0;r<this.ITERATION;r++){this.renderTargetsHorizontal.push(fboHelper.createRenderTarget(1,1,!1,t)),this.renderTargetsVertical.push(fboHelper.createRenderTarget(1,1,!1,t));const n=3+r*2;this.blurMaterials[r]=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:null},u_resolution:{value:new Vector2},u_direction:{value:null}},fragmentShader:blurFrag,defines:{KERNEL_RADIUS:n,SIGMA:n}})}this.material=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:null},u_bloomStrength:{value:1},u_bloomWeights:{value:[]},u_saturation:{value:0}},fragmentShader:frag$2,blending:NoBlending,defines:{ITERATION:this.ITERATION}});for(let r=0;r<this.ITERATION;r++)this.material.uniforms["u_blurTexture"+r]={value:this.renderTargetsVertical[r].texture}}}setDirtTexture(e){this.highPassMaterial.uniforms.u_dirtTexture.value=e}setPostprocessing(e){const t=e.width,r=e.height;if(this.USE_CONVOLUTION){let n=math.powerTwoCeiling(t/2)>>this.convolutionMixDownScale,a=math.powerTwoCeiling(r/2)>>this.convolutionMixDownScale;if(this.highPassRenderTarget.setSize(n,a),n!==this.fftCacheRT1.width||a!==this.fftCacheRT1.height){this.fftSrcRT.setSize(n,a),this.fftCacheRT1.setSize(n,a),this.fftCacheRT2.setSize(n,a),this.fftBloomOutCacheRT.setSize(n,a);let l=r/Math.max(t,r);this.srcMaterial.uniforms.u_aspect.value.set(t/r*l,l),fboHelper.render(this.srcMaterial,this.fftCacheRT1),this.renderFFT(this.fftCacheRT1,this.fftSrcRT,!0)}}else{let n=Math.ceil(t/2),a=Math.ceil(r/2);this.highPassRenderTarget.setSize(n,a),super.setPostprocessing(e);for(let l=0;l<this.ITERATION;l++)this.renderTargetsHorizontal[l].setSize(n,a),this.renderTargetsVertical[l].setSize(n,a),this.blurMaterials[l].uniforms.u_resolution.value.set(n,a),n=Math.ceil(n/2),a=Math.ceil(a/2)}}dispose(){if(!this.USE_CONVOLUTION){this.highPassRenderTarget&&this.highPassRenderTarget.dispose();for(let e=0;e<this.ITERATION;e++)this.renderTargetsHorizontal[e]&&this.renderTargetsHorizontal[e].dispose(),this.renderTargetsVertical[e]&&this.renderTargetsVertical[e].dispose()}}needsRender(){return!!this.amount}renderFFT(e,t,r){let n=e.width,a=e.height,l=Math.round(Math.log(n)/Math.log(2)),c=Math.round(Math.log(a)/Math.log(2)),u=l+c,f=u%2===0;this.fftHMaterial;let p=this.fftHMaterial.uniforms;for(let g=0;g<u;g++){let v=g<l;p.u_texture.value=e.texture,p.u_normalization.value=g===0?1/Math.sqrt(n*a):1,p.u_isForward.value=!!r,p.u_texelSize.value.set(1/n,1/a),p.u_subtransformSize.value=Math.pow(2,(v?g:g-l)+1),fboHelper.render(v?this.fftHMaterial:this.fftVMaterial,t);let _=e;e=t,t=_}f&&fboHelper.copy(e.texture,t)}render(e,t=!1){let r=properties.postprocessing.width,n=properties.postprocessing.height;this.highPassMaterial.uniforms.u_texture.value=e.fromTexture,this.highPassMaterial.uniforms.u_luminosityThreshold.value=this.threshold,this.highPassMaterial.uniforms.u_smoothWidth.value=this.smoothWidth,this.highPassMaterial.uniforms.u_amount.value=this.highPassMultiplier,this.highPassMaterial.uniforms.u_haloWidth.value=this.haloWidth,this.highPassMaterial.uniforms.u_haloRGBShift.value=this.haloRGBShift*r,this.highPassMaterial.uniforms.u_haloStrength.value=this.haloStrength,this.highPassMaterial.uniforms.u_haloMaskInner.value=this.haloMaskInner,this.highPassMaterial.uniforms.u_haloMaskOuter.value=this.haloMaskOuter,this.highPassMaterial.uniforms.u_texelSize=e.sharedUniforms.u_texelSize,this.highPassMaterial.uniforms.u_aspect=e.sharedUniforms.u_aspect;let a=this.haloStrength>0,l=n/Math.sqrt(r*r+n*n)*2;if(this.highPassMaterial.uniforms.u_aspect.value.set(r/n*l,l),l=n/Math.max(r,n),this.highPassMaterial.uniforms.u_dirtAspect.value.set(r/n*l,l),this.highPassMaterial.defines.USE_HALO!==a&&(this.highPassMaterial.defines.USE_HALO=a,this.highPassMaterial.needsUpdate=!0),this.USE_CONVOLUTION&&(this.highPassMaterial.uniforms.u_convolutionBuffer.value=this.convolutionBuffer),e.renderMaterial(this.highPassMaterial,this.highPassRenderTarget),this.USE_CONVOLUTION){fboHelper.copy(this.highPassRenderTarget.texture,this.fftCacheRT1),this.renderFFT(this.fftCacheRT1,this.fftCacheRT2,!0),this.convolutionMixMaterial.uniforms.u_texture.value=this.fftCacheRT2.texture,fboHelper.render(this.convolutionMixMaterial,this.fftCacheRT1),this.renderFFT(this.fftCacheRT1,this.fftCacheRT2,!1);let c=this.amount*1024;c=c/Math.pow(math.powerTwoCeilingBase(this.fftCacheRT1.width*this.fftCacheRT1.height),4)*.85,this.fftBloomOutCacheMaterial.uniforms.u_amount.value=c,this.fftBloomOutCacheMaterial.uniforms.u_saturation.value=this.saturation,this.fftBloomOutCacheMaterial.uniforms.u_texture.value=this.fftCacheRT2.texture,e.renderMaterial(this.fftBloomOutCacheMaterial,this.fftBloomOutCacheRT),super.render(e,t)}else{let c=this.highPassRenderTarget;for(let u=0;u<this.ITERATION;u++){const f=this.blurMaterials[u];f.uniforms.u_texture.value=c.texture,f.uniforms.u_direction.value=this.directionX,e.renderMaterial(f,this.renderTargetsHorizontal[u]),f.uniforms.u_texture.value=this.renderTargetsHorizontal[u].texture,f.uniforms.u_direction.value=this.directionY,e.renderMaterial(f,this.renderTargetsVertical[u]),c=this.renderTargetsVertical[u]}this.material.uniforms.u_texture.value=e.fromTexture,this.material.uniforms.u_saturation.value=math.mix(1,this.saturation,.5);for(let u=0;u<this.ITERATION;u++){const f=(this.ITERATION-u)/this.ITERATION;this.material.uniforms.u_bloomWeights.value[u]=this.amount*(f+(1.2-f*2)*this.radius)/Math.pow(2,this.ITERATION-u-1)}super.render(e,t)}}}const frag$1=`#define GLSLIFY 1
uniform sampler2D u_texture;uniform sampler2D u_screenPaintTexture;uniform vec2 u_screenPaintTexelSize;uniform float u_amount;uniform float u_rgbShift;uniform float u_multiplier;uniform float u_colorMultiplier;uniform float u_shade;varying vec2 v_uv;
#include <getBlueNoise>
void main(){vec3 bnoise=getBlueNoise(gl_FragCoord.xy+vec2(17.,29.));vec4 data=texture2D(u_screenPaintTexture,v_uv);float weight=(data.z+data.w)*0.5;vec2 vel=(0.5-data.xy-0.001)*2.*weight;vec4 color=vec4(0.0);vec2 velocity=vel*u_amount/4.0*u_screenPaintTexelSize*u_multiplier;vec2 uv=v_uv+bnoise.xy*velocity;for(int i=0;i<9;i++){color+=texture2D(u_texture,uv);uv+=velocity;}color/=9.;color.rgb+=sin(vec3(vel.x+vel.y)*40.0+vec3(0.0,2.0,4.0)*u_rgbShift)*smoothstep(0.4,-0.9,weight)*u_shade*max(abs(vel.x),abs(vel.y))*u_colorMultiplier;gl_FragColor=color;}`;class ScreenPaintDistortion extends PostEffect{screenPaint=null;amount=20;rgbShift=1;multiplier=1.25;colorMultiplier=1;shade=1.25;renderOrder=75;init(e){if(Object.assign(this,e),super.init(),!this.screenPaint)throw new Error("screenPaint is required");this.material=fboHelper.createRawShaderMaterial({uniforms:Object.assign({u_texture:{value:null},u_screenPaintTexture:this.screenPaint.sharedUniforms.u_currPaintTexture,u_screenPaintTexelSize:this.screenPaint.sharedUniforms.u_paintTexelSize,u_amount:{value:0},u_rgbShift:{value:0},u_multiplier:{value:0},u_colorMultiplier:{value:0},u_shade:{value:0}},blueNoise.sharedUniforms),fragmentShader:frag$1})}needsRender(e){return this.amount>0}syncCamera(e){this.needsSync=!0,e&&(e.matrixWorldInverse.decompose(this._position,this._quaternion,this._scale),this.projectionViewMatrix.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this.projectionViewInverseMatrix.copy(this.projectionViewMatrix).invert()),this.prevProjectionViewMatrix.copy(this.projectionViewMatrix)}render(e,t=!1){this.material.uniforms.u_amount.value=this.amount,this.material.uniforms.u_rgbShift.value=this.rgbShift,this.material.uniforms.u_multiplier.value=this.multiplier,this.material.uniforms.u_colorMultiplier.value=this.colorMultiplier,this.material.uniforms.u_shade.value=this.shade,super.render(e,t)}}const fragmentShader=`#define GLSLIFY 1
varying vec2 v_uv;uniform sampler2D u_texture;uniform vec3 u_bgColor;uniform float u_opacity;uniform float u_vignetteFrom;uniform float u_vignetteTo;uniform vec2 u_vignetteAspect;uniform vec3 u_vignetteColor;uniform float u_saturation;uniform float u_contrast;uniform float u_brightness;uniform vec3 u_tintColor;uniform float u_tintOpacity;uniform float u_ditherSeed;float hash13(vec3 p3){p3=fract(p3*.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}vec3 screen(vec3 cb,vec3 cs){return cb+cs-(cb*cs);}vec3 colorDodge(vec3 cb,vec3 cs){return mix(min(vec3(1.0),cb/(1.0-cs)),vec3(1.0),step(vec3(1.0),cs));}void main(){vec2 uv=v_uv;vec3 color=texture2D(u_texture,uv).rgb;float luma=dot(color,vec3(0.299,0.587,0.114));color=mix(vec3(luma),color,1.0+u_saturation);color=0.5+(1.0+u_contrast)*(color-0.5);color+=u_brightness;color=mix(color,screen(colorDodge(color,u_tintColor),u_tintColor),u_tintOpacity);float d=length((uv-0.5)*u_vignetteAspect)*2.0;color=mix(color,u_vignetteColor,smoothstep(u_vignetteFrom,u_vignetteTo,d));gl_FragColor=vec4(mix(u_bgColor,color,u_opacity)+hash13(vec3(gl_FragCoord.xy,u_ditherSeed))/255.0,1.0);}`;class Final extends PostEffect{vignetteFrom=.6;vignetteTo=1.6;vignetteAspect=new Vector2;vignetteColor=new Color;saturation=1;contrast=0;brightness=1;tintColor=new Color;tintOpacity=1;bgColor=new Color;opacity=1;isActive=!1;renderOrder=30;init(e){Object.assign(this,e),super.init(),this.material=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:null},u_vignetteFrom:{value:0},u_vignetteTo:{value:0},u_vignetteAspect:{value:this.vignetteAspect},u_vignetteColor:{value:this.vignetteColor},u_saturation:{value:0},u_contrast:{value:0},u_brightness:{value:0},u_tintColor:{value:this.tintColor},u_tintOpacity:{value:0},u_bgColor:{value:this.bgColor},u_opacity:{value:0},u_ditherSeed:{value:0}},fragmentShader})}needsRender(){return this.isActive}render(e,t=!1){const r=e.width,n=e.height;let a=this.material.uniforms;a.u_vignetteFrom.value=this.vignetteFrom,a.u_vignetteTo.value=this.vignetteTo;const l=n/Math.sqrt(r*r+n*n);this.vignetteAspect.set(r/n*l,l),a.u_saturation.value=this.saturation-1,a.u_contrast.value=this.contrast,a.u_brightness.value=this.brightness-1,a.u_tintOpacity.value=this.tintOpacity,a.u_opacity.value=this.opacity,a.u_ditherSeed.value=Math.random()*1e3,super.render(e,t)}}const easuFrag=`#define GLSLIFY 1
uniform sampler2D u_texture;uniform vec2 u_inResolution;uniform vec2 u_outResolution;vec3 FsrEasuCF(vec2 p){return texture2D(u_texture,p).rgb;}void FsrEasuCon(out vec4 con0,out vec4 con1,out vec4 con2,out vec4 con3,vec2 inputViewportInPixels,vec2 inputSizeInPixels,vec2 outputSizeInPixels){con0=vec4(inputViewportInPixels.x/outputSizeInPixels.x,inputViewportInPixels.y/outputSizeInPixels.y,.5*inputViewportInPixels.x/outputSizeInPixels.x-.5,.5*inputViewportInPixels.y/outputSizeInPixels.y-.5);con1=vec4(1,1,1,-1)/inputSizeInPixels.xyxy;con2=vec4(-1,2,1,2)/inputSizeInPixels.xyxy;con3=vec4(0,4,0,0)/inputSizeInPixels.xyxy;}void FsrEasuTapF(inout vec3 aC,inout float aW,vec2 off,vec2 dir,vec2 len,float lob,float clp,vec3 c){vec2 v=vec2(dot(off,dir),dot(off,vec2(-dir.y,dir.x)));v*=len;float d2=min(dot(v,v),clp);float wB=.4*d2-1.;float wA=lob*d2-1.;wB*=wB;wA*=wA;wB=1.5625*wB-.5625;float w=wB*wA;aC+=c*w;aW+=w;}void FsrEasuSetF(inout vec2 dir,inout float len,float w,float lA,float lB,float lC,float lD,float lE){float lenX=max(abs(lD-lC),abs(lC-lB));float dirX=lD-lB;dir.x+=dirX*w;lenX=clamp(abs(dirX)/lenX,0.,1.);lenX*=lenX;len+=lenX*w;float lenY=max(abs(lE-lC),abs(lC-lA));float dirY=lE-lA;dir.y+=dirY*w;lenY=clamp(abs(dirY)/lenY,0.,1.);lenY*=lenY;len+=lenY*w;}void FsrEasuF(out vec3 pix,vec2 ip,vec4 con0,vec4 con1,vec4 con2,vec4 con3){vec2 pp=ip*con0.xy+con0.zw;vec2 fp=floor(pp);pp-=fp;vec2 p0=fp*con1.xy+con1.zw;vec2 p1=p0+con2.xy;vec2 p2=p0+con2.zw;vec2 p3=p0+con3.xy;vec4 off=vec4(-.5,.5,-.5,.5)*con1.xxyy;vec3 bC=FsrEasuCF(p0+off.xw);float bL=bC.g+0.5*(bC.r+bC.b);vec3 cC=FsrEasuCF(p0+off.yw);float cL=cC.g+0.5*(cC.r+cC.b);vec3 iC=FsrEasuCF(p1+off.xw);float iL=iC.g+0.5*(iC.r+iC.b);vec3 jC=FsrEasuCF(p1+off.yw);float jL=jC.g+0.5*(jC.r+jC.b);vec3 fC=FsrEasuCF(p1+off.yz);float fL=fC.g+0.5*(fC.r+fC.b);vec3 eC=FsrEasuCF(p1+off.xz);float eL=eC.g+0.5*(eC.r+eC.b);vec3 kC=FsrEasuCF(p2+off.xw);float kL=kC.g+0.5*(kC.r+kC.b);vec3 lC=FsrEasuCF(p2+off.yw);float lL=lC.g+0.5*(lC.r+lC.b);vec3 hC=FsrEasuCF(p2+off.yz);float hL=hC.g+0.5*(hC.r+hC.b);vec3 gC=FsrEasuCF(p2+off.xz);float gL=gC.g+0.5*(gC.r+gC.b);vec3 oC=FsrEasuCF(p3+off.yz);float oL=oC.g+0.5*(oC.r+oC.b);vec3 nC=FsrEasuCF(p3+off.xz);float nL=nC.g+0.5*(nC.r+nC.b);vec2 dir=vec2(0.);float len=0.;FsrEasuSetF(dir,len,(1.-pp.x)*(1.-pp.y),bL,eL,fL,gL,jL);FsrEasuSetF(dir,len,pp.x*(1.-pp.y),cL,fL,gL,hL,kL);FsrEasuSetF(dir,len,(1.-pp.x)*pp.y,fL,iL,jL,kL,nL);FsrEasuSetF(dir,len,pp.x*pp.y,gL,jL,kL,lL,oL);vec2 dir2=dir*dir;float dirR=dir2.x+dir2.y;bool zro=dirR<(1./32768.);dirR=inversesqrt(dirR);dirR=zro ? 1. : dirR;dir.x=zro ? 1. : dir.x;dir*=vec2(dirR);len=len*.5;len*=len;float stretch=dot(dir,dir)/(max(abs(dir.x),abs(dir.y)));vec2 len2=vec2(1.+(stretch-1.0)*len,1.-.5*len);float lob=.5-.29*len;float clp=1./lob;vec3 min4=min(min(fC,gC),min(jC,kC));vec3 max4=max(max(fC,gC),max(jC,kC));vec3 aC=vec3(0);float aW=0.;FsrEasuTapF(aC,aW,vec2(0.,-1.)-pp,dir,len2,lob,clp,bC);FsrEasuTapF(aC,aW,vec2(1.,-1.)-pp,dir,len2,lob,clp,cC);FsrEasuTapF(aC,aW,vec2(-1.,1.)-pp,dir,len2,lob,clp,iC);FsrEasuTapF(aC,aW,vec2(0.,1.)-pp,dir,len2,lob,clp,jC);FsrEasuTapF(aC,aW,vec2(0.,0.)-pp,dir,len2,lob,clp,fC);FsrEasuTapF(aC,aW,vec2(-1.,0.)-pp,dir,len2,lob,clp,eC);FsrEasuTapF(aC,aW,vec2(1.,1.)-pp,dir,len2,lob,clp,kC);FsrEasuTapF(aC,aW,vec2(2.,1.)-pp,dir,len2,lob,clp,lC);FsrEasuTapF(aC,aW,vec2(2.,0.)-pp,dir,len2,lob,clp,hC);FsrEasuTapF(aC,aW,vec2(1.,0.)-pp,dir,len2,lob,clp,gC);FsrEasuTapF(aC,aW,vec2(1.,2.)-pp,dir,len2,lob,clp,oC);FsrEasuTapF(aC,aW,vec2(0.,2.)-pp,dir,len2,lob,clp,nC);pix=min(max4,max(min4,aC/aW));}void main(){vec3 c;vec4 con0,con1,con2,con3;FsrEasuCon(con0,con1,con2,con3,u_inResolution,u_inResolution,u_outResolution);FsrEasuF(c,gl_FragCoord.xy,con0,con1,con2,con3);gl_FragColor=vec4(c.xyz,1);}`,frag=`#define GLSLIFY 1
uniform sampler2D u_texture;uniform vec2 u_outResolution;uniform float u_sharpness;
#define FSR_RCAS_LIMIT (0.25-(1.0/16.0))
vec4 FsrRcasLoadF(vec2 p);void FsrRcasCon(out float con,float sharpness){con=exp2(-sharpness);}vec3 FsrRcasF(vec2 ip,float con){vec2 sp=vec2(ip);vec3 b=FsrRcasLoadF(sp+vec2(0,-1)).rgb;vec3 d=FsrRcasLoadF(sp+vec2(-1,0)).rgb;vec3 e=FsrRcasLoadF(sp).rgb;vec3 f=FsrRcasLoadF(sp+vec2(1,0)).rgb;vec3 h=FsrRcasLoadF(sp+vec2(0,1)).rgb;float bL=b.g+.5*(b.b+b.r);float dL=d.g+.5*(d.b+d.r);float eL=e.g+.5*(e.b+e.r);float fL=f.g+.5*(f.b+f.r);float hL=h.g+.5*(h.b+h.r);float nz=.25*(bL+dL+fL+hL)-eL;nz=clamp(abs(nz)/(max(max(bL,dL),max(eL,max(fL,hL)))-min(min(bL,dL),min(eL,min(fL,hL)))),0.,1.);nz=1.-.5*nz;vec3 mn4=min(b,min(f,h));vec3 mx4=max(b,max(f,h));vec2 peakC=vec2(1.,-4.);vec3 hitMin=mn4/(4.*mx4);vec3 hitMax=(peakC.x-mx4)/(4.*mn4+peakC.y);vec3 lobeRGB=max(-hitMin,hitMax);float lobe=max(-FSR_RCAS_LIMIT,min(max(lobeRGB.r,max(lobeRGB.g,lobeRGB.b)),0.))*con;
#ifdef FSR_RCAS_DENOISE
lobe*=nz;
#endif
return(lobe*(b+d+h+f)+e)/(4.*lobe+1.);}vec4 FsrRcasLoadF(vec2 p){return texture2D(u_texture,p/u_outResolution.xy);}void main(){vec2 uv=gl_FragCoord.xy/u_outResolution.xy;float con;FsrRcasCon(con,u_sharpness);vec3 col=FsrRcasF(gl_FragCoord.xy,con);gl_FragColor=vec4(col,1.);}`;let Fsr$1=class{sharpness=1;_easuMaterial;_material;_inResolution=new Vector2;_outResolution=new Vector2;_cacheRenderTarget=null;constructor(){this._cacheRenderTarget=fboHelper.createRenderTarget(1,1),this._easuMaterial=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:null},u_inResolution:{value:this._inResolution},u_outResolution:{value:this._outResolution}},fragmentShader:easuFrag}),this._material=fboHelper.createRawShaderMaterial({uniforms:{u_texture:{value:this._cacheRenderTarget.texture},u_outResolution:this._easuMaterial.uniforms.u_outResolution,u_sharpness:{value:0}},fragmentShader:frag})}render(e,t){let r=e.image.width,n=e.image.height;this._material.uniforms.u_sharpness.value=this.sharpness,(this._inResolution.width!==r||this._inResolution.height!==n)&&this._inResolution.set(r,n);let a,l;t?(a=t.width,l=t.height):(a=fboHelper.renderer.domElement.width,l=fboHelper.renderer.domElement.height),(this._outResolution.width!==a||this._outResolution.height!==l)&&(this._outResolution.set(a,l),this._cacheRenderTarget.setSize(a,l)),this._easuMaterial.uniforms.u_texture.value=e,fboHelper.render(this._easuMaterial,this._cacheRenderTarget),t||(fboHelper.renderer.setRenderTarget(null),fboHelper.renderer.setViewport(0,0,this._outResolution.x,this._outResolution.y)),fboHelper.render(this._material,t)}};class Fsr extends PostEffect{sharpness=1;fsr;renderOrder=2e3;init(e){Object.assign(this,e),super.init(),this.fsr=new Fsr$1}render(e,t=!1){this.fsr.sharpness=this.sharpness,this.fsr.render(e.fromTexture,t?null:e.toRenderTarget),e.swap()}}const XHRItem=properties.loader.ITEM_CLASSES.xhr;class BufItem extends XHRItem{constructor(e,t){super(e,{...t,responseType:"arraybuffer"})}retrieve(){return!1}_onLoad(){if(!this.content){const e=this.xmlhttp.response;let t=new Uint32Array(e,0,1)[0],r=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(e,4,t))),n=r.vertexCount,a=r.indexCount,l=4+t,c=new BufferGeometry,u=r.attributes,f=!1,p={};for(let _=0,T=u.length;_<T;_++){let M=u[_],S=M.id,b=S==="indices"?a:n,C=M.componentSize,w=window[M.storageType],R=new w(e,l,b*C),E=w.BYTES_PER_ELEMENT,I;if(M.needsPack){let F=M.packedComponents,k=F.length,L=M.storageType.indexOf("Int")===0,D=1<<E*8,ne=L?D*.5:0,re=1/D;I=new Float32Array(b*C);for(let ce=0,z=0;ce<b;ce++)for(let j=0;j<k;j++){let X=F[j];I[z]=(R[z]+ne)*re*X.delta+X.from,z++}}else p[S]=l,I=R;S==="normal"&&(f=!0),S==="indices"?c.setIndex(new BufferAttribute(I,1)):c.setAttribute(S,new BufferAttribute(I,C)),l+=b*C*E}let g=r.meshType,v=[];if(r.sceneData){let _=r.sceneData,T=new Object3D,M=[],S=g==="Mesh"?3:g==="LineSegments"?2:1;for(let b=0,C=_.length;b<C;b++){let w=_[b],R;if(w.vertexCount==0)R=new Object3D;else{let E=new BufferGeometry,I=c.index,F=I.array,k=F.constructor,L=k.BYTES_PER_ELEMENT;E.setIndex(new BufferAttribute(new F.constructor(F.buffer,w.faceIndex*I.itemSize*L*S+(p.indices||0),w.faceCount*I.itemSize*S),I.itemSize));for(let D=0,ne=E.index.array.length;D<ne;D++)E.index.array[D]-=w.vertexIndex;for(let D in c.attributes)I=c.attributes[D],F=I.array,k=F.constructor,L=k.BYTES_PER_ELEMENT,E.setAttribute(D,new BufferAttribute(new F.constructor(F.buffer,w.vertexIndex*I.itemSize*L+(p[D]||0),w.vertexCount*I.itemSize),I.itemSize));g==="Mesh"?R=new Mesh(E,new MeshNormalMaterial({flatShading:!f})):g==="LineSegments"?R=new LineSegments(E,new LineBasicMaterial):R=new Points(E,new PointsMaterial({sizeAttenuation:!1,size:2})),M.push(R)}w.parentIndex>-1?v[w.parentIndex].add(R):T.add(R),R.position.fromArray(w.position),R.quaternion.fromArray(w.quaternion),R.scale.fromArray(w.scale),R.name=w.name,R.userData.material=w.material,v[b]=R}c.userData.meshList=M,c.userData.sceneObject=T}this.content=c}this.xmlhttp=void 0,super._onLoad(this)}}BufItem.type="buf";BufItem.extensions=["buf"];BufItem.responseType="arraybuffer";/*!
fflate - fast JavaScript compression/decompression
<https://101arrowz.github.io/fflate>
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
version 0.6.9
*/var durl=function(o){return URL.createObjectURL(new Blob([o],{type:"text/javascript"}))};try{URL.revokeObjectURL(durl(""))}catch(o){durl=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}var u8=Uint8Array,u16=Uint16Array,u32=Uint32Array,fleb=new u8([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),fdeb=new u8([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),clim=new u8([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(o,e){for(var t=new u16(31),r=0;r<31;++r)t[r]=e+=1<<o[r-1];for(var n=new u32(t[30]),r=1;r<30;++r)for(var a=t[r];a<t[r+1];++a)n[a]=a-t[r]<<5|r;return[t,n]},_a=freb(fleb,2),fl=_a[0],revfl=_a[1];fl[28]=258,revfl[258]=28;var _b=freb(fdeb,0),fd=_b[0],rev=new u16(32768);for(var i=0;i<32768;++i){var x=(i&43690)>>>1|(i&21845)<<1;x=(x&52428)>>>2|(x&13107)<<2,x=(x&61680)>>>4|(x&3855)<<4,rev[i]=((x&65280)>>>8|(x&255)<<8)>>>1}var hMap=function(o,e,t){for(var r=o.length,n=0,a=new u16(e);n<r;++n)++a[o[n]-1];var l=new u16(e);for(n=0;n<e;++n)l[n]=l[n-1]+a[n-1]<<1;var c;if(t){c=new u16(1<<e);var u=15-e;for(n=0;n<r;++n)if(o[n])for(var f=n<<4|o[n],p=e-o[n],g=l[o[n]-1]++<<p,v=g|(1<<p)-1;g<=v;++g)c[rev[g]>>>u]=f}else for(c=new u16(r),n=0;n<r;++n)o[n]&&(c[n]=rev[l[o[n]-1]++]>>>15-o[n]);return c},flt=new u8(288);for(var i=0;i<144;++i)flt[i]=8;for(var i=144;i<256;++i)flt[i]=9;for(var i=256;i<280;++i)flt[i]=7;for(var i=280;i<288;++i)flt[i]=8;var fdt=new u8(32);for(var i=0;i<32;++i)fdt[i]=5;var flrm=hMap(flt,9,1),fdrm=hMap(fdt,5,1),max=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},bits=function(o,e,t){var r=e/8|0;return(o[r]|o[r+1]<<8)>>(e&7)&t},bits16=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},shft=function(o){return(o/8|0)+(o&7&&1)},slc=function(o,e,t){(t==null||t>o.length)&&(t=o.length);var r=new(o instanceof u16?u16:o instanceof u32?u32:u8)(t-e);return r.set(o.subarray(e,t)),r},inflt=function(o,e,t){var r=o.length;if(!r||t&&!t.l&&r<5)return e||new u8(0);var n=!e||t,a=!t||t.i;t||(t={}),e||(e=new u8(r*3));var l=function(U){var N=e.length;if(U>N){var he=new u8(Math.max(N*2,U));he.set(e),e=he}},c=t.f||0,u=t.p||0,f=t.b||0,p=t.l,g=t.d,v=t.m,_=t.n,T=r*8;do{if(!p){t.f=c=bits(o,u,1);var M=bits(o,u+1,3);if(u+=3,M)if(M==1)p=flrm,g=fdrm,v=9,_=5;else if(M==2){var w=bits(o,u,31)+257,R=bits(o,u+10,15)+4,E=w+bits(o,u+5,31)+1;u+=14;for(var I=new u8(E),F=new u8(19),k=0;k<R;++k)F[clim[k]]=bits(o,u+k*3,7);u+=R*3;for(var L=max(F),D=(1<<L)-1,ne=hMap(F,L,1),k=0;k<E;){var re=ne[bits(o,u,D)];u+=re&15;var S=re>>>4;if(S<16)I[k++]=S;else{var ce=0,z=0;for(S==16?(z=3+bits(o,u,3),u+=2,ce=I[k-1]):S==17?(z=3+bits(o,u,7),u+=3):S==18&&(z=11+bits(o,u,127),u+=7);z--;)I[k++]=ce}}var j=I.subarray(0,w),X=I.subarray(w);v=max(j),_=max(X),p=hMap(j,v,1),g=hMap(X,_,1)}else throw"invalid block type";else{var S=shft(u)+4,b=o[S-4]|o[S-3]<<8,C=S+b;if(C>r){if(a)throw"unexpected EOF";break}n&&l(f+b),e.set(o.subarray(S,C),f),t.b=f+=b,t.p=u=C*8;continue}if(u>T){if(a)throw"unexpected EOF";break}}n&&l(f+131072);for(var Z=(1<<v)-1,q=(1<<_)-1,ue=u;;ue=u){var ce=p[bits16(o,u)&Z],oe=ce>>>4;if(u+=ce&15,u>T){if(a)throw"unexpected EOF";break}if(!ce)throw"invalid length/literal";if(oe<256)e[f++]=oe;else if(oe==256){ue=u,p=null;break}else{var te=oe-254;if(oe>264){var k=oe-257,le=fleb[k];te=bits(o,u,(1<<le)-1)+fl[k],u+=le}var Te=g[bits16(o,u)&q],K=Te>>>4;if(!Te)throw"invalid distance";u+=Te&15;var X=fd[K];if(K>3){var le=fdeb[K];X+=bits16(o,u)&(1<<le)-1,u+=le}if(u>T){if(a)throw"unexpected EOF";break}n&&l(f+131072);for(var G=f+te;f<G;f+=4)e[f]=e[f-X],e[f+1]=e[f+1-X],e[f+2]=e[f+2-X],e[f+3]=e[f+3-X];f=G}}t.l=p,t.p=ue,t.b=f,p&&(c=1,t.m=v,t.d=g,t.n=_)}while(!c);return f==e.length?e:slc(e,0,f)},et=new u8(0),zlv=function(o){if((o[0]&15)!=8||o[0]>>>4>7||(o[0]<<8|o[1])%31)throw"invalid zlib data";if(o[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function unzlibSync(o,e){return inflt((zlv(o),o.subarray(2,-4)),e)}var td=typeof TextDecoder<"u"&&new TextDecoder,tds=0;try{td.decode(et,{stream:!0}),tds=1}catch(o){}class EXRLoader extends DataTextureLoader{constructor(e){super(e),this.type=HalfFloatType}parse(e){const L=Math.pow(2.7182818,2.2);function D(P,B){let Q=0;for(let H=0;H<65536;++H)(H==0||P[H>>3]&1<<(H&7))&&(B[Q++]=H);const A=Q-1;for(;Q<65536;)B[Q++]=0;return A}function ne(P){for(let B=0;B<16384;B++)P[B]={},P[B].len=0,P[B].lit=0,P[B].p=null}const re={l:0,c:0,lc:0};function ce(P,B,Q,A,H){for(;Q<P;)B=B<<8|ot(A,H),Q+=8;Q-=P,re.l=B>>Q&(1<<P)-1,re.c=B,re.lc=Q}const z=new Array(59);function j(P){for(let Q=0;Q<=58;++Q)z[Q]=0;for(let Q=0;Q<65537;++Q)z[P[Q]]+=1;let B=0;for(let Q=58;Q>0;--Q){const A=B+z[Q]>>1;z[Q]=B,B=A}for(let Q=0;Q<65537;++Q){const A=P[Q];A>0&&(P[Q]=A|z[A]++<<6)}}function X(P,B,Q,A,H,V){const J=B;let ie=0,ge=0;for(;A<=H;A++){if(J.value-B.value>Q)return!1;ce(6,ie,ge,P,J);const pe=re.l;if(ie=re.c,ge=re.lc,V[A]=pe,pe==63){if(J.value-B.value>Q)throw new Error("Something wrong with hufUnpackEncTable");ce(8,ie,ge,P,J);let ye=re.l+6;if(ie=re.c,ge=re.lc,A+ye>H+1)throw new Error("Something wrong with hufUnpackEncTable");for(;ye--;)V[A++]=0;A--}else if(pe>=59){let ye=pe-59+2;if(A+ye>H+1)throw new Error("Something wrong with hufUnpackEncTable");for(;ye--;)V[A++]=0;A--}}j(V)}function Z(P){return P&63}function q(P){return P>>6}function ue(P,B,Q,A){for(;B<=Q;B++){const H=q(P[B]),V=Z(P[B]);if(H>>V)throw new Error("Invalid table entry");if(V>14){const J=A[H>>V-14];if(J.len)throw new Error("Invalid table entry");if(J.lit++,J.p){const ie=J.p;J.p=new Array(J.lit);for(let ge=0;ge<J.lit-1;++ge)J.p[ge]=ie[ge]}else J.p=new Array(1);J.p[J.lit-1]=B}else if(V){let J=0;for(let ie=1<<14-V;ie>0;ie--){const ge=A[(H<<14-V)+J];if(ge.len||ge.p)throw new Error("Invalid table entry");ge.len=V,ge.lit=B,J++}}}return!0}const oe={c:0,lc:0};function te(P,B,Q,A){P=P<<8|ot(Q,A),B+=8,oe.c=P,oe.lc=B}const le={c:0,lc:0};function Te(P,B,Q,A,H,V,J,ie,ge){if(P==B){A<8&&(te(Q,A,H,V),Q=oe.c,A=oe.lc),A-=8;let pe=Q>>A;if(pe=new Uint8Array([pe])[0],ie.value+pe>ge)return!1;const ye=J[ie.value-1];for(;pe-- >0;)J[ie.value++]=ye}else if(ie.value<ge)J[ie.value++]=P;else return!1;le.c=Q,le.lc=A}function K(P){return P&65535}function G(P){const B=K(P);return B>32767?B-65536:B}const U={a:0,b:0};function N(P,B){const Q=G(P),H=G(B),V=Q+(H&1)+(H>>1),J=V,ie=V-H;U.a=J,U.b=ie}function he(P,B){const Q=K(P),A=K(B),H=Q-(A>>1)&65535,V=A+H-32768&65535;U.a=V,U.b=H}function ve(P,B,Q,A,H,V,J){const ie=J<16384,ge=Q>H?H:Q;let pe=1,ye,Ce;for(;pe<=ge;)pe<<=1;for(pe>>=1,ye=pe,pe>>=1;pe>=1;){Ce=0;const Ae=Ce+V*(H-ye),De=V*pe,He=V*ye,Ve=A*pe,$e=A*ye;let Ze,ct,it,Qe;for(;Ce<=Ae;Ce+=He){let ut=Ce;const Ke=Ce+A*(Q-ye);for(;ut<=Ke;ut+=$e){const dt=ut+Ve,_t=ut+De,ft=_t+Ve;ie?(N(P[ut+B],P[_t+B]),Ze=U.a,it=U.b,N(P[dt+B],P[ft+B]),ct=U.a,Qe=U.b,N(Ze,ct),P[ut+B]=U.a,P[dt+B]=U.b,N(it,Qe),P[_t+B]=U.a,P[ft+B]=U.b):(he(P[ut+B],P[_t+B]),Ze=U.a,it=U.b,he(P[dt+B],P[ft+B]),ct=U.a,Qe=U.b,he(Ze,ct),P[ut+B]=U.a,P[dt+B]=U.b,he(it,Qe),P[_t+B]=U.a,P[ft+B]=U.b)}if(Q&pe){const dt=ut+De;ie?N(P[ut+B],P[dt+B]):he(P[ut+B],P[dt+B]),Ze=U.a,P[dt+B]=U.b,P[ut+B]=Ze}}if(H&pe){let ut=Ce;const Ke=Ce+A*(Q-ye);for(;ut<=Ke;ut+=$e){const dt=ut+Ve;ie?N(P[ut+B],P[dt+B]):he(P[ut+B],P[dt+B]),Ze=U.a,P[dt+B]=U.b,P[ut+B]=Ze}}ye=pe,pe>>=1}return Ce}function de(P,B,Q,A,H,V,J,ie,ge){let pe=0,ye=0;const Ce=J,Ae=Math.trunc(A.value+(H+7)/8);for(;A.value<Ae;)for(te(pe,ye,Q,A),pe=oe.c,ye=oe.lc;ye>=14;){const He=pe>>ye-14&16383,Ve=B[He];if(Ve.len)ye-=Ve.len,Te(Ve.lit,V,pe,ye,Q,A,ie,ge,Ce),pe=le.c,ye=le.lc;else{if(!Ve.p)throw new Error("hufDecode issues");let $e;for($e=0;$e<Ve.lit;$e++){const Ze=Z(P[Ve.p[$e]]);for(;ye<Ze&&A.value<Ae;)te(pe,ye,Q,A),pe=oe.c,ye=oe.lc;if(ye>=Ze&&q(P[Ve.p[$e]])==(pe>>ye-Ze&(1<<Ze)-1)){ye-=Ze,Te(Ve.p[$e],V,pe,ye,Q,A,ie,ge,Ce),pe=le.c,ye=le.lc;break}}if($e==Ve.lit)throw new Error("hufDecode issues")}}const De=8-H&7;for(pe>>=De,ye-=De;ye>0;){const He=B[pe<<14-ye&16383];if(He.len)ye-=He.len,Te(He.lit,V,pe,ye,Q,A,ie,ge,Ce),pe=le.c,ye=le.lc;else throw new Error("hufDecode issues")}return!0}function xe(P,B,Q,A,H,V){const J={value:0},ie=Q.value,ge=Re(B,Q),pe=Re(B,Q);Q.value+=4;const ye=Re(B,Q);if(Q.value+=4,ge<0||ge>=65537||pe<0||pe>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const Ce=new Array(65537),Ae=new Array(16384);ne(Ae);const De=A-(Q.value-ie);if(X(P,Q,De,ge,pe,Ce),ye>8*(A-(Q.value-ie)))throw new Error("Something wrong with hufUncompress");ue(Ce,ge,pe,Ae),de(Ce,Ae,P,Q,ye,pe,V,H,J)}function ee(P,B,Q){for(let A=0;A<Q;++A)B[A]=P[B[A]]}function Ue(P){for(let B=1;B<P.length;B++){const Q=P[B-1]+P[B]-128;P[B]=Q}}function fe(P,B){let Q=0,A=Math.floor((P.length+1)/2),H=0;const V=P.length-1;for(;!(H>V||(B[H++]=P[Q++],H>V));)B[H++]=P[A++]}function Se(P){let B=P.byteLength;const Q=new Array;let A=0;const H=new DataView(P);for(;B>0;){const V=H.getInt8(A++);if(V<0){const J=-V;B-=J+1;for(let ie=0;ie<J;ie++)Q.push(H.getUint8(A++))}else{const J=V;B-=2;const ie=H.getUint8(A++);for(let ge=0;ge<J+1;ge++)Q.push(ie)}}return Q}function Me(P,B,Q,A,H,V){let J=new DataView(V.buffer);const ie=Q[P.idx[0]].width,ge=Q[P.idx[0]].height,pe=3,ye=Math.floor(ie/8),Ce=Math.ceil(ie/8),Ae=Math.ceil(ge/8),De=ie-(Ce-1)*8,He=ge-(Ae-1)*8,Ve={value:0},$e=new Array(pe),Ze=new Array(pe),ct=new Array(pe),it=new Array(pe),Qe=new Array(pe);for(let Ke=0;Ke<pe;++Ke)Qe[Ke]=B[P.idx[Ke]],$e[Ke]=Ke<1?0:$e[Ke-1]+Ce*Ae,Ze[Ke]=new Float32Array(64),ct[Ke]=new Uint16Array(64),it[Ke]=new Uint16Array(Ce*64);for(let Ke=0;Ke<Ae;++Ke){let dt=8;Ke==Ae-1&&(dt=He);let _t=8;for(let lt=0;lt<Ce;++lt){lt==Ce-1&&(_t=De);for(let rt=0;rt<pe;++rt)ct[rt].fill(0),ct[rt][0]=H[$e[rt]++],Be(Ve,A,ct[rt]),se(ct[rt],Ze[rt]),$(Ze[rt]);Oe(Ze);for(let rt=0;rt<pe;++rt)Ye(Ze[rt],it[rt],lt*64)}let ft=0;for(let lt=0;lt<pe;++lt){const rt=Q[P.idx[lt]].type;for(let vt=8*Ke;vt<8*Ke+dt;++vt){ft=Qe[lt][vt];for(let bt=0;bt<ye;++bt){const mt=bt*64+(vt&7)*8;J.setUint16(ft+0*2*rt,it[lt][mt+0],!0),J.setUint16(ft+1*2*rt,it[lt][mt+1],!0),J.setUint16(ft+2*2*rt,it[lt][mt+2],!0),J.setUint16(ft+3*2*rt,it[lt][mt+3],!0),J.setUint16(ft+4*2*rt,it[lt][mt+4],!0),J.setUint16(ft+5*2*rt,it[lt][mt+5],!0),J.setUint16(ft+6*2*rt,it[lt][mt+6],!0),J.setUint16(ft+7*2*rt,it[lt][mt+7],!0),ft+=8*2*rt}}if(ye!=Ce)for(let vt=8*Ke;vt<8*Ke+dt;++vt){const bt=Qe[lt][vt]+8*ye*2*rt,mt=ye*64+(vt&7)*8;for(let wt=0;wt<_t;++wt)J.setUint16(bt+wt*2*rt,it[lt][mt+wt],!0)}}}const ut=new Uint16Array(ie);J=new DataView(V.buffer);for(let Ke=0;Ke<pe;++Ke){Q[P.idx[Ke]].decoded=!0;const dt=Q[P.idx[Ke]].type;if(Q[Ke].type==2)for(let _t=0;_t<ge;++_t){const ft=Qe[Ke][_t];for(let lt=0;lt<ie;++lt)ut[lt]=J.getUint16(ft+lt*2*dt,!0);for(let lt=0;lt<ie;++lt)J.setFloat32(ft+lt*2*dt,Pe(ut[lt]),!0)}}}function Be(P,B,Q){let A,H=1;for(;H<64;)A=B[P.value],A==65280?H=64:A>>8==255?H+=A&255:(Q[H]=A,H++),P.value++}function se(P,B){B[0]=Pe(P[0]),B[1]=Pe(P[1]),B[2]=Pe(P[5]),B[3]=Pe(P[6]),B[4]=Pe(P[14]),B[5]=Pe(P[15]),B[6]=Pe(P[27]),B[7]=Pe(P[28]),B[8]=Pe(P[2]),B[9]=Pe(P[4]),B[10]=Pe(P[7]),B[11]=Pe(P[13]),B[12]=Pe(P[16]),B[13]=Pe(P[26]),B[14]=Pe(P[29]),B[15]=Pe(P[42]),B[16]=Pe(P[3]),B[17]=Pe(P[8]),B[18]=Pe(P[12]),B[19]=Pe(P[17]),B[20]=Pe(P[25]),B[21]=Pe(P[30]),B[22]=Pe(P[41]),B[23]=Pe(P[43]),B[24]=Pe(P[9]),B[25]=Pe(P[11]),B[26]=Pe(P[18]),B[27]=Pe(P[24]),B[28]=Pe(P[31]),B[29]=Pe(P[40]),B[30]=Pe(P[44]),B[31]=Pe(P[53]),B[32]=Pe(P[10]),B[33]=Pe(P[19]),B[34]=Pe(P[23]),B[35]=Pe(P[32]),B[36]=Pe(P[39]),B[37]=Pe(P[45]),B[38]=Pe(P[52]),B[39]=Pe(P[54]),B[40]=Pe(P[20]),B[41]=Pe(P[22]),B[42]=Pe(P[33]),B[43]=Pe(P[38]),B[44]=Pe(P[46]),B[45]=Pe(P[51]),B[46]=Pe(P[55]),B[47]=Pe(P[60]),B[48]=Pe(P[21]),B[49]=Pe(P[34]),B[50]=Pe(P[37]),B[51]=Pe(P[47]),B[52]=Pe(P[50]),B[53]=Pe(P[56]),B[54]=Pe(P[59]),B[55]=Pe(P[61]),B[56]=Pe(P[35]),B[57]=Pe(P[36]),B[58]=Pe(P[48]),B[59]=Pe(P[49]),B[60]=Pe(P[57]),B[61]=Pe(P[58]),B[62]=Pe(P[62]),B[63]=Pe(P[63])}function $(P){const B=.5*Math.cos(.7853975),Q=.5*Math.cos(3.14159/16),A=.5*Math.cos(3.14159/8),H=.5*Math.cos(3*3.14159/16),V=.5*Math.cos(5*3.14159/16),J=.5*Math.cos(3*3.14159/8),ie=.5*Math.cos(7*3.14159/16),ge=new Array(4),pe=new Array(4),ye=new Array(4),Ce=new Array(4);for(let Ae=0;Ae<8;++Ae){const De=Ae*8;ge[0]=A*P[De+2],ge[1]=J*P[De+2],ge[2]=A*P[De+6],ge[3]=J*P[De+6],pe[0]=Q*P[De+1]+H*P[De+3]+V*P[De+5]+ie*P[De+7],pe[1]=H*P[De+1]-ie*P[De+3]-Q*P[De+5]-V*P[De+7],pe[2]=V*P[De+1]-Q*P[De+3]+ie*P[De+5]+H*P[De+7],pe[3]=ie*P[De+1]-V*P[De+3]+H*P[De+5]-Q*P[De+7],ye[0]=B*(P[De+0]+P[De+4]),ye[3]=B*(P[De+0]-P[De+4]),ye[1]=ge[0]+ge[3],ye[2]=ge[1]-ge[2],Ce[0]=ye[0]+ye[1],Ce[1]=ye[3]+ye[2],Ce[2]=ye[3]-ye[2],Ce[3]=ye[0]-ye[1],P[De+0]=Ce[0]+pe[0],P[De+1]=Ce[1]+pe[1],P[De+2]=Ce[2]+pe[2],P[De+3]=Ce[3]+pe[3],P[De+4]=Ce[3]-pe[3],P[De+5]=Ce[2]-pe[2],P[De+6]=Ce[1]-pe[1],P[De+7]=Ce[0]-pe[0]}for(let Ae=0;Ae<8;++Ae)ge[0]=A*P[16+Ae],ge[1]=J*P[16+Ae],ge[2]=A*P[48+Ae],ge[3]=J*P[48+Ae],pe[0]=Q*P[8+Ae]+H*P[24+Ae]+V*P[40+Ae]+ie*P[56+Ae],pe[1]=H*P[8+Ae]-ie*P[24+Ae]-Q*P[40+Ae]-V*P[56+Ae],pe[2]=V*P[8+Ae]-Q*P[24+Ae]+ie*P[40+Ae]+H*P[56+Ae],pe[3]=ie*P[8+Ae]-V*P[24+Ae]+H*P[40+Ae]-Q*P[56+Ae],ye[0]=B*(P[Ae]+P[32+Ae]),ye[3]=B*(P[Ae]-P[32+Ae]),ye[1]=ge[0]+ge[3],ye[2]=ge[1]-ge[2],Ce[0]=ye[0]+ye[1],Ce[1]=ye[3]+ye[2],Ce[2]=ye[3]-ye[2],Ce[3]=ye[0]-ye[1],P[0+Ae]=Ce[0]+pe[0],P[8+Ae]=Ce[1]+pe[1],P[16+Ae]=Ce[2]+pe[2],P[24+Ae]=Ce[3]+pe[3],P[32+Ae]=Ce[3]-pe[3],P[40+Ae]=Ce[2]-pe[2],P[48+Ae]=Ce[1]-pe[1],P[56+Ae]=Ce[0]-pe[0]}function Oe(P){for(let B=0;B<64;++B){const Q=P[0][B],A=P[1][B],H=P[2][B];P[0][B]=Q+1.5747*H,P[1][B]=Q-.1873*A-.4682*H,P[2][B]=Q+1.8556*A}}function Ye(P,B,Q){for(let A=0;A<64;++A)B[Q+A]=DataUtils.toHalfFloat(st(P[A]))}function st(P){return P<=1?Math.sign(P)*Math.pow(Math.abs(P),2.2):Math.sign(P)*Math.pow(L,Math.abs(P)-1)}function W(P){return new DataView(P.array.buffer,P.offset.value,P.size)}function O(P){const B=P.viewer.buffer.slice(P.offset.value,P.offset.value+P.size),Q=new Uint8Array(Se(B)),A=new Uint8Array(Q.length);return Ue(Q),fe(Q,A),new DataView(A.buffer)}function me(P){const B=P.array.slice(P.offset.value,P.offset.value+P.size),Q=unzlibSync(B),A=new Uint8Array(Q.length);return Ue(Q),fe(Q,A),new DataView(A.buffer)}function Ie(P){const B=P.viewer,Q={value:P.offset.value},A=new Uint16Array(P.width*P.scanlineBlockSize*(P.channels*P.type)),H=new Uint8Array(8192);let V=0;const J=new Array(P.channels);for(let He=0;He<P.channels;He++)J[He]={},J[He].start=V,J[He].end=J[He].start,J[He].nx=P.width,J[He].ny=P.lines,J[He].size=P.type,V+=J[He].nx*J[He].ny*J[He].size;const ie=ae(B,Q),ge=ae(B,Q);if(ge>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(ie<=ge)for(let He=0;He<ge-ie+1;He++)H[He+ie]=je(B,Q);const pe=new Uint16Array(65536),ye=D(H,pe),Ce=Re(B,Q);xe(P.array,B,Q,Ce,A,V);for(let He=0;He<P.channels;++He){const Ve=J[He];for(let $e=0;$e<J[He].size;++$e)ve(A,Ve.start+$e,Ve.nx,Ve.size,Ve.ny,Ve.nx*Ve.size,ye)}ee(pe,A,V);let Ae=0;const De=new Uint8Array(A.buffer.byteLength);for(let He=0;He<P.lines;He++)for(let Ve=0;Ve<P.channels;Ve++){const $e=J[Ve],Ze=$e.nx*$e.size,ct=new Uint8Array(A.buffer,$e.end*2,Ze*2);De.set(ct,Ae),Ae+=Ze*2,$e.end+=Ze}return new DataView(De.buffer)}function Le(P){const B=P.array.slice(P.offset.value,P.offset.value+P.size),Q=unzlibSync(B),A=P.lines*P.channels*P.width,H=P.type==1?new Uint16Array(A):new Uint32Array(A);let V=0,J=0;const ie=new Array(4);for(let ge=0;ge<P.lines;ge++)for(let pe=0;pe<P.channels;pe++){let ye=0;switch(P.type){case 1:ie[0]=V,ie[1]=ie[0]+P.width,V=ie[1]+P.width;for(let Ce=0;Ce<P.width;++Ce){const Ae=Q[ie[0]++]<<8|Q[ie[1]++];ye+=Ae,H[J]=ye,J++}break;case 2:ie[0]=V,ie[1]=ie[0]+P.width,ie[2]=ie[1]+P.width,V=ie[2]+P.width;for(let Ce=0;Ce<P.width;++Ce){const Ae=Q[ie[0]++]<<24|Q[ie[1]++]<<16|Q[ie[2]++]<<8;ye+=Ae,H[J]=ye,J++}break}}return new DataView(H.buffer)}function Y(P){const B=P.viewer,Q={value:P.offset.value},A=new Uint8Array(P.width*P.lines*(P.channels*P.type*2)),H={version:We(B,Q),unknownUncompressedSize:We(B,Q),unknownCompressedSize:We(B,Q),acCompressedSize:We(B,Q),dcCompressedSize:We(B,Q),rleCompressedSize:We(B,Q),rleUncompressedSize:We(B,Q),rleRawSize:We(B,Q),totalAcUncompressedCount:We(B,Q),totalDcUncompressedCount:We(B,Q),acCompression:We(B,Q)};if(H.version<2)throw new Error("EXRLoader.parse: "+Tt.compression+" version "+H.version+" is unsupported");const V=new Array;let J=ae(B,Q)-2;for(;J>0;){const Ve=we(B.buffer,Q),$e=je(B,Q),Ze=$e>>2&3,ct=($e>>4)-1,it=new Int8Array([ct])[0],Qe=je(B,Q);V.push({name:Ve,index:it,type:Qe,compression:Ze}),J-=Ve.length+3}const ie=Tt.channels,ge=new Array(P.channels);for(let Ve=0;Ve<P.channels;++Ve){const $e=ge[Ve]={},Ze=ie[Ve];$e.name=Ze.name,$e.compression=0,$e.decoded=!1,$e.type=Ze.pixelType,$e.pLinear=Ze.pLinear,$e.width=P.width,$e.height=P.lines}const pe={idx:new Array(3)};for(let Ve=0;Ve<P.channels;++Ve){const $e=ge[Ve];for(let Ze=0;Ze<V.length;++Ze){const ct=V[Ze];$e.name==ct.name&&($e.compression=ct.compression,ct.index>=0&&(pe.idx[ct.index]=Ve),$e.offset=Ve)}}let ye,Ce,Ae;if(H.acCompressedSize>0)switch(H.acCompression){case 0:ye=new Uint16Array(H.totalAcUncompressedCount),xe(P.array,B,Q,H.acCompressedSize,ye,H.totalAcUncompressedCount);break;case 1:const Ve=P.array.slice(Q.value,Q.value+H.totalAcUncompressedCount),$e=unzlibSync(Ve);ye=new Uint16Array($e.buffer),Q.value+=H.totalAcUncompressedCount;break}if(H.dcCompressedSize>0){const Ve={array:P.array,offset:Q,size:H.dcCompressedSize};Ce=new Uint16Array(me(Ve).buffer),Q.value+=H.dcCompressedSize}if(H.rleRawSize>0){const Ve=P.array.slice(Q.value,Q.value+H.rleCompressedSize),$e=unzlibSync(Ve);Ae=Se($e.buffer),Q.value+=H.rleCompressedSize}let De=0;const He=new Array(ge.length);for(let Ve=0;Ve<He.length;++Ve)He[Ve]=new Array;for(let Ve=0;Ve<P.lines;++Ve)for(let $e=0;$e<ge.length;++$e)He[$e].push(De),De+=ge[$e].width*P.type*2;Me(pe,He,ge,ye,Ce,A);for(let Ve=0;Ve<ge.length;++Ve){const $e=ge[Ve];if(!$e.decoded)switch($e.compression){case 2:let Ze=0,ct=0;for(let it=0;it<P.lines;++it){let Qe=He[Ve][Ze];for(let ut=0;ut<$e.width;++ut){for(let Ke=0;Ke<2*$e.type;++Ke)A[Qe++]=Ae[ct+Ke*$e.width*$e.height];ct++}Ze++}break;case 1:default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(A.buffer)}function we(P,B){const Q=new Uint8Array(P);let A=0;for(;Q[B.value+A]!=0;)A+=1;const H=new TextDecoder().decode(Q.slice(B.value,B.value+A));return B.value=B.value+A+1,H}function Ee(P,B,Q){const A=new TextDecoder().decode(new Uint8Array(P).slice(B.value,B.value+Q));return B.value=B.value+Q,A}function Fe(P,B){const Q=tt(P,B),A=Re(P,B);return[Q,A]}function Xe(P,B){const Q=Re(P,B),A=Re(P,B);return[Q,A]}function tt(P,B){const Q=P.getInt32(B.value,!0);return B.value=B.value+4,Q}function Re(P,B){const Q=P.getUint32(B.value,!0);return B.value=B.value+4,Q}function ot(P,B){const Q=P[B.value];return B.value=B.value+1,Q}function je(P,B){const Q=P.getUint8(B.value);return B.value=B.value+1,Q}const We=function(P,B){let Q;return"getBigInt64"in DataView.prototype?Q=Number(P.getBigInt64(B.value,!0)):Q=P.getUint32(B.value+4,!0)+Number(P.getUint32(B.value,!0)<<32),B.value+=8,Q};function Ge(P,B){const Q=P.getFloat32(B.value,!0);return B.value+=4,Q}function qe(P,B){return DataUtils.toHalfFloat(Ge(P,B))}function Pe(P){const B=(P&31744)>>10,Q=P&1023;return(P>>15?-1:1)*(B?B===31?Q?NaN:1/0:Math.pow(2,B-15)*(1+Q/1024):6103515625e-14*(Q/1024))}function ae(P,B){const Q=P.getUint16(B.value,!0);return B.value+=2,Q}function ke(P,B){return Pe(ae(P,B))}function Ne(P,B,Q,A){const H=Q.value,V=[];for(;Q.value<H+A-1;){const J=we(B,Q),ie=tt(P,Q),ge=je(P,Q);Q.value+=3;const pe=tt(P,Q),ye=tt(P,Q);V.push({name:J,pixelType:ie,pLinear:ge,xSampling:pe,ySampling:ye})}return Q.value+=1,V}function be(P,B){const Q=Ge(P,B),A=Ge(P,B),H=Ge(P,B),V=Ge(P,B),J=Ge(P,B),ie=Ge(P,B),ge=Ge(P,B),pe=Ge(P,B);return{redX:Q,redY:A,greenX:H,greenY:V,blueX:J,blueY:ie,whiteX:ge,whiteY:pe}}function ze(P,B){const Q=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],A=je(P,B);return Q[A]}function Je(P,B){const Q=Re(P,B),A=Re(P,B),H=Re(P,B),V=Re(P,B);return{xMin:Q,yMin:A,xMax:H,yMax:V}}function at(P,B){const Q=["INCREASING_Y"],A=je(P,B);return Q[A]}function pt(P,B){const Q=Ge(P,B),A=Ge(P,B);return[Q,A]}function xt(P,B){const Q=Ge(P,B),A=Ge(P,B),H=Ge(P,B);return[Q,A,H]}function ht(P,B,Q,A,H){if(A==="string"||A==="stringvector"||A==="iccProfile")return Ee(B,Q,H);if(A==="chlist")return Ne(P,B,Q,H);if(A==="chromaticities")return be(P,Q);if(A==="compression")return ze(P,Q);if(A==="box2i")return Je(P,Q);if(A==="lineOrder")return at(P,Q);if(A==="float")return Ge(P,Q);if(A==="v2f")return pt(P,Q);if(A==="v3f")return xt(P,Q);if(A==="int")return tt(P,Q);if(A==="rational")return Fe(P,Q);if(A==="timecode")return Xe(P,Q);if(A==="preview")return Q.value+=H,"skipped";Q.value+=H}function gt(P,B,Q){const A={};if(P.getUint32(0,!0)!=20000630)throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");A.version=P.getUint8(4);const H=P.getUint8(5);A.spec={singleTile:!!(H&2),longName:!!(H&4),deepFormat:!!(H&8),multiPart:!!(H&16)},Q.value=8;let V=!0;for(;V;){const J=we(B,Q);if(J==0)V=!1;else{const ie=we(B,Q),ge=Re(P,Q),pe=ht(P,B,Q,ie,ge);pe===void 0?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${ie}'.`):A[J]=pe}}if(H&-5)throw console.error("THREE.EXRHeader:",A),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return A}function yt(P,B,Q,A,H){const V={size:0,viewer:B,array:Q,offset:A,width:P.dataWindow.xMax-P.dataWindow.xMin+1,height:P.dataWindow.yMax-P.dataWindow.yMin+1,channels:P.channels.length,bytesPerLine:null,lines:null,inputSize:null,type:P.channels[0].pixelType,uncompress:null,getter:null,format:null,colorSpace:LinearSRGBColorSpace};switch(P.compression){case"NO_COMPRESSION":V.lines=1,V.uncompress=W;break;case"RLE_COMPRESSION":V.lines=1,V.uncompress=O;break;case"ZIPS_COMPRESSION":V.lines=1,V.uncompress=me;break;case"ZIP_COMPRESSION":V.lines=16,V.uncompress=me;break;case"PIZ_COMPRESSION":V.lines=32,V.uncompress=Ie;break;case"PXR24_COMPRESSION":V.lines=16,V.uncompress=Le;break;case"DWAA_COMPRESSION":V.lines=32,V.uncompress=Y;break;case"DWAB_COMPRESSION":V.lines=256,V.uncompress=Y;break;default:throw new Error("EXRLoader.parse: "+P.compression+" is unsupported")}if(V.scanlineBlockSize=V.lines,V.type==1)switch(H){case FloatType:V.getter=ke,V.inputSize=2;break;case HalfFloatType:V.getter=ae,V.inputSize=2;break}else if(V.type==2)switch(H){case FloatType:V.getter=Ge,V.inputSize=4;break;case HalfFloatType:V.getter=qe,V.inputSize=4}else throw new Error("EXRLoader.parse: unsupported pixelType "+V.type+" for "+P.compression+".");V.blockCount=(P.dataWindow.yMax+1)/V.scanlineBlockSize;for(let ie=0;ie<V.blockCount;ie++)We(B,A);V.outputChannels=V.channels==3?4:V.channels;const J=V.width*V.height*V.outputChannels;switch(H){case FloatType:V.byteArray=new Float32Array(J),V.channels<V.outputChannels&&V.byteArray.fill(1,0,J);break;case HalfFloatType:V.byteArray=new Uint16Array(J),V.channels<V.outputChannels&&V.byteArray.fill(15360,0,J);break;default:console.error("THREE.EXRLoader: unsupported type: ",H);break}return V.bytesPerLine=V.width*V.inputSize*V.channels,V.outputChannels==4?(V.format=RGBAFormat,V.colorSpace=LinearSRGBColorSpace):(V.format=RedFormat,V.colorSpace=NoColorSpace),V}const Mt=new DataView(e),Et=new Uint8Array(e),St={value:0},Tt=gt(Mt,e,St),nt=yt(Tt,Mt,Et,St,this.type),Rt={value:0},Ct={R:0,G:1,B:2,A:3,Y:0};for(let P=0;P<nt.height/nt.scanlineBlockSize;P++){const B=Re(Mt,St);nt.size=Re(Mt,St),nt.lines=B+nt.scanlineBlockSize>nt.height?nt.height-B:nt.scanlineBlockSize;const A=nt.size<nt.lines*nt.bytesPerLine?nt.uncompress(nt):W(nt);St.value+=nt.size;for(let H=0;H<nt.scanlineBlockSize;H++){const V=H+P*nt.scanlineBlockSize;if(V>=nt.height)break;for(let J=0;J<nt.channels;J++){const ie=Ct[Tt.channels[J].name];for(let ge=0;ge<nt.width;ge++){Rt.value=(H*(nt.channels*nt.width)+J*nt.width+ge)*nt.inputSize;const pe=(nt.height-1-V)*(nt.width*nt.outputChannels)+ge*nt.outputChannels+ie;nt.byteArray[pe]=nt.getter(A,Rt)}}}}return{header:Tt,width:nt.width,height:nt.height,data:nt.byteArray,format:nt.format,colorSpace:nt.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,r,n){function a(l,c){l.colorSpace=c.colorSpace,l.minFilter=LinearFilter,l.magFilter=LinearFilter,l.generateMipmaps=!1,l.flipY=!1,t&&t(l,c)}return super.load(e,a,r,n)}}const AnyItem$2=properties.loader.ITEM_CLASSES.any;class EXRItem extends AnyItem$2{constructor(e,t){super(e,{...t,responseType:"type"}),this.EXRLoader=new EXRLoader}retrieve(){return!1}_onLoad(e){this.content=e,super._onLoad(this)}loadFunc(){this.EXRLoader.load(this.url,this._onLoad.bind(this),this._onGLTFLoading.bind(this))}_onGLTFLoading(e){this.hasLoading&&this.loadingSignal.dispatch(e.loaded/e.total)}}EXRItem.type="exr";EXRItem.extensions=["exr"];const ImageItem=properties.loader.ITEM_CLASSES.image;class TextureItem extends ImageItem{constructor(e,t){let r=t.content||new Texture(new Image);switch(t.content=r.image,r.size=new Vector2,r.minFilter=t.minFilter||LinearMipMapLinearFilter,r.minFilter){case NearestMipMapNearestFilter:case NearestMipMapLinearFilter:case LinearMipMapNearestFilter:case LinearMipMapLinearFilter:r.generateMipmaps=!0,r.anisotropy=t.anisotropy||properties.renderer.capabilities.getMaxAnisotropy();break;default:r.generateMipmaps=!1}r.flipY=t.flipY===void 0?!0:t.flipY,t.wrap?r.wrapS=r.wrapT=t.wrap:(t.wrapS&&(r.wrapS=t.wrapS),t.wrapT&&(r.wrapT=t.wrapT)),super(e,t),this.content=r}retrieve(){return!1}load(){this.isStartLoaded=!0;let e=this.content.image;e.onload=this.boundOnLoad,e.src=this.url}_onLoad(){delete this.content.image.onload,this.width=this.content.image.width,this.height=this.content.image.height,this.content.size.set(this.width,this.height),this.content.needsUpdate=!0,taskManager.add(this.content),this.onPost?this.onPost.call(this,this.content,this.onPostLoadingSignal):this._onLoadComplete()}}TextureItem.type="texture";TextureItem.extensions=[];const AnyItem$1=properties.loader.ITEM_CLASSES.any;class ThreeLoaderItem extends AnyItem$1{constructor(e,t){t.loadFunc=()=>{},t.hasLoading=t.hasLoading===void 0?!0:t.hasLoading,super(e,t),!t.loader&&console&&(console.error||console.log)("loader is required."),this.loadFunc=this._loadFunc.bind(this)}_loadFunc(e,t,r){this.loader.load(e,this._onLoaderLoad.bind(this,t),this._onLoaderLoading.bind(this,r))}_onLoaderLoad(e,t){this.content=t,e(t)}_onLoaderLoading(e,t){e.dispatch(t.loaded/t.total)}}ThreeLoaderItem.type="three-loader";ThreeLoaderItem.extensions=[];const shader=`#define GLSLIFY 1
uniform vec2 u_glPositionOffset;vec4 glPositionOffset(vec4 glPosition){return glPosition+vec4(u_glPositionOffset*glPosition.w,0.0,0.0);}`;class GlPositionOffset{offset=new Vector2;sharedUniforms={u_glPositionOffset:{value:null}};init(){this.sharedUniforms.u_glPositionOffset.value=this.offset,shaderHelper.addChunk("glPositionOffset",shader)}setOffset(e,t){return this.offset.set(e,t)}}const glPositionOffset=new GlPositionOffset;class Support{isSupported(){return properties._isSupportedDevice=!0,properties._isSupportedBrowser=(browser$1.isChrome||browser$1.isSafari||browser$1.isEdge||browser$1.isFirefox||browser$1.isOpera)&&!browser$1.isIE,properties._isSupportedWebGL=this.checkSupportWebGL(),properties._isSupportedWebGL}checkSupportWebGL(){if(!(properties.canvas instanceof HTMLCanvasElement))return!1;if(settings.USE_WEBGL2&&window.WebGL2RenderingContext)try{return properties.gl=properties.canvas.getContext("webgl2",properties.webglOpts),settings.RENDER_TARGET_FLOAT_TYPE=HalfFloatType,settings.DATA_FLOAT_TYPE=FloatType,!0}catch(e){return console.error(e),!1}if(settings.USE_WEBGL2=!1,window.WebGLRenderingContext)try{let e=properties.gl=properties.canvas.getContext("webgl",properties.webglOpts)||properties.canvas.getContext("experimental-webgl",properties.webglOpts);if((e.getExtension("OES_texture_float")||e.getExtension("OES_texture_half_float"))&&e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS))settings.RENDER_TARGET_FLOAT_TYPE=browser$1.isIOS||e.getExtension("OES_texture_half_float")?HalfFloatType:FloatType,settings.DATA_FLOAT_TYPE=FloatType;else return settings.USE_FLOAT_PACKING=!0,settings.RENDER_TARGET_FLOAT_TYPE=settings.DATA_FLOAT_TYPE=UnsignedByteType,!1;return!0}catch(e){return console.error(e),!1}return!1}}const support=new Support,textureBicubicShader=`#define GLSLIFY 1
vec4 cubic(float v){vec4 n=vec4(1.0,2.0,3.0,4.0)-v;vec4 s=n*n*n;float x=s.x;float y=s.y-4.0*s.x;float z=s.z-4.0*s.y+6.0*s.x;float w=6.0-x-y-z;return vec4(x,y,z,w);}vec4 textureBicubic(sampler2D t,vec2 texCoords,vec2 textureSize){vec2 invTexSize=1.0/textureSize;texCoords=texCoords*textureSize-0.5;vec2 fxy=fract(texCoords);texCoords-=fxy;vec4 xcubic=cubic(fxy.x);vec4 ycubic=cubic(fxy.y);vec4 c=texCoords.xxyy+vec2(-0.5,1.5).xyxy;vec4 s=vec4(xcubic.xz+xcubic.yw,ycubic.xz+ycubic.yw);vec4 offset=c+vec4(xcubic.yw,ycubic.yw)/s;offset*=invTexSize.xxyy;vec4 sample0=texture2D(t,offset.xz);vec4 sample1=texture2D(t,offset.yz);vec4 sample2=texture2D(t,offset.xw);vec4 sample3=texture2D(t,offset.yw);float sx=s.x/(s.x+s.y);float sy=s.z/(s.z+s.w);return mix(mix(sample3,sample2,sx),mix(sample1,sample0,sx),sy);}vec4 textureBicubic(sampler2D t,vec2 texCoords,vec2 textureSize,vec4 clampRect){vec2 invTexSize=1.0/textureSize;texCoords=texCoords*textureSize-0.5;vec2 fxy=fract(texCoords);texCoords-=fxy;vec4 xcubic=cubic(fxy.x);vec4 ycubic=cubic(fxy.y);vec4 c=texCoords.xxyy+vec2(-0.5,1.5).xyxy;vec4 s=vec4(xcubic.xz+xcubic.yw,ycubic.xz+ycubic.yw);vec4 offset=c+vec4(xcubic.yw,ycubic.yw)/s;offset*=invTexSize.xxyy;vec4 sample0=texture2D(t,clamp(offset.xz,clampRect.xy,clampRect.zw));vec4 sample1=texture2D(t,clamp(offset.yz,clampRect.xy,clampRect.zw));vec4 sample2=texture2D(t,clamp(offset.xw,clampRect.xy,clampRect.zw));vec4 sample3=texture2D(t,clamp(offset.yw,clampRect.xy,clampRect.zw));float sx=s.x/(s.x+s.y);float sy=s.z/(s.z+s.w);return mix(mix(sample3,sample2,sx),mix(sample1,sample0,sx),sy);}`;class App{initEngine(){if(properties.canvas=document.getElementById("canvas"),properties.isSupported=support.isSupported(),properties.isSupported){properties.loader.register(BufItem),properties.loader.register(EXRItem),properties.loader.register(TextureItem),properties.loader.register(ThreeLoaderItem),properties.renderer=new WebGLRenderer({canvas:properties.canvas,context:properties.gl,premultipliedAlpha:!1}),properties.scene=new Scene,properties.camera=new PerspectiveCamera(45,1,.1,200),properties.scene.add(properties.camera),properties.sharedUniforms.u_resolution.value=properties.resolution=new Vector2,properties.sharedUniforms.u_viewportResolution.value=properties.viewportResolution=new Vector2,properties.sharedUniforms.u_bgColor.value=properties.bgColor=new Color,shaderHelper.addChunk("textureBicubic",textureBicubicShader),fboHelper.init(properties.renderer,settings.RENDER_TARGET_FLOAT_TYPE),textureHelper.init(),properties.postprocessing=new Postprocessing,properties.postprocessing.init(),blueNoise.preInit(),glPositionOffset.init(),screenPaint.init(),properties.smaa=new Smaa,properties.smaa.init(),properties.smaa.setTextures(properties.loader.add(settings.TEXTURE_PATH+"smaa-area.png",{weight:32}).content,properties.loader.add(settings.TEXTURE_PATH+"smaa-search.png",{weight:.1}).content),properties.postprocessing.queue.push(properties.smaa);let e=!browser$1.isMobile||settings.USE_HD;properties.bloom=new Bloom,properties.bloom.init({USE_CONVOLUTION:e,USE_HD:e}),properties.postprocessing.queue.push(properties.bloom),properties.screenPaintDistortion=new ScreenPaintDistortion,properties.screenPaintDistortion.init({screenPaint}),properties.postprocessing.queue.push(properties.screenPaintDistortion),properties.final=new Final,properties.final.init(),properties.postprocessing.queue.push(properties.final),settings.UP_SCALE>1&&(properties.upscaler=new Fsr,properties.upscaler.init(),properties.postprocessing.queue.push(properties.upscaler)),preUfx.init(),properties.postprocessing.queue.push(preUfx),postUfx.init(),properties.postprocessing.queue.push(postUfx)}}preInit(){settings.WEBGL_OFF||(cameraControls.preInit(),visuals.preInit(),audios.preInit())}init(){settings.WEBGL_OFF||(properties.smaa&&properties.smaa.updateTextures(),cameraControls.init(),visuals.init(),audios.init(),settings.IS_DEV===!1&&(console.clear&&console.clear(),console.log("%c Created by Lusion: https://lusion.co/","border:2px solid gray; padding:5px; font-family:monospace; font-size:11px;")))}start(){visuals.start()}resize(e,t){settings.WEBGL_OFF||(properties.renderer.setSize(e,t),properties.canvas.style.width=`${properties.viewportWidth}px`,properties.canvas.style.height=`${properties.viewportHeight}px`,properties.camera.aspect=properties.width/properties.height,properties.sharedUniforms.u_aspect.value=properties.camera.aspect,properties.camera.updateProjectionMatrix(),properties.postprocessing.setSize(properties.width,properties.height),screenPaint.resize(properties.width,properties.height),visuals.resize(properties.width,properties.height))}preUpdate(e=0){visuals.deactivateAll()}update(e=0){settings.WEBGL_OFF||(properties.time=properties.sharedUniforms.u_time.value+=e,properties.deltaTime=properties.sharedUniforms.u_deltaTime.value=e,visuals.syncProperties(e),blueNoise.update(e),screenPaint.update(e),cameraControls.update(e),visuals.update(e),audios.update(e),properties.renderer.setClearColor(properties.bgColor,properties.clearAlpha),properties.bgColor.setStyle(properties.bgColorHex),aboutPageHeroEfxPrepass.isActive=aboutHero.isActive,aboutPageHeroEfx.isActive=aboutHero.isActive,goalTunnelEfx.isActive=goalTunnels.isActive,properties.bloom.amount=properties.bloomAmount,properties.bloom.radius=properties.bloomRadius,properties.bloom.threshold=properties.bloomThreshold,properties.bloom.smoothWidth=properties.bloomSmoothWidth,properties.bloom.haloWidth=properties.haloWidth,properties.bloom.haloRGBShift=properties.haloRGBShift,properties.bloom.haloStrength=properties.haloStrength,properties.bloom.haloMaskInner=properties.haloMaskInner,properties.bloom.haloMaskOuter=properties.haloMaskOuter,properties.bloom.saturation=properties.bloomSaturation,properties.bloom.highPassMultiplier=properties.bloomHighPassMultiplier*(properties.bloom.USE_CONVOLUTION?1:1.5),properties.final.isActive=properties.useFinal,properties.final.vignetteFrom=properties.vignetteFrom,properties.final.vignetteTo=properties.vignetteTo,properties.final.vignetteColor.setStyle(properties.vignetteColorHex),properties.final.saturation=properties.saturation,properties.final.contrast=properties.contrast,properties.final.brightness=properties.brightness,properties.final.tintColor.setStyle(properties.tintColorHex),properties.final.tintOpacity=properties.tintOpacity,properties.final.bgColor.setStyle(properties.bgColorHex),properties.final.opacity=properties.opacity,screenPaint.needsMouseDown=properties.screenPaintNeedsMouseDown,screenPaint.minRadius=0,screenPaint.maxRadius=Math.max(40,properties.viewportWidth/20),screenPaint.radiusDistanceRange=properties.screenPaintRadiusDistanceRange,screenPaint.pushStrength=properties.screenPaintPushStrength,screenPaint.velocityDissipation=properties.screenPaintVelocityDissipation,screenPaint.weight1Dissipation=properties.screenPaintWeight1Dissipation,screenPaint.weight2Dissipation=properties.screenPaintWeight2Dissipation,screenPaint.useNoise=properties.screenPaintUseNoise,screenPaint.curlScale=properties.screenPaintCurlScale,screenPaint.curlStrength=properties.screenPaintCurlStrength,properties.screenPaintDistortion.amount=properties.screenPaintDistortionAmount,properties.screenPaintDistortion.rgbShift=properties.screenPaintDistortionRGBShift,properties.screenPaintDistortion.colorMultiplier=properties.screenPaintDistortionColorMultiplier,properties.screenPaintDistortion.multiplier=properties.screenPaintDistortionMultiplier,properties.upscaler&&(properties.upscaler.sharpness=properties.upscalerSharpness),transitionOverlay.activeRatio<1&&properties.postprocessing.render(visuals.currentStage3D,properties.camera,!0),window.__debugTexture&&fboHelper.debugTo(window.__debugTexture))}}const app=new App;class Preloader{percentTarget=0;percent=0;percentToStart=0;DELAY=1.5;MIN_PRELOAD_DURATION=1;PERCENT_BETWEEN_INIT_AND_START=.3;MIN_DURATION_BETWEEN_INIT_AND_START=.25;HIDE_DURATION=.5;isActive=!1;lineTransformTime=0;digitsWidth=0;preInit(){this.domContainer=document.getElementById("preloader"),this.domDigitsContainer=document.getElementById("preloader-percent-digits"),this.domDigits=document.querySelectorAll(".preloader-percent-digit");for(let e=0;e<this.domDigits.length;e++){let t=this.domDigits[e];t._domNums=t.querySelectorAll(".preloader-percent-digit-num"),t._easedVal=0}}init(){}show(e,t){this._initCallback=e,this._startCallback=t,this.isActive=!0,properties.loader.start(r=>{this.percentTarget=r})}hide(){}resize(e,t,r){r!==!0&&(this.digitsWidth=this.domDigitsContainer.offsetWidth)}update(e){if(!this.isActive)return;this.percent=Math.min(this.percentTarget,this.percent+(settings.SKIP_ANIMATION?1:this.percentTarget>this.percent?e:0)/this.MIN_PRELOAD_DURATION),this.percentTarget==1&&(properties.hasInitialized||this._initCallback(),this.percentToStart=settings.SKIP_ANIMATION?1:Math.min(taskManager.percent,this.percentToStart+e/this.MIN_DURATION_BETWEEN_INIT_AND_START));let t=this.percentToStart*this.PERCENT_BETWEEN_INIT_AND_START+this.percent*(1-this.PERCENT_BETWEEN_INIT_AND_START),r=0;t==1&&(this.lineTransformTime+=settings.SKIP_ANIMATION?1:e,r=ease.expoInOut(math.saturate(this.lineTransformTime))),r==1&&!properties.hasStarted&&this._startCallback();let n=settings.SKIP_ANIMATION?+properties.hasStarted:math.saturate(properties.startTime);for(let a=0;a<this.domDigits.length;a++){let l=this.domDigits[a],c=Math.floor(t*100/Math.pow(10,this.domDigits.length-a-1));l._easedVal=math.mix(l._easedVal,c,1-Math.exp(-7*e)),c-l._easedVal<.01&&(l._easedVal=c);let u=l._easedVal%10,f=Math.floor(u),p=Math.ceil(u)%10,g=u-f;l._domNums[0].innerHTML=f,l._domNums[1].innerHTML=p,l.style.transform="translateY("+-(g-ease.expoInOut(math.saturate(n*1.2-.2*a/(this.domDigits.length-1))))*50+"%) translateY(-0.05em)"}transitionOverlay.loadBarRatio=t,transitionOverlay.lineTransformRatio=r,transitionOverlay.contentShowRatio=n,n==1&&(this.domContainer.style.display="none",this.isActive=!1)}}const preloader=new Preloader;class Links{links=[];preInit(){Array.from(document.querySelectorAll(".is-link")).forEach(t=>{const r={el:t,canvas:document.createElement("canvas"),context:null,ratio:0,animating:!1,color:t.classList.contains("is-email")?"#000000":"#ffffff"};r.context=r.canvas.getContext("2d"),r.el.style.position="relative",r.el.style.width="fit-content",r.canvas.style.position="absolute",r.canvas.style.left="0",r.canvas.style.top="0",r.canvas.style.pointerEvents="none",r.el.append(r.canvas),this.links.push(r)})}init(){this.links.forEach(e=>{e.el.addEventListener("mouseenter",this._onLinkMouseenter.bind(this)),e.el.addEventListener("mouseleave",this._onLinkMouseleave.bind(this))})}resize(){this.links.forEach(e=>{const t=e.el.getBoundingClientRect();e._width=t.width,e._height=t.height,e.canvas.width=e._width*settings.DPR,e.canvas.height=e._height*settings.DPR,e.canvas.style.width=e._width+"px",e.canvas.style.height=e._height+"px"})}update(e){this.links.forEach(t=>{let r=t.ratio;if(t.ratio=math.saturate(t.ratio+(t.animating?1:-1)*e*3),t.ratio!==0||r!==t.ratio){const n=ease.quadInOut(t.ratio),a=ease.quadOut(Math.abs(t.ratio*2-1));t.context.save(),t.context.scale(settings.DPR,settings.DPR),t.context.lineWidth=2,t.context.strokeStyle=t.color,t.context.clearRect(0,0,t._width,t._height),t.context.beginPath(),t.context.moveTo(0,t._height-t.context.lineWidth/2),t.context.arcTo(t._width*n,t._height-t.context.lineWidth/2,t._width*n,t._height-t.context.lineWidth/2-1,30*(1-a)),t.context.stroke(),t.context.restore()}})}_onLinkMouseenter(e){const t=this.links.filter(r=>r.el===e.target)[0];t.animating=!0}_onLinkMouseleave(e){const t=this.links.filter(r=>r.el===e.target)[0];t.animating=!1}}const links=new Links;new Color;class UI{domSectionsContainer=document.querySelector("#page-container");preInit(){settings.WEBGL_OFF||document.documentElement.classList.add("is-ready"),transitionOverlay.init(),preloader.preInit(),header.preInit(),links.preInit(),pageExtraSections.preInit()}preload(e,t){preloader.show(e,t)}init(){header.init(),links.init(),pageExtraSections.init()}start(){preloader.hide(),header.show()}resize(e,t,r){transitionOverlay.resize(e,t),preloader.resize(e,t,r),links.resize(e,t),header.resize(e,t),pageExtraSections.resize(e,t),videoOverlay.resize(e,t);const a=getComputedStyle(document.documentElement).getPropertyValue("--global-border-radius").split("px")[0];properties.globalRadius=properties.sharedUniforms.u_globalRadius.value=parseInt(a)}update(e){preloader.update(e),transitionOverlay.update(e),links.update(e),header.update(e),pageExtraSections.update(e),videoOverlay.update(e)}}const ui=new UI,AnyItem=properties.loader.ITEM_CLASSES.any;class FontItem extends AnyItem{constructor(e,t){FontItem.dom||FontItem.initDom(),t.loadFunc=()=>{},t.hasLoading=t.hasLoading===void 0?!0:t.hasLoading,t.refText="refing something...",t.refFontSize=t.refFontSize||120,t.refFont="Helvetica, Arial, FreeSans, Garuda, sans-serif",t.interval=t.interval||20,t.refTextWidth=0,super(e,t),this.loadFunc=this._loadFunc.bind(this)}static dom;static initDom(){let e=document.createElement("dom");e.style.position="fixed",e.style.left=e.style.top=0,e.style.visibility="hidden",document.body.appendChild(e),FontItem.dom=e}_loadFunc(e,t,r){let n=e.split(","),a=[];for(let g=0;g<n.length;g++)a.push(n[g].trim());n=this.refFont.split(":");let l=n[0],c=n[1]||"normal",u=n[2]||"normal",f,p=a.length;f=setInterval(()=>{n=a[0].split(":"),l=n[0],c=n[1]||"normal",u=n[2]||"normal";let g=this._getTextWidth(l,c,u,this.refFont),v=this._getTextWidth(this.refFont,c,u,this.refFont);g!==v&&(a.shift(),r.dispatch((p-a.length)/p),a.length===0&&(clearInterval(f),t()))},this.interval)}_getTextWidth=(e,t,r,n)=>{let a=FontItem.dom;return a.style.fontFamily='"'+e+'"'+(n?", "+n:""),a.style.fontWeight=t,a.style.fontStyle=r,a.innerHTML=this.refText,a.getBoundingClientRect().width};_onLoaderLoad(e,t){this.content=t,e(t)}_onLoaderLoading(e,t){e.dispatch(t.loaded/t.total)}}FontItem.type="font";FontItem.extensions=[];let dateTime=performance.now(),_needsResize=!1;function preRun(){for(const[o,e]of Object.entries(settings.CROSS_ORIGINS))properties.loader.setCrossOrigin(o,e);routeManager.init(),properties.loader.register(FontItem),properties.loader.add("Aeonik:400",{type:"font"}),properties.loader.start(o=>{o===1&&run()})}function run(){let o=properties.viewportWidth=window.innerWidth,e=properties.viewportHeight=window.innerHeight;properties.viewportResolution=new Vector2(o,e),properties.width=o,properties.height=e,properties.loader.add("Aeonik:500,Aeonik:400:italic,IBMPlexMono:400,IBMPlexMono:500,LusionMono:400",{type:"font"}),app.initEngine(),input.preInit(),scrollManager.init(),pagesManager.preInit(),ui.preInit(),app.preInit(),window.addEventListener("resize",onResize),_onResize(),loop(),ui.preload(init,start)}function init(){input.init(),pagesManager.init(),ui.init(),app.init(),properties.hasInitialized=!0}function start(){ui.start(),pagesManager.start(),app.start(),properties.hasStarted=!0,_onResize(!0),scrollManager.isActive=!0,settings.JUMP_SECTION!==""&&scrollManager.scrollTo(settings.JUMP_SECTION,settings.JUMP_OFFSET,!0)}function onResize(){_needsResize=!0}function _onResize(o){let e=properties.viewportWidth=window.innerWidth,t=properties.viewportHeight=window.innerHeight;properties.viewportResolution.set(e,window.innerHeight),properties.useMobileLayout=e<=settings.MOBILE_WIDTH,document.documentElement.style.setProperty("--vh",t*.01+"px");let r=e*settings.DPR,n=t*settings.DPR;if(settings.USE_PIXEL_LIMIT===!0&&r*n>settings.MAX_PIXEL_COUNT){let a=r/n;n=Math.sqrt(settings.MAX_PIXEL_COUNT/a),r=Math.ceil(n*a),n=Math.ceil(n)}properties.width=r,properties.height=n,properties.webglDPR=properties.width/e,properties.resolution.set(properties.width,properties.height),o||input.resize(),scrollManager.resize(e,t),pagesManager.resize(e,t),ui.resize(e,t,o),app.resize(Math.ceil(r*properties.upscalerAmount),Math.ceil(n*properties.upscalerAmount)),scrollManager.resize(e,t)}function update(o){scrollManager.autoScrollSpeed=properties.autoScrollSpeed,window.__AUTO_SCROLL__&&(scrollManager.autoScrollSpeed=window.__AUTO_SCROLL__),taskManager.update(),properties.reset(),app.preUpdate(o),input.update(o),scrollManager.update(o),pagesManager.update(o),ui.update(o),app.update(o),input.postUpdate(o)}function loop(){window.requestAnimationFrame(loop);let o=performance.now(),e=(o-dateTime)/1e3;dateTime=o,e=Math.min(e,1/20),_needsResize&&_onResize(),properties.hasStarted&&(properties.startTime+=e),Tween.autoUpdate(e),update(e),_needsResize=!1}preRun();Object.assign||document.documentElement.classList.add("not-supported not-supported--browser");document.documentElement.classList.remove("no-js");/(ipad|iphone|android)/i.test((navigator.userAgent||navigator.vendor).toLowerCase())?document.documentElement.classList.add("is-mobile"):document.documentElement.classList.add("is-desktop");function preventZoom(o){o.preventDefault(),document.body.style.zoom=1}window.addEventListener("wheel",o=>o.preventDefault(),{passive:!1});document.addEventListener("gesturestart",o=>preventZoom(o));document.addEventListener("gesturechange",o=>preventZoom(o));document.addEventListener("gestureend",o=>preventZoom(o));